Completed
Push — master ( 2dcb43...e8e430 )
by Yannick
30:24
created
statistics-sub-menu.php 2 patches
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -28,11 +28,11 @@  discard block
 block discarded – undo
28 28
 					$Spotter = new Spotter();
29 29
 					$alliances = $Spotter->getAllAllianceNames();
30 30
 					if (!empty($alliances)) {
31
-						foreach($alliances as $alliance) {
32
-							if (isset($airline_icao) && str_replace('_',' ',str_replace('alliance_','',$airline_icao)) == $alliance['alliance']) {
33
-								print '<option value="alliance_'.str_replace(' ','_',$alliance['alliance']).'" selected>'.$alliance['alliance'].'</option>';
31
+						foreach ($alliances as $alliance) {
32
+							if (isset($airline_icao) && str_replace('_', ' ', str_replace('alliance_', '', $airline_icao)) == $alliance['alliance']) {
33
+								print '<option value="alliance_'.str_replace(' ', '_', $alliance['alliance']).'" selected>'.$alliance['alliance'].'</option>';
34 34
 							} else {
35
-								print '<option value="alliance_'.str_replace(' ','_',$alliance['alliance']).'">'.$alliance['alliance'].'</option>';
35
+								print '<option value="alliance_'.str_replace(' ', '_', $alliance['alliance']).'">'.$alliance['alliance'].'</option>';
36 36
 							}
37 37
 						}
38 38
 						print '<option disabled>──────────</option>';
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 					$Stats = new Stats();
41 41
 					if (!isset($filter_name)) $filter_name = '';
42 42
 					$airlines = $Stats->getAllAirlineNames($filter_name);
43
-					foreach($airlines as $airline) {
43
+					foreach ($airlines as $airline) {
44 44
 						if ($airline['airline_icao'] != '') {
45 45
 							if (isset($airline_icao) && $airline_icao != 'all' && $airline_icao == $airline['airline_icao']) {
46 46
 								print '<option value="'.$airline['airline_icao'].'" selected>'.$airline['airline_name'].'</option>';
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 	if (!isset($type) || $type == 'aircraft') {
66 66
 ?>
67 67
 		<li class="dropdown">
68
-		    <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="#" >
68
+		    <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="#" >
69 69
 		      <?php echo _("Aircraft"); ?> <span class="caret"></span>
70 70
 		    </a>
71 71
 		    <ul class="dropdown-menu">
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 		    </ul>
77 77
 		</li>
78 78
 		<li class="dropdown">
79
-		    <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="#">
79
+		    <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="#">
80 80
 		      <?php echo _("Airline"); ?> <span class="caret"></span>
81 81
 		    </a>
82 82
 		    <ul class="dropdown-menu" role="menu">
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 		    </ul>
93 93
 		</li>
94 94
 		<li class="dropdown">
95
-		    <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="#">
95
+		    <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="#">
96 96
 		      <?php echo _("Airport"); ?> <span class="caret"></span>
97 97
 		    </a>
98 98
 		    <ul class="dropdown-menu" role="menu">
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
 		    </ul>
104 104
 		</li>
105 105
 		<li class="dropdown">
106
-		    <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-route-airport" || strtolower($current_page) == "statistics-route-waypoint"){ print 'active'; } ?>" data-toggle="dropdown" href="#">
106
+		    <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-route-airport" || strtolower($current_page) == "statistics-route-waypoint") { print 'active'; } ?>" data-toggle="dropdown" href="#">
107 107
 		      <?php echo _("Route"); ?> <span class="caret"></span>
108 108
 		    </a>
109 109
 		    <ul class="dropdown-menu" role="menu">
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 		    </ul>
113 113
 		</li>
114 114
 		<li class="dropdown">
115
-		    <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-date" || strtolower($current_page) == "statistics-time"){ print 'active'; } ?>" data-toggle="dropdown" href="#">
115
+		    <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-date" || strtolower($current_page) == "statistics-time") { print 'active'; } ?>" data-toggle="dropdown" href="#">
116 116
 		      <?php echo _("Date &amp; Time"); ?> <span class="caret"></span>
117 117
 		    </a>
118 118
 		    <ul class="dropdown-menu" role="menu">
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 		    if (isset($globalAccidents) && $globalAccidents && (!isset($airline_icao) || $airline_icao == '' || $airline_icao == 'all')) {
125 125
 		?>
126 126
 		<li class="dropdown">
127
-		    <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-fatalities-year" || strtolower($current_page) == "statistics-fatalities-month"){ print 'active'; } ?>" data-toggle="dropdown" href="#">
127
+		    <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-fatalities-year" || strtolower($current_page) == "statistics-fatalities-month") { print 'active'; } ?>" data-toggle="dropdown" href="#">
128 128
 		      <?php echo _("Fatalities"); ?> <span class="caret"></span>
129 129
 		    </a>
130 130
 		    <ul class="dropdown-menu" role="menu">
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
 	} elseif ($type == 'marine' || $type == 'tracker') {
140 140
 ?>
141 141
 		<li class="dropdown">
142
-		    <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-date" || strtolower($current_page) == "statistics-time"){ print 'active'; } ?>" data-toggle="dropdown" href="#">
142
+		    <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-date" || strtolower($current_page) == "statistics-time") { print 'active'; } ?>" data-toggle="dropdown" href="#">
143 143
 			<?php echo _("Date &amp; Time"); ?> <span class="caret"></span>
144 144
 		    </a>
145 145
 		    <ul class="dropdown-menu" role="menu">
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
 	if (!isset($type) || $type == 'aircraft') {
170 170
 ?>
171 171
 		<li class="dropdown">
172
-		    <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="#" >
172
+		    <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="#" >
173 173
 		      <?php echo _("Aircraft"); ?> <span class="caret"></span>
174 174
 		    </a>
175 175
 		    <ul class="dropdown-menu">
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
 		    </ul>
181 181
 		</li>
182 182
 		<li class="dropdown">
183
-		    <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="#">
183
+		    <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="#">
184 184
 		      <?php echo _("Airline"); ?> <span class="caret"></span>
185 185
 		    </a>
186 186
 		    <ul class="dropdown-menu" role="menu">
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
 		    </ul>
197 197
 		</li>
198 198
 		<li class="dropdown">
199
-		    <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="#">
199
+		    <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="#">
200 200
 		      <?php echo _("Airport"); ?> <span class="caret"></span>
201 201
 		    </a>
202 202
 		    <ul class="dropdown-menu" role="menu">
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
 		</li>
209 209
 		<!--
210 210
 		<li class="dropdown">
211
-		    <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-route-airport" || strtolower($current_page) == "statistics-route-waypoint"){ print 'active'; } ?>" data-toggle="dropdown" href="#">
211
+		    <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-route-airport" || strtolower($current_page) == "statistics-route-waypoint") { print 'active'; } ?>" data-toggle="dropdown" href="#">
212 212
 		      <?php echo _("Route"); ?> <span class="caret"></span>
213 213
 		    </a>
214 214
 		    <ul class="dropdown-menu" role="menu">
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
 		-->
220 220
 		<!--
221 221
 		<li class="dropdown">
222
-		    <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-date" || strtolower($current_page) == "statistics-time"){ print 'active'; } ?>" data-toggle="dropdown" href="#">
222
+		    <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-date" || strtolower($current_page) == "statistics-time") { print 'active'; } ?>" data-toggle="dropdown" href="#">
223 223
 		      <?php echo _("Date &amp; Time"); ?> <span class="caret"></span>
224 224
 		    </a>
225 225
 		    <ul class="dropdown-menu" role="menu">
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
 		?>
234 234
 		<!--
235 235
 		<li class="dropdown">
236
-		    <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-fatalities-year" || strtolower($current_page) == "statistics-fatalities-month"){ print 'active'; } ?>" data-toggle="dropdown" href="#">
236
+		    <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-fatalities-year" || strtolower($current_page) == "statistics-fatalities-month") { print 'active'; } ?>" data-toggle="dropdown" href="#">
237 237
 		      <?php echo _("Fatalities"); ?> <span class="caret"></span>
238 238
 		    </a>
239 239
 		    <ul class="dropdown-menu" role="menu">
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
 	} elseif ($type == 'marine' || $type == 'tracker') {
250 250
 ?>
251 251
 		<li class="dropdown">
252
-		    <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-date" || strtolower($current_page) == "statistics-time"){ print 'active'; } ?>" data-toggle="dropdown" href="#">
252
+		    <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-date" || strtolower($current_page) == "statistics-time") { print 'active'; } ?>" data-toggle="dropdown" href="#">
253 253
 		      <?php echo _("Date &amp; Time"); ?> <span class="caret"></span>
254 254
 		    </a>
255 255
 		    <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
@@ -6,7 +6,13 @@  discard block
 block discarded – undo
6 6
 	if (!isset($type) || $type != 'satellite') {
7 7
 ?>
8 8
 		<form id="changedate" method="post">
9
-			<input type="month" name="date" onchange="statsdatechange(this);" value="<?php if (isset($year) && $year != '') echo $year.'-'; ?><?php if (isset($month) && $month != '') echo $month; ?>" />
9
+			<input type="month" name="date" onchange="statsdatechange(this);" value="<?php if (isset($year) && $year != '') {
10
+	echo $year.'-';
11
+}
12
+?><?php if (isset($month) && $month != '') {
13
+	echo $month;
14
+}
15
+?>" />
10 16
 		</form>
11 17
 <?php
12 18
 	}
@@ -38,7 +44,9 @@  discard block
 block discarded – undo
38 44
 						print '<option disabled>──────────</option>';
39 45
 					}
40 46
 					$Stats = new Stats();
41
-					if (!isset($filter_name)) $filter_name = '';
47
+					if (!isset($filter_name)) {
48
+						$filter_name = '';
49
+					}
42 50
 					$airlines = $Stats->getAllAirlineNames($filter_name);
43 51
 					foreach($airlines as $airline) {
44 52
 						if ($airline['airline_icao'] != '') {
@@ -69,10 +77,22 @@  discard block
 block discarded – undo
69 77
 		      <?php echo _("Aircraft"); ?> <span class="caret"></span>
70 78
 		    </a>
71 79
 		    <ul class="dropdown-menu">
72
-			<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>
73
-			<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>
74
-			<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>
75
-			<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>
80
+			<li><a href="<?php print $globalURL; ?>/statistics/aircraft<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
81
+	echo '/'.$airline_icao;
82
+}
83
+?>"><?php echo _("Aircraft"); ?></a></li>
84
+			<li><a href="<?php print $globalURL; ?>/statistics/registration<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
85
+	echo '/'.$airline_icao;
86
+}
87
+?>"><?php echo _("Registration"); ?></a></li>
88
+			<li><a href="<?php print $globalURL; ?>/statistics/manufacturer<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
89
+	echo '/'.$airline_icao;
90
+}
91
+?>"><?php echo _("Manufacturer"); ?></a></li>
92
+			<li><a href="<?php print $globalURL; ?>/statistics/country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
93
+	echo '/'.$airline_icao;
94
+}
95
+?>"><?php echo _("Country"); ?></a></li>
76 96
 		    </ul>
77 97
 		</li>
78 98
 		<li class="dropdown">
@@ -83,12 +103,21 @@  discard block
 block discarded – undo
83 103
 <?php
84 104
 		if (!isset($airline_icao) || $airline_icao == 'all') {
85 105
 ?>
86
-		      <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>
87
-		      <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>
106
+		      <li><a href="<?php print $globalURL; ?>/statistics/airline<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
107
+	echo '/'.$airline_icao;
108
+}
109
+?>"><?php echo _("Airline"); ?></a></li>
110
+		      <li><a href="<?php print $globalURL; ?>/statistics/airline-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
111
+	echo '/'.$airline_icao;
112
+}
113
+?>"><?php echo _("Airline by Country"); ?></a></li>
88 114
 <?php
89 115
 		}
90 116
 ?>
91
-		      <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>
117
+		      <li><a href="<?php print $globalURL; ?>/statistics/callsign<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
118
+	echo '/'.$airline_icao;
119
+}
120
+?>"><?php echo _("Callsign"); ?></a></li>
92 121
 		    </ul>
93 122
 		</li>
94 123
 		<li class="dropdown">
@@ -96,10 +125,22 @@  discard block
 block discarded – undo
96 125
 		      <?php echo _("Airport"); ?> <span class="caret"></span>
97 126
 		    </a>
98 127
 		    <ul class="dropdown-menu" role="menu">
99
-		      <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>
100
-		      <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>
101
-		      <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>
102
-		      <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>
128
+		      <li><a href="<?php print $globalURL; ?>/statistics/airport-departure<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
129
+	echo '/'.$airline_icao;
130
+}
131
+?>"><?php echo _("Departure Airport"); ?></a></li>
132
+		      <li><a href="<?php print $globalURL; ?>/statistics/airport-departure-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
133
+	echo '/'.$airline_icao;
134
+}
135
+?>"><?php echo _("Departure Airport by Country"); ?></a></li>
136
+		      <li><a href="<?php print $globalURL; ?>/statistics/airport-arrival<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
137
+	echo '/'.$airline_icao;
138
+}
139
+?>"><?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') {
141
+	echo '/'.$airline_icao;
142
+}
143
+?>"><?php echo _("Arrival Airport by Country"); ?></a></li>
103 144
 		    </ul>
104 145
 		</li>
105 146
 		<li class="dropdown">
@@ -107,8 +148,14 @@  discard block
 block discarded – undo
107 148
 		      <?php echo _("Route"); ?> <span class="caret"></span>
108 149
 		    </a>
109 150
 		    <ul class="dropdown-menu" role="menu">
110
-		      <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>
111
-		      <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>
151
+		      <li><a href="<?php print $globalURL; ?>/statistics/route-airport<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
152
+	echo '/'.$airline_icao;
153
+}
154
+?>"><?php echo _("Route by Airport"); ?></a></li>
155
+		      <li><a href="<?php print $globalURL; ?>/statistics/route-waypoint<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
156
+	echo '/'.$airline_icao;
157
+}
158
+?>"><?php echo _("Route by Waypoint"); ?></a></li>
112 159
 		    </ul>
113 160
 		</li>
114 161
 		<li class="dropdown">
@@ -116,8 +163,14 @@  discard block
 block discarded – undo
116 163
 		      <?php echo _("Date &amp; Time"); ?> <span class="caret"></span>
117 164
 		    </a>
118 165
 		    <ul class="dropdown-menu" role="menu">
119
-		      <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>
120
-			  <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>
166
+		      <li><a href="<?php print $globalURL; ?>/statistics/date<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
167
+	echo '/'.$airline_icao;
168
+}
169
+?>"><?php echo _("Date"); ?></a></li>
170
+			  <li><a href="<?php print $globalURL; ?>/statistics/time<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
171
+	echo '/'.$airline_icao;
172
+}
173
+?>"><?php echo _("Time"); ?></a></li>
121 174
 		    </ul>
122 175
 		</li>
123 176
 		<?php
@@ -173,9 +226,18 @@  discard block
 block discarded – undo
173 226
 		      <?php echo _("Aircraft"); ?> <span class="caret"></span>
174 227
 		    </a>
175 228
 		    <ul class="dropdown-menu">
176
-			<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>
177
-			<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>
178
-			<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>
229
+			<li><a href="<?php print $globalURL; ?>/statistics/aircraft<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
230
+	echo '/'.$airline_icao;
231
+}
232
+?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Aircraft"); ?></a></li>
233
+			<li><a href="<?php print $globalURL; ?>/statistics/registration<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
234
+	echo '/'.$airline_icao;
235
+}
236
+?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Registration"); ?></a></li>
237
+			<li><a href="<?php print $globalURL; ?>/statistics/manufacturer<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
238
+	echo '/'.$airline_icao;
239
+}
240
+?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Manufacturer"); ?></a></li>
179 241
 			<!-- <li><a href="<?php print $globalURL; ?>/statistics/country"><?php echo _("Country"); ?></a></li> -->
180 242
 		    </ul>
181 243
 		</li>
@@ -187,12 +249,21 @@  discard block
 block discarded – undo
187 249
 <?php
188 250
 		if (!isset($airline_icao) || $airline_icao == 'all') {
189 251
 ?>
190
-		      <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>
191
-		      <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>
252
+		      <li><a href="<?php print $globalURL; ?>/statistics/airline<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
253
+	echo '/'.$airline_icao;
254
+}
255
+?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Airline"); ?></a></li>
256
+		      <li><a href="<?php print $globalURL; ?>/statistics/airline-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
257
+	echo '/'.$airline_icao;
258
+}
259
+?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Airline by Country"); ?></a></li>
192 260
 <?php
193 261
 		}
194 262
 ?>
195
-		      <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>
263
+		      <li><a href="<?php print $globalURL; ?>/statistics/callsign<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
264
+	echo '/'.$airline_icao;
265
+}
266
+?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Callsign"); ?></a></li>
196 267
 		    </ul>
197 268
 		</li>
198 269
 		<li class="dropdown">
@@ -200,10 +271,22 @@  discard block
 block discarded – undo
200 271
 		      <?php echo _("Airport"); ?> <span class="caret"></span>
201 272
 		    </a>
202 273
 		    <ul class="dropdown-menu" role="menu">
203
-		      <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>
204
-		      <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>
205
-		      <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>
206
-		      <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>
274
+		      <li><a href="<?php print $globalURL; ?>/statistics/airport-departure<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
275
+	echo '/'.$airline_icao;
276
+}
277
+?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Departure Airport"); ?></a></li>
278
+		      <li><a href="<?php print $globalURL; ?>/statistics/airport-departure-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
279
+	echo '/'.$airline_icao;
280
+}
281
+?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Departure Airport by Country"); ?></a></li>
282
+		      <li><a href="<?php print $globalURL; ?>/statistics/airport-arrival<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
283
+	echo '/'.$airline_icao;
284
+}
285
+?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Arrival Airport"); ?></a></li>
286
+		      <li><a href="<?php print $globalURL; ?>/statistics/airport-arrival-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
287
+	echo '/'.$airline_icao;
288
+}
289
+?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Arrival Airport by Country"); ?></a></li>
207 290
 		    </ul>
208 291
 		</li>
209 292
 		<!--
Please login to merge, or discard this patch.
require/class.SpotterArchive.php 1 patch
Spacing   +117 added lines, -117 removed lines patch added patch discarded remove patch
@@ -14,82 +14,82 @@  discard block
 block discarded – undo
14 14
 	* @param Array $filter the filter
15 15
 	* @return Array the SQL part
16 16
 	*/
