Completed
Push — master ( ca0d40...ae4662 )
by Yannick
07:22
created
statistics-airport-departure.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
         	["'._("Airport").'", "'._("# of times").'"],';
27 27
 
28 28
 $airport_data = '';
29
-foreach($airport_airport_array as $airport_item)
29
+foreach ($airport_airport_array as $airport_item)
30 30
 {
31 31
 	$name = $airport_item['airport_departure_city'].', '.$airport_item['airport_departure_country'].' ('.$airport_item['airport_departure_icao'].')';
32 32
 	$name = str_replace("'", "", $name);
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 print '</thead>';
65 65
 print '<tbody>';
66 66
 $i = 1;
67
-foreach($airport_airport_array as $airport_item)
67
+foreach ($airport_airport_array as $airport_item)
68 68
 {
69 69
 	print '<tr>';
70 70
 	print '<td><strong>'.$i.'</strong></td>';
Please login to merge, or discard this patch.
registration-statistics-arrival-airport.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -3,16 +3,16 @@  discard block
 block discarded – undo
3 3
 require_once('require/class.Spotter.php');
4 4
 require_once('require/class.Language.php');
5 5
 $Spotter = new Spotter();
6
-$sort=filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING);
7
-$registration = filter_input(INPUT_GET,'registration',FILTER_SANITIZE_STRING);
6
+$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING);
7
+$registration = filter_input(INPUT_GET, 'registration', FILTER_SANITIZE_STRING);
8 8
 if ($registration != '') {
9 9
 	$spotter_array = $Spotter->getSpotterDataByRegistration($registration, "0,1", $sort);
10 10
 	$aircraft_array = $Spotter->getAircraftInfoByRegistration($registration);
11
-} else $spotter_array=array();
11
+} else $spotter_array = array();
12 12
 
13 13
 if (!empty($spotter_array))
