Completed
Push — master ( 553331...19ae00 )
by Yannick
07:35
created
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.
Indentation   +1457 added lines, -1457 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();
@@ -149,14 +149,14 @@  discard block
 block discarded – undo
149 149
 	}
150 150
 
151 151
 	/**
152
-	* Executes the SQL statements to get the spotter information
153
-	*
154
-	* @param String $query the SQL query
155
-	* @param Array $params parameter of the query
156
-	* @param String $limitQuery the limit query
157
-	* @return Array the spotter information
158
-	*
159
-	*/
152
+	 * Executes the SQL statements to get the spotter information
153
+	 *
154
+	 * @param String $query the SQL query
155
+	 * @param Array $params parameter of the query
156
+	 * @param String $limitQuery the limit query
157
+	 * @return Array the spotter information
158
+	 *
159
+	 */
160 160
 	public function getDataFromDB($query, $params = array(), $limitQuery = '',$schedules = false)
161 161
 	{
162 162
 		global $globalSquawkCountry, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalAirlinesSource, $globalVAM;
@@ -323,11 +323,11 @@  discard block
 block discarded – undo
323 323
 					if ($aircraft_array[0]['aircraft_shadow'] != NULL) {
324 324
 						$temp_array['aircraft_shadow'] = $aircraft_array[0]['aircraft_shadow'];
325 325
 					} else $temp_array['aircraft_shadow'] = 'default.png';
326
-                                } else {
327
-                            		$temp_array['aircraft_shadow'] = 'default.png';
326
+								} else {
327
+									$temp_array['aircraft_shadow'] = 'default.png';
328 328
 					$temp_array['aircraft_name'] = 'N/A';
329 329
 					$temp_array['aircraft_manufacturer'] = 'N/A';
330
-                            	}
330
+								}
331 331
 			}
332 332
 			$fromsource = NULL;
333 333
 			if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource;
@@ -523,11 +523,11 @@  discard block
 block discarded – undo
523 523
 	
524 524
 	
525 525
 	/**
526
-	* Gets all the spotter information
527
-	*
528
-	* @return Array the spotter information
529
-	*
530
-	*/
526
+	 * Gets all the spotter information
527
+	 *
528
+	 * @return Array the spotter information
529
+	 *
530
+	 */
531 531
 	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())
532 532
 	{
533 533
 		global $globalTimezone, $globalDBdriver;
@@ -874,11 +874,11 @@  discard block
 block discarded – undo
874 874
 	
875 875
 	
876 876
 	/**
877
-	* Gets all the spotter information based on the latest data entry
878
-	*
879
-	* @return Array the spotter information
880
-	*
881
-	*/
877
+	 * Gets all the spotter information based on the latest data entry
878
+	 *
879
+	 * @return Array the spotter information
880
+	 *
881
+	 */
882 882
 	public function getLatestSpotterData($limit = '', $sort = '', $filter = array())
883 883
 	{
884 884
 		global $global_query;
@@ -917,12 +917,12 @@  discard block
 block discarded – undo
917 917
 	}
918 918
     
919 919
     
920
-    /**
921
-	* Gets all the spotter information based on a user's latitude and longitude
922
-	*
923
-	* @return Array the spotter information
924
-	*
925
-	*/
920
+	/**
921
+	 * Gets all the spotter information based on a user's latitude and longitude
922
+	 *
923
+	 * @return Array the spotter information
924
+	 *
925
+	 */
926 926
 	public function getLatestSpotterForLayar($lat, $lng, $radius, $interval)
927 927
 	{
928 928
 		date_default_timezone_set('UTC');
@@ -950,7 +950,7 @@  discard block
 block discarded – undo
950 950
 				return false;
951 951
 			}
952 952
 		}
953
-    		$additional_query = '';
953
+			$additional_query = '';
954 954
 		if ($interval != "")
955 955
 		{
956 956
 			if (!is_string($interval))
@@ -990,12 +990,12 @@  discard block
 block discarded – undo
990 990
 	}
991 991
     
992 992
     
993
-    /**
994
-	* Gets all the spotter information sorted by the newest aircraft type
995
-	*
996
-	* @return Array the spotter information
997
-	*
998
-	*/
993
+	/**
994
+	 * Gets all the spotter information sorted by the newest aircraft type
995
+	 *
996
+	 * @return Array the spotter information
997
+	 *
998
+	 */
999 999
 	public function getNewestSpotterDataSortedByAircraftType($limit = '', $sort = '',$filter = array())
1000 1000
 	{
1001 1001
 		global $global_query;
@@ -1036,11 +1036,11 @@  discard block
 block discarded – undo
1036 1036
     
1037 1037
     
1038 1038
 	/**
1039
-	* Gets all the spotter information sorted by the newest aircraft registration
1040
-	*
1041
-	* @return Array the spotter information
1042
-	*
1043
-	*/
1039
+	 * Gets all the spotter information sorted by the newest aircraft registration
1040
+	 *
1041
+	 * @return Array the spotter information
1042
+	 *
1043
+	 */
1044 1044
 	public function getNewestSpotterDataSortedByAircraftRegistration($limit = '', $sort = '', $filter = array())
1045 1045
 	{
1046 1046
 		global $global_query;
@@ -1080,11 +1080,11 @@  discard block
 block discarded – undo
1080 1080
 
1081 1081
 
1082 1082
 	/**
1083
-	* Gets all the spotter information sorted by the newest airline
1084
-	*
1085
-	* @return Array the spotter information
1086
-	*
1087
-	*/
1083
+	 * Gets all the spotter information sorted by the newest airline
1084
+	 *
1085
+	 * @return Array the spotter information
1086
+	 *
1087
+	 */
1088 1088
 	public function getNewestSpotterDataSortedByAirline($limit = '', $sort = '',$filter = array())
1089 1089
 	{
1090 1090
 		global $global_query;
@@ -1123,12 +1123,12 @@  discard block
 block discarded – undo
1123 1123
 	}
1124 1124
     
1125 1125
     
1126
-    /**
1127
-	* Gets all the spotter information sorted by the newest departure airport
1128
-	*
1129
-	* @return Array the spotter information
1130
-	*
1131
-	*/
1126
+	/**
1127
+	 * Gets all the spotter information sorted by the newest departure airport
1128
+	 *
1129
+	 * @return Array the spotter information
1130
+	 *
1131
+	 */
1132 1132
 	public function getNewestSpotterDataSortedByDepartureAirport($limit = '', $sort = '', $filter = array())
1133 1133
 	{
1134 1134
 		global $global_query;
@@ -1170,11 +1170,11 @@  discard block
 block discarded – undo
1170 1170
 
1171 1171
 
1172 1172
 	/**
1173
-	* Gets all the spotter information sorted by the newest arrival airport
1174
-	*
1175
-	* @return Array the spotter information
1176
-	*
1177
-	*/
1173
+	 * Gets all the spotter information sorted by the newest arrival airport
1174
+	 *
1175
+	 * @return Array the spotter information
1176
+	 *
1177
+	 */
1178 1178
 	public function getNewestSpotterDataSortedByArrivalAirport($limit = '', $sort = '', $filter = array())
1179 1179
 	{
1180 1180
 		global $global_query;
@@ -1213,11 +1213,11 @@  discard block
 block discarded – undo
1213 1213
 	
1214 1214
 
1215 1215
 	/**
1216
-	* Gets all the spotter information based on the spotter id
1217
-	*
1218
-	* @return Array the spotter information
1219
-	*
1220
-	*/
1216
+	 * Gets all the spotter information based on the spotter id
1217
+	 *
1218
+	 * @return Array the spotter information
1219
+	 *
1220
+	 */
1221 1221
 	public function getSpotterDataByID($id = '')
1222 1222
 	{
1223 1223
 		global $global_query;
@@ -1239,11 +1239,11 @@  discard block
 block discarded – undo
1239 1239
 	
1240 1240
 	
1241 1241
 	/**
1242
-	* Gets all the spotter information based on the callsign
1243
-	*
1244
-	* @return Array the spotter information
1245
-	*
1246
-	*/
1242
+	 * Gets all the spotter information based on the callsign
1243
+	 *
1244
+	 * @return Array the spotter information
1245
+	 *
1246
+	 */
1247 1247
 	public function getSpotterDataByIdent($ident = '', $limit = '', $sort = '', $filter = array())
1248 1248
 	{
1249 1249
 		global $global_query;
@@ -1295,11 +1295,11 @@  discard block
 block discarded – undo
1295 1295
 	}
1296 1296
 	
1297 1297
 	/**
1298
-	* Gets all the spotter information based on the owner
1299
-	*
1300
-	* @return Array the spotter information
1301
-	*
1302
-	*/
1298
+	 * Gets all the spotter information based on the owner
1299
+	 *
1300
+	 * @return Array the spotter information
1301
+	 *
1302
+	 */
1303 1303
 	public function getSpotterDataByOwner($owner = '', $limit = '', $sort = '', $filter = array())
1304 1304
 	{
1305 1305
 		global $global_query;
@@ -1352,11 +1352,11 @@  discard block
 block discarded – undo
1352 1352
 	}
1353 1353
 	
1354 1354
 	/**
1355
-	* Gets all the spotter information based on the pilot
1356
-	*
1357
-	* @return Array the spotter information
1358
-	*
1359
-	*/
1355
+	 * Gets all the spotter information based on the pilot
1356
+	 *
1357
+	 * @return Array the spotter information
1358
+	 *
1359
+	 */
1360 1360
 	public function getSpotterDataByPilot($pilot = '', $limit = '', $sort = '', $filter = array())
1361 1361
 	{
1362 1362
 		global $global_query;
@@ -1405,11 +1405,11 @@  discard block
 block discarded – undo
1405 1405
 	
1406 1406
 	
1407 1407
 	/**
1408
-	* Gets all the spotter information based on the aircraft type
1409
-	*
1410
-	* @return Array the spotter information
1411
-	*
1412
-	*/
1408
+	 * Gets all the spotter information based on the aircraft type
1409
+	 *
1410
+	 * @return Array the spotter information
1411
+	 *
1412
+	 */
1413 1413
 	public function getSpotterDataByAircraft($aircraft_type = '', $limit = '', $sort = '', $filter = array())
1414 1414
 	{
1415 1415
 		global $global_query;
@@ -1463,11 +1463,11 @@  discard block
 block discarded – undo
1463 1463
 	
1464 1464
 	
1465 1465
 	/**
1466
-	* Gets all the spotter information based on the aircraft registration
1467
-	*
1468
-	* @return Array the spotter information
1469
-	*
1470
-	*/
1466
+	 * Gets all the spotter information based on the aircraft registration
1467
+	 *
1468
+	 * @return Array the spotter information
1469
+	 *
1470
+	 */
1471 1471
 	public function getSpotterDataByRegistration($registration = '', $limit = '', $sort = '', $filter = array())
1472 1472
 	{
1473 1473
 		global $global_query;
@@ -1524,11 +1524,11 @@  discard block
 block discarded – undo
1524 1524
 	
1525 1525
 	
1526 1526
 	/**
1527
-	* Gets all the spotter information based on the airline
1528
-	*
1529
-	* @return Array the spotter information
1530
-	*
1531
-	*/
1527
+	 * Gets all the spotter information based on the airline
1528
+	 *
1529
+	 * @return Array the spotter information
1530
+	 *
1531
+	 */
1532 1532
 	public function getSpotterDataByAirline($airline = '', $limit = '', $sort = '',$filters = array())
1533 1533
 	{
1534 1534
 		global $global_query;
@@ -1581,11 +1581,11 @@  discard block
 block discarded – undo
1581 1581
 	
1582 1582
 	
1583 1583
 	/**
1584
-	* Gets all the spotter information based on the airport
1585
-	*
1586
-	* @return Array the spotter information
1587
-	*
1588
-	*/
1584
+	 * Gets all the spotter information based on the airport
1585
+	 *
1586
+	 * @return Array the spotter information
1587
+	 *
1588
+	 */
1589 1589
 	public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '',$filters = array())
1590 1590
 	{
1591 1591
 		global $global_query;
@@ -1639,11 +1639,11 @@  discard block
 block discarded – undo
1639 1639
 
1640 1640
 
1641 1641
 	/**
1642
-	* Gets all the spotter information based on the date
1643
-	*
1644
-	* @return Array the spotter information
1645
-	*
1646
-	*/
1642
+	 * Gets all the spotter information based on the date
1643
+	 *
1644
+	 * @return Array the spotter information
1645
+	 *
1646
+	 */
1647 1647
 	public function getSpotterDataByDate($date = '', $limit = '', $sort = '',$filter = array())
1648 1648
 	{
1649 1649
 		global $global_query, $globalTimezone, $globalDBdriver;
@@ -1707,11 +1707,11 @@  discard block
 block discarded – undo
1707 1707
 
1708 1708
 
1709 1709
 	/**
1710
-	* Gets all the spotter information based on the country name
1711
-	*
1712
-	* @return Array the spotter information
1713
-	*
1714
-	*/
1710
+	 * Gets all the spotter information based on the country name
1711
+	 *
1712
+	 * @return Array the spotter information
1713
+	 *
1714
+	 */
1715 1715
 	public function getSpotterDataByCountry($country = '', $limit = '', $sort = '',$filters = array())
1716 1716
 	{
1717 1717
 		global $global_query;
@@ -1765,11 +1765,11 @@  discard block
 block discarded – undo
1765 1765
 	
1766 1766
 	
1767 1767
 	/**
1768
-	* Gets all the spotter information based on the manufacturer name
1769
-	*
1770
-	* @return Array the spotter information
1771
-	*
1772
-	*/
1768
+	 * Gets all the spotter information based on the manufacturer name
1769
+	 *
1770
+	 * @return Array the spotter information
1771
+	 *
1772
+	 */
1773 1773
 	public function getSpotterDataByManufacturer($aircraft_manufacturer = '', $limit = '', $sort = '', $filters = array())
1774 1774
 	{
1775 1775
 		global $global_query;
@@ -1825,13 +1825,13 @@  discard block
 block discarded – undo
1825 1825
   
1826 1826
   
1827 1827
 	/**
1828
-	* Gets a list of all aircraft that take a route
1829
-	*
1830
-	* @param String $departure_airport_icao ICAO code of departure airport
1831
-	* @param String $arrival_airport_icao ICAO code of arrival airport
1832
-	* @return Array the spotter information
1833
-	*
1834
-	*/
1828
+	 * Gets a list of all aircraft that take a route
1829
+	 *
1830
+	 * @param String $departure_airport_icao ICAO code of departure airport
1831
+	 * @param String $arrival_airport_icao ICAO code of arrival airport
1832
+	 * @return Array the spotter information
1833
+	 *
1834
+	 */
1835 1835
 	public function getSpotterDataByRoute($departure_airport_icao = '', $arrival_airport_icao = '', $limit = '', $sort = '', $filters = array())
1836 1836
 	{
1837 1837
 		global $global_query;
@@ -1900,11 +1900,11 @@  discard block
 block discarded – undo
1900 1900
 	
1901 1901
 	
1902 1902
 	/**
1903
-	* Gets all the spotter information based on the special column in the table
1904
-	*
1905
-	* @return Array the spotter information
1906
-	*
1907
-	*/
1903
+	 * Gets all the spotter information based on the special column in the table
1904
+	 *
1905
+	 * @return Array the spotter information
1906
+	 *
1907
+	 */
1908 1908
 	public function getSpotterDataByHighlight($limit = '', $sort = '', $filter = array())
1909 1909
 	{
1910 1910
 		global $global_query;
@@ -1943,11 +1943,11 @@  discard block
 block discarded – undo
1943 1943
 	}
1944 1944
 
1945 1945
 	/**
1946
-	* Gets all the highlight based on a aircraft registration
1947
-	*
1948
-	* @return String the highlight text
1949
-	*
1950
-	*/
1946
+	 * Gets all the highlight based on a aircraft registration
1947
+	 *
1948
+	 * @return String the highlight text
1949
+	 *
1950
+	 */
1951 1951
 	public function getHighlightByRegistration($registration,$filter = array())
1952 1952
 	{
1953 1953
 		global $global_query;
@@ -1969,13 +1969,13 @@  discard block
 block discarded – undo
1969 1969
 
1970 1970
 	
1971 1971
 	/**
1972
-	* Gets the squawk usage from squawk code
1973
-	*
1974
-	* @param String $squawk squawk code
1975
-	* @param String $country country
1976
-	* @return String usage
1977
-	*
1978
-	*/
1972
+	 * Gets the squawk usage from squawk code
1973
+	 *
1974
+	 * @param String $squawk squawk code
1975
+	 * @param String $country country
1976
+	 * @return String usage
1977
+	 *
1978
+	 */
1979 1979
 	public function getSquawkUsage($squawk = '',$country = 'FR')
1980 1980
 	{
1981 1981
 		
@@ -1996,12 +1996,12 @@  discard block
 block discarded – undo
1996 1996
 	}
1997 1997
 
1998 1998
 	/**
1999
-	* Gets the airport icao from the iata
2000
-	*
2001
-	* @param String $airport_iata the iata code of the airport
2002
-	* @return String airport iata
2003
-	*
2004
-	*/
1999
+	 * Gets the airport icao from the iata
2000
+	 *
2001
+	 * @param String $airport_iata the iata code of the airport
2002
+	 * @return String airport iata
2003
+	 *
2004
+	 */
2005 2005
 	public function getAirportIcao($airport_iata = '')
2006 2006
 	{
2007 2007
 		
@@ -2021,14 +2021,14 @@  discard block
 block discarded – undo
2021 2021
 	}
2022 2022
 
2023 2023
 	/**
2024
-	* Gets the airport distance
2025
-	*
2026
-	* @param String $airport_icao the icao code of the airport
2027
-	* @param Float $latitude the latitude
2028
-	* @param Float $longitude the longitude
2029
-	* @return Float distance to the airport
2030
-	*
2031
-	*/
2024
+	 * Gets the airport distance
2025
+	 *
2026
+	 * @param String $airport_icao the icao code of the airport
2027
+	 * @param Float $latitude the latitude
2028
+	 * @param Float $longitude the longitude
2029
+	 * @return Float distance to the airport
2030
+	 *
2031
+	 */
2032 2032
 	public function getAirportDistance($airport_icao,$latitude,$longitude)
2033 2033
 	{
2034 2034
 		
@@ -2049,12 +2049,12 @@  discard block
 block discarded – undo
2049 2049
 	}
2050 2050
 	
2051 2051
 	/**
2052
-	* Gets the airport info based on the icao
2053
-	*
2054
-	* @param String $airport the icao code of the airport
2055
-	* @return Array airport information
2056
-	*
2057
-	*/
2052
+	 * Gets the airport info based on the icao
2053
+	 *
2054
+	 * @param String $airport the icao code of the airport
2055
+	 * @return Array airport information
2056
+	 *
2057
+	 */
2058 2058
 	public function getAllAirportInfo($airport = '')
2059 2059
 	{
2060 2060
 		
@@ -2100,12 +2100,12 @@  discard block
 block discarded – undo
2100 2100
 	}
2101 2101
 	
2102 2102
 	/**
2103
-	* Gets the airport info based on the country
2104
-	*
2105
-	* @param Array $countries Airports countries
2106
-	* @return Array airport information
2107
-	*
2108
-	*/
2103
+	 * Gets the airport info based on the country
2104
+	 *
2105
+	 * @param Array $countries Airports countries
2106
+	 * @return Array airport information
2107
+	 *
2108
+	 */
2109 2109
 	public function getAllAirportInfobyCountry($countries)
2110 2110
 	{
2111 2111
 		$lst_countries = '';
@@ -2143,12 +2143,12 @@  discard block
 block discarded – undo
2143 2143
 	}
2144 2144
 	
2145 2145
 	/**
2146
-	* Gets airports info based on the coord
2147
-	*
2148
-	* @param Array $coord Airports longitude min,latitude min, longitude max, latitude max
2149
-	* @return Array airport information
2150
-	*
2151
-	*/
2146
+	 * Gets airports info based on the coord
2147
+	 *
2148
+	 * @param Array $coord Airports longitude min,latitude min, longitude max, latitude max
2149
+	 * @return Array airport information
2150
+	 *
2151
+	 */
2152 2152
 	public function getAllAirportInfobyCoord($coord)
2153 2153
 	{
2154 2154
 		global $globalDBdriver;
@@ -2179,12 +2179,12 @@  discard block
 block discarded – undo
2179 2179
 	}
2180 2180
 
2181 2181
 	/**
2182
-	* Gets waypoints info based on the coord
2183
-	*
2184
-	* @param Array $coord waypoints coord
2185
-	* @return Array airport information
2186
-	*
2187
-	*/
2182
+	 * Gets waypoints info based on the coord
2183
+	 *
2184
+	 * @param Array $coord waypoints coord
2185
+	 * @return Array airport information
2186
+	 *
2187
+	 */
2188 2188
 	public function getAllWaypointsInfobyCoord($coord)
2189 2189
 	{
2190 2190
 		if (is_array($coord)) {
@@ -2218,12 +2218,12 @@  discard block
 block discarded – undo
2218 2218
 	
2219 2219
 	
2220 2220
 	/**
2221
-	* Gets the airline info based on the icao code or iata code
2222
-	*
2223
-	* @param String $airline_icao the iata code of the airport
2224
-	* @return Array airport information
2225
-	*
2226
-	*/
2221
+	 * Gets the airline info based on the icao code or iata code
2222
+	 *
2223
+	 * @param String $airline_icao the iata code of the airport
2224
+	 * @return Array airport information
2225
+	 *
2226
+	 */
2227 2227
 	public function getAllAirlineInfo($airline_icao, $fromsource = NULL)
2228 2228
 	{
2229 2229
 		global $globalUseRealAirlines;
@@ -2254,7 +2254,7 @@  discard block
 block discarded – undo
2254 2254
 			} else {
2255 2255
 				$sth->execute(array(':airline_icao' => $airline_icao,':fromsource' => $fromsource));
2256 2256
 			}
2257
-                        /*
2257
+						/*
2258 2258
 			$airline_array = array();
2259 2259
 			$temp_array = array();
2260 2260
 		
@@ -2287,12 +2287,12 @@  discard block
 block discarded – undo
2287 2287
 	}
2288 2288
 	
2289 2289
 	/**
2290
-	* Gets the airline info based on the airline name
2291
-	*
2292
-	* @param String $airline_name the name of the airline
2293
-	* @return Array airline information
2294
-	*
2295
-	*/
2290
+	 * Gets the airline info based on the airline name
2291
+	 *
2292
+	 * @param String $airline_name the name of the airline
2293
+	 * @return Array airline information
2294
+	 *
2295
+	 */
2296 2296
 	public function getAllAirlineInfoByName($airline_name, $fromsource = NULL)
2297 2297
 	{
2298 2298
 		global $globalUseRealAirlines;
@@ -2320,12 +2320,12 @@  discard block
 block discarded – undo
2320 2320
 	
2321 2321
 	
2322 2322
 	/**
2323
-	* Gets the aircraft info based on the aircraft type
2324
-	*
2325
-	* @param String $aircraft_type the aircraft type
2326
-	* @return Array aircraft information
2327
-	*
2328
-	*/
2323
+	 * Gets the aircraft info based on the aircraft type
2324
+	 *
2325
+	 * @param String $aircraft_type the aircraft type
2326
+	 * @return Array aircraft information
2327
+	 *
2328
+	 */
2329 2329
 	public function getAllAircraftInfo($aircraft_type)
2330 2330
 	{
2331 2331
 		$aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING);
@@ -2357,12 +2357,12 @@  discard block
 block discarded – undo
2357 2357
 	}
2358 2358
 
2359 2359
 	/**
2360
-	* Gets the aircraft icao based on the aircraft name/type
2361
-	*
2362
-	* @param String $aircraft_type the aircraft type
2363
-	* @return String aircraft information
2364
-	*
2365
-	*/
2360
+	 * Gets the aircraft icao based on the aircraft name/type
2361
+	 *
2362
+	 * @param String $aircraft_type the aircraft type
2363
+	 * @return String aircraft information
2364
+	 *
2365
+	 */
2366 2366
 	public function getAircraftIcao($aircraft_type)
2367 2367
 	{
2368 2368
 		$aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING);
@@ -2387,12 +2387,12 @@  discard block
 block discarded – undo
2387 2387
 	}
2388 2388
 	
2389 2389
 	/**
2390
-	* Gets the aircraft info based on the aircraft modes
2391
-	*
2392
-	* @param String $aircraft_modes the aircraft ident (hex)
2393
-	* @return String aircraft type
2394
-	*
2395
-	*/
2390
+	 * Gets the aircraft info based on the aircraft modes
2391
+	 *
2392
+	 * @param String $aircraft_modes the aircraft ident (hex)
2393
+	 * @return String aircraft type
2394
+	 *
2395
+	 */
2396 2396
 	public function getAllAircraftType($aircraft_modes)
2397 2397
 	{
2398 2398
 		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
@@ -2412,12 +2412,12 @@  discard block
 block discarded – undo
2412 2412
 	}
2413 2413
 
2414 2414
 	/**
2415
-	* Gets the aircraft info based on the aircraft registration
2416
-	*
2417
-	* @param String $registration the aircraft registration
2418
-	* @return String aircraft type
2419
-	*
2420
-	*/
2415
+	 * Gets the aircraft info based on the aircraft registration
2416
+	 *
2417
+	 * @param String $registration the aircraft registration
2418
+	 * @return String aircraft type
2419
+	 *
2420
+	 */
2421 2421
 	public function getAllAircraftTypeByRegistration($registration)
2422 2422
 	{
2423 2423
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -2435,12 +2435,12 @@  discard block
 block discarded – undo
2435 2435
 	}
2436 2436
 
2437 2437
 	/**
2438
-	* Gets the spotter_id and flightaware_id based on the aircraft registration
2439
-	*
2440
-	* @param String $registration the aircraft registration
2441
-	* @return Array spotter_id and flightaware_id
2442
-	*
2443
-	*/
2438
+	 * Gets the spotter_id and flightaware_id based on the aircraft registration
2439
+	 *
2440
+	 * @param String $registration the aircraft registration
2441
+	 * @return Array spotter_id and flightaware_id
2442
+	 *
2443
+	 */
2444 2444
 	public function getAllIDByRegistration($registration)
2445 2445
 	{
2446 2446
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -2459,12 +2459,12 @@  discard block
 block discarded – undo
2459 2459
 	}
2460 2460
 
2461 2461
 	/**
2462
-	* Gets correct aircraft operator code
2463
-	*
2464
-	* @param String $operator the aircraft operator code (callsign)
2465
-	* @return String aircraft operator code
2466
-	*
2467
-	*/
2462
+	 * Gets correct aircraft operator code
2463
+	 *
2464
+	 * @param String $operator the aircraft operator code (callsign)
2465
+	 * @return String aircraft operator code
2466
+	 *
2467
+	 */
2468 2468
 	public function getOperator($operator)
2469 2469
 	{
2470 2470
 		$operator = filter_var($operator,FILTER_SANITIZE_STRING);
@@ -2481,16 +2481,16 @@  discard block
 block discarded – undo
2481 2481
 	}
2482 2482
 
2483 2483
 	/**
2484
-	* Gets the aircraft route based on the aircraft callsign
2485
-	*
2486
-	* @param String $callsign the aircraft callsign
2487
-	* @return Array aircraft type
2488
-	*
2489
-	*/
2484
+	 * Gets the aircraft route based on the aircraft callsign
2485
+	 *
2486
+	 * @param String $callsign the aircraft callsign
2487
+	 * @return Array aircraft type
2488
+	 *
2489
+	 */
2490 2490
 	public function getRouteInfo($callsign)
2491 2491
 	{
2492 2492
 		$callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
2493
-                if ($callsign == '') return array();
2493
+				if ($callsign == '') return array();
2494 2494
 		$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";
2495 2495
 		
2496 2496
 		$sth = $this->db->prepare($query);
@@ -2504,12 +2504,12 @@  discard block
 block discarded – undo
2504 2504
 	}
2505 2505
 	
2506 2506
 	/**
2507
-	* Gets the aircraft info based on the aircraft registration
2508
-	*
2509
-	* @param String $registration the aircraft registration
2510
-	* @return Array aircraft information
2511
-	*
2512
-	*/
2507
+	 * Gets the aircraft info based on the aircraft registration
2508
+	 *
2509
+	 * @param String $registration the aircraft registration
2510
+	 * @return Array aircraft information
2511
+	 *
2512
+	 */
2513 2513
 	public function getAircraftInfoByRegistration($registration)
2514 2514
 	{
2515 2515
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -2536,12 +2536,12 @@  discard block
 block discarded – undo
2536 2536
 	}
2537 2537
 	
2538 2538
 	/**
2539
-	* Gets the aircraft owner & base based on the aircraft registration
2540
-	*
2541
-	* @param String $registration the aircraft registration
2542
-	* @return Array aircraft information
2543
-	*
2544
-	*/
2539
+	 * Gets the aircraft owner & base based on the aircraft registration
2540
+	 *
2541
+	 * @param String $registration the aircraft registration
2542
+	 * @return Array aircraft information
2543
+	 *
2544
+	 */
2545 2545
 	public function getAircraftOwnerByRegistration($registration)
2546 2546
 	{
2547 2547
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -2558,11 +2558,11 @@  discard block
 block discarded – undo
2558 2558
 	
2559 2559
   
2560 2560
   /**
2561
-	* Gets all flights (but with only little info)
2562
-	*
2563
-	* @return Array basic flight information
2564
-	*
2565
-	*/
2561
+   * Gets all flights (but with only little info)
2562
+   *
2563
+   * @return Array basic flight information
2564
+   *
2565
+   */
2566 2566
 	public function getAllFlightsforSitemap()
2567 2567
 	{
2568 2568
 		//$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 ";
@@ -2570,7 +2570,7 @@  discard block
 block discarded – undo
2570 2570
 		
2571 2571
 		$sth = $this->db->prepare($query);
2572 2572
 		$sth->execute();
2573
-                  /*
2573
+				  /*
2574 2574
 		$flight_array = array();
2575 2575
 		$temp_array = array();
2576 2576
 		
@@ -2592,11 +2592,11 @@  discard block
 block discarded – undo
2592 2592
 	}
2593 2593
   
2594 2594
 	/**
2595
-	* Gets a list of all aircraft manufacturers
2596
-	*
2597
-	* @return Array list of aircraft types
2598
-	*
2599
-	*/
2595
+	 * Gets a list of all aircraft manufacturers
2596
+	 *
2597
+	 * @return Array list of aircraft types
2598
+	 *
2599
+	 */
2600 2600
 	public function getAllManufacturers()
2601 2601
 	{
2602 2602
 		/*
@@ -2625,11 +2625,11 @@  discard block
 block discarded – undo
2625 2625
   
2626 2626
   
2627 2627
   /**
2628
-	* Gets a list of all aircraft types
2629
-	*
2630
-	* @return Array list of aircraft types
2631
-	*
2632
-	*/
2628
+   * Gets a list of all aircraft types
2629
+   *
2630
+   * @return Array list of aircraft types
2631
+   *
2632
+   */
2633 2633
 	public function getAllAircraftTypes($filters = array())
2634 2634
 	{
2635 2635
 		/*
@@ -2664,11 +2664,11 @@  discard block
 block discarded – undo
2664 2664
 	
2665 2665
 	
2666 2666
 	/**
2667
-	* Gets a list of all aircraft registrations
2668
-	*
2669
-	* @return Array list of aircraft registrations
2670
-	*
2671
-	*/
2667
+	 * Gets a list of all aircraft registrations
2668
+	 *
2669
+	 * @return Array list of aircraft registrations
2670
+	 *
2671
+	 */
2672 2672
 	public function getAllAircraftRegistrations($filters = array())
2673 2673
 	{
2674 2674
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2693,12 +2693,12 @@  discard block
 block discarded – undo
2693 2693
 	}
2694 2694
 
2695 2695
 	/**
2696
-	* Gets all source name
2697
-	*
2698
-	* @param String type format of source
2699
-	* @return Array list of source name
2700
-	*
2701
-	*/
2696
+	 * Gets all source name
2697
+	 *
2698
+	 * @param String type format of source
2699
+	 * @return Array list of source name
2700
+	 *
2701
+	 */
2702 2702
 	public function getAllSourceName($type = '',$filters = array())
2703 2703
 	{
2704 2704
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2729,11 +2729,11 @@  discard block
 block discarded – undo
2729 2729
 
2730 2730
 
2731 2731
 	/**
2732
-	* Gets a list of all airline names
2733
-	*
2734
-	* @return Array list of airline names
2735
-	*
2736
-	*/
2732
+	 * Gets a list of all airline names
2733
+	 *
2734
+	 * @return Array list of airline names
2735
+	 *
2736
+	 */
2737 2737
 	public function getAllAirlineNames($airline_type = '',$forsource = NULL,$filters = array())
2738 2738
 	{
2739 2739
 		global $globalAirlinesSource,$globalVATSIM, $globalIVAO;
@@ -2782,11 +2782,11 @@  discard block
 block discarded – undo
2782 2782
 	}
2783 2783
 	
2784 2784
 	/**
2785
-	* Gets a list of all alliance names
2786
-	*
2787
-	* @return Array list of alliance names
2788
-	*
2789
-	*/
2785
+	 * Gets a list of all alliance names
2786
+	 *
2787
+	 * @return Array list of alliance names
2788
+	 *
2789
+	 */
2790 2790
 	public function getAllAllianceNames($forsource = NULL,$filters = array())
2791 2791
 	{
2792 2792
 		global $globalAirlinesSource,$globalVATSIM, $globalIVAO;
@@ -2811,11 +2811,11 @@  discard block
 block discarded – undo
2811 2811
 	}
2812 2812
 	
2813 2813
 	/**
2814
-	* Gets a list of all airline countries
2815
-	*
2816
-	* @return Array list of airline countries
2817
-	*
2818
-	*/
2814
+	 * Gets a list of all airline countries
2815
+	 *
2816
+	 * @return Array list of airline countries
2817
+	 *
2818
+	 */
2819 2819
 	public function getAllAirlineCountries($filters = array())
2820 2820
 	{
2821 2821
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2843,11 +2843,11 @@  discard block
 block discarded – undo
2843 2843
 	
2844 2844
 	
2845 2845
 	/**
2846
-	* Gets a list of all departure & arrival names
2847
-	*
2848
-	* @return Array list of airport names
2849
-	*
2850
-	*/
2846
+	 * Gets a list of all departure & arrival names
2847
+	 *
2848
+	 * @return Array list of airport names
2849
+	 *
2850
+	 */
2851 2851
 	public function getAllAirportNames($filters = array())
2852 2852
 	{
2853 2853
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2895,11 +2895,11 @@  discard block
 block discarded – undo
2895 2895
 	} 
2896 2896
 
2897 2897
 	/**
2898
-	* Gets a list of all owner names
2899
-	*
2900
-	* @return Array list of owner names
2901
-	*
2902
-	*/
2898
+	 * Gets a list of all owner names
2899
+	 *
2900
+	 * @return Array list of owner names
2901
+	 *
2902
+	 */
2903 2903
 	public function getAllOwnerNames($filters = array())
2904 2904
 	{
2905 2905
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2913,11 +2913,11 @@  discard block
 block discarded – undo
2913 2913
 	} 
2914 2914
 
2915 2915
 	/**
2916
-	* Gets a list of all pilot names and pilot ids
2917
-	*
2918
-	* @return Array list of pilot names and pilot ids
2919
-	*
2920
-	*/
2916
+	 * Gets a list of all pilot names and pilot ids
2917
+	 *
2918
+	 * @return Array list of pilot names and pilot ids
2919
+	 *
2920
+	 */
2921 2921
 	public function getAllPilotNames($filters = array())
2922 2922
 	{
2923 2923
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2932,11 +2932,11 @@  discard block
 block discarded – undo
2932 2932
 	
2933 2933
 	
2934 2934
 	/**
2935
-	* Gets a list of all departure & arrival airport countries
2936
-	*
2937
-	* @return Array list of airport countries
2938
-	*
2939
-	*/
2935
+	 * Gets a list of all departure & arrival airport countries
2936
+	 *
2937
+	 * @return Array list of airport countries
2938
+	 *
2939
+	 */
2940 2940
 	public function getAllAirportCountries($filters = array())
2941 2941
 	{
2942 2942
 		$airport_array = array();
@@ -2984,11 +2984,11 @@  discard block
 block discarded – undo
2984 2984
 	
2985 2985
 	
2986 2986
 	/**
2987
-	* Gets a list of all countries (airline, departure airport & arrival airport)
2988
-	*
2989
-	* @return Array list of countries
2990
-	*
2991
-	*/
2987
+	 * Gets a list of all countries (airline, departure airport & arrival airport)
2988
+	 *
2989
+	 * @return Array list of countries
2990
+	 *
2991
+	 */
2992 2992
 	public function getAllCountries($filters = array())
2993 2993
 	{
2994 2994
 		$Connection= new Connection($this->db);
@@ -3065,11 +3065,11 @@  discard block
 block discarded – undo
3065 3065
 	
3066 3066
 	
3067 3067
 	/**
3068
-	* Gets a list of all idents/callsigns
3069
-	*
3070
-	* @return Array list of ident/callsign names
3071
-	*
3072
-	*/
3068
+	 * Gets a list of all idents/callsigns
3069
+	 *
3070
+	 * @return Array list of ident/callsign names
3071
+	 *
3072
+	 */
3073 3073
 	public function getAllIdents($filters = array())
3074 3074
 	{
3075 3075
 		$filter_query = $this->getFilter($filters,true,true);
@@ -3093,9 +3093,9 @@  discard block
 block discarded – undo
3093 3093
 	}
3094 3094
 
3095 3095
 	/**
3096
-	* Get a list of flights from airport since 7 days
3097
-	* @return Array number, icao, name and city of airports
3098
-	*/
3096
+	 * Get a list of flights from airport since 7 days
3097
+	 * @return Array number, icao, name and city of airports
3098
+	 */
3099 3099
 
3100 3100
 	public function getLast7DaysAirportsDeparture($airport_icao = '',$filters = array()) {
3101 3101
 		global $globalTimezone, $globalDBdriver;
@@ -3126,9 +3126,9 @@  discard block
 block discarded – undo
3126 3126
 	}
3127 3127
 
3128 3128
 	/**
3129
-	* Get a list of flights from airport since 7 days
3130
-	* @return Array number, icao, name and city of airports
3131
-	*/
3129
+	 * Get a list of flights from airport since 7 days
3130
+	 * @return Array number, icao, name and city of airports
3131
+	 */
3132 3132
 
3133 3133
 	public function getLast7DaysAirportsDepartureByAirlines($airport_icao = '') {
3134 3134
 		global $globalTimezone, $globalDBdriver;
@@ -3158,9 +3158,9 @@  discard block
 block discarded – undo
3158 3158
 	}
3159 3159
 
3160 3160
 	/**
3161
-	* Get a list of flights from detected airport since 7 days
3162
-	* @return Array number, icao, name and city of airports
3163
-	*/
3161
+	 * Get a list of flights from detected airport since 7 days
3162
+	 * @return Array number, icao, name and city of airports
3163
+	 */
3164 3164
 
3165 3165
 	public function getLast7DaysDetectedAirportsDeparture($airport_icao = '', $filters = array()) {
3166 3166
 		global $globalTimezone, $globalDBdriver;
@@ -3198,9 +3198,9 @@  discard block
 block discarded – undo
3198 3198
 	}
3199 3199
 
3200 3200
 	/**
3201
-	* Get a list of flights from detected airport since 7 days
3202
-	* @return Array number, icao, name and city of airports
3203
-	*/
3201
+	 * Get a list of flights from detected airport since 7 days
3202
+	 * @return Array number, icao, name and city of airports
3203
+	 */
3204 3204
 
3205 3205
 	public function getLast7DaysDetectedAirportsDepartureByAirlines($airport_icao = '') {
3206 3206
 		global $globalTimezone, $globalDBdriver;
@@ -3242,9 +3242,9 @@  discard block
 block discarded – undo
3242 3242
 
3243 3243
 
3244 3244
 	/**
3245
-	* Get a list of flights to airport since 7 days
3246
-	* @return Array number, icao, name and city of airports
3247
-	*/
3245
+	 * Get a list of flights to airport since 7 days
3246
+	 * @return Array number, icao, name and city of airports
3247
+	 */
3248 3248
 
3249 3249
 	public function getLast7DaysAirportsArrival($airport_icao = '', $filters = array()) {
3250 3250
 		global $globalTimezone, $globalDBdriver;
@@ -3277,9 +3277,9 @@  discard block
 block discarded – undo
3277 3277
 
3278 3278
 
3279 3279
 	/**
3280
-	* Get a list of flights detected to airport since 7 days
3281
-	* @return Array number, icao, name and city of airports
3282
-	*/
3280
+	 * Get a list of flights detected to airport since 7 days
3281
+	 * @return Array number, icao, name and city of airports
3282
+	 */
3283 3283
 
3284 3284
 	public function getLast7DaysDetectedAirportsArrival($airport_icao = '',$filters = array()) {
3285 3285
 		global $globalTimezone, $globalDBdriver;
@@ -3320,9 +3320,9 @@  discard block
 block discarded – undo
3320 3320
 
3321 3321
 
3322 3322
 	/**
3323
-	* Get a list of flights to airport since 7 days
3324
-	* @return Array number, icao, name and city of airports
3325
-	*/
3323
+	 * Get a list of flights to airport since 7 days
3324
+	 * @return Array number, icao, name and city of airports
3325
+	 */
3326 3326
 
3327 3327
 	public function getLast7DaysAirportsArrivalByAirlines($airport_icao = '') {
3328 3328
 		global $globalTimezone, $globalDBdriver;
@@ -3354,9 +3354,9 @@  discard block
 block discarded – undo
3354 3354
 
3355 3355
 
3356 3356
 	/**
3357
-	* Get a list of flights detected to airport since 7 days
3358
-	* @return Array number, icao, name and city of airports
3359
-	*/
3357
+	 * Get a list of flights detected to airport since 7 days
3358
+	 * @return Array number, icao, name and city of airports
3359
+	 */
3360 3360
 
3361 3361
 	public function getLast7DaysDetectedAirportsArrivalByAirlines($airport_icao = '') {
3362 3362
 		global $globalTimezone, $globalDBdriver;
@@ -3400,11 +3400,11 @@  discard block
 block discarded – undo
3400 3400
 
3401 3401
 
3402 3402
 	/**
3403
-	* Gets a list of all dates
3404
-	*
3405
-	* @return Array list of date names
3406
-	*
3407
-	*/
3403
+	 * Gets a list of all dates
3404
+	 *
3405
+	 * @return Array list of date names
3406
+	 *
3407
+	 */
3408 3408
 	public function getAllDates()
3409 3409
 	{
3410 3410
 		global $globalTimezone, $globalDBdriver;
@@ -3445,11 +3445,11 @@  discard block
 block discarded – undo
3445 3445
 	
3446 3446
 	
3447 3447
 	/**
3448
-	* Gets all route combinations
3449
-	*
3450
-	* @return Array the route list
3451
-	*
3452
-	*/
3448
+	 * Gets all route combinations
3449
+	 *
3450
+	 * @return Array the route list
3451
+	 *
3452
+	 */
3453 3453
 	public function getAllRoutes()
3454 3454
 	{
3455 3455
 		$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 
@@ -3475,13 +3475,13 @@  discard block
 block discarded – undo
3475 3475
 	}
3476 3476
 
3477 3477
 	/**
3478
-	* Update ident spotter data
3479
-	*
3480
-	* @param String $flightaware_id the ID from flightaware
3481
-	* @param String $ident the flight ident
3482
-	* @return String success or false
3483
-	*
3484
-	*/	
3478
+	 * Update ident spotter data
3479
+	 *
3480
+	 * @param String $flightaware_id the ID from flightaware
3481
+	 * @param String $ident the flight ident
3482
+	 * @return String success or false
3483
+	 *
3484
+	 */	
3485 3485
 	public function updateIdentSpotterData($flightaware_id = '', $ident = '',$fromsource = NULL)
3486 3486
 	{
3487 3487
 		if (!is_numeric(substr($ident, 0, 3)))
@@ -3502,14 +3502,14 @@  discard block
 block discarded – undo
3502 3502
 		} else {
3503 3503
 			$airline_array = $this->getAllAirlineInfo("NA");
3504 3504
 		}
3505
-                $airline_name = $airline_array[0]['name'];
3506
-                $airline_icao = $airline_array[0]['icao'];
3507
-                $airline_country = $airline_array[0]['country'];
3508
-                $airline_type = $airline_array[0]['type'];
3505
+				$airline_name = $airline_array[0]['name'];
3506
+				$airline_icao = $airline_array[0]['icao'];
3507
+				$airline_country = $airline_array[0]['country'];
3508
+				$airline_type = $airline_array[0]['type'];
3509 3509
 
3510 3510
 
3511 3511
 		$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';
3512
-                $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);
3512
+				$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);
3513 3513
 
3514 3514
 		try {
3515 3515
 			$sth = $this->db->prepare($query);
@@ -3522,19 +3522,19 @@  discard block
 block discarded – undo
3522 3522
 
3523 3523
 	}
3524 3524
 	/**
3525
-	* Update latest spotter data
3526
-	*
3527
-	* @param String $flightaware_id the ID from flightaware
3528
-	* @param String $ident the flight ident
3529
-	* @param String $arrival_airport_icao the arrival airport
3530
-	* @return String success or false
3531
-	*
3532
-	*/	
3525
+	 * Update latest spotter data
3526
+	 *
3527
+	 * @param String $flightaware_id the ID from flightaware
3528
+	 * @param String $ident the flight ident
3529
+	 * @param String $arrival_airport_icao the arrival airport
3530
+	 * @return String success or false
3531
+	 *
3532
+	 */	
3533 3533
 	public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '',$arrival_airport_time = '')
3534 3534
 	{
3535 3535
 		if ($groundspeed == '') $groundspeed = NULL;
3536 3536
 		$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';
3537
-                $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);
3537
+				$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);
3538 3538
 
3539 3539
 		try {
3540 3540
 			$sth = $this->db->prepare($query);
@@ -3548,32 +3548,32 @@  discard block
 block discarded – undo
3548 3548
 	}
3549 3549
 
3550 3550
 	/**
3551
-	* Adds a new spotter data
3552
-	*
3553
-	* @param String $flightaware_id the ID from flightaware
3554
-	* @param String $ident the flight ident
3555
-	* @param String $aircraft_icao the aircraft type
3556
-	* @param String $departure_airport_icao the departure airport
3557
-	* @param String $arrival_airport_icao the arrival airport
3558
-	* @param String $latitude latitude of flight
3559
-	* @param String $longitude latitude of flight
3560
-	* @param String $waypoints waypoints of flight
3561
-	* @param String $altitude altitude of flight
3562
-	* @param String $heading heading of flight
3563
-	* @param String $groundspeed speed of flight
3564
-	* @param String $date date of flight
3565
-	* @param String $departure_airport_time departure time of flight
3566
-	* @param String $arrival_airport_time arrival time of flight
3567
-	* @param String $squawk squawk code of flight
3568
-	* @param String $route_stop route stop of flight
3569
-	* @param String $highlight highlight or not
3570
-	* @param String $ModeS ModesS code of flight
3571
-	* @param String $registration registration code of flight
3572
-	* @param String $pilot_id pilot id of flight (for virtual airlines)
3573
-	* @param String $pilot_name pilot name of flight (for virtual airlines)
3574
-	* @param String $verticalrate vertival rate of flight
3575
-	* @return String success or false
3576
-	*/
3551
+	 * Adds a new spotter data
3552
+	 *
3553
+	 * @param String $flightaware_id the ID from flightaware
3554
+	 * @param String $ident the flight ident
3555
+	 * @param String $aircraft_icao the aircraft type
3556
+	 * @param String $departure_airport_icao the departure airport
3557
+	 * @param String $arrival_airport_icao the arrival airport
3558
+	 * @param String $latitude latitude of flight
3559
+	 * @param String $longitude latitude of flight
3560
+	 * @param String $waypoints waypoints of flight
3561
+	 * @param String $altitude altitude of flight
3562
+	 * @param String $heading heading of flight
3563
+	 * @param String $groundspeed speed of flight
3564
+	 * @param String $date date of flight
3565
+	 * @param String $departure_airport_time departure time of flight
3566
+	 * @param String $arrival_airport_time arrival time of flight
3567
+	 * @param String $squawk squawk code of flight
3568
+	 * @param String $route_stop route stop of flight
3569
+	 * @param String $highlight highlight or not
3570
+	 * @param String $ModeS ModesS code of flight
3571
+	 * @param String $registration registration code of flight
3572
+	 * @param String $pilot_id pilot id of flight (for virtual airlines)
3573
+	 * @param String $pilot_name pilot name of flight (for virtual airlines)
3574
+	 * @param String $verticalrate vertival rate of flight
3575
+	 * @return String success or false
3576
+	 */
3577 3577
 	public function addSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $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 = '')
3578 3578
 	{
3579 3579
 		global $globalURL, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalDebugTimeElapsed, $globalAirlinesSource, $globalVAM;
@@ -3788,8 +3788,8 @@  discard block
 block discarded – undo
3788 3788
     
3789 3789
 		if ($globalIVAO && $aircraft_icao != '')
3790 3790
 		{
3791
-            		if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao'];
3792
-            		else $airline_icao = '';
3791
+					if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao'];
3792
+					else $airline_icao = '';
3793 3793
 			$image_array = $Image->getSpotterImage('',$aircraft_icao,$airline_icao);
3794 3794
 			if (!isset($image_array[0]['registration']))
3795 3795
 			{
@@ -3820,53 +3820,53 @@  discard block
 block discarded – undo
3820 3820
 	
3821 3821
 		if (count($airline_array) == 0) 
3822 3822
 		{
3823
-                        $airline_array = $this->getAllAirlineInfo('NA');
3824
-                }
3825
-                if (count($aircraft_array) == 0) 
3826
-                {
3827
-                        $aircraft_array = $this->getAllAircraftInfo('NA');
3828
-                }
3829
-                if (count($departure_airport_array) == 0 || $departure_airport_array[0]['icao'] == '' || $departure_airport_icao == '') 
3830
-                {
3831
-                        $departure_airport_array = $this->getAllAirportInfo('NA');
3832
-                }
3833
-                if (count($arrival_airport_array) == 0 || $arrival_airport_array[0]['icao'] == '' || $arrival_airport_icao == '') 
3834
-                {
3835
-                        $arrival_airport_array = $this->getAllAirportInfo('NA');
3836
-                }
3837
-                if ($registration == '') $registration = 'NA';
3838
-                if ($latitude == '' && $longitude == '') {
3839
-            		$latitude = 0;
3840
-            		$longitude = 0;
3841
-            	}
3842
-                if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL;
3843
-                if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL;
3844
-                if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
3845
-                if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
3846
-                if (!isset($aircraft_owner)) $aircraft_owner = NULL;
3847
-                $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) 
3823
+						$airline_array = $this->getAllAirlineInfo('NA');
3824
+				}
3825
+				if (count($aircraft_array) == 0) 
3826
+				{
3827
+						$aircraft_array = $this->getAllAircraftInfo('NA');
3828
+				}
3829
+				if (count($departure_airport_array) == 0 || $departure_airport_array[0]['icao'] == '' || $departure_airport_icao == '') 
3830
+				{
3831
+						$departure_airport_array = $this->getAllAirportInfo('NA');
3832
+				}
3833
+				if (count($arrival_airport_array) == 0 || $arrival_airport_array[0]['icao'] == '' || $arrival_airport_icao == '') 
3834
+				{
3835
+						$arrival_airport_array = $this->getAllAirportInfo('NA');
3836
+				}
3837
+				if ($registration == '') $registration = 'NA';
3838
+				if ($latitude == '' && $longitude == '') {
3839
+					$latitude = 0;
3840
+					$longitude = 0;
3841
+				}
3842
+				if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL;
3843
+				if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL;
3844
+				if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
3845
+				if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
3846
+				if (!isset($aircraft_owner)) $aircraft_owner = NULL;
3847
+				$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) 
3848 3848
                 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)";
3849 3849
 
3850
-                $airline_name = $airline_array[0]['name'];
3851
-                $airline_icao = $airline_array[0]['icao'];
3852
-                $airline_country = $airline_array[0]['country'];
3853
-                $airline_type = $airline_array[0]['type'];
3850
+				$airline_name = $airline_array[0]['name'];
3851
+				$airline_icao = $airline_array[0]['icao'];
3852
+				$airline_country = $airline_array[0]['country'];
3853
+				$airline_type = $airline_array[0]['type'];
3854 3854
 		if ($airline_type == '') {
3855 3855
 			$timeelapsed = microtime(true);
3856 3856
 			$airline_type = $this->getAircraftTypeBymodeS($ModeS);
3857 3857
 			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3858 3858
 		}
3859 3859
 		if ($airline_type == null) $airline_type = '';
3860
-                $aircraft_type = $aircraft_array[0]['type'];
3861
-                $aircraft_manufacturer = $aircraft_array[0]['manufacturer'];
3862
-                $departure_airport_name = $departure_airport_array[0]['name'];
3863
-	        $departure_airport_city = $departure_airport_array[0]['city'];
3864
-            	$departure_airport_country = $departure_airport_array[0]['country'];
3860
+				$aircraft_type = $aircraft_array[0]['type'];
3861
+				$aircraft_manufacturer = $aircraft_array[0]['manufacturer'];
3862
+				$departure_airport_name = $departure_airport_array[0]['name'];
3863
+			$departure_airport_city = $departure_airport_array[0]['city'];
3864
+				$departure_airport_country = $departure_airport_array[0]['country'];
3865 3865
                 
3866
-                $arrival_airport_name = $arrival_airport_array[0]['name'];
3867
-                $arrival_airport_city = $arrival_airport_array[0]['city'];
3868
-                $arrival_airport_country = $arrival_airport_array[0]['country'];
3869
-                $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);
3866
+				$arrival_airport_name = $arrival_airport_array[0]['name'];
3867
+				$arrival_airport_city = $arrival_airport_array[0]['city'];
3868
+				$arrival_airport_country = $arrival_airport_array[0]['country'];
3869
+				$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);
3870 3870
 
3871 3871
 		try {
3872 3872
 		        
@@ -3874,7 +3874,7 @@  discard block
 block discarded – undo
3874 3874
 			$sth->execute($query_values);
3875 3875
 			$this->db = null;
3876 3876
 		} catch (PDOException $e) {
3877
-		    return "error : ".$e->getMessage();
3877
+			return "error : ".$e->getMessage();
3878 3878
 		}
3879 3879
 		
3880 3880
 		return "success";
@@ -3883,11 +3883,11 @@  discard block
 block discarded – undo
3883 3883
 	
3884 3884
   
3885 3885
 	/**
3886
-	* Gets the aircraft ident within the last hour
3887
-	*
3888
-	* @return String the ident
3889
-	*
3890
-	*/
3886
+	 * Gets the aircraft ident within the last hour
3887
+	 *
3888
+	 * @return String the ident
3889
+	 *
3890
+	 */
3891 3891
 	public function getIdentFromLastHour($ident)
3892 3892
 	{
3893 3893
 		global $globalDBdriver, $globalTimezone;
@@ -3903,11 +3903,11 @@  discard block
 block discarded – undo
3903 3903
 								AND spotter_output.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS'
3904 3904
 								AND spotter_output.date < now() AT TIME ZONE 'UTC'";
3905 3905
 			$query_data = array(':ident' => $ident);
3906
-    		}
3906
+			}
3907 3907
 		
3908 3908
 		$sth = $this->db->prepare($query);
3909 3909
 		$sth->execute($query_data);
3910
-    		$ident_result='';
3910
+			$ident_result='';
3911 3911
 		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3912 3912
 		{
3913 3913
 			$ident_result = $row['ident'];
@@ -3918,11 +3918,11 @@  discard block
 block discarded – undo
3918 3918
 	
3919 3919
 	
3920 3920
 	/**
3921
-	* Gets the aircraft data from the last 20 seconds
3922
-	*
3923
-	* @return Array the spotter data
3924
-	*
3925
-	*/
3921
+	 * Gets the aircraft data from the last 20 seconds
3922
+	 *
3923
+	 * @return Array the spotter data
3924
+	 *
3925
+	 */
3926 3926
 	public function getRealTimeData($q = '')
3927 3927
 	{
3928 3928
 		global $globalDBdriver;
@@ -3966,11 +3966,11 @@  discard block
 block discarded – undo
3966 3966
 	
3967 3967
 	
3968 3968
 	 /**
3969
-	* Gets all airlines that have flown over
3970
-	*
3971
-	* @return Array the airline list
3972
-	*
3973
-	*/
3969
+	  * Gets all airlines that have flown over
3970
+	  *
3971
+	  * @return Array the airline list
3972
+	  *
3973
+	  */
3974 3974
 	public function countAllAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(), $year = '', $month = '', $day = '')
3975 3975
 	{
3976 3976
 		global $globalDBdriver;
@@ -3984,7 +3984,7 @@  discard block
 block discarded – undo
3984 3984
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
3985 3985
 			}
3986 3986
 		}
3987
-                if ($sincedate != '') {
3987
+				if ($sincedate != '') {
3988 3988
 			if ($globalDBdriver == 'mysql') {
3989 3989
 				$query .= " AND spotter_output.date > '".$sincedate."'";
3990 3990
 			} else {
@@ -4038,26 +4038,26 @@  discard block
 block discarded – undo
4038 4038
 	}
4039 4039
 
4040 4040
 	 /**
4041
-	* Gets all pilots that have flown over
4042
-	*
4043
-	* @return Array the pilots list
4044
-	*
4045
-	*/
4041
+	  * Gets all pilots that have flown over
4042
+	  *
4043
+	  * @return Array the pilots list
4044
+	  *
4045
+	  */
4046 4046
 	public function countAllPilots($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '', $month = '',$day = '')
4047 4047
 	{
4048 4048
 		global $globalDBdriver;
4049 4049
 		$filter_query = $this->getFilter($filters,true,true);
4050 4050
 		$query  = "SELECT DISTINCT spotter_output.pilot_id, s.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count, spotter_output.format_source
4051 4051
 			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 <> ''";
4052
-                if ($olderthanmonths > 0) {
4053
-            		if ($globalDBdriver == 'mysql') {
4052
+				if ($olderthanmonths > 0) {
4053
+					if ($globalDBdriver == 'mysql') {
4054 4054
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
4055 4055
 			} else {
4056 4056
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
4057 4057
 			}
4058 4058
 		}
4059
-                if ($sincedate != '') {
4060
-            		if ($globalDBdriver == 'mysql') {
4059
+				if ($sincedate != '') {
4060
+					if ($globalDBdriver == 'mysql') {
4061 4061
 				$query .= " AND spotter_output.date > '".$sincedate."'";
4062 4062
 			} else {
4063 4063
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -4112,25 +4112,25 @@  discard block
 block discarded – undo
4112 4112
 	}
4113 4113
 	
4114 4114
 	/**
4115
-	* Gets all pilots that have flown over
4116
-	*
4117
-	* @return Array the pilots list
4118
-	*
4119
-	*/
4115
+	 * Gets all pilots that have flown over
4116
+	 *
4117
+	 * @return Array the pilots list
4118
+	 *
4119
+	 */
4120 4120
 	public function countAllPilotsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '')
4121 4121
 	{
4122 4122
 		global $globalDBdriver;
4123 4123
 		$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
4124 4124
 		 			FROM spotter_output WHERE spotter_output.pilot_id <> '' ";
4125
-                if ($olderthanmonths > 0) {
4126
-            		if ($globalDBdriver == 'mysql') {
4125
+				if ($olderthanmonths > 0) {
4126
+					if ($globalDBdriver == 'mysql') {
4127 4127
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
4128 4128
 			} else {
4129 4129
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
4130 4130
 			}
4131 4131
 		}
4132
-                if ($sincedate != '') {
4133
-            		if ($globalDBdriver == 'mysql') {
4132
+				if ($sincedate != '') {
4133
+					if ($globalDBdriver == 'mysql') {
4134 4134
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
4135 4135
 			} else {
4136 4136
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -4159,26 +4159,26 @@  discard block
 block discarded – undo
4159 4159
 	}
4160 4160
 	
4161 4161
 	 /**
4162
-	* Gets all owner that have flown over
4163
-	*
4164
-	* @return Array the pilots list
4165
-	*
4166
-	*/
4162
+	  * Gets all owner that have flown over
4163
+	  *
4164
+	  * @return Array the pilots list
4165
+	  *
4166
+	  */
4167 4167
 	public function countAllOwners($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '',$month = '',$day = '')
4168 4168
 	{
4169 4169
 		global $globalDBdriver;
4170 4170
 		$filter_query = $this->getFilter($filters,true,true);
4171 4171
 		$query  = "SELECT DISTINCT spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
4172 4172
 					FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL";
4173
-                if ($olderthanmonths > 0) {
4174
-            		if ($globalDBdriver == 'mysql') {
4173
+				if ($olderthanmonths > 0) {
4174
+					if ($globalDBdriver == 'mysql') {
4175 4175
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
4176 4176
 			} else {
4177 4177
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
4178 4178
 			}
4179 4179
 		}
4180
-                if ($sincedate != '') {
4181
-            		if ($globalDBdriver == 'mysql') {
4180
+				if ($sincedate != '') {
4181
+					if ($globalDBdriver == 'mysql') {
4182 4182
 				$query .= " AND spotter_output.date > '".$sincedate."' ";
4183 4183
 			} else {
4184 4184
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -4229,26 +4229,26 @@  discard block
 block discarded – undo
4229 4229
 	}
4230 4230
 	
4231 4231
 	 /**
4232
-	* Gets all owner that have flown over
4233
-	*
4234
-	* @return Array the pilots list
4235
-	*
4236
-	*/
4232
+	  * Gets all owner that have flown over
4233
+	  *
4234
+	  * @return Array the pilots list
4235
+	  *
4236
+	  */
4237 4237
 	public function countAllOwnersByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
4238 4238
 	{
4239 4239
 		global $globalDBdriver;
4240 4240
 		$filter_query = $this->getFilter($filters,true,true);
4241 4241
 		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
4242 4242
 		 			FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL ";
4243
-                if ($olderthanmonths > 0) {
4244
-            		if ($globalDBdriver == 'mysql') {
4243
+				if ($olderthanmonths > 0) {
4244
+					if ($globalDBdriver == 'mysql') {
4245 4245
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
4246 4246
 			} else {
4247 4247
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
4248 4248
 			}
4249 4249
 		}
4250
-                if ($sincedate != '') {
4251
-            		if ($globalDBdriver == 'mysql') {
4250
+				if ($sincedate != '') {
4251
+					if ($globalDBdriver == 'mysql') {
4252 4252
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
4253 4253
 			} else {
4254 4254
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -4275,11 +4275,11 @@  discard block
 block discarded – undo
4275 4275
 	}
4276 4276
 
4277 4277
 	/**
4278
-	* Gets all airlines that have flown over by aircraft
4279
-	*
4280
-	* @return Array the airline list
4281
-	*
4282
-	*/
4278
+	 * Gets all airlines that have flown over by aircraft
4279
+	 *
4280
+	 * @return Array the airline list
4281
+	 *
4282
+	 */
4283 4283
 	public function countAllAirlinesByAircraft($aircraft_icao,$filters = array())
4284 4284
 	{
4285 4285
 		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
@@ -4311,11 +4311,11 @@  discard block
 block discarded – undo
4311 4311
 
4312 4312
 
4313 4313
 	/**
4314
-	* Gets all airline countries that have flown over by aircraft
4315
-	*
4316
-	* @return Array the airline country list
4317
-	*
4318
-	*/
4314
+	 * Gets all airline countries that have flown over by aircraft
4315
+	 *
4316
+	 * @return Array the airline country list
4317
+	 *
4318
+	 */
4319 4319
 	public function countAllAirlineCountriesByAircraft($aircraft_icao,$filters = array())
4320 4320
 	{
4321 4321
 		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
@@ -4347,11 +4347,11 @@  discard block
 block discarded – undo
4347 4347
 	
4348 4348
 	
4349 4349
 	/**
4350
-	* Gets all airlines that have flown over by airport
4351
-	*
4352
-	* @return Array the airline list
4353
-	*
4354
-	*/
4350
+	 * Gets all airlines that have flown over by airport
4351
+	 *
4352
+	 * @return Array the airline list
4353
+	 *
4354
+	 */
4355 4355
 	public function countAllAirlinesByAirport($airport_icao,$filters = array())
4356 4356
 	{
4357 4357
 		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
@@ -4382,11 +4382,11 @@  discard block
 block discarded – undo
4382 4382
 
4383 4383
 
4384 4384
 	/**
4385
-	* Gets all airline countries that have flown over by airport icao
4386
-	*
4387
-	* @return Array the airline country list
4388
-	*
4389
-	*/
4385
+	 * Gets all airline countries that have flown over by airport icao
4386
+	 *
4387
+	 * @return Array the airline country list
4388
+	 *
4389
+	 */
4390 4390
 	public function countAllAirlineCountriesByAirport($airport_icao,$filters = array())
4391 4391
 	{
4392 4392
 		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
@@ -4416,11 +4416,11 @@  discard block
 block discarded – undo
4416 4416
 
4417 4417
 
4418 4418
 	/**
4419
-	* Gets all airlines that have flown over by aircraft manufacturer
4420
-	*
4421
-	* @return Array the airline list
4422
-	*
4423
-	*/
4419
+	 * Gets all airlines that have flown over by aircraft manufacturer
4420
+	 *
4421
+	 * @return Array the airline list
4422
+	 *
4423
+	 */
4424 4424
 	public function countAllAirlinesByManufacturer($aircraft_manufacturer,$filters = array())
4425 4425
 	{
4426 4426
 		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
@@ -4451,11 +4451,11 @@  discard block
 block discarded – undo
4451 4451
 
4452 4452
 
4453 4453
 	/**
4454
-	* Gets all airline countries that have flown over by aircraft manufacturer
4455
-	*
4456
-	* @return Array the airline country list
4457
-	*
4458
-	*/
4454
+	 * Gets all airline countries that have flown over by aircraft manufacturer
4455
+	 *
4456
+	 * @return Array the airline country list
4457
+	 *
4458
+	 */
4459 4459
 	public function countAllAirlineCountriesByManufacturer($aircraft_manufacturer,$filters = array())
4460 4460
 	{
4461 4461
 		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
@@ -4484,11 +4484,11 @@  discard block
 block discarded – undo
4484 4484
 
4485 4485
 
4486 4486
 	/**
4487
-	* Gets all airlines that have flown over by date
4488
-	*
4489
-	* @return Array the airline list
4490
-	*
4491
-	*/
4487
+	 * Gets all airlines that have flown over by date
4488
+	 *
4489
+	 * @return Array the airline list
4490
+	 *
4491
+	 */
4492 4492
 	public function countAllAirlinesByDate($date,$filters = array())
4493 4493
 	{
4494 4494
 		global $globalTimezone, $globalDBdriver;
@@ -4532,11 +4532,11 @@  discard block
 block discarded – undo
4532 4532
 	
4533 4533
 	
4534 4534
 	/**
4535
-	* Gets all airline countries that have flown over by date
4536
-	*
4537
-	* @return Array the airline country list
4538
-	*
4539
-	*/
4535
+	 * Gets all airline countries that have flown over by date
4536
+	 *
4537
+	 * @return Array the airline country list
4538
+	 *
4539
+	 */
4540 4540
 	public function countAllAirlineCountriesByDate($date,$filters = array())
4541 4541
 	{
4542 4542
 		global $globalTimezone, $globalDBdriver;
@@ -4579,11 +4579,11 @@  discard block
 block discarded – undo
4579 4579
 
4580 4580
 
4581 4581
 	/**
4582
-	* Gets all airlines that have flown over by ident/callsign
4583
-	*
4584
-	* @return Array the airline list
4585
-	*
4586
-	*/
4582
+	 * Gets all airlines that have flown over by ident/callsign
4583
+	 *
4584
+	 * @return Array the airline list
4585
+	 *
4586
+	 */
4587 4587
 	public function countAllAirlinesByIdent($ident,$filters = array())
4588 4588
 	{
4589 4589
 		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
@@ -4600,11 +4600,11 @@  discard block
 block discarded – undo
4600 4600
 	}
4601 4601
 
4602 4602
 	/**
4603
-	* Gets all airlines by owner
4604
-	*
4605
-	* @return Array the airline list
4606
-	*
4607
-	*/
4603
+	 * Gets all airlines by owner
4604
+	 *
4605
+	 * @return Array the airline list
4606
+	 *
4607
+	 */
4608 4608
 	public function countAllAirlinesByOwner($owner,$filters = array())
4609 4609
 	{
4610 4610
 		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
@@ -4621,11 +4621,11 @@  discard block
 block discarded – undo
4621 4621
 	}
4622 4622
 
4623 4623
 	/**
4624
-	* Gets flight duration by owner
4625
-	*
4626
-	* @return String Duration of all flights
4627
-	*
4628
-	*/
4624
+	 * Gets flight duration by owner
4625
+	 *
4626
+	 * @return String Duration of all flights
4627
+	 *
4628
+	 */
4629 4629
 	public function getFlightDurationByOwner($owner,$filters = array(),$year = '',$month = '',$day = '')
4630 4630
 	{
4631 4631
 		global $globalDBdriver;
@@ -4670,11 +4670,11 @@  discard block
 block discarded – undo
4670 4670
 	}
4671 4671
 
4672 4672
 	/**
4673
-	* Count flights by owner
4674
-	*
4675
-	* @return String Duration of all flights
4676
-	*
4677
-	*/
4673
+	 * Count flights by owner
4674
+	 *
4675
+	 * @return String Duration of all flights
4676
+	 *
4677
+	 */
4678 4678
 	public function countFlightsByOwner($owner,$filters = array())
4679 4679
 	{
4680 4680
 		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
@@ -4690,11 +4690,11 @@  discard block
 block discarded – undo
4690 4690
 	}
4691 4691
 
4692 4692
 	/**
4693
-	* Count flights by pilot
4694
-	*
4695
-	* @return String Duration of all flights
4696
-	*
4697
-	*/
4693
+	 * Count flights by pilot
4694
+	 *
4695
+	 * @return String Duration of all flights
4696
+	 *
4697
+	 */
4698 4698
 	public function countFlightsByPilot($pilot,$filters = array())
4699 4699
 	{
4700 4700
 		$pilot = filter_var($pilot,FILTER_SANITIZE_STRING);
@@ -4710,11 +4710,11 @@  discard block
 block discarded – undo
4710 4710
 	}
4711 4711
 
4712 4712
 	/**
4713
-	* Gets flight duration by pilot
4714
-	*
4715
-	* @return String Duration of all flights
4716
-	*
4717
-	*/
4713
+	 * Gets flight duration by pilot
4714
+	 *
4715
+	 * @return String Duration of all flights
4716
+	 *
4717
+	 */
4718 4718
 	public function getFlightDurationByPilot($pilot,$filters = array(),$year = '',$month = '',$day = '')
4719 4719
 	{
4720 4720
 		global $globalDBdriver;
@@ -4759,11 +4759,11 @@  discard block
 block discarded – undo
4759 4759
 	}
4760 4760
 
4761 4761
 	/**
4762
-	* Gets all airlines used by pilot
4763
-	*
4764
-	* @return Array the airline list
4765
-	*
4766
-	*/
4762
+	 * Gets all airlines used by pilot
4763
+	 *
4764
+	 * @return Array the airline list
4765
+	 *
4766
+	 */
4767 4767
 	public function countAllAirlinesByPilot($pilot,$filters = array())
4768 4768
 	{
4769 4769
 		$pilot = filter_var($pilot,FILTER_SANITIZE_STRING);
@@ -4780,11 +4780,11 @@  discard block
 block discarded – undo
4780 4780
 	}
4781 4781
 
4782 4782
 	/**
4783
-	* Gets all airlines that have flown over by route
4784
-	*
4785
-	* @return Array the airline list
4786
-	*
4787
-	*/
4783
+	 * Gets all airlines that have flown over by route
4784
+	 *
4785
+	 * @return Array the airline list
4786
+	 *
4787
+	 */
4788 4788
 	public function countAllAirlinesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
4789 4789
 	{
4790 4790
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4816,11 +4816,11 @@  discard block
 block discarded – undo
4816 4816
 	}
4817 4817
 
4818 4818
 	/**
4819
-	* Gets all airline countries that have flown over by route
4820
-	*
4821
-	* @return Array the airline country list
4822
-	*
4823
-	*/
4819
+	 * Gets all airline countries that have flown over by route
4820
+	 *
4821
+	 * @return Array the airline country list
4822
+	 *
4823
+	 */
4824 4824
 	public function countAllAirlineCountriesByRoute($departure_airport_icao, $arrival_airport_icao,$filters= array())
4825 4825
 	{
4826 4826
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4852,11 +4852,11 @@  discard block
 block discarded – undo
4852 4852
 
4853 4853
 
4854 4854
 	/**
4855
-	* Gets all airlines that have flown over by country
4856
-	*
4857
-	* @return Array the airline list
4858
-	*
4859
-	*/
4855
+	 * Gets all airlines that have flown over by country
4856
+	 *
4857
+	 * @return Array the airline list
4858
+	 *
4859
+	 */
4860 4860
 	public function countAllAirlinesByCountry($country,$filters = array())
4861 4861
 	{
4862 4862
 		$country = filter_var($country,FILTER_SANITIZE_STRING);
@@ -4886,11 +4886,11 @@  discard block
 block discarded – undo
4886 4886
 
4887 4887
 
4888 4888
 	/**
4889
-	* Gets all airline countries that have flown over by country
4890
-	*
4891
-	* @return Array the airline country list
4892
-	*
4893
-	*/
4889
+	 * Gets all airline countries that have flown over by country
4890
+	 *
4891
+	 * @return Array the airline country list
4892
+	 *
4893
+	 */
4894 4894
 	public function countAllAirlineCountriesByCountry($country,$filters = array())
4895 4895
 	{
4896 4896
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4919,11 +4919,11 @@  discard block
 block discarded – undo
4919 4919
 
4920 4920
 
4921 4921
 	/**
4922
-	* Gets all airlines countries
4923
-	*
4924
-	* @return Array the airline country list
4925
-	*
4926
-	*/
4922
+	 * Gets all airlines countries
4923
+	 *
4924
+	 * @return Array the airline country list
4925
+	 *
4926
+	 */
4927 4927
 	public function countAllAirlineCountries($limit = true, $filters = array(), $year = '', $month = '', $day = '')
4928 4928
 	{
4929 4929
 		global $globalDBdriver;
@@ -4978,11 +4978,11 @@  discard block
 block discarded – undo
4978 4978
 	}
4979 4979
 
4980 4980
 	/**
4981
-	* Gets all number of flight over countries
4982
-	*
4983
-	* @return Array the airline country list
4984
-	*
4985
-	*/
4981
+	 * Gets all number of flight over countries
4982
+	 *
4983
+	 * @return Array the airline country list
4984
+	 *
4985
+	 */
4986 4986
 	public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
4987 4987
 	{
4988 4988
 		global $globalDBdriver;
@@ -5004,15 +5004,15 @@  discard block
 block discarded – undo
5004 5004
 		$SpotterLive = new SpotterLive();
5005 5005
 		$filter_query = $SpotterLive->getFilter($filters,true,true);
5006 5006
 		$filter_query .= ' over_country IS NOT NULL';
5007
-                if ($olderthanmonths > 0) {
5007
+				if ($olderthanmonths > 0) {
5008 5008
 			if ($globalDBdriver == 'mysql') {
5009 5009
 				$filter_query .= ' AND spotter_live.date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5010 5010
 			} else {
5011 5011
 				$filter_query .= " AND spotter_live.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
5012 5012
 			}
5013 5013
 		}
5014
-                if ($sincedate != '') {
5015
-            		if ($globalDBdriver == 'mysql') {
5014
+				if ($sincedate != '') {
5015
+					if ($globalDBdriver == 'mysql') {
5016 5016
 				$filter_query .= " AND spotter_live.date > '".$sincedate."' ";
5017 5017
 			} else {
5018 5018
 				$filter_query .= " AND spotter_live.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -5042,11 +5042,11 @@  discard block
 block discarded – undo
5042 5042
 	
5043 5043
 	
5044 5044
 	/**
5045
-	* Gets all aircraft types that have flown over
5046
-	*
5047
-	* @return Array the aircraft list
5048
-	*
5049
-	*/
5045
+	 * Gets all aircraft types that have flown over
5046
+	 *
5047
+	 * @return Array the aircraft list
5048
+	 *
5049
+	 */
5050 5050
 	public function countAllAircraftTypes($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '',$month = '',$day = '')
5051 5051
 	{
5052 5052
 		global $globalDBdriver;
@@ -5116,11 +5116,11 @@  discard block
 block discarded – undo
5116 5116
 	}
5117 5117
 
5118 5118
 	/**
5119
-	* Gets all aircraft types that have flown over by airline
5120
-	*
5121
-	* @return Array the aircraft list
5122
-	*
5123
-	*/
5119
+	 * Gets all aircraft types that have flown over by airline
5120
+	 *
5121
+	 * @return Array the aircraft list
5122
+	 *
5123
+	 */
5124 5124
 	public function countAllAircraftTypesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '',$month = '', $day = '')
5125 5125
 	{
5126 5126
 		global $globalDBdriver;
@@ -5191,11 +5191,11 @@  discard block
 block discarded – undo
5191 5191
 	}
5192 5192
 
5193 5193
 	/**
5194
-	* Gets all aircraft types that have flown over by months
5195
-	*
5196
-	* @return Array the aircraft list
5197
-	*
5198
-	*/
5194
+	 * Gets all aircraft types that have flown over by months
5195
+	 *
5196
+	 * @return Array the aircraft list
5197
+	 *
5198
+	 */
5199 5199
 	public function countAllAircraftTypesByMonths($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
5200 5200
 	{
5201 5201
 		global $globalDBdriver;
@@ -5239,11 +5239,11 @@  discard block
 block discarded – undo
5239 5239
 
5240 5240
 
5241 5241
 	/**
5242
-	* Gets all aircraft registration that have flown over by aircaft icao
5243
-	*
5244
-	* @return Array the aircraft list
5245
-	*
5246
-	*/
5242
+	 * Gets all aircraft registration that have flown over by aircaft icao
5243
+	 *
5244
+	 * @return Array the aircraft list
5245
+	 *
5246
+	 */
5247 5247
 	public function countAllAircraftRegistrationByAircraft($aircraft_icao,$filters = array())
5248 5248
 	{
5249 5249
 		$Image = new Image($this->db);
@@ -5282,11 +5282,11 @@  discard block
 block discarded – undo
5282 5282
 
5283 5283
 
5284 5284
 	/**
5285
-	* Gets all aircraft types that have flown over by airline icao
5286
-	*
5287
-	* @return Array the aircraft list
5288
-	*
5289
-	*/
5285
+	 * Gets all aircraft types that have flown over by airline icao
5286
+	 *
5287
+	 * @return Array the aircraft list
5288
+	 *
5289
+	 */
5290 5290
 	public function countAllAircraftTypesByAirline($airline_icao,$filters = array())
5291 5291
 	{
5292 5292
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5315,11 +5315,11 @@  discard block
 block discarded – undo
5315 5315
 
5316 5316
 
5317 5317
 	/**
5318
-	* Gets all aircraft registration that have flown over by airline icao
5319
-	*
5320
-	* @return Array the aircraft list
5321
-	*
5322
-	*/
5318
+	 * Gets all aircraft registration that have flown over by airline icao
5319
+	 *
5320
+	 * @return Array the aircraft list
5321
+	 *
5322
+	 */
5323 5323
 	public function countAllAircraftRegistrationByAirline($airline_icao,$filters = array())
5324 5324
 	{
5325 5325
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5357,11 +5357,11 @@  discard block
 block discarded – undo
5357 5357
 
5358 5358
 
5359 5359
 	/**
5360
-	* Gets all aircraft manufacturer that have flown over by airline icao
5361
-	*
5362
-	* @return Array the aircraft list
5363
-	*
5364
-	*/
5360
+	 * Gets all aircraft manufacturer that have flown over by airline icao
5361
+	 *
5362
+	 * @return Array the aircraft list
5363
+	 *
5364
+	 */
5365 5365
 	public function countAllAircraftManufacturerByAirline($airline_icao,$filters = array())
5366 5366
 	{
5367 5367
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5389,11 +5389,11 @@  discard block
 block discarded – undo
5389 5389
 
5390 5390
 
5391 5391
 	/**
5392
-	* Gets all aircraft types that have flown over by airline icao
5393
-	*
5394
-	* @return Array the aircraft list
5395
-	*
5396
-	*/
5392
+	 * Gets all aircraft types that have flown over by airline icao
5393
+	 *
5394
+	 * @return Array the aircraft list
5395
+	 *
5396
+	 */
5397 5397
 	public function countAllAircraftTypesByAirport($airport_icao,$filters = array())
5398 5398
 	{
5399 5399
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5422,11 +5422,11 @@  discard block
 block discarded – undo
5422 5422
 
5423 5423
 
5424 5424
 	/**
5425
-	* Gets all aircraft registration that have flown over by airport icao
5426
-	*
5427
-	* @return Array the aircraft list
5428
-	*
5429
-	*/
5425
+	 * Gets all aircraft registration that have flown over by airport icao
5426
+	 *
5427
+	 * @return Array the aircraft list
5428
+	 *
5429
+	 */
5430 5430
 	public function countAllAircraftRegistrationByAirport($airport_icao,$filters = array())
5431 5431
 	{
5432 5432
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5463,11 +5463,11 @@  discard block
 block discarded – undo
5463 5463
 	
5464 5464
 	
5465 5465
 	/**
5466
-	* Gets all aircraft manufacturer that have flown over by airport icao
5467
-	*
5468
-	* @return Array the aircraft list
5469
-	*
5470
-	*/
5466
+	 * Gets all aircraft manufacturer that have flown over by airport icao
5467
+	 *
5468
+	 * @return Array the aircraft list
5469
+	 *
5470
+	 */
5471 5471
 	public function countAllAircraftManufacturerByAirport($airport_icao,$filters = array())
5472 5472
 	{
5473 5473
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5493,11 +5493,11 @@  discard block
 block discarded – undo
5493 5493
 	}
5494 5494
 
5495 5495
 	/**
5496
-	* Gets all aircraft types that have flown over by aircraft manufacturer
5497
-	*
5498
-	* @return Array the aircraft list
5499
-	*
5500
-	*/
5496
+	 * Gets all aircraft types that have flown over by aircraft manufacturer
5497
+	 *
5498
+	 * @return Array the aircraft list
5499
+	 *
5500
+	 */
5501 5501
 	public function countAllAircraftTypesByManufacturer($aircraft_manufacturer,$filters = array())
5502 5502
 	{
5503 5503
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5524,11 +5524,11 @@  discard block
 block discarded – undo
5524 5524
 
5525 5525
 
5526 5526
 	/**
5527
-	* Gets all aircraft registration that have flown over by aircaft manufacturer
5528
-	*
5529
-	* @return Array the aircraft list
5530
-	*
5531
-	*/
5527
+	 * Gets all aircraft registration that have flown over by aircaft manufacturer
5528
+	 *
5529
+	 * @return Array the aircraft list
5530
+	 *
5531
+	 */
5532 5532
 	public function countAllAircraftRegistrationByManufacturer($aircraft_manufacturer, $filters = array())
5533 5533
 	{
5534 5534
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5564,11 +5564,11 @@  discard block
 block discarded – undo
5564 5564
 	}
5565 5565
 
5566 5566
 	/**
5567
-	* Gets all aircraft types that have flown over by date
5568
-	*
5569
-	* @return Array the aircraft list
5570
-	*
5571
-	*/
5567
+	 * Gets all aircraft types that have flown over by date
5568
+	 *
5569
+	 * @return Array the aircraft list
5570
+	 *
5571
+	 */
5572 5572
 	public function countAllAircraftTypesByDate($date,$filters = array())
5573 5573
 	{
5574 5574
 		global $globalTimezone, $globalDBdriver;
@@ -5610,11 +5610,11 @@  discard block
 block discarded – undo
5610 5610
 
5611 5611
 
5612 5612
 	/**
5613
-	* Gets all aircraft registration that have flown over by date
5614
-	*
5615
-	* @return Array the aircraft list
5616
-	*
5617
-	*/
5613
+	 * Gets all aircraft registration that have flown over by date
5614
+	 *
5615
+	 * @return Array the aircraft list
5616
+	 *
5617
+	 */
5618 5618
 	public function countAllAircraftRegistrationByDate($date,$filters = array())
5619 5619
 	{
5620 5620
 		global $globalTimezone, $globalDBdriver;
@@ -5665,11 +5665,11 @@  discard block
 block discarded – undo
5665 5665
 
5666 5666
 
5667 5667
 	/**
5668
-	* Gets all aircraft manufacturer that have flown over by date
5669
-	*
5670
-	* @return Array the aircraft manufacturer list
5671
-	*
5672
-	*/
5668
+	 * Gets all aircraft manufacturer that have flown over by date
5669
+	 *
5670
+	 * @return Array the aircraft manufacturer list
5671
+	 *
5672
+	 */
5673 5673
 	public function countAllAircraftManufacturerByDate($date,$filters = array())
5674 5674
 	{
5675 5675
 		global $globalTimezone, $globalDBdriver;
@@ -5711,11 +5711,11 @@  discard block
 block discarded – undo
5711 5711
 
5712 5712
 
5713 5713
 	/**
5714
-	* Gets all aircraft types that have flown over by ident/callsign
5715
-	*
5716
-	* @return Array the aircraft list
5717
-	*
5718
-	*/
5714
+	 * Gets all aircraft types that have flown over by ident/callsign
5715
+	 *
5716
+	 * @return Array the aircraft list
5717
+	 *
5718
+	 */
5719 5719
 	public function countAllAircraftTypesByIdent($ident,$filters = array())
5720 5720
 	{
5721 5721
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5743,11 +5743,11 @@  discard block
 block discarded – undo
5743 5743
 	}
5744 5744
 
5745 5745
 	/**
5746
-	* Gets all aircraft types that have flown over by pilot
5747
-	*
5748
-	* @return Array the aircraft list
5749
-	*
5750
-	*/
5746
+	 * Gets all aircraft types that have flown over by pilot
5747
+	 *
5748
+	 * @return Array the aircraft list
5749
+	 *
5750
+	 */
5751 5751
 	public function countAllAircraftTypesByPilot($pilot,$filters = array(),$year = '',$month = '',$day = '')
5752 5752
 	{
5753 5753
 		global $globalDBdriver;
@@ -5793,11 +5793,11 @@  discard block
 block discarded – undo
5793 5793
 	}
5794 5794
 
5795 5795
 	/**
5796
-	* Gets all aircraft types that have flown over by owner
5797
-	*
5798
-	* @return Array the aircraft list
5799
-	*
5800
-	*/
5796
+	 * Gets all aircraft types that have flown over by owner
5797
+	 *
5798
+	 * @return Array the aircraft list
5799
+	 *
5800
+	 */
5801 5801
 	public function countAllAircraftTypesByOwner($owner,$filters = array(),$year = '',$month = '',$day = '')
5802 5802
 	{
5803 5803
 		global $globalDBdriver;
@@ -5842,11 +5842,11 @@  discard block
 block discarded – undo
5842 5842
 	}
5843 5843
 
5844 5844
 	/**
5845
-	* Gets all aircraft registration that have flown over by ident/callsign
5846
-	*
5847
-	* @return Array the aircraft list
5848
-	*
5849
-	*/
5845
+	 * Gets all aircraft registration that have flown over by ident/callsign
5846
+	 *
5847
+	 * @return Array the aircraft list
5848
+	 *
5849
+	 */
5850 5850
 	public function countAllAircraftRegistrationByIdent($ident,$filters = array())
5851 5851
 	{
5852 5852
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5885,11 +5885,11 @@  discard block
 block discarded – undo
5885 5885
 	}
5886 5886
 
5887 5887
 	/**
5888
-	* Gets all aircraft registration that have flown over by owner
5889
-	*
5890
-	* @return Array the aircraft list
5891
-	*
5892
-	*/
5888
+	 * Gets all aircraft registration that have flown over by owner
5889
+	 *
5890
+	 * @return Array the aircraft list
5891
+	 *
5892
+	 */
5893 5893
 	public function countAllAircraftRegistrationByOwner($owner,$filters = array(),$year = '',$month = '',$day = '')
5894 5894
 	{
5895 5895
 		global $globalDBdriver;
@@ -5960,11 +5960,11 @@  discard block
 block discarded – undo
5960 5960
 	}
5961 5961
 
5962 5962
 	/**
5963
-	* Gets all aircraft registration that have flown over by pilot
5964
-	*
5965
-	* @return Array the aircraft list
5966
-	*
5967
-	*/
5963
+	 * Gets all aircraft registration that have flown over by pilot
5964
+	 *
5965
+	 * @return Array the aircraft list
5966
+	 *
5967
+	 */
5968 5968
 	public function countAllAircraftRegistrationByPilot($pilot,$filters = array(),$year = '',$month = '',$day = '')
5969 5969
 	{
5970 5970
 		global $globalDBdriver;
@@ -6036,11 +6036,11 @@  discard block
 block discarded – undo
6036 6036
 
6037 6037
 
6038 6038
 	/**
6039
-	* Gets all aircraft manufacturer that have flown over by ident/callsign
6040
-	*
6041
-	* @return Array the aircraft manufacturer list
6042
-	*
6043
-	*/
6039
+	 * Gets all aircraft manufacturer that have flown over by ident/callsign
6040
+	 *
6041
+	 * @return Array the aircraft manufacturer list
6042
+	 *
6043
+	 */
6044 6044
 	public function countAllAircraftManufacturerByIdent($ident,$filters = array())
6045 6045
 	{
6046 6046
 		$filter_query = $this->getFilter($filters,true,true);
@@ -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 owner
6069
-	*
6070
-	* @return Array the aircraft manufacturer list
6071
-	*
6072
-	*/
6068
+	 * Gets all aircraft manufacturer that have flown over by owner
6069
+	 *
6070
+	 * @return Array the aircraft manufacturer list
6071
+	 *
6072
+	 */
6073 6073
 	public function countAllAircraftManufacturerByOwner($owner,$filters = array(),$year = '',$month = '',$day = '')
6074 6074
 	{
6075 6075
 		global $globalDBdriver;
@@ -6117,11 +6117,11 @@  discard block
 block discarded – undo
6117 6117
 	}
6118 6118
 
6119 6119
 	/**
6120
-	* Gets all aircraft manufacturer that have flown over by pilot
6121
-	*
6122
-	* @return Array the aircraft manufacturer list
6123
-	*
6124
-	*/
6120
+	 * Gets all aircraft manufacturer that have flown over by pilot
6121
+	 *
6122
+	 * @return Array the aircraft manufacturer list
6123
+	 *
6124
+	 */
6125 6125
 	public function countAllAircraftManufacturerByPilot($pilot,$filters = array(),$year = '',$month = '',$day = '')
6126 6126
 	{
6127 6127
 		global $globalDBdriver;
@@ -6170,11 +6170,11 @@  discard block
 block discarded – undo
6170 6170
 
6171 6171
 
6172 6172
 	/**
6173
-	* Gets all aircraft types that have flown over by route
6174
-	*
6175
-	* @return Array the aircraft list
6176
-	*
6177
-	*/
6173
+	 * Gets all aircraft types that have flown over by route
6174
+	 *
6175
+	 * @return Array the aircraft list
6176
+	 *
6177
+	 */
6178 6178
 	public function countAllAircraftTypesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
6179 6179
 	{
6180 6180
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6203,11 +6203,11 @@  discard block
 block discarded – undo
6203 6203
 	}
6204 6204
 
6205 6205
 	/**
6206
-	* Gets all aircraft registration that have flown over by route
6207
-	*
6208
-	* @return Array the aircraft list
6209
-	*
6210
-	*/
6206
+	 * Gets all aircraft registration that have flown over by route
6207
+	 *
6208
+	 * @return Array the aircraft list
6209
+	 *
6210
+	 */
6211 6211
 	public function countAllAircraftRegistrationByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
6212 6212
 	{
6213 6213
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6249,11 +6249,11 @@  discard block
 block discarded – undo
6249 6249
 	
6250 6250
 	
6251 6251
 	/**
6252
-	* Gets all aircraft manufacturer that have flown over by route
6253
-	*
6254
-	* @return Array the aircraft manufacturer list
6255
-	*
6256
-	*/
6252
+	 * Gets all aircraft manufacturer that have flown over by route
6253
+	 *
6254
+	 * @return Array the aircraft manufacturer list
6255
+	 *
6256
+	 */
6257 6257
 	public function countAllAircraftManufacturerByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
6258 6258
 	{
6259 6259
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6287,11 +6287,11 @@  discard block
 block discarded – undo
6287 6287
 	
6288 6288
 	
6289 6289
 	/**
6290
-	* Gets all aircraft types that have flown over by country
6291
-	*
6292
-	* @return Array the aircraft list
6293
-	*
6294
-	*/
6290
+	 * Gets all aircraft types that have flown over by country
6291
+	 *
6292
+	 * @return Array the aircraft list
6293
+	 *
6294
+	 */
6295 6295
 	public function countAllAircraftTypesByCountry($country,$filters = array())
6296 6296
 	{
6297 6297
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6322,11 +6322,11 @@  discard block
 block discarded – undo
6322 6322
 
6323 6323
 
6324 6324
 	/**
6325
-	* Gets all aircraft registration that have flown over by country
6326
-	*
6327
-	* @return Array the aircraft list
6328
-	*
6329
-	*/
6325
+	 * Gets all aircraft registration that have flown over by country
6326
+	 *
6327
+	 * @return Array the aircraft list
6328
+	 *
6329
+	 */
6330 6330
 	public function countAllAircraftRegistrationByCountry($country,$filters = array())
6331 6331
 	{
6332 6332
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6366,11 +6366,11 @@  discard block
 block discarded – undo
6366 6366
 	
6367 6367
 	
6368 6368
 	/**
6369
-	* Gets all aircraft manufacturer that have flown over by country
6370
-	*
6371
-	* @return Array the aircraft manufacturer list
6372
-	*
6373
-	*/
6369
+	 * Gets all aircraft manufacturer that have flown over by country
6370
+	 *
6371
+	 * @return Array the aircraft manufacturer list
6372
+	 *
6373
+	 */
6374 6374
 	public function countAllAircraftManufacturerByCountry($country,$filters = array())
6375 6375
 	{
6376 6376
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6401,18 +6401,18 @@  discard block
 block discarded – undo
6401 6401
 	
6402 6402
 	
6403 6403
 	/**
6404
-	* Gets all aircraft manufacturers that have flown over
6405
-	*
6406
-	* @return Array the aircraft list
6407
-	*
6408
-	*/
6404
+	 * Gets all aircraft manufacturers that have flown over
6405
+	 *
6406
+	 * @return Array the aircraft list
6407
+	 *
6408
+	 */
6409 6409
 	public function countAllAircraftManufacturers($filters = array(),$year = '',$month = '',$day = '')
6410 6410
 	{
6411 6411
 		global $globalDBdriver;
6412 6412
 		$filter_query = $this->getFilter($filters,true,true);
6413 6413
 		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
6414 6414
                     FROM spotter_output ".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.aircraft_manufacturer <> 'Not Available'";
6415
-                $query_values = array();
6415
+				$query_values = array();
6416 6416
 		if ($year != '') {
6417 6417
 			if ($globalDBdriver == 'mysql') {
6418 6418
 				$query .= " AND YEAR(spotter_output.date) = :year";
@@ -6465,11 +6465,11 @@  discard block
 block discarded – undo
6465 6465
 	
6466 6466
 	
6467 6467
 	/**
6468
-	* Gets all aircraft registrations that have flown over
6469
-	*
6470
-	* @return Array the aircraft list
6471
-	*
6472
-	*/
6468
+	 * Gets all aircraft registrations that have flown over
6469
+	 *
6470
+	 * @return Array the aircraft list
6471
+	 *
6472
+	 */
6473 6473
 	public function countAllAircraftRegistrations($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '', $month = '', $day = '')
6474 6474
 	{
6475 6475
 		global $globalDBdriver;
@@ -6477,15 +6477,15 @@  discard block
 block discarded – undo
6477 6477
 		$filter_query = $this->getFilter($filters,true,true);
6478 6478
 		$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    
6479 6479
                     FROM spotter_output ".$filter_query." spotter_output.registration <> '' AND spotter_output.registration <> 'NA'";
6480
-                if ($olderthanmonths > 0) {
6481
-            		if ($globalDBdriver == 'mysql') {
6480
+				if ($olderthanmonths > 0) {
6481
+					if ($globalDBdriver == 'mysql') {
6482 6482
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
6483 6483
 			} else {
6484 6484
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
6485 6485
 			}
6486 6486
 		}
6487
-                if ($sincedate != '') {
6488
-            		if ($globalDBdriver == 'mysql') {
6487
+				if ($sincedate != '') {
6488
+					if ($globalDBdriver == 'mysql') {
6489 6489
 				$query .= " AND spotter_output.date > '".$sincedate."'";
6490 6490
 			} else {
6491 6491
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -6550,11 +6550,11 @@  discard block
 block discarded – undo
6550 6550
 
6551 6551
 
6552 6552
 	/**
6553
-	* Gets all aircraft registrations that have flown over
6554
-	*
6555
-	* @return Array the aircraft list
6556
-	*
6557
-	*/
6553
+	 * Gets all aircraft registrations that have flown over
6554
+	 *
6555
+	 * @return Array the aircraft list
6556
+	 *
6557
+	 */
6558 6558
 	public function countAllAircraftRegistrationsByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
6559 6559
 	{
6560 6560
 		global $globalDBdriver;
@@ -6562,15 +6562,15 @@  discard block
 block discarded – undo
6562 6562
 		$Image = new Image($this->db);
6563 6563
 		$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    
6564 6564
                     FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.registration <> '' AND spotter_output.registration <> 'NA' ";
6565
-                if ($olderthanmonths > 0) {
6566
-            		if ($globalDBdriver == 'mysql') {
6565
+				if ($olderthanmonths > 0) {
6566
+					if ($globalDBdriver == 'mysql') {
6567 6567
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
6568 6568
 			} else {
6569 6569
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
6570 6570
 			}
6571 6571
 		}
6572
-                if ($sincedate != '') {
6573
-            		if ($globalDBdriver == 'mysql') {
6572
+				if ($sincedate != '') {
6573
+					if ($globalDBdriver == 'mysql') {
6574 6574
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
6575 6575
 			} else {
6576 6576
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -6579,7 +6579,7 @@  discard block
 block discarded – undo
6579 6579
 
6580 6580
 		// if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6581 6581
 		//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6582
-                $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";
6582
+				$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";
6583 6583
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
6584 6584
 		
6585 6585
 		$sth = $this->db->prepare($query);
@@ -6611,26 +6611,26 @@  discard block
 block discarded – undo
6611 6611
 	
6612 6612
 	
6613 6613
 	/**
6614
-	* Gets all departure airports of the airplanes that have flown over
6615
-	*
6616
-	* @return Array the airport list
6617
-	*
6618
-	*/
6614
+	 * Gets all departure airports of the airplanes that have flown over
6615
+	 *
6616
+	 * @return Array the airport list
6617
+	 *
6618
+	 */
6619 6619
 	public function countAllDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '',$month = '',$day = '')
6620 6620
 	{
6621 6621
 		global $globalDBdriver;
6622 6622
 		$filter_query = $this->getFilter($filters,true,true);
6623 6623
 		$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 
6624 6624
 				FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> ''";
6625
-                if ($olderthanmonths > 0) {
6626
-            		if ($globalDBdriver == 'mysql') {
6625
+				if ($olderthanmonths > 0) {
6626
+					if ($globalDBdriver == 'mysql') {
6627 6627
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
6628 6628
 			} else {
6629 6629
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
6630 6630
 			}
6631
-                }
6632
-                if ($sincedate != '') {
6633
-            		if ($globalDBdriver == 'mysql') {
6631
+				}
6632
+				if ($sincedate != '') {
6633
+					if ($globalDBdriver == 'mysql') {
6634 6634
 				$query .= " AND spotter_output.date > '".$sincedate."'";
6635 6635
 			} else {
6636 6636
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -6664,7 +6664,7 @@  discard block
 block discarded – undo
6664 6664
 				$query_values = array_merge($query_values,array(':day' => $day));
6665 6665
 			}
6666 6666
 		}
6667
-                $query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
6667
+				$query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
6668 6668
 				ORDER BY airport_departure_icao_count DESC";
6669 6669
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
6670 6670
 
@@ -6687,35 +6687,35 @@  discard block
 block discarded – undo
6687 6687
 	}
6688 6688
 
6689 6689
 	/**
6690
-	* Gets all departure airports of the airplanes that have flown over
6691
-	*
6692
-	* @return Array the airport list
6693
-	*
6694
-	*/
6690
+	 * Gets all departure airports of the airplanes that have flown over
6691
+	 *
6692
+	 * @return Array the airport list
6693
+	 *
6694
+	 */
6695 6695
 	public function countAllDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
6696 6696
 	{
6697 6697
 		global $globalDBdriver;
6698 6698
 		$filter_query = $this->getFilter($filters,true,true);
6699 6699
 		$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 
6700 6700
 			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 <> '' ";
6701
-                if ($olderthanmonths > 0) {
6702
-            		if ($globalDBdriver == 'mysql') {
6701
+				if ($olderthanmonths > 0) {
6702
+					if ($globalDBdriver == 'mysql') {
6703 6703
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
6704 6704
 			} else {
6705 6705
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
6706 6706
 			}
6707
-                }
6708
-                if ($sincedate != '') {
6709
-            		if ($globalDBdriver == 'mysql') {
6707
+				}
6708
+				if ($sincedate != '') {
6709
+					if ($globalDBdriver == 'mysql') {
6710 6710
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
6711 6711
 			} else {
6712 6712
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
6713 6713
 			}
6714 6714
 		}
6715 6715
 
6716
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6717
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6718
-                $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
6716
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6717
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6718
+				$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
6719 6719
 				ORDER BY airport_departure_icao_count DESC";
6720 6720
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
6721 6721
       
@@ -6740,26 +6740,26 @@  discard block
 block discarded – undo
6740 6740
 	}
6741 6741
 
6742 6742
 	/**
6743
-	* Gets all detected departure airports of the airplanes that have flown over
6744
-	*
6745
-	* @return Array the airport list
6746
-	*
6747
-	*/
6743
+	 * Gets all detected departure airports of the airplanes that have flown over
6744
+	 *
6745
+	 * @return Array the airport list
6746
+	 *
6747
+	 */
6748 6748
 	public function countAllDetectedDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '',$month = '',$day = '')
6749 6749
 	{
6750 6750
 		global $globalDBdriver;
6751 6751
 		$filter_query = $this->getFilter($filters,true,true);
6752 6752
 		$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
6753 6753
 				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";
6754
-                if ($olderthanmonths > 0) {
6755
-            		if ($globalDBdriver == 'mysql') {
6754
+				if ($olderthanmonths > 0) {
6755
+					if ($globalDBdriver == 'mysql') {
6756 6756
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
6757 6757
 			} else {
6758 6758
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
6759 6759
 			}
6760
-                }
6761
-                if ($sincedate != '') {
6762
-            		if ($globalDBdriver == 'mysql') {
6760
+				}
6761
+				if ($sincedate != '') {
6762
+					if ($globalDBdriver == 'mysql') {
6763 6763
 				$query .= " AND spotter_output.date > '".$sincedate."'";
6764 6764
 			} else {
6765 6765
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -6793,10 +6793,10 @@  discard block
 block discarded – undo
6793 6793
 				$query_values = array_merge($query_values,array(':day' => $day));
6794 6794
 			}
6795 6795
 		}
6796
-                $query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
6796
+				$query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
6797 6797
 				ORDER BY airport_departure_icao_count DESC";
6798 6798
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
6799
-    		//echo $query;
6799
+			//echo $query;
6800 6800
 		$sth = $this->db->prepare($query);
6801 6801
 		$sth->execute($query_values);
6802 6802
       
@@ -6817,35 +6817,35 @@  discard block
 block discarded – undo
6817 6817
 	}
6818 6818
 	
6819 6819
 	/**
6820
-	* Gets all detected departure airports of the airplanes that have flown over
6821
-	*
6822
-	* @return Array the airport list
6823
-	*
6824
-	*/
6820
+	 * Gets all detected departure airports of the airplanes that have flown over
6821
+	 *
6822
+	 * @return Array the airport list
6823
+	 *
6824
+	 */
6825 6825
 	public function countAllDetectedDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
6826 6826
 	{
6827 6827
 		global $globalDBdriver;
6828 6828
 		$filter_query = $this->getFilter($filters,true,true);
6829 6829
 		$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
6830 6830
 				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 ";
6831
-                if ($olderthanmonths > 0) {
6832
-            		if ($globalDBdriver == 'mysql') {
6831
+				if ($olderthanmonths > 0) {
6832
+					if ($globalDBdriver == 'mysql') {
6833 6833
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
6834 6834
 			} else {
6835 6835
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
6836 6836
 			}
6837
-                }
6838
-                if ($sincedate != '') {
6839
-            		if ($globalDBdriver == 'mysql') {
6837
+				}
6838
+				if ($sincedate != '') {
6839
+					if ($globalDBdriver == 'mysql') {
6840 6840
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
6841 6841
 			} else {
6842 6842
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP) ";
6843 6843
 			}
6844 6844
 		}
6845 6845
 
6846
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6847
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6848
-                $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
6846
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6847
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6848
+				$query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
6849 6849
 				ORDER BY airport_departure_icao_count DESC";
6850 6850
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
6851 6851
       
@@ -6870,11 +6870,11 @@  discard block
 block discarded – undo
6870 6870
 	}	
6871 6871
 	
6872 6872
 	/**
6873
-	* Gets all departure airports of the airplanes that have flown over based on an airline icao
6874
-	*
6875
-	* @return Array the airport list
6876
-	*
6877
-	*/
6873
+	 * Gets all departure airports of the airplanes that have flown over based on an airline icao
6874
+	 *
6875
+	 * @return Array the airport list
6876
+	 *
6877
+	 */
6878 6878
 	public function countAllDepartureAirportsByAirline($airline_icao,$filters = array())
6879 6879
 	{
6880 6880
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6908,11 +6908,11 @@  discard block
 block discarded – undo
6908 6908
 	
6909 6909
 	
6910 6910
 	/**
6911
-	* Gets all departure airports by country of the airplanes that have flown over based on an airline icao
6912
-	*
6913
-	* @return Array the airport list
6914
-	*
6915
-	*/
6911
+	 * Gets all departure airports by country of the airplanes that have flown over based on an airline icao
6912
+	 *
6913
+	 * @return Array the airport list
6914
+	 *
6915
+	 */
6916 6916
 	public function countAllDepartureAirportCountriesByAirline($airline_icao,$filters = array())
6917 6917
 	{
6918 6918
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6943,11 +6943,11 @@  discard block
 block discarded – undo
6943 6943
 	
6944 6944
 	
6945 6945
 	/**
6946
-	* Gets all departure airports of the airplanes that have flown over based on an aircraft icao
6947
-	*
6948
-	* @return Array the airport list
6949
-	*
6950
-	*/
6946
+	 * Gets all departure airports of the airplanes that have flown over based on an aircraft icao
6947
+	 *
6948
+	 * @return Array the airport list
6949
+	 *
6950
+	 */
6951 6951
 	public function countAllDepartureAirportsByAircraft($aircraft_icao,$filters = array())
6952 6952
 	{
6953 6953
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6980,11 +6980,11 @@  discard block
 block discarded – undo
6980 6980
 	
6981 6981
 	
6982 6982
 	/**
6983
-	* Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao
6984
-	*
6985
-	* @return Array the airport list
6986
-	*
6987
-	*/
6983
+	 * Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao
6984
+	 *
6985
+	 * @return Array the airport list
6986
+	 *
6987
+	 */
6988 6988
 	public function countAllDepartureAirportCountriesByAircraft($aircraft_icao,$filters = array())
6989 6989
 	{
6990 6990
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7014,11 +7014,11 @@  discard block
 block discarded – undo
7014 7014
 	
7015 7015
 	
7016 7016
 	/**
7017
-	* Gets all departure airports of the airplanes that have flown over based on an aircraft registration
7018
-	*
7019
-	* @return Array the airport list
7020
-	*
7021
-	*/
7017
+	 * Gets all departure airports of the airplanes that have flown over based on an aircraft registration
7018
+	 *
7019
+	 * @return Array the airport list
7020
+	 *
7021
+	 */
7022 7022
 	public function countAllDepartureAirportsByRegistration($registration,$filters = array())
7023 7023
 	{
7024 7024
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7051,11 +7051,11 @@  discard block
 block discarded – undo
7051 7051
 	
7052 7052
 	
7053 7053
 	/**
7054
-	* Gets all departure airports by country of the airplanes that have flown over based on an aircraft registration
7055
-	*
7056
-	* @return Array the airport list
7057
-	*
7058
-	*/
7054
+	 * Gets all departure airports by country of the airplanes that have flown over based on an aircraft registration
7055
+	 *
7056
+	 * @return Array the airport list
7057
+	 *
7058
+	 */
7059 7059
 	public function countAllDepartureAirportCountriesByRegistration($registration,$filters = array())
7060 7060
 	{
7061 7061
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7085,11 +7085,11 @@  discard block
 block discarded – undo
7085 7085
 	
7086 7086
 	
7087 7087
 	/**
7088
-	* Gets all departure airports of the airplanes that have flown over based on an arrivl airport icao
7089
-	*
7090
-	* @return Array the airport list
7091
-	*
7092
-	*/
7088
+	 * Gets all departure airports of the airplanes that have flown over based on an arrivl airport icao
7089
+	 *
7090
+	 * @return Array the airport list
7091
+	 *
7092
+	 */
7093 7093
 	public function countAllDepartureAirportsByAirport($airport_icao,$filters = array())
7094 7094
 	{
7095 7095
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7122,11 +7122,11 @@  discard block
 block discarded – undo
7122 7122
 	
7123 7123
 	
7124 7124
 	/**
7125
-	* Gets all departure airports by country of the airplanes that have flown over based on an airport icao
7126
-	*
7127
-	* @return Array the airport list
7128
-	*
7129
-	*/
7125
+	 * Gets all departure airports by country of the airplanes that have flown over based on an airport icao
7126
+	 *
7127
+	 * @return Array the airport list
7128
+	 *
7129
+	 */
7130 7130
 	public function countAllDepartureAirportCountriesByAirport($airport_icao,$filters = array())
7131 7131
 	{
7132 7132
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7157,11 +7157,11 @@  discard block
 block discarded – undo
7157 7157
 	
7158 7158
 	
7159 7159
 	/**
7160
-	* Gets all departure airports of the airplanes that have flown over based on an aircraft manufacturer
7161
-	*
7162
-	* @return Array the airport list
7163
-	*
7164
-	*/
7160
+	 * Gets all departure airports of the airplanes that have flown over based on an aircraft manufacturer
7161
+	 *
7162
+	 * @return Array the airport list
7163
+	 *
7164
+	 */
7165 7165
 	public function countAllDepartureAirportsByManufacturer($aircraft_manufacturer,$filters = array())
7166 7166
 	{
7167 7167
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7194,11 +7194,11 @@  discard block
 block discarded – undo
7194 7194
 	
7195 7195
 	
7196 7196
 	/**
7197
-	* Gets all departure airports by country of the airplanes that have flown over based on an aircraft manufacturer
7198
-	*
7199
-	* @return Array the airport list
7200
-	*
7201
-	*/
7197
+	 * Gets all departure airports by country of the airplanes that have flown over based on an aircraft manufacturer
7198
+	 *
7199
+	 * @return Array the airport list
7200
+	 *
7201
+	 */
7202 7202
 	public function countAllDepartureAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array())
7203 7203
 	{
7204 7204
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7228,11 +7228,11 @@  discard block
 block discarded – undo
7228 7228
 	
7229 7229
 	
7230 7230
 	/**
7231
-	* Gets all departure airports of the airplanes that have flown over based on a date
7232
-	*
7233
-	* @return Array the airport list
7234
-	*
7235
-	*/
7231
+	 * Gets all departure airports of the airplanes that have flown over based on a date
7232
+	 *
7233
+	 * @return Array the airport list
7234
+	 *
7235
+	 */
7236 7236
 	public function countAllDepartureAirportsByDate($date,$filters = array())
7237 7237
 	{
7238 7238
 		global $globalTimezone, $globalDBdriver;
@@ -7278,11 +7278,11 @@  discard block
 block discarded – undo
7278 7278
 	
7279 7279
 	
7280 7280
 	/**
7281
-	* Gets all departure airports by country of the airplanes that have flown over based on a date
7282
-	*
7283
-	* @return Array the airport list
7284
-	*
7285
-	*/
7281
+	 * Gets all departure airports by country of the airplanes that have flown over based on a date
7282
+	 *
7283
+	 * @return Array the airport list
7284
+	 *
7285
+	 */
7286 7286
 	public function countAllDepartureAirportCountriesByDate($date,$filters = array())
7287 7287
 	{
7288 7288
 		global $globalTimezone, $globalDBdriver;
@@ -7325,11 +7325,11 @@  discard block
 block discarded – undo
7325 7325
 	
7326 7326
 	
7327 7327
 	/**
7328
-	* Gets all departure airports of the airplanes that have flown over based on a ident/callsign
7329
-	*
7330
-	* @return Array the airport list
7331
-	*
7332
-	*/
7328
+	 * Gets all departure airports of the airplanes that have flown over based on a ident/callsign
7329
+	 *
7330
+	 * @return Array the airport list
7331
+	 *
7332
+	 */
7333 7333
 	public function countAllDepartureAirportsByIdent($ident,$filters = array())
7334 7334
 	{
7335 7335
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7361,11 +7361,11 @@  discard block
 block discarded – undo
7361 7361
 	}
7362 7362
 	
7363 7363
 	/**
7364
-	* Gets all departure airports of the airplanes that have flown over based on a owner
7365
-	*
7366
-	* @return Array the airport list
7367
-	*
7368
-	*/
7364
+	 * Gets all departure airports of the airplanes that have flown over based on a owner
7365
+	 *
7366
+	 * @return Array the airport list
7367
+	 *
7368
+	 */
7369 7369
 	public function countAllDepartureAirportsByOwner($owner,$filters = array())
7370 7370
 	{
7371 7371
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7397,11 +7397,11 @@  discard block
 block discarded – undo
7397 7397
 	}
7398 7398
 	
7399 7399
 	/**
7400
-	* Gets all departure airports of the airplanes that have flown over based on a pilot
7401
-	*
7402
-	* @return Array the airport list
7403
-	*
7404
-	*/
7400
+	 * Gets all departure airports of the airplanes that have flown over based on a pilot
7401
+	 *
7402
+	 * @return Array the airport list
7403
+	 *
7404
+	 */
7405 7405
 	public function countAllDepartureAirportsByPilot($pilot,$filters = array())
7406 7406
 	{
7407 7407
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7434,11 +7434,11 @@  discard block
 block discarded – undo
7434 7434
 	
7435 7435
 	
7436 7436
 	/**
7437
-	* Gets all departure airports by country of the airplanes that have flown over based on a callsign/ident
7438
-	*
7439
-	* @return Array the airport list
7440
-	*
7441
-	*/
7437
+	 * Gets all departure airports by country of the airplanes that have flown over based on a callsign/ident
7438
+	 *
7439
+	 * @return Array the airport list
7440
+	 *
7441
+	 */
7442 7442
 	public function countAllDepartureAirportCountriesByIdent($ident,$filters = array())
7443 7443
 	{
7444 7444
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7467,11 +7467,11 @@  discard block
 block discarded – undo
7467 7467
 	}
7468 7468
 	
7469 7469
 	/**
7470
-	* Gets all departure airports by country of the airplanes that have flown over based on owner
7471
-	*
7472
-	* @return Array the airport list
7473
-	*
7474
-	*/
7470
+	 * Gets all departure airports by country of the airplanes that have flown over based on owner
7471
+	 *
7472
+	 * @return Array the airport list
7473
+	 *
7474
+	 */
7475 7475
 	public function countAllDepartureAirportCountriesByOwner($owner,$filters = array())
7476 7476
 	{
7477 7477
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7487,11 +7487,11 @@  discard block
 block discarded – undo
7487 7487
 	}
7488 7488
 	
7489 7489
 	/**
7490
-	* Gets all departure airports by country of the airplanes that have flown over based on pilot
7491
-	*
7492
-	* @return Array the airport list
7493
-	*
7494
-	*/
7490
+	 * Gets all departure airports by country of the airplanes that have flown over based on pilot
7491
+	 *
7492
+	 * @return Array the airport list
7493
+	 *
7494
+	 */
7495 7495
 	public function countAllDepartureAirportCountriesByPilot($pilot,$filters = array())
7496 7496
 	{
7497 7497
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7509,11 +7509,11 @@  discard block
 block discarded – undo
7509 7509
 	
7510 7510
 	
7511 7511
 	/**
7512
-	* Gets all departure airports of the airplanes that have flown over based on a country
7513
-	*
7514
-	* @return Array the airport list
7515
-	*
7516
-	*/
7512
+	 * Gets all departure airports of the airplanes that have flown over based on a country
7513
+	 *
7514
+	 * @return Array the airport list
7515
+	 *
7516
+	 */
7517 7517
 	public function countAllDepartureAirportsByCountry($country,$filters = array())
7518 7518
 	{
7519 7519
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7547,11 +7547,11 @@  discard block
 block discarded – undo
7547 7547
 
7548 7548
 
7549 7549
 	/**
7550
-	* Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao
7551
-	*
7552
-	* @return Array the airport list
7553
-	*
7554
-	*/
7550
+	 * Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao
7551
+	 *
7552
+	 * @return Array the airport list
7553
+	 *
7554
+	 */
7555 7555
 	public function countAllDepartureAirportCountriesByCountry($country,$filters = array())
7556 7556
 	{
7557 7557
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7581,31 +7581,31 @@  discard block
 block discarded – undo
7581 7581
 	
7582 7582
 
7583 7583
 	/**
7584
-	* Gets all arrival airports of the airplanes that have flown over
7585
-	*
7586
-	* @param Boolean $limit Limit result to 10 or not
7587
-	* @param Integer $olderthanmonths Only show result older than x months
7588
-	* @param String $sincedate Only show result since x date
7589
-	* @param Boolean $icaoaskey Show result by ICAO
7590
-	* @param Array $filters Filter used here
7591
-	* @return Array the airport list
7592
-	*
7593
-	*/
7584
+	 * Gets all arrival airports of the airplanes that have flown over
7585
+	 *
7586
+	 * @param Boolean $limit Limit result to 10 or not
7587
+	 * @param Integer $olderthanmonths Only show result older than x months
7588
+	 * @param String $sincedate Only show result since x date
7589
+	 * @param Boolean $icaoaskey Show result by ICAO
7590
+	 * @param Array $filters Filter used here
7591
+	 * @return Array the airport list
7592
+	 *
7593
+	 */
7594 7594
 	public function countAllArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array(),$year = '',$month = '',$day = '')
7595 7595
 	{
7596 7596
 		global $globalDBdriver;
7597 7597
 		$filter_query = $this->getFilter($filters,true,true);
7598 7598
 		$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 
7599 7599
 				FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> ''";
7600
-                if ($olderthanmonths > 0) {
7601
-            		if ($globalDBdriver == 'mysql') {
7600
+				if ($olderthanmonths > 0) {
7601
+					if ($globalDBdriver == 'mysql') {
7602 7602
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
7603 7603
 			} else {
7604 7604
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
7605 7605
 			}
7606 7606
 		}
7607
-                if ($sincedate != '') {
7608
-            		if ($globalDBdriver == 'mysql') {
7607
+				if ($sincedate != '') {
7608
+					if ($globalDBdriver == 'mysql') {
7609 7609
 				$query .= " AND spotter_output.date > '".$sincedate."'";
7610 7610
 			} else {
7611 7611
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -7639,7 +7639,7 @@  discard block
 block discarded – undo
7639 7639
 				$query_values = array_merge($query_values,array(':day' => $day));
7640 7640
 			}
7641 7641
 		}
7642
-                $query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
7642
+				$query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
7643 7643
 					ORDER BY airport_arrival_icao_count DESC";
7644 7644
 		if ($limit) $query .= " LIMIT 10";
7645 7645
       
@@ -7668,35 +7668,35 @@  discard block
 block discarded – undo
7668 7668
 	}
7669 7669
 
7670 7670
 	/**
7671
-	* Gets all arrival airports of the airplanes that have flown over
7672
-	*
7673
-	* @return Array the airport list
7674
-	*
7675
-	*/
7671
+	 * Gets all arrival airports of the airplanes that have flown over
7672
+	 *
7673
+	 * @return Array the airport list
7674
+	 *
7675
+	 */
7676 7676
 	public function countAllArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array())
7677 7677
 	{
7678 7678
 		global $globalDBdriver;
7679 7679
 		$filter_query = $this->getFilter($filters,true,true);
7680 7680
 		$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 
7681 7681
 			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 <> '' ";
7682
-                if ($olderthanmonths > 0) {
7683
-            		if ($globalDBdriver == 'mysql') {
7682
+				if ($olderthanmonths > 0) {
7683
+					if ($globalDBdriver == 'mysql') {
7684 7684
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
7685 7685
 			} else {
7686 7686
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
7687 7687
 			}
7688 7688
 		}
7689
-                if ($sincedate != '') {
7690
-            		if ($globalDBdriver == 'mysql') {
7689
+				if ($sincedate != '') {
7690
+					if ($globalDBdriver == 'mysql') {
7691 7691
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
7692 7692
 			} else {
7693 7693
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
7694 7694
 			}
7695 7695
 		}
7696 7696
 
7697
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
7698
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
7699
-                $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
7697
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
7698
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
7699
+				$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
7700 7700
 					ORDER BY airport_arrival_icao_count DESC";
7701 7701
 		if ($limit) $query .= " LIMIT 10";
7702 7702
       
@@ -7727,26 +7727,26 @@  discard block
 block discarded – undo
7727 7727
 
7728 7728
 
7729 7729
 	/**
7730
-	* Gets all detected arrival airports of the airplanes that have flown over
7731
-	*
7732
-	* @return Array the airport list
7733
-	*
7734
-	*/
7730
+	 * Gets all detected arrival airports of the airplanes that have flown over
7731
+	 *
7732
+	 * @return Array the airport list
7733
+	 *
7734
+	 */
7735 7735
 	public function countAllDetectedArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array(),$year = '',$month = '',$day = '')
7736 7736
 	{
7737 7737
 		global $globalDBdriver;
7738 7738
 		$filter_query = $this->getFilter($filters,true,true);
7739 7739
 		$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 
7740 7740
 			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";
7741
-                if ($olderthanmonths > 0) {
7742
-            		if ($globalDBdriver == 'mysql') {
7741
+				if ($olderthanmonths > 0) {
7742
+					if ($globalDBdriver == 'mysql') {
7743 7743
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
7744 7744
 			} else {
7745 7745
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
7746 7746
 			}
7747 7747
 		}
7748
-                if ($sincedate != '') {
7749
-            		if ($globalDBdriver == 'mysql') {
7748
+				if ($sincedate != '') {
7749
+					if ($globalDBdriver == 'mysql') {
7750 7750
 				$query .= " AND spotter_output.date > '".$sincedate."'";
7751 7751
 			} else {
7752 7752
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -7780,7 +7780,7 @@  discard block
 block discarded – undo
7780 7780
 				$query_values = array_merge($query_values,array(':day' => $day));
7781 7781
 			}
7782 7782
 		}
7783
-                $query .= " GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
7783
+				$query .= " GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
7784 7784
 					ORDER BY airport_arrival_icao_count DESC";
7785 7785
 		if ($limit) $query .= " LIMIT 10";
7786 7786
       
@@ -7808,35 +7808,35 @@  discard block
 block discarded – undo
7808 7808
 	}
7809 7809
 	
7810 7810
 	/**
7811
-	* Gets all detected arrival airports of the airplanes that have flown over
7812
-	*
7813
-	* @return Array the airport list
7814
-	*
7815
-	*/
7811
+	 * Gets all detected arrival airports of the airplanes that have flown over
7812
+	 *
7813
+	 * @return Array the airport list
7814
+	 *
7815
+	 */
7816 7816
 	public function countAllDetectedArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array())
7817 7817
 	{
7818 7818
 		global $globalDBdriver;
7819 7819
 		$filter_query = $this->getFilter($filters,true,true);
7820 7820
 		$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 
7821 7821
 			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 ";
7822
-                if ($olderthanmonths > 0) {
7823
-            		if ($globalDBdriver == 'mysql') {
7822
+				if ($olderthanmonths > 0) {
7823
+					if ($globalDBdriver == 'mysql') {
7824 7824
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
7825 7825
 			} else {
7826 7826
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
7827 7827
 			}
7828 7828
 		}
7829
-                if ($sincedate != '') {
7830
-            		if ($globalDBdriver == 'mysql') {
7829
+				if ($sincedate != '') {
7830
+					if ($globalDBdriver == 'mysql') {
7831 7831
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
7832 7832
 			} else {
7833 7833
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
7834 7834
 			}
7835 7835
 		}
7836 7836
 
7837
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
7838
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
7839
-                $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
7837
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
7838
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
7839
+				$query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
7840 7840
 					ORDER BY airport_arrival_icao_count DESC";
7841 7841
 		if ($limit) $query .= " LIMIT 10";
7842 7842
       
@@ -7866,11 +7866,11 @@  discard block
 block discarded – undo
7866 7866
 	}	
7867 7867
 	
7868 7868
 	/**
7869
-	* Gets all arrival airports of the airplanes that have flown over based on an airline icao
7870
-	*
7871
-	* @return Array the airport list
7872
-	*
7873
-	*/
7869
+	 * Gets all arrival airports of the airplanes that have flown over based on an airline icao
7870
+	 *
7871
+	 * @return Array the airport list
7872
+	 *
7873
+	 */
7874 7874
 	public function countAllArrivalAirportsByAirline($airline_icao, $filters = array())
7875 7875
 	{
7876 7876
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7902,11 +7902,11 @@  discard block
 block discarded – undo
7902 7902
 	
7903 7903
 	
7904 7904
 	/**
7905
-	* Gets all arrival airports by country of the airplanes that have flown over based on an airline icao
7906
-	*
7907
-	* @return Array the airport list
7908
-	*
7909
-	*/
7905
+	 * Gets all arrival airports by country of the airplanes that have flown over based on an airline icao
7906
+	 *
7907
+	 * @return Array the airport list
7908
+	 *
7909
+	 */
7910 7910
 	public function countAllArrivalAirportCountriesByAirline($airline_icao,$filters = array())
7911 7911
 	{
7912 7912
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7937,11 +7937,11 @@  discard block
 block discarded – undo
7937 7937
 	
7938 7938
 	
7939 7939
 	/**
7940
-	* Gets all arrival airports of the airplanes that have flown over based on an aircraft icao
7941
-	*
7942
-	* @return Array the airport list
7943
-	*
7944
-	*/
7940
+	 * Gets all arrival airports of the airplanes that have flown over based on an aircraft icao
7941
+	 *
7942
+	 * @return Array the airport list
7943
+	 *
7944
+	 */
7945 7945
 	public function countAllArrivalAirportsByAircraft($aircraft_icao,$filters = array())
7946 7946
 	{
7947 7947
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7975,11 +7975,11 @@  discard block
 block discarded – undo
7975 7975
 	
7976 7976
 	
7977 7977
 	/**
7978
-	* Gets all arrival airports by country of the airplanes that have flown over based on an aircraft icao
7979
-	*
7980
-	* @return Array the airport list
7981
-	*
7982
-	*/
7978
+	 * Gets all arrival airports by country of the airplanes that have flown over based on an aircraft icao
7979
+	 *
7980
+	 * @return Array the airport list
7981
+	 *
7982
+	 */
7983 7983
 	public function countAllArrivalAirportCountriesByAircraft($aircraft_icao,$filters = array())
7984 7984
 	{
7985 7985
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8009,11 +8009,11 @@  discard block
 block discarded – undo
8009 8009
 	
8010 8010
 	
8011 8011
 	/**
8012
-	* Gets all arrival airports of the airplanes that have flown over based on an aircraft registration
8013
-	*
8014
-	* @return Array the airport list
8015
-	*
8016
-	*/
8012
+	 * Gets all arrival airports of the airplanes that have flown over based on an aircraft registration
8013
+	 *
8014
+	 * @return Array the airport list
8015
+	 *
8016
+	 */
8017 8017
 	public function countAllArrivalAirportsByRegistration($registration,$filters = array())
8018 8018
 	{
8019 8019
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8047,11 +8047,11 @@  discard block
 block discarded – undo
8047 8047
 	
8048 8048
 	
8049 8049
 	/**
8050
-	* Gets all arrival airports by country of the airplanes that have flown over based on an aircraft registration
8051
-	*
8052
-	* @return Array the airport list
8053
-	*
8054
-	*/
8050
+	 * Gets all arrival airports by country of the airplanes that have flown over based on an aircraft registration
8051
+	 *
8052
+	 * @return Array the airport list
8053
+	 *
8054
+	 */
8055 8055
 	public function countAllArrivalAirportCountriesByRegistration($registration,$filters = array())
8056 8056
 	{
8057 8057
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8082,11 +8082,11 @@  discard block
 block discarded – undo
8082 8082
 	
8083 8083
 	
8084 8084
 	/**
8085
-	* Gets all arrival airports of the airplanes that have flown over based on an departure airport
8086
-	*
8087
-	* @return Array the airport list
8088
-	*
8089
-	*/
8085
+	 * Gets all arrival airports of the airplanes that have flown over based on an departure airport
8086
+	 *
8087
+	 * @return Array the airport list
8088
+	 *
8089
+	 */
8090 8090
 	public function countAllArrivalAirportsByAirport($airport_icao,$filters = array())
8091 8091
 	{
8092 8092
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8119,11 +8119,11 @@  discard block
 block discarded – undo
8119 8119
 	
8120 8120
 	
8121 8121
 	/**
8122
-	* Gets all arrival airports by country of the airplanes that have flown over based on an airport icao
8123
-	*
8124
-	* @return Array the airport list
8125
-	*
8126
-	*/
8122
+	 * Gets all arrival airports by country of the airplanes that have flown over based on an airport icao
8123
+	 *
8124
+	 * @return Array the airport list
8125
+	 *
8126
+	 */
8127 8127
 	public function countAllArrivalAirportCountriesByAirport($airport_icao,$filters = array())
8128 8128
 	{
8129 8129
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8153,11 +8153,11 @@  discard block
 block discarded – undo
8153 8153
 	
8154 8154
 	
8155 8155
 	/**
8156
-	* Gets all arrival airports of the airplanes that have flown over based on a aircraft manufacturer
8157
-	*
8158
-	* @return Array the airport list
8159
-	*
8160
-	*/
8156
+	 * Gets all arrival airports of the airplanes that have flown over based on a aircraft manufacturer
8157
+	 *
8158
+	 * @return Array the airport list
8159
+	 *
8160
+	 */
8161 8161
 	public function countAllArrivalAirportsByManufacturer($aircraft_manufacturer,$filters = array())
8162 8162
 	{
8163 8163
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8191,11 +8191,11 @@  discard block
 block discarded – undo
8191 8191
 	
8192 8192
 	
8193 8193
 	/**
8194
-	* Gets all arrival airports by country of the airplanes that have flown over based on a aircraft manufacturer
8195
-	*
8196
-	* @return Array the airport list
8197
-	*
8198
-	*/
8194
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a aircraft manufacturer
8195
+	 *
8196
+	 * @return Array the airport list
8197
+	 *
8198
+	 */
8199 8199
 	public function countAllArrivalAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array())
8200 8200
 	{
8201 8201
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8226,11 +8226,11 @@  discard block
 block discarded – undo
8226 8226
 	
8227 8227
 	
8228 8228
 	/**
8229
-	* Gets all arrival airports of the airplanes that have flown over based on a date
8230
-	*
8231
-	* @return Array the airport list
8232
-	*
8233
-	*/
8229
+	 * Gets all arrival airports of the airplanes that have flown over based on a date
8230
+	 *
8231
+	 * @return Array the airport list
8232
+	 *
8233
+	 */
8234 8234
 	public function countAllArrivalAirportsByDate($date,$filters = array())
8235 8235
 	{
8236 8236
 		global $globalTimezone, $globalDBdriver;
@@ -8276,11 +8276,11 @@  discard block
 block discarded – undo
8276 8276
 	
8277 8277
 	
8278 8278
 	/**
8279
-	* Gets all arrival airports by country of the airplanes that have flown over based on a date
8280
-	*
8281
-	* @return Array the airport list
8282
-	*
8283
-	*/
8279
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a date
8280
+	 *
8281
+	 * @return Array the airport list
8282
+	 *
8283
+	 */
8284 8284
 	public function countAllArrivalAirportCountriesByDate($date, $filters = array())
8285 8285
 	{
8286 8286
 		global $globalTimezone, $globalDBdriver;
@@ -8323,11 +8323,11 @@  discard block
 block discarded – undo
8323 8323
 	
8324 8324
 	
8325 8325
 	/**
8326
-	* Gets all arrival airports of the airplanes that have flown over based on a ident/callsign
8327
-	*
8328
-	* @return Array the airport list
8329
-	*
8330
-	*/
8326
+	 * Gets all arrival airports of the airplanes that have flown over based on a ident/callsign
8327
+	 *
8328
+	 * @return Array the airport list
8329
+	 *
8330
+	 */
8331 8331
 	public function countAllArrivalAirportsByIdent($ident,$filters = array())
8332 8332
 	{
8333 8333
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8359,11 +8359,11 @@  discard block
 block discarded – undo
8359 8359
 	}
8360 8360
 	
8361 8361
 	/**
8362
-	* Gets all arrival airports of the airplanes that have flown over based on a owner
8363
-	*
8364
-	* @return Array the airport list
8365
-	*
8366
-	*/
8362
+	 * Gets all arrival airports of the airplanes that have flown over based on a owner
8363
+	 *
8364
+	 * @return Array the airport list
8365
+	 *
8366
+	 */
8367 8367
 	public function countAllArrivalAirportsByOwner($owner,$filters = array())
8368 8368
 	{
8369 8369
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8394,11 +8394,11 @@  discard block
 block discarded – undo
8394 8394
 	}
8395 8395
 
8396 8396
 	/**
8397
-	* Gets all arrival airports of the airplanes that have flown over based on a pilot
8398
-	*
8399
-	* @return Array the airport list
8400
-	*
8401
-	*/
8397
+	 * Gets all arrival airports of the airplanes that have flown over based on a pilot
8398
+	 *
8399
+	 * @return Array the airport list
8400
+	 *
8401
+	 */
8402 8402
 	public function countAllArrivalAirportsByPilot($pilot,$filters = array())
8403 8403
 	{
8404 8404
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8429,11 +8429,11 @@  discard block
 block discarded – undo
8429 8429
 	}
8430 8430
 	
8431 8431
 	/**
8432
-	* Gets all arrival airports by country of the airplanes that have flown over based on a callsign/ident
8433
-	*
8434
-	* @return Array the airport list
8435
-	*
8436
-	*/
8432
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a callsign/ident
8433
+	 *
8434
+	 * @return Array the airport list
8435
+	 *
8436
+	 */
8437 8437
 	public function countAllArrivalAirportCountriesByIdent($ident, $filters = array())
8438 8438
 	{
8439 8439
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8462,11 +8462,11 @@  discard block
 block discarded – undo
8462 8462
 	}
8463 8463
 	
8464 8464
 	/**
8465
-	* Gets all arrival airports by country of the airplanes that have flown over based on a owner
8466
-	*
8467
-	* @return Array the airport list
8468
-	*
8469
-	*/
8465
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a owner
8466
+	 *
8467
+	 * @return Array the airport list
8468
+	 *
8469
+	 */
8470 8470
 	public function countAllArrivalAirportCountriesByOwner($owner, $filters = array())
8471 8471
 	{
8472 8472
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8482,11 +8482,11 @@  discard block
 block discarded – undo
8482 8482
 	}
8483 8483
 	
8484 8484
 	/**
8485
-	* Gets all arrival airports by country of the airplanes that have flown over based on a pilot
8486
-	*
8487
-	* @return Array the airport list
8488
-	*
8489
-	*/
8485
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a pilot
8486
+	 *
8487
+	 * @return Array the airport list
8488
+	 *
8489
+	 */
8490 8490
 	public function countAllArrivalAirportCountriesByPilot($pilot, $filters = array())
8491 8491
 	{
8492 8492
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8504,11 +8504,11 @@  discard block
 block discarded – undo
8504 8504
 	
8505 8505
 	
8506 8506
 	/**
8507
-	* Gets all arrival airports of the airplanes that have flown over based on a country
8508
-	*
8509
-	* @return Array the airport list
8510
-	*
8511
-	*/
8507
+	 * Gets all arrival airports of the airplanes that have flown over based on a country
8508
+	 *
8509
+	 * @return Array the airport list
8510
+	 *
8511
+	 */
8512 8512
 	public function countAllArrivalAirportsByCountry($country,$filters = array())
8513 8513
 	{
8514 8514
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8541,11 +8541,11 @@  discard block
 block discarded – undo
8541 8541
 	
8542 8542
 	
8543 8543
 	/**
8544
-	* Gets all arrival airports by country of the airplanes that have flown over based on a country
8545
-	*
8546
-	* @return Array the airport list
8547
-	*
8548
-	*/
8544
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a country
8545
+	 *
8546
+	 * @return Array the airport list
8547
+	 *
8548
+	 */
8549 8549
 	public function countAllArrivalAirportCountriesByCountry($country,$filters = array())
8550 8550
 	{
8551 8551
 		global $globalDBdriver;
@@ -8577,11 +8577,11 @@  discard block
 block discarded – undo
8577 8577
 
8578 8578
 
8579 8579
 	/**
8580
-	* Counts all airport departure countries
8581
-	*
8582
-	* @return Array the airport departure list
8583
-	*
8584
-	*/
8580
+	 * Counts all airport departure countries
8581
+	 *
8582
+	 * @return Array the airport departure list
8583
+	 *
8584
+	 */
8585 8585
 	public function countAllDepartureCountries($filters = array(),$year = '',$month = '', $day = '')
8586 8586
 	{
8587 8587
 		global $globalDBdriver;
@@ -8640,11 +8640,11 @@  discard block
 block discarded – undo
8640 8640
 	
8641 8641
 	
8642 8642
 	/**
8643
-	* Counts all airport arrival countries
8644
-	*
8645
-	* @return Array the airport arrival list
8646
-	*
8647
-	*/
8643
+	 * Counts all airport arrival countries
8644
+	 *
8645
+	 * @return Array the airport arrival list
8646
+	 *
8647
+	 */
8648 8648
 	public function countAllArrivalCountries($limit = true,$filters = array(),$year = '',$month = '',$day = '')
8649 8649
 	{
8650 8650
 		global $globalDBdriver;
@@ -8706,11 +8706,11 @@  discard block
 block discarded – undo
8706 8706
 
8707 8707
 
8708 8708
 	/**
8709
-	* Gets all route combinations
8710
-	*
8711
-	* @return Array the route list
8712
-	*
8713
-	*/
8709
+	 * Gets all route combinations
8710
+	 *
8711
+	 * @return Array the route list
8712
+	 *
8713
+	 */
8714 8714
 	public function countAllRoutes($filters = array())
8715 8715
 	{
8716 8716
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8749,11 +8749,11 @@  discard block
 block discarded – undo
8749 8749
 	
8750 8750
 	
8751 8751
 	/**
8752
-	* Gets all route combinations based on an aircraft
8753
-	*
8754
-	* @return Array the route list
8755
-	*
8756
-	*/
8752
+	 * Gets all route combinations based on an aircraft
8753
+	 *
8754
+	 * @return Array the route list
8755
+	 *
8756
+	 */
8757 8757
 	public function countAllRoutesByAircraft($aircraft_icao,$filters = array())
8758 8758
 	{
8759 8759
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8789,11 +8789,11 @@  discard block
 block discarded – undo
8789 8789
 	
8790 8790
 	
8791 8791
 	/**
8792
-	* Gets all route combinations based on an aircraft registration
8793
-	*
8794
-	* @return Array the route list
8795
-	*
8796
-	*/
8792
+	 * Gets all route combinations based on an aircraft registration
8793
+	 *
8794
+	 * @return Array the route list
8795
+	 *
8796
+	 */
8797 8797
 	public function countAllRoutesByRegistration($registration, $filters = array())
8798 8798
 	{
8799 8799
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8831,11 +8831,11 @@  discard block
 block discarded – undo
8831 8831
 	
8832 8832
 	
8833 8833
 	/**
8834
-	* Gets all route combinations based on an airline
8835
-	*
8836
-	* @return Array the route list
8837
-	*
8838
-	*/
8834
+	 * Gets all route combinations based on an airline
8835
+	 *
8836
+	 * @return Array the route list
8837
+	 *
8838
+	 */
8839 8839
 	public function countAllRoutesByAirline($airline_icao, $filters = array())
8840 8840
 	{
8841 8841
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8873,11 +8873,11 @@  discard block
 block discarded – undo
8873 8873
 	
8874 8874
 	
8875 8875
 	/**
8876
-	* Gets all route combinations based on an airport
8877
-	*
8878
-	* @return Array the route list
8879
-	*
8880
-	*/
8876
+	 * Gets all route combinations based on an airport
8877
+	 *
8878
+	 * @return Array the route list
8879
+	 *
8880
+	 */
8881 8881
 	public function countAllRoutesByAirport($airport_icao, $filters = array())
8882 8882
 	{
8883 8883
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8914,11 +8914,11 @@  discard block
 block discarded – undo
8914 8914
 	
8915 8915
 	
8916 8916
 	/**
8917
-	* Gets all route combinations based on an country
8918
-	*
8919
-	* @return Array the route list
8920
-	*
8921
-	*/
8917
+	 * Gets all route combinations based on an country
8918
+	 *
8919
+	 * @return Array the route list
8920
+	 *
8921
+	 */
8922 8922
 	public function countAllRoutesByCountry($country, $filters = array())
8923 8923
 	{
8924 8924
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8954,11 +8954,11 @@  discard block
 block discarded – undo
8954 8954
 
8955 8955
 
8956 8956
 	/**
8957
-	* Gets all route combinations based on an date
8958
-	*
8959
-	* @return Array the route list
8960
-	*
8961
-	*/
8957
+	 * Gets all route combinations based on an date
8958
+	 *
8959
+	 * @return Array the route list
8960
+	 *
8961
+	 */
8962 8962
 	public function countAllRoutesByDate($date, $filters = array())
8963 8963
 	{
8964 8964
 		global $globalTimezone, $globalDBdriver;
@@ -9008,11 +9008,11 @@  discard block
 block discarded – undo
9008 9008
 	
9009 9009
 	
9010 9010
 	/**
9011
-	* Gets all route combinations based on an ident/callsign
9012
-	*
9013
-	* @return Array the route list
9014
-	*
9015
-	*/
9011
+	 * Gets all route combinations based on an ident/callsign
9012
+	 *
9013
+	 * @return Array the route list
9014
+	 *
9015
+	 */
9016 9016
 	public function countAllRoutesByIdent($ident, $filters = array())
9017 9017
 	{
9018 9018
 		$filter_query = $this->getFilter($filters,true,true);
@@ -9048,11 +9048,11 @@  discard block
 block discarded – undo
9048 9048
 	}
9049 9049
 	
9050 9050
 	/**
9051
-	* Gets all route combinations based on an owner
9052
-	*
9053
-	* @return Array the route list
9054
-	*
9055
-	*/
9051
+	 * Gets all route combinations based on an owner
9052
+	 *
9053
+	 * @return Array the route list
9054
+	 *
9055
+	 */
9056 9056
 	public function countAllRoutesByOwner($owner,$filters = array())
9057 9057
 	{
9058 9058
 		$filter_query = $this->getFilter($filters,true,true);
@@ -9088,11 +9088,11 @@  discard block
 block discarded – undo
9088 9088
 	}
9089 9089
 	
9090 9090
 	/**
9091
-	* Gets all route combinations based on a pilot
9092
-	*
9093
-	* @return Array the route list
9094
-	*
9095
-	*/
9091
+	 * Gets all route combinations based on a pilot
9092
+	 *
9093
+	 * @return Array the route list
9094
+	 *
9095
+	 */
9096 9096
 	public function countAllRoutesByPilot($pilot,$filters = array())
9097 9097
 	{
9098 9098
 		$filter_query = $this->getFilter($filters,true,true);
@@ -9129,11 +9129,11 @@  discard block
 block discarded – undo
9129 9129
 	
9130 9130
 	
9131 9131
 	/**
9132
-	* Gets all route combinations based on an manufacturer
9133
-	*
9134
-	* @return Array the route list
9135
-	*
9136
-	*/
9132
+	 * Gets all route combinations based on an manufacturer
9133
+	 *
9134
+	 * @return Array the route list
9135
+	 *
9136
+	 */
9137 9137
 	public function countAllRoutesByManufacturer($aircraft_manufacturer, $filters = array())
9138 9138
 	{
9139 9139
 		$filter_query = $this->getFilter($filters,true,true);
@@ -9171,11 +9171,11 @@  discard block
 block discarded – undo
9171 9171
 	
9172 9172
 	
9173 9173
 	/**
9174
-	* Gets all route combinations with waypoints
9175
-	*
9176
-	* @return Array the route list
9177
-	*
9178
-	*/
9174
+	 * Gets all route combinations with waypoints
9175
+	 *
9176
+	 * @return Array the route list
9177
+	 *
9178
+	 */
9179 9179
 	public function countAllRoutesWithWaypoints($filters = array())
9180 9180
 	{
9181 9181
 		$filter_query = $this->getFilter($filters,true,true);
@@ -9212,11 +9212,11 @@  discard block
 block discarded – undo
9212 9212
 	}
9213 9213
 	
9214 9214
 	/**
9215
-	* Gets all callsigns that have flown over
9216
-	*
9217
-	* @return Array the callsign list
9218
-	*
9219
-	*/
9215
+	 * Gets all callsigns that have flown over
9216
+	 *
9217
+	 * @return Array the callsign list
9218
+	 *
9219
+	 */
9220 9220
 	public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '', $month = '', $day = '')
9221 9221
 	{
9222 9222
 		global $globalDBdriver;
@@ -9282,11 +9282,11 @@  discard block
 block discarded – undo
9282 9282
 	}
9283 9283
 
9284 9284
 	/**
9285
-	* Gets all callsigns that have flown over
9286
-	*
9287
-	* @return Array the callsign list
9288
-	*
9289
-	*/
9285
+	 * Gets all callsigns that have flown over
9286
+	 *
9287
+	 * @return Array the callsign list
9288
+	 *
9289
+	 */
9290 9290
 	public function countAllCallsignsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
9291 9291
 	{
9292 9292
 		global $globalDBdriver;
@@ -9327,11 +9327,11 @@  discard block
 block discarded – undo
9327 9327
 
9328 9328
 
9329 9329
 	/**
9330
-	* Counts all dates
9331
-	*
9332
-	* @return Array the date list
9333
-	*
9334
-	*/
9330
+	 * Counts all dates
9331
+	 *
9332
+	 * @return Array the date list
9333
+	 *
9334
+	 */
9335 9335
 	public function countAllDates($filters = array())
9336 9336
 	{
9337 9337
 		global $globalTimezone, $globalDBdriver;
@@ -9376,11 +9376,11 @@  discard block
 block discarded – undo
9376 9376
 	}
9377 9377
 	
9378 9378
 	/**
9379
-	* Counts all dates
9380
-	*
9381
-	* @return Array the date list
9382
-	*
9383
-	*/
9379
+	 * Counts all dates
9380
+	 *
9381
+	 * @return Array the date list
9382
+	 *
9383
+	 */
9384 9384
 	public function countAllDatesByAirlines($filters = array())
9385 9385
 	{
9386 9386
 		global $globalTimezone, $globalDBdriver;
@@ -9425,11 +9425,11 @@  discard block
 block discarded – undo
9425 9425
 	}	
9426 9426
 	
9427 9427
 	/**
9428
-	* Counts all dates during the last 7 days
9429
-	*
9430
-	* @return Array the date list
9431
-	*
9432
-	*/
9428
+	 * Counts all dates during the last 7 days
9429
+	 *
9430
+	 * @return Array the date list
9431
+	 *
9432
+	 */
9433 9433
 	public function countAllDatesLast7Days($filters = array())
9434 9434
 	{
9435 9435
 		global $globalTimezone, $globalDBdriver;
@@ -9451,7 +9451,7 @@  discard block
 block discarded – undo
9451 9451
 			$query .= " GROUP BY date_name 
9452 9452
 								ORDER BY date_name ASC";
9453 9453
 			$query_data = array(':offset' => $offset);
9454
-    		}
9454
+			}
9455 9455
 		
9456 9456
 		$sth = $this->db->prepare($query);
9457 9457
 		$sth->execute($query_data);
@@ -9471,11 +9471,11 @@  discard block
 block discarded – undo
9471 9471
 	}
9472 9472
 
9473 9473
 	/**
9474
-	* Counts all dates during the last month
9475
-	*
9476
-	* @return Array the date list
9477
-	*
9478
-	*/
9474
+	 * Counts all dates during the last month
9475
+	 *
9476
+	 * @return Array the date list
9477
+	 *
9478
+	 */
9479 9479
 	public function countAllDatesLastMonth($filters = array())
9480 9480
 	{
9481 9481
 		global $globalTimezone, $globalDBdriver;
@@ -9497,7 +9497,7 @@  discard block
 block discarded – undo
9497 9497
 			$query .= " GROUP BY date_name 
9498 9498
 								ORDER BY date_name ASC";
9499 9499
 			$query_data = array(':offset' => $offset);
9500
-    		}
9500
+			}
9501 9501
 		
9502 9502
 		$sth = $this->db->prepare($query);
9503 9503
 		$sth->execute($query_data);
@@ -9518,11 +9518,11 @@  discard block
 block discarded – undo
9518 9518
 
9519 9519
 
9520 9520
 	/**
9521
-	* Counts all dates during the last month
9522
-	*
9523
-	* @return Array the date list
9524
-	*
9525
-	*/
9521
+	 * Counts all dates during the last month
9522
+	 *
9523
+	 * @return Array the date list
9524
+	 *
9525
+	 */
9526 9526
 	public function countAllDatesLastMonthByAirlines($filters = array())
9527 9527
 	{
9528 9528
 		global $globalTimezone, $globalDBdriver;
@@ -9545,7 +9545,7 @@  discard block
 block discarded – undo
9545 9545
 								GROUP BY spotter_output.airline_icao, date_name 
9546 9546
 								ORDER BY date_name ASC";
9547 9547
 			$query_data = array(':offset' => $offset);
9548
-    		}
9548
+			}
9549 9549
 		
9550 9550
 		$sth = $this->db->prepare($query);
9551 9551
 		$sth->execute($query_data);
@@ -9567,11 +9567,11 @@  discard block
 block discarded – undo
9567 9567
 	
9568 9568
 
9569 9569
 	/**
9570
-	* Counts all month
9571
-	*
9572
-	* @return Array the month list
9573
-	*
9574
-	*/
9570
+	 * Counts all month
9571
+	 *
9572
+	 * @return Array the month list
9573
+	 *
9574
+	 */
9575 9575
 	public function countAllMonths($filters = array())
9576 9576
 	{
9577 9577
 		global $globalTimezone, $globalDBdriver;
@@ -9613,11 +9613,11 @@  discard block
 block discarded – undo
9613 9613
 	}
9614 9614
 
9615 9615
 	/**
9616
-	* Counts all month
9617
-	*
9618
-	* @return Array the month list
9619
-	*
9620
-	*/
9616
+	 * Counts all month
9617
+	 *
9618
+	 * @return Array the month list
9619
+	 *
9620
+	 */
9621 9621
 	public function countAllMonthsByAirlines($filters = array())
9622 9622
 	{
9623 9623
 		global $globalTimezone, $globalDBdriver;
@@ -9662,11 +9662,11 @@  discard block
 block discarded – undo
9662 9662
 	}
9663 9663
 
9664 9664
 	/**
9665
-	* Counts all military month
9666
-	*
9667
-	* @return Array the month list
9668
-	*
9669
-	*/
9665
+	 * Counts all military month
9666
+	 *
9667
+	 * @return Array the month list
9668
+	 *
9669
+	 */
9670 9670
 	public function countAllMilitaryMonths($filters = array())
9671 9671
 	{
9672 9672
 		global $globalTimezone, $globalDBdriver;
@@ -9707,11 +9707,11 @@  discard block
 block discarded – undo
9707 9707
 	}
9708 9708
 	
9709 9709
 	/**
9710
-	* Counts all month owners
9711
-	*
9712
-	* @return Array the month list
9713
-	*
9714
-	*/
9710
+	 * Counts all month owners
9711
+	 *
9712
+	 * @return Array the month list
9713
+	 *
9714
+	 */
9715 9715
 	public function countAllMonthsOwners($filters = array())
9716 9716
 	{
9717 9717
 		global $globalTimezone, $globalDBdriver;
@@ -9753,11 +9753,11 @@  discard block
 block discarded – undo
9753 9753
 	}
9754 9754
 	
9755 9755
 	/**
9756
-	* Counts all month owners
9757
-	*
9758
-	* @return Array the month list
9759
-	*
9760
-	*/
9756
+	 * Counts all month owners
9757
+	 *
9758
+	 * @return Array the month list
9759
+	 *
9760
+	 */
9761 9761
 	public function countAllMonthsOwnersByAirlines($filters = array())
9762 9762
 	{
9763 9763
 		global $globalTimezone, $globalDBdriver;
@@ -9800,11 +9800,11 @@  discard block
 block discarded – undo
9800 9800
 	}
9801 9801
 
9802 9802
 	/**
9803
-	* Counts all month pilot
9804
-	*
9805
-	* @return Array the month list
9806
-	*
9807
-	*/
9803
+	 * Counts all month pilot
9804
+	 *
9805
+	 * @return Array the month list
9806
+	 *
9807
+	 */
9808 9808
 	public function countAllMonthsPilots($filters = array())
9809 9809
 	{
9810 9810
 		global $globalTimezone, $globalDBdriver;
@@ -9846,11 +9846,11 @@  discard block
 block discarded – undo
9846 9846
 	}
9847 9847
 	
9848 9848
 	/**
9849
-	* Counts all month pilot
9850
-	*
9851
-	* @return Array the month list
9852
-	*
9853
-	*/
9849
+	 * Counts all month pilot
9850
+	 *
9851
+	 * @return Array the month list
9852
+	 *
9853
+	 */
9854 9854
 	public function countAllMonthsPilotsByAirlines($filters = array())
9855 9855
 	{
9856 9856
 		global $globalTimezone, $globalDBdriver;
@@ -9893,11 +9893,11 @@  discard block
 block discarded – undo
9893 9893
 	}
9894 9894
 
9895 9895
 	/**
9896
-	* Counts all month airline
9897
-	*
9898
-	* @return Array the month list
9899
-	*
9900
-	*/
9896
+	 * Counts all month airline
9897
+	 *
9898
+	 * @return Array the month list
9899
+	 *
9900
+	 */
9901 9901
 	public function countAllMonthsAirlines($filters = array())
9902 9902
 	{
9903 9903
 		global $globalTimezone, $globalDBdriver;
@@ -9939,11 +9939,11 @@  discard block
 block discarded – undo
9939 9939
 	}
9940 9940
 	
9941 9941
 	/**
9942
-	* Counts all month aircraft
9943
-	*
9944
-	* @return Array the month list
9945
-	*
9946
-	*/
9942
+	 * Counts all month aircraft
9943
+	 *
9944
+	 * @return Array the month list
9945
+	 *
9946
+	 */
9947 9947
 	public function countAllMonthsAircrafts($filters = array())
9948 9948
 	{
9949 9949
 		global $globalTimezone, $globalDBdriver;
@@ -9986,11 +9986,11 @@  discard block
 block discarded – undo
9986 9986
 	
9987 9987
 
9988 9988
 	/**
9989
-	* Counts all month aircraft
9990
-	*
9991
-	* @return Array the month list
9992
-	*
9993
-	*/
9989
+	 * Counts all month aircraft
9990
+	 *
9991
+	 * @return Array the month list
9992
+	 *
9993
+	 */
9994 9994
 	public function countAllMonthsAircraftsByAirlines($filters = array())
9995 9995
 	{
9996 9996
 		global $globalTimezone, $globalDBdriver;
@@ -10033,11 +10033,11 @@  discard block
 block discarded – undo
10033 10033
 	}
10034 10034
 
10035 10035
 	/**
10036
-	* Counts all month real arrival
10037
-	*
10038
-	* @return Array the month list
10039
-	*
10040
-	*/
10036
+	 * Counts all month real arrival
10037
+	 *
10038
+	 * @return Array the month list
10039
+	 *
10040
+	 */
10041 10041
 	public function countAllMonthsRealArrivals($filters = array())
10042 10042
 	{
10043 10043
 		global $globalTimezone, $globalDBdriver;
@@ -10080,11 +10080,11 @@  discard block
 block discarded – undo
10080 10080
 	
10081 10081
 
10082 10082
 	/**
10083
-	* Counts all month real arrival
10084
-	*
10085
-	* @return Array the month list
10086
-	*
10087
-	*/
10083
+	 * Counts all month real arrival
10084
+	 *
10085
+	 * @return Array the month list
10086
+	 *
10087
+	 */
10088 10088
 	public function countAllMonthsRealArrivalsByAirlines($filters = array())
10089 10089
 	{
10090 10090
 		global $globalTimezone, $globalDBdriver;
@@ -10128,11 +10128,11 @@  discard block
 block discarded – undo
10128 10128
 	
10129 10129
 
10130 10130
 	/**
10131
-	* Counts all dates during the last year
10132
-	*
10133
-	* @return Array the date list
10134
-	*
10135
-	*/
10131
+	 * Counts all dates during the last year
10132
+	 *
10133
+	 * @return Array the date list
10134
+	 *
10135
+	 */
10136 10136
 	public function countAllMonthsLastYear($filters)
10137 10137
 	{
10138 10138
 		global $globalTimezone, $globalDBdriver;
@@ -10154,7 +10154,7 @@  discard block
 block discarded – undo
10154 10154
 			$query .= " GROUP BY year_name, month_name
10155 10155
 								ORDER BY year_name, month_name ASC";
10156 10156
 			$query_data = array(':offset' => $offset);
10157
-    		}
10157
+			}
10158 10158
 		
10159 10159
 		$sth = $this->db->prepare($query);
10160 10160
 		$sth->execute($query_data);
@@ -10177,11 +10177,11 @@  discard block
 block discarded – undo
10177 10177
 	
10178 10178
 	
10179 10179
 	/**
10180
-	* Counts all hours
10181
-	*
10182
-	* @return Array the hour list
10183
-	*
10184
-	*/
10180
+	 * Counts all hours
10181
+	 *
10182
+	 * @return Array the hour list
10183
+	 *
10184
+	 */
10185 10185
 	public function countAllHours($orderby,$filters = array())
10186 10186
 	{
10187 10187
 		global $globalTimezone, $globalDBdriver;
@@ -10242,11 +10242,11 @@  discard block
 block discarded – undo
10242 10242
 	}
10243 10243
 	
10244 10244
 	/**
10245
-	* Counts all hours
10246
-	*
10247
-	* @return Array the hour list
10248
-	*
10249
-	*/
10245
+	 * Counts all hours
10246
+	 *
10247
+	 * @return Array the hour list
10248
+	 *
10249
+	 */
10250 10250
 	public function countAllHoursByAirlines($orderby, $filters = array())
10251 10251
 	{
10252 10252
 		global $globalTimezone, $globalDBdriver;
@@ -10309,11 +10309,11 @@  discard block
 block discarded – undo
10309 10309
 
10310 10310
 
10311 10311
 	/**
10312
-	* Counts all hours by airline
10313
-	*
10314
-	* @return Array the hour list
10315
-	*
10316
-	*/
10312
+	 * Counts all hours by airline
10313
+	 *
10314
+	 * @return Array the hour list
10315
+	 *
10316
+	 */
10317 10317
 	public function countAllHoursByAirline($airline_icao, $filters = array())
10318 10318
 	{
10319 10319
 		global $globalTimezone, $globalDBdriver;
@@ -10359,11 +10359,11 @@  discard block
 block discarded – undo
10359 10359
 	
10360 10360
 	
10361 10361
 	/**
10362
-	* Counts all hours by aircraft
10363
-	*
10364
-	* @return Array the hour list
10365
-	*
10366
-	*/
10362
+	 * Counts all hours by aircraft
10363
+	 *
10364
+	 * @return Array the hour list
10365
+	 *
10366
+	 */
10367 10367
 	public function countAllHoursByAircraft($aircraft_icao, $filters = array())
10368 10368
 	{
10369 10369
 		global $globalTimezone, $globalDBdriver;
@@ -10406,11 +10406,11 @@  discard block
 block discarded – undo
10406 10406
 	
10407 10407
 	
10408 10408
 	/**
10409
-	* Counts all hours by aircraft registration
10410
-	*
10411
-	* @return Array the hour list
10412
-	*
10413
-	*/
10409
+	 * Counts all hours by aircraft registration
10410
+	 *
10411
+	 * @return Array the hour list
10412
+	 *
10413
+	 */
10414 10414
 	public function countAllHoursByRegistration($registration, $filters = array())
10415 10415
 	{
10416 10416
 		global $globalTimezone, $globalDBdriver;
@@ -10453,11 +10453,11 @@  discard block
 block discarded – undo
10453 10453
 	
10454 10454
 	
10455 10455
 	/**
10456
-	* Counts all hours by airport
10457
-	*
10458
-	* @return Array the hour list
10459
-	*
10460
-	*/
10456
+	 * Counts all hours by airport
10457
+	 *
10458
+	 * @return Array the hour list
10459
+	 *
10460
+	 */
10461 10461
 	public function countAllHoursByAirport($airport_icao, $filters = array())
10462 10462
 	{
10463 10463
 		global $globalTimezone, $globalDBdriver;
@@ -10501,11 +10501,11 @@  discard block
 block discarded – undo
10501 10501
 	
10502 10502
 	
10503 10503
 	/**
10504
-	* Counts all hours by manufacturer
10505
-	*
10506
-	* @return Array the hour list
10507
-	*
10508
-	*/
10504
+	 * Counts all hours by manufacturer
10505
+	 *
10506
+	 * @return Array the hour list
10507
+	 *
10508
+	 */
10509 10509
 	public function countAllHoursByManufacturer($aircraft_manufacturer,$filters =array())
10510 10510
 	{
10511 10511
 		global $globalTimezone, $globalDBdriver;
@@ -10549,11 +10549,11 @@  discard block
 block discarded – undo
10549 10549
 	
10550 10550
 	
10551 10551
 	/**
10552
-	* Counts all hours by date
10553
-	*
10554
-	* @return Array the hour list
10555
-	*
10556
-	*/
10552
+	 * Counts all hours by date
10553
+	 *
10554
+	 * @return Array the hour list
10555
+	 *
10556
+	 */
10557 10557
 	public function countAllHoursByDate($date, $filters = array())
10558 10558
 	{
10559 10559
 		global $globalTimezone, $globalDBdriver;
@@ -10597,11 +10597,11 @@  discard block
 block discarded – undo
10597 10597
 	
10598 10598
 	
10599 10599
 	/**
10600
-	* Counts all hours by a ident/callsign
10601
-	*
10602
-	* @return Array the hour list
10603
-	*
10604
-	*/
10600
+	 * Counts all hours by a ident/callsign
10601
+	 *
10602
+	 * @return Array the hour list
10603
+	 *
10604
+	 */
10605 10605
 	public function countAllHoursByIdent($ident, $filters = array())
10606 10606
 	{
10607 10607
 		global $globalTimezone, $globalDBdriver;
@@ -10644,11 +10644,11 @@  discard block
 block discarded – undo
10644 10644
 	}
10645 10645
 	
10646 10646
 	/**
10647
-	* Counts all hours by a owner
10648
-	*
10649
-	* @return Array the hour list
10650
-	*
10651
-	*/
10647
+	 * Counts all hours by a owner
10648
+	 *
10649
+	 * @return Array the hour list
10650
+	 *
10651
+	 */
10652 10652
 	public function countAllHoursByOwner($owner, $filters = array())
10653 10653
 	{
10654 10654
 		global $globalTimezone, $globalDBdriver;
@@ -10691,11 +10691,11 @@  discard block
 block discarded – undo
10691 10691
 	}
10692 10692
 	
10693 10693
 	/**
10694
-	* Counts all hours by a pilot
10695
-	*
10696
-	* @return Array the hour list
10697
-	*
10698
-	*/
10694
+	 * Counts all hours by a pilot
10695
+	 *
10696
+	 * @return Array the hour list
10697
+	 *
10698
+	 */
10699 10699
 	public function countAllHoursByPilot($pilot, $filters = array())
10700 10700
 	{
10701 10701
 		global $globalTimezone, $globalDBdriver;
@@ -10740,11 +10740,11 @@  discard block
 block discarded – undo
10740 10740
 	
10741 10741
 	
10742 10742
 	/**
10743
-	* Counts all hours by route
10744
-	*
10745
-	* @return Array the hour list
10746
-	*
10747
-	*/
10743
+	 * Counts all hours by route
10744
+	 *
10745
+	 * @return Array the hour list
10746
+	 *
10747
+	 */
10748 10748
 	public function countAllHoursByRoute($departure_airport_icao, $arrival_airport_icao, $filters =array())
10749 10749
 	{
10750 10750
 		global $globalTimezone, $globalDBdriver;
@@ -10788,11 +10788,11 @@  discard block
 block discarded – undo
10788 10788
 	
10789 10789
 	
10790 10790
 	/**
10791
-	* Counts all hours by country
10792
-	*
10793
-	* @return Array the hour list
10794
-	*
10795
-	*/
10791
+	 * Counts all hours by country
10792
+	 *
10793
+	 * @return Array the hour list
10794
+	 *
10795
+	 */
10796 10796
 	public function countAllHoursByCountry($country, $filters = array())
10797 10797
 	{
10798 10798
 		global $globalTimezone, $globalDBdriver;
@@ -10837,11 +10837,11 @@  discard block
 block discarded – undo
10837 10837
 
10838 10838
 
10839 10839
 	/**
10840
-	* Counts all aircraft that have flown over
10841
-	*
10842
-	* @return Integer the number of aircrafts
10843
-	*
10844
-	*/
10840
+	 * Counts all aircraft that have flown over
10841
+	 *
10842
+	 * @return Integer the number of aircrafts
10843
+	 *
10844
+	 */
10845 10845
 	public function countOverallAircrafts($filters = array(),$year = '',$month = '')
10846 10846
 	{
10847 10847
 		global $globalDBdriver;
@@ -10874,11 +10874,11 @@  discard block
 block discarded – undo
10874 10874
 	}
10875 10875
 
10876 10876
 	/**
10877
-	* Counts all flight that really arrival
10878
-	*
10879
-	* @return Integer the number of aircrafts
10880
-	*
10881
-	*/
10877
+	 * Counts all flight that really arrival
10878
+	 *
10879
+	 * @return Integer the number of aircrafts
10880
+	 *
10881
+	 */
10882 10882
 	public function countOverallArrival($filters = array(),$year = '',$month = '')
10883 10883
 	{
10884 10884
 		global $globalDBdriver;
@@ -10911,11 +10911,11 @@  discard block
 block discarded – undo
10911 10911
 	}
10912 10912
 
10913 10913
 	/**
10914
-	* Counts all pilots that have flown over
10915
-	*
10916
-	* @return Integer the number of pilots
10917
-	*
10918
-	*/
10914
+	 * Counts all pilots that have flown over
10915
+	 *
10916
+	 * @return Integer the number of pilots
10917
+	 *
10918
+	 */
10919 10919
 	public function countOverallPilots($filters = array(),$year = '',$month = '')
10920 10920
 	{
10921 10921
 		global $globalDBdriver;
@@ -10947,11 +10947,11 @@  discard block
 block discarded – undo
10947 10947
 	}
10948 10948
 
10949 10949
 	/**
10950
-	* Counts all owners that have flown over
10951
-	*
10952
-	* @return Integer the number of owners
10953
-	*
10954
-	*/
10950
+	 * Counts all owners that have flown over
10951
+	 *
10952
+	 * @return Integer the number of owners
10953
+	 *
10954
+	 */
10955 10955
 	public function countOverallOwners($filters = array(),$year = '',$month = '')
10956 10956
 	{
10957 10957
 		global $globalDBdriver;
@@ -10984,11 +10984,11 @@  discard block
 block discarded – undo
10984 10984
 	
10985 10985
 	
10986 10986
 	/**
10987
-	* Counts all flights that have flown over
10988
-	*
10989
-	* @return Integer the number of flights
10990
-	*
10991
-	*/
10987
+	 * Counts all flights that have flown over
10988
+	 *
10989
+	 * @return Integer the number of flights
10990
+	 *
10991
+	 */
10992 10992
 	public function countOverallFlights($filters = array(),$year = '',$month = '')
10993 10993
 	{
10994 10994
 		global $globalDBdriver;
@@ -11022,11 +11022,11 @@  discard block
 block discarded – undo
11022 11022
 	}
11023 11023
 	
11024 11024
 	/**
11025
-	* Counts all military flights that have flown over
11026
-	*
11027
-	* @return Integer the number of flights
11028
-	*
11029
-	*/
11025
+	 * Counts all military flights that have flown over
11026
+	 *
11027
+	 * @return Integer the number of flights
11028
+	 *
11029
+	 */
11030 11030
 	public function countOverallMilitaryFlights($filters = array(),$year = '',$month = '')
11031 11031
 	{
11032 11032
 		global $globalDBdriver;
@@ -11061,11 +11061,11 @@  discard block
 block discarded – undo
11061 11061
 	
11062 11062
 	
11063 11063
 	/**
11064
-	* Counts all airlines that have flown over
11065
-	*
11066
-	* @return Integer the number of airlines
11067
-	*
11068
-	*/
11064
+	 * Counts all airlines that have flown over
11065
+	 *
11066
+	 * @return Integer the number of airlines
11067
+	 *
11068
+	 */
11069 11069
 	public function countOverallAirlines($filters = array(),$year = '',$month = '')
11070 11070
 	{
11071 11071
 		global $globalDBdriver;
@@ -11092,8 +11092,8 @@  discard block
 block discarded – undo
11092 11092
 				$query_values = array_merge($query_values,array(':month' => $month));
11093 11093
 			}
11094 11094
 		}
11095
-                if ($query == '') $queryi .= $this->getFilter($filters);
11096
-                else $queryi .= $this->getFilter($filters,true,true).substr($query,4);
11095
+				if ($query == '') $queryi .= $this->getFilter($filters);
11096
+				else $queryi .= $this->getFilter($filters,true,true).substr($query,4);
11097 11097
 
11098 11098
 
11099 11099
 		$sth = $this->db->prepare($queryi);
@@ -11103,11 +11103,11 @@  discard block
 block discarded – undo
11103 11103
 
11104 11104
   
11105 11105
 	/**
11106
-	* Counts all hours of today
11107
-	*
11108
-	* @return Array the hour list
11109
-	*
11110
-	*/
11106
+	 * Counts all hours of today
11107
+	 *
11108
+	 * @return Array the hour list
11109
+	 *
11110
+	 */
11111 11111
 	public function countAllHoursFromToday($filters = array())
11112 11112
 	{
11113 11113
 		global $globalTimezone, $globalDBdriver;
@@ -11147,11 +11147,11 @@  discard block
 block discarded – undo
11147 11147
 	}
11148 11148
     
11149 11149
 	/**
11150
-	* Gets all the spotter information based on calculated upcoming flights
11151
-	*
11152
-	* @return Array the spotter information
11153
-	*
11154
-	*/
11150
+	 * Gets all the spotter information based on calculated upcoming flights
11151
+	 *
11152
+	 * @return Array the spotter information
11153
+	 *
11154
+	 */
11155 11155
 	public function getUpcomingFlights($limit = '', $sort = '', $filters = array())
11156 11156
 	{
11157 11157
 		global $global_query, $globalDBdriver, $globalTimezone;
@@ -11226,12 +11226,12 @@  discard block
 block discarded – undo
11226 11226
 	}
11227 11227
     
11228 11228
     
11229
-     /**
11230
-	* Gets the Barrie Spotter ID based on the FlightAware ID
11231
-	*
11232
-	* @return Integer the Barrie Spotter ID
11229
+	 /**
11230
+	  * Gets the Barrie Spotter ID based on the FlightAware ID
11231
+	  *
11232
+	  * @return Integer the Barrie Spotter ID
11233 11233
 q	*
11234
-	*/
11234
+	  */
11235 11235
 	public function getSpotterIDBasedOnFlightAwareID($flightaware_id)
11236 11236
 	{
11237 11237
 		$flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING);
@@ -11252,13 +11252,13 @@  discard block
 block discarded – undo
11252 11252
   
11253 11253
  
11254 11254
 	/**
11255
-	* Parses a date string
11256
-	*
11257
-	* @param String $dateString the date string
11258
-	* @param String $timezone the timezone of a user
11259
-	* @return Array the time information
11260
-	*
11261
-	*/
11255
+	 * Parses a date string
11256
+	 *
11257
+	 * @param String $dateString the date string
11258
+	 * @param String $timezone the timezone of a user
11259
+	 * @return Array the time information
11260
+	 *
11261
+	 */
11262 11262
 	public function parseDateString($dateString, $timezone = '')
11263 11263
 	{
11264 11264
 		$time_array = array();
@@ -11294,12 +11294,12 @@  discard block
 block discarded – undo
11294 11294
 	
11295 11295
 	
11296 11296
 	/**
11297
-	* Parses the direction degrees to working
11298
-	*
11299
-	* @param Float $direction the direction in degrees
11300
-	* @return Array the direction information
11301
-	*
11302
-	*/
11297
+	 * Parses the direction degrees to working
11298
+	 *
11299
+	 * @param Float $direction the direction in degrees
11300
+	 * @return Array the direction information
11301
+	 *
11302
+	 */
11303 11303
 	public function parseDirection($direction = 0)
11304 11304
 	{
11305 11305
 		if ($direction == '') $direction = 0;
@@ -11378,12 +11378,12 @@  discard block
 block discarded – undo
11378 11378
 	
11379 11379
 	
11380 11380
 	/**
11381
-	* Gets the aircraft registration
11382
-	*
11383
-	* @param String $flightaware_id the flight aware id
11384
-	* @return String the aircraft registration
11385
-	*
11386
-	*/
11381
+	 * Gets the aircraft registration
11382
+	 *
11383
+	 * @param String $flightaware_id the flight aware id
11384
+	 * @return String the aircraft registration
11385
+	 *
11386
+	 */
11387 11387
 	
11388 11388
 	public function getAircraftRegistration($flightaware_id)
11389 11389
 	{
@@ -11412,12 +11412,12 @@  discard block
 block discarded – undo
11412 11412
 
11413 11413
 
11414 11414
 	/**
11415
-	* Gets the aircraft registration from ModeS
11416
-	*
11417
-	* @param String $aircraft_modes the flight ModeS in hex
11418
-	* @return String the aircraft registration
11419
-	*
11420
-	*/
11415
+	 * Gets the aircraft registration from ModeS
11416
+	 *
11417
+	 * @param String $aircraft_modes the flight ModeS in hex
11418
+	 * @return String the aircraft registration
11419
+	 *
11420
+	 */
11421 11421
 	public function getAircraftRegistrationBymodeS($aircraft_modes)
11422 11422
 	{
11423 11423
 		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
@@ -11430,19 +11430,19 @@  discard block
 block discarded – undo
11430 11430
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
11431 11431
 		$sth->closeCursor();
11432 11432
 		if (count($row) > 0) {
11433
-		    //return $row['Registration'];
11434
-		    return $row['registration'];
11433
+			//return $row['Registration'];
11434
+			return $row['registration'];
11435 11435
 		} else return '';
11436 11436
 	
11437 11437
 	}
11438 11438
 
11439 11439
 	/**
11440
-	* Gets the aircraft type from ModeS
11441
-	*
11442
-	* @param String $aircraft_modes the flight ModeS in hex
11443
-	* @return String the aircraft type
11444
-	*
11445
-	*/
11440
+	 * Gets the aircraft type from ModeS
11441
+	 *
11442
+	 * @param String $aircraft_modes the flight ModeS in hex
11443
+	 * @return String the aircraft type
11444
+	 *
11445
+	 */
11446 11446
 	public function getAircraftTypeBymodeS($aircraft_modes)
11447 11447
 	{
11448 11448
 		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
@@ -11455,19 +11455,19 @@  discard block
 block discarded – undo
11455 11455
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
11456 11456
 		$sth->closeCursor();
11457 11457
 		if (count($row) > 0) {
11458
-		    if ($row['type_flight'] == null) return '';
11459
-		    else return $row['type_flight'];
11458
+			if ($row['type_flight'] == null) return '';
11459
+			else return $row['type_flight'];
11460 11460
 		} else return '';
11461 11461
 	
11462 11462
 	}
11463 11463
 
11464 11464
 	/**
11465
-	* Gets Country from latitude/longitude
11466
-	*
11467
-	* @param Float $latitude latitute of the flight
11468
-	* @param Float $longitude longitute of the flight
11469
-	* @return String the countrie
11470
-	*/
11465
+	 * Gets Country from latitude/longitude
11466
+	 *
11467
+	 * @param Float $latitude latitute of the flight
11468
+	 * @param Float $longitude longitute of the flight
11469
+	 * @return String the countrie
11470
+	 */
11471 11471
 	public function getCountryFromLatitudeLongitude($latitude,$longitude)
11472 11472
 	{
11473 11473
 		global $globalDBdriver, $globalDebug;
@@ -11504,11 +11504,11 @@  discard block
 block discarded – undo
11504 11504
 	}
11505 11505
 
11506 11506
 	/**
11507
-	* Gets Country from iso2
11508
-	*
11509
-	* @param String $iso2 ISO2 country code
11510
-	* @return String the countrie
11511
-	*/
11507
+	 * Gets Country from iso2
11508
+	 *
11509
+	 * @param String $iso2 ISO2 country code
11510
+	 * @return String the countrie
11511
+	 */
11512 11512
 	public function getCountryFromISO2($iso2)
11513 11513
 	{
11514 11514
 		global $globalDBdriver, $globalDebug;
@@ -11536,12 +11536,12 @@  discard block
 block discarded – undo
11536 11536
 	}
11537 11537
 
11538 11538
 	/**
11539
-	* converts the registration code using the country prefix
11540
-	*
11541
-	* @param String $registration the aircraft registration
11542
-	* @return String the aircraft registration
11543
-	*
11544
-	*/
11539
+	 * converts the registration code using the country prefix
11540
+	 *
11541
+	 * @param String $registration the aircraft registration
11542
+	 * @return String the aircraft registration
11543
+	 *
11544
+	 */
11545 11545
 	public function convertAircraftRegistration($registration)
11546 11546
 	{
11547 11547
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -11593,12 +11593,12 @@  discard block
 block discarded – undo
11593 11593
 	}
11594 11594
 
11595 11595
 	/**
11596
-	* Country from the registration code
11597
-	*
11598
-	* @param String $registration the aircraft registration
11599
-	* @return String the country
11600
-	*
11601
-	*/
11596
+	 * Country from the registration code
11597
+	 *
11598
+	 * @param String $registration the aircraft registration
11599
+	 * @return String the country
11600
+	 *
11601
+	 */
11602 11602
 	public function countryFromAircraftRegistration($registration)
11603 11603
 	{
11604 11604
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -11617,8 +11617,8 @@  discard block
 block discarded – undo
11617 11617
 				$country = $row['country'];
11618 11618
 			}
11619 11619
 		} else {
11620
-    			$registration_1 = substr($registration, 0, 1);
11621
-		        $registration_2 = substr($registration, 0, 2);
11620
+				$registration_1 = substr($registration, 0, 1);
11621
+				$registration_2 = substr($registration, 0, 2);
11622 11622
 
11623 11623
 			$country = '';
11624 11624
 			//first get the prefix based on two characters
@@ -11654,12 +11654,12 @@  discard block
 block discarded – undo
11654 11654
 	}
11655 11655
 
11656 11656
 	/**
11657
-	* Registration prefix from the registration code
11658
-	*
11659
-	* @param String $registration the aircraft registration
11660
-	* @return String the registration prefix
11661
-	*
11662
-	*/
11657
+	 * Registration prefix from the registration code
11658
+	 *
11659
+	 * @param String $registration the aircraft registration
11660
+	 * @return String the registration prefix
11661
+	 *
11662
+	 */
11663 11663
 	public function registrationPrefixFromAircraftRegistration($registration)
11664 11664
 	{
11665 11665
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -11678,8 +11678,8 @@  discard block
 block discarded – undo
11678 11678
 				//$country = $row['country'];
11679 11679
 			}
11680 11680
 		} else {
11681
-    			$registration_1 = substr($registration, 0, 1);
11682
-		        $registration_2 = substr($registration, 0, 2);
11681
+				$registration_1 = substr($registration, 0, 1);
11682
+				$registration_2 = substr($registration, 0, 2);
11683 11683
 
11684 11684
 			//first get the prefix based on two characters
11685 11685
 			$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_2 LIMIT 1";
@@ -11715,12 +11715,12 @@  discard block
 block discarded – undo
11715 11715
 
11716 11716
 
11717 11717
 	/**
11718
-	* Country from the registration code
11719
-	*
11720
-	* @param String $registration the aircraft registration
11721
-	* @return String the country
11722
-	*
11723
-	*/
11718
+	 * Country from the registration code
11719
+	 *
11720
+	 * @param String $registration the aircraft registration
11721
+	 * @return String the country
11722
+	 *
11723
+	 */
11724 11724
 	public function countryFromAircraftRegistrationCode($registration)
11725 11725
 	{
11726 11726
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -11737,11 +11737,11 @@  discard block
 block discarded – undo
11737 11737
 	}
11738 11738
 	
11739 11739
 	/**
11740
-	* Set a new highlight value for a flight
11741
-	*
11742
-	* @param String $flightaware_id flightaware_id from spotter_output table
11743
-	* @param String $highlight New highlight value
11744
-	*/
11740
+	 * Set a new highlight value for a flight
11741
+	 *
11742
+	 * @param String $flightaware_id flightaware_id from spotter_output table
11743
+	 * @param String $highlight New highlight value
11744
+	 */
11745 11745
 	public function setHighlightFlight($flightaware_id,$highlight) {
11746 11746
 		
11747 11747
 		$query  = "UPDATE spotter_output SET highlight = :highlight WHERE flightaware_id = :flightaware_id";
@@ -11750,12 +11750,12 @@  discard block
 block discarded – undo
11750 11750
 	}
11751 11751
 
11752 11752
 	/**
11753
-	* Set a new highlight value for a flight by Registration
11754
-	*
11755
-	* @param String $registration Registration of the aircraft
11756
-	* @param String $date Date of spotted aircraft
11757
-	* @param String $highlight New highlight value
11758
-	*/
11753
+	 * Set a new highlight value for a flight by Registration
11754
+	 *
11755
+	 * @param String $registration Registration of the aircraft
11756
+	 * @param String $date Date of spotted aircraft
11757
+	 * @param String $highlight New highlight value
11758
+	 */
11759 11759
 	public function setHighlightFlightByRegistration($registration,$highlight, $date = '') {
11760 11760
 		if ($date == '') {
11761 11761
 			$query  = "UPDATE spotter_output SET highlight = :highlight WHERE spotter_id IN (SELECT MAX(spotter_id) FROM spotter_output WHERE registration = :registration)";
@@ -11769,12 +11769,12 @@  discard block
 block discarded – undo
11769 11769
 	}
11770 11770
 	
11771 11771
 	/**
11772
-	* Gets the short url from bit.ly
11773
-	*
11774
-	* @param String $url the full url
11775
-	* @return String the bit.ly url
11776
-	*
11777
-	*/
11772
+	 * Gets the short url from bit.ly
11773
+	 *
11774
+	 * @param String $url the full url
11775
+	 * @return String the bit.ly url
11776
+	 *
11777
+	 */
11778 11778
 	public function getBitlyURL($url)
11779 11779
 	{
11780 11780
 		global $globalBitlyAccessToken;
@@ -12063,11 +12063,11 @@  discard block
 block discarded – undo
12063 12063
 			$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 
12064 12064
 	                      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)) 
12065 12065
 	                      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;";
12066
-                } else {
12066
+				} else {
12067 12067
 			$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 
12068 12068
 	                      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)) 
12069 12069
 	                      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;";
12070
-    		}
12070
+			}
12071 12071
 		$sth = $this->db->prepare($query);
12072 12072
 		$sth->execute();
12073 12073
 		return $sth->fetchAll(PDO::FETCH_ASSOC);
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) {
@@ -149,8 +151,11 @@  discard block
 block discarded – undo
149 151
 				$filter_query_where .= " AND EXTRACT(DAY FROM spotter_output.date) = '".$filter['day']."'";
150 152
 			}
151 153
 		}
152
-		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
153
-		elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND';
154
+		if ($filter_query_where == '' && $where) {
155
+			$filter_query_where = ' WHERE';
156
+		} elseif ($filter_query_where != '' && $and) {
157
+			$filter_query_where .= ' AND';
158
+		}
154 159
 		if ($filter_query_where != '') {
155 160
 			$filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where);
156 161
 		}
@@ -173,10 +178,18 @@  discard block
 block discarded – undo
173 178
 		$Image = new Image($this->db);
174 179
 		$Schedule = new Schedule($this->db);
175 180
 		$ACARS = new ACARS($this->db);
176
-		if (!isset($globalIVAO)) $globalIVAO = FALSE;
177
-		if (!isset($globalVATSIM)) $globalVATSIM = FALSE;
178
-		if (!isset($globalphpVMS)) $globalphpVMS = FALSE;
179
-		if (!isset($globalVAM)) $globalVAM = FALSE;
181
+		if (!isset($globalIVAO)) {
182
+			$globalIVAO = FALSE;
183
+		}
184
+		if (!isset($globalVATSIM)) {
185
+			$globalVATSIM = FALSE;
186
+		}
187
+		if (!isset($globalphpVMS)) {
188
+			$globalphpVMS = FALSE;
189
+		}
190
+		if (!isset($globalVAM)) {
191
+			$globalVAM = FALSE;
192
+		}
180 193
 		date_default_timezone_set('UTC');
181 194
 		
182 195
 		if (!is_string($query))
@@ -223,21 +236,35 @@  discard block
 block discarded – undo
223 236
 			} else {
224 237
 				$temp_array['spotter_id'] = '';
225 238
 			}
226
-			if (isset($row['flightaware_id'])) $temp_array['flightaware_id'] = $row['flightaware_id'];
227
-			if (isset($row['modes'])) $temp_array['modes'] = $row['modes'];
239
+			if (isset($row['flightaware_id'])) {
240
+				$temp_array['flightaware_id'] = $row['flightaware_id'];
241
+			}
242
+			if (isset($row['modes'])) {
243
+				$temp_array['modes'] = $row['modes'];
244
+			}
228 245
 			$temp_array['ident'] = $row['ident'];
229 246
 			if (isset($row['registration']) && $row['registration'] != '') {
230 247
 				$temp_array['registration'] = $row['registration'];
231 248
 			} elseif (isset($temp_array['modes'])) {
232 249
 				$temp_array['registration'] = $this->getAircraftRegistrationBymodeS($temp_array['modes']);
233
-			} else $temp_array['registration'] = '';
234
-			if (isset($row['aircraft_icao'])) $temp_array['aircraft_type'] = $row['aircraft_icao'];
250
+			} else {
251
+				$temp_array['registration'] = '';
252
+			}
253
+			if (isset($row['aircraft_icao'])) {
254
+				$temp_array['aircraft_type'] = $row['aircraft_icao'];
255
+			}
235 256
 			
236 257
 			$temp_array['departure_airport'] = $row['departure_airport_icao'];
237 258
 			$temp_array['arrival_airport'] = $row['arrival_airport_icao'];
238
-			if (isset($row['real_arrival_airport_icao']) && $row['real_arrival_airport_icao'] != NULL) $temp_array['real_arrival_airport'] = $row['real_arrival_airport_icao'];
239
-			if (isset($row['latitude'])) $temp_array['latitude'] = $row['latitude'];
240
-			if (isset($row['longitude'])) $temp_array['longitude'] = $row['longitude'];
259
+			if (isset($row['real_arrival_airport_icao']) && $row['real_arrival_airport_icao'] != NULL) {
260
+				$temp_array['real_arrival_airport'] = $row['real_arrival_airport_icao'];
261
+			}
262
+			if (isset($row['latitude'])) {
263
+				$temp_array['latitude'] = $row['latitude'];
264
+			}
265
+			if (isset($row['longitude'])) {
266
+				$temp_array['longitude'] = $row['longitude'];
267
+			}
241 268
 			/*
242 269
 			if (Connection->tableExists('countries')) {
243 270
 				$country_info = $this->getCountryFromLatitudeLongitude($temp_array['latitude'],$temp_array['longitude']);
@@ -247,8 +274,12 @@  discard block
 block discarded – undo
247 274
 				}
248 275
 			}
249 276
 			*/
250
-			if (isset($row['waypoints'])) $temp_array['waypoints'] = $row['waypoints'];
251
-			if (isset($row['format_source'])) $temp_array['format_source'] = $row['format_source'];
277
+			if (isset($row['waypoints'])) {
278
+				$temp_array['waypoints'] = $row['waypoints'];
279
+			}
280
+			if (isset($row['format_source'])) {
281
+				$temp_array['format_source'] = $row['format_source'];
282
+			}
252 283
 			if (isset($row['route_stop']) && $row['route_stop'] != '') {
253 284
 				$temp_array['route_stop'] = $row['route_stop'];
254 285
 				$allroute = explode(' ',$row['route_stop']);
@@ -264,13 +295,19 @@  discard block
 block discarded – undo
264 295
 					}
265 296
 				}
266 297
 			}
267
-			if (isset($row['altitude'])) $temp_array['altitude'] = $row['altitude'];
298
+			if (isset($row['altitude'])) {
299
+				$temp_array['altitude'] = $row['altitude'];
300
+			}
268 301
 			if (isset($row['heading'])) {
269 302
 				$temp_array['heading'] = $row['heading'];
270 303
 				$heading_direction = $this->parseDirection($row['heading']);
271
-				if (isset($heading_direction[0]['direction_fullname'])) $temp_array['heading_name'] = $heading_direction[0]['direction_fullname'];
304
+				if (isset($heading_direction[0]['direction_fullname'])) {
305
+					$temp_array['heading_name'] = $heading_direction[0]['direction_fullname'];
306
+				}
307
+			}
308
+			if (isset($row['ground_speed'])) {
309
+				$temp_array['ground_speed'] = $row['ground_speed'];
272 310
 			}
273
-			if (isset($row['ground_speed'])) $temp_array['ground_speed'] = $row['ground_speed'];
274 311
 			$temp_array['image'] = "";
275 312
 			$temp_array['image_thumbnail'] = "";
276 313
 			$temp_array['image_source'] = "";
@@ -278,7 +315,9 @@  discard block
 block discarded – undo
278 315
  
279 316
 			if (isset($row['highlight'])) {
280 317
 				$temp_array['highlight'] = $row['highlight'];
281
-			} else $temp_array['highlight'] = '';
318
+			} else {
319
+				$temp_array['highlight'] = '';
320
+			}
282 321
 			
283 322
 			if (isset($row['date'])) {
284 323
 				$dateArray = $this->parseDateString($row['date']);
@@ -334,7 +373,9 @@  discard block
 block discarded – undo
334 373
 				
335 374
 					if ($aircraft_array[0]['aircraft_shadow'] != NULL) {
336 375
 						$temp_array['aircraft_shadow'] = $aircraft_array[0]['aircraft_shadow'];
337
-					} else $temp_array['aircraft_shadow'] = 'default.png';
376
+					} else {
377
+						$temp_array['aircraft_shadow'] = 'default.png';
378
+					}
338 379
                                 } else {
339 380
                             		$temp_array['aircraft_shadow'] = 'default.png';
340 381
 					$temp_array['aircraft_name'] = 'N/A';
@@ -342,11 +383,17 @@  discard block
 block discarded – undo
342 383
                             	}
343 384
 			}
344 385
 			$fromsource = NULL;
345
-			if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource;
346
-			elseif (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') $fromsource = 'vatsim';
347
-			elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') $fromsource = 'ivao';
348
-			elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim';
349
-			elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao';
386
+			if (isset($globalAirlinesSource) && $globalAirlinesSource != '') {
387
+				$fromsource = $globalAirlinesSource;
388
+			} elseif (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') {
389
+				$fromsource = 'vatsim';
390
+			} elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') {
391
+				$fromsource = 'ivao';
392
+			} elseif (isset($globalVATSIM) && $globalVATSIM) {
393
+				$fromsource = 'vatsim';
394
+			} elseif (isset($globalIVAO) && $globalIVAO) {
395
+				$fromsource = 'ivao';
396
+			}
350 397
 			if (!isset($row['airline_name']) || $row['airline_name'] == '') {
351 398
 				if (!is_numeric(substr($row['ident'], 0, 3))) {
352 399
 					if (is_numeric(substr($row['ident'], 2, 1))) {
@@ -369,12 +416,18 @@  discard block
 block discarded – undo
369 416
 				}
370 417
 			} else {
371 418
 				$temp_array['airline_icao'] = $row['airline_icao'];
372
-				if (isset($row['airline_iata'])) $temp_array['airline_iata'] = $row['airline_iata'];
373
-				else $temp_array['airline_iata'] = 'N/A';
419
+				if (isset($row['airline_iata'])) {
420
+					$temp_array['airline_iata'] = $row['airline_iata'];
421
+				} else {
422
+					$temp_array['airline_iata'] = 'N/A';
423
+				}
374 424
 				$temp_array['airline_name'] = $row['airline_name'];
375 425
 				$temp_array['airline_country'] = $row['airline_country'];
376
-				if (isset($row['airline_callsign'])) $temp_array['airline_callsign'] = $row['airline_callsign'];
377
-				else $temp_array['airline_callsign'] = 'N/A';
426
+				if (isset($row['airline_callsign'])) {
427
+					$temp_array['airline_callsign'] = $row['airline_callsign'];
428
+				} else {
429
+					$temp_array['airline_callsign'] = 'N/A';
430
+				}
378 431
 				$temp_array['airline_type'] = $row['airline_type'];
379 432
 				if ($temp_array['airline_icao'] != '' && $temp_array['airline_iata'] == 'N/A') {
380 433
 					$airline_array = $this->getAllAirlineInfo($temp_array['airline_icao']);
@@ -401,7 +454,9 @@  discard block
 block discarded – undo
401 454
 			}
402 455
 			if ($temp_array['registration'] != "" && !$globalIVAO && !$globalVATSIM && !$globalphpVMS && !$globalVAM && !isset($temp_array['aircraft_owner'])) {
403 456
 				$owner_info = $this->getAircraftOwnerByRegistration($temp_array['registration']);
404
-				if ($owner_info['owner'] != '') $temp_array['aircraft_owner'] = ucwords(strtolower($owner_info['owner']));
457
+				if ($owner_info['owner'] != '') {
458
+					$temp_array['aircraft_owner'] = ucwords(strtolower($owner_info['owner']));
459
+				}
405 460
 				$temp_array['aircraft_base'] = $owner_info['base'];
406 461
 				$temp_array['aircraft_date_first_reg'] = $owner_info['date_first_reg'];
407 462
 			}
@@ -409,9 +464,14 @@  discard block
 block discarded – undo
409 464
 			if($temp_array['registration'] != "" || ($globalIVAO && isset($temp_array['aircraft_type']) && $temp_array['aircraft_type'] != ''))
410 465
 			{
411 466
 				if ($globalIVAO) {
412
-					if (isset($temp_array['airline_icao']))	$image_array = $Image->getSpotterImage('',$temp_array['aircraft_type'],$temp_array['airline_icao']);
413
-					else $image_array = $Image->getSpotterImage('',$temp_array['aircraft_type']);
414
-				} else $image_array = $Image->getSpotterImage($temp_array['registration']);
467
+					if (isset($temp_array['airline_icao'])) {
468
+						$image_array = $Image->getSpotterImage('',$temp_array['aircraft_type'],$temp_array['airline_icao']);
469
+					} else {
470
+						$image_array = $Image->getSpotterImage('',$temp_array['aircraft_type']);
471
+					}
472
+				} else {
473
+					$image_array = $Image->getSpotterImage($temp_array['registration']);
474
+				}
415 475
 				if (count($image_array) > 0) {
416 476
 					$temp_array['image'] = $image_array[0]['image'];
417 477
 					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -463,7 +523,9 @@  discard block
 block discarded – undo
463 523
 			//if ($row['departure_airport_icao'] != '' && $row['departure_airport_name'] == '') {
464 524
 			if ($row['departure_airport_icao'] != '') {
465 525
 				$departure_airport_array = $this->getAllAirportInfo($row['departure_airport_icao']);
466
-				if (!isset($departure_airport_array[0]['name'])) $departure_airport_array = $this->getAllAirportInfo('NA');
526
+				if (!isset($departure_airport_array[0]['name'])) {
527
+					$departure_airport_array = $this->getAllAirportInfo('NA');
528
+				}
467 529
 			/*
468 530
 			} elseif ($row['departure_airport_name'] != '') {
469 531
 				$temp_array['departure_airport_name'] = $row['departure_airport_name'];
@@ -471,7 +533,9 @@  discard block
 block discarded – undo
471 533
 				$temp_array['departure_airport_country'] = $row['departure_airport_country'];
472 534
 				$temp_array['departure_airport_icao'] = $row['departure_airport_icao'];
473 535
 			*/
474
-			} else $departure_airport_array = $this->getAllAirportInfo('NA');
536
+			} else {
537
+				$departure_airport_array = $this->getAllAirportInfo('NA');
538
+			}
475 539
 			if (isset($departure_airport_array[0]['name'])) {
476 540
 				$temp_array['departure_airport_name'] = $departure_airport_array[0]['name'];
477 541
 				$temp_array['departure_airport_city'] = $departure_airport_array[0]['city'];
@@ -491,8 +555,12 @@  discard block
 block discarded – undo
491 555
 			
492 556
 			if ($row['arrival_airport_icao'] != '') {
493 557
 				$arrival_airport_array = $this->getAllAirportInfo($row['arrival_airport_icao']);
494
-				if (count($arrival_airport_array) == 0) $arrival_airport_array = $this->getAllAirportInfo('NA');
495
-			} else $arrival_airport_array = $this->getAllAirportInfo('NA');
558
+				if (count($arrival_airport_array) == 0) {
559
+					$arrival_airport_array = $this->getAllAirportInfo('NA');
560
+				}
561
+			} else {
562
+				$arrival_airport_array = $this->getAllAirportInfo('NA');
563
+			}
496 564
 			if (isset($arrival_airport_array[0]['name'])) {
497 565
 				$temp_array['arrival_airport_name'] = $arrival_airport_array[0]['name'];
498 566
 				$temp_array['arrival_airport_city'] = $arrival_airport_array[0]['city'];
@@ -508,27 +576,45 @@  discard block
 block discarded – undo
508 576
 				$temp_array['arrival_airport_time'] = $row['arrival_airport_time'];
509 577
 			}
510 578
 			*/
511
-			if (isset($row['pilot_id']) && $row['pilot_id'] != '') $temp_array['pilot_id'] = $row['pilot_id'];
512
-			if (isset($row['pilot_name']) && $row['pilot_name'] != '') $temp_array['pilot_name'] = $row['pilot_name'];
513
-			if (isset($row['source_name']) && $row['source_name'] != '') $temp_array['source_name'] = $row['source_name'];
514
-			if (isset($row['over_country']) && $row['over_country'] != '') $temp_array['over_country'] = $row['over_country'];
515
-			if (isset($row['distance']) && $row['distance'] != '') $temp_array['distance'] = $row['distance'];
579
+			if (isset($row['pilot_id']) && $row['pilot_id'] != '') {
580
+				$temp_array['pilot_id'] = $row['pilot_id'];
581
+			}
582
+			if (isset($row['pilot_name']) && $row['pilot_name'] != '') {
583
+				$temp_array['pilot_name'] = $row['pilot_name'];
584
+			}
585
+			if (isset($row['source_name']) && $row['source_name'] != '') {
586
+				$temp_array['source_name'] = $row['source_name'];
587
+			}
588
+			if (isset($row['over_country']) && $row['over_country'] != '') {
589
+				$temp_array['over_country'] = $row['over_country'];
590
+			}
591
+			if (isset($row['distance']) && $row['distance'] != '') {
592
+				$temp_array['distance'] = $row['distance'];
593
+			}
516 594
 			if (isset($row['squawk'])) {
517 595
 				$temp_array['squawk'] = $row['squawk'];
518 596
 				if ($row['squawk'] != '' && isset($temp_array['country_iso2'])) {
519 597
 					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$temp_array['country_iso2']);
520
-					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
598
+					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) {
599
+						$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
600
+					}
521 601
 				} elseif ($row['squawk'] != '' && isset($temp_array['over_country'])) {
522 602
 					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$temp_array['over_country']);
523
-					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
524
-				} elseif ($row['squawk'] != '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
603
+					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) {
604
+						$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
605
+					}
606
+				} elseif ($row['squawk'] != '' && isset($globalSquawkCountry)) {
607
+					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
608
+				}
525 609
 			}
526 610
     			
527 611
 			$temp_array['query_number_rows'] = $num_rows;
528 612
 			
529 613
 			$spotter_array[] = $temp_array;
530 614
 		}
531
-		if ($num_rows == 0) return array();
615
+		if ($num_rows == 0) {
616
+			return array();
617
+		}
532 618
 		$spotter_array[0]['query_number_rows'] = $num_rows;
533 619
 		return $spotter_array;
534 620
 	}	
@@ -561,7 +647,9 @@  discard block
 block discarded – undo
561 647
 				foreach ($q_array as $q_item){
562 648
 					$q_item = filter_var($q_item,FILTER_SANITIZE_STRING);
563 649
 					$additional_query .= " AND (";
564
-					if (is_int($q_item)) $additional_query .= "(spotter_output.spotter_id like '%".$q_item."%') OR ";
650
+					if (is_int($q_item)) {
651
+						$additional_query .= "(spotter_output.spotter_id like '%".$q_item."%') OR ";
652
+					}
565 653
 					$additional_query .= "(spotter_output.aircraft_icao like '%".$q_item."%') OR ";
566 654
 					$additional_query .= "(spotter_output.aircraft_name like '%".$q_item."%') OR ";
567 655
 					$additional_query .= "(spotter_output.aircraft_manufacturer like '%".$q_item."%') OR ";
@@ -582,7 +670,9 @@  discard block
 block discarded – undo
582 670
 					$additional_query .= "(spotter_output.pilot_name like '%".$q_item."%') OR ";
583 671
 					$additional_query .= "(spotter_output.ident like '%".$q_item."%') OR ";
584 672
 					$translate = $Translation->ident2icao($q_item);
585
-					if ($translate != $q_item) $additional_query .= "(spotter_output.ident like '%".$translate."%') OR ";
673
+					if ($translate != $q_item) {
674
+						$additional_query .= "(spotter_output.ident like '%".$translate."%') OR ";
675
+					}
586 676
 					$additional_query .= "(spotter_output.highlight like '%".$q_item."%')";
587 677
 					$additional_query .= ")";
588 678
 				}
@@ -809,7 +899,9 @@  discard block
 block discarded – undo
809 899
 				date_default_timezone_set($globalTimezone);
810 900
 				$datetime = new DateTime();
811 901
 				$offset = $datetime->format('P');
812
-			} else $offset = '+00:00';
902
+			} else {
903
+				$offset = '+00:00';
904
+			}
813 905
 
814 906
 			if ($date_array[1] != "")
815 907
 			{
@@ -841,8 +933,12 @@  discard block
 block discarded – undo
841 933
 			{
842 934
 				//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
843 935
 				$limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0];
844
-			} else $limit_query = "";
845
-		} else $limit_query = "";
936
+			} else {
937
+				$limit_query = "";
938
+			}
939
+		} else {
940
+			$limit_query = "";
941
+		}
846 942
 
847 943
 
848 944
 		if ($sort != "")
@@ -910,8 +1006,12 @@  discard block
 block discarded – undo
910 1006
 			{
911 1007
 				//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
912 1008
 				$limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0];
913
-			} else $limit_query = "";
914
-		} else $limit_query = "";
1009
+			} else {
1010
+				$limit_query = "";
1011
+			}
1012
+		} else {
1013
+			$limit_query = "";
1014
+		}
915 1015
 		
916 1016
 		if ($sort != "")
917 1017
 		{
@@ -1235,7 +1335,9 @@  discard block
 block discarded – undo
1235 1335
 		global $global_query;
1236 1336
 		
1237 1337
 		date_default_timezone_set('UTC');
1238
-		if ($id == '') return array();
1338
+		if ($id == '') {
1339
+			return array();
1340
+		}
1239 1341
 		$additional_query = "spotter_output.spotter_id = :id";
1240 1342
 		$query_values = array(':id' => $id);
1241 1343
 
@@ -1350,8 +1452,11 @@  discard block
 block discarded – undo
1350 1452
 		if ($sort != "")
1351 1453
 		{
1352 1454
 			$search_orderby_array = $this->getOrderBy();
1353
-			if (isset($search_orderby_array[$sort]['sql'])) $orderby_query = $search_orderby_array[$sort]['sql'];
1354
-			else $orderby_query = " ORDER BY spotter_output.date DESC";
1455
+			if (isset($search_orderby_array[$sort]['sql'])) {
1456
+				$orderby_query = $search_orderby_array[$sort]['sql'];
1457
+			} else {
1458
+				$orderby_query = " ORDER BY spotter_output.date DESC";
1459
+			}
1355 1460
 		} else {
1356 1461
 			$orderby_query = " ORDER BY spotter_output.date DESC";
1357 1462
 		}
@@ -1976,7 +2081,9 @@  discard block
 block discarded – undo
1976 2081
 		{
1977 2082
 			$highlight = $row['highlight'];
1978 2083
 		}
1979
-		if (isset($highlight)) return $highlight;
2084
+		if (isset($highlight)) {
2085
+			return $highlight;
2086
+		}
1980 2087
 	}
1981 2088
 
1982 2089
 	
@@ -2004,7 +2111,9 @@  discard block
 block discarded – undo
2004 2111
 		$sth->closeCursor();
2005 2112
 		if (count($row) > 0) {
2006 2113
 			return $row['usage'];
2007
-		} else return '';
2114
+		} else {
2115
+			return '';
2116
+		}
2008 2117
 	}
2009 2118
 
2010 2119
 	/**
@@ -2029,7 +2138,9 @@  discard block
 block discarded – undo
2029 2138
 		$sth->closeCursor();
2030 2139
 		if (count($row) > 0) {
2031 2140
 			return $row['icao'];
2032
-		} else return '';
2141
+		} else {
2142
+			return '';
2143
+		}
2033 2144
 	}
2034 2145
 
2035 2146
 	/**
@@ -2057,7 +2168,9 @@  discard block
 block discarded – undo
2057 2168
 			$airport_longitude = $row['longitude'];
2058 2169
 			$Common = new Common();
2059 2170
 			return $Common->distance($latitude,$longitude,$airport_latitude,$airport_longitude);
2060
-		} else return '';
2171
+		} else {
2172
+			return '';
2173
+		}
2061 2174
 	}
2062 2175
 	
2063 2176
 	/**
@@ -2169,7 +2282,9 @@  discard block
 block discarded – undo
2169 2282
 			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2170 2283
 			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2171 2284
 			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2172
-		} else return array();
2285
+		} else {
2286
+			return array();
2287
+		}
2173 2288
 		if ($globalDBdriver == 'mysql') {
2174 2289
 			$query  = "SELECT airport.* FROM airport WHERE airport.latitude BETWEEN ".$minlat." AND ".$maxlat." AND airport.longitude BETWEEN ".$minlong." AND ".$maxlong." AND airport.type != 'closed'";
2175 2290
 		} else {
@@ -2204,7 +2319,9 @@  discard block
 block discarded – undo
2204 2319
 			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2205 2320
 			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2206 2321
 			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2207
-		} else return array();
2322
+		} else {
2323
+			return array();
2324
+		}
2208 2325
 		//$query  = "SELECT waypoints.* FROM waypoints WHERE waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong;
2209 2326
 		$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.")";
2210 2327
 		//$query  = "SELECT waypoints.* FROM waypoints";
@@ -2239,7 +2356,9 @@  discard block
 block discarded – undo
2239 2356
 	public function getAllAirlineInfo($airline_icao, $fromsource = NULL)
2240 2357
 	{
2241 2358
 		global $globalUseRealAirlines;
2242
-		if (isset($globalUseRealAirlines) && $globalUseRealAirlines) $fromsource = NULL;
2359
+		if (isset($globalUseRealAirlines) && $globalUseRealAirlines) {
2360
+			$fromsource = NULL;
2361
+		}
2243 2362
 		$airline_icao = strtoupper(filter_var($airline_icao,FILTER_SANITIZE_STRING));
2244 2363
 		if ($airline_icao == 'NA') {
2245 2364
 			$airline_array = array();
@@ -2308,7 +2427,9 @@  discard block
 block discarded – undo
2308 2427
 	public function getAllAirlineInfoByName($airline_name, $fromsource = NULL)
2309 2428
 	{
2310 2429
 		global $globalUseRealAirlines;
2311
-		if (isset($globalUseRealAirlines) && $globalUseRealAirlines) $fromsource = NULL;
2430
+		if (isset($globalUseRealAirlines) && $globalUseRealAirlines) {
2431
+			$fromsource = NULL;
2432
+		}
2312 2433
 		$airline_name = strtolower(filter_var($airline_name,FILTER_SANITIZE_STRING));
2313 2434
 		$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";
2314 2435
 		$sth = $this->db->prepare($query);
@@ -2324,7 +2445,9 @@  discard block
 block discarded – undo
2324 2445
 			$sth->execute(array(':fromsource' => $fromsource));
2325 2446
 			$row = $sth->fetch(PDO::FETCH_ASSOC);
2326 2447
 			$sth->closeCursor();
2327
-			if ($row['nb'] == 0) $result = $this->getAllAirlineInfoByName($airline_name);
2448
+			if ($row['nb'] == 0) {
2449
+				$result = $this->getAllAirlineInfoByName($airline_name);
2450
+			}
2328 2451
 		}
2329 2452
 		return $result;
2330 2453
 	}
@@ -2387,15 +2510,20 @@  discard block
 block discarded – undo
2387 2510
 				'A320-211' => 'A320',
2388 2511
 				'747-8i' => 'B748',
2389 2512
 				'A380' => 'A388');
2390
-		if (isset($all_aircraft[$aircraft_type])) return $all_aircraft[$aircraft_type];
2513
+		if (isset($all_aircraft[$aircraft_type])) {
2514
+			return $all_aircraft[$aircraft_type];
2515
+		}
2391 2516
 
2392 2517
 		$query  = "SELECT aircraft.icao FROM aircraft WHERE aircraft.type LIKE :saircraft_type OR aircraft.type = :aircraft_type OR aircraft.icao = :aircraft_type LIMIT 1";
2393 2518
 		$aircraft_type = strtoupper($aircraft_type);
2394 2519
 		$sth = $this->db->prepare($query);
2395 2520
 		$sth->execute(array(':saircraft_type' => '%'.$aircraft_type.'%',':aircraft_type' => $aircraft_type,));
2396 2521
 		$result = $sth->fetchAll(PDO::FETCH_ASSOC);
2397
-		if (isset($result[0]['icao'])) return $result[0]['icao'];
2398
-		else return '';
2522
+		if (isset($result[0]['icao'])) {
2523
+			return $result[0]['icao'];
2524
+		} else {
2525
+			return '';
2526
+		}
2399 2527
 	}
2400 2528
 	
2401 2529
 	/**
@@ -2418,9 +2546,13 @@  discard block
 block discarded – undo
2418 2546
 		$sth->closeCursor();
2419 2547
 		if (isset($row['icaotypecode'])) {
2420 2548
 			$icao = $row['icaotypecode'];
2421
-			if (isset($this->aircraft_correct_icaotype[$icao])) $icao = $this->aircraft_correct_icaotype[$icao];
2549
+			if (isset($this->aircraft_correct_icaotype[$icao])) {
2550
+				$icao = $this->aircraft_correct_icaotype[$icao];
2551
+			}
2422 2552
 			return $icao;
2423
-		} else return '';
2553
+		} else {
2554
+			return '';
2555
+		}
2424 2556
 	}
2425 2557
 
2426 2558
 	/**
@@ -2443,7 +2575,9 @@  discard block
 block discarded – undo
2443 2575
 		$sth->closeCursor();
2444 2576
 		if (isset($row['icaotypecode'])) {
2445 2577
 			return $row['icaotypecode'];
2446
-		} else return '';
2578
+		} else {
2579
+			return '';
2580
+		}
2447 2581
 	}
2448 2582
 
2449 2583
 	/**
@@ -2489,7 +2623,9 @@  discard block
 block discarded – undo
2489 2623
 		$sth->closeCursor();
2490 2624
 		if (isset($row['operator_correct'])) {
2491 2625
 			return $row['operator_correct'];
2492
-		} else return $operator;
2626
+		} else {
2627
+			return $operator;
2628
+		}
2493 2629
 	}
2494 2630
 
2495 2631
 	/**
@@ -2502,7 +2638,9 @@  discard block
 block discarded – undo
2502 2638
 	public function getRouteInfo($callsign)
2503 2639
 	{
2504 2640
 		$callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
2505
-                if ($callsign == '') return array();
2641
+                if ($callsign == '') {
2642
+                	return array();
2643
+                }
2506 2644
 		$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";
2507 2645
 		
2508 2646
 		$sth = $this->db->prepare($query);
@@ -2512,7 +2650,9 @@  discard block
 block discarded – undo
2512 2650
 		$sth->closeCursor();
2513 2651
 		if (count($row) > 0) {
2514 2652
 			return $row;
2515
-		} else return array();
2653
+		} else {
2654
+			return array();
2655
+		}
2516 2656
 	}
2517 2657
 	
2518 2658
 	/**
@@ -2565,7 +2705,9 @@  discard block
 block discarded – undo
2565 2705
 			$result = $sth->fetch(PDO::FETCH_ASSOC);
2566 2706
 			$sth->closeCursor();
2567 2707
 			return $result;
2568
-		} else return array();
2708
+		} else {
2709
+			return array();
2710
+		}
2569 2711
 	}
2570 2712
 	
2571 2713
   
@@ -2724,8 +2866,11 @@  discard block
 block discarded – undo
2724 2866
 		$query .= " ORDER BY spotter_output.source_name ASC";
2725 2867
 
2726 2868
 		$sth = $this->db->prepare($query);
2727
-		if (!empty($query_values)) $sth->execute($query_values);
2728
-		else $sth->execute();
2869
+		if (!empty($query_values)) {
2870
+			$sth->execute($query_values);
2871
+		} else {
2872
+			$sth->execute();
2873
+		}
2729 2874
 
2730 2875
 		$source_array = array();
2731 2876
 		$temp_array = array();
@@ -2758,9 +2903,13 @@  discard block
 block discarded – undo
2758 2903
 								WHERE spotter_output.airline_icao <> '' 
2759 2904
 								ORDER BY spotter_output.airline_name ASC";
2760 2905
 			*/
2761
-			if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $forsource = $globalAirlinesSource;
2762
-			elseif (isset($globalVATSIM) && $globalVATSIM) $forsource = 'vatsim';
2763
-			elseif (isset($globalIVAO) && $globalIVAO) $forsource = 'ivao';
2906
+			if (isset($globalAirlinesSource) && $globalAirlinesSource != '') {
2907
+				$forsource = $globalAirlinesSource;
2908
+			} elseif (isset($globalVATSIM) && $globalVATSIM) {
2909
+				$forsource = 'vatsim';
2910
+			} elseif (isset($globalIVAO) && $globalIVAO) {
2911
+				$forsource = 'ivao';
2912
+			}
2764 2913
 			if ($forsource === NULL) {
2765 2914
 				$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";
2766 2915
 				$query_data = array();
@@ -2803,9 +2952,13 @@  discard block
 block discarded – undo
2803 2952
 	{
2804 2953
 		global $globalAirlinesSource,$globalVATSIM, $globalIVAO;
2805 2954
 		$filter_query = $this->getFilter($filters,true,true);
2806
-		if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $forsource = $globalAirlinesSource;
2807
-		elseif (isset($globalVATSIM) && $globalVATSIM) $forsource = 'vatsim';
2808
-		elseif (isset($globalIVAO) && $globalIVAO) $forsource = 'ivao';
2955
+		if (isset($globalAirlinesSource) && $globalAirlinesSource != '') {
2956
+			$forsource = $globalAirlinesSource;
2957
+		} elseif (isset($globalVATSIM) && $globalVATSIM) {
2958
+			$forsource = 'vatsim';
2959
+		} elseif (isset($globalIVAO) && $globalIVAO) {
2960
+			$forsource = 'ivao';
2961
+		}
2809 2962
 		if ($forsource === NULL) {
2810 2963
 			$query = "SELECT DISTINCT alliance FROM airlines WHERE alliance IS NOT NULL AND forsource IS NULL ORDER BY alliance ASC";
2811 2964
 			$query_data = array();
@@ -3116,7 +3269,9 @@  discard block
 block discarded – undo
3116 3269
 			date_default_timezone_set($globalTimezone);
3117 3270
 			$datetime = new DateTime();
3118 3271
 			$offset = $datetime->format('P');
3119
-		} else $offset = '+00:00';
3272
+		} else {
3273
+			$offset = '+00:00';
3274
+		}
3120 3275
 		if ($airport_icao == '') {
3121 3276
 			if ($globalDBdriver == 'mysql') {
3122 3277
 				$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";
@@ -3148,7 +3303,9 @@  discard block
 block discarded – undo
3148 3303
 			date_default_timezone_set($globalTimezone);
3149 3304
 			$datetime = new DateTime();
3150 3305
 			$offset = $datetime->format('P');
3151
-		} else $offset = '+00:00';
3306
+		} else {
3307
+			$offset = '+00:00';
3308
+		}
3152 3309
 		if ($airport_icao == '') {
3153 3310
 			if ($globalDBdriver == 'mysql') {
3154 3311
 				$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";
@@ -3181,7 +3338,9 @@  discard block
 block discarded – undo
3181 3338
 			date_default_timezone_set($globalTimezone);
3182 3339
 			$datetime = new DateTime();
3183 3340
 			$offset = $datetime->format('P');
3184
-		} else $offset = '+00:00';
3341
+		} else {
3342
+			$offset = '+00:00';
3343
+		}
3185 3344
 		if ($airport_icao == '') {
3186 3345
 			if ($globalDBdriver == 'mysql') {
3187 3346
 				$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 
@@ -3220,7 +3379,9 @@  discard block
 block discarded – undo
3220 3379
 			date_default_timezone_set($globalTimezone);
3221 3380
 			$datetime = new DateTime();
3222 3381
 			$offset = $datetime->format('P');
3223
-		} else $offset = '+00:00';
3382
+		} else {
3383
+			$offset = '+00:00';
3384
+		}
3224 3385
 		if ($airport_icao == '') {
3225 3386
 			if ($globalDBdriver == 'mysql') {
3226 3387
 				$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 
@@ -3265,7 +3426,9 @@  discard block
 block discarded – undo
3265 3426
 			date_default_timezone_set($globalTimezone);
3266 3427
 			$datetime = new DateTime();
3267 3428
 			$offset = $datetime->format('P');
3268
-		} else $offset = '+00:00';
3429
+		} else {
3430
+			$offset = '+00:00';
3431
+		}
3269 3432
 		if ($airport_icao == '') {
3270 3433
 			if ($globalDBdriver == 'mysql') {
3271 3434
 				$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";
@@ -3300,7 +3463,9 @@  discard block
 block discarded – undo
3300 3463
 			date_default_timezone_set($globalTimezone);
3301 3464
 			$datetime = new DateTime();
3302 3465
 			$offset = $datetime->format('P');
3303
-		} else $offset = '+00:00';
3466
+		} else {
3467
+			$offset = '+00:00';
3468
+		}
3304 3469
 		if ($airport_icao == '') {
3305 3470
 			if ($globalDBdriver == 'mysql') {
3306 3471
 				$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 
@@ -3342,7 +3507,9 @@  discard block
 block discarded – undo
3342 3507
 			date_default_timezone_set($globalTimezone);
3343 3508
 			$datetime = new DateTime();
3344 3509
 			$offset = $datetime->format('P');
3345
-		} else $offset = '+00:00';
3510
+		} else {
3511
+			$offset = '+00:00';
3512
+		}
3346 3513
 		if ($airport_icao == '') {
3347 3514
 			if ($globalDBdriver == 'mysql') {
3348 3515
 				$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";
@@ -3376,7 +3543,9 @@  discard block
 block discarded – undo
3376 3543
 			date_default_timezone_set($globalTimezone);
3377 3544
 			$datetime = new DateTime();
3378 3545
 			$offset = $datetime->format('P');
3379
-		} else $offset = '+00:00';
3546
+		} else {
3547
+			$offset = '+00:00';
3548
+		}
3380 3549
 		if ($airport_icao == '') {
3381 3550
 			if ($globalDBdriver == 'mysql') {
3382 3551
 				$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 
@@ -3424,7 +3593,9 @@  discard block
 block discarded – undo
3424 3593
 			date_default_timezone_set($globalTimezone);
3425 3594
 			$datetime = new DateTime();
3426 3595
 			$offset = $datetime->format('P');
3427
-		} else $offset = '+00:00';
3596
+		} else {
3597
+			$offset = '+00:00';
3598
+		}
3428 3599
 
3429 3600
 		if ($globalDBdriver == 'mysql') {
3430 3601
 			$query  = "SELECT DISTINCT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) as date
@@ -3544,7 +3715,9 @@  discard block
 block discarded – undo
3544 3715
 	*/	
3545 3716
 	public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '',$arrival_airport_time = '')
3546 3717
 	{
3547
-		if ($groundspeed == '') $groundspeed = NULL;
3718
+		if ($groundspeed == '') {
3719
+			$groundspeed = NULL;
3720
+		}
3548 3721
 		$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';
3549 3722
                 $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);
3550 3723
 
@@ -3594,10 +3767,18 @@  discard block
 block discarded – undo
3594 3767
 		$Image = new Image($this->db);
3595 3768
 		$Common = new Common();
3596 3769
 		
3597
-		if (!isset($globalIVAO)) $globalIVAO = FALSE;
3598
-		if (!isset($globalVATSIM)) $globalVATSIM = FALSE;
3599
-		if (!isset($globalphpVMS)) $globalphpVMS = FALSE;
3600
-		if (!isset($globalVAM)) $globalVAM = FALSE;
3770
+		if (!isset($globalIVAO)) {
3771
+			$globalIVAO = FALSE;
3772
+		}
3773
+		if (!isset($globalVATSIM)) {
3774
+			$globalVATSIM = FALSE;
3775
+		}
3776
+		if (!isset($globalphpVMS)) {
3777
+			$globalphpVMS = FALSE;
3778
+		}
3779
+		if (!isset($globalVAM)) {
3780
+			$globalVAM = FALSE;
3781
+		}
3601 3782
 		date_default_timezone_set('UTC');
3602 3783
 		
3603 3784
 		//getting the registration
@@ -3610,23 +3791,33 @@  discard block
 block discarded – undo
3610 3791
 				if ($ModeS != '') {
3611 3792
 					$timeelapsed = microtime(true);
3612 3793
 					$registration = $this->getAircraftRegistrationBymodeS($ModeS);
3613
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3794
+					if ($globalDebugTimeElapsed) {
3795
+						echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3796
+					}
3614 3797
 				} else {
3615 3798
 					$myhex = explode('-',$flightaware_id);
3616 3799
 					if (count($myhex) > 0) {
3617 3800
 						$timeelapsed = microtime(true);
3618 3801
 						$registration = $this->getAircraftRegistrationBymodeS($myhex[0]);
3619
-						if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3802
+						if ($globalDebugTimeElapsed) {
3803
+							echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3804
+						}
3620 3805
 					}
3621 3806
 				}
3622 3807
 			}
3623 3808
 		}
3624 3809
 		$fromsource = NULL;
3625
-		if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource;
3626
-		elseif ($format_source == 'vatsimtxt') $fromsource = 'vatsim';
3627
-		elseif ($format_source == 'whazzup') $fromsource = 'ivao';
3628
-		elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim';
3629
-		elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao';
3810
+		if (isset($globalAirlinesSource) && $globalAirlinesSource != '') {
3811
+			$fromsource = $globalAirlinesSource;
3812
+		} elseif ($format_source == 'vatsimtxt') {
3813
+			$fromsource = 'vatsim';
3814
+		} elseif ($format_source == 'whazzup') {
3815
+			$fromsource = 'ivao';
3816
+		} elseif (isset($globalVATSIM) && $globalVATSIM) {
3817
+			$fromsource = 'vatsim';
3818
+		} elseif (isset($globalIVAO) && $globalIVAO) {
3819
+			$fromsource = 'ivao';
3820
+		}
3630 3821
 		//getting the airline information
3631 3822
 		if ($ident != "")
3632 3823
 		{
@@ -3650,15 +3841,21 @@  discard block
 block discarded – undo
3650 3841
 					if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == ""){
3651 3842
 						$airline_array = $this->getAllAirlineInfo("NA");
3652 3843
 					}
3653
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3844
+					if ($globalDebugTimeElapsed) {
3845
+						echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3846
+					}
3654 3847
 
3655 3848
 				} else {
3656 3849
 					$timeelapsed = microtime(true);
3657 3850
 					$airline_array = $this->getAllAirlineInfo("NA");
3658
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3851
+					if ($globalDebugTimeElapsed) {
3852
+						echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3853
+					}
3659 3854
 				}
3660 3855
 			}
3661
-		} else $airline_array = array();
3856
+		} else {
3857
+			$airline_array = array();
3858
+		}
3662 3859
 		
3663 3860
 		//getting the aircraft information
3664 3861
 		$aircraft_array = array();
@@ -3672,27 +3869,37 @@  discard block
 block discarded – undo
3672 3869
 				{
3673 3870
 					$timeelapsed = microtime(true);
3674 3871
 					$aircraft_array = $this->getAllAircraftInfo("NA");
3675
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3872
+					if ($globalDebugTimeElapsed) {
3873
+						echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3874
+					}
3676 3875
 				} else {
3677 3876
 					$timeelapsed = microtime(true);
3678 3877
 					$aircraft_array = $this->getAllAircraftInfo($aircraft_icao);
3679
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3878
+					if ($globalDebugTimeElapsed) {
3879
+						echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3880
+					}
3680 3881
 				}
3681 3882
 			}
3682 3883
 		} else {
3683 3884
 			if ($ModeS != '') {
3684 3885
 				$timeelapsed = microtime(true);
3685 3886
 				$aircraft_icao = $this->getAllAircraftType($ModeS);
3686
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3887
+				if ($globalDebugTimeElapsed) {
3888
+					echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3889
+				}
3687 3890
 				if ($aircraft_icao == "" || $aircraft_icao == "XXXX")
3688 3891
 				{
3689 3892
 					$timeelapsed = microtime(true);
3690 3893
 					$aircraft_array = $this->getAllAircraftInfo("NA");
3691
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3894
+					if ($globalDebugTimeElapsed) {
3895
+						echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3896
+					}
3692 3897
 				} else {
3693 3898
 					$timeelapsed = microtime(true);
3694 3899
 					$aircraft_array = $this->getAllAircraftInfo($aircraft_icao);
3695
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3900
+					if ($globalDebugTimeElapsed) {
3901
+						echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3902
+					}
3696 3903
 				}
3697 3904
 			}
3698 3905
 		}
@@ -3708,7 +3915,9 @@  discard block
 block discarded – undo
3708 3915
 			} else {
3709 3916
 				$timeelapsed = microtime(true);
3710 3917
 				$departure_airport_array = $this->getAllAirportInfo($departure_airport_icao);
3711
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3918
+				if ($globalDebugTimeElapsed) {
3919
+					echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3920
+				}
3712 3921
 			}
3713 3922
 		}
3714 3923
 		
@@ -3723,7 +3932,9 @@  discard block
 block discarded – undo
3723 3932
 			} else {
3724 3933
 				$timeelapsed = microtime(true);
3725 3934
 				$arrival_airport_array = $this->getAllAirportInfo($arrival_airport_icao);
3726
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3935
+				if ($globalDebugTimeElapsed) {
3936
+					echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3937
+				}
3727 3938
 			}
3728 3939
 		}
3729 3940
 
@@ -3757,7 +3968,9 @@  discard block
 block discarded – undo
3757 3968
 			{
3758 3969
 				return false;
3759 3970
 			}
3760
-		} else $altitude = 0;
3971
+		} else {
3972
+			$altitude = 0;
3973
+		}
3761 3974
 		
3762 3975
 		if ($heading != "")
3763 3976
 		{
@@ -3786,7 +3999,9 @@  discard block
 block discarded – undo
3786 3999
 		{
3787 4000
 			$timeelapsed = microtime(true);
3788 4001
 			$image_array = $Image->getSpotterImage($registration);
3789
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
4002
+			if ($globalDebugTimeElapsed) {
4003
+				echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
4004
+			}
3790 4005
 			if (!isset($image_array[0]['registration']))
3791 4006
 			{
3792 4007
 				//echo "Add image !!!! \n";
@@ -3794,14 +4009,21 @@  discard block
 block discarded – undo
3794 4009
 			}
3795 4010
 			$timeelapsed = microtime(true);
3796 4011
 			$owner_info = $this->getAircraftOwnerByRegistration($registration);
3797
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3798
-			if ($owner_info['owner'] != '') $aircraft_owner = ucwords(strtolower($owner_info['owner']));
4012
+			if ($globalDebugTimeElapsed) {
4013
+				echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
4014
+			}
4015
+			if ($owner_info['owner'] != '') {
4016
+				$aircraft_owner = ucwords(strtolower($owner_info['owner']));
4017
+			}
3799 4018
 		}
3800 4019
     
3801 4020
 		if ($globalIVAO && $aircraft_icao != '')
3802 4021
 		{
3803
-            		if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao'];
3804
-            		else $airline_icao = '';
4022
+            		if (isset($airline_array[0]['icao'])) {
4023
+            			$airline_icao = $airline_array[0]['icao'];
4024
+            		} else {
4025
+            			$airline_icao = '';
4026
+            		}
3805 4027
 			$image_array = $Image->getSpotterImage('',$aircraft_icao,$airline_icao);
3806 4028
 			if (!isset($image_array[0]['registration']))
3807 4029
 			{
@@ -3846,16 +4068,28 @@  discard block
 block discarded – undo
3846 4068
                 {
3847 4069
                         $arrival_airport_array = $this->getAllAirportInfo('NA');
3848 4070
                 }
3849
-                if ($registration == '') $registration = 'NA';
4071
+                if ($registration == '') {
4072
+                	$registration = 'NA';
4073
+                }
3850 4074
                 if ($latitude == '' && $longitude == '') {
3851 4075
             		$latitude = 0;
3852 4076
             		$longitude = 0;
3853 4077
             	}
3854
-                if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL;
3855
-                if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL;
3856
-                if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
3857
-                if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
3858
-                if (!isset($aircraft_owner)) $aircraft_owner = NULL;
4078
+                if ($squawk == '' || $Common->isInteger($squawk) === false) {
4079
+                	$squawk = NULL;
4080
+                }
4081
+                if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) {
4082
+                	$verticalrate = NULL;
4083
+                }
4084
+                if ($heading == '' || $Common->isInteger($heading) === false) {
4085
+                	$heading = 0;
4086
+                }
4087
+                if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) {
4088
+                	$groundspeed = 0;
4089
+                }
4090
+                if (!isset($aircraft_owner)) {
4091
+                	$aircraft_owner = NULL;
4092
+                }
3859 4093
                 $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) 
3860 4094
                 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)";
3861 4095
 
@@ -3866,9 +4100,13 @@  discard block
 block discarded – undo
3866 4100
 		if ($airline_type == '') {
3867 4101
 			$timeelapsed = microtime(true);
3868 4102
 			$airline_type = $this->getAircraftTypeBymodeS($ModeS);
3869
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
4103
+			if ($globalDebugTimeElapsed) {
4104
+				echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
4105
+			}
4106
+		}
4107
+		if ($airline_type == null) {
4108
+			$airline_type = '';
3870 4109
 		}
3871
-		if ($airline_type == null) $airline_type = '';
3872 4110
                 $aircraft_type = $aircraft_array[0]['type'];
3873 4111
                 $aircraft_manufacturer = $aircraft_array[0]['manufacturer'];
3874 4112
                 $departure_airport_name = $departure_airport_array[0]['name'];
@@ -4032,7 +4270,9 @@  discard block
 block discarded – undo
4032 4270
 			}
4033 4271
 		}
4034 4272
 		$query .= " GROUP BY spotter_output.airline_name,spotter_output.airline_icao, spotter_output.airline_country ORDER BY airline_count DESC";
4035
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4273
+		if ($limit) {
4274
+			$query .= " LIMIT 10 OFFSET 0";
4275
+		}
4036 4276
 
4037 4277
 		$sth = $this->db->prepare($query);
4038 4278
 		$sth->execute($query_values);
@@ -4105,7 +4345,9 @@  discard block
 block discarded – undo
4105 4345
 		}
4106 4346
 		
4107 4347
 		$query .= " GROUP BY spotter_output.pilot_id,s.pilot_name,spotter_output.format_source ORDER BY pilot_count DESC";
4108
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4348
+		if ($limit) {
4349
+			$query .= " LIMIT 10 OFFSET 0";
4350
+		}
4109 4351
       
4110 4352
 		
4111 4353
 		$sth = $this->db->prepare($query);
@@ -4149,7 +4391,9 @@  discard block
 block discarded – undo
4149 4391
 			}
4150 4392
 		}
4151 4393
 		$query .= "GROUP BY spotter_output.airline_icao, spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.format_source ORDER BY pilot_count DESC";
4152
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4394
+		if ($limit) {
4395
+			$query .= " LIMIT 10 OFFSET 0";
4396
+		}
4153 4397
       
4154 4398
 		
4155 4399
 		$sth = $this->db->prepare($query);
@@ -4225,7 +4469,9 @@  discard block
 block discarded – undo
4225 4469
 			}
4226 4470
 		}
4227 4471
 		$query .= " GROUP BY spotter_output.owner_name ORDER BY owner_count DESC";
4228
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4472
+		if ($limit) {
4473
+			$query .= " LIMIT 10 OFFSET 0";
4474
+		}
4229 4475
 		
4230 4476
 		$sth = $this->db->prepare($query);
4231 4477
 		$sth->execute($query_values);
@@ -4267,7 +4513,9 @@  discard block
 block discarded – undo
4267 4513
 			}
4268 4514
 		}
4269 4515
 		$query .= "GROUP BY spotter_output.airline_icao, spotter_output.owner_name ORDER BY owner_count DESC";
4270
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4516
+		if ($limit) {
4517
+			$query .= " LIMIT 10 OFFSET 0";
4518
+		}
4271 4519
       
4272 4520
 		
4273 4521
 		$sth = $this->db->prepare($query);
@@ -4510,7 +4758,9 @@  discard block
 block discarded – undo
4510 4758
 			date_default_timezone_set($globalTimezone);
4511 4759
 			$datetime = new DateTime($date);
4512 4760
 			$offset = $datetime->format('P');
4513
-		} else $offset = '+00:00';
4761
+		} else {
4762
+			$offset = '+00:00';
4763
+		}
4514 4764
 
4515 4765
 		if ($globalDBdriver == 'mysql') {
4516 4766
 			$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
@@ -4558,7 +4808,9 @@  discard block
 block discarded – undo
4558 4808
 			date_default_timezone_set($globalTimezone);
4559 4809
 			$datetime = new DateTime($date);
4560 4810
 			$offset = $datetime->format('P');
4561
-		} else $offset = '+00:00';
4811
+		} else {
4812
+			$offset = '+00:00';
4813
+		}
4562 4814
 		
4563 4815
 		if ($globalDBdriver == 'mysql') {
4564 4816
 			$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
@@ -4678,9 +4930,13 @@  discard block
 block discarded – undo
4678 4930
 		$sth = $this->db->prepare($query);
4679 4931
 		$sth->execute($query_values);
4680 4932
 		$result = $sth->fetchAll(PDO::FETCH_ASSOC);
4681
-		if (is_numeric($result[0]['duration'])) return gmdate('H:i:s',$result[0]['duration']);
4682
-		elseif ($result[0]['duration'] == '') return 0;
4683
-		else return $result[0]['duration'];
4933
+		if (is_numeric($result[0]['duration'])) {
4934
+			return gmdate('H:i:s',$result[0]['duration']);
4935
+		} elseif ($result[0]['duration'] == '') {
4936
+			return 0;
4937
+		} else {
4938
+			return $result[0]['duration'];
4939
+		}
4684 4940
 	}
4685 4941
 
4686 4942
 	/**
@@ -4769,8 +5025,11 @@  discard block
 block discarded – undo
4769 5025
 		$sth = $this->db->prepare($query);
4770 5026
 		$sth->execute($query_values);
4771 5027
 		$result = $sth->fetchAll(PDO::FETCH_ASSOC);
4772
-		if (is_int($result[0]['duration'])) return gmdate('H:i:s',$result[0]['duration']);
4773
-		else return $result[0]['duration'];
5028
+		if (is_int($result[0]['duration'])) {
5029
+			return gmdate('H:i:s',$result[0]['duration']);
5030
+		} else {
5031
+			return $result[0]['duration'];
5032
+		}
4774 5033
 	}
4775 5034
 
4776 5035
 	/**
@@ -4975,7 +5234,9 @@  discard block
 block discarded – undo
4975 5234
 		}
4976 5235
 		$query .= " GROUP BY spotter_output.airline_country
4977 5236
 					ORDER BY airline_country_count DESC";
4978
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5237
+		if ($limit) {
5238
+			$query .= " LIMIT 10 OFFSET 0";
5239
+		}
4979 5240
       
4980 5241
 		$sth = $this->db->prepare($query);
4981 5242
 		$sth->execute($query_values);
@@ -5003,7 +5264,9 @@  discard block
 block discarded – undo
5003 5264
 		global $globalDBdriver;
5004 5265
 		//$filter_query = $this->getFilter($filters,true,true);
5005 5266
 		$Connection= new Connection($this->db);
5006
-		if (!$Connection->tableExists('countries')) return array();
5267
+		if (!$Connection->tableExists('countries')) {
5268
+			return array();
5269
+		}
5007 5270
 		/*
5008 5271
 		$query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb 
5009 5272
 					FROM countries c, spotter_output s
@@ -5035,7 +5298,9 @@  discard block
 block discarded – undo
5035 5298
 		}
5036 5299
 		$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 ";
5037 5300
 		$query .= "GROUP BY c.name,c.iso3,c.iso2 ORDER BY nb DESC";
5038
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5301
+		if ($limit) {
5302
+			$query .= " LIMIT 10 OFFSET 0";
5303
+		}
5039 5304
       
5040 5305
 		
5041 5306
 		$sth = $this->db->prepare($query);
@@ -5112,7 +5377,9 @@  discard block
 block discarded – undo
5112 5377
 		}
5113 5378
 
5114 5379
 		$query .= " GROUP BY spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer ORDER BY aircraft_icao_count DESC";
5115
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5380
+		if ($limit) {
5381
+			$query .= " LIMIT 10 OFFSET 0";
5382
+		}
5116 5383
  
5117 5384
 		$sth = $this->db->prepare($query);
5118 5385
 		$sth->execute($query_values);
@@ -5186,7 +5453,9 @@  discard block
 block discarded – undo
5186 5453
 		}
5187 5454
 
5188 5455
 		$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";
5189
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5456
+		if ($limit) {
5457
+			$query .= " LIMIT 10 OFFSET 0";
5458
+		}
5190 5459
  
5191 5460
 		$sth = $this->db->prepare($query);
5192 5461
 		$sth->execute($query_values);
@@ -5233,7 +5502,9 @@  discard block
 block discarded – undo
5233 5502
 		}
5234 5503
 
5235 5504
 		$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";
5236
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5505
+		if ($limit) {
5506
+			$query .= " LIMIT 10 OFFSET 0";
5507
+		}
5237 5508
  
5238 5509
 		$sth = $this->db->prepare($query);
5239 5510
 		$sth->execute();
@@ -5286,7 +5557,9 @@  discard block
 block discarded – undo
5286 5557
 			if($row['registration'] != "")
5287 5558
 			{
5288 5559
 				$image_array = $Image->getSpotterImage($row['registration']);
5289
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5560
+				if (isset($image_array[0]['image_thumbnail'])) {
5561
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5562
+				}
5290 5563
 			}
5291 5564
 			$temp_array['registration_count'] = $row['registration_count'];
5292 5565
 
@@ -5361,7 +5634,9 @@  discard block
 block discarded – undo
5361 5634
 			if($row['registration'] != "")
5362 5635
 			{
5363 5636
 				$image_array = $Image->getSpotterImage($row['registration']);
5364
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5637
+				if (isset($image_array[0]['image_thumbnail'])) {
5638
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5639
+				}
5365 5640
 			}
5366 5641
 			$temp_array['registration_count'] = $row['registration_count'];
5367 5642
 
@@ -5468,7 +5743,9 @@  discard block
 block discarded – undo
5468 5743
 			if($row['registration'] != "")
5469 5744
 			{
5470 5745
 				$image_array = $Image->getSpotterImage($row['registration']);
5471
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5746
+				if (isset($image_array[0]['image_thumbnail'])) {
5747
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5748
+				}
5472 5749
 			}
5473 5750
 			$temp_array['registration_count'] = $row['registration_count'];
5474 5751
 			$aircraft_array[] = $temp_array;
@@ -5593,7 +5870,9 @@  discard block
 block discarded – undo
5593 5870
 			date_default_timezone_set($globalTimezone);
5594 5871
 			$datetime = new DateTime($date);
5595 5872
 			$offset = $datetime->format('P');
5596
-		} else $offset = '+00:00';
5873
+		} else {
5874
+			$offset = '+00:00';
5875
+		}
5597 5876
 
5598 5877
 		if ($globalDBdriver == 'mysql') {
5599 5878
 			$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
@@ -5640,7 +5919,9 @@  discard block
 block discarded – undo
5640 5919
 			date_default_timezone_set($globalTimezone);
5641 5920
 			$datetime = new DateTime($date);
5642 5921
 			$offset = $datetime->format('P');
5643
-		} else $offset = '+00:00';
5922
+		} else {
5923
+			$offset = '+00:00';
5924
+		}
5644 5925
 
5645 5926
 		if ($globalDBdriver == 'mysql') {
5646 5927
 			$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 
@@ -5669,7 +5950,9 @@  discard block
 block discarded – undo
5669 5950
 			if($row['registration'] != "")
5670 5951
 			{
5671 5952
 				$image_array = $Image->getSpotterImage($row['registration']);
5672
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5953
+				if (isset($image_array[0]['image_thumbnail'])) {
5954
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5955
+				}
5673 5956
 			}
5674 5957
 			$temp_array['registration_count'] = $row['registration_count'];
5675 5958
  
@@ -5694,7 +5977,9 @@  discard block
 block discarded – undo
5694 5977
 			date_default_timezone_set($globalTimezone);
5695 5978
 			$datetime = new DateTime($date);
5696 5979
 			$offset = $datetime->format('P');
5697
-		} else $offset = '+00:00';
5980
+		} else {
5981
+			$offset = '+00:00';
5982
+		}
5698 5983
 
5699 5984
 		if ($globalDBdriver == 'mysql') {
5700 5985
 			$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
@@ -5890,8 +6175,11 @@  discard block
 block discarded – undo
5890 6175
 			if($row['registration'] != "")
5891 6176
 			{
5892 6177
 				$image_array = $Image->getSpotterImage($row['registration']);
5893
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5894
-				else $temp_array['image_thumbnail'] = '';
6178
+				if (isset($image_array[0]['image_thumbnail'])) {
6179
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
6180
+				} else {
6181
+					$temp_array['image_thumbnail'] = '';
6182
+				}
5895 6183
 			}
5896 6184
 			$temp_array['registration_count'] = $row['registration_count'];
5897 6185
 			$aircraft_array[] = $temp_array;
@@ -5965,8 +6253,11 @@  discard block
 block discarded – undo
5965 6253
 			if($row['registration'] != "")
5966 6254
 			{
5967 6255
 				$image_array = $Image->getSpotterImage($row['registration']);
5968
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5969
-				else $temp_array['image_thumbnail'] = '';
6256
+				if (isset($image_array[0]['image_thumbnail'])) {
6257
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
6258
+				} else {
6259
+					$temp_array['image_thumbnail'] = '';
6260
+				}
5970 6261
 			}
5971 6262
 			$temp_array['registration_count'] = $row['registration_count'];
5972 6263
 			$aircraft_array[] = $temp_array;
@@ -6040,8 +6331,11 @@  discard block
 block discarded – undo
6040 6331
 			if($row['registration'] != "")
6041 6332
 			{
6042 6333
 				$image_array = $Image->getSpotterImage($row['registration']);
6043
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
6044
-				else $temp_array['image_thumbnail'] = '';
6334
+				if (isset($image_array[0]['image_thumbnail'])) {
6335
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
6336
+				} else {
6337
+					$temp_array['image_thumbnail'] = '';
6338
+				}
6045 6339
 			}
6046 6340
 			$temp_array['registration_count'] = $row['registration_count'];
6047 6341
 			$aircraft_array[] = $temp_array;
@@ -6252,7 +6546,9 @@  discard block
 block discarded – undo
6252 6546
 			if($row['registration'] != "")
6253 6547
 			{
6254 6548
 				$image_array = $Image->getSpotterImage($row['registration']);
6255
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
6549
+				if (isset($image_array[0]['image_thumbnail'])) {
6550
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
6551
+				}
6256 6552
 			}
6257 6553
 			$temp_array['registration_count'] = $row['registration_count'];
6258 6554
           
@@ -6369,7 +6665,9 @@  discard block
 block discarded – undo
6369 6665
 			if($row['registration'] != "")
6370 6666
 			{
6371 6667
 				$image_array = $Image->getSpotterImage($row['registration']);
6372
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
6668
+				if (isset($image_array[0]['image_thumbnail'])) {
6669
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
6670
+				}
6373 6671
 			}
6374 6672
 			$temp_array['registration_count'] = $row['registration_count'];
6375 6673
           
@@ -6535,7 +6833,9 @@  discard block
 block discarded – undo
6535 6833
 			}
6536 6834
 		}
6537 6835
 		$query .= " GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC";
6538
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
6836
+		if ($limit) {
6837
+			$query .= " LIMIT 10 OFFSET 0";
6838
+		}
6539 6839
 		
6540 6840
 		$sth = $this->db->prepare($query);
6541 6841
 		$sth->execute($query_values);
@@ -6554,7 +6854,9 @@  discard block
 block discarded – undo
6554 6854
 			if($row['registration'] != "")
6555 6855
 			{
6556 6856
 				$image_array = $Image->getSpotterImage($row['registration']);
6557
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
6857
+				if (isset($image_array[0]['image_thumbnail'])) {
6858
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
6859
+				}
6558 6860
 			}
6559 6861
           
6560 6862
 			$aircraft_array[] = $temp_array;
@@ -6595,7 +6897,9 @@  discard block
 block discarded – undo
6595 6897
 		// if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6596 6898
 		//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6597 6899
                 $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";
6598
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
6900
+		if ($limit) {
6901
+			$query .= " LIMIT 10 OFFSET 0";
6902
+		}
6599 6903
 		
6600 6904
 		$sth = $this->db->prepare($query);
6601 6905
 		$sth->execute();
@@ -6615,7 +6919,9 @@  discard block
 block discarded – undo
6615 6919
 			if($row['registration'] != "")
6616 6920
 			{
6617 6921
 				$image_array = $Image->getSpotterImage($row['registration']);
6618
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
6922
+				if (isset($image_array[0]['image_thumbnail'])) {
6923
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
6924
+				}
6619 6925
 			}
6620 6926
           
6621 6927
 			$aircraft_array[] = $temp_array;
@@ -6681,7 +6987,9 @@  discard block
 block discarded – undo
6681 6987
 		}
6682 6988
                 $query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
6683 6989
 				ORDER BY airport_departure_icao_count DESC";
6684
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
6990
+		if ($limit) {
6991
+			$query .= " LIMIT 10 OFFSET 0";
6992
+		}
6685 6993
 
6686 6994
 		$sth = $this->db->prepare($query);
6687 6995
 		$sth->execute($query_values);
@@ -6732,7 +7040,9 @@  discard block
 block discarded – undo
6732 7040
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6733 7041
                 $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
6734 7042
 				ORDER BY airport_departure_icao_count DESC";
6735
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
7043
+		if ($limit) {
7044
+			$query .= " LIMIT 10 OFFSET 0";
7045
+		}
6736 7046
       
6737 7047
 		$sth = $this->db->prepare($query);
6738 7048
 		$sth->execute();
@@ -6810,7 +7120,9 @@  discard block
 block discarded – undo
6810 7120
 		}
6811 7121
                 $query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
6812 7122
 				ORDER BY airport_departure_icao_count DESC";
6813
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
7123
+		if ($limit) {
7124
+			$query .= " LIMIT 10 OFFSET 0";
7125
+		}
6814 7126
     		//echo $query;
6815 7127
 		$sth = $this->db->prepare($query);
6816 7128
 		$sth->execute($query_values);
@@ -6862,7 +7174,9 @@  discard block
 block discarded – undo
6862 7174
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6863 7175
                 $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
6864 7176
 				ORDER BY airport_departure_icao_count DESC";
6865
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
7177
+		if ($limit) {
7178
+			$query .= " LIMIT 10 OFFSET 0";
7179
+		}
6866 7180
       
6867 7181
 		$sth = $this->db->prepare($query);
6868 7182
 		$sth->execute();
@@ -7257,7 +7571,9 @@  discard block
 block discarded – undo
7257 7571
 			date_default_timezone_set($globalTimezone);
7258 7572
 			$datetime = new DateTime($date);
7259 7573
 			$offset = $datetime->format('P');
7260
-		} else $offset = '+00:00';
7574
+		} else {
7575
+			$offset = '+00:00';
7576
+		}
7261 7577
 
7262 7578
 		if ($globalDBdriver == 'mysql') {
7263 7579
 			$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 
@@ -7307,7 +7623,9 @@  discard block
 block discarded – undo
7307 7623
 			date_default_timezone_set($globalTimezone);
7308 7624
 			$datetime = new DateTime($date);
7309 7625
 			$offset = $datetime->format('P');
7310
-		} else $offset = '+00:00';
7626
+		} else {
7627
+			$offset = '+00:00';
7628
+		}
7311 7629
 
7312 7630
 		if ($globalDBdriver == 'mysql') {
7313 7631
 			$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
@@ -7656,7 +7974,9 @@  discard block
 block discarded – undo
7656 7974
 		}
7657 7975
                 $query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
7658 7976
 					ORDER BY airport_arrival_icao_count DESC";
7659
-		if ($limit) $query .= " LIMIT 10";
7977
+		if ($limit) {
7978
+			$query .= " LIMIT 10";
7979
+		}
7660 7980
       
7661 7981
 		
7662 7982
 		$sth = $this->db->prepare($query);
@@ -7676,7 +7996,9 @@  discard block
 block discarded – undo
7676 7996
 			if ($icaoaskey) {
7677 7997
 				$icao = $row['arrival_airport_icao'];
7678 7998
 				$airport_array[$icao] = $temp_array;
7679
-			} else $airport_array[] = $temp_array;
7999
+			} else {
8000
+				$airport_array[] = $temp_array;
8001
+			}
7680 8002
 		}
7681 8003
 
7682 8004
 		return $airport_array;
@@ -7713,7 +8035,9 @@  discard block
 block discarded – undo
7713 8035
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
7714 8036
                 $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
7715 8037
 					ORDER BY airport_arrival_icao_count DESC";
7716
-		if ($limit) $query .= " LIMIT 10";
8038
+		if ($limit) {
8039
+			$query .= " LIMIT 10";
8040
+		}
7717 8041
       
7718 8042
 		
7719 8043
 		$sth = $this->db->prepare($query);
@@ -7734,7 +8058,9 @@  discard block
 block discarded – undo
7734 8058
 			if ($icaoaskey) {
7735 8059
 				$icao = $row['arrival_airport_icao'];
7736 8060
 				$airport_array[$icao] = $temp_array;
7737
-			} else $airport_array[] = $temp_array;
8061
+			} else {
8062
+				$airport_array[] = $temp_array;
8063
+			}
7738 8064
 		}
7739 8065
 
7740 8066
 		return $airport_array;
@@ -7797,7 +8123,9 @@  discard block
 block discarded – undo
7797 8123
 		}
7798 8124
                 $query .= " GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
7799 8125
 					ORDER BY airport_arrival_icao_count DESC";
7800
-		if ($limit) $query .= " LIMIT 10";
8126
+		if ($limit) {
8127
+			$query .= " LIMIT 10";
8128
+		}
7801 8129
       
7802 8130
 		
7803 8131
 		$sth = $this->db->prepare($query);
@@ -7816,7 +8144,9 @@  discard block
 block discarded – undo
7816 8144
 			if ($icaoaskey) {
7817 8145
 				$icao = $row['arrival_airport_icao'];
7818 8146
 				$airport_array[$icao] = $temp_array;
7819
-			} else $airport_array[] = $temp_array;
8147
+			} else {
8148
+				$airport_array[] = $temp_array;
8149
+			}
7820 8150
 		}
7821 8151
 
7822 8152
 		return $airport_array;
@@ -7853,7 +8183,9 @@  discard block
 block discarded – undo
7853 8183
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
7854 8184
                 $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
7855 8185
 					ORDER BY airport_arrival_icao_count DESC";
7856
-		if ($limit) $query .= " LIMIT 10";
8186
+		if ($limit) {
8187
+			$query .= " LIMIT 10";
8188
+		}
7857 8189
       
7858 8190
 		
7859 8191
 		$sth = $this->db->prepare($query);
@@ -7874,7 +8206,9 @@  discard block
 block discarded – undo
7874 8206
 			if ($icaoaskey) {
7875 8207
 				$icao = $row['arrival_airport_icao'];
7876 8208
 				$airport_array[$icao] = $temp_array;
7877
-			} else $airport_array[] = $temp_array;
8209
+			} else {
8210
+				$airport_array[] = $temp_array;
8211
+			}
7878 8212
 		}
7879 8213
 
7880 8214
 		return $airport_array;
@@ -8255,7 +8589,9 @@  discard block
 block discarded – undo
8255 8589
 			date_default_timezone_set($globalTimezone);
8256 8590
 			$datetime = new DateTime($date);
8257 8591
 			$offset = $datetime->format('P');
8258
-		} else $offset = '+00:00';
8592
+		} else {
8593
+			$offset = '+00:00';
8594
+		}
8259 8595
 
8260 8596
 		if ($globalDBdriver == 'mysql') {
8261 8597
 			$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 
@@ -8305,7 +8641,9 @@  discard block
 block discarded – undo
8305 8641
 			date_default_timezone_set($globalTimezone);
8306 8642
 			$datetime = new DateTime($date);
8307 8643
 			$offset = $datetime->format('P');
8308
-		} else $offset = '+00:00';
8644
+		} else {
8645
+			$offset = '+00:00';
8646
+		}
8309 8647
 
8310 8648
 		if ($globalDBdriver == 'mysql') {
8311 8649
 			$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
@@ -8696,7 +9034,9 @@  discard block
 block discarded – undo
8696 9034
 		}
8697 9035
 		$query .= " GROUP BY spotter_output.arrival_airport_country
8698 9036
 					ORDER BY airport_arrival_country_count DESC";
8699
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
9037
+		if ($limit) {
9038
+			$query .= " LIMIT 10 OFFSET 0";
9039
+		}
8700 9040
       
8701 9041
 		
8702 9042
 		$sth = $this->db->prepare($query);
@@ -8983,7 +9323,9 @@  discard block
 block discarded – undo
8983 9323
 			date_default_timezone_set($globalTimezone);
8984 9324
 			$datetime = new DateTime($date);
8985 9325
 			$offset = $datetime->format('P');
8986
-		} else $offset = '+00:00';
9326
+		} else {
9327
+			$offset = '+00:00';
9328
+		}
8987 9329
 		
8988 9330
 		if ($globalDBdriver == 'mysql') {
8989 9331
 			$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
@@ -9239,12 +9581,18 @@  discard block
 block discarded – undo
9239 9581
 		$query  = "SELECT DISTINCT spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name, spotter_output.airline_icao  
9240 9582
                     FROM spotter_output".$filter_query." spotter_output.ident <> ''";
9241 9583
 		 if ($olderthanmonths > 0) {
9242
-			if ($globalDBdriver == 'mysql') $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)';
9243
-			else $query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
9584
+			if ($globalDBdriver == 'mysql') {
9585
+				$query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)';
9586
+			} else {
9587
+				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
9588
+			}
9244 9589
 		}
9245 9590
 		if ($sincedate != '') {
9246
-			if ($globalDBdriver == 'mysql') $query .= " AND spotter_output.date > '".$sincedate."'";
9247
-			else $query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
9591
+			if ($globalDBdriver == 'mysql') {
9592
+				$query .= " AND spotter_output.date > '".$sincedate."'";
9593
+			} else {
9594
+				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
9595
+			}
9248 9596
 		}
9249 9597
 		$query_values = array();
9250 9598
 		if ($year != '') {
@@ -9275,7 +9623,9 @@  discard block
 block discarded – undo
9275 9623
 			}
9276 9624
 		}
9277 9625
 		$query .= " GROUP BY spotter_output.ident, spotter_output.airline_name, spotter_output.airline_icao ORDER BY callsign_icao_count DESC";
9278
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
9626
+		if ($limit) {
9627
+			$query .= " LIMIT 10 OFFSET 0";
9628
+		}
9279 9629
       		
9280 9630
 		$sth = $this->db->prepare($query);
9281 9631
 		$sth->execute($query_values);
@@ -9309,15 +9659,23 @@  discard block
 block discarded – undo
9309 9659
 		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name  
9310 9660
                     FROM spotter_output".$filter_query." spotter_output.ident <> ''  AND spotter_output.airline_icao <> '' ";
9311 9661
 		 if ($olderthanmonths > 0) {
9312
-			if ($globalDBdriver == 'mysql') $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
9313
-			else $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
9662
+			if ($globalDBdriver == 'mysql') {
9663
+				$query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
9664
+			} else {
9665
+				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
9666
+			}
9314 9667
 		}
9315 9668
 		if ($sincedate != '') {
9316
-			if ($globalDBdriver == 'mysql') $query .= "AND spotter_output.date > '".$sincedate."' ";
9317
-			else $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP) ";
9669
+			if ($globalDBdriver == 'mysql') {
9670
+				$query .= "AND spotter_output.date > '".$sincedate."' ";
9671
+			} else {
9672
+				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP) ";
9673
+			}
9318 9674
 		}
9319 9675
 		$query .= "GROUP BY spotter_output.airline_icao, spotter_output.ident, spotter_output.airline_name, spotter_output.airline_icao ORDER BY callsign_icao_count DESC";
9320
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
9676
+		if ($limit) {
9677
+			$query .= " LIMIT 10 OFFSET 0";
9678
+		}
9321 9679
       		
9322 9680
 		$sth = $this->db->prepare($query);
9323 9681
 		$sth->execute();
@@ -9354,7 +9712,9 @@  discard block
 block discarded – undo
9354 9712
 			date_default_timezone_set($globalTimezone);
9355 9713
 			$datetime = new DateTime();
9356 9714
 			$offset = $datetime->format('P');
9357
-		} else $offset = '+00:00';
9715
+		} else {
9716
+			$offset = '+00:00';
9717
+		}
9358 9718
 
9359 9719
 		if ($globalDBdriver == 'mysql') {
9360 9720
 			$query  = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -9403,7 +9763,9 @@  discard block
 block discarded – undo
9403 9763
 			date_default_timezone_set($globalTimezone);
9404 9764
 			$datetime = new DateTime();
9405 9765
 			$offset = $datetime->format('P');
9406
-		} else $offset = '+00:00';
9766
+		} else {
9767
+			$offset = '+00:00';
9768
+		}
9407 9769
 		$filter_query = $this->getFilter($filters,true,true);
9408 9770
 		if ($globalDBdriver == 'mysql') {
9409 9771
 			$query  = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -9452,7 +9814,9 @@  discard block
 block discarded – undo
9452 9814
 			date_default_timezone_set($globalTimezone);
9453 9815
 			$datetime = new DateTime();
9454 9816
 			$offset = $datetime->format('P');
9455
-		} else $offset = '+00:00';
9817
+		} else {
9818
+			$offset = '+00:00';
9819
+		}
9456 9820
 		$filter_query = $this->getFilter($filters,true,true);
9457 9821
 		if ($globalDBdriver == 'mysql') {
9458 9822
 			$query  = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -9498,7 +9862,9 @@  discard block
 block discarded – undo
9498 9862
 			date_default_timezone_set($globalTimezone);
9499 9863
 			$datetime = new DateTime();
9500 9864
 			$offset = $datetime->format('P');
9501
-		} else $offset = '+00:00';
9865
+		} else {
9866
+			$offset = '+00:00';
9867
+		}
9502 9868
 		$filter_query = $this->getFilter($filters,true,true);
9503 9869
 		if ($globalDBdriver == 'mysql') {
9504 9870
 			$query  = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -9546,7 +9912,9 @@  discard block
 block discarded – undo
9546 9912
 			date_default_timezone_set($globalTimezone);
9547 9913
 			$datetime = new DateTime();
9548 9914
 			$offset = $datetime->format('P');
9549
-		} else $offset = '+00:00';
9915
+		} else {
9916
+			$offset = '+00:00';
9917
+		}
9550 9918
 		
9551 9919
 		if ($globalDBdriver == 'mysql') {
9552 9920
 			$query  = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -9594,7 +9962,9 @@  discard block
 block discarded – undo
9594 9962
 			date_default_timezone_set($globalTimezone);
9595 9963
 			$datetime = new DateTime();
9596 9964
 			$offset = $datetime->format('P');
9597
-		} else $offset = '+00:00';
9965
+		} else {
9966
+			$offset = '+00:00';
9967
+		}
9598 9968
 
9599 9969
 		if ($globalDBdriver == 'mysql') {
9600 9970
 			$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
@@ -9641,7 +10011,9 @@  discard block
 block discarded – undo
9641 10011
 			date_default_timezone_set($globalTimezone);
9642 10012
 			$datetime = new DateTime();
9643 10013
 			$offset = $datetime->format('P');
9644
-		} else $offset = '+00:00';
10014
+		} else {
10015
+			$offset = '+00:00';
10016
+		}
9645 10017
 
9646 10018
 		if ($globalDBdriver == 'mysql') {
9647 10019
 			$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
@@ -9689,7 +10061,9 @@  discard block
 block discarded – undo
9689 10061
 			date_default_timezone_set($globalTimezone);
9690 10062
 			$datetime = new DateTime();
9691 10063
 			$offset = $datetime->format('P');
9692
-		} else $offset = '+00:00';
10064
+		} else {
10065
+			$offset = '+00:00';
10066
+		}
9693 10067
 		$filter_query = $this->getFilter($filters,true,true);
9694 10068
 		if ($globalDBdriver == 'mysql') {
9695 10069
 			$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
@@ -9734,7 +10108,9 @@  discard block
 block discarded – undo
9734 10108
 			date_default_timezone_set($globalTimezone);
9735 10109
 			$datetime = new DateTime();
9736 10110
 			$offset = $datetime->format('P');
9737
-		} else $offset = '+00:00';
10111
+		} else {
10112
+			$offset = '+00:00';
10113
+		}
9738 10114
 		$filter_query = $this->getFilter($filters,true,true);
9739 10115
 
9740 10116
 		if ($globalDBdriver == 'mysql') {
@@ -9781,7 +10157,9 @@  discard block
 block discarded – undo
9781 10157
 			date_default_timezone_set($globalTimezone);
9782 10158
 			$datetime = new DateTime();
9783 10159
 			$offset = $datetime->format('P');
9784
-		} else $offset = '+00:00';
10160
+		} else {
10161
+			$offset = '+00:00';
10162
+		}
9785 10163
 
9786 10164
 		if ($globalDBdriver == 'mysql') {
9787 10165
 			$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
@@ -9827,7 +10205,9 @@  discard block
 block discarded – undo
9827 10205
 			date_default_timezone_set($globalTimezone);
9828 10206
 			$datetime = new DateTime();
9829 10207
 			$offset = $datetime->format('P');
9830
-		} else $offset = '+00:00';
10208
+		} else {
10209
+			$offset = '+00:00';
10210
+		}
9831 10211
 		$filter_query = $this->getFilter($filters,true,true);
9832 10212
 
9833 10213
 		if ($globalDBdriver == 'mysql') {
@@ -9874,7 +10254,9 @@  discard block
 block discarded – undo
9874 10254
 			date_default_timezone_set($globalTimezone);
9875 10255
 			$datetime = new DateTime();
9876 10256
 			$offset = $datetime->format('P');
9877
-		} else $offset = '+00:00';
10257
+		} else {
10258
+			$offset = '+00:00';
10259
+		}
9878 10260
 
9879 10261
 		if ($globalDBdriver == 'mysql') {
9880 10262
 			$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
@@ -9921,7 +10303,9 @@  discard block
 block discarded – undo
9921 10303
 			date_default_timezone_set($globalTimezone);
9922 10304
 			$datetime = new DateTime();
9923 10305
 			$offset = $datetime->format('P');
9924
-		} else $offset = '+00:00';
10306
+		} else {
10307
+			$offset = '+00:00';
10308
+		}
9925 10309
 
9926 10310
 		if ($globalDBdriver == 'mysql') {
9927 10311
 			$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
@@ -9966,7 +10350,9 @@  discard block
 block discarded – undo
9966 10350
 			date_default_timezone_set($globalTimezone);
9967 10351
 			$datetime = new DateTime();
9968 10352
 			$offset = $datetime->format('P');
9969
-		} else $offset = '+00:00';
10353
+		} else {
10354
+			$offset = '+00:00';
10355
+		}
9970 10356
 		$filter_query = $this->getFilter($filters,true,true);
9971 10357
 
9972 10358
 		if ($globalDBdriver == 'mysql') {
@@ -10014,7 +10400,9 @@  discard block
 block discarded – undo
10014 10400
 			date_default_timezone_set($globalTimezone);
10015 10401
 			$datetime = new DateTime();
10016 10402
 			$offset = $datetime->format('P');
10017
-		} else $offset = '+00:00';
10403
+		} else {
10404
+			$offset = '+00:00';
10405
+		}
10018 10406
 
10019 10407
 		if ($globalDBdriver == 'mysql') {
10020 10408
 			$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
@@ -10060,7 +10448,9 @@  discard block
 block discarded – undo
10060 10448
 			date_default_timezone_set($globalTimezone);
10061 10449
 			$datetime = new DateTime();
10062 10450
 			$offset = $datetime->format('P');
10063
-		} else $offset = '+00:00';
10451
+		} else {
10452
+			$offset = '+00:00';
10453
+		}
10064 10454
 		$filter_query = $this->getFilter($filters,true,true);
10065 10455
 
10066 10456
 		if ($globalDBdriver == 'mysql') {
@@ -10108,7 +10498,9 @@  discard block
 block discarded – undo
10108 10498
 			date_default_timezone_set($globalTimezone);
10109 10499
 			$datetime = new DateTime();
10110 10500
 			$offset = $datetime->format('P');
10111
-		} else $offset = '+00:00';
10501
+		} else {
10502
+			$offset = '+00:00';
10503
+		}
10112 10504
 
10113 10505
 		if ($globalDBdriver == 'mysql') {
10114 10506
 			$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
@@ -10155,7 +10547,9 @@  discard block
 block discarded – undo
10155 10547
 			date_default_timezone_set($globalTimezone);
10156 10548
 			$datetime = new DateTime();
10157 10549
 			$offset = $datetime->format('P');
10158
-		} else $offset = '+00:00';
10550
+		} else {
10551
+			$offset = '+00:00';
10552
+		}
10159 10553
 		$filter_query = $this->getFilter($filters,true,true);
10160 10554
 		if ($globalDBdriver == 'mysql') {
10161 10555
 			$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
@@ -10204,7 +10598,9 @@  discard block
 block discarded – undo
10204 10598
 			date_default_timezone_set($globalTimezone);
10205 10599
 			$datetime = new DateTime();
10206 10600
 			$offset = $datetime->format('P');
10207
-		} else $offset = '+00:00';
10601
+		} else {
10602
+			$offset = '+00:00';
10603
+		}
10208 10604
 
10209 10605
 		$orderby_sql = '';
10210 10606
 		if ($orderby == "hour")
@@ -10270,7 +10666,9 @@  discard block
 block discarded – undo
10270 10666
 			date_default_timezone_set($globalTimezone);
10271 10667
 			$datetime = new DateTime();
10272 10668
 			$offset = $datetime->format('P');
10273
-		} else $offset = '+00:00';
10669
+		} else {
10670
+			$offset = '+00:00';
10671
+		}
10274 10672
 
10275 10673
 		$orderby_sql = '';
10276 10674
 		if ($orderby == "hour")
@@ -10337,7 +10735,9 @@  discard block
 block discarded – undo
10337 10735
 			date_default_timezone_set($globalTimezone);
10338 10736
 			$datetime = new DateTime();
10339 10737
 			$offset = $datetime->format('P');
10340
-		} else $offset = '+00:00';
10738
+		} else {
10739
+			$offset = '+00:00';
10740
+		}
10341 10741
 
10342 10742
 		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
10343 10743
 
@@ -10388,7 +10788,9 @@  discard block
 block discarded – undo
10388 10788
 			date_default_timezone_set($globalTimezone);
10389 10789
 			$datetime = new DateTime();
10390 10790
 			$offset = $datetime->format('P');
10391
-		} else $offset = '+00:00';
10791
+		} else {
10792
+			$offset = '+00:00';
10793
+		}
10392 10794
 
10393 10795
 		if ($globalDBdriver == 'mysql') {
10394 10796
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -10435,7 +10837,9 @@  discard block
 block discarded – undo
10435 10837
 			date_default_timezone_set($globalTimezone);
10436 10838
 			$datetime = new DateTime();
10437 10839
 			$offset = $datetime->format('P');
10438
-		} else $offset = '+00:00';
10840
+		} else {
10841
+			$offset = '+00:00';
10842
+		}
10439 10843
 
10440 10844
 		if ($globalDBdriver == 'mysql') {
10441 10845
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -10482,7 +10886,9 @@  discard block
 block discarded – undo
10482 10886
 			date_default_timezone_set($globalTimezone);
10483 10887
 			$datetime = new DateTime();
10484 10888
 			$offset = $datetime->format('P');
10485
-		} else $offset = '+00:00';
10889
+		} else {
10890
+			$offset = '+00:00';
10891
+		}
10486 10892
 
10487 10893
 		if ($globalDBdriver == 'mysql') {
10488 10894
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -10530,7 +10936,9 @@  discard block
 block discarded – undo
10530 10936
 			date_default_timezone_set($globalTimezone);
10531 10937
 			$datetime = new DateTime();
10532 10938
 			$offset = $datetime->format('P');
10533
-		} else $offset = '+00:00';
10939
+		} else {
10940
+			$offset = '+00:00';
10941
+		}
10534 10942
 
10535 10943
 		if ($globalDBdriver == 'mysql') {
10536 10944
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -10578,7 +10986,9 @@  discard block
 block discarded – undo
10578 10986
 			date_default_timezone_set($globalTimezone);
10579 10987
 			$datetime = new DateTime($date);
10580 10988
 			$offset = $datetime->format('P');
10581
-		} else $offset = '+00:00';
10989
+		} else {
10990
+			$offset = '+00:00';
10991
+		}
10582 10992
 
10583 10993
 		if ($globalDBdriver == 'mysql') {
10584 10994
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -10626,7 +11036,9 @@  discard block
 block discarded – undo
10626 11036
 			date_default_timezone_set($globalTimezone);
10627 11037
 			$datetime = new DateTime();
10628 11038
 			$offset = $datetime->format('P');
10629
-		} else $offset = '+00:00';
11039
+		} else {
11040
+			$offset = '+00:00';
11041
+		}
10630 11042
 
10631 11043
 		if ($globalDBdriver == 'mysql') {
10632 11044
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -10673,7 +11085,9 @@  discard block
 block discarded – undo
10673 11085
 			date_default_timezone_set($globalTimezone);
10674 11086
 			$datetime = new DateTime();
10675 11087
 			$offset = $datetime->format('P');
10676
-		} else $offset = '+00:00';
11088
+		} else {
11089
+			$offset = '+00:00';
11090
+		}
10677 11091
 
10678 11092
 		if ($globalDBdriver == 'mysql') {
10679 11093
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -10720,7 +11134,9 @@  discard block
 block discarded – undo
10720 11134
 			date_default_timezone_set($globalTimezone);
10721 11135
 			$datetime = new DateTime();
10722 11136
 			$offset = $datetime->format('P');
10723
-		} else $offset = '+00:00';
11137
+		} else {
11138
+			$offset = '+00:00';
11139
+		}
10724 11140
 
10725 11141
 		if ($globalDBdriver == 'mysql') {
10726 11142
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -10770,7 +11186,9 @@  discard block
 block discarded – undo
10770 11186
 			date_default_timezone_set($globalTimezone);
10771 11187
 			$datetime = new DateTime();
10772 11188
 			$offset = $datetime->format('P');
10773
-		} else $offset = '+00:00';
11189
+		} else {
11190
+			$offset = '+00:00';
11191
+		}
10774 11192
 
10775 11193
 		if ($globalDBdriver == 'mysql') {
10776 11194
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -10817,7 +11235,9 @@  discard block
 block discarded – undo
10817 11235
 			date_default_timezone_set($globalTimezone);
10818 11236
 			$datetime = new DateTime();
10819 11237
 			$offset = $datetime->format('P');
10820
-		} else $offset = '+00:00';
11238
+		} else {
11239
+			$offset = '+00:00';
11240
+		}
10821 11241
 
10822 11242
 		if ($globalDBdriver == 'mysql') {
10823 11243
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -11028,8 +11448,11 @@  discard block
 block discarded – undo
11028 11448
 				$query_values = array_merge($query_values,array(':month' => $month));
11029 11449
 			}
11030 11450
 		}
11031
-		if (empty($query_values)) $queryi .= $this->getFilter($filters);
11032
-		else $queryi .= $this->getFilter($filters,true,true).substr($query,4);
11451
+		if (empty($query_values)) {
11452
+			$queryi .= $this->getFilter($filters);
11453
+		} else {
11454
+			$queryi .= $this->getFilter($filters,true,true).substr($query,4);
11455
+		}
11033 11456
 		
11034 11457
 		$sth = $this->db->prepare($queryi);
11035 11458
 		$sth->execute($query_values);
@@ -11107,8 +11530,11 @@  discard block
 block discarded – undo
11107 11530
 				$query_values = array_merge($query_values,array(':month' => $month));
11108 11531
 			}
11109 11532
 		}
11110
-                if ($query == '') $queryi .= $this->getFilter($filters);
11111
-                else $queryi .= $this->getFilter($filters,true,true).substr($query,4);
11533
+                if ($query == '') {
11534
+                	$queryi .= $this->getFilter($filters);
11535
+                } else {
11536
+                	$queryi .= $this->getFilter($filters,true,true).substr($query,4);
11537
+                }
11112 11538
 
11113 11539
 
11114 11540
 		$sth = $this->db->prepare($queryi);
@@ -11131,7 +11557,9 @@  discard block
 block discarded – undo
11131 11557
 			date_default_timezone_set($globalTimezone);
11132 11558
 			$datetime = new DateTime();
11133 11559
 			$offset = $datetime->format('P');
11134
-		} else $offset = '+00:00';
11560
+		} else {
11561
+			$offset = '+00:00';
11562
+		}
11135 11563
 
11136 11564
 		if ($globalDBdriver == 'mysql') {
11137 11565
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -11317,7 +11745,9 @@  discard block
 block discarded – undo
11317 11745
 	*/
11318 11746
 	public function parseDirection($direction = 0)
11319 11747
 	{
11320
-		if ($direction == '') $direction = 0;
11748
+		if ($direction == '') {
11749
+			$direction = 0;
11750
+		}
11321 11751
 		$direction_array = array();
11322 11752
 		$temp_array = array();
11323 11753
 
@@ -11418,7 +11848,9 @@  discard block
 block discarded – undo
11418 11848
 		if (isset($result->AirlineFlightInfoResult))
11419 11849
 		{
11420 11850
 			$registration = $result->AirlineFlightInfoResult->tailnumber;
11421
-		} else return '';
11851
+		} else {
11852
+			return '';
11853
+		}
11422 11854
 		
11423 11855
 		$registration = $this->convertAircraftRegistration($registration);
11424 11856
 		
@@ -11447,7 +11879,9 @@  discard block
 block discarded – undo
11447 11879
 		if (count($row) > 0) {
11448 11880
 		    //return $row['Registration'];
11449 11881
 		    return $row['registration'];
11450
-		} else return '';
11882
+		} else {
11883
+			return '';
11884
+		}
11451 11885
 	
11452 11886
 	}
11453 11887
 
@@ -11470,9 +11904,14 @@  discard block
 block discarded – undo
11470 11904
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
11471 11905
 		$sth->closeCursor();
11472 11906
 		if (count($row) > 0) {
11473
-		    if ($row['type_flight'] == null) return '';
11474
-		    else return $row['type_flight'];
11475
-		} else return '';
11907
+		    if ($row['type_flight'] == null) {
11908
+		    	return '';
11909
+		    } else {
11910
+		    	return $row['type_flight'];
11911
+		    }
11912
+		} else {
11913
+			return '';
11914
+		}
11476 11915
 	
11477 11916
 	}
11478 11917
 
@@ -11490,7 +11929,9 @@  discard block
 block discarded – undo
11490 11929
 		$longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
11491 11930
 	
11492 11931
 		$Connection = new Connection($this->db);
11493
-		if (!$Connection->tableExists('countries')) return '';
11932
+		if (!$Connection->tableExists('countries')) {
11933
+			return '';
11934
+		}
11494 11935
 	
11495 11936
 		try {
11496 11937
 			/*
@@ -11510,9 +11951,13 @@  discard block
 block discarded – undo
11510 11951
 			$sth->closeCursor();
11511 11952
 			if (count($row) > 0) {
11512 11953
 				return $row;
11513
-			} else return '';
11954
+			} else {
11955
+				return '';
11956
+			}
11514 11957
 		} catch (PDOException $e) {
11515
-			if (isset($globalDebug) && $globalDebug) echo 'Error : '.$e->getMessage()."\n";
11958
+			if (isset($globalDebug) && $globalDebug) {
11959
+				echo 'Error : '.$e->getMessage()."\n";
11960
+			}
11516 11961
 			return '';
11517 11962
 		}
11518 11963
 	
@@ -11530,7 +11975,9 @@  discard block
 block discarded – undo
11530 11975
 		$iso2 = filter_var($iso2,FILTER_SANITIZE_STRING);
11531 11976
 	
11532 11977
 		$Connection = new Connection($this->db);
11533
-		if (!$Connection->tableExists('countries')) return '';
11978
+		if (!$Connection->tableExists('countries')) {
11979
+			return '';
11980
+		}
11534 11981
 	
11535 11982
 		try {
11536 11983
 			$query = "SELECT name,iso2,iso3 FROM countries WHERE iso2 = :iso2 LIMIT 1";
@@ -11542,9 +11989,13 @@  discard block
 block discarded – undo
11542 11989
 			$sth->closeCursor();
11543 11990
 			if (count($row) > 0) {
11544 11991
 				return $row;
11545
-			} else return '';
11992
+			} else {
11993
+				return '';
11994
+			}
11546 11995
 		} catch (PDOException $e) {
11547
-			if (isset($globalDebug) && $globalDebug) echo 'Error : '.$e->getMessage()."\n";
11996
+			if (isset($globalDebug) && $globalDebug) {
11997
+				echo 'Error : '.$e->getMessage()."\n";
11998
+			}
11548 11999
 			return '';
11549 12000
 		}
11550 12001
 	
@@ -11794,7 +12245,9 @@  discard block
 block discarded – undo
11794 12245
 	{
11795 12246
 		global $globalBitlyAccessToken;
11796 12247
 		
11797
-		if ($globalBitlyAccessToken == '') return $url;
12248
+		if ($globalBitlyAccessToken == '') {
12249
+			return $url;
12250
+		}
11798 12251
         
11799 12252
 		$google_url = 'https://api-ssl.bitly.com/v3/shorten?access_token='.$globalBitlyAccessToken.'&longUrl='.$url;
11800 12253
 		
@@ -11943,7 +12396,9 @@  discard block
 block discarded – undo
11943 12396
 		
11944 12397
 
11945 12398
 		// routes
11946
-		if ($globalDebug) print "Routes...\n";
12399
+		if ($globalDebug) {
12400
+			print "Routes...\n";
12401
+		}
11947 12402
 		if ($globalDBdriver == 'mysql') {
11948 12403
 			$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)";
11949 12404
 		} else {
@@ -11962,7 +12417,9 @@  discard block
 block discarded – undo
11962 12417
 			}
11963 12418
 		}
11964 12419
 		
11965
-		if ($globalDebug) print "Airlines...\n";
12420
+		if ($globalDebug) {
12421
+			print "Airlines...\n";
12422
+		}
11966 12423
 		//airlines
11967 12424
 		if ($globalDBdriver == 'mysql') {
11968 12425
 			$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)";
@@ -11976,10 +12433,15 @@  discard block
 block discarded – undo
11976 12433
 			if (is_numeric(substr($row['ident'], -1, 1)))
11977 12434
 			{
11978 12435
 				$fromsource = NULL;
11979
-				if (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') $fromsource = 'vatsim';
11980
-				elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') $fromsource = 'ivao';
11981
-				elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim';
11982
-				elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao';
12436
+				if (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') {
12437
+					$fromsource = 'vatsim';
12438
+				} elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') {
12439
+					$fromsource = 'ivao';
12440
+				} elseif (isset($globalVATSIM) && $globalVATSIM) {
12441
+					$fromsource = 'vatsim';
12442
+				} elseif (isset($globalIVAO) && $globalIVAO) {
12443
+					$fromsource = 'ivao';
12444
+				}
11983 12445
 				$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3),$fromsource);
11984 12446
 				if (isset($airline_array[0]['name'])) {
11985 12447
 					$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";
@@ -11989,13 +12451,17 @@  discard block
 block discarded – undo
11989 12451
 			}
11990 12452
 		}
11991 12453
 
11992
-		if ($globalDebug) print "Remove Duplicate in aircraft_modes...\n";
12454
+		if ($globalDebug) {
12455
+			print "Remove Duplicate in aircraft_modes...\n";
12456
+		}
11993 12457
 		//duplicate modes
11994 12458
 		$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";
11995 12459
 		$sth = $this->db->prepare($query);
11996 12460
 		$sth->execute();
11997 12461
 		
11998
-		if ($globalDebug) print "Aircraft...\n";
12462
+		if ($globalDebug) {
12463
+			print "Aircraft...\n";
12464
+		}
11999 12465
 		//aircraft
12000 12466
 		if ($globalDBdriver == 'mysql') {
12001 12467
 			$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)";
@@ -12038,26 +12504,38 @@  discard block
 block discarded – undo
12038 12504
 				 if (isset($closestAirports[0])) {
12039 12505
 					if ($row['arrival_airport_icao'] == $closestAirports[0]['icao']) {
12040 12506
 						$airport_icao = $closestAirports[0]['icao'];
12041
-						if ($globalDebug) echo "\o/ 1st ---++ Find arrival airport. airport_icao : ".$airport_icao."\n";
12507
+						if ($globalDebug) {
12508
+							echo "\o/ 1st ---++ Find arrival airport. airport_icao : ".$airport_icao."\n";
12509
+						}
12042 12510
 					} elseif (count($closestAirports > 1) && $row['arrival_airport_icao'] != '' && $row['arrival_airport_icao'] != 'NA') {
12043 12511
 						foreach ($closestAirports as $airport) {
12044 12512
 							if ($row['arrival_airport_icao'] == $airport['icao']) {
12045 12513
 								$airport_icao = $airport['icao'];
12046
-								if ($globalDebug) echo "\o/ try --++ Find arrival airport. airport_icao : ".$airport_icao."\n";
12514
+								if ($globalDebug) {
12515
+									echo "\o/ try --++ Find arrival airport. airport_icao : ".$airport_icao."\n";
12516
+								}
12047 12517
 								break;
12048 12518
 							}
12049 12519
 						}
12050 12520
 					} elseif ($row['last_altitude'] == 0 || ($row['last_altitude'] != '' && ($closestAirports[0]['altitude'] <= $row['last_altitude']*100+1000 && $row['last_altitude']*100 < $closestAirports[0]['altitude']+5000))) {
12051 12521
 						$airport_icao = $closestAirports[0]['icao'];
12052
-						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";
12522
+						if ($globalDebug) {
12523
+							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";
12524
+						}
12053 12525
 					} else {
12054
-						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";
12526
+						if ($globalDebug) {
12527
+							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";
12528
+						}
12055 12529
 					}
12056 12530
 				} else {
12057
-					if ($globalDebug) echo "----- No Airport near last coord. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist."\n";
12531
+					if ($globalDebug) {
12532
+						echo "----- No Airport near last coord. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist."\n";
12533
+					}
12058 12534
 				}
12059 12535
 				if ($row['real_arrival_airport_icao'] != $airport_icao) {
12060
-					if ($globalDebug) echo "Updating airport to ".$airport_icao."...\n";
12536
+					if ($globalDebug) {
12537
+						echo "Updating airport to ".$airport_icao."...\n";
12538
+					}
12061 12539
 					$update_query="UPDATE spotter_output SET real_arrival_airport_icao = :airport_icao WHERE spotter_id = :spotter_id";
12062 12540
 					$sthu = $this->db->prepare($update_query);
12063 12541
 					$sthu->execute(array(':airport_icao' => $airport_icao,':spotter_id' => $row['spotter_id']));
Please login to merge, or discard this patch.
Spacing   +1346 added lines, -1346 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,55 +59,55 @@  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['airlines']) && empty($flt['airlines']) && isset($flt['pilots_id']) && empty($flt['pilots_id'])) || (!isset($flt['airlines']) && !isset($flt['pilots_id']))) {
103 103
 				if (isset($flt['source'])) {
104
-					$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";
104
+					$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";
105 105
 				}
106 106
 			}
107 107
 		}
108 108
 		if (isset($filter['airlines']) && !empty($filter['airlines'])) {
109 109
 			if ($filter['airlines'][0] != '') {
110
-					$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";
110
+					$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";
111 111
 			}
112 112
 		}
113 113
 		if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
@@ -117,16 +117,16 @@  discard block
 block discarded – undo
117 117
 			$filter_query_join .= " INNER JOIN (SELECT icao FROM airlines WHERE alliance = '".$filter['alliance']."') sal ON sal.icao = spotter_output.airline_icao ";
118 118
 		}
119 119
 		if (isset($filter['pilots_id']) && !empty($filter['pilots_id'])) {
120
-				$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";
120
+				$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";
121 121
 			}
122 122
 		if (isset($filter['source']) && !empty($filter['source'])) {
123
-			$filter_query_where .= " AND format_source IN ('".implode("','",$filter['source'])."')";
123
+			$filter_query_where .= " AND format_source IN ('".implode("','", $filter['source'])."')";
124 124
 		}
125 125
 		if (isset($filter['ident']) && !empty($filter['ident'])) {
126 126
 			$filter_query_where .= " AND ident = '".$filter['ident']."'";
127 127
 		}
128 128
 		if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
129
-			$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
129
+			$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')";
130 130
 		}
131 131
 		if (isset($filter['year']) && $filter['year'] != '') {
132 132
 			if ($globalDBdriver == 'mysql') {
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
 		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
153 153
 		elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND';
154 154
 		if ($filter_query_where != '') {
155
-			$filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where);
155
+			$filter_query_where = preg_replace('/^ AND/', ' WHERE', $filter_query_where);
156 156
 		}
157 157
 		$filter_query = $filter_query_join.$filter_query_where;
158 158
 		return $filter_query;
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
 	* @return Array the spotter information
168 168
 	*
169 169
 	*/
170
-	public function getDataFromDB($query, $params = array(), $limitQuery = '',$schedules = false)
170
+	public function getDataFromDB($query, $params = array(), $limitQuery = '', $schedules = false)
171 171
 	{
172 172
 		global $globalSquawkCountry, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalAirlinesSource, $globalVAM;
173 173
 		$Image = new Image($this->db);
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
 			$sth = $this->db->prepare($query.$limitQuery);
198 198
 			$sth->execute($params);
199 199
 		} catch (PDOException $e) {
200
-			printf("Invalid query : %s\nWhole query: %s\n",$e->getMessage(), $query.$limitQuery);
200
+			printf("Invalid query : %s\nWhole query: %s\n", $e->getMessage(), $query.$limitQuery);
201 201
 			exit();
202 202
 		}
203 203
 		
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
 		$spotter_array = array();
208 208
 		
209 209
 
210
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
210
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
211 211
 		{
212 212
 			$num_rows++;
213 213
 			$temp_array = array();
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
 			if (isset($row['format_source'])) $temp_array['format_source'] = $row['format_source'];
252 252
 			if (isset($row['route_stop']) && $row['route_stop'] != '') {
253 253
 				$temp_array['route_stop'] = $row['route_stop'];
254
-				$allroute = explode(' ',$row['route_stop']);
254
+				$allroute = explode(' ', $row['route_stop']);
255 255
 				foreach ($allroute as $route) {
256 256
 					$route_airport_array = $this->getAllAirportInfo($route);
257 257
 					if (isset($route_airport_array[0]['name'])) {
@@ -304,17 +304,17 @@  discard block
 block discarded – undo
304 304
 				{
305 305
 					$temp_array['date'] = "about ".$dateArray['hours']." hours ago";
306 306
 				} else {
307
-					$temp_array['date'] = date("M j Y, g:i a",strtotime($row['date']." UTC"));
307
+					$temp_array['date'] = date("M j Y, g:i a", strtotime($row['date']." UTC"));
308 308
 				}
309 309
 				$temp_array['date_minutes_past'] = $dateArray['minutes'];
310
-				$temp_array['date_iso_8601'] = date("c",strtotime($row['date']." UTC"));
311
-				$temp_array['date_rfc_2822'] = date("r",strtotime($row['date']." UTC"));
310
+				$temp_array['date_iso_8601'] = date("c", strtotime($row['date']." UTC"));
311
+				$temp_array['date_rfc_2822'] = date("r", strtotime($row['date']." UTC"));
312 312
 				$temp_array['date_unix'] = strtotime($row['date']." UTC");
313 313
 				if (isset($row['last_seen']) && $row['last_seen'] != '') {
314 314
 					if (strtotime($row['last_seen']) > strtotime($row['date'])) {
315 315
 						$temp_array['duration'] = strtotime($row['last_seen']) - strtotime($row['date']);
316
-						$temp_array['last_seen_date_iso_8601'] = date("c",strtotime($row['last_seen']." UTC"));
317
-						$temp_array['last_seen_date_rfc_2822'] = date("r",strtotime($row['last_seen']." UTC"));
316
+						$temp_array['last_seen_date_iso_8601'] = date("c", strtotime($row['last_seen']." UTC"));
317
+						$temp_array['last_seen_date_rfc_2822'] = date("r", strtotime($row['last_seen']." UTC"));
318 318
 						$temp_array['last_seen_date_unix'] = strtotime($row['last_seen']." UTC");
319 319
 					}
320 320
 				}
@@ -350,9 +350,9 @@  discard block
 block discarded – undo
350 350
 			if (!isset($row['airline_name']) || $row['airline_name'] == '') {
351 351
 				if (!is_numeric(substr($row['ident'], 0, 3))) {
352 352
 					if (is_numeric(substr($row['ident'], 2, 1))) {
353
-						$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 2),$fromsource);
353
+						$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 2), $fromsource);
354 354
 					} elseif (is_numeric(substr($row['ident'], 3, 1))) {
355
-						$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3),$fromsource);
355
+						$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3), $fromsource);
356 356
 					} else {
357 357
 						$airline_array = $this->getAllAirlineInfo('NA');
358 358
 					}
@@ -389,7 +389,7 @@  discard block
 block discarded – undo
389 389
 				}
390 390
 			}
391 391
 			if (isset($temp_array['airline_iata']) && $temp_array['airline_iata'] != '') {
392
-				$acars_array = $ACARS->getLiveAcarsData($temp_array['airline_iata'].substr($temp_array['ident'],3));
392
+				$acars_array = $ACARS->getLiveAcarsData($temp_array['airline_iata'].substr($temp_array['ident'], 3));
393 393
 				//$acars_array = ACARS->getLiveAcarsData('BA40YL');
394 394
 				if (count($acars_array) > 0) {
395 395
 					$temp_array['acars'] = $acars_array;
@@ -406,11 +406,11 @@  discard block
 block discarded – undo
406 406
 				$temp_array['aircraft_date_first_reg'] = $owner_info['date_first_reg'];
407 407
 			}
408 408
 
409
-			if($temp_array['registration'] != "" || ($globalIVAO && isset($temp_array['aircraft_type']) && $temp_array['aircraft_type'] != ''))
409
+			if ($temp_array['registration'] != "" || ($globalIVAO && isset($temp_array['aircraft_type']) && $temp_array['aircraft_type'] != ''))
410 410
 			{
411 411
 				if ($globalIVAO) {
412
-					if (isset($temp_array['airline_icao']))	$image_array = $Image->getSpotterImage('',$temp_array['aircraft_type'],$temp_array['airline_icao']);
413
-					else $image_array = $Image->getSpotterImage('',$temp_array['aircraft_type']);
412
+					if (isset($temp_array['airline_icao']))	$image_array = $Image->getSpotterImage('', $temp_array['aircraft_type'], $temp_array['airline_icao']);
413
+					else $image_array = $Image->getSpotterImage('', $temp_array['aircraft_type']);
414 414
 				} else $image_array = $Image->getSpotterImage($temp_array['registration']);
415 415
 				if (count($image_array) > 0) {
416 416
 					$temp_array['image'] = $image_array[0]['image'];
@@ -434,7 +434,7 @@  discard block
 block discarded – undo
434 434
 				$temp_array['arrival_airport_time'] = $row['arrival_airport_time'];
435 435
 			}
436 436
 			
437
-			if ((!isset($globalIVAO) || ! $globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalVAM) || !$globalVAM)) {
437
+			if ((!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalVAM) || !$globalVAM)) {
438 438
 				if ($schedules === true) {
439 439
 					$schedule_array = $Schedule->getSchedule($temp_array['ident']);
440 440
 					//print_r($schedule_array);
@@ -516,12 +516,12 @@  discard block
 block discarded – undo
516 516
 			if (isset($row['squawk'])) {
517 517
 				$temp_array['squawk'] = $row['squawk'];
518 518
 				if ($row['squawk'] != '' && isset($temp_array['country_iso2'])) {
519
-					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$temp_array['country_iso2']);
520
-					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
519
+					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $temp_array['country_iso2']);
520
+					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $globalSquawkCountry);
521 521
 				} elseif ($row['squawk'] != '' && isset($temp_array['over_country'])) {
522
-					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$temp_array['over_country']);
523
-					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
524
-				} elseif ($row['squawk'] != '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
522
+					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $temp_array['over_country']);
523
+					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $globalSquawkCountry);
524
+				} elseif ($row['squawk'] != '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $globalSquawkCountry);
525 525
 			}
526 526
     			
527 527
 			$temp_array['query_number_rows'] = $num_rows;
@@ -540,7 +540,7 @@  discard block
 block discarded – undo
540 540
 	* @return Array the spotter information
541 541
 	*
542 542
 	*/
543
-	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())
543
+	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())
544 544
 	{
545 545
 		global $globalTimezone, $globalDBdriver;
546 546
 		require_once(dirname(__FILE__).'/class.Translation.php');
@@ -550,7 +550,7 @@  discard block
 block discarded – undo
550 550
 
551 551
 		$query_values = array();
552 552
 		$additional_query = '';
553
-		$filter_query = $this->getFilter($filters,true,true);
553
+		$filter_query = $this->getFilter($filters, true, true);
554 554
 		if ($q != "")
555 555
 		{
556 556
 			if (!is_string($q))
@@ -558,8 +558,8 @@  discard block
 block discarded – undo
558 558
 				return false;
559 559
 			} else {
560 560
 				$q_array = explode(" ", $q);
561
-				foreach ($q_array as $q_item){
562
-					$q_item = filter_var($q_item,FILTER_SANITIZE_STRING);
561
+				foreach ($q_array as $q_item) {
562
+					$q_item = filter_var($q_item, FILTER_SANITIZE_STRING);
563 563
 					$additional_query .= " AND (";
564 564
 					if (is_int($q_item)) $additional_query .= "(spotter_output.spotter_id like '%".$q_item."%') OR ";
565 565
 					$additional_query .= "(spotter_output.aircraft_icao like '%".$q_item."%') OR ";
@@ -591,37 +591,37 @@  discard block
 block discarded – undo
591 591
 
592 592
 		if ($registration != "")
593 593
 		{
594
-			$registration = filter_var($registration,FILTER_SANITIZE_STRING);
594
+			$registration = filter_var($registration, FILTER_SANITIZE_STRING);
595 595
 			if (!is_string($registration))
596 596
 			{
597 597
 				return false;
598 598
 			} else {
599 599
 				$additional_query .= " AND spotter_output.registration = :registration";
600
-				$query_values = array_merge($query_values,array(':registration' => $registration));
600
+				$query_values = array_merge($query_values, array(':registration' => $registration));
601 601
 			}
602 602
 		}
603 603
 
604 604
 		if ($aircraft_icao != "")
605 605
 		{
606
-			$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
606
+			$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
607 607
 			if (!is_string($aircraft_icao))
608 608
 			{
609 609
 				return false;
610 610
 			} else {
611 611
 				$additional_query .= " AND spotter_output.aircraft_icao = :aircraft_icao";
612
-				$query_values = array_merge($query_values,array(':aircraft_icao' => $aircraft_icao));
612
+				$query_values = array_merge($query_values, array(':aircraft_icao' => $aircraft_icao));
613 613
 			}
614 614
 		}
615 615
 
616 616
 		if ($aircraft_manufacturer != "")
617 617
 		{
618
-			$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
618
+			$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
619 619
 			if (!is_string($aircraft_manufacturer))
620 620
 			{
621 621
 				return false;
622 622
 			} else {
623 623
 				$additional_query .= " AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer";
624
-				$query_values = array_merge($query_values,array(':aircraft_manufacturer' => $aircraft_manufacturer));
624
+				$query_values = array_merge($query_values, array(':aircraft_manufacturer' => $aircraft_manufacturer));
625 625
 			}
626 626
 		}
627 627
 
@@ -637,25 +637,25 @@  discard block
 block discarded – undo
637 637
 
638 638
 		if ($airline_icao != "")
639 639
 		{
640
-			$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
640
+			$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
641 641
 			if (!is_string($airline_icao))
642 642
 			{
643 643
 				return false;
644 644
 			} else {
645 645
 				$additional_query .= " AND spotter_output.airline_icao = :airline_icao";
646
-				$query_values = array_merge($query_values,array(':airline_icao' => $airline_icao));
646
+				$query_values = array_merge($query_values, array(':airline_icao' => $airline_icao));
647 647
 			}
648 648
 		}
649 649
 
650 650
 		if ($airline_country != "")
651 651
 		{
652
-			$airline_country = filter_var($airline_country,FILTER_SANITIZE_STRING);
652
+			$airline_country = filter_var($airline_country, FILTER_SANITIZE_STRING);
653 653
 			if (!is_string($airline_country))
654 654
 			{
655 655
 				return false;
656 656
 			} else {
657 657
 				$additional_query .= " AND spotter_output.airline_country = :airline_country";
658
-				$query_values = array_merge($query_values,array(':airline_country' => $airline_country));
658
+				$query_values = array_merge($query_values, array(':airline_country' => $airline_country));
659 659
 			}
660 660
 		}
661 661
 
@@ -682,31 +682,31 @@  discard block
 block discarded – undo
682 682
 
683 683
 		if ($airport != "")
684 684
 		{
685
-			$airport = filter_var($airport,FILTER_SANITIZE_STRING);
685
+			$airport = filter_var($airport, FILTER_SANITIZE_STRING);
686 686
 			if (!is_string($airport))
687 687
 			{
688 688
 				return false;
689 689
 			} else {
690 690
 				$additional_query .= " AND (spotter_output.departure_airport_icao = :airport OR spotter_output.arrival_airport_icao = :airport)";
691
-				$query_values = array_merge($query_values,array(':airport' => $airport));
691
+				$query_values = array_merge($query_values, array(':airport' => $airport));
692 692
 			}
693 693
 		}
694 694
 
695 695
 		if ($airport_country != "")
696 696
 		{
697
-			$airport_country = filter_var($airport_country,FILTER_SANITIZE_STRING);
697
+			$airport_country = filter_var($airport_country, FILTER_SANITIZE_STRING);
698 698
 			if (!is_string($airport_country))
699 699
 			{
700 700
 				return false;
701 701
 			} else {
702 702
 				$additional_query .= " AND (spotter_output.departure_airport_country = :airport_country OR spotter_output.arrival_airport_country = :airport_country)";
703
-				$query_values = array_merge($query_values,array(':airport_country' => $airport_country));
703
+				$query_values = array_merge($query_values, array(':airport_country' => $airport_country));
704 704
 			}
705 705
 		}
706 706
     
707 707
 		if ($callsign != "")
708 708
 		{
709
-			$callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
709
+			$callsign = filter_var($callsign, FILTER_SANITIZE_STRING);
710 710
 			if (!is_string($callsign))
711 711
 			{
712 712
 				return false;
@@ -714,79 +714,79 @@  discard block
 block discarded – undo
714 714
 				$translate = $Translation->ident2icao($callsign);
715 715
 				if ($translate != $callsign) {
716 716
 					$additional_query .= " AND (spotter_output.ident = :callsign OR spotter_output.ident = :translate)";
717
-					$query_values = array_merge($query_values,array(':callsign' => $callsign,':translate' => $translate));
717
+					$query_values = array_merge($query_values, array(':callsign' => $callsign, ':translate' => $translate));
718 718
 				} else {
719 719
 					$additional_query .= " AND spotter_output.ident = :callsign";
720
-					$query_values = array_merge($query_values,array(':callsign' => $callsign));
720
+					$query_values = array_merge($query_values, array(':callsign' => $callsign));
721 721
 				}
722 722
 			}
723 723
 		}
724 724
 
725 725
 		if ($owner != "")
726 726
 		{
727
-			$owner = filter_var($owner,FILTER_SANITIZE_STRING);
727
+			$owner = filter_var($owner, FILTER_SANITIZE_STRING);
728 728
 			if (!is_string($owner))
729 729
 			{
730 730
 				return false;
731 731
 			} else {
732 732
 				$additional_query .= " AND spotter_output.owner_name = :owner";
733
-				$query_values = array_merge($query_values,array(':owner' => $owner));
733
+				$query_values = array_merge($query_values, array(':owner' => $owner));
734 734
 			}
735 735
 		}
736 736
 
737 737
 		if ($pilot_name != "")
738 738
 		{
739
-			$pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING);
739
+			$pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING);
740 740
 			if (!is_string($pilot_name))
741 741
 			{
742 742
 				return false;
743 743
 			} else {
744 744
 				$additional_query .= " AND spotter_output.pilot_name = :pilot_name";
745
-				$query_values = array_merge($query_values,array(':pilot_name' => $pilot_name));
745
+				$query_values = array_merge($query_values, array(':pilot_name' => $pilot_name));
746 746
 			}
747 747
 		}
748 748
 
749 749
 		if ($pilot_id != "")
750 750
 		{
751
-			$pilot_id = filter_var($pilot_id,FILTER_SANITIZE_STRING);
751
+			$pilot_id = filter_var($pilot_id, FILTER_SANITIZE_STRING);
752 752
 			if (!is_string($pilot_id))
753 753
 			{
754 754
 				return false;
755 755
 			} else {
756 756
 				$additional_query .= " AND spotter_output.pilot_id = :pilot_id";
757
-				$query_values = array_merge($query_values,array(':pilot_id' => $pilot_id));
757
+				$query_values = array_merge($query_values, array(':pilot_id' => $pilot_id));
758 758
 			}
759 759
 		}
760 760
 
761 761
 		if ($departure_airport_route != "")
762 762
 		{
763
-			$departure_airport_route = filter_var($departure_airport_route,FILTER_SANITIZE_STRING);
763
+			$departure_airport_route = filter_var($departure_airport_route, FILTER_SANITIZE_STRING);
764 764
 			if (!is_string($departure_airport_route))
765 765
 			{
766 766
 				return false;
767 767
 			} else {
768 768
 				$additional_query .= " AND spotter_output.departure_airport_icao = :departure_airport_route";
769
-				$query_values = array_merge($query_values,array(':departure_airport_route' => $departure_airport_route));
769
+				$query_values = array_merge($query_values, array(':departure_airport_route' => $departure_airport_route));
770 770
 			}
771 771
 		}
772 772
 
773 773
 		if ($arrival_airport_route != "")
774 774
 		{
775
-			$arrival_airport_route = filter_var($arrival_airport_route,FILTER_SANITIZE_STRING);
775
+			$arrival_airport_route = filter_var($arrival_airport_route, FILTER_SANITIZE_STRING);
776 776
 			if (!is_string($arrival_airport_route))
777 777
 			{
778 778
 				return false;
779 779
 			} else {
780 780
 				$additional_query .= " AND spotter_output.arrival_airport_icao = :arrival_airport_route";
781
-				$query_values = array_merge($query_values,array(':arrival_airport_route' => $arrival_airport_route));
781
+				$query_values = array_merge($query_values, array(':arrival_airport_route' => $arrival_airport_route));
782 782
 			}
783 783
 		}
784 784
 
785 785
 		if ($altitude != "")
786 786
 		{
787 787
 			$altitude_array = explode(",", $altitude);
788
-			$altitude_array[0] = filter_var($altitude_array[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
789
-			$altitude_array[1] = filter_var($altitude_array[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
788
+			$altitude_array[0] = filter_var($altitude_array[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
789
+			$altitude_array[1] = filter_var($altitude_array[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
790 790
 
791 791
 			if ($altitude_array[1] != "")
792 792
 			{                
@@ -802,8 +802,8 @@  discard block
 block discarded – undo
802 802
 		if ($date_posted != "")
803 803
 		{
804 804
 			$date_array = explode(",", $date_posted);
805
-			$date_array[0] = filter_var($date_array[0],FILTER_SANITIZE_STRING);
806
-			$date_array[1] = filter_var($date_array[1],FILTER_SANITIZE_STRING);
805
+			$date_array[0] = filter_var($date_array[0], FILTER_SANITIZE_STRING);
806
+			$date_array[1] = filter_var($date_array[1], FILTER_SANITIZE_STRING);
807 807
 
808 808
 			if ($globalTimezone != '') {
809 809
 				date_default_timezone_set($globalTimezone);
@@ -834,8 +834,8 @@  discard block
 block discarded – undo
834 834
 		{
835 835
 			$limit_array = explode(",", $limit);
836 836
 			
837
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
838
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
837
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
838
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
839 839
 			
840 840
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
841 841
 			{
@@ -864,23 +864,23 @@  discard block
 block discarded – undo
864 864
 
865 865
 
866 866
 		if ($origLat != "" && $origLon != "" && $dist != "") {
867
-			$dist = number_format($dist*0.621371,2,'.',''); // convert km to mile
867
+			$dist = number_format($dist*0.621371, 2, '.', ''); // convert km to mile
868 868
 
869 869
 			if ($globalDBdriver == 'mysql') {
870
-				$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 
870
+				$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 
871 871
 						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)) 
872 872
 						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;
873 873
 			} else {
874
-				$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 
874
+				$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 
875 875
 						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)) 
876 876
 						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;
877 877
 			}
878 878
 		} else {		
879
-			$query  = "SELECT spotter_output.* FROM spotter_output".$filter_query." spotter_output.ident <> '' 
879
+			$query = "SELECT spotter_output.* FROM spotter_output".$filter_query." spotter_output.ident <> '' 
880 880
 					".$additional_query."
881 881
 					".$orderby_query;
882 882
 		}
883
-		$spotter_array = $this->getDataFromDB($query, $query_values,$limit_query);
883
+		$spotter_array = $this->getDataFromDB($query, $query_values, $limit_query);
884 884
 		return $spotter_array;
885 885
 	}
886 886
 	
@@ -903,8 +903,8 @@  discard block
 block discarded – undo
903 903
 		{
904 904
 			$limit_array = explode(",", $limit);
905 905
 			
906
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
907
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
906
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
907
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
908 908
 			
909 909
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
910 910
 			{
@@ -921,9 +921,9 @@  discard block
 block discarded – undo
921 921
 			$orderby_query = " ORDER BY spotter_output.date DESC";
922 922
 		}
923 923
 
924
-		$query  = $global_query.$filter_query." ".$orderby_query;
924
+		$query = $global_query.$filter_query." ".$orderby_query;
925 925
 
926
-		$spotter_array = $this->getDataFromDB($query, array(),$limit_query,true);
926
+		$spotter_array = $this->getDataFromDB($query, array(), $limit_query, true);
927 927
 
928 928
 		return $spotter_array;
929 929
 	}
@@ -969,34 +969,34 @@  discard block
 block discarded – undo
969 969
 			{
970 970
 				return false;
971 971
 			} else {
972
-				if ($interval == "30m"){
972
+				if ($interval == "30m") {
973 973
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE) <= $this_output.date ';
974
-				} else if ($interval == "1h"){
974
+				} else if ($interval == "1h") {
975 975
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) <= $this_output.date ';
976
-				} else if ($interval == "3h"){
976
+				} else if ($interval == "3h") {
977 977
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 3 HOUR) <= $this_output.date ';
978
-				} else if ($interval == "6h"){
978
+				} else if ($interval == "6h") {
979 979
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 6 HOUR) <= $this_output.date ';
980
-				} else if ($interval == "12h"){
980
+				} else if ($interval == "12h") {
981 981
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 12 HOUR) <= $this_output.date ';
982
-				} else if ($interval == "24h"){
982
+				} else if ($interval == "24h") {
983 983
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 24 HOUR) <= $this_output.date ';
984
-				} else if ($interval == "7d"){
984
+				} else if ($interval == "7d") {
985 985
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY) <= $this_output.date ';
986
-				} else if ($interval == "30d"){
986
+				} else if ($interval == "30d") {
987 987
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 DAY) <= $this_output.date ';
988 988
 				} 
989 989
 			}
990 990
 		}
991 991
 
992
-		$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 
992
+		$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 
993 993
                    WHERE spotter_output.latitude <> '' 
994 994
 				   AND spotter_output.longitude <> '' 
995 995
                    ".$additional_query."
996 996
                    HAVING distance < :radius  
997 997
 				   ORDER BY distance";
998 998
 
999
-		$spotter_array = $this->getDataFromDB($query, array(':radius' => $radius),$limit_query);
999
+		$spotter_array = $this->getDataFromDB($query, array(':radius' => $radius), $limit_query);
1000 1000
 
1001 1001
 		return $spotter_array;
1002 1002
 	}
@@ -1008,21 +1008,21 @@  discard block
 block discarded – undo
1008 1008
 	* @return Array the spotter information
1009 1009
 	*
1010 1010
 	*/
1011
-	public function getNewestSpotterDataSortedByAircraftType($limit = '', $sort = '',$filter = array())
1011
+	public function getNewestSpotterDataSortedByAircraftType($limit = '', $sort = '', $filter = array())
1012 1012
 	{
1013 1013
 		global $global_query;
1014 1014
 		
1015 1015
 		date_default_timezone_set('UTC');
1016 1016
 
1017
-		$filter_query = $this->getFilter($filter,true,true);
1017
+		$filter_query = $this->getFilter($filter, true, true);
1018 1018
 
1019 1019
 		$limit_query = '';
1020 1020
 		if ($limit != "")
1021 1021
 		{
1022 1022
 			$limit_array = explode(",", $limit);
1023 1023
 			
1024
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1025
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1024
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1025
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1026 1026
 			
1027 1027
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1028 1028
 			{
@@ -1039,7 +1039,7 @@  discard block
 block discarded – undo
1039 1039
 			$orderby_query = " ORDER BY spotter_output.date DESC ";
1040 1040
 		}
1041 1041
 
1042
-		$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;
1042
+		$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;
1043 1043
 
1044 1044
 		$spotter_array = $this->getDataFromDB($query, array(), $limit_query);
1045 1045
 
@@ -1058,15 +1058,15 @@  discard block
 block discarded – undo
1058 1058
 		global $global_query;
1059 1059
 		
1060 1060
 		date_default_timezone_set('UTC');
1061
-		$filter_query = $this->getFilter($filter,true,true);
1061
+		$filter_query = $this->getFilter($filter, true, true);
1062 1062
 
1063 1063
 		$limit_query = '';
1064 1064
 		if ($limit != "")
1065 1065
 		{
1066 1066
 			$limit_array = explode(",", $limit);
1067 1067
 			
1068
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1069
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1068
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1069
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1070 1070
 			
1071 1071
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1072 1072
 			{
@@ -1083,7 +1083,7 @@  discard block
 block discarded – undo
1083 1083
 			$orderby_query = " ORDER BY spotter_output.date DESC ";
1084 1084
 		}
1085 1085
 
1086
-		$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;
1086
+		$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;
1087 1087
 
1088 1088
 		$spotter_array = $this->getDataFromDB($query, array(), $limit_query);
1089 1089
 
@@ -1097,20 +1097,20 @@  discard block
 block discarded – undo
1097 1097
 	* @return Array the spotter information
1098 1098
 	*
1099 1099
 	*/
1100
-	public function getNewestSpotterDataSortedByAirline($limit = '', $sort = '',$filter = array())
1100
+	public function getNewestSpotterDataSortedByAirline($limit = '', $sort = '', $filter = array())
1101 1101
 	{
1102 1102
 		global $global_query;
1103 1103
 		
1104 1104
 		date_default_timezone_set('UTC');
1105
-		$filter_query = $this->getFilter($filter,true,true);
1105
+		$filter_query = $this->getFilter($filter, true, true);
1106 1106
 		
1107 1107
 		$limit_query = '';
1108 1108
 		if ($limit != "")
1109 1109
 		{
1110 1110
 			$limit_array = explode(",", $limit);
1111 1111
 			
1112
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1113
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1112
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1113
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1114 1114
 			
1115 1115
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1116 1116
 			{
@@ -1127,7 +1127,7 @@  discard block
 block discarded – undo
1127 1127
 			$orderby_query = " ORDER BY spotter_output.date DESC ";
1128 1128
 		}
1129 1129
 
1130
-		$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;
1130
+		$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;
1131 1131
 
1132 1132
 		$spotter_array = $this->getDataFromDB($query, array(), $limit_query);
1133 1133
 
@@ -1147,7 +1147,7 @@  discard block
 block discarded – undo
1147 1147
 		
1148 1148
 		date_default_timezone_set('UTC');
1149 1149
 		
1150
-		$filter_query = $this->getFilter($filter,true,true);
1150
+		$filter_query = $this->getFilter($filter, true, true);
1151 1151
 		
1152 1152
 		$limit_query = '';
1153 1153
 		
@@ -1155,8 +1155,8 @@  discard block
 block discarded – undo
1155 1155
 		{
1156 1156
 			$limit_array = explode(",", $limit);
1157 1157
 			
1158
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1159
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1158
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1159
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1160 1160
 			
1161 1161
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1162 1162
 			{
@@ -1173,7 +1173,7 @@  discard block
 block discarded – undo
1173 1173
 			$orderby_query = " ORDER BY spotter_output.date DESC ";
1174 1174
 		}
1175 1175
 
1176
-		$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;
1176
+		$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;
1177 1177
 
1178 1178
 		$spotter_array = $this->getDataFromDB($query, array(), $limit_query);
1179 1179
 
@@ -1192,14 +1192,14 @@  discard block
 block discarded – undo
1192 1192
 		global $global_query;
1193 1193
 		
1194 1194
 		date_default_timezone_set('UTC');
1195
-		$filter_query = $this->getFilter($filter,true,true);
1195
+		$filter_query = $this->getFilter($filter, true, true);
1196 1196
 		$limit_query = '';
1197 1197
 		if ($limit != "")
1198 1198
 		{
1199 1199
 			$limit_array = explode(",", $limit);
1200 1200
 			
1201
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1202
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1201
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1202
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1203 1203
 			
1204 1204
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1205 1205
 			{
@@ -1216,7 +1216,7 @@  discard block
 block discarded – undo
1216 1216
 			$orderby_query = " ORDER BY spotter_output.date DESC ";
1217 1217
 		}
1218 1218
 
1219
-		$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;
1219
+		$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;
1220 1220
 
1221 1221
 		$spotter_array = $this->getDataFromDB($query, array(), $limit_query);
1222 1222
 
@@ -1240,9 +1240,9 @@  discard block
 block discarded – undo
1240 1240
 		$query_values = array(':id' => $id);
1241 1241
 
1242 1242
 		//$query  = $global_query." WHERE spotter_output.ident <> '' ".$additional_query." ";
1243
-		$query  = $global_query." WHERE ".$additional_query." ";
1243
+		$query = $global_query." WHERE ".$additional_query." ";
1244 1244
 
1245
-		$spotter_array = $this->getDataFromDB($query,$query_values);
1245
+		$spotter_array = $this->getDataFromDB($query, $query_values);
1246 1246
 
1247 1247
 		return $spotter_array;
1248 1248
 	}
@@ -1265,7 +1265,7 @@  discard block
 block discarded – undo
1265 1265
 		$query_values = array();
1266 1266
 		$limit_query = '';
1267 1267
 		$additional_query = '';
1268
-		$filter_query = $this->getFilter($filter,true,true);
1268
+		$filter_query = $this->getFilter($filter, true, true);
1269 1269
 		if ($ident != "")
1270 1270
 		{
1271 1271
 			if (!is_string($ident))
@@ -1281,8 +1281,8 @@  discard block
 block discarded – undo
1281 1281
 		{
1282 1282
 			$limit_array = explode(",", $limit);
1283 1283
 			
1284
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1285
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1284
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1285
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1286 1286
 			
1287 1287
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1288 1288
 			{
@@ -1321,7 +1321,7 @@  discard block
 block discarded – undo
1321 1321
 		$query_values = array();
1322 1322
 		$limit_query = '';
1323 1323
 		$additional_query = '';
1324
-		$filter_query = $this->getFilter($filter,true,true);
1324
+		$filter_query = $this->getFilter($filter, true, true);
1325 1325
 		if ($owner != "")
1326 1326
 		{
1327 1327
 			if (!is_string($owner))
@@ -1337,8 +1337,8 @@  discard block
 block discarded – undo
1337 1337
 		{
1338 1338
 			$limit_array = explode(",", $limit);
1339 1339
 			
1340
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1341
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1340
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1341
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1342 1342
 			
1343 1343
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1344 1344
 			{
@@ -1378,7 +1378,7 @@  discard block
 block discarded – undo
1378 1378
 		$query_values = array();
1379 1379
 		$limit_query = '';
1380 1380
 		$additional_query = '';
1381
-		$filter_query = $this->getFilter($filter,true,true);
1381
+		$filter_query = $this->getFilter($filter, true, true);
1382 1382
 		if ($pilot != "")
1383 1383
 		{
1384 1384
 			$additional_query = " AND (spotter_output.pilot_name = :pilot OR spotter_output.pilot_id = :pilot)";
@@ -1389,8 +1389,8 @@  discard block
 block discarded – undo
1389 1389
 		{
1390 1390
 			$limit_array = explode(",", $limit);
1391 1391
 			
1392
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1393
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1392
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1393
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1394 1394
 			
1395 1395
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1396 1396
 			{
@@ -1431,7 +1431,7 @@  discard block
 block discarded – undo
1431 1431
 		$query_values = array();
1432 1432
 		$limit_query = '';
1433 1433
 		$additional_query = '';
1434
-		$filter_query = $this->getFilter($filter,true,true);
1434
+		$filter_query = $this->getFilter($filter, true, true);
1435 1435
 		
1436 1436
 		if ($aircraft_type != "")
1437 1437
 		{
@@ -1448,8 +1448,8 @@  discard block
 block discarded – undo
1448 1448
 		{
1449 1449
 			$limit_array = explode(",", $limit);
1450 1450
 			
1451
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1452
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1451
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1452
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1453 1453
 			
1454 1454
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1455 1455
 			{
@@ -1505,8 +1505,8 @@  discard block
 block discarded – undo
1505 1505
 		{
1506 1506
 			$limit_array = explode(",", $limit);
1507 1507
 			
1508
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1509
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1508
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1509
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1510 1510
 			
1511 1511
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1512 1512
 			{
@@ -1522,7 +1522,7 @@  discard block
 block discarded – undo
1522 1522
 		} else {
1523 1523
 			$orderby_query = " ORDER BY spotter_output.date DESC";
1524 1524
 		}
1525
-		$filter_query = $this->getFilter($filter,true,true);
1525
+		$filter_query = $this->getFilter($filter, true, true);
1526 1526
 
1527 1527
 		//$query = $global_query.$filter_query." spotter_output.ident <> '' ".$additional_query." ".$orderby_query;
1528 1528
 		$query = $global_query.$filter_query." ".$additional_query." ".$orderby_query;
@@ -1541,7 +1541,7 @@  discard block
 block discarded – undo
1541 1541
 	* @return Array the spotter information
1542 1542
 	*
1543 1543
 	*/
1544
-	public function getSpotterDataByAirline($airline = '', $limit = '', $sort = '',$filters = array())
1544
+	public function getSpotterDataByAirline($airline = '', $limit = '', $sort = '', $filters = array())
1545 1545
 	{
1546 1546
 		global $global_query;
1547 1547
 		
@@ -1550,7 +1550,7 @@  discard block
 block discarded – undo
1550 1550
 		$query_values = array();
1551 1551
 		$limit_query = '';
1552 1552
 		$additional_query = '';
1553
-		$filter_query = $this->getFilter($filters,true,true);
1553
+		$filter_query = $this->getFilter($filters, true, true);
1554 1554
 		
1555 1555
 		if ($airline != "")
1556 1556
 		{
@@ -1567,8 +1567,8 @@  discard block
 block discarded – undo
1567 1567
 		{
1568 1568
 			$limit_array = explode(",", $limit);
1569 1569
 			
1570
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1571
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1570
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1571
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1572 1572
 			
1573 1573
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1574 1574
 			{
@@ -1598,7 +1598,7 @@  discard block
 block discarded – undo
1598 1598
 	* @return Array the spotter information
1599 1599
 	*
1600 1600
 	*/
1601
-	public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '',$filters = array())
1601
+	public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '', $filters = array())
1602 1602
 	{
1603 1603
 		global $global_query;
1604 1604
 		
@@ -1606,7 +1606,7 @@  discard block
 block discarded – undo
1606 1606
 		$query_values = array();
1607 1607
 		$limit_query = '';
1608 1608
 		$additional_query = '';
1609
-		$filter_query = $this->getFilter($filters,true,true);
1609
+		$filter_query = $this->getFilter($filters, true, true);
1610 1610
 		
1611 1611
 		if ($airport != "")
1612 1612
 		{
@@ -1623,8 +1623,8 @@  discard block
 block discarded – undo
1623 1623
 		{
1624 1624
 			$limit_array = explode(",", $limit);
1625 1625
 			
1626
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1627
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1626
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1627
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1628 1628
 			
1629 1629
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1630 1630
 			{
@@ -1656,7 +1656,7 @@  discard block
 block discarded – undo
1656 1656
 	* @return Array the spotter information
1657 1657
 	*
1658 1658
 	*/
1659
-	public function getSpotterDataByDate($date = '', $limit = '', $sort = '',$filter = array())
1659
+	public function getSpotterDataByDate($date = '', $limit = '', $sort = '', $filter = array())
1660 1660
 	{
1661 1661
 		global $global_query, $globalTimezone, $globalDBdriver;
1662 1662
 		
@@ -1664,7 +1664,7 @@  discard block
 block discarded – undo
1664 1664
 		$limit_query = '';
1665 1665
 		$additional_query = '';
1666 1666
 
1667
-		$filter_query = $this->getFilter($filter,true,true);
1667
+		$filter_query = $this->getFilter($filter, true, true);
1668 1668
 		
1669 1669
 		if ($date != "")
1670 1670
 		{
@@ -1693,8 +1693,8 @@  discard block
 block discarded – undo
1693 1693
 		{
1694 1694
 			$limit_array = explode(",", $limit);
1695 1695
 			
1696
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1697
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1696
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1697
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1698 1698
 			
1699 1699
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1700 1700
 			{
@@ -1724,7 +1724,7 @@  discard block
 block discarded – undo
1724 1724
 	* @return Array the spotter information
1725 1725
 	*
1726 1726
 	*/
1727
-	public function getSpotterDataByCountry($country = '', $limit = '', $sort = '',$filters = array())
1727
+	public function getSpotterDataByCountry($country = '', $limit = '', $sort = '', $filters = array())
1728 1728
 	{
1729 1729
 		global $global_query;
1730 1730
 		
@@ -1733,7 +1733,7 @@  discard block
 block discarded – undo
1733 1733
 		$query_values = array();
1734 1734
 		$limit_query = '';
1735 1735
 		$additional_query = '';
1736
-		$filter_query = $this->getFilter($filters,true,true);
1736
+		$filter_query = $this->getFilter($filters, true, true);
1737 1737
 		if ($country != "")
1738 1738
 		{
1739 1739
 			if (!is_string($country))
@@ -1750,8 +1750,8 @@  discard block
 block discarded – undo
1750 1750
 		{
1751 1751
 			$limit_array = explode(",", $limit);
1752 1752
 			
1753
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1754
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1753
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1754
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1755 1755
 			
1756 1756
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1757 1757
 			{
@@ -1791,7 +1791,7 @@  discard block
 block discarded – undo
1791 1791
 		$query_values = array();
1792 1792
 		$additional_query = '';
1793 1793
 		$limit_query = '';
1794
-		$filter_query = $this->getFilter($filters,true,true);
1794
+		$filter_query = $this->getFilter($filters, true, true);
1795 1795
 		
1796 1796
 		if ($aircraft_manufacturer != "")
1797 1797
 		{
@@ -1808,8 +1808,8 @@  discard block
 block discarded – undo
1808 1808
 		{
1809 1809
 			$limit_array = explode(",", $limit);
1810 1810
 			
1811
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1812
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1811
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1812
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1813 1813
 			
1814 1814
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1815 1815
 			{
@@ -1851,14 +1851,14 @@  discard block
 block discarded – undo
1851 1851
 		$query_values = array();
1852 1852
 		$additional_query = '';
1853 1853
 		$limit_query = '';
1854
-		$filter_query = $this->getFilter($filters,true,true);
1854
+		$filter_query = $this->getFilter($filters, true, true);
1855 1855
 		if ($departure_airport_icao != "")
1856 1856
 		{
1857 1857
 			if (!is_string($departure_airport_icao))
1858 1858
 			{
1859 1859
 				return false;
1860 1860
 			} else {
1861
-				$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
1861
+				$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
1862 1862
 				$additional_query .= " AND (spotter_output.departure_airport_icao = :departure_airport_icao)";
1863 1863
 				//$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";
1864 1864
 				$query_values = array(':departure_airport_icao' => $departure_airport_icao);
@@ -1871,10 +1871,10 @@  discard block
 block discarded – undo
1871 1871
 			{
1872 1872
 				return false;
1873 1873
 			} else {
1874
-				$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
1874
+				$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
1875 1875
 				$additional_query .= " AND (spotter_output.arrival_airport_icao = :arrival_airport_icao)";
1876 1876
 				//$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)";
1877
-				$query_values = array_merge($query_values,array(':arrival_airport_icao' => $arrival_airport_icao));
1877
+				$query_values = array_merge($query_values, array(':arrival_airport_icao' => $arrival_airport_icao));
1878 1878
 			}
1879 1879
 		}
1880 1880
 		
@@ -1882,8 +1882,8 @@  discard block
 block discarded – undo
1882 1882
 		{
1883 1883
 			$limit_array = explode(",", $limit);
1884 1884
 			
1885
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1886
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1885
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1886
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1887 1887
 			
1888 1888
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1889 1889
 			{
@@ -1922,15 +1922,15 @@  discard block
 block discarded – undo
1922 1922
 		global $global_query;
1923 1923
 		
1924 1924
 		date_default_timezone_set('UTC');
1925
-		$filter_query = $this->getFilter($filter,true,true);
1925
+		$filter_query = $this->getFilter($filter, true, true);
1926 1926
 		$limit_query = '';
1927 1927
 		
1928 1928
 		if ($limit != "")
1929 1929
 		{
1930 1930
 			$limit_array = explode(",", $limit);
1931 1931
 			
1932
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1933
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1932
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1933
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1934 1934
 			
1935 1935
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1936 1936
 			{
@@ -1947,7 +1947,7 @@  discard block
 block discarded – undo
1947 1947
 			$orderby_query = " ORDER BY spotter_output.date DESC";
1948 1948
 		}
1949 1949
 
1950
-		$query  = $global_query.$filter_query." spotter_output.highlight <> '' ".$orderby_query;
1950
+		$query = $global_query.$filter_query." spotter_output.highlight <> '' ".$orderby_query;
1951 1951
 
1952 1952
 		$spotter_array = $this->getDataFromDB($query, array(), $limit_query);
1953 1953
 
@@ -1960,19 +1960,19 @@  discard block
 block discarded – undo
1960 1960
 	* @return String the highlight text
1961 1961
 	*
1962 1962
 	*/
1963
-	public function getHighlightByRegistration($registration,$filter = array())
1963
+	public function getHighlightByRegistration($registration, $filter = array())
1964 1964
 	{
1965 1965
 		global $global_query;
1966 1966
 		
1967 1967
 		date_default_timezone_set('UTC');
1968
-		$filter_query = $this->getFilter($filter,true,true);
1969
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
1968
+		$filter_query = $this->getFilter($filter, true, true);
1969
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
1970 1970
 		
1971
-		$query  = $global_query.$filter_query." spotter_output.highlight <> '' AND spotter_output.registration = :registration";
1971
+		$query = $global_query.$filter_query." spotter_output.highlight <> '' AND spotter_output.registration = :registration";
1972 1972
 		$sth = $this->db->prepare($query);
1973 1973
 		$sth->execute(array(':registration' => $registration));
1974 1974
 
1975
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
1975
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
1976 1976
 		{
1977 1977
 			$highlight = $row['highlight'];
1978 1978
 		}
@@ -1988,14 +1988,14 @@  discard block
 block discarded – undo
1988 1988
 	* @return String usage
1989 1989
 	*
1990 1990
 	*/
1991
-	public function getSquawkUsage($squawk = '',$country = 'FR')
1991
+	public function getSquawkUsage($squawk = '', $country = 'FR')
1992 1992
 	{
1993 1993
 		
1994
-		$squawk = filter_var($squawk,FILTER_SANITIZE_STRING);
1995
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
1994
+		$squawk = filter_var($squawk, FILTER_SANITIZE_STRING);
1995
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
1996 1996
 
1997 1997
 		$query  = "SELECT squawk.* FROM squawk WHERE squawk.code = :squawk AND squawk.country = :country LIMIT 1";
1998
-		$query_values = array(':squawk' => ltrim($squawk,'0'), ':country' => $country);
1998
+		$query_values = array(':squawk' => ltrim($squawk, '0'), ':country' => $country);
1999 1999
 		
2000 2000
 		$sth = $this->db->prepare($query);
2001 2001
 		$sth->execute($query_values);
@@ -2017,9 +2017,9 @@  discard block
 block discarded – undo
2017 2017
 	public function getAirportIcao($airport_iata = '')
2018 2018
 	{
2019 2019
 		
2020
-		$airport_iata = filter_var($airport_iata,FILTER_SANITIZE_STRING);
2020
+		$airport_iata = filter_var($airport_iata, FILTER_SANITIZE_STRING);
2021 2021
 
2022
-		$query  = "SELECT airport.* FROM airport WHERE airport.iata = :airport LIMIT 1";
2022
+		$query = "SELECT airport.* FROM airport WHERE airport.iata = :airport LIMIT 1";
2023 2023
 		$query_values = array(':airport' => $airport_iata);
2024 2024
 		
2025 2025
 		$sth = $this->db->prepare($query);
@@ -2041,12 +2041,12 @@  discard block
 block discarded – undo
2041 2041
 	* @return Float distance to the airport
2042 2042
 	*
2043 2043
 	*/
2044
-	public function getAirportDistance($airport_icao,$latitude,$longitude)
2044
+	public function getAirportDistance($airport_icao, $latitude, $longitude)
2045 2045
 	{
2046 2046
 		
2047
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
2047
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
2048 2048
 
2049
-		$query  = "SELECT airport.latitude, airport.longitude FROM airport WHERE airport.icao = :airport LIMIT 1";
2049
+		$query = "SELECT airport.latitude, airport.longitude FROM airport WHERE airport.icao = :airport LIMIT 1";
2050 2050
 		$query_values = array(':airport' => $airport_icao);
2051 2051
 		$sth = $this->db->prepare($query);
2052 2052
 		$sth->execute($query_values);
@@ -2056,7 +2056,7 @@  discard block
 block discarded – undo
2056 2056
 			$airport_latitude = $row['latitude'];
2057 2057
 			$airport_longitude = $row['longitude'];
2058 2058
 			$Common = new Common();
2059
-			return $Common->distance($latitude,$longitude,$airport_latitude,$airport_longitude);
2059
+			return $Common->distance($latitude, $longitude, $airport_latitude, $airport_longitude);
2060 2060
 		} else return '';
2061 2061
 	}
2062 2062
 	
@@ -2070,11 +2070,11 @@  discard block
 block discarded – undo
2070 2070
 	public function getAllAirportInfo($airport = '')
2071 2071
 	{
2072 2072
 		
2073
-		$airport = filter_var($airport,FILTER_SANITIZE_STRING);
2073
+		$airport = filter_var($airport, FILTER_SANITIZE_STRING);
2074 2074
 
2075 2075
 		$query_values = array();
2076 2076
 		if ($airport == 'NA') {
2077
-			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' => ''));
2077
+			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' => ''));
2078 2078
 		} elseif ($airport == '') {
2079 2079
 			$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";
2080 2080
 		} else {
@@ -2122,14 +2122,14 @@  discard block
 block discarded – undo
2122 2122
 	{
2123 2123
 		$lst_countries = '';
2124 2124
 		foreach ($countries as $country) {
2125
-			$country = filter_var($country,FILTER_SANITIZE_STRING);
2125
+			$country = filter_var($country, FILTER_SANITIZE_STRING);
2126 2126
 			if ($lst_countries == '') {
2127 2127
 				$lst_countries = "'".$country."'";
2128 2128
 			} else {
2129 2129
 				$lst_countries .= ",'".$country."'";
2130 2130
 			}
2131 2131
 		}
2132
-		$query  = "SELECT airport.* FROM airport WHERE airport.country IN (".$lst_countries.")";
2132
+		$query = "SELECT airport.* FROM airport WHERE airport.country IN (".$lst_countries.")";
2133 2133
 		
2134 2134
 		$sth = $this->db->prepare($query);
2135 2135
 		$sth->execute();
@@ -2137,7 +2137,7 @@  discard block
 block discarded – undo
2137 2137
 		$airport_array = array();
2138 2138
 		$temp_array = array();
2139 2139
 		
2140
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2140
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2141 2141
 		{
2142 2142
 			$temp_array['name'] = $row['name'];
2143 2143
 			$temp_array['city'] = $row['city'];
@@ -2165,10 +2165,10 @@  discard block
 block discarded – undo
2165 2165
 	{
2166 2166
 		global $globalDBdriver;
2167 2167
 		if (is_array($coord)) {
2168
-			$minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2169
-			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2170
-			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2171
-			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2168
+			$minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
2169
+			$minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
2170
+			$maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
2171
+			$maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
2172 2172
 		} else return array();
2173 2173
 		if ($globalDBdriver == 'mysql') {
2174 2174
 			$query  = "SELECT airport.* FROM airport WHERE airport.latitude BETWEEN ".$minlat." AND ".$maxlat." AND airport.longitude BETWEEN ".$minlong." AND ".$maxlong." AND airport.type != 'closed'";
@@ -2180,7 +2180,7 @@  discard block
 block discarded – undo
2180 2180
     
2181 2181
 		$airport_array = array();
2182 2182
 		
2183
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2183
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2184 2184
 		{
2185 2185
 			$temp_array = $row;
2186 2186
 
@@ -2200,13 +2200,13 @@  discard block
 block discarded – undo
2200 2200
 	public function getAllWaypointsInfobyCoord($coord)
2201 2201
 	{
2202 2202
 		if (is_array($coord)) {
2203
-			$minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2204
-			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2205
-			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2206
-			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2203
+			$minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
2204
+			$minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
2205
+			$maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
2206
+			$maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
2207 2207
 		} else return array();
2208 2208
 		//$query  = "SELECT waypoints.* FROM waypoints WHERE waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong;
2209
-		$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.")";
2209
+		$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.")";
2210 2210
 		//$query  = "SELECT waypoints.* FROM waypoints";
2211 2211
 		//$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";
2212 2212
 		//$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;
@@ -2218,7 +2218,7 @@  discard block
 block discarded – undo
2218 2218
     
2219 2219
 		$waypoints_array = array();
2220 2220
 		
2221
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2221
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2222 2222
 		{
2223 2223
 			$temp_array = $row;
2224 2224
 
@@ -2240,10 +2240,10 @@  discard block
 block discarded – undo
2240 2240
 	{
2241 2241
 		global $globalUseRealAirlines;
2242 2242
 		if (isset($globalUseRealAirlines) && $globalUseRealAirlines) $fromsource = NULL;
2243
-		$airline_icao = strtoupper(filter_var($airline_icao,FILTER_SANITIZE_STRING));
2243
+		$airline_icao = strtoupper(filter_var($airline_icao, FILTER_SANITIZE_STRING));
2244 2244
 		if ($airline_icao == 'NA') {
2245 2245
 			$airline_array = array();
2246
-			$airline_array[] = array('name' => 'Not Available','iata' => 'NA', 'icao' => 'NA', 'callsign' => '', 'country' => 'NA', 'type' =>'');
2246
+			$airline_array[] = array('name' => 'Not Available', 'iata' => 'NA', 'icao' => 'NA', 'callsign' => '', 'country' => 'NA', 'type' =>'');
2247 2247
 			return $airline_array;
2248 2248
 		} else {
2249 2249
 			if (strlen($airline_icao) == 2) {
@@ -2264,7 +2264,7 @@  discard block
 block discarded – undo
2264 2264
 			if ($fromsource === NULL) {
2265 2265
 				$sth->execute(array(':airline_icao' => $airline_icao));
2266 2266
 			} else {
2267
-				$sth->execute(array(':airline_icao' => $airline_icao,':fromsource' => $fromsource));
2267
+				$sth->execute(array(':airline_icao' => $airline_icao, ':fromsource' => $fromsource));
2268 2268
 			}
2269 2269
                         /*
2270 2270
 			$airline_array = array();
@@ -2309,13 +2309,13 @@  discard block
 block discarded – undo
2309 2309
 	{
2310 2310
 		global $globalUseRealAirlines;
2311 2311
 		if (isset($globalUseRealAirlines) && $globalUseRealAirlines) $fromsource = NULL;
2312
-		$airline_name = strtolower(filter_var($airline_name,FILTER_SANITIZE_STRING));
2313
-		$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";
2312
+		$airline_name = strtolower(filter_var($airline_name, FILTER_SANITIZE_STRING));
2313
+		$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";
2314 2314
 		$sth = $this->db->prepare($query);
2315 2315
 		if ($fromsource === NULL) {
2316 2316
 			$sth->execute(array(':airline_name' => $airline_name));
2317 2317
 		} else {
2318
-			$sth->execute(array(':airline_name' => $airline_name,':fromsource' => $fromsource));
2318
+			$sth->execute(array(':airline_name' => $airline_name, ':fromsource' => $fromsource));
2319 2319
 		}
2320 2320
 		$result = $sth->fetchAll(PDO::FETCH_ASSOC);
2321 2321
 		if (empty($result) && $fromsource !== NULL) {
@@ -2340,12 +2340,12 @@  discard block
 block discarded – undo
2340 2340
 	*/
2341 2341
 	public function getAllAircraftInfo($aircraft_type)
2342 2342
 	{
2343
-		$aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING);
2343
+		$aircraft_type = filter_var($aircraft_type, FILTER_SANITIZE_STRING);
2344 2344
 
2345 2345
 		if ($aircraft_type == 'NA') {
2346
-			return array(array('icao' => 'NA','type' => 'Not Available', 'manufacturer' => 'Not Available', 'aircraft_shadow' => NULL));
2346
+			return array(array('icao' => 'NA', 'type' => 'Not Available', 'manufacturer' => 'Not Available', 'aircraft_shadow' => NULL));
2347 2347
 		}
2348
-		$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";
2348
+		$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";
2349 2349
 		
2350 2350
 		$sth = $this->db->prepare($query);
2351 2351
 		$sth->execute(array(':aircraft_type' => $aircraft_type));
@@ -2377,7 +2377,7 @@  discard block
 block discarded – undo
2377 2377
 	*/
2378 2378
 	public function getAircraftIcao($aircraft_type)
2379 2379
 	{
2380
-		$aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING);
2380
+		$aircraft_type = filter_var($aircraft_type, FILTER_SANITIZE_STRING);
2381 2381
 		$all_aircraft = array('737-300' => 'B733',
2382 2382
 				'777-200' => 'B772',
2383 2383
 				'777-200ER' => 'B772',
@@ -2389,10 +2389,10 @@  discard block
 block discarded – undo
2389 2389
 				'A380' => 'A388');
2390 2390
 		if (isset($all_aircraft[$aircraft_type])) return $all_aircraft[$aircraft_type];
2391 2391
 
2392
-		$query  = "SELECT aircraft.icao FROM aircraft WHERE aircraft.type LIKE :saircraft_type OR aircraft.type = :aircraft_type OR aircraft.icao = :aircraft_type LIMIT 1";
2392
+		$query = "SELECT aircraft.icao FROM aircraft WHERE aircraft.type LIKE :saircraft_type OR aircraft.type = :aircraft_type OR aircraft.icao = :aircraft_type LIMIT 1";
2393 2393
 		$aircraft_type = strtoupper($aircraft_type);
2394 2394
 		$sth = $this->db->prepare($query);
2395
-		$sth->execute(array(':saircraft_type' => '%'.$aircraft_type.'%',':aircraft_type' => $aircraft_type,));
2395
+		$sth->execute(array(':saircraft_type' => '%'.$aircraft_type.'%', ':aircraft_type' => $aircraft_type,));
2396 2396
 		$result = $sth->fetchAll(PDO::FETCH_ASSOC);
2397 2397
 		if (isset($result[0]['icao'])) return $result[0]['icao'];
2398 2398
 		else return '';
@@ -2407,9 +2407,9 @@  discard block
 block discarded – undo
2407 2407
 	*/
2408 2408
 	public function getAllAircraftType($aircraft_modes)
2409 2409
 	{
2410
-		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
2410
+		$aircraft_modes = filter_var($aircraft_modes, FILTER_SANITIZE_STRING);
2411 2411
 
2412
-		$query  = "SELECT aircraft_modes.ICAOTypeCode FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes ORDER BY FirstCreated DESC LIMIT 1";
2412
+		$query = "SELECT aircraft_modes.ICAOTypeCode FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes ORDER BY FirstCreated DESC LIMIT 1";
2413 2413
 		
2414 2414
 		$sth = $this->db->prepare($query);
2415 2415
 		$sth->execute(array(':aircraft_modes' => $aircraft_modes));
@@ -2432,9 +2432,9 @@  discard block
 block discarded – undo
2432 2432
 	*/
2433 2433
 	public function getAllAircraftTypeByRegistration($registration)
2434 2434
 	{
2435
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
2435
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
2436 2436
 
2437
-		$query  = "SELECT aircraft_modes.ICAOTypeCode FROM aircraft_modes WHERE aircraft_modes.registration = :registration ORDER BY FirstCreated DESC LIMIT 1";
2437
+		$query = "SELECT aircraft_modes.ICAOTypeCode FROM aircraft_modes WHERE aircraft_modes.registration = :registration ORDER BY FirstCreated DESC LIMIT 1";
2438 2438
 		
2439 2439
 		$sth = $this->db->prepare($query);
2440 2440
 		$sth->execute(array(':registration' => $registration));
@@ -2455,9 +2455,9 @@  discard block
 block discarded – undo
2455 2455
 	*/
2456 2456
 	public function getAllIDByRegistration($registration)
2457 2457
 	{
2458
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
2458
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
2459 2459
 
2460
-		$query  = "SELECT spotter_id,flightaware_id, date FROM spotter_output WHERE spotter_output.registration = :registration";
2460
+		$query = "SELECT spotter_id,flightaware_id, date FROM spotter_output WHERE spotter_output.registration = :registration";
2461 2461
 		
2462 2462
 		$sth = $this->db->prepare($query);
2463 2463
 		$sth->execute(array(':registration' => $registration));
@@ -2465,7 +2465,7 @@  discard block
 block discarded – undo
2465 2465
 		$idarray = array();
2466 2466
 		while ($row = $sth->fetch(PDO::FETCH_ASSOC)) {
2467 2467
 			$date = $row['date'];
2468
-			$idarray[$date] = array('flightaware_id' => $row['flightaware_id'],'spotter_id' => $row['spotter_id']);
2468
+			$idarray[$date] = array('flightaware_id' => $row['flightaware_id'], 'spotter_id' => $row['spotter_id']);
2469 2469
 		}
2470 2470
 		return $idarray;
2471 2471
 	}
@@ -2479,8 +2479,8 @@  discard block
 block discarded – undo
2479 2479
 	*/
2480 2480
 	public function getOperator($operator)
2481 2481
 	{
2482
-		$operator = filter_var($operator,FILTER_SANITIZE_STRING);
2483
-		$query  = "SELECT translation.operator_correct FROM translation WHERE translation.operator = :operator LIMIT 1";
2482
+		$operator = filter_var($operator, FILTER_SANITIZE_STRING);
2483
+		$query = "SELECT translation.operator_correct FROM translation WHERE translation.operator = :operator LIMIT 1";
2484 2484
 		
2485 2485
 		$sth = $this->db->prepare($query);
2486 2486
 		$sth->execute(array(':operator' => $operator));
@@ -2501,9 +2501,9 @@  discard block
 block discarded – undo
2501 2501
 	*/
2502 2502
 	public function getRouteInfo($callsign)
2503 2503
 	{
2504
-		$callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
2504
+		$callsign = filter_var($callsign, FILTER_SANITIZE_STRING);
2505 2505
                 if ($callsign == '') return array();
2506
-		$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";
2506
+		$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";
2507 2507
 		
2508 2508
 		$sth = $this->db->prepare($query);
2509 2509
 		$sth->execute(array(':callsign' => $callsign));
@@ -2524,9 +2524,9 @@  discard block
 block discarded – undo
2524 2524
 	*/
2525 2525
 	public function getAircraftInfoByRegistration($registration)
2526 2526
 	{
2527
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
2527
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
2528 2528
 
2529
-		$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";
2529
+		$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";
2530 2530
 		
2531 2531
 		$sth = $this->db->prepare($query);
2532 2532
 		$sth->execute(array(':registration' => $registration));
@@ -2534,7 +2534,7 @@  discard block
 block discarded – undo
2534 2534
 		$aircraft_array = array();
2535 2535
 		$temp_array = array();
2536 2536
 		
2537
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2537
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2538 2538
 		{
2539 2539
 			$temp_array['airline_icao'] = $row['airline_icao'];
2540 2540
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
@@ -2556,7 +2556,7 @@  discard block
 block discarded – undo
2556 2556
 	*/
2557 2557
 	public function getAircraftOwnerByRegistration($registration)
2558 2558
 	{
2559
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
2559
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
2560 2560
 		$Connection = new Connection($this->db);
2561 2561
 		if ($Connection->tableExists('aircraft_owner')) {
2562 2562
 			$query  = "SELECT aircraft_owner.base, aircraft_owner.owner, aircraft_owner.date_first_reg FROM aircraft_owner WHERE registration = :registration LIMIT 1";
@@ -2578,7 +2578,7 @@  discard block
 block discarded – undo
2578 2578
 	public function getAllFlightsforSitemap()
2579 2579
 	{
2580 2580
 		//$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 ";
2581
-		$query  = "SELECT spotter_output.spotter_id FROM spotter_output ORDER BY spotter_id DESC LIMIT 200 OFFSET 0";
2581
+		$query = "SELECT spotter_output.spotter_id FROM spotter_output ORDER BY spotter_id DESC LIMIT 200 OFFSET 0";
2582 2582
 		
2583 2583
 		$sth = $this->db->prepare($query);
2584 2584
 		$sth->execute();
@@ -2625,7 +2625,7 @@  discard block
 block discarded – undo
2625 2625
 		$manufacturer_array = array();
2626 2626
 		$temp_array = array();
2627 2627
 		
2628
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2628
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2629 2629
 		{
2630 2630
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
2631 2631
 
@@ -2662,7 +2662,7 @@  discard block
 block discarded – undo
2662 2662
 		$aircraft_array = array();
2663 2663
 		$temp_array = array();
2664 2664
 		
2665
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2665
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2666 2666
 		{
2667 2667
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
2668 2668
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
@@ -2683,8 +2683,8 @@  discard block
 block discarded – undo
2683 2683
 	*/
2684 2684
 	public function getAllAircraftRegistrations($filters = array())
2685 2685
 	{
2686
-		$filter_query = $this->getFilter($filters,true,true);
2687
-		$query  = "SELECT DISTINCT spotter_output.registration 
2686
+		$filter_query = $this->getFilter($filters, true, true);
2687
+		$query = "SELECT DISTINCT spotter_output.registration 
2688 2688
 				FROM spotter_output".$filter_query." spotter_output.registration <> '' 
2689 2689
 				ORDER BY spotter_output.registration ASC";
2690 2690
 
@@ -2694,7 +2694,7 @@  discard block
 block discarded – undo
2694 2694
 		$aircraft_array = array();
2695 2695
 		$temp_array = array();
2696 2696
 		
2697
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2697
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2698 2698
 		{
2699 2699
 			$temp_array['registration'] = $row['registration'];
2700 2700
 
@@ -2711,11 +2711,11 @@  discard block
 block discarded – undo
2711 2711
 	* @return Array list of source name
2712 2712
 	*
2713 2713
 	*/
2714
-	public function getAllSourceName($type = '',$filters = array())
2714
+	public function getAllSourceName($type = '', $filters = array())
2715 2715
 	{
2716
-		$filter_query = $this->getFilter($filters,true,true);
2716
+		$filter_query = $this->getFilter($filters, true, true);
2717 2717
 		$query_values = array();
2718
-		$query  = "SELECT DISTINCT spotter_output.source_name 
2718
+		$query = "SELECT DISTINCT spotter_output.source_name 
2719 2719
 				FROM spotter_output".$filter_query." spotter_output.source_name <> ''";
2720 2720
 		if ($type != '') {
2721 2721
 			$query_values = array(':type' => $type);
@@ -2730,7 +2730,7 @@  discard block
 block discarded – undo
2730 2730
 		$source_array = array();
2731 2731
 		$temp_array = array();
2732 2732
 		
2733
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2733
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2734 2734
 		{
2735 2735
 			$temp_array['source_name'] = $row['source_name'];
2736 2736
 			$source_array[] = $temp_array;
@@ -2746,11 +2746,11 @@  discard block
 block discarded – undo
2746 2746
 	* @return Array list of airline names
2747 2747
 	*
2748 2748
 	*/
2749
-	public function getAllAirlineNames($airline_type = '',$forsource = NULL,$filters = array())
2749
+	public function getAllAirlineNames($airline_type = '', $forsource = NULL, $filters = array())
2750 2750
 	{
2751
-		global $globalAirlinesSource,$globalVATSIM, $globalIVAO;
2752
-		$filter_query = $this->getFilter($filters,true,true);
2753
-		$airline_type = filter_var($airline_type,FILTER_SANITIZE_STRING);
2751
+		global $globalAirlinesSource, $globalVATSIM, $globalIVAO;
2752
+		$filter_query = $this->getFilter($filters, true, true);
2753
+		$airline_type = filter_var($airline_type, FILTER_SANITIZE_STRING);
2754 2754
 		if ($airline_type == '' || $airline_type == 'all') {
2755 2755
 			/*
2756 2756
 			$query  = "SELECT DISTINCT spotter_output.airline_icao AS airline_icao, spotter_output.airline_name AS airline_name, spotter_output.airline_type AS airline_type
@@ -2769,7 +2769,7 @@  discard block
 block discarded – undo
2769 2769
 				$query_data = array(':forsource' => $forsource);
2770 2770
 			}
2771 2771
 		} else {
2772
-			$query  = "SELECT DISTINCT spotter_output.airline_icao AS airline_icao, spotter_output.airline_name AS airline_name, spotter_output.airline_type AS airline_type
2772
+			$query = "SELECT DISTINCT spotter_output.airline_icao AS airline_icao, spotter_output.airline_name AS airline_name, spotter_output.airline_type AS airline_type
2773 2773
 					FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' 
2774 2774
 					AND spotter_output.airline_type = :airline_type 
2775 2775
 					ORDER BY spotter_output.airline_icao ASC";
@@ -2782,7 +2782,7 @@  discard block
 block discarded – undo
2782 2782
 		$airline_array = array();
2783 2783
 		$temp_array = array();
2784 2784
 		
2785
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2785
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2786 2786
 		{
2787 2787
 			$temp_array['airline_icao'] = $row['airline_icao'];
2788 2788
 			$temp_array['airline_name'] = $row['airline_name'];
@@ -2799,10 +2799,10 @@  discard block
 block discarded – undo
2799 2799
 	* @return Array list of alliance names
2800 2800
 	*
2801 2801
 	*/
2802
-	public function getAllAllianceNames($forsource = NULL,$filters = array())
2802
+	public function getAllAllianceNames($forsource = NULL, $filters = array())
2803 2803
 	{
2804
-		global $globalAirlinesSource,$globalVATSIM, $globalIVAO;
2805
-		$filter_query = $this->getFilter($filters,true,true);
2804
+		global $globalAirlinesSource, $globalVATSIM, $globalIVAO;
2805
+		$filter_query = $this->getFilter($filters, true, true);
2806 2806
 		if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $forsource = $globalAirlinesSource;
2807 2807
 		elseif (isset($globalVATSIM) && $globalVATSIM) $forsource = 'vatsim';
2808 2808
 		elseif (isset($globalIVAO) && $globalIVAO) $forsource = 'ivao';
@@ -2830,8 +2830,8 @@  discard block
 block discarded – undo
2830 2830
 	*/
2831 2831
 	public function getAllAirlineCountries($filters = array())
2832 2832
 	{
2833
-		$filter_query = $this->getFilter($filters,true,true);
2834
-		$query  = "SELECT DISTINCT spotter_output.airline_country AS airline_country
2833
+		$filter_query = $this->getFilter($filters, true, true);
2834
+		$query = "SELECT DISTINCT spotter_output.airline_country AS airline_country
2835 2835
 				FROM spotter_output".$filter_query." spotter_output.airline_country <> '' 
2836 2836
 				ORDER BY spotter_output.airline_country ASC";
2837 2837
 		
@@ -2842,7 +2842,7 @@  discard block
 block discarded – undo
2842 2842
 		$airline_array = array();
2843 2843
 		$temp_array = array();
2844 2844
 		
2845
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2845
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2846 2846
 		{
2847 2847
 			$temp_array['airline_country'] = $row['airline_country'];
2848 2848
 
@@ -2862,9 +2862,9 @@  discard block
 block discarded – undo
2862 2862
 	*/
2863 2863
 	public function getAllAirportNames($filters = array())
2864 2864
 	{
2865
-		$filter_query = $this->getFilter($filters,true,true);
2865
+		$filter_query = $this->getFilter($filters, true, true);
2866 2866
 		$airport_array = array();
2867
-		$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
2867
+		$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
2868 2868
 				FROM spotter_output".$filter_query." spotter_output.departure_airport_icao <> '' AND spotter_output.departure_airport_icao <> 'NA' 
2869 2869
 				ORDER BY spotter_output.departure_airport_city ASC";
2870 2870
 		
@@ -2873,7 +2873,7 @@  discard block
 block discarded – undo
2873 2873
 		$sth->execute();
2874 2874
 
2875 2875
 		$temp_array = array();
2876
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2876
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2877 2877
 		{
2878 2878
 			$temp_array['airport_icao'] = $row['airport_icao'];
2879 2879
 			$temp_array['airport_name'] = $row['airport_name'];
@@ -2883,14 +2883,14 @@  discard block
 block discarded – undo
2883 2883
 			$airport_array[$row['airport_city'].",".$row['airport_name']] = $temp_array;
2884 2884
 		}
2885 2885
 
2886
-		$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
2886
+		$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
2887 2887
 								FROM spotter_output".$filter_query." spotter_output.arrival_airport_icao <> '' AND spotter_output.arrival_airport_icao <> 'NA' 
2888 2888
 								ORDER BY spotter_output.arrival_airport_city ASC";
2889 2889
 					
2890 2890
 		$sth = $this->db->prepare($query);
2891 2891
 		$sth->execute();
2892 2892
 
2893
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2893
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2894 2894
 			{
2895 2895
 		//	if ($airport_array[$row['airport_city'].",".$row['airport_name']]['airport_icao'] != $row['airport_icao'])
2896 2896
 		//	{
@@ -2914,8 +2914,8 @@  discard block
 block discarded – undo
2914 2914
 	*/
2915 2915
 	public function getAllOwnerNames($filters = array())
2916 2916
 	{
2917
-		$filter_query = $this->getFilter($filters,true,true);
2918
-		$query  = "SELECT DISTINCT spotter_output.owner_name
2917
+		$filter_query = $this->getFilter($filters, true, true);
2918
+		$query = "SELECT DISTINCT spotter_output.owner_name
2919 2919
 				FROM spotter_output".$filter_query." spotter_output.owner_name <> '' 
2920 2920
 				ORDER BY spotter_output.owner_name ASC";
2921 2921
 		
@@ -2932,8 +2932,8 @@  discard block
 block discarded – undo
2932 2932
 	*/
2933 2933
 	public function getAllPilotNames($filters = array())
2934 2934
 	{
2935
-		$filter_query = $this->getFilter($filters,true,true);
2936
-		$query  = "SELECT DISTINCT spotter_output.pilot_name, spotter_output.pilot_id
2935
+		$filter_query = $this->getFilter($filters, true, true);
2936
+		$query = "SELECT DISTINCT spotter_output.pilot_name, spotter_output.pilot_id
2937 2937
 				FROM spotter_output".$filter_query." spotter_output.pilot_name <> '' 
2938 2938
 				ORDER BY spotter_output.pilot_name ASC";
2939 2939
 		
@@ -2966,21 +2966,21 @@  discard block
 block discarded – undo
2966 2966
    
2967 2967
 		$temp_array = array();
2968 2968
 		
2969
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2969
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2970 2970
 		{
2971 2971
 			$temp_array['airport_country'] = $row['airport_country'];
2972 2972
 
2973 2973
 			$airport_array[$row['airport_country']] = $temp_array;
2974 2974
 		}
2975
-		$filter_query = $this->getFilter($filters,true,true);
2976
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country
2975
+		$filter_query = $this->getFilter($filters, true, true);
2976
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country
2977 2977
 								FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' 
2978 2978
 								ORDER BY spotter_output.arrival_airport_country ASC";
2979 2979
 					
2980 2980
 		$sth = $this->db->prepare($query);
2981 2981
 		$sth->execute();
2982 2982
 		
2983
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2983
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2984 2984
 		{
2985 2985
 			if (isset($airport_array[$row['airport_country']]['airport_country']) && $airport_array[$row['airport_country']]['airport_country'] != $row['airport_country'])
2986 2986
 			{
@@ -3003,9 +3003,9 @@  discard block
 block discarded – undo
3003 3003
 	*/
3004 3004
 	public function getAllCountries($filters = array())
3005 3005
 	{
3006
-		$Connection= new Connection($this->db);
3006
+		$Connection = new Connection($this->db);
3007 3007
 		if ($Connection->tableExists('countries')) {
3008
-			$query  = "SELECT countries.name AS airport_country
3008
+			$query = "SELECT countries.name AS airport_country
3009 3009
 				FROM countries
3010 3010
 				ORDER BY countries.name ASC";
3011 3011
 			$sth = $this->db->prepare($query);
@@ -3014,14 +3014,14 @@  discard block
 block discarded – undo
3014 3014
 			$temp_array = array();
3015 3015
 			$country_array = array();
3016 3016
 		
3017
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
3017
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3018 3018
 			{
3019 3019
 				$temp_array['country'] = $row['airport_country'];
3020 3020
 				$country_array[$row['airport_country']] = $temp_array;
3021 3021
 			}
3022 3022
 		} else {
3023
-			$filter_query = $this->getFilter($filters,true,true);
3024
-			$query  = "SELECT DISTINCT spotter_output.departure_airport_country AS airport_country
3023
+			$filter_query = $this->getFilter($filters, true, true);
3024
+			$query = "SELECT DISTINCT spotter_output.departure_airport_country AS airport_country
3025 3025
 								FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' 
3026 3026
 								ORDER BY spotter_output.departure_airport_country ASC";
3027 3027
 
@@ -3030,20 +3030,20 @@  discard block
 block discarded – undo
3030 3030
    
3031 3031
 			$temp_array = array();
3032 3032
 			$country_array = array();
3033
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
3033
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3034 3034
 			{
3035 3035
 				$temp_array['country'] = $row['airport_country'];
3036 3036
 				$country_array[$row['airport_country']] = $temp_array;
3037 3037
 			}
3038 3038
 
3039
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country
3039
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country
3040 3040
 								FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' 
3041 3041
 								ORDER BY spotter_output.arrival_airport_country ASC";
3042 3042
 					
3043 3043
 		$sth = $this->db->prepare($query);
3044 3044
 		$sth->execute();
3045 3045
 		
3046
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3046
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3047 3047
 		{
3048 3048
 			if ($country_array[$row['airport_country']]['country'] != $row['airport_country'])
3049 3049
 			{
@@ -3053,14 +3053,14 @@  discard block
 block discarded – undo
3053 3053
 			}
3054 3054
 		}
3055 3055
 		
3056
-		$query  = "SELECT DISTINCT spotter_output.airline_country AS airline_country
3056
+		$query = "SELECT DISTINCT spotter_output.airline_country AS airline_country
3057 3057
 								FROM spotter_output".$filter_query." spotter_output.airline_country <> '' 
3058 3058
 								ORDER BY spotter_output.airline_country ASC";
3059 3059
 					
3060 3060
 		$sth = $this->db->prepare($query);
3061 3061
 		$sth->execute();
3062 3062
 		
3063
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3063
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3064 3064
 		{
3065 3065
 			if (isset($country_array[$row['airline_country']]['country']) && $country_array[$row['airline_country']]['country'] != $row['airline_country'])
3066 3066
 			{
@@ -3084,8 +3084,8 @@  discard block
 block discarded – undo
3084 3084
 	*/
3085 3085
 	public function getAllIdents($filters = array())
3086 3086
 	{
3087
-		$filter_query = $this->getFilter($filters,true,true);
3088
-		$query  = "SELECT DISTINCT spotter_output.ident
3087
+		$filter_query = $this->getFilter($filters, true, true);
3088
+		$query = "SELECT DISTINCT spotter_output.ident
3089 3089
 								FROM spotter_output".$filter_query." spotter_output.ident <> '' 
3090 3090
 								ORDER BY spotter_output.date ASC LIMIT 700 OFFSET 0";
3091 3091
 
@@ -3095,7 +3095,7 @@  discard block
 block discarded – undo
3095 3095
 		$ident_array = array();
3096 3096
 		$temp_array = array();
3097 3097
 		
3098
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3098
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3099 3099
 		{
3100 3100
 			$temp_array['ident'] = $row['ident'];
3101 3101
 			$ident_array[] = $temp_array;
@@ -3109,9 +3109,9 @@  discard block
 block discarded – undo
3109 3109
 	* @return Array number, icao, name and city of airports
3110 3110
 	*/
3111 3111
 
3112
-	public function getLast7DaysAirportsDeparture($airport_icao = '',$filters = array()) {
3112
+	public function getLast7DaysAirportsDeparture($airport_icao = '', $filters = array()) {
3113 3113
 		global $globalTimezone, $globalDBdriver;
3114
-		$filter_query = $this->getFilter($filters,true,true);
3114
+		$filter_query = $this->getFilter($filters, true, true);
3115 3115
 		if ($globalTimezone != '') {
3116 3116
 			date_default_timezone_set($globalTimezone);
3117 3117
 			$datetime = new DateTime();
@@ -3176,7 +3176,7 @@  discard block
 block discarded – undo
3176 3176
 
3177 3177
 	public function getLast7DaysDetectedAirportsDeparture($airport_icao = '', $filters = array()) {
3178 3178
 		global $globalTimezone, $globalDBdriver;
3179
-		$filter_query = $this->getFilter($filters,true,true);
3179
+		$filter_query = $this->getFilter($filters, true, true);
3180 3180
 		if ($globalTimezone != '') {
3181 3181
 			date_default_timezone_set($globalTimezone);
3182 3182
 			$datetime = new DateTime();
@@ -3260,7 +3260,7 @@  discard block
 block discarded – undo
3260 3260
 
3261 3261
 	public function getLast7DaysAirportsArrival($airport_icao = '', $filters = array()) {
3262 3262
 		global $globalTimezone, $globalDBdriver;
3263
-		$filter_query = $this->getFilter($filters,true,true);
3263
+		$filter_query = $this->getFilter($filters, true, true);
3264 3264
 		if ($globalTimezone != '') {
3265 3265
 			date_default_timezone_set($globalTimezone);
3266 3266
 			$datetime = new DateTime();
@@ -3293,9 +3293,9 @@  discard block
 block discarded – undo
3293 3293
 	* @return Array number, icao, name and city of airports
3294 3294
 	*/
3295 3295
 
3296
-	public function getLast7DaysDetectedAirportsArrival($airport_icao = '',$filters = array()) {
3296
+	public function getLast7DaysDetectedAirportsArrival($airport_icao = '', $filters = array()) {
3297 3297
 		global $globalTimezone, $globalDBdriver;
3298
-		$filter_query = $this->getFilter($filters,true,true);
3298
+		$filter_query = $this->getFilter($filters, true, true);
3299 3299
 		if ($globalTimezone != '') {
3300 3300
 			date_default_timezone_set($globalTimezone);
3301 3301
 			$datetime = new DateTime();
@@ -3427,12 +3427,12 @@  discard block
 block discarded – undo
3427 3427
 		} else $offset = '+00:00';
3428 3428
 
3429 3429
 		if ($globalDBdriver == 'mysql') {
3430
-			$query  = "SELECT DISTINCT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) as date
3430
+			$query = "SELECT DISTINCT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) as date
3431 3431
 								FROM spotter_output
3432 3432
 								WHERE spotter_output.date <> '' 
3433 3433
 								ORDER BY spotter_output.date ASC LIMIT 0,200";
3434 3434
 		} else {
3435
-			$query  = "SELECT DISTINCT to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') as date
3435
+			$query = "SELECT DISTINCT to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') as date
3436 3436
 								FROM spotter_output
3437 3437
 								WHERE spotter_output.date <> '' 
3438 3438
 								ORDER BY spotter_output.date ASC LIMIT 0,200";
@@ -3444,7 +3444,7 @@  discard block
 block discarded – undo
3444 3444
 		$date_array = array();
3445 3445
 		$temp_array = array();
3446 3446
 		
3447
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3447
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3448 3448
 		{
3449 3449
 			$temp_array['date'] = $row['date'];
3450 3450
 
@@ -3464,7 +3464,7 @@  discard block
 block discarded – undo
3464 3464
 	*/
3465 3465
 	public function getAllRoutes()
3466 3466
 	{
3467
-		$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 
3467
+		$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 
3468 3468
 				FROM spotter_output
3469 3469
 				WHERE spotter_output.ident <> '' 
3470 3470
 				GROUP BY route
@@ -3475,7 +3475,7 @@  discard block
 block discarded – undo
3475 3475
 
3476 3476
 		$routes_array = array();
3477 3477
 		$temp_array = array();
3478
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3478
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3479 3479
 		{
3480 3480
 			$temp_array['route'] = $row['route'];
3481 3481
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -3494,21 +3494,21 @@  discard block
 block discarded – undo
3494 3494
 	* @return String success or false
3495 3495
 	*
3496 3496
 	*/	
3497
-	public function updateIdentSpotterData($flightaware_id = '', $ident = '',$fromsource = NULL)
3497
+	public function updateIdentSpotterData($flightaware_id = '', $ident = '', $fromsource = NULL)
3498 3498
 	{
3499 3499
 		if (!is_numeric(substr($ident, 0, 3)))
3500 3500
 		{
3501 3501
 			if (is_numeric(substr(substr($ident, 0, 3), -1, 1))) {
3502
-				$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2),$fromsource);
3502
+				$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2), $fromsource);
3503 3503
 			} elseif (is_numeric(substr(substr($ident, 0, 4), -1, 1))) {
3504
-				$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3),$fromsource);
3504
+				$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3), $fromsource);
3505 3505
 			} else {
3506 3506
 				$airline_array = $this->getAllAirlineInfo("NA");
3507 3507
 			}
3508 3508
 			if (count($airline_array) == 0) {
3509 3509
 				$airline_array = $this->getAllAirlineInfo("NA");
3510 3510
 			}
3511
-			if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == ""){
3511
+			if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == "") {
3512 3512
 				$airline_array = $this->getAllAirlineInfo("NA");
3513 3513
 			}
3514 3514
 		} else {
@@ -3521,7 +3521,7 @@  discard block
 block discarded – undo
3521 3521
 
3522 3522
 
3523 3523
 		$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';
3524
-                $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);
3524
+                $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);
3525 3525
 
3526 3526
 		try {
3527 3527
 			$sth = $this->db->prepare($query);
@@ -3542,11 +3542,11 @@  discard block
 block discarded – undo
3542 3542
 	* @return String success or false
3543 3543
 	*
3544 3544
 	*/	
3545
-	public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '',$arrival_airport_time = '')
3545
+	public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '', $arrival_airport_time = '')
3546 3546
 	{
3547 3547
 		if ($groundspeed == '') $groundspeed = NULL;
3548 3548
 		$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';
3549
-                $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);
3549
+                $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);
3550 3550
 
3551 3551
 		try {
3552 3552
 			$sth = $this->db->prepare($query);
@@ -3586,7 +3586,7 @@  discard block
 block discarded – undo
3586 3586
 	* @param String $verticalrate vertival rate of flight
3587 3587
 	* @return String success or false
3588 3588
 	*/
3589
-	public function addSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $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 = '')
3589
+	public function addSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $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 = '')
3590 3590
 	{
3591 3591
 		global $globalURL, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalDebugTimeElapsed, $globalAirlinesSource, $globalVAM;
3592 3592
 		
@@ -3610,13 +3610,13 @@  discard block
 block discarded – undo
3610 3610
 				if ($ModeS != '') {
3611 3611
 					$timeelapsed = microtime(true);
3612 3612
 					$registration = $this->getAircraftRegistrationBymodeS($ModeS);
3613
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3613
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3614 3614
 				} else {
3615
-					$myhex = explode('-',$flightaware_id);
3615
+					$myhex = explode('-', $flightaware_id);
3616 3616
 					if (count($myhex) > 0) {
3617 3617
 						$timeelapsed = microtime(true);
3618 3618
 						$registration = $this->getAircraftRegistrationBymodeS($myhex[0]);
3619
-						if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3619
+						if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3620 3620
 					}
3621 3621
 				}
3622 3622
 			}
@@ -3638,24 +3638,24 @@  discard block
 block discarded – undo
3638 3638
 				{
3639 3639
 					$timeelapsed = microtime(true);
3640 3640
 					if (is_numeric(substr(substr($ident, 0, 3), -1, 1))) {
3641
-						$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2),$fromsource);
3641
+						$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2), $fromsource);
3642 3642
 					} elseif (is_numeric(substr(substr($ident, 0, 4), -1, 1))) {
3643
-						$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3),$fromsource);
3643
+						$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3), $fromsource);
3644 3644
 					} else {
3645 3645
 						$airline_array = $this->getAllAirlineInfo("NA");
3646 3646
 					}
3647 3647
 					if (count($airline_array) == 0) {
3648 3648
 						$airline_array = $this->getAllAirlineInfo("NA");
3649 3649
 					}
3650
-					if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == ""){
3650
+					if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == "") {
3651 3651
 						$airline_array = $this->getAllAirlineInfo("NA");
3652 3652
 					}
3653
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3653
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3654 3654
 
3655 3655
 				} else {
3656 3656
 					$timeelapsed = microtime(true);
3657 3657
 					$airline_array = $this->getAllAirlineInfo("NA");
3658
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3658
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3659 3659
 				}
3660 3660
 			}
3661 3661
 		} else $airline_array = array();
@@ -3672,27 +3672,27 @@  discard block
 block discarded – undo
3672 3672
 				{
3673 3673
 					$timeelapsed = microtime(true);
3674 3674
 					$aircraft_array = $this->getAllAircraftInfo("NA");
3675
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3675
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3676 3676
 				} else {
3677 3677
 					$timeelapsed = microtime(true);
3678 3678
 					$aircraft_array = $this->getAllAircraftInfo($aircraft_icao);
3679
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3679
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3680 3680
 				}
3681 3681
 			}
3682 3682
 		} else {
3683 3683
 			if ($ModeS != '') {
3684 3684
 				$timeelapsed = microtime(true);
3685 3685
 				$aircraft_icao = $this->getAllAircraftType($ModeS);
3686
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3686
+				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3687 3687
 				if ($aircraft_icao == "" || $aircraft_icao == "XXXX")
3688 3688
 				{
3689 3689
 					$timeelapsed = microtime(true);
3690 3690
 					$aircraft_array = $this->getAllAircraftInfo("NA");
3691
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3691
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3692 3692
 				} else {
3693 3693
 					$timeelapsed = microtime(true);
3694 3694
 					$aircraft_array = $this->getAllAircraftInfo($aircraft_icao);
3695
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3695
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3696 3696
 				}
3697 3697
 			}
3698 3698
 		}
@@ -3708,7 +3708,7 @@  discard block
 block discarded – undo
3708 3708
 			} else {
3709 3709
 				$timeelapsed = microtime(true);
3710 3710
 				$departure_airport_array = $this->getAllAirportInfo($departure_airport_icao);
3711
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3711
+				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3712 3712
 			}
3713 3713
 		}
3714 3714
 		
@@ -3723,7 +3723,7 @@  discard block
 block discarded – undo
3723 3723
 			} else {
3724 3724
 				$timeelapsed = microtime(true);
3725 3725
 				$arrival_airport_array = $this->getAllAirportInfo($arrival_airport_icao);
3726
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3726
+				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3727 3727
 			}
3728 3728
 		}
3729 3729
 
@@ -3776,7 +3776,7 @@  discard block
 block discarded – undo
3776 3776
 		}
3777 3777
 
3778 3778
     
3779
-		if ($date == "" || strtotime($date) < time()-20*60)
3779
+		if ($date == "" || strtotime($date) < time() - 20*60)
3780 3780
 		{
3781 3781
 			$date = date("Y-m-d H:i:s", time());
3782 3782
 		}
@@ -3786,7 +3786,7 @@  discard block
 block discarded – undo
3786 3786
 		{
3787 3787
 			$timeelapsed = microtime(true);
3788 3788
 			$image_array = $Image->getSpotterImage($registration);
3789
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3789
+			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3790 3790
 			if (!isset($image_array[0]['registration']))
3791 3791
 			{
3792 3792
 				//echo "Add image !!!! \n";
@@ -3794,7 +3794,7 @@  discard block
 block discarded – undo
3794 3794
 			}
3795 3795
 			$timeelapsed = microtime(true);
3796 3796
 			$owner_info = $this->getAircraftOwnerByRegistration($registration);
3797
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3797
+			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3798 3798
 			if ($owner_info['owner'] != '') $aircraft_owner = ucwords(strtolower($owner_info['owner']));
3799 3799
 		}
3800 3800
     
@@ -3802,33 +3802,33 @@  discard block
 block discarded – undo
3802 3802
 		{
3803 3803
             		if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao'];
3804 3804
             		else $airline_icao = '';
3805
-			$image_array = $Image->getSpotterImage('',$aircraft_icao,$airline_icao);
3805
+			$image_array = $Image->getSpotterImage('', $aircraft_icao, $airline_icao);
3806 3806
 			if (!isset($image_array[0]['registration']))
3807 3807
 			{
3808 3808
 				//echo "Add image !!!! \n";
3809
-				$Image->addSpotterImage('',$aircraft_icao,$airline_icao);
3809
+				$Image->addSpotterImage('', $aircraft_icao, $airline_icao);
3810 3810
 			}
3811 3811
 		}
3812 3812
     
3813
-		$flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING);
3814
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
3815
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
3816
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
3817
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
3818
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
3819
-		$latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
3820
-		$longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
3821
-		$waypoints = filter_var($waypoints,FILTER_SANITIZE_STRING);
3822
-		$altitude = filter_var($altitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
3823
-		$heading = filter_var($heading,FILTER_SANITIZE_NUMBER_INT);
3824
-		$groundspeed = filter_var($groundspeed,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
3825
-		$squawk = filter_var($squawk,FILTER_SANITIZE_NUMBER_INT);
3826
-		$route_stop = filter_var($route_stop,FILTER_SANITIZE_STRING);
3827
-		$ModeS = filter_var($ModeS,FILTER_SANITIZE_STRING);
3828
-		$pilot_id = filter_var($pilot_id,FILTER_SANITIZE_STRING);
3829
-		$pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING);
3830
-		$format_source = filter_var($format_source,FILTER_SANITIZE_STRING);
3831
-		$verticalrate = filter_var($verticalrate,FILTER_SANITIZE_NUMBER_INT);
3813
+		$flightaware_id = filter_var($flightaware_id, FILTER_SANITIZE_STRING);
3814
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
3815
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
3816
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
3817
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
3818
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
3819
+		$latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
3820
+		$longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
3821
+		$waypoints = filter_var($waypoints, FILTER_SANITIZE_STRING);
3822
+		$altitude = filter_var($altitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
3823
+		$heading = filter_var($heading, FILTER_SANITIZE_NUMBER_INT);
3824
+		$groundspeed = filter_var($groundspeed, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
3825
+		$squawk = filter_var($squawk, FILTER_SANITIZE_NUMBER_INT);
3826
+		$route_stop = filter_var($route_stop, FILTER_SANITIZE_STRING);
3827
+		$ModeS = filter_var($ModeS, FILTER_SANITIZE_STRING);
3828
+		$pilot_id = filter_var($pilot_id, FILTER_SANITIZE_STRING);
3829
+		$pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING);
3830
+		$format_source = filter_var($format_source, FILTER_SANITIZE_STRING);
3831
+		$verticalrate = filter_var($verticalrate, FILTER_SANITIZE_NUMBER_INT);
3832 3832
 	
3833 3833
 		if (count($airline_array) == 0) 
3834 3834
 		{
@@ -3856,7 +3856,7 @@  discard block
 block discarded – undo
3856 3856
                 if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
3857 3857
                 if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
3858 3858
                 if (!isset($aircraft_owner)) $aircraft_owner = NULL;
3859
-                $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) 
3859
+                $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) 
3860 3860
                 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)";
3861 3861
 
3862 3862
                 $airline_name = $airline_array[0]['name'];
@@ -3866,7 +3866,7 @@  discard block
 block discarded – undo
3866 3866
 		if ($airline_type == '') {
3867 3867
 			$timeelapsed = microtime(true);
3868 3868
 			$airline_type = $this->getAircraftTypeBymodeS($ModeS);
3869
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3869
+			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3870 3870
 		}
3871 3871
 		if ($airline_type == null) $airline_type = '';
3872 3872
                 $aircraft_type = $aircraft_array[0]['type'];
@@ -3878,7 +3878,7 @@  discard block
 block discarded – undo
3878 3878
                 $arrival_airport_name = $arrival_airport_array[0]['name'];
3879 3879
                 $arrival_airport_city = $arrival_airport_array[0]['city'];
3880 3880
                 $arrival_airport_country = $arrival_airport_array[0]['country'];
3881
-                $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);
3881
+                $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);
3882 3882
 
3883 3883
 		try {
3884 3884
 		        
@@ -3904,13 +3904,13 @@  discard block
 block discarded – undo
3904 3904
 	{
3905 3905
 		global $globalDBdriver, $globalTimezone;
3906 3906
 		if ($globalDBdriver == 'mysql') {
3907
-			$query  = "SELECT spotter_output.ident FROM spotter_output 
3907
+			$query = "SELECT spotter_output.ident FROM spotter_output 
3908 3908
 								WHERE spotter_output.ident = :ident 
3909 3909
 								AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) 
3910 3910
 								AND spotter_output.date < UTC_TIMESTAMP()";
3911 3911
 			$query_data = array(':ident' => $ident);
3912 3912
 		} else {
3913
-			$query  = "SELECT spotter_output.ident FROM spotter_output 
3913
+			$query = "SELECT spotter_output.ident FROM spotter_output 
3914 3914
 								WHERE spotter_output.ident = :ident 
3915 3915
 								AND spotter_output.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS'
3916 3916
 								AND spotter_output.date < now() AT TIME ZONE 'UTC'";
@@ -3919,8 +3919,8 @@  discard block
 block discarded – undo
3919 3919
 		
3920 3920
 		$sth = $this->db->prepare($query);
3921 3921
 		$sth->execute($query_data);
3922
-    		$ident_result='';
3923
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3922
+    		$ident_result = '';
3923
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3924 3924
 		{
3925 3925
 			$ident_result = $row['ident'];
3926 3926
 		}
@@ -3946,8 +3946,8 @@  discard block
 block discarded – undo
3946 3946
 				return false;
3947 3947
 			} else {
3948 3948
 				$q_array = explode(" ", $q);
3949
-				foreach ($q_array as $q_item){
3950
-					$q_item = filter_var($q_item,FILTER_SANITIZE_STRING);
3949
+				foreach ($q_array as $q_item) {
3950
+					$q_item = filter_var($q_item, FILTER_SANITIZE_STRING);
3951 3951
 					$additional_query .= " AND (";
3952 3952
 					$additional_query .= "(spotter_output.aircraft_icao like '%".$q_item."%') OR ";
3953 3953
 					$additional_query .= "(spotter_output.aircraft_name like '%".$q_item."%') OR ";
@@ -3962,11 +3962,11 @@  discard block
 block discarded – undo
3962 3962
 			}
3963 3963
 		}
3964 3964
 		if ($globalDBdriver == 'mysql') {
3965
-			$query  = "SELECT spotter_output.* FROM spotter_output 
3965
+			$query = "SELECT spotter_output.* FROM spotter_output 
3966 3966
 				WHERE spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 20 SECOND) ".$additional_query." 
3967 3967
 				AND spotter_output.date < UTC_TIMESTAMP()";
3968 3968
 		} else {
3969
-			$query  = "SELECT spotter_output.* FROM spotter_output 
3969
+			$query = "SELECT spotter_output.* FROM spotter_output 
3970 3970
 				WHERE spotter_output.date::timestamp >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '20 SECONDS' ".$additional_query." 
3971 3971
 				AND spotter_output.date::timestamp < CURRENT_TIMESTAMP AT TIME ZONE 'UTC'";
3972 3972
 		}
@@ -3983,11 +3983,11 @@  discard block
 block discarded – undo
3983 3983
 	* @return Array the airline list
3984 3984
 	*
3985 3985
 	*/
3986
-	public function countAllAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(), $year = '', $month = '', $day = '')
3986
+	public function countAllAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '')
3987 3987
 	{
3988 3988
 		global $globalDBdriver;
3989
-		$filter_query = $this->getFilter($filters,true,true);
3990
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
3989
+		$filter_query = $this->getFilter($filters, true, true);
3990
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
3991 3991
 		 			FROM spotter_output".$filter_query." spotter_output.airline_name <> '' AND spotter_output.airline_icao <> 'NA'";
3992 3992
 		if ($olderthanmonths > 0) {
3993 3993
 			if ($globalDBdriver == 'mysql') {
@@ -4007,28 +4007,28 @@  discard block
 block discarded – undo
4007 4007
 		if ($year != '') {
4008 4008
 			if ($globalDBdriver == 'mysql') {
4009 4009
 				$query .= " AND YEAR(spotter_output.date) = :year";
4010
-				$query_values = array_merge($query_values,array(':year' => $year));
4010
+				$query_values = array_merge($query_values, array(':year' => $year));
4011 4011
 			} else {
4012 4012
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
4013
-				$query_values = array_merge($query_values,array(':year' => $year));
4013
+				$query_values = array_merge($query_values, array(':year' => $year));
4014 4014
 			}
4015 4015
 		}
4016 4016
 		if ($month != '') {
4017 4017
 			if ($globalDBdriver == 'mysql') {
4018 4018
 				$query .= " AND MONTH(spotter_output.date) = :month";
4019
-				$query_values = array_merge($query_values,array(':month' => $month));
4019
+				$query_values = array_merge($query_values, array(':month' => $month));
4020 4020
 			} else {
4021 4021
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
4022
-				$query_values = array_merge($query_values,array(':month' => $month));
4022
+				$query_values = array_merge($query_values, array(':month' => $month));
4023 4023
 			}
4024 4024
 		}
4025 4025
 		if ($day != '') {
4026 4026
 			if ($globalDBdriver == 'mysql') {
4027 4027
 				$query .= " AND DAY(spotter_output.date) = :day";
4028
-				$query_values = array_merge($query_values,array(':day' => $day));
4028
+				$query_values = array_merge($query_values, array(':day' => $day));
4029 4029
 			} else {
4030 4030
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
4031
-				$query_values = array_merge($query_values,array(':day' => $day));
4031
+				$query_values = array_merge($query_values, array(':day' => $day));
4032 4032
 			}
4033 4033
 		}
4034 4034
 		$query .= " GROUP BY spotter_output.airline_name,spotter_output.airline_icao, spotter_output.airline_country ORDER BY airline_count DESC";
@@ -4038,7 +4038,7 @@  discard block
 block discarded – undo
4038 4038
 		$sth->execute($query_values);
4039 4039
 		$airline_array = array();
4040 4040
 		$temp_array = array();
4041
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4041
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4042 4042
 		{
4043 4043
 			$temp_array['airline_name'] = $row['airline_name'];
4044 4044
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4055,11 +4055,11 @@  discard block
 block discarded – undo
4055 4055
 	* @return Array the pilots list
4056 4056
 	*
4057 4057
 	*/
4058
-	public function countAllPilots($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '', $month = '',$day = '')
4058
+	public function countAllPilots($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '')
4059 4059
 	{
4060 4060
 		global $globalDBdriver;
4061
-		$filter_query = $this->getFilter($filters,true,true);
4062
-		$query  = "SELECT DISTINCT spotter_output.pilot_id, s.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count, spotter_output.format_source
4061
+		$filter_query = $this->getFilter($filters, true, true);
4062
+		$query = "SELECT DISTINCT spotter_output.pilot_id, s.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count, spotter_output.format_source
4063 4063
 			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 <> ''";
4064 4064
                 if ($olderthanmonths > 0) {
4065 4065
             		if ($globalDBdriver == 'mysql') {
@@ -4079,28 +4079,28 @@  discard block
 block discarded – undo
4079 4079
 		if ($year != '') {
4080 4080
 			if ($globalDBdriver == 'mysql') {
4081 4081
 				$query .= " AND YEAR(spotter_output.date) = :year";
4082
-				$query_values = array_merge($query_values,array(':year' => $year));
4082
+				$query_values = array_merge($query_values, array(':year' => $year));
4083 4083
 			} else {
4084 4084
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
4085
-				$query_values = array_merge($query_values,array(':year' => $year));
4085
+				$query_values = array_merge($query_values, array(':year' => $year));
4086 4086
 			}
4087 4087
 		}
4088 4088
 		if ($month != '') {
4089 4089
 			if ($globalDBdriver == 'mysql') {
4090 4090
 				$query .= " AND MONTH(spotter_output.date) = :month";
4091
-				$query_values = array_merge($query_values,array(':month' => $month));
4091
+				$query_values = array_merge($query_values, array(':month' => $month));
4092 4092
 			} else {
4093 4093
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
4094
-				$query_values = array_merge($query_values,array(':month' => $month));
4094
+				$query_values = array_merge($query_values, array(':month' => $month));
4095 4095
 			}
4096 4096
 		}
4097 4097
 		if ($day != '') {
4098 4098
 			if ($globalDBdriver == 'mysql') {
4099 4099
 				$query .= " AND DAY(spotter_output.date) = :day";
4100
-				$query_values = array_merge($query_values,array(':day' => $day));
4100
+				$query_values = array_merge($query_values, array(':day' => $day));
4101 4101
 			} else {
4102 4102
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
4103
-				$query_values = array_merge($query_values,array(':day' => $day));
4103
+				$query_values = array_merge($query_values, array(':day' => $day));
4104 4104
 			}
4105 4105
 		}
4106 4106
 		
@@ -4112,7 +4112,7 @@  discard block
 block discarded – undo
4112 4112
 		$sth->execute($query_values);
4113 4113
 		$airline_array = array();
4114 4114
 		$temp_array = array();
4115
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4115
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4116 4116
 		{
4117 4117
 			$temp_array['pilot_name'] = $row['pilot_name'];
4118 4118
 			$temp_array['pilot_id'] = $row['pilot_id'];
@@ -4132,7 +4132,7 @@  discard block
 block discarded – undo
4132 4132
 	public function countAllPilotsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '')
4133 4133
 	{
4134 4134
 		global $globalDBdriver;
4135
-		$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
4135
+		$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
4136 4136
 		 			FROM spotter_output WHERE spotter_output.pilot_id <> '' ";
4137 4137
                 if ($olderthanmonths > 0) {
4138 4138
             		if ($globalDBdriver == 'mysql') {
@@ -4158,7 +4158,7 @@  discard block
 block discarded – undo
4158 4158
 		$airline_array = array();
4159 4159
 		$temp_array = array();
4160 4160
         
4161
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4161
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4162 4162
 		{
4163 4163
 			$temp_array['pilot_name'] = $row['pilot_name'];
4164 4164
 			$temp_array['pilot_id'] = $row['pilot_id'];
@@ -4176,11 +4176,11 @@  discard block
 block discarded – undo
4176 4176
 	* @return Array the pilots list
4177 4177
 	*
4178 4178
 	*/
4179
-	public function countAllOwners($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '',$month = '',$day = '')
4179
+	public function countAllOwners($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '')
4180 4180
 	{
4181 4181
 		global $globalDBdriver;
4182
-		$filter_query = $this->getFilter($filters,true,true);
4183
-		$query  = "SELECT DISTINCT spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
4182
+		$filter_query = $this->getFilter($filters, true, true);
4183
+		$query = "SELECT DISTINCT spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
4184 4184
 					FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL";
4185 4185
                 if ($olderthanmonths > 0) {
4186 4186
             		if ($globalDBdriver == 'mysql') {
@@ -4200,28 +4200,28 @@  discard block
 block discarded – undo
4200 4200
 		if ($year != '') {
4201 4201
 			if ($globalDBdriver == 'mysql') {
4202 4202
 				$query .= " AND YEAR(spotter_output.date) = :year";
4203
-				$query_values = array_merge($query_values,array(':year' => $year));
4203
+				$query_values = array_merge($query_values, array(':year' => $year));
4204 4204
 			} else {
4205 4205
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
4206
-				$query_values = array_merge($query_values,array(':year' => $year));
4206
+				$query_values = array_merge($query_values, array(':year' => $year));
4207 4207
 			}
4208 4208
 		}
4209 4209
 		if ($month != '') {
4210 4210
 			if ($globalDBdriver == 'mysql') {
4211 4211
 				$query .= " AND MONTH(spotter_output.date) = :month";
4212
-				$query_values = array_merge($query_values,array(':month' => $month));
4212
+				$query_values = array_merge($query_values, array(':month' => $month));
4213 4213
 			} else {
4214 4214
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
4215
-				$query_values = array_merge($query_values,array(':month' => $month));
4215
+				$query_values = array_merge($query_values, array(':month' => $month));
4216 4216
 			}
4217 4217
 		}
4218 4218
 		if ($day != '') {
4219 4219
 			if ($globalDBdriver == 'mysql') {
4220 4220
 				$query .= " AND DAY(spotter_output.date) = :day";
4221
-				$query_values = array_merge($query_values,array(':day' => $day));
4221
+				$query_values = array_merge($query_values, array(':day' => $day));
4222 4222
 			} else {
4223 4223
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
4224
-				$query_values = array_merge($query_values,array(':day' => $day));
4224
+				$query_values = array_merge($query_values, array(':day' => $day));
4225 4225
 			}
4226 4226
 		}
4227 4227
 		$query .= " GROUP BY spotter_output.owner_name ORDER BY owner_count DESC";
@@ -4231,7 +4231,7 @@  discard block
 block discarded – undo
4231 4231
 		$sth->execute($query_values);
4232 4232
 		$airline_array = array();
4233 4233
 		$temp_array = array();
4234
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4234
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4235 4235
 		{
4236 4236
 			$temp_array['owner_name'] = $row['owner_name'];
4237 4237
 			$temp_array['owner_count'] = $row['owner_count'];
@@ -4246,11 +4246,11 @@  discard block
 block discarded – undo
4246 4246
 	* @return Array the pilots list
4247 4247
 	*
4248 4248
 	*/
4249
-	public function countAllOwnersByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
4249
+	public function countAllOwnersByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
4250 4250
 	{
4251 4251
 		global $globalDBdriver;
4252
-		$filter_query = $this->getFilter($filters,true,true);
4253
-		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
4252
+		$filter_query = $this->getFilter($filters, true, true);
4253
+		$query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
4254 4254
 		 			FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL ";
4255 4255
                 if ($olderthanmonths > 0) {
4256 4256
             		if ($globalDBdriver == 'mysql') {
@@ -4276,7 +4276,7 @@  discard block
 block discarded – undo
4276 4276
 		$airline_array = array();
4277 4277
 		$temp_array = array();
4278 4278
         
4279
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4279
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4280 4280
 		{
4281 4281
 			$temp_array['owner_name'] = $row['owner_name'];
4282 4282
 			$temp_array['owner_count'] = $row['owner_count'];
@@ -4292,11 +4292,11 @@  discard block
 block discarded – undo
4292 4292
 	* @return Array the airline list
4293 4293
 	*
4294 4294
 	*/
4295
-	public function countAllAirlinesByAircraft($aircraft_icao,$filters = array())
4295
+	public function countAllAirlinesByAircraft($aircraft_icao, $filters = array())
4296 4296
 	{
4297
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
4298
-		$filter_query = $this->getFilter($filters,true,true);
4299
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4297
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
4298
+		$filter_query = $this->getFilter($filters, true, true);
4299
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4300 4300
 		 	    FROM spotter_output".$filter_query." spotter_output.airline_name <> '' AND spotter_output.aircraft_icao = :aircraft_icao 
4301 4301
 			    GROUP BY spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country 
4302 4302
 			    ORDER BY airline_count DESC";
@@ -4308,7 +4308,7 @@  discard block
 block discarded – undo
4308 4308
 		$airline_array = array();
4309 4309
 		$temp_array = array();
4310 4310
         
4311
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4311
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4312 4312
 		{
4313 4313
 			$temp_array['airline_name'] = $row['airline_name'];
4314 4314
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4328,11 +4328,11 @@  discard block
 block discarded – undo
4328 4328
 	* @return Array the airline country list
4329 4329
 	*
4330 4330
 	*/
4331
-	public function countAllAirlineCountriesByAircraft($aircraft_icao,$filters = array())
4331
+	public function countAllAirlineCountriesByAircraft($aircraft_icao, $filters = array())
4332 4332
 	{
4333
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
4334
-		$filter_query = $this->getFilter($filters,true,true);
4335
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4333
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
4334
+		$filter_query = $this->getFilter($filters, true, true);
4335
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4336 4336
 		 			FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND spotter_output.aircraft_icao = :aircraft_icao
4337 4337
                     GROUP BY spotter_output.airline_country
4338 4338
 					ORDER BY airline_country_count DESC
@@ -4345,7 +4345,7 @@  discard block
 block discarded – undo
4345 4345
 		$airline_country_array = array();
4346 4346
 		$temp_array = array();
4347 4347
         
4348
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4348
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4349 4349
 		{
4350 4350
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4351 4351
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4364,11 +4364,11 @@  discard block
 block discarded – undo
4364 4364
 	* @return Array the airline list
4365 4365
 	*
4366 4366
 	*/
4367
-	public function countAllAirlinesByAirport($airport_icao,$filters = array())
4367
+	public function countAllAirlinesByAirport($airport_icao, $filters = array())
4368 4368
 	{
4369
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
4370
-		$filter_query = $this->getFilter($filters,true,true);
4371
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4369
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
4370
+		$filter_query = $this->getFilter($filters, true, true);
4371
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4372 4372
 		    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 ) 
4373 4373
                     GROUP BY spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country
4374 4374
 		    ORDER BY airline_count DESC";
@@ -4380,7 +4380,7 @@  discard block
 block discarded – undo
4380 4380
 		$airline_array = array();
4381 4381
 		$temp_array = array();
4382 4382
         
4383
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4383
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4384 4384
 		{
4385 4385
 			$temp_array['airline_name'] = $row['airline_name'];
4386 4386
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4399,11 +4399,11 @@  discard block
 block discarded – undo
4399 4399
 	* @return Array the airline country list
4400 4400
 	*
4401 4401
 	*/
4402
-	public function countAllAirlineCountriesByAirport($airport_icao,$filters = array())
4402
+	public function countAllAirlineCountriesByAirport($airport_icao, $filters = array())
4403 4403
 	{
4404
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
4405
-		$filter_query = $this->getFilter($filters,true,true);
4406
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4404
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
4405
+		$filter_query = $this->getFilter($filters, true, true);
4406
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4407 4407
 		 			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 )
4408 4408
 					GROUP BY spotter_output.airline_country
4409 4409
 					ORDER BY airline_country_count DESC
@@ -4416,7 +4416,7 @@  discard block
 block discarded – undo
4416 4416
 		$airline_country_array = array();
4417 4417
 		$temp_array = array();
4418 4418
         
4419
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4419
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4420 4420
 		{
4421 4421
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4422 4422
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4433,11 +4433,11 @@  discard block
 block discarded – undo
4433 4433
 	* @return Array the airline list
4434 4434
 	*
4435 4435
 	*/
4436
-	public function countAllAirlinesByManufacturer($aircraft_manufacturer,$filters = array())
4436
+	public function countAllAirlinesByManufacturer($aircraft_manufacturer, $filters = array())
4437 4437
 	{
4438
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
4439
-		$filter_query = $this->getFilter($filters,true,true);
4440
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4438
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
4439
+		$filter_query = $this->getFilter($filters, true, true);
4440
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4441 4441
 		 			FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer = :aircraft_manufacturer 
4442 4442
 					GROUP BY spotter_output.airline_name
4443 4443
 					ORDER BY airline_count DESC";
@@ -4448,7 +4448,7 @@  discard block
 block discarded – undo
4448 4448
 		$airline_array = array();
4449 4449
 		$temp_array = array();
4450 4450
         
4451
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4451
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4452 4452
 		{
4453 4453
 			$temp_array['airline_name'] = $row['airline_name'];
4454 4454
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4468,11 +4468,11 @@  discard block
 block discarded – undo
4468 4468
 	* @return Array the airline country list
4469 4469
 	*
4470 4470
 	*/
4471
-	public function countAllAirlineCountriesByManufacturer($aircraft_manufacturer,$filters = array())
4471
+	public function countAllAirlineCountriesByManufacturer($aircraft_manufacturer, $filters = array())
4472 4472
 	{
4473
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
4474
-		$filter_query = $this->getFilter($filters,true,true);
4475
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4473
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
4474
+		$filter_query = $this->getFilter($filters, true, true);
4475
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4476 4476
 		 			FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer 
4477 4477
 					GROUP BY spotter_output.airline_country
4478 4478
 					ORDER BY airline_country_count DESC
@@ -4485,7 +4485,7 @@  discard block
 block discarded – undo
4485 4485
 		$airline_country_array = array();
4486 4486
 		$temp_array = array();
4487 4487
         
4488
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4488
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4489 4489
 		{
4490 4490
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4491 4491
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4501,11 +4501,11 @@  discard block
 block discarded – undo
4501 4501
 	* @return Array the airline list
4502 4502
 	*
4503 4503
 	*/
4504
-	public function countAllAirlinesByDate($date,$filters = array())
4504
+	public function countAllAirlinesByDate($date, $filters = array())
4505 4505
 	{
4506 4506
 		global $globalTimezone, $globalDBdriver;
4507
-		$filter_query = $this->getFilter($filters,true,true);
4508
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
4507
+		$filter_query = $this->getFilter($filters, true, true);
4508
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
4509 4509
 		if ($globalTimezone != '') {
4510 4510
 			date_default_timezone_set($globalTimezone);
4511 4511
 			$datetime = new DateTime($date);
@@ -4513,12 +4513,12 @@  discard block
 block discarded – undo
4513 4513
 		} else $offset = '+00:00';
4514 4514
 
4515 4515
 		if ($globalDBdriver == 'mysql') {
4516
-			$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4516
+			$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4517 4517
 		 			FROM spotter_output".$filter_query." DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
4518 4518
 					GROUP BY spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country 
4519 4519
 					ORDER BY airline_count DESC";
4520 4520
 		} else {
4521
-			$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4521
+			$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4522 4522
 		 			FROM spotter_output".$filter_query." to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date 
4523 4523
 					GROUP BY spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country
4524 4524
 					ORDER BY airline_count DESC";
@@ -4529,7 +4529,7 @@  discard block
 block discarded – undo
4529 4529
 
4530 4530
 		$airline_array = array();
4531 4531
 		$temp_array = array();
4532
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4532
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4533 4533
 		{
4534 4534
 			$temp_array['airline_name'] = $row['airline_name'];
4535 4535
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4549,11 +4549,11 @@  discard block
 block discarded – undo
4549 4549
 	* @return Array the airline country list
4550 4550
 	*
4551 4551
 	*/
4552
-	public function countAllAirlineCountriesByDate($date,$filters = array())
4552
+	public function countAllAirlineCountriesByDate($date, $filters = array())
4553 4553
 	{
4554 4554
 		global $globalTimezone, $globalDBdriver;
4555
-		$filter_query = $this->getFilter($filters,true,true);
4556
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
4555
+		$filter_query = $this->getFilter($filters, true, true);
4556
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
4557 4557
 		if ($globalTimezone != '') {
4558 4558
 			date_default_timezone_set($globalTimezone);
4559 4559
 			$datetime = new DateTime($date);
@@ -4561,13 +4561,13 @@  discard block
 block discarded – undo
4561 4561
 		} else $offset = '+00:00';
4562 4562
 		
4563 4563
 		if ($globalDBdriver == 'mysql') {
4564
-			$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4564
+			$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4565 4565
 		 			FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
4566 4566
 					GROUP BY spotter_output.airline_country
4567 4567
 					ORDER BY airline_country_count DESC
4568 4568
 					LIMIT 10 OFFSET 0";
4569 4569
 		} else {
4570
-			$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4570
+			$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4571 4571
 		 			FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date 
4572 4572
 					GROUP BY spotter_output.airline_country
4573 4573
 					ORDER BY airline_country_count DESC
@@ -4579,7 +4579,7 @@  discard block
 block discarded – undo
4579 4579
  
4580 4580
 		$airline_country_array = array();
4581 4581
 		$temp_array = array();
4582
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4582
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4583 4583
 		{
4584 4584
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4585 4585
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4596,11 +4596,11 @@  discard block
 block discarded – undo
4596 4596
 	* @return Array the airline list
4597 4597
 	*
4598 4598
 	*/
4599
-	public function countAllAirlinesByIdent($ident,$filters = array())
4599
+	public function countAllAirlinesByIdent($ident, $filters = array())
4600 4600
 	{
4601
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
4602
-		$filter_query = $this->getFilter($filters,true,true);
4603
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4601
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
4602
+		$filter_query = $this->getFilter($filters, true, true);
4603
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4604 4604
 		 		FROM spotter_output".$filter_query." spotter_output.ident = :ident  
4605 4605
 				GROUP BY spotter_output.airline_icao, spotter_output.airline_name, spotter_output.airline_country
4606 4606
 				ORDER BY airline_count DESC";
@@ -4617,11 +4617,11 @@  discard block
 block discarded – undo
4617 4617
 	* @return Array the airline list
4618 4618
 	*
4619 4619
 	*/
4620
-	public function countAllAirlinesByOwner($owner,$filters = array())
4620
+	public function countAllAirlinesByOwner($owner, $filters = array())
4621 4621
 	{
4622
-		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
4623
-		$filter_query = $this->getFilter($filters,true,true);
4624
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4622
+		$owner = filter_var($owner, FILTER_SANITIZE_STRING);
4623
+		$filter_query = $this->getFilter($filters, true, true);
4624
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4625 4625
 		 		FROM spotter_output".$filter_query." spotter_output.owner_name = :owner  
4626 4626
 				GROUP BY spotter_output.airline_icao, spotter_output.airline_name, spotter_output.airline_country
4627 4627
 				ORDER BY airline_count DESC";
@@ -4638,47 +4638,47 @@  discard block
 block discarded – undo
4638 4638
 	* @return String Duration of all flights
4639 4639
 	*
4640 4640
 	*/
4641
-	public function getFlightDurationByOwner($owner,$filters = array(),$year = '',$month = '',$day = '')
4641
+	public function getFlightDurationByOwner($owner, $filters = array(), $year = '', $month = '', $day = '')
4642 4642
 	{
4643 4643
 		global $globalDBdriver;
4644
-		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
4645
-		$filter_query = $this->getFilter($filters,true,true);
4646
-		$query  = "SELECT SUM(last_seen - date) AS duration 
4644
+		$owner = filter_var($owner, FILTER_SANITIZE_STRING);
4645
+		$filter_query = $this->getFilter($filters, true, true);
4646
+		$query = "SELECT SUM(last_seen - date) AS duration 
4647 4647
 				FROM spotter_output".$filter_query." spotter_output.owner_name = :owner 
4648 4648
 				AND last_seen > date";
4649 4649
 		$query_values = array();
4650 4650
 		if ($year != '') {
4651 4651
 			if ($globalDBdriver == 'mysql') {
4652 4652
 				$query .= " AND YEAR(spotter_output.date) = :year";
4653
-				$query_values = array_merge($query_values,array(':year' => $year));
4653
+				$query_values = array_merge($query_values, array(':year' => $year));
4654 4654
 			} else {
4655 4655
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
4656
-				$query_values = array_merge($query_values,array(':year' => $year));
4656
+				$query_values = array_merge($query_values, array(':year' => $year));
4657 4657
 			}
4658 4658
 		}
4659 4659
 		if ($month != '') {
4660 4660
 			if ($globalDBdriver == 'mysql') {
4661 4661
 				$query .= " AND MONTH(spotter_output.date) = :month";
4662
-				$query_values = array_merge($query_values,array(':month' => $month));
4662
+				$query_values = array_merge($query_values, array(':month' => $month));
4663 4663
 			} else {
4664 4664
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
4665
-				$query_values = array_merge($query_values,array(':month' => $month));
4665
+				$query_values = array_merge($query_values, array(':month' => $month));
4666 4666
 			}
4667 4667
 		}
4668 4668
 		if ($day != '') {
4669 4669
 			if ($globalDBdriver == 'mysql') {
4670 4670
 				$query .= " AND DAY(spotter_output.date) = :day";
4671
-				$query_values = array_merge($query_values,array(':day' => $day));
4671
+				$query_values = array_merge($query_values, array(':day' => $day));
4672 4672
 			} else {
4673 4673
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
4674
-				$query_values = array_merge($query_values,array(':day' => $day));
4674
+				$query_values = array_merge($query_values, array(':day' => $day));
4675 4675
 			}
4676 4676
 		}
4677
-		$query_values = array_merge($query_values,array(':owner' => $owner));
4677
+		$query_values = array_merge($query_values, array(':owner' => $owner));
4678 4678
 		$sth = $this->db->prepare($query);
4679 4679
 		$sth->execute($query_values);
4680 4680
 		$result = $sth->fetchAll(PDO::FETCH_ASSOC);
4681
-		if (is_numeric($result[0]['duration'])) return gmdate('H:i:s',$result[0]['duration']);
4681
+		if (is_numeric($result[0]['duration'])) return gmdate('H:i:s', $result[0]['duration']);
4682 4682
 		elseif ($result[0]['duration'] == '') return 0;
4683 4683
 		else return $result[0]['duration'];
4684 4684
 	}
@@ -4689,14 +4689,14 @@  discard block
 block discarded – undo
4689 4689
 	* @return String Duration of all flights
4690 4690
 	*
4691 4691
 	*/
4692
-	public function countFlightsByOwner($owner,$filters = array())
4692
+	public function countFlightsByOwner($owner, $filters = array())
4693 4693
 	{
4694
-		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
4695
-		$filter_query = $this->getFilter($filters,true,true);
4696
-		$query  = "SELECT COUNT(*) AS nb 
4694
+		$owner = filter_var($owner, FILTER_SANITIZE_STRING);
4695
+		$filter_query = $this->getFilter($filters, true, true);
4696
+		$query = "SELECT COUNT(*) AS nb 
4697 4697
 				FROM spotter_output".$filter_query." spotter_output.owner_name = :owner";
4698 4698
 		$query_values = array();
4699
-		$query_values = array_merge($query_values,array(':owner' => $owner));
4699
+		$query_values = array_merge($query_values, array(':owner' => $owner));
4700 4700
 		$sth = $this->db->prepare($query);
4701 4701
 		$sth->execute($query_values);
4702 4702
 		$result = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -4709,14 +4709,14 @@  discard block
 block discarded – undo
4709 4709
 	* @return String Duration of all flights
4710 4710
 	*
4711 4711
 	*/
4712
-	public function countFlightsByPilot($pilot,$filters = array())
4712
+	public function countFlightsByPilot($pilot, $filters = array())
4713 4713
 	{
4714
-		$pilot = filter_var($pilot,FILTER_SANITIZE_STRING);
4715
-		$filter_query = $this->getFilter($filters,true,true);
4716
-		$query  = "SELECT COUNT(*) AS nb 
4714
+		$pilot = filter_var($pilot, FILTER_SANITIZE_STRING);
4715
+		$filter_query = $this->getFilter($filters, true, true);
4716
+		$query = "SELECT COUNT(*) AS nb 
4717 4717
 				FROM spotter_output".$filter_query." (spotter_output.pilot_name = :pilot OR spotter_output.pilod_id = :pilot)";
4718 4718
 		$query_values = array();
4719
-		$query_values = array_merge($query_values,array(':pilot' => $pilot));
4719
+		$query_values = array_merge($query_values, array(':pilot' => $pilot));
4720 4720
 		$sth = $this->db->prepare($query);
4721 4721
 		$sth->execute($query_values);
4722 4722
 		$result = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -4729,47 +4729,47 @@  discard block
 block discarded – undo
4729 4729
 	* @return String Duration of all flights
4730 4730
 	*
4731 4731
 	*/
4732
-	public function getFlightDurationByPilot($pilot,$filters = array(),$year = '',$month = '',$day = '')
4732
+	public function getFlightDurationByPilot($pilot, $filters = array(), $year = '', $month = '', $day = '')
4733 4733
 	{
4734 4734
 		global $globalDBdriver;
4735
-		$pilot = filter_var($pilot,FILTER_SANITIZE_STRING);
4736
-		$filter_query = $this->getFilter($filters,true,true);
4737
-		$query  = "SELECT SUM(last_seen - date) AS duration 
4735
+		$pilot = filter_var($pilot, FILTER_SANITIZE_STRING);
4736
+		$filter_query = $this->getFilter($filters, true, true);
4737
+		$query = "SELECT SUM(last_seen - date) AS duration 
4738 4738
 		 		FROM spotter_output".$filter_query." (spotter_output.pilot_name = :pilot OR spotter_output.pilot_id = :pilot) 
4739 4739
 		 		AND last_seen > date";
4740 4740
 		$query_values = array();
4741 4741
 		if ($year != '') {
4742 4742
 			if ($globalDBdriver == 'mysql') {
4743 4743
 				$query .= " AND YEAR(spotter_output.date) = :year";
4744
-				$query_values = array_merge($query_values,array(':year' => $year));
4744
+				$query_values = array_merge($query_values, array(':year' => $year));
4745 4745
 			} else {
4746 4746
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
4747
-				$query_values = array_merge($query_values,array(':year' => $year));
4747
+				$query_values = array_merge($query_values, array(':year' => $year));
4748 4748
 			}
4749 4749
 		}
4750 4750
 		if ($month != '') {
4751 4751
 			if ($globalDBdriver == 'mysql') {
4752 4752
 				$query .= " AND MONTH(spotter_output.date) = :month";
4753
-				$query_values = array_merge($query_values,array(':month' => $month));
4753
+				$query_values = array_merge($query_values, array(':month' => $month));
4754 4754
 			} else {
4755 4755
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
4756
-				$query_values = array_merge($query_values,array(':month' => $month));
4756
+				$query_values = array_merge($query_values, array(':month' => $month));
4757 4757
 			}
4758 4758
 		}
4759 4759
 		if ($day != '') {
4760 4760
 			if ($globalDBdriver == 'mysql') {
4761 4761
 				$query .= " AND DAY(spotter_output.date) = :day";
4762
-				$query_values = array_merge($query_values,array(':day' => $day));
4762
+				$query_values = array_merge($query_values, array(':day' => $day));
4763 4763
 			} else {
4764 4764
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
4765
-				$query_values = array_merge($query_values,array(':day' => $day));
4765
+				$query_values = array_merge($query_values, array(':day' => $day));
4766 4766
 			}
4767 4767
 		}
4768
-		$query_values = array_merge($query_values,array(':pilot' => $pilot));
4768
+		$query_values = array_merge($query_values, array(':pilot' => $pilot));
4769 4769
 		$sth = $this->db->prepare($query);
4770 4770
 		$sth->execute($query_values);
4771 4771
 		$result = $sth->fetchAll(PDO::FETCH_ASSOC);
4772
-		if (is_int($result[0]['duration'])) return gmdate('H:i:s',$result[0]['duration']);
4772
+		if (is_int($result[0]['duration'])) return gmdate('H:i:s', $result[0]['duration']);
4773 4773
 		else return $result[0]['duration'];
4774 4774
 	}
4775 4775
 
@@ -4779,11 +4779,11 @@  discard block
 block discarded – undo
4779 4779
 	* @return Array the airline list
4780 4780
 	*
4781 4781
 	*/
4782
-	public function countAllAirlinesByPilot($pilot,$filters = array())
4782
+	public function countAllAirlinesByPilot($pilot, $filters = array())
4783 4783
 	{
4784
-		$pilot = filter_var($pilot,FILTER_SANITIZE_STRING);
4785
-		$filter_query = $this->getFilter($filters,true,true);
4786
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4784
+		$pilot = filter_var($pilot, FILTER_SANITIZE_STRING);
4785
+		$filter_query = $this->getFilter($filters, true, true);
4786
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4787 4787
 		 		FROM spotter_output".$filter_query." (spotter_output.pilot_name = :pilot OR spotter_output.pilot_id = :pilot) 
4788 4788
 				GROUP BY spotter_output.airline_icao, spotter_output.airline_name, spotter_output.airline_country
4789 4789
 				ORDER BY airline_count DESC";
@@ -4800,25 +4800,25 @@  discard block
 block discarded – undo
4800 4800
 	* @return Array the airline list
4801 4801
 	*
4802 4802
 	*/
4803
-	public function countAllAirlinesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
4803
+	public function countAllAirlinesByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array())
4804 4804
 	{
4805
-		$filter_query = $this->getFilter($filters,true,true);
4806
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
4807
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
4805
+		$filter_query = $this->getFilter($filters, true, true);
4806
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
4807
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
4808 4808
 
4809
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4809
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4810 4810
 		 			FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao) 
4811 4811
 					GROUP BY spotter_output.airline_name
4812 4812
 					ORDER BY airline_count DESC";
4813 4813
       
4814 4814
 		
4815 4815
 		$sth = $this->db->prepare($query);
4816
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao));
4816
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao));
4817 4817
       
4818 4818
 		$airline_array = array();
4819 4819
 		$temp_array = array();
4820 4820
         
4821
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4821
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4822 4822
 		{
4823 4823
 			$temp_array['airline_name'] = $row['airline_name'];
4824 4824
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4836,13 +4836,13 @@  discard block
 block discarded – undo
4836 4836
 	* @return Array the airline country list
4837 4837
 	*
4838 4838
 	*/
4839
-	public function countAllAirlineCountriesByRoute($departure_airport_icao, $arrival_airport_icao,$filters= array())
4839
+	public function countAllAirlineCountriesByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array())
4840 4840
 	{
4841
-		$filter_query = $this->getFilter($filters,true,true);
4842
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
4843
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
4841
+		$filter_query = $this->getFilter($filters, true, true);
4842
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
4843
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
4844 4844
       
4845
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4845
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4846 4846
 		 		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) 
4847 4847
 				GROUP BY spotter_output.airline_country
4848 4848
 				ORDER BY airline_country_count DESC
@@ -4850,11 +4850,11 @@  discard block
 block discarded – undo
4850 4850
       
4851 4851
 		
4852 4852
 		$sth = $this->db->prepare($query);
4853
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao));
4853
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao));
4854 4854
       
4855 4855
 		$airline_country_array = array();
4856 4856
 		$temp_array = array();
4857
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4857
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4858 4858
 		{
4859 4859
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4860 4860
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4872,11 +4872,11 @@  discard block
 block discarded – undo
4872 4872
 	* @return Array the airline list
4873 4873
 	*
4874 4874
 	*/
4875
-	public function countAllAirlinesByCountry($country,$filters = array())
4875
+	public function countAllAirlinesByCountry($country, $filters = array())
4876 4876
 	{
4877
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
4878
-		$filter_query = $this->getFilter($filters,true,true);
4879
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4877
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
4878
+		$filter_query = $this->getFilter($filters, true, true);
4879
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4880 4880
 		 	    FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country  
4881 4881
 			    GROUP BY spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country 
4882 4882
 			    ORDER BY airline_count DESC";
@@ -4887,7 +4887,7 @@  discard block
 block discarded – undo
4887 4887
 
4888 4888
 		$airline_array = array();
4889 4889
 		$temp_array = array();
4890
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4890
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4891 4891
 		{
4892 4892
 			$temp_array['airline_name'] = $row['airline_name'];
4893 4893
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4906,11 +4906,11 @@  discard block
 block discarded – undo
4906 4906
 	* @return Array the airline country list
4907 4907
 	*
4908 4908
 	*/
4909
-	public function countAllAirlineCountriesByCountry($country,$filters = array())
4909
+	public function countAllAirlineCountriesByCountry($country, $filters = array())
4910 4910
 	{
4911
-		$filter_query = $this->getFilter($filters,true,true);
4912
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
4913
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4911
+		$filter_query = $this->getFilter($filters, true, true);
4912
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
4913
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4914 4914
 		 		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 
4915 4915
 				GROUP BY spotter_output.airline_country
4916 4916
 				ORDER BY airline_country_count DESC
@@ -4922,7 +4922,7 @@  discard block
 block discarded – undo
4922 4922
 
4923 4923
 		$airline_country_array = array();
4924 4924
 		$temp_array = array();
4925
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4925
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4926 4926
 		{
4927 4927
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4928 4928
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4942,35 +4942,35 @@  discard block
 block discarded – undo
4942 4942
 	public function countAllAirlineCountries($limit = true, $filters = array(), $year = '', $month = '', $day = '')
4943 4943
 	{
4944 4944
 		global $globalDBdriver;
4945
-		$filter_query = $this->getFilter($filters,true,true);
4946
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4945
+		$filter_query = $this->getFilter($filters, true, true);
4946
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4947 4947
 		 			FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND spotter_output.airline_country <> 'NA'";
4948 4948
 		$query_values = array();
4949 4949
 		if ($year != '') {
4950 4950
 			if ($globalDBdriver == 'mysql') {
4951 4951
 				$query .= " AND YEAR(spotter_output.date) = :year";
4952
-				$query_values = array_merge($query_values,array(':year' => $year));
4952
+				$query_values = array_merge($query_values, array(':year' => $year));
4953 4953
 			} else {
4954 4954
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
4955
-				$query_values = array_merge($query_values,array(':year' => $year));
4955
+				$query_values = array_merge($query_values, array(':year' => $year));
4956 4956
 			}
4957 4957
 		}
4958 4958
 		if ($month != '') {
4959 4959
 			if ($globalDBdriver == 'mysql') {
4960 4960
 				$query .= " AND MONTH(spotter_output.date) = :month";
4961
-				$query_values = array_merge($query_values,array(':month' => $month));
4961
+				$query_values = array_merge($query_values, array(':month' => $month));
4962 4962
 			} else {
4963 4963
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
4964
-				$query_values = array_merge($query_values,array(':month' => $month));
4964
+				$query_values = array_merge($query_values, array(':month' => $month));
4965 4965
 			}
4966 4966
 		}
4967 4967
 		if ($day != '') {
4968 4968
 			if ($globalDBdriver == 'mysql') {
4969 4969
 				$query .= " AND DAY(spotter_output.date) = :day";
4970
-				$query_values = array_merge($query_values,array(':day' => $day));
4970
+				$query_values = array_merge($query_values, array(':day' => $day));
4971 4971
 			} else {
4972 4972
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
4973
-				$query_values = array_merge($query_values,array(':day' => $day));
4973
+				$query_values = array_merge($query_values, array(':day' => $day));
4974 4974
 			}
4975 4975
 		}
4976 4976
 		$query .= " GROUP BY spotter_output.airline_country
@@ -4982,7 +4982,7 @@  discard block
 block discarded – undo
4982 4982
 
4983 4983
 		$airline_array = array();
4984 4984
 		$temp_array = array();
4985
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4985
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4986 4986
 		{
4987 4987
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4988 4988
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4998,11 +4998,11 @@  discard block
 block discarded – undo
4998 4998
 	* @return Array the airline country list
4999 4999
 	*
5000 5000
 	*/
5001
-	public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
5001
+	public function countAllFlightOverCountries($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
5002 5002
 	{
5003 5003
 		global $globalDBdriver;
5004 5004
 		//$filter_query = $this->getFilter($filters,true,true);
5005
-		$Connection= new Connection($this->db);
5005
+		$Connection = new Connection($this->db);
5006 5006
 		if (!$Connection->tableExists('countries')) return array();
5007 5007
 		/*
5008 5008
 		$query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb 
@@ -5017,7 +5017,7 @@  discard block
 block discarded – undo
5017 5017
 */
5018 5018
 		require_once('class.SpotterLive.php');
5019 5019
 		$SpotterLive = new SpotterLive();
5020
-		$filter_query = $SpotterLive->getFilter($filters,true,true);
5020
+		$filter_query = $SpotterLive->getFilter($filters, true, true);
5021 5021
 		$filter_query .= ' over_country IS NOT NULL';
5022 5022
                 if ($olderthanmonths > 0) {
5023 5023
 			if ($globalDBdriver == 'mysql') {
@@ -5044,7 +5044,7 @@  discard block
 block discarded – undo
5044 5044
 		$flight_array = array();
5045 5045
 		$temp_array = array();
5046 5046
         
5047
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5047
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5048 5048
 		{
5049 5049
 			$temp_array['flight_count'] = $row['nb'];
5050 5050
 			$temp_array['flight_country'] = $row['name'];
@@ -5062,11 +5062,11 @@  discard block
 block discarded – undo
5062 5062
 	* @return Array the aircraft list
5063 5063
 	*
5064 5064
 	*/
5065
-	public function countAllAircraftTypes($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '',$month = '',$day = '')
5065
+	public function countAllAircraftTypes($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '')
5066 5066
 	{
5067 5067
 		global $globalDBdriver;
5068
-		$filter_query = $this->getFilter($filters,true,true);
5069
-		$query  = "SELECT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer 
5068
+		$filter_query = $this->getFilter($filters, true, true);
5069
+		$query = "SELECT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer 
5070 5070
 		    FROM spotter_output ".$filter_query." spotter_output.aircraft_name  <> '' AND spotter_output.aircraft_icao  <> ''";
5071 5071
 		if ($olderthanmonths > 0) {
5072 5072
 			if ($globalDBdriver == 'mysql') {
@@ -5086,28 +5086,28 @@  discard block
 block discarded – undo
5086 5086
 		if ($year != '') {
5087 5087
 			if ($globalDBdriver == 'mysql') {
5088 5088
 				$query .= " AND YEAR(spotter_output.date) = :year";
5089
-				$query_values = array_merge($query_values,array(':year' => $year));
5089
+				$query_values = array_merge($query_values, array(':year' => $year));
5090 5090
 			} else {
5091 5091
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
5092
-				$query_values = array_merge($query_values,array(':year' => $year));
5092
+				$query_values = array_merge($query_values, array(':year' => $year));
5093 5093
 			}
5094 5094
 		}
5095 5095
 		if ($month != '') {
5096 5096
 			if ($globalDBdriver == 'mysql') {
5097 5097
 				$query .= " AND MONTH(spotter_output.date) = :month";
5098
-				$query_values = array_merge($query_values,array(':month' => $month));
5098
+				$query_values = array_merge($query_values, array(':month' => $month));
5099 5099
 			} else {
5100 5100
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
5101
-				$query_values = array_merge($query_values,array(':month' => $month));
5101
+				$query_values = array_merge($query_values, array(':month' => $month));
5102 5102
 			}
5103 5103
 		}
5104 5104
 		if ($day != '') {
5105 5105
 			if ($globalDBdriver == 'mysql') {
5106 5106
 				$query .= " AND DAY(spotter_output.date) = :day";
5107
-				$query_values = array_merge($query_values,array(':day' => $day));
5107
+				$query_values = array_merge($query_values, array(':day' => $day));
5108 5108
 			} else {
5109 5109
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
5110
-				$query_values = array_merge($query_values,array(':day' => $day));
5110
+				$query_values = array_merge($query_values, array(':day' => $day));
5111 5111
 			}
5112 5112
 		}
5113 5113
 
@@ -5119,7 +5119,7 @@  discard block
 block discarded – undo
5119 5119
 
5120 5120
 		$aircraft_array = array();
5121 5121
 		$temp_array = array();
5122
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5122
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5123 5123
 		{
5124 5124
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5125 5125
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -5136,11 +5136,11 @@  discard block
 block discarded – undo
5136 5136
 	* @return Array the aircraft list
5137 5137
 	*
5138 5138
 	*/
5139
-	public function countAllAircraftTypesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '',$month = '', $day = '')
5139
+	public function countAllAircraftTypesByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '')
5140 5140
 	{
5141 5141
 		global $globalDBdriver;
5142
-		$filter_query = $this->getFilter($filters,true,true);
5143
-		$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 
5142
+		$filter_query = $this->getFilter($filters, true, true);
5143
+		$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 
5144 5144
 		    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'";
5145 5145
 		if ($olderthanmonths > 0) {
5146 5146
 			if ($globalDBdriver == 'mysql') {
@@ -5160,28 +5160,28 @@  discard block
 block discarded – undo
5160 5160
 		if ($year != '') {
5161 5161
 			if ($globalDBdriver == 'mysql') {
5162 5162
 				$query .= " AND YEAR(spotter_output.date) = :year";
5163
-				$query_values = array_merge($query_values,array(':year' => $year));
5163
+				$query_values = array_merge($query_values, array(':year' => $year));
5164 5164
 			} else {
5165 5165
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
5166
-				$query_values = array_merge($query_values,array(':year' => $year));
5166
+				$query_values = array_merge($query_values, array(':year' => $year));
5167 5167
 			}
5168 5168
 		}
5169 5169
 		if ($month != '') {
5170 5170
 			if ($globalDBdriver == 'mysql') {
5171 5171
 				$query .= " AND MONTH(spotter_output.date) = :month";
5172
-				$query_values = array_merge($query_values,array(':month' => $month));
5172
+				$query_values = array_merge($query_values, array(':month' => $month));
5173 5173
 			} else {
5174 5174
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
5175
-				$query_values = array_merge($query_values,array(':month' => $month));
5175
+				$query_values = array_merge($query_values, array(':month' => $month));
5176 5176
 			}
5177 5177
 		}
5178 5178
 		if ($day != '') {
5179 5179
 			if ($globalDBdriver == 'mysql') {
5180 5180
 				$query .= " AND DAY(spotter_output.date) = :day";
5181
-				$query_values = array_merge($query_values,array(':day' => $day));
5181
+				$query_values = array_merge($query_values, array(':day' => $day));
5182 5182
 			} else {
5183 5183
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
5184
-				$query_values = array_merge($query_values,array(':day' => $day));
5184
+				$query_values = array_merge($query_values, array(':day' => $day));
5185 5185
 			}
5186 5186
 		}
5187 5187
 
@@ -5193,7 +5193,7 @@  discard block
 block discarded – undo
5193 5193
 
5194 5194
 		$aircraft_array = array();
5195 5195
 		$temp_array = array();
5196
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5196
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5197 5197
 		{
5198 5198
 			$temp_array['airline_icao'] = $row['airline_icao'];
5199 5199
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
@@ -5211,11 +5211,11 @@  discard block
 block discarded – undo
5211 5211
 	* @return Array the aircraft list
5212 5212
 	*
5213 5213
 	*/
5214
-	public function countAllAircraftTypesByMonths($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
5214
+	public function countAllAircraftTypesByMonths($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
5215 5215
 	{
5216 5216
 		global $globalDBdriver;
5217
-		$filter_query = $this->getFilter($filters,true,true);
5218
-		$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 
5217
+		$filter_query = $this->getFilter($filters, true, true);
5218
+		$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 
5219 5219
 		    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' ";
5220 5220
 		if ($olderthanmonths > 0) {
5221 5221
 			if ($globalDBdriver == 'mysql') {
@@ -5240,7 +5240,7 @@  discard block
 block discarded – undo
5240 5240
 
5241 5241
 		$aircraft_array = array();
5242 5242
 		$temp_array = array();
5243
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5243
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5244 5244
 		{
5245 5245
 			//$temp_array['airline_icao'] = $row['airline_icao'];
5246 5246
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
@@ -5259,13 +5259,13 @@  discard block
 block discarded – undo
5259 5259
 	* @return Array the aircraft list
5260 5260
 	*
5261 5261
 	*/
5262
-	public function countAllAircraftRegistrationByAircraft($aircraft_icao,$filters = array())
5262
+	public function countAllAircraftRegistrationByAircraft($aircraft_icao, $filters = array())
5263 5263
 	{
5264 5264
 		$Image = new Image($this->db);
5265
-		$filter_query = $this->getFilter($filters,true,true);
5266
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
5265
+		$filter_query = $this->getFilter($filters, true, true);
5266
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
5267 5267
 
5268
-		$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  
5268
+		$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  
5269 5269
 				FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.aircraft_icao = :aircraft_icao  
5270 5270
 				GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name  
5271 5271
 				ORDER BY registration_count DESC";
@@ -5276,14 +5276,14 @@  discard block
 block discarded – undo
5276 5276
 		$aircraft_array = array();
5277 5277
 		$temp_array = array();
5278 5278
         
5279
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5279
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5280 5280
 		{
5281 5281
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5282 5282
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5283 5283
 			$temp_array['registration'] = $row['registration'];
5284 5284
 			$temp_array['airline_name'] = $row['airline_name'];
5285 5285
 			$temp_array['image_thumbnail'] = "";
5286
-			if($row['registration'] != "")
5286
+			if ($row['registration'] != "")
5287 5287
 			{
5288 5288
 				$image_array = $Image->getSpotterImage($row['registration']);
5289 5289
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5302,11 +5302,11 @@  discard block
 block discarded – undo
5302 5302
 	* @return Array the aircraft list
5303 5303
 	*
5304 5304
 	*/
5305
-	public function countAllAircraftTypesByAirline($airline_icao,$filters = array())
5305
+	public function countAllAircraftTypesByAirline($airline_icao, $filters = array())
5306 5306
 	{
5307
-		$filter_query = $this->getFilter($filters,true,true);
5308
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
5309
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5307
+		$filter_query = $this->getFilter($filters, true, true);
5308
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
5309
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5310 5310
 			    FROM spotter_output".$filter_query." spotter_output.aircraft_icao <> '' AND spotter_output.airline_icao = :airline_icao 
5311 5311
 			    GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao 
5312 5312
 			    ORDER BY aircraft_icao_count DESC";
@@ -5317,7 +5317,7 @@  discard block
 block discarded – undo
5317 5317
 		$aircraft_array = array();
5318 5318
 		$temp_array = array();
5319 5319
 
5320
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5320
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5321 5321
 		{
5322 5322
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5323 5323
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -5335,13 +5335,13 @@  discard block
 block discarded – undo
5335 5335
 	* @return Array the aircraft list
5336 5336
 	*
5337 5337
 	*/
5338
-	public function countAllAircraftRegistrationByAirline($airline_icao,$filters = array())
5338
+	public function countAllAircraftRegistrationByAirline($airline_icao, $filters = array())
5339 5339
 	{
5340
-		$filter_query = $this->getFilter($filters,true,true);
5340
+		$filter_query = $this->getFilter($filters, true, true);
5341 5341
 		$Image = new Image($this->db);
5342
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
5342
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
5343 5343
 
5344
-		$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 
5344
+		$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 
5345 5345
 			    FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.airline_icao = :airline_icao 
5346 5346
 			    GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name
5347 5347
 			    ORDER BY registration_count DESC";
@@ -5351,14 +5351,14 @@  discard block
 block discarded – undo
5351 5351
 
5352 5352
 		$aircraft_array = array();
5353 5353
 		$temp_array = array();
5354
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5354
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5355 5355
 		{
5356 5356
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5357 5357
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5358 5358
 			$temp_array['registration'] = $row['registration'];
5359 5359
 			$temp_array['airline_name'] = $row['airline_name'];
5360 5360
 			$temp_array['image_thumbnail'] = "";
5361
-			if($row['registration'] != "")
5361
+			if ($row['registration'] != "")
5362 5362
 			{
5363 5363
 				$image_array = $Image->getSpotterImage($row['registration']);
5364 5364
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5377,11 +5377,11 @@  discard block
 block discarded – undo
5377 5377
 	* @return Array the aircraft list
5378 5378
 	*
5379 5379
 	*/
5380
-	public function countAllAircraftManufacturerByAirline($airline_icao,$filters = array())
5380
+	public function countAllAircraftManufacturerByAirline($airline_icao, $filters = array())
5381 5381
 	{
5382
-		$filter_query = $this->getFilter($filters,true,true);
5383
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
5384
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5382
+		$filter_query = $this->getFilter($filters, true, true);
5383
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
5384
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5385 5385
 				FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.airline_icao = :airline_icao 
5386 5386
 				GROUP BY spotter_output.aircraft_manufacturer 
5387 5387
 				ORDER BY aircraft_manufacturer_count DESC";
@@ -5392,7 +5392,7 @@  discard block
 block discarded – undo
5392 5392
 		$aircraft_array = array();
5393 5393
 		$temp_array = array();
5394 5394
 
5395
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5395
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5396 5396
 		{
5397 5397
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
5398 5398
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -5409,12 +5409,12 @@  discard block
 block discarded – undo
5409 5409
 	* @return Array the aircraft list
5410 5410
 	*
5411 5411
 	*/
5412
-	public function countAllAircraftTypesByAirport($airport_icao,$filters = array())
5412
+	public function countAllAircraftTypesByAirport($airport_icao, $filters = array())
5413 5413
 	{
5414
-		$filter_query = $this->getFilter($filters,true,true);
5415
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
5414
+		$filter_query = $this->getFilter($filters, true, true);
5415
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
5416 5416
 
5417
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5417
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5418 5418
 				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) 
5419 5419
 				GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao 
5420 5420
 				ORDER BY aircraft_icao_count DESC";
@@ -5424,7 +5424,7 @@  discard block
 block discarded – undo
5424 5424
 
5425 5425
 		$aircraft_array = array();
5426 5426
 		$temp_array = array();
5427
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5427
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5428 5428
 		{
5429 5429
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5430 5430
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -5442,13 +5442,13 @@  discard block
 block discarded – undo
5442 5442
 	* @return Array the aircraft list
5443 5443
 	*
5444 5444
 	*/
5445
-	public function countAllAircraftRegistrationByAirport($airport_icao,$filters = array())
5445
+	public function countAllAircraftRegistrationByAirport($airport_icao, $filters = array())
5446 5446
 	{
5447
-		$filter_query = $this->getFilter($filters,true,true);
5447
+		$filter_query = $this->getFilter($filters, true, true);
5448 5448
 		$Image = new Image($this->db);
5449
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
5449
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
5450 5450
 
5451
-		$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  
5451
+		$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  
5452 5452
                     FROM spotter_output".$filter_query." spotter_output.registration <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao)   
5453 5453
                     GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name 
5454 5454
 		    ORDER BY registration_count DESC";
@@ -5458,14 +5458,14 @@  discard block
 block discarded – undo
5458 5458
 
5459 5459
 		$aircraft_array = array();
5460 5460
 		$temp_array = array();
5461
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5461
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5462 5462
 		{
5463 5463
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5464 5464
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5465 5465
 			$temp_array['registration'] = $row['registration'];
5466 5466
 			$temp_array['airline_name'] = $row['airline_name'];
5467 5467
 			$temp_array['image_thumbnail'] = "";
5468
-			if($row['registration'] != "")
5468
+			if ($row['registration'] != "")
5469 5469
 			{
5470 5470
 				$image_array = $Image->getSpotterImage($row['registration']);
5471 5471
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5483,11 +5483,11 @@  discard block
 block discarded – undo
5483 5483
 	* @return Array the aircraft list
5484 5484
 	*
5485 5485
 	*/
5486
-	public function countAllAircraftManufacturerByAirport($airport_icao,$filters = array())
5486
+	public function countAllAircraftManufacturerByAirport($airport_icao, $filters = array())
5487 5487
 	{
5488
-		$filter_query = $this->getFilter($filters,true,true);
5489
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
5490
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5488
+		$filter_query = $this->getFilter($filters, true, true);
5489
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
5490
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5491 5491
                     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)  
5492 5492
                     GROUP BY spotter_output.aircraft_manufacturer 
5493 5493
 					ORDER BY aircraft_manufacturer_count DESC";
@@ -5498,7 +5498,7 @@  discard block
 block discarded – undo
5498 5498
 
5499 5499
 		$aircraft_array = array();
5500 5500
 		$temp_array = array();
5501
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5501
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5502 5502
 		{
5503 5503
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
5504 5504
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -5513,12 +5513,12 @@  discard block
 block discarded – undo
5513 5513
 	* @return Array the aircraft list
5514 5514
 	*
5515 5515
 	*/
5516
-	public function countAllAircraftTypesByManufacturer($aircraft_manufacturer,$filters = array())
5516
+	public function countAllAircraftTypesByManufacturer($aircraft_manufacturer, $filters = array())
5517 5517
 	{
5518
-		$filter_query = $this->getFilter($filters,true,true);
5519
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
5518
+		$filter_query = $this->getFilter($filters, true, true);
5519
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
5520 5520
 
5521
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5521
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5522 5522
                     FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer = :aircraft_manufacturer
5523 5523
                     GROUP BY spotter_output.aircraft_name 
5524 5524
 					ORDER BY aircraft_icao_count DESC";
@@ -5527,7 +5527,7 @@  discard block
 block discarded – undo
5527 5527
 		$sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer));
5528 5528
 		$aircraft_array = array();
5529 5529
 		$temp_array = array();
5530
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5530
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5531 5531
 		{
5532 5532
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5533 5533
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -5546,11 +5546,11 @@  discard block
 block discarded – undo
5546 5546
 	*/
5547 5547
 	public function countAllAircraftRegistrationByManufacturer($aircraft_manufacturer, $filters = array())
5548 5548
 	{
5549
-		$filter_query = $this->getFilter($filters,true,true);
5549
+		$filter_query = $this->getFilter($filters, true, true);
5550 5550
 		$Image = new Image($this->db);
5551
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
5551
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
5552 5552
 
5553
-		$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   
5553
+		$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   
5554 5554
                     FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer   
5555 5555
                     GROUP BY spotter_output.registration 
5556 5556
 					ORDER BY registration_count DESC";
@@ -5560,14 +5560,14 @@  discard block
 block discarded – undo
5560 5560
 		$sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer));
5561 5561
 		$aircraft_array = array();
5562 5562
 		$temp_array = array();
5563
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5563
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5564 5564
 		{
5565 5565
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5566 5566
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5567 5567
 			$temp_array['registration'] = $row['registration'];
5568 5568
 			$temp_array['airline_name'] = $row['airline_name'];
5569 5569
 			$temp_array['image_thumbnail'] = "";
5570
-			if($row['registration'] != "")
5570
+			if ($row['registration'] != "")
5571 5571
 			{
5572 5572
 				$image_array = $Image->getSpotterImage($row['registration']);
5573 5573
 				$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5584,11 +5584,11 @@  discard block
 block discarded – undo
5584 5584
 	* @return Array the aircraft list
5585 5585
 	*
5586 5586
 	*/
5587
-	public function countAllAircraftTypesByDate($date,$filters = array())
5587
+	public function countAllAircraftTypesByDate($date, $filters = array())
5588 5588
 	{
5589 5589
 		global $globalTimezone, $globalDBdriver;
5590
-		$filter_query = $this->getFilter($filters,true,true);
5591
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
5590
+		$filter_query = $this->getFilter($filters, true, true);
5591
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
5592 5592
 		if ($globalTimezone != '') {
5593 5593
 			date_default_timezone_set($globalTimezone);
5594 5594
 			$datetime = new DateTime($date);
@@ -5596,12 +5596,12 @@  discard block
 block discarded – undo
5596 5596
 		} else $offset = '+00:00';
5597 5597
 
5598 5598
 		if ($globalDBdriver == 'mysql') {
5599
-			$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5599
+			$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5600 5600
 					FROM spotter_output".$filter_query." DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date
5601 5601
 					GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao 
5602 5602
 					ORDER BY aircraft_icao_count DESC";
5603 5603
 		} else {
5604
-			$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5604
+			$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5605 5605
 					FROM spotter_output".$filter_query." to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date
5606 5606
 					GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao 
5607 5607
 					ORDER BY aircraft_icao_count DESC";
@@ -5612,7 +5612,7 @@  discard block
 block discarded – undo
5612 5612
 
5613 5613
 		$aircraft_array = array();
5614 5614
 		$temp_array = array();
5615
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5615
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5616 5616
 		{
5617 5617
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5618 5618
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -5630,12 +5630,12 @@  discard block
 block discarded – undo
5630 5630
 	* @return Array the aircraft list
5631 5631
 	*
5632 5632
 	*/
5633
-	public function countAllAircraftRegistrationByDate($date,$filters = array())
5633
+	public function countAllAircraftRegistrationByDate($date, $filters = array())
5634 5634
 	{
5635 5635
 		global $globalTimezone, $globalDBdriver;
5636
-		$filter_query = $this->getFilter($filters,true,true);
5636
+		$filter_query = $this->getFilter($filters, true, true);
5637 5637
 		$Image = new Image($this->db);
5638
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
5638
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
5639 5639
 		if ($globalTimezone != '') {
5640 5640
 			date_default_timezone_set($globalTimezone);
5641 5641
 			$datetime = new DateTime($date);
@@ -5643,12 +5643,12 @@  discard block
 block discarded – undo
5643 5643
 		} else $offset = '+00:00';
5644 5644
 
5645 5645
 		if ($globalDBdriver == 'mysql') {
5646
-			$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 
5646
+			$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 
5647 5647
 					FROM spotter_output".$filter_query." spotter_output.registration <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
5648 5648
 					GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name 
5649 5649
 					ORDER BY registration_count DESC";
5650 5650
 		} else {
5651
-			$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    
5651
+			$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    
5652 5652
 					FROM spotter_output".$filter_query." spotter_output.registration <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date 
5653 5653
 					GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name 
5654 5654
 					ORDER BY registration_count DESC";
@@ -5659,14 +5659,14 @@  discard block
 block discarded – undo
5659 5659
 
5660 5660
 		$aircraft_array = array();
5661 5661
 		$temp_array = array();
5662
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5662
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5663 5663
 		{
5664 5664
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5665 5665
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5666 5666
 			$temp_array['registration'] = $row['registration'];
5667 5667
 			$temp_array['airline_name'] = $row['airline_name'];
5668 5668
 			$temp_array['image_thumbnail'] = "";
5669
-			if($row['registration'] != "")
5669
+			if ($row['registration'] != "")
5670 5670
 			{
5671 5671
 				$image_array = $Image->getSpotterImage($row['registration']);
5672 5672
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5685,11 +5685,11 @@  discard block
 block discarded – undo
5685 5685
 	* @return Array the aircraft manufacturer list
5686 5686
 	*
5687 5687
 	*/
5688
-	public function countAllAircraftManufacturerByDate($date,$filters = array())
5688
+	public function countAllAircraftManufacturerByDate($date, $filters = array())
5689 5689
 	{
5690 5690
 		global $globalTimezone, $globalDBdriver;
5691
-		$filter_query = $this->getFilter($filters,true,true);
5692
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
5691
+		$filter_query = $this->getFilter($filters, true, true);
5692
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
5693 5693
 		if ($globalTimezone != '') {
5694 5694
 			date_default_timezone_set($globalTimezone);
5695 5695
 			$datetime = new DateTime($date);
@@ -5697,12 +5697,12 @@  discard block
 block discarded – undo
5697 5697
 		} else $offset = '+00:00';
5698 5698
 
5699 5699
 		if ($globalDBdriver == 'mysql') {
5700
-			$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5700
+			$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5701 5701
 				FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
5702 5702
 				GROUP BY spotter_output.aircraft_manufacturer 
5703 5703
 				ORDER BY aircraft_manufacturer_count DESC";
5704 5704
 		} else {
5705
-			$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5705
+			$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5706 5706
 				FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date 
5707 5707
 				GROUP BY spotter_output.aircraft_manufacturer 
5708 5708
 				ORDER BY aircraft_manufacturer_count DESC";
@@ -5714,7 +5714,7 @@  discard block
 block discarded – undo
5714 5714
 		$aircraft_array = array();
5715 5715
 		$temp_array = array();
5716 5716
 
5717
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5717
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5718 5718
 		{
5719 5719
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
5720 5720
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -5731,11 +5731,11 @@  discard block
 block discarded – undo
5731 5731
 	* @return Array the aircraft list
5732 5732
 	*
5733 5733
 	*/
5734
-	public function countAllAircraftTypesByIdent($ident,$filters = array())
5734
+	public function countAllAircraftTypesByIdent($ident, $filters = array())
5735 5735
 	{
5736
-		$filter_query = $this->getFilter($filters,true,true);
5737
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
5738
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5736
+		$filter_query = $this->getFilter($filters, true, true);
5737
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
5738
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5739 5739
 				FROM spotter_output".$filter_query." spotter_output.ident = :ident 
5740 5740
 				GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao
5741 5741
 				ORDER BY aircraft_icao_count DESC";
@@ -5746,7 +5746,7 @@  discard block
 block discarded – undo
5746 5746
 		$aircraft_array = array();
5747 5747
 		$temp_array = array();
5748 5748
 
5749
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5749
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5750 5750
 		{
5751 5751
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5752 5752
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -5763,45 +5763,45 @@  discard block
 block discarded – undo
5763 5763
 	* @return Array the aircraft list
5764 5764
 	*
5765 5765
 	*/
5766
-	public function countAllAircraftTypesByPilot($pilot,$filters = array(),$year = '',$month = '',$day = '')
5766
+	public function countAllAircraftTypesByPilot($pilot, $filters = array(), $year = '', $month = '', $day = '')
5767 5767
 	{
5768 5768
 		global $globalDBdriver;
5769
-		$filter_query = $this->getFilter($filters,true,true);
5770
-		$pilot = filter_var($pilot,FILTER_SANITIZE_STRING);
5771
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5769
+		$filter_query = $this->getFilter($filters, true, true);
5770
+		$pilot = filter_var($pilot, FILTER_SANITIZE_STRING);
5771
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5772 5772
 				FROM spotter_output".$filter_query." (spotter_output.pilot_id = :pilot OR spotter_output.pilot_name = :pilot)";
5773 5773
 		$query_values = array();
5774 5774
 		if ($year != '') {
5775 5775
 			if ($globalDBdriver == 'mysql') {
5776 5776
 				$query .= " AND YEAR(spotter_output.date) = :year";
5777
-				$query_values = array_merge($query_values,array(':year' => $year));
5777
+				$query_values = array_merge($query_values, array(':year' => $year));
5778 5778
 			} else {
5779 5779
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
5780
-				$query_values = array_merge($query_values,array(':year' => $year));
5780
+				$query_values = array_merge($query_values, array(':year' => $year));
5781 5781
 			}
5782 5782
 		}
5783 5783
 		if ($month != '') {
5784 5784
 			if ($globalDBdriver == 'mysql') {
5785 5785
 				$query .= " AND MONTH(spotter_output.date) = :month";
5786
-				$query_values = array_merge($query_values,array(':month' => $month));
5786
+				$query_values = array_merge($query_values, array(':month' => $month));
5787 5787
 			} else {
5788 5788
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
5789
-				$query_values = array_merge($query_values,array(':month' => $month));
5789
+				$query_values = array_merge($query_values, array(':month' => $month));
5790 5790
 			}
5791 5791
 		}
5792 5792
 		if ($day != '') {
5793 5793
 			if ($globalDBdriver == 'mysql') {
5794 5794
 				$query .= " AND DAY(spotter_output.date) = :day";
5795
-				$query_values = array_merge($query_values,array(':day' => $day));
5795
+				$query_values = array_merge($query_values, array(':day' => $day));
5796 5796
 			} else {
5797 5797
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
5798
-				$query_values = array_merge($query_values,array(':day' => $day));
5798
+				$query_values = array_merge($query_values, array(':day' => $day));
5799 5799
 			}
5800 5800
 		}
5801 5801
 
5802 5802
 		$query .= " GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao
5803 5803
 				ORDER BY aircraft_icao_count DESC";
5804
-		$query_values = array_merge($query_values,array(':pilot' => $pilot));
5804
+		$query_values = array_merge($query_values, array(':pilot' => $pilot));
5805 5805
 		$sth = $this->db->prepare($query);
5806 5806
 		$sth->execute($query_values);
5807 5807
 		return $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -5813,44 +5813,44 @@  discard block
 block discarded – undo
5813 5813
 	* @return Array the aircraft list
5814 5814
 	*
5815 5815
 	*/
5816
-	public function countAllAircraftTypesByOwner($owner,$filters = array(),$year = '',$month = '',$day = '')
5816
+	public function countAllAircraftTypesByOwner($owner, $filters = array(), $year = '', $month = '', $day = '')
5817 5817
 	{
5818 5818
 		global $globalDBdriver;
5819
-		$filter_query = $this->getFilter($filters,true,true);
5820
-		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
5821
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer 
5819
+		$filter_query = $this->getFilter($filters, true, true);
5820
+		$owner = filter_var($owner, FILTER_SANITIZE_STRING);
5821
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer 
5822 5822
 				FROM spotter_output".$filter_query." spotter_output.owner_name = :owner";
5823 5823
 		$query_values = array();
5824 5824
 		if ($year != '') {
5825 5825
 			if ($globalDBdriver == 'mysql') {
5826 5826
 				$query .= " AND YEAR(spotter_output.date) = :year";
5827
-				$query_values = array_merge($query_values,array(':year' => $year));
5827
+				$query_values = array_merge($query_values, array(':year' => $year));
5828 5828
 			} else {
5829 5829
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
5830
-				$query_values = array_merge($query_values,array(':year' => $year));
5830
+				$query_values = array_merge($query_values, array(':year' => $year));
5831 5831
 			}
5832 5832
 		}
5833 5833
 		if ($month != '') {
5834 5834
 			if ($globalDBdriver == 'mysql') {
5835 5835
 				$query .= " AND MONTH(spotter_output.date) = :month";
5836
-				$query_values = array_merge($query_values,array(':month' => $month));
5836
+				$query_values = array_merge($query_values, array(':month' => $month));
5837 5837
 			} else {
5838 5838
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
5839
-				$query_values = array_merge($query_values,array(':month' => $month));
5839
+				$query_values = array_merge($query_values, array(':month' => $month));
5840 5840
 			}
5841 5841
 		}
5842 5842
 		if ($day != '') {
5843 5843
 			if ($globalDBdriver == 'mysql') {
5844 5844
 				$query .= " AND DAY(spotter_output.date) = :day";
5845
-				$query_values = array_merge($query_values,array(':day' => $day));
5845
+				$query_values = array_merge($query_values, array(':day' => $day));
5846 5846
 			} else {
5847 5847
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
5848
-				$query_values = array_merge($query_values,array(':day' => $day));
5848
+				$query_values = array_merge($query_values, array(':day' => $day));
5849 5849
 			}
5850 5850
 		}
5851 5851
 		$query .= " GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_manufacturer, spotter_output.aircraft_icao
5852 5852
 				ORDER BY aircraft_icao_count DESC";
5853
-		$query_values = array_merge($query_values,array(':owner' => $owner));
5853
+		$query_values = array_merge($query_values, array(':owner' => $owner));
5854 5854
 		$sth = $this->db->prepare($query);
5855 5855
 		$sth->execute($query_values);
5856 5856
 		return $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -5862,13 +5862,13 @@  discard block
 block discarded – undo
5862 5862
 	* @return Array the aircraft list
5863 5863
 	*
5864 5864
 	*/
5865
-	public function countAllAircraftRegistrationByIdent($ident,$filters = array())
5865
+	public function countAllAircraftRegistrationByIdent($ident, $filters = array())
5866 5866
 	{
5867
-		$filter_query = $this->getFilter($filters,true,true);
5867
+		$filter_query = $this->getFilter($filters, true, true);
5868 5868
 		$Image = new Image($this->db);
5869
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
5869
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
5870 5870
 
5871
-		$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  
5871
+		$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  
5872 5872
                     FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.ident = :ident   
5873 5873
                     GROUP BY spotter_output.registration,spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name
5874 5874
 		    ORDER BY registration_count DESC";
@@ -5880,14 +5880,14 @@  discard block
 block discarded – undo
5880 5880
 		$aircraft_array = array();
5881 5881
 		$temp_array = array();
5882 5882
         
5883
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5883
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5884 5884
 		{
5885 5885
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5886 5886
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5887 5887
 			$temp_array['registration'] = $row['registration'];
5888 5888
 			$temp_array['airline_name'] = $row['airline_name'];
5889 5889
 			$temp_array['image_thumbnail'] = "";
5890
-			if($row['registration'] != "")
5890
+			if ($row['registration'] != "")
5891 5891
 			{
5892 5892
 				$image_array = $Image->getSpotterImage($row['registration']);
5893 5893
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5905,44 +5905,44 @@  discard block
 block discarded – undo
5905 5905
 	* @return Array the aircraft list
5906 5906
 	*
5907 5907
 	*/
5908
-	public function countAllAircraftRegistrationByOwner($owner,$filters = array(),$year = '',$month = '',$day = '')
5908
+	public function countAllAircraftRegistrationByOwner($owner, $filters = array(), $year = '', $month = '', $day = '')
5909 5909
 	{
5910 5910
 		global $globalDBdriver;
5911
-		$filter_query = $this->getFilter($filters,true,true);
5911
+		$filter_query = $this->getFilter($filters, true, true);
5912 5912
 		$Image = new Image($this->db);
5913
-		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
5913
+		$owner = filter_var($owner, FILTER_SANITIZE_STRING);
5914 5914
 
5915
-		$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  
5915
+		$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  
5916 5916
                     FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.owner_name = :owner";
5917 5917
 		$query_values = array();
5918 5918
 		if ($year != '') {
5919 5919
 			if ($globalDBdriver == 'mysql') {
5920 5920
 				$query .= " AND YEAR(spotter_output.date) = :year";
5921
-				$query_values = array_merge($query_values,array(':year' => $year));
5921
+				$query_values = array_merge($query_values, array(':year' => $year));
5922 5922
 			} else {
5923 5923
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
5924
-				$query_values = array_merge($query_values,array(':year' => $year));
5924
+				$query_values = array_merge($query_values, array(':year' => $year));
5925 5925
 			}
5926 5926
 		}
5927 5927
 		if ($month != '') {
5928 5928
 			if ($globalDBdriver == 'mysql') {
5929 5929
 				$query .= " AND MONTH(spotter_output.date) = :month";
5930
-				$query_values = array_merge($query_values,array(':month' => $month));
5930
+				$query_values = array_merge($query_values, array(':month' => $month));
5931 5931
 			} else {
5932 5932
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
5933
-				$query_values = array_merge($query_values,array(':month' => $month));
5933
+				$query_values = array_merge($query_values, array(':month' => $month));
5934 5934
 			}
5935 5935
 		}
5936 5936
 		if ($day != '') {
5937 5937
 			if ($globalDBdriver == 'mysql') {
5938 5938
 				$query .= " AND DAY(spotter_output.date) = :day";
5939
-				$query_values = array_merge($query_values,array(':day' => $day));
5939
+				$query_values = array_merge($query_values, array(':day' => $day));
5940 5940
 			} else {
5941 5941
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
5942
-				$query_values = array_merge($query_values,array(':day' => $day));
5942
+				$query_values = array_merge($query_values, array(':day' => $day));
5943 5943
 			}
5944 5944
 		}
5945
-		$query_values = array_merge($query_values,array(':owner' => $owner));
5945
+		$query_values = array_merge($query_values, array(':owner' => $owner));
5946 5946
 
5947 5947
 		$query .= " GROUP BY spotter_output.registration,spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer, spotter_output.airline_name
5948 5948
 		    ORDER BY registration_count DESC";
@@ -5954,7 +5954,7 @@  discard block
 block discarded – undo
5954 5954
 		$aircraft_array = array();
5955 5955
 		$temp_array = array();
5956 5956
         
5957
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5957
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5958 5958
 		{
5959 5959
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5960 5960
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -5962,7 +5962,7 @@  discard block
 block discarded – undo
5962 5962
 			$temp_array['registration'] = $row['registration'];
5963 5963
 			$temp_array['airline_name'] = $row['airline_name'];
5964 5964
 			$temp_array['image_thumbnail'] = "";
5965
-			if($row['registration'] != "")
5965
+			if ($row['registration'] != "")
5966 5966
 			{
5967 5967
 				$image_array = $Image->getSpotterImage($row['registration']);
5968 5968
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5980,44 +5980,44 @@  discard block
 block discarded – undo
5980 5980
 	* @return Array the aircraft list
5981 5981
 	*
5982 5982
 	*/
5983
-	public function countAllAircraftRegistrationByPilot($pilot,$filters = array(),$year = '',$month = '',$day = '')
5983
+	public function countAllAircraftRegistrationByPilot($pilot, $filters = array(), $year = '', $month = '', $day = '')
5984 5984
 	{
5985 5985
 		global $globalDBdriver;
5986
-		$filter_query = $this->getFilter($filters,true,true);
5986
+		$filter_query = $this->getFilter($filters, true, true);
5987 5987
 		$Image = new Image($this->db);
5988
-		$pilot = filter_var($pilot,FILTER_SANITIZE_STRING);
5988
+		$pilot = filter_var($pilot, FILTER_SANITIZE_STRING);
5989 5989
 
5990
-		$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  
5990
+		$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  
5991 5991
                     FROM spotter_output".$filter_query." spotter_output.registration <> '' AND (spotter_output.pilot_name = :pilot OR spotter_output.pilot_id = :pilot)";
5992 5992
 		$query_values = array();
5993 5993
 		if ($year != '') {
5994 5994
 			if ($globalDBdriver == 'mysql') {
5995 5995
 				$query .= " AND YEAR(spotter_output.date) = :year";
5996
-				$query_values = array_merge($query_values,array(':year' => $year));
5996
+				$query_values = array_merge($query_values, array(':year' => $year));
5997 5997
 			} else {
5998 5998
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
5999
-				$query_values = array_merge($query_values,array(':year' => $year));
5999
+				$query_values = array_merge($query_values, array(':year' => $year));
6000 6000
 			}
6001 6001
 		}
6002 6002
 		if ($month != '') {
6003 6003
 			if ($globalDBdriver == 'mysql') {
6004 6004
 				$query .= " AND MONTH(spotter_output.date) = :month";
6005
-				$query_values = array_merge($query_values,array(':month' => $month));
6005
+				$query_values = array_merge($query_values, array(':month' => $month));
6006 6006
 			} else {
6007 6007
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
6008
-				$query_values = array_merge($query_values,array(':month' => $month));
6008
+				$query_values = array_merge($query_values, array(':month' => $month));
6009 6009
 			}
6010 6010
 		}
6011 6011
 		if ($day != '') {
6012 6012
 			if ($globalDBdriver == 'mysql') {
6013 6013
 				$query .= " AND DAY(spotter_output.date) = :day";
6014
-				$query_values = array_merge($query_values,array(':day' => $day));
6014
+				$query_values = array_merge($query_values, array(':day' => $day));
6015 6015
 			} else {
6016 6016
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
6017
-				$query_values = array_merge($query_values,array(':day' => $day));
6017
+				$query_values = array_merge($query_values, array(':day' => $day));
6018 6018
 			}
6019 6019
 		}
6020
-		$query_values = array_merge($query_values,array(':pilot' => $pilot));
6020
+		$query_values = array_merge($query_values, array(':pilot' => $pilot));
6021 6021
 
6022 6022
 		$query .= " GROUP BY spotter_output.registration,spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer, spotter_output.airline_name
6023 6023
 		    ORDER BY registration_count DESC";
@@ -6029,7 +6029,7 @@  discard block
 block discarded – undo
6029 6029
 		$aircraft_array = array();
6030 6030
 		$temp_array = array();
6031 6031
         
6032
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6032
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6033 6033
 		{
6034 6034
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
6035 6035
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -6037,7 +6037,7 @@  discard block
 block discarded – undo
6037 6037
 			$temp_array['registration'] = $row['registration'];
6038 6038
 			$temp_array['airline_name'] = $row['airline_name'];
6039 6039
 			$temp_array['image_thumbnail'] = "";
6040
-			if($row['registration'] != "")
6040
+			if ($row['registration'] != "")
6041 6041
 			{
6042 6042
 				$image_array = $Image->getSpotterImage($row['registration']);
6043 6043
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -6056,11 +6056,11 @@  discard block
 block discarded – undo
6056 6056
 	* @return Array the aircraft manufacturer list
6057 6057
 	*
6058 6058
 	*/
6059
-	public function countAllAircraftManufacturerByIdent($ident,$filters = array())
6059
+	public function countAllAircraftManufacturerByIdent($ident, $filters = array())
6060 6060
 	{
6061
-		$filter_query = $this->getFilter($filters,true,true);
6062
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
6063
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
6061
+		$filter_query = $this->getFilter($filters, true, true);
6062
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
6063
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
6064 6064
                     FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.ident = :ident  
6065 6065
                     GROUP BY spotter_output.aircraft_manufacturer 
6066 6066
 					ORDER BY aircraft_manufacturer_count DESC";
@@ -6070,7 +6070,7 @@  discard block
 block discarded – undo
6070 6070
 		$sth->execute(array(':ident' => $ident));
6071 6071
 		$aircraft_array = array();
6072 6072
 		$temp_array = array();
6073
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6073
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6074 6074
 		{
6075 6075
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
6076 6076
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -6085,42 +6085,42 @@  discard block
 block discarded – undo
6085 6085
 	* @return Array the aircraft manufacturer list
6086 6086
 	*
6087 6087
 	*/
6088
-	public function countAllAircraftManufacturerByOwner($owner,$filters = array(),$year = '',$month = '',$day = '')
6088
+	public function countAllAircraftManufacturerByOwner($owner, $filters = array(), $year = '', $month = '', $day = '')
6089 6089
 	{
6090 6090
 		global $globalDBdriver;
6091
-		$filter_query = $this->getFilter($filters,true,true);
6092
-		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
6093
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
6091
+		$filter_query = $this->getFilter($filters, true, true);
6092
+		$owner = filter_var($owner, FILTER_SANITIZE_STRING);
6093
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
6094 6094
 		    FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.owner_name = :owner";
6095 6095
 		$query_values = array();
6096 6096
 		if ($year != '') {
6097 6097
 			if ($globalDBdriver == 'mysql') {
6098 6098
 				$query .= " AND YEAR(spotter_output.date) = :year";
6099
-				$query_values = array_merge($query_values,array(':year' => $year));
6099
+				$query_values = array_merge($query_values, array(':year' => $year));
6100 6100
 			} else {
6101 6101
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
6102
-				$query_values = array_merge($query_values,array(':year' => $year));
6102
+				$query_values = array_merge($query_values, array(':year' => $year));
6103 6103
 			}
6104 6104
 		}
6105 6105
 		if ($month != '') {
6106 6106
 			if ($globalDBdriver == 'mysql') {
6107 6107
 				$query .= " AND MONTH(spotter_output.date) = :month";
6108
-				$query_values = array_merge($query_values,array(':month' => $month));
6108
+				$query_values = array_merge($query_values, array(':month' => $month));
6109 6109
 			} else {
6110 6110
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
6111
-				$query_values = array_merge($query_values,array(':month' => $month));
6111
+				$query_values = array_merge($query_values, array(':month' => $month));
6112 6112
 			}
6113 6113
 		}
6114 6114
 		if ($day != '') {
6115 6115
 			if ($globalDBdriver == 'mysql') {
6116 6116
 				$query .= " AND DAY(spotter_output.date) = :day";
6117
-				$query_values = array_merge($query_values,array(':day' => $day));
6117
+				$query_values = array_merge($query_values, array(':day' => $day));
6118 6118
 			} else {
6119 6119
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
6120
-				$query_values = array_merge($query_values,array(':day' => $day));
6120
+				$query_values = array_merge($query_values, array(':day' => $day));
6121 6121
 			}
6122 6122
 		}
6123
-		$query_values = array_merge($query_values,array(':owner' => $owner));
6123
+		$query_values = array_merge($query_values, array(':owner' => $owner));
6124 6124
 
6125 6125
 		$query .= " GROUP BY spotter_output.aircraft_manufacturer 
6126 6126
 		    ORDER BY aircraft_manufacturer_count DESC";
@@ -6137,42 +6137,42 @@  discard block
 block discarded – undo
6137 6137
 	* @return Array the aircraft manufacturer list
6138 6138
 	*
6139 6139
 	*/
6140
-	public function countAllAircraftManufacturerByPilot($pilot,$filters = array(),$year = '',$month = '',$day = '')
6140
+	public function countAllAircraftManufacturerByPilot($pilot, $filters = array(), $year = '', $month = '', $day = '')
6141 6141
 	{
6142 6142
 		global $globalDBdriver;
6143
-		$filter_query = $this->getFilter($filters,true,true);
6144
-		$pilot = filter_var($pilot,FILTER_SANITIZE_STRING);
6145
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
6143
+		$filter_query = $this->getFilter($filters, true, true);
6144
+		$pilot = filter_var($pilot, FILTER_SANITIZE_STRING);
6145
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
6146 6146
 		    FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND (spotter_output.pilot_name = :pilot OR spotter_output.pilot_id = :pilot)";
6147 6147
 		$query_values = array();
6148 6148
 		if ($year != '') {
6149 6149
 			if ($globalDBdriver == 'mysql') {
6150 6150
 				$query .= " AND YEAR(spotter_output.date) = :year";
6151
-				$query_values = array_merge($query_values,array(':year' => $year));
6151
+				$query_values = array_merge($query_values, array(':year' => $year));
6152 6152
 			} else {
6153 6153
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
6154
-				$query_values = array_merge($query_values,array(':year' => $year));
6154
+				$query_values = array_merge($query_values, array(':year' => $year));
6155 6155
 			}
6156 6156
 		}
6157 6157
 		if ($month != '') {
6158 6158
 			if ($globalDBdriver == 'mysql') {
6159 6159
 				$query .= " AND MONTH(spotter_output.date) = :month";
6160
-				$query_values = array_merge($query_values,array(':month' => $month));
6160
+				$query_values = array_merge($query_values, array(':month' => $month));
6161 6161
 			} else {
6162 6162
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
6163
-				$query_values = array_merge($query_values,array(':month' => $month));
6163
+				$query_values = array_merge($query_values, array(':month' => $month));
6164 6164
 			}
6165 6165
 		}
6166 6166
 		if ($day != '') {
6167 6167
 			if ($globalDBdriver == 'mysql') {
6168 6168
 				$query .= " AND DAY(spotter_output.date) = :day";
6169
-				$query_values = array_merge($query_values,array(':day' => $day));
6169
+				$query_values = array_merge($query_values, array(':day' => $day));
6170 6170
 			} else {
6171 6171
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
6172
-				$query_values = array_merge($query_values,array(':day' => $day));
6172
+				$query_values = array_merge($query_values, array(':day' => $day));
6173 6173
 			}
6174 6174
 		}
6175
-		$query_values = array_merge($query_values,array(':pilot' => $pilot));
6175
+		$query_values = array_merge($query_values, array(':pilot' => $pilot));
6176 6176
 
6177 6177
 		$query .= " GROUP BY spotter_output.aircraft_manufacturer 
6178 6178
 		    ORDER BY aircraft_manufacturer_count DESC";
@@ -6190,24 +6190,24 @@  discard block
 block discarded – undo
6190 6190
 	* @return Array the aircraft list
6191 6191
 	*
6192 6192
 	*/
6193
-	public function countAllAircraftTypesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
6193
+	public function countAllAircraftTypesByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array())
6194 6194
 	{
6195
-		$filter_query = $this->getFilter($filters,true,true);
6196
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
6197
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
6195
+		$filter_query = $this->getFilter($filters, true, true);
6196
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
6197
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
6198 6198
 		
6199 6199
 
6200
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
6200
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
6201 6201
                     FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao)
6202 6202
                     GROUP BY spotter_output.aircraft_name 
6203 6203
 					ORDER BY aircraft_icao_count DESC";
6204 6204
  
6205 6205
 		
6206 6206
 		$sth = $this->db->prepare($query);
6207
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao));
6207
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao));
6208 6208
 		$aircraft_array = array();
6209 6209
 		$temp_array = array();
6210
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6210
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6211 6211
 		{
6212 6212
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
6213 6213
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -6223,33 +6223,33 @@  discard block
 block discarded – undo
6223 6223
 	* @return Array the aircraft list
6224 6224
 	*
6225 6225
 	*/
6226
-	public function countAllAircraftRegistrationByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
6226
+	public function countAllAircraftRegistrationByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array())
6227 6227
 	{
6228
-		$filter_query = $this->getFilter($filters,true,true);
6228
+		$filter_query = $this->getFilter($filters, true, true);
6229 6229
 		$Image = new Image($this->db);
6230
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
6231
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
6230
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
6231
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
6232 6232
 
6233
-		$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   
6233
+		$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   
6234 6234
                     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)   
6235 6235
                     GROUP BY spotter_output.registration 
6236 6236
 					ORDER BY registration_count DESC";
6237 6237
 
6238 6238
 		
6239 6239
 		$sth = $this->db->prepare($query);
6240
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao));
6240
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao));
6241 6241
       
6242 6242
 		$aircraft_array = array();
6243 6243
 		$temp_array = array();
6244 6244
         
6245
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6245
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6246 6246
 		{
6247 6247
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
6248 6248
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
6249 6249
 			$temp_array['registration'] = $row['registration'];
6250 6250
 			$temp_array['airline_name'] = $row['airline_name'];
6251 6251
 			$temp_array['image_thumbnail'] = "";
6252
-			if($row['registration'] != "")
6252
+			if ($row['registration'] != "")
6253 6253
 			{
6254 6254
 				$image_array = $Image->getSpotterImage($row['registration']);
6255 6255
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -6269,25 +6269,25 @@  discard block
 block discarded – undo
6269 6269
 	* @return Array the aircraft manufacturer list
6270 6270
 	*
6271 6271
 	*/
6272
-	public function countAllAircraftManufacturerByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
6272
+	public function countAllAircraftManufacturerByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array())
6273 6273
 	{
6274
-		$filter_query = $this->getFilter($filters,true,true);
6275
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
6276
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
6274
+		$filter_query = $this->getFilter($filters, true, true);
6275
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
6276
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
6277 6277
 
6278
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
6278
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
6279 6279
                     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) 
6280 6280
                     GROUP BY spotter_output.aircraft_manufacturer 
6281 6281
 					ORDER BY aircraft_manufacturer_count DESC";
6282 6282
 
6283 6283
 		
6284 6284
 		$sth = $this->db->prepare($query);
6285
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao));
6285
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao));
6286 6286
       
6287 6287
 		$aircraft_array = array();
6288 6288
 		$temp_array = array();
6289 6289
         
6290
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6290
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6291 6291
 		{
6292 6292
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
6293 6293
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -6307,11 +6307,11 @@  discard block
 block discarded – undo
6307 6307
 	* @return Array the aircraft list
6308 6308
 	*
6309 6309
 	*/
6310
-	public function countAllAircraftTypesByCountry($country,$filters = array())
6310
+	public function countAllAircraftTypesByCountry($country, $filters = array())
6311 6311
 	{
6312
-		$filter_query = $this->getFilter($filters,true,true);
6313
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
6314
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
6312
+		$filter_query = $this->getFilter($filters, true, true);
6313
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
6314
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
6315 6315
 			    FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country 
6316 6316
 			    GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao 
6317 6317
 			    ORDER BY aircraft_icao_count DESC";
@@ -6323,7 +6323,7 @@  discard block
 block discarded – undo
6323 6323
 		$aircraft_array = array();
6324 6324
 		$temp_array = array();
6325 6325
         
6326
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6326
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6327 6327
 		{
6328 6328
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
6329 6329
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -6342,12 +6342,12 @@  discard block
 block discarded – undo
6342 6342
 	* @return Array the aircraft list
6343 6343
 	*
6344 6344
 	*/
6345
-	public function countAllAircraftRegistrationByCountry($country,$filters = array())
6345
+	public function countAllAircraftRegistrationByCountry($country, $filters = array())
6346 6346
 	{
6347
-		$filter_query = $this->getFilter($filters,true,true);
6347
+		$filter_query = $this->getFilter($filters, true, true);
6348 6348
 		$Image = new Image($this->db);
6349
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
6350
-		$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 
6349
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
6350
+		$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 
6351 6351
 			    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)    
6352 6352
 			    GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name 
6353 6353
 			    ORDER BY registration_count DESC";
@@ -6359,14 +6359,14 @@  discard block
 block discarded – undo
6359 6359
 		$aircraft_array = array();
6360 6360
 		$temp_array = array();
6361 6361
         
6362
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6362
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6363 6363
 		{
6364 6364
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
6365 6365
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
6366 6366
 			$temp_array['registration'] = $row['registration'];
6367 6367
 			$temp_array['airline_name'] = $row['airline_name'];
6368 6368
 			$temp_array['image_thumbnail'] = "";
6369
-			if($row['registration'] != "")
6369
+			if ($row['registration'] != "")
6370 6370
 			{
6371 6371
 				$image_array = $Image->getSpotterImage($row['registration']);
6372 6372
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -6386,11 +6386,11 @@  discard block
 block discarded – undo
6386 6386
 	* @return Array the aircraft manufacturer list
6387 6387
 	*
6388 6388
 	*/
6389
-	public function countAllAircraftManufacturerByCountry($country,$filters = array())
6389
+	public function countAllAircraftManufacturerByCountry($country, $filters = array())
6390 6390
 	{
6391
-		$filter_query = $this->getFilter($filters,true,true);
6392
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
6393
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
6391
+		$filter_query = $this->getFilter($filters, true, true);
6392
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
6393
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
6394 6394
                     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) 
6395 6395
                     GROUP BY spotter_output.aircraft_manufacturer 
6396 6396
 					ORDER BY aircraft_manufacturer_count DESC";
@@ -6402,7 +6402,7 @@  discard block
 block discarded – undo
6402 6402
 		$aircraft_array = array();
6403 6403
 		$temp_array = array();
6404 6404
         
6405
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6405
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6406 6406
 		{
6407 6407
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
6408 6408
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -6421,38 +6421,38 @@  discard block
 block discarded – undo
6421 6421
 	* @return Array the aircraft list
6422 6422
 	*
6423 6423
 	*/
6424
-	public function countAllAircraftManufacturers($filters = array(),$year = '',$month = '',$day = '')
6424
+	public function countAllAircraftManufacturers($filters = array(), $year = '', $month = '', $day = '')
6425 6425
 	{
6426 6426
 		global $globalDBdriver;
6427
-		$filter_query = $this->getFilter($filters,true,true);
6428
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
6427
+		$filter_query = $this->getFilter($filters, true, true);
6428
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
6429 6429
                     FROM spotter_output ".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.aircraft_manufacturer <> 'Not Available'";
6430 6430
                 $query_values = array();
6431 6431
 		if ($year != '') {
6432 6432
 			if ($globalDBdriver == 'mysql') {
6433 6433
 				$query .= " AND YEAR(spotter_output.date) = :year";
6434
-				$query_values = array_merge($query_values,array(':year' => $year));
6434
+				$query_values = array_merge($query_values, array(':year' => $year));
6435 6435
 			} else {
6436 6436
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
6437
-				$query_values = array_merge($query_values,array(':year' => $year));
6437
+				$query_values = array_merge($query_values, array(':year' => $year));
6438 6438
 			}
6439 6439
 		}
6440 6440
 		if ($month != '') {
6441 6441
 			if ($globalDBdriver == 'mysql') {
6442 6442
 				$query .= " AND MONTH(spotter_output.date) = :month";
6443
-				$query_values = array_merge($query_values,array(':month' => $month));
6443
+				$query_values = array_merge($query_values, array(':month' => $month));
6444 6444
 			} else {
6445 6445
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
6446
-				$query_values = array_merge($query_values,array(':month' => $month));
6446
+				$query_values = array_merge($query_values, array(':month' => $month));
6447 6447
 			}
6448 6448
 		}
6449 6449
 		if ($day != '') {
6450 6450
 			if ($globalDBdriver == 'mysql') {
6451 6451
 				$query .= " AND DAY(spotter_output.date) = :day";
6452
-				$query_values = array_merge($query_values,array(':day' => $day));
6452
+				$query_values = array_merge($query_values, array(':day' => $day));
6453 6453
 			} else {
6454 6454
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
6455
-				$query_values = array_merge($query_values,array(':day' => $day));
6455
+				$query_values = array_merge($query_values, array(':day' => $day));
6456 6456
 			}
6457 6457
 		}
6458 6458
 		$query .= " GROUP BY spotter_output.aircraft_manufacturer
@@ -6466,7 +6466,7 @@  discard block
 block discarded – undo
6466 6466
 		$manufacturer_array = array();
6467 6467
 		$temp_array = array();
6468 6468
         
6469
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6469
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6470 6470
 		{
6471 6471
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
6472 6472
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -6485,12 +6485,12 @@  discard block
 block discarded – undo
6485 6485
 	* @return Array the aircraft list
6486 6486
 	*
6487 6487
 	*/
6488
-	public function countAllAircraftRegistrations($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '', $month = '', $day = '')
6488
+	public function countAllAircraftRegistrations($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '')
6489 6489
 	{
6490 6490
 		global $globalDBdriver;
6491 6491
 		$Image = new Image($this->db);
6492
-		$filter_query = $this->getFilter($filters,true,true);
6493
-		$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    
6492
+		$filter_query = $this->getFilter($filters, true, true);
6493
+		$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    
6494 6494
                     FROM spotter_output ".$filter_query." spotter_output.registration <> '' AND spotter_output.registration <> 'NA'";
6495 6495
                 if ($olderthanmonths > 0) {
6496 6496
             		if ($globalDBdriver == 'mysql') {
@@ -6510,28 +6510,28 @@  discard block
 block discarded – undo
6510 6510
 		if ($year != '') {
6511 6511
 			if ($globalDBdriver == 'mysql') {
6512 6512
 				$query .= " AND YEAR(spotter_output.date) = :year";
6513
-				$query_values = array_merge($query_values,array(':year' => $year));
6513
+				$query_values = array_merge($query_values, array(':year' => $year));
6514 6514
 			} else {
6515 6515
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
6516
-				$query_values = array_merge($query_values,array(':year' => $year));
6516
+				$query_values = array_merge($query_values, array(':year' => $year));
6517 6517
 			}
6518 6518
 		}
6519 6519
 		if ($month != '') {
6520 6520
 			if ($globalDBdriver == 'mysql') {
6521 6521
 				$query .= " AND MONTH(spotter_output.date) = :month";
6522
-				$query_values = array_merge($query_values,array(':month' => $month));
6522
+				$query_values = array_merge($query_values, array(':month' => $month));
6523 6523
 			} else {
6524 6524
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
6525
-				$query_values = array_merge($query_values,array(':month' => $month));
6525
+				$query_values = array_merge($query_values, array(':month' => $month));
6526 6526
 			}
6527 6527
 		}
6528 6528
 		if ($day != '') {
6529 6529
 			if ($globalDBdriver == 'mysql') {
6530 6530
 				$query .= " AND DAY(spotter_output.date) = :day";
6531
-				$query_values = array_merge($query_values,array(':day' => $day));
6531
+				$query_values = array_merge($query_values, array(':day' => $day));
6532 6532
 			} else {
6533 6533
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
6534
-				$query_values = array_merge($query_values,array(':day' => $day));
6534
+				$query_values = array_merge($query_values, array(':day' => $day));
6535 6535
 			}
6536 6536
 		}
6537 6537
 		$query .= " GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC";
@@ -6543,7 +6543,7 @@  discard block
 block discarded – undo
6543 6543
 		$aircraft_array = array();
6544 6544
 		$temp_array = array();
6545 6545
         
6546
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6546
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6547 6547
 		{
6548 6548
 			$temp_array['registration'] = $row['registration'];
6549 6549
 			$temp_array['aircraft_registration_count'] = $row['aircraft_registration_count'];
@@ -6551,7 +6551,7 @@  discard block
 block discarded – undo
6551 6551
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
6552 6552
 			$temp_array['airline_name'] = $row['airline_name'];
6553 6553
 			$temp_array['image_thumbnail'] = "";
6554
-			if($row['registration'] != "")
6554
+			if ($row['registration'] != "")
6555 6555
 			{
6556 6556
 				$image_array = $Image->getSpotterImage($row['registration']);
6557 6557
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -6570,12 +6570,12 @@  discard block
 block discarded – undo
6570 6570
 	* @return Array the aircraft list
6571 6571
 	*
6572 6572
 	*/
6573
-	public function countAllAircraftRegistrationsByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
6573
+	public function countAllAircraftRegistrationsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
6574 6574
 	{
6575 6575
 		global $globalDBdriver;
6576
-		$filter_query = $this->getFilter($filters,true,true);
6576
+		$filter_query = $this->getFilter($filters, true, true);
6577 6577
 		$Image = new Image($this->db);
6578
-		$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    
6578
+		$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    
6579 6579
                     FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.registration <> '' AND spotter_output.registration <> 'NA' ";
6580 6580
                 if ($olderthanmonths > 0) {
6581 6581
             		if ($globalDBdriver == 'mysql') {
@@ -6603,7 +6603,7 @@  discard block
 block discarded – undo
6603 6603
 		$aircraft_array = array();
6604 6604
 		$temp_array = array();
6605 6605
         
6606
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6606
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6607 6607
 		{
6608 6608
 			$temp_array['registration'] = $row['registration'];
6609 6609
 			$temp_array['aircraft_registration_count'] = $row['aircraft_registration_count'];
@@ -6612,7 +6612,7 @@  discard block
 block discarded – undo
6612 6612
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
6613 6613
 			$temp_array['airline_name'] = $row['airline_name'];
6614 6614
 			$temp_array['image_thumbnail'] = "";
6615
-			if($row['registration'] != "")
6615
+			if ($row['registration'] != "")
6616 6616
 			{
6617 6617
 				$image_array = $Image->getSpotterImage($row['registration']);
6618 6618
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -6631,11 +6631,11 @@  discard block
 block discarded – undo
6631 6631
 	* @return Array the airport list
6632 6632
 	*
6633 6633
 	*/
6634
-	public function countAllDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '',$month = '',$day = '')
6634
+	public function countAllDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '')
6635 6635
 	{
6636 6636
 		global $globalDBdriver;
6637
-		$filter_query = $this->getFilter($filters,true,true);
6638
-		$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 
6637
+		$filter_query = $this->getFilter($filters, true, true);
6638
+		$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 
6639 6639
 				FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> ''";
6640 6640
                 if ($olderthanmonths > 0) {
6641 6641
             		if ($globalDBdriver == 'mysql') {
@@ -6655,28 +6655,28 @@  discard block
 block discarded – undo
6655 6655
 		if ($year != '') {
6656 6656
 			if ($globalDBdriver == 'mysql') {
6657 6657
 				$query .= " AND YEAR(spotter_output.date) = :year";
6658
-				$query_values = array_merge($query_values,array(':year' => $year));
6658
+				$query_values = array_merge($query_values, array(':year' => $year));
6659 6659
 			} else {
6660 6660
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
6661
-				$query_values = array_merge($query_values,array(':year' => $year));
6661
+				$query_values = array_merge($query_values, array(':year' => $year));
6662 6662
 			}
6663 6663
 		}
6664 6664
 		if ($month != '') {
6665 6665
 			if ($globalDBdriver == 'mysql') {
6666 6666
 				$query .= " AND MONTH(spotter_output.date) = :month";
6667
-				$query_values = array_merge($query_values,array(':month' => $month));
6667
+				$query_values = array_merge($query_values, array(':month' => $month));
6668 6668
 			} else {
6669 6669
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
6670
-				$query_values = array_merge($query_values,array(':month' => $month));
6670
+				$query_values = array_merge($query_values, array(':month' => $month));
6671 6671
 			}
6672 6672
 		}
6673 6673
 		if ($day != '') {
6674 6674
 			if ($globalDBdriver == 'mysql') {
6675 6675
 				$query .= " AND DAY(spotter_output.date) = :day";
6676
-				$query_values = array_merge($query_values,array(':day' => $day));
6676
+				$query_values = array_merge($query_values, array(':day' => $day));
6677 6677
 			} else {
6678 6678
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
6679
-				$query_values = array_merge($query_values,array(':day' => $day));
6679
+				$query_values = array_merge($query_values, array(':day' => $day));
6680 6680
 			}
6681 6681
 		}
6682 6682
                 $query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
@@ -6688,7 +6688,7 @@  discard block
 block discarded – undo
6688 6688
 
6689 6689
 		$airport_array = array();
6690 6690
 		$temp_array = array();
6691
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6691
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6692 6692
 		{
6693 6693
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
6694 6694
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -6707,11 +6707,11 @@  discard block
 block discarded – undo
6707 6707
 	* @return Array the airport list
6708 6708
 	*
6709 6709
 	*/
6710
-	public function countAllDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
6710
+	public function countAllDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
6711 6711
 	{
6712 6712
 		global $globalDBdriver;
6713
-		$filter_query = $this->getFilter($filters,true,true);
6714
-		$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 
6713
+		$filter_query = $this->getFilter($filters, true, true);
6714
+		$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 
6715 6715
 			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 <> '' ";
6716 6716
                 if ($olderthanmonths > 0) {
6717 6717
             		if ($globalDBdriver == 'mysql') {
@@ -6740,7 +6740,7 @@  discard block
 block discarded – undo
6740 6740
 		$airport_array = array();
6741 6741
 		$temp_array = array();
6742 6742
         
6743
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6743
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6744 6744
 		{
6745 6745
 			$temp_array['airline_icao'] = $row['airline_icao'];
6746 6746
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -6760,11 +6760,11 @@  discard block
 block discarded – undo
6760 6760
 	* @return Array the airport list
6761 6761
 	*
6762 6762
 	*/
6763
-	public function countAllDetectedDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '',$month = '',$day = '')
6763
+	public function countAllDetectedDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '')
6764 6764
 	{
6765 6765
 		global $globalDBdriver;
6766
-		$filter_query = $this->getFilter($filters,true,true);
6767
-		$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
6766
+		$filter_query = $this->getFilter($filters, true, true);
6767
+		$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
6768 6768
 				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";
6769 6769
                 if ($olderthanmonths > 0) {
6770 6770
             		if ($globalDBdriver == 'mysql') {
@@ -6784,28 +6784,28 @@  discard block
 block discarded – undo
6784 6784
 		if ($year != '') {
6785 6785
 			if ($globalDBdriver == 'mysql') {
6786 6786
 				$query .= " AND YEAR(spotter_output.date) = :year";
6787
-				$query_values = array_merge($query_values,array(':year' => $year));
6787
+				$query_values = array_merge($query_values, array(':year' => $year));
6788 6788
 			} else {
6789 6789
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
6790
-				$query_values = array_merge($query_values,array(':year' => $year));
6790
+				$query_values = array_merge($query_values, array(':year' => $year));
6791 6791
 			}
6792 6792
 		}
6793 6793
 		if ($month != '') {
6794 6794
 			if ($globalDBdriver == 'mysql') {
6795 6795
 				$query .= " AND MONTH(spotter_output.date) = :month";
6796
-				$query_values = array_merge($query_values,array(':month' => $month));
6796
+				$query_values = array_merge($query_values, array(':month' => $month));
6797 6797
 			} else {
6798 6798
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
6799
-				$query_values = array_merge($query_values,array(':month' => $month));
6799
+				$query_values = array_merge($query_values, array(':month' => $month));
6800 6800
 			}
6801 6801
 		}
6802 6802
 		if ($day != '') {
6803 6803
 			if ($globalDBdriver == 'mysql') {
6804 6804
 				$query .= " AND DAY(spotter_output.date) = :day";
6805
-				$query_values = array_merge($query_values,array(':day' => $day));
6805
+				$query_values = array_merge($query_values, array(':day' => $day));
6806 6806
 			} else {
6807 6807
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
6808
-				$query_values = array_merge($query_values,array(':day' => $day));
6808
+				$query_values = array_merge($query_values, array(':day' => $day));
6809 6809
 			}
6810 6810
 		}
6811 6811
                 $query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
@@ -6818,7 +6818,7 @@  discard block
 block discarded – undo
6818 6818
 		$airport_array = array();
6819 6819
 		$temp_array = array();
6820 6820
         
6821
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6821
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6822 6822
 		{
6823 6823
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
6824 6824
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -6837,11 +6837,11 @@  discard block
 block discarded – undo
6837 6837
 	* @return Array the airport list
6838 6838
 	*
6839 6839
 	*/
6840
-	public function countAllDetectedDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
6840
+	public function countAllDetectedDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
6841 6841
 	{
6842 6842
 		global $globalDBdriver;
6843
-		$filter_query = $this->getFilter($filters,true,true);
6844
-		$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
6843
+		$filter_query = $this->getFilter($filters, true, true);
6844
+		$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
6845 6845
 				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 ";
6846 6846
                 if ($olderthanmonths > 0) {
6847 6847
             		if ($globalDBdriver == 'mysql') {
@@ -6870,7 +6870,7 @@  discard block
 block discarded – undo
6870 6870
 		$airport_array = array();
6871 6871
 		$temp_array = array();
6872 6872
         
6873
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6873
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6874 6874
 		{
6875 6875
 			$temp_array['airline_icao'] = $row['airline_icao'];
6876 6876
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -6890,11 +6890,11 @@  discard block
 block discarded – undo
6890 6890
 	* @return Array the airport list
6891 6891
 	*
6892 6892
 	*/
6893
-	public function countAllDepartureAirportsByAirline($airline_icao,$filters = array())
6893
+	public function countAllDepartureAirportsByAirline($airline_icao, $filters = array())
6894 6894
 	{
6895
-		$filter_query = $this->getFilter($filters,true,true);
6896
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
6897
-		$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 
6895
+		$filter_query = $this->getFilter($filters, true, true);
6896
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
6897
+		$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 
6898 6898
 			    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 <> '' 
6899 6899
 			    GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
6900 6900
 			    ORDER BY airport_departure_icao_count DESC";
@@ -6906,7 +6906,7 @@  discard block
 block discarded – undo
6906 6906
 		$airport_array = array();
6907 6907
 		$temp_array = array();
6908 6908
         
6909
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6909
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6910 6910
 		{
6911 6911
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
6912 6912
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -6928,11 +6928,11 @@  discard block
 block discarded – undo
6928 6928
 	* @return Array the airport list
6929 6929
 	*
6930 6930
 	*/
6931
-	public function countAllDepartureAirportCountriesByAirline($airline_icao,$filters = array())
6931
+	public function countAllDepartureAirportCountriesByAirline($airline_icao, $filters = array())
6932 6932
 	{
6933
-		$filter_query = $this->getFilter($filters,true,true);
6934
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
6935
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6933
+		$filter_query = $this->getFilter($filters, true, true);
6934
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
6935
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6936 6936
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.airline_icao = :airline_icao 
6937 6937
                     GROUP BY spotter_output.departure_airport_country
6938 6938
 					ORDER BY airport_departure_country_count DESC";
@@ -6944,7 +6944,7 @@  discard block
 block discarded – undo
6944 6944
 		$airport_array = array();
6945 6945
 		$temp_array = array();
6946 6946
         
6947
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6947
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6948 6948
 		{
6949 6949
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
6950 6950
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -6963,11 +6963,11 @@  discard block
 block discarded – undo
6963 6963
 	* @return Array the airport list
6964 6964
 	*
6965 6965
 	*/
6966
-	public function countAllDepartureAirportsByAircraft($aircraft_icao,$filters = array())
6966
+	public function countAllDepartureAirportsByAircraft($aircraft_icao, $filters = array())
6967 6967
 	{
6968
-		$filter_query = $this->getFilter($filters,true,true);
6969
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
6970
-		$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 
6968
+		$filter_query = $this->getFilter($filters, true, true);
6969
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
6970
+		$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 
6971 6971
 			    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 <> '' 
6972 6972
 			    GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
6973 6973
 			    ORDER BY airport_departure_icao_count DESC";
@@ -6979,7 +6979,7 @@  discard block
 block discarded – undo
6979 6979
 		$airport_array = array();
6980 6980
 		$temp_array = array();
6981 6981
         
6982
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6982
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6983 6983
 		{
6984 6984
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
6985 6985
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -7000,11 +7000,11 @@  discard block
 block discarded – undo
7000 7000
 	* @return Array the airport list
7001 7001
 	*
7002 7002
 	*/
7003
-	public function countAllDepartureAirportCountriesByAircraft($aircraft_icao,$filters = array())
7003
+	public function countAllDepartureAirportCountriesByAircraft($aircraft_icao, $filters = array())
7004 7004
 	{
7005
-		$filter_query = $this->getFilter($filters,true,true);
7006
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
7007
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7005
+		$filter_query = $this->getFilter($filters, true, true);
7006
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
7007
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7008 7008
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.aircraft_icao = :aircraft_icao
7009 7009
                     GROUP BY spotter_output.departure_airport_country
7010 7010
 					ORDER BY airport_departure_country_count DESC";
@@ -7016,7 +7016,7 @@  discard block
 block discarded – undo
7016 7016
 		$airport_array = array();
7017 7017
 		$temp_array = array();
7018 7018
         
7019
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7019
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7020 7020
 		{
7021 7021
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
7022 7022
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -7034,11 +7034,11 @@  discard block
 block discarded – undo
7034 7034
 	* @return Array the airport list
7035 7035
 	*
7036 7036
 	*/
7037
-	public function countAllDepartureAirportsByRegistration($registration,$filters = array())
7037
+	public function countAllDepartureAirportsByRegistration($registration, $filters = array())
7038 7038
 	{
7039
-		$filter_query = $this->getFilter($filters,true,true);
7040
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
7041
-		$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 
7039
+		$filter_query = $this->getFilter($filters, true, true);
7040
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
7041
+		$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 
7042 7042
 			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 <> '' 
7043 7043
                     GROUP BY spotter_output.departure_airport_icao
7044 7044
 					ORDER BY airport_departure_icao_count DESC";
@@ -7050,7 +7050,7 @@  discard block
 block discarded – undo
7050 7050
 		$airport_array = array();
7051 7051
 		$temp_array = array();
7052 7052
         
7053
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7053
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7054 7054
 		{
7055 7055
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
7056 7056
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -7071,11 +7071,11 @@  discard block
 block discarded – undo
7071 7071
 	* @return Array the airport list
7072 7072
 	*
7073 7073
 	*/
7074
-	public function countAllDepartureAirportCountriesByRegistration($registration,$filters = array())
7074
+	public function countAllDepartureAirportCountriesByRegistration($registration, $filters = array())
7075 7075
 	{
7076
-		$filter_query = $this->getFilter($filters,true,true);
7077
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
7078
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7076
+		$filter_query = $this->getFilter($filters, true, true);
7077
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
7078
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7079 7079
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.registration = :registration 
7080 7080
                     GROUP BY spotter_output.departure_airport_country
7081 7081
 					ORDER BY airport_departure_country_count DESC";
@@ -7087,7 +7087,7 @@  discard block
 block discarded – undo
7087 7087
 		$airport_array = array();
7088 7088
 		$temp_array = array();
7089 7089
         
7090
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7090
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7091 7091
 		{
7092 7092
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
7093 7093
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -7105,11 +7105,11 @@  discard block
 block discarded – undo
7105 7105
 	* @return Array the airport list
7106 7106
 	*
7107 7107
 	*/
7108
-	public function countAllDepartureAirportsByAirport($airport_icao,$filters = array())
7108
+	public function countAllDepartureAirportsByAirport($airport_icao, $filters = array())
7109 7109
 	{
7110
-		$filter_query = $this->getFilter($filters,true,true);
7111
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
7112
-		$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 
7110
+		$filter_query = $this->getFilter($filters, true, true);
7111
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
7112
+		$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 
7113 7113
 			    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 <> '' 
7114 7114
 			    GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
7115 7115
 			    ORDER BY airport_departure_icao_count DESC";
@@ -7121,7 +7121,7 @@  discard block
 block discarded – undo
7121 7121
 		$airport_array = array();
7122 7122
 		$temp_array = array();
7123 7123
         
7124
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7124
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7125 7125
 		{
7126 7126
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
7127 7127
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -7142,11 +7142,11 @@  discard block
 block discarded – undo
7142 7142
 	* @return Array the airport list
7143 7143
 	*
7144 7144
 	*/
7145
-	public function countAllDepartureAirportCountriesByAirport($airport_icao,$filters = array())
7145
+	public function countAllDepartureAirportCountriesByAirport($airport_icao, $filters = array())
7146 7146
 	{
7147
-		$filter_query = $this->getFilter($filters,true,true);
7148
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
7149
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7147
+		$filter_query = $this->getFilter($filters, true, true);
7148
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
7149
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7150 7150
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.arrival_airport_icao = :airport_icao 
7151 7151
                     GROUP BY spotter_output.departure_airport_country
7152 7152
 					ORDER BY airport_departure_country_count DESC";
@@ -7158,7 +7158,7 @@  discard block
 block discarded – undo
7158 7158
 		$airport_array = array();
7159 7159
 		$temp_array = array();
7160 7160
         
7161
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7161
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7162 7162
 		{
7163 7163
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
7164 7164
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -7177,11 +7177,11 @@  discard block
 block discarded – undo
7177 7177
 	* @return Array the airport list
7178 7178
 	*
7179 7179
 	*/
7180
-	public function countAllDepartureAirportsByManufacturer($aircraft_manufacturer,$filters = array())
7180
+	public function countAllDepartureAirportsByManufacturer($aircraft_manufacturer, $filters = array())
7181 7181
 	{
7182
-		$filter_query = $this->getFilter($filters,true,true);
7183
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
7184
-		$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 
7182
+		$filter_query = $this->getFilter($filters, true, true);
7183
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
7184
+		$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 
7185 7185
 			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 <> '' 
7186 7186
                     GROUP BY spotter_output.departure_airport_icao
7187 7187
 					ORDER BY airport_departure_icao_count DESC";
@@ -7193,7 +7193,7 @@  discard block
 block discarded – undo
7193 7193
 		$airport_array = array();
7194 7194
 		$temp_array = array();
7195 7195
         
7196
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7196
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7197 7197
 		{
7198 7198
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
7199 7199
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -7214,11 +7214,11 @@  discard block
 block discarded – undo
7214 7214
 	* @return Array the airport list
7215 7215
 	*
7216 7216
 	*/
7217
-	public function countAllDepartureAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array())
7217
+	public function countAllDepartureAirportCountriesByManufacturer($aircraft_manufacturer, $filters = array())
7218 7218
 	{
7219
-		$filter_query = $this->getFilter($filters,true,true);
7220
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
7221
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7219
+		$filter_query = $this->getFilter($filters, true, true);
7220
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
7221
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7222 7222
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer 
7223 7223
                     GROUP BY spotter_output.departure_airport_country
7224 7224
 					ORDER BY airport_departure_country_count DESC";
@@ -7230,7 +7230,7 @@  discard block
 block discarded – undo
7230 7230
 		$airport_array = array();
7231 7231
 		$temp_array = array();
7232 7232
         
7233
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7233
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7234 7234
 		{
7235 7235
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
7236 7236
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -7248,11 +7248,11 @@  discard block
 block discarded – undo
7248 7248
 	* @return Array the airport list
7249 7249
 	*
7250 7250
 	*/
7251
-	public function countAllDepartureAirportsByDate($date,$filters = array())
7251
+	public function countAllDepartureAirportsByDate($date, $filters = array())
7252 7252
 	{
7253 7253
 		global $globalTimezone, $globalDBdriver;
7254
-		$filter_query = $this->getFilter($filters,true,true);
7255
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
7254
+		$filter_query = $this->getFilter($filters, true, true);
7255
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
7256 7256
 		if ($globalTimezone != '') {
7257 7257
 			date_default_timezone_set($globalTimezone);
7258 7258
 			$datetime = new DateTime($date);
@@ -7260,12 +7260,12 @@  discard block
 block discarded – undo
7260 7260
 		} else $offset = '+00:00';
7261 7261
 
7262 7262
 		if ($globalDBdriver == 'mysql') {
7263
-			$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 
7263
+			$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 
7264 7264
 					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
7265 7265
 					GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
7266 7266
 					ORDER BY airport_departure_icao_count DESC";
7267 7267
 		} else {
7268
-			$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 
7268
+			$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 
7269 7269
 					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
7270 7270
 					GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
7271 7271
 					ORDER BY airport_departure_icao_count DESC";
@@ -7277,7 +7277,7 @@  discard block
 block discarded – undo
7277 7277
 		$airport_array = array();
7278 7278
 		$temp_array = array();
7279 7279
         
7280
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7280
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7281 7281
 		{
7282 7282
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
7283 7283
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -7298,11 +7298,11 @@  discard block
 block discarded – undo
7298 7298
 	* @return Array the airport list
7299 7299
 	*
7300 7300
 	*/
7301
-	public function countAllDepartureAirportCountriesByDate($date,$filters = array())
7301
+	public function countAllDepartureAirportCountriesByDate($date, $filters = array())
7302 7302
 	{
7303 7303
 		global $globalTimezone, $globalDBdriver;
7304
-		$filter_query = $this->getFilter($filters,true,true);
7305
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
7304
+		$filter_query = $this->getFilter($filters, true, true);
7305
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
7306 7306
 		if ($globalTimezone != '') {
7307 7307
 			date_default_timezone_set($globalTimezone);
7308 7308
 			$datetime = new DateTime($date);
@@ -7310,12 +7310,12 @@  discard block
 block discarded – undo
7310 7310
 		} else $offset = '+00:00';
7311 7311
 
7312 7312
 		if ($globalDBdriver == 'mysql') {
7313
-			$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7313
+			$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7314 7314
 					FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
7315 7315
 					GROUP BY spotter_output.departure_airport_country
7316 7316
 					ORDER BY airport_departure_country_count DESC";
7317 7317
 		} else {
7318
-			$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7318
+			$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7319 7319
 					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 
7320 7320
 					GROUP BY spotter_output.departure_airport_country
7321 7321
 					ORDER BY airport_departure_country_count DESC";
@@ -7327,7 +7327,7 @@  discard block
 block discarded – undo
7327 7327
 		$airport_array = array();
7328 7328
 		$temp_array = array();
7329 7329
         
7330
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7330
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7331 7331
 		{
7332 7332
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
7333 7333
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -7345,11 +7345,11 @@  discard block
 block discarded – undo
7345 7345
 	* @return Array the airport list
7346 7346
 	*
7347 7347
 	*/
7348
-	public function countAllDepartureAirportsByIdent($ident,$filters = array())
7348
+	public function countAllDepartureAirportsByIdent($ident, $filters = array())
7349 7349
 	{
7350
-		$filter_query = $this->getFilter($filters,true,true);
7351
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
7352
-		$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 
7350
+		$filter_query = $this->getFilter($filters, true, true);
7351
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
7352
+		$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 
7353 7353
 		    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 
7354 7354
                     GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
7355 7355
 		    ORDER BY airport_departure_icao_count DESC";
@@ -7361,7 +7361,7 @@  discard block
 block discarded – undo
7361 7361
 		$airport_array = array();
7362 7362
 		$temp_array = array();
7363 7363
         
7364
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7364
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7365 7365
 		{
7366 7366
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
7367 7367
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -7381,11 +7381,11 @@  discard block
 block discarded – undo
7381 7381
 	* @return Array the airport list
7382 7382
 	*
7383 7383
 	*/
7384
-	public function countAllDepartureAirportsByOwner($owner,$filters = array())
7384
+	public function countAllDepartureAirportsByOwner($owner, $filters = array())
7385 7385
 	{
7386
-		$filter_query = $this->getFilter($filters,true,true);
7387
-		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
7388
-		$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 
7386
+		$filter_query = $this->getFilter($filters, true, true);
7387
+		$owner = filter_var($owner, FILTER_SANITIZE_STRING);
7388
+		$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 
7389 7389
 		    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 
7390 7390
                     GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
7391 7391
 		    ORDER BY airport_departure_icao_count DESC";
@@ -7397,7 +7397,7 @@  discard block
 block discarded – undo
7397 7397
 		$airport_array = array();
7398 7398
 		$temp_array = array();
7399 7399
         
7400
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7400
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7401 7401
 		{
7402 7402
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
7403 7403
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -7417,11 +7417,11 @@  discard block
 block discarded – undo
7417 7417
 	* @return Array the airport list
7418 7418
 	*
7419 7419
 	*/
7420
-	public function countAllDepartureAirportsByPilot($pilot,$filters = array())
7420
+	public function countAllDepartureAirportsByPilot($pilot, $filters = array())
7421 7421
 	{
7422
-		$filter_query = $this->getFilter($filters,true,true);
7423
-		$pilot = filter_var($pilot,FILTER_SANITIZE_STRING);
7424
-		$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 
7422
+		$filter_query = $this->getFilter($filters, true, true);
7423
+		$pilot = filter_var($pilot, FILTER_SANITIZE_STRING);
7424
+		$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 
7425 7425
 		    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) 
7426 7426
                     GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
7427 7427
 		    ORDER BY airport_departure_icao_count DESC";
@@ -7432,7 +7432,7 @@  discard block
 block discarded – undo
7432 7432
 		$airport_array = array();
7433 7433
 		$temp_array = array();
7434 7434
         
7435
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7435
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7436 7436
 		{
7437 7437
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
7438 7438
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -7454,11 +7454,11 @@  discard block
 block discarded – undo
7454 7454
 	* @return Array the airport list
7455 7455
 	*
7456 7456
 	*/
7457
-	public function countAllDepartureAirportCountriesByIdent($ident,$filters = array())
7457
+	public function countAllDepartureAirportCountriesByIdent($ident, $filters = array())
7458 7458
 	{
7459
-		$filter_query = $this->getFilter($filters,true,true);
7460
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
7461
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7459
+		$filter_query = $this->getFilter($filters, true, true);
7460
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
7461
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7462 7462
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.ident = :ident 
7463 7463
                     GROUP BY spotter_output.departure_airport_country
7464 7464
 					ORDER BY airport_departure_country_count DESC";
@@ -7470,7 +7470,7 @@  discard block
 block discarded – undo
7470 7470
 		$airport_array = array();
7471 7471
 		$temp_array = array();
7472 7472
         
7473
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7473
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7474 7474
 		{
7475 7475
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
7476 7476
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -7487,11 +7487,11 @@  discard block
 block discarded – undo
7487 7487
 	* @return Array the airport list
7488 7488
 	*
7489 7489
 	*/
7490
-	public function countAllDepartureAirportCountriesByOwner($owner,$filters = array())
7490
+	public function countAllDepartureAirportCountriesByOwner($owner, $filters = array())
7491 7491
 	{
7492
-		$filter_query = $this->getFilter($filters,true,true);
7493
-		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
7494
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7492
+		$filter_query = $this->getFilter($filters, true, true);
7493
+		$owner = filter_var($owner, FILTER_SANITIZE_STRING);
7494
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7495 7495
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.owner_name = :owner 
7496 7496
 			GROUP BY spotter_output.departure_airport_country
7497 7497
 			ORDER BY airport_departure_country_count DESC";
@@ -7507,11 +7507,11 @@  discard block
 block discarded – undo
7507 7507
 	* @return Array the airport list
7508 7508
 	*
7509 7509
 	*/
7510
-	public function countAllDepartureAirportCountriesByPilot($pilot,$filters = array())
7510
+	public function countAllDepartureAirportCountriesByPilot($pilot, $filters = array())
7511 7511
 	{
7512
-		$filter_query = $this->getFilter($filters,true,true);
7513
-		$pilot = filter_var($pilot,FILTER_SANITIZE_STRING);
7514
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7512
+		$filter_query = $this->getFilter($filters, true, true);
7513
+		$pilot = filter_var($pilot, FILTER_SANITIZE_STRING);
7514
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7515 7515
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND (spotter_output.pilot_name = :pilot OR spotter_output.pilot_id = :pilot) 
7516 7516
 			GROUP BY spotter_output.departure_airport_country
7517 7517
 			ORDER BY airport_departure_country_count DESC";
@@ -7529,12 +7529,12 @@  discard block
 block discarded – undo
7529 7529
 	* @return Array the airport list
7530 7530
 	*
7531 7531
 	*/
7532
-	public function countAllDepartureAirportsByCountry($country,$filters = array())
7532
+	public function countAllDepartureAirportsByCountry($country, $filters = array())
7533 7533
 	{
7534
-		$filter_query = $this->getFilter($filters,true,true);
7535
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
7534
+		$filter_query = $this->getFilter($filters, true, true);
7535
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
7536 7536
 
7537
-		$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 
7537
+		$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 
7538 7538
 			    FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country
7539 7539
 			    GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
7540 7540
 			    ORDER BY airport_departure_icao_count DESC";
@@ -7546,7 +7546,7 @@  discard block
 block discarded – undo
7546 7546
 		$airport_array = array();
7547 7547
 		$temp_array = array();
7548 7548
         
7549
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7549
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7550 7550
 		{
7551 7551
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
7552 7552
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -7567,11 +7567,11 @@  discard block
 block discarded – undo
7567 7567
 	* @return Array the airport list
7568 7568
 	*
7569 7569
 	*/
7570
-	public function countAllDepartureAirportCountriesByCountry($country,$filters = array())
7570
+	public function countAllDepartureAirportCountriesByCountry($country, $filters = array())
7571 7571
 	{
7572
-		$filter_query = $this->getFilter($filters,true,true);
7573
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
7574
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7572
+		$filter_query = $this->getFilter($filters, true, true);
7573
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
7574
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7575 7575
 			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 
7576 7576
                     GROUP BY spotter_output.departure_airport_country
7577 7577
 					ORDER BY airport_departure_country_count DESC";
@@ -7583,7 +7583,7 @@  discard block
 block discarded – undo
7583 7583
 		$airport_array = array();
7584 7584
 		$temp_array = array();
7585 7585
         
7586
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7586
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7587 7587
 		{
7588 7588
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
7589 7589
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -7606,11 +7606,11 @@  discard block
 block discarded – undo
7606 7606
 	* @return Array the airport list
7607 7607
 	*
7608 7608
 	*/
7609
-	public function countAllArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array(),$year = '',$month = '',$day = '')
7609
+	public function countAllArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false, $filters = array(), $year = '', $month = '', $day = '')
7610 7610
 	{
7611 7611
 		global $globalDBdriver;
7612
-		$filter_query = $this->getFilter($filters,true,true);
7613
-		$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 
7612
+		$filter_query = $this->getFilter($filters, true, true);
7613
+		$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 
7614 7614
 				FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> ''";
7615 7615
                 if ($olderthanmonths > 0) {
7616 7616
             		if ($globalDBdriver == 'mysql') {
@@ -7630,28 +7630,28 @@  discard block
 block discarded – undo
7630 7630
 		if ($year != '') {
7631 7631
 			if ($globalDBdriver == 'mysql') {
7632 7632
 				$query .= " AND YEAR(spotter_output.date) = :year";
7633
-				$query_values = array_merge($query_values,array(':year' => $year));
7633
+				$query_values = array_merge($query_values, array(':year' => $year));
7634 7634
 			} else {
7635 7635
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
7636
-				$query_values = array_merge($query_values,array(':year' => $year));
7636
+				$query_values = array_merge($query_values, array(':year' => $year));
7637 7637
 			}
7638 7638
 		}
7639 7639
 		if ($month != '') {
7640 7640
 			if ($globalDBdriver == 'mysql') {
7641 7641
 				$query .= " AND MONTH(spotter_output.date) = :month";
7642
-				$query_values = array_merge($query_values,array(':month' => $month));
7642
+				$query_values = array_merge($query_values, array(':month' => $month));
7643 7643
 			} else {
7644 7644
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
7645
-				$query_values = array_merge($query_values,array(':month' => $month));
7645
+				$query_values = array_merge($query_values, array(':month' => $month));
7646 7646
 			}
7647 7647
 		}
7648 7648
 		if ($day != '') {
7649 7649
 			if ($globalDBdriver == 'mysql') {
7650 7650
 				$query .= " AND DAY(spotter_output.date) = :day";
7651
-				$query_values = array_merge($query_values,array(':day' => $day));
7651
+				$query_values = array_merge($query_values, array(':day' => $day));
7652 7652
 			} else {
7653 7653
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
7654
-				$query_values = array_merge($query_values,array(':day' => $day));
7654
+				$query_values = array_merge($query_values, array(':day' => $day));
7655 7655
 			}
7656 7656
 		}
7657 7657
                 $query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
@@ -7665,7 +7665,7 @@  discard block
 block discarded – undo
7665 7665
 		$airport_array = array();
7666 7666
 		$temp_array = array();
7667 7667
         
7668
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7668
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7669 7669
 		{
7670 7670
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
7671 7671
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -7688,11 +7688,11 @@  discard block
 block discarded – undo
7688 7688
 	* @return Array the airport list
7689 7689
 	*
7690 7690
 	*/
7691
-	public function countAllArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array())
7691
+	public function countAllArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false, $filters = array())
7692 7692
 	{
7693 7693
 		global $globalDBdriver;
7694
-		$filter_query = $this->getFilter($filters,true,true);
7695
-		$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 
7694
+		$filter_query = $this->getFilter($filters, true, true);
7695
+		$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 
7696 7696
 			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 <> '' ";
7697 7697
                 if ($olderthanmonths > 0) {
7698 7698
             		if ($globalDBdriver == 'mysql') {
@@ -7722,7 +7722,7 @@  discard block
 block discarded – undo
7722 7722
 		$airport_array = array();
7723 7723
 		$temp_array = array();
7724 7724
         
7725
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7725
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7726 7726
 		{
7727 7727
 			$temp_array['airline_icao'] = $row['airline_icao'];
7728 7728
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
@@ -7747,11 +7747,11 @@  discard block
 block discarded – undo
7747 7747
 	* @return Array the airport list
7748 7748
 	*
7749 7749
 	*/
7750
-	public function countAllDetectedArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array(),$year = '',$month = '',$day = '')
7750
+	public function countAllDetectedArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false, $filters = array(), $year = '', $month = '', $day = '')
7751 7751
 	{
7752 7752
 		global $globalDBdriver;
7753
-		$filter_query = $this->getFilter($filters,true,true);
7754
-		$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 
7753
+		$filter_query = $this->getFilter($filters, true, true);
7754
+		$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 
7755 7755
 			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";
7756 7756
                 if ($olderthanmonths > 0) {
7757 7757
             		if ($globalDBdriver == 'mysql') {
@@ -7771,28 +7771,28 @@  discard block
 block discarded – undo
7771 7771
 		if ($year != '') {
7772 7772
 			if ($globalDBdriver == 'mysql') {
7773 7773
 				$query .= " AND YEAR(spotter_output.date) = :year";
7774
-				$query_values = array_merge($query_values,array(':year' => $year));
7774
+				$query_values = array_merge($query_values, array(':year' => $year));
7775 7775
 			} else {
7776 7776
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
7777
-				$query_values = array_merge($query_values,array(':year' => $year));
7777
+				$query_values = array_merge($query_values, array(':year' => $year));
7778 7778
 			}
7779 7779
 		}
7780 7780
 		if ($month != '') {
7781 7781
 			if ($globalDBdriver == 'mysql') {
7782 7782
 				$query .= " AND MONTH(spotter_output.date) = :month";
7783
-				$query_values = array_merge($query_values,array(':month' => $month));
7783
+				$query_values = array_merge($query_values, array(':month' => $month));
7784 7784
 			} else {
7785 7785
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
7786
-				$query_values = array_merge($query_values,array(':month' => $month));
7786
+				$query_values = array_merge($query_values, array(':month' => $month));
7787 7787
 			}
7788 7788
 		}
7789 7789
 		if ($day != '') {
7790 7790
 			if ($globalDBdriver == 'mysql') {
7791 7791
 				$query .= " AND DAY(spotter_output.date) = :day";
7792
-				$query_values = array_merge($query_values,array(':day' => $day));
7792
+				$query_values = array_merge($query_values, array(':day' => $day));
7793 7793
 			} else {
7794 7794
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
7795
-				$query_values = array_merge($query_values,array(':day' => $day));
7795
+				$query_values = array_merge($query_values, array(':day' => $day));
7796 7796
 			}
7797 7797
 		}
7798 7798
                 $query .= " GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
@@ -7805,7 +7805,7 @@  discard block
 block discarded – undo
7805 7805
       
7806 7806
 		$airport_array = array();
7807 7807
 		$temp_array = array();
7808
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7808
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7809 7809
 		{
7810 7810
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
7811 7811
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -7828,11 +7828,11 @@  discard block
 block discarded – undo
7828 7828
 	* @return Array the airport list
7829 7829
 	*
7830 7830
 	*/
7831
-	public function countAllDetectedArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array())
7831
+	public function countAllDetectedArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false, $filters = array())
7832 7832
 	{
7833 7833
 		global $globalDBdriver;
7834
-		$filter_query = $this->getFilter($filters,true,true);
7835
-		$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 
7834
+		$filter_query = $this->getFilter($filters, true, true);
7835
+		$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 
7836 7836
 			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 ";
7837 7837
                 if ($olderthanmonths > 0) {
7838 7838
             		if ($globalDBdriver == 'mysql') {
@@ -7862,7 +7862,7 @@  discard block
 block discarded – undo
7862 7862
 		$airport_array = array();
7863 7863
 		$temp_array = array();
7864 7864
         
7865
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7865
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7866 7866
 		{
7867 7867
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
7868 7868
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -7888,9 +7888,9 @@  discard block
 block discarded – undo
7888 7888
 	*/
7889 7889
 	public function countAllArrivalAirportsByAirline($airline_icao, $filters = array())
7890 7890
 	{
7891
-		$filter_query = $this->getFilter($filters,true,true);
7892
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
7893
-		$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 
7891
+		$filter_query = $this->getFilter($filters, true, true);
7892
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
7893
+		$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 
7894 7894
 			    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 
7895 7895
 			    GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
7896 7896
 			    ORDER BY airport_arrival_icao_count DESC";
@@ -7901,7 +7901,7 @@  discard block
 block discarded – undo
7901 7901
 		$airport_array = array();
7902 7902
 		$temp_array = array();
7903 7903
         
7904
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7904
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7905 7905
 		{
7906 7906
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
7907 7907
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -7922,12 +7922,12 @@  discard block
 block discarded – undo
7922 7922
 	* @return Array the airport list
7923 7923
 	*
7924 7924
 	*/
7925
-	public function countAllArrivalAirportCountriesByAirline($airline_icao,$filters = array())
7925
+	public function countAllArrivalAirportCountriesByAirline($airline_icao, $filters = array())
7926 7926
 	{
7927
-		$filter_query = $this->getFilter($filters,true,true);
7928
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
7927
+		$filter_query = $this->getFilter($filters, true, true);
7928
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
7929 7929
 					
7930
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7930
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7931 7931
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.airline_icao = :airline_icao 
7932 7932
                     GROUP BY spotter_output.arrival_airport_country
7933 7933
 					ORDER BY airport_arrival_country_count DESC";
@@ -7939,7 +7939,7 @@  discard block
 block discarded – undo
7939 7939
 		$airport_array = array();
7940 7940
 		$temp_array = array();
7941 7941
         
7942
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7942
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7943 7943
 		{
7944 7944
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
7945 7945
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -7957,11 +7957,11 @@  discard block
 block discarded – undo
7957 7957
 	* @return Array the airport list
7958 7958
 	*
7959 7959
 	*/
7960
-	public function countAllArrivalAirportsByAircraft($aircraft_icao,$filters = array())
7960
+	public function countAllArrivalAirportsByAircraft($aircraft_icao, $filters = array())
7961 7961
 	{
7962
-		$filter_query = $this->getFilter($filters,true,true);
7963
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
7964
-		$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 
7962
+		$filter_query = $this->getFilter($filters, true, true);
7963
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
7964
+		$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 
7965 7965
 			    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 
7966 7966
 			    GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
7967 7967
 			    ORDER BY airport_arrival_icao_count DESC";
@@ -7973,7 +7973,7 @@  discard block
 block discarded – undo
7973 7973
 		$airport_array = array();
7974 7974
 		$temp_array = array();
7975 7975
         
7976
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7976
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7977 7977
 		{
7978 7978
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
7979 7979
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -7995,11 +7995,11 @@  discard block
 block discarded – undo
7995 7995
 	* @return Array the airport list
7996 7996
 	*
7997 7997
 	*/
7998
-	public function countAllArrivalAirportCountriesByAircraft($aircraft_icao,$filters = array())
7998
+	public function countAllArrivalAirportCountriesByAircraft($aircraft_icao, $filters = array())
7999 7999
 	{
8000
-		$filter_query = $this->getFilter($filters,true,true);
8001
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
8002
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8000
+		$filter_query = $this->getFilter($filters, true, true);
8001
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
8002
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8003 8003
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.aircraft_icao = :aircraft_icao
8004 8004
                     GROUP BY spotter_output.arrival_airport_country
8005 8005
 					ORDER BY airport_arrival_country_count DESC";
@@ -8011,7 +8011,7 @@  discard block
 block discarded – undo
8011 8011
 		$airport_array = array();
8012 8012
 		$temp_array = array();
8013 8013
         
8014
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8014
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8015 8015
 		{
8016 8016
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
8017 8017
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -8029,12 +8029,12 @@  discard block
 block discarded – undo
8029 8029
 	* @return Array the airport list
8030 8030
 	*
8031 8031
 	*/
8032
-	public function countAllArrivalAirportsByRegistration($registration,$filters = array())
8032
+	public function countAllArrivalAirportsByRegistration($registration, $filters = array())
8033 8033
 	{
8034
-		$filter_query = $this->getFilter($filters,true,true);
8035
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
8034
+		$filter_query = $this->getFilter($filters, true, true);
8035
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
8036 8036
 
8037
-		$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 
8037
+		$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 
8038 8038
 			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 
8039 8039
                     GROUP BY spotter_output.arrival_airport_icao
8040 8040
 					ORDER BY airport_arrival_icao_count DESC";
@@ -8046,7 +8046,7 @@  discard block
 block discarded – undo
8046 8046
 		$airport_array = array();
8047 8047
 		$temp_array = array();
8048 8048
         
8049
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8049
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8050 8050
 		{
8051 8051
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
8052 8052
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -8067,11 +8067,11 @@  discard block
 block discarded – undo
8067 8067
 	* @return Array the airport list
8068 8068
 	*
8069 8069
 	*/
8070
-	public function countAllArrivalAirportCountriesByRegistration($registration,$filters = array())
8070
+	public function countAllArrivalAirportCountriesByRegistration($registration, $filters = array())
8071 8071
 	{
8072
-		$filter_query = $this->getFilter($filters,true,true);
8073
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
8074
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8072
+		$filter_query = $this->getFilter($filters, true, true);
8073
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
8074
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8075 8075
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.registration = :registration 
8076 8076
                     GROUP BY spotter_output.arrival_airport_country
8077 8077
 					ORDER BY airport_arrival_country_count DESC";
@@ -8083,7 +8083,7 @@  discard block
 block discarded – undo
8083 8083
 		$airport_array = array();
8084 8084
 		$temp_array = array();
8085 8085
         
8086
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8086
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8087 8087
 		{
8088 8088
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
8089 8089
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -8102,11 +8102,11 @@  discard block
 block discarded – undo
8102 8102
 	* @return Array the airport list
8103 8103
 	*
8104 8104
 	*/
8105
-	public function countAllArrivalAirportsByAirport($airport_icao,$filters = array())
8105
+	public function countAllArrivalAirportsByAirport($airport_icao, $filters = array())
8106 8106
 	{
8107
-		$filter_query = $this->getFilter($filters,true,true);
8108
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
8109
-		$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 
8107
+		$filter_query = $this->getFilter($filters, true, true);
8108
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
8109
+		$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 
8110 8110
 			    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 
8111 8111
 			    GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
8112 8112
 			    ORDER BY airport_arrival_icao_count DESC";
@@ -8118,7 +8118,7 @@  discard block
 block discarded – undo
8118 8118
 		$airport_array = array();
8119 8119
 		$temp_array = array();
8120 8120
         
8121
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8121
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8122 8122
 		{
8123 8123
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
8124 8124
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -8139,11 +8139,11 @@  discard block
 block discarded – undo
8139 8139
 	* @return Array the airport list
8140 8140
 	*
8141 8141
 	*/
8142
-	public function countAllArrivalAirportCountriesByAirport($airport_icao,$filters = array())
8142
+	public function countAllArrivalAirportCountriesByAirport($airport_icao, $filters = array())
8143 8143
 	{
8144
-		$filter_query = $this->getFilter($filters,true,true);
8145
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
8146
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8144
+		$filter_query = $this->getFilter($filters, true, true);
8145
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
8146
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8147 8147
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.departure_airport_icao = :airport_icao 
8148 8148
                     GROUP BY spotter_output.arrival_airport_country
8149 8149
 					ORDER BY airport_arrival_country_count DESC";
@@ -8155,7 +8155,7 @@  discard block
 block discarded – undo
8155 8155
 		$airport_array = array();
8156 8156
 		$temp_array = array();
8157 8157
         
8158
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8158
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8159 8159
 		{
8160 8160
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
8161 8161
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -8173,11 +8173,11 @@  discard block
 block discarded – undo
8173 8173
 	* @return Array the airport list
8174 8174
 	*
8175 8175
 	*/
8176
-	public function countAllArrivalAirportsByManufacturer($aircraft_manufacturer,$filters = array())
8176
+	public function countAllArrivalAirportsByManufacturer($aircraft_manufacturer, $filters = array())
8177 8177
 	{
8178
-		$filter_query = $this->getFilter($filters,true,true);
8179
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
8180
-		$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 
8178
+		$filter_query = $this->getFilter($filters, true, true);
8179
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
8180
+		$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 
8181 8181
 			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 
8182 8182
                     GROUP BY spotter_output.arrival_airport_icao
8183 8183
 					ORDER BY airport_arrival_icao_count DESC";
@@ -8189,7 +8189,7 @@  discard block
 block discarded – undo
8189 8189
 		$airport_array = array();
8190 8190
 		$temp_array = array();
8191 8191
         
8192
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8192
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8193 8193
 		{
8194 8194
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
8195 8195
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -8211,11 +8211,11 @@  discard block
 block discarded – undo
8211 8211
 	* @return Array the airport list
8212 8212
 	*
8213 8213
 	*/
8214
-	public function countAllArrivalAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array())
8214
+	public function countAllArrivalAirportCountriesByManufacturer($aircraft_manufacturer, $filters = array())
8215 8215
 	{
8216
-		$filter_query = $this->getFilter($filters,true,true);
8217
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
8218
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8216
+		$filter_query = $this->getFilter($filters, true, true);
8217
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
8218
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8219 8219
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer 
8220 8220
                     GROUP BY spotter_output.arrival_airport_country
8221 8221
 					ORDER BY airport_arrival_country_count DESC";
@@ -8227,7 +8227,7 @@  discard block
 block discarded – undo
8227 8227
 		$airport_array = array();
8228 8228
 		$temp_array = array();
8229 8229
         
8230
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8230
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8231 8231
 		{
8232 8232
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
8233 8233
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -8246,11 +8246,11 @@  discard block
 block discarded – undo
8246 8246
 	* @return Array the airport list
8247 8247
 	*
8248 8248
 	*/
8249
-	public function countAllArrivalAirportsByDate($date,$filters = array())
8249
+	public function countAllArrivalAirportsByDate($date, $filters = array())
8250 8250
 	{
8251 8251
 		global $globalTimezone, $globalDBdriver;
8252
-		$filter_query = $this->getFilter($filters,true,true);
8253
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
8252
+		$filter_query = $this->getFilter($filters, true, true);
8253
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
8254 8254
 		if ($globalTimezone != '') {
8255 8255
 			date_default_timezone_set($globalTimezone);
8256 8256
 			$datetime = new DateTime($date);
@@ -8258,12 +8258,12 @@  discard block
 block discarded – undo
8258 8258
 		} else $offset = '+00:00';
8259 8259
 
8260 8260
 		if ($globalDBdriver == 'mysql') {
8261
-			$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 
8261
+			$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 
8262 8262
 					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  
8263 8263
 					GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
8264 8264
 					ORDER BY airport_arrival_icao_count DESC";
8265 8265
 		} else {
8266
-			$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 
8266
+			$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 
8267 8267
 					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  
8268 8268
 					GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
8269 8269
 					ORDER BY airport_arrival_icao_count DESC";
@@ -8275,7 +8275,7 @@  discard block
 block discarded – undo
8275 8275
 		$airport_array = array();
8276 8276
 		$temp_array = array();
8277 8277
         
8278
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8278
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8279 8279
 		{
8280 8280
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
8281 8281
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -8299,8 +8299,8 @@  discard block
 block discarded – undo
8299 8299
 	public function countAllArrivalAirportCountriesByDate($date, $filters = array())
8300 8300
 	{
8301 8301
 		global $globalTimezone, $globalDBdriver;
8302
-		$filter_query = $this->getFilter($filters,true,true);
8303
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
8302
+		$filter_query = $this->getFilter($filters, true, true);
8303
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
8304 8304
 		if ($globalTimezone != '') {
8305 8305
 			date_default_timezone_set($globalTimezone);
8306 8306
 			$datetime = new DateTime($date);
@@ -8308,12 +8308,12 @@  discard block
 block discarded – undo
8308 8308
 		} else $offset = '+00:00';
8309 8309
 
8310 8310
 		if ($globalDBdriver == 'mysql') {
8311
-			$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8311
+			$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8312 8312
 					FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
8313 8313
 					GROUP BY spotter_output.arrival_airport_country
8314 8314
 					ORDER BY airport_arrival_country_count DESC";
8315 8315
 		} else {
8316
-			$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8316
+			$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8317 8317
 					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 
8318 8318
 					GROUP BY spotter_output.arrival_airport_country
8319 8319
 					ORDER BY airport_arrival_country_count DESC";
@@ -8325,7 +8325,7 @@  discard block
 block discarded – undo
8325 8325
 		$airport_array = array();
8326 8326
 		$temp_array = array();
8327 8327
         
8328
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8328
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8329 8329
 		{
8330 8330
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
8331 8331
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -8343,11 +8343,11 @@  discard block
 block discarded – undo
8343 8343
 	* @return Array the airport list
8344 8344
 	*
8345 8345
 	*/
8346
-	public function countAllArrivalAirportsByIdent($ident,$filters = array())
8346
+	public function countAllArrivalAirportsByIdent($ident, $filters = array())
8347 8347
 	{
8348
-		$filter_query = $this->getFilter($filters,true,true);
8349
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
8350
-		$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 
8348
+		$filter_query = $this->getFilter($filters, true, true);
8349
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
8350
+		$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 
8351 8351
 		    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  
8352 8352
                     GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
8353 8353
 		    ORDER BY airport_arrival_icao_count DESC";
@@ -8359,7 +8359,7 @@  discard block
 block discarded – undo
8359 8359
 		$airport_array = array();
8360 8360
 		$temp_array = array();
8361 8361
         
8362
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8362
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8363 8363
 		{
8364 8364
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
8365 8365
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -8379,11 +8379,11 @@  discard block
 block discarded – undo
8379 8379
 	* @return Array the airport list
8380 8380
 	*
8381 8381
 	*/
8382
-	public function countAllArrivalAirportsByOwner($owner,$filters = array())
8382
+	public function countAllArrivalAirportsByOwner($owner, $filters = array())
8383 8383
 	{
8384
-		$filter_query = $this->getFilter($filters,true,true);
8385
-		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
8386
-		$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 
8384
+		$filter_query = $this->getFilter($filters, true, true);
8385
+		$owner = filter_var($owner, FILTER_SANITIZE_STRING);
8386
+		$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 
8387 8387
 		    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 
8388 8388
                     GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
8389 8389
 		    ORDER BY airport_arrival_icao_count DESC";
@@ -8394,7 +8394,7 @@  discard block
 block discarded – undo
8394 8394
 		$airport_array = array();
8395 8395
 		$temp_array = array();
8396 8396
         
8397
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8397
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8398 8398
 		{
8399 8399
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
8400 8400
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -8414,11 +8414,11 @@  discard block
 block discarded – undo
8414 8414
 	* @return Array the airport list
8415 8415
 	*
8416 8416
 	*/
8417
-	public function countAllArrivalAirportsByPilot($pilot,$filters = array())
8417
+	public function countAllArrivalAirportsByPilot($pilot, $filters = array())
8418 8418
 	{
8419
-		$filter_query = $this->getFilter($filters,true,true);
8420
-		$pilot = filter_var($pilot,FILTER_SANITIZE_STRING);
8421
-		$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 
8419
+		$filter_query = $this->getFilter($filters, true, true);
8420
+		$pilot = filter_var($pilot, FILTER_SANITIZE_STRING);
8421
+		$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 
8422 8422
 		    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) 
8423 8423
                     GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
8424 8424
 		    ORDER BY airport_arrival_icao_count DESC";
@@ -8429,7 +8429,7 @@  discard block
 block discarded – undo
8429 8429
 		$airport_array = array();
8430 8430
 		$temp_array = array();
8431 8431
         
8432
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8432
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8433 8433
 		{
8434 8434
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
8435 8435
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -8451,9 +8451,9 @@  discard block
 block discarded – undo
8451 8451
 	*/
8452 8452
 	public function countAllArrivalAirportCountriesByIdent($ident, $filters = array())
8453 8453
 	{
8454
-		$filter_query = $this->getFilter($filters,true,true);
8455
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
8456
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8454
+		$filter_query = $this->getFilter($filters, true, true);
8455
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
8456
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8457 8457
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.ident = :ident 
8458 8458
                     GROUP BY spotter_output.arrival_airport_country
8459 8459
 					ORDER BY airport_arrival_country_count DESC";
@@ -8465,7 +8465,7 @@  discard block
 block discarded – undo
8465 8465
 		$airport_array = array();
8466 8466
 		$temp_array = array();
8467 8467
         
8468
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8468
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8469 8469
 		{
8470 8470
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
8471 8471
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -8484,9 +8484,9 @@  discard block
 block discarded – undo
8484 8484
 	*/
8485 8485
 	public function countAllArrivalAirportCountriesByOwner($owner, $filters = array())
8486 8486
 	{
8487
-		$filter_query = $this->getFilter($filters,true,true);
8488
-		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
8489
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8487
+		$filter_query = $this->getFilter($filters, true, true);
8488
+		$owner = filter_var($owner, FILTER_SANITIZE_STRING);
8489
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8490 8490
 		    FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.owner_name = :owner 
8491 8491
                     GROUP BY spotter_output.arrival_airport_country
8492 8492
 		    ORDER BY airport_arrival_country_count DESC";
@@ -8504,9 +8504,9 @@  discard block
 block discarded – undo
8504 8504
 	*/
8505 8505
 	public function countAllArrivalAirportCountriesByPilot($pilot, $filters = array())
8506 8506
 	{
8507
-		$filter_query = $this->getFilter($filters,true,true);
8508
-		$pilot = filter_var($pilot,FILTER_SANITIZE_STRING);
8509
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8507
+		$filter_query = $this->getFilter($filters, true, true);
8508
+		$pilot = filter_var($pilot, FILTER_SANITIZE_STRING);
8509
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8510 8510
 		    FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND (spotter_output.pilot_name = :pilot OR spotter_output.pilot_id = :pilot) 
8511 8511
                     GROUP BY spotter_output.arrival_airport_country
8512 8512
 		    ORDER BY airport_arrival_country_count DESC";
@@ -8524,11 +8524,11 @@  discard block
 block discarded – undo
8524 8524
 	* @return Array the airport list
8525 8525
 	*
8526 8526
 	*/
8527
-	public function countAllArrivalAirportsByCountry($country,$filters = array())
8527
+	public function countAllArrivalAirportsByCountry($country, $filters = array())
8528 8528
 	{
8529
-		$filter_query = $this->getFilter($filters,true,true);
8530
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
8531
-		$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 
8529
+		$filter_query = $this->getFilter($filters, true, true);
8530
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
8531
+		$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 
8532 8532
 			    FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country  
8533 8533
 			    GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
8534 8534
 			    ORDER BY airport_arrival_icao_count DESC";
@@ -8540,7 +8540,7 @@  discard block
 block discarded – undo
8540 8540
 		$airport_array = array();
8541 8541
 		$temp_array = array();
8542 8542
         
8543
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8543
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8544 8544
 		{
8545 8545
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
8546 8546
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -8561,12 +8561,12 @@  discard block
 block discarded – undo
8561 8561
 	* @return Array the airport list
8562 8562
 	*
8563 8563
 	*/
8564
-	public function countAllArrivalAirportCountriesByCountry($country,$filters = array())
8564
+	public function countAllArrivalAirportCountriesByCountry($country, $filters = array())
8565 8565
 	{
8566 8566
 		global $globalDBdriver;
8567
-		$filter_query = $this->getFilter($filters,true,true);
8568
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
8569
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8567
+		$filter_query = $this->getFilter($filters, true, true);
8568
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
8569
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8570 8570
 			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 
8571 8571
                     GROUP BY spotter_output.arrival_airport_country
8572 8572
 					ORDER BY airport_arrival_country_count DESC";
@@ -8578,7 +8578,7 @@  discard block
 block discarded – undo
8578 8578
 		$airport_array = array();
8579 8579
 		$temp_array = array();
8580 8580
         
8581
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8581
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8582 8582
 		{
8583 8583
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
8584 8584
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -8597,38 +8597,38 @@  discard block
 block discarded – undo
8597 8597
 	* @return Array the airport departure list
8598 8598
 	*
8599 8599
 	*/
8600
-	public function countAllDepartureCountries($filters = array(),$year = '',$month = '', $day = '')
8600
+	public function countAllDepartureCountries($filters = array(), $year = '', $month = '', $day = '')
8601 8601
 	{
8602 8602
 		global $globalDBdriver;
8603
-		$filter_query = $this->getFilter($filters,true,true);
8604
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
8603
+		$filter_query = $this->getFilter($filters, true, true);
8604
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
8605 8605
 				FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> ''";
8606 8606
 		$query_values = array();
8607 8607
 		if ($year != '') {
8608 8608
 			if ($globalDBdriver == 'mysql') {
8609 8609
 				$query .= " AND YEAR(spotter_output.date) = :year";
8610
-				$query_values = array_merge($query_values,array(':year' => $year));
8610
+				$query_values = array_merge($query_values, array(':year' => $year));
8611 8611
 			} else {
8612 8612
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
8613
-				$query_values = array_merge($query_values,array(':year' => $year));
8613
+				$query_values = array_merge($query_values, array(':year' => $year));
8614 8614
 			}
8615 8615
 		}
8616 8616
 		if ($month != '') {
8617 8617
 			if ($globalDBdriver == 'mysql') {
8618 8618
 				$query .= " AND MONTH(spotter_output.date) = :month";
8619
-				$query_values = array_merge($query_values,array(':month' => $month));
8619
+				$query_values = array_merge($query_values, array(':month' => $month));
8620 8620
 			} else {
8621 8621
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
8622
-				$query_values = array_merge($query_values,array(':month' => $month));
8622
+				$query_values = array_merge($query_values, array(':month' => $month));
8623 8623
 			}
8624 8624
 		}
8625 8625
 		if ($day != '') {
8626 8626
 			if ($globalDBdriver == 'mysql') {
8627 8627
 				$query .= " AND DAY(spotter_output.date) = :day";
8628
-				$query_values = array_merge($query_values,array(':day' => $day));
8628
+				$query_values = array_merge($query_values, array(':day' => $day));
8629 8629
 			} else {
8630 8630
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
8631
-				$query_values = array_merge($query_values,array(':day' => $day));
8631
+				$query_values = array_merge($query_values, array(':day' => $day));
8632 8632
 			}
8633 8633
 		}
8634 8634
 		$query .= " GROUP BY spotter_output.departure_airport_country
@@ -8642,7 +8642,7 @@  discard block
 block discarded – undo
8642 8642
 		$airport_array = array();
8643 8643
 		$temp_array = array();
8644 8644
         
8645
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8645
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8646 8646
 		{
8647 8647
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
8648 8648
 			$temp_array['airport_departure_country'] = $row['departure_airport_country'];
@@ -8660,38 +8660,38 @@  discard block
 block discarded – undo
8660 8660
 	* @return Array the airport arrival list
8661 8661
 	*
8662 8662
 	*/
8663
-	public function countAllArrivalCountries($limit = true,$filters = array(),$year = '',$month = '',$day = '')
8663
+	public function countAllArrivalCountries($limit = true, $filters = array(), $year = '', $month = '', $day = '')
8664 8664
 	{
8665 8665
 		global $globalDBdriver;
8666
-		$filter_query = $this->getFilter($filters,true,true);
8667
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8666
+		$filter_query = $this->getFilter($filters, true, true);
8667
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8668 8668
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> ''";
8669 8669
 		$query_values = array();
8670 8670
 		if ($year != '') {
8671 8671
 			if ($globalDBdriver == 'mysql') {
8672 8672
 				$query .= " AND YEAR(spotter_output.date) = :year";
8673
-				$query_values = array_merge($query_values,array(':year' => $year));
8673
+				$query_values = array_merge($query_values, array(':year' => $year));
8674 8674
 			} else {
8675 8675
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
8676
-				$query_values = array_merge($query_values,array(':year' => $year));
8676
+				$query_values = array_merge($query_values, array(':year' => $year));
8677 8677
 			}
8678 8678
 		}
8679 8679
 		if ($month != '') {
8680 8680
 			if ($globalDBdriver == 'mysql') {
8681 8681
 				$query .= " AND MONTH(spotter_output.date) = :month";
8682
-				$query_values = array_merge($query_values,array(':month' => $month));
8682
+				$query_values = array_merge($query_values, array(':month' => $month));
8683 8683
 			} else {
8684 8684
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
8685
-				$query_values = array_merge($query_values,array(':month' => $month));
8685
+				$query_values = array_merge($query_values, array(':month' => $month));
8686 8686
 			}
8687 8687
 		}
8688 8688
 		if ($day != '') {
8689 8689
 			if ($globalDBdriver == 'mysql') {
8690 8690
 				$query .= " AND DAY(spotter_output.date) = :day";
8691
-				$query_values = array_merge($query_values,array(':day' => $day));
8691
+				$query_values = array_merge($query_values, array(':day' => $day));
8692 8692
 			} else {
8693 8693
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
8694
-				$query_values = array_merge($query_values,array(':day' => $day));
8694
+				$query_values = array_merge($query_values, array(':day' => $day));
8695 8695
 			}
8696 8696
 		}
8697 8697
 		$query .= " GROUP BY spotter_output.arrival_airport_country
@@ -8705,7 +8705,7 @@  discard block
 block discarded – undo
8705 8705
 		$airport_array = array();
8706 8706
 		$temp_array = array();
8707 8707
         
8708
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8708
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8709 8709
 		{
8710 8710
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
8711 8711
 			$temp_array['airport_arrival_country'] = $row['arrival_airport_country'];
@@ -8728,8 +8728,8 @@  discard block
 block discarded – undo
8728 8728
 	*/
8729 8729
 	public function countAllRoutes($filters = array())
8730 8730
 	{
8731
-		$filter_query = $this->getFilter($filters,true,true);
8732
-		$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
8731
+		$filter_query = $this->getFilter($filters, true, true);
8732
+		$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
8733 8733
 		    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 <> ''
8734 8734
                     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
8735 8735
                     ORDER BY route_count DESC
@@ -8742,7 +8742,7 @@  discard block
 block discarded – undo
8742 8742
 		$routes_array = array();
8743 8743
 		$temp_array = array();
8744 8744
         
8745
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8745
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8746 8746
 		{
8747 8747
 			$temp_array['route_count'] = $row['route_count'];
8748 8748
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -8769,11 +8769,11 @@  discard block
 block discarded – undo
8769 8769
 	* @return Array the route list
8770 8770
 	*
8771 8771
 	*/
8772
-	public function countAllRoutesByAircraft($aircraft_icao,$filters = array())
8772
+	public function countAllRoutesByAircraft($aircraft_icao, $filters = array())
8773 8773
 	{
8774
-		$filter_query = $this->getFilter($filters,true,true);
8775
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
8776
-		$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
8774
+		$filter_query = $this->getFilter($filters, true, true);
8775
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
8776
+		$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
8777 8777
 			    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.aircraft_icao = :aircraft_icao 
8778 8778
 			    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 
8779 8779
 			    ORDER BY route_count DESC";
@@ -8784,7 +8784,7 @@  discard block
 block discarded – undo
8784 8784
 		$routes_array = array();
8785 8785
 		$temp_array = array();
8786 8786
         
8787
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8787
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8788 8788
 		{
8789 8789
 			$temp_array['route_count'] = $row['route_count'];
8790 8790
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -8811,9 +8811,9 @@  discard block
 block discarded – undo
8811 8811
 	*/
8812 8812
 	public function countAllRoutesByRegistration($registration, $filters = array())
8813 8813
 	{
8814
-		$filter_query = $this->getFilter($filters,true,true);
8814
+		$filter_query = $this->getFilter($filters, true, true);
8815 8815
 		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
8816
-		$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
8816
+		$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
8817 8817
 			FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.registration = :registration 
8818 8818
                     GROUP BY route
8819 8819
                     ORDER BY route_count DESC";
@@ -8825,7 +8825,7 @@  discard block
 block discarded – undo
8825 8825
 		$routes_array = array();
8826 8826
 		$temp_array = array();
8827 8827
         
8828
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8828
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8829 8829
 		{
8830 8830
 			$temp_array['route_count'] = $row['route_count'];
8831 8831
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -8853,9 +8853,9 @@  discard block
 block discarded – undo
8853 8853
 	*/
8854 8854
 	public function countAllRoutesByAirline($airline_icao, $filters = array())
8855 8855
 	{
8856
-		$filter_query = $this->getFilter($filters,true,true);
8857
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
8858
-		$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
8856
+		$filter_query = $this->getFilter($filters, true, true);
8857
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
8858
+		$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
8859 8859
 			    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.airline_icao = :airline_icao 
8860 8860
 			    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 
8861 8861
 			    ORDER BY route_count DESC";
@@ -8867,7 +8867,7 @@  discard block
 block discarded – undo
8867 8867
 		$routes_array = array();
8868 8868
 		$temp_array = array();
8869 8869
         
8870
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8870
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8871 8871
 		{
8872 8872
 			$temp_array['route_count'] = $row['route_count'];
8873 8873
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -8895,9 +8895,9 @@  discard block
 block discarded – undo
8895 8895
 	*/
8896 8896
 	public function countAllRoutesByAirport($airport_icao, $filters = array())
8897 8897
 	{
8898
-		$filter_query = $this->getFilter($filters,true,true);
8899
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
8900
-		$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
8898
+		$filter_query = $this->getFilter($filters, true, true);
8899
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
8900
+		$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
8901 8901
 			    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao)
8902 8902
 			    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 
8903 8903
 			    ORDER BY route_count DESC";
@@ -8908,7 +8908,7 @@  discard block
 block discarded – undo
8908 8908
 		$routes_array = array();
8909 8909
 		$temp_array = array();
8910 8910
         
8911
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8911
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8912 8912
 		{
8913 8913
 			$temp_array['route_count'] = $row['route_count'];
8914 8914
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -8936,9 +8936,9 @@  discard block
 block discarded – undo
8936 8936
 	*/
8937 8937
 	public function countAllRoutesByCountry($country, $filters = array())
8938 8938
 	{
8939
-		$filter_query = $this->getFilter($filters,true,true);
8940
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
8941
-		$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
8939
+		$filter_query = $this->getFilter($filters, true, true);
8940
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
8941
+		$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
8942 8942
 			    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 
8943 8943
 			    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 
8944 8944
 			    ORDER BY route_count DESC";
@@ -8949,7 +8949,7 @@  discard block
 block discarded – undo
8949 8949
 		$routes_array = array();
8950 8950
 		$temp_array = array();
8951 8951
         
8952
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8952
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8953 8953
 		{
8954 8954
 			$temp_array['route_count'] = $row['route_count'];
8955 8955
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -8977,8 +8977,8 @@  discard block
 block discarded – undo
8977 8977
 	public function countAllRoutesByDate($date, $filters = array())
8978 8978
 	{
8979 8979
 		global $globalTimezone, $globalDBdriver;
8980
-		$filter_query = $this->getFilter($filters,true,true);
8981
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
8980
+		$filter_query = $this->getFilter($filters, true, true);
8981
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
8982 8982
 		if ($globalTimezone != '') {
8983 8983
 			date_default_timezone_set($globalTimezone);
8984 8984
 			$datetime = new DateTime($date);
@@ -8986,12 +8986,12 @@  discard block
 block discarded – undo
8986 8986
 		} else $offset = '+00:00';
8987 8987
 		
8988 8988
 		if ($globalDBdriver == 'mysql') {
8989
-			$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
8989
+			$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
8990 8990
 				    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date  
8991 8991
 				    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
8992 8992
 				    ORDER BY route_count DESC";
8993 8993
 		} else {
8994
-			$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
8994
+			$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
8995 8995
 				    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date  
8996 8996
 				    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
8997 8997
 				    ORDER BY route_count DESC";
@@ -9003,7 +9003,7 @@  discard block
 block discarded – undo
9003 9003
 		$routes_array = array();
9004 9004
 		$temp_array = array();
9005 9005
         
9006
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9006
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9007 9007
 		{
9008 9008
 			$temp_array['route_count'] = $row['route_count'];
9009 9009
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -9030,9 +9030,9 @@  discard block
 block discarded – undo
9030 9030
 	*/
9031 9031
 	public function countAllRoutesByIdent($ident, $filters = array())
9032 9032
 	{
9033
-		$filter_query = $this->getFilter($filters,true,true);
9034
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
9035
-		$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
9033
+		$filter_query = $this->getFilter($filters, true, true);
9034
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
9035
+		$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
9036 9036
 		    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.ident = :ident   
9037 9037
                     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
9038 9038
                     ORDER BY route_count DESC";
@@ -9044,7 +9044,7 @@  discard block
 block discarded – undo
9044 9044
 		$routes_array = array();
9045 9045
 		$temp_array = array();
9046 9046
         
9047
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9047
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9048 9048
 		{
9049 9049
 			$temp_array['route_count'] = $row['route_count'];
9050 9050
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -9068,11 +9068,11 @@  discard block
 block discarded – undo
9068 9068
 	* @return Array the route list
9069 9069
 	*
9070 9070
 	*/
9071
-	public function countAllRoutesByOwner($owner,$filters = array())
9071
+	public function countAllRoutesByOwner($owner, $filters = array())
9072 9072
 	{
9073
-		$filter_query = $this->getFilter($filters,true,true);
9074
-		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
9075
-		$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
9073
+		$filter_query = $this->getFilter($filters, true, true);
9074
+		$owner = filter_var($owner, FILTER_SANITIZE_STRING);
9075
+		$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
9076 9076
 		    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.owner_name = :owner 
9077 9077
                     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
9078 9078
                     ORDER BY route_count DESC";
@@ -9084,7 +9084,7 @@  discard block
 block discarded – undo
9084 9084
 		$routes_array = array();
9085 9085
 		$temp_array = array();
9086 9086
         
9087
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9087
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9088 9088
 		{
9089 9089
 			$temp_array['route_count'] = $row['route_count'];
9090 9090
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -9108,11 +9108,11 @@  discard block
 block discarded – undo
9108 9108
 	* @return Array the route list
9109 9109
 	*
9110 9110
 	*/
9111
-	public function countAllRoutesByPilot($pilot,$filters = array())
9111
+	public function countAllRoutesByPilot($pilot, $filters = array())
9112 9112
 	{
9113
-		$filter_query = $this->getFilter($filters,true,true);
9114
-		$pilot = filter_var($pilot,FILTER_SANITIZE_STRING);
9115
-		$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
9113
+		$filter_query = $this->getFilter($filters, true, true);
9114
+		$pilot = filter_var($pilot, FILTER_SANITIZE_STRING);
9115
+		$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
9116 9116
 		    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND (spotter_output.pilot_name = :pilot OR spotter_output.pilot_id = :pilot) 
9117 9117
                     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
9118 9118
                     ORDER BY route_count DESC";
@@ -9124,7 +9124,7 @@  discard block
 block discarded – undo
9124 9124
 		$routes_array = array();
9125 9125
 		$temp_array = array();
9126 9126
         
9127
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9127
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9128 9128
 		{
9129 9129
 			$temp_array['route_count'] = $row['route_count'];
9130 9130
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -9151,9 +9151,9 @@  discard block
 block discarded – undo
9151 9151
 	*/
9152 9152
 	public function countAllRoutesByManufacturer($aircraft_manufacturer, $filters = array())
9153 9153
 	{
9154
-		$filter_query = $this->getFilter($filters,true,true);
9155
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
9156
-		$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
9154
+		$filter_query = $this->getFilter($filters, true, true);
9155
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
9156
+		$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
9157 9157
 		    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer   
9158 9158
                     GROUP BY route
9159 9159
                     ORDER BY route_count DESC";
@@ -9165,7 +9165,7 @@  discard block
 block discarded – undo
9165 9165
 		$routes_array = array();
9166 9166
 		$temp_array = array();
9167 9167
         
9168
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9168
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9169 9169
 		{
9170 9170
 			$temp_array['route_count'] = $row['route_count'];
9171 9171
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -9193,8 +9193,8 @@  discard block
 block discarded – undo
9193 9193
 	*/
9194 9194
 	public function countAllRoutesWithWaypoints($filters = array())
9195 9195
 	{
9196
-		$filter_query = $this->getFilter($filters,true,true);
9197
-		$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
9196
+		$filter_query = $this->getFilter($filters, true, true);
9197
+		$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
9198 9198
 		    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.waypoints <> '' 
9199 9199
                     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
9200 9200
                     ORDER BY route_count DESC
@@ -9207,7 +9207,7 @@  discard block
 block discarded – undo
9207 9207
 		$routes_array = array();
9208 9208
 		$temp_array = array();
9209 9209
         
9210
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9210
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9211 9211
 		{
9212 9212
 			$temp_array['spotter_id'] = $row['spotter_id'];
9213 9213
 			$temp_array['route_count'] = $row['route_count'];
@@ -9232,11 +9232,11 @@  discard block
 block discarded – undo
9232 9232
 	* @return Array the callsign list
9233 9233
 	*
9234 9234
 	*/
9235
-	public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '', $month = '', $day = '')
9235
+	public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '')
9236 9236
 	{
9237 9237
 		global $globalDBdriver;
9238
-		$filter_query = $this->getFilter($filters,true,true);
9239
-		$query  = "SELECT DISTINCT spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name, spotter_output.airline_icao  
9238
+		$filter_query = $this->getFilter($filters, true, true);
9239
+		$query = "SELECT DISTINCT spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name, spotter_output.airline_icao  
9240 9240
                     FROM spotter_output".$filter_query." spotter_output.ident <> ''";
9241 9241
 		 if ($olderthanmonths > 0) {
9242 9242
 			if ($globalDBdriver == 'mysql') $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)';
@@ -9250,28 +9250,28 @@  discard block
 block discarded – undo
9250 9250
 		if ($year != '') {
9251 9251
 			if ($globalDBdriver == 'mysql') {
9252 9252
 				$query .= " AND YEAR(spotter_output.date) = :year";
9253
-				$query_values = array_merge($query_values,array(':year' => $year));
9253
+				$query_values = array_merge($query_values, array(':year' => $year));
9254 9254
 			} else {
9255 9255
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
9256
-				$query_values = array_merge($query_values,array(':year' => $year));
9256
+				$query_values = array_merge($query_values, array(':year' => $year));
9257 9257
 			}
9258 9258
 		}
9259 9259
 		if ($month != '') {
9260 9260
 			if ($globalDBdriver == 'mysql') {
9261 9261
 				$query .= " AND MONTH(spotter_output.date) = :month";
9262
-				$query_values = array_merge($query_values,array(':month' => $month));
9262
+				$query_values = array_merge($query_values, array(':month' => $month));
9263 9263
 			} else {
9264 9264
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
9265
-				$query_values = array_merge($query_values,array(':month' => $month));
9265
+				$query_values = array_merge($query_values, array(':month' => $month));
9266 9266
 			}
9267 9267
 		}
9268 9268
 		if ($day != '') {
9269 9269
 			if ($globalDBdriver == 'mysql') {
9270 9270
 				$query .= " AND DAY(spotter_output.date) = :day";
9271
-				$query_values = array_merge($query_values,array(':day' => $day));
9271
+				$query_values = array_merge($query_values, array(':day' => $day));
9272 9272
 			} else {
9273 9273
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
9274
-				$query_values = array_merge($query_values,array(':day' => $day));
9274
+				$query_values = array_merge($query_values, array(':day' => $day));
9275 9275
 			}
9276 9276
 		}
9277 9277
 		$query .= " GROUP BY spotter_output.ident, spotter_output.airline_name, spotter_output.airline_icao ORDER BY callsign_icao_count DESC";
@@ -9283,7 +9283,7 @@  discard block
 block discarded – undo
9283 9283
 		$callsign_array = array();
9284 9284
 		$temp_array = array();
9285 9285
         
9286
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9286
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9287 9287
 		{
9288 9288
 			$temp_array['callsign_icao'] = $row['ident'];
9289 9289
 			$temp_array['airline_name'] = $row['airline_name'];
@@ -9305,8 +9305,8 @@  discard block
 block discarded – undo
9305 9305
 	public function countAllCallsignsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
9306 9306
 	{
9307 9307
 		global $globalDBdriver;
9308
-		$filter_query = $this->getFilter($filters,true,true);
9309
-		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name  
9308
+		$filter_query = $this->getFilter($filters, true, true);
9309
+		$query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name  
9310 9310
                     FROM spotter_output".$filter_query." spotter_output.ident <> ''  AND spotter_output.airline_icao <> '' ";
9311 9311
 		 if ($olderthanmonths > 0) {
9312 9312
 			if ($globalDBdriver == 'mysql') $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
@@ -9325,7 +9325,7 @@  discard block
 block discarded – undo
9325 9325
 		$callsign_array = array();
9326 9326
 		$temp_array = array();
9327 9327
         
9328
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9328
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9329 9329
 		{
9330 9330
 			$temp_array['callsign_icao'] = $row['ident'];
9331 9331
 			$temp_array['airline_name'] = $row['airline_name'];
@@ -9379,7 +9379,7 @@  discard block
 block discarded – undo
9379 9379
 		$date_array = array();
9380 9380
 		$temp_array = array();
9381 9381
         
9382
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9382
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9383 9383
 		{
9384 9384
 			$temp_array['date_name'] = $row['date_name'];
9385 9385
 			$temp_array['date_count'] = $row['date_count'];
@@ -9404,15 +9404,15 @@  discard block
 block discarded – undo
9404 9404
 			$datetime = new DateTime();
9405 9405
 			$offset = $datetime->format('P');
9406 9406
 		} else $offset = '+00:00';
9407
-		$filter_query = $this->getFilter($filters,true,true);
9407
+		$filter_query = $this->getFilter($filters, true, true);
9408 9408
 		if ($globalDBdriver == 'mysql') {
9409
-			$query  = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
9409
+			$query = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
9410 9410
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' 
9411 9411
 								GROUP BY spotter_output.airline_icao, date_name 
9412 9412
 								ORDER BY date_count DESC
9413 9413
 								LIMIT 10 OFFSET 0";
9414 9414
 		} else {
9415
-			$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
9415
+			$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
9416 9416
 								FROM spotter_output 
9417 9417
 								WHERE spotter_output.airline_icao <> '' 
9418 9418
 								GROUP BY spotter_output.airline_icao, date_name 
@@ -9427,7 +9427,7 @@  discard block
 block discarded – undo
9427 9427
 		$date_array = array();
9428 9428
 		$temp_array = array();
9429 9429
         
9430
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9430
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9431 9431
 		{
9432 9432
 			$temp_array['date_name'] = $row['date_name'];
9433 9433
 			$temp_array['date_count'] = $row['date_count'];
@@ -9453,7 +9453,7 @@  discard block
 block discarded – undo
9453 9453
 			$datetime = new DateTime();
9454 9454
 			$offset = $datetime->format('P');
9455 9455
 		} else $offset = '+00:00';
9456
-		$filter_query = $this->getFilter($filters,true,true);
9456
+		$filter_query = $this->getFilter($filters, true, true);
9457 9457
 		if ($globalDBdriver == 'mysql') {
9458 9458
 			$query  = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
9459 9459
 								FROM spotter_output".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY)";
@@ -9474,7 +9474,7 @@  discard block
 block discarded – undo
9474 9474
 		$date_array = array();
9475 9475
 		$temp_array = array();
9476 9476
         
9477
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9477
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9478 9478
 		{
9479 9479
 			$temp_array['date_name'] = $row['date_name'];
9480 9480
 			$temp_array['date_count'] = $row['date_count'];
@@ -9499,7 +9499,7 @@  discard block
 block discarded – undo
9499 9499
 			$datetime = new DateTime();
9500 9500
 			$offset = $datetime->format('P');
9501 9501
 		} else $offset = '+00:00';
9502
-		$filter_query = $this->getFilter($filters,true,true);
9502
+		$filter_query = $this->getFilter($filters, true, true);
9503 9503
 		if ($globalDBdriver == 'mysql') {
9504 9504
 			$query  = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
9505 9505
 								FROM spotter_output".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MONTH)";
@@ -9520,7 +9520,7 @@  discard block
 block discarded – undo
9520 9520
 		$date_array = array();
9521 9521
 		$temp_array = array();
9522 9522
         
9523
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9523
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9524 9524
 		{
9525 9525
 			$temp_array['date_name'] = $row['date_name'];
9526 9526
 			$temp_array['date_count'] = $row['date_count'];
@@ -9541,7 +9541,7 @@  discard block
 block discarded – undo
9541 9541
 	public function countAllDatesLastMonthByAirlines($filters = array())
9542 9542
 	{
9543 9543
 		global $globalTimezone, $globalDBdriver;
9544
-		$filter_query = $this->getFilter($filters,true,true);
9544
+		$filter_query = $this->getFilter($filters, true, true);
9545 9545
 		if ($globalTimezone != '') {
9546 9546
 			date_default_timezone_set($globalTimezone);
9547 9547
 			$datetime = new DateTime();
@@ -9549,13 +9549,13 @@  discard block
 block discarded – undo
9549 9549
 		} else $offset = '+00:00';
9550 9550
 		
9551 9551
 		if ($globalDBdriver == 'mysql') {
9552
-			$query  = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
9552
+			$query = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
9553 9553
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MONTH)
9554 9554
 								GROUP BY spotter_output.airline_icao, date_name 
9555 9555
 								ORDER BY spotter_output.date ASC";
9556 9556
 			$query_data = array(':offset' => $offset);
9557 9557
 		} else {
9558
-			$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
9558
+			$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
9559 9559
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.date >= CURRENT_TIMESTAMP AT TIME ZONE INTERVAL :offset - INTERVAL '1 MONTHS'
9560 9560
 								GROUP BY spotter_output.airline_icao, date_name 
9561 9561
 								ORDER BY date_name ASC";
@@ -9568,7 +9568,7 @@  discard block
 block discarded – undo
9568 9568
 		$date_array = array();
9569 9569
 		$temp_array = array();
9570 9570
         
9571
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9571
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9572 9572
 		{
9573 9573
 			$temp_array['date_name'] = $row['date_name'];
9574 9574
 			$temp_array['date_count'] = $row['date_count'];
@@ -9615,7 +9615,7 @@  discard block
 block discarded – undo
9615 9615
 		$date_array = array();
9616 9616
 		$temp_array = array();
9617 9617
         
9618
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9618
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9619 9619
 		{
9620 9620
 			$temp_array['month_name'] = $row['month_name'];
9621 9621
 			$temp_array['year_name'] = $row['year_name'];
@@ -9636,7 +9636,7 @@  discard block
 block discarded – undo
9636 9636
 	public function countAllMonthsByAirlines($filters = array())
9637 9637
 	{
9638 9638
 		global $globalTimezone, $globalDBdriver;
9639
-		$filter_query = $this->getFilter($filters,true,true);
9639
+		$filter_query = $this->getFilter($filters, true, true);
9640 9640
 		if ($globalTimezone != '') {
9641 9641
 			date_default_timezone_set($globalTimezone);
9642 9642
 			$datetime = new DateTime();
@@ -9644,12 +9644,12 @@  discard block
 block discarded – undo
9644 9644
 		} else $offset = '+00:00';
9645 9645
 
9646 9646
 		if ($globalDBdriver == 'mysql') {
9647
-			$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
9647
+			$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
9648 9648
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' 
9649 9649
 								GROUP BY spotter_output.airline_icao, year_name, month_name 
9650 9650
 								ORDER BY date_count DESC";
9651 9651
 		} else {
9652
-			$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
9652
+			$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
9653 9653
 								FROM spotter_output 
9654 9654
 								WHERE spotter_output.airline_icao <> '' 
9655 9655
 								GROUP BY spotter_output.airline_icao, year_name, month_name 
@@ -9663,7 +9663,7 @@  discard block
 block discarded – undo
9663 9663
 		$date_array = array();
9664 9664
 		$temp_array = array();
9665 9665
         
9666
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9666
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9667 9667
 		{
9668 9668
 			$temp_array['month_name'] = $row['month_name'];
9669 9669
 			$temp_array['year_name'] = $row['year_name'];
@@ -9690,14 +9690,14 @@  discard block
 block discarded – undo
9690 9690
 			$datetime = new DateTime();
9691 9691
 			$offset = $datetime->format('P');
9692 9692
 		} else $offset = '+00:00';
9693
-		$filter_query = $this->getFilter($filters,true,true);
9693
+		$filter_query = $this->getFilter($filters, true, true);
9694 9694
 		if ($globalDBdriver == 'mysql') {
9695
-			$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
9695
+			$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
9696 9696
 								FROM spotter_output".$filter_query." spotter_output.airline_type = 'military'
9697 9697
 								GROUP BY year_name, month_name 
9698 9698
 								ORDER BY date_count DESC";
9699 9699
 		} else {
9700
-			$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
9700
+			$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
9701 9701
 								FROM spotter_output".$filter_query." spotter_output.airline_type = 'military'
9702 9702
 								GROUP BY year_name, month_name 
9703 9703
 								ORDER BY date_count DESC";
@@ -9709,7 +9709,7 @@  discard block
 block discarded – undo
9709 9709
 		$date_array = array();
9710 9710
 		$temp_array = array();
9711 9711
         
9712
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9712
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9713 9713
 		{
9714 9714
 			$temp_array['month_name'] = $row['month_name'];
9715 9715
 			$temp_array['year_name'] = $row['year_name'];
@@ -9735,15 +9735,15 @@  discard block
 block discarded – undo
9735 9735
 			$datetime = new DateTime();
9736 9736
 			$offset = $datetime->format('P');
9737 9737
 		} else $offset = '+00:00';
9738
-		$filter_query = $this->getFilter($filters,true,true);
9738
+		$filter_query = $this->getFilter($filters, true, true);
9739 9739
 
9740 9740
 		if ($globalDBdriver == 'mysql') {
9741
-			$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
9741
+			$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
9742 9742
 								FROM spotter_output".$filter_query." owner_name <> ''
9743 9743
 								GROUP BY year_name, month_name
9744 9744
 								ORDER BY date_count DESC";
9745 9745
 		} else {
9746
-			$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
9746
+			$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
9747 9747
 								FROM spotter_output".$filter_query." owner_name <> ''
9748 9748
 								GROUP BY year_name, month_name
9749 9749
 								ORDER BY date_count DESC";
@@ -9755,7 +9755,7 @@  discard block
 block discarded – undo
9755 9755
 		$date_array = array();
9756 9756
 		$temp_array = array();
9757 9757
         
9758
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9758
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9759 9759
 		{
9760 9760
 			$temp_array['month_name'] = $row['month_name'];
9761 9761
 			$temp_array['year_name'] = $row['year_name'];
@@ -9776,7 +9776,7 @@  discard block
 block discarded – undo
9776 9776
 	public function countAllMonthsOwnersByAirlines($filters = array())
9777 9777
 	{
9778 9778
 		global $globalTimezone, $globalDBdriver;
9779
-		$filter_query = $this->getFilter($filters,true,true);
9779
+		$filter_query = $this->getFilter($filters, true, true);
9780 9780
 		if ($globalTimezone != '') {
9781 9781
 			date_default_timezone_set($globalTimezone);
9782 9782
 			$datetime = new DateTime();
@@ -9784,12 +9784,12 @@  discard block
 block discarded – undo
9784 9784
 		} else $offset = '+00:00';
9785 9785
 
9786 9786
 		if ($globalDBdriver == 'mysql') {
9787
-			$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
9787
+			$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
9788 9788
 								FROM spotter_output".$filter_query." owner_name <> '' AND spotter_output.airline_icao <> '' 
9789 9789
 								GROUP BY spotter_output.airline_icao, year_name, month_name
9790 9790
 								ORDER BY date_count DESC";
9791 9791
 		} else {
9792
-			$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
9792
+			$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
9793 9793
 								FROM spotter_output".$filter_query." owner_name <> '' AND spotter_output.airline_icao <> '' 
9794 9794
 								GROUP BY spotter_output.airline_icao, year_name, month_name
9795 9795
 								ORDER BY date_count DESC";
@@ -9801,7 +9801,7 @@  discard block
 block discarded – undo
9801 9801
 		$date_array = array();
9802 9802
 		$temp_array = array();
9803 9803
         
9804
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9804
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9805 9805
 		{
9806 9806
 			$temp_array['month_name'] = $row['month_name'];
9807 9807
 			$temp_array['year_name'] = $row['year_name'];
@@ -9828,15 +9828,15 @@  discard block
 block discarded – undo
9828 9828
 			$datetime = new DateTime();
9829 9829
 			$offset = $datetime->format('P');
9830 9830
 		} else $offset = '+00:00';
9831
-		$filter_query = $this->getFilter($filters,true,true);
9831
+		$filter_query = $this->getFilter($filters, true, true);
9832 9832
 
9833 9833
 		if ($globalDBdriver == 'mysql') {
9834
-			$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
9834
+			$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
9835 9835
 								FROM spotter_output".$filter_query." pilot_id <> '' AND pilot_id IS NOT NULL
9836 9836
 								GROUP BY year_name, month_name
9837 9837
 								ORDER BY date_count DESC";
9838 9838
 		} else {
9839
-			$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
9839
+			$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
9840 9840
 								FROM spotter_output".$filter_query." pilot_id <> '' AND pilot_id IS NOT NULL
9841 9841
 								GROUP BY year_name, month_name
9842 9842
 								ORDER BY date_count DESC";
@@ -9848,7 +9848,7 @@  discard block
 block discarded – undo
9848 9848
 		$date_array = array();
9849 9849
 		$temp_array = array();
9850 9850
         
9851
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9851
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9852 9852
 		{
9853 9853
 			$temp_array['month_name'] = $row['month_name'];
9854 9854
 			$temp_array['year_name'] = $row['year_name'];
@@ -9869,7 +9869,7 @@  discard block
 block discarded – undo
9869 9869
 	public function countAllMonthsPilotsByAirlines($filters = array())
9870 9870
 	{
9871 9871
 		global $globalTimezone, $globalDBdriver;
9872
-		$filter_query = $this->getFilter($filters,true,true);
9872
+		$filter_query = $this->getFilter($filters, true, true);
9873 9873
 		if ($globalTimezone != '') {
9874 9874
 			date_default_timezone_set($globalTimezone);
9875 9875
 			$datetime = new DateTime();
@@ -9877,12 +9877,12 @@  discard block
 block discarded – undo
9877 9877
 		} else $offset = '+00:00';
9878 9878
 
9879 9879
 		if ($globalDBdriver == 'mysql') {
9880
-			$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
9880
+			$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
9881 9881
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND pilot_id <> '' AND pilot_id IS NOT NULL
9882 9882
 								GROUP BY spotter_output.airline_icao,year_name, month_name
9883 9883
 								ORDER BY date_count DESC";
9884 9884
 		} else {
9885
-			$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
9885
+			$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
9886 9886
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND pilot_id <> '' AND pilot_id IS NOT NULL
9887 9887
 								GROUP BY spotter_output.airline_icao, year_name, month_name
9888 9888
 								ORDER BY date_count DESC";
@@ -9894,7 +9894,7 @@  discard block
 block discarded – undo
9894 9894
 		$date_array = array();
9895 9895
 		$temp_array = array();
9896 9896
         
9897
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9897
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9898 9898
 		{
9899 9899
 			$temp_array['month_name'] = $row['month_name'];
9900 9900
 			$temp_array['year_name'] = $row['year_name'];
@@ -9916,7 +9916,7 @@  discard block
 block discarded – undo
9916 9916
 	public function countAllMonthsAirlines($filters = array())
9917 9917
 	{
9918 9918
 		global $globalTimezone, $globalDBdriver;
9919
-		$filter_query = $this->getFilter($filters,true,true);
9919
+		$filter_query = $this->getFilter($filters, true, true);
9920 9920
 		if ($globalTimezone != '') {
9921 9921
 			date_default_timezone_set($globalTimezone);
9922 9922
 			$datetime = new DateTime();
@@ -9924,12 +9924,12 @@  discard block
 block discarded – undo
9924 9924
 		} else $offset = '+00:00';
9925 9925
 
9926 9926
 		if ($globalDBdriver == 'mysql') {
9927
-			$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
9927
+			$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
9928 9928
 								FROM spotter_output".$filter_query." airline_icao <> '' 
9929 9929
 								GROUP BY year_name, month_name
9930 9930
 								ORDER BY date_count DESC";
9931 9931
 		} else {
9932
-			$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
9932
+			$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
9933 9933
 								FROM spotter_output".$filter_query." airline_icao <> '' 
9934 9934
 								GROUP BY year_name, month_name
9935 9935
 								ORDER BY date_count DESC";
@@ -9941,7 +9941,7 @@  discard block
 block discarded – undo
9941 9941
 		$date_array = array();
9942 9942
 		$temp_array = array();
9943 9943
         
9944
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9944
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9945 9945
 		{
9946 9946
 			$temp_array['month_name'] = $row['month_name'];
9947 9947
 			$temp_array['year_name'] = $row['year_name'];
@@ -9967,15 +9967,15 @@  discard block
 block discarded – undo
9967 9967
 			$datetime = new DateTime();
9968 9968
 			$offset = $datetime->format('P');
9969 9969
 		} else $offset = '+00:00';
9970
-		$filter_query = $this->getFilter($filters,true,true);
9970
+		$filter_query = $this->getFilter($filters, true, true);
9971 9971
 
9972 9972
 		if ($globalDBdriver == 'mysql') {
9973
-			$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
9973
+			$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
9974 9974
 								FROM spotter_output".$filter_query." aircraft_icao <> '' 
9975 9975
 								GROUP BY year_name, month_name
9976 9976
 								ORDER BY date_count DESC";
9977 9977
 		} else {
9978
-			$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
9978
+			$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
9979 9979
 								FROM spotter_output".$filter_query." aircraft_icao <> '' 
9980 9980
 								GROUP BY year_name, month_name
9981 9981
 								ORDER BY date_count DESC";
@@ -9987,7 +9987,7 @@  discard block
 block discarded – undo
9987 9987
 		$date_array = array();
9988 9988
 		$temp_array = array();
9989 9989
         
9990
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9990
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9991 9991
 		{
9992 9992
 			$temp_array['month_name'] = $row['month_name'];
9993 9993
 			$temp_array['year_name'] = $row['year_name'];
@@ -10009,7 +10009,7 @@  discard block
 block discarded – undo
10009 10009
 	public function countAllMonthsAircraftsByAirlines($filters = array())
10010 10010
 	{
10011 10011
 		global $globalTimezone, $globalDBdriver;
10012
-		$filter_query = $this->getFilter($filters,true,true);
10012
+		$filter_query = $this->getFilter($filters, true, true);
10013 10013
 		if ($globalTimezone != '') {
10014 10014
 			date_default_timezone_set($globalTimezone);
10015 10015
 			$datetime = new DateTime();
@@ -10017,12 +10017,12 @@  discard block
 block discarded – undo
10017 10017
 		} else $offset = '+00:00';
10018 10018
 
10019 10019
 		if ($globalDBdriver == 'mysql') {
10020
-			$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
10020
+			$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
10021 10021
 								FROM spotter_output".$filter_query." aircraft_icao <> ''  AND spotter_output.airline_icao <> '' 
10022 10022
 								GROUP BY spotter_output.airline_icao, year_name, month_name
10023 10023
 								ORDER BY date_count DESC";
10024 10024
 		} else {
10025
-			$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
10025
+			$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
10026 10026
 								FROM spotter_output".$filter_query." aircraft_icao <> '' AND spotter_output.airline_icao <> '' 
10027 10027
 								GROUP BY spotter_output.airline_icao, year_name, month_name
10028 10028
 								ORDER BY date_count DESC";
@@ -10034,7 +10034,7 @@  discard block
 block discarded – undo
10034 10034
 		$date_array = array();
10035 10035
 		$temp_array = array();
10036 10036
         
10037
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10037
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10038 10038
 		{
10039 10039
 			$temp_array['month_name'] = $row['month_name'];
10040 10040
 			$temp_array['year_name'] = $row['year_name'];
@@ -10061,15 +10061,15 @@  discard block
 block discarded – undo
10061 10061
 			$datetime = new DateTime();
10062 10062
 			$offset = $datetime->format('P');
10063 10063
 		} else $offset = '+00:00';
10064
-		$filter_query = $this->getFilter($filters,true,true);
10064
+		$filter_query = $this->getFilter($filters, true, true);
10065 10065
 
10066 10066
 		if ($globalDBdriver == 'mysql') {
10067
-			$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
10067
+			$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
10068 10068
 								FROM spotter_output".$filter_query." real_arrival_airport_icao <> '' 
10069 10069
 								GROUP BY year_name, month_name
10070 10070
 								ORDER BY date_count DESC";
10071 10071
 		} else {
10072
-			$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
10072
+			$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
10073 10073
 								FROM spotter_output".$filter_query." real_arrival_airport_icao <> '' 
10074 10074
 								GROUP BY year_name, month_name
10075 10075
 								ORDER BY date_count DESC";
@@ -10081,7 +10081,7 @@  discard block
 block discarded – undo
10081 10081
 		$date_array = array();
10082 10082
 		$temp_array = array();
10083 10083
         
10084
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10084
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10085 10085
 		{
10086 10086
 			$temp_array['month_name'] = $row['month_name'];
10087 10087
 			$temp_array['year_name'] = $row['year_name'];
@@ -10103,7 +10103,7 @@  discard block
 block discarded – undo
10103 10103
 	public function countAllMonthsRealArrivalsByAirlines($filters = array())
10104 10104
 	{
10105 10105
 		global $globalTimezone, $globalDBdriver;
10106
-		$filter_query = $this->getFilter($filters,true,true);
10106
+		$filter_query = $this->getFilter($filters, true, true);
10107 10107
 		if ($globalTimezone != '') {
10108 10108
 			date_default_timezone_set($globalTimezone);
10109 10109
 			$datetime = new DateTime();
@@ -10111,12 +10111,12 @@  discard block
 block discarded – undo
10111 10111
 		} else $offset = '+00:00';
10112 10112
 
10113 10113
 		if ($globalDBdriver == 'mysql') {
10114
-			$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
10114
+			$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
10115 10115
 								FROM spotter_output".$filter_query." real_arrival_airport_icao <> '' AND spotter_output.airline_icao <> '' 
10116 10116
 								GROUP BY spotter_output.airline_icao, year_name, month_name
10117 10117
 								ORDER BY date_count DESC";
10118 10118
 		} else {
10119
-			$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
10119
+			$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
10120 10120
 								FROM spotter_output".$filter_query." real_arrival_airport_icao <> '' AND spotter_output.airline_icao <> '' 
10121 10121
 								GROUP BY spotter_output.airline_icao, year_name, month_name
10122 10122
 								ORDER BY date_count DESC";
@@ -10128,7 +10128,7 @@  discard block
 block discarded – undo
10128 10128
 		$date_array = array();
10129 10129
 		$temp_array = array();
10130 10130
         
10131
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10131
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10132 10132
 		{
10133 10133
 			$temp_array['month_name'] = $row['month_name'];
10134 10134
 			$temp_array['year_name'] = $row['year_name'];
@@ -10156,7 +10156,7 @@  discard block
 block discarded – undo
10156 10156
 			$datetime = new DateTime();
10157 10157
 			$offset = $datetime->format('P');
10158 10158
 		} else $offset = '+00:00';
10159
-		$filter_query = $this->getFilter($filters,true,true);
10159
+		$filter_query = $this->getFilter($filters, true, true);
10160 10160
 		if ($globalDBdriver == 'mysql') {
10161 10161
 			$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
10162 10162
 								FROM spotter_output".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 YEAR)";
@@ -10177,7 +10177,7 @@  discard block
 block discarded – undo
10177 10177
 		$date_array = array();
10178 10178
 		$temp_array = array();
10179 10179
         
10180
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10180
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10181 10181
 		{
10182 10182
 			$temp_array['year_name'] = $row['year_name'];
10183 10183
 			$temp_array['month_name'] = $row['month_name'];
@@ -10197,7 +10197,7 @@  discard block
 block discarded – undo
10197 10197
 	* @return Array the hour list
10198 10198
 	*
10199 10199
 	*/
10200
-	public function countAllHours($orderby,$filters = array())
10200
+	public function countAllHours($orderby, $filters = array())
10201 10201
 	{
10202 10202
 		global $globalTimezone, $globalDBdriver;
10203 10203
 		if ($globalTimezone != '') {
@@ -10245,7 +10245,7 @@  discard block
 block discarded – undo
10245 10245
 		$hour_array = array();
10246 10246
 		$temp_array = array();
10247 10247
         
10248
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10248
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10249 10249
 		{
10250 10250
 			$temp_array['hour_name'] = $row['hour_name'];
10251 10251
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -10265,7 +10265,7 @@  discard block
 block discarded – undo
10265 10265
 	public function countAllHoursByAirlines($orderby, $filters = array())
10266 10266
 	{
10267 10267
 		global $globalTimezone, $globalDBdriver;
10268
-		$filter_query = $this->getFilter($filters,true,true);
10268
+		$filter_query = $this->getFilter($filters, true, true);
10269 10269
 		if ($globalTimezone != '') {
10270 10270
 			date_default_timezone_set($globalTimezone);
10271 10271
 			$datetime = new DateTime();
@@ -10283,7 +10283,7 @@  discard block
 block discarded – undo
10283 10283
 		}
10284 10284
 		
10285 10285
 		if ($globalDBdriver == 'mysql') {
10286
-			$query  = "SELECT spotter_output.airline_icao, HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10286
+			$query = "SELECT spotter_output.airline_icao, HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10287 10287
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' 
10288 10288
 								GROUP BY spotter_output.airline_icao, hour_name 
10289 10289
 								".$orderby_sql;
@@ -10296,7 +10296,7 @@  discard block
 block discarded – undo
10296 10296
   */    
10297 10297
 		$query_data = array(':offset' => $offset);
10298 10298
 		} else {
10299
-			$query  = "SELECT spotter_output.airline_icao, EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10299
+			$query = "SELECT spotter_output.airline_icao, EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10300 10300
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' 
10301 10301
 								GROUP BY spotter_output.airline_icao, hour_name 
10302 10302
 								".$orderby_sql;
@@ -10309,7 +10309,7 @@  discard block
 block discarded – undo
10309 10309
 		$hour_array = array();
10310 10310
 		$temp_array = array();
10311 10311
         
10312
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10312
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10313 10313
 		{
10314 10314
 			$temp_array['hour_name'] = $row['hour_name'];
10315 10315
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -10332,34 +10332,34 @@  discard block
 block discarded – undo
10332 10332
 	public function countAllHoursByAirline($airline_icao, $filters = array())
10333 10333
 	{
10334 10334
 		global $globalTimezone, $globalDBdriver;
10335
-		$filter_query = $this->getFilter($filters,true,true);
10335
+		$filter_query = $this->getFilter($filters, true, true);
10336 10336
 		if ($globalTimezone != '') {
10337 10337
 			date_default_timezone_set($globalTimezone);
10338 10338
 			$datetime = new DateTime();
10339 10339
 			$offset = $datetime->format('P');
10340 10340
 		} else $offset = '+00:00';
10341 10341
 
10342
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
10342
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
10343 10343
 
10344 10344
 		if ($globalDBdriver == 'mysql') {
10345
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10345
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10346 10346
 								FROM spotter_output".$filter_query." spotter_output.airline_icao = :airline_icao
10347 10347
 								GROUP BY hour_name 
10348 10348
 								ORDER BY hour_name ASC";
10349 10349
 		} else {
10350
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10350
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10351 10351
 								FROM spotter_output".$filter_query." spotter_output.airline_icao = :airline_icao
10352 10352
 								GROUP BY hour_name 
10353 10353
 								ORDER BY hour_name ASC";
10354 10354
 		}
10355 10355
 		
10356 10356
 		$sth = $this->db->prepare($query);
10357
-		$sth->execute(array(':airline_icao' => $airline_icao,':offset' => $offset));
10357
+		$sth->execute(array(':airline_icao' => $airline_icao, ':offset' => $offset));
10358 10358
       
10359 10359
 		$hour_array = array();
10360 10360
 		$temp_array = array();
10361 10361
         
10362
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10362
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10363 10363
 		{
10364 10364
 			$temp_array['hour_name'] = $row['hour_name'];
10365 10365
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -10382,8 +10382,8 @@  discard block
 block discarded – undo
10382 10382
 	public function countAllHoursByAircraft($aircraft_icao, $filters = array())
10383 10383
 	{
10384 10384
 		global $globalTimezone, $globalDBdriver;
10385
-		$filter_query = $this->getFilter($filters,true,true);
10386
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
10385
+		$filter_query = $this->getFilter($filters, true, true);
10386
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
10387 10387
 		if ($globalTimezone != '') {
10388 10388
 			date_default_timezone_set($globalTimezone);
10389 10389
 			$datetime = new DateTime();
@@ -10391,24 +10391,24 @@  discard block
 block discarded – undo
10391 10391
 		} else $offset = '+00:00';
10392 10392
 
10393 10393
 		if ($globalDBdriver == 'mysql') {
10394
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10394
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10395 10395
 								FROM spotter_output".$filter_query." spotter_output.aircraft_icao = :aircraft_icao
10396 10396
 								GROUP BY hour_name 
10397 10397
 								ORDER BY hour_name ASC";
10398 10398
 		} else {
10399
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10399
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10400 10400
 								FROM spotter_output".$filter_query." spotter_output.aircraft_icao = :aircraft_icao
10401 10401
 								GROUP BY hour_name 
10402 10402
 								ORDER BY hour_name ASC";
10403 10403
 		}
10404 10404
 		
10405 10405
 		$sth = $this->db->prepare($query);
10406
-		$sth->execute(array(':aircraft_icao' => $aircraft_icao,':offset' => $offset));
10406
+		$sth->execute(array(':aircraft_icao' => $aircraft_icao, ':offset' => $offset));
10407 10407
       
10408 10408
 		$hour_array = array();
10409 10409
 		$temp_array = array();
10410 10410
         
10411
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10411
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10412 10412
 		{
10413 10413
 			$temp_array['hour_name'] = $row['hour_name'];
10414 10414
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -10429,8 +10429,8 @@  discard block
 block discarded – undo
10429 10429
 	public function countAllHoursByRegistration($registration, $filters = array())
10430 10430
 	{
10431 10431
 		global $globalTimezone, $globalDBdriver;
10432
-		$filter_query = $this->getFilter($filters,true,true);
10433
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
10432
+		$filter_query = $this->getFilter($filters, true, true);
10433
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
10434 10434
 		if ($globalTimezone != '') {
10435 10435
 			date_default_timezone_set($globalTimezone);
10436 10436
 			$datetime = new DateTime();
@@ -10438,24 +10438,24 @@  discard block
 block discarded – undo
10438 10438
 		} else $offset = '+00:00';
10439 10439
 
10440 10440
 		if ($globalDBdriver == 'mysql') {
10441
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10441
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10442 10442
 								FROM spotter_output".$filter_query." spotter_output.registration = :registration
10443 10443
 								GROUP BY hour_name 
10444 10444
 								ORDER BY hour_name ASC";
10445 10445
 		} else {
10446
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10446
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10447 10447
 								FROM spotter_output".$filter_query." spotter_output.registration = :registration
10448 10448
 								GROUP BY hour_name 
10449 10449
 								ORDER BY hour_name ASC";
10450 10450
 		}
10451 10451
 		
10452 10452
 		$sth = $this->db->prepare($query);
10453
-		$sth->execute(array(':registration' => $registration,':offset' => $offset));
10453
+		$sth->execute(array(':registration' => $registration, ':offset' => $offset));
10454 10454
       
10455 10455
 		$hour_array = array();
10456 10456
 		$temp_array = array();
10457 10457
         
10458
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10458
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10459 10459
 		{
10460 10460
 			$temp_array['hour_name'] = $row['hour_name'];
10461 10461
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -10476,8 +10476,8 @@  discard block
 block discarded – undo
10476 10476
 	public function countAllHoursByAirport($airport_icao, $filters = array())
10477 10477
 	{
10478 10478
 		global $globalTimezone, $globalDBdriver;
10479
-		$filter_query = $this->getFilter($filters,true,true);
10480
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
10479
+		$filter_query = $this->getFilter($filters, true, true);
10480
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
10481 10481
 		if ($globalTimezone != '') {
10482 10482
 			date_default_timezone_set($globalTimezone);
10483 10483
 			$datetime = new DateTime();
@@ -10485,24 +10485,24 @@  discard block
 block discarded – undo
10485 10485
 		} else $offset = '+00:00';
10486 10486
 
10487 10487
 		if ($globalDBdriver == 'mysql') {
10488
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10488
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10489 10489
 								FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao)
10490 10490
 								GROUP BY hour_name 
10491 10491
 								ORDER BY hour_name ASC";
10492 10492
 		} else {
10493
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10493
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10494 10494
 								FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao)
10495 10495
 								GROUP BY hour_name 
10496 10496
 								ORDER BY hour_name ASC";
10497 10497
 		}
10498 10498
 		
10499 10499
 		$sth = $this->db->prepare($query);
10500
-		$sth->execute(array(':airport_icao' => $airport_icao,':offset' => $offset));
10500
+		$sth->execute(array(':airport_icao' => $airport_icao, ':offset' => $offset));
10501 10501
       
10502 10502
 		$hour_array = array();
10503 10503
 		$temp_array = array();
10504 10504
         
10505
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10505
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10506 10506
 		{
10507 10507
 			$temp_array['hour_name'] = $row['hour_name'];
10508 10508
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -10521,11 +10521,11 @@  discard block
 block discarded – undo
10521 10521
 	* @return Array the hour list
10522 10522
 	*
10523 10523
 	*/
10524
-	public function countAllHoursByManufacturer($aircraft_manufacturer,$filters =array())
10524
+	public function countAllHoursByManufacturer($aircraft_manufacturer, $filters = array())
10525 10525
 	{
10526 10526
 		global $globalTimezone, $globalDBdriver;
10527
-		$filter_query = $this->getFilter($filters,true,true);
10528
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
10527
+		$filter_query = $this->getFilter($filters, true, true);
10528
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
10529 10529
 		if ($globalTimezone != '') {
10530 10530
 			date_default_timezone_set($globalTimezone);
10531 10531
 			$datetime = new DateTime();
@@ -10533,24 +10533,24 @@  discard block
 block discarded – undo
10533 10533
 		} else $offset = '+00:00';
10534 10534
 
10535 10535
 		if ($globalDBdriver == 'mysql') {
10536
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10536
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10537 10537
 								FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer = :aircraft_manufacturer
10538 10538
 								GROUP BY hour_name 
10539 10539
 								ORDER BY hour_name ASC";
10540 10540
 		} else {
10541
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10541
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10542 10542
 								FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer = :aircraft_manufacturer
10543 10543
 								GROUP BY hour_name 
10544 10544
 								ORDER BY hour_name ASC";
10545 10545
 		}
10546 10546
 		
10547 10547
 		$sth = $this->db->prepare($query);
10548
-		$sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer,':offset' => $offset));
10548
+		$sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer, ':offset' => $offset));
10549 10549
       
10550 10550
 		$hour_array = array();
10551 10551
 		$temp_array = array();
10552 10552
         
10553
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10553
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10554 10554
 		{
10555 10555
 			$temp_array['hour_name'] = $row['hour_name'];
10556 10556
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -10572,8 +10572,8 @@  discard block
 block discarded – undo
10572 10572
 	public function countAllHoursByDate($date, $filters = array())
10573 10573
 	{
10574 10574
 		global $globalTimezone, $globalDBdriver;
10575
-		$filter_query = $this->getFilter($filters,true,true);
10576
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
10575
+		$filter_query = $this->getFilter($filters, true, true);
10576
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
10577 10577
 		if ($globalTimezone != '') {
10578 10578
 			date_default_timezone_set($globalTimezone);
10579 10579
 			$datetime = new DateTime($date);
@@ -10581,12 +10581,12 @@  discard block
 block discarded – undo
10581 10581
 		} else $offset = '+00:00';
10582 10582
 
10583 10583
 		if ($globalDBdriver == 'mysql') {
10584
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10584
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10585 10585
 								FROM spotter_output".$filter_query." DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date
10586 10586
 								GROUP BY hour_name 
10587 10587
 								ORDER BY hour_name ASC";
10588 10588
 		} else {
10589
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10589
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10590 10590
 								FROM spotter_output".$filter_query." to_char(spotter_output.date AT TIME ZONE INTERVAL :offset, 'YYYY-mm-dd') = :date
10591 10591
 								GROUP BY hour_name 
10592 10592
 								ORDER BY hour_name ASC";
@@ -10598,7 +10598,7 @@  discard block
 block discarded – undo
10598 10598
 		$hour_array = array();
10599 10599
 		$temp_array = array();
10600 10600
         
10601
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10601
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10602 10602
 		{
10603 10603
 			$temp_array['hour_name'] = $row['hour_name'];
10604 10604
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -10620,8 +10620,8 @@  discard block
 block discarded – undo
10620 10620
 	public function countAllHoursByIdent($ident, $filters = array())
10621 10621
 	{
10622 10622
 		global $globalTimezone, $globalDBdriver;
10623
-		$filter_query = $this->getFilter($filters,true,true);
10624
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
10623
+		$filter_query = $this->getFilter($filters, true, true);
10624
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
10625 10625
 		if ($globalTimezone != '') {
10626 10626
 			date_default_timezone_set($globalTimezone);
10627 10627
 			$datetime = new DateTime();
@@ -10629,12 +10629,12 @@  discard block
 block discarded – undo
10629 10629
 		} else $offset = '+00:00';
10630 10630
 
10631 10631
 		if ($globalDBdriver == 'mysql') {
10632
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10632
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10633 10633
 								FROM spotter_output".$filter_query." spotter_output.ident = :ident 
10634 10634
 								GROUP BY hour_name 
10635 10635
 								ORDER BY hour_name ASC";
10636 10636
 		} else {
10637
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10637
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10638 10638
 								FROM spotter_output".$filter_query." spotter_output.ident = :ident 
10639 10639
 								GROUP BY hour_name 
10640 10640
 								ORDER BY hour_name ASC";
@@ -10642,12 +10642,12 @@  discard block
 block discarded – undo
10642 10642
       
10643 10643
 		
10644 10644
 		$sth = $this->db->prepare($query);
10645
-		$sth->execute(array(':ident' => $ident,':offset' => $offset));
10645
+		$sth->execute(array(':ident' => $ident, ':offset' => $offset));
10646 10646
       
10647 10647
 		$hour_array = array();
10648 10648
 		$temp_array = array();
10649 10649
         
10650
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10650
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10651 10651
 		{
10652 10652
 			$temp_array['hour_name'] = $row['hour_name'];
10653 10653
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -10667,8 +10667,8 @@  discard block
 block discarded – undo
10667 10667
 	public function countAllHoursByOwner($owner, $filters = array())
10668 10668
 	{
10669 10669
 		global $globalTimezone, $globalDBdriver;
10670
-		$filter_query = $this->getFilter($filters,true,true);
10671
-		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
10670
+		$filter_query = $this->getFilter($filters, true, true);
10671
+		$owner = filter_var($owner, FILTER_SANITIZE_STRING);
10672 10672
 		if ($globalTimezone != '') {
10673 10673
 			date_default_timezone_set($globalTimezone);
10674 10674
 			$datetime = new DateTime();
@@ -10676,12 +10676,12 @@  discard block
 block discarded – undo
10676 10676
 		} else $offset = '+00:00';
10677 10677
 
10678 10678
 		if ($globalDBdriver == 'mysql') {
10679
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10679
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10680 10680
 								FROM spotter_output".$filter_query." spotter_output.owner_name = :owner 
10681 10681
 								GROUP BY hour_name 
10682 10682
 								ORDER BY hour_name ASC";
10683 10683
 		} else {
10684
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10684
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10685 10685
 								FROM spotter_output".$filter_query." spotter_output.owner_name = :owner 
10686 10686
 								GROUP BY hour_name 
10687 10687
 								ORDER BY hour_name ASC";
@@ -10689,12 +10689,12 @@  discard block
 block discarded – undo
10689 10689
       
10690 10690
 		
10691 10691
 		$sth = $this->db->prepare($query);
10692
-		$sth->execute(array(':owner' => $owner,':offset' => $offset));
10692
+		$sth->execute(array(':owner' => $owner, ':offset' => $offset));
10693 10693
       
10694 10694
 		$hour_array = array();
10695 10695
 		$temp_array = array();
10696 10696
         
10697
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10697
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10698 10698
 		{
10699 10699
 			$temp_array['hour_name'] = $row['hour_name'];
10700 10700
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -10714,8 +10714,8 @@  discard block
 block discarded – undo
10714 10714
 	public function countAllHoursByPilot($pilot, $filters = array())
10715 10715
 	{
10716 10716
 		global $globalTimezone, $globalDBdriver;
10717
-		$filter_query = $this->getFilter($filters,true,true);
10718
-		$pilot = filter_var($pilot,FILTER_SANITIZE_STRING);
10717
+		$filter_query = $this->getFilter($filters, true, true);
10718
+		$pilot = filter_var($pilot, FILTER_SANITIZE_STRING);
10719 10719
 		if ($globalTimezone != '') {
10720 10720
 			date_default_timezone_set($globalTimezone);
10721 10721
 			$datetime = new DateTime();
@@ -10723,12 +10723,12 @@  discard block
 block discarded – undo
10723 10723
 		} else $offset = '+00:00';
10724 10724
 
10725 10725
 		if ($globalDBdriver == 'mysql') {
10726
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10726
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10727 10727
 								FROM spotter_output".$filter_query." (spotter_output.pilot_name = :pilot OR spotter_output.pilot_id = :pilot) 
10728 10728
 								GROUP BY hour_name 
10729 10729
 								ORDER BY hour_name ASC";
10730 10730
 		} else {
10731
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10731
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10732 10732
 								FROM spotter_output".$filter_query." (spotter_output.pilot_name = :pilot OR spotter_output.pilot_id = :pilot) 
10733 10733
 								GROUP BY hour_name 
10734 10734
 								ORDER BY hour_name ASC";
@@ -10736,12 +10736,12 @@  discard block
 block discarded – undo
10736 10736
       
10737 10737
 		
10738 10738
 		$sth = $this->db->prepare($query);
10739
-		$sth->execute(array(':pilot' => $pilot,':offset' => $offset));
10739
+		$sth->execute(array(':pilot' => $pilot, ':offset' => $offset));
10740 10740
       
10741 10741
 		$hour_array = array();
10742 10742
 		$temp_array = array();
10743 10743
         
10744
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10744
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10745 10745
 		{
10746 10746
 			$temp_array['hour_name'] = $row['hour_name'];
10747 10747
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -10760,12 +10760,12 @@  discard block
 block discarded – undo
10760 10760
 	* @return Array the hour list
10761 10761
 	*
10762 10762
 	*/
10763
-	public function countAllHoursByRoute($departure_airport_icao, $arrival_airport_icao, $filters =array())
10763
+	public function countAllHoursByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array())
10764 10764
 	{
10765 10765
 		global $globalTimezone, $globalDBdriver;
10766
-		$filter_query = $this->getFilter($filters,true,true);
10767
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
10768
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
10766
+		$filter_query = $this->getFilter($filters, true, true);
10767
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
10768
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
10769 10769
 		if ($globalTimezone != '') {
10770 10770
 			date_default_timezone_set($globalTimezone);
10771 10771
 			$datetime = new DateTime();
@@ -10773,24 +10773,24 @@  discard block
 block discarded – undo
10773 10773
 		} else $offset = '+00:00';
10774 10774
 
10775 10775
 		if ($globalDBdriver == 'mysql') {
10776
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10776
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10777 10777
 								FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao)
10778 10778
 								GROUP BY hour_name 
10779 10779
 								ORDER BY hour_name ASC";
10780 10780
 		} else {
10781
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10781
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10782 10782
 								FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao)
10783 10783
 								GROUP BY hour_name 
10784 10784
 								ORDER BY hour_name ASC";
10785 10785
 		}
10786 10786
 		
10787 10787
 		$sth = $this->db->prepare($query);
10788
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao,':offset' => $offset));
10788
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao, ':offset' => $offset));
10789 10789
       
10790 10790
 		$hour_array = array();
10791 10791
 		$temp_array = array();
10792 10792
         
10793
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10793
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10794 10794
 		{
10795 10795
 			$temp_array['hour_name'] = $row['hour_name'];
10796 10796
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -10811,8 +10811,8 @@  discard block
 block discarded – undo
10811 10811
 	public function countAllHoursByCountry($country, $filters = array())
10812 10812
 	{
10813 10813
 		global $globalTimezone, $globalDBdriver;
10814
-		$filter_query = $this->getFilter($filters,true,true);
10815
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
10814
+		$filter_query = $this->getFilter($filters, true, true);
10815
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
10816 10816
 		if ($globalTimezone != '') {
10817 10817
 			date_default_timezone_set($globalTimezone);
10818 10818
 			$datetime = new DateTime();
@@ -10820,24 +10820,24 @@  discard block
 block discarded – undo
10820 10820
 		} else $offset = '+00:00';
10821 10821
 
10822 10822
 		if ($globalDBdriver == 'mysql') {
10823
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10823
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10824 10824
 								FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country
10825 10825
 								GROUP BY hour_name 
10826 10826
 								ORDER BY hour_name ASC";
10827 10827
 		} else {
10828
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10828
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10829 10829
 								FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country
10830 10830
 								GROUP BY hour_name 
10831 10831
 								ORDER BY hour_name ASC";
10832 10832
 		}
10833 10833
 		
10834 10834
 		$sth = $this->db->prepare($query);
10835
-		$sth->execute(array(':country' => $country,':offset' => $offset));
10835
+		$sth->execute(array(':country' => $country, ':offset' => $offset));
10836 10836
       
10837 10837
 		$hour_array = array();
10838 10838
 		$temp_array = array();
10839 10839
         
10840
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10840
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10841 10841
 		{
10842 10842
 			$temp_array['hour_name'] = $row['hour_name'];
10843 10843
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -10857,29 +10857,29 @@  discard block
 block discarded – undo
10857 10857
 	* @return Integer the number of aircrafts
10858 10858
 	*
10859 10859
 	*/
10860
-	public function countOverallAircrafts($filters = array(),$year = '',$month = '')
10860
+	public function countOverallAircrafts($filters = array(), $year = '', $month = '')
10861 10861
 	{
10862 10862
 		global $globalDBdriver;
10863
-		$filter_query = $this->getFilter($filters,true,true);
10864
-		$query  = "SELECT COUNT(DISTINCT spotter_output.aircraft_icao) AS aircraft_count  
10863
+		$filter_query = $this->getFilter($filters, true, true);
10864
+		$query = "SELECT COUNT(DISTINCT spotter_output.aircraft_icao) AS aircraft_count  
10865 10865
                     FROM spotter_output".$filter_query." spotter_output.ident <> ''";
10866 10866
 		$query_values = array();
10867 10867
 		if ($year != '') {
10868 10868
 			if ($globalDBdriver == 'mysql') {
10869 10869
 				$query .= " AND YEAR(spotter_output.date) = :year";
10870
-				$query_values = array_merge($query_values,array(':year' => $year));
10870
+				$query_values = array_merge($query_values, array(':year' => $year));
10871 10871
 			} else {
10872 10872
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
10873
-				$query_values = array_merge($query_values,array(':year' => $year));
10873
+				$query_values = array_merge($query_values, array(':year' => $year));
10874 10874
 			}
10875 10875
 		}
10876 10876
 		if ($month != '') {
10877 10877
 			if ($globalDBdriver == 'mysql') {
10878 10878
 				$query .= " AND MONTH(spotter_output.date) = :month";
10879
-				$query_values = array_merge($query_values,array(':month' => $month));
10879
+				$query_values = array_merge($query_values, array(':month' => $month));
10880 10880
 			} else {
10881 10881
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
10882
-				$query_values = array_merge($query_values,array(':month' => $month));
10882
+				$query_values = array_merge($query_values, array(':month' => $month));
10883 10883
 			}
10884 10884
 		}
10885 10885
 
@@ -10894,29 +10894,29 @@  discard block
 block discarded – undo
10894 10894
 	* @return Integer the number of aircrafts
10895 10895
 	*
10896 10896
 	*/
10897
-	public function countOverallArrival($filters = array(),$year = '',$month = '')
10897
+	public function countOverallArrival($filters = array(), $year = '', $month = '')
10898 10898
 	{
10899 10899
 		global $globalDBdriver;
10900
-		$filter_query = $this->getFilter($filters,true,true);
10901
-		$query  = "SELECT COUNT(spotter_output.real_arrival_airport_icao) AS arrival_count  
10900
+		$filter_query = $this->getFilter($filters, true, true);
10901
+		$query = "SELECT COUNT(spotter_output.real_arrival_airport_icao) AS arrival_count  
10902 10902
                     FROM spotter_output".$filter_query." spotter_output.arrival_airport_icao <> ''";
10903 10903
 		$query_values = array();
10904 10904
 		if ($year != '') {
10905 10905
 			if ($globalDBdriver == 'mysql') {
10906 10906
 				$query .= " AND YEAR(spotter_output.date) = :year";
10907
-				$query_values = array_merge($query_values,array(':year' => $year));
10907
+				$query_values = array_merge($query_values, array(':year' => $year));
10908 10908
 			} else {
10909 10909
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
10910
-				$query_values = array_merge($query_values,array(':year' => $year));
10910
+				$query_values = array_merge($query_values, array(':year' => $year));
10911 10911
 			}
10912 10912
 		}
10913 10913
 		if ($month != '') {
10914 10914
 			if ($globalDBdriver == 'mysql') {
10915 10915
 				$query .= " AND MONTH(spotter_output.date) = :month";
10916
-				$query_values = array_merge($query_values,array(':month' => $month));
10916
+				$query_values = array_merge($query_values, array(':month' => $month));
10917 10917
 			} else {
10918 10918
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
10919
-				$query_values = array_merge($query_values,array(':month' => $month));
10919
+				$query_values = array_merge($query_values, array(':month' => $month));
10920 10920
 			}
10921 10921
 		}
10922 10922
 		
@@ -10931,29 +10931,29 @@  discard block
 block discarded – undo
10931 10931
 	* @return Integer the number of pilots
10932 10932
 	*
10933 10933
 	*/
10934
-	public function countOverallPilots($filters = array(),$year = '',$month = '')
10934
+	public function countOverallPilots($filters = array(), $year = '', $month = '')
10935 10935
 	{
10936 10936
 		global $globalDBdriver;
10937
-		$filter_query = $this->getFilter($filters,true,true);
10938
-		$query  = "SELECT COUNT(DISTINCT spotter_output.pilot_id) AS pilot_count  
10937
+		$filter_query = $this->getFilter($filters, true, true);
10938
+		$query = "SELECT COUNT(DISTINCT spotter_output.pilot_id) AS pilot_count  
10939 10939
                     FROM spotter_output".$filter_query." spotter_output.pilot_id <> ''";
10940 10940
 		$query_values = array();
10941 10941
 		if ($year != '') {
10942 10942
 			if ($globalDBdriver == 'mysql') {
10943 10943
 				$query .= " AND YEAR(spotter_output.date) = :year";
10944
-				$query_values = array_merge($query_values,array(':year' => $year));
10944
+				$query_values = array_merge($query_values, array(':year' => $year));
10945 10945
 			} else {
10946 10946
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
10947
-				$query_values = array_merge($query_values,array(':year' => $year));
10947
+				$query_values = array_merge($query_values, array(':year' => $year));
10948 10948
 			}
10949 10949
 		}
10950 10950
 		if ($month != '') {
10951 10951
 			if ($globalDBdriver == 'mysql') {
10952 10952
 				$query .= " AND MONTH(spotter_output.date) = :month";
10953
-				$query_values = array_merge($query_values,array(':month' => $month));
10953
+				$query_values = array_merge($query_values, array(':month' => $month));
10954 10954
 			} else {
10955 10955
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
10956
-				$query_values = array_merge($query_values,array(':month' => $month));
10956
+				$query_values = array_merge($query_values, array(':month' => $month));
10957 10957
 			}
10958 10958
 		}
10959 10959
 		$sth = $this->db->prepare($query);
@@ -10967,29 +10967,29 @@  discard block
 block discarded – undo
10967 10967
 	* @return Integer the number of owners
10968 10968
 	*
10969 10969
 	*/
10970
-	public function countOverallOwners($filters = array(),$year = '',$month = '')
10970
+	public function countOverallOwners($filters = array(), $year = '', $month = '')
10971 10971
 	{
10972 10972
 		global $globalDBdriver;
10973
-		$filter_query = $this->getFilter($filters,true,true);
10974
-		$query  = "SELECT COUNT(DISTINCT spotter_output.owner_name) AS owner_count  
10973
+		$filter_query = $this->getFilter($filters, true, true);
10974
+		$query = "SELECT COUNT(DISTINCT spotter_output.owner_name) AS owner_count  
10975 10975
                     FROM spotter_output".$filter_query." spotter_output.owner_name <> ''";
10976 10976
 		$query_values = array();
10977 10977
 		if ($year != '') {
10978 10978
 			if ($globalDBdriver == 'mysql') {
10979 10979
 				$query .= " AND YEAR(spotter_output.date) = :year";
10980
-				$query_values = array_merge($query_values,array(':year' => $year));
10980
+				$query_values = array_merge($query_values, array(':year' => $year));
10981 10981
 			} else {
10982 10982
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
10983
-				$query_values = array_merge($query_values,array(':year' => $year));
10983
+				$query_values = array_merge($query_values, array(':year' => $year));
10984 10984
 			}
10985 10985
 		}
10986 10986
 		if ($month != '') {
10987 10987
 			if ($globalDBdriver == 'mysql') {
10988 10988
 				$query .= " AND MONTH(spotter_output.date) = :month";
10989
-				$query_values = array_merge($query_values,array(':month' => $month));
10989
+				$query_values = array_merge($query_values, array(':month' => $month));
10990 10990
 			} else {
10991 10991
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
10992
-				$query_values = array_merge($query_values,array(':month' => $month));
10992
+				$query_values = array_merge($query_values, array(':month' => $month));
10993 10993
 			}
10994 10994
 		}
10995 10995
 		$sth = $this->db->prepare($query);
@@ -11004,32 +11004,32 @@  discard block
 block discarded – undo
11004 11004
 	* @return Integer the number of flights
11005 11005
 	*
11006 11006
 	*/
11007
-	public function countOverallFlights($filters = array(),$year = '',$month = '')
11007
+	public function countOverallFlights($filters = array(), $year = '', $month = '')
11008 11008
 	{
11009 11009
 		global $globalDBdriver;
11010
-		$queryi  = "SELECT COUNT(spotter_output.spotter_id) AS flight_count FROM spotter_output";
11010
+		$queryi = "SELECT COUNT(spotter_output.spotter_id) AS flight_count FROM spotter_output";
11011 11011
 		$query_values = array();
11012 11012
 		$query = '';
11013 11013
 		if ($year != '') {
11014 11014
 			if ($globalDBdriver == 'mysql') {
11015 11015
 				$query .= " AND YEAR(spotter_output.date) = :year";
11016
-				$query_values = array_merge($query_values,array(':year' => $year));
11016
+				$query_values = array_merge($query_values, array(':year' => $year));
11017 11017
 			} else {
11018 11018
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
11019
-				$query_values = array_merge($query_values,array(':year' => $year));
11019
+				$query_values = array_merge($query_values, array(':year' => $year));
11020 11020
 			}
11021 11021
 		}
11022 11022
 		if ($month != '') {
11023 11023
 			if ($globalDBdriver == 'mysql') {
11024 11024
 				$query .= " AND MONTH(spotter_output.date) = :month";
11025
-				$query_values = array_merge($query_values,array(':month' => $month));
11025
+				$query_values = array_merge($query_values, array(':month' => $month));
11026 11026
 			} else {
11027 11027
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
11028
-				$query_values = array_merge($query_values,array(':month' => $month));
11028
+				$query_values = array_merge($query_values, array(':month' => $month));
11029 11029
 			}
11030 11030
 		}
11031 11031
 		if (empty($query_values)) $queryi .= $this->getFilter($filters);
11032
-		else $queryi .= $this->getFilter($filters,true,true).substr($query,4);
11032
+		else $queryi .= $this->getFilter($filters, true, true).substr($query, 4);
11033 11033
 		
11034 11034
 		$sth = $this->db->prepare($queryi);
11035 11035
 		$sth->execute($query_values);
@@ -11042,29 +11042,29 @@  discard block
 block discarded – undo
11042 11042
 	* @return Integer the number of flights
11043 11043
 	*
11044 11044
 	*/
11045
-	public function countOverallMilitaryFlights($filters = array(),$year = '',$month = '')
11045
+	public function countOverallMilitaryFlights($filters = array(), $year = '', $month = '')
11046 11046
 	{
11047 11047
 		global $globalDBdriver;
11048
-		$filter_query = $this->getFilter($filters,true,true);
11049
-		$query  = "SELECT COUNT(spotter_output.spotter_id) AS flight_count  
11048
+		$filter_query = $this->getFilter($filters, true, true);
11049
+		$query = "SELECT COUNT(spotter_output.spotter_id) AS flight_count  
11050 11050
                     FROM airlines,spotter_output".$filter_query." spotter_output.airline_icao = airlines.icao AND airlines.type = 'military'";
11051 11051
 		$query_values = array();
11052 11052
 		if ($year != '') {
11053 11053
 			if ($globalDBdriver == 'mysql') {
11054 11054
 				$query .= " AND YEAR(spotter_output.date) = :year";
11055
-				$query_values = array_merge($query_values,array(':year' => $year));
11055
+				$query_values = array_merge($query_values, array(':year' => $year));
11056 11056
 			} else {
11057 11057
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
11058
-				$query_values = array_merge($query_values,array(':year' => $year));
11058
+				$query_values = array_merge($query_values, array(':year' => $year));
11059 11059
 			}
11060 11060
 		}
11061 11061
 		if ($month != '') {
11062 11062
 			if ($globalDBdriver == 'mysql') {
11063 11063
 				$query .= " AND MONTH(spotter_output.date) = :month";
11064
-				$query_values = array_merge($query_values,array(':month' => $month));
11064
+				$query_values = array_merge($query_values, array(':month' => $month));
11065 11065
 			} else {
11066 11066
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
11067
-				$query_values = array_merge($query_values,array(':month' => $month));
11067
+				$query_values = array_merge($query_values, array(':month' => $month));
11068 11068
 			}
11069 11069
 		}
11070 11070
       
@@ -11081,10 +11081,10 @@  discard block
 block discarded – undo
11081 11081
 	* @return Integer the number of airlines
11082 11082
 	*
11083 11083
 	*/
11084
-	public function countOverallAirlines($filters = array(),$year = '',$month = '')
11084
+	public function countOverallAirlines($filters = array(), $year = '', $month = '')
11085 11085
 	{
11086 11086
 		global $globalDBdriver;
11087
-		$queryi  = "SELECT COUNT(DISTINCT spotter_output.airline_name) AS airline_count 
11087
+		$queryi = "SELECT COUNT(DISTINCT spotter_output.airline_name) AS airline_count 
11088 11088
 							FROM spotter_output";
11089 11089
       
11090 11090
 		$query_values = array();
@@ -11092,23 +11092,23 @@  discard block
 block discarded – undo
11092 11092
 		if ($year != '') {
11093 11093
 			if ($globalDBdriver == 'mysql') {
11094 11094
 				$query .= " AND YEAR(spotter_output.date) = :year";
11095
-				$query_values = array_merge($query_values,array(':year' => $year));
11095
+				$query_values = array_merge($query_values, array(':year' => $year));
11096 11096
 			} else {
11097 11097
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
11098
-				$query_values = array_merge($query_values,array(':year' => $year));
11098
+				$query_values = array_merge($query_values, array(':year' => $year));
11099 11099
 			}
11100 11100
 		}
11101 11101
 		if ($month != '') {
11102 11102
 			if ($globalDBdriver == 'mysql') {
11103 11103
 				$query .= " AND MONTH(spotter_output.date) = :month";
11104
-				$query_values = array_merge($query_values,array(':month' => $month));
11104
+				$query_values = array_merge($query_values, array(':month' => $month));
11105 11105
 			} else {
11106 11106
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
11107
-				$query_values = array_merge($query_values,array(':month' => $month));
11107
+				$query_values = array_merge($query_values, array(':month' => $month));
11108 11108
 			}
11109 11109
 		}
11110 11110
                 if ($query == '') $queryi .= $this->getFilter($filters);
11111
-                else $queryi .= $this->getFilter($filters,true,true).substr($query,4);
11111
+                else $queryi .= $this->getFilter($filters, true, true).substr($query, 4);
11112 11112
 
11113 11113
 
11114 11114
 		$sth = $this->db->prepare($queryi);
@@ -11126,7 +11126,7 @@  discard block
 block discarded – undo
11126 11126
 	public function countAllHoursFromToday($filters = array())
11127 11127
 	{
11128 11128
 		global $globalTimezone, $globalDBdriver;
11129
-		$filter_query = $this->getFilter($filters,true,true);
11129
+		$filter_query = $this->getFilter($filters, true, true);
11130 11130
 		if ($globalTimezone != '') {
11131 11131
 			date_default_timezone_set($globalTimezone);
11132 11132
 			$datetime = new DateTime();
@@ -11134,12 +11134,12 @@  discard block
 block discarded – undo
11134 11134
 		} else $offset = '+00:00';
11135 11135
 
11136 11136
 		if ($globalDBdriver == 'mysql') {
11137
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
11137
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
11138 11138
 								FROM spotter_output".$filter_query." DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = CURDATE()
11139 11139
 								GROUP BY hour_name 
11140 11140
 								ORDER BY hour_name ASC";
11141 11141
 		} else {
11142
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
11142
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
11143 11143
 								FROM spotter_output".$filter_query." to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = CAST(NOW() AS date)
11144 11144
 								GROUP BY hour_name 
11145 11145
 								ORDER BY hour_name ASC";
@@ -11151,7 +11151,7 @@  discard block
 block discarded – undo
11151 11151
 		$hour_array = array();
11152 11152
 		$temp_array = array();
11153 11153
         
11154
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
11154
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
11155 11155
 		{
11156 11156
 			$temp_array['hour_name'] = $row['hour_name'];
11157 11157
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -11170,14 +11170,14 @@  discard block
 block discarded – undo
11170 11170
 	public function getUpcomingFlights($limit = '', $sort = '', $filters = array())
11171 11171
 	{
11172 11172
 		global $global_query, $globalDBdriver, $globalTimezone;
11173
-		$filter_query = $this->getFilter($filters,true,true);
11173
+		$filter_query = $this->getFilter($filters, true, true);
11174 11174
 		date_default_timezone_set('UTC');
11175 11175
 		$limit_query = '';
11176 11176
 		if ($limit != "")
11177 11177
 		{
11178 11178
 			$limit_array = explode(",", $limit);
11179
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
11180
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
11179
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
11180
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
11181 11181
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
11182 11182
 			{
11183 11183
 				//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
@@ -11230,7 +11230,7 @@  discard block
 block discarded – undo
11230 11230
 			    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')
11231 11231
 			    HAVING count(spotter_output.ident) > 5$orderby_query";
11232 11232
 			//echo $query;
11233
-			$spotter_array = $this->getDataFromDB($query.$limit_query,array(':timezone' => $globalTimezone));
11233
+			$spotter_array = $this->getDataFromDB($query.$limit_query, array(':timezone' => $globalTimezone));
11234 11234
 			/*
11235 11235
 			$sth = $this->db->prepare($query);
11236 11236
 			$sth->execute(array(':timezone' => $globalTimezone));
@@ -11249,9 +11249,9 @@  discard block
 block discarded – undo
11249 11249
 	*/
11250 11250
 	public function getSpotterIDBasedOnFlightAwareID($flightaware_id)
11251 11251
 	{
11252
-		$flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING);
11252
+		$flightaware_id = filter_var($flightaware_id, FILTER_SANITIZE_STRING);
11253 11253
 
11254
-		$query  = "SELECT spotter_output.spotter_id
11254
+		$query = "SELECT spotter_output.spotter_id
11255 11255
 								FROM spotter_output 
11256 11256
 								WHERE spotter_output.flightaware_id = '".$flightaware_id."'";
11257 11257
         
@@ -11259,7 +11259,7 @@  discard block
 block discarded – undo
11259 11259
 		$sth = $this->db->prepare($query);
11260 11260
 		$sth->execute();
11261 11261
 
11262
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
11262
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
11263 11263
 		{
11264 11264
 			return $row['spotter_id'];
11265 11265
 		}
@@ -11284,23 +11284,23 @@  discard block
 block discarded – undo
11284 11284
 		}
11285 11285
 		
11286 11286
 		$current_date = date("Y-m-d H:i:s");
11287
-		$date = date("Y-m-d H:i:s",strtotime($dateString." UTC"));
11287
+		$date = date("Y-m-d H:i:s", strtotime($dateString." UTC"));
11288 11288
 		
11289 11289
 		$diff = abs(strtotime($current_date) - strtotime($date));
11290 11290
 
11291
-		$time_array['years'] = floor($diff / (365*60*60*24)); 
11291
+		$time_array['years'] = floor($diff/(365*60*60*24)); 
11292 11292
 		$years = $time_array['years'];
11293 11293
 		
11294
-		$time_array['months'] = floor(($diff - $years * 365*60*60*24) / (30*60*60*24));
11294
+		$time_array['months'] = floor(($diff - $years*365*60*60*24)/(30*60*60*24));
11295 11295
 		$months = $time_array['months'];
11296 11296
 		
11297
-		$time_array['days'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24)/ (60*60*24));
11297
+		$time_array['days'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24)/(60*60*24));
11298 11298
 		$days = $time_array['days'];
11299
-		$time_array['hours'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24)/ (60*60));
11299
+		$time_array['hours'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24)/(60*60));
11300 11300
 		$hours = $time_array['hours'];
11301
-		$time_array['minutes'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60)/ 60);
11301
+		$time_array['minutes'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60)/60);
11302 11302
 		$minutes = $time_array['minutes'];
11303
-		$time_array['seconds'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60 - $minutes*60));  
11303
+		$time_array['seconds'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60 - $minutes*60));  
11304 11304
 		
11305 11305
 		return $time_array;	
11306 11306
 	}	
@@ -11326,63 +11326,63 @@  discard block
 block discarded – undo
11326 11326
 			$temp_array['direction_degree'] = $direction;
11327 11327
 			$temp_array['direction_shortname'] = "N";
11328 11328
 			$temp_array['direction_fullname'] = "North";
11329
-		} elseif ($direction >= 22.5 && $direction < 45){
11329
+		} elseif ($direction >= 22.5 && $direction < 45) {
11330 11330
 			$temp_array['direction_degree'] = $direction;
11331 11331
 			$temp_array['direction_shortname'] = "NNE";
11332 11332
 			$temp_array['direction_fullname'] = "North-Northeast";
11333
-		} elseif ($direction >= 45 && $direction < 67.5){
11333
+		} elseif ($direction >= 45 && $direction < 67.5) {
11334 11334
 			$temp_array['direction_degree'] = $direction;
11335 11335
 			$temp_array['direction_shortname'] = "NE";
11336 11336
 			$temp_array['direction_fullname'] = "Northeast";
11337
-		} elseif ($direction >= 67.5 && $direction < 90){
11337
+		} elseif ($direction >= 67.5 && $direction < 90) {
11338 11338
 			$temp_array['direction_degree'] = $direction;
11339 11339
 			$temp_array['direction_shortname'] = "ENE";
11340 11340
 			$temp_array['direction_fullname'] = "East-Northeast";
11341
-		} elseif ($direction >= 90 && $direction < 112.5){
11341
+		} elseif ($direction >= 90 && $direction < 112.5) {
11342 11342
 			$temp_array['direction_degree'] = $direction;
11343 11343
 			$temp_array['direction_shortname'] = "E";
11344 11344
 			$temp_array['direction_fullname'] = "East";
11345
-		} elseif ($direction >= 112.5 && $direction < 135){
11345
+		} elseif ($direction >= 112.5 && $direction < 135) {
11346 11346
 			$temp_array['direction_degree'] = $direction;
11347 11347
 			$temp_array['direction_shortname'] = "ESE";
11348 11348
 			$temp_array['direction_fullname'] = "East-Southeast";
11349
-		} elseif ($direction >= 135 && $direction < 157.5){
11349
+		} elseif ($direction >= 135 && $direction < 157.5) {
11350 11350
 			$temp_array['direction_degree'] = $direction;
11351 11351
 			$temp_array['direction_shortname'] = "SE";
11352 11352
 			$temp_array['direction_fullname'] = "Southeast";
11353
-		} elseif ($direction >= 157.5 && $direction < 180){
11353
+		} elseif ($direction >= 157.5 && $direction < 180) {
11354 11354
 			$temp_array['direction_degree'] = $direction;
11355 11355
 			$temp_array['direction_shortname'] = "SSE";
11356 11356
 			$temp_array['direction_fullname'] = "South-Southeast";
11357
-		} elseif ($direction >= 180 && $direction < 202.5){
11357
+		} elseif ($direction >= 180 && $direction < 202.5) {
11358 11358
 			$temp_array['direction_degree'] = $direction;
11359 11359
 			$temp_array['direction_shortname'] = "S";
11360 11360
 			$temp_array['direction_fullname'] = "South";
11361
-		} elseif ($direction >= 202.5 && $direction < 225){
11361
+		} elseif ($direction >= 202.5 && $direction < 225) {
11362 11362
 			$temp_array['direction_degree'] = $direction;
11363 11363
 			$temp_array['direction_shortname'] = "SSW";
11364 11364
 			$temp_array['direction_fullname'] = "South-Southwest";
11365
-		} elseif ($direction >= 225 && $direction < 247.5){
11365
+		} elseif ($direction >= 225 && $direction < 247.5) {
11366 11366
 			$temp_array['direction_degree'] = $direction;
11367 11367
 			$temp_array['direction_shortname'] = "SW";
11368 11368
 			$temp_array['direction_fullname'] = "Southwest";
11369
-		} elseif ($direction >= 247.5 && $direction < 270){
11369
+		} elseif ($direction >= 247.5 && $direction < 270) {
11370 11370
 			$temp_array['direction_degree'] = $direction;
11371 11371
 			$temp_array['direction_shortname'] = "WSW";
11372 11372
 			$temp_array['direction_fullname'] = "West-Southwest";
11373
-		} elseif ($direction >= 270 && $direction < 292.5){
11373
+		} elseif ($direction >= 270 && $direction < 292.5) {
11374 11374
 			$temp_array['direction_degree'] = $direction;
11375 11375
 			$temp_array['direction_shortname'] = "W";
11376 11376
 			$temp_array['direction_fullname'] = "West";
11377
-		} elseif ($direction >= 292.5 && $direction < 315){
11377
+		} elseif ($direction >= 292.5 && $direction < 315) {
11378 11378
 			$temp_array['direction_degree'] = $direction;
11379 11379
 			$temp_array['direction_shortname'] = "WNW";
11380 11380
 			$temp_array['direction_fullname'] = "West-Northwest";
11381
-		} elseif ($direction >= 315 && $direction < 337.5){
11381
+		} elseif ($direction >= 315 && $direction < 337.5) {
11382 11382
 			$temp_array['direction_degree'] = $direction;
11383 11383
 			$temp_array['direction_shortname'] = "NW";
11384 11384
 			$temp_array['direction_fullname'] = "Northwest";
11385
-		} elseif ($direction >= 337.5 && $direction < 360){
11385
+		} elseif ($direction >= 337.5 && $direction < 360) {
11386 11386
 			$temp_array['direction_degree'] = $direction;
11387 11387
 			$temp_array['direction_shortname'] = "NNW";
11388 11388
 			$temp_array['direction_fullname'] = "North-Northwest";
@@ -11435,9 +11435,9 @@  discard block
 block discarded – undo
11435 11435
 	*/
11436 11436
 	public function getAircraftRegistrationBymodeS($aircraft_modes)
11437 11437
 	{
11438
-		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
11438
+		$aircraft_modes = filter_var($aircraft_modes, FILTER_SANITIZE_STRING);
11439 11439
 	
11440
-		$query  = "SELECT aircraft_modes.Registration FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes ORDER BY FirstCreated DESC LIMIT 1";
11440
+		$query = "SELECT aircraft_modes.Registration FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes ORDER BY FirstCreated DESC LIMIT 1";
11441 11441
 		
11442 11442
 		$sth = $this->db->prepare($query);
11443 11443
 		$sth->execute(array(':aircraft_modes' => $aircraft_modes));
@@ -11460,9 +11460,9 @@  discard block
 block discarded – undo
11460 11460
 	*/
11461 11461
 	public function getAircraftTypeBymodeS($aircraft_modes)
11462 11462
 	{
11463
-		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
11463
+		$aircraft_modes = filter_var($aircraft_modes, FILTER_SANITIZE_STRING);
11464 11464
 	
11465
-		$query  = "SELECT aircraft_modes.type_flight FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes ORDER BY FirstCreated DESC LIMIT 1";
11465
+		$query = "SELECT aircraft_modes.type_flight FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes ORDER BY FirstCreated DESC LIMIT 1";
11466 11466
 		
11467 11467
 		$sth = $this->db->prepare($query);
11468 11468
 		$sth->execute(array(':aircraft_modes' => $aircraft_modes));
@@ -11483,11 +11483,11 @@  discard block
 block discarded – undo
11483 11483
 	* @param Float $longitude longitute of the flight
11484 11484
 	* @return String the countrie
11485 11485
 	*/
11486
-	public function getCountryFromLatitudeLongitude($latitude,$longitude)
11486
+	public function getCountryFromLatitudeLongitude($latitude, $longitude)
11487 11487
 	{
11488 11488
 		global $globalDBdriver, $globalDebug;
11489
-		$latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
11490
-		$longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
11489
+		$latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
11490
+		$longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
11491 11491
 	
11492 11492
 		$Connection = new Connection($this->db);
11493 11493
 		if (!$Connection->tableExists('countries')) return '';
@@ -11527,7 +11527,7 @@  discard block
 block discarded – undo
11527 11527
 	public function getCountryFromISO2($iso2)
11528 11528
 	{
11529 11529
 		global $globalDBdriver, $globalDebug;
11530
-		$iso2 = filter_var($iso2,FILTER_SANITIZE_STRING);
11530
+		$iso2 = filter_var($iso2, FILTER_SANITIZE_STRING);
11531 11531
 	
11532 11532
 		$Connection = new Connection($this->db);
11533 11533
 		if (!$Connection->tableExists('countries')) return '';
@@ -11559,19 +11559,19 @@  discard block
 block discarded – undo
11559 11559
 	*/
11560 11560
 	public function convertAircraftRegistration($registration)
11561 11561
 	{
11562
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
11562
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
11563 11563
 		$registration_prefix = '';
11564 11564
 		$registration_1 = substr($registration, 0, 1);
11565 11565
 		$registration_2 = substr($registration, 0, 2);
11566 11566
 
11567 11567
 		//first get the prefix based on two characters
11568
-		$query  = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_2";
11568
+		$query = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_2";
11569 11569
       
11570 11570
 		
11571 11571
 		$sth = $this->db->prepare($query);
11572 11572
 		$sth->execute(array(':registration_2' => $registration_2));
11573 11573
         
11574
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
11574
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
11575 11575
 		{
11576 11576
 			$registration_prefix = $row['registration_prefix'];
11577 11577
 		}
@@ -11579,11 +11579,11 @@  discard block
 block discarded – undo
11579 11579
 		//if we didn't find a two chracter prefix lets just search the one with one character
11580 11580
 		if ($registration_prefix == '')
11581 11581
 		{
11582
-			$query  = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_1";
11582
+			$query = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_1";
11583 11583
 			$sth = $this->db->prepare($query);
11584 11584
 			$sth->execute(array(':registration_1' => $registration_1));
11585 11585
 	        
11586
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
11586
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
11587 11587
 			{
11588 11588
 				$registration_prefix = $row['registration_prefix'];
11589 11589
 			}
@@ -11597,7 +11597,7 @@  discard block
 block discarded – undo
11597 11597
 			} else {
11598 11598
 				$registration = preg_replace("/^(.{1})/", "$1-", $registration);
11599 11599
 			}
11600
-		} else if(strlen($registration_prefix) == 2){
11600
+		} else if (strlen($registration_prefix) == 2) {
11601 11601
 			if (0 === strpos($registration, 'N')) {
11602 11602
 				$registration = preg_replace("/^(.{2})/", "$1", $registration);
11603 11603
 			} else {
@@ -11616,17 +11616,17 @@  discard block
 block discarded – undo
11616 11616
 	*/
11617 11617
 	public function countryFromAircraftRegistration($registration)
11618 11618
 	{
11619
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
11619
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
11620 11620
 		
11621 11621
 		$registration_prefix = '';
11622
-		$registration_test = explode('-',$registration);
11622
+		$registration_test = explode('-', $registration);
11623 11623
 		$country = '';
11624 11624
 		if ($registration_test[0] != $registration) {
11625 11625
 			$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1";
11626 11626
 	      
11627 11627
 			$sth = $this->db->prepare($query);
11628 11628
 			$sth->execute(array(':registration_1' => $registration_test[0]));
11629
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
11629
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
11630 11630
 			{
11631 11631
 				//$registration_prefix = $row['registration_prefix'];
11632 11632
 				$country = $row['country'];
@@ -11637,13 +11637,13 @@  discard block
 block discarded – undo
11637 11637
 
11638 11638
 			$country = '';
11639 11639
 			//first get the prefix based on two characters
11640
-			$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_2 LIMIT 1";
11640
+			$query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_2 LIMIT 1";
11641 11641
       
11642 11642
 			
11643 11643
 			$sth = $this->db->prepare($query);
11644 11644
 			$sth->execute(array(':registration_2' => $registration_2));
11645 11645
         
11646
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
11646
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
11647 11647
 			{
11648 11648
 				$registration_prefix = $row['registration_prefix'];
11649 11649
 				$country = $row['country'];
@@ -11652,12 +11652,12 @@  discard block
 block discarded – undo
11652 11652
 			//if we didn't find a two chracter prefix lets just search the one with one character
11653 11653
 			if ($registration_prefix == "")
11654 11654
 			{
11655
-				$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1";
11655
+				$query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1";
11656 11656
 	      
11657 11657
 				$sth = $this->db->prepare($query);
11658 11658
 				$sth->execute(array(':registration_1' => $registration_1));
11659 11659
 	        
11660
-				while($row = $sth->fetch(PDO::FETCH_ASSOC))
11660
+				while ($row = $sth->fetch(PDO::FETCH_ASSOC))
11661 11661
 				{
11662 11662
 					//$registration_prefix = $row['registration_prefix'];
11663 11663
 					$country = $row['country'];
@@ -11677,17 +11677,17 @@  discard block
 block discarded – undo
11677 11677
 	*/
11678 11678
 	public function registrationPrefixFromAircraftRegistration($registration)
11679 11679
 	{
11680
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
11680
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
11681 11681
 		
11682 11682
 		$registration_prefix = '';
11683
-		$registration_test = explode('-',$registration);
11683
+		$registration_test = explode('-', $registration);
11684 11684
 		//$country = '';
11685 11685
 		if ($registration_test[0] != $registration) {
11686
-			$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1";
11686
+			$query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1";
11687 11687
 	      
11688 11688
 			$sth = $this->db->prepare($query);
11689 11689
 			$sth->execute(array(':registration_1' => $registration_test[0]));
11690
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
11690
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
11691 11691
 			{
11692 11692
 				$registration_prefix = $row['registration_prefix'];
11693 11693
 				//$country = $row['country'];
@@ -11697,13 +11697,13 @@  discard block
 block discarded – undo
11697 11697
 		        $registration_2 = substr($registration, 0, 2);
11698 11698
 
11699 11699
 			//first get the prefix based on two characters
11700
-			$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_2 LIMIT 1";
11700
+			$query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_2 LIMIT 1";
11701 11701
       
11702 11702
 			
11703 11703
 			$sth = $this->db->prepare($query);
11704 11704
 			$sth->execute(array(':registration_2' => $registration_2));
11705 11705
         
11706
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
11706
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
11707 11707
 			{
11708 11708
 				$registration_prefix = $row['registration_prefix'];
11709 11709
 				//$country = $row['country'];
@@ -11712,12 +11712,12 @@  discard block
 block discarded – undo
11712 11712
 			//if we didn't find a two chracter prefix lets just search the one with one character
11713 11713
 			if ($registration_prefix == "")
11714 11714
 			{
11715
-				$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1";
11715
+				$query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1";
11716 11716
 	      
11717 11717
 				$sth = $this->db->prepare($query);
11718 11718
 				$sth->execute(array(':registration_1' => $registration_1));
11719 11719
 	        
11720
-				while($row = $sth->fetch(PDO::FETCH_ASSOC))
11720
+				while ($row = $sth->fetch(PDO::FETCH_ASSOC))
11721 11721
 				{
11722 11722
 					$registration_prefix = $row['registration_prefix'];
11723 11723
 					//$country = $row['country'];
@@ -11738,13 +11738,13 @@  discard block
 block discarded – undo
11738 11738
 	*/
11739 11739
 	public function countryFromAircraftRegistrationCode($registration)
11740 11740
 	{
11741
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
11741
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
11742 11742
 		
11743 11743
 		$country = '';
11744
-		$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration LIMIT 1";
11744
+		$query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration LIMIT 1";
11745 11745
 		$sth = $this->db->prepare($query);
11746 11746
 		$sth->execute(array(':registration' => $registration));
11747
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
11747
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
11748 11748
 		{
11749 11749
 			$country = $row['country'];
11750 11750
 		}
@@ -11757,9 +11757,9 @@  discard block
 block discarded – undo
11757 11757
 	* @param String $flightaware_id flightaware_id from spotter_output table
11758 11758
 	* @param String $highlight New highlight value
11759 11759
 	*/
11760
-	public function setHighlightFlight($flightaware_id,$highlight) {
11760
+	public function setHighlightFlight($flightaware_id, $highlight) {
11761 11761
 		
11762
-		$query  = "UPDATE spotter_output SET highlight = :highlight WHERE flightaware_id = :flightaware_id";
11762
+		$query = "UPDATE spotter_output SET highlight = :highlight WHERE flightaware_id = :flightaware_id";
11763 11763
 		$sth = $this->db->prepare($query);
11764 11764
 		$sth->execute(array(':flightaware_id' => $flightaware_id, ':highlight' => $highlight));
11765 11765
 	}
@@ -11771,13 +11771,13 @@  discard block
 block discarded – undo
11771 11771
 	* @param String $date Date of spotted aircraft
11772 11772
 	* @param String $highlight New highlight value
11773 11773
 	*/
11774
-	public function setHighlightFlightByRegistration($registration,$highlight, $date = '') {
11774
+	public function setHighlightFlightByRegistration($registration, $highlight, $date = '') {
11775 11775
 		if ($date == '') {
11776 11776
 			$query  = "UPDATE spotter_output SET highlight = :highlight WHERE spotter_id IN (SELECT MAX(spotter_id) FROM spotter_output WHERE registration = :registration)";
11777 11777
 			$query_values = array(':registration' => $registration, ':highlight' => $highlight);
11778 11778
 		} else {
11779 11779
 			$query  = "UPDATE spotter_output SET highlight = :highlight WHERE registration = :registration AND date(date) = :date";
11780
-			$query_values = array(':registration' => $registration, ':highlight' => $highlight,':date' => $date);
11780
+			$query_values = array(':registration' => $registration, ':highlight' => $highlight, ':date' => $date);
11781 11781
 		}
11782 11782
 		$sth = $this->db->prepare($query);
11783 11783
 		$sth->execute($query_values);
@@ -11807,7 +11807,7 @@  discard block
 block discarded – undo
11807 11807
 		
11808 11808
 		$bitly_data = json_decode($bitly_data);
11809 11809
 		$bitly_url = '';
11810
-		if ($bitly_data->status_txt = "OK"){
11810
+		if ($bitly_data->status_txt = "OK") {
11811 11811
 			$bitly_url = $bitly_data->data->url;
11812 11812
 		}
11813 11813
 
@@ -11817,7 +11817,7 @@  discard block
 block discarded – undo
11817 11817
 
11818 11818
 	public function getOrderBy()
11819 11819
 	{
11820
-		$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"));
11820
+		$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"));
11821 11821
 		
11822 11822
 		return $orderby;
11823 11823
 		
@@ -11951,14 +11951,14 @@  discard block
 block discarded – undo
11951 11951
 		}
11952 11952
 		$sth = $this->db->prepare($query);
11953 11953
 		$sth->execute();
11954
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
11954
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
11955 11955
 		{
11956 11956
 			$departure_airport_array = $this->getAllAirportInfo($row['fromairport_icao']);
11957 11957
 			$arrival_airport_array = $this->getAllAirportInfo($row['toairport_icao']);
11958 11958
 			if (count($departure_airport_array) > 0 && count($arrival_airport_array) > 0) {
11959
-				$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";
11959
+				$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";
11960 11960
 				$sthu = $this->db->prepare($update_query);
11961
-				$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']));
11961
+				$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']));
11962 11962
 			}
11963 11963
 		}
11964 11964
 		
@@ -11971,7 +11971,7 @@  discard block
 block discarded – undo
11971 11971
 		}
11972 11972
 		$sth = $this->db->prepare($query);
11973 11973
 		$sth->execute();
11974
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
11974
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
11975 11975
 		{
11976 11976
 			if (is_numeric(substr($row['ident'], -1, 1)))
11977 11977
 			{
@@ -11980,11 +11980,11 @@  discard block
 block discarded – undo
11980 11980
 				elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') $fromsource = 'ivao';
11981 11981
 				elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim';
11982 11982
 				elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao';
11983
-				$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3),$fromsource);
11983
+				$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3), $fromsource);
11984 11984
 				if (isset($airline_array[0]['name'])) {
11985
-					$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";
11985
+					$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";
11986 11986
 					$sthu = $this->db->prepare($update_query);
11987
-					$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']));
11987
+					$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']));
11988 11988
 				}
11989 11989
 			}
11990 11990
 		}
@@ -12004,18 +12004,18 @@  discard block
 block discarded – undo
12004 12004
 		}
12005 12005
 		$sth = $this->db->prepare($query);
12006 12006
 		$sth->execute();
12007
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
12007
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
12008 12008
 		{
12009 12009
 			if ($row['aircraft_icao'] != '') {
12010 12010
 				$aircraft_name = $this->getAllAircraftInfo($row['aircraft_icao']);
12011
-				if ($row['registration'] != ""){
12011
+				if ($row['registration'] != "") {
12012 12012
 					$image_array = $Image->getSpotterImage($row['registration']);
12013 12013
 					if (!isset($image_array[0]['registration'])) {
12014 12014
 						$Image->addSpotterImage($row['registration']);
12015 12015
 					}
12016 12016
 				}
12017 12017
 				if (count($aircraft_name) > 0) {
12018
-					$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";
12018
+					$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";
12019 12019
 					$sthu = $this->db->prepare($update_query);
12020 12020
 					$sthu->execute(array(':aircraft_name' => $aircraft_name[0]['type'], ':aircraft_manufacturer' => $aircraft_name[0]['manufacturer'], ':spotter_id' => $row['spotter_id']));
12021 12021
 				}
@@ -12030,10 +12030,10 @@  discard block
 block discarded – undo
12030 12030
 		$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";
12031 12031
 		$sth = $this->db->prepare($query);
12032 12032
 		$sth->execute();
12033
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
12033
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
12034 12034
 		{
12035 12035
 			if ($row['last_latitude'] != '' && $row['last_longitude'] != '') {
12036
-				$closestAirports = $this->closestAirports($row['last_latitude'],$row['last_longitude'],$globalClosestMinDist);
12036
+				$closestAirports = $this->closestAirports($row['last_latitude'], $row['last_longitude'], $globalClosestMinDist);
12037 12037
 				$airport_icao = '';
12038 12038
 				 if (isset($closestAirports[0])) {
12039 12039
 					if ($row['arrival_airport_icao'] == $closestAirports[0]['icao']) {
@@ -12047,7 +12047,7 @@  discard block
 block discarded – undo
12047 12047
 								break;
12048 12048
 							}
12049 12049
 						}
12050
-					} elseif ($row['last_altitude'] == 0 || ($row['last_altitude'] != '' && ($closestAirports[0]['altitude'] <= $row['last_altitude']*100+1000 && $row['last_altitude']*100 < $closestAirports[0]['altitude']+5000))) {
12050
+					} elseif ($row['last_altitude'] == 0 || ($row['last_altitude'] != '' && ($closestAirports[0]['altitude'] <= $row['last_altitude']*100 + 1000 && $row['last_altitude']*100 < $closestAirports[0]['altitude'] + 5000))) {
12051 12051
 						$airport_icao = $closestAirports[0]['icao'];
12052 12052
 						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";
12053 12053
 					} else {
@@ -12058,28 +12058,28 @@  discard block
 block discarded – undo
12058 12058
 				}
12059 12059
 				if ($row['real_arrival_airport_icao'] != $airport_icao) {
12060 12060
 					if ($globalDebug) echo "Updating airport to ".$airport_icao."...\n";
12061
-					$update_query="UPDATE spotter_output SET real_arrival_airport_icao = :airport_icao WHERE spotter_id = :spotter_id";
12061
+					$update_query = "UPDATE spotter_output SET real_arrival_airport_icao = :airport_icao WHERE spotter_id = :spotter_id";
12062 12062
 					$sthu = $this->db->prepare($update_query);
12063
-					$sthu->execute(array(':airport_icao' => $airport_icao,':spotter_id' => $row['spotter_id']));
12063
+					$sthu->execute(array(':airport_icao' => $airport_icao, ':spotter_id' => $row['spotter_id']));
12064 12064
 				}
12065 12065
 			}
12066 12066
 		}
12067 12067
 	}
12068 12068
 	
12069
-	public function closestAirports($origLat,$origLon,$dist = 10) {
12069
+	public function closestAirports($origLat, $origLon, $dist = 10) {
12070 12070
 		global $globalDBdriver;
12071
-		$dist = number_format($dist*0.621371,2,'.',''); // convert km to mile
12071
+		$dist = number_format($dist*0.621371, 2, '.', ''); // convert km to mile
12072 12072
 /*
12073 12073
 		$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 
12074 12074
                       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)) 
12075 12075
                       having distance < $dist ORDER BY distance limit 100;";
12076 12076
 */
12077 12077
 		if ($globalDBdriver == 'mysql') {
12078
-			$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 
12078
+			$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 
12079 12079
 	                      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)) 
12080 12080
 	                      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;";
12081 12081
                 } else {
12082
-			$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 
12082
+			$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 
12083 12083
 	                      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)) 
12084 12084
 	                      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;";
12085 12085
     		}
Please login to merge, or discard this patch.
pilot-sub-menu.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -3,9 +3,9 @@  discard block
 block discarded – undo
3 3
 </span>
4 4
 <div class="sub-menu sub-menu-container">
5 5
 	<ul class="nav nav-pills">
6
-		<li><a href="<?php print $globalURL; ?>/pilot/<?php print $_GET['pilot']; ?><?php if (isset($year) && $year != '') echo '/'.$year; ?><?php if (isset($month) && $month != '') echo '/'.$month; ?>" <?php if (strtolower($current_page) == "pilot-detailed"){ print 'class="active"'; } ?>><?php echo _("Detailed"); ?></a></li>
6
+		<li><a href="<?php print $globalURL; ?>/pilot/<?php print $_GET['pilot']; ?><?php if (isset($year) && $year != '') echo '/'.$year; ?><?php if (isset($month) && $month != '') echo '/'.$month; ?>" <?php if (strtolower($current_page) == "pilot-detailed") { print 'class="active"'; } ?>><?php echo _("Detailed"); ?></a></li>
7 7
 		<li class="dropdown">
8
-		    <a class="dropdown-toggle <?php if(strtolower($current_page) == "pilot-statistics-aircraft" || strtolower($current_page) == "pilot-statistics-registration" || strtolower($current_page) == "pilot-statistics-manufacturer"){ print 'active'; } ?>" data-toggle="dropdown" href="#">
8
+		    <a class="dropdown-toggle <?php if (strtolower($current_page) == "pilot-statistics-aircraft" || strtolower($current_page) == "pilot-statistics-registration" || strtolower($current_page) == "pilot-statistics-manufacturer") { print 'active'; } ?>" data-toggle="dropdown" href="#">
9 9
 		      <?php echo _("Aircraft"); ?> <span class="caret"></span>
10 10
 		    </a>
11 11
 		    <ul class="dropdown-menu" role="menu">
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 		    </ul>
16 16
 		</li>
17 17
 		<li class="dropdown">
18
-		    <a class="dropdown-toggle <?php if(strtolower($current_page) == "pilot-statistics-departure-airport" || strtolower($current_page) == "pilot-statistics-departure-airport-country" || strtolower($current_page) == "pilot-statistics-arrival-airport" || strtolower($current_page) == "pilot-statistics-arrival-airport-country"){ print 'active'; } ?>" data-toggle="dropdown" href="#">
18
+		    <a class="dropdown-toggle <?php if (strtolower($current_page) == "pilot-statistics-departure-airport" || strtolower($current_page) == "pilot-statistics-departure-airport-country" || strtolower($current_page) == "pilot-statistics-arrival-airport" || strtolower($current_page) == "pilot-statistics-arrival-airport-country") { print 'active'; } ?>" data-toggle="dropdown" href="#">
19 19
 		      <?php echo _("Airport"); ?> <span class="caret"></span>
20 20
 		    </a>
21 21
 		    <ul class="dropdown-menu" role="menu">
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 			  <li><a href="<?php print $globalURL; ?>/pilot/statistics/arrival-airport-country/<?php print $_GET['pilot']; ?><?php if (isset($year) && $year != '') echo '/'.$year; ?><?php if (isset($month) && $month != '') echo '/'.$month; ?>"><?php echo _("Arrival Airport by Country"); ?></a></li>
26 26
 		    </ul>
27 27
 		</li>
28
-		<li><a href="<?php print $globalURL; ?>/pilot/statistics/route/<?php print $_GET['pilot']; ?><?php if (isset($year) && $year != '') echo '/'.$year; ?><?php if (isset($month) && $month != '') echo '/'.$month; ?>" <?php if (strtolower($current_page) == "pilot-statistics-route"){ print 'class="active"'; } ?>><?php echo _("Route"); ?></a></li>
29
-		<li><a href="<?php print $globalURL; ?>/pilot/statistics/time/<?php print $_GET['pilot']; ?><?php if (isset($year) && $year != '') echo '/'.$year; ?><?php if (isset($month) && $month != '') echo '/'.$month; ?>" <?php if (strtolower($current_page) == "pilot-statistics-time"){ print 'class="active"'; } ?>><?php echo _("Time"); ?></a></li>
28
+		<li><a href="<?php print $globalURL; ?>/pilot/statistics/route/<?php print $_GET['pilot']; ?><?php if (isset($year) && $year != '') echo '/'.$year; ?><?php if (isset($month) && $month != '') echo '/'.$month; ?>" <?php if (strtolower($current_page) == "pilot-statistics-route") { print 'class="active"'; } ?>><?php echo _("Route"); ?></a></li>
29
+		<li><a href="<?php print $globalURL; ?>/pilot/statistics/time/<?php print $_GET['pilot']; ?><?php if (isset($year) && $year != '') echo '/'.$year; ?><?php if (isset($month) && $month != '') echo '/'.$month; ?>" <?php if (strtolower($current_page) == "pilot-statistics-time") { print 'class="active"'; } ?>><?php echo _("Time"); ?></a></li>
30 30
 	</ul>
31 31
 </div>
32 32
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +70 added lines, -10 removed lines patch added patch discarded remove patch
@@ -3,15 +3,39 @@  discard block
 block discarded – undo
3 3
 </span>
4 4
 <div class="sub-menu sub-menu-container">
5 5
 	<ul class="nav nav-pills">
6
-		<li><a href="<?php print $globalURL; ?>/pilot/<?php print $_GET['pilot']; ?><?php if (isset($year) && $year != '') echo '/'.$year; ?><?php if (isset($month) && $month != '') echo '/'.$month; ?>" <?php if (strtolower($current_page) == "pilot-detailed"){ print 'class="active"'; } ?>><?php echo _("Detailed"); ?></a></li>
6
+		<li><a href="<?php print $globalURL; ?>/pilot/<?php print $_GET['pilot']; ?><?php if (isset($year) && $year != '') {
7
+	echo '/'.$year;
8
+}
9
+?><?php if (isset($month) && $month != '') {
10
+	echo '/'.$month;
11
+}
12
+?>" <?php if (strtolower($current_page) == "pilot-detailed"){ print 'class="active"'; } ?>><?php echo _("Detailed"); ?></a></li>
7 13
 		<li class="dropdown">
8 14
 		    <a class="dropdown-toggle <?php if(strtolower($current_page) == "pilot-statistics-aircraft" || strtolower($current_page) == "pilot-statistics-registration" || strtolower($current_page) == "pilot-statistics-manufacturer"){ print 'active'; } ?>" data-toggle="dropdown" href="#">
9 15
 		      <?php echo _("Aircraft"); ?> <span class="caret"></span>
10 16
 		    </a>
11 17
 		    <ul class="dropdown-menu" role="menu">
12
-		      <li><a href="<?php print $globalURL; ?>/pilot/statistics/aircraft/<?php print $_GET['pilot']; ?><?php if (isset($year) && $year != '') echo '/'.$year; ?><?php if (isset($month) && $month != '') echo '/'.$month; ?>"><?php echo _("Aircraft Type"); ?></a></li>
13
-					<li><a href="<?php print $globalURL; ?>/pilot/statistics/registration/<?php print $_GET['pilot']; ?><?php if (isset($year) && $year != '') echo '/'.$year; ?><?php if (isset($month) && $month != '') echo '/'.$month; ?>"><?php echo _("Registration"); ?></a></li>
14
-					<li><a href="<?php print $globalURL; ?>/pilot/statistics/manufacturer/<?php print $_GET['pilot']; ?><?php if (isset($year) && $year != '') echo '/'.$year; ?><?php if (isset($month) && $month != '') echo '/'.$month; ?>"><?php echo _("Manufacturer"); ?></a></li>
18
+		      <li><a href="<?php print $globalURL; ?>/pilot/statistics/aircraft/<?php print $_GET['pilot']; ?><?php if (isset($year) && $year != '') {
19
+	echo '/'.$year;
20
+}
21
+?><?php if (isset($month) && $month != '') {
22
+	echo '/'.$month;
23
+}
24
+?>"><?php echo _("Aircraft Type"); ?></a></li>
25
+					<li><a href="<?php print $globalURL; ?>/pilot/statistics/registration/<?php print $_GET['pilot']; ?><?php if (isset($year) && $year != '') {
26
+	echo '/'.$year;
27
+}
28
+?><?php if (isset($month) && $month != '') {
29
+	echo '/'.$month;
30
+}
31
+?>"><?php echo _("Registration"); ?></a></li>
32
+					<li><a href="<?php print $globalURL; ?>/pilot/statistics/manufacturer/<?php print $_GET['pilot']; ?><?php if (isset($year) && $year != '') {
33
+	echo '/'.$year;
34
+}
35
+?><?php if (isset($month) && $month != '') {
36
+	echo '/'.$month;
37
+}
38
+?>"><?php echo _("Manufacturer"); ?></a></li>
15 39
 		    </ul>
16 40
 		</li>
17 41
 		<li class="dropdown">
@@ -19,13 +43,49 @@  discard block
 block discarded – undo
19 43
 		      <?php echo _("Airport"); ?> <span class="caret"></span>
20 44
 		    </a>
21 45
 		    <ul class="dropdown-menu" role="menu">
22
-		      <li><a href="<?php print $globalURL; ?>/pilot/statistics/departure-airport/<?php print $_GET['pilot']; ?><?php if (isset($year) && $year != '') echo '/'.$year; ?><?php if (isset($month) && $month != '') echo '/'.$month; ?>"><?php echo _("Departure Airport"); ?></a></li>
23
-		      <li><a href="<?php print $globalURL; ?>/pilot/statistics/departure-airport-country/<?php print $_GET['pilot']; ?><?php if (isset($year) && $year != '') echo '/'.$year; ?><?php if (isset($month) && $month != '') echo '/'.$month; ?>"><?php echo _("Departure Airport by Country"); ?></a></li>
24
-			  <li><a href="<?php print $globalURL; ?>/pilot/statistics/arrival-airport/<?php print $_GET['pilot']; ?><?php if (isset($year) && $year != '') echo '/'.$year; ?><?php if (isset($month) && $month != '') echo '/'.$month; ?>"><?php echo _("Arrival Airport"); ?></a></li>
25
-			  <li><a href="<?php print $globalURL; ?>/pilot/statistics/arrival-airport-country/<?php print $_GET['pilot']; ?><?php if (isset($year) && $year != '') echo '/'.$year; ?><?php if (isset($month) && $month != '') echo '/'.$month; ?>"><?php echo _("Arrival Airport by Country"); ?></a></li>
46
+		      <li><a href="<?php print $globalURL; ?>/pilot/statistics/departure-airport/<?php print $_GET['pilot']; ?><?php if (isset($year) && $year != '') {
47
+	echo '/'.$year;
48
+}
49
+?><?php if (isset($month) && $month != '') {
50
+	echo '/'.$month;
51
+}
52
+?>"><?php echo _("Departure Airport"); ?></a></li>
53
+		      <li><a href="<?php print $globalURL; ?>/pilot/statistics/departure-airport-country/<?php print $_GET['pilot']; ?><?php if (isset($year) && $year != '') {
54
+	echo '/'.$year;
55
+}
56
+?><?php if (isset($month) && $month != '') {
57
+	echo '/'.$month;
58
+}
59
+?>"><?php echo _("Departure Airport by Country"); ?></a></li>
60
+			  <li><a href="<?php print $globalURL; ?>/pilot/statistics/arrival-airport/<?php print $_GET['pilot']; ?><?php if (isset($year) && $year != '') {
61
+	echo '/'.$year;
62
+}
63
+?><?php if (isset($month) && $month != '') {
64
+	echo '/'.$month;
65
+}
66
+?>"><?php echo _("Arrival Airport"); ?></a></li>
67
+			  <li><a href="<?php print $globalURL; ?>/pilot/statistics/arrival-airport-country/<?php print $_GET['pilot']; ?><?php if (isset($year) && $year != '') {
68
+	echo '/'.$year;
69
+}
70
+?><?php if (isset($month) && $month != '') {
71
+	echo '/'.$month;
72
+}
73
+?>"><?php echo _("Arrival Airport by Country"); ?></a></li>
26 74
 		    </ul>
27 75
 		</li>
28
-		<li><a href="<?php print $globalURL; ?>/pilot/statistics/route/<?php print $_GET['pilot']; ?><?php if (isset($year) && $year != '') echo '/'.$year; ?><?php if (isset($month) && $month != '') echo '/'.$month; ?>" <?php if (strtolower($current_page) == "pilot-statistics-route"){ print 'class="active"'; } ?>><?php echo _("Route"); ?></a></li>
29
-		<li><a href="<?php print $globalURL; ?>/pilot/statistics/time/<?php print $_GET['pilot']; ?><?php if (isset($year) && $year != '') echo '/'.$year; ?><?php if (isset($month) && $month != '') echo '/'.$month; ?>" <?php if (strtolower($current_page) == "pilot-statistics-time"){ print 'class="active"'; } ?>><?php echo _("Time"); ?></a></li>
76
+		<li><a href="<?php print $globalURL; ?>/pilot/statistics/route/<?php print $_GET['pilot']; ?><?php if (isset($year) && $year != '') {
77
+	echo '/'.$year;
78
+}
79
+?><?php if (isset($month) && $month != '') {
80
+	echo '/'.$month;
81
+}
82
+?>" <?php if (strtolower($current_page) == "pilot-statistics-route"){ print 'class="active"'; } ?>><?php echo _("Route"); ?></a></li>
83
+		<li><a href="<?php print $globalURL; ?>/pilot/statistics/time/<?php print $_GET['pilot']; ?><?php if (isset($year) && $year != '') {
84
+	echo '/'.$year;
85
+}
86
+?><?php if (isset($month) && $month != '') {
87
+	echo '/'.$month;
88
+}
89
+?>" <?php if (strtolower($current_page) == "pilot-statistics-time"){ print 'class="active"'; } ?>><?php echo _("Time"); ?></a></li>
30 90
 	</ul>
31 91
 </div>
32 92
\ No newline at end of file
Please login to merge, or discard this patch.
owner-sub-menu.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -8,9 +8,9 @@  discard block
 block discarded – undo
8 8
 </div>
9 9
 <div class="sub-menu sub-menu-container">
10 10
 	<ul class="nav nav-pills">
11
-		<li><a href="<?php print $globalURL; ?>/owner/<?php print $_GET['owner']; ?><?php if (isset($year) && $year != '') echo '/'.$year; ?><?php if (isset($month) && $month != '') echo '/'.$month; ?>" <?php if (strtolower($current_page) == "owner-detailed"){ print 'class="active"'; } ?>><?php echo _("Detailed"); ?></a></li>
11
+		<li><a href="<?php print $globalURL; ?>/owner/<?php print $_GET['owner']; ?><?php if (isset($year) && $year != '') echo '/'.$year; ?><?php if (isset($month) && $month != '') echo '/'.$month; ?>" <?php if (strtolower($current_page) == "owner-detailed") { print 'class="active"'; } ?>><?php echo _("Detailed"); ?></a></li>
12 12
 		<li class="dropdown">
13
-		    <a class="dropdown-toggle <?php if(strtolower($current_page) == "owner-statistics-aircraft" || strtolower($current_page) == "owner-statistics-registration" || strtolower($current_page) == "owner-statistics-manufacturer"){ print 'active'; } ?>" data-toggle="dropdown" href="#">
13
+		    <a class="dropdown-toggle <?php if (strtolower($current_page) == "owner-statistics-aircraft" || strtolower($current_page) == "owner-statistics-registration" || strtolower($current_page) == "owner-statistics-manufacturer") { print 'active'; } ?>" data-toggle="dropdown" href="#">
14 14
 		      <?php echo _("Aircraft"); ?> <span class="caret"></span>
15 15
 		    </a>
16 16
 		    <ul class="dropdown-menu" role="menu">
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 		    </ul>
21 21
 		</li>
22 22
 		<li class="dropdown">
23
-		    <a class="dropdown-toggle <?php if(strtolower($current_page) == "owner-statistics-departure-airport" || strtolower($current_page) == "owner-statistics-departure-airport-country" || strtolower($current_page) == "owner-statistics-arrival-airport" || strtolower($current_page) == "owner-statistics-arrival-airport-country"){ print 'active'; } ?>" data-toggle="dropdown" href="#">
23
+		    <a class="dropdown-toggle <?php if (strtolower($current_page) == "owner-statistics-departure-airport" || strtolower($current_page) == "owner-statistics-departure-airport-country" || strtolower($current_page) == "owner-statistics-arrival-airport" || strtolower($current_page) == "owner-statistics-arrival-airport-country") { print 'active'; } ?>" data-toggle="dropdown" href="#">
24 24
 		      <?php echo _("Airport"); ?> <span class="caret"></span>
25 25
 		    </a>
26 26
 		    <ul class="dropdown-menu" role="menu">
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 			  <li><a href="<?php print $globalURL; ?>/owner/statistics/arrival-airport-country/<?php print $_GET['owner']; ?><?php if (isset($year) && $year != '') echo '/'.$year; ?><?php if (isset($month) && $month != '') echo '/'.$month; ?>"><?php echo _("Arrival Airport by Country"); ?></a></li>
31 31
 		    </ul>
32 32
 		</li>
33
-		<li><a href="<?php print $globalURL; ?>/owner/statistics/route/<?php print $_GET['owner']; ?><?php if (isset($year) && $year != '') echo '/'.$year; ?><?php if (isset($month) && $month != '') echo '/'.$month; ?>" <?php if (strtolower($current_page) == "owner-statistics-route"){ print 'class="active"'; } ?>><?php echo _("Route"); ?></a></li>
34
-		<li><a href="<?php print $globalURL; ?>/owner/statistics/time/<?php print $_GET['owner']; ?><?php if (isset($year) && $year != '') echo '/'.$year; ?><?php if (isset($month) && $month != '') echo '/'.$month; ?>" <?php if (strtolower($current_page) == "owner-statistics-time"){ print 'class="active"'; } ?>><?php echo _("Time"); ?></a></li>
33
+		<li><a href="<?php print $globalURL; ?>/owner/statistics/route/<?php print $_GET['owner']; ?><?php if (isset($year) && $year != '') echo '/'.$year; ?><?php if (isset($month) && $month != '') echo '/'.$month; ?>" <?php if (strtolower($current_page) == "owner-statistics-route") { print 'class="active"'; } ?>><?php echo _("Route"); ?></a></li>
34
+		<li><a href="<?php print $globalURL; ?>/owner/statistics/time/<?php print $_GET['owner']; ?><?php if (isset($year) && $year != '') echo '/'.$year; ?><?php if (isset($month) && $month != '') echo '/'.$month; ?>" <?php if (strtolower($current_page) == "owner-statistics-time") { print 'class="active"'; } ?>><?php echo _("Time"); ?></a></li>
35 35
 	</ul>
36 36
 </div>
37 37
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +77 added lines, -11 removed lines patch added patch discarded remove patch
@@ -3,20 +3,50 @@  discard block
 block discarded – undo
3 3
 </span>
4 4
 <div class="stats_airline">
5 5
 	<form id="changedate" method="post">
6
-		<input type="month" name="date" onchange="statsdatechange(this);" value="<?php if (isset($year) && $year != '') echo $year.'-'; ?><?php if (isset($month) && $month != '') echo $month; ?>" />
6
+		<input type="month" name="date" onchange="statsdatechange(this);" value="<?php if (isset($year) && $year != '') {
7
+	echo $year.'-';
8
+}
9
+?><?php if (isset($month) && $month != '') {
10
+	echo $month;
11
+}
12
+?>" />
7 13
 	</form>
8 14
 </div>
9 15
 <div class="sub-menu sub-menu-container">
10 16
 	<ul class="nav nav-pills">
11
-		<li><a href="<?php print $globalURL; ?>/owner/<?php print $_GET['owner']; ?><?php if (isset($year) && $year != '') echo '/'.$year; ?><?php if (isset($month) && $month != '') echo '/'.$month; ?>" <?php if (strtolower($current_page) == "owner-detailed"){ print 'class="active"'; } ?>><?php echo _("Detailed"); ?></a></li>
17
+		<li><a href="<?php print $globalURL; ?>/owner/<?php print $_GET['owner']; ?><?php if (isset($year) && $year != '') {
18
+	echo '/'.$year;
19
+}
20
+?><?php if (isset($month) && $month != '') {
21
+	echo '/'.$month;
22
+}
23
+?>" <?php if (strtolower($current_page) == "owner-detailed"){ print 'class="active"'; } ?>><?php echo _("Detailed"); ?></a></li>
12 24
 		<li class="dropdown">
13 25
 		    <a class="dropdown-toggle <?php if(strtolower($current_page) == "owner-statistics-aircraft" || strtolower($current_page) == "owner-statistics-registration" || strtolower($current_page) == "owner-statistics-manufacturer"){ print 'active'; } ?>" data-toggle="dropdown" href="#">
14 26
 		      <?php echo _("Aircraft"); ?> <span class="caret"></span>
15 27
 		    </a>
16 28
 		    <ul class="dropdown-menu" role="menu">
17
-		      <li><a href="<?php print $globalURL; ?>/owner/statistics/aircraft/<?php print $_GET['owner']; ?><?php if (isset($year) && $year != '') echo '/'.$year; ?><?php if (isset($month) && $month != '') echo '/'.$month; ?>"><?php echo _("Aircraft Type"); ?></a></li>
18
-					<li><a href="<?php print $globalURL; ?>/owner/statistics/registration/<?php print $_GET['owner']; ?><?php if (isset($year) && $year != '') echo '/'.$year; ?><?php if (isset($month) && $month != '') echo '/'.$month; ?>"><?php echo _("Registration"); ?></a></li>
19
-					<li><a href="<?php print $globalURL; ?>/owner/statistics/manufacturer/<?php print $_GET['owner']; ?><?php if (isset($year) && $year != '') echo '/'.$year; ?><?php if (isset($month) && $month != '') echo '/'.$month; ?>"><?php echo _("Manufacturer"); ?></a></li>
29
+		      <li><a href="<?php print $globalURL; ?>/owner/statistics/aircraft/<?php print $_GET['owner']; ?><?php if (isset($year) && $year != '') {
30
+	echo '/'.$year;
31
+}
32
+?><?php if (isset($month) && $month != '') {
33
+	echo '/'.$month;
34
+}
35
+?>"><?php echo _("Aircraft Type"); ?></a></li>
36
+					<li><a href="<?php print $globalURL; ?>/owner/statistics/registration/<?php print $_GET['owner']; ?><?php if (isset($year) && $year != '') {
37
+	echo '/'.$year;
38
+}
39
+?><?php if (isset($month) && $month != '') {
40
+	echo '/'.$month;
41
+}
42
+?>"><?php echo _("Registration"); ?></a></li>
43
+					<li><a href="<?php print $globalURL; ?>/owner/statistics/manufacturer/<?php print $_GET['owner']; ?><?php if (isset($year) && $year != '') {
44
+	echo '/'.$year;
45
+}
46
+?><?php if (isset($month) && $month != '') {
47
+	echo '/'.$month;
48
+}
49
+?>"><?php echo _("Manufacturer"); ?></a></li>
20 50
 		    </ul>
21 51
 		</li>
22 52
 		<li class="dropdown">
@@ -24,13 +54,49 @@  discard block
 block discarded – undo
24 54
 		      <?php echo _("Airport"); ?> <span class="caret"></span>
25 55
 		    </a>
26 56
 		    <ul class="dropdown-menu" role="menu">
27
-		      <li><a href="<?php print $globalURL; ?>/owner/statistics/departure-airport/<?php print $_GET['owner']; ?><?php if (isset($year) && $year != '') echo '/'.$year; ?><?php if (isset($month) && $month != '') echo '/'.$month; ?>"><?php echo _("Departure Airport"); ?></a></li>
28
-		      <li><a href="<?php print $globalURL; ?>/owner/statistics/departure-airport-country/<?php print $_GET['owner']; ?><?php if (isset($year) && $year != '') echo '/'.$year; ?><?php if (isset($month) && $month != '') echo '/'.$month; ?>"><?php echo _("Departure Airport by Country"); ?></a></li>
29
-			  <li><a href="<?php print $globalURL; ?>/owner/statistics/arrival-airport/<?php print $_GET['owner']; ?><?php if (isset($year) && $year != '') echo '/'.$year; ?><?php if (isset($month) && $month != '') echo '/'.$month; ?>"><?php echo _("Arrival Airport"); ?></a></li>
30
-			  <li><a href="<?php print $globalURL; ?>/owner/statistics/arrival-airport-country/<?php print $_GET['owner']; ?><?php if (isset($year) && $year != '') echo '/'.$year; ?><?php if (isset($month) && $month != '') echo '/'.$month; ?>"><?php echo _("Arrival Airport by Country"); ?></a></li>
57
+		      <li><a href="<?php print $globalURL; ?>/owner/statistics/departure-airport/<?php print $_GET['owner']; ?><?php if (isset($year) && $year != '') {
58
+	echo '/'.$year;
59
+}
60
+?><?php if (isset($month) && $month != '') {
61
+	echo '/'.$month;
62
+}
63
+?>"><?php echo _("Departure Airport"); ?></a></li>
64
+		      <li><a href="<?php print $globalURL; ?>/owner/statistics/departure-airport-country/<?php print $_GET['owner']; ?><?php if (isset($year) && $year != '') {
65
+	echo '/'.$year;
66
+}
67
+?><?php if (isset($month) && $month != '') {
68
+	echo '/'.$month;
69
+}
70
+?>"><?php echo _("Departure Airport by Country"); ?></a></li>
71
+			  <li><a href="<?php print $globalURL; ?>/owner/statistics/arrival-airport/<?php print $_GET['owner']; ?><?php if (isset($year) && $year != '') {
72
+	echo '/'.$year;
73
+}
74
+?><?php if (isset($month) && $month != '') {
75
+	echo '/'.$month;
76
+}
77
+?>"><?php echo _("Arrival Airport"); ?></a></li>
78
+			  <li><a href="<?php print $globalURL; ?>/owner/statistics/arrival-airport-country/<?php print $_GET['owner']; ?><?php if (isset($year) && $year != '') {
79
+	echo '/'.$year;
80
+}
81
+?><?php if (isset($month) && $month != '') {
82
+	echo '/'.$month;
83
+}
84
+?>"><?php echo _("Arrival Airport by Country"); ?></a></li>
31 85
 		    </ul>
32 86
 		</li>
33
-		<li><a href="<?php print $globalURL; ?>/owner/statistics/route/<?php print $_GET['owner']; ?><?php if (isset($year) && $year != '') echo '/'.$year; ?><?php if (isset($month) && $month != '') echo '/'.$month; ?>" <?php if (strtolower($current_page) == "owner-statistics-route"){ print 'class="active"'; } ?>><?php echo _("Route"); ?></a></li>
34
-		<li><a href="<?php print $globalURL; ?>/owner/statistics/time/<?php print $_GET['owner']; ?><?php if (isset($year) && $year != '') echo '/'.$year; ?><?php if (isset($month) && $month != '') echo '/'.$month; ?>" <?php if (strtolower($current_page) == "owner-statistics-time"){ print 'class="active"'; } ?>><?php echo _("Time"); ?></a></li>
87
+		<li><a href="<?php print $globalURL; ?>/owner/statistics/route/<?php print $_GET['owner']; ?><?php if (isset($year) && $year != '') {
88
+	echo '/'.$year;
89
+}
90
+?><?php if (isset($month) && $month != '') {
91
+	echo '/'.$month;
92
+}
93
+?>" <?php if (strtolower($current_page) == "owner-statistics-route"){ print 'class="active"'; } ?>><?php echo _("Route"); ?></a></li>
94
+		<li><a href="<?php print $globalURL; ?>/owner/statistics/time/<?php print $_GET['owner']; ?><?php if (isset($year) && $year != '') {
95
+	echo '/'.$year;
96
+}
97
+?><?php if (isset($month) && $month != '') {
98
+	echo '/'.$month;
99
+}
100
+?>" <?php if (strtolower($current_page) == "owner-statistics-time"){ print 'class="active"'; } ?>><?php echo _("Time"); ?></a></li>
35 101
 	</ul>
36 102
 </div>
37 103
\ No newline at end of file
Please login to merge, or discard this patch.
require/class.SpotterLive.php 4 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@
 block discarded – undo
14 14
 	/**
15 15
 	* Get SQL query part for filter used
16 16
 	* @param Array $filter the filter
17
-	* @return Array the SQL part
17
+	* @return string the SQL part
18 18
 	*/
19 19
 	public function getFilter($filter = array(),$where = false,$and = false) {
20 20
 		global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver;
Please login to merge, or discard this patch.
Indentation   +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();
@@ -111,11 +111,11 @@  discard block
 block discarded – undo
111 111
 	}
112 112
 
113 113
 	/**
114
-	* Gets all the spotter information based on the latest data entry
115
-	*
116
-	* @return Array the spotter information
117
-	*
118
-	*/
114
+	 * Gets all the spotter information based on the latest data entry
115
+	 *
116
+	 * @return Array the spotter information
117
+	 *
118
+	 */
119 119
 	public function getLiveSpotterData($limit = '', $sort = '', $filter = array())
120 120
 	{
121 121
 		global $globalDBdriver, $globalLiveInterval;
@@ -157,11 +157,11 @@  discard block
 block discarded – undo
157 157
 	}
158 158
 
159 159
 	/**
160
-	* Gets Minimal Live Spotter data
161
-	*
162
-	* @return Array the spotter information
163
-	*
164
-	*/
160
+	 * Gets Minimal Live Spotter data
161
+	 *
162
+	 * @return Array the spotter information
163
+	 *
164
+	 */
165 165
 	public function getMinLiveSpotterData($filter = array())
166 166
 	{
167 167
 		global $globalDBdriver, $globalLiveInterval;
@@ -214,11 +214,11 @@  discard block
 block discarded – undo
214 214
 	}
215 215
 
216 216
 	/**
217
-	* Gets Minimal Live Spotter data since xx seconds
218
-	*
219
-	* @return Array the spotter information
220
-	*
221
-	*/
217
+	 * Gets Minimal Live Spotter data since xx seconds
218
+	 *
219
+	 * @return Array the spotter information
220
+	 *
221
+	 */
222 222
 	public function getMinLastLiveSpotterData($filter = array())
223 223
 	{
224 224
 		global $globalDBdriver, $globalLiveInterval;
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
 			$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 
237 237
 			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' 
238 238
 			ORDER BY spotter_live.flightaware_id, spotter_live.date";
239
-                } else {
239
+				} else {
240 240
 /*
241 241
 			$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 
242 242
 			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' 
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
 //			echo $query;
249 249
 		}
250 250
 
251
-    		try {
251
+			try {
252 252
 			$sth = $this->db->prepare($query);
253 253
 			$sth->execute();
254 254
 		} catch(PDOException $e) {
@@ -260,11 +260,11 @@  discard block
 block discarded – undo
260 260
 	}
261 261
 
262 262
 	/**
263
-	* Gets number of latest data entry
264
-	*
265
-	* @return String number of entry
266
-	*
267
-	*/
263
+	 * Gets number of latest data entry
264
+	 *
265
+	 * @return String number of entry
266
+	 *
267
+	 */
268 268
 	public function getLiveSpotterCount($filter = array())
269 269
 	{
270 270
 		global $globalDBdriver, $globalLiveInterval;
@@ -291,11 +291,11 @@  discard block
 block discarded – undo
291 291
 	}
292 292
 
293 293
 	/**
294
-	* Gets all the spotter information based on the latest data entry and coord
295
-	*
296
-	* @return Array the spotter information
297
-	*
298
-	*/
294
+	 * Gets all the spotter information based on the latest data entry and coord
295
+	 *
296
+	 * @return Array the spotter information
297
+	 *
298
+	 */
299 299
 	public function getLiveSpotterDatabyCoord($coord, $filter = array())
300 300
 	{
301 301
 		global $globalDBdriver, $globalLiveInterval;
@@ -320,11 +320,11 @@  discard block
 block discarded – undo
320 320
 	}
321 321
 
322 322
 	/**
323
-	* Gets all the spotter information based on a user's latitude and longitude
324
-	*
325
-	* @return Array the spotter information
326
-	*
327
-	*/
323
+	 * Gets all the spotter information based on a user's latitude and longitude
324
+	 *
325
+	 * @return Array the spotter information
326
+	 *
327
+	 */
328 328
 	public function getLatestSpotterForLayar($lat, $lng, $radius, $interval)
329 329
 	{
330 330
 		$Spotter = new Spotter($this->db);
@@ -334,145 +334,145 @@  discard block
 block discarded – undo
334 334
 				return false;
335 335
 			}
336 336
 		}
337
-        if ($lng != '')
338
-                {
339
-                        if (!is_numeric($lng))
340
-                        {
341
-                                return false;
342
-                        }
343
-                }
344
-
345
-                if ($radius != '')
346
-                {
347
-                        if (!is_numeric($radius))
348
-                        {
349
-                                return false;
350
-                        }
351
-                }
337
+		if ($lng != '')
338
+				{
339
+						if (!is_numeric($lng))
340
+						{
341
+								return false;
342
+						}
343
+				}
344
+
345
+				if ($radius != '')
346
+				{
347
+						if (!is_numeric($radius))
348
+						{
349
+								return false;
350
+						}
351
+				}
352 352
 		$additional_query = '';
353
-        if ($interval != '')
354
-                {
355
-                        if (!is_string($interval))
356
-                        {
357
-                                //$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';
358
-			        return false;
359
-                        } else {
360
-                if ($interval == '1m')
361
-                {
362
-                    $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';
363
-                } else if ($interval == '15m'){
364
-                    $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= spotter_live.date ';
365
-                } 
366
-            }
367
-                } else {
368
-         $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';   
369
-        }
370
-
371
-                $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 
353
+		if ($interval != '')
354
+				{
355
+						if (!is_string($interval))
356
+						{
357
+								//$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';
358
+					return false;
359
+						} else {
360
+				if ($interval == '1m')
361
+				{
362
+					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';
363
+				} else if ($interval == '15m'){
364
+					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= spotter_live.date ';
365
+				} 
366
+			}
367
+				} else {
368
+		 $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';   
369
+		}
370
+
371
+				$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 
372 372
                    WHERE spotter_live.latitude <> '' 
373 373
                                    AND spotter_live.longitude <> '' 
374 374
                    ".$additional_query."
375 375
                    HAVING distance < :radius  
376 376
                                    ORDER BY distance";
377 377
 
378
-                $spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius));
378
+				$spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius));
379 379
 
380
-                return $spotter_array;
381
-        }
380
+				return $spotter_array;
381
+		}
382 382
 
383 383
     
384
-        /**
385
-	* Gets all the spotter information based on a particular callsign
386
-	*
387
-	* @return Array the spotter information
388
-	*
389
-	*/
384
+		/**
385
+		 * Gets all the spotter information based on a particular callsign
386
+		 *
387
+		 * @return Array the spotter information
388
+		 *
389
+		 */
390 390
 	public function getLastLiveSpotterDataByIdent($ident)
391 391
 	{
392 392
 		$Spotter = new Spotter($this->db);
393 393
 		date_default_timezone_set('UTC');
394 394
 
395 395
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
396
-                $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';
396
+				$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';
397 397
 
398 398
 		$spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident),'',true);
399 399
 
400 400
 		return $spotter_array;
401 401
 	}
402 402
 
403
-        /**
404
-	* Gets all the spotter information based on a particular callsign
405
-	*
406
-	* @return Array the spotter information
407
-	*
408
-	*/
403
+		/**
404
+		 * Gets all the spotter information based on a particular callsign
405
+		 *
406
+		 * @return Array the spotter information
407
+		 *
408
+		 */
409 409
 	public function getDateLiveSpotterDataByIdent($ident,$date)
410 410
 	{
411 411
 		$Spotter = new Spotter($this->db);
412 412
 		date_default_timezone_set('UTC');
413 413
 
414 414
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
415
-                $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';
415
+				$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';
416 416
 
417
-                $date = date('c',$date);
417
+				$date = date('c',$date);
418 418
 		$spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident,':date' => $date));
419 419
 
420 420
 		return $spotter_array;
421 421
 	}
422 422
 
423
-        /**
424
-	* Gets last spotter information based on a particular callsign
425
-	*
426
-	* @return Array the spotter information
427
-	*
428
-	*/
423
+		/**
424
+		 * Gets last spotter information based on a particular callsign
425
+		 *
426
+		 * @return Array the spotter information
427
+		 *
428
+		 */
429 429
 	public function getLastLiveSpotterDataById($id)
430 430
 	{
431 431
 		$Spotter = new Spotter($this->db);
432 432
 		date_default_timezone_set('UTC');
433 433
 
434 434
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
435
-                $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';
435
+				$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';
436 436
 
437 437
 		$spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id),'',true);
438 438
 
439 439
 		return $spotter_array;
440 440
 	}
441 441
 
442
-        /**
443
-	* Gets last spotter information based on a particular callsign
444
-	*
445
-	* @return Array the spotter information
446
-	*
447
-	*/
442
+		/**
443
+		 * Gets last spotter information based on a particular callsign
444
+		 *
445
+		 * @return Array the spotter information
446
+		 *
447
+		 */
448 448
 	public function getDateLiveSpotterDataById($id,$date)
449 449
 	{
450 450
 		$Spotter = new Spotter($this->db);
451 451
 		date_default_timezone_set('UTC');
452 452
 
453 453
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
454
-                $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';
455
-                $date = date('c',$date);
454
+				$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';
455
+				$date = date('c',$date);
456 456
 		$spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id,':date' => $date),'',true);
457 457
 
458 458
 		return $spotter_array;
459 459
 	}
460 460
 
461
-        /**
462
-	* Gets altitude information based on a particular callsign
463
-	*
464
-	* @return Array the spotter information
465
-	*
466
-	*/
461
+		/**
462
+		 * Gets altitude information based on a particular callsign
463
+		 *
464
+		 * @return Array the spotter information
465
+		 *
466
+		 */
467 467
 	public function getAltitudeLiveSpotterDataByIdent($ident)
468 468
 	{
469 469
 
470 470
 		date_default_timezone_set('UTC');
471 471
 
472 472
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
473
-                $query  = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident';
473
+				$query  = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident';
474 474
 
475
-    		try {
475
+			try {
476 476
 			
477 477
 			$sth = $this->db->prepare($query);
478 478
 			$sth->execute(array(':ident' => $ident));
@@ -485,12 +485,12 @@  discard block
 block discarded – undo
485 485
 		return $spotter_array;
486 486
 	}
487 487
 
488
-        /**
489
-	* Gets all the spotter information based on a particular id
490
-	*
491
-	* @return Array the spotter information
492
-	*
493
-	*/
488
+		/**
489
+		 * Gets all the spotter information based on a particular id
490
+		 *
491
+		 * @return Array the spotter information
492
+		 *
493
+		 */
494 494
 	public function getAllLiveSpotterDataById($id,$liveinterval = false)
495 495
 	{
496 496
 		global $globalDBdriver, $globalLiveInterval;
@@ -518,18 +518,18 @@  discard block
 block discarded – undo
518 518
 		return $spotter_array;
519 519
 	}
520 520
 
521
-        /**
522
-	* Gets all the spotter information based on a particular ident
523
-	*
524
-	* @return Array the spotter information
525
-	*
526
-	*/
521
+		/**
522
+		 * Gets all the spotter information based on a particular ident
523
+		 *
524
+		 * @return Array the spotter information
525
+		 *
526
+		 */
527 527
 	public function getAllLiveSpotterDataByIdent($ident)
528 528
 	{
529 529
 		date_default_timezone_set('UTC');
530 530
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
531 531
 		$query  = self::$global_query.' WHERE spotter_live.ident = :ident';
532
-    		try {
532
+			try {
533 533
 			
534 534
 			$sth = $this->db->prepare($query);
535 535
 			$sth->execute(array(':ident' => $ident));
@@ -543,23 +543,23 @@  discard block
 block discarded – undo
543 543
 
544 544
 
545 545
 	/**
546
-	* Deletes all info in the table
547
-	*
548
-	* @return String success or false
549
-	*
550
-	*/
546
+	 * Deletes all info in the table
547
+	 *
548
+	 * @return String success or false
549
+	 *
550
+	 */
551 551
 	public function deleteLiveSpotterData()
552 552
 	{
553 553
 		global $globalDBdriver;
554 554
 		if ($globalDBdriver == 'mysql') {
555 555
 			//$query  = "DELETE FROM spotter_live WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE) >= spotter_live.date";
556 556
 			$query  = 'DELETE FROM spotter_live WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 9 HOUR) >= spotter_live.date';
557
-            		//$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)";
557
+					//$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)";
558 558
 		} else {
559 559
 			$query  = "DELETE FROM spotter_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' >= spotter_live.date";
560 560
 		}
561 561
         
562
-    		try {
562
+			try {
563 563
 			
564 564
 			$sth = $this->db->prepare($query);
565 565
 			$sth->execute();
@@ -571,18 +571,18 @@  discard block
 block discarded – undo
571 571
 	}
572 572
 
573 573
 	/**
574
-	* Deletes all info in the table for aircraft not seen since 2 HOUR
575
-	*
576
-	* @return String success or false
577
-	*
578
-	*/
574
+	 * Deletes all info in the table for aircraft not seen since 2 HOUR
575
+	 *
576
+	 * @return String success or false
577
+	 *
578
+	 */
579 579
 	public function deleteLiveSpotterDataNotUpdated()
580 580
 	{
581 581
 		global $globalDBdriver, $globalDebug;
582 582
 		if ($globalDBdriver == 'mysql') {
583 583
 			//$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';
584
-    			$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";
585
-    			try {
584
+				$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";
585
+				try {
586 586
 				
587 587
 				$sth = $this->db->prepare($query);
588 588
 				$sth->execute();
@@ -590,8 +590,8 @@  discard block
 block discarded – undo
590 590
 				return "error";
591 591
 			}
592 592
 			$query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN (';
593
-                        $i = 0;
594
-                        $j =0;
593
+						$i = 0;
594
+						$j =0;
595 595
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
596 596
 			foreach($all as $row)
597 597
 			{
@@ -599,20 +599,20 @@  discard block
 block discarded – undo
599 599
 				$j++;
600 600
 				if ($j == 30) {
601 601
 					if ($globalDebug) echo ".";
602
-				    	try {
602
+						try {
603 603
 						
604 604
 						$sth = $this->db->prepare(substr($query_delete,0,-1).")");
605 605
 						$sth->execute();
606 606
 					} catch(PDOException $e) {
607 607
 						return "error";
608 608
 					}
609
-                                	$query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN (';
610
-                                	$j = 0;
609
+									$query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN (';
610
+									$j = 0;
611 611
 				}
612 612
 				$query_delete .= "'".$row['flightaware_id']."',";
613 613
 			}
614 614
 			if ($i > 0) {
615
-    				try {
615
+					try {
616 616
 					
617 617
 					$sth = $this->db->prepare(substr($query_delete,0,-1).")");
618 618
 					$sth->execute();
@@ -623,9 +623,9 @@  discard block
 block discarded – undo
623 623
 			return "success";
624 624
 		} elseif ($globalDBdriver == 'pgsql') {
625 625
 			//$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";
626
-    			//$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";
627
-    			$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)";
628
-    			try {
626
+				//$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";
627
+				$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)";
628
+				try {
629 629
 				
630 630
 				$sth = $this->db->prepare($query);
631 631
 				$sth->execute();
@@ -669,17 +669,17 @@  discard block
 block discarded – undo
669 669
 	}
670 670
 
671 671
 	/**
672
-	* Deletes all info in the table for an ident
673
-	*
674
-	* @return String success or false
675
-	*
676
-	*/
672
+	 * Deletes all info in the table for an ident
673
+	 *
674
+	 * @return String success or false
675
+	 *
676
+	 */
677 677
 	public function deleteLiveSpotterDataByIdent($ident)
678 678
 	{
679 679
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
680 680
 		$query  = 'DELETE FROM spotter_live WHERE ident = :ident';
681 681
         
682
-    		try {
682
+			try {
683 683
 			
684 684
 			$sth = $this->db->prepare($query);
685 685
 			$sth->execute(array(':ident' => $ident));
@@ -691,17 +691,17 @@  discard block
 block discarded – undo
691 691
 	}
692 692
 
693 693
 	/**
694
-	* Deletes all info in the table for an id
695
-	*
696
-	* @return String success or false
697
-	*
698
-	*/
694
+	 * Deletes all info in the table for an id
695
+	 *
696
+	 * @return String success or false
697
+	 *
698
+	 */
699 699
 	public function deleteLiveSpotterDataById($id)
700 700
 	{
701 701
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
702 702
 		$query  = 'DELETE FROM spotter_live WHERE flightaware_id = :id';
703 703
         
704
-    		try {
704
+			try {
705 705
 			
706 706
 			$sth = $this->db->prepare($query);
707 707
 			$sth->execute(array(':id' => $id));
@@ -714,11 +714,11 @@  discard block
 block discarded – undo
714 714
 
715 715
 
716 716
 	/**
717
-	* Gets the aircraft ident within the last hour
718
-	*
719
-	* @return String the ident
720
-	*
721
-	*/
717
+	 * Gets the aircraft ident within the last hour
718
+	 *
719
+	 * @return String the ident
720
+	 *
721
+	 */
722 722
 	public function getIdentFromLastHour($ident)
723 723
 	{
724 724
 		global $globalDBdriver, $globalTimezone;
@@ -744,14 +744,14 @@  discard block
 block discarded – undo
744 744
 			$ident_result = $row['ident'];
745 745
 		}
746 746
 		return $ident_result;
747
-        }
747
+		}
748 748
 
749 749
 	/**
750
-	* Check recent aircraft
751
-	*
752
-	* @return String the ident
753
-	*
754
-	*/
750
+	 * Check recent aircraft
751
+	 *
752
+	 * @return String the ident
753
+	 *
754
+	 */
755 755
 	public function checkIdentRecent($ident)
756 756
 	{
757 757
 		global $globalDBdriver, $globalTimezone;
@@ -777,14 +777,14 @@  discard block
 block discarded – undo
777 777
 			$ident_result = $row['flightaware_id'];
778 778
 		}
779 779
 		return $ident_result;
780
-        }
780
+		}
781 781
 
782 782
 	/**
783
-	* Check recent aircraft by id
784
-	*
785
-	* @return String the ident
786
-	*
787
-	*/
783
+	 * Check recent aircraft by id
784
+	 *
785
+	 * @return String the ident
786
+	 *
787
+	 */
788 788
 	public function checkIdRecent($id)
789 789
 	{
790 790
 		global $globalDBdriver, $globalTimezone;
@@ -810,14 +810,14 @@  discard block
 block discarded – undo
810 810
 			$ident_result = $row['flightaware_id'];
811 811
 		}
812 812
 		return $ident_result;
813
-        }
813
+		}
814 814
 
815 815
 	/**
816
-	* Check recent aircraft by ModeS
817
-	*
818
-	* @return String the ModeS
819
-	*
820
-	*/
816
+	 * Check recent aircraft by ModeS
817
+	 *
818
+	 * @return String the ModeS
819
+	 *
820
+	 */
821 821
 	public function checkModeSRecent($modes)
822 822
 	{
823 823
 		global $globalDBdriver, $globalTimezone;
@@ -844,19 +844,19 @@  discard block
 block discarded – undo
844 844
 			$ident_result = $row['flightaware_id'];
845 845
 		}
846 846
 		return $ident_result;
847
-        }
847
+		}
848 848
 
849 849
 	/**
850
-	* Adds a new spotter data
851
-	*
852
-	* @param String $flightaware_id the ID from flightaware
853
-	* @param String $ident the flight ident
854
-	* @param String $aircraft_icao the aircraft type
855
-	* @param String $departure_airport_icao the departure airport
856
-	* @param String $arrival_airport_icao the arrival airport
857
-	* @return String success or false
858
-	*
859
-	*/
850
+	 * Adds a new spotter data
851
+	 *
852
+	 * @param String $flightaware_id the ID from flightaware
853
+	 * @param String $ident the flight ident
854
+	 * @param String $aircraft_icao the aircraft type
855
+	 * @param String $departure_airport_icao the departure airport
856
+	 * @param String $arrival_airport_icao the arrival airport
857
+	 * @return String success or false
858
+	 *
859
+	 */
860 860
 	public function addLiveSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $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 = '')
861 861
 	{
862 862
 		global $globalURL, $globalArchive, $globalDebug;
@@ -991,10 +991,10 @@  discard block
 block discarded – undo
991 991
 		$arrival_airport_country = '';
992 992
 		
993 993
             	
994
-            	if ($squawk == '' || $Common->isInteger($squawk) === false ) $squawk = NULL;
995
-            	if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) $verticalrate = NULL;
996
-            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
997
-            	if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
994
+				if ($squawk == '' || $Common->isInteger($squawk) === false ) $squawk = NULL;
995
+				if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) $verticalrate = NULL;
996
+				if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
997
+				if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
998 998
             	
999 999
 		$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) 
1000 1000
 		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)';
@@ -1004,14 +1004,14 @@  discard block
 block discarded – undo
1004 1004
 			
1005 1005
 			$sth = $this->db->prepare($query);
1006 1006
 			$sth->execute($query_values);
1007
-                } catch(PDOException $e) {
1008
-                	return "error : ".$e->getMessage();
1009
-                }
1007
+				} catch(PDOException $e) {
1008
+					return "error : ".$e->getMessage();
1009
+				}
1010 1010
 		if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) {
1011
-		    if ($globalDebug) echo '(Add to SBS archive : ';
1012
-		    $SpotterArchive = new SpotterArchive($this->db);
1013
-		    $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);
1014
-		    if ($globalDebug) echo $result.')';
1011
+			if ($globalDebug) echo '(Add to SBS archive : ';
1012
+			$SpotterArchive = new SpotterArchive($this->db);
1013
+			$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);
1014
+			if ($globalDebug) echo $result.')';
1015 1015
 		}
1016 1016
 		return "success";
1017 1017
 
Please login to merge, or discard this patch.
Spacing   +115 added lines, -115 removed lines patch added patch discarded remove patch
@@ -16,55 +16,55 @@  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['airlines']) && empty($flt['airlines']) && isset($flt['pilots_id']) && empty($flt['pilots_id'])) || (!isset($flt['airlines']) && !isset($flt['pilots_id']))) {
60 60
 				if (isset($flt['source'])) {
61
-					$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";
61
+					$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";
62 62
 				}
63 63
 			}
64 64
 		}
65 65
 		if (isset($filter['airlines']) && !empty($filter['airlines'])) {
66 66
 			if ($filter['airlines'][0] != '') {
67
-				$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";
67
+				$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";
68 68
 			}
69 69
 		}
70 70
 		if (isset($filter['alliance']) && !empty($filter['alliance'])) {
@@ -74,10 +74,10 @@  discard block
 block discarded – undo
74 74
 			$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 ";
75 75
 		}
76 76
 		if (isset($filter['pilots_id']) && !empty($filter['pilots_id'])) {
77
-			$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";
77
+			$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";
78 78
 		}
79 79
 		if (isset($filter['source']) && !empty($filter['source'])) {
80
-			$filter_query_where .= " AND format_source IN ('".implode("','",$filter['source'])."')";
80
+			$filter_query_where .= " AND format_source IN ('".implode("','", $filter['source'])."')";
81 81
 		}
82 82
 		if (isset($filter['ident']) && !empty($filter['ident'])) {
83 83
 			$filter_query_where .= " AND ident = '".$filter['ident']."'";
@@ -106,15 +106,15 @@  discard block
 block discarded – undo
106 106
 					$filter_query_date .= " AND EXTRACT(DAY FROM spotter_output.date) = '".$filter['day']."'";
107 107
 				}
108 108
 			}
109
-			$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";
109
+			$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";
110 110
 		}
111 111
 		if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
112
-			$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
112
+			$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')";
113 113
 		}
114 114
 		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
115 115
 		elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND';
116 116
 		if ($filter_query_where != '') {
117
-			$filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where);
117
+			$filter_query_where = preg_replace('/^ AND/', ' WHERE', $filter_query_where);
118 118
 		}
119 119
 		$filter_query = $filter_query_join.$filter_query_where;
120 120
 		return $filter_query;
@@ -137,8 +137,8 @@  discard block
 block discarded – undo
137 137
 		if ($limit != '')
138 138
 		{
139 139
 			$limit_array = explode(',', $limit);
140
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
141
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
140
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
141
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
142 142
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
143 143
 			{
144 144
 				$limit_query = ' LIMIT '.$limit_array[1].' OFFSET '.$limit_array[0];
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
 		} else {
162 162
 			$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;
163 163
 		}
164
-		$spotter_array = $Spotter->getDataFromDB($query.$limit_query,array(),'',true);
164
+		$spotter_array = $Spotter->getDataFromDB($query.$limit_query, array(), '', true);
165 165
 
166 166
 		return $spotter_array;
167 167
 	}
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
 		global $globalDBdriver, $globalLiveInterval;
178 178
 		date_default_timezone_set('UTC');
179 179
 
180
-		$filter_query = $this->getFilter($filter,true,true);
180
+		$filter_query = $this->getFilter($filter, true, true);
181 181
 
182 182
 		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
183 183
 		if ($globalDBdriver == 'mysql') {
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
 			$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 
189 189
 			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";
190 190
 */
191
-			$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 
191
+			$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 
192 192
 			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";
193 193
 
194 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 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;
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
 			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'";
204 204
 */
205 205
 
206
-			$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 
206
+			$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 
207 207
 			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'";
208 208
 
209 209
 
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
 		try {
215 215
 			$sth = $this->db->prepare($query);
216 216
 			$sth->execute();
217
-		} catch(PDOException $e) {
217
+		} catch (PDOException $e) {
218 218
 			echo $e->getMessage();
219 219
 			die;
220 220
 		}
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
 		global $globalDBdriver, $globalLiveInterval;
235 235
 		date_default_timezone_set('UTC');
236 236
 
237
-		$filter_query = $this->getFilter($filter,true,true);
237
+		$filter_query = $this->getFilter($filter, true, true);
238 238
 
239 239
 		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
240 240
 		if ($globalDBdriver == 'mysql') {
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
 			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' 
244 244
 			ORDER BY spotter_live.flightaware_id, spotter_live.date";
245 245
 */
246
-			$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 
246
+			$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 
247 247
 			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' 
248 248
 			ORDER BY spotter_live.flightaware_id, spotter_live.date";
249 249
                 } else {
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
 			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' 
253 253
 			ORDER BY spotter_live.flightaware_id, spotter_live.date";
254 254
 */
255
-			$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 
255
+			$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 
256 256
 			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' 
257 257
 			ORDER BY spotter_live.flightaware_id, spotter_live.date";
258 258
 //			echo $query;
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
     		try {
262 262
 			$sth = $this->db->prepare($query);
263 263
 			$sth->execute();
264
-		} catch(PDOException $e) {
264
+		} catch (PDOException $e) {
265 265
 			echo $e->getMessage();
266 266
 			die;
267 267
 		}
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
 	public function getLiveSpotterCount($filter = array())
279 279
 	{
280 280
 		global $globalDBdriver, $globalLiveInterval;
281
-		$filter_query = $this->getFilter($filter,true,true);
281
+		$filter_query = $this->getFilter($filter, true, true);
282 282
 
283 283
 		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
284 284
 		if ($globalDBdriver == 'mysql') {
@@ -291,7 +291,7 @@  discard block
 block discarded – undo
291 291
 		try {
292 292
 			$sth = $this->db->prepare($query);
293 293
 			$sth->execute();
294
-		} catch(PDOException $e) {
294
+		} catch (PDOException $e) {
295 295
 			echo $e->getMessage();
296 296
 			die;
297 297
 		}
@@ -314,10 +314,10 @@  discard block
 block discarded – undo
314 314
 		$filter_query = $this->getFilter($filter);
315 315
 
316 316
 		if (is_array($coord)) {
317
-			$minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
318
-			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
319
-			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
320
-			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
317
+			$minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
318
+			$minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
319
+			$maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
320
+			$maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
321 321
 		} else return array();
322 322
 		if ($globalDBdriver == 'mysql') {
323 323
 			//$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.")";
@@ -370,7 +370,7 @@  discard block
 block discarded – undo
370 370
                 if ($interval == '1m')
371 371
                 {
372 372
                     $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';
373
-                } else if ($interval == '15m'){
373
+                } else if ($interval == '15m') {
374 374
                     $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= spotter_live.date ';
375 375
                 } 
376 376
             }
@@ -378,14 +378,14 @@  discard block
 block discarded – undo
378 378
          $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';   
379 379
         }
380 380
 
381
-                $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 
381
+                $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 
382 382
                    WHERE spotter_live.latitude <> '' 
383 383
                                    AND spotter_live.longitude <> '' 
384 384
                    ".$additional_query."
385 385
                    HAVING distance < :radius  
386 386
                                    ORDER BY distance";
387 387
 
388
-                $spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius));
388
+                $spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng, ':radius' => $radius));
389 389
 
390 390
                 return $spotter_array;
391 391
         }
@@ -403,9 +403,9 @@  discard block
 block discarded – undo
403 403
 		date_default_timezone_set('UTC');
404 404
 
405 405
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
406
-                $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';
406
+                $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';
407 407
 
408
-		$spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident),'',true);
408
+		$spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident), '', true);
409 409
 
410 410
 		return $spotter_array;
411 411
 	}
@@ -416,16 +416,16 @@  discard block
 block discarded – undo
416 416
 	* @return Array the spotter information
417 417
 	*
418 418
 	*/
419
-	public function getDateLiveSpotterDataByIdent($ident,$date)
419
+	public function getDateLiveSpotterDataByIdent($ident, $date)
420 420
 	{
421 421
 		$Spotter = new Spotter($this->db);
422 422
 		date_default_timezone_set('UTC');
423 423
 
424 424
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
425
-                $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';
425
+                $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';
426 426
 
427
-                $date = date('c',$date);
428
-		$spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident,':date' => $date));
427
+                $date = date('c', $date);
428
+		$spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident, ':date' => $date));
429 429
 
430 430
 		return $spotter_array;
431 431
 	}
@@ -442,9 +442,9 @@  discard block
 block discarded – undo
442 442
 		date_default_timezone_set('UTC');
443 443
 
444 444
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
445
-                $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';
445
+                $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';
446 446
 
447
-		$spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id),'',true);
447
+		$spotter_array = $Spotter->getDataFromDB($query, array(':id' => $id), '', true);
448 448
 
449 449
 		return $spotter_array;
450 450
 	}
@@ -455,15 +455,15 @@  discard block
 block discarded – undo
455 455
 	* @return Array the spotter information
456 456
 	*
457 457
 	*/
458
-	public function getDateLiveSpotterDataById($id,$date)
458
+	public function getDateLiveSpotterDataById($id, $date)
459 459
 	{
460 460
 		$Spotter = new Spotter($this->db);
461 461
 		date_default_timezone_set('UTC');
462 462
 
463 463
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
464
-                $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';
465
-                $date = date('c',$date);
466
-		$spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id,':date' => $date),'',true);
464
+                $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';
465
+                $date = date('c', $date);
466
+		$spotter_array = $Spotter->getDataFromDB($query, array(':id' => $id, ':date' => $date), '', true);
467 467
 
468 468
 		return $spotter_array;
469 469
 	}
@@ -480,13 +480,13 @@  discard block
 block discarded – undo
480 480
 		date_default_timezone_set('UTC');
481 481
 
482 482
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
483
-                $query  = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident';
483
+                $query = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident';
484 484
 
485 485
     		try {
486 486
 			
487 487
 			$sth = $this->db->prepare($query);
488 488
 			$sth->execute(array(':ident' => $ident));
489
-		} catch(PDOException $e) {
489
+		} catch (PDOException $e) {
490 490
 			echo $e->getMessage();
491 491
 			die;
492 492
 		}
@@ -501,7 +501,7 @@  discard block
 block discarded – undo
501 501
 	* @return Array the spotter information
502 502
 	*
503 503
 	*/
504
-	public function getAllLiveSpotterDataById($id,$liveinterval = false)
504
+	public function getAllLiveSpotterDataById($id, $liveinterval = false)
505 505
 	{
506 506
 		global $globalDBdriver, $globalLiveInterval;
507 507
 		date_default_timezone_set('UTC');
@@ -520,7 +520,7 @@  discard block
 block discarded – undo
520 520
 		try {
521 521
 			$sth = $this->db->prepare($query);
522 522
 			$sth->execute(array(':id' => $id));
523
-		} catch(PDOException $e) {
523
+		} catch (PDOException $e) {
524 524
 			echo $e->getMessage();
525 525
 			die;
526 526
 		}
@@ -538,12 +538,12 @@  discard block
 block discarded – undo
538 538
 	{
539 539
 		date_default_timezone_set('UTC');
540 540
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
541
-		$query  = self::$global_query.' WHERE spotter_live.ident = :ident';
541
+		$query = self::$global_query.' WHERE spotter_live.ident = :ident';
542 542
     		try {
543 543
 			
544 544
 			$sth = $this->db->prepare($query);
545 545
 			$sth->execute(array(':ident' => $ident));
546
-		} catch(PDOException $e) {
546
+		} catch (PDOException $e) {
547 547
 			echo $e->getMessage();
548 548
 			die;
549 549
 		}
@@ -573,7 +573,7 @@  discard block
 block discarded – undo
573 573
 			
574 574
 			$sth = $this->db->prepare($query);
575 575
 			$sth->execute();
576
-		} catch(PDOException $e) {
576
+		} catch (PDOException $e) {
577 577
 			return "error";
578 578
 		}
579 579
 
@@ -596,14 +596,14 @@  discard block
 block discarded – undo
596 596
 				
597 597
 				$sth = $this->db->prepare($query);
598 598
 				$sth->execute();
599
-			} catch(PDOException $e) {
599
+			} catch (PDOException $e) {
600 600
 				return "error";
601 601
 			}
602 602
 			$query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN (';
603 603
                         $i = 0;
604
-                        $j =0;
604
+                        $j = 0;
605 605
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
606
-			foreach($all as $row)
606
+			foreach ($all as $row)
607 607
 			{
608 608
 				$i++;
609 609
 				$j++;
@@ -611,9 +611,9 @@  discard block
 block discarded – undo
611 611
 					if ($globalDebug) echo ".";
612 612
 				    	try {
613 613
 						
614
-						$sth = $this->db->prepare(substr($query_delete,0,-1).")");
614
+						$sth = $this->db->prepare(substr($query_delete, 0, -1).")");
615 615
 						$sth->execute();
616
-					} catch(PDOException $e) {
616
+					} catch (PDOException $e) {
617 617
 						return "error";
618 618
 					}
619 619
                                 	$query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN (';
@@ -624,9 +624,9 @@  discard block
 block discarded – undo
624 624
 			if ($i > 0) {
625 625
     				try {
626 626
 					
627
-					$sth = $this->db->prepare(substr($query_delete,0,-1).")");
627
+					$sth = $this->db->prepare(substr($query_delete, 0, -1).")");
628 628
 					$sth->execute();
629
-				} catch(PDOException $e) {
629
+				} catch (PDOException $e) {
630 630
 					return "error";
631 631
 				}
632 632
 			}
@@ -639,7 +639,7 @@  discard block
 block discarded – undo
639 639
 				
640 640
 				$sth = $this->db->prepare($query);
641 641
 				$sth->execute();
642
-			} catch(PDOException $e) {
642
+			} catch (PDOException $e) {
643 643
 				return "error";
644 644
 			}
645 645
 /*			$query_delete = "DELETE FROM spotter_live WHERE flightaware_id IN (";
@@ -687,13 +687,13 @@  discard block
 block discarded – undo
687 687
 	public function deleteLiveSpotterDataByIdent($ident)
688 688
 	{
689 689
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
690
-		$query  = 'DELETE FROM spotter_live WHERE ident = :ident';
690
+		$query = 'DELETE FROM spotter_live WHERE ident = :ident';
691 691
         
692 692
     		try {
693 693
 			
694 694
 			$sth = $this->db->prepare($query);
695 695
 			$sth->execute(array(':ident' => $ident));
696
-		} catch(PDOException $e) {
696
+		} catch (PDOException $e) {
697 697
 			return "error";
698 698
 		}
699 699
 
@@ -709,13 +709,13 @@  discard block
 block discarded – undo
709 709
 	public function deleteLiveSpotterDataById($id)
710 710
 	{
711 711
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
712
-		$query  = 'DELETE FROM spotter_live WHERE flightaware_id = :id';
712
+		$query = 'DELETE FROM spotter_live WHERE flightaware_id = :id';
713 713
         
714 714
     		try {
715 715
 			
716 716
 			$sth = $this->db->prepare($query);
717 717
 			$sth->execute(array(':id' => $id));
718
-		} catch(PDOException $e) {
718
+		} catch (PDOException $e) {
719 719
 			return "error";
720 720
 		}
721 721
 
@@ -733,13 +733,13 @@  discard block
 block discarded – undo
733 733
 	{
734 734
 		global $globalDBdriver, $globalTimezone;
735 735
 		if ($globalDBdriver == 'mysql') {
736
-			$query  = 'SELECT spotter_live.ident FROM spotter_live 
736
+			$query = 'SELECT spotter_live.ident FROM spotter_live 
737 737
 				WHERE spotter_live.ident = :ident 
738 738
 				AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) 
739 739
 				AND spotter_live.date < UTC_TIMESTAMP()';
740 740
 			$query_data = array(':ident' => $ident);
741 741
 		} else {
742
-			$query  = "SELECT spotter_live.ident FROM spotter_live 
742
+			$query = "SELECT spotter_live.ident FROM spotter_live 
743 743
 				WHERE spotter_live.ident = :ident 
744 744
 				AND spotter_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS'
745 745
 				AND spotter_live.date < now() AT TIME ZONE 'UTC'";
@@ -748,8 +748,8 @@  discard block
 block discarded – undo
748 748
 		
749 749
 		$sth = $this->db->prepare($query);
750 750
 		$sth->execute($query_data);
751
-		$ident_result='';
752
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
751
+		$ident_result = '';
752
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
753 753
 		{
754 754
 			$ident_result = $row['ident'];
755 755
 		}
@@ -766,13 +766,13 @@  discard block
 block discarded – undo
766 766
 	{
767 767
 		global $globalDBdriver, $globalTimezone;
768 768
 		if ($globalDBdriver == 'mysql') {
769
-			$query  = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
769
+			$query = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
770 770
 				WHERE spotter_live.ident = :ident 
771 771
 				AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE)'; 
772 772
 //				AND spotter_live.date < UTC_TIMESTAMP()";
773 773
 			$query_data = array(':ident' => $ident);
774 774
 		} else {
775
-			$query  = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
775
+			$query = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
776 776
 				WHERE spotter_live.ident = :ident 
777 777
 				AND spotter_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '30 MINUTES'";
778 778
 //				AND spotter_live.date < now() AT TIME ZONE 'UTC'";
@@ -781,8 +781,8 @@  discard block
 block discarded – undo
781 781
 		
782 782
 		$sth = $this->db->prepare($query);
783 783
 		$sth->execute($query_data);
784
-		$ident_result='';
785
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
784
+		$ident_result = '';
785
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
786 786
 		{
787 787
 			$ident_result = $row['flightaware_id'];
788 788
 		}
@@ -799,13 +799,13 @@  discard block
 block discarded – undo
799 799
 	{
800 800
 		global $globalDBdriver, $globalTimezone;
801 801
 		if ($globalDBdriver == 'mysql') {
802
-			$query  = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
802
+			$query = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
803 803
 				WHERE spotter_live.flightaware_id = :id 
804 804
 				AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 10 HOUR)'; 
805 805
 //				AND spotter_live.date < UTC_TIMESTAMP()";
806 806
 			$query_data = array(':id' => $id);
807 807
 		} else {
808
-			$query  = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
808
+			$query = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
809 809
 				WHERE spotter_live.flightaware_id = :id 
810 810
 				AND spotter_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '10 HOUR'";
811 811
 //				AND spotter_live.date < now() AT TIME ZONE 'UTC'";
@@ -814,8 +814,8 @@  discard block
 block discarded – undo
814 814
 		
815 815
 		$sth = $this->db->prepare($query);
816 816
 		$sth->execute($query_data);
817
-		$ident_result='';
818
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
817
+		$ident_result = '';
818
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
819 819
 		{
820 820
 			$ident_result = $row['flightaware_id'];
821 821
 		}
@@ -832,13 +832,13 @@  discard block
 block discarded – undo
832 832
 	{
833 833
 		global $globalDBdriver, $globalTimezone;
834 834
 		if ($globalDBdriver == 'mysql') {
835
-			$query  = 'SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live 
835
+			$query = 'SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live 
836 836
 				WHERE spotter_live.ModeS = :modes 
837 837
 				AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE)'; 
838 838
 //				AND spotter_live.date < UTC_TIMESTAMP()";
839 839
 			$query_data = array(':modes' => $modes);
840 840
 		} else {
841
-			$query  = "SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live 
841
+			$query = "SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live 
842 842
 				WHERE spotter_live.ModeS = :modes 
843 843
 				AND spotter_live.date >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '30 MINUTE'";
844 844
 //			//	AND spotter_live.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC'";
@@ -847,8 +847,8 @@  discard block
 block discarded – undo
847 847
 		
848 848
 		$sth = $this->db->prepare($query);
849 849
 		$sth->execute($query_data);
850
-		$ident_result='';
851
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
850
+		$ident_result = '';
851
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
852 852
 		{
853 853
 			//$ident_result = $row['spotter_live_id'];
854 854
 			$ident_result = $row['flightaware_id'];
@@ -867,7 +867,7 @@  discard block
 block discarded – undo
867 867
 	* @return String success or false
868 868
 	*
869 869
 	*/
870
-	public function addLiveSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $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 = '')
870
+	public function addLiveSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $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 = '')
871 871
 	{
872 872
 		global $globalURL, $globalArchive, $globalDebug;
873 873
 		$Common = new Common();
@@ -960,26 +960,26 @@  discard block
 block discarded – undo
960 960
 		if ($date == '') $date = date("Y-m-d H:i:s", time());
961 961
 
962 962
         
963
-		$flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING);
964
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
965
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
966
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
967
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
968
-		$latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
969
-		$longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
970
-		$waypoints = filter_var($waypoints,FILTER_SANITIZE_STRING);
971
-		$altitude = filter_var($altitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
972
-		$heading = filter_var($heading,FILTER_SANITIZE_NUMBER_INT);
973
-		$groundspeed = filter_var($groundspeed,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
974
-		$squawk = filter_var($squawk,FILTER_SANITIZE_NUMBER_INT);
975
-		$route_stop = filter_var($route_stop,FILTER_SANITIZE_STRING);
976
-		$ModeS = filter_var($ModeS,FILTER_SANITIZE_STRING);
977
-		$pilot_id = filter_var($pilot_id,FILTER_SANITIZE_STRING);
978
-		$pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING);
979
-		$format_source = filter_var($format_source,FILTER_SANITIZE_STRING);
980
-		$source_name = filter_var($source_name,FILTER_SANITIZE_STRING);
981
-		$over_country = filter_var($over_country,FILTER_SANITIZE_STRING);
982
-		$verticalrate = filter_var($verticalrate,FILTER_SANITIZE_NUMBER_INT);
963
+		$flightaware_id = filter_var($flightaware_id, FILTER_SANITIZE_STRING);
964
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
965
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
966
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
967
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
968
+		$latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
969
+		$longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
970
+		$waypoints = filter_var($waypoints, FILTER_SANITIZE_STRING);
971
+		$altitude = filter_var($altitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
972
+		$heading = filter_var($heading, FILTER_SANITIZE_NUMBER_INT);
973
+		$groundspeed = filter_var($groundspeed, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
974
+		$squawk = filter_var($squawk, FILTER_SANITIZE_NUMBER_INT);
975
+		$route_stop = filter_var($route_stop, FILTER_SANITIZE_STRING);
976
+		$ModeS = filter_var($ModeS, FILTER_SANITIZE_STRING);
977
+		$pilot_id = filter_var($pilot_id, FILTER_SANITIZE_STRING);
978
+		$pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING);
979
+		$format_source = filter_var($format_source, FILTER_SANITIZE_STRING);
980
+		$source_name = filter_var($source_name, FILTER_SANITIZE_STRING);
981
+		$over_country = filter_var($over_country, FILTER_SANITIZE_STRING);
982
+		$verticalrate = filter_var($verticalrate, FILTER_SANITIZE_NUMBER_INT);
983 983
 
984 984
 		$airline_name = '';
985 985
 		$airline_icao = '';
@@ -1001,26 +1001,26 @@  discard block
 block discarded – undo
1001 1001
 		$arrival_airport_country = '';
1002 1002
 		
1003 1003
             	
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;
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;
1008 1008
             	
1009
-		$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) 
1009
+		$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 1010
 		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)';
1011 1011
 
1012
-		$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);
1012
+		$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);
1013 1013
 		try {
1014 1014
 			
1015 1015
 			$sth = $this->db->prepare($query);
1016 1016
 			$sth->execute($query_values);
1017
-                } catch(PDOException $e) {
1017
+                } catch (PDOException $e) {
1018 1018
                 	return "error : ".$e->getMessage();
1019 1019
                 }
1020 1020
 		if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) {
1021 1021
 		    if ($globalDebug) echo '(Add to SBS archive : ';
1022 1022
 		    $SpotterArchive = new SpotterArchive($this->db);
1023
-		    $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);
1023
+		    $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 1024
 		    if ($globalDebug) echo $result.')';
1025 1025
 		}
1026 1026
 		return "success";
@@ -1029,7 +1029,7 @@  discard block
 block discarded – undo
1029 1029
 
1030 1030
 	public function getOrderBy()
1031 1031
 	{
1032
-		$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"));
1032
+		$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"));
1033 1033
 		return $orderby;
1034 1034
 	}
1035 1035
 
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.