17
-	public function getFilter($filter = array(),$where = false,$and = false) {
17
+	public function getFilter($filter = array(), $where = false, $and = false) {
18 18
 		global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver;
19 19
 		$filters = array();
20 20
 		if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) {
21 21
 			if (isset($globalStatsFilters[$globalFilterName][0]['source'])) {
22 22
 				$filters = $globalStatsFilters[$globalFilterName];
23 23
 			} else {
24
-				$filter = array_merge($filter,$globalStatsFilters[$globalFilterName]);
24
+				$filter = array_merge($filter, $globalStatsFilters[$globalFilterName]);
25 25
 			}
26 26
 		}
27 27
 		if (isset($filter[0]['source'])) {
28
-			$filters = array_merge($filters,$filter);
28
+			$filters = array_merge($filters, $filter);
29 29
 		}
30
-		if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter);
30
+		if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter);
31 31
 		$filter_query_join = '';
32 32
 		$filter_query_where = '';
33
-		foreach($filters as $flt) {
33
+		foreach ($filters as $flt) {
34 34
 			if (isset($flt['airlines']) && !empty($flt['airlines'])) {
35 35
 				if ($flt['airlines'][0] != '' && $flt['airlines'][0] != 'all') {
36 36
 					if (isset($flt['source'])) {
37
-						$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','",$flt['airlines'])."') AND spotter_archive_output.format_source IN ('".implode("','",$flt['source'])."')) saff ON saff.flightaware_id = spotter_archive_output.flightaware_id";
37
+						$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','", $flt['airlines'])."') AND spotter_archive_output.format_source IN ('".implode("','", $flt['source'])."')) saff ON saff.flightaware_id = spotter_archive_output.flightaware_id";
38 38
 					} else {
39
-						$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','",$flt['airlines'])."')) saff ON saff.flightaware_id = spotter_archive_output.flightaware_id";
39
+						$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','", $flt['airlines'])."')) saff ON saff.flightaware_id = spotter_archive_output.flightaware_id";
40 40
 					}
41 41
 				}
42 42
 			}
43 43
 			if (isset($flt['pilots_id']) && !empty($flt['pilots_id'])) {
44 44
 				if (isset($flt['source'])) {
45
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."') AND spotter_archive_output.format_source IN ('".implode("','",$flt['source'])."')) sp ON sp.flightaware_id = spotter_archive_output.flightaware_id";
45
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.pilot_id IN ('".implode("','", $flt['pilots_id'])."') AND spotter_archive_output.format_source IN ('".implode("','", $flt['source'])."')) sp ON sp.flightaware_id = spotter_archive_output.flightaware_id";
46 46
 				} else {
47
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."')) sp ON sp.flightaware_id = spotter_archive_output.flightaware_id";
47
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.pilot_id IN ('".implode("','", $flt['pilots_id'])."')) sp ON sp.flightaware_id = spotter_archive_output.flightaware_id";
48 48
 				}
49 49
 			}
50 50
 			if (isset($flt['idents']) && !empty($flt['idents'])) {
51 51
 				if (isset($flt['source'])) {
52
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.ident IN ('".implode("','",$flt['idents'])."') AND spotter_archive_output.format_source IN ('".implode("','",$flt['source'])."')) spi ON spi.flightaware_id = spotter_archive_output.flightaware_id";
52
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.ident IN ('".implode("','", $flt['idents'])."') AND spotter_archive_output.format_source IN ('".implode("','", $flt['source'])."')) spi ON spi.flightaware_id = spotter_archive_output.flightaware_id";
53 53
 				} else {
54
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.ident IN ('".implode("','",$flt['idents'])."')) spi ON spi.flightaware_id = spotter_archive_output.flightaware_id";
54
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.ident IN ('".implode("','", $flt['idents'])."')) spi ON spi.flightaware_id = spotter_archive_output.flightaware_id";
55 55
 				}
56 56
 			}
57 57
 			if (isset($flt['registrations']) && !empty($flt['registrations'])) {
58 58
 				if (isset($flt['source'])) {
59
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.registration IN ('".implode("','",$flt['registrations'])."') AND spotter_archive_output.format_source IN ('".implode("','",$flt['source'])."')) sre ON sre.flightaware_id = spotter_archive_output.flightaware_id";
59
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.registration IN ('".implode("','", $flt['registrations'])."') AND spotter_archive_output.format_source IN ('".implode("','", $flt['source'])."')) sre ON sre.flightaware_id = spotter_archive_output.flightaware_id";
60 60
 				} else {
61
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.registration IN ('".implode("','",$flt['registrations'])."')) sre ON sre.flightaware_id = spotter_archive_output.flightaware_id";
61
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.registration IN ('".implode("','", $flt['registrations'])."')) sre ON sre.flightaware_id = spotter_archive_output.flightaware_id";
62 62
 				}
63 63
 			}
64 64
 			if ((isset($flt['airlines']) && empty($flt['airlines']) && isset($flt['pilots_id']) && empty($flt['pilots_id']) && isset($flt['idents']) && empty($flt['idents']) && isset($flt['registrations']) && empty($flt['registrations'])) || (!isset($flt['airlines']) && !isset($flt['pilots_id']) && !isset($flt['idents']) && !isset($flt['registrations']))) {
65 65
 				if (isset($flt['source'])) {
66
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_output.format_source IN ('".implode("','",$flt['source'])."')) saa ON saa.flightaware_id = spotter_archive_output.flightaware_id";
66
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_output.format_source IN ('".implode("','", $flt['source'])."')) saa ON saa.flightaware_id = spotter_archive_output.flightaware_id";
67 67
 				}
68 68
 			}
69 69
 		}
70 70
 		if (isset($filter['airlines']) && !empty($filter['airlines'])) {
71 71
 			if ($filter['airlines'][0] != '' && $filter['airlines'][0] != 'all') {
72
-				$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) saf ON saf.flightaware_id = spotter_archive_output.flightaware_id";
72
+				$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) saf ON saf.flightaware_id = spotter_archive_output.flightaware_id";
73 73
 			}
74 74
 		}
75 75
 		if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
76 76
 			$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_archive_output.flightaware_id ";
77 77
 		}
78 78
 		if (isset($filter['pilots_id']) && !empty($filter['pilots_id'])) {
79
-			$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.pilot_id IN ('".implode("','",$filter['pilots_id'])."')) spi ON spi.flightaware_id = spotter_archive_output.flightaware_id";
79
+			$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.pilot_id IN ('".implode("','", $filter['pilots_id'])."')) spi ON spi.flightaware_id = spotter_archive_output.flightaware_id";
80 80
 		}
81 81
 		if (isset($filter['source']) && !empty($filter['source'])) {
82 82
 			if (count($filter['source']) == 1) {
83 83
 				$filter_query_where .= " AND format_source = '".$filter['source'][0]."'";
84 84
 			} else {
85
-				$filter_query_where .= " AND format_source IN ('".implode("','",$filter['source'])."')";
85
+				$filter_query_where .= " AND format_source IN ('".implode("','", $filter['source'])."')";
86 86
 			}
87 87
 		}
88 88
 		if (isset($filter['ident']) && !empty($filter['ident'])) {
89 89
 			$filter_query_where .= " AND ident = '".$filter['ident']."'";
90 90
 		}
91 91
 		if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
92
-			$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
92
+			$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')";
93 93
 		}
94 94
 		if ((isset($filter['year']) && $filter['year'] != '') || (isset($filter['month']) && $filter['month'] != '') || (isset($filter['day']) && $filter['day'] != '')) {
95 95
 			$filter_query_date = '';
@@ -114,41 +114,41 @@  discard block
 block discarded – undo
114 114
 					$filter_query_date .= " AND EXTRACT(DAY FROM spotter_archive_output.date) = '".$filter['day']."'";
115 115
 				}
116 116
 			}
117
-			$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output".preg_replace('/^ AND/',' WHERE',$filter_query_date).") sd ON sd.flightaware_id = spotter_archive_output.flightaware_id";
117
+			$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output".preg_replace('/^ AND/', ' WHERE', $filter_query_date).") sd ON sd.flightaware_id = spotter_archive_output.flightaware_id";
118 118
 		}
119 119
 		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
120 120
 		elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND';
121 121
 		if ($filter_query_where != '') {
122
-			$filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where);
122
+			$filter_query_where = preg_replace('/^ AND/', ' WHERE', $filter_query_where);
123 123
 		}
124 124
 		$filter_query = $filter_query_join.$filter_query_where;
125 125
 		return $filter_query;
126 126
 	}
127 127
 
128 128
 	// Spotter_archive
129
-	public function 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 = '', $real_altitude = '',$heading = '', $ground_speed = '', $squawk = '', $ModeS = '', $pilot_id = '', $pilot_name = '',$verticalrate = '',$format_source = '', $source_name = '', $over_country = '') {
129
+	public function 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 = '', $real_altitude = '', $heading = '', $ground_speed = '', $squawk = '', $ModeS = '', $pilot_id = '', $pilot_name = '', $verticalrate = '', $format_source = '', $source_name = '', $over_country = '') {
130 130
 		require_once(dirname(__FILE__).'/class.Spotter.php');
131 131
 		if ($over_country == '') {
132 132
 			$Spotter = new Spotter($this->db);
133
-			$data_country = $Spotter->getCountryFromLatitudeLongitude($latitude,$longitude);
133
+			$data_country = $Spotter->getCountryFromLatitudeLongitude($latitude, $longitude);
134 134
 			if (!empty($data_country)) $country = $data_country['iso2'];
135 135
 			else $country = '';
136 136
 		} else $country = $over_country;
137
-		if ($airline_type === NULL) $airline_type ='';
137
+		if ($airline_type === NULL) $airline_type = '';
138 138
 	
139 139
 		//if ($country == '') echo "\n".'************ UNKNOW COUNTRY ****************'."\n";
140 140
 		//else echo "\n".'*/*/*/*/*/*/*/ Country : '.$country.' */*/*/*/*/*/*/*/*/'."\n";
141 141
 
142 142
 		// Route is not added in spotter_archive
143
-		$query  = "INSERT INTO spotter_archive (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, ground_speed, squawk, ModeS, pilot_id, pilot_name, verticalrate,format_source,over_country,source_name,real_altitude)
143
+		$query = "INSERT INTO spotter_archive (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, ground_speed, squawk, ModeS, pilot_id, pilot_name, verticalrate,format_source,over_country,source_name,real_altitude)
144 144
 		        VALUES (: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, :ground_speed, :squawk, :ModeS, :pilot_id, :pilot_name, :verticalrate, :format_source, :over_country, :source_name,:real_altitude)";
145 145
 
146
-		$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_name' => $aircraft_name, ':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, ':departure_airport_time' => $departure_airport_time,':arrival_airport_icao' => $arrival_airport_icao, ':arrival_airport_name' => $arrival_airport_name, ':arrival_airport_city' => $arrival_airport_city, ':arrival_airport_country' => $arrival_airport_country, ':arrival_airport_time' => $arrival_airport_time, ':route_stop' => $route_stop, ':date' => $date,':latitude' => $latitude, ':longitude' => $longitude, ':waypoints' => $waypoints, ':altitude' => $altitude, ':heading' => $heading, ':ground_speed' => $ground_speed, ':squawk' => $squawk, ':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':format_source' => $format_source, ':over_country' => $country, ':source_name' => $source_name,':real_altitude' => $real_altitude);
146
+		$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_name' => $aircraft_name, ':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, ':departure_airport_time' => $departure_airport_time, ':arrival_airport_icao' => $arrival_airport_icao, ':arrival_airport_name' => $arrival_airport_name, ':arrival_airport_city' => $arrival_airport_city, ':arrival_airport_country' => $arrival_airport_country, ':arrival_airport_time' => $arrival_airport_time, ':route_stop' => $route_stop, ':date' => $date, ':latitude' => $latitude, ':longitude' => $longitude, ':waypoints' => $waypoints, ':altitude' => $altitude, ':heading' => $heading, ':ground_speed' => $ground_speed, ':squawk' => $squawk, ':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':format_source' => $format_source, ':over_country' => $country, ':source_name' => $source_name, ':real_altitude' => $real_altitude);
147 147
 		try {
148 148
 			$sth = $this->db->prepare($query);
149 149
 			$sth->execute($query_values);
150 150
 			$sth->closeCursor();
151
-		} catch(PDOException $e) {
151
+		} catch (PDOException $e) {
152 152
 			return "error : ".$e->getMessage();
153 153
 		}
154 154
 		return "success";
@@ -168,9 +168,9 @@  discard block
 block discarded – undo
168 168
 
169 169
                 $ident = filter_var($ident, FILTER_SANITIZE_STRING);
170 170
                 //$query  = "SELECT spotter_archive.* FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate LIMIT 1";
171
-                $query  = "SELECT spotter_archive.* FROM spotter_archive WHERE ident = :ident ORDER BY date DESC LIMIT 1";
171
+                $query = "SELECT spotter_archive.* FROM spotter_archive WHERE ident = :ident ORDER BY date DESC LIMIT 1";
172 172
 
173
-                $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident));
173
+                $spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident));
174 174
 
175 175
                 return $spotter_array;
176 176
         }
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
                 $id = filter_var($id, FILTER_SANITIZE_STRING);
190 190
                 //$query  = SpotterArchive->$global_query." WHERE spotter_archive.flightaware_id = :id";
191 191
                 //$query  = "SELECT spotter_archive.* FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.flightaware_id = :id GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate LIMIT 1";
192
-                $query  = "SELECT * FROM spotter_archive WHERE flightaware_id = :id ORDER BY date DESC LIMIT 1";
192
+                $query = "SELECT * FROM spotter_archive WHERE flightaware_id = :id ORDER BY date DESC LIMIT 1";
193 193
 
194 194
 //              $spotter_array = Spotter->getDataFromDB($query,array(':id' => $id));
195 195
                   /*
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
                 }
203 203
                 $spotter_array = $sth->fetchAll(PDO->FETCH_ASSOC);
204 204
                 */
205
-                $spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id));
205
+                $spotter_array = $Spotter->getDataFromDB($query, array(':id' => $id));
206 206
 
207 207
                 return $spotter_array;
208 208
         }
@@ -217,14 +217,14 @@  discard block
 block discarded – undo
217 217
 	{
218 218
                 date_default_timezone_set('UTC');
219 219
                 $id = filter_var($id, FILTER_SANITIZE_STRING);
220
-                $query  = $this->global_query." WHERE spotter_archive.flightaware_id = :id ORDER BY date";
220
+                $query = $this->global_query." WHERE spotter_archive.flightaware_id = :id ORDER BY date";
221 221
 
222 222
 //              $spotter_array = Spotter->getDataFromDB($query,array(':id' => $id));
223 223
 
224 224
                 try {
225 225
                         $sth = $this->db->prepare($query);
226 226
                         $sth->execute(array(':id' => $id));
227
-                } catch(PDOException $e) {
227
+                } catch (PDOException $e) {
228 228
                         echo $e->getMessage();
229 229
                         die;
230 230
                 }
@@ -243,14 +243,14 @@  discard block
 block discarded – undo
243 243
         {
244 244
                 date_default_timezone_set('UTC');
245 245
                 $id = filter_var($id, FILTER_SANITIZE_STRING);
246
-                $query  = "SELECT spotter_archive.latitude, spotter_archive.longitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id";
246
+                $query = "SELECT spotter_archive.latitude, spotter_archive.longitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id";
247 247
 
248 248
 //              $spotter_array = Spotter->getDataFromDB($query,array(':id' => $id));
249 249
 
250 250
                 try {
251 251
                         $sth = $this->db->prepare($query);
252 252
                         $sth->execute(array(':id' => $id));
253
-                } catch(PDOException $e) {
253
+                } catch (PDOException $e) {
254 254
                         echo $e->getMessage();
255 255
                         die;
256 256
                 }
@@ -272,12 +272,12 @@  discard block
 block discarded – undo
272 272
                 date_default_timezone_set('UTC');
273 273
 
274 274
                 $ident = filter_var($ident, FILTER_SANITIZE_STRING);
275
-                $query  = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.ident = :ident AND spotter_archive.latitude <> 0 AND spotter_archive.longitude <> 0 ORDER BY date";
275
+                $query = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.ident = :ident AND spotter_archive.latitude <> 0 AND spotter_archive.longitude <> 0 ORDER BY date";
276 276
 
277 277
                 try {
278 278
                         $sth = $this->db->prepare($query);
279 279
                         $sth->execute(array(':ident' => $ident));
280
-                } catch(PDOException $e) {
280
+                } catch (PDOException $e) {
281 281
                         echo $e->getMessage();
282 282
                         die;
283 283
                 }
@@ -298,12 +298,12 @@  discard block
 block discarded – undo
298 298
                 date_default_timezone_set('UTC');
299 299
 
300 300
                 $id = filter_var($id, FILTER_SANITIZE_STRING);
301
-                $query  = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id AND spotter_archive.latitude <> 0 AND spotter_archive.longitude <> 0 ORDER BY date";
301
+                $query = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id AND spotter_archive.latitude <> 0 AND spotter_archive.longitude <> 0 ORDER BY date";
302 302
 
303 303
                 try {
304 304
                         $sth = $this->db->prepare($query);
305 305
                         $sth->execute(array(':id' => $id));
306
-                } catch(PDOException $e) {
306
+                } catch (PDOException $e) {
307 307
                         echo $e->getMessage();
308 308
                         die;
309 309
                 }
@@ -322,11 +322,11 @@  discard block
 block discarded – undo
322 322
 	{
323 323
 		date_default_timezone_set('UTC');
324 324
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
325
-		$query  = "SELECT spotter_archive.altitude, spotter_archive.real_altitude,spotter_archive.ground_speed, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id ORDER BY date";
325
+		$query = "SELECT spotter_archive.altitude, spotter_archive.real_altitude,spotter_archive.ground_speed, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id ORDER BY date";
326 326
 		try {
327 327
 			$sth = $this->db->prepare($query);
328 328
 			$sth->execute(array(':id' => $id));
329
-		} catch(PDOException $e) {
329
+		} catch (PDOException $e) {
330 330
 			echo $e->getMessage();
331 331
 			die;
332 332
 		}
@@ -344,12 +344,12 @@  discard block
 block discarded – undo
344 344
 	{
345 345
 		date_default_timezone_set('UTC');
346 346
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
347
-		$query  = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate LIMIT 1";
347
+		$query = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate LIMIT 1";
348 348
 //                $query  = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.ident = :ident";
349 349
 		try {
350 350
 			$sth = $this->db->prepare($query);
351 351
 			$sth->execute(array(':ident' => $ident));
352
-		} catch(PDOException $e) {
352
+		} catch (PDOException $e) {
353 353
 			echo $e->getMessage();
354 354
 			die;
355 355
 		}
@@ -365,12 +365,12 @@  discard block
 block discarded – undo
365 365
         * @return Array the spotter information
366 366
         *
367 367
         */
368
-	public function getSpotterArchiveData($ident,$flightaware_id,$date)
368
+	public function getSpotterArchiveData($ident, $flightaware_id, $date)
369 369
 	{
370 370
 		$Spotter = new Spotter($this->db);
371 371
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
372
-		$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.flightaware_id = :flightaware_id AND l.date LIKE :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate";
373
-		$spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident,':flightaware_id' => $flightaware_id,':date' => $date.'%'));
372
+		$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.flightaware_id = :flightaware_id AND l.date LIKE :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate";
373
+		$spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident, ':flightaware_id' => $flightaware_id, ':date' => $date.'%'));
374 374
 		return $spotter_array;
375 375
 	}