14 14
 {
15
-	$title = sprintf(_("Most Common Arrival Airports of aircraft with registration %s"),$registration);
15
+	$title = sprintf(_("Most Common Arrival Airports of aircraft with registration %s"), $registration);
16 16
 
17 17
 	require_once('header.php');
18 18
 		print '<div class="info column">';
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 	include('registration-sub-menu.php');
26 26
 	print '<div class="column">';
27 27
 	print '<h2>'._("Most Common Arrival Airports").'</h2>';
28
-	print '<p>'.sprintf(_("The statistic below shows all arrival airports of flights with aircraft registration <strong>%s</strong>."),$registration).'</p>';
28
+	print '<p>'.sprintf(_("The statistic below shows all arrival airports of flights with aircraft registration <strong>%s</strong>."), $registration).'</p>';
29 29
 	$airport_airport_array = $Spotter->countAllArrivalAirportsByRegistration($registration);
30 30
 	print '<script type="text/javascript" src="https://www.google.com/jsapi"></script>
31 31
     	<script>
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
         	["'._("Airport").'", "'._("# of times").'"],';
41 41
 
42 42
 	$airport_data = '';
43
-	foreach($airport_airport_array as $airport_item)
43
+	foreach ($airport_airport_array as $airport_item)
44 44
 	{
45 45
 		$name = $airport_item['airport_arrival_city'].', '.$airport_item['airport_arrival_country'].' ('.$airport_item['airport_arrival_icao'].')';
46 46
 		$name = str_replace("'", "", $name);
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 	print '</thead>';
79 79
 	print '<tbody>';
80 80
 	$i = 1;
81
-	foreach($airport_airport_array as $airport_item)
81
+	foreach ($airport_airport_array as $airport_item)
82 82
 	{
83 83
 		print '<tr>';
84 84
 		print '<td><strong>'.$i.'</strong></td>';
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -8,7 +8,9 @@
 block discarded – undo
8 8
 if ($registration != '') {
9 9
 	$spotter_array = $Spotter->getSpotterDataByRegistration($registration, "0,1", $sort);
10 10
 	$aircraft_array = $Spotter->getAircraftInfoByRegistration($registration);
11
-} else $spotter_array=array();
11
+} else {
12
+	$spotter_array=array();
13
+}
12 14
 
13 15
 if (!empty($spotter_array))
14 16
 {
Please login to merge, or discard this patch.
statistics-airport-departure-country.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
         	["'._("Country").'", "'._("# of times").'"],';
27 27
 
28 28
 $country_data = '';
29
-foreach($airport_country_array as $airport_item)
29
+foreach ($airport_country_array as $airport_item)
30 30
 {
31 31
 	$country_data .= '[ "'.$airport_item['airport_departure_country'].'",'.$airport_item['airport_departure_country_count'].'],';
32 32
 }
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 print '</thead>';
62 62
 print '<tbody>';
63 63
 $i = 1;
64
-foreach($airport_country_array as $airport_item)
64
+foreach ($airport_country_array as $airport_item)
65 65
 {
66 66
 	print '<tr>';
67 67
 	print '<td><strong>'.$i.'</strong></td>';
Please login to merge, or discard this patch.
sitemap.php 2 patches
Indentation   +107 added lines, -107 removed lines patch added patch discarded remove patch
@@ -15,9 +15,9 @@  discard block
 block discarded – undo
15 15
 		foreach($spotter_array as $spotter_item)
16 16
 		{
17 17
 			$output .= '<url>';
18
-			    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/flightid/'.$spotter_item['spotter_id'].'</loc>';
19
-			    $output .= '<lastmod>'.date("c", time()).'</lastmod>';
20
-			    $output .= '<changefreq>weekly</changefreq>';
18
+				$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/flightid/'.$spotter_item['spotter_id'].'</loc>';
19
+				$output .= '<lastmod>'.date("c", time()).'</lastmod>';
20
+				$output .= '<changefreq>weekly</changefreq>';
21 21
 			$output .= '</url>';
22 22
 		}
23 23
 	$output .= '</urlset>';
@@ -32,9 +32,9 @@  discard block
 block discarded – undo
32 32
 		foreach($aircraft_types as $aircraft_item)
33 33
 		{
34 34
 			$output .= '<url>';
35
-			    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/aircraft/'.$aircraft_item['aircraft_icao'].'</loc>';
36
-			    $output .= '<lastmod>'.date("c", time()).'</lastmod>';
37
-			    $output .= '<changefreq>daily</changefreq>';
35
+				$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/aircraft/'.$aircraft_item['aircraft_icao'].'</loc>';
36
+				$output .= '<lastmod>'.date("c", time()).'</lastmod>';
37
+				$output .= '<changefreq>daily</changefreq>';
38 38
 			$output .= '</url>';
39 39
 		}
40 40
 	$output .= '</urlset>';
@@ -49,9 +49,9 @@  discard block
 block discarded – undo
49 49
 		foreach($aircraft_registrations as $aircraft_item)
50 50
 		{
51 51
 			$output .= '<url>';
52
-			    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/registration/'.$aircraft_item['registration'].'</loc>';
53
-			    $output .= '<lastmod>'.date("c", time()).'</lastmod>';
54
-			    $output .= '<changefreq>daily</changefreq>';
52
+				$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/registration/'.$aircraft_item['registration'].'</loc>';
53
+				$output .= '<lastmod>'.date("c", time()).'</lastmod>';
54
+				$output .= '<changefreq>daily</changefreq>';
55 55
 			$output .= '</url>';
56 56
 		}
57 57
 	$output .= '</urlset>';
@@ -65,9 +65,9 @@  discard block
 block discarded – undo
65 65
 		foreach($airline_names as $airline_item)
66 66
 		{
67 67
 			$output .= '<url>';
68
-			    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/airline/'.$airline_item['airline_icao'].'</loc>';
69
-			    $output .= '<lastmod>'.date("c", time()).'</lastmod>';
70
-			    $output .= '<changefreq>daily</changefreq>';
68
+				$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/airline/'.$airline_item['airline_icao'].'</loc>';
69
+				$output .= '<lastmod>'.date("c", time()).'</lastmod>';
70
+				$output .= '<changefreq>daily</changefreq>';
71 71
 			$output .= '</url>';
72 72
 		}
73 73
 	$output .= '</urlset>';
@@ -81,9 +81,9 @@  discard block
 block discarded – undo
81 81
 		foreach($airport_names as $airport_item)
82 82
 		{
83 83
 			$output .= '<url>';
84
-			    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/airport/'.$airport_item['airport_icao'].'</loc>';
85
-			    $output .= '<lastmod>'.date("c", time()).'</lastmod>';
86
-			    $output .= '<changefreq>daily</changefreq>';
84
+				$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/airport/'.$airport_item['airport_icao'].'</loc>';
85
+				$output .= '<lastmod>'.date("c", time()).'</lastmod>';
86
+				$output .= '<changefreq>daily</changefreq>';
87 87
 			$output .= '</url>';
88 88
 		}
89 89
 	$output .= '</urlset>';
@@ -97,9 +97,9 @@  discard block
 block discarded – undo
97 97
 		foreach($manufacturer_names as $manufacturer_item)
98 98
 		{
99 99
 			$output .= '<url>';
100
-			    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/manufacturer/'.strtolower(str_replace(" ", "-", $manufacturer_item['aircraft_manufacturer'])).'</loc>';
101
-			    $output .= '<lastmod>'.date("c", time()).'</lastmod>';
102
-			    $output .= '<changefreq>daily</changefreq>';
100
+				$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/manufacturer/'.strtolower(str_replace(" ", "-", $manufacturer_item['aircraft_manufacturer'])).'</loc>';
101
+				$output .= '<lastmod>'.date("c", time()).'</lastmod>';
102
+				$output .= '<changefreq>daily</changefreq>';
103 103
 			$output .= '</url>';
104 104
 		}
105 105
 	$output .= '</urlset>';
@@ -113,9 +113,9 @@  discard block
 block discarded – undo
113 113
 		foreach($country_names as $country_item)
114 114
 		{
115 115
 			$output .= '<url>';
116
-			    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/country/'.strtolower(str_replace(" ", "-", $country_item['country'])).'</loc>';
117
-			    $output .= '<lastmod>'.date("c", time()).'</lastmod>';
118
-			    $output .= '<changefreq>daily</changefreq>';
116
+				$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/country/'.strtolower(str_replace(" ", "-", $country_item['country'])).'</loc>';
117
+				$output .= '<lastmod>'.date("c", time()).'</lastmod>';
118
+				$output .= '<changefreq>daily</changefreq>';
119 119
 			$output .= '</url>';
120 120
 		}
121 121
 	$output .= '</urlset>';
@@ -130,9 +130,9 @@  discard block
 block discarded – undo
130 130
 		{
131 131
 			if (ctype_alnum($ident_item['ident'])) {
132 132
 				$output .= '<url>';
133
-				    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/ident/'.$ident_item['ident'].'</loc>';
134
-				    $output .= '<lastmod>'.date("c", time()).'</lastmod>';
135
-				    $output .= '<changefreq>daily</changefreq>';
133
+					$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/ident/'.$ident_item['ident'].'</loc>';
134
+					$output .= '<lastmod>'.date("c", time()).'</lastmod>';
135
+					$output .= '<changefreq>daily</changefreq>';
136 136
 				$output .= '</url>';
137 137
 			}
138 138
 		}
@@ -147,9 +147,9 @@  discard block
 block discarded – undo
147 147
 		foreach($date_names as $date_item)
148 148
 		{
149 149
 			$output .= '<url>';
150
-			    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/date/'.date("Y-m-d", strtotime($date_item['date'])).'</loc>';
151
-			    $output .= '<lastmod>'.date("c", time()).'</lastmod>';
152
-			    $output .= '<changefreq>daily</changefreq>';
150
+				$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/date/'.date("Y-m-d", strtotime($date_item['date'])).'</loc>';
151
+				$output .= '<lastmod>'.date("c", time()).'</lastmod>';
152
+				$output .= '<changefreq>daily</changefreq>';
153 153
 			$output .= '</url>';
154 154
 		}
155 155
 	$output .= '</urlset>';
@@ -163,9 +163,9 @@  discard block
 block discarded – undo
163 163
 		foreach($route_names as $route_item)
164 164
 		{
165 165
 			$output .= '<url>';
166
-			    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/route/'.$route_item['airport_departure_icao'].'/'.$route_item['airport_arrival_icao'].'</loc>';
167
-			    $output .= '<lastmod>'.date("c", time()).'</lastmod>';
168
-			    $output .= '<changefreq>daily</changefreq>';
166
+				$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/route/'.$route_item['airport_departure_icao'].'/'.$route_item['airport_arrival_icao'].'</loc>';
167
+				$output .= '<lastmod>'.date("c", time()).'</lastmod>';
168
+				$output .= '<changefreq>daily</changefreq>';
169 169
 			$output .= '</url>';
170 170
 		}
171 171
 	$output .= '</urlset>';
@@ -177,117 +177,117 @@  discard block
 block discarded – undo
177 177
 		
178 178
 		/* STATIC PAGES */
179 179
 		$output .= '<url>';
180
-		    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/</loc>';
181
-		    $output .= '<lastmod>'.date("c", time()).'</lastmod>';
182
-		    $output .= '<changefreq>daily</changefreq>';
180
+			$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/</loc>';
181
+			$output .= '<lastmod>'.date("c", time()).'</lastmod>';
182
+			$output .= '<changefreq>daily</changefreq>';
183 183
 		$output .= '</url>';
184 184
 		$output .= '<url>';
185
-		    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/latest</loc>';
186
-		    $output .= '<lastmod>'.date("c", time()).'</lastmod>';
187
-		    $output .= '<changefreq>daily</changefreq>';
185
+			$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/latest</loc>';
186
+			$output .= '<lastmod>'.date("c", time()).'</lastmod>';
187
+			$output .= '<changefreq>daily</changefreq>';
188 188
 		$output .= '</url>';
189 189
 		$output .= '<url>';
190
-		    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/highlights</loc>';
191
-		    $output .= '<lastmod>'.date("c", time()).'</lastmod>';
192
-		    $output .= '<changefreq>daily</changefreq>';
190
+			$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/highlights</loc>';
191
+			$output .= '<lastmod>'.date("c", time()).'</lastmod>';
192
+			$output .= '<changefreq>daily</changefreq>';
193 193
 		$output .= '</url>';
194 194
 		$output .= '<url>';
195
-		    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/aircraft</loc>';
196
-		    $output .= '<lastmod>'.date("c", time()).'</lastmod>';
197
-		    $output .= '<changefreq>daily</changefreq>';
195
+			$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/aircraft</loc>';
196
+			$output .= '<lastmod>'.date("c", time()).'</lastmod>';
197
+			$output .= '<changefreq>daily</changefreq>';
198 198
 		$output .= '</url>';
199 199
 		$output .= '<url>';
200
-		    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/airline</loc>';
201
-		    $output .= '<lastmod>'.date("c", time()).'</lastmod>';
202
-		    $output .= '<changefreq>daily</changefreq>';
200
+			$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/airline</loc>';
201
+			$output .= '<lastmod>'.date("c", time()).'</lastmod>';
202
+			$output .= '<changefreq>daily</changefreq>';
203 203
 		$output .= '</url>';
204 204
 		$output .= '<url>';
205
-		    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/airport</loc>';
206
-		    $output .= '<lastmod>'.date("c", time()).'</lastmod>';
207
-		    $output .= '<changefreq>daily</changefreq>';
205
+			$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/airport</loc>';
206
+			$output .= '<lastmod>'.date("c", time()).'</lastmod>';
207
+			$output .= '<changefreq>daily</changefreq>';
208 208
 		$output .= '</url>';
209 209
 		$output .= '<url>';
210
-		    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/search</loc>';
211
-		    $output .= '<lastmod>'.date("c", time()).'</lastmod>';
212
-		    $output .= '<changefreq>daily</changefreq>';
210
+			$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/search</loc>';
211
+			$output .= '<lastmod>'.date("c", time()).'</lastmod>';
212
+			$output .= '<changefreq>daily</changefreq>';
213 213
 		$output .= '</url>';
214 214
 		$output .= '<url>';
215
-		    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/about</loc>';
216
-		    $output .= '<lastmod>'.date("c", time()).'</lastmod>';
217
-		    $output .= '<changefreq>weekly</changefreq>';
215
+			$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/about</loc>';
216
+			$output .= '<lastmod>'.date("c", time()).'</lastmod>';
217
+			$output .= '<changefreq>weekly</changefreq>';
218 218
 		$output .= '</url>';
219 219
 		
220 220
 		
221 221
 		/* STATISTIC PAGES */
222 222
 		$output .= '<url>';
223
-		    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/statistics/aircraft</loc>';
224
-		    $output .= '<lastmod>'.date("c", time()).'</lastmod>';
225
-		    $output .= '<changefreq>daily</changefreq>';
223
+			$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/statistics/aircraft</loc>';
224
+			$output .= '<lastmod>'.date("c", time()).'</lastmod>';
225
+			$output .= '<changefreq>daily</changefreq>';
226 226
 		$output .= '</url>';
227 227
 		$output .= '<url>';
228
-		    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/statistics/registration</loc>';
229
-		    $output .= '<lastmod>'.date("c", time()).'</lastmod>';
230
-		    $output .= '<changefreq>daily</changefreq>';
228
+			$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/statistics/registration</loc>';
229
+			$output .= '<lastmod>'.date("c", time()).'</lastmod>';
230
+			$output .= '<changefreq>daily</changefreq>';
231 231
 		$output .= '</url>';
232 232
 		$output .= '<url>';
233
-		    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/statistics/manufacturer</loc>';
234
-		    $output .= '<lastmod>'.date("c", time()).'</lastmod>';
235
-		    $output .= '<changefreq>daily</changefreq>';
233
+			$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/statistics/manufacturer</loc>';
234
+			$output .= '<lastmod>'.date("c", time()).'</lastmod>';
235
+			$output .= '<changefreq>daily</changefreq>';
236 236
 		$output .= '</url>';
237 237
 		$output .= '<url>';
238
-		    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/statistics/airline</loc>';
239
-		    $output .= '<lastmod>'.date("c", time()).'</lastmod>';
240
-		    $output .= '<changefreq>daily</changefreq>';
238
+			$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/statistics/airline</loc>';
239
+			$output .= '<lastmod>'.date("c", time()).'</lastmod>';
240
+			$output .= '<changefreq>daily</changefreq>';
241 241
 		$output .= '</url>';
242 242
 		$output .= '<url>';
243
-		    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/statistics/airline-country</loc>';
244
-		    $output .= '<lastmod>'.date("c", time()).'</lastmod>';
245
-		    $output .= '<changefreq>daily</changefreq>';
243
+			$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/statistics/airline-country</loc>';
244
+			$output .= '<lastmod>'.date("c", time()).'</lastmod>';
245
+			$output .= '<changefreq>daily</changefreq>';
246 246
 		$output .= '</url>';
247 247
 		$output .= '<url>';
248
-		    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/statistics/airport-departure</loc>';
249
-		    $output .= '<lastmod>'.date("c", time()).'</lastmod>';
250
-		    $output .= '<changefreq>daily</changefreq>';
248
+			$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/statistics/airport-departure</loc>';
249
+			$output .= '<lastmod>'.date("c", time()).'</lastmod>';
250
+			$output .= '<changefreq>daily</changefreq>';
251 251
 		$output .= '</url>';
252 252
 		$output .= '<url>';
253
-		    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/statistics/airport-departure-country</loc>';
254
-		    $output .= '<lastmod>'.date("c", time()).'</lastmod>';
255
-		    $output .= '<changefreq>daily</changefreq>';
253
+			$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/statistics/airport-departure-country</loc>';
254
+			$output .= '<lastmod>'.date("c", time()).'</lastmod>';
255
+			$output .= '<changefreq>daily</changefreq>';
256 256
 		$output .= '</url>';
257 257
 		$output .= '<url>';
258
-		    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/statistics/airport-arrival</loc>';
259
-		    $output .= '<lastmod>'.date("c", time()).'</lastmod>';
260
-		    $output .= '<changefreq>daily</changefreq>';
258
+			$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/statistics/airport-arrival</loc>';
259
+			$output .= '<lastmod>'.date("c", time()).'</lastmod>';
260
+			$output .= '<changefreq>daily</changefreq>';
261 261
 		$output .= '</url>';
262 262
 		$output .= '<url>';
263
-		    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/statistics/airport-arrival-country</loc>';
264
-		    $output .= '<lastmod>'.date("c", time()).'</lastmod>';
265
-		    $output .= '<changefreq>daily</changefreq>';
263
+			$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/statistics/airport-arrival-country</loc>';
264
+			$output .= '<lastmod>'.date("c", time()).'</lastmod>';
265
+			$output .= '<changefreq>daily</changefreq>';
266 266
 		$output .= '</url>';
267 267
 		$output .= '<url>';
268
-		    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/statistics/route-airport</loc>';
269
-		    $output .= '<lastmod>'.date("c", time()).'</lastmod>';
270
-		    $output .= '<changefreq>daily</changefreq>';
268
+			$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/statistics/route-airport</loc>';
269
+			$output .= '<lastmod>'.date("c", time()).'</lastmod>';
270
+			$output .= '<changefreq>daily</changefreq>';
271 271
 		$output .= '</url>';
272 272
 		$output .= '<url>';
273
-		    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/statistics/route-waypoint</loc>';
274
-		    $output .= '<lastmod>'.date("c", time()).'</lastmod>';
275
-		    $output .= '<changefreq>daily</changefreq>';
273
+			$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/statistics/route-waypoint</loc>';
274
+			$output .= '<lastmod>'.date("c", time()).'</lastmod>';
275
+			$output .= '<changefreq>daily</changefreq>';
276 276
 		$output .= '</url>';
277 277
 		$output .= '<url>';
278
-		    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/statistics/callsign</loc>';
279
-		    $output .= '<lastmod>'.date("c", time()).'</lastmod>';
280
-		    $output .= '<changefreq>daily</changefreq>';
278
+			$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/statistics/callsign</loc>';
279
+			$output .= '<lastmod>'.date("c", time()).'</lastmod>';
280
+			$output .= '<changefreq>daily</changefreq>';
281 281
 		$output .= '</url>';
282 282
 		$output .= '<url>';
283
-		    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/statistics/date</loc>';
284
-		    $output .= '<lastmod>'.date("c", time()).'</lastmod>';
285
-		    $output .= '<changefreq>daily</changefreq>';
283
+			$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/statistics/date</loc>';
284
+			$output .= '<lastmod>'.date("c", time()).'</lastmod>';
285
+			$output .= '<changefreq>daily</changefreq>';
286 286
 		$output .= '</url>';
287 287
 		$output .= '<url>';
288
-		    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/statistics/time</loc>';
289
-		    $output .= '<lastmod>'.date("c", time()).'</lastmod>';
290
-		    $output .= '<changefreq>daily</changefreq>';
288
+			$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/statistics/time</loc>';
289
+			$output .= '<lastmod>'.date("c", time()).'</lastmod>';
290
+			$output .= '<changefreq>daily</changefreq>';
291 291
 		$output .= '</url>';
292 292
 	$output .= '</urlset>';
293 293
 	
@@ -297,37 +297,37 @@  discard block
 block discarded – undo
297 297
 	$output .= '<?xml version="1.0" encoding="UTF-8"?>';
298 298
 	$output .= '<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">';
299 299
 		$output .= '<sitemap>';
300
-	    	$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/sitemap/static</loc>';
300
+			$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/sitemap/static</loc>';
301 301
 		$output .= '</sitemap>';
302 302
 		$output .= '<sitemap>';
303
-	    	$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/sitemap/flight</loc>';
303
+			$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/sitemap/flight</loc>';
304 304
 		$output .= '</sitemap>';
305 305
 		$output .= '<sitemap>';
306
-	    	$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/sitemap/aircraft</loc>';
306
+			$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/sitemap/aircraft</loc>';
307 307
 		$output .= '</sitemap>';
308 308
 		$output .= '<sitemap>';
309
-	    	$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/sitemap/registration</loc>';
309
+			$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/sitemap/registration</loc>';
310 310
 		$output .= '</sitemap>';
311 311
 		$output .= '<sitemap>';
312
-	    	$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/sitemap/airline</loc>';
312
+			$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/sitemap/airline</loc>';
313 313
 		$output .= '</sitemap>';
314 314
 		$output .= '<sitemap>';
315
-	    	$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/sitemap/airport</loc>';
315
+			$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/sitemap/airport</loc>';
316 316
 		$output .= '</sitemap>';
317 317
 		$output .= '<sitemap>';
318
-	    	$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/sitemap/manufacturer</loc>';
318
+			$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/sitemap/manufacturer</loc>';
319 319
 		$output .= '</sitemap>';
320 320
 		$output .= '<sitemap>';
321
-	    	$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/sitemap/country</loc>';
321
+			$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/sitemap/country</loc>';
322 322
 		$output .= '</sitemap>';
323 323
 		$output .= '<sitemap>';
324
-	    	$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/sitemap/ident</loc>';
324
+			$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/sitemap/ident</loc>';
325 325
 		$output .= '</sitemap>';
326 326
 		$output .= '<sitemap>';
327
-	    	$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/sitemap/date</loc>';
327
+			$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/sitemap/date</loc>';
328 328
 		$output .= '</sitemap>';
329 329
 		$output .= '<sitemap>';
330
-	    	$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/sitemap/route</loc>';
330
+			$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/sitemap/route</loc>';
331 331
 		$output .= '</sitemap>';
332 332
 	$output .= '</sitemapindex>';
333 333
 	
Please login to merge, or discard this patch.
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
 	$output .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">';
13 13
 
14 14
 		$spotter_array = $Spotter->getAllFlightsforSitemap();
15
-		foreach($spotter_array as $spotter_item)
15
+		foreach ($spotter_array as $spotter_item)
16 16
 		{
17 17
 			$output .= '<url>';
18 18
 			    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/flightid/'.$spotter_item['spotter_id'].'</loc>';
@@ -23,13 +23,13 @@  discard block
 block discarded – undo
23 23
 	$output .= '</urlset>';
24 24
 	
25 25
 	
26
-} else if (isset($_GET['type']) && $_GET['type'] == "aircraft"){
26
+} else if (isset($_GET['type']) && $_GET['type'] == "aircraft") {
27 27
 
28 28
 	$output .= '<?xml version="1.0" encoding="UTF-8"?>';
29 29
 	$output .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">';
30 30
 
31 31
 		$aircraft_types = $Spotter->getAllAircraftTypes();
32
-		foreach($aircraft_types as $aircraft_item)
32
+		foreach ($aircraft_types as $aircraft_item)
33 33
 		{
34 34
 			$output .= '<url>';
35 35
 			    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/aircraft/'.$aircraft_item['aircraft_icao'].'</loc>';
@@ -40,13 +40,13 @@  discard block
 block discarded – undo
40 40
 	$output .= '</urlset>';
41 41
 	
42 42
 	
43
-} else if (isset($_GET['type']) && $_GET['type'] == "registration"){
43
+} else if (isset($_GET['type']) && $_GET['type'] == "registration") {
44 44
 
45 45
 	$output .= '<?xml version="1.0" encoding="UTF-8"?>';
46 46
 	$output .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">';
47 47
 
48 48
 		$aircraft_registrations = $Spotter->getAllAircraftRegistrations();
49
-		foreach($aircraft_registrations as $aircraft_item)
49
+		foreach ($aircraft_registrations as $aircraft_item)
50 50
 		{
51 51
 			$output .= '<url>';
52 52
 			    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/registration/'.$aircraft_item['registration'].'</loc>';
@@ -56,13 +56,13 @@  discard block
 block discarded – undo
56 56
 		}
57 57
 	$output .= '</urlset>';
58 58
 	
59
-} else if (isset($_GET['type']) && $_GET['type'] == "airline"){
59
+} else if (isset($_GET['type']) && $_GET['type'] == "airline") {
60 60
 
61 61
 	$output .= '<?xml version="1.0" encoding="UTF-8"?>';
62 62
 	$output .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">';
63 63
 
64 64
 		$airline_names = $Spotter->getAllAirlineNames();
65
-		foreach($airline_names as $airline_item)
65
+		foreach ($airline_names as $airline_item)
66 66
 		{
67 67
 			$output .= '<url>';
68 68
 			    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/airline/'.$airline_item['airline_icao'].'</loc>';
@@ -72,13 +72,13 @@  discard block
 block discarded – undo
72 72
 		}
73 73
 	$output .= '</urlset>';
74 74
 	
75
-} else if (isset($_GET['type']) && $_GET['type'] == "airport"){
75
+} else if (isset($_GET['type']) && $_GET['type'] == "airport") {
76 76
 
77 77
 	$output .= '<?xml version="1.0" encoding="UTF-8"?>';
78 78
 	$output .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">';
79 79
 
80 80
 		$airport_names = $Spotter->getAllAirportNames();
81
-		foreach($airport_names as $airport_item)
81
+		foreach ($airport_names as $airport_item)
82 82
 		{
83 83
 			$output .= '<url>';
84 84
 			    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/airport/'.$airport_item['airport_icao'].'</loc>';
@@ -88,13 +88,13 @@  discard block
 block discarded – undo
88 88
 		}
89 89
 	$output .= '</urlset>';
90 90
 	
91
-} else if (isset($_GET['type']) && $_GET['type'] == "manufacturer"){
91
+} else if (isset($_GET['type']) && $_GET['type'] == "manufacturer") {
92 92
 
93 93
 	$output .= '<?xml version="1.0" encoding="UTF-8"?>';
94 94
 	$output .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">';
95 95
 
96 96
 		$manufacturer_names = $Spotter->getAllManufacturers();
97
-		foreach($manufacturer_names as $manufacturer_item)
97
+		foreach ($manufacturer_names as $manufacturer_item)
98 98
 		{
99 99
 			$output .= '<url>';
100 100
 			    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/manufacturer/'.strtolower(str_replace(" ", "-", $manufacturer_item['aircraft_manufacturer'])).'</loc>';
@@ -104,13 +104,13 @@  discard block
 block discarded – undo
104 104
 		}
105 105
 	$output .= '</urlset>';
106 106
 	
107
-} else if (isset($_GET['type']) && $_GET['type'] == "country"){
107
+} else if (isset($_GET['type']) && $_GET['type'] == "country") {
108 108
 
109 109
 	$output .= '<?xml version="1.0" encoding="UTF-8"?>';
110 110
 	$output .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">';
111 111
 
112 112
 		$country_names = $Spotter->getAllCountries();
113
-		foreach($country_names as $country_item)
113
+		foreach ($country_names as $country_item)
114 114
 		{
115 115
 			$output .= '<url>';
116 116
 			    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/country/'.strtolower(str_replace(" ", "-", $country_item['country'])).'</loc>';
@@ -120,13 +120,13 @@  discard block
 block discarded – undo
120 120
 		}
121 121
 	$output .= '</urlset>';
122 122
 	
123
-} else if (isset($_GET['type']) && $_GET['type'] == "ident"){
123
+} else if (isset($_GET['type']) && $_GET['type'] == "ident") {
124 124
 
125 125
 	$output .= '<?xml version="1.0" encoding="UTF-8"?>';
126 126
 	$output .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">';
127 127
 
128 128
 		$ident_names = $Spotter->getAllIdents();
129
-		foreach($ident_names as $ident_item)
129
+		foreach ($ident_names as $ident_item)
130 130
 		{
131 131
 			if (ctype_alnum($ident_item['ident'])) {
132 132
 				$output .= '<url>';
@@ -138,13 +138,13 @@  discard block
 block discarded – undo
138 138
 		}
139 139
 	$output .= '</urlset>';
140 140
 	
141
-} else if (isset($_GET['type']) && $_GET['type'] == "date"){
141
+} else if (isset($_GET['type']) && $_GET['type'] == "date") {
142 142
 
143 143
 	$output .= '<?xml version="1.0" encoding="UTF-8"?>';
144 144
 	$output .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">';
145 145
 
146 146
 		$date_names = $Spotter->getAllDates();
147
-		foreach($date_names as $date_item)
147
+		foreach ($date_names as $date_item)
148 148
 		{
149 149
 			$output .= '<url>';
150 150
 			    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/date/'.date("Y-m-d", strtotime($date_item['date'])).'</loc>';
@@ -154,13 +154,13 @@  discard block
 block discarded – undo
154 154
 		}
155 155
 	$output .= '</urlset>';
156 156
 	
157
-} else if (isset($_GET['type']) && $_GET['type'] == "route"){
157
+} else if (isset($_GET['type']) && $_GET['type'] == "route") {
158 158
 
159 159
 	$output .= '<?xml version="1.0" encoding="UTF-8"?>';
160 160
 	$output .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">';
161 161
 
162 162
 		$route_names = $Spotter->getAllRoutes();
163
-		foreach($route_names as $route_item)
163
+		foreach ($route_names as $route_item)
164 164
 		{
165 165
 			$output .= '<url>';
166 166
 			    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/route/'.$route_item['airport_departure_icao'].'/'.$route_item['airport_arrival_icao'].'</loc>';
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
 		}
171 171
 	$output .= '</urlset>';
172 172
 	
173
-} else if (isset($_GET['type']) && $_GET['type'] == "static"){
173
+} else if (isset($_GET['type']) && $_GET['type'] == "static") {
174 174
 
175 175
 	$output .= '<?xml version="1.0" encoding="UTF-8"?>';
176 176
 	$output .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">';
Please login to merge, or discard this patch.
statistics-airport-arrival-country.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
         	["'._("Country").'", "'._("# of times").'"],';
27 27
 
28 28
 $country_data = '';
29
-foreach($airport_country_array as $airport_item)
29
+foreach ($airport_country_array as $airport_item)
30 30
 {
31 31
 	$country_data .= '[ "'.$airport_item['airport_departure_country'].'",'.$airport_item['airport_departure_country_count'].'],';
32 32
 }
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 print '</thead>';
62 62
 print '<tbody>';
63 63
 $i = 1;
64
-foreach($airport_country_array as $airport_item)
64
+foreach ($airport_country_array as $airport_item)
65 65
 {
66 66
 	print '<tr>';
67 67
 	print '<td><strong>'.$i.'</strong></td>';
Please login to merge, or discard this patch.
search-gpx.php 3 patches
Indentation   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -4,55 +4,55 @@
 block discarded – undo
4 4
 require_once('require/class.Language.php');
5 5
 $Spotter = new Spotter();
6 6
 if (isset($_GET['start_date'])) {
7
-        //for the date manipulation into the query
8
-        if($_GET['start_date'] != "" && $_GET['end_date'] != ""){
9
-                $start_date = $_GET['start_date'].":00";
10
-                $end_date = $_GET['end_date'].":00";
11
-                $sql_date = $start_date.",".$end_date;
12
-        } else if($_GET['start_date'] != ""){
13
-                $start_date = $_GET['start_date'].":00";
14
-                $sql_date = $start_date;
15
-        } else if($_GET['start_date'] == "" && $_GET['end_date'] != ""){
16
-                $end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")).",".$_GET['end_date'].":00";
17
-                $sql_date = $end_date;
18
-        } else $sql_date = '';
7
+		//for the date manipulation into the query
8
+		if($_GET['start_date'] != "" && $_GET['end_date'] != ""){
9
+				$start_date = $_GET['start_date'].":00";
10
+				$end_date = $_GET['end_date'].":00";
11
+				$sql_date = $start_date.",".$end_date;
12
+		} else if($_GET['start_date'] != ""){
13
+				$start_date = $_GET['start_date'].":00";
14
+				$sql_date = $start_date;
15
+		} else if($_GET['start_date'] == "" && $_GET['end_date'] != ""){
16
+				$end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")).",".$_GET['end_date'].":00";
17
+				$sql_date = $end_date;
18
+		} else $sql_date = '';
19 19
 } else $sql_date = '';
20 20
 
21 21
 if (isset($_GET['highest_altitude'])) {
22
-        //for altitude manipulation
23
-        if($_GET['highest_altitude'] != "" && $_GET['lowest_altitude'] != ""){
24
-                $end_altitude = $_GET['highest_altitude'];
25
-                $start_altitude = $_GET['lowest_altitude'];
26
-                $sql_altitude = $start_altitude.",".$end_altitude;
27
-        } else if($_GET['highest_altitude'] != ""){
28
-                $end_altitude = $_GET['highest_altitude'];
29
-                $sql_altitude = $end_altitude;
30
-        } else if($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != ""){
31
-                $start_altitude = $_GET['lowest_altitude'].",60000";
32
-                $sql_altitude = $start_altitude;
33
-        } else $sql_altitude = '';
22
+		//for altitude manipulation
23
+		if($_GET['highest_altitude'] != "" && $_GET['lowest_altitude'] != ""){
24
+				$end_altitude = $_GET['highest_altitude'];
25
+				$start_altitude = $_GET['lowest_altitude'];
26
+				$sql_altitude = $start_altitude.",".$end_altitude;
27
+		} else if($_GET['highest_altitude'] != ""){
28
+				$end_altitude = $_GET['highest_altitude'];
29
+				$sql_altitude = $end_altitude;
30
+		} else if($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != ""){
31
+				$start_altitude = $_GET['lowest_altitude'].",60000";
32
+				$sql_altitude = $start_altitude;
33
+		} else $sql_altitude = '';
34 34
 } else $sql_altitude = '';
35 35
 
36 36
 //calculuation for the pagination
37 37
 if(!isset($_GET['limit']))
38 38
 {
39
-        if (!isset($_GET['number_results']))
40
-        {
41
-                $limit_start = 0;
42
-                $limit_end = 25;
43
-                $absolute_difference = 25;
44
-        } else {
45
-                if ($_GET['number_results'] > 1000){
46
-                        $_GET['number_results'] = 1000;
47
-                }
48
-                $limit_start = 0;
49
-                $limit_end = $_GET['number_results'];
50
-                $absolute_difference = $_GET['number_results'];
51
-        }
39
+		if (!isset($_GET['number_results']))
40
+		{
41
+				$limit_start = 0;
42
+				$limit_end = 25;
43
+				$absolute_difference = 25;
44
+		} else {
45
+				if ($_GET['number_results'] > 1000){
46
+						$_GET['number_results'] = 1000;
47
+				}
48
+				$limit_start = 0;
49
+				$limit_end = $_GET['number_results'];
50
+				$absolute_difference = $_GET['number_results'];
51
+		}
52 52
 }  else {
53
-        $limit_explode = explode(",", $_GET['limit']);
54
-        $limit_start = $limit_explode[0];
55
-        $limit_end = $limit_explode[1];
53
+		$limit_explode = explode(",", $_GET['limit']);
54
+		$limit_start = $limit_explode[0];
55
+		$limit_end = $limit_explode[1];
56 56
 }
57 57
 
58 58
 $absolute_difference = abs($limit_start - $limit_end);
Please login to merge, or discard this patch.
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -5,14 +5,14 @@  discard block
 block discarded – undo
5 5
 $Spotter = new Spotter();
6 6
 if (isset($_GET['start_date'])) {
7 7
         //for the date manipulation into the query
8
-        if($_GET['start_date'] != "" && $_GET['end_date'] != ""){
8
+        if ($_GET['start_date'] != "" && $_GET['end_date'] != "") {
9 9
                 $start_date = $_GET['start_date'].":00";
10 10
                 $end_date = $_GET['end_date'].":00";
11 11
                 $sql_date = $start_date.",".$end_date;
12
-        } else if($_GET['start_date'] != ""){
12
+        } else if ($_GET['start_date'] != "") {
13 13
                 $start_date = $_GET['start_date'].":00";
14 14
                 $sql_date = $start_date;
15
-        } else if($_GET['start_date'] == "" && $_GET['end_date'] != ""){
15
+        } else if ($_GET['start_date'] == "" && $_GET['end_date'] != "") {
16 16
                 $end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")).",".$_GET['end_date'].":00";
17 17
                 $sql_date = $end_date;
18 18
         } else $sql_date = '';
@@ -20,21 +20,21 @@  discard block
 block discarded – undo
20 20
 
21 21
 if (isset($_GET['highest_altitude'])) {
22 22
         //for altitude manipulation
23
-        if($_GET['highest_altitude'] != "" && $_GET['lowest_altitude'] != ""){
23
+        if ($_GET['highest_altitude'] != "" && $_GET['lowest_altitude'] != "") {
24 24
                 $end_altitude = $_GET['highest_altitude'];
25 25
                 $start_altitude = $_GET['lowest_altitude'];
26 26
                 $sql_altitude = $start_altitude.",".$end_altitude;
27
-        } else if($_GET['highest_altitude'] != ""){
27
+        } else if ($_GET['highest_altitude'] != "") {
28 28
                 $end_altitude = $_GET['highest_altitude'];
29 29
                 $sql_altitude = $end_altitude;
30
-        } else if($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != ""){
30
+        } else if ($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != "") {
31 31
                 $start_altitude = $_GET['lowest_altitude'].",60000";
32 32
                 $sql_altitude = $start_altitude;
33 33
         } else $sql_altitude = '';
34 34
 } else $sql_altitude = '';
35 35
 
36 36
 //calculuation for the pagination
37
-if(!isset($_GET['limit']))
37
+if (!isset($_GET['limit']))
38 38
 {
39 39
         if (!isset($_GET['number_results']))
40 40
         {
@@ -42,14 +42,14 @@  discard block
 block discarded – undo
42 42
                 $limit_end = 25;
43 43
                 $absolute_difference = 25;
44 44
         } else {
45
-                if ($_GET['number_results'] > 1000){
45
+                if ($_GET['number_results'] > 1000) {
46 46
                         $_GET['number_results'] = 1000;
47 47
                 }
48 48
                 $limit_start = 0;
49 49
                 $limit_end = $_GET['number_results'];
50 50
                 $absolute_difference = $_GET['number_results'];
51 51
         }
52
-}  else {
52
+} else {
53 53
         $limit_explode = explode(",", $_GET['limit']);
54 54
         $limit_start = $limit_explode[0];
55 55
         $limit_end = $limit_explode[1];
@@ -69,30 +69,30 @@  discard block
 block discarded – undo
69 69
 
70 70
 if (isset($_GET['sort'])) $sort = $_GET['sort'];
71 71
 else $sort = '';
72
-$q = filter_input(INPUT_GET,'q',FILTER_SANITIZE_STRING);
73
-$registration = filter_input(INPUT_GET,'registratrion',FILTER_SANITIZE_STRING);
74
-$aircraft = filter_input(INPUT_GET,'aircraft',FILTER_SANITIZE_STRING);
75
-$manufacturer = filter_input(INPUT_GET,'manufacturer',FILTER_SANITIZE_STRING);
76
-$highlights = filter_input(INPUT_GET,'highlights',FILTER_SANITIZE_STRING);
77
-$airline = filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING);
78
-$airline_country = filter_input(INPUT_GET,'airline_country',FILTER_SANITIZE_STRING);
79
-$airline_type = filter_input(INPUT_GET,'airline_type',FILTER_SANITIZE_STRING);
80
-$airport = filter_input(INPUT_GET,'airport',FILTER_SANITIZE_STRING);
81
-$airport_country = filter_input(INPUT_GET,'airport_country',FILTER_SANITIZE_STRING);
82
-$callsign = filter_input(INPUT_GET,'callsign',FILTER_SANITIZE_STRING);
83
-$owner = filter_input(INPUT_GET,'owner',FILTER_SANITIZE_STRING);
84
-$pilot_id = filter_input(INPUT_GET,'pilot_id',FILTER_SANITIZE_STRING);
85
-$pilot_name = filter_input(INPUT_GET,'pilot_name',FILTER_SANITIZE_STRING);
86
-$departure_airport_route = filter_input(INPUT_GET,'departure_airport_route',FILTER_SANITIZE_STRING);
87
-$arrival_airport_route = filter_input(INPUT_GET,'arrival_airport_route',FILTER_SANITIZE_STRING);
88
-$spotter_array = $Spotter->searchSpotterData($q,$registration,$aircraft,strtolower(str_replace("-", " ", $manufacturer)),$highlights,$airline,$airline_country,$airline_type,$airport,$airport_country,$callsign,$departure_airport_route,$arrival_airport_route,$owner,$pilot_id,$pilot_name,$sql_altitude,$sql_date,$limit_start.",".$absolute_difference,$sort,'');
72
+$q = filter_input(INPUT_GET, 'q', FILTER_SANITIZE_STRING);
73
+$registration = filter_input(INPUT_GET, 'registratrion', FILTER_SANITIZE_STRING);
74
+$aircraft = filter_input(INPUT_GET, 'aircraft', FILTER_SANITIZE_STRING);
75
+$manufacturer = filter_input(INPUT_GET, 'manufacturer', FILTER_SANITIZE_STRING);
76
+$highlights = filter_input(INPUT_GET, 'highlights', FILTER_SANITIZE_STRING);
77
+$airline = filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING);
78
+$airline_country = filter_input(INPUT_GET, 'airline_country', FILTER_SANITIZE_STRING);
79
+$airline_type = filter_input(INPUT_GET, 'airline_type', FILTER_SANITIZE_STRING);
80
+$airport = filter_input(INPUT_GET, 'airport', FILTER_SANITIZE_STRING);
81
+$airport_country = filter_input(INPUT_GET, 'airport_country', FILTER_SANITIZE_STRING);
82
+$callsign = filter_input(INPUT_GET, 'callsign', FILTER_SANITIZE_STRING);
83
+$owner = filter_input(INPUT_GET, 'owner', FILTER_SANITIZE_STRING);
84
+$pilot_id = filter_input(INPUT_GET, 'pilot_id', FILTER_SANITIZE_STRING);
85
+$pilot_name = filter_input(INPUT_GET, 'pilot_name', FILTER_SANITIZE_STRING);
86
+$departure_airport_route = filter_input(INPUT_GET, 'departure_airport_route', FILTER_SANITIZE_STRING);
87
+$arrival_airport_route = filter_input(INPUT_GET, 'arrival_airport_route', FILTER_SANITIZE_STRING);
88
+$spotter_array = $Spotter->searchSpotterData($q, $registration, $aircraft, strtolower(str_replace("-", " ", $manufacturer)), $highlights, $airline, $airline_country, $airline_type, $airport, $airport_country, $callsign, $departure_airport_route, $arrival_airport_route, $owner, $pilot_id, $pilot_name, $sql_altitude, $sql_date, $limit_start.",".$absolute_difference, $sort, '');
89 89
        
90 90
 $i = 1;      
91 91
 //$output .= "oid;Line\n";
92 92
 $output = '';
93 93
 if (!empty($spotter_array))
94 94
 {
95
-	foreach($spotter_array as $spotter_item)
95
+	foreach ($spotter_array as $spotter_item)
96 96
 	{
97 97
 		if ($spotter_item['waypoints'] != '') {
98 98
 			$waypoint_pieces = explode(' ', $spotter_item['waypoints']);
Please login to merge, or discard this patch.
Braces   +18 added lines, -7 removed lines patch added patch discarded remove patch
@@ -15,8 +15,12 @@  discard block
 block discarded – undo
15 15
         } else if($_GET['start_date'] == "" && $_GET['end_date'] != ""){
16 16
                 $end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")).",".$_GET['end_date'].":00";
17 17
                 $sql_date = $end_date;
18
-        } else $sql_date = '';
19
-} else $sql_date = '';
18
+        } else {
19
+        	$sql_date = '';
20
+        }
21
+        } else {
22
+	$sql_date = '';
23
+}
20 24
 
21 25
 if (isset($_GET['highest_altitude'])) {
22 26
         //for altitude manipulation
@@ -30,8 +34,12 @@  discard block
 block discarded – undo
30 34
         } else if($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != ""){
31 35
                 $start_altitude = $_GET['lowest_altitude'].",60000";
32 36
                 $sql_altitude = $start_altitude;
33
-        } else $sql_altitude = '';
34
-} else $sql_altitude = '';
37
+        } else {
38
+        	$sql_altitude = '';
39
+        }
40
+        } else {
41
+	$sql_altitude = '';
42
+}
35 43
 
36 44
 //calculuation for the pagination
37 45
 if(!isset($_GET['limit']))
@@ -49,7 +57,7 @@  discard block
 block discarded – undo
49 57
                 $limit_end = $_GET['number_results'];
50 58
                 $absolute_difference = $_GET['number_results'];
51 59
         }
52
-}  else {
60
+} else {
53 61
         $limit_explode = explode(",", $_GET['limit']);
54 62
         $limit_start = $limit_explode[0];
55 63
         $limit_end = $limit_explode[1];
@@ -67,8 +75,11 @@  discard block
 block discarded – undo
67 75
 
68 76
 header("Content-type: text/yaml");
69 77
 
70
-if (isset($_GET['sort'])) $sort = $_GET['sort'];
71
-else $sort = '';
78
+if (isset($_GET['sort'])) {
79
+	$sort = $_GET['sort'];
80
+} else {
81
+	$sort = '';
82
+}
72 83
 $q = filter_input(INPUT_GET,'q',FILTER_SANITIZE_STRING);
73 84
 $registration = filter_input(INPUT_GET,'registratrion',FILTER_SANITIZE_STRING);
74 85
 $aircraft = filter_input(INPUT_GET,'aircraft',FILTER_SANITIZE_STRING);
Please login to merge, or discard this patch.
statistics-airport-arrival.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
         	["'._("Airport").'", "'._("# of times").'"],';
27 27
 
28 28
 $airport_data = '';
29
-foreach($airport_airport_array as $airport_item)
29
+foreach ($airport_airport_array as $airport_item)
30 30
 {
31 31
 	$name = $airport_item['airport_departure_city'].', '.$airport_item['airport_departure_country'].' ('.$airport_item['airport_departure_icao'].')';
32 32
 	$name = str_replace("'", "", $name);
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 print '</thead>';
65 65
 print '<tbody>';
66 66
 $i = 1;
67
-foreach($airport_airport_array as $airport_item)
67
+foreach ($airport_airport_array as $airport_item)
68 68
 {
69 69
 	print '<tr>';
70 70
 	print '<td><strong>'.$i.'</strong></td>';
Please login to merge, or discard this patch.
statistics-airline.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
             var data = google.visualization.arrayToDataTable([
24 24
             	["'._("Country").'", "'._("# of times").'"], ';
25 25
 $country_data = '';
26
-foreach($airline_array as $airline_item)
26
+foreach ($airline_array as $airline_item)
27 27
 {
28 28
 	$country_data .= '[ "'.$airline_item['airline_country'].'",'.$airline_item['airline_country_count'].'],';
29 29
 }
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 	print '</thead>';
58 58
 	print '<tbody>';
59 59
 	$i = 1;
60
-	foreach($airline_array as $airline_item)
60
+	foreach ($airline_array as $airline_item)
61 61
 	{
62 62
 		print '<tr>';
63 63
 		print '<td><strong>'.$i.'</strong></td>';
Please login to merge, or discard this patch.
require/class.SpotterArchive.php 3 patches
Spacing   +78 added lines, -78 removed lines patch added patch discarded remove patch
@@ -11,28 +11,28 @@  discard block
 block discarded – undo
11 11
 
12 12
     // Spotter_archive
13 13
     
14
-    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 = '', $heading = '', $ground_speed = '', $squawk = '', $ModeS = '', $pilot_id = '', $pilot_name = '',$verticalrate = '',$format_source = '', $source_name = '', $over_country = '') {
14
+    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 = '', $heading = '', $ground_speed = '', $squawk = '', $ModeS = '', $pilot_id = '', $pilot_name = '', $verticalrate = '', $format_source = '', $source_name = '', $over_country = '') {
15 15
 	require_once(dirname(__FILE__).'/class.Spotter.php');
16 16
         if ($over_country == '') {
17 17
 	        $Spotter = new Spotter($this->db);
18
-	        $data_country = $Spotter->getCountryFromLatitudeLongitude($latitude,$longitude);
18
+	        $data_country = $Spotter->getCountryFromLatitudeLongitude($latitude, $longitude);
19 19
 		if (!empty($data_country)) $country = $data_country['iso2'];
20 20
 		else $country = '';
21 21
 	} else $country = $over_country;
22
-	if ($airline_type === NULL) $airline_type ='';
22
+	if ($airline_type === NULL) $airline_type = '';
23 23
 	
24 24
 	//if ($country == '') echo "\n".'************ UNKNOW COUNTRY ****************'."\n";
25 25
 	//else echo "\n".'*/*/*/*/*/*/*/ Country : '.$country.' */*/*/*/*/*/*/*/*/'."\n";
26 26
 
27 27
 	// Route is not added in spotter_archive
28
-	$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)
28
+	$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)
29 29
                 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)";
30 30
 
31
-        $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);
31
+        $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);
32 32
         try {
33 33
             $sth = $this->db->prepare($query);
34 34
             $sth->execute($query_values);
35
-        } catch(PDOException $e) {
35
+        } catch (PDOException $e) {
36 36
             return "error : ".$e->getMessage();
37 37
         }
38 38
         return "success";
@@ -52,9 +52,9 @@  discard block
 block discarded – undo
52 52
 
53 53
                 $ident = filter_var($ident, FILTER_SANITIZE_STRING);
54 54
                 //$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";
55
-                $query  = "SELECT spotter_archive.* FROM spotter_archive WHERE ident = :ident ORDER BY date DESC LIMIT 1";
55
+                $query = "SELECT spotter_archive.* FROM spotter_archive WHERE ident = :ident ORDER BY date DESC LIMIT 1";
56 56
 
57
-                $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident));
57
+                $spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident));
58 58
 
59 59
                 return $spotter_array;
60 60
         }
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
                 $id = filter_var($id, FILTER_SANITIZE_STRING);
74 74
                 //$query  = SpotterArchive->$global_query." WHERE spotter_archive.flightaware_id = :id";
75 75
                 //$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";
76
-                $query  = "SELECT * FROM spotter_archive WHERE flightaware_id = :id ORDER BY date DESC LIMIT 1";
76
+                $query = "SELECT * FROM spotter_archive WHERE flightaware_id = :id ORDER BY date DESC LIMIT 1";
77 77
 
78 78
 //              $spotter_array = Spotter->getDataFromDB($query,array(':id' => $id));
79 79
                   /*
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
                 }
87 87
                 $spotter_array = $sth->fetchAll(PDO->FETCH_ASSOC);
88 88
                 */
89
-                $spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id));
89
+                $spotter_array = $Spotter->getDataFromDB($query, array(':id' => $id));
90 90
 
91 91
                 return $spotter_array;
92 92
         }
@@ -101,14 +101,14 @@  discard block
 block discarded – undo
101 101
         {
102 102
                 date_default_timezone_set('UTC');
103 103
                 $id = filter_var($id, FILTER_SANITIZE_STRING);
104
-                $query  = $this->global_query." WHERE spotter_archive.flightaware_id = :id";
104
+                $query = $this->global_query." WHERE spotter_archive.flightaware_id = :id";
105 105
 
106 106
 //              $spotter_array = Spotter->getDataFromDB($query,array(':id' => $id));
107 107
 
108 108
                 try {
109 109
                         $sth = $this->db->prepare($query);
110 110
                         $sth->execute(array(':id' => $id));
111
-                } catch(PDOException $e) {
111
+                } catch (PDOException $e) {
112 112
                         return "error";
113 113
                 }
114 114
                 $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -126,14 +126,14 @@  discard block
 block discarded – undo
126 126
         {
127 127
                 date_default_timezone_set('UTC');
128 128
                 $id = filter_var($id, FILTER_SANITIZE_STRING);
129
-                $query  = "SELECT spotter_archive.latitude, spotter_archive.longitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id";
129
+                $query = "SELECT spotter_archive.latitude, spotter_archive.longitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id";
130 130
 
131 131
 //              $spotter_array = Spotter->getDataFromDB($query,array(':id' => $id));
132 132
 
133 133
                 try {
134 134
                         $sth = $this->db->prepare($query);
135 135
                         $sth->execute(array(':id' => $id));
136
-                } catch(PDOException $e) {
136
+                } catch (PDOException $e) {
137 137
                         return $e->getMessage();
138 138
                 }
139 139
                 $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -154,12 +154,12 @@  discard block
 block discarded – undo
154 154
                 date_default_timezone_set('UTC');
155 155
 
156 156
                 $ident = filter_var($ident, FILTER_SANITIZE_STRING);
157
-                $query  = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.ident = :ident";
157
+                $query = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.ident = :ident";
158 158
 
159 159
                 try {
160 160
                         $sth = $this->db->prepare($query);
161 161
                         $sth->execute(array(':ident' => $ident));
162
-                } catch(PDOException $e) {
162
+                } catch (PDOException $e) {
163 163
                         return "error";
164 164
                 }
165 165
                 $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -179,12 +179,12 @@  discard block
 block discarded – undo
179 179
                 date_default_timezone_set('UTC');
180 180
 
181 181
                 $id = filter_var($id, FILTER_SANITIZE_STRING);
182
-                $query  = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id";
182
+                $query = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id";
183 183
 
184 184
                 try {
185 185
                         $sth = $this->db->prepare($query);
186 186
                         $sth->execute(array(':id' => $id));
187
-                } catch(PDOException $e) {
187
+                } catch (PDOException $e) {
188 188
                         return "error";
189 189
                 }
190 190
                 $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -204,12 +204,12 @@  discard block
 block discarded – undo
204 204
                 date_default_timezone_set('UTC');
205 205
 
206 206
                 $id = filter_var($id, FILTER_SANITIZE_STRING);
207
-                $query  = "SELECT spotter_archive.altitude, spotter_archive.ground_speed, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id";
207
+                $query = "SELECT spotter_archive.altitude, spotter_archive.ground_speed, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id";
208 208
 
209 209
                 try {
210 210
                         $sth = $this->db->prepare($query);
211 211
                         $sth->execute(array(':id' => $id));
212
-                } catch(PDOException $e) {
212
+                } catch (PDOException $e) {
213 213
 		        return "error : ".$e->getMessage();
214 214
                 }
215 215
                 $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -230,13 +230,13 @@  discard block
 block discarded – undo
230 230
                 date_default_timezone_set('UTC');
231 231
 
232 232
                 $ident = filter_var($ident, FILTER_SANITIZE_STRING);
233
-                $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";
233
+                $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";
234 234
 //                $query  = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.ident = :ident";
235 235
 
236 236
                 try {
237 237
                         $sth = $this->db->prepare($query);
238 238
                         $sth->execute(array(':ident' => $ident));
239
-                } catch(PDOException $e) {
239
+                } catch (PDOException $e) {
240 240
                         return "error";
241 241
                 }
242 242
                 $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -252,13 +252,13 @@  discard block
 block discarded – undo
252 252
         * @return Array the spotter information
253 253
         *
254 254
         */
255
-        public function getSpotterArchiveData($ident,$flightaware_id,$date)
255
+        public function getSpotterArchiveData($ident, $flightaware_id, $date)
256 256
         {
257 257
     		$Spotter = new Spotter($this->db);
258 258
                 $ident = filter_var($ident, FILTER_SANITIZE_STRING);
259
-                $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";
259
+                $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";
260 260
 
261
-                $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident,':flightaware_id' => $flightaware_id,':date' => $date.'%'));
261
+                $spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident, ':flightaware_id' => $flightaware_id, ':date' => $date.'%'));
262 262
 
263 263
                 return $spotter_array;
264 264
         }
@@ -271,7 +271,7 @@  discard block
 block discarded – undo
271 271
                 try {
272 272
                         $sth = $this->db->prepare($query);
273 273
                         $sth->execute();
274
-                } catch(PDOException $e) {
274
+                } catch (PDOException $e) {
275 275
                         return "error";
276 276
                 }
277 277
 	}