376 376
 
@@ -385,7 +385,7 @@  discard block
 block discarded – undo
385 385
 		try {
386 386
 			$sth = $this->db->prepare($query);
387 387
 			$sth->execute();
388
-		} catch(PDOException $e) {
388
+		} catch (PDOException $e) {
389 389
 			echo $e->getMessage();
390 390
 			die;
391 391
 		}
@@ -397,24 +397,24 @@  discard block
 block discarded – undo
397 397
         * @return Array the spotter information
398 398
         *
399 399
         */
400
-        public function getMinLiveSpotterData($begindate,$enddate,$filter = array())
400
+        public function getMinLiveSpotterData($begindate, $enddate, $filter = array())
401 401
         {
402 402
                 global $globalDBdriver, $globalLiveInterval;
403 403
                 date_default_timezone_set('UTC');
404 404
 
405 405
                 $filter_query = '';
406 406
                 if (isset($filter['source']) && !empty($filter['source'])) {
407
-                        $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') ";
407
+                        $filter_query .= " AND format_source IN ('".implode("','", $filter['source'])."') ";
408 408
                 }
409 409
                 // Use spotter_output also ?
410 410
                 if (isset($filter['airlines']) && !empty($filter['airlines'])) {
411
-                        $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id ";
411
+                        $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id ";
412 412
                 }
413 413
                 if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
414 414
                         $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_archive.flightaware_id ";
415 415
                 }
416 416
                 if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
417
-                        $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
417
+                        $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')";
418 418
                 }
419 419
 
420 420
                 //if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
@@ -433,14 +433,14 @@  discard block
 block discarded – undo
433 433
 						GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id 
434 434
 				    AND spotter_archive.date = s.maxdate '.$filter_query.'LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON spotter_archive.aircraft_icao = a.icao';
435 435
 */
436
-			$query  = 'SELECT spotter_archive.date,spotter_archive.flightaware_id, spotter_archive.ident, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, a.aircraft_shadow,a.engine_type, a.engine_count, a.wake_category 
436
+			$query = 'SELECT spotter_archive.date,spotter_archive.flightaware_id, spotter_archive.ident, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, a.aircraft_shadow,a.engine_type, a.engine_count, a.wake_category 
437 437
 				    FROM spotter_archive 
438 438
 				    INNER JOIN (SELECT * FROM aircraft) a on spotter_archive.aircraft_icao = a.icao
439 439
 				    WHERE spotter_archive.date BETWEEN '."'".$begindate."'".' AND '."'".$begindate."'".' 
440 440
                         	    '.$filter_query.' ORDER BY flightaware_id';
441 441
                 } else {
442 442
                         //$query  = 'SELECT spotter_archive.ident, spotter_archive.flightaware_id, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, a.aircraft_shadow FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate '.$filter_query.'INNER JOIN (SELECT * FROM aircraft) a on spotter_archive.aircraft_icao = a.icao';
443
-                        $query  = 'SELECT spotter_archive.date,spotter_archive.flightaware_id, spotter_archive.ident, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, a.aircraft_shadow,a.engine_type, a.engine_count, a.wake_category 
443
+                        $query = 'SELECT spotter_archive.date,spotter_archive.flightaware_id, spotter_archive.ident, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, a.aircraft_shadow,a.engine_type, a.engine_count, a.wake_category 
444 444
                         	    FROM spotter_archive 
445 445
                         	    INNER JOIN (SELECT * FROM aircraft) a on spotter_archive.aircraft_icao = a.icao
446 446
                         	    WHERE spotter_archive.date >= '."'".$begindate."'".' AND spotter_archive.date <= '."'".$enddate."'".'
@@ -450,7 +450,7 @@  discard block
 block discarded – undo
450 450
                 try {
451 451
                         $sth = $this->db->prepare($query);
452 452
                         $sth->execute();
453
-                } catch(PDOException $e) {
453
+                } catch (PDOException $e) {
454 454
                         echo $e->getMessage();
455 455
                         die;
456 456
                 }
@@ -465,24 +465,24 @@  discard block
 block discarded – undo
465 465
         * @return Array the spotter information
466 466
         *
467 467
         */
468
-        public function getMinLiveSpotterDataPlayback($begindate,$enddate,$filter = array())
468
+        public function getMinLiveSpotterDataPlayback($begindate, $enddate, $filter = array())
469 469
         {
470 470
                 global $globalDBdriver, $globalLiveInterval;
471 471
                 date_default_timezone_set('UTC');
472 472
 
473 473
                 $filter_query = '';
474 474
                 if (isset($filter['source']) && !empty($filter['source'])) {
475
-                        $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') ";
475
+                        $filter_query .= " AND format_source IN ('".implode("','", $filter['source'])."') ";
476 476
                 }
477 477
                 // Should use spotter_output also ?
478 478
                 if (isset($filter['airlines']) && !empty($filter['airlines'])) {
479
-                        $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id ";
479
+                        $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id ";
480 480
                 }
481 481
                 if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
482 482
                         $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_archive.flightaware_id ";
483 483
                 }
484 484
                 if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
485
-                        $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
485
+                        $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')";
486 486
                 }
487 487
 
488 488
                 //if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
@@ -492,7 +492,7 @@  discard block
 block discarded – undo
492 492
                     		    FROM spotter_archive 
493 493
                     		    INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE (l.date BETWEEN '."'".$begindate."'".' AND '."'".$enddate."'".') GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate '.$filter_query.'LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON spotter_archive.aircraft_icao = a.icao';
494 494
 			*/
495
-			$query  = 'SELECT a.aircraft_shadow, spotter_archive_output.ident, spotter_archive_output.flightaware_id, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao as departure_airport, spotter_archive_output.arrival_airport_icao as arrival_airport, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk 
495
+			$query = 'SELECT a.aircraft_shadow, spotter_archive_output.ident, spotter_archive_output.flightaware_id, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao as departure_airport, spotter_archive_output.arrival_airport_icao as arrival_airport, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk 
496 496
 				    FROM spotter_archive_output 
497 497
 				    LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON spotter_archive_output.aircraft_icao = a.icao 
498 498
 				    WHERE (spotter_archive_output.date BETWEEN '."'".$begindate."'".' AND '."'".$enddate."'".') 
@@ -507,7 +507,7 @@  discard block
 block discarded – undo
507 507
                         	    WHERE spotter_archive_output.date >= '."'".$begindate."'".' AND spotter_archive_output.date <= '."'".$enddate."'".'
508 508
                         	    '.$filter_query.' GROUP BY spotter_archive_output.flightaware_id, spotter_archive_output.ident, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao, spotter_archive_output.arrival_airport_icao, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk, a.aircraft_shadow';
509 509
                         */
510
-                        $query  = 'SELECT DISTINCT spotter_archive_output.flightaware_id, spotter_archive_output.ident, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao as departure_airport, spotter_archive_output.arrival_airport_icao as arrival_airport, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk, a.aircraft_shadow
510
+                        $query = 'SELECT DISTINCT spotter_archive_output.flightaware_id, spotter_archive_output.ident, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao as departure_airport, spotter_archive_output.arrival_airport_icao as arrival_airport, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk, a.aircraft_shadow
511 511
                         	    FROM spotter_archive_output 
512 512
                         	    INNER JOIN (SELECT * FROM aircraft) a on spotter_archive_output.aircraft_icao = a.icao
513 513
                         	    WHERE spotter_archive_output.date >= '."'".$begindate."'".' AND spotter_archive_output.date <= '."'".$enddate."'".'
@@ -519,7 +519,7 @@  discard block
 block discarded – undo
519 519
                 try {
520 520
                         $sth = $this->db->prepare($query);
521 521
                         $sth->execute();
522
-                } catch(PDOException $e) {
522
+                } catch (PDOException $e) {
523 523
                         echo $e->getMessage();
524 524
                         die;
525 525
                 }
@@ -534,23 +534,23 @@  discard block
 block discarded – undo
534 534
         * @return Array the spotter information
535 535
         *
536 536
         */
537
-        public function getLiveSpotterCount($begindate,$enddate,$filter = array())
537
+        public function getLiveSpotterCount($begindate, $enddate, $filter = array())
538 538
         {
539 539
                 global $globalDBdriver, $globalLiveInterval;
540 540
                 date_default_timezone_set('UTC');
541 541
 
542 542
                 $filter_query = '';
543 543
                 if (isset($filter['source']) && !empty($filter['source'])) {
544
-                        $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') ";
544
+                        $filter_query .= " AND format_source IN ('".implode("','", $filter['source'])."') ";
545 545
                 }
546 546
                 if (isset($filter['airlines']) && !empty($filter['airlines'])) {
547
-                        $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id ";
547
+                        $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id ";
548 548
                 }
549 549
                 if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
550 550
                         $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_archive.flightaware_id ";
551 551
                 }
552 552
                 if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
553
-                        $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
553
+                        $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')";
554 554
                 }
555 555
 
556 556
                 //if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
@@ -565,7 +565,7 @@  discard block
 block discarded – undo
565 565
                 try {
566 566
                         $sth = $this->db->prepare($query);
567 567
                         $sth->execute();
568
-                } catch(PDOException $e) {
568
+                } catch (PDOException $e) {
569 569
                         echo $e->getMessage();
570 570
                         die;
571 571
                 }
@@ -585,7 +585,7 @@  discard block
 block discarded – undo
585 585
     * @return Array the spotter information
586 586
     *
587 587
     */
588
-    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())
588
+    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())
589 589
     {
590 590
 	global $globalTimezone, $globalDBdriver;
591 591
 	require_once(dirname(__FILE__).'/class.Translation.php');
@@ -607,7 +607,7 @@  discard block
 block discarded – undo
607 607
 	        
608 608
 		$q_array = explode(" ", $q);
609 609
 		
610
-		foreach ($q_array as $q_item){
610
+		foreach ($q_array as $q_item) {
611 611
 		    $additional_query .= " AND (";
612 612
 		    $additional_query .= "(spotter_archive_output.spotter_id like '%".$q_item."%') OR ";
613 613
 		    $additional_query .= "(spotter_archive_output.aircraft_icao like '%".$q_item."%') OR ";
@@ -639,7 +639,7 @@  discard block
 block discarded – undo
639 639
 	
640 640
 	if ($registration != "")
641 641
 	{
642
-	    $registration = filter_var($registration,FILTER_SANITIZE_STRING);
642
+	    $registration = filter_var($registration, FILTER_SANITIZE_STRING);
643 643
 	    if (!is_string($registration))
644 644
 	    {
645 645
 		return false;
@@ -650,7 +650,7 @@  discard block
 block discarded – undo
650 650
 	
651 651
 	if ($aircraft_icao != "")
652 652
 	{
653
-	    $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
653
+	    $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
654 654
 	    if (!is_string($aircraft_icao))
655 655
 	    {
656 656
 		return false;
@@ -661,7 +661,7 @@  discard block
 block discarded – undo
661 661
 	
662 662
 	if ($aircraft_manufacturer != "")
663 663
 	{
664
-	    $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
664
+	    $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
665 665
 	    if (!is_string($aircraft_manufacturer))
666 666
 	    {
667 667
 		return false;
@@ -682,7 +682,7 @@  discard block
 block discarded – undo
682 682
 	
683 683
 	if ($airline_icao != "")
684 684
 	{
685
-	    $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
685
+	    $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
686 686
 	    if (!is_string($airline_icao))
687 687
 	    {
688 688
 		return false;
@@ -693,7 +693,7 @@  discard block
 block discarded – undo
693 693
 	
694 694
 	if ($airline_country != "")
695 695
 	{
696
-	    $airline_country = filter_var($airline_country,FILTER_SANITIZE_STRING);
696
+	    $airline_country = filter_var($airline_country, FILTER_SANITIZE_STRING);
697 697
 	    if (!is_string($airline_country))
698 698
 	    {
699 699
 		return false;
@@ -704,7 +704,7 @@  discard block
 block discarded – undo
704 704
 	
705 705
 	if ($airline_type != "")
706 706
 	{
707
-	    $airline_type = filter_var($airline_type,FILTER_SANITIZE_STRING);
707
+	    $airline_type = filter_var($airline_type, FILTER_SANITIZE_STRING);
708 708
 	    if (!is_string($airline_type))
709 709
 	    {
710 710
 		return false;
@@ -726,7 +726,7 @@  discard block
 block discarded – undo
726 726
 	
727 727
 	if ($airport != "")
728 728
 	{
729
-	    $airport = filter_var($airport,FILTER_SANITIZE_STRING);
729
+	    $airport = filter_var($airport, FILTER_SANITIZE_STRING);
730 730
 	    if (!is_string($airport))
731 731
 	    {
732 732
 		return false;
@@ -737,7 +737,7 @@  discard block
 block discarded – undo
737 737
 	
738 738
 	if ($airport_country != "")
739 739
 	{
740
-	    $airport_country = filter_var($airport_country,FILTER_SANITIZE_STRING);
740
+	    $airport_country = filter_var($airport_country, FILTER_SANITIZE_STRING);
741 741
 	    if (!is_string($airport_country))
742 742
 	    {
743 743
 		return false;
@@ -748,7 +748,7 @@  discard block
 block discarded – undo
748 748
     
749 749
 	if ($callsign != "")
750 750
 	{
751
-	    $callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
751
+	    $callsign = filter_var($callsign, FILTER_SANITIZE_STRING);
752 752
 	    if (!is_string($callsign))
753 753
 	    {
754 754
 		return false;
@@ -756,7 +756,7 @@  discard block
 block discarded – undo
756 756
 		$translate = $Translation->ident2icao($callsign);
757 757
 		if ($translate != $callsign) {
758 758
 			$additional_query .= " AND (spotter_archive_output.ident = :callsign OR spotter_archive_output.ident = :translate)";
759
-			$query_values = array_merge($query_values,array(':callsign' => $callsign,':translate' => $translate));
759
+			$query_values = array_merge($query_values, array(':callsign' => $callsign, ':translate' => $translate));
760 760
 		} else {
761 761
 			$additional_query .= " AND (spotter_archive_output.ident = '".$callsign."')";
762 762
 		}
@@ -765,7 +765,7 @@  discard block
 block discarded – undo
765 765
 
766 766
 	if ($owner != "")
767 767
 	{
768
-	    $owner = filter_var($owner,FILTER_SANITIZE_STRING);
768
+	    $owner = filter_var($owner, FILTER_SANITIZE_STRING);
769 769
 	    if (!is_string($owner))
770 770
 	    {
771 771
 		return false;
@@ -776,7 +776,7 @@  discard block
 block discarded – undo
776 776
 
777 777
 	if ($pilot_name != "")
778 778
 	{
779
-	    $pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING);
779
+	    $pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING);
780 780
 	    if (!is_string($pilot_name))
781 781
 	    {
782 782
 		return false;
@@ -787,7 +787,7 @@  discard block
 block discarded – undo
787 787
 	
788 788
 	if ($pilot_id != "")
789 789
 	{
790
-	    $pilot_id = filter_var($pilot_id,FILTER_SANITIZE_NUMBER_INT);
790
+	    $pilot_id = filter_var($pilot_id, FILTER_SANITIZE_NUMBER_INT);
791 791
 	    if (!is_string($pilot_id))
792 792
 	    {
793 793
 		return false;
@@ -798,7 +798,7 @@  discard block
 block discarded – undo
798 798
 	
799 799
 	if ($departure_airport_route != "")
800 800
 	{
801
-	    $departure_airport_route = filter_var($departure_airport_route,FILTER_SANITIZE_STRING);
801
+	    $departure_airport_route = filter_var($departure_airport_route, FILTER_SANITIZE_STRING);
802 802
 	    if (!is_string($departure_airport_route))
803 803
 	    {
804 804
 		return false;
@@ -809,7 +809,7 @@  discard block
 block discarded – undo
809 809
 	
810 810
 	if ($arrival_airport_route != "")
811 811
 	{
812
-	    $arrival_airport_route = filter_var($arrival_airport_route,FILTER_SANITIZE_STRING);
812
+	    $arrival_airport_route = filter_var($arrival_airport_route, FILTER_SANITIZE_STRING);
813 813
 	    if (!is_string($arrival_airport_route))
814 814
 	    {
815 815
 		return false;
@@ -822,8 +822,8 @@  discard block
 block discarded – undo
822 822
 	{
823 823
 	    $altitude_array = explode(",", $altitude);
824 824
 	    
825
-	    $altitude_array[0] = filter_var($altitude_array[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
826
-	    $altitude_array[1] = filter_var($altitude_array[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
825
+	    $altitude_array[0] = filter_var($altitude_array[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
826
+	    $altitude_array[1] = filter_var($altitude_array[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
827 827
 	    
828 828
 
829 829
 	    if ($altitude_array[1] != "")
@@ -840,8 +840,8 @@  discard block
 block discarded – undo
840 840
 	if ($date_posted != "")
841 841
 	{
842 842
 		$date_array = explode(",", $date_posted);
843
-		$date_array[0] = filter_var($date_array[0],FILTER_SANITIZE_STRING);
844
-		$date_array[1] = filter_var($date_array[1],FILTER_SANITIZE_STRING);
843
+		$date_array[0] = filter_var($date_array[0], FILTER_SANITIZE_STRING);
844
+		$date_array[1] = filter_var($date_array[1], FILTER_SANITIZE_STRING);
845 845
 		if ($globalTimezone != '') {
846 846
 			date_default_timezone_set($globalTimezone);
847 847
 			$datetime = new DateTime();
@@ -868,8 +868,8 @@  discard block
 block discarded – undo
868 868
 		if ($limit != "")
869 869
 		{
870 870
 			$limit_array = explode(",", $limit);
871
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
872
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
871
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
872
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
873 873
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
874 874
 			{
875 875
 				//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
@@ -877,8 +877,8 @@  discard block
 block discarded – undo
877 877
 			}
878 878
 		}
879 879
 		if ($origLat != "" && $origLon != "" && $dist != "") {
880
-			$dist = number_format($dist*0.621371,2,'.','');
881
-			$query="SELECT spotter_archive_output.*, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - ABS(CAST(spotter_archive.latitude as double precision)))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(ABS(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 
880
+			$dist = number_format($dist*0.621371, 2, '.', '');
881
+			$query = "SELECT spotter_archive_output.*, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - ABS(CAST(spotter_archive.latitude as double precision)))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(ABS(CAST(spotter_archive.latitude as double precision))*pi()/180)*POWER(SIN(($origLon-CAST(spotter_archive.longitude as double precision))*pi()/180/2),2))) as distance 
882 882
 			      FROM spotter_archive_output, spotter_archive WHERE spotter_output_archive.flightaware_id = spotter_archive.flightaware_id AND spotter_output.ident <> '' ".$additional_query."AND CAST(spotter_archive.longitude as double precision) between ($origLon-$dist/ABS(cos(radians($origLat))*69)) and ($origLon+$dist/ABS(cos(radians($origLat))*69)) and CAST(spotter_archive.latitude as double precision) between ($origLat-($dist/69)) and ($origLat+($dist/69)) 
883 883
 			      AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - ABS(CAST(spotter_archive.latitude as double precision)))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(ABS(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." ORDER BY distance";
884 884
 		} else {
@@ -894,12 +894,12 @@  discard block
 block discarded – undo
894 894
 				$additional_query .= " AND (spotter_archive_output.waypoints <> '')";
895 895
 			}
896 896
 
897
-			$query  = "SELECT spotter_archive_output.* FROM spotter_archive_output 
897
+			$query = "SELECT spotter_archive_output.* FROM spotter_archive_output 
898 898
 			    WHERE spotter_archive_output.ident <> '' 
899 899
 			    ".$additional_query."
900 900
 			    ".$filter_query.$orderby_query;
901 901
 		}
902
-		$spotter_array = $Spotter->getDataFromDB($query, $query_values,$limit_query);
902
+		$spotter_array = $Spotter->getDataFromDB($query, $query_values, $limit_query);
903 903
 		return $spotter_array;
904 904
 	}
905 905
 
@@ -914,7 +914,7 @@  discard block
 block discarded – undo
914 914
 		try {
915 915
 			$sth = $this->db->prepare($query);
916 916
 			$sth->execute();
917
-		} catch(PDOException $e) {
917
+		} catch (PDOException $e) {
918 918
 			return "error";
919 919
 		}
920 920
 	}
@@ -951,8 +951,8 @@  discard block
 block discarded – undo
951 951
 	{
952 952
 	    $limit_array = explode(",", $limit);
953 953
 	    
954
-	    $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
955
-	    $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
954
+	    $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
955
+	    $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
956 956
 	    
957 957
 	    if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
958 958
 	    {
@@ -993,7 +993,7 @@  discard block
 block discarded – undo
993 993
 	$query_values = array();
994 994
 	$limit_query = '';
995 995
 	$additional_query = '';
996
-	$filter_query = $this->getFilter($filter,true,true);
996
+	$filter_query = $this->getFilter($filter, true, true);
997 997
 	
998 998
 	if ($owner != "")
999 999
 	{
@@ -1010,8 +1010,8 @@  discard block
 block discarded – undo
1010 1010
 	{
1011 1011
 	    $limit_array = explode(",", $limit);
1012 1012
 	    
1013
-	    $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1014
-	    $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1013
+	    $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1014
+	    $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1015 1015
 	    
1016 1016
 	    if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1017 1017
 	    {
@@ -1051,7 +1051,7 @@  discard block
 block discarded – undo
1051 1051
 	$query_values = array();
1052 1052
 	$limit_query = '';
1053 1053
 	$additional_query = '';
1054
-	$filter_query = $this->getFilter($filter,true,true);
1054
+	$filter_query = $this->getFilter($filter, true, true);
1055 1055
 	
1056 1056
 	if ($pilot != "")
1057 1057
 	{
@@ -1063,8 +1063,8 @@  discard block
 block discarded – undo
1063 1063
 	{
1064 1064
 	    $limit_array = explode(",", $limit);
1065 1065
 	    
1066
-	    $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1067
-	    $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1066
+	    $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1067
+	    $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1068 1068
 	    
1069 1069
 	    if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1070 1070
 	    {
@@ -1094,7 +1094,7 @@  discard block
 block discarded – undo
1094 1094
     * @return Array the airline country list
1095 1095
     *
1096 1096
     */
1097
-    public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '')
1097
+    public function countAllFlightOverCountries($limit = true, $olderthanmonths = 0, $sincedate = '')
1098 1098
     {
1099 1099
 	global $globalDBdriver;
1100 1100
 	/*
@@ -1123,7 +1123,7 @@  discard block
 block discarded – undo
1123 1123
 	$flight_array = array();
1124 1124
 	$temp_array = array();
1125 1125
         
1126
-	while($row = $sth->fetch(PDO::FETCH_ASSOC))
1126
+	while ($row = $sth->fetch(PDO::FETCH_ASSOC))
1127 1127
 	{
1128 1128
 	    $temp_array['flight_count'] = $row['nb'];
1129 1129
 	    $temp_array['flight_country'] = $row['name'];
@@ -1140,7 +1140,7 @@  discard block
 block discarded – undo
1140 1140
     * @return Array the airline country list
1141 1141
     *
1142 1142
     */
1143
-    public function countAllFlightOverCountriesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '')
1143
+    public function countAllFlightOverCountriesByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '')
1144 1144
     {
1145 1145
 	global $globalDBdriver;
1146 1146
 	/*
@@ -1169,7 +1169,7 @@  discard block
 block discarded – undo
1169 1169
 	$flight_array = array();
1170 1170
 	$temp_array = array();
1171 1171
         
1172
-	while($row = $sth->fetch(PDO::FETCH_ASSOC))
1172
+	while ($row = $sth->fetch(PDO::FETCH_ASSOC))
1173 1173
 	{
1174 1174
 	    $temp_array['airline_icao'] = $row['airline_icao'];
1175 1175
 	    $temp_array['flight_count'] = $row['nb'];
@@ -1187,14 +1187,14 @@  discard block
 block discarded – undo
1187 1187
     * @return Array the spotter information
1188 1188
     *
1189 1189
     */
1190
-    public function getDateArchiveSpotterDataById($id,$date)
1190
+    public function getDateArchiveSpotterDataById($id, $date)
1191 1191
     {
1192 1192
 	$Spotter = new Spotter($this->db);
1193 1193
 	date_default_timezone_set('UTC');
1194 1194
 	$id = filter_var($id, FILTER_SANITIZE_STRING);
1195
-	$query  = 'SELECT spotter_archive.* FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.flightaware_id = :id AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate ORDER BY spotter_archive.date DESC';
1196
-	$date = date('c',$date);
1197
-	$spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id,':date' => $date));
1195
+	$query = 'SELECT spotter_archive.* FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.flightaware_id = :id AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate ORDER BY spotter_archive.date DESC';
1196
+	$date = date('c', $date);
1197
+	$spotter_array = $Spotter->getDataFromDB($query, array(':id' => $id, ':date' => $date));
1198 1198
 	return $spotter_array;
1199 1199
     }
1200 1200
 
@@ -1204,14 +1204,14 @@  discard block
 block discarded – undo
1204 1204
     * @return Array the spotter information
1205 1205
     *
1206 1206
     */
1207
-    public function getDateArchiveSpotterDataByIdent($ident,$date)
1207
+    public function getDateArchiveSpotterDataByIdent($ident, $date)
1208 1208
     {
1209 1209
 	$Spotter = new Spotter($this->db);
1210 1210
 	date_default_timezone_set('UTC');
1211 1211
 	$ident = filter_var($ident, FILTER_SANITIZE_STRING);
1212
-	$query  = 'SELECT spotter_archive.* FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate ORDER BY spotter_archive.date DESC';
1213
-	$date = date('c',$date);
1214
-	$spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident,':date' => $date));
1212
+	$query = 'SELECT spotter_archive.* FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate ORDER BY spotter_archive.date DESC';
1213
+	$date = date('c', $date);
1214
+	$spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident, ':date' => $date));
1215 1215
 	return $spotter_array;
1216 1216
     }
1217 1217
 
@@ -1221,7 +1221,7 @@  discard block
 block discarded – undo
1221 1221
     * @return Array the spotter information
1222 1222
     *
1223 1223
     */
1224
-    public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '',$filters = array())
1224
+    public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '', $filters = array())
1225 1225
     {
1226 1226
 	global $global_query;
1227 1227
 	$Spotter = new Spotter($this->db);
@@ -1229,7 +1229,7 @@  discard block
 block discarded – undo
1229 1229
 	$query_values = array();
1230 1230
 	$limit_query = '';
1231 1231
 	$additional_query = '';
1232
-	$filter_query = $this->getFilter($filters,true,true);
1232
+	$filter_query = $this->getFilter($filters, true, true);
1233 1233
 	
1234 1234
 	if ($airport != "")
1235 1235
 	{
@@ -1246,8 +1246,8 @@  discard block
 block discarded – undo
1246 1246
 	{
1247 1247
 	    $limit_array = explode(",", $limit);
1248 1248
 	    
1249
-	    $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1250
-	    $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1249
+	    $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1250
+	    $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1251 1251
 	    
1252 1252
 	    if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1253 1253
 	    {
Please login to merge, or discard this patch.
require/class.APRS.php 1 patch
Spacing   +157 added lines, -158 removed lines patch added patch discarded remove patch
@@ -175,8 +175,7 @@  discard block
 block discarded – undo
175 175
 		'\~' => 'TNC Stream SW');
176 176
 
177 177
 	private function urshift($n, $s) {
178
-		return ($n >= 0) ? ($n >> $s) :
179
-		    (($n & 0x7fffffff) >> $s) | 
178
+		return ($n >= 0) ? ($n >> $s) : (($n&0x7fffffff) >> $s)| 
180 179
 		    (0x40000000 >> ($s - 1));
181 180
 	}
182 181
 
@@ -192,7 +191,7 @@  discard block
 block discarded – undo
192 191
 		$input_len = strlen($input);
193 192
 		
194 193
 		/* Find the end of header checking for NULL bytes while doing it. */
195
-		$splitpos = strpos($input,':');
194
+		$splitpos = strpos($input, ':');
196 195
 		
197 196
 		/* Check that end was found and body has at least one byte. */
198 197
 		if ($splitpos == 0 || $splitpos + 1 == $input_len || $splitpos === FALSE) {
@@ -202,14 +201,14 @@  discard block
 block discarded – undo
202 201
 		
203 202
 		if ($debug) echo 'input : '.$input."\n";
204 203
 		/* Save header and body. */
205
-		$body = substr($input,$splitpos+1,$input_len);
204
+		$body = substr($input, $splitpos + 1, $input_len);
206 205
 		$body_len = strlen($body);
207
-		$header = substr($input,0,$splitpos);
206
+		$header = substr($input, 0, $splitpos);
208 207
 		if ($debug) echo 'header : '.$header."\n";
209 208
 		
210 209
 		/* Parse source, target and path. */
211 210
 		//FLRDF0A52>APRS,qAS,LSTB
212
-		if (preg_match('/^([A-Z0-9\\-]{1,9})>(.*)$/',$header,$matches)) {
211
+		if (preg_match('/^([A-Z0-9\\-]{1,9})>(.*)$/', $header, $matches)) {
213 212
 			$ident = $matches[1];
214 213
 			$all_elements = $matches[2];
215 214
 			if ($ident == 'AIRCRAFT') {
@@ -226,13 +225,13 @@  discard block
 block discarded – undo
226 225
 			if ($debug) 'No ident'."\n";
227 226
 			return false;
228 227
 		}
229
-		$elements = explode(',',$all_elements);
228
+		$elements = explode(',', $all_elements);
230 229
 		$source = end($elements);
231 230
 		$result['source'] = $source;
232 231
 		foreach ($elements as $element) {
233
-			if (preg_match('/^([a-zA-Z0-9-]{1,9})([*]?)$/',$element)) {
232
+			if (preg_match('/^([a-zA-Z0-9-]{1,9})([*]?)$/', $element)) {
234 233
 			//if ($element == 'TCPIP*') return false;
235
-			} elseif (!preg_match('/^([0-9A-F]{32})$/',$element)) {
234
+			} elseif (!preg_match('/^([0-9A-F]{32})$/', $element)) {
236 235
 				if ($debug) echo 'element : '.$element."\n";
237 236
 				return false;
238 237
 			}
@@ -245,14 +244,14 @@  discard block
 block discarded – undo
245 244
 			*/
246 245
 		}
247 246
 		
248
-		$type = substr($body,0,1);
247
+		$type = substr($body, 0, 1);
249 248
 		if ($debug) echo 'type : '.$type."\n";
250 249
 		if ($type == ';') {
251 250
 			if (isset($result['source_type']) && $result['source_type'] == 'modes') {
252
-				$result['address'] = trim(substr($body,1,9));
251
+				$result['address'] = trim(substr($body, 1, 9));
253 252
 			} elseif (isset($result['source_type']) && $result['source_type'] == 'ais') {
254
-				$result['mmsi'] = trim(substr($body,1,9));
255
-			} else $result['ident'] = trim(substr($body,1,9));
253
+				$result['mmsi'] = trim(substr($body, 1, 9));
254
+			} else $result['ident'] = trim(substr($body, 1, 9));
256 255
 		} elseif ($type == ',') {
257 256
 			// Invalid data or test data
258 257
 			return false;
@@ -260,20 +259,20 @@  discard block
 block discarded – undo
260 259
 		
261 260
 		// Check for Timestamp
262 261
 		$find = false;
263
-		$body_parse = substr($body,1);
264
-		if (preg_match('/^;(.){9}\*/',$body,$matches)) {
265
-			$body_parse = substr($body_parse,10);
262
+		$body_parse = substr($body, 1);
263
+		if (preg_match('/^;(.){9}\*/', $body, $matches)) {
264
+			$body_parse = substr($body_parse, 10);
266 265
 			$find = true;
267 266
 		}
268
-		if (preg_match('/^`(.*)\//',$body,$matches)) {
269
-			$body_parse = substr($body_parse,strlen($matches[1])-1);
267
+		if (preg_match('/^`(.*)\//', $body, $matches)) {
268
+			$body_parse = substr($body_parse, strlen($matches[1]) - 1);
270 269
 			$find = true;
271 270
 		}
272
-		if (preg_match("/^'(.*)\//",$body,$matches)) {
273
-			$body_parse = substr($body_parse,strlen($matches[1])-1);
271
+		if (preg_match("/^'(.*)\//", $body, $matches)) {
272
+			$body_parse = substr($body_parse, strlen($matches[1]) - 1);
274 273
 			$find = true;
275 274
 		}
276
-		if (preg_match('/^([0-9]{2})([0-9]{2})([0-9]{2})([zh\\/])/',$body_parse,$matches)) {
275
+		if (preg_match('/^([0-9]{2})([0-9]{2})([0-9]{2})([zh\\/])/', $body_parse, $matches)) {
277 276
 			$find = true;
278 277
 			$timestamp = $matches[0];
279 278
 			if ($matches[4] == 'h') {
@@ -286,17 +285,17 @@  discard block
 block discarded – undo
286 285
 				// This work or not ?
287 286
 				$timestamp = strtotime(date('Ym').$matches[1].' '.$matches[2].':'.$matches[3]);
288 287
 			}
289
-			$body_parse = substr($body_parse,7);
288
+			$body_parse = substr($body_parse, 7);
290 289
 			$result['timestamp'] = $timestamp;
291 290
 		}
292
-		if (preg_match('/^([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})/',$body_parse,$matches)) {
291
+		if (preg_match('/^([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})/', $body_parse, $matches)) {
293 292
 			$find = true;
294 293
 			$timestamp = strtotime(date('Y').$matches[1].$matches[2].' '.$matches[3].':'.$matches[4]);
295
-			$body_parse = substr($body_parse,8);
294
+			$body_parse = substr($body_parse, 8);
296 295
 			$result['timestamp'] = $timestamp;
297 296
 		}
298 297
 		//if (strlen($body_parse) > 19) {
299
-		if (preg_match('/^([0-9]{2})([0-7 ][0-9 ]\\.[0-9 ]{2})([NnSs])(.)([0-9]{3})([0-7 ][0-9 ]\\.[0-9 ]{2})([EeWw])(.)/',$body_parse,$matches)) {
298
+		if (preg_match('/^([0-9]{2})([0-7 ][0-9 ]\\.[0-9 ]{2})([NnSs])(.)([0-9]{3})([0-7 ][0-9 ]\\.[0-9 ]{2})([EeWw])(.)/', $body_parse, $matches)) {
300 299
 			$find = true;
301 300
 			// 4658.70N/00707.78Ez
302 301
 			$sind = strtoupper($matches[3]);
@@ -318,11 +317,11 @@  discard block
 block discarded – undo
318 317
 			    */
319 318
 			$latitude = $lat + floatval($lat_min)/60;
320 319
 			$longitude = $lon + floatval($lon_min)/60;
321
-			if ($sind == 'S') $latitude = 0-$latitude;
322
-			if ($wind == 'W') $longitude = 0-$longitude;
320
+			if ($sind == 'S') $latitude = 0 - $latitude;
321
+			if ($wind == 'W') $longitude = 0 - $longitude;
323 322
 			$result['latitude'] = $latitude;
324 323
 			$result['longitude'] = $longitude;
325
-			$body_parse = substr($body_parse,18);
324
+			$body_parse = substr($body_parse, 18);
326 325
 			$body_parse_len = strlen($body_parse);
327 326
 		}
328 327
 		$body_parse_len = strlen($body_parse);
@@ -349,22 +348,22 @@  discard block
 block discarded – undo
349 348
 				//'
350 349
 				//if ($type != ';' && $type != '>') {
351 350
 				if ($type != '') {
352
-					$body_parse = substr($body_parse,1);
351
+					$body_parse = substr($body_parse, 1);
353 352
 					$body_parse_len = strlen($body_parse);
354 353
 					$result['symbol_code'] = $symbol_code;
355 354
 					if (isset($this->symbols[$symbol_code])) $result['symbol'] = $this->symbols[$symbol_code];
356 355
 					if ($symbol_code != '_') {
357 356
 					}
358 357
 					if ($body_parse_len >= 7) {
359
-						if (preg_match('/^([0-9\\. ]{3})\\/([0-9\\. ]{3})/',$body_parse)) {
360
-							$course = substr($body_parse,0,3);
358
+						if (preg_match('/^([0-9\\. ]{3})\\/([0-9\\. ]{3})/', $body_parse)) {
359
+							$course = substr($body_parse, 0, 3);
361 360
 							$tmp_s = intval($course);
362 361
 							if ($tmp_s >= 1 && $tmp_s <= 360) $result['heading'] = intval($course);
363
-							$speed = substr($body_parse,4,3);
362
+							$speed = substr($body_parse, 4, 3);
364 363
 							if ($speed != '...') {
365 364
 								$result['speed'] = intval($speed);
366 365
 							}
367
-							$body_parse = substr($body_parse,7);
366
+							$body_parse = substr($body_parse, 7);
368 367
 						}
369 368
 						// Check PHGR, PHG, RNG
370 369
 					} 
@@ -374,11 +373,11 @@  discard block
 block discarded – undo
374 373
 					}
375 374
 					*/
376 375
 					if (strlen($body_parse) > 0) {
377
-						if (preg_match('/\\/A=(-[0-9]{5}|[0-9]{6})/',$body_parse,$matches)) {
376
+						if (preg_match('/\\/A=(-[0-9]{5}|[0-9]{6})/', $body_parse, $matches)) {
378 377
 							$altitude = intval($matches[1]);
379 378
 							$result['altitude'] = $altitude;
380 379
 							//$body_parse = trim(substr($body_parse,strlen($matches[0])));
381
-							$body_parse = trim(preg_replace('/\\/A=(-[0-9]{5}|[0-9]{6})/','',$body_parse));
380
+							$body_parse = trim(preg_replace('/\\/A=(-[0-9]{5}|[0-9]{6})/', '', $body_parse));
382 381
 						}
383 382
 					}
384 383
 					// Telemetry
@@ -388,58 +387,58 @@  discard block
 block discarded – undo
388 387
 					}
389 388
 					*/
390 389
 					// DAO
391
-					if (preg_match('/^!([0-9A-Z]{3})/',$body_parse,$matches)) {
390
+					if (preg_match('/^!([0-9A-Z]{3})/', $body_parse, $matches)) {
392 391
 						$dao = $matches[1];
393
-						if (preg_match('/^([A-Z])([0-9]{2})/',$dao)) {
392
+						if (preg_match('/^([A-Z])([0-9]{2})/', $dao)) {
394 393
 							$dao_split = str_split($dao);
395
-							$lat_off = (($dao_split[1])-48.0)*0.001/60.0;
396
-							$lon_off = (($dao_split[2])-48.0)*0.001/60.0;
394
+							$lat_off = (($dao_split[1]) - 48.0)*0.001/60.0;
395
+							$lon_off = (($dao_split[2]) - 48.0)*0.001/60.0;
397 396
 							if ($result['latitude'] < 0) $result['latitude'] -= $lat_off;
398 397
 							else $result['latitude'] += $lat_off;
399 398
 							if ($result['longitude'] < 0) $result['longitude'] -= $lon_off;
400 399
 							else $result['longitude'] += $lon_off;
401 400
 						}
402
-						$body_parse = substr($body_parse,6);
401
+						$body_parse = substr($body_parse, 6);
403 402
 					}
404
-					if (preg_match('/CS=([0-9A-Z_]*)/',$body_parse,$matches)) {
405
-						$result['ident'] = str_replace('_',' ',$matches[1]);
403
+					if (preg_match('/CS=([0-9A-Z_]*)/', $body_parse, $matches)) {
404
+						$result['ident'] = str_replace('_', ' ', $matches[1]);
406 405
 					}
407
-					if (preg_match('/SQ=([0-9]{4})/',$body_parse,$matches)) {
406
+					if (preg_match('/SQ=([0-9]{4})/', $body_parse, $matches)) {
408 407
 						$result['squawk'] = $matches[1];
409 408
 					}
410
-					if (preg_match('/AI=([0-9A-Z]{4})/',$body_parse,$matches)) {
409
+					if (preg_match('/AI=([0-9A-Z]{4})/', $body_parse, $matches)) {
411 410
 						$result['aircraft_icao'] = $matches[1];
412 411
 					}
413
-					if (preg_match('/VR=([-0-9]*)/',$body_parse,$matches)) {
412
+					if (preg_match('/VR=([-0-9]*)/', $body_parse, $matches)) {
414 413
 						$result['verticalrate'] = $matches[1];
415 414
 					}
416
-					if (preg_match('/TI=([0-9]*)/',$body_parse,$matches)) {
415
+					if (preg_match('/TI=([0-9]*)/', $body_parse, $matches)) {
417 416
 						$result['typeid'] = $matches[1];
418 417
 					}
419
-					if (preg_match('/SI=([0-9]*)/',$body_parse,$matches)) {
418
+					if (preg_match('/SI=([0-9]*)/', $body_parse, $matches)) {
420 419
 						$result['statusid'] = $matches[1];
421 420
 					}
422
-					if (preg_match('/IMO=([0-9]{7})/',$body_parse,$matches)) {
421
+					if (preg_match('/IMO=([0-9]{7})/', $body_parse, $matches)) {
423 422
 						$result['imo'] = $matches[1];
424 423
 					}
425
-					if (preg_match('/AD=([0-9]*)/',$body_parse,$matches)) {
424
+					if (preg_match('/AD=([0-9]*)/', $body_parse, $matches)) {
426 425
 						$result['arrival_date'] = $matches[1];
427 426
 					}
428
-					if (preg_match('/AC=([0-9A-Z_]*)/',$body_parse,$matches)) {
429
-						$result['arrival_code'] = str_replace('_',' ',$matches[1]);
427
+					if (preg_match('/AC=([0-9A-Z_]*)/', $body_parse, $matches)) {
428
+						$result['arrival_code'] = str_replace('_', ' ', $matches[1]);
430 429
 					}
431 430
 					// OGN comment
432 431
 					//if (preg_match('/^id([0-9A-F]{8}) ([+-])([0-9]{3,4})fpm ([+-])([0-9.]{3,4})rot (.*)$/',$body_parse,$matches)) {
433
-					if (preg_match('/^id([0-9A-F]{8})/',$body_parse,$matches)) {
432
+					if (preg_match('/^id([0-9A-F]{8})/', $body_parse, $matches)) {
434 433
 						$id = $matches[1];
435 434
 						//$mode = substr($id,0,2);
436
-						$address = substr($id,2);
437
-						$addressType = (intval(substr($id,0,2),16))&3;
435
+						$address = substr($id, 2);
436
+						$addressType = (intval(substr($id, 0, 2), 16))&3;
438 437
 						if ($addressType == 0) $result['addresstype'] = "RANDOM";
439 438
 						elseif ($addressType == 1) $result['addresstype'] = "ICAO";
440 439
 						elseif ($addressType == 2) $result['addresstype'] = "FLARM";
441 440
 						elseif ($addressType == 3) $result['addresstype'] = "OGN";
442
-						$aircraftType = $this->urshift(((intval(substr($id,0,2),16)) & 0b1111100),2);
441
+						$aircraftType = $this->urshift(((intval(substr($id, 0, 2), 16))&0b1111100), 2);
443 442
 						$result['aircrafttype_code'] = $aircraftType;
444 443
 						if ($aircraftType == 0) $result['aircrafttype'] = "UNKNOWN";
445 444
 						elseif ($aircraftType == 1) $result['aircrafttype'] = "GLIDER";
@@ -456,110 +455,110 @@  discard block
 block discarded – undo
456 455
 						elseif ($aircraftType == 12) $result['aircrafttype'] = "AIRSHIP";
457 456
 						elseif ($aircraftType == 13) $result['aircrafttype'] = "UAV";
458 457
 						elseif ($aircraftType == 15) $result['aircrafttype'] = "STATIC_OBJECT";
459
-						$stealth = (intval(substr($id,0,2), 16) & 0b10000000) != 0;
458
+						$stealth = (intval(substr($id, 0, 2), 16)&0b10000000) != 0;
460 459
 						$result['stealth'] = $stealth;
461 460
 						$result['address'] = $address;
462 461
 					}
463 462
 					//Comment
464 463
 					$result['comment'] = trim($body_parse);
465 464
 					// parse weather
466
-					if (preg_match('/^_{0,1}([0-9 \\.\\-]{3})\\/([0-9 \\.]{3})g([0-9 \\.]+)t(-{0,1}[0-9 \\.]+)/',$body_parse,$matches)) {
465
+					if (preg_match('/^_{0,1}([0-9 \\.\\-]{3})\\/([0-9 \\.]{3})g([0-9 \\.]+)t(-{0,1}[0-9 \\.]+)/', $body_parse, $matches)) {
467 466
 						$result['wind_dir'] = intval($matches[1]);
468
-						$result['wind_speed'] = round(intval($matches[2])*1.60934,1);
469
-						$result['wind_gust'] = round(intval($matches[3])*1.60934,1);
470
-						$result['temp'] = round(5/9*((intval($matches[4]))-32),1);
471
-						$body_parse = substr($body_parse,strlen($matches[0])+1);
472
-					} elseif (preg_match('/^_{0,1}c([0-9 \\.\\-]{3})s([0-9 \\.]{3})g([0-9 \\.]+)t(-{0,1}[0-9 \\.]+)/',$body_parse,$matches)) {
467
+						$result['wind_speed'] = round(intval($matches[2])*1.60934, 1);
468
+						$result['wind_gust'] = round(intval($matches[3])*1.60934, 1);
469
+						$result['temp'] = round(5/9*((intval($matches[4])) - 32), 1);
470
+						$body_parse = substr($body_parse, strlen($matches[0]) + 1);
471
+					} elseif (preg_match('/^_{0,1}c([0-9 \\.\\-]{3})s([0-9 \\.]{3})g([0-9 \\.]+)t(-{0,1}[0-9 \\.]+)/', $body_parse, $matches)) {
473 472
 						$result['wind_dir'] = intval($matches[1]);
474
-						$result['wind_speed'] = round($matches[2]*1.60934,1);
475
-						$result['wind_gust'] = round($matches[3]*1.60934,1);
476
-						$result['temp'] = round(5/9*(($matches[4])-32),1);
477
-						$body_parse = substr($body_parse,strlen($matches[0])+1);
478
-					} elseif (preg_match('/^_{0,1}([0-9 \\.\\-]{3})\\/([0-9 \\.]{3})t(-{0,1}[0-9 \\.]+)/',$body_parse,$matches)) {
473
+						$result['wind_speed'] = round($matches[2]*1.60934, 1);
474
+						$result['wind_gust'] = round($matches[3]*1.60934, 1);
475
+						$result['temp'] = round(5/9*(($matches[4]) - 32), 1);
476
+						$body_parse = substr($body_parse, strlen($matches[0]) + 1);
477
+					} elseif (preg_match('/^_{0,1}([0-9 \\.\\-]{3})\\/([0-9 \\.]{3})t(-{0,1}[0-9 \\.]+)/', $body_parse, $matches)) {
479 478
 						$result['wind_dir'] = intval($matches[1]);
480
-						$result['wind_speed'] = round($matches[2]*1.60934,1);
481
-						$result['wind_gust'] = round($matches[3]*1.60934,1);
482
-						$body_parse = substr($body_parse,strlen($matches[0])+1);
483
-					} elseif (preg_match('/^_{0,1}([0-9 \\.\\-]{3})\\/([0-9 \\.]{3})g([0-9 \\.]+)/',$body_parse,$matches)) {
479
+						$result['wind_speed'] = round($matches[2]*1.60934, 1);
480
+						$result['wind_gust'] = round($matches[3]*1.60934, 1);
481
+						$body_parse = substr($body_parse, strlen($matches[0]) + 1);
482
+					} elseif (preg_match('/^_{0,1}([0-9 \\.\\-]{3})\\/([0-9 \\.]{3})g([0-9 \\.]+)/', $body_parse, $matches)) {
484 483
 						$result['wind_dir'] = intval($matches[1]);
485
-						$result['wind_speed'] = round($matches[2]*1.60934,1);
486
-						$result['wind_gust'] = round($matches[3]*1.60934,1);
487
-						$body_parse = substr($body_parse,strlen($matches[0])+1);
484
+						$result['wind_speed'] = round($matches[2]*1.60934, 1);
485
+						$result['wind_gust'] = round($matches[3]*1.60934, 1);
486
+						$body_parse = substr($body_parse, strlen($matches[0]) + 1);
488 487
 					}
489 488
 					// temperature
490 489
 					//g012t088r000p000P000h38b10110
491 490
 					//g011t086r000p000P000h29b10198
492
-					if (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3,4})r([0-9 \\.]{3})p([0-9 \\.]{3})P([0-9 \\.]{3})h([0-9 \\.]{2,3})b([0-9 \\.]{5})/',$body_parse,$matches)) {
493
-						if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1);
494
-						if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1);
495
-						if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1,1);
496
-						if ($matches[4] != '...') $result['precipitation'] = round((intval($matches[4])/100)*25.1,1);
497
-						if ($matches[5] != '...') $result['precipitation24h'] = round((intval($matches[5])/100)*25.1,1);
491
+					if (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3,4})r([0-9 \\.]{3})p([0-9 \\.]{3})P([0-9 \\.]{3})h([0-9 \\.]{2,3})b([0-9 \\.]{5})/', $body_parse, $matches)) {
492
+						if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934, 1);
493
+						if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2])) - 32), 1);
494
+						if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1, 1);
495
+						if ($matches[4] != '...') $result['precipitation'] = round((intval($matches[4])/100)*25.1, 1);
496
+						if ($matches[5] != '...') $result['precipitation24h'] = round((intval($matches[5])/100)*25.1, 1);
498 497
 						if ($matches[6] != '...') $result['humidity'] = intval($matches[6]);
499
-						if ($matches[7] != '...') $result['pressure'] = round((intval($matches[7])/10),1);
500
-						$body_parse = substr($body_parse,strlen($matches[0]));
501
-					} elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3,4})r([0-9 \\.]{3})P([0-9 \\.]{3})p([0-9 \\.]{3})h([0-9 \\.]{2,3})b([0-9 \\.]{5})/',$body_parse,$matches)) {
502
-						if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1);
503
-						if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1);
504
-						if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1,1);
505
-						if ($matches[5] != '...') $result['precipitation'] = round((intval($matches[5])/100)*25.1,1);
506
-						if ($matches[4] != '...') $result['precipitation24h'] = round((intval($matches[4])/100)*25.1,1);
498
+						if ($matches[7] != '...') $result['pressure'] = round((intval($matches[7])/10), 1);
499
+						$body_parse = substr($body_parse, strlen($matches[0]));
500
+					} elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3,4})r([0-9 \\.]{3})P([0-9 \\.]{3})p([0-9 \\.]{3})h([0-9 \\.]{2,3})b([0-9 \\.]{5})/', $body_parse, $matches)) {
501
+						if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934, 1);
502
+						if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2])) - 32), 1);
503
+						if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1, 1);
504
+						if ($matches[5] != '...') $result['precipitation'] = round((intval($matches[5])/100)*25.1, 1);
505
+						if ($matches[4] != '...') $result['precipitation24h'] = round((intval($matches[4])/100)*25.1, 1);
507 506
 						if ($matches[6] != '...') $result['humidity'] = intval($matches[6]);
508
-						if ($matches[7] != '...') $result['pressure'] = round((intval($matches[7])/10),1);
509
-						$body_parse = substr($body_parse,strlen($matches[0]));
510
-					} elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})r([0-9 \\.]{3})p([0-9 \\.]{3})P([0-9 \\.]{3})b([0-9 \\.]{5})h([0-9 \\.]{2})/',$body_parse,$matches)) {
511
-						if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1);
512
-						if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1);
513
-						if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1,1);
514
-						if ($matches[4] != '...') $result['precipitation'] = round((intval($matches[4])/100)*25.1,1);
515
-						if ($matches[5] != '...') $result['precipitation24h'] = round((intval($matches[5])/100)*25.1,1);
507
+						if ($matches[7] != '...') $result['pressure'] = round((intval($matches[7])/10), 1);
508
+						$body_parse = substr($body_parse, strlen($matches[0]));
509
+					} elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})r([0-9 \\.]{3})p([0-9 \\.]{3})P([0-9 \\.]{3})b([0-9 \\.]{5})h([0-9 \\.]{2})/', $body_parse, $matches)) {
510
+						if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934, 1);
511
+						if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2])) - 32), 1);
512
+						if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1, 1);
513
+						if ($matches[4] != '...') $result['precipitation'] = round((intval($matches[4])/100)*25.1, 1);
514
+						if ($matches[5] != '...') $result['precipitation24h'] = round((intval($matches[5])/100)*25.1, 1);
516 515
 						if ($matches[7] != '...') $result['humidity'] = intval($matches[7]);
517
-						if ($matches[6] != '...') $result['pressure'] = round((intval($matches[6])/10),1);
518
-						$body_parse = substr($body_parse,strlen($matches[0]));
519
-					} elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})r([0-9 \\.]{3})P([0-9 \\.]{3})b([0-9 \\.]{5})h([0-9 \\.]{2})/',$body_parse,$matches)) {
520
-						if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1);
521
-						if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1);
522
-						if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1,1);
523
-						if ($matches[4] != '...') $result['precipitation24h'] = round((intval($matches[4])/100)*25.1,1);
516
+						if ($matches[6] != '...') $result['pressure'] = round((intval($matches[6])/10), 1);
517
+						$body_parse = substr($body_parse, strlen($matches[0]));
518
+					} elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})r([0-9 \\.]{3})P([0-9 \\.]{3})b([0-9 \\.]{5})h([0-9 \\.]{2})/', $body_parse, $matches)) {
519
+						if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934, 1);
520
+						if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2])) - 32), 1);
521
+						if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1, 1);
522
+						if ($matches[4] != '...') $result['precipitation24h'] = round((intval($matches[4])/100)*25.1, 1);
524 523
 						if ($matches[6] != '...') $result['humidity'] = intval($matches[6]);
525
-						if ($matches[5] != '...') $result['pressure'] = round((intval($matches[5])/10),1);
526
-						$body_parse = substr($body_parse,strlen($matches[0]));
527
-					} elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})r([0-9 \\.]{3})p([0-9 \\.]{3})b([0-9 \\.]{5})h([0-9 \\.]{2})/',$body_parse,$matches)) {
528
-						if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1);
529
-						if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1);
530
-						if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1,1);
531
-						if ($matches[4] != '...') $result['precipitation'] = round((intval($matches[4])/100)*25.1,1);
524
+						if ($matches[5] != '...') $result['pressure'] = round((intval($matches[5])/10), 1);
525
+						$body_parse = substr($body_parse, strlen($matches[0]));
526
+					} elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})r([0-9 \\.]{3})p([0-9 \\.]{3})b([0-9 \\.]{5})h([0-9 \\.]{2})/', $body_parse, $matches)) {
527
+						if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934, 1);
528
+						if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2])) - 32), 1);
529
+						if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1, 1);
530
+						if ($matches[4] != '...') $result['precipitation'] = round((intval($matches[4])/100)*25.1, 1);
532 531
 						if ($matches[6] != '...') $result['humidity'] = intval($matches[6]);