@@ -282,24 +282,24 @@  discard block
 block discarded – undo
282 282
         * @return Array the spotter information
283 283
         *
284 284
         */
285
-        public function getMinLiveSpotterData($begindate,$enddate,$filter = array())
285
+        public function getMinLiveSpotterData($begindate, $enddate, $filter = array())
286 286
         {
287 287
                 global $globalDBdriver, $globalLiveInterval;
288 288
                 date_default_timezone_set('UTC');
289 289
 
290 290
                 $filter_query = '';
291 291
                 if (isset($filter['source']) && !empty($filter['source'])) {
292
-                        $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') ";
292
+                        $filter_query .= " AND format_source IN ('".implode("','", $filter['source'])."') ";
293 293
                 }
294 294
                 // Use spotter_output also ?
295 295
                 if (isset($filter['airlines']) && !empty($filter['airlines'])) {
296
-                        $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 ";
296
+                        $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 ";
297 297
                 }
298 298
                 if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
299 299
                         $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 ";
300 300
                 }
301 301
                 if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
302
-                        $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
302
+                        $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')";
303 303
                 }
304 304
 
305 305
                 //if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
                     		    FROM spotter_archive 
310 310
                     		    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';
311 311
 			*/
312
-			$query  = 'SELECT a.aircraft_shadow, 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 
312
+			$query = 'SELECT a.aircraft_shadow, 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 
313 313
 				    FROM spotter_archive 