533
-						if ($matches[5] != '...') $result['pressure'] = round((intval($matches[5])/10),1);
534
-						$body_parse = substr($body_parse,strlen($matches[0]));
535
-					} elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})r([0-9 \\.]{3})p([0-9 \\.]{3})h([0-9 \\.]{2})b([0-9 \\.]{5})/',$body_parse,$matches)) {
536
-						if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1);
537
-						if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1);
538
-						if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1,1);
539
-						if ($matches[4] != '...') $result['precipitation'] = round((intval($matches[4])/100)*25.1,1);
532
+						if ($matches[5] != '...') $result['pressure'] = round((intval($matches[5])/10), 1);
533
+						$body_parse = substr($body_parse, strlen($matches[0]));
534
+					} elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})r([0-9 \\.]{3})p([0-9 \\.]{3})h([0-9 \\.]{2})b([0-9 \\.]{5})/', $body_parse, $matches)) {
535
+						if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934, 1);
536
+						if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2])) - 32), 1);
537
+						if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1, 1);
538
+						if ($matches[4] != '...') $result['precipitation'] = round((intval($matches[4])/100)*25.1, 1);
540 539
 						if ($matches[5] != '...') $result['humidity'] = intval($matches[5]);
541
-						if ($matches[6] != '...') $result['pressure'] = round((intval($matches[6])/10),1);
542
-						$body_parse = substr($body_parse,strlen($matches[0]));
543
-					} elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})h([0-9 \\.]{2})b([0-9 \\.]{5})/',$body_parse,$matches)) {
544
-						if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1);
545
-						if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1);
540
+						if ($matches[6] != '...') $result['pressure'] = round((intval($matches[6])/10), 1);
541
+						$body_parse = substr($body_parse, strlen($matches[0]));
542
+					} elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})h([0-9 \\.]{2})b([0-9 \\.]{5})/', $body_parse, $matches)) {
543
+						if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934, 1);
544
+						if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2])) - 32), 1);
546 545
 						if ($matches[2] != '...') $result['humidity'] = intval($matches[3]);
547
-						if ($matches[4] != '...') $result['pressure'] = round((intval($matches[4])/10),1);
548
-						$body_parse = substr($body_parse,strlen($matches[0]));
549
-					} elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})r([0-9 \\.]{2,3})h([0-9 \\.]{2})b([0-9 \\.]{5})/',$body_parse,$matches)) {
550
-						if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1);
551
-						if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1);
552
-						if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1,1);
546
+						if ($matches[4] != '...') $result['pressure'] = round((intval($matches[4])/10), 1);
547
+						$body_parse = substr($body_parse, strlen($matches[0]));
548
+					} elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})r([0-9 \\.]{2,3})h([0-9 \\.]{2})b([0-9 \\.]{5})/', $body_parse, $matches)) {
549
+						if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934, 1);
550
+						if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2])) - 32), 1);
551
+						if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1, 1);
553 552
 						if ($matches[4] != '...') $result['humidity'] = intval($matches[4]);
554
-						if ($matches[5] != '...') $result['pressure'] = round((intval($matches[5])/10),1);
555
-						$body_parse = substr($body_parse,strlen($matches[0]));
553
+						if ($matches[5] != '...') $result['pressure'] = round((intval($matches[5])/10), 1);
554
+						$body_parse = substr($body_parse, strlen($matches[0]));
556 555
 					}
557 556
 					$result['comment'] = trim($body_parse);
558 557
 				}
559 558
 			} else $result['comment'] = trim($body_parse);
560 559
 		}
561
-		if (isset($result['latitude'])) $result['latitude'] = round($result['latitude'],4);
562
-		if (isset($result['longitude'])) $result['longitude'] = round($result['longitude'],4);
560
+		if (isset($result['latitude'])) $result['latitude'] = round($result['latitude'], 4);
561
+		if (isset($result['longitude'])) $result['longitude'] = round($result['longitude'], 4);
563 562
 		if ($debug) print_r($result);
564 563
 		return $result;
565 564
 	}
@@ -568,34 +567,34 @@  discard block
 block discarded – undo
568 567
 	 * Connect to APRS server
569 568
 	*/
570 569
 	public function connect() {
571
-		global $globalAPRSversion, $globalServerAPRSssid, $globalServerAPRSpass,$globalName, $globalServerAPRShost, $globalServerAPRSport;
570
+		global $globalAPRSversion, $globalServerAPRSssid, $globalServerAPRSpass, $globalName, $globalServerAPRShost, $globalServerAPRSport;
572 571
 		$aprs_connect = 0;
573 572
 		$aprs_keep = 120;
574 573
 		$aprs_last_tx = time();
575 574
 		if (isset($globalAPRSversion)) $aprs_version = $globalAPRSversion;
576
-		else $aprs_version = 'FlightAirMap '.str_replace(' ','_',$globalName);
575
+		else $aprs_version = 'FlightAirMap '.str_replace(' ', '_', $globalName);
577 576
 		if (isset($globalServerAPRSssid)) $aprs_ssid = $globalServerAPRSssid;
578
-		else $aprs_ssid = substr('FAM'.strtoupper(str_replace(' ','_',$globalName)),0,8);
577
+		else $aprs_ssid = substr('FAM'.strtoupper(str_replace(' ', '_', $globalName)), 0, 8);
579 578
 		if (isset($globalServerAPRSpass)) $aprs_pass = $globalServerAPRSpass;
580 579
 		else $aprs_pass = '-1';
581
-		$aprs_filter  = '';
580
+		$aprs_filter = '';
582 581
 		$aprs_login = "user {$aprs_ssid} pass {$aprs_pass} vers {$aprs_version}\n";
583 582
 		$Common = new Common();
584
-		$s = $Common->create_socket($globalServerAPRShost,$globalServerAPRSport,$errno,$errstr);
583
+		$s = $Common->create_socket($globalServerAPRShost, $globalServerAPRSport, $errno, $errstr);
585 584
 		if ($s !== false) {
586 585
 			echo 'Connected to APRS server! '."\n";
587 586
 			$authstart = time();
588 587
 			$this->socket = $s;
589
-			$send = socket_send( $this->socket  , $aprs_login , strlen($aprs_login) , 0 );
590
-			socket_set_option($this->socket,SOL_SOCKET,SO_KEEPALIVE,1);
591
-			while ($msgin = socket_read($this->socket, 1000,PHP_NORMAL_READ)) {
588
+			$send = socket_send($this->socket, $aprs_login, strlen($aprs_login), 0);
589
+			socket_set_option($this->socket, SOL_SOCKET, SO_KEEPALIVE, 1);
590
+			while ($msgin = socket_read($this->socket, 1000, PHP_NORMAL_READ)) {
592 591
 				if (strpos($msgin, "$aprs_ssid verified") !== FALSE) {
593 592
 					echo 'APRS user verified !'."\n";
594 593
 					$this->connected = true;
595 594
 					return true;
596 595
 					break;
597 596
 				}
598
-				if (time()-$authstart > 5) {
597
+				if (time() - $authstart > 5) {
599 598
 					echo 'APRS timeout'."\n";
600 599
 					break;
601 600
 				}
@@ -617,7 +616,7 @@  discard block
 block discarded – undo
617 616
 	public function send($data) {
618 617
 		global $globalDebug;
619 618
 		if ($this->connected === false) $this->connect();
620
-		$send = socket_send( $this->socket  , $data , strlen($data),0);
619
+		$send = socket_send($this->socket, $data, strlen($data), 0);
621 620
 		if ($send === FALSE) {
622 621
 			if ($globalDebug) echo 'Reconnect...';
623 622
 			socket_close($this->socket);
@@ -627,17 +626,17 @@  discard block
 block discarded – undo
627 626
 }
628 627
 
629 628
 class APRSSpotter extends APRS {
630
-	public function addLiveSpotterData($id,$ident,$aircraft_icao,$departure_airport,$arrival_airport,$latitude,$longitude,$waypoints,$altitude,$altitude_real,$heading,$speed,$datetime,$departure_airport_time,$arrival_airport_time,$squawk,$route_stop,$hex,$putinarchive,$registration,$pilot_id,$pilot_name, $verticalrate, $noarchive, $ground,$format_source,$source_name,$over_country) {
629
+	public function addLiveSpotterData($id, $ident, $aircraft_icao, $departure_airport, $arrival_airport, $latitude, $longitude, $waypoints, $altitude, $altitude_real, $heading, $speed, $datetime, $departure_airport_time, $arrival_airport_time, $squawk, $route_stop, $hex, $putinarchive, $registration, $pilot_id, $pilot_name, $verticalrate, $noarchive, $ground, $format_source, $source_name, $over_country) {
631 630
 		$Common = new Common();
632 631
 		date_default_timezone_set('UTC');
633 632
 		if ($latitude != '' && $longitude != '') {
634 633
 			$lat = $latitude;
635 634
 			$long = $longitude;
636
-			$latitude = $Common->convertDM($latitude,'latitude');
637
-			$longitude = $Common->convertDM($longitude,'longitude');
638
-			$coordinate = sprintf("%02d",$latitude['deg']).str_pad(number_format($latitude['min'],2,'.',''),5,'0',STR_PAD_LEFT).$latitude['NSEW'].'/'.sprintf("%03d",$longitude['deg']).str_pad(number_format($longitude['min'],2,'.',''),5,'0',STR_PAD_LEFT).$longitude['NSEW'];
639
-			$w1 = abs(ceil(($latitude['min'] - number_format($latitude['min'],2,'.',''))*1000));
640
-			$w2 = abs(ceil(($longitude['min'] - number_format($longitude['min'],2,'.',''))*1000));
635
+			$latitude = $Common->convertDM($latitude, 'latitude');
636
+			$longitude = $Common->convertDM($longitude, 'longitude');
637
+			$coordinate = sprintf("%02d", $latitude['deg']).str_pad(number_format($latitude['min'], 2, '.', ''), 5, '0', STR_PAD_LEFT).$latitude['NSEW'].'/'.sprintf("%03d", $longitude['deg']).str_pad(number_format($longitude['min'], 2, '.', ''), 5, '0', STR_PAD_LEFT).$longitude['NSEW'];
638
+			$w1 = abs(ceil(($latitude['min'] - number_format($latitude['min'], 2, '.', ''))*1000));
639
+			$w2 = abs(ceil(($longitude['min'] - number_format($longitude['min'], 2, '.', ''))*1000));
641 640
 			$w = $w1.$w2;
642 641
 			//$w = '00';
643 642
 			$custom = '';
@@ -664,26 +663,26 @@  discard block
 block discarded – undo
664 663
 			$geoid= round($GeoidClass->get($lat,$long)*3.28084,2);
665 664
 			$altitude_real = round($altitude_real + $geoid);
666 665
 			*/
667
-			$this->send('AIRCRAFT>APRS,TCPIP*:;'.$hex.'   *'.date('His',strtotime($datetime)).'h'.$coordinate.'^'.str_pad($heading,3,'0',STR_PAD_LEFT).'/'.str_pad($speed,3,'0',STR_PAD_LEFT).'/A='.str_pad($altitude_real,6,'0',STR_PAD_LEFT).' !W'.$w.'!'.$custom."\n");
666
+			$this->send('AIRCRAFT>APRS,TCPIP*:;'.$hex.'   *'.date('His', strtotime($datetime)).'h'.$coordinate.'^'.str_pad($heading, 3, '0', STR_PAD_LEFT).'/'.str_pad($speed, 3, '0', STR_PAD_LEFT).'/A='.str_pad($altitude_real, 6, '0', STR_PAD_LEFT).' !W'.$w.'!'.$custom."\n");
668 667
 		}
669 668
 	}
670 669
 }
671 670
 class APRSMarine extends APRS {
672
-	public function addLiveMarineData($id, $ident, $latitude, $longitude, $heading, $speed,$datetime, $putinarchive,$mmsi,$type,$typeid,$imo,$callsign,$arrival_code,$arrival_date,$status,$statusid,$noarchive,$format_source,$source_name,$over_country) {
671
+	public function addLiveMarineData($id, $ident, $latitude, $longitude, $heading, $speed, $datetime, $putinarchive, $mmsi, $type, $typeid, $imo, $callsign, $arrival_code, $arrival_date, $status, $statusid, $noarchive, $format_source, $source_name, $over_country) {
673 672
 		$Common = new Common();
674 673
 		date_default_timezone_set('UTC');
675 674
 		if ($latitude != '' && $longitude != '') {
676
-			$latitude = $Common->convertDM($latitude,'latitude');
677
-			$longitude = $Common->convertDM($longitude,'longitude');
678
-			$coordinate = sprintf("%02d",$latitude['deg']).str_pad(number_format($latitude['min'],2,'.',''),5,'0',STR_PAD_LEFT).$latitude['NSEW'].'/'.sprintf("%03d",$longitude['deg']).str_pad(number_format($longitude['min'],2,'.',''),5,'0',STR_PAD_LEFT).$longitude['NSEW'];
679
-			$w1 = abs(ceil(($latitude['min'] - number_format($latitude['min'],2,'.',''))*1000));
680
-			$w2 = abs(ceil(($longitude['min'] - number_format($longitude['min'],2,'.',''))*1000));
675
+			$latitude = $Common->convertDM($latitude, 'latitude');
676
+			$longitude = $Common->convertDM($longitude, 'longitude');
677
+			$coordinate = sprintf("%02d", $latitude['deg']).str_pad(number_format($latitude['min'], 2, '.', ''), 5, '0', STR_PAD_LEFT).$latitude['NSEW'].'/'.sprintf("%03d", $longitude['deg']).str_pad(number_format($longitude['min'], 2, '.', ''), 5, '0', STR_PAD_LEFT).$longitude['NSEW'];
678
+			$w1 = abs(ceil(($latitude['min'] - number_format($latitude['min'], 2, '.', ''))*1000));
679
+			$w2 = abs(ceil(($longitude['min'] - number_format($longitude['min'], 2, '.', ''))*1000));
681 680
 			$w = $w1.$w2;
682 681
 			//$w = '00';
683 682
 			$custom = '';
684 683
 			if ($ident != '') {
685 684
 				if ($custom != '') $custom .= '/';
686
-				$custom .= 'CS='.str_replace(' ','_',$ident);
685
+				$custom .= 'CS='.str_replace(' ', '_', $ident);
687 686
 			}
688 687
 			if ($typeid != '') {
689 688
 				if ($custom != '') $custom .= '/';
@@ -703,11 +702,11 @@  discard block
 block discarded – undo
703 702
 			}
704 703
 			if ($arrival_code != '') {
705 704
 				if ($custom != '') $custom .= '/';
706
-				$custom .= 'AC='.str_replace(' ','_',$arrival_code);
705
+				$custom .= 'AC='.str_replace(' ', '_', $arrival_code);
707 706
 			}
708 707
 			if ($custom != '') $custom = ' '.$custom;
709 708
 			$altitude = 0;
710
-			$this->send('MARINE>APRS,TCPIP*:;'.$mmsi.'*'.date('His',strtotime($datetime)).'h'.$coordinate.'s'.str_pad($heading,3,'0',STR_PAD_LEFT).'/'.str_pad($speed,3,'0',STR_PAD_LEFT).'/A='.str_pad($altitude,6,'0',STR_PAD_LEFT).' !W'.$w.'!'.$custom."\n");
709
+			$this->send('MARINE>APRS,TCPIP*:;'.$mmsi.'*'.date('His', strtotime($datetime)).'h'.$coordinate.'s'.str_pad($heading, 3, '0', STR_PAD_LEFT).'/'.str_pad($speed, 3, '0', STR_PAD_LEFT).'/A='.str_pad($altitude, 6, '0', STR_PAD_LEFT).' !W'.$w.'!'.$custom."\n");
711 710
 		}
712 711
 	}
713 712
 }
Please login to merge, or discard this patch.
require/class.SpotterLive.php 1 patch
Spacing   +132 added lines, -132 removed lines patch added patch discarded remove patch
@@ -17,62 +17,62 @@  discard block
 block discarded – undo
17 17
 	* @param Array $filter the filter
18 18
 	* @return Array the SQL part
19 19
 	*/
20
-	public function getFilter($filter = array(),$where = false,$and = false) {
20
+	public function getFilter($filter = array(), $where = false, $and = false) {
21 21
 		global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver;
22 22
 		$filters = array();
23 23
 		if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) {
24 24
 			if (isset($globalStatsFilters[$globalFilterName][0]['source'])) {
25 25
 				$filters = $globalStatsFilters[$globalFilterName];
26 26
 			} else {
27
-				$filter = array_merge($filter,$globalStatsFilters[$globalFilterName]);
27
+				$filter = array_merge($filter, $globalStatsFilters[$globalFilterName]);
28 28
 			}
29 29
 		}
30 30
 		if (isset($filter[0]['source'])) {
31
-			$filters = array_merge($filters,$filter);
31
+			$filters = array_merge($filters, $filter);
32 32
 		}
33
-		if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter);
33
+		if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter);
34 34
 		$filter_query_join = '';
35 35
 		$filter_query_where = '';
36
-		foreach($filters as $flt) {
36
+		foreach ($filters as $flt) {
37 37
 			if (isset($flt['airlines']) && !empty($flt['airlines'])) {
38 38
 				if ($flt['airlines'][0] != '' && $flt['airlines'][0] != 'all') {
39 39
 					if (isset($flt['source'])) {
40
-						$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$flt['airlines'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) saf ON saf.flightaware_id = spotter_live.flightaware_id";
40
+						$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $flt['airlines'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) saf ON saf.flightaware_id = spotter_live.flightaware_id";
41 41
 					} else {
42
-						$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$flt['airlines'])."')) saf ON saf.flightaware_id = spotter_live.flightaware_id";
42
+						$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $flt['airlines'])."')) saf ON saf.flightaware_id = spotter_live.flightaware_id";
43 43
 					}
44 44
 				}
45 45
 			}
46 46
 			if (isset($flt['pilots_id']) && !empty($flt['pilots_id'])) {
47 47
 				if (isset($flt['source'])) {
48
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) spi ON spi.flightaware_id = spotter_live.flightaware_id";
48
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $flt['pilots_id'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) spi ON spi.flightaware_id = spotter_live.flightaware_id";
49 49
 				} else {
50
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."')) spi ON spi.flightaware_id = spotter_live.flightaware_id";
50
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $flt['pilots_id'])."')) spi ON spi.flightaware_id = spotter_live.flightaware_id";
51 51
 				}
52 52
 			}
53 53
 			if (isset($flt['idents']) && !empty($flt['idents'])) {
54 54
 				if (isset($flt['source'])) {
55
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.ident IN ('".implode("','",$flt['idents'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) spid ON spid.flightaware_id = spotter_live.flightaware_id";
55
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.ident IN ('".implode("','", $flt['idents'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) spid ON spid.flightaware_id = spotter_live.flightaware_id";
56 56
 				} else {
57
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.ident IN ('".implode("','",$flt['idents'])."')) spid ON spid.flightaware_id = spotter_live.flightaware_id";
57
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.ident IN ('".implode("','", $flt['idents'])."')) spid ON spid.flightaware_id = spotter_live.flightaware_id";
58 58
 				}
59 59
 			}
60 60
 			if (isset($flt['registrations']) && !empty($flt['registrations'])) {
61 61
 				if (isset($flt['source'])) {
62
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.registration IN ('".implode("','",$flt['registrations'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) sre ON sre.flightaware_id = spotter_live.flightaware_id";
62
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.registration IN ('".implode("','", $flt['registrations'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) sre ON sre.flightaware_id = spotter_live.flightaware_id";
63 63
 				} else {
64
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.registration IN ('".implode("','",$flt['registrations'])."')) sre ON sre.flightaware_id = spotter_live.flightaware_id";
64
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.registration IN ('".implode("','", $flt['registrations'])."')) sre ON sre.flightaware_id = spotter_live.flightaware_id";
65 65
 				}
66 66
 			}
67 67
 			if ((isset($flt['airlines']) && empty($flt['airlines']) && isset($flt['pilots_id']) && empty($flt['pilots_id']) && isset($flt['idents']) && empty($flt['idents'])) || (!isset($flt['airlines']) && !isset($flt['pilots_id']) && !isset($flt['idents']) && !isset($flt['registrations']))) {
68 68
 				if (isset($flt['source'])) {
69
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.format_source IN ('".implode("','",$flt['source'])."')) ssf ON ssf.flightaware_id = spotter_live.flightaware_id";
69
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.format_source IN ('".implode("','", $flt['source'])."')) ssf ON ssf.flightaware_id = spotter_live.flightaware_id";
70 70
 				}
71 71
 			}
72 72
 		}
73 73
 		if (isset($filter['airlines']) && !empty($filter['airlines'])) {
74 74
 			if ($filter['airlines'][0] != '' && $filter['airlines'][0] != 'all') {
75
-				$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) sai ON sai.flightaware_id = spotter_live.flightaware_id";
75
+				$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) sai ON sai.flightaware_id = spotter_live.flightaware_id";
76 76
 			}
77 77
 		}