314 314
 				    INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate 
315 315
 						FROM spotter_archive l 
@@ -317,13 +317,13 @@  discard block
 block discarded – undo
317 317
 						GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id 
318 318
 				    AND spotter_archive.date = s.maxdate '.$filter_query.'LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON spotter_archive.aircraft_icao = a.icao';
319 319
                 } else if ($globalDBdriver == 'pgsql') {
320
-                        $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';
320
+                        $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';
321 321
                 }
322 322
                 //echo $query;
323 323
                 try {
324 324
                         $sth = $this->db->prepare($query);
325 325
                         $sth->execute();
326
-                } catch(PDOException $e) {
326
+                } catch (PDOException $e) {
327 327
                         return "error";
328 328
                 }
329 329
                 $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -337,24 +337,24 @@  discard block
 block discarded – undo
337 337
         * @return Array the spotter information
338 338
         *
339 339
         */
340
-        public function getMinLiveSpotterDataPlayback($begindate,$enddate,$filter = array())
340
+        public function getMinLiveSpotterDataPlayback($begindate, $enddate, $filter = array())
341 341
         {
342 342
                 global $globalDBdriver, $globalLiveInterval;
343 343
                 date_default_timezone_set('UTC');
344 344
 
345 345
                 $filter_query = '';
346 346
                 if (isset($filter['source']) && !empty($filter['source'])) {
347
-                        $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') ";
347
+                        $filter_query .= " AND format_source IN ('".implode("','", $filter['source'])."') ";
348 348
                 }
349 349
                 // FIXME : use spotter_output also
350 350
                 if (isset($filter['airlines']) && !empty($filter['airlines'])) {
351
-                        $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 ";
351
+                        $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 ";
352 352
                 }
353 353
                 if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
354 354
                         $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 ";
355 355
                 }
356 356
                 if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
357
-                        $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
357
+                        $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')";
358 358
                 }
359 359
 
360 360
                 //if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
@@ -364,7 +364,7 @@  discard block
 block discarded – undo
364 364
                     		    FROM spotter_archive 
365 365
                     		    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';
366 366
 			*/
367
-			$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 
367
+			$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 
368 368
 				    FROM spotter_archive_output 
369 369
 				    LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON spotter_archive_output.aircraft_icao = a.icao 
370 370
 				    WHERE (spotter_archive_output.date BETWEEN '."'".$begindate."'".' AND '."'".$enddate."'".') 
@@ -372,12 +372,12 @@  discard block
 block discarded – undo
372 372
 
373 373
                 } else if ($globalDBdriver == 'pgsql') {
374 374
                         //$query  = 'SELECT 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, a.aircraft_shadow FROM spotter_archive_output INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive_output l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_archive_output.flightaware_id = s.flightaware_id AND spotter_archive_output.date = s.maxdate '.$filter_query.'INNER JOIN (SELECT * FROM aircraft) a on spotter_archive_output.aircraft_icao = a.icao';
375
-                        $query  = 'SELECT 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, a.aircraft_shadow
375
+                        $query = 'SELECT 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, a.aircraft_shadow
376 376
                         	    FROM spotter_archive_output 
377 377
                         	    INNER JOIN (SELECT * FROM aircraft) a on spotter_archive_output.aircraft_icao = a.icao
378 378
                         	    WHERE spotter_archive_output.date >= '."'".$begindate."'".' AND spotter_archive_output.date <= '."'".$enddate."'".'
379 379
                         	    '.$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';
380
-                        $query  = 'SELECT DISTINCT spotter_output.flightaware_id, spotter_output.ident, spotter_output.aircraft_icao, spotter_output.departure_airport_icao as departure_airport, spotter_output.arrival_airport_icao as arrival_airport, spotter_output.latitude, spotter_output.longitude, spotter_output.altitude, spotter_output.heading, spotter_output.ground_speed, spotter_output.squawk, a.aircraft_shadow
380
+                        $query = 'SELECT DISTINCT spotter_output.flightaware_id, spotter_output.ident, spotter_output.aircraft_icao, spotter_output.departure_airport_icao as departure_airport, spotter_output.arrival_airport_icao as arrival_airport, spotter_output.latitude, spotter_output.longitude, spotter_output.altitude, spotter_output.heading, spotter_output.ground_speed, spotter_output.squawk, a.aircraft_shadow
381 381
                         	    FROM spotter_output 
382 382
                         	    INNER JOIN (SELECT * FROM aircraft) a on spotter_output.aircraft_icao = a.icao
383 383
                         	    WHERE spotter_output.date >= '."'".$begindate."'".' AND spotter_output.date <= '."'".$enddate."'".'
@@ -389,7 +389,7 @@  discard block
 block discarded – undo
389 389
                 try {
390 390
                         $sth = $this->db->prepare($query);
391 391
                         $sth->execute();
392
-                } catch(PDOException $e) {
392
+                } catch (PDOException $e) {
393 393
                         return $e->getMessage();
394 394
                 }
395 395
                 $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -403,23 +403,23 @@  discard block
 block discarded – undo
403 403
         * @return Array the spotter information
404 404
         *
405 405
         */
406
-        public function getLiveSpotterCount($begindate,$enddate,$filter = array())
406
+        public function getLiveSpotterCount($begindate, $enddate, $filter = array())
407 407
         {
408 408
                 global $globalDBdriver, $globalLiveInterval;
409 409
                 date_default_timezone_set('UTC');
410 410
 
411 411
                 $filter_query = '';
412 412
                 if (isset($filter['source']) && !empty($filter['source'])) {
413
-                        $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') ";
413
+                        $filter_query .= " AND format_source IN ('".implode("','", $filter['source'])."') ";
414 414
                 }
415 415
                 if (isset($filter['airlines']) && !empty($filter['airlines'])) {
416
-                        $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 ";
416
+                        $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 ";
417 417
                 }
418 418
                 if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
419 419
                         $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 ";
420 420
                 }
421 421
                 if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
422
-                        $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
422
+                        $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')";
423 423
                 }
424 424
 
425 425
                 //if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
@@ -435,7 +435,7 @@  discard block
 block discarded – undo
435 435
                 try {
436 436
                         $sth = $this->db->prepare($query);
437 437
                         $sth->execute();
438
-                } catch(PDOException $e) {
438
+                } catch (PDOException $e) {
439 439
                         return "error";
440 440
                 }
441 441
 		$result = $sth->fetch(PDO::FETCH_ASSOC);
@@ -453,7 +453,7 @@  discard block
 block discarded – undo
453 453
     * @return Array the spotter information
454 454
     *
455 455
     */