78 78
 		if (isset($filter['alliance']) && !empty($filter['alliance'])) {
@@ -82,13 +82,13 @@  discard block
 block discarded – undo
82 82
 			$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_live.flightaware_id ";
83 83
 		}
84 84
 		if (isset($filter['pilots_id']) && !empty($filter['pilots_id'])) {
85
-			$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$filter['pilots_id'])."')) sp ON sp.flightaware_id = spotter_live.flightaware_id";
85
+			$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $filter['pilots_id'])."')) sp ON sp.flightaware_id = spotter_live.flightaware_id";
86 86
 		}
87 87
 		if (isset($filter['source']) && !empty($filter['source'])) {
88 88
 			if (count($filter['source']) == 1) {
89 89
 				$filter_query_where .= " AND format_source = '".$filter['source'][0]."'";
90 90
 			} else {
91
-				$filter_query_where .= " AND format_source IN ('".implode("','",$filter['source'])."')";
91
+				$filter_query_where .= " AND format_source IN ('".implode("','", $filter['source'])."')";
92 92
 			}
93 93
 		}
94 94
 		if (isset($filter['ident']) && !empty($filter['ident'])) {
@@ -118,15 +118,15 @@  discard block
 block discarded – undo
118 118
 					$filter_query_date .= " AND EXTRACT(DAY FROM spotter_output.date) = '".$filter['day']."'";
119 119
 				}
120 120
 			}
121
-			$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";
121
+			$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";
122 122
 		}
123 123
 		if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
124
-			$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
124
+			$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')";
125 125
 		}
126 126
 		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
127 127
 		elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND';
128 128
 		if ($filter_query_where != '') {
129
-			$filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where);
129
+			$filter_query_where = preg_replace('/^ AND/', ' WHERE', $filter_query_where);
130 130
 		}
131 131
 		$filter_query = $filter_query_join.$filter_query_where;
132 132
 		return $filter_query;
@@ -149,8 +149,8 @@  discard block
 block discarded – undo
149 149
 		if ($limit != '')
150 150
 		{
151 151
 			$limit_array = explode(',', $limit);
152
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
153
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
152
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
153
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
154 154
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
155 155
 			{
156 156
 				$limit_query = ' LIMIT '.$limit_array[1].' OFFSET '.$limit_array[0];
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
 		} else {
175 175
 			$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;
176 176
 		}
177
-		$spotter_array = $Spotter->getDataFromDB($query.$limit_query,array(),'',true);
177
+		$spotter_array = $Spotter->getDataFromDB($query.$limit_query, array(), '', true);
178 178
 
179 179
 		return $spotter_array;
180 180
 	}
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
 	{
190 190
 		global $globalDBdriver, $globalLiveInterval, $globalArchive;
191 191
 		date_default_timezone_set('UTC');
192
-		$filter_query = $this->getFilter($filter,true,true);
192
+		$filter_query = $this->getFilter($filter, true, true);
193 193
 		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
194 194
 		if ($globalDBdriver == 'mysql') {
195 195
 			if (isset($globalArchive) && $globalArchive === TRUE) {
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
 		try {
213 213
 			$sth = $this->db->prepare($query);
214 214
 			$sth->execute();
215
-		} catch(PDOException $e) {
215
+		} catch (PDOException $e) {
216 216
 			echo $e->getMessage();
217 217
 			die;
218 218
 		}
@@ -226,19 +226,19 @@  discard block
 block discarded – undo
226 226
 	* @return Array the spotter information
227 227
 	*
228 228
 	*/
229
-	public function getMinLastLiveSpotterData($coord = array(),$filter = array(), $limit = false)
229
+	public function getMinLastLiveSpotterData($coord = array(), $filter = array(), $limit = false)
230 230
 	{
231 231
 		global $globalDBdriver, $globalLiveInterval, $globalArchive, $globalMap3DAircraftsLimit;
232 232
 		date_default_timezone_set('UTC');
233 233
 		$usecoord = false;
234 234
 		if (is_array($coord) && !empty($coord)) {
235
-			$minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
236
-			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
237
-			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
238
-			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
235
+			$minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
236
+			$minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
237
+			$maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
238
+			$maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
239 239
 			$usecoord = true;
240 240
 		}
241
-		$filter_query = $this->getFilter($filter,true,true);
241
+		$filter_query = $this->getFilter($filter, true, true);
242 242
 
243 243
 		if (!isset($globalLiveInterval) || $globalLiveInterval == '') $globalLiveInterval = '200';
244 244
 		if (!isset($globalMap3DAircraftsLimit) || $globalMap3DAircraftsLimit == '') $globalMap3DAircraftsLimit = '300';
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
 		try {
300 300
 			$sth = $this->db->prepare($query);
301 301
 			$sth->execute();
302
-		} catch(PDOException $e) {
302
+		} catch (PDOException $e) {
303 303
 			echo $e->getMessage();
304 304
 			die;
305 305
 		}
@@ -316,7 +316,7 @@  discard block
 block discarded – undo
316 316
 	public function getLiveSpotterCount($filter = array())
317 317
 	{
318 318
 		global $globalDBdriver, $globalLiveInterval;
319
-		$filter_query = $this->getFilter($filter,true,true);
319
+		$filter_query = $this->getFilter($filter, true, true);
320 320
 
321 321
 		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
322 322
 		if ($globalDBdriver == 'mysql') {
@@ -329,7 +329,7 @@  discard block
 block discarded – undo
329 329
 		try {
330 330
 			$sth = $this->db->prepare($query);
331 331
 			$sth->execute();
332
-		} catch(PDOException $e) {
332
+		} catch (PDOException $e) {
333 333
 			echo $e->getMessage();
334 334
 			die;
335 335
 		}
@@ -352,10 +352,10 @@  discard block
 block discarded – undo
352 352
 		$filter_query = $this->getFilter($filter);
353 353
 
354 354
 		if (is_array($coord)) {
355
-			$minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
356
-			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
357
-			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
358
-			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
355
+			$minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
356
+			$minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
357
+			$maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
358
+			$maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
359 359
 		} else return array();
360 360
 		if ($globalDBdriver == 'mysql') {
361 361
 			$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;
@@ -378,23 +378,23 @@  discard block
 block discarded – undo
378 378
 		global $globalDBdriver, $globalLiveInterval, $globalArchive;
379 379
 		$Spotter = new Spotter($this->db);
380 380
 		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
381
-		$filter_query = $this->getFilter($filter,true,true);
381
+		$filter_query = $this->getFilter($filter, true, true);
382 382
 
383 383
 		if (is_array($coord)) {
384
-			$minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
385
-			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
386
-			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
387
-			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
384
+			$minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
385
+			$minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
386
+			$maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
387
+			$maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
388 388
 		} else return array();
389 389
 		if ($globalDBdriver == 'mysql') {
390 390
 			if (isset($globalArchive) && $globalArchive === TRUE) {
391
-				$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 
391
+				$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 
392 392
 				FROM spotter_live 
393 393
 				'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= spotter_live.date 
394 394
 				AND spotter_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND spotter_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.'
395 395
 				AND spotter_live.latitude <> 0 AND spotter_live.longitude <> 0';
396 396
 			} else {
397
-				$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 
397
+				$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 
398 398
 				FROM spotter_live 
399 399
 				INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate 
400 400
 				    FROM spotter_live l 
@@ -406,14 +406,14 @@  discard block
 block discarded – undo
406 406
 			}
407 407
 		} else {
408 408
 			if (isset($globalArchive) && $globalArchive === TRUE) {
409
-				$query  = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
409
+				$query = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
410 410
 				FROM spotter_live 
411 411
 				".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= spotter_live.date 
412 412
 				AND spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." 
413 413
 				AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong." 
414 414
 				AND spotter_live.latitude <> '0' AND spotter_live.longitude <> '0'";
415 415
 			} else {
416
-				$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 
416
+				$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 
417 417
 				FROM spotter_live 
418 418
 				INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate 
419 419
 				    FROM spotter_live l 
@@ -428,7 +428,7 @@  discard block
 block discarded – undo
428 428
 		try {
429 429
 			$sth = $this->db->prepare($query);
430 430
 			$sth->execute();
431
-		} catch(PDOException $e) {
431
+		} catch (PDOException $e) {
432 432
 			echo $e->getMessage();
433 433
 			die;
434 434
 		}
@@ -477,7 +477,7 @@  discard block
 block discarded – undo
477 477
                 if ($interval == '1m')
478 478
                 {
479 479
                     $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';
480
-                } else if ($interval == '15m'){
480
+                } else if ($interval == '15m') {
481 481
                     $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= spotter_live.date ';
482 482
                 } 
483 483
             }
@@ -485,14 +485,14 @@  discard block
 block discarded – undo
485 485
          $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';   
486 486
         }
487 487
 
488
-                $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 
488
+                $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 
489 489
                    WHERE spotter_live.latitude <> '' 
490 490
                                    AND spotter_live.longitude <> '' 
491 491
                    ".$additional_query."
492 492
                    HAVING distance < :radius  
493 493
                                    ORDER BY distance";
494 494
 
495
-                $spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius));
495
+                $spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng, ':radius' => $radius));
496 496
 
497 497
                 return $spotter_array;
498 498
         }
@@ -510,9 +510,9 @@  discard block
 block discarded – undo
510 510
 		date_default_timezone_set('UTC');
511 511
 
512 512
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
513
-                $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';
513
+                $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';
514 514
 
515
-		$spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident),'',true);
515
+		$spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident), '', true);
516 516
 
517 517
 		return $spotter_array;
518 518
 	}
@@ -523,16 +523,16 @@  discard block
 block discarded – undo
523 523
 	* @return Array the spotter information
524 524
 	*
525 525
 	*/
526
-	public function getDateLiveSpotterDataByIdent($ident,$date)
526
+	public function getDateLiveSpotterDataByIdent($ident, $date)
527 527
 	{
528 528
 		$Spotter = new Spotter($this->db);
529 529
 		date_default_timezone_set('UTC');
530 530
 
531 531
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
532
-                $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';
532
+                $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';
533 533
 
534
-                $date = date('c',$date);
535
-		$spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident,':date' => $date));
534
+                $date = date('c', $date);
535
+		$spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident, ':date' => $date));
536 536
 
537 537
 		return $spotter_array;
538 538
 	}
@@ -548,8 +548,8 @@  discard block
 block discarded – undo
548 548
 		$Spotter = new Spotter($this->db);
549 549
 		date_default_timezone_set('UTC');
550 550
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
551
-		$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';
552
-		$spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id),'',true);
551
+		$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';
552
+		$spotter_array = $Spotter->getDataFromDB($query, array(':id' => $id), '', true);
553 553
 		return $spotter_array;
554 554
 	}
555 555
 
@@ -559,15 +559,15 @@  discard block
 block discarded – undo
559 559
 	* @return Array the spotter information
560 560
 	*
561 561
 	*/
562
-	public function getDateLiveSpotterDataById($id,$date)
562
+	public function getDateLiveSpotterDataById($id, $date)
563 563
 	{
564 564
 		$Spotter = new Spotter($this->db);
565 565
 		date_default_timezone_set('UTC');
566 566
 
567 567
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
568
-		$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';
569
-		$date = date('c',$date);
570
-		$spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id,':date' => $date),'',true);
568
+		$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';
569
+		$date = date('c', $date);
570
+		$spotter_array = $Spotter->getDataFromDB($query, array(':id' => $id, ':date' => $date), '', true);
571 571
 		return $spotter_array;
572 572
 	}
573 573
 
@@ -583,13 +583,13 @@  discard block
 block discarded – undo
583 583
 		date_default_timezone_set('UTC');
584 584
 
585 585
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
586
-                $query  = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident';
586
+                $query = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident';
587 587
 
588 588
     		try {
589 589
 			
590 590
 			$sth = $this->db->prepare($query);
591 591
 			$sth->execute(array(':ident' => $ident));
592
-		} catch(PDOException $e) {
592
+		} catch (PDOException $e) {
593 593
 			echo $e->getMessage();
594 594
 			die;
595 595
 		}
@@ -604,7 +604,7 @@  discard block
 block discarded – undo
604 604
 	* @return Array the spotter information
605 605
 	*
606 606
 	*/
607
-	public function getAllLiveSpotterDataById($id,$liveinterval = false)
607
+	public function getAllLiveSpotterDataById($id, $liveinterval = false)
608 608
 	{
609 609
 		global $globalDBdriver, $globalLiveInterval;
610 610
 		date_default_timezone_set('UTC');
@@ -623,7 +623,7 @@  discard block
 block discarded – undo
623 623
 		try {
624 624
 			$sth = $this->db->prepare($query);
625 625
 			$sth->execute(array(':id' => $id));
626
-		} catch(PDOException $e) {
626
+		} catch (PDOException $e) {
627 627
 			echo $e->getMessage();
628 628
 			die;
629 629
 		}
@@ -641,12 +641,12 @@  discard block
 block discarded – undo
641 641
 	{
642 642
 		date_default_timezone_set('UTC');
643 643
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
644
-		$query  = self::$global_query.' WHERE spotter_live.ident = :ident';
644
+		$query = self::$global_query.' WHERE spotter_live.ident = :ident';
645 645
     		try {
646 646
 			
647 647
 			$sth = $this->db->prepare($query);
648 648
 			$sth->execute(array(':ident' => $ident));
649
-		} catch(PDOException $e) {
649
+		} catch (PDOException $e) {
650 650
 			echo $e->getMessage();
651 651
 			die;
652 652
 		}
@@ -676,7 +676,7 @@  discard block
 block discarded – undo
676 676
 			
677 677
 			$sth = $this->db->prepare($query);
678 678
 			$sth->execute();
679
-		} catch(PDOException $e) {
679
+		} catch (PDOException $e) {
680 680
 			return "error";
681 681
 		}
682 682
 
@@ -699,14 +699,14 @@  discard block
 block discarded – undo
699 699
 				
700 700
 				$sth = $this->db->prepare($query);
701 701
 				$sth->execute();
702
-			} catch(PDOException $e) {
702
+			} catch (PDOException $e) {
703 703
 				return "error";
704 704
 			}
705 705
 			$query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN (';
706 706
                         $i = 0;
707
-                        $j =0;
707
+                        $j = 0;
708 708
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
709
-			foreach($all as $row)
709
+			foreach ($all as $row)
710 710
 			{
711 711
 				$i++;
712 712
 				$j++;
@@ -714,9 +714,9 @@  discard block
 block discarded – undo
714 714
 					if ($globalDebug) echo ".";
715 715
 				    	try {
716 716
 						
717
-						$sth = $this->db->prepare(substr($query_delete,0,-1).")");
717
+						$sth = $this->db->prepare(substr($query_delete, 0, -1).")");
718 718
 						$sth->execute();
719
-					} catch(PDOException $e) {
719
+					} catch (PDOException $e) {
720 720
 						return "error";
721 721
 					}
722 722
                                 	$query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN (';
@@ -727,9 +727,9 @@  discard block
 block discarded – undo
727 727
 			if ($i > 0) {
728 728
     				try {
729 729
 					
730
-					$sth = $this->db->prepare(substr($query_delete,0,-1).")");
730
+					$sth = $this->db->prepare(substr($query_delete, 0, -1).")");
731 731
 					$sth->execute();
732
-				} catch(PDOException $e) {
732
+				} catch (PDOException $e) {
733 733
 					return "error";
734 734
 				}
735 735
 			}
@@ -742,7 +742,7 @@  discard block
 block discarded – undo
742 742
 				
743 743
 				$sth = $this->db->prepare($query);
744 744
 				$sth->execute();
745
-			} catch(PDOException $e) {
745
+			} catch (PDOException $e) {
746 746
 				return "error";
747 747
 			}
748 748
 /*			$query_delete = "DELETE FROM spotter_live WHERE flightaware_id IN (";
@@ -790,13 +790,13 @@  discard block
 block discarded – undo
790 790
 	public function deleteLiveSpotterDataByIdent($ident)
791 791
 	{
792 792
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
793
-		$query  = 'DELETE FROM spotter_live WHERE ident = :ident';
793
+		$query = 'DELETE FROM spotter_live WHERE ident = :ident';
794 794
         
795 795
     		try {
796 796
 			
797 797
 			$sth = $this->db->prepare($query);
798 798
 			$sth->execute(array(':ident' => $ident));
799
-		} catch(PDOException $e) {
799
+		} catch (PDOException $e) {
800 800
 			return "error";
801 801
 		}
802 802
 
@@ -812,13 +812,13 @@  discard block
 block discarded – undo
812 812
 	public function deleteLiveSpotterDataById($id)
813 813
 	{
814 814
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
815
-		$query  = 'DELETE FROM spotter_live WHERE flightaware_id = :id';
815
+		$query = 'DELETE FROM spotter_live WHERE flightaware_id = :id';
816 816
         
817 817
     		try {
818 818
 			
819 819
 			$sth = $this->db->prepare($query);
820 820
 			$sth->execute(array(':id' => $id));
821
-		} catch(PDOException $e) {
821
+		} catch (PDOException $e) {
822 822
 			return "error";
823 823
 		}
824 824
 
@@ -836,13 +836,13 @@  discard block
 block discarded – undo
836 836
 	{
837 837
 		global $globalDBdriver, $globalTimezone;
838 838
 		if ($globalDBdriver == 'mysql') {
839
-			$query  = 'SELECT spotter_live.ident FROM spotter_live 
839
+			$query = 'SELECT spotter_live.ident FROM spotter_live 
840 840
 				WHERE spotter_live.ident = :ident 
841 841
 				AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) 
842 842
 				AND spotter_live.date < UTC_TIMESTAMP()';
843 843
 			$query_data = array(':ident' => $ident);
844 844
 		} else {
845
-			$query  = "SELECT spotter_live.ident FROM spotter_live 
845
+			$query = "SELECT spotter_live.ident FROM spotter_live 
846 846
 				WHERE spotter_live.ident = :ident 
847 847
 				AND spotter_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS'
848 848
 				AND spotter_live.date < now() AT TIME ZONE 'UTC'";
@@ -851,8 +851,8 @@  discard block
 block discarded – undo
851 851
 		
852 852
 		$sth = $this->db->prepare($query);
853 853
 		$sth->execute($query_data);
854
-		$ident_result='';
855
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
854
+		$ident_result = '';
855
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
856 856
 		{
857 857
 			$ident_result = $row['ident'];
858 858
 		}
@@ -869,13 +869,13 @@  discard block
 block discarded – undo
869 869
 	{
870 870
 		global $globalDBdriver, $globalTimezone;
871 871
 		if ($globalDBdriver == 'mysql') {
872
-			$query  = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
872
+			$query = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
873 873
 				WHERE spotter_live.ident = :ident 
874 874
 				AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 20 MINUTE)'; 
875 875
 //				AND spotter_live.date < UTC_TIMESTAMP()";
876 876
 			$query_data = array(':ident' => $ident);
877 877
 		} else {
878
-			$query  = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
878
+			$query = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
879 879
 				WHERE spotter_live.ident = :ident 
880 880
 				AND spotter_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '20 MINUTES'";
881 881
 //				AND spotter_live.date < now() AT TIME ZONE 'UTC'";
@@ -884,8 +884,8 @@  discard block
 block discarded – undo
884 884
 		
885 885
 		$sth = $this->db->prepare($query);
886 886
 		$sth->execute($query_data);
887
-		$ident_result='';
888
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
887
+		$ident_result = '';
888
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
889 889
 		{
890 890
 			$ident_result = $row['flightaware_id'];
891 891
 		}
@@ -902,13 +902,13 @@  discard block
 block discarded – undo
902 902
 	{
903 903
 		global $globalDBdriver, $globalTimezone;
904 904
 		if ($globalDBdriver == 'mysql') {
905
-			$query  = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
905
+			$query = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
906 906
 				WHERE spotter_live.flightaware_id = :id 
907 907
 				AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 10 HOUR)'; 
908 908
 //				AND spotter_live.date < UTC_TIMESTAMP()";
909 909
 			$query_data = array(':id' => $id);
910 910
 		} else {
911
-			$query  = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
911
+			$query = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
912 912
 				WHERE spotter_live.flightaware_id = :id 
913 913
 				AND spotter_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '10 HOUR'";
914 914
 //				AND spotter_live.date < now() AT TIME ZONE 'UTC'";
@@ -917,8 +917,8 @@  discard block
 block discarded – undo
917 917
 		
918 918
 		$sth = $this->db->prepare($query);
919 919
 		$sth->execute($query_data);
920
-		$ident_result='';
921
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
920
+		$ident_result = '';
921
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
922 922
 		{
923 923
 			$ident_result = $row['flightaware_id'];
924 924
 		}
@@ -935,13 +935,13 @@  discard block
 block discarded – undo
935 935
 	{
936 936
 		global $globalDBdriver, $globalTimezone;
937 937
 		if ($globalDBdriver == 'mysql') {
938
-			$query  = 'SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live 
938
+			$query = 'SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live 
939 939
 				WHERE spotter_live.ModeS = :modes 
940 940
 				AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 20 MINUTE)'; 
941 941
 //				AND spotter_live.date < UTC_TIMESTAMP()";
942 942
 			$query_data = array(':modes' => $modes);
943 943
 		} else {
944
-			$query  = "SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live 
944
+			$query = "SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live 
945 945
 				WHERE spotter_live.ModeS = :modes 
946 946
 				AND spotter_live.date >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '20 MINUTE'";
947 947
 //			//	AND spotter_live.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC'";
@@ -950,8 +950,8 @@  discard block
 block discarded – undo
950 950
 		
951 951
 		$sth = $this->db->prepare($query);
952 952
 		$sth->execute($query_data);
953
-		$ident_result='';
954
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
953
+		$ident_result = '';
954
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
955 955
 		{
956 956
 			//$ident_result = $row['spotter_live_id'];
957 957
 			$ident_result = $row['flightaware_id'];
@@ -976,8 +976,8 @@  discard block
 block discarded – undo
976 976
 				return array();
977 977
 			} else {
978 978
 				$q_array = explode(" ", $q);
979
-				foreach ($q_array as $q_item){
980
-					$q_item = filter_var($q_item,FILTER_SANITIZE_STRING);
979
+				foreach ($q_array as $q_item) {
980
+					$q_item = filter_var($q_item, FILTER_SANITIZE_STRING);
981 981
 					$additional_query .= " AND (";
982 982
 					$additional_query .= "(spotter_live.aircraft_icao like '%".$q_item."%') OR ";
983 983
 					$additional_query .= "(spotter_live.aircraft_name like '%".$q_item."%') OR ";
@@ -992,11 +992,11 @@  discard block
 block discarded – undo
992 992
 			}
993 993
 		}
994 994
 		if ($globalDBdriver == 'mysql') {
995
-			$query  = "SELECT spotter_live.* FROM spotter_live 
995
+			$query = "SELECT spotter_live.* FROM spotter_live 
996 996
 			    WHERE spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 20 SECOND) ".$additional_query." 
997 997
 			    AND spotter_live.date < UTC_TIMESTAMP()";
998 998
 		} else {
999
-			$query  = "SELECT spotter_live.* FROM spotter_live 
999
+			$query = "SELECT spotter_live.* FROM spotter_live 
1000 1000
 			    WHERE spotter_live.date::timestamp >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '20 SECONDS' ".$additional_query." 
1001 1001
 			    AND spotter_live.date::timestamp < CURRENT_TIMESTAMP AT TIME ZONE 'UTC'";
1002 1002
 		}
@@ -1016,7 +1016,7 @@  discard block
 block discarded – undo
1016 1016
 	* @return String success or false
1017 1017
 	*
1018 1018
 	*/
1019
-	public function addLiveSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $altitude_real = '',$heading = '', $groundspeed = '', $date = '',$departure_airport_time = '', $arrival_airport_time = '', $squawk = '', $route_stop = '', $ModeS = '', $putinarchive = false,$registration = '',$pilot_id = '', $pilot_name = '', $verticalrate = '', $noarchive = false, $ground = false,$format_source = '', $source_name = '', $over_country = '')
1019
+	public function addLiveSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $altitude_real = '', $heading = '', $groundspeed = '', $date = '', $departure_airport_time = '', $arrival_airport_time = '', $squawk = '', $route_stop = '', $ModeS = '', $putinarchive = false, $registration = '', $pilot_id = '', $pilot_name = '', $verticalrate = '', $noarchive = false, $ground = false, $format_source = '', $source_name = '', $over_country = '')
1020 1020
 	{
1021 1021
 		global $globalURL, $globalArchive, $globalDebug;
1022 1022
 		$Common = new Common();
@@ -1116,27 +1116,27 @@  discard block
 block discarded – undo
1116 1116
 		if ($date == '') $date = date("Y-m-d H:i:s", time());
1117 1117
 
1118 1118
         
1119
-		$flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING);
1120
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
1121
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
1122
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
1123
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
1124
-		$latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1125
-		$longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1126
-		$waypoints = filter_var($waypoints,FILTER_SANITIZE_STRING);
1127
-		$altitude = filter_var($altitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1128
-		$altitude_real = filter_var($altitude_real,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1129
-		$heading = filter_var($heading,FILTER_SANITIZE_NUMBER_INT);
1130
-		$groundspeed = filter_var($groundspeed,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1131
-		$squawk = filter_var($squawk,FILTER_SANITIZE_NUMBER_INT);
1132
-		$route_stop = filter_var($route_stop,FILTER_SANITIZE_STRING);
1133
-		$ModeS = filter_var($ModeS,FILTER_SANITIZE_STRING);
1134
-		$pilot_id = filter_var($pilot_id,FILTER_SANITIZE_STRING);
1135
-		$pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING);
1136
-		$format_source = filter_var($format_source,FILTER_SANITIZE_STRING);
1137
-		$source_name = filter_var($source_name,FILTER_SANITIZE_STRING);
1138
-		$over_country = filter_var($over_country,FILTER_SANITIZE_STRING);
1139
-		$verticalrate = filter_var($verticalrate,FILTER_SANITIZE_NUMBER_INT);
1119
+		$flightaware_id = filter_var($flightaware_id, FILTER_SANITIZE_STRING);
1120
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
1121
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
1122
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
1123
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
1124
+		$latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1125
+		$longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1126
+		$waypoints = filter_var($waypoints, FILTER_SANITIZE_STRING);
1127
+		$altitude = filter_var($altitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1128
+		$altitude_real = filter_var($altitude_real, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1129
+		$heading = filter_var($heading, FILTER_SANITIZE_NUMBER_INT);
1130
+		$groundspeed = filter_var($groundspeed, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1131
+		$squawk = filter_var($squawk, FILTER_SANITIZE_NUMBER_INT);
1132
+		$route_stop = filter_var($route_stop, FILTER_SANITIZE_STRING);
1133
+		$ModeS = filter_var($ModeS, FILTER_SANITIZE_STRING);
1134
+		$pilot_id = filter_var($pilot_id, FILTER_SANITIZE_STRING);
1135
+		$pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING);
1136
+		$format_source = filter_var($format_source, FILTER_SANITIZE_STRING);
1137
+		$source_name = filter_var($source_name, FILTER_SANITIZE_STRING);
1138
+		$over_country = filter_var($over_country, FILTER_SANITIZE_STRING);
1139
+		$verticalrate = filter_var($verticalrate, FILTER_SANITIZE_NUMBER_INT);
1140 1140
 
1141 1141
 		$airline_name = '';
1142 1142
 		$airline_icao = '';
@@ -1158,10 +1158,10 @@  discard block
 block discarded – undo
1158 1158
 		$arrival_airport_country = '';
1159 1159
 		
1160 1160
             	
1161
-            	if ($squawk == '' || $Common->isInteger($squawk) === false ) $squawk = NULL;
1162
-            	if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) $verticalrate = NULL;
1163
-            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
1164
-            	if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
1161
+            	if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL;
1162
+            	if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL;
1163
+            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
1164
+            	if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
1165 1165
 		
1166 1166
 		$query = '';
1167 1167
 		if ($globalArchive) {
@@ -1172,19 +1172,19 @@  discard block
 block discarded – undo
1172 1172
 		$query  .= 'INSERT INTO spotter_live (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_shadow, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, latitude, longitude, waypoints, altitude, heading, ground_speed, date, departure_airport_time, arrival_airport_time, squawk, route_stop, ModeS, pilot_id, pilot_name, verticalrate, ground, format_source, source_name, over_country, real_altitude) 
1173 1173
 		VALUES (:flightaware_id,:ident,:registration,:airline_name,:airline_icao,:airline_country,:airline_type,:aircraft_icao,:aircraft_shadow,:aircraft_type,:aircraft_manufacturer,:departure_airport_icao,:departure_airport_name, :departure_airport_city, :departure_airport_country, :arrival_airport_icao, :arrival_airport_name, :arrival_airport_city, :arrival_airport_country, :latitude,:longitude,:waypoints,:altitude,:heading,:groundspeed,:date,:departure_airport_time,:arrival_airport_time,:squawk,:route_stop,:ModeS, :pilot_id, :pilot_name, :verticalrate, :ground, :format_source, :source_name, :over_country, :real_altitude)';
1174 1174
 
1175
-		$query_values = array(':flightaware_id' => $flightaware_id,':ident' => $ident, ':registration' => $registration,':airline_name' => $airline_name,':airline_icao' => $airline_icao,':airline_country' => $airline_country,':airline_type' => $airline_type,':aircraft_icao' => $aircraft_icao,':aircraft_shadow' => $aircraft_shadow,':aircraft_type' => $aircraft_type,':aircraft_manufacturer' => $aircraft_manufacturer,':departure_airport_icao' => $departure_airport_icao,':departure_airport_name' => $departure_airport_name,':departure_airport_city' => $departure_airport_city,':departure_airport_country' => $departure_airport_country,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_name' => $arrival_airport_name,':arrival_airport_city' => $arrival_airport_city,':arrival_airport_country' => $arrival_airport_country,':latitude' => $latitude,':longitude' => $longitude, ':waypoints' => $waypoints,':altitude' => $altitude,':heading' => $heading,':groundspeed' => $groundspeed,':date' => $date, ':departure_airport_time' => $departure_airport_time,':arrival_airport_time' => $arrival_airport_time, ':squawk' => $squawk,':route_stop' => $route_stop,':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':format_source' => $format_source,':ground' => $ground, ':source_name' => $source_name, ':over_country' => $over_country,':real_altitude' => $altitude_real);
1175
+		$query_values = array(':flightaware_id' => $flightaware_id, ':ident' => $ident, ':registration' => $registration, ':airline_name' => $airline_name, ':airline_icao' => $airline_icao, ':airline_country' => $airline_country, ':airline_type' => $airline_type, ':aircraft_icao' => $aircraft_icao, ':aircraft_shadow' => $aircraft_shadow, ':aircraft_type' => $aircraft_type, ':aircraft_manufacturer' => $aircraft_manufacturer, ':departure_airport_icao' => $departure_airport_icao, ':departure_airport_name' => $departure_airport_name, ':departure_airport_city' => $departure_airport_city, ':departure_airport_country' => $departure_airport_country, ':arrival_airport_icao' => $arrival_airport_icao, ':arrival_airport_name' => $arrival_airport_name, ':arrival_airport_city' => $arrival_airport_city, ':arrival_airport_country' => $arrival_airport_country, ':latitude' => $latitude, ':longitude' => $longitude, ':waypoints' => $waypoints, ':altitude' => $altitude, ':heading' => $heading, ':groundspeed' => $groundspeed, ':date' => $date, ':departure_airport_time' => $departure_airport_time, ':arrival_airport_time' => $arrival_airport_time, ':squawk' => $squawk, ':route_stop' => $route_stop, ':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':format_source' => $format_source, ':ground' => $ground, ':source_name' => $source_name, ':over_country' => $over_country, ':real_altitude' => $altitude_real);
1176 1176
 		try {
1177 1177
 			
1178 1178
 			$sth = $this->db->prepare($query);
1179 1179
 			$sth->execute($query_values);
1180 1180
 			$sth->closeCursor();
1181
-		} catch(PDOException $e) {
1181
+		} catch (PDOException $e) {
1182 1182
 			return "error : ".$e->getMessage();
1183 1183
 		}
1184 1184
 		if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) {
1185 1185
 		    if ($globalDebug) echo '(Add to SBS archive : ';
1186 1186
 		    $SpotterArchive = new SpotterArchive($this->db);
1187
-		    $result =  $SpotterArchive->addSpotterArchiveData($flightaware_id, $ident, $registration, $airline_name, $airline_icao, $airline_country, $airline_type, $aircraft_icao, $aircraft_shadow, $aircraft_name, $aircraft_manufacturer, $departure_airport_icao, $departure_airport_name, $departure_airport_city, $departure_airport_country, $departure_airport_time,$arrival_airport_icao, $arrival_airport_name, $arrival_airport_city, $arrival_airport_country, $arrival_airport_time, $route_stop, $date,$latitude, $longitude, $waypoints, $altitude, $altitude_real,$heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name,$verticalrate,$format_source,$source_name, $over_country);
1187
+		    $result = $SpotterArchive->addSpotterArchiveData($flightaware_id, $ident, $registration, $airline_name, $airline_icao, $airline_country, $airline_type, $aircraft_icao, $aircraft_shadow, $aircraft_name, $aircraft_manufacturer, $departure_airport_icao, $departure_airport_name, $departure_airport_city, $departure_airport_country, $departure_airport_time, $arrival_airport_icao, $arrival_airport_name, $arrival_airport_city, $arrival_airport_country, $arrival_airport_time, $route_stop, $date, $latitude, $longitude, $waypoints, $altitude, $altitude_real, $heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name, $verticalrate, $format_source, $source_name, $over_country);
1188 1188
 		    if ($globalDebug) echo $result.')';
1189 1189
 		} elseif ($globalDebug && $putinarchive !== true) {
1190 1190
 			echo '(Not adding to archive)';
@@ -1197,7 +1197,7 @@  discard block
 block discarded – undo
1197 1197
 
1198 1198
 	public function getOrderBy()
1199 1199
 	{
1200
-		$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"));
1200
+		$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"));
1201 1201
 		return $orderby;
1202 1202
 	}
1203 1203
 
Please login to merge, or discard this patch.