456
-    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 = '')
456
+    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 = '')
457 457
     {
458 458
 	global $globalTimezone, $globalDbdriver;
459 459
 	require_once(dirname(__FILE__).'/class.Translation.php');
@@ -472,7 +472,7 @@  discard block
 block discarded – undo
472 472
 	        
473 473
 		$q_array = explode(" ", $q);
474 474
 		
475
-		foreach ($q_array as $q_item){
475
+		foreach ($q_array as $q_item) {
476 476
 		    $additional_query .= " AND (";
477 477
 		    $additional_query .= "(spotter_archive_output.spotter_id like '%".$q_item."%') OR ";
478 478
 		    $additional_query .= "(spotter_archive_output.aircraft_icao like '%".$q_item."%') OR ";
@@ -504,7 +504,7 @@  discard block
 block discarded – undo
504 504
 	
505 505
 	if ($registration != "")
506 506
 	{
507
-	    $registration = filter_var($registration,FILTER_SANITIZE_STRING);
507
+	    $registration = filter_var($registration, FILTER_SANITIZE_STRING);
508 508
 	    if (!is_string($registration))
509 509
 	    {
510 510
 		return false;
@@ -515,7 +515,7 @@  discard block
 block discarded – undo
515 515
 	
516 516
 	if ($aircraft_icao != "")
517 517
 	{
518
-	    $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
518
+	    $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
519 519
 	    if (!is_string($aircraft_icao))
520 520
 	    {
521 521
 		return false;
@@ -526,7 +526,7 @@  discard block
 block discarded – undo
526 526
 	
527 527
 	if ($aircraft_manufacturer != "")
528 528
 	{
529
-	    $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
529
+	    $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
530 530
 	    if (!is_string($aircraft_manufacturer))
531 531
 	    {
532 532
 		return false;
@@ -547,7 +547,7 @@  discard block
 block discarded – undo
547 547
 	
548 548
 	if ($airline_icao != "")
549 549
 	{
550
-	    $registration = filter_var($airline_icao,FILTER_SANITIZE_STRING);
550
+	    $registration = filter_var($airline_icao, FILTER_SANITIZE_STRING);
551 551
 	    if (!is_string($airline_icao))
552 552
 	    {
553 553
 		return false;
@@ -558,7 +558,7 @@  discard block
 block discarded – undo
558 558
 	
559 559
 	if ($airline_country != "")
560 560
 	{
561
-	    $airline_country = filter_var($airline_country,FILTER_SANITIZE_STRING);
561
+	    $airline_country = filter_var($airline_country, FILTER_SANITIZE_STRING);
562 562
 	    if (!is_string($airline_country))
563 563
 	    {
564 564
 		return false;
@@ -569,7 +569,7 @@  discard block
 block discarded – undo
569 569
 	
570 570
 	if ($airline_type != "")
571 571
 	{
572
-	    $airline_type = filter_var($airline_type,FILTER_SANITIZE_STRING);
572
+	    $airline_type = filter_var($airline_type, FILTER_SANITIZE_STRING);
573 573
 	    if (!is_string($airline_type))
574 574
 	    {
575 575
 		return false;
@@ -591,7 +591,7 @@  discard block
 block discarded – undo
591 591
 	
592 592
 	if ($airport != "")
593 593
 	{
594
-	    $airport = filter_var($airport,FILTER_SANITIZE_STRING);
594
+	    $airport = filter_var($airport, FILTER_SANITIZE_STRING);
595 595
 	    if (!is_string($airport))
596 596
 	    {
597 597
 		return false;
@@ -602,7 +602,7 @@  discard block
 block discarded – undo
602 602
 	
603 603
 	if ($airport_country != "")
604 604
 	{
605
-	    $airport_country = filter_var($airport_country,FILTER_SANITIZE_STRING);
605
+	    $airport_country = filter_var($airport_country, FILTER_SANITIZE_STRING);
606 606
 	    if (!is_string($airport_country))
607 607
 	    {
608 608
 		return false;
@@ -613,7 +613,7 @@  discard block
 block discarded – undo
613 613
     
614 614
 	if ($callsign != "")
615 615
 	{
616
-	    $callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
616
+	    $callsign = filter_var($callsign, FILTER_SANITIZE_STRING);
617 617
 	    if (!is_string($callsign))
618 618
 	    {
619 619
 		return false;
@@ -621,7 +621,7 @@  discard block
 block discarded – undo
621 621
 		$translate = $Translation->ident2icao($callsign);
622 622
 		if ($translate != $callsign) {
623 623
 			$additional_query .= " AND (spotter_archive_output.ident = :callsign OR spotter_archive_output.ident = :translate)";
624
-			$query_values = array_merge($query_values,array(':callsign' => $callsign,':translate' => $translate));
624
+			$query_values = array_merge($query_values, array(':callsign' => $callsign, ':translate' => $translate));
625 625
 		} else {
626 626
 			$additional_query .= " AND (spotter_archive_output.ident = '".$callsign."')";
627 627
 		}
@@ -630,7 +630,7 @@  discard block
 block discarded – undo
630 630
 
631 631
 	if ($owner != "")
632 632
 	{
633
-	    $owner = filter_var($owner,FILTER_SANITIZE_STRING);
633
+	    $owner = filter_var($owner, FILTER_SANITIZE_STRING);
634 634
 	    if (!is_string($owner))
635 635
 	    {
636 636
 		return false;
@@ -641,7 +641,7 @@  discard block
 block discarded – undo
641 641
 
642 642
 	if ($pilot_name != "")
643 643
 	{
644
-	    $pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING);
644
+	    $pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING);
645 645
 	    if (!is_string($pilot_name))
646 646
 	    {
647 647
 		return false;
@@ -652,7 +652,7 @@  discard block
 block discarded – undo
652 652
 	
653 653
 	if ($pilot_id != "")
654 654
 	{
655
-	    $pilot_id = filter_var($pilot_id,FILTER_SANITIZE_NUMBER_INT);
655
+	    $pilot_id = filter_var($pilot_id, FILTER_SANITIZE_NUMBER_INT);
656 656
 	    if (!is_string($pilot_id))
657 657
 	    {
658 658
 		return false;
@@ -663,7 +663,7 @@  discard block
 block discarded – undo
663 663
 	
664 664
 	if ($departure_airport_route != "")
665 665
 	{
666
-	    $departure_airport_route = filter_var($departure_airport_route,FILTER_SANITIZE_STRING);
666
+	    $departure_airport_route = filter_var($departure_airport_route, FILTER_SANITIZE_STRING);
667 667
 	    if (!is_string($departure_airport_route))
668 668
 	    {
669 669
 		return false;
@@ -674,7 +674,7 @@  discard block
 block discarded – undo
674 674
 	
675 675
 	if ($arrival_airport_route != "")
676 676
 	{
677
-	    $arrival_airport_route = filter_var($arrival_airport_route,FILTER_SANITIZE_STRING);
677
+	    $arrival_airport_route = filter_var($arrival_airport_route, FILTER_SANITIZE_STRING);
678 678
 	    if (!is_string($arrival_airport_route))
679 679
 	    {
680 680
 		return false;
@@ -687,8 +687,8 @@  discard block
 block discarded – undo
687 687
 	{
688 688
 	    $altitude_array = explode(",", $altitude);
689 689
 	    
690
-	    $altitude_array[0] = filter_var($altitude_array[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
691
-	    $altitude_array[1] = filter_var($altitude_array[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
690
+	    $altitude_array[0] = filter_var($altitude_array[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
691
+	    $altitude_array[1] = filter_var($altitude_array[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
692 692
 	    
693 693
 
694 694
 	    if ($altitude_array[1] != "")
@@ -706,8 +706,8 @@  discard block
 block discarded – undo
706 706
 	{
707 707
 	    $date_array = explode(",", $date_posted);
708 708
 	    
709
-	    $date_array[0] = filter_var($date_array[0],FILTER_SANITIZE_STRING);
710
-	    $date_array[1] = filter_var($date_array[1],FILTER_SANITIZE_STRING);
709
+	    $date_array[0] = filter_var($date_array[0], FILTER_SANITIZE_STRING);
710
+	    $date_array[1] = filter_var($date_array[1], FILTER_SANITIZE_STRING);
711 711
 	    
712 712
 	    if ($globalTimezone != '') {
713 713
 		date_default_timezone_set($globalTimezone);
@@ -739,8 +739,8 @@  discard block
 block discarded – undo
739 739
 	{
740 740
 	    $limit_array = explode(",", $limit);
741 741
 	    
742
-	    $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
743
-	    $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
742
+	    $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
743
+	    $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
744 744
 	    
745 745
 	    if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
746 746
 	    {
@@ -751,8 +751,8 @@  discard block
 block discarded – undo
751 751
 	
752 752
 
753 753
 	if ($origLat != "" && $origLon != "" && $dist != "") {
754
-		$dist = number_format($dist*0.621371,2,'.','');
755
-		$query="SELECT spotter_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 
754
+		$dist = number_format($dist*0.621371, 2, '.', '');
755
+		$query = "SELECT spotter_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 
756 756
                           FROM spotter_output_archive, 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)) 
757 757
                           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 ORDER BY distance";
758 758
 	} else {
@@ -769,13 +769,13 @@  discard block
 block discarded – undo
769 769
 			$additional_query .= " AND (spotter_archive_output.waypoints <> '')";
770 770
 		}
771 771
 
772
-		$query  = "SELECT spotter_archive_output.* FROM spotter_archive_output 
772
+		$query = "SELECT spotter_archive_output.* FROM spotter_archive_output 
773 773
 		    WHERE spotter_archive_output.ident <> '' 
774 774
 		    ".$additional_query."
775 775
 		    ".$orderby_query;
776 776
 	}
777 777
 	$Spotter = new Spotter($this->db);
778
-	$spotter_array = $Spotter->getDataFromDB($query, array(),$limit_query);
778
+	$spotter_array = $Spotter->getDataFromDB($query, array(), $limit_query);
779 779
 
780 780
 	return $spotter_array;
781 781
     }
@@ -792,7 +792,7 @@  discard block
 block discarded – undo
792 792
                 try {
793 793
                         $sth = $this->db->prepare($query);
794 794
                         $sth->execute();
795
-                } catch(PDOException $e) {
795
+                } catch (PDOException $e) {
796 796
                         return "error";
797 797
                 }
798 798
 	}
@@ -826,8 +826,8 @@  discard block
 block discarded – undo
826 826
 	{
827 827
 	    $limit_array = explode(",", $limit);
828 828
 	    
829
-	    $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
830
-	    $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
829
+	    $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
830
+	    $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
831 831
 	    
832 832
 	    if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
833 833
 	    {
@@ -858,7 +858,7 @@  discard block
 block discarded – undo
858 858
     * @return Array the airline country list
859 859
     *
860 860
     */
861
-    public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '')
861
+    public function countAllFlightOverCountries($limit = true, $olderthanmonths = 0, $sincedate = '')
862 862
     {
863 863
 	global $globalDBdriver;
864 864
 	/*
@@ -887,7 +887,7 @@  discard block
 block discarded – undo
887 887
 	$flight_array = array();
888 888
 	$temp_array = array();
889 889
         
890
-	while($row = $sth->fetch(PDO::FETCH_ASSOC))
890
+	while ($row = $sth->fetch(PDO::FETCH_ASSOC))
891 891
 	{
892 892
 	    $temp_array['flight_count'] = $row['nb'];
893 893
 	    $temp_array['flight_country'] = $row['name'];
Please login to merge, or discard this patch.
Braces   +23 added lines, -8 removed lines patch added patch discarded remove patch
@@ -16,10 +16,17 @@  discard block
 block discarded – undo
16 16
         if ($over_country == '') {
17 17
 	        $Spotter = new Spotter($this->db);
18 18
 	        $data_country = $Spotter->getCountryFromLatitudeLongitude($latitude,$longitude);
19
-		if (!empty($data_country)) $country = $data_country['iso2'];
20
-		else $country = '';
21
-	} else $country = $over_country;
22
-	if ($airline_type === NULL) $airline_type ='';
19
+		if (!empty($data_country)) {
20
+			$country = $data_country['iso2'];
21
+		} else {
22
+			$country = '';
23
+		}
24
+	} else {
25
+		$country = $over_country;
26
+	}
27
+	if ($airline_type === NULL) {
28
+		$airline_type ='';
29
+	}
23 30
 	
24 31
 	//if ($country == '') echo "\n".'************ UNKNOW COUNTRY ****************'."\n";
25 32
 	//else echo "\n".'*/*/*/*/*/*/*/ Country : '.$country.' */*/*/*/*/*/*/*/*/'."\n";
@@ -495,7 +502,9 @@  discard block
 block discarded – undo
495 502
 		    $additional_query .= "(spotter_archive_output.pilot_name like '%".$q_item."%') OR ";
496 503
 		    $additional_query .= "(spotter_archive_output.ident like '%".$q_item."%') OR ";
497 504
 		    $translate = $Translation->ident2icao($q_item);
498
-		    if ($translate != $q_item) $additional_query .= "(spotter_archive_output.ident like '%".$translate."%') OR ";
505
+		    if ($translate != $q_item) {
506
+		    	$additional_query .= "(spotter_archive_output.ident like '%".$translate."%') OR ";
507
+		    }
499 508
 		    $additional_query .= "(spotter_archive_output.highlight like '%".$q_item."%')";
500 509
 		    $additional_query .= ")";
501 510
 		}
@@ -713,7 +722,9 @@  discard block
 block discarded – undo
713 722
 		date_default_timezone_set($globalTimezone);
714 723
 		$datetime = new DateTime();
715 724
 		$offset = $datetime->format('P');
716
-	    } else $offset = '+00:00';
725
+	    } else {
726
+	    	$offset = '+00:00';
727
+	    }
717 728
 
718 729
 
719 730
 	    if ($date_array[1] != "")
@@ -876,9 +887,13 @@  discard block
 block discarded – undo
876 887
 				$query .= "AND date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
877 888
 			}
878 889
 		}
879
-                if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
890
+                if ($sincedate != '') {
891
+                	$query .= "AND date > '".$sincedate."' ";
892
+                }
880 893
 	$query .= "GROUP BY c.name, c.iso3, c.iso2 ORDER BY nb DESC";
881
-	if ($limit) $query .= " LIMIT 0,10";
894
+	if ($limit) {
895
+		$query .= " LIMIT 0,10";
896
+	}
882 897
       
883 898
 	
884 899
 	$sth = $this->db->prepare($query);
Please login to merge, or discard this patch.
Indentation   +514 added lines, -514 removed lines patch added patch discarded remove patch
@@ -1,21 +1,21 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 class SpotterArchive {
3
-    public $global_query = "SELECT spotter_archive.* FROM spotter_archive";
4
-    public $db;
3
+	public $global_query = "SELECT spotter_archive.* FROM spotter_archive";
4
+	public $db;
5 5
 
6
-    function __construct($dbc = null) {
7
-            $Connection = new Connection($dbc);
8
-            $this->db = $Connection->db;
9
-    }
6
+	function __construct($dbc = null) {
7
+			$Connection = new Connection($dbc);
8
+			$this->db = $Connection->db;
9
+	}
10 10
 
11 11
 
12
-    // Spotter_archive
12
+	// Spotter_archive
13 13
     
14
-    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 = '', $heading = '', $ground_speed = '', $squawk = '', $ModeS = '', $pilot_id = '', $pilot_name = '',$verticalrate = '',$format_source = '', $source_name = '', $over_country = '') {
14
+	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 = '', $heading = '', $ground_speed = '', $squawk = '', $ModeS = '', $pilot_id = '', $pilot_name = '',$verticalrate = '',$format_source = '', $source_name = '', $over_country = '') {
15 15
 	require_once(dirname(__FILE__).'/class.Spotter.php');
16
-        if ($over_country == '') {
17
-	        $Spotter = new Spotter($this->db);
18
-	        $data_country = $Spotter->getCountryFromLatitudeLongitude($latitude,$longitude);
16
+		if ($over_country == '') {
17
+			$Spotter = new Spotter($this->db);
18
+			$data_country = $Spotter->getCountryFromLatitudeLongitude($latitude,$longitude);
19 19
 		if (!empty($data_country)) $country = $data_country['iso2'];
20 20
 		else $country = '';
21 21
 	} else $country = $over_country;
@@ -28,55 +28,55 @@  discard block
 block discarded – undo
28 28
 	$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)
29 29
                 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)";
30 30
 
31
-        $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);
32
-        try {
33
-            $sth = $this->db->prepare($query);
34
-            $sth->execute($query_values);
35
-        } catch(PDOException $e) {
36
-            return "error : ".$e->getMessage();
37
-        }
38
-        return "success";
39
-    }
40
-
41
-
42
-        /**
43
-        * Gets all the spotter information based on a particular callsign
44
-        *
45
-        * @return Array the spotter information
46
-        *
47
-        */
48
-        public function getLastArchiveSpotterDataByIdent($ident)
49
-        {
31
+		$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);
32
+		try {
33
+			$sth = $this->db->prepare($query);
34
+			$sth->execute($query_values);
35
+		} catch(PDOException $e) {
36
+			return "error : ".$e->getMessage();
37
+		}
38
+		return "success";
39
+	}
40
+
41
+
42
+		/**
43
+		 * Gets all the spotter information based on a particular callsign
44
+		 *
45
+		 * @return Array the spotter information
46
+		 *
47
+		 */
48
+		public function getLastArchiveSpotterDataByIdent($ident)
49
+		{
50 50
 		$Spotter = new Spotter($this->db);
51
-                date_default_timezone_set('UTC');
51
+				date_default_timezone_set('UTC');
52 52
 
53
-                $ident = filter_var($ident, FILTER_SANITIZE_STRING);
54
-                //$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";
55
-                $query  = "SELECT spotter_archive.* FROM spotter_archive WHERE ident = :ident ORDER BY date DESC LIMIT 1";
53
+				$ident = filter_var($ident, FILTER_SANITIZE_STRING);
54
+				//$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";
55
+				$query  = "SELECT spotter_archive.* FROM spotter_archive WHERE ident = :ident ORDER BY date DESC LIMIT 1";
56 56
 
57
-                $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident));
57
+				$spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident));
58 58
 
59
-                return $spotter_array;
60
-        }
59
+				return $spotter_array;
60
+		}
61 61
 
62 62
 
63
-        /**
64
-        * Gets last the spotter information based on a particular id
65
-        *
66
-        * @return Array the spotter information
67
-        *
68
-        */
69
-        public function getLastArchiveSpotterDataById($id)
70
-        {
71
-    		$Spotter = new Spotter($this->db);
72
-                date_default_timezone_set('UTC');
73
-                $id = filter_var($id, FILTER_SANITIZE_STRING);
74
-                //$query  = SpotterArchive->$global_query." WHERE spotter_archive.flightaware_id = :id";
75
-                //$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";
76
-                $query  = "SELECT * FROM spotter_archive WHERE flightaware_id = :id ORDER BY date DESC LIMIT 1";
63
+		/**
64
+		 * Gets last the spotter information based on a particular id
65
+		 *
66
+		 * @return Array the spotter information
67
+		 *
68
+		 */
69
+		public function getLastArchiveSpotterDataById($id)
70
+		{
71
+			$Spotter = new Spotter($this->db);
72
+				date_default_timezone_set('UTC');
73
+				$id = filter_var($id, FILTER_SANITIZE_STRING);
74
+				//$query  = SpotterArchive->$global_query." WHERE spotter_archive.flightaware_id = :id";
75
+				//$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";
76
+				$query  = "SELECT * FROM spotter_archive WHERE flightaware_id = :id ORDER BY date DESC LIMIT 1";
77 77
 
78 78
 //              $spotter_array = Spotter->getDataFromDB($query,array(':id' => $id));
79
-                  /*
79
+				  /*
80 80
                 try {
81 81
                         $Connection = new Connection();
82 82
                         $sth = Connection->$db->prepare($query);
@@ -86,225 +86,225 @@  discard block
 block discarded – undo
86 86
                 }
87 87
                 $spotter_array = $sth->fetchAll(PDO->FETCH_ASSOC);
88 88
                 */
89
-                $spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id));
90
-
91
-                return $spotter_array;
92
-        }
93
-
94
-        /**
95
-        * Gets all the spotter information based on a particular id
96
-        *
97
-        * @return Array the spotter information
98
-        *
99
-        */
100
-        public function getAllArchiveSpotterDataById($id)
101
-        {
102
-                date_default_timezone_set('UTC');
103
-                $id = filter_var($id, FILTER_SANITIZE_STRING);
104
-                $query  = $this->global_query." WHERE spotter_archive.flightaware_id = :id";
89
+				$spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id));
90
+
91
+				return $spotter_array;
92
+		}
93
+
94
+		/**
95
+		 * Gets all the spotter information based on a particular id
96
+		 *
97
+		 * @return Array the spotter information
98
+		 *
99
+		 */
100
+		public function getAllArchiveSpotterDataById($id)
101
+		{
102
+				date_default_timezone_set('UTC');
103
+				$id = filter_var($id, FILTER_SANITIZE_STRING);
104
+				$query  = $this->global_query." WHERE spotter_archive.flightaware_id = :id";
105 105
 
106 106
 //              $spotter_array = Spotter->getDataFromDB($query,array(':id' => $id));
107 107
 
108
-                try {
109
-                        $sth = $this->db->prepare($query);
110
-                        $sth->execute(array(':id' => $id));
111
-                } catch(PDOException $e) {
112
-                        return "error";
113
-                }
114
-                $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
115
-
116
-                return $spotter_array;
117
-        }
118
-
119
-        /**
120
-        * Gets coordinate & time spotter information based on a particular id
121
-        *
122
-        * @return Array the spotter information
123
-        *
124
-        */
125
-        public function getCoordArchiveSpotterDataById($id)
126
-        {
127
-                date_default_timezone_set('UTC');
128
-                $id = filter_var($id, FILTER_SANITIZE_STRING);
129
-                $query  = "SELECT spotter_archive.latitude, spotter_archive.longitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id";
108
+				try {
109
+						$sth = $this->db->prepare($query);
110
+						$sth->execute(array(':id' => $id));
111
+				} catch(PDOException $e) {
112
+						return "error";
113
+				}
114
+				$spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
115
+
116
+				return $spotter_array;
117
+		}
118
+
119
+		/**
120
+		 * Gets coordinate & time spotter information based on a particular id
121
+		 *
122
+		 * @return Array the spotter information
123
+		 *
124
+		 */
125
+		public function getCoordArchiveSpotterDataById($id)
126
+		{
127
+				date_default_timezone_set('UTC');
128
+				$id = filter_var($id, FILTER_SANITIZE_STRING);
129
+				$query  = "SELECT spotter_archive.latitude, spotter_archive.longitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id";
130 130
 
131 131
 //              $spotter_array = Spotter->getDataFromDB($query,array(':id' => $id));
132 132
 
133
-                try {
134
-                        $sth = $this->db->prepare($query);
135
-                        $sth->execute(array(':id' => $id));
136
-                } catch(PDOException $e) {
137
-                        return $e->getMessage();
138
-                }
139
-                $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
133
+				try {
134
+						$sth = $this->db->prepare($query);
135
+						$sth->execute(array(':id' => $id));
136
+				} catch(PDOException $e) {
137
+						return $e->getMessage();
138
+				}
139
+				$spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
140 140
 
141
-                return $spotter_array;
142
-        }
141
+				return $spotter_array;
142
+		}
143 143
 
144 144
 
145
-        /**
146
-        * Gets altitude information based on a particular callsign
147
-        *
148
-        * @return Array the spotter information
149
-        *
150
-        */
151
-        public function getAltitudeArchiveSpotterDataByIdent($ident)
152
-        {
145
+		/**
146
+		 * Gets altitude information based on a particular callsign
147
+		 *
148
+		 * @return Array the spotter information
149
+		 *
150
+		 */
151
+		public function getAltitudeArchiveSpotterDataByIdent($ident)
152
+		{
153 153
 
154
-                date_default_timezone_set('UTC');
154
+				date_default_timezone_set('UTC');
155 155
 
156
-                $ident = filter_var($ident, FILTER_SANITIZE_STRING);
157
-                $query  = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.ident = :ident";
156
+				$ident = filter_var($ident, FILTER_SANITIZE_STRING);
157
+				$query  = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.ident = :ident";
158 158
 
159
-                try {
160
-                        $sth = $this->db->prepare($query);
161
-                        $sth->execute(array(':ident' => $ident));
162
-                } catch(PDOException $e) {
163
-                        return "error";
164
-                }
165
-                $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
159
+				try {
160
+						$sth = $this->db->prepare($query);
161
+						$sth->execute(array(':ident' => $ident));
162
+				} catch(PDOException $e) {
163
+						return "error";
164
+				}
165
+				$spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
166 166
 
167
-                return $spotter_array;
168
-        }
167
+				return $spotter_array;
168
+		}
169 169
 
170
-        /**
171
-        * Gets altitude information based on a particular id
172
-        *
173
-        * @return Array the spotter information
174
-        *
175
-        */
176
-        public function getAltitudeArchiveSpotterDataById($id)
177
-        {
170
+		/**
171
+		 * Gets altitude information based on a particular id
172
+		 *
173
+		 * @return Array the spotter information
174
+		 *
175
+		 */
176
+		public function getAltitudeArchiveSpotterDataById($id)
177
+		{
178 178
 
179
-                date_default_timezone_set('UTC');
179
+				date_default_timezone_set('UTC');
180 180
 
181
-                $id = filter_var($id, FILTER_SANITIZE_STRING);
182
-                $query  = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id";
181
+				$id = filter_var($id, FILTER_SANITIZE_STRING);
182
+				$query  = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id";
183 183
 
184
-                try {
185
-                        $sth = $this->db->prepare($query);
186
-                        $sth->execute(array(':id' => $id));
187
-                } catch(PDOException $e) {
188
-                        return "error";
189
-                }
190
-                $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
184
+				try {
185
+						$sth = $this->db->prepare($query);
186
+						$sth->execute(array(':id' => $id));
187
+				} catch(PDOException $e) {
188
+						return "error";
189
+				}
190
+				$spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
191 191
 
192
-                return $spotter_array;
193
-        }
192
+				return $spotter_array;
193
+		}
194 194
 
195
-        /**
196
-        * Gets altitude & speed information based on a particular id
197
-        *
198
-        * @return Array the spotter information
199
-        *
200
-        */
201
-        public function getAltitudeSpeedArchiveSpotterDataById($id)
202
-        {
195
+		/**
196
+		 * Gets altitude & speed information based on a particular id
197
+		 *
198
+		 * @return Array the spotter information
199
+		 *
200
+		 */
201
+		public function getAltitudeSpeedArchiveSpotterDataById($id)
202
+		{
203 203
 
204
-                date_default_timezone_set('UTC');
204
+				date_default_timezone_set('UTC');
205 205
 
206
-                $id = filter_var($id, FILTER_SANITIZE_STRING);
207
-                $query  = "SELECT spotter_archive.altitude, spotter_archive.ground_speed, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id";
206
+				$id = filter_var($id, FILTER_SANITIZE_STRING);
207
+				$query  = "SELECT spotter_archive.altitude, spotter_archive.ground_speed, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id";
208 208
 
209
-                try {
210
-                        $sth = $this->db->prepare($query);
211
-                        $sth->execute(array(':id' => $id));
212
-                } catch(PDOException $e) {
213
-		        return "error : ".$e->getMessage();
214
-                }
215
-                $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
209
+				try {
210
+						$sth = $this->db->prepare($query);
211
+						$sth->execute(array(':id' => $id));
212
+				} catch(PDOException $e) {
213
+				return "error : ".$e->getMessage();
214
+				}
215
+				$spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
216 216
 
217
-                return $spotter_array;
218
-        }
217
+				return $spotter_array;
218
+		}
219 219
 
220 220
 
221
-        /**
222
-        * Gets altitude information based on a particular callsign
223
-        *
224
-        * @return Array the spotter information
225
-        *
226
-        */
227
-        public function getLastAltitudeArchiveSpotterDataByIdent($ident)
228
-        {
221
+		/**
222
+		 * Gets altitude information based on a particular callsign
223
+		 *
224
+		 * @return Array the spotter information
225
+		 *
226
+		 */
227
+		public function getLastAltitudeArchiveSpotterDataByIdent($ident)
228
+		{
229 229
 
230
-                date_default_timezone_set('UTC');
230
+				date_default_timezone_set('UTC');
231 231
 
232
-                $ident = filter_var($ident, FILTER_SANITIZE_STRING);
233
-                $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";
232
+				$ident = filter_var($ident, FILTER_SANITIZE_STRING);
233
+				$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";
234 234
 //                $query  = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.ident = :ident";
235 235
 
236
-                try {
237
-                        $sth = $this->db->prepare($query);
238
-                        $sth->execute(array(':ident' => $ident));
239
-                } catch(PDOException $e) {
240
-                        return "error";
241
-                }
242
-                $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
236
+				try {
237
+						$sth = $this->db->prepare($query);
238
+						$sth->execute(array(':ident' => $ident));
239
+				} catch(PDOException $e) {
240
+						return "error";
241
+				}
242
+				$spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
243 243
 
244
-                return $spotter_array;
245
-        }
244
+				return $spotter_array;
245
+		}
246 246
 
247 247
 
248 248
 
249
-       /**
250
-        * Gets all the archive spotter information
251
-        *
252
-        * @return Array the spotter information
253
-        *
254
-        */
255
-        public function getSpotterArchiveData($ident,$flightaware_id,$date)
256
-        {
257
-    		$Spotter = new Spotter($this->db);
258
-                $ident = filter_var($ident, FILTER_SANITIZE_STRING);
259
-                $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";
249
+	   /**
250
+	    * Gets all the archive spotter information
251
+	    *
252
+	    * @return Array the spotter information
253
+	    *
254
+	    */
255
+		public function getSpotterArchiveData($ident,$flightaware_id,$date)
256
+		{
257
+			$Spotter = new Spotter($this->db);
258
+				$ident = filter_var($ident, FILTER_SANITIZE_STRING);
259
+				$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";
260 260
 
261
-                $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident,':flightaware_id' => $flightaware_id,':date' => $date.'%'));
261
+				$spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident,':flightaware_id' => $flightaware_id,':date' => $date.'%'));
262 262
 
263
-                return $spotter_array;
264
-        }
263
+				return $spotter_array;
264
+		}
265 265
         
266
-        public function deleteSpotterArchiveTrackData()
267
-        {
266
+		public function deleteSpotterArchiveTrackData()
267
+		{
268 268
 		global $globalArchiveKeepTrackMonths;
269
-                date_default_timezone_set('UTC');
269
+				date_default_timezone_set('UTC');
270 270
 		$query = 'DELETE FROM spotter_archive WHERE spotter_archive.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$globalArchiveKeepTrackMonths.' MONTH)';
271
-                try {
272
-                        $sth = $this->db->prepare($query);
273
-                        $sth->execute();
274
-                } catch(PDOException $e) {
275
-                        return "error";
276
-                }
271
+				try {
272
+						$sth = $this->db->prepare($query);
273
+						$sth->execute();
274
+				} catch(PDOException $e) {
275
+						return "error";
276
+				}
277 277
 	}
278 278
 
279 279
 	/**
280
-        * Gets Minimal Live Spotter data
281
-        *
282
-        * @return Array the spotter information
283
-        *
284
-        */
285
-        public function getMinLiveSpotterData($begindate,$enddate,$filter = array())
286
-        {
287
-                global $globalDBdriver, $globalLiveInterval;
288
-                date_default_timezone_set('UTC');
289
-
290
-                $filter_query = '';
291
-                if (isset($filter['source']) && !empty($filter['source'])) {
292
-                        $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') ";
293
-                }
294
-                // Use spotter_output also ?
295
-                if (isset($filter['airlines']) && !empty($filter['airlines'])) {
296
-                        $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 ";
297
-                }
298
-                if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
299
-                        $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 ";
300
-                }
301
-                if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
302
-                        $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
303
-                }
304
-
305
-                //if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
306
-                if ($globalDBdriver == 'mysql') {
307
-                        /*
280
+	 * Gets Minimal Live Spotter data
281
+	 *
282
+	 * @return Array the spotter information
283
+	 *
284
+	 */
285
+		public function getMinLiveSpotterData($begindate,$enddate,$filter = array())
286
+		{
287
+				global $globalDBdriver, $globalLiveInterval;
288
+				date_default_timezone_set('UTC');
289
+
290
+				$filter_query = '';
291
+				if (isset($filter['source']) && !empty($filter['source'])) {
292
+						$filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') ";
293
+				}
294
+				// Use spotter_output also ?
295
+				if (isset($filter['airlines']) && !empty($filter['airlines'])) {
296
+						$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 ";
297
+				}
298
+				if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
299
+						$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 ";
300
+				}
301
+				if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
302
+						$filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
303
+				}
304
+
305
+				//if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
306
+				if ($globalDBdriver == 'mysql') {
307
+						/*
308 308
                         $query  = 'SELECT a.aircraft_shadow, 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 
309 309
                     		    FROM spotter_archive 
310 310
                     		    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';
@@ -316,50 +316,50 @@  discard block
 block discarded – undo
316 316
 						WHERE (l.date BETWEEN DATE_SUB('."'".$begindate."'".',INTERVAL '.$globalLiveInterval.' SECOND) AND '."'".$begindate."'".') 
317 317
 						GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id 
318 318
 				    AND spotter_archive.date = s.maxdate '.$filter_query.'LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON spotter_archive.aircraft_icao = a.icao';
319
-                } else if ($globalDBdriver == 'pgsql') {
320
-                        $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';
321
-                }
322
-                //echo $query;
323
-                try {
324
-                        $sth = $this->db->prepare($query);
325
-                        $sth->execute();
326
-                } catch(PDOException $e) {
327
-                        return "error";
328
-                }
329
-                $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
330
-
331
-                return $spotter_array;
332
-        }
319
+				} else if ($globalDBdriver == 'pgsql') {
320
+						$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';
321
+				}
322
+				//echo $query;
323
+				try {
324
+						$sth = $this->db->prepare($query);
325
+						$sth->execute();
326
+				} catch(PDOException $e) {
327
+						return "error";
328
+				}
329
+				$spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
330
+
331
+				return $spotter_array;
332
+		}
333 333
 
334 334
 	/**
335
-        * Gets Minimal Live Spotter data
336
-        *
337
-        * @return Array the spotter information
338
-        *
339
-        */
340
-        public function getMinLiveSpotterDataPlayback($begindate,$enddate,$filter = array())
341
-        {
342
-                global $globalDBdriver, $globalLiveInterval;
343
-                date_default_timezone_set('UTC');
344
-
345
-                $filter_query = '';
346
-                if (isset($filter['source']) && !empty($filter['source'])) {
347
-                        $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') ";
348
-                }
349
-                // Should use spotter_output also ?
350
-                if (isset($filter['airlines']) && !empty($filter['airlines'])) {
351
-                        $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 ";
352
-                }
353
-                if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
354
-                        $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 ";
355
-                }
356
-                if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
357
-                        $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
358
-                }
359
-
360
-                //if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
361
-                if ($globalDBdriver == 'mysql') {
362
-                        /*
335
+	 * Gets Minimal Live Spotter data
336
+	 *
337
+	 * @return Array the spotter information
338
+	 *
339
+	 */
340
+		public function getMinLiveSpotterDataPlayback($begindate,$enddate,$filter = array())
341
+		{
342
+				global $globalDBdriver, $globalLiveInterval;
343
+				date_default_timezone_set('UTC');
344
+
345
+				$filter_query = '';
346
+				if (isset($filter['source']) && !empty($filter['source'])) {
347
+						$filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') ";
348
+				}
349
+				// Should use spotter_output also ?
350
+				if (isset($filter['airlines']) && !empty($filter['airlines'])) {
351
+						$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 ";
352
+				}
353
+				if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
354
+						$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 ";
355
+				}
356
+				if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
357
+						$filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
358
+				}
359
+
360
+				//if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
361
+				if ($globalDBdriver == 'mysql') {
362
+						/*
363 363
                         $query  = 'SELECT a.aircraft_shadow, 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 
364 364
                     		    FROM spotter_archive 
365 365
                     		    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';
@@ -370,91 +370,91 @@  discard block
 block discarded – undo
370 370
 				    WHERE (spotter_archive_output.date BETWEEN '."'".$begindate."'".' AND '."'".$enddate."'".') 
371 371
                         	    '.$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';
372 372
 
373
-                } else if ($globalDBdriver == 'pgsql') {
374
-                        //$query  = 'SELECT 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, a.aircraft_shadow FROM spotter_archive_output INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive_output l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_archive_output.flightaware_id = s.flightaware_id AND spotter_archive_output.date = s.maxdate '.$filter_query.'INNER JOIN (SELECT * FROM aircraft) a on spotter_archive_output.aircraft_icao = a.icao';
375
-                        $query  = 'SELECT 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, a.aircraft_shadow
373
+				} else if ($globalDBdriver == 'pgsql') {
374
+						//$query  = 'SELECT 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, a.aircraft_shadow FROM spotter_archive_output INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive_output l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_archive_output.flightaware_id = s.flightaware_id AND spotter_archive_output.date = s.maxdate '.$filter_query.'INNER JOIN (SELECT * FROM aircraft) a on spotter_archive_output.aircraft_icao = a.icao';
375
+						$query  = 'SELECT 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, a.aircraft_shadow
376 376
                         	    FROM spotter_archive_output 
377 377
                         	    INNER JOIN (SELECT * FROM aircraft) a on spotter_archive_output.aircraft_icao = a.icao
378 378
                         	    WHERE spotter_archive_output.date >= '."'".$begindate."'".' AND spotter_archive_output.date <= '."'".$enddate."'".'
379 379
                         	    '.$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';
380
-                        $query  = 'SELECT DISTINCT spotter_output.flightaware_id, spotter_output.ident, spotter_output.aircraft_icao, spotter_output.departure_airport_icao as departure_airport, spotter_output.arrival_airport_icao as arrival_airport, spotter_output.latitude, spotter_output.longitude, spotter_output.altitude, spotter_output.heading, spotter_output.ground_speed, spotter_output.squawk, a.aircraft_shadow
380
+						$query  = 'SELECT DISTINCT spotter_output.flightaware_id, spotter_output.ident, spotter_output.aircraft_icao, spotter_output.departure_airport_icao as departure_airport, spotter_output.arrival_airport_icao as arrival_airport, spotter_output.latitude, spotter_output.longitude, spotter_output.altitude, spotter_output.heading, spotter_output.ground_speed, spotter_output.squawk, a.aircraft_shadow
381 381
                         	    FROM spotter_output 
382 382
                         	    INNER JOIN (SELECT * FROM aircraft) a on spotter_output.aircraft_icao = a.icao
383 383
                         	    WHERE spotter_output.date >= '."'".$begindate."'".' AND spotter_output.date <= '."'".$enddate."'".'
384 384
                         	    '.$filter_query.' LIMIT 200 OFFSET 0';
385 385
 //                        	    .' GROUP BY spotter_output.flightaware_id, spotter_output.ident, spotter_output.aircraft_icao, spotter_output.departure_airport_icao, spotter_output.arrival_airport_icao, spotter_output.latitude, spotter_output.longitude, spotter_output.altitude, spotter_output.heading, spotter_output.ground_speed, spotter_output.squawk, a.aircraft_shadow';
386 386
                         	    
387
-                }
388
-                //echo $query;
389
-                try {
390
-                        $sth = $this->db->prepare($query);
391
-                        $sth->execute();
392
-                } catch(PDOException $e) {
393
-                        return $e->getMessage();
394
-                }
395
-                $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
396
-
397
-                return $spotter_array;
398
-        }
387
+				}
388
+				//echo $query;
389
+				try {
390
+						$sth = $this->db->prepare($query);
391
+						$sth->execute();
392
+				} catch(PDOException $e) {
393
+						return $e->getMessage();
394
+				}
395
+				$spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
396
+
397
+				return $spotter_array;
398
+		}
399 399
 
400 400
 	 /**
401
-        * Gets count Live Spotter data
402
-        *
403
-        * @return Array the spotter information
404
-        *
405
-        */
406
-        public function getLiveSpotterCount($begindate,$enddate,$filter = array())
407
-        {
408
-                global $globalDBdriver, $globalLiveInterval;
409
-                date_default_timezone_set('UTC');
410
-
411
-                $filter_query = '';
412
-                if (isset($filter['source']) && !empty($filter['source'])) {
413
-                        $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') ";
414
-                }
415
-                if (isset($filter['airlines']) && !empty($filter['airlines'])) {
416
-                        $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 ";
417
-                }
418
-                if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
419
-                        $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 ";
420
-                }
421
-                if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
422
-                        $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
423
-                }
424
-
425
-                //if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
426
-                if ($globalDBdriver == 'mysql') {
401
+	  * Gets count Live Spotter data
402
+	  *
403
+	  * @return Array the spotter information
404
+	  *
405
+	  */
406
+		public function getLiveSpotterCount($begindate,$enddate,$filter = array())
407
+		{
408
+				global $globalDBdriver, $globalLiveInterval;
409
+				date_default_timezone_set('UTC');
410
+
411
+				$filter_query = '';
412
+				if (isset($filter['source']) && !empty($filter['source'])) {
413
+						$filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') ";
414
+				}
415
+				if (isset($filter['airlines']) && !empty($filter['airlines'])) {
416
+						$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 ";
417
+				}
418
+				if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
419
+						$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 ";
420
+				}
421
+				if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
422
+						$filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
423
+				}
424
+
425
+				//if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
426
+				if ($globalDBdriver == 'mysql') {
427 427
 			$query = 'SELECT COUNT(DISTINCT flightaware_id) as nb 
428 428
 			FROM spotter_archive l 
429 429
 			WHERE (l.date BETWEEN DATE_SUB('."'".$begindate."'".',INTERVAL '.$globalLiveInterval.' SECOND) AND '."'".$begindate."'".')'.$filter_query;
430 430
 
431
-                } else if ($globalDBdriver == 'pgsql') {
431
+				} else if ($globalDBdriver == 'pgsql') {
432 432
 			$query = 'SELECT COUNT(DISTINCT flightaware_id) as nb FROM spotter_archive l WHERE (l.date BETWEEN '."'".$begindate."' - INTERVAL '".$globalLiveInterval." SECONDS' AND "."'".$enddate."'".')'.$filter_query;
433
-                }
434
-                //echo $query;
435
-                try {
436
-                        $sth = $this->db->prepare($query);
437
-                        $sth->execute();
438
-                } catch(PDOException $e) {
439
-                        return "error";
440
-                }
433
+				}
434
+				//echo $query;
435
+				try {
436
+						$sth = $this->db->prepare($query);
437
+						$sth->execute();
438
+				} catch(PDOException $e) {
439
+						return "error";
440
+				}
441 441
 		$result = $sth->fetch(PDO::FETCH_ASSOC);
442
-                return $result['nb'];
442
+				return $result['nb'];
443 443
 
444
-        }
444
+		}
445 445
 
446 446
 
447 447
 
448 448
 	// Spotter_Archive_output
449 449
 	
450
-    /**
451
-    * Gets all the spotter information
452
-    *
453
-    * @return Array the spotter information
454
-    *
455
-    */
456
-    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 = '')
457
-    {
450
+	/**
451
+	 * Gets all the spotter information
452
+	 *
453
+	 * @return Array the spotter information
454
+	 *
455
+	 */
456
+	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 = '')
457
+	{
458 458
 	global $globalTimezone, $globalDbdriver;
459 459
 	require_once(dirname(__FILE__).'/class.Translation.php');
460 460
 	$Translation = new Translation();
@@ -465,159 +465,159 @@  discard block
 block discarded – undo
465 465
 	$additional_query = '';
466 466
 	if ($q != "")
467 467
 	{
468
-	    if (!is_string($q))
469
-	    {
468
+		if (!is_string($q))
469
+		{
470 470
 		return false;
471
-	    } else {
471
+		} else {
472 472
 	        
473 473
 		$q_array = explode(" ", $q);
474 474
 		
475 475
 		foreach ($q_array as $q_item){
476
-		    $additional_query .= " AND (";
477
-		    $additional_query .= "(spotter_archive_output.spotter_id like '%".$q_item."%') OR ";
478
-		    $additional_query .= "(spotter_archive_output.aircraft_icao like '%".$q_item."%') OR ";
479
-		    $additional_query .= "(spotter_archive_output.aircraft_name like '%".$q_item."%') OR ";
480
-		    $additional_query .= "(spotter_archive_output.aircraft_manufacturer like '%".$q_item."%') OR ";
481
-		    $additional_query .= "(spotter_archive_output.airline_icao like '%".$q_item."%') OR ";
482
-		    $additional_query .= "(spotter_archive_output.airline_name like '%".$q_item."%') OR ";
483
-		    $additional_query .= "(spotter_archive_output.airline_country like '%".$q_item."%') OR ";
484
-		    $additional_query .= "(spotter_archive_output.departure_airport_icao like '%".$q_item."%') OR ";
485
-		    $additional_query .= "(spotter_archive_output.departure_airport_name like '%".$q_item."%') OR ";
486
-		    $additional_query .= "(spotter_archive_output.departure_airport_city like '%".$q_item."%') OR ";
487
-		    $additional_query .= "(spotter_archive_output.departure_airport_country like '%".$q_item."%') OR ";
488
-		    $additional_query .= "(spotter_archive_output.arrival_airport_icao like '%".$q_item."%') OR ";
489
-		    $additional_query .= "(spotter_archive_output.arrival_airport_name like '%".$q_item."%') OR ";
490
-		    $additional_query .= "(spotter_archive_output.arrival_airport_city like '%".$q_item."%') OR ";
491
-		    $additional_query .= "(spotter_archive_output.arrival_airport_country like '%".$q_item."%') OR ";
492
-		    $additional_query .= "(spotter_archive_output.registration like '%".$q_item."%') OR ";
493
-		    $additional_query .= "(spotter_archive_output.owner_name like '%".$q_item."%') OR ";
494
-		    $additional_query .= "(spotter_archive_output.pilot_id like '%".$q_item."%') OR ";
495
-		    $additional_query .= "(spotter_archive_output.pilot_name like '%".$q_item."%') OR ";
496
-		    $additional_query .= "(spotter_archive_output.ident like '%".$q_item."%') OR ";
497
-		    $translate = $Translation->ident2icao($q_item);
498
-		    if ($translate != $q_item) $additional_query .= "(spotter_archive_output.ident like '%".$translate."%') OR ";
499
-		    $additional_query .= "(spotter_archive_output.highlight like '%".$q_item."%')";
500
-		    $additional_query .= ")";
501
-		}
502
-	    }
476
+			$additional_query .= " AND (";
477
+			$additional_query .= "(spotter_archive_output.spotter_id like '%".$q_item."%') OR ";
478
+			$additional_query .= "(spotter_archive_output.aircraft_icao like '%".$q_item."%') OR ";
479
+			$additional_query .= "(spotter_archive_output.aircraft_name like '%".$q_item."%') OR ";
480
+			$additional_query .= "(spotter_archive_output.aircraft_manufacturer like '%".$q_item."%') OR ";
481
+			$additional_query .= "(spotter_archive_output.airline_icao like '%".$q_item."%') OR ";
482
+			$additional_query .= "(spotter_archive_output.airline_name like '%".$q_item."%') OR ";
483
+			$additional_query .= "(spotter_archive_output.airline_country like '%".$q_item."%') OR ";
484
+			$additional_query .= "(spotter_archive_output.departure_airport_icao like '%".$q_item."%') OR ";
485
+			$additional_query .= "(spotter_archive_output.departure_airport_name like '%".$q_item."%') OR ";
486
+			$additional_query .= "(spotter_archive_output.departure_airport_city like '%".$q_item."%') OR ";
487
+			$additional_query .= "(spotter_archive_output.departure_airport_country like '%".$q_item."%') OR ";
488
+			$additional_query .= "(spotter_archive_output.arrival_airport_icao like '%".$q_item."%') OR ";
489
+			$additional_query .= "(spotter_archive_output.arrival_airport_name like '%".$q_item."%') OR ";
490
+			$additional_query .= "(spotter_archive_output.arrival_airport_city like '%".$q_item."%') OR ";
491
+			$additional_query .= "(spotter_archive_output.arrival_airport_country like '%".$q_item."%') OR ";
492
+			$additional_query .= "(spotter_archive_output.registration like '%".$q_item."%') OR ";
493
+			$additional_query .= "(spotter_archive_output.owner_name like '%".$q_item."%') OR ";
494
+			$additional_query .= "(spotter_archive_output.pilot_id like '%".$q_item."%') OR ";
495
+			$additional_query .= "(spotter_archive_output.pilot_name like '%".$q_item."%') OR ";
496
+			$additional_query .= "(spotter_archive_output.ident like '%".$q_item."%') OR ";
497
+			$translate = $Translation->ident2icao($q_item);
498
+			if ($translate != $q_item) $additional_query .= "(spotter_archive_output.ident like '%".$translate."%') OR ";
499
+			$additional_query .= "(spotter_archive_output.highlight like '%".$q_item."%')";
500
+			$additional_query .= ")";
501
+		}
502
+		}
503 503
 	}
504 504
 	
505 505
 	if ($registration != "")
506 506
 	{
507
-	    $registration = filter_var($registration,FILTER_SANITIZE_STRING);
508
-	    if (!is_string($registration))
509
-	    {
507
+		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
508
+		if (!is_string($registration))
509
+		{
510 510
 		return false;
511
-	    } else {
511
+		} else {
512 512
 		$additional_query .= " AND (spotter_archive_output.registration = '".$registration."')";
513
-	    }
513
+		}
514 514
 	}
515 515
 	
516 516
 	if ($aircraft_icao != "")
517 517
 	{
518
-	    $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
519
-	    if (!is_string($aircraft_icao))
520
-	    {
518
+		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
519
+		if (!is_string($aircraft_icao))
520
+		{
521 521
 		return false;
522
-	    } else {
522
+		} else {
523 523
 		$additional_query .= " AND (spotter_archive_output.aircraft_icao = '".$aircraft_icao."')";
524
-	    }
524
+		}
525 525
 	}
526 526
 	
527 527
 	if ($aircraft_manufacturer != "")
528 528
 	{
529
-	    $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
530
-	    if (!is_string($aircraft_manufacturer))
531
-	    {
529
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
530
+		if (!is_string($aircraft_manufacturer))
531
+		{
532 532
 		return false;
533
-	    } else {
533
+		} else {
534 534
 		$additional_query .= " AND (spotter_archive_output.aircraft_manufacturer = '".$aircraft_manufacturer."')";
535
-	    }
535
+		}
536 536
 	}
537 537
 	
538 538
 	if ($highlights == "true")
539 539
 	{
540
-	    if (!is_string($highlights))
541
-	    {
540
+		if (!is_string($highlights))
541
+		{
542 542
 		return false;
543
-	    } else {
543
+		} else {
544 544
 		$additional_query .= " AND (spotter_archive_output.highlight <> '')";
545
-	    }
545
+		}
546 546
 	}
547 547
 	
548 548
 	if ($airline_icao != "")
549 549
 	{
550
-	    $registration = filter_var($airline_icao,FILTER_SANITIZE_STRING);
551
-	    if (!is_string($airline_icao))
552
-	    {
550
+		$registration = filter_var($airline_icao,FILTER_SANITIZE_STRING);
551
+		if (!is_string($airline_icao))
552
+		{
553 553
 		return false;
554
-	    } else {
554
+		} else {
555 555
 		$additional_query .= " AND (spotter_archive_output.airline_icao = '".$airline_icao."')";
556
-	    }
556
+		}
557 557
 	}
558 558
 	
559 559
 	if ($airline_country != "")
560 560
 	{
561
-	    $airline_country = filter_var($airline_country,FILTER_SANITIZE_STRING);
562
-	    if (!is_string($airline_country))
563
-	    {
561
+		$airline_country = filter_var($airline_country,FILTER_SANITIZE_STRING);
562
+		if (!is_string($airline_country))
563
+		{
564 564
 		return false;
565
-	    } else {
565
+		} else {
566 566
 		$additional_query .= " AND (spotter_archive_output.airline_country = '".$airline_country."')";
567
-	    }
567
+		}
568 568
 	}
569 569
 	
570 570
 	if ($airline_type != "")
571 571
 	{
572
-	    $airline_type = filter_var($airline_type,FILTER_SANITIZE_STRING);
573
-	    if (!is_string($airline_type))
574
-	    {
572
+		$airline_type = filter_var($airline_type,FILTER_SANITIZE_STRING);
573
+		if (!is_string($airline_type))
574
+		{
575 575
 		return false;
576
-	    } else {
576
+		} else {
577 577
 		if ($airline_type == "passenger")
578 578
 		{
579
-		    $additional_query .= " AND (spotter_archive_output.airline_type = 'passenger')";
579
+			$additional_query .= " AND (spotter_archive_output.airline_type = 'passenger')";
580 580
 		}
581 581
 		if ($airline_type == "cargo")
582 582
 		{
583
-		    $additional_query .= " AND (spotter_archive_output.airline_type = 'cargo')";
583
+			$additional_query .= " AND (spotter_archive_output.airline_type = 'cargo')";
584 584
 		}
585 585
 		if ($airline_type == "military")
586 586
 		{
587
-		    $additional_query .= " AND (spotter_archive_output.airline_type = 'military')";
587
+			$additional_query .= " AND (spotter_archive_output.airline_type = 'military')";
588
+		}
588 589
 		}
589
-	    }
590 590
 	}
591 591
 	
592 592
 	if ($airport != "")
593 593
 	{
594
-	    $airport = filter_var($airport,FILTER_SANITIZE_STRING);
595
-	    if (!is_string($airport))
596
-	    {
594
+		$airport = filter_var($airport,FILTER_SANITIZE_STRING);
595
+		if (!is_string($airport))
596
+		{
597 597
 		return false;
598
-	    } else {
598
+		} else {
599 599
 		$additional_query .= " AND ((spotter_archive_output.departure_airport_icao = '".$airport."') OR (spotter_archive_output.arrival_airport_icao = '".$airport."'))";
600
-	    }
600
+		}
601 601
 	}
602 602
 	
603 603
 	if ($airport_country != "")
604 604
 	{
605
-	    $airport_country = filter_var($airport_country,FILTER_SANITIZE_STRING);
606
-	    if (!is_string($airport_country))
607
-	    {
605
+		$airport_country = filter_var($airport_country,FILTER_SANITIZE_STRING);
606
+		if (!is_string($airport_country))
607
+		{
608 608
 		return false;
609
-	    } else {
609
+		} else {
610 610
 		$additional_query .= " AND ((spotter_archive_output.departure_airport_country = '".$airport_country."') OR (spotter_archive_output.arrival_airport_country = '".$airport_country."'))";
611
-	    }
611
+		}
612 612
 	}
613 613
     
614 614
 	if ($callsign != "")
615 615
 	{
616
-	    $callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
617
-	    if (!is_string($callsign))
618
-	    {
616
+		$callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
617
+		if (!is_string($callsign))
618
+		{
619 619
 		return false;
620
-	    } else {
620
+		} else {
621 621
 		$translate = $Translation->ident2icao($callsign);
622 622
 		if ($translate != $callsign) {
623 623
 			$additional_query .= " AND (spotter_archive_output.ident = :callsign OR spotter_archive_output.ident = :translate)";
@@ -625,99 +625,99 @@  discard block
 block discarded – undo
625 625
 		} else {
626 626
 			$additional_query .= " AND (spotter_archive_output.ident = '".$callsign."')";
627 627
 		}
628
-	    }
628
+		}
629 629
 	}
630 630
 
631 631
 	if ($owner != "")
632 632
 	{
633
-	    $owner = filter_var($owner,FILTER_SANITIZE_STRING);
634
-	    if (!is_string($owner))
635
-	    {
633
+		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
634
+		if (!is_string($owner))
635
+		{
636 636
 		return false;
637
-	    } else {
637
+		} else {
638 638
 		$additional_query .= " AND (spotter_archive_output.owner_name = '".$owner."')";
639
-	    }
639
+		}
640 640
 	}
641 641
 
642 642
 	if ($pilot_name != "")
643 643
 	{
644
-	    $pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING);
645
-	    if (!is_string($pilot_name))
646
-	    {
644
+		$pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING);
645
+		if (!is_string($pilot_name))
646
+		{
647 647
 		return false;
648
-	    } else {
648
+		} else {
649 649
 		$additional_query .= " AND (spotter_archive_output.pilot_name = '".$pilot_name."')";
650
-	    }
650
+		}
651 651
 	}
652 652
 	
653 653
 	if ($pilot_id != "")
654 654
 	{
655
-	    $pilot_id = filter_var($pilot_id,FILTER_SANITIZE_NUMBER_INT);
656
-	    if (!is_string($pilot_id))
657
-	    {
655
+		$pilot_id = filter_var($pilot_id,FILTER_SANITIZE_NUMBER_INT);
656
+		if (!is_string($pilot_id))
657
+		{
658 658
 		return false;
659
-	    } else {
659
+		} else {
660 660
 		$additional_query .= " AND (spotter_archive_output.pilot_id = '".$pilot_id."')";
661
-	    }
661
+		}
662 662
 	}
663 663
 	
664 664
 	if ($departure_airport_route != "")
665 665
 	{
666
-	    $departure_airport_route = filter_var($departure_airport_route,FILTER_SANITIZE_STRING);
667
-	    if (!is_string($departure_airport_route))
668
-	    {
666
+		$departure_airport_route = filter_var($departure_airport_route,FILTER_SANITIZE_STRING);
667
+		if (!is_string($departure_airport_route))
668
+		{
669 669
 		return false;
670
-	    } else {
670
+		} else {
671 671
 		$additional_query .= " AND (spotter_archive_output.departure_airport_icao = '".$departure_airport_route."')";
672
-	    }
672
+		}
673 673
 	}
674 674
 	
675 675
 	if ($arrival_airport_route != "")
676 676
 	{
677
-	    $arrival_airport_route = filter_var($arrival_airport_route,FILTER_SANITIZE_STRING);
678
-	    if (!is_string($arrival_airport_route))
679
-	    {
677
+		$arrival_airport_route = filter_var($arrival_airport_route,FILTER_SANITIZE_STRING);
678
+		if (!is_string($arrival_airport_route))
679
+		{
680 680
 		return false;
681
-	    } else {
681
+		} else {
682 682
 		$additional_query .= " AND (spotter_archive_output.arrival_airport_icao = '".$arrival_airport_route."')";
683
-	    }
683
+		}
684 684
 	}
685 685
 	
686 686
 	if ($altitude != "")
687 687
 	{
688
-	    $altitude_array = explode(",", $altitude);
688
+		$altitude_array = explode(",", $altitude);
689 689
 	    
690
-	    $altitude_array[0] = filter_var($altitude_array[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
691
-	    $altitude_array[1] = filter_var($altitude_array[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
690
+		$altitude_array[0] = filter_var($altitude_array[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
691
+		$altitude_array[1] = filter_var($altitude_array[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
692 692
 	    
693 693
 
694
-	    if ($altitude_array[1] != "")
695
-	    {                
694
+		if ($altitude_array[1] != "")
695
+		{                
696 696
 		$altitude_array[0] = substr($altitude_array[0], 0, -2);
697 697
 		$altitude_array[1] = substr($altitude_array[1], 0, -2);
698 698
 		$additional_query .= " AND altitude BETWEEN '".$altitude_array[0]."' AND '".$altitude_array[1]."' ";
699
-	    } else {
699
+		} else {
700 700
 		$altitude_array[0] = substr($altitude_array[0], 0, -2);
701 701
 		$additional_query .= " AND altitude <= '".$altitude_array[0]."' ";
702
-	    }
702
+		}
703 703
 	}
704 704
 	
705 705
 	if ($date_posted != "")
706 706
 	{
707
-	    $date_array = explode(",", $date_posted);
707
+		$date_array = explode(",", $date_posted);
708 708
 	    
709
-	    $date_array[0] = filter_var($date_array[0],FILTER_SANITIZE_STRING);
710
-	    $date_array[1] = filter_var($date_array[1],FILTER_SANITIZE_STRING);
709
+		$date_array[0] = filter_var($date_array[0],FILTER_SANITIZE_STRING);
710
+		$date_array[1] = filter_var($date_array[1],FILTER_SANITIZE_STRING);
711 711
 	    
712
-	    if ($globalTimezone != '') {
712
+		if ($globalTimezone != '') {
713 713
 		date_default_timezone_set($globalTimezone);
714 714
 		$datetime = new DateTime();
715 715
 		$offset = $datetime->format('P');
716
-	    } else $offset = '+00:00';
716
+		} else $offset = '+00:00';
717 717
 
718 718
 
719
-	    if ($date_array[1] != "")
720
-	    {                
719
+		if ($date_array[1] != "")
720
+		{                
721 721
 		$date_array[0] = date("Y-m-d H:i:s", strtotime($date_array[0]));
722 722
 		$date_array[1] = date("Y-m-d H:i:s", strtotime($date_array[1]));
723 723
 		if ($globalDBdriver == 'mysql') {
@@ -725,28 +725,28 @@  discard block
 block discarded – undo
725 725
 		} else {
726 726
 			$additional_query .= " AND spotter_archive_output.date::timestamp AT TIME ZONE INTERVAL ".$offset." >= CAST('".$date_array[0]."' AS TIMESTAMP) AND spotter_archive_output.date::timestamp AT TIME ZONE INTERVAL ".$offset." <= CAST('".$date_array[1]."' AS TIMESTAMP) ";
727 727
 		}
728
-	    } else {
728
+		} else {
729 729
 		$date_array[0] = date("Y-m-d H:i:s", strtotime($date_array[0]));
730
-                if ($globalDBdriver == 'mysql') {
730
+				if ($globalDBdriver == 'mysql') {
731 731
 			$additional_query .= " AND TIMESTAMP(CONVERT_TZ(spotter_archive_output.date,'+00:00', '".$offset."')) >= '".$date_array[0]."' ";
732 732
 		} else {
733 733
 			$additional_query .= " AND spotter_archive_output.date::timestamp AT TIME ZONE INTERVAL ".$offset." >= CAST('".$date_array[0]."' AS TIMESTAMP) ";
734 734
 		}
735
-	    }
735
+		}
736 736
 	}
737 737
 	
738 738
 	if ($limit != "")
739 739
 	{
740
-	    $limit_array = explode(",", $limit);
740
+		$limit_array = explode(",", $limit);
741 741
 	    
742
-	    $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
743
-	    $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
742
+		$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
743
+		$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
744 744
 	    
745
-	    if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
746
-	    {
745
+		if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
746
+		{
747 747
 		//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
748 748
 		$limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0];
749
-	    }
749
+		}
750 750
 	}
751 751
 	
752 752
 
@@ -778,33 +778,33 @@  discard block
 block discarded – undo
778 778
 	$spotter_array = $Spotter->getDataFromDB($query, array(),$limit_query);
779 779
 
780 780
 	return $spotter_array;
781
-    }
781
+	}
782 782
 
783
-    public function deleteSpotterArchiveData()
784
-    {
783
+	public function deleteSpotterArchiveData()
784
+	{
785 785
 		global $globalArchiveKeepMonths, $globalDBdriver;
786
-                date_default_timezone_set('UTC');
787
-                if ($globalDBdriver == 'mysql') {
786
+				date_default_timezone_set('UTC');
787
+				if ($globalDBdriver == 'mysql') {
788 788
 			$query = 'DELETE FROM spotter_archive_output WHERE spotter_archive_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$globalArchiveKeepMonths.' MONTH)';
789 789
 		} else {
790 790
 			$query = "DELETE FROM spotter_archive_output WHERE spotter_archive_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalArchiveKeepMonths." MONTH'";
791 791
 		}
792
-                try {
793
-                        $sth = $this->db->prepare($query);
794
-                        $sth->execute();
795
-                } catch(PDOException $e) {
796
-                        return "error";
797
-                }
792
+				try {
793
+						$sth = $this->db->prepare($query);
794
+						$sth->execute();
795
+				} catch(PDOException $e) {
796
+						return "error";
797
+				}
798 798
 	}
799 799
 
800
-    /**
801
-    * Gets all the spotter information based on the callsign
802
-    *
803
-    * @return Array the spotter information
804
-    *
805
-    */
806
-    public function getSpotterDataByIdent($ident = '', $limit = '', $sort = '')
807
-    {
800
+	/**
801
+	 * Gets all the spotter information based on the callsign
802
+	 *
803
+	 * @return Array the spotter information
804
+	 *
805
+	 */
806
+	public function getSpotterDataByIdent($ident = '', $limit = '', $sort = '')
807
+	{
808 808
 	$global_query = "SELECT spotter_archive_output.* FROM spotter_archive_output";
809 809
 	
810 810
 	date_default_timezone_set('UTC');
@@ -813,35 +813,35 @@  discard block
 block discarded – undo
813 813
 	
814 814
 	if ($ident != "")
815 815
 	{
816
-	    if (!is_string($ident))
817
-	    {
816
+		if (!is_string($ident))
817
+		{
818 818
 		return false;
819
-	    } else {
819
+		} else {
820 820
 		$additional_query = " AND (spotter_archive_output.ident = :ident)";
821 821
 		$query_values = array(':ident' => $ident);
822
-	    }
822
+		}
823 823
 	}
824 824
 	
825 825
 	if ($limit != "")
826 826
 	{
827
-	    $limit_array = explode(",", $limit);
827
+		$limit_array = explode(",", $limit);
828 828
 	    
829
-	    $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
830
-	    $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
829
+		$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
830
+		$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
831 831
 	    
832
-	    if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
833
-	    {
832
+		if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
833
+		{
834 834
 		//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
835 835
 		$limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0];
836
-	    }
836
+		}
837 837
 	}
838 838
 
839 839
 	if ($sort != "")
840 840
 	{
841
-	    $search_orderby_array = $this->getOrderBy();
842
-	    $orderby_query = $search_orderby_array[$sort]['sql'];
841
+		$search_orderby_array = $this->getOrderBy();
842
+		$orderby_query = $search_orderby_array[$sort]['sql'];
843 843
 	} else {
844
-	    $orderby_query = " ORDER BY spotter_archive_output.date DESC";
844
+		$orderby_query = " ORDER BY spotter_archive_output.date DESC";
845 845
 	}
846 846
 
847 847
 	$query = $global_query." WHERE spotter_archive_output.ident <> '' ".$additional_query." ".$orderby_query;
@@ -850,16 +850,16 @@  discard block
 block discarded – undo
850 850
 	$spotter_array = $Spotter->getDataFromDB($query, $query_values, $limit_query);
851 851
 
852 852
 	return $spotter_array;
853
-    }
854
-
855
-    /**
856
-    * Gets all number of flight over countries
857
-    *
858
-    * @return Array the airline country list
859
-    *
860
-    */
861
-    public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '')
862
-    {
853
+	}
854
+
855
+	/**
856
+	 * Gets all number of flight over countries
857
+	 *
858
+	 * @return Array the airline country list
859
+	 *
860
+	 */
861
+	public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '')
862
+	{
863 863
 	global $globalDBdriver;
864 864
 	/*
865 865
 	$query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb 
@@ -869,14 +869,14 @@  discard block
 block discarded – undo
869 869
 	$query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb
870 870
 		    FROM countries c, spotter_archive s
871 871
 		    WHERE c.iso2 = s.over_country ";
872
-                if ($olderthanmonths > 0) {
873
-            		if ($globalDBdriver == 'mysql') {
872
+				if ($olderthanmonths > 0) {
873
+					if ($globalDBdriver == 'mysql') {
874 874
 				$query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
875 875
 			} else {
876 876
 				$query .= "AND date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
877 877
 			}
878 878
 		}
879
-                if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
879
+				if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
880 880
 	$query .= "GROUP BY c.name, c.iso3, c.iso2 ORDER BY nb DESC";
881 881
 	if ($limit) $query .= " LIMIT 0,10";
882 882
       
@@ -889,14 +889,14 @@  discard block
 block discarded – undo
889 889
         
890 890
 	while($row = $sth->fetch(PDO::FETCH_ASSOC))
891 891
 	{
892
-	    $temp_array['flight_count'] = $row['nb'];
893
-	    $temp_array['flight_country'] = $row['name'];
894
-	    $temp_array['flight_country_iso3'] = $row['iso3'];
895
-	    $temp_array['flight_country_iso2'] = $row['iso2'];
896
-	    $flight_array[] = $temp_array;
892
+		$temp_array['flight_count'] = $row['nb'];
893
+		$temp_array['flight_country'] = $row['name'];
894
+		$temp_array['flight_country_iso3'] = $row['iso3'];
895
+		$temp_array['flight_country_iso2'] = $row['iso2'];
896
+		$flight_array[] = $temp_array;
897 897
 	}
898 898
 	return $flight_array;
899
-    }
899
+	}
900 900
 
901 901
 }
902 902
 ?>
903 903
\ No newline at end of file
Please login to merge, or discard this patch.