Completed
Push — master ( 029a3f...057a2a )
by Yannick
07:22
created
pilot-statistics-time.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -12,8 +12,12 @@
 block discarded – undo
12 12
 $year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT);
13 13
 $month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT);
14 14
 $filter = array();
15
-if ($year != '') $filter = array_merge($filter,array('year' => $year));
16
-if ($month != '') $filter = array_merge($filter,array('month' => $month));
15
+if ($year != '') {
16
+	$filter = array_merge($filter,array('year' => $year));
17
+}
18
+if ($month != '') {
19
+	$filter = array_merge($filter,array('month' => $month));
20
+}
17 21
 $spotter_array = $Spotter->getSpotterDataByPilot($pilot,"0,1", $sort,$filter);
18 22
 
19 23
 if (!empty($spotter_array))
Please login to merge, or discard this patch.
pilot-sub-menu.php 1 patch
Braces   +70 added lines, -10 removed lines patch added patch discarded remove patch
@@ -3,15 +3,39 @@  discard block
 block discarded – undo
3 3
 </span>
4 4
 <div class="sub-menu sub-menu-container">
5 5
 	<ul class="nav nav-pills">
6
-		<li><a href="<?php print $globalURL; ?>/pilot/<?php print $_GET['pilot']; ?><?php if (isset($year) && $year != '') echo '/'.$year; ?><?php if (isset($month) && $month != '') echo '/'.$month; ?>" <?php if (strtolower($current_page) == "pilot-detailed"){ print 'class="active"'; } ?>><?php echo _("Detailed"); ?></a></li>
6
+		<li><a href="<?php print $globalURL; ?>/pilot/<?php print $_GET['pilot']; ?><?php if (isset($year) && $year != '') {
7
+	echo '/'.$year;
8
+}
9
+?><?php if (isset($month) && $month != '') {
10
+	echo '/'.$month;
11
+}
12
+?>" <?php if (strtolower($current_page) == "pilot-detailed"){ print 'class="active"'; } ?>><?php echo _("Detailed"); ?></a></li>
7 13
 		<li class="dropdown">
8 14
 		    <a class="dropdown-toggle <?php if(strtolower($current_page) == "pilot-statistics-aircraft" || strtolower($current_page) == "pilot-statistics-registration" || strtolower($current_page) == "pilot-statistics-manufacturer"){ print 'active'; } ?>" data-toggle="dropdown" href="#">
9 15
 		      <?php echo _("Aircraft"); ?> <span class="caret"></span>
10 16
 		    </a>
11 17
 		    <ul class="dropdown-menu" role="menu">
12
-		      <li><a href="<?php print $globalURL; ?>/pilot/statistics/aircraft/<?php print $_GET['pilot']; ?><?php if (isset($year) && $year != '') echo '/'.$year; ?><?php if (isset($month) && $month != '') echo '/'.$month; ?>"><?php echo _("Aircraft Type"); ?></a></li>
13
-					<li><a href="<?php print $globalURL; ?>/pilot/statistics/registration/<?php print $_GET['pilot']; ?><?php if (isset($year) && $year != '') echo '/'.$year; ?><?php if (isset($month) && $month != '') echo '/'.$month; ?>"><?php echo _("Registration"); ?></a></li>
14
-					<li><a href="<?php print $globalURL; ?>/pilot/statistics/manufacturer/<?php print $_GET['pilot']; ?><?php if (isset($year) && $year != '') echo '/'.$year; ?><?php if (isset($month) && $month != '') echo '/'.$month; ?>"><?php echo _("Manufacturer"); ?></a></li>
18
+		      <li><a href="<?php print $globalURL; ?>/pilot/statistics/aircraft/<?php print $_GET['pilot']; ?><?php if (isset($year) && $year != '') {
19
+	echo '/'.$year;
20
+}
21
+?><?php if (isset($month) && $month != '') {
22
+	echo '/'.$month;
23
+}
24
+?>"><?php echo _("Aircraft Type"); ?></a></li>
25
+					<li><a href="<?php print $globalURL; ?>/pilot/statistics/registration/<?php print $_GET['pilot']; ?><?php if (isset($year) && $year != '') {
26
+	echo '/'.$year;
27
+}
28
+?><?php if (isset($month) && $month != '') {
29
+	echo '/'.$month;
30
+}
31
+?>"><?php echo _("Registration"); ?></a></li>
32
+					<li><a href="<?php print $globalURL; ?>/pilot/statistics/manufacturer/<?php print $_GET['pilot']; ?><?php if (isset($year) && $year != '') {
33
+	echo '/'.$year;
34
+}
35
+?><?php if (isset($month) && $month != '') {
36
+	echo '/'.$month;
37
+}
38
+?>"><?php echo _("Manufacturer"); ?></a></li>
15 39
 		    </ul>
16 40
 		</li>
17 41
 		<li class="dropdown">
@@ -19,13 +43,49 @@  discard block
 block discarded – undo
19 43
 		      <?php echo _("Airport"); ?> <span class="caret"></span>
20 44
 		    </a>
21 45
 		    <ul class="dropdown-menu" role="menu">
22
-		      <li><a href="<?php print $globalURL; ?>/pilot/statistics/departure-airport/<?php print $_GET['pilot']; ?><?php if (isset($year) && $year != '') echo '/'.$year; ?><?php if (isset($month) && $month != '') echo '/'.$month; ?>"><?php echo _("Departure Airport"); ?></a></li>
23
-		      <li><a href="<?php print $globalURL; ?>/pilot/statistics/departure-airport-country/<?php print $_GET['pilot']; ?><?php if (isset($year) && $year != '') echo '/'.$year; ?><?php if (isset($month) && $month != '') echo '/'.$month; ?>"><?php echo _("Departure Airport by Country"); ?></a></li>
24
-			  <li><a href="<?php print $globalURL; ?>/pilot/statistics/arrival-airport/<?php print $_GET['pilot']; ?><?php if (isset($year) && $year != '') echo '/'.$year; ?><?php if (isset($month) && $month != '') echo '/'.$month; ?>"><?php echo _("Arrival Airport"); ?></a></li>
25
-			  <li><a href="<?php print $globalURL; ?>/pilot/statistics/arrival-airport-country/<?php print $_GET['pilot']; ?><?php if (isset($year) && $year != '') echo '/'.$year; ?><?php if (isset($month) && $month != '') echo '/'.$month; ?>"><?php echo _("Arrival Airport by Country"); ?></a></li>
46
+		      <li><a href="<?php print $globalURL; ?>/pilot/statistics/departure-airport/<?php print $_GET['pilot']; ?><?php if (isset($year) && $year != '') {
47
+	echo '/'.$year;
48
+}
49
+?><?php if (isset($month) && $month != '') {
50
+	echo '/'.$month;
51
+}
52
+?>"><?php echo _("Departure Airport"); ?></a></li>
53
+		      <li><a href="<?php print $globalURL; ?>/pilot/statistics/departure-airport-country/<?php print $_GET['pilot']; ?><?php if (isset($year) && $year != '') {
54
+	echo '/'.$year;
55
+}
56
+?><?php if (isset($month) && $month != '') {
57
+	echo '/'.$month;
58
+}
59
+?>"><?php echo _("Departure Airport by Country"); ?></a></li>
60
+			  <li><a href="<?php print $globalURL; ?>/pilot/statistics/arrival-airport/<?php print $_GET['pilot']; ?><?php if (isset($year) && $year != '') {
61
+	echo '/'.$year;
62
+}
63
+?><?php if (isset($month) && $month != '') {
64
+	echo '/'.$month;
65
+}
66
+?>"><?php echo _("Arrival Airport"); ?></a></li>
67
+			  <li><a href="<?php print $globalURL; ?>/pilot/statistics/arrival-airport-country/<?php print $_GET['pilot']; ?><?php if (isset($year) && $year != '') {
68
+	echo '/'.$year;
69
+}
70
+?><?php if (isset($month) && $month != '') {
71
+	echo '/'.$month;
72
+}
73
+?>"><?php echo _("Arrival Airport by Country"); ?></a></li>
26 74
 		    </ul>
27 75
 		</li>
28
-		<li><a href="<?php print $globalURL; ?>/pilot/statistics/route/<?php print $_GET['pilot']; ?><?php if (isset($year) && $year != '') echo '/'.$year; ?><?php if (isset($month) && $month != '') echo '/'.$month; ?>" <?php if (strtolower($current_page) == "pilot-statistics-route"){ print 'class="active"'; } ?>><?php echo _("Route"); ?></a></li>
29
-		<li><a href="<?php print $globalURL; ?>/pilot/statistics/time/<?php print $_GET['pilot']; ?><?php if (isset($year) && $year != '') echo '/'.$year; ?><?php if (isset($month) && $month != '') echo '/'.$month; ?>" <?php if (strtolower($current_page) == "pilot-statistics-time"){ print 'class="active"'; } ?>><?php echo _("Time"); ?></a></li>
76
+		<li><a href="<?php print $globalURL; ?>/pilot/statistics/route/<?php print $_GET['pilot']; ?><?php if (isset($year) && $year != '') {
77
+	echo '/'.$year;
78
+}
79
+?><?php if (isset($month) && $month != '') {
80
+	echo '/'.$month;
81
+}
82
+?>" <?php if (strtolower($current_page) == "pilot-statistics-route"){ print 'class="active"'; } ?>><?php echo _("Route"); ?></a></li>
83
+		<li><a href="<?php print $globalURL; ?>/pilot/statistics/time/<?php print $_GET['pilot']; ?><?php if (isset($year) && $year != '') {
84
+	echo '/'.$year;
85
+}
86
+?><?php if (isset($month) && $month != '') {
87
+	echo '/'.$month;
88
+}
89
+?>" <?php if (strtolower($current_page) == "pilot-statistics-time"){ print 'class="active"'; } ?>><?php echo _("Time"); ?></a></li>
30 90
 	</ul>
31 91
 </div>
32 92
\ No newline at end of file
Please login to merge, or discard this patch.
require/class.Spotter.php 1 patch
Braces   +733 added lines, -256 removed lines patch added patch discarded remove patch
@@ -69,7 +69,9 @@  discard block
 block discarded – undo
69 69
 				$filter = array_merge($filter,$globalStatsFilters[$globalFilterName]);
70 70
 			}
71 71
 		}
72
-		if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter);
72
+		if (is_array($globalFilter)) {
73
+			$filter = array_merge($filter,$globalFilter);
74
+		}
73 75
 		$filter_query_join = '';
74 76
 		$filter_query_where = '';
75 77
 		foreach($filters as $flt) {
@@ -139,8 +141,11 @@  discard block
 block discarded – undo
139 141
 				$filter_query_where .= " AND EXTRACT(DAY FROM spotter_output.date) = '".$filter['day']."'";
140 142
 			}
141 143
 		}
142
-		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
143
-		elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND';
144
+		if ($filter_query_where == '' && $where) {
145
+			$filter_query_where = ' WHERE';
146
+		} elseif ($filter_query_where != '' && $and) {
147
+			$filter_query_where .= ' AND';
148
+		}
144 149
 		if ($filter_query_where != '') {
145 150
 			$filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where);
146 151
 		}
@@ -163,10 +168,18 @@  discard block
 block discarded – undo
163 168
 		$Image = new Image($this->db);
164 169
 		$Schedule = new Schedule($this->db);
165 170
 		$ACARS = new ACARS($this->db);
166
-		if (!isset($globalIVAO)) $globalIVAO = FALSE;
167
-		if (!isset($globalVATSIM)) $globalVATSIM = FALSE;
168
-		if (!isset($globalphpVMS)) $globalphpVMS = FALSE;
169
-		if (!isset($globalVAM)) $globalVAM = FALSE;
171
+		if (!isset($globalIVAO)) {
172
+			$globalIVAO = FALSE;
173
+		}
174
+		if (!isset($globalVATSIM)) {
175
+			$globalVATSIM = FALSE;
176
+		}
177
+		if (!isset($globalphpVMS)) {
178
+			$globalphpVMS = FALSE;
179
+		}
180
+		if (!isset($globalVAM)) {
181
+			$globalVAM = FALSE;
182
+		}
170 183
 		date_default_timezone_set('UTC');
171 184
 		
172 185
 		if (!is_string($query))
@@ -213,21 +226,35 @@  discard block
 block discarded – undo
213 226
 			} else {
214 227
 				$temp_array['spotter_id'] = '';
215 228
 			}
216
-			if (isset($row['flightaware_id'])) $temp_array['flightaware_id'] = $row['flightaware_id'];
217
-			if (isset($row['modes'])) $temp_array['modes'] = $row['modes'];
229
+			if (isset($row['flightaware_id'])) {
230
+				$temp_array['flightaware_id'] = $row['flightaware_id'];
231
+			}
232
+			if (isset($row['modes'])) {
233
+				$temp_array['modes'] = $row['modes'];
234
+			}
218 235
 			$temp_array['ident'] = $row['ident'];
219 236
 			if (isset($row['registration']) && $row['registration'] != '') {
220 237
 				$temp_array['registration'] = $row['registration'];
221 238
 			} elseif (isset($temp_array['modes'])) {
222 239
 				$temp_array['registration'] = $this->getAircraftRegistrationBymodeS($temp_array['modes']);
223
-			} else $temp_array['registration'] = '';
224
-			if (isset($row['aircraft_icao'])) $temp_array['aircraft_type'] = $row['aircraft_icao'];
240
+			} else {
241
+				$temp_array['registration'] = '';
242
+			}
243
+			if (isset($row['aircraft_icao'])) {
244
+				$temp_array['aircraft_type'] = $row['aircraft_icao'];
245
+			}
225 246
 			
226 247
 			$temp_array['departure_airport'] = $row['departure_airport_icao'];
227 248
 			$temp_array['arrival_airport'] = $row['arrival_airport_icao'];
228
-			if (isset($row['real_arrival_airport_icao']) && $row['real_arrival_airport_icao'] != NULL) $temp_array['real_arrival_airport'] = $row['real_arrival_airport_icao'];
229
-			if (isset($row['latitude'])) $temp_array['latitude'] = $row['latitude'];
230
-			if (isset($row['longitude'])) $temp_array['longitude'] = $row['longitude'];
249
+			if (isset($row['real_arrival_airport_icao']) && $row['real_arrival_airport_icao'] != NULL) {
250
+				$temp_array['real_arrival_airport'] = $row['real_arrival_airport_icao'];
251
+			}
252
+			if (isset($row['latitude'])) {
253
+				$temp_array['latitude'] = $row['latitude'];
254
+			}
255
+			if (isset($row['longitude'])) {
256
+				$temp_array['longitude'] = $row['longitude'];
257
+			}
231 258
 			/*
232 259
 			if (Connection->tableExists('countries')) {
233 260
 				$country_info = $this->getCountryFromLatitudeLongitude($temp_array['latitude'],$temp_array['longitude']);
@@ -237,8 +264,12 @@  discard block
 block discarded – undo
237 264
 				}
238 265
 			}
239 266
 			*/
240
-			if (isset($row['waypoints'])) $temp_array['waypoints'] = $row['waypoints'];
241
-			if (isset($row['format_source'])) $temp_array['format_source'] = $row['format_source'];
267
+			if (isset($row['waypoints'])) {
268
+				$temp_array['waypoints'] = $row['waypoints'];
269
+			}
270
+			if (isset($row['format_source'])) {
271
+				$temp_array['format_source'] = $row['format_source'];
272
+			}
242 273
 			if (isset($row['route_stop']) && $row['route_stop'] != '') {
243 274
 				$temp_array['route_stop'] = $row['route_stop'];
244 275
 				$allroute = explode(' ',$row['route_stop']);
@@ -254,13 +285,19 @@  discard block
 block discarded – undo
254 285
 					}
255 286
 				}
256 287
 			}
257
-			if (isset($row['altitude'])) $temp_array['altitude'] = $row['altitude'];
288
+			if (isset($row['altitude'])) {
289
+				$temp_array['altitude'] = $row['altitude'];
290
+			}
258 291
 			if (isset($row['heading'])) {
259 292
 				$temp_array['heading'] = $row['heading'];
260 293
 				$heading_direction = $this->parseDirection($row['heading']);
261
-				if (isset($heading_direction[0]['direction_fullname'])) $temp_array['heading_name'] = $heading_direction[0]['direction_fullname'];
294
+				if (isset($heading_direction[0]['direction_fullname'])) {
295
+					$temp_array['heading_name'] = $heading_direction[0]['direction_fullname'];
296
+				}
297
+			}
298
+			if (isset($row['ground_speed'])) {
299
+				$temp_array['ground_speed'] = $row['ground_speed'];
262 300
 			}
263
-			if (isset($row['ground_speed'])) $temp_array['ground_speed'] = $row['ground_speed'];
264 301
 			$temp_array['image'] = "";
265 302
 			$temp_array['image_thumbnail'] = "";
266 303
 			$temp_array['image_source'] = "";
@@ -268,7 +305,9 @@  discard block
 block discarded – undo
268 305
  
269 306
 			if (isset($row['highlight'])) {
270 307
 				$temp_array['highlight'] = $row['highlight'];
271
-			} else $temp_array['highlight'] = '';
308
+			} else {
309
+				$temp_array['highlight'] = '';
310
+			}
272 311
 			
273 312
 			if (isset($row['date'])) {
274 313
 				$dateArray = $this->parseDateString($row['date']);
@@ -322,7 +361,9 @@  discard block
 block discarded – undo
322 361
 				
323 362
 					if ($aircraft_array[0]['aircraft_shadow'] != NULL) {
324 363
 						$temp_array['aircraft_shadow'] = $aircraft_array[0]['aircraft_shadow'];
325
-					} else $temp_array['aircraft_shadow'] = 'default.png';
364
+					} else {
365
+						$temp_array['aircraft_shadow'] = 'default.png';
366
+					}
326 367
                                 } else {
327 368
                             		$temp_array['aircraft_shadow'] = 'default.png';
328 369
 					$temp_array['aircraft_name'] = 'N/A';
@@ -330,11 +371,17 @@  discard block
 block discarded – undo
330 371
                             	}
331 372
 			}
332 373
 			$fromsource = NULL;
333
-			if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource;
334
-			elseif (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') $fromsource = 'vatsim';
335
-			elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') $fromsource = 'ivao';
336
-			elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim';
337
-			elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao';
374
+			if (isset($globalAirlinesSource) && $globalAirlinesSource != '') {
375
+				$fromsource = $globalAirlinesSource;
376
+			} elseif (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') {
377
+				$fromsource = 'vatsim';
378
+			} elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') {
379
+				$fromsource = 'ivao';
380
+			} elseif (isset($globalVATSIM) && $globalVATSIM) {
381
+				$fromsource = 'vatsim';
382
+			} elseif (isset($globalIVAO) && $globalIVAO) {
383
+				$fromsource = 'ivao';
384
+			}
338 385
 			if (!isset($row['airline_name']) || $row['airline_name'] == '') {
339 386
 				if (!is_numeric(substr($row['ident'], 0, 3))) {
340 387
 					if (is_numeric(substr($row['ident'], 2, 1))) {
@@ -357,12 +404,18 @@  discard block
 block discarded – undo
357 404
 				}
358 405
 			} else {
359 406
 				$temp_array['airline_icao'] = $row['airline_icao'];
360
-				if (isset($row['airline_iata'])) $temp_array['airline_iata'] = $row['airline_iata'];
361
-				else $temp_array['airline_iata'] = 'N/A';
407
+				if (isset($row['airline_iata'])) {
408
+					$temp_array['airline_iata'] = $row['airline_iata'];
409
+				} else {
410
+					$temp_array['airline_iata'] = 'N/A';
411
+				}
362 412
 				$temp_array['airline_name'] = $row['airline_name'];
363 413
 				$temp_array['airline_country'] = $row['airline_country'];
364
-				if (isset($row['airline_callsign'])) $temp_array['airline_callsign'] = $row['airline_callsign'];
365
-				else $temp_array['airline_callsign'] = 'N/A';
414
+				if (isset($row['airline_callsign'])) {
415
+					$temp_array['airline_callsign'] = $row['airline_callsign'];
416
+				} else {
417
+					$temp_array['airline_callsign'] = 'N/A';
418
+				}
366 419
 				$temp_array['airline_type'] = $row['airline_type'];
367 420
 				if ($temp_array['airline_icao'] != '' && $temp_array['airline_iata'] == 'N/A') {
368 421
 					$airline_array = $this->getAllAirlineInfo($temp_array['airline_icao']);
@@ -389,7 +442,9 @@  discard block
 block discarded – undo
389 442
 			}
390 443
 			if ($temp_array['registration'] != "" && !$globalIVAO && !$globalVATSIM && !$globalphpVMS && !$globalVAM && !isset($temp_array['aircraft_owner'])) {
391 444
 				$owner_info = $this->getAircraftOwnerByRegistration($temp_array['registration']);
392
-				if ($owner_info['owner'] != '') $temp_array['aircraft_owner'] = ucwords(strtolower($owner_info['owner']));
445
+				if ($owner_info['owner'] != '') {
446
+					$temp_array['aircraft_owner'] = ucwords(strtolower($owner_info['owner']));
447
+				}
393 448
 				$temp_array['aircraft_base'] = $owner_info['base'];
394 449
 				$temp_array['aircraft_date_first_reg'] = $owner_info['date_first_reg'];
395 450
 			}
@@ -397,9 +452,14 @@  discard block
 block discarded – undo
397 452
 			if($temp_array['registration'] != "" || ($globalIVAO && isset($temp_array['aircraft_type']) && $temp_array['aircraft_type'] != ''))
398 453
 			{
399 454
 				if ($globalIVAO) {
400
-					if (isset($temp_array['airline_icao']))	$image_array = $Image->getSpotterImage('',$temp_array['aircraft_type'],$temp_array['airline_icao']);
401
-					else $image_array = $Image->getSpotterImage('',$temp_array['aircraft_type']);
402
-				} else $image_array = $Image->getSpotterImage($temp_array['registration']);
455
+					if (isset($temp_array['airline_icao'])) {
456
+						$image_array = $Image->getSpotterImage('',$temp_array['aircraft_type'],$temp_array['airline_icao']);
457
+					} else {
458
+						$image_array = $Image->getSpotterImage('',$temp_array['aircraft_type']);
459
+					}
460
+				} else {
461
+					$image_array = $Image->getSpotterImage($temp_array['registration']);
462
+				}
403 463
 				if (count($image_array) > 0) {
404 464
 					$temp_array['image'] = $image_array[0]['image'];
405 465
 					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -451,7 +511,9 @@  discard block
 block discarded – undo
451 511
 			//if ($row['departure_airport_icao'] != '' && $row['departure_airport_name'] == '') {
452 512
 			if ($row['departure_airport_icao'] != '') {
453 513
 				$departure_airport_array = $this->getAllAirportInfo($row['departure_airport_icao']);
454
-				if (!isset($departure_airport_array[0]['name'])) $departure_airport_array = $this->getAllAirportInfo('NA');
514
+				if (!isset($departure_airport_array[0]['name'])) {
515
+					$departure_airport_array = $this->getAllAirportInfo('NA');
516
+				}
455 517
 			/*
456 518
 			} elseif ($row['departure_airport_name'] != '') {
457 519
 				$temp_array['departure_airport_name'] = $row['departure_airport_name'];
@@ -459,7 +521,9 @@  discard block
 block discarded – undo
459 521
 				$temp_array['departure_airport_country'] = $row['departure_airport_country'];
460 522
 				$temp_array['departure_airport_icao'] = $row['departure_airport_icao'];
461 523
 			*/
462
-			} else $departure_airport_array = $this->getAllAirportInfo('NA');
524
+			} else {
525
+				$departure_airport_array = $this->getAllAirportInfo('NA');
526
+			}
463 527
 			if (isset($departure_airport_array[0]['name'])) {
464 528
 				$temp_array['departure_airport_name'] = $departure_airport_array[0]['name'];
465 529
 				$temp_array['departure_airport_city'] = $departure_airport_array[0]['city'];
@@ -479,8 +543,12 @@  discard block
 block discarded – undo
479 543
 			
480 544
 			if ($row['arrival_airport_icao'] != '') {
481 545
 				$arrival_airport_array = $this->getAllAirportInfo($row['arrival_airport_icao']);
482
-				if (count($arrival_airport_array) == 0) $arrival_airport_array = $this->getAllAirportInfo('NA');
483
-			} else $arrival_airport_array = $this->getAllAirportInfo('NA');
546
+				if (count($arrival_airport_array) == 0) {
547
+					$arrival_airport_array = $this->getAllAirportInfo('NA');
548
+				}
549
+			} else {
550
+				$arrival_airport_array = $this->getAllAirportInfo('NA');
551
+			}
484 552
 			if (isset($arrival_airport_array[0]['name'])) {
485 553
 				$temp_array['arrival_airport_name'] = $arrival_airport_array[0]['name'];
486 554
 				$temp_array['arrival_airport_city'] = $arrival_airport_array[0]['city'];
@@ -496,27 +564,45 @@  discard block
 block discarded – undo
496 564
 				$temp_array['arrival_airport_time'] = $row['arrival_airport_time'];
497 565
 			}
498 566
 			*/
499
-			if (isset($row['pilot_id']) && $row['pilot_id'] != '') $temp_array['pilot_id'] = $row['pilot_id'];
500
-			if (isset($row['pilot_name']) && $row['pilot_name'] != '') $temp_array['pilot_name'] = $row['pilot_name'];
501
-			if (isset($row['source_name']) && $row['source_name'] != '') $temp_array['source_name'] = $row['source_name'];
502
-			if (isset($row['over_country']) && $row['over_country'] != '') $temp_array['over_country'] = $row['over_country'];
503
-			if (isset($row['distance']) && $row['distance'] != '') $temp_array['distance'] = $row['distance'];
567
+			if (isset($row['pilot_id']) && $row['pilot_id'] != '') {
568
+				$temp_array['pilot_id'] = $row['pilot_id'];
569
+			}
570
+			if (isset($row['pilot_name']) && $row['pilot_name'] != '') {
571
+				$temp_array['pilot_name'] = $row['pilot_name'];
572
+			}
573
+			if (isset($row['source_name']) && $row['source_name'] != '') {
574
+				$temp_array['source_name'] = $row['source_name'];
575
+			}
576
+			if (isset($row['over_country']) && $row['over_country'] != '') {
577
+				$temp_array['over_country'] = $row['over_country'];
578
+			}
579
+			if (isset($row['distance']) && $row['distance'] != '') {
580
+				$temp_array['distance'] = $row['distance'];
581
+			}
504 582
 			if (isset($row['squawk'])) {
505 583
 				$temp_array['squawk'] = $row['squawk'];
506 584
 				if ($row['squawk'] != '' && isset($temp_array['country_iso2'])) {
507 585
 					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$temp_array['country_iso2']);
508
-					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
586
+					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) {
587
+						$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
588
+					}
509 589
 				} elseif ($row['squawk'] != '' && isset($temp_array['over_country'])) {
510 590
 					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$temp_array['over_country']);
511
-					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
512
-				} elseif ($row['squawk'] != '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
591
+					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) {
592
+						$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
593
+					}
594
+				} elseif ($row['squawk'] != '' && isset($globalSquawkCountry)) {
595
+					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
596
+				}
513 597
 			}
514 598
     			
515 599
 			$temp_array['query_number_rows'] = $num_rows;
516 600
 			
517 601
 			$spotter_array[] = $temp_array;
518 602
 		}
519
-		if ($num_rows == 0) return array();
603
+		if ($num_rows == 0) {
604
+			return array();
605
+		}
520 606
 		$spotter_array[0]['query_number_rows'] = $num_rows;
521 607
 		return $spotter_array;
522 608
 	}	
@@ -549,7 +635,9 @@  discard block
 block discarded – undo
549 635
 				foreach ($q_array as $q_item){
550 636
 					$q_item = filter_var($q_item,FILTER_SANITIZE_STRING);
551 637
 					$additional_query .= " AND (";
552
-					if (is_int($q_item)) $additional_query .= "(spotter_output.spotter_id like '%".$q_item."%') OR ";
638
+					if (is_int($q_item)) {
639
+						$additional_query .= "(spotter_output.spotter_id like '%".$q_item."%') OR ";
640
+					}
553 641
 					$additional_query .= "(spotter_output.aircraft_icao like '%".$q_item."%') OR ";
554 642
 					$additional_query .= "(spotter_output.aircraft_name like '%".$q_item."%') OR ";
555 643
 					$additional_query .= "(spotter_output.aircraft_manufacturer like '%".$q_item."%') OR ";
@@ -570,7 +658,9 @@  discard block
 block discarded – undo
570 658
 					$additional_query .= "(spotter_output.pilot_name like '%".$q_item."%') OR ";
571 659
 					$additional_query .= "(spotter_output.ident like '%".$q_item."%') OR ";
572 660
 					$translate = $Translation->ident2icao($q_item);
573
-					if ($translate != $q_item) $additional_query .= "(spotter_output.ident like '%".$translate."%') OR ";
661
+					if ($translate != $q_item) {
662
+						$additional_query .= "(spotter_output.ident like '%".$translate."%') OR ";
663
+					}
574 664
 					$additional_query .= "(spotter_output.highlight like '%".$q_item."%')";
575 665
 					$additional_query .= ")";
576 666
 				}
@@ -797,7 +887,9 @@  discard block
 block discarded – undo
797 887
 				date_default_timezone_set($globalTimezone);
798 888
 				$datetime = new DateTime();
799 889
 				$offset = $datetime->format('P');
800
-			} else $offset = '+00:00';
890
+			} else {
891
+				$offset = '+00:00';
892
+			}
801 893
 
802 894
 			if ($date_array[1] != "")
803 895
 			{
@@ -829,8 +921,12 @@  discard block
 block discarded – undo
829 921
 			{
830 922
 				//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
831 923
 				$limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0];
832
-			} else $limit_query = "";
833
-		} else $limit_query = "";
924
+			} else {
925
+				$limit_query = "";
926
+			}
927
+		} else {
928
+			$limit_query = "";
929
+		}
834 930
 
835 931
 
836 932
 		if ($sort != "")
@@ -898,8 +994,12 @@  discard block
 block discarded – undo
898 994
 			{
899 995
 				//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
900 996
 				$limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0];
901
-			} else $limit_query = "";
902
-		} else $limit_query = "";
997
+			} else {
998
+				$limit_query = "";
999
+			}
1000
+		} else {
1001
+			$limit_query = "";
1002
+		}
903 1003
 		
904 1004
 		if ($sort != "")
905 1005
 		{
@@ -1223,7 +1323,9 @@  discard block
 block discarded – undo
1223 1323
 		global $global_query;
1224 1324
 		
1225 1325
 		date_default_timezone_set('UTC');
1226
-		if ($id == '') return array();
1326
+		if ($id == '') {
1327
+			return array();
1328
+		}
1227 1329
 		$additional_query = "spotter_output.spotter_id = :id";
1228 1330
 		$query_values = array(':id' => $id);
1229 1331
 
@@ -1338,8 +1440,11 @@  discard block
 block discarded – undo
1338 1440
 		if ($sort != "")
1339 1441
 		{
1340 1442
 			$search_orderby_array = $this->getOrderBy();
1341
-			if (isset($search_orderby_array[$sort]['sql'])) $orderby_query = $search_orderby_array[$sort]['sql'];
1342
-			else $orderby_query = " ORDER BY spotter_output.date DESC";
1443
+			if (isset($search_orderby_array[$sort]['sql'])) {
1444
+				$orderby_query = $search_orderby_array[$sort]['sql'];
1445
+			} else {
1446
+				$orderby_query = " ORDER BY spotter_output.date DESC";
1447
+			}
1343 1448
 		} else {
1344 1449
 			$orderby_query = " ORDER BY spotter_output.date DESC";
1345 1450
 		}
@@ -1964,7 +2069,9 @@  discard block
 block discarded – undo
1964 2069
 		{
1965 2070
 			$highlight = $row['highlight'];
1966 2071
 		}
1967
-		if (isset($highlight)) return $highlight;
2072
+		if (isset($highlight)) {
2073
+			return $highlight;
2074
+		}
1968 2075
 	}
1969 2076
 
1970 2077
 	
@@ -1992,7 +2099,9 @@  discard block
 block discarded – undo
1992 2099
 		$sth->closeCursor();
1993 2100
 		if (count($row) > 0) {
1994 2101
 			return $row['usage'];
1995
-		} else return '';
2102
+		} else {
2103
+			return '';
2104
+		}
1996 2105
 	}
1997 2106
 
1998 2107
 	/**
@@ -2017,7 +2126,9 @@  discard block
 block discarded – undo
2017 2126
 		$sth->closeCursor();
2018 2127
 		if (count($row) > 0) {
2019 2128
 			return $row['icao'];
2020
-		} else return '';
2129
+		} else {
2130
+			return '';
2131
+		}
2021 2132
 	}
2022 2133
 
2023 2134
 	/**
@@ -2045,7 +2156,9 @@  discard block
 block discarded – undo
2045 2156
 			$airport_longitude = $row['longitude'];
2046 2157
 			$Common = new Common();
2047 2158
 			return $Common->distance($latitude,$longitude,$airport_latitude,$airport_longitude);
2048
-		} else return '';
2159
+		} else {
2160
+			return '';
2161
+		}
2049 2162
 	}
2050 2163
 	
2051 2164
 	/**
@@ -2157,7 +2270,9 @@  discard block
 block discarded – undo
2157 2270
 			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2158 2271
 			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2159 2272
 			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2160
-		} else return array();
2273
+		} else {
2274
+			return array();
2275
+		}
2161 2276
 		if ($globalDBdriver == 'mysql') {
2162 2277
 			$query  = "SELECT airport.* FROM airport WHERE airport.latitude BETWEEN ".$minlat." AND ".$maxlat." AND airport.longitude BETWEEN ".$minlong." AND ".$maxlong." AND airport.type != 'closed'";
2163 2278
 		} else {
@@ -2192,7 +2307,9 @@  discard block
 block discarded – undo
2192 2307
 			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2193 2308
 			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2194 2309
 			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2195
-		} else return array();
2310
+		} else {
2311
+			return array();
2312
+		}
2196 2313
 		//$query  = "SELECT waypoints.* FROM waypoints WHERE waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong;
2197 2314
 		$query  = "SELECT waypoints.* FROM waypoints WHERE (waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong.") OR (waypoints.latitude_end BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_end BETWEEN ".$minlong." AND ".$maxlong.")";
2198 2315
 		//$query  = "SELECT waypoints.* FROM waypoints";
@@ -2227,7 +2344,9 @@  discard block
 block discarded – undo
2227 2344
 	public function getAllAirlineInfo($airline_icao, $fromsource = NULL)
2228 2345
 	{
2229 2346
 		global $globalUseRealAirlines;
2230
-		if (isset($globalUseRealAirlines) && $globalUseRealAirlines) $fromsource = NULL;
2347
+		if (isset($globalUseRealAirlines) && $globalUseRealAirlines) {
2348
+			$fromsource = NULL;
2349
+		}
2231 2350
 		$airline_icao = strtoupper(filter_var($airline_icao,FILTER_SANITIZE_STRING));
2232 2351
 		if ($airline_icao == 'NA') {
2233 2352
 			$airline_array = array();
@@ -2296,7 +2415,9 @@  discard block
 block discarded – undo
2296 2415
 	public function getAllAirlineInfoByName($airline_name, $fromsource = NULL)
2297 2416
 	{
2298 2417
 		global $globalUseRealAirlines;
2299
-		if (isset($globalUseRealAirlines) && $globalUseRealAirlines) $fromsource = NULL;
2418
+		if (isset($globalUseRealAirlines) && $globalUseRealAirlines) {
2419
+			$fromsource = NULL;
2420
+		}
2300 2421
 		$airline_name = strtolower(filter_var($airline_name,FILTER_SANITIZE_STRING));
2301 2422
 		$query  = "SELECT airlines.name, airlines.iata, airlines.icao, airlines.callsign, airlines.country, airlines.type FROM airlines WHERE lower(airlines.name) = :airline_name AND airlines.active = 'Y' AND airlines.forsource IS NULL LIMIT 1";
2302 2423
 		$sth = $this->db->prepare($query);
@@ -2312,7 +2433,9 @@  discard block
 block discarded – undo
2312 2433
 			$sth->execute(array(':fromsource' => $fromsource));
2313 2434
 			$row = $sth->fetch(PDO::FETCH_ASSOC);
2314 2435
 			$sth->closeCursor();
2315
-			if ($row['nb'] == 0) $result = $this->getAllAirlineInfoByName($airline_name);
2436
+			if ($row['nb'] == 0) {
2437
+				$result = $this->getAllAirlineInfoByName($airline_name);
2438
+			}
2316 2439
 		}
2317 2440
 		return $result;
2318 2441
 	}
@@ -2375,15 +2498,20 @@  discard block
 block discarded – undo
2375 2498
 				'A320-211' => 'A320',
2376 2499
 				'747-8i' => 'B748',
2377 2500
 				'A380' => 'A388');
2378
-		if (isset($all_aircraft[$aircraft_type])) return $all_aircraft[$aircraft_type];
2501
+		if (isset($all_aircraft[$aircraft_type])) {
2502
+			return $all_aircraft[$aircraft_type];
2503
+		}
2379 2504
 
2380 2505
 		$query  = "SELECT aircraft.icao FROM aircraft WHERE aircraft.type LIKE :saircraft_type OR aircraft.type = :aircraft_type OR aircraft.icao = :aircraft_type LIMIT 1";
2381 2506
 		$aircraft_type = strtoupper($aircraft_type);
2382 2507
 		$sth = $this->db->prepare($query);
2383 2508
 		$sth->execute(array(':saircraft_type' => '%'.$aircraft_type.'%',':aircraft_type' => $aircraft_type,));
2384 2509
 		$result = $sth->fetchAll(PDO::FETCH_ASSOC);
2385
-		if (isset($result[0]['icao'])) return $result[0]['icao'];
2386
-		else return '';
2510
+		if (isset($result[0]['icao'])) {
2511
+			return $result[0]['icao'];
2512
+		} else {
2513
+			return '';
2514
+		}
2387 2515
 	}
2388 2516
 	
2389 2517
 	/**
@@ -2406,9 +2534,13 @@  discard block
 block discarded – undo
2406 2534
 		$sth->closeCursor();
2407 2535
 		if (isset($row['icaotypecode'])) {
2408 2536
 			$icao = $row['icaotypecode'];
2409
-			if (isset($this->aircraft_correct_icaotype[$icao])) $icao = $this->aircraft_correct_icaotype[$icao];
2537
+			if (isset($this->aircraft_correct_icaotype[$icao])) {
2538
+				$icao = $this->aircraft_correct_icaotype[$icao];
2539
+			}
2410 2540
 			return $icao;
2411
-		} else return '';
2541
+		} else {
2542
+			return '';
2543
+		}
2412 2544
 	}
2413 2545
 
2414 2546
 	/**
@@ -2431,7 +2563,9 @@  discard block
 block discarded – undo
2431 2563
 		$sth->closeCursor();
2432 2564
 		if (isset($row['icaotypecode'])) {
2433 2565
 			return $row['icaotypecode'];
2434
-		} else return '';
2566
+		} else {
2567
+			return '';
2568
+		}
2435 2569
 	}
2436 2570
 
2437 2571
 	/**
@@ -2477,7 +2611,9 @@  discard block
 block discarded – undo
2477 2611
 		$sth->closeCursor();
2478 2612
 		if (isset($row['operator_correct'])) {
2479 2613
 			return $row['operator_correct'];
2480
-		} else return $operator;
2614
+		} else {
2615
+			return $operator;
2616
+		}
2481 2617
 	}
2482 2618
 
2483 2619
 	/**
@@ -2490,7 +2626,9 @@  discard block
 block discarded – undo
2490 2626
 	public function getRouteInfo($callsign)
2491 2627
 	{
2492 2628
 		$callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
2493
-                if ($callsign == '') return array();
2629
+                if ($callsign == '') {
2630
+                	return array();
2631
+                }
2494 2632
 		$query  = "SELECT routes.Operator_ICAO, routes.FromAirport_ICAO, routes.ToAirport_ICAO, routes.RouteStop, routes.FromAirport_Time, routes.ToAirport_Time FROM routes WHERE CallSign = :callsign LIMIT 1";
2495 2633
 		
2496 2634
 		$sth = $this->db->prepare($query);
@@ -2500,7 +2638,9 @@  discard block
 block discarded – undo
2500 2638
 		$sth->closeCursor();
2501 2639
 		if (count($row) > 0) {
2502 2640
 			return $row;
2503
-		} else return array();
2641
+		} else {
2642
+			return array();
2643
+		}
2504 2644
 	}
2505 2645
 	
2506 2646
 	/**
@@ -2553,7 +2693,9 @@  discard block
 block discarded – undo
2553 2693
 			$result = $sth->fetch(PDO::FETCH_ASSOC);
2554 2694
 			$sth->closeCursor();
2555 2695
 			return $result;
2556
-		} else return array();
2696
+		} else {
2697
+			return array();
2698
+		}
2557 2699
 	}
2558 2700
 	
2559 2701
   
@@ -2712,8 +2854,11 @@  discard block
 block discarded – undo
2712 2854
 		$query .= " ORDER BY spotter_output.source_name ASC";
2713 2855
 
2714 2856
 		$sth = $this->db->prepare($query);
2715
-		if (!empty($query_values)) $sth->execute($query_values);
2716
-		else $sth->execute();
2857
+		if (!empty($query_values)) {
2858
+			$sth->execute($query_values);
2859
+		} else {
2860
+			$sth->execute();
2861
+		}
2717 2862
 
2718 2863
 		$source_array = array();
2719 2864
 		$temp_array = array();
@@ -2746,9 +2891,13 @@  discard block
 block discarded – undo
2746 2891
 								WHERE spotter_output.airline_icao <> '' 
2747 2892
 								ORDER BY spotter_output.airline_name ASC";
2748 2893
 			*/
2749
-			if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $forsource = $globalAirlinesSource;
2750
-			elseif (isset($globalVATSIM) && $globalVATSIM) $forsource = 'vatsim';
2751
-			elseif (isset($globalIVAO) && $globalIVAO) $forsource = 'ivao';
2894
+			if (isset($globalAirlinesSource) && $globalAirlinesSource != '') {
2895
+				$forsource = $globalAirlinesSource;
2896
+			} elseif (isset($globalVATSIM) && $globalVATSIM) {
2897
+				$forsource = 'vatsim';
2898
+			} elseif (isset($globalIVAO) && $globalIVAO) {
2899
+				$forsource = 'ivao';
2900
+			}
2752 2901
 			if ($forsource === NULL) {
2753 2902
 				$query = "SELECT DISTINCT icao AS airline_icao, name AS airline_name, type AS airline_type FROM airlines WHERE forsource IS NULL ORDER BY name ASC";
2754 2903
 				$query_data = array();
@@ -2791,9 +2940,13 @@  discard block
 block discarded – undo
2791 2940
 	{
2792 2941
 		global $globalAirlinesSource,$globalVATSIM, $globalIVAO;
2793 2942
 		$filter_query = $this->getFilter($filters,true,true);
2794
-		if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $forsource = $globalAirlinesSource;
2795
-		elseif (isset($globalVATSIM) && $globalVATSIM) $forsource = 'vatsim';
2796
-		elseif (isset($globalIVAO) && $globalIVAO) $forsource = 'ivao';
2943
+		if (isset($globalAirlinesSource) && $globalAirlinesSource != '') {
2944
+			$forsource = $globalAirlinesSource;
2945
+		} elseif (isset($globalVATSIM) && $globalVATSIM) {
2946
+			$forsource = 'vatsim';
2947
+		} elseif (isset($globalIVAO) && $globalIVAO) {
2948
+			$forsource = 'ivao';
2949
+		}
2797 2950
 		if ($forsource === NULL) {
2798 2951
 			$query = "SELECT DISTINCT alliance FROM airlines WHERE alliance IS NOT NULL AND forsource IS NULL ORDER BY alliance ASC";
2799 2952
 			$query_data = array();
@@ -3104,7 +3257,9 @@  discard block
 block discarded – undo
3104 3257
 			date_default_timezone_set($globalTimezone);
3105 3258
 			$datetime = new DateTime();
3106 3259
 			$offset = $datetime->format('P');
3107
-		} else $offset = '+00:00';
3260
+		} else {
3261
+			$offset = '+00:00';
3262
+		}
3108 3263
 		if ($airport_icao == '') {
3109 3264
 			if ($globalDBdriver == 'mysql') {
3110 3265
 				$query = "SELECT COUNT(departure_airport_icao) AS departure_airport_count, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date FROM `spotter_output`".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 7 DAY) AND departure_airport_icao <> 'NA' AND departure_airport_icao <> '' GROUP BY departure_airport_icao, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d'), departure_airport_name, departure_airport_city, departure_airport_country ORDER BY departure_airport_count DESC";
@@ -3136,7 +3291,9 @@  discard block
 block discarded – undo
3136 3291
 			date_default_timezone_set($globalTimezone);
3137 3292
 			$datetime = new DateTime();
3138 3293
 			$offset = $datetime->format('P');
3139
-		} else $offset = '+00:00';
3294
+		} else {
3295
+			$offset = '+00:00';
3296
+		}
3140 3297
 		if ($airport_icao == '') {
3141 3298
 			if ($globalDBdriver == 'mysql') {
3142 3299
 				$query = "SELECT spotter_output.airline_icao, COUNT(departure_airport_icao) AS departure_airport_count, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date FROM `spotter_output` WHERE spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 7 DAY) AND departure_airport_icao <> 'NA' AND departure_airport_icao <> '' AND spotter_output.airline_icao <> '' GROUP BY spotter_output.airline_icao, departure_airport_icao, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d'), departure_airport_name, departure_airport_city, departure_airport_country ORDER BY departure_airport_count DESC";
@@ -3169,7 +3326,9 @@  discard block
 block discarded – undo
3169 3326
 			date_default_timezone_set($globalTimezone);
3170 3327
 			$datetime = new DateTime();
3171 3328
 			$offset = $datetime->format('P');
3172
-		} else $offset = '+00:00';
3329
+		} else {
3330
+			$offset = '+00:00';
3331
+		}
3173 3332
 		if ($airport_icao == '') {
3174 3333
 			if ($globalDBdriver == 'mysql') {
3175 3334
 				$query = "SELECT COUNT(real_departure_airport_icao) AS departure_airport_count, real_departure_airport_icao AS departure_airport_icao, airport.name AS departure_airport_name, airport.city AS departure_airport_city, airport.country AS departure_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date 
@@ -3208,7 +3367,9 @@  discard block
 block discarded – undo
3208 3367
 			date_default_timezone_set($globalTimezone);
3209 3368
 			$datetime = new DateTime();
3210 3369
 			$offset = $datetime->format('P');
3211
-		} else $offset = '+00:00';
3370
+		} else {
3371
+			$offset = '+00:00';
3372
+		}
3212 3373
 		if ($airport_icao == '') {
3213 3374
 			if ($globalDBdriver == 'mysql') {
3214 3375
 				$query = "SELECT spotter_output.airline_icao, COUNT(real_departure_airport_icao) AS departure_airport_count, real_departure_airport_icao AS departure_airport_icao, airport.name AS departure_airport_name, airport.city AS departure_airport_city, airport.country AS departure_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date 
@@ -3253,7 +3414,9 @@  discard block
 block discarded – undo
3253 3414
 			date_default_timezone_set($globalTimezone);
3254 3415
 			$datetime = new DateTime();
3255 3416
 			$offset = $datetime->format('P');
3256
-		} else $offset = '+00:00';
3417
+		} else {
3418
+			$offset = '+00:00';
3419
+		}
3257 3420
 		if ($airport_icao == '') {
3258 3421
 			if ($globalDBdriver == 'mysql') {
3259 3422
 				$query = "SELECT COUNT(arrival_airport_icao) AS arrival_airport_count, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date FROM `spotter_output`".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 7 DAY) AND arrival_airport_icao <> 'NA' AND arrival_airport_icao <> '' GROUP BY arrival_airport_icao, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d'), arrival_airport_name, arrival_airport_city, arrival_airport_country ORDER BY arrival_airport_count DESC";
@@ -3288,7 +3451,9 @@  discard block
 block discarded – undo
3288 3451
 			date_default_timezone_set($globalTimezone);
3289 3452
 			$datetime = new DateTime();
3290 3453
 			$offset = $datetime->format('P');
3291
-		} else $offset = '+00:00';
3454
+		} else {
3455
+			$offset = '+00:00';
3456
+		}
3292 3457
 		if ($airport_icao == '') {
3293 3458
 			if ($globalDBdriver == 'mysql') {
3294 3459
 				$query = "SELECT COUNT(real_arrival_airport_icao) AS arrival_airport_count, real_arrival_airport_icao AS arrival_airport_icao, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date 
@@ -3330,7 +3495,9 @@  discard block
 block discarded – undo
3330 3495
 			date_default_timezone_set($globalTimezone);
3331 3496
 			$datetime = new DateTime();
3332 3497
 			$offset = $datetime->format('P');
3333
-		} else $offset = '+00:00';
3498
+		} else {
3499
+			$offset = '+00:00';
3500
+		}
3334 3501
 		if ($airport_icao == '') {
3335 3502
 			if ($globalDBdriver == 'mysql') {
3336 3503
 				$query = "SELECT spotter_output.airline_icao, COUNT(arrival_airport_icao) AS arrival_airport_count, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date FROM `spotter_output` WHERE spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 7 DAY) AND arrival_airport_icao <> 'NA' AND arrival_airport_icao <> '' AND spotter_output.airline_icao <> '' GROUP BY spotter_output.airline_icao, arrival_airport_icao, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d'), arrival_airport_name, arrival_airport_city, arrival_airport_country ORDER BY arrival_airport_count DESC";
@@ -3364,7 +3531,9 @@  discard block
 block discarded – undo
3364 3531
 			date_default_timezone_set($globalTimezone);
3365 3532
 			$datetime = new DateTime();
3366 3533
 			$offset = $datetime->format('P');
3367
-		} else $offset = '+00:00';
3534
+		} else {
3535
+			$offset = '+00:00';
3536
+		}
3368 3537
 		if ($airport_icao == '') {
3369 3538
 			if ($globalDBdriver == 'mysql') {
3370 3539
 				$query = "SELECT spotter_output.airline_icao, COUNT(real_arrival_airport_icao) AS arrival_airport_count, real_arrival_airport_icao AS arrival_airport_icao, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date 
@@ -3412,7 +3581,9 @@  discard block
 block discarded – undo
3412 3581
 			date_default_timezone_set($globalTimezone);
3413 3582
 			$datetime = new DateTime();
3414 3583
 			$offset = $datetime->format('P');
3415
-		} else $offset = '+00:00';
3584
+		} else {
3585
+			$offset = '+00:00';
3586
+		}
3416 3587
 
3417 3588
 		if ($globalDBdriver == 'mysql') {
3418 3589
 			$query  = "SELECT DISTINCT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) as date
@@ -3532,7 +3703,9 @@  discard block
 block discarded – undo
3532 3703
 	*/	
3533 3704
 	public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '',$arrival_airport_time = '')
3534 3705
 	{
3535
-		if ($groundspeed == '') $groundspeed = NULL;
3706
+		if ($groundspeed == '') {
3707
+			$groundspeed = NULL;
3708
+		}
3536 3709
 		$query = 'UPDATE spotter_output SET ident = :ident, last_latitude = :last_latitude, last_longitude = :last_longitude, last_altitude = :last_altitude, last_ground = :last_ground, last_seen = :last_seen, real_arrival_airport_icao = :real_arrival_airport_icao, real_arrival_airport_time = :real_arrival_airport_time, last_ground_speed = :last_ground_speed WHERE flightaware_id = :flightaware_id';
3537 3710
                 $query_values = array(':flightaware_id' => $flightaware_id,':real_arrival_airport_icao' => $arrival_airport_icao,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_altitude' => $altitude,':last_ground_speed' => $groundspeed,':last_seen' => $date,':real_arrival_airport_time' => $arrival_airport_time, ':last_ground' => $ground, ':ident' => $ident);
3538 3711
 
@@ -3582,10 +3755,18 @@  discard block
 block discarded – undo
3582 3755
 		$Image = new Image($this->db);
3583 3756
 		$Common = new Common();
3584 3757
 		
3585
-		if (!isset($globalIVAO)) $globalIVAO = FALSE;
3586
-		if (!isset($globalVATSIM)) $globalVATSIM = FALSE;
3587
-		if (!isset($globalphpVMS)) $globalphpVMS = FALSE;
3588
-		if (!isset($globalVAM)) $globalVAM = FALSE;
3758
+		if (!isset($globalIVAO)) {
3759
+			$globalIVAO = FALSE;
3760
+		}
3761
+		if (!isset($globalVATSIM)) {
3762
+			$globalVATSIM = FALSE;
3763
+		}
3764
+		if (!isset($globalphpVMS)) {
3765
+			$globalphpVMS = FALSE;
3766
+		}
3767
+		if (!isset($globalVAM)) {
3768
+			$globalVAM = FALSE;
3769
+		}
3589 3770
 		date_default_timezone_set('UTC');
3590 3771
 		
3591 3772
 		//getting the registration
@@ -3598,23 +3779,33 @@  discard block
 block discarded – undo
3598 3779
 				if ($ModeS != '') {
3599 3780
 					$timeelapsed = microtime(true);
3600 3781
 					$registration = $this->getAircraftRegistrationBymodeS($ModeS);
3601
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3782
+					if ($globalDebugTimeElapsed) {
3783
+						echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3784
+					}
3602 3785
 				} else {
3603 3786
 					$myhex = explode('-',$flightaware_id);
3604 3787
 					if (count($myhex) > 0) {
3605 3788
 						$timeelapsed = microtime(true);
3606 3789
 						$registration = $this->getAircraftRegistrationBymodeS($myhex[0]);
3607
-						if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3790
+						if ($globalDebugTimeElapsed) {
3791
+							echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3792
+						}
3608 3793
 					}
3609 3794
 				}
3610 3795
 			}
3611 3796
 		}
3612 3797
 		$fromsource = NULL;
3613
-		if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource;
3614
-		elseif ($format_source == 'vatsimtxt') $fromsource = 'vatsim';
3615
-		elseif ($format_source == 'whazzup') $fromsource = 'ivao';
3616
-		elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim';
3617
-		elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao';
3798
+		if (isset($globalAirlinesSource) && $globalAirlinesSource != '') {
3799
+			$fromsource = $globalAirlinesSource;
3800
+		} elseif ($format_source == 'vatsimtxt') {
3801
+			$fromsource = 'vatsim';
3802
+		} elseif ($format_source == 'whazzup') {
3803
+			$fromsource = 'ivao';
3804
+		} elseif (isset($globalVATSIM) && $globalVATSIM) {
3805
+			$fromsource = 'vatsim';
3806
+		} elseif (isset($globalIVAO) && $globalIVAO) {
3807
+			$fromsource = 'ivao';
3808
+		}
3618 3809
 		//getting the airline information
3619 3810
 		if ($ident != "")
3620 3811
 		{
@@ -3638,15 +3829,21 @@  discard block
 block discarded – undo
3638 3829
 					if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == ""){
3639 3830
 						$airline_array = $this->getAllAirlineInfo("NA");
3640 3831
 					}
3641
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3832
+					if ($globalDebugTimeElapsed) {
3833
+						echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3834
+					}
3642 3835
 
3643 3836
 				} else {
3644 3837
 					$timeelapsed = microtime(true);
3645 3838
 					$airline_array = $this->getAllAirlineInfo("NA");
3646
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3839
+					if ($globalDebugTimeElapsed) {
3840
+						echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3841
+					}
3647 3842
 				}
3648 3843
 			}
3649
-		} else $airline_array = array();
3844
+		} else {
3845
+			$airline_array = array();
3846
+		}
3650 3847
 		
3651 3848
 		//getting the aircraft information
3652 3849
 		$aircraft_array = array();
@@ -3660,27 +3857,37 @@  discard block
 block discarded – undo
3660 3857
 				{
3661 3858
 					$timeelapsed = microtime(true);
3662 3859
 					$aircraft_array = $this->getAllAircraftInfo("NA");
3663
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3860
+					if ($globalDebugTimeElapsed) {
3861
+						echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3862
+					}
3664 3863
 				} else {
3665 3864
 					$timeelapsed = microtime(true);
3666 3865
 					$aircraft_array = $this->getAllAircraftInfo($aircraft_icao);
3667
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3866
+					if ($globalDebugTimeElapsed) {
3867
+						echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3868
+					}
3668 3869
 				}
3669 3870
 			}
3670 3871
 		} else {
3671 3872
 			if ($ModeS != '') {
3672 3873
 				$timeelapsed = microtime(true);
3673 3874
 				$aircraft_icao = $this->getAllAircraftType($ModeS);
3674
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3875
+				if ($globalDebugTimeElapsed) {
3876
+					echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3877
+				}
3675 3878
 				if ($aircraft_icao == "" || $aircraft_icao == "XXXX")
3676 3879
 				{
3677 3880
 					$timeelapsed = microtime(true);
3678 3881
 					$aircraft_array = $this->getAllAircraftInfo("NA");
3679
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3882
+					if ($globalDebugTimeElapsed) {
3883
+						echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3884
+					}
3680 3885
 				} else {
3681 3886
 					$timeelapsed = microtime(true);
3682 3887
 					$aircraft_array = $this->getAllAircraftInfo($aircraft_icao);
3683
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3888
+					if ($globalDebugTimeElapsed) {
3889
+						echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3890
+					}
3684 3891
 				}
3685 3892
 			}
3686 3893
 		}
@@ -3696,7 +3903,9 @@  discard block
 block discarded – undo
3696 3903
 			} else {
3697 3904
 				$timeelapsed = microtime(true);
3698 3905
 				$departure_airport_array = $this->getAllAirportInfo($departure_airport_icao);
3699
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3906
+				if ($globalDebugTimeElapsed) {
3907
+					echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3908
+				}
3700 3909
 			}
3701 3910
 		}
3702 3911
 		
@@ -3711,7 +3920,9 @@  discard block
 block discarded – undo
3711 3920
 			} else {
3712 3921
 				$timeelapsed = microtime(true);
3713 3922
 				$arrival_airport_array = $this->getAllAirportInfo($arrival_airport_icao);
3714
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3923
+				if ($globalDebugTimeElapsed) {
3924
+					echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3925
+				}
3715 3926
 			}
3716 3927
 		}
3717 3928
 
@@ -3745,7 +3956,9 @@  discard block
 block discarded – undo
3745 3956
 			{
3746 3957
 				return false;
3747 3958
 			}
3748
-		} else $altitude = 0;
3959
+		} else {
3960
+			$altitude = 0;
3961
+		}
3749 3962
 		
3750 3963
 		if ($heading != "")
3751 3964
 		{
@@ -3774,7 +3987,9 @@  discard block
 block discarded – undo
3774 3987
 		{
3775 3988
 			$timeelapsed = microtime(true);
3776 3989
 			$image_array = $Image->getSpotterImage($registration);
3777
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3990
+			if ($globalDebugTimeElapsed) {
3991
+				echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3992
+			}
3778 3993
 			if (!isset($image_array[0]['registration']))
3779 3994
 			{
3780 3995
 				//echo "Add image !!!! \n";
@@ -3782,14 +3997,21 @@  discard block
 block discarded – undo
3782 3997
 			}
3783 3998
 			$timeelapsed = microtime(true);
3784 3999
 			$owner_info = $this->getAircraftOwnerByRegistration($registration);
3785
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3786
-			if ($owner_info['owner'] != '') $aircraft_owner = ucwords(strtolower($owner_info['owner']));
4000
+			if ($globalDebugTimeElapsed) {
4001
+				echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
4002
+			}
4003
+			if ($owner_info['owner'] != '') {
4004
+				$aircraft_owner = ucwords(strtolower($owner_info['owner']));
4005
+			}
3787 4006
 		}
3788 4007
     
3789 4008
 		if ($globalIVAO && $aircraft_icao != '')
3790 4009
 		{
3791
-            		if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao'];
3792
-            		else $airline_icao = '';
4010
+            		if (isset($airline_array[0]['icao'])) {
4011
+            			$airline_icao = $airline_array[0]['icao'];
4012
+            		} else {
4013
+            			$airline_icao = '';
4014
+            		}
3793 4015
 			$image_array = $Image->getSpotterImage('',$aircraft_icao,$airline_icao);
3794 4016
 			if (!isset($image_array[0]['registration']))
3795 4017
 			{
@@ -3834,16 +4056,28 @@  discard block
 block discarded – undo
3834 4056
                 {
3835 4057
                         $arrival_airport_array = $this->getAllAirportInfo('NA');
3836 4058
                 }
3837
-                if ($registration == '') $registration = 'NA';
4059
+                if ($registration == '') {
4060
+                	$registration = 'NA';
4061
+                }
3838 4062
                 if ($latitude == '' && $longitude == '') {
3839 4063
             		$latitude = 0;
3840 4064
             		$longitude = 0;
3841 4065
             	}
3842
-                if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL;
3843
-                if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL;
3844
-                if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
3845
-                if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
3846
-                if (!isset($aircraft_owner)) $aircraft_owner = NULL;
4066
+                if ($squawk == '' || $Common->isInteger($squawk) === false) {
4067
+                	$squawk = NULL;
4068
+                }
4069
+                if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) {
4070
+                	$verticalrate = NULL;
4071
+                }
4072
+                if ($heading == '' || $Common->isInteger($heading) === false) {
4073
+                	$heading = 0;
4074
+                }
4075
+                if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) {
4076
+                	$groundspeed = 0;
4077
+                }
4078
+                if (!isset($aircraft_owner)) {
4079
+                	$aircraft_owner = NULL;
4080
+                }
3847 4081
                 $query  = "INSERT INTO spotter_output (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, latitude, longitude, waypoints, altitude, heading, ground_speed, date, departure_airport_time, arrival_airport_time, squawk, route_stop,highlight,ModeS, pilot_id, pilot_name, verticalrate, owner_name, ground, format_source, source_name) 
3848 4082
                 VALUES (:flightaware_id,:ident,:registration,:airline_name,:airline_icao,:airline_country,:airline_type,:aircraft_icao,:aircraft_type,:aircraft_manufacturer,:departure_airport_icao,:departure_airport_name,:departure_airport_city,:departure_airport_country, :arrival_airport_icao, :arrival_airport_name, :arrival_airport_city, :arrival_airport_country, :latitude,:longitude,:waypoints,:altitude,:heading,:groundspeed,:date, :departure_airport_time, :arrival_airport_time, :squawk, :route_stop, :highlight, :ModeS, :pilot_id, :pilot_name, :verticalrate, :owner_name,:ground, :format_source, :source_name)";
3849 4083
 
@@ -3854,9 +4088,13 @@  discard block
 block discarded – undo
3854 4088
 		if ($airline_type == '') {
3855 4089
 			$timeelapsed = microtime(true);
3856 4090
 			$airline_type = $this->getAircraftTypeBymodeS($ModeS);
3857
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
4091
+			if ($globalDebugTimeElapsed) {
4092
+				echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
4093
+			}
4094
+		}
4095
+		if ($airline_type == null) {
4096
+			$airline_type = '';
3858 4097
 		}
3859
-		if ($airline_type == null) $airline_type = '';
3860 4098
                 $aircraft_type = $aircraft_array[0]['type'];
3861 4099
                 $aircraft_manufacturer = $aircraft_array[0]['manufacturer'];
3862 4100
                 $departure_airport_name = $departure_airport_array[0]['name'];
@@ -4020,7 +4258,9 @@  discard block
 block discarded – undo
4020 4258
 			}
4021 4259
 		}
4022 4260
 		$query .= " GROUP BY spotter_output.airline_name,spotter_output.airline_icao, spotter_output.airline_country ORDER BY airline_count DESC";
4023
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4261
+		if ($limit) {
4262
+			$query .= " LIMIT 10 OFFSET 0";
4263
+		}
4024 4264
 
4025 4265
 		$sth = $this->db->prepare($query);
4026 4266
 		$sth->execute($query_values);
@@ -4093,7 +4333,9 @@  discard block
 block discarded – undo
4093 4333
 		}
4094 4334
 		
4095 4335
 		$query .= " GROUP BY spotter_output.pilot_id,s.pilot_name,spotter_output.format_source ORDER BY pilot_count DESC";
4096
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4336
+		if ($limit) {
4337
+			$query .= " LIMIT 10 OFFSET 0";
4338
+		}
4097 4339
       
4098 4340
 		
4099 4341
 		$sth = $this->db->prepare($query);
@@ -4137,7 +4379,9 @@  discard block
 block discarded – undo
4137 4379
 			}
4138 4380
 		}
4139 4381
 		$query .= "GROUP BY spotter_output.airline_icao, spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.format_source ORDER BY pilot_count DESC";
4140
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4382
+		if ($limit) {
4383
+			$query .= " LIMIT 10 OFFSET 0";
4384
+		}
4141 4385
       
4142 4386
 		
4143 4387
 		$sth = $this->db->prepare($query);
@@ -4213,7 +4457,9 @@  discard block
 block discarded – undo
4213 4457
 			}
4214 4458
 		}
4215 4459
 		$query .= " GROUP BY spotter_output.owner_name ORDER BY owner_count DESC";
4216
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4460
+		if ($limit) {
4461
+			$query .= " LIMIT 10 OFFSET 0";
4462
+		}
4217 4463
 		
4218 4464
 		$sth = $this->db->prepare($query);
4219 4465
 		$sth->execute($query_values);
@@ -4255,7 +4501,9 @@  discard block
 block discarded – undo
4255 4501
 			}
4256 4502
 		}
4257 4503
 		$query .= "GROUP BY spotter_output.airline_icao, spotter_output.owner_name ORDER BY owner_count DESC";
4258
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4504
+		if ($limit) {
4505
+			$query .= " LIMIT 10 OFFSET 0";
4506
+		}
4259 4507
       
4260 4508
 		
4261 4509
 		$sth = $this->db->prepare($query);
@@ -4498,7 +4746,9 @@  discard block
 block discarded – undo
4498 4746
 			date_default_timezone_set($globalTimezone);
4499 4747
 			$datetime = new DateTime($date);
4500 4748
 			$offset = $datetime->format('P');
4501
-		} else $offset = '+00:00';
4749
+		} else {
4750
+			$offset = '+00:00';
4751
+		}
4502 4752
 
4503 4753
 		if ($globalDBdriver == 'mysql') {
4504 4754
 			$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
@@ -4546,7 +4796,9 @@  discard block
 block discarded – undo
4546 4796
 			date_default_timezone_set($globalTimezone);
4547 4797
 			$datetime = new DateTime($date);
4548 4798
 			$offset = $datetime->format('P');
4549
-		} else $offset = '+00:00';
4799
+		} else {
4800
+			$offset = '+00:00';
4801
+		}
4550 4802
 		
4551 4803
 		if ($globalDBdriver == 'mysql') {
4552 4804
 			$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
@@ -4664,8 +4916,11 @@  discard block
 block discarded – undo
4664 4916
 		$sth = $this->db->prepare($query);
4665 4917
 		$sth->execute($query_values);
4666 4918
 		$result = $sth->fetchAll(PDO::FETCH_ASSOC);
4667
-		if (is_numeric($result[0]['duration'])) return gmdate('H:i:s',$result[0]['duration']);
4668
-		else return $result[0]['duration'];
4919
+		if (is_numeric($result[0]['duration'])) {
4920
+			return gmdate('H:i:s',$result[0]['duration']);
4921
+		} else {
4922
+			return $result[0]['duration'];
4923
+		}
4669 4924
 	}
4670 4925
 
4671 4926
 	/**
@@ -4752,8 +5007,11 @@  discard block
 block discarded – undo
4752 5007
 		$sth = $this->db->prepare($query);
4753 5008
 		$sth->execute($query_values);
4754 5009
 		$result = $sth->fetchAll(PDO::FETCH_ASSOC);
4755
-		if (is_int($result[0]['duration'])) return gmdate('H:i:s',$result[0]['duration']);
4756
-		else return $result[0]['duration'];
5010
+		if (is_int($result[0]['duration'])) {
5011
+			return gmdate('H:i:s',$result[0]['duration']);
5012
+		} else {
5013
+			return $result[0]['duration'];
5014
+		}
4757 5015
 	}
4758 5016
 
4759 5017
 	/**
@@ -4958,7 +5216,9 @@  discard block
 block discarded – undo
4958 5216
 		}
4959 5217
 		$query .= " GROUP BY spotter_output.airline_country
4960 5218
 					ORDER BY airline_country_count DESC";
4961
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5219
+		if ($limit) {
5220
+			$query .= " LIMIT 10 OFFSET 0";
5221
+		}
4962 5222
       
4963 5223
 		$sth = $this->db->prepare($query);
4964 5224
 		$sth->execute($query_values);
@@ -4986,7 +5246,9 @@  discard block
 block discarded – undo
4986 5246
 		global $globalDBdriver;
4987 5247
 		//$filter_query = $this->getFilter($filters,true,true);
4988 5248
 		$Connection= new Connection($this->db);
4989
-		if (!$Connection->tableExists('countries')) return array();
5249
+		if (!$Connection->tableExists('countries')) {
5250
+			return array();
5251
+		}
4990 5252
 		/*
4991 5253
 		$query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb 
4992 5254
 					FROM countries c, spotter_output s
@@ -5018,7 +5280,9 @@  discard block
 block discarded – undo
5018 5280
 		}
5019 5281
 		$query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb FROM countries c INNER JOIN (SELECT DISTINCT flightaware_id,over_country FROM spotter_live".$filter_query.") l ON c.iso2 = l.over_country ";
5020 5282
 		$query .= "GROUP BY c.name,c.iso3,c.iso2 ORDER BY nb DESC";
5021
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5283
+		if ($limit) {
5284
+			$query .= " LIMIT 10 OFFSET 0";
5285
+		}
5022 5286
       
5023 5287
 		
5024 5288
 		$sth = $this->db->prepare($query);
@@ -5095,7 +5359,9 @@  discard block
 block discarded – undo
5095 5359
 		}
5096 5360
 
5097 5361
 		$query .= " GROUP BY spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer ORDER BY aircraft_icao_count DESC";
5098
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5362
+		if ($limit) {
5363
+			$query .= " LIMIT 10 OFFSET 0";
5364
+		}
5099 5365
  
5100 5366
 		$sth = $this->db->prepare($query);
5101 5367
 		$sth->execute($query_values);
@@ -5169,7 +5435,9 @@  discard block
 block discarded – undo
5169 5435
 		}
5170 5436
 
5171 5437
 		$query .= " GROUP BY spotter_output.airline_icao, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer ORDER BY aircraft_icao_count DESC";
5172
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5438
+		if ($limit) {
5439
+			$query .= " LIMIT 10 OFFSET 0";
5440
+		}
5173 5441
  
5174 5442
 		$sth = $this->db->prepare($query);
5175 5443
 		$sth->execute($query_values);
@@ -5216,7 +5484,9 @@  discard block
 block discarded – undo
5216 5484
 		}
5217 5485
 
5218 5486
 		$query .= "GROUP BY EXTRACT(month from spotter_output.date), EXTRACT(year from spotter_output.date), spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer ORDER BY aircraft_icao_count DESC";
5219
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5487
+		if ($limit) {
5488
+			$query .= " LIMIT 10 OFFSET 0";
5489
+		}
5220 5490
  
5221 5491
 		$sth = $this->db->prepare($query);
5222 5492
 		$sth->execute();
@@ -5269,7 +5539,9 @@  discard block
 block discarded – undo
5269 5539
 			if($row['registration'] != "")
5270 5540
 			{
5271 5541
 				$image_array = $Image->getSpotterImage($row['registration']);
5272
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5542
+				if (isset($image_array[0]['image_thumbnail'])) {
5543
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5544
+				}
5273 5545
 			}
5274 5546
 			$temp_array['registration_count'] = $row['registration_count'];
5275 5547
 
@@ -5344,7 +5616,9 @@  discard block
 block discarded – undo
5344 5616
 			if($row['registration'] != "")
5345 5617
 			{
5346 5618
 				$image_array = $Image->getSpotterImage($row['registration']);
5347
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5619
+				if (isset($image_array[0]['image_thumbnail'])) {
5620
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5621
+				}
5348 5622
 			}
5349 5623
 			$temp_array['registration_count'] = $row['registration_count'];
5350 5624
 
@@ -5451,7 +5725,9 @@  discard block
 block discarded – undo
5451 5725
 			if($row['registration'] != "")
5452 5726
 			{
5453 5727
 				$image_array = $Image->getSpotterImage($row['registration']);
5454
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5728
+				if (isset($image_array[0]['image_thumbnail'])) {
5729
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5730
+				}
5455 5731
 			}
5456 5732
 			$temp_array['registration_count'] = $row['registration_count'];
5457 5733
 			$aircraft_array[] = $temp_array;
@@ -5576,7 +5852,9 @@  discard block
 block discarded – undo
5576 5852
 			date_default_timezone_set($globalTimezone);
5577 5853
 			$datetime = new DateTime($date);
5578 5854
 			$offset = $datetime->format('P');
5579
-		} else $offset = '+00:00';
5855
+		} else {
5856
+			$offset = '+00:00';
5857
+		}
5580 5858
 
5581 5859
 		if ($globalDBdriver == 'mysql') {
5582 5860
 			$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
@@ -5623,7 +5901,9 @@  discard block
 block discarded – undo
5623 5901
 			date_default_timezone_set($globalTimezone);
5624 5902
 			$datetime = new DateTime($date);
5625 5903
 			$offset = $datetime->format('P');
5626
-		} else $offset = '+00:00';
5904
+		} else {
5905
+			$offset = '+00:00';
5906
+		}
5627 5907
 
5628 5908
 		if ($globalDBdriver == 'mysql') {
5629 5909
 			$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name 
@@ -5652,7 +5932,9 @@  discard block
 block discarded – undo
5652 5932
 			if($row['registration'] != "")
5653 5933
 			{
5654 5934
 				$image_array = $Image->getSpotterImage($row['registration']);
5655
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5935
+				if (isset($image_array[0]['image_thumbnail'])) {
5936
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5937
+				}
5656 5938
 			}
5657 5939
 			$temp_array['registration_count'] = $row['registration_count'];
5658 5940
  
@@ -5677,7 +5959,9 @@  discard block
 block discarded – undo
5677 5959
 			date_default_timezone_set($globalTimezone);
5678 5960
 			$datetime = new DateTime($date);
5679 5961
 			$offset = $datetime->format('P');
5680
-		} else $offset = '+00:00';
5962
+		} else {
5963
+			$offset = '+00:00';
5964
+		}
5681 5965
 
5682 5966
 		if ($globalDBdriver == 'mysql') {
5683 5967
 			$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
@@ -5871,8 +6155,11 @@  discard block
 block discarded – undo
5871 6155
 			if($row['registration'] != "")
5872 6156
 			{
5873 6157
 				$image_array = $Image->getSpotterImage($row['registration']);
5874
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5875
-				else $temp_array['image_thumbnail'] = '';
6158
+				if (isset($image_array[0]['image_thumbnail'])) {
6159
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
6160
+				} else {
6161
+					$temp_array['image_thumbnail'] = '';
6162
+				}
5876 6163
 			}
5877 6164
 			$temp_array['registration_count'] = $row['registration_count'];
5878 6165
 			$aircraft_array[] = $temp_array;
@@ -5945,8 +6232,11 @@  discard block
 block discarded – undo
5945 6232
 			if($row['registration'] != "")
5946 6233
 			{
5947 6234
 				$image_array = $Image->getSpotterImage($row['registration']);
5948
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5949
-				else $temp_array['image_thumbnail'] = '';
6235
+				if (isset($image_array[0]['image_thumbnail'])) {
6236
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
6237
+				} else {
6238
+					$temp_array['image_thumbnail'] = '';
6239
+				}
5950 6240
 			}
5951 6241
 			$temp_array['registration_count'] = $row['registration_count'];
5952 6242
 			$aircraft_array[] = $temp_array;
@@ -6019,8 +6309,11 @@  discard block
 block discarded – undo
6019 6309
 			if($row['registration'] != "")
6020 6310
 			{
6021 6311
 				$image_array = $Image->getSpotterImage($row['registration']);
6022
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
6023
-				else $temp_array['image_thumbnail'] = '';
6312
+				if (isset($image_array[0]['image_thumbnail'])) {
6313
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
6314
+				} else {
6315
+					$temp_array['image_thumbnail'] = '';
6316
+				}
6024 6317
 			}
6025 6318
 			$temp_array['registration_count'] = $row['registration_count'];
6026 6319
 			$aircraft_array[] = $temp_array;
@@ -6229,7 +6522,9 @@  discard block
 block discarded – undo
6229 6522
 			if($row['registration'] != "")
6230 6523
 			{
6231 6524
 				$image_array = $Image->getSpotterImage($row['registration']);
6232
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
6525
+				if (isset($image_array[0]['image_thumbnail'])) {
6526
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
6527
+				}
6233 6528
 			}
6234 6529
 			$temp_array['registration_count'] = $row['registration_count'];
6235 6530
           
@@ -6346,7 +6641,9 @@  discard block
 block discarded – undo
6346 6641
 			if($row['registration'] != "")
6347 6642
 			{
6348 6643
 				$image_array = $Image->getSpotterImage($row['registration']);
6349
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
6644
+				if (isset($image_array[0]['image_thumbnail'])) {
6645
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
6646
+				}
6350 6647
 			}
6351 6648
 			$temp_array['registration_count'] = $row['registration_count'];
6352 6649
           
@@ -6512,7 +6809,9 @@  discard block
 block discarded – undo
6512 6809
 			}
6513 6810
 		}
6514 6811
 		$query .= " GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC";
6515
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
6812
+		if ($limit) {
6813
+			$query .= " LIMIT 10 OFFSET 0";
6814
+		}
6516 6815
 		
6517 6816
 		$sth = $this->db->prepare($query);
6518 6817
 		$sth->execute($query_values);
@@ -6531,7 +6830,9 @@  discard block
 block discarded – undo
6531 6830
 			if($row['registration'] != "")
6532 6831
 			{
6533 6832
 				$image_array = $Image->getSpotterImage($row['registration']);
6534
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
6833
+				if (isset($image_array[0]['image_thumbnail'])) {
6834
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
6835
+				}
6535 6836
 			}
6536 6837
           
6537 6838
 			$aircraft_array[] = $temp_array;
@@ -6572,7 +6873,9 @@  discard block
 block discarded – undo
6572 6873
 		// if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6573 6874
 		//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6574 6875
                 $query .= "GROUP BY spotter_output.airline_icao, spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC";
6575
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
6876
+		if ($limit) {
6877
+			$query .= " LIMIT 10 OFFSET 0";
6878
+		}
6576 6879
 		
6577 6880
 		$sth = $this->db->prepare($query);
6578 6881
 		$sth->execute();
@@ -6592,7 +6895,9 @@  discard block
 block discarded – undo
6592 6895
 			if($row['registration'] != "")
6593 6896
 			{
6594 6897
 				$image_array = $Image->getSpotterImage($row['registration']);
6595
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
6898
+				if (isset($image_array[0]['image_thumbnail'])) {
6899
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
6900
+				}
6596 6901
 			}
6597 6902
           
6598 6903
 			$aircraft_array[] = $temp_array;
@@ -6658,7 +6963,9 @@  discard block
 block discarded – undo
6658 6963
 		}
6659 6964
                 $query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
6660 6965
 				ORDER BY airport_departure_icao_count DESC";
6661
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
6966
+		if ($limit) {
6967
+			$query .= " LIMIT 10 OFFSET 0";
6968
+		}
6662 6969
 
6663 6970
 		$sth = $this->db->prepare($query);
6664 6971
 		$sth->execute($query_values);
@@ -6709,7 +7016,9 @@  discard block
 block discarded – undo
6709 7016
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6710 7017
                 $query .= "GROUP BY spotter_output.airline_icao, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
6711 7018
 				ORDER BY airport_departure_icao_count DESC";
6712
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
7019
+		if ($limit) {
7020
+			$query .= " LIMIT 10 OFFSET 0";
7021
+		}
6713 7022
       
6714 7023
 		$sth = $this->db->prepare($query);
6715 7024
 		$sth->execute();
@@ -6787,7 +7096,9 @@  discard block
 block discarded – undo
6787 7096
 		}
6788 7097
                 $query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
6789 7098
 				ORDER BY airport_departure_icao_count DESC";
6790
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
7099
+		if ($limit) {
7100
+			$query .= " LIMIT 10 OFFSET 0";
7101
+		}
6791 7102
     		//echo $query;
6792 7103
 		$sth = $this->db->prepare($query);
6793 7104
 		$sth->execute($query_values);
@@ -6839,7 +7150,9 @@  discard block
 block discarded – undo
6839 7150
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6840 7151
                 $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
6841 7152
 				ORDER BY airport_departure_icao_count DESC";
6842
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
7153
+		if ($limit) {
7154
+			$query .= " LIMIT 10 OFFSET 0";
7155
+		}
6843 7156
       
6844 7157
 		$sth = $this->db->prepare($query);
6845 7158
 		$sth->execute();
@@ -7234,7 +7547,9 @@  discard block
 block discarded – undo
7234 7547
 			date_default_timezone_set($globalTimezone);
7235 7548
 			$datetime = new DateTime($date);
7236 7549
 			$offset = $datetime->format('P');
7237
-		} else $offset = '+00:00';
7550
+		} else {
7551
+			$offset = '+00:00';
7552
+		}
7238 7553
 
7239 7554
 		if ($globalDBdriver == 'mysql') {
7240 7555
 			$query  = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
@@ -7284,7 +7599,9 @@  discard block
 block discarded – undo
7284 7599
 			date_default_timezone_set($globalTimezone);
7285 7600
 			$datetime = new DateTime($date);
7286 7601
 			$offset = $datetime->format('P');
7287
-		} else $offset = '+00:00';
7602
+		} else {
7603
+			$offset = '+00:00';
7604
+		}
7288 7605
 
7289 7606
 		if ($globalDBdriver == 'mysql') {
7290 7607
 			$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
@@ -7633,7 +7950,9 @@  discard block
 block discarded – undo
7633 7950
 		}
7634 7951
                 $query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
7635 7952
 					ORDER BY airport_arrival_icao_count DESC";
7636
-		if ($limit) $query .= " LIMIT 10";
7953
+		if ($limit) {
7954
+			$query .= " LIMIT 10";
7955
+		}
7637 7956
       
7638 7957
 		
7639 7958
 		$sth = $this->db->prepare($query);
@@ -7653,7 +7972,9 @@  discard block
 block discarded – undo
7653 7972
 			if ($icaoaskey) {
7654 7973
 				$icao = $row['arrival_airport_icao'];
7655 7974
 				$airport_array[$icao] = $temp_array;
7656
-			} else $airport_array[] = $temp_array;
7975
+			} else {
7976
+				$airport_array[] = $temp_array;
7977
+			}
7657 7978
 		}
7658 7979
 
7659 7980
 		return $airport_array;
@@ -7690,7 +8011,9 @@  discard block
 block discarded – undo
7690 8011
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
7691 8012
                 $query .= "GROUP BY spotter_output.airline_icao,spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
7692 8013
 					ORDER BY airport_arrival_icao_count DESC";
7693
-		if ($limit) $query .= " LIMIT 10";
8014
+		if ($limit) {
8015
+			$query .= " LIMIT 10";
8016
+		}
7694 8017
       
7695 8018
 		
7696 8019
 		$sth = $this->db->prepare($query);
@@ -7711,7 +8034,9 @@  discard block
 block discarded – undo
7711 8034
 			if ($icaoaskey) {
7712 8035
 				$icao = $row['arrival_airport_icao'];
7713 8036
 				$airport_array[$icao] = $temp_array;
7714
-			} else $airport_array[] = $temp_array;
8037
+			} else {
8038
+				$airport_array[] = $temp_array;
8039
+			}
7715 8040
 		}
7716 8041
 
7717 8042
 		return $airport_array;
@@ -7774,7 +8099,9 @@  discard block
 block discarded – undo
7774 8099
 		}
7775 8100
                 $query .= " GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
7776 8101
 					ORDER BY airport_arrival_icao_count DESC";
7777
-		if ($limit) $query .= " LIMIT 10";
8102
+		if ($limit) {
8103
+			$query .= " LIMIT 10";
8104
+		}
7778 8105
       
7779 8106
 		
7780 8107
 		$sth = $this->db->prepare($query);
@@ -7793,7 +8120,9 @@  discard block
 block discarded – undo
7793 8120
 			if ($icaoaskey) {
7794 8121
 				$icao = $row['arrival_airport_icao'];
7795 8122
 				$airport_array[$icao] = $temp_array;
7796
-			} else $airport_array[] = $temp_array;
8123
+			} else {
8124
+				$airport_array[] = $temp_array;
8125
+			}
7797 8126
 		}
7798 8127
 
7799 8128
 		return $airport_array;
@@ -7830,7 +8159,9 @@  discard block
 block discarded – undo
7830 8159
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
7831 8160
                 $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
7832 8161
 					ORDER BY airport_arrival_icao_count DESC";
7833
-		if ($limit) $query .= " LIMIT 10";
8162
+		if ($limit) {
8163
+			$query .= " LIMIT 10";
8164
+		}
7834 8165
       
7835 8166
 		
7836 8167
 		$sth = $this->db->prepare($query);
@@ -7851,7 +8182,9 @@  discard block
 block discarded – undo
7851 8182
 			if ($icaoaskey) {
7852 8183
 				$icao = $row['arrival_airport_icao'];
7853 8184
 				$airport_array[$icao] = $temp_array;
7854
-			} else $airport_array[] = $temp_array;
8185
+			} else {
8186
+				$airport_array[] = $temp_array;
8187
+			}
7855 8188
 		}
7856 8189
 
7857 8190
 		return $airport_array;
@@ -8232,7 +8565,9 @@  discard block
 block discarded – undo
8232 8565
 			date_default_timezone_set($globalTimezone);
8233 8566
 			$datetime = new DateTime($date);
8234 8567
 			$offset = $datetime->format('P');
8235
-		} else $offset = '+00:00';
8568
+		} else {
8569
+			$offset = '+00:00';
8570
+		}
8236 8571
 
8237 8572
 		if ($globalDBdriver == 'mysql') {
8238 8573
 			$query  = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
@@ -8282,7 +8617,9 @@  discard block
 block discarded – undo
8282 8617
 			date_default_timezone_set($globalTimezone);
8283 8618
 			$datetime = new DateTime($date);
8284 8619
 			$offset = $datetime->format('P');
8285
-		} else $offset = '+00:00';
8620
+		} else {
8621
+			$offset = '+00:00';
8622
+		}
8286 8623
 
8287 8624
 		if ($globalDBdriver == 'mysql') {
8288 8625
 			$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
@@ -8673,7 +9010,9 @@  discard block
 block discarded – undo
8673 9010
 		}
8674 9011
 		$query .= " GROUP BY spotter_output.arrival_airport_country
8675 9012
 					ORDER BY airport_arrival_country_count DESC";
8676
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
9013
+		if ($limit) {
9014
+			$query .= " LIMIT 10 OFFSET 0";
9015
+		}
8677 9016
       
8678 9017
 		
8679 9018
 		$sth = $this->db->prepare($query);
@@ -8960,7 +9299,9 @@  discard block
 block discarded – undo
8960 9299
 			date_default_timezone_set($globalTimezone);
8961 9300
 			$datetime = new DateTime($date);
8962 9301
 			$offset = $datetime->format('P');
8963
-		} else $offset = '+00:00';
9302
+		} else {
9303
+			$offset = '+00:00';
9304
+		}
8964 9305
 		
8965 9306
 		if ($globalDBdriver == 'mysql') {
8966 9307
 			$query  = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
@@ -9216,12 +9557,18 @@  discard block
 block discarded – undo
9216 9557
 		$query  = "SELECT DISTINCT spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name, spotter_output.airline_icao  
9217 9558
                     FROM spotter_output".$filter_query." spotter_output.ident <> ''";
9218 9559
 		 if ($olderthanmonths > 0) {
9219
-			if ($globalDBdriver == 'mysql') $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)';
9220
-			else $query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
9560
+			if ($globalDBdriver == 'mysql') {
9561
+				$query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)';
9562
+			} else {
9563
+				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
9564
+			}
9221 9565
 		}
9222 9566
 		if ($sincedate != '') {
9223
-			if ($globalDBdriver == 'mysql') $query .= " AND spotter_output.date > '".$sincedate."'";
9224
-			else $query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
9567
+			if ($globalDBdriver == 'mysql') {
9568
+				$query .= " AND spotter_output.date > '".$sincedate."'";
9569
+			} else {
9570
+				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
9571
+			}
9225 9572
 		}
9226 9573
 		$query_values = array();
9227 9574
 		if ($year != '') {
@@ -9252,7 +9599,9 @@  discard block
 block discarded – undo
9252 9599
 			}
9253 9600
 		}
9254 9601
 		$query .= " GROUP BY spotter_output.ident, spotter_output.airline_name, spotter_output.airline_icao ORDER BY callsign_icao_count DESC";
9255
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
9602
+		if ($limit) {
9603
+			$query .= " LIMIT 10 OFFSET 0";
9604
+		}
9256 9605
       		
9257 9606
 		$sth = $this->db->prepare($query);
9258 9607
 		$sth->execute($query_values);
@@ -9286,15 +9635,23 @@  discard block
 block discarded – undo
9286 9635
 		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name  
9287 9636
                     FROM spotter_output".$filter_query." spotter_output.ident <> ''  AND spotter_output.airline_icao <> '' ";
9288 9637
 		 if ($olderthanmonths > 0) {
9289
-			if ($globalDBdriver == 'mysql') $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
9290
-			else $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
9638
+			if ($globalDBdriver == 'mysql') {
9639
+				$query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
9640
+			} else {
9641
+				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
9642
+			}
9291 9643
 		}
9292 9644
 		if ($sincedate != '') {
9293
-			if ($globalDBdriver == 'mysql') $query .= "AND spotter_output.date > '".$sincedate."' ";
9294
-			else $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP) ";
9645
+			if ($globalDBdriver == 'mysql') {
9646
+				$query .= "AND spotter_output.date > '".$sincedate."' ";
9647
+			} else {
9648
+				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP) ";
9649
+			}
9295 9650
 		}
9296 9651
 		$query .= "GROUP BY spotter_output.airline_icao, spotter_output.ident, spotter_output.airline_name, spotter_output.airline_icao ORDER BY callsign_icao_count DESC";
9297
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
9652
+		if ($limit) {
9653
+			$query .= " LIMIT 10 OFFSET 0";
9654
+		}
9298 9655
       		
9299 9656
 		$sth = $this->db->prepare($query);
9300 9657
 		$sth->execute();
@@ -9331,7 +9688,9 @@  discard block
 block discarded – undo
9331 9688
 			date_default_timezone_set($globalTimezone);
9332 9689
 			$datetime = new DateTime();
9333 9690
 			$offset = $datetime->format('P');
9334
-		} else $offset = '+00:00';
9691
+		} else {
9692
+			$offset = '+00:00';
9693
+		}
9335 9694
 
9336 9695
 		if ($globalDBdriver == 'mysql') {
9337 9696
 			$query  = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -9380,7 +9739,9 @@  discard block
 block discarded – undo
9380 9739
 			date_default_timezone_set($globalTimezone);
9381 9740
 			$datetime = new DateTime();
9382 9741
 			$offset = $datetime->format('P');
9383
-		} else $offset = '+00:00';
9742
+		} else {
9743
+			$offset = '+00:00';
9744
+		}
9384 9745
 		$filter_query = $this->getFilter($filters,true,true);
9385 9746
 		if ($globalDBdriver == 'mysql') {
9386 9747
 			$query  = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -9429,7 +9790,9 @@  discard block
 block discarded – undo
9429 9790
 			date_default_timezone_set($globalTimezone);
9430 9791
 			$datetime = new DateTime();
9431 9792
 			$offset = $datetime->format('P');
9432
-		} else $offset = '+00:00';
9793
+		} else {
9794
+			$offset = '+00:00';
9795
+		}
9433 9796
 		$filter_query = $this->getFilter($filters,true,true);
9434 9797
 		if ($globalDBdriver == 'mysql') {
9435 9798
 			$query  = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -9475,7 +9838,9 @@  discard block
 block discarded – undo
9475 9838
 			date_default_timezone_set($globalTimezone);
9476 9839
 			$datetime = new DateTime();
9477 9840
 			$offset = $datetime->format('P');
9478
-		} else $offset = '+00:00';
9841
+		} else {
9842
+			$offset = '+00:00';
9843
+		}
9479 9844
 		$filter_query = $this->getFilter($filters,true,true);
9480 9845
 		if ($globalDBdriver == 'mysql') {
9481 9846
 			$query  = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -9523,7 +9888,9 @@  discard block
 block discarded – undo
9523 9888
 			date_default_timezone_set($globalTimezone);
9524 9889
 			$datetime = new DateTime();
9525 9890
 			$offset = $datetime->format('P');
9526
-		} else $offset = '+00:00';
9891
+		} else {
9892
+			$offset = '+00:00';
9893
+		}
9527 9894
 		
9528 9895
 		if ($globalDBdriver == 'mysql') {
9529 9896
 			$query  = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -9571,7 +9938,9 @@  discard block
 block discarded – undo
9571 9938
 			date_default_timezone_set($globalTimezone);
9572 9939
 			$datetime = new DateTime();
9573 9940
 			$offset = $datetime->format('P');
9574
-		} else $offset = '+00:00';
9941
+		} else {
9942
+			$offset = '+00:00';
9943
+		}
9575 9944
 
9576 9945
 		if ($globalDBdriver == 'mysql') {
9577 9946
 			$query  = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(*) as date_count
@@ -9618,7 +9987,9 @@  discard block
 block discarded – undo
9618 9987
 			date_default_timezone_set($globalTimezone);
9619 9988
 			$datetime = new DateTime();
9620 9989
 			$offset = $datetime->format('P');
9621
-		} else $offset = '+00:00';
9990
+		} else {
9991
+			$offset = '+00:00';
9992
+		}
9622 9993
 
9623 9994
 		if ($globalDBdriver == 'mysql') {
9624 9995
 			$query  = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(*) as date_count
@@ -9666,7 +10037,9 @@  discard block
 block discarded – undo
9666 10037
 			date_default_timezone_set($globalTimezone);
9667 10038
 			$datetime = new DateTime();
9668 10039
 			$offset = $datetime->format('P');
9669
-		} else $offset = '+00:00';
10040
+		} else {
10041
+			$offset = '+00:00';
10042
+		}
9670 10043
 		$filter_query = $this->getFilter($filters,true,true);
9671 10044
 		if ($globalDBdriver == 'mysql') {
9672 10045
 			$query  = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(*) as date_count
@@ -9711,7 +10084,9 @@  discard block
 block discarded – undo
9711 10084
 			date_default_timezone_set($globalTimezone);
9712 10085
 			$datetime = new DateTime();
9713 10086
 			$offset = $datetime->format('P');
9714
-		} else $offset = '+00:00';
10087
+		} else {
10088
+			$offset = '+00:00';
10089
+		}
9715 10090
 		$filter_query = $this->getFilter($filters,true,true);
9716 10091
 
9717 10092
 		if ($globalDBdriver == 'mysql') {
@@ -9758,7 +10133,9 @@  discard block
 block discarded – undo
9758 10133
 			date_default_timezone_set($globalTimezone);
9759 10134
 			$datetime = new DateTime();
9760 10135
 			$offset = $datetime->format('P');
9761
-		} else $offset = '+00:00';
10136
+		} else {
10137
+			$offset = '+00:00';
10138
+		}
9762 10139
 
9763 10140
 		if ($globalDBdriver == 'mysql') {
9764 10141
 			$query  = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct owner_name) as date_count
@@ -9804,7 +10181,9 @@  discard block
 block discarded – undo
9804 10181
 			date_default_timezone_set($globalTimezone);
9805 10182
 			$datetime = new DateTime();
9806 10183
 			$offset = $datetime->format('P');
9807
-		} else $offset = '+00:00';
10184
+		} else {
10185
+			$offset = '+00:00';
10186
+		}
9808 10187
 		$filter_query = $this->getFilter($filters,true,true);
9809 10188
 
9810 10189
 		if ($globalDBdriver == 'mysql') {
@@ -9851,7 +10230,9 @@  discard block
 block discarded – undo
9851 10230
 			date_default_timezone_set($globalTimezone);
9852 10231
 			$datetime = new DateTime();
9853 10232
 			$offset = $datetime->format('P');
9854
-		} else $offset = '+00:00';
10233
+		} else {
10234
+			$offset = '+00:00';
10235
+		}
9855 10236
 
9856 10237
 		if ($globalDBdriver == 'mysql') {
9857 10238
 			$query  = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct pilot_id) as date_count
@@ -9898,7 +10279,9 @@  discard block
 block discarded – undo
9898 10279
 			date_default_timezone_set($globalTimezone);
9899 10280
 			$datetime = new DateTime();
9900 10281
 			$offset = $datetime->format('P');
9901
-		} else $offset = '+00:00';
10282
+		} else {
10283
+			$offset = '+00:00';
10284
+		}
9902 10285
 
9903 10286
 		if ($globalDBdriver == 'mysql') {
9904 10287
 			$query  = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct airline_icao) as date_count
@@ -9943,7 +10326,9 @@  discard block
 block discarded – undo
9943 10326
 			date_default_timezone_set($globalTimezone);
9944 10327
 			$datetime = new DateTime();
9945 10328
 			$offset = $datetime->format('P');
9946
-		} else $offset = '+00:00';
10329
+		} else {
10330
+			$offset = '+00:00';
10331
+		}
9947 10332
 		$filter_query = $this->getFilter($filters,true,true);
9948 10333
 
9949 10334
 		if ($globalDBdriver == 'mysql') {
@@ -9991,7 +10376,9 @@  discard block
 block discarded – undo
9991 10376
 			date_default_timezone_set($globalTimezone);
9992 10377
 			$datetime = new DateTime();
9993 10378
 			$offset = $datetime->format('P');
9994
-		} else $offset = '+00:00';
10379
+		} else {
10380
+			$offset = '+00:00';
10381
+		}
9995 10382
 
9996 10383
 		if ($globalDBdriver == 'mysql') {
9997 10384
 			$query  = "SELECT spotter_output.airline_icao,YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct aircraft_icao) as date_count
@@ -10037,7 +10424,9 @@  discard block
 block discarded – undo
10037 10424
 			date_default_timezone_set($globalTimezone);
10038 10425
 			$datetime = new DateTime();
10039 10426
 			$offset = $datetime->format('P');
10040
-		} else $offset = '+00:00';
10427
+		} else {
10428
+			$offset = '+00:00';
10429
+		}
10041 10430
 		$filter_query = $this->getFilter($filters,true,true);
10042 10431
 
10043 10432
 		if ($globalDBdriver == 'mysql') {
@@ -10085,7 +10474,9 @@  discard block
 block discarded – undo
10085 10474
 			date_default_timezone_set($globalTimezone);
10086 10475
 			$datetime = new DateTime();
10087 10476
 			$offset = $datetime->format('P');
10088
-		} else $offset = '+00:00';
10477
+		} else {
10478
+			$offset = '+00:00';
10479
+		}
10089 10480
 
10090 10481
 		if ($globalDBdriver == 'mysql') {
10091 10482
 			$query  = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(real_arrival_airport_icao) as date_count
@@ -10132,7 +10523,9 @@  discard block
 block discarded – undo
10132 10523
 			date_default_timezone_set($globalTimezone);
10133 10524
 			$datetime = new DateTime();
10134 10525
 			$offset = $datetime->format('P');
10135
-		} else $offset = '+00:00';
10526
+		} else {
10527
+			$offset = '+00:00';
10528
+		}
10136 10529
 		$filter_query = $this->getFilter($filters,true,true);
10137 10530
 		if ($globalDBdriver == 'mysql') {
10138 10531
 			$query  = "SELECT MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name, count(*) as date_count
@@ -10181,7 +10574,9 @@  discard block
 block discarded – undo
10181 10574
 			date_default_timezone_set($globalTimezone);
10182 10575
 			$datetime = new DateTime();
10183 10576
 			$offset = $datetime->format('P');
10184
-		} else $offset = '+00:00';
10577
+		} else {
10578
+			$offset = '+00:00';
10579
+		}
10185 10580
 
10186 10581
 		$orderby_sql = '';
10187 10582
 		if ($orderby == "hour")
@@ -10247,7 +10642,9 @@  discard block
 block discarded – undo
10247 10642
 			date_default_timezone_set($globalTimezone);
10248 10643
 			$datetime = new DateTime();
10249 10644
 			$offset = $datetime->format('P');
10250
-		} else $offset = '+00:00';
10645
+		} else {
10646
+			$offset = '+00:00';
10647
+		}
10251 10648
 
10252 10649
 		$orderby_sql = '';
10253 10650
 		if ($orderby == "hour")
@@ -10314,7 +10711,9 @@  discard block
 block discarded – undo
10314 10711
 			date_default_timezone_set($globalTimezone);
10315 10712
 			$datetime = new DateTime();
10316 10713
 			$offset = $datetime->format('P');
10317
-		} else $offset = '+00:00';
10714
+		} else {
10715
+			$offset = '+00:00';
10716
+		}
10318 10717
 
10319 10718
 		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
10320 10719
 
@@ -10365,7 +10764,9 @@  discard block
 block discarded – undo
10365 10764
 			date_default_timezone_set($globalTimezone);
10366 10765
 			$datetime = new DateTime();
10367 10766
 			$offset = $datetime->format('P');
10368
-		} else $offset = '+00:00';
10767
+		} else {
10768
+			$offset = '+00:00';
10769
+		}
10369 10770
 
10370 10771
 		if ($globalDBdriver == 'mysql') {
10371 10772
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -10412,7 +10813,9 @@  discard block
 block discarded – undo
10412 10813
 			date_default_timezone_set($globalTimezone);
10413 10814
 			$datetime = new DateTime();
10414 10815
 			$offset = $datetime->format('P');
10415
-		} else $offset = '+00:00';
10816
+		} else {
10817
+			$offset = '+00:00';
10818
+		}
10416 10819
 
10417 10820
 		if ($globalDBdriver == 'mysql') {
10418 10821
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -10459,7 +10862,9 @@  discard block
 block discarded – undo
10459 10862
 			date_default_timezone_set($globalTimezone);
10460 10863
 			$datetime = new DateTime();
10461 10864
 			$offset = $datetime->format('P');
10462
-		} else $offset = '+00:00';
10865
+		} else {
10866
+			$offset = '+00:00';
10867
+		}
10463 10868
 
10464 10869
 		if ($globalDBdriver == 'mysql') {
10465 10870
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -10507,7 +10912,9 @@  discard block
 block discarded – undo
10507 10912
 			date_default_timezone_set($globalTimezone);
10508 10913
 			$datetime = new DateTime();
10509 10914
 			$offset = $datetime->format('P');
10510
-		} else $offset = '+00:00';
10915
+		} else {
10916
+			$offset = '+00:00';
10917
+		}
10511 10918
 
10512 10919
 		if ($globalDBdriver == 'mysql') {
10513 10920
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -10555,7 +10962,9 @@  discard block
 block discarded – undo
10555 10962
 			date_default_timezone_set($globalTimezone);
10556 10963
 			$datetime = new DateTime($date);
10557 10964
 			$offset = $datetime->format('P');
10558
-		} else $offset = '+00:00';
10965
+		} else {
10966
+			$offset = '+00:00';
10967
+		}
10559 10968
 
10560 10969
 		if ($globalDBdriver == 'mysql') {
10561 10970
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -10603,7 +11012,9 @@  discard block
 block discarded – undo
10603 11012
 			date_default_timezone_set($globalTimezone);
10604 11013
 			$datetime = new DateTime();
10605 11014
 			$offset = $datetime->format('P');
10606
-		} else $offset = '+00:00';
11015
+		} else {
11016
+			$offset = '+00:00';
11017
+		}
10607 11018
 
10608 11019
 		if ($globalDBdriver == 'mysql') {
10609 11020
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -10650,7 +11061,9 @@  discard block
 block discarded – undo
10650 11061
 			date_default_timezone_set($globalTimezone);
10651 11062
 			$datetime = new DateTime();
10652 11063
 			$offset = $datetime->format('P');
10653
-		} else $offset = '+00:00';
11064
+		} else {
11065
+			$offset = '+00:00';
11066
+		}
10654 11067
 
10655 11068
 		if ($globalDBdriver == 'mysql') {
10656 11069
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -10697,7 +11110,9 @@  discard block
 block discarded – undo
10697 11110
 			date_default_timezone_set($globalTimezone);
10698 11111
 			$datetime = new DateTime();
10699 11112
 			$offset = $datetime->format('P');
10700
-		} else $offset = '+00:00';
11113
+		} else {
11114
+			$offset = '+00:00';
11115
+		}
10701 11116
 
10702 11117
 		if ($globalDBdriver == 'mysql') {
10703 11118
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -10747,7 +11162,9 @@  discard block
 block discarded – undo
10747 11162
 			date_default_timezone_set($globalTimezone);
10748 11163
 			$datetime = new DateTime();
10749 11164
 			$offset = $datetime->format('P');
10750
-		} else $offset = '+00:00';
11165
+		} else {
11166
+			$offset = '+00:00';
11167
+		}
10751 11168
 
10752 11169
 		if ($globalDBdriver == 'mysql') {
10753 11170
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -10794,7 +11211,9 @@  discard block
 block discarded – undo
10794 11211
 			date_default_timezone_set($globalTimezone);
10795 11212
 			$datetime = new DateTime();
10796 11213
 			$offset = $datetime->format('P');
10797
-		} else $offset = '+00:00';
11214
+		} else {
11215
+			$offset = '+00:00';
11216
+		}
10798 11217
 
10799 11218
 		if ($globalDBdriver == 'mysql') {
10800 11219
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -11005,8 +11424,11 @@  discard block
 block discarded – undo
11005 11424
 				$query_values = array_merge($query_values,array(':month' => $month));
11006 11425
 			}
11007 11426
 		}
11008
-		if (empty($query_values)) $queryi .= $this->getFilter($filters);
11009
-		else $queryi .= $this->getFilter($filters,true,true).substr($query,4);
11427
+		if (empty($query_values)) {
11428
+			$queryi .= $this->getFilter($filters);
11429
+		} else {
11430
+			$queryi .= $this->getFilter($filters,true,true).substr($query,4);
11431
+		}
11010 11432
 		
11011 11433
 		$sth = $this->db->prepare($queryi);
11012 11434
 		$sth->execute($query_values);
@@ -11084,8 +11506,11 @@  discard block
 block discarded – undo
11084 11506
 				$query_values = array_merge($query_values,array(':month' => $month));
11085 11507
 			}
11086 11508
 		}
11087
-                if ($query == '') $queryi .= $this->getFilter($filters);
11088
-                else $queryi .= $this->getFilter($filters,true,true).substr($query,4);
11509
+                if ($query == '') {
11510
+                	$queryi .= $this->getFilter($filters);
11511
+                } else {
11512
+                	$queryi .= $this->getFilter($filters,true,true).substr($query,4);
11513
+                }
11089 11514
 
11090 11515
 
11091 11516
 		$sth = $this->db->prepare($queryi);
@@ -11108,7 +11533,9 @@  discard block
 block discarded – undo
11108 11533
 			date_default_timezone_set($globalTimezone);
11109 11534
 			$datetime = new DateTime();
11110 11535
 			$offset = $datetime->format('P');
11111
-		} else $offset = '+00:00';
11536
+		} else {
11537
+			$offset = '+00:00';
11538
+		}
11112 11539
 
11113 11540
 		if ($globalDBdriver == 'mysql') {
11114 11541
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -11294,7 +11721,9 @@  discard block
 block discarded – undo
11294 11721
 	*/
11295 11722
 	public function parseDirection($direction = 0)
11296 11723
 	{
11297
-		if ($direction == '') $direction = 0;
11724
+		if ($direction == '') {
11725
+			$direction = 0;
11726
+		}
11298 11727
 		$direction_array = array();
11299 11728
 		$temp_array = array();
11300 11729
 
@@ -11395,7 +11824,9 @@  discard block
 block discarded – undo
11395 11824
 		if (isset($result->AirlineFlightInfoResult))
11396 11825
 		{
11397 11826
 			$registration = $result->AirlineFlightInfoResult->tailnumber;
11398
-		} else return '';
11827
+		} else {
11828
+			return '';
11829
+		}
11399 11830
 		
11400 11831
 		$registration = $this->convertAircraftRegistration($registration);
11401 11832
 		
@@ -11424,7 +11855,9 @@  discard block
 block discarded – undo
11424 11855
 		if (count($row) > 0) {
11425 11856
 		    //return $row['Registration'];
11426 11857
 		    return $row['registration'];
11427
-		} else return '';
11858
+		} else {
11859
+			return '';
11860
+		}
11428 11861
 	
11429 11862
 	}
11430 11863
 
@@ -11447,9 +11880,14 @@  discard block
 block discarded – undo
11447 11880
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
11448 11881
 		$sth->closeCursor();
11449 11882
 		if (count($row) > 0) {
11450
-		    if ($row['type_flight'] == null) return '';
11451
-		    else return $row['type_flight'];
11452
-		} else return '';
11883
+		    if ($row['type_flight'] == null) {
11884
+		    	return '';
11885
+		    } else {
11886
+		    	return $row['type_flight'];
11887
+		    }
11888
+		} else {
11889
+			return '';
11890
+		}
11453 11891
 	
11454 11892
 	}
11455 11893
 
@@ -11467,7 +11905,9 @@  discard block
 block discarded – undo
11467 11905
 		$longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
11468 11906
 	
11469 11907
 		$Connection = new Connection($this->db);
11470
-		if (!$Connection->tableExists('countries')) return '';
11908
+		if (!$Connection->tableExists('countries')) {
11909
+			return '';
11910
+		}
11471 11911
 	
11472 11912
 		try {
11473 11913
 			/*
@@ -11487,9 +11927,13 @@  discard block
 block discarded – undo
11487 11927
 			$sth->closeCursor();
11488 11928
 			if (count($row) > 0) {
11489 11929
 				return $row;
11490
-			} else return '';
11930
+			} else {
11931
+				return '';
11932
+			}
11491 11933
 		} catch (PDOException $e) {
11492
-			if (isset($globalDebug) && $globalDebug) echo 'Error : '.$e->getMessage()."\n";
11934
+			if (isset($globalDebug) && $globalDebug) {
11935
+				echo 'Error : '.$e->getMessage()."\n";
11936
+			}
11493 11937
 			return '';
11494 11938
 		}
11495 11939
 	
@@ -11507,7 +11951,9 @@  discard block
 block discarded – undo
11507 11951
 		$iso2 = filter_var($iso2,FILTER_SANITIZE_STRING);
11508 11952
 	
11509 11953
 		$Connection = new Connection($this->db);
11510
-		if (!$Connection->tableExists('countries')) return '';
11954
+		if (!$Connection->tableExists('countries')) {
11955
+			return '';
11956
+		}
11511 11957
 	
11512 11958
 		try {
11513 11959
 			$query = "SELECT name,iso2,iso3 FROM countries WHERE iso2 = :iso2 LIMIT 1";
@@ -11519,9 +11965,13 @@  discard block
 block discarded – undo
11519 11965
 			$sth->closeCursor();
11520 11966
 			if (count($row) > 0) {
11521 11967
 				return $row;
11522
-			} else return '';
11968
+			} else {
11969
+				return '';
11970
+			}
11523 11971
 		} catch (PDOException $e) {
11524
-			if (isset($globalDebug) && $globalDebug) echo 'Error : '.$e->getMessage()."\n";
11972
+			if (isset($globalDebug) && $globalDebug) {
11973
+				echo 'Error : '.$e->getMessage()."\n";
11974
+			}
11525 11975
 			return '';
11526 11976
 		}
11527 11977
 	
@@ -11771,7 +12221,9 @@  discard block
 block discarded – undo
11771 12221
 	{
11772 12222
 		global $globalBitlyAccessToken;
11773 12223
 		
11774
-		if ($globalBitlyAccessToken == '') return $url;
12224
+		if ($globalBitlyAccessToken == '') {
12225
+			return $url;
12226
+		}
11775 12227
         
11776 12228
 		$google_url = 'https://api-ssl.bitly.com/v3/shorten?access_token='.$globalBitlyAccessToken.'&longUrl='.$url;
11777 12229
 		
@@ -11920,7 +12372,9 @@  discard block
 block discarded – undo
11920 12372
 		
11921 12373
 
11922 12374
 		// routes
11923
-		if ($globalDebug) print "Routes...\n";
12375
+		if ($globalDebug) {
12376
+			print "Routes...\n";
12377
+		}
11924 12378
 		if ($globalDBdriver == 'mysql') {
11925 12379
 			$query = "SELECT spotter_output.spotter_id, routes.FromAirport_ICAO, routes.ToAirport_ICAO FROM spotter_output, routes WHERE spotter_output.ident = routes.CallSign AND ( spotter_output.departure_airport_icao != routes.FromAirport_ICAO OR spotter_output.arrival_airport_icao != routes.ToAirport_ICAO) AND routes.FromAirport_ICAO != '' AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 DAY)";
11926 12380
 		} else {
@@ -11939,7 +12393,9 @@  discard block
 block discarded – undo
11939 12393
 			}
11940 12394
 		}
11941 12395
 		
11942
-		if ($globalDebug) print "Airlines...\n";
12396
+		if ($globalDebug) {
12397
+			print "Airlines...\n";
12398
+		}
11943 12399
 		//airlines
11944 12400
 		if ($globalDBdriver == 'mysql') {
11945 12401
 			$query  = "SELECT spotter_output.spotter_id, spotter_output.ident FROM spotter_output WHERE (spotter_output.airline_name = '' OR spotter_output.airline_name = 'Not Available') AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 DAY)";
@@ -11953,10 +12409,15 @@  discard block
 block discarded – undo
11953 12409
 			if (is_numeric(substr($row['ident'], -1, 1)))
11954 12410
 			{
11955 12411
 				$fromsource = NULL;
11956
-				if (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') $fromsource = 'vatsim';
11957
-				elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') $fromsource = 'ivao';
11958
-				elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim';
11959
-				elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao';
12412
+				if (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') {
12413
+					$fromsource = 'vatsim';
12414
+				} elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') {
12415
+					$fromsource = 'ivao';
12416
+				} elseif (isset($globalVATSIM) && $globalVATSIM) {
12417
+					$fromsource = 'vatsim';
12418
+				} elseif (isset($globalIVAO) && $globalIVAO) {
12419
+					$fromsource = 'ivao';
12420
+				}
11960 12421
 				$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3),$fromsource);
11961 12422
 				if (isset($airline_array[0]['name'])) {
11962 12423
 					$update_query  = "UPDATE spotter_output SET spotter_output.airline_name = :airline_name, spotter_output.airline_icao = :airline_icao, spotter_output.airline_country = :airline_country, spotter_output.airline_type = :airline_type WHERE spotter_output.spotter_id = :spotter_id";
@@ -11966,13 +12427,17 @@  discard block
 block discarded – undo
11966 12427
 			}
11967 12428
 		}
11968 12429
 
11969
-		if ($globalDebug) print "Remove Duplicate in aircraft_modes...\n";
12430
+		if ($globalDebug) {
12431
+			print "Remove Duplicate in aircraft_modes...\n";
12432
+		}
11970 12433
 		//duplicate modes
11971 12434
 		$query = "DELETE aircraft_modes FROM aircraft_modes LEFT OUTER JOIN (SELECT max(`AircraftID`) as `AircraftID`,`ModeS` FROM `aircraft_modes` group by ModeS) as KeepRows ON aircraft_modes.AircraftID = KeepRows.AircraftID WHERE KeepRows.AircraftID IS NULL";
11972 12435
 		$sth = $this->db->prepare($query);
11973 12436
 		$sth->execute();
11974 12437
 		
11975
-		if ($globalDebug) print "Aircraft...\n";
12438
+		if ($globalDebug) {
12439
+			print "Aircraft...\n";
12440
+		}
11976 12441
 		//aircraft
11977 12442
 		if ($globalDBdriver == 'mysql') {
11978 12443
 			$query  = "SELECT spotter_output.spotter_id, spotter_output.aircraft_icao, spotter_output.registration FROM spotter_output WHERE (spotter_output.aircraft_name = '' OR spotter_output.aircraft_name = 'Not Available') AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY)";
@@ -12015,26 +12480,38 @@  discard block
 block discarded – undo
12015 12480
 				 if (isset($closestAirports[0])) {
12016 12481
 					if ($row['arrival_airport_icao'] == $closestAirports[0]['icao']) {
12017 12482
 						$airport_icao = $closestAirports[0]['icao'];
12018
-						if ($globalDebug) echo "\o/ 1st ---++ Find arrival airport. airport_icao : ".$airport_icao."\n";
12483
+						if ($globalDebug) {
12484
+							echo "\o/ 1st ---++ Find arrival airport. airport_icao : ".$airport_icao."\n";
12485
+						}
12019 12486
 					} elseif (count($closestAirports > 1) && $row['arrival_airport_icao'] != '' && $row['arrival_airport_icao'] != 'NA') {
12020 12487
 						foreach ($closestAirports as $airport) {
12021 12488
 							if ($row['arrival_airport_icao'] == $airport['icao']) {
12022 12489
 								$airport_icao = $airport['icao'];
12023
-								if ($globalDebug) echo "\o/ try --++ Find arrival airport. airport_icao : ".$airport_icao."\n";
12490
+								if ($globalDebug) {
12491
+									echo "\o/ try --++ Find arrival airport. airport_icao : ".$airport_icao."\n";
12492
+								}
12024 12493
 								break;
12025 12494
 							}
12026 12495
 						}
12027 12496
 					} elseif ($row['last_altitude'] == 0 || ($row['last_altitude'] != '' && ($closestAirports[0]['altitude'] <= $row['last_altitude']*100+1000 && $row['last_altitude']*100 < $closestAirports[0]['altitude']+5000))) {
12028 12497
 						$airport_icao = $closestAirports[0]['icao'];
12029
-						if ($globalDebug) echo "\o/ NP --++ Find arrival airport. Airport ICAO : ".$airport_icao." !  Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist." - Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.($row['last_altitude']*100)."\n";
12498
+						if ($globalDebug) {
12499
+							echo "\o/ NP --++ Find arrival airport. Airport ICAO : ".$airport_icao." !  Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist." - Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.($row['last_altitude']*100)."\n";
12500
+						}
12030 12501
 					} else {
12031
-						if ($globalDebug) echo "----- Can't find arrival airport. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist." - Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.($row['last_altitude']*100)."\n";
12502
+						if ($globalDebug) {
12503
+							echo "----- Can't find arrival airport. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist." - Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.($row['last_altitude']*100)."\n";
12504
+						}
12032 12505
 					}
12033 12506
 				} else {
12034
-					if ($globalDebug) echo "----- No Airport near last coord. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist."\n";
12507
+					if ($globalDebug) {
12508
+						echo "----- No Airport near last coord. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist."\n";
12509
+					}
12035 12510
 				}
12036 12511
 				if ($row['real_arrival_airport_icao'] != $airport_icao) {
12037
-					if ($globalDebug) echo "Updating airport to ".$airport_icao."...\n";
12512
+					if ($globalDebug) {
12513
+						echo "Updating airport to ".$airport_icao."...\n";
12514
+					}
12038 12515
 					$update_query="UPDATE spotter_output SET real_arrival_airport_icao = :airport_icao WHERE spotter_id = :spotter_id";
12039 12516
 					$sthu = $this->db->prepare($update_query);
12040 12517
 					$sthu->execute(array(':airport_icao' => $airport_icao,':spotter_id' => $row['spotter_id']));
Please login to merge, or discard this patch.
require/class.Stats.php 1 patch
Braces   +476 added lines, -165 removed lines patch added patch discarded remove patch
@@ -12,7 +12,9 @@  discard block
 block discarded – undo
12 12
 	
13 13
 	public function __construct($dbc = null) {
14 14
 		global $globalFilterName;
15
-		if (isset($globalFilterName)) $this->filter_name = $globalFilterName;
15
+		if (isset($globalFilterName)) {
16
+			$this->filter_name = $globalFilterName;
17
+		}
16 18
 		$Connection = new Connection($dbc);
17 19
 		$this->db = $Connection->db();
18 20
         }
@@ -77,7 +79,9 @@  discard block
 block discarded – undo
77 79
                 }
78 80
         }
79 81
 	public function getAllAirlineNames($filter_name = '') {
80
-		if ($filter_name == '') $filter_name = $this->filter_name;
82
+		if ($filter_name == '') {
83
+			$filter_name = $this->filter_name;
84
+		}
81 85
                 $query = "SELECT * FROM stats_airline WHERE filter_name = :filter_name ORDER BY airline_name ASC";
82 86
                  try {
83 87
                         $sth = $this->db->prepare($query);
@@ -89,7 +93,9 @@  discard block
 block discarded – undo
89 93
                 return $all;
90 94
         }
91 95
 	public function getAllAircraftTypes($stats_airline = '',$filter_name = '') {
92
-		if ($filter_name == '') $filter_name = $this->filter_name;
96
+		if ($filter_name == '') {
97
+			$filter_name = $this->filter_name;
98
+		}
93 99
                 $query = "SELECT * FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_manufacturer ASC";
94 100
                  try {
95 101
                         $sth = $this->db->prepare($query);
@@ -101,7 +107,9 @@  discard block
 block discarded – undo
101 107
                 return $all;
102 108
         }
103 109
 	public function getAllManufacturers($stats_airline = '',$filter_name = '') {
104
-		if ($filter_name == '') $filter_name = $this->filter_name;
110
+		if ($filter_name == '') {
111
+			$filter_name = $this->filter_name;
112
+		}
105 113
                 $query = "SELECT DISTINCT(aircraft_manufacturer) FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name AND aircraft_manufacturer <> '' ORDER BY aircraft_manufacturer ASC";
106 114
                  try {
107 115
                         $sth = $this->db->prepare($query);
@@ -113,7 +121,9 @@  discard block
 block discarded – undo
113 121
                 return $all;
114 122
         }
115 123
 	public function getAllAirportNames($stats_airline = '',$filter_name = '') {
116
-		if ($filter_name == '') $filter_name = $this->filter_name;
124
+		if ($filter_name == '') {
125
+			$filter_name = $this->filter_name;
126
+		}
117 127
                 $query = "SELECT airport_icao, airport_name,airport_city,airport_country FROM stats_airport WHERE stats_airline = :stats_airline AND filter_name = :filter_name AND stats_type = 'daily' GROUP BY airport_icao,airport_name,airport_city,airport_country ORDER BY airport_city ASC";
118 128
                  try {
119 129
                         $sth = $this->db->prepare($query);
@@ -126,7 +136,9 @@  discard block
 block discarded – undo
126 136
         }
127 137
 
128 138
 	public function getAllOwnerNames($stats_airline = '',$filter_name = '') {
129
-		if ($filter_name == '') $filter_name = $this->filter_name;
139
+		if ($filter_name == '') {
140
+			$filter_name = $this->filter_name;
141
+		}
130 142
                 $query = "SELECT owner_name FROM stats_owner WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY owner_name ASC";
131 143
                  try {
132 144
                         $sth = $this->db->prepare($query);
@@ -139,7 +151,9 @@  discard block
 block discarded – undo
139 151
         }
140 152
 
141 153
 	public function getAllPilotNames($stats_airline = '',$filter_name = '') {
142
-		if ($filter_name == '') $filter_name = $this->filter_name;
154
+		if ($filter_name == '') {
155
+			$filter_name = $this->filter_name;
156
+		}
143 157
                 $query = "SELECT pilot_id,pilot_name FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_name ASC";
144 158
                  try {
145 159
                         $sth = $this->db->prepare($query);
@@ -154,10 +168,15 @@  discard block
 block discarded – undo
154 168
 
155 169
 	public function countAllAircraftTypes($limit = true, $stats_airline = '', $filter_name = '',$year = '', $month = '') {
156 170
 		global $globalStatsFilters;
157
-		if ($filter_name == '') $filter_name = $this->filter_name;
171
+		if ($filter_name == '') {
172
+			$filter_name = $this->filter_name;
173
+		}
158 174
 		if ($year == '' && $month == '') {
159
-			if ($limit) $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name, aircraft_manufacturer FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC LIMIT 10 OFFSET 0";
160
-			else $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name, aircraft_manufacturer FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC";
175
+			if ($limit) {
176
+				$query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name, aircraft_manufacturer FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC LIMIT 10 OFFSET 0";
177
+			} else {
178
+				$query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name, aircraft_manufacturer FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC";
179
+			}
161 180
 			try {
162 181
 				$sth = $this->db->prepare($query);
163 182
 				$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -165,7 +184,9 @@  discard block
 block discarded – undo
165 184
 				echo "error : ".$e->getMessage();
166 185
 			}
167 186
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
168
-		} else $all = array();
187
+		} else {
188
+			$all = array();
189
+		}
169 190
                 if (empty($all)) {
170 191
             	    $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month);
171 192
             	    if ($filter_name != '') {
@@ -179,10 +200,15 @@  discard block
 block discarded – undo
179 200
 	}
180 201
 	public function countAllAirlineCountries($limit = true,$filter_name = '',$year = '',$month = '') {
181 202
 		global $globalStatsFilters;
182
-		if ($filter_name == '') $filter_name = $this->filter_name;
203
+		if ($filter_name == '') {
204
+			$filter_name = $this->filter_name;
205
+		}
183 206
 		if ($year == '' && $month == '') {
184
-			if ($limit) $query = "SELECT airlines.country AS airline_country, SUM(stats_airline.cnt) as airline_country_count FROM stats_airline,airlines WHERE stats_airline.airline_icao=airlines.icao AND filter_name = :filter_name GROUP BY airline_country ORDER BY airline_country_count DESC LIMIT 10 OFFSET 0";
185
-			else $query = "SELECT airlines.country AS airline_country, SUM(stats_airline.cnt) as airline_country_count FROM stats_airline,airlines WHERE stats_airline.airline_icao=airlines.icao AND filter_name = :filter_name GROUP BY airline_country ORDER BY airline_country_count DESC";
207
+			if ($limit) {
208
+				$query = "SELECT airlines.country AS airline_country, SUM(stats_airline.cnt) as airline_country_count FROM stats_airline,airlines WHERE stats_airline.airline_icao=airlines.icao AND filter_name = :filter_name GROUP BY airline_country ORDER BY airline_country_count DESC LIMIT 10 OFFSET 0";
209
+			} else {
210
+				$query = "SELECT airlines.country AS airline_country, SUM(stats_airline.cnt) as airline_country_count FROM stats_airline,airlines WHERE stats_airline.airline_icao=airlines.icao AND filter_name = :filter_name GROUP BY airline_country ORDER BY airline_country_count DESC";
211
+			}
186 212
 			try {
187 213
 				$sth = $this->db->prepare($query);
188 214
 				$sth->execute(array(':filter_name' => $filter_name));
@@ -190,7 +216,9 @@  discard block
 block discarded – undo
190 216
 				echo "error : ".$e->getMessage();
191 217
 			}
192 218
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
193
-		} else $all = array();
219
+		} else {
220
+			$all = array();
221
+		}
194 222
                 if (empty($all)) {
195 223
             		$Spotter = new Spotter($this->db);
196 224
             		$filters = array();
@@ -205,10 +233,15 @@  discard block
 block discarded – undo
205 233
 	}
206 234
 	public function countAllAircraftManufacturers($limit = true,$stats_airline = '', $filter_name = '',$year = '', $month = '') {
207 235
 		global $globalStatsFilters;
208
-		if ($filter_name == '') $filter_name = $this->filter_name;
236
+		if ($filter_name == '') {
237
+			$filter_name = $this->filter_name;
238
+		}
209 239
 		if ($year == '' && $month == '') {
210
-			if ($limit) $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC LIMIT 10 OFFSET 0";
211
-			else $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC";
240
+			if ($limit) {
241
+				$query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC LIMIT 10 OFFSET 0";
242
+			} else {
243
+				$query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC";
244
+			}
212 245
 			try {
213 246
 				$sth = $this->db->prepare($query);
214 247
 				$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -216,7 +249,9 @@  discard block
 block discarded – undo
216 249
 				echo "error : ".$e->getMessage();
217 250
 			}
218 251
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
219
-		} else $all = array();
252
+		} else {
253
+			$all = array();
254
+		}
220 255
 		if (empty($all)) {
221 256
 			$filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month);
222 257
 			if ($filter_name != '') {
@@ -231,10 +266,15 @@  discard block
 block discarded – undo
231 266
 
232 267
 	public function countAllArrivalCountries($limit = true, $stats_airline = '', $filter_name = '',$year = '', $month = '') {
233 268
 		global $globalStatsFilters;
234
-		if ($filter_name == '') $filter_name = $this->filter_name;
269
+		if ($filter_name == '') {
270
+			$filter_name = $this->filter_name;
271
+		}
235 272
 		if ($year == '' && $month == '') {
236
-			if ($limit) $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_arrival_country ORDER BY airport_arrival_country_count DESC LIMIT 10 OFFSET 0";
237
-			else $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_arrival_country ORDER BY airport_arrival_country_count DESC";
273
+			if ($limit) {
274
+				$query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_arrival_country ORDER BY airport_arrival_country_count DESC LIMIT 10 OFFSET 0";
275
+			} else {
276
+				$query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_arrival_country ORDER BY airport_arrival_country_count DESC";
277
+			}
238 278
 			try {
239 279
 				$sth = $this->db->prepare($query);
240 280
 				$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -242,7 +282,9 @@  discard block
 block discarded – undo
242 282
 				echo "error : ".$e->getMessage();
243 283
 			}
244 284
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
245
-		} else $all = array();
285
+		} else {
286
+			$all = array();
287
+		}
246 288
                 if (empty($all)) {
247 289
 			$filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month);
248 290
 			if ($filter_name != '') {
@@ -256,9 +298,14 @@  discard block
 block discarded – undo
256 298
 	}
257 299
 	public function countAllDepartureCountries($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') {
258 300
 		global $globalStatsFilters;
259
-		if ($filter_name == '') $filter_name = $this->filter_name;
260
-		if ($limit) $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_departure_country ORDER BY airport_departure_country_count DESC LIMIT 10 OFFSET 0";
261
-		else $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_departure_country ORDER BY airport_departure_country_count DESC";
301
+		if ($filter_name == '') {
302
+			$filter_name = $this->filter_name;
303
+		}
304
+		if ($limit) {
305
+			$query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_departure_country ORDER BY airport_departure_country_count DESC LIMIT 10 OFFSET 0";
306
+		} else {
307
+			$query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_departure_country ORDER BY airport_departure_country_count DESC";
308
+		}
262 309
                  try {
263 310
                         $sth = $this->db->prepare($query);
264 311
                         $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -280,17 +327,29 @@  discard block
 block discarded – undo
280 327
 
281 328
 	public function countAllAirlines($limit = true,$filter_name = '',$year = '',$month = '') {
282 329
 		global $globalStatsFilters, $globalVATSIM, $globalIVAO;
283
-		if ($filter_name == '') $filter_name = $this->filter_name;
330
+		if ($filter_name == '') {
331
+			$filter_name = $this->filter_name;
332
+		}
284 333
 		if ($year == '' && $month == '') {
285
-			if ($globalVATSIM) $forsource = 'vatsim';
286
-			if ($globalIVAO) $forsource = 'ivao';
334
+			if ($globalVATSIM) {
335
+				$forsource = 'vatsim';
336
+			}
337
+			if ($globalIVAO) {
338
+				$forsource = 'ivao';
339
+			}
287 340
 			if (isset($forsource)) {
288
-				if ($limit) $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name AND airlines.forsource = :forsource ORDER BY airline_count DESC LIMIT 10 OFFSET 0";
289
-				else $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name AND airlines.forsource = :forsource ORDER BY airline_count DESC";
341
+				if ($limit) {
342
+					$query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name AND airlines.forsource = :forsource ORDER BY airline_count DESC LIMIT 10 OFFSET 0";
343
+				} else {
344
+					$query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name AND airlines.forsource = :forsource ORDER BY airline_count DESC";
345
+				}
290 346
 				$query_values = array(':filter_name' => $filter_name,':forsource' => $forsource);
291 347
 			} else {
292
-				if ($limit) $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name AND airlines.forsource IS NULL ORDER BY airline_count DESC LIMIT 10 OFFSET 0";
293
-				else $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name AND airlines.forsource IS NULL ORDER BY airline_count DESC";
348
+				if ($limit) {
349
+					$query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name AND airlines.forsource IS NULL ORDER BY airline_count DESC LIMIT 10 OFFSET 0";
350
+				} else {
351
+					$query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name AND airlines.forsource IS NULL ORDER BY airline_count DESC";
352
+				}
294 353
 				$query_values = array(':filter_name' => $filter_name);
295 354
 			}
296 355
 			try {
@@ -300,7 +359,9 @@  discard block
 block discarded – undo
300 359
 				echo "error : ".$e->getMessage();
301 360
 			}
302 361
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
303
-		} else $all = array();
362
+		} else {
363
+			$all = array();
364
+		}
304 365
                 if (empty($all)) {
305 366
 	                $Spotter = new Spotter($this->db);
306 367
             		$filters = array();
@@ -315,10 +376,15 @@  discard block
 block discarded – undo
315 376
 	}
316 377
 	public function countAllAircraftRegistrations($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') {
317 378
 		global $globalStatsFilters;
318
-		if ($filter_name == '') $filter_name = $this->filter_name;
379
+		if ($filter_name == '') {
380
+			$filter_name = $this->filter_name;
381
+		}
319 382
 		if ($year == '' && $month == '') {
320
-			if ($limit) $query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name, s.registration FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC LIMIT 10 OFFSET 0";
321
-			else $query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC";
383
+			if ($limit) {
384
+				$query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name, s.registration FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC LIMIT 10 OFFSET 0";
385
+			} else {
386
+				$query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC";
387
+			}
322 388
 			try {
323 389
 				$sth = $this->db->prepare($query);
324 390
 				$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -326,7 +392,9 @@  discard block
 block discarded – undo
326 392
 				echo "error : ".$e->getMessage();
327 393
 			}
328 394
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
329
-		} else $all = array();
395
+		} else {
396
+			$all = array();
397
+		}
330 398
                 if (empty($all)) {
331 399
 			$filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month);
332 400
 			if ($filter_name != '') {
@@ -340,10 +408,15 @@  discard block
 block discarded – undo
340 408
 	}
341 409
 	public function countAllCallsigns($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') {
342 410
 		global $globalStatsFilters;
343
-		if ($filter_name == '') $filter_name = $this->filter_name;
411
+		if ($filter_name == '') {
412
+			$filter_name = $this->filter_name;
413
+		}
344 414
 		if ($year == '' && $month == '') {
345
-			if ($limit) $query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao = :stats_airline AND filter_name = :filter_name ORDER BY callsign_icao_count DESC LIMIT 10 OFFSET 0";
346
-			else $query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao = :stats_airline AND filter_name = :filter_name ORDER BY callsign_icao_count DESC";
415
+			if ($limit) {
416
+				$query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao = :stats_airline AND filter_name = :filter_name ORDER BY callsign_icao_count DESC LIMIT 10 OFFSET 0";
417
+			} else {
418
+				$query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao = :stats_airline AND filter_name = :filter_name ORDER BY callsign_icao_count DESC";
419
+			}
347 420
 			 try {
348 421
 				$sth = $this->db->prepare($query);
349 422
 				$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -351,7 +424,9 @@  discard block
 block discarded – undo
351 424
 				echo "error : ".$e->getMessage();
352 425
 			}
353 426
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
354
-		} else $all = array();
427
+		} else {
428
+			$all = array();
429
+		}
355 430
 		if (empty($all)) {
356 431
 			$filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month);
357 432
 			if ($filter_name != '') {
@@ -365,11 +440,16 @@  discard block
 block discarded – undo
365 440
 	}
366 441
 	public function countAllFlightOverCountries($limit = true, $stats_airline = '',$filter_name = '',$year = '',$month = '') {
367 442
 		$Connection = new Connection();
368
-		if ($filter_name == '') $filter_name = $this->filter_name;
443
+		if ($filter_name == '') {
444
+			$filter_name = $this->filter_name;
445
+		}
369 446
 		if ($Connection->tableExists('countries')) {
370 447
 			if ($year == '' && $month == '') {
371
-				if ($limit) $query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 AND stats_country.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY flight_count DESC LIMIT 20 OFFSET 0";
372
-				else $query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 AND stats_country.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY flight_count DESC";
448
+				if ($limit) {
449
+					$query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 AND stats_country.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY flight_count DESC LIMIT 20 OFFSET 0";
450
+				} else {
451
+					$query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 AND stats_country.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY flight_count DESC";
452
+				}
373 453
 				 try {
374 454
 					$sth = $this->db->prepare($query);
375 455
 					$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -384,17 +464,24 @@  discard block
 block discarded – undo
384 464
                 }
385 465
                 */
386 466
 				return $all;
387
-			} else return array();
467
+			} else {
468
+				return array();
469
+			}
388 470
 		} else {
389 471
 			return array();
390 472
 		}
391 473
 	}
392 474
 	public function countAllPilots($limit = true,$stats_airline = '',$filter_name = '', $year = '',$month = '') {
393 475
 		global $globalStatsFilters;
394
-		if ($filter_name == '') $filter_name = $this->filter_name;
476
+		if ($filter_name == '') {
477
+			$filter_name = $this->filter_name;
478
+		}
395 479
 		if ($year == '' && $month == '') {
396
-			if ($limit) $query = "SELECT pilot_id, cnt AS pilot_count, pilot_name, format_source FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_count DESC LIMIT 10 OFFSET 0";
397
-			else $query = "SELECT pilot_id, cnt AS pilot_count, pilot_name, format_source FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_count DESC";
480
+			if ($limit) {
481
+				$query = "SELECT pilot_id, cnt AS pilot_count, pilot_name, format_source FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_count DESC LIMIT 10 OFFSET 0";
482
+			} else {
483
+				$query = "SELECT pilot_id, cnt AS pilot_count, pilot_name, format_source FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_count DESC";
484
+			}
398 485
 			try {
399 486
 				$sth = $this->db->prepare($query);
400 487
 				$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -402,7 +489,9 @@  discard block
 block discarded – undo
402 489
 				echo "error : ".$e->getMessage();
403 490
 			}
404 491
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
405
-		} else $all = array();
492
+		} else {
493
+			$all = array();
494
+		}
406 495
 		if (empty($all)) {
407 496
 			$filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month);
408 497
 			if ($filter_name != '') {
@@ -417,10 +506,15 @@  discard block
 block discarded – undo
417 506
 
418 507
 	public function countAllOwners($limit = true,$stats_airline = '', $filter_name = '',$year = '',$month = '') {
419 508
 		global $globalStatsFilters;
420
-		if ($filter_name == '') $filter_name = $this->filter_name;
509
+		if ($filter_name == '') {
510
+			$filter_name = $this->filter_name;
511
+		}
421 512
 		if ($year == '' && $month == '') {
422
-			if ($limit) $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY owner_count DESC LIMIT 10 OFFSET 0";
423
-			else $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY owner_count DESC";
513
+			if ($limit) {
514
+				$query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY owner_count DESC LIMIT 10 OFFSET 0";
515
+			} else {
516
+				$query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY owner_count DESC";
517
+			}
424 518
 			try {
425 519
 				$sth = $this->db->prepare($query);
426 520
 				$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -428,7 +522,9 @@  discard block
 block discarded – undo
428 522
 				echo "error : ".$e->getMessage();
429 523
 			}
430 524
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
431
-		} else $all = array();
525
+		} else {
526
+			$all = array();
527
+		}
432 528
                 if (empty($all)) {
433 529
 			$filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month);
434 530
 			if ($filter_name != '') {
@@ -442,10 +538,15 @@  discard block
 block discarded – undo
442 538
 	}
443 539
 	public function countAllDepartureAirports($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') {
444 540
 		global $globalStatsFilters;
445
-		if ($filter_name == '') $filter_name = $this->filter_name;
541
+		if ($filter_name == '') {
542
+			$filter_name = $this->filter_name;
543
+		}
446 544
 		if ($year == '' && $month == '') {
447
-			if ($limit) $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count FROM stats_airport WHERE departure > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC LIMIT 10 OFFSET 0";
448
-			else $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count FROM stats_airport WHERE departure > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC";
545
+			if ($limit) {
546
+				$query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count FROM stats_airport WHERE departure > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC LIMIT 10 OFFSET 0";
547
+			} else {
548
+				$query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count FROM stats_airport WHERE departure > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC";
549
+			}
449 550
 			try {
450 551
 				$sth = $this->db->prepare($query);
451 552
 				$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -453,7 +554,9 @@  discard block
 block discarded – undo
453 554
 				echo "error : ".$e->getMessage();
454 555
 			}
455 556
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
456
-		} else $all = array();
557
+		} else {
558
+			$all = array();
559
+		}
457 560
                 if (empty($all)) {
458 561
 			$filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month);
459 562
             		if ($filter_name != '') {
@@ -474,7 +577,9 @@  discard block
 block discarded – undo
474 577
         			$icao = $value['airport_departure_icao'];
475 578
         			if (isset($all[$icao])) {
476 579
         				$all[$icao]['airport_departure_icao_count'] = $all[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count'];
477
-        			} else $all[$icao] = $value;
580
+        			} else {
581
+        				$all[$icao] = $value;
582
+        			}
478 583
         		}
479 584
         		$count = array();
480 585
         		foreach ($all as $key => $row) {
@@ -486,10 +591,15 @@  discard block
 block discarded – undo
486 591
 	}
487 592
 	public function countAllArrivalAirports($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') {
488 593
 		global $globalStatsFilters;
489
-		if ($filter_name == '') $filter_name = $this->filter_name;
594
+		if ($filter_name == '') {
595
+			$filter_name = $this->filter_name;
596
+		}
490 597
 		if ($year == '' && $month == '') {
491
-			if ($limit) $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count FROM stats_airport WHERE arrival > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC LIMIT 10 OFFSET 0";
492
-			else $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count FROM stats_airport WHERE arrival > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC";
598
+			if ($limit) {
599
+				$query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count FROM stats_airport WHERE arrival > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC LIMIT 10 OFFSET 0";
600
+			} else {
601
+				$query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count FROM stats_airport WHERE arrival > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC";
602
+			}
493 603
 			try {
494 604
 				$sth = $this->db->prepare($query);
495 605
 				$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -497,7 +607,9 @@  discard block
 block discarded – undo
497 607
 				echo "error : ".$e->getMessage();
498 608
 			}
499 609
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
500
-		} else $all = array();
610
+		} else {
611
+			$all = array();
612
+		}
501 613
 		if (empty($all)) {
502 614
 			$filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month);
503 615
 			if ($filter_name != '') {
@@ -518,7 +630,9 @@  discard block
 block discarded – undo
518 630
         			$icao = $value['airport_arrival_icao'];
519 631
         			if (isset($all[$icao])) {
520 632
         				$all[$icao]['airport_arrival_icao_count'] = $all[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count'];
521
-        			} else $all[$icao] = $value;
633
+        			} else {
634
+        				$all[$icao] = $value;
635
+        			}
522 636
         		}
523 637
         		$count = array();
524 638
         		foreach ($all as $key => $row) {
@@ -531,13 +645,21 @@  discard block
 block discarded – undo
531 645
 	}
532 646
 	public function countAllMonthsLastYear($limit = true,$stats_airline = '',$filter_name = '') {
533 647
 		global $globalDBdriver, $globalStatsFilters;
534
-		if ($filter_name == '') $filter_name = $this->filter_name;
648
+		if ($filter_name == '') {
649
+			$filter_name = $this->filter_name;
650
+		}
535 651
 		if ($globalDBdriver == 'mysql') {
536
-			if ($limit) $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 12 MONTH) AND stats_airline = :stats_airline AND filter_name = :filter_name";
537
-			else $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline = :stats_airline AND filter_name = :filter_name";
652
+			if ($limit) {
653
+				$query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 12 MONTH) AND stats_airline = :stats_airline AND filter_name = :filter_name";
654
+			} else {
655
+				$query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline = :stats_airline AND filter_name = :filter_name";
656
+			}
538 657
 		} else {
539
-			if ($limit) $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '12 MONTHS' AND stats_airline = :stats_airline AND filter_name = :filter_name";
540
-			else $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline = :stats_airline AND filter_name = :filter_name";
658
+			if ($limit) {
659
+				$query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '12 MONTHS' AND stats_airline = :stats_airline AND filter_name = :filter_name";
660
+			} else {
661
+				$query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline = :stats_airline AND filter_name = :filter_name";
662
+			}
541 663
 		}
542 664
 		$query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name);
543 665
                  try {
@@ -561,7 +683,9 @@  discard block
 block discarded – undo
561 683
 	
562 684
 	public function countAllDatesLastMonth($stats_airline = '',$filter_name = '') {
563 685
 		global $globalStatsFilters;
564
-		if ($filter_name == '') $filter_name = $this->filter_name;
686
+		if ($filter_name == '') {
687
+			$filter_name = $this->filter_name;
688
+		}
565 689
 		$query = "SELECT flight_date as date_name, cnt as date_count FROM stats_flight WHERE stats_type = 'month' AND stats_airline = :stats_airline AND filter_name = :filter_name";
566 690
 		$query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name);
567 691
                  try {
@@ -583,7 +707,9 @@  discard block
 block discarded – undo
583 707
 	}
584 708
 	public function countAllDatesLast7Days($stats_airline = '',$filter_name = '') {
585 709
 		global $globalDBdriver, $globalStatsFilters;
586
-		if ($filter_name == '') $filter_name = $this->filter_name;
710
+		if ($filter_name == '') {
711
+			$filter_name = $this->filter_name;
712
+		}
587 713
 		if ($globalDBdriver == 'mysql') {
588 714
 			$query = "SELECT flight_date as date_name, cnt as date_count FROM stats_flight WHERE stats_type = 'month' AND flight_date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY) AND stats_airline = :stats_airline AND filter_name = :filter_name";
589 715
 		} else {
@@ -609,7 +735,9 @@  discard block
 block discarded – undo
609 735
 	}
610 736
 	public function countAllDates($stats_airline = '',$filter_name = '') {
611 737
 		global $globalStatsFilters;
612
-		if ($filter_name == '') $filter_name = $this->filter_name;
738
+		if ($filter_name == '') {
739
+			$filter_name = $this->filter_name;
740
+		}
613 741
 		$query = "SELECT flight_date as date_name, cnt as date_count FROM stats_flight WHERE stats_type = 'date' AND stats_airline = :stats_airline AND filter_name = :filter_name";
614 742
 		$query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name);
615 743
                  try {
@@ -631,7 +759,9 @@  discard block
 block discarded – undo
631 759
 	}
632 760
 	public function countAllDatesByAirlines($filter_name = '') {
633 761
 		global $globalStatsFilters;
634
-		if ($filter_name == '') $filter_name = $this->filter_name;
762
+		if ($filter_name == '') {
763
+			$filter_name = $this->filter_name;
764
+		}
635 765
 		$query = "SELECT stats_airline as airline_icao, flight_date as date_name, cnt as date_count FROM stats_flight WHERE stats_type = 'date' AND filter_name = :filter_name";
636 766
 		$query_data = array('filter_name' => $filter_name);
637 767
                  try {
@@ -653,7 +783,9 @@  discard block
 block discarded – undo
653 783
 	}
654 784
 	public function countAllMonths($stats_airline = '',$filter_name = '') {
655 785
 		global $globalStatsFilters;
656
-		if ($filter_name == '') $filter_name = $this->filter_name;
786
+		if ($filter_name == '') {
787
+			$filter_name = $this->filter_name;
788
+		}
657 789
 	    	$query = "SELECT YEAR(stats_date) AS year_name,MONTH(stats_date) AS month_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline = :stats_airline AND filter_name = :filter_name";
658 790
                  try {
659 791
                         $sth = $this->db->prepare($query);
@@ -676,7 +808,9 @@  discard block
 block discarded – undo
676 808
 	}
677 809
 	public function countAllMilitaryMonths($filter_name = '') {
678 810
 		global $globalStatsFilters;
679
-		if ($filter_name == '') $filter_name = $this->filter_name;
811
+		if ($filter_name == '') {
812
+			$filter_name = $this->filter_name;
813
+		}
680 814
 	    	$query = "SELECT YEAR(stats_date) AS year_name,MONTH(stats_date) AS month_name, cnt as date_count FROM stats WHERE stats_type = 'military_flights_bymonth' AND filter_name = :filter_name";
681 815
                  try {
682 816
                         $sth = $this->db->prepare($query);
@@ -697,9 +831,14 @@  discard block
 block discarded – undo
697 831
 	}
698 832
 	public function countAllHours($orderby = 'hour',$limit = true,$stats_airline = '',$filter_name = '') {
699 833
 		global $globalTimezone, $globalDBdriver, $globalStatsFilters;
700
-		if ($filter_name == '') $filter_name = $this->filter_name;
701
-		if ($limit) $query = "SELECT flight_date as hour_name, cnt as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline = :stats_airline AND filter_name = :filter_name";
702
-		else $query = "SELECT flight_date as hour_name, cnt as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline = :stats_airline AND filter_name = :filter_name";
834
+		if ($filter_name == '') {
835
+			$filter_name = $this->filter_name;
836
+		}
837
+		if ($limit) {
838
+			$query = "SELECT flight_date as hour_name, cnt as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline = :stats_airline AND filter_name = :filter_name";
839
+		} else {
840
+			$query = "SELECT flight_date as hour_name, cnt as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline = :stats_airline AND filter_name = :filter_name";
841
+		}
703 842
 		if ($orderby == 'hour') {
704 843
 			/*
705 844
 			if ($globalDBdriver == 'mysql') {
@@ -708,7 +847,9 @@  discard block
 block discarded – undo
708 847
 			*/
709 848
 			$query .= " ORDER BY CAST(flight_date AS integer) ASC";
710 849
 		}
711
-		if ($orderby == 'count') $query .= " ORDER BY hour_count DESC";
850
+		if ($orderby == 'count') {
851
+			$query .= " ORDER BY hour_count DESC";
852
+		}
712 853
                  try {
713 854
                         $sth = $this->db->prepare($query);
714 855
                         $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
@@ -729,8 +870,12 @@  discard block
 block discarded – undo
729 870
 	
730 871
 	public function countOverallFlights($stats_airline = '', $filter_name = '',$year = '',$month = '') {
731 872
 		global $globalStatsFilters;
732
-		if ($filter_name == '') $filter_name = $this->filter_name;
733
-		if ($year == '') $year = date('Y');
873
+		if ($filter_name == '') {
874
+			$filter_name = $this->filter_name;
875
+		}
876
+		if ($year == '') {
877
+			$year = date('Y');
878
+		}
734 879
 		$all = $this->getSumStats('flights_bymonth',$year,$stats_airline,$filter_name,$month);
735 880
 		if (empty($all)) {
736 881
 			$filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month);
@@ -745,8 +890,12 @@  discard block
 block discarded – undo
745 890
 	}
746 891
 	public function countOverallMilitaryFlights($filter_name = '',$year = '', $month = '') {
747 892
 		global $globalStatsFilters;
748
-		if ($filter_name == '') $filter_name = $this->filter_name;
749
-		if ($year == '') $year = date('Y');
893
+		if ($filter_name == '') {
894
+			$filter_name = $this->filter_name;
895
+		}
896
+		if ($year == '') {
897
+			$year = date('Y');
898
+		}
750 899
 		$all = $this->getSumStats('military_flights_bymonth',$year,'',$filter_name,$month);
751 900
 		if (empty($all)) {
752 901
 		        $filters = array();
@@ -762,8 +911,12 @@  discard block
 block discarded – undo
762 911
 	}
763 912
 	public function countOverallArrival($stats_airline = '',$filter_name = '', $year = '', $month = '') {
764 913
 		global $globalStatsFilters;
765
-		if ($filter_name == '') $filter_name = $this->filter_name;
766
-		if ($year == '') $year = date('Y');
914
+		if ($filter_name == '') {
915
+			$filter_name = $this->filter_name;
916
+		}
917
+		if ($year == '') {
918
+			$year = date('Y');
919
+		}
767 920
 		$all = $this->getSumStats('realarrivals_bymonth',$year,$stats_airline,$filter_name,$month);
768 921
 		if (empty($all)) {
769 922
 			$filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month);
@@ -778,7 +931,9 @@  discard block
 block discarded – undo
778 931
 	}
779 932
 	public function countOverallAircrafts($stats_airline = '',$filter_name = '',$year = '', $month = '') {
780 933
 		global $globalStatsFilters;
781
-		if ($filter_name == '') $filter_name = $this->filter_name;
934
+		if ($filter_name == '') {
935
+			$filter_name = $this->filter_name;
936
+		}
782 937
 		if ($year == '' && $month == '') {
783 938
 			$query = "SELECT COUNT(*) AS nb FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name";
784 939
 			try {
@@ -789,7 +944,9 @@  discard block
 block discarded – undo
789 944
 			}
790 945
 			$result = $sth->fetchAll(PDO::FETCH_ASSOC);
791 946
 			$all = $result[0]['nb'];
792
-		} else $all = $this->getSumStats('aircrafts_bymonth',$year,$stats_airline,$filter_name,$month);
947
+		} else {
948
+			$all = $this->getSumStats('aircrafts_bymonth',$year,$stats_airline,$filter_name,$month);
949
+		}
793 950
 		if (empty($all)) {
794 951
 			$filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month);
795 952
 			if ($filter_name != '') {
@@ -803,7 +960,9 @@  discard block
 block discarded – undo
803 960
 	}
804 961
 	public function countOverallAirlines($filter_name = '',$year = '',$month = '') {
805 962
 		global $globalStatsFilters;
806
-		if ($filter_name == '') $filter_name = $this->filter_name;
963
+		if ($filter_name == '') {
964
+			$filter_name = $this->filter_name;
965
+		}
807 966
 		if ($year == '' && $month == '') {
808 967
 			$query = "SELECT COUNT(*) AS nb_airline FROM stats_airline WHERE filter_name = :filter_name";
809 968
 			try {
@@ -814,7 +973,9 @@  discard block
 block discarded – undo
814 973
 			}
815 974
 			$result = $sth->fetchAll(PDO::FETCH_ASSOC);
816 975
 			$all = $result[0]['nb_airline'];
817
-		} else $all = $this->getSumStats('airlines_bymonth',$year,'',$filter_name,$month);
976
+		} else {
977
+			$all = $this->getSumStats('airlines_bymonth',$year,'',$filter_name,$month);
978
+		}
818 979
 		if (empty($all)) {
819 980
             		$filters = array();
820 981
 			$filters = array('year' => $year,'month' => $month);
@@ -829,7 +990,9 @@  discard block
 block discarded – undo
829 990
 	}
830 991
 	public function countOverallOwners($stats_airline = '',$filter_name = '',$year = '', $month = '') {
831 992
 		global $globalStatsFilters;
832
-		if ($filter_name == '') $filter_name = $this->filter_name;
993
+		if ($filter_name == '') {
994
+			$filter_name = $this->filter_name;
995
+		}
833 996
 		if ($year == '' && $month == '') {
834 997
 			$query = "SELECT count(*) as nb FROM stats_owner WHERE stats_airline = :stats_airline AND filter_name = :filter_name";
835 998
 			$query_values = array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
@@ -857,7 +1020,9 @@  discard block
 block discarded – undo
857 1020
 	}
858 1021
 	public function countOverallPilots($stats_airline = '',$filter_name = '',$year = '',$month = '') {
859 1022
 		global $globalStatsFilters;
860
-		if ($filter_name == '') $filter_name = $this->filter_name;
1023
+		if ($filter_name == '') {
1024
+			$filter_name = $this->filter_name;
1025
+		}
861 1026
 		//if ($year == '') $year = date('Y');
862 1027
 		if ($year == '' && $month == '') {
863 1028
 			$query = "SELECT count(*) as nb FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name";
@@ -886,7 +1051,9 @@  discard block
 block discarded – undo
886 1051
 	}
887 1052
 
888 1053
 	public function getLast7DaysAirports($airport_icao = '', $stats_airline = '',$filter_name = '') {
889
-		if ($filter_name == '') $filter_name = $this->filter_name;
1054
+		if ($filter_name == '') {
1055
+			$filter_name = $this->filter_name;
1056
+		}
890 1057
 		$query = "SELECT * FROM stats_airport WHERE stats_type = 'daily' AND airport_icao = :airport_icao AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY date";
891 1058
 		$query_values = array(':airport_icao' => $airport_icao,':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
892 1059
                  try {
@@ -899,7 +1066,9 @@  discard block
 block discarded – undo
899 1066
                 return $all;
900 1067
 	}
901 1068
 	public function getStats($type,$stats_airline = '', $filter_name = '') {
902
-		if ($filter_name == '') $filter_name = $this->filter_name;
1069
+		if ($filter_name == '') {
1070
+			$filter_name = $this->filter_name;
1071
+		}
903 1072
                 $query = "SELECT * FROM stats WHERE stats_type = :type AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY stats_date";
904 1073
                 $query_values = array(':type' => $type,':stats_airline' => $stats_airline,':filter_name' => $filter_name);
905 1074
                  try {
@@ -912,7 +1081,9 @@  discard block
 block discarded – undo
912 1081
                 return $all;
913 1082
         }
914 1083
 	public function getSumStats($type,$year,$stats_airline = '',$filter_name = '',$month = '') {
915
-		if ($filter_name == '') $filter_name = $this->filter_name;
1084
+		if ($filter_name == '') {
1085
+			$filter_name = $this->filter_name;
1086
+		}
916 1087
     		global $globalArchiveMonths, $globalDBdriver;
917 1088
     		if ($globalDBdriver == 'mysql') {
918 1089
     			if ($month == '') {
@@ -942,7 +1113,9 @@  discard block
 block discarded – undo
942 1113
         }
943 1114
 	public function getStatsTotal($type, $stats_airline = '', $filter_name = '') {
944 1115
     		global $globalArchiveMonths, $globalDBdriver;
945
-		if ($filter_name == '') $filter_name = $this->filter_name;
1116
+		if ($filter_name == '') {
1117
+			$filter_name = $this->filter_name;
1118
+		}
946 1119
     		if ($globalDBdriver == 'mysql') {
947 1120
 			$query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND stats_date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL ".$globalArchiveMonths." MONTH) AND stats_airline = :stats_airline AND filter_name = :filter_name";
948 1121
 		} else {
@@ -960,7 +1133,9 @@  discard block
 block discarded – undo
960 1133
         }
961 1134
 	public function getStatsAircraftTotal($stats_airline = '', $filter_name = '') {
962 1135
     		global $globalArchiveMonths, $globalDBdriver;
963
-		if ($filter_name == '') $filter_name = $this->filter_name;
1136
+		if ($filter_name == '') {
1137
+			$filter_name = $this->filter_name;
1138
+		}
964 1139
     		if ($globalDBdriver == 'mysql') {
965 1140
 			$query = "SELECT SUM(cnt) as total FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name";
966 1141
                 } else {
@@ -977,7 +1152,9 @@  discard block
 block discarded – undo
977 1152
         }
978 1153
 	public function getStatsAirlineTotal($filter_name = '') {
979 1154
     		global $globalArchiveMonths, $globalDBdriver;
980
-		if ($filter_name == '') $filter_name = $this->filter_name;
1155
+		if ($filter_name == '') {
1156
+			$filter_name = $this->filter_name;
1157
+		}
981 1158
     		if ($globalDBdriver == 'mysql') {
982 1159
 			$query = "SELECT SUM(cnt) as total FROM stats_airline WHERE filter_name = :filter_name";
983 1160
                 } else {
@@ -994,7 +1171,9 @@  discard block
 block discarded – undo
994 1171
         }
995 1172
 	public function getStatsOwnerTotal($filter_name = '') {
996 1173
     		global $globalArchiveMonths, $globalDBdriver;
997
-		if ($filter_name == '') $filter_name = $this->filter_name;
1174
+		if ($filter_name == '') {
1175
+			$filter_name = $this->filter_name;
1176
+		}
998 1177
     		if ($globalDBdriver == 'mysql') {
999 1178
 			$query = "SELECT SUM(cnt) as total FROM stats_owner WHERE filter_name = :filter_name";
1000 1179
 		} else {
@@ -1011,7 +1190,9 @@  discard block
 block discarded – undo
1011 1190
         }
1012 1191
 	public function getStatsOwner($owner_name,$filter_name = '') {
1013 1192
     		global $globalArchiveMonths, $globalDBdriver;
1014
-		if ($filter_name == '') $filter_name = $this->filter_name;
1193
+		if ($filter_name == '') {
1194
+			$filter_name = $this->filter_name;
1195
+		}
1015 1196
 		$query = "SELECT cnt FROM stats_owner WHERE filter_name = :filter_name AND owner_name = :owner_name";
1016 1197
                  try {
1017 1198
                         $sth = $this->db->prepare($query);
@@ -1020,12 +1201,17 @@  discard block
 block discarded – undo
1020 1201
                         echo "error : ".$e->getMessage();
1021 1202
                 }
1022 1203
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
1023
-                if (isset($all[0]['cnt'])) return $all[0]['cnt'];
1024
-                else return 0;
1204
+                if (isset($all[0]['cnt'])) {
1205
+                	return $all[0]['cnt'];
1206
+                } else {
1207
+                	return 0;
1208
+                }
1025 1209
         }
1026 1210
 	public function getStatsPilotTotal($filter_name = '') {
1027 1211
     		global $globalArchiveMonths, $globalDBdriver;
1028
-		if ($filter_name == '') $filter_name = $this->filter_name;
1212
+		if ($filter_name == '') {
1213
+			$filter_name = $this->filter_name;
1214
+		}
1029 1215
     		if ($globalDBdriver == 'mysql') {
1030 1216
             		$query = "SELECT SUM(cnt) as total FROM stats_pilot WHERE filter_name = :filter_name";
1031 1217
             	} else {
@@ -1042,7 +1228,9 @@  discard block
 block discarded – undo
1042 1228
         }
1043 1229
 	public function getStatsPilot($pilot,$filter_name = '') {
1044 1230
     		global $globalArchiveMonths, $globalDBdriver;
1045
-		if ($filter_name == '') $filter_name = $this->filter_name;
1231
+		if ($filter_name == '') {
1232
+			$filter_name = $this->filter_name;
1233
+		}
1046 1234
 		$query = "SELECT cnt FROM stats_pilot WHERE filter_name = :filter_name AND (pilot_name = :pilot OR pilot_id = :pilot)";
1047 1235
                  try {
1048 1236
                         $sth = $this->db->prepare($query);
@@ -1051,13 +1239,18 @@  discard block
 block discarded – undo
1051 1239
                         echo "error : ".$e->getMessage();
1052 1240
                 }
1053 1241
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
1054
-                if (isset($all[0]['cnt'])) return $all[0]['cnt'];
1055
-                else return 0;
1242
+                if (isset($all[0]['cnt'])) {
1243
+                	return $all[0]['cnt'];
1244
+                } else {
1245
+                	return 0;
1246
+                }
1056 1247
         }
1057 1248
 
1058 1249
 	public function addStat($type,$cnt,$stats_date,$stats_airline = '',$filter_name = '') {
1059 1250
 		global $globalDBdriver;
1060
-		if ($filter_name == '') $filter_name = $this->filter_name;
1251
+		if ($filter_name == '') {
1252
+			$filter_name = $this->filter_name;
1253
+		}
1061 1254
 		if ($globalDBdriver == 'mysql') {
1062 1255
 			$query = "INSERT INTO stats (stats_type,cnt,stats_date,stats_airline,filter_name) VALUES (:type,:cnt,:stats_date,:stats_airline,:filter_name) ON DUPLICATE KEY UPDATE cnt = :cnt";
1063 1256
                 } else {
@@ -1073,7 +1266,9 @@  discard block
 block discarded – undo
1073 1266
         }
1074 1267
 	public function updateStat($type,$cnt,$stats_date,$stats_airline = '',$filter_name = '') {
1075 1268
 		global $globalDBdriver;
1076
-		if ($filter_name == '') $filter_name = $this->filter_name;
1269
+		if ($filter_name == '') {
1270
+			$filter_name = $this->filter_name;
1271
+		}
1077 1272
 		if ($globalDBdriver == 'mysql') {
1078 1273
 			$query = "INSERT INTO stats (stats_type,cnt,stats_date,stats_airline,filter_name) VALUES (:type,:cnt,:stats_date,:stats_airline,:filter_name) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt, stats_date = :date";
1079 1274
 		} else {
@@ -1459,10 +1654,14 @@  discard block
 block discarded – undo
1459 1654
     		$Connection = new Connection();
1460 1655
     		date_default_timezone_set('UTC');
1461 1656
     		$last_update = $this->getLastStatsUpdate('last_update_stats');
1462
-			if ($globalDebug) echo 'Update stats !'."\n";
1657
+			if ($globalDebug) {
1658
+				echo 'Update stats !'."\n";
1659
+			}
1463 1660
 			if (isset($last_update[0]['value'])) {
1464 1661
 				$last_update_day = $last_update[0]['value'];
1465
-			} else $last_update_day = '2012-12-12 12:12:12';
1662
+			} else {
1663
+				$last_update_day = '2012-12-12 12:12:12';
1664
+			}
1466 1665
 			$reset = false;
1467 1666
 			if ($globalStatsResetYear) {
1468 1667
 				$reset = true;
@@ -1470,42 +1669,60 @@  discard block
 block discarded – undo
1470 1669
 			}
1471 1670
 			$Spotter = new Spotter($this->db);
1472 1671
 
1473
-			if ($globalDebug) echo 'Count all aircraft types...'."\n";
1672
+			if ($globalDebug) {
1673
+				echo 'Count all aircraft types...'."\n";
1674
+			}
1474 1675
 			$alldata = $Spotter->countAllAircraftTypes(false,0,$last_update_day);
1475 1676
 			foreach ($alldata as $number) {
1476 1677
 				$this->addStatAircraft($number['aircraft_icao'],$number['aircraft_icao_count'],$number['aircraft_name'],$number['aircraft_manufacturer'],'','',$reset);
1477 1678
 			}
1478
-			if ($globalDebug) echo 'Count all airlines...'."\n";
1679
+			if ($globalDebug) {
1680
+				echo 'Count all airlines...'."\n";
1681
+			}
1479 1682
 			$alldata = $Spotter->countAllAirlines(false,0,$last_update_day);
1480 1683
 			foreach ($alldata as $number) {
1481 1684
 				$this->addStatAirline($number['airline_icao'],$number['airline_count'],$number['airline_name'],'',$reset);
1482 1685
 			}
1483
-			if ($globalDebug) echo 'Count all registrations...'."\n";
1686
+			if ($globalDebug) {
1687
+				echo 'Count all registrations...'."\n";
1688
+			}
1484 1689
 			$alldata = $Spotter->countAllAircraftRegistrations(false,0,$last_update_day);
1485 1690
 			foreach ($alldata as $number) {
1486 1691
 				$this->addStatAircraftRegistration($number['registration'],$number['aircraft_registration_count'],$number['aircraft_icao'],'','',$reset);
1487 1692
 			}
1488
-			if ($globalDebug) echo 'Count all callsigns...'."\n";
1693
+			if ($globalDebug) {
1694
+				echo 'Count all callsigns...'."\n";
1695
+			}
1489 1696
 			$alldata = $Spotter->countAllCallsigns(false,0,$last_update_day);
1490 1697
 			foreach ($alldata as $number) {
1491 1698
 				$this->addStatCallsign($number['callsign_icao'],$number['callsign_icao_count'],$number['airline_icao'],'',$reset);
1492 1699
 			}
1493
-			if ($globalDebug) echo 'Count all owners...'."\n";
1700
+			if ($globalDebug) {
1701
+				echo 'Count all owners...'."\n";
1702
+			}
1494 1703
 			$alldata = $Spotter->countAllOwners(false,0,$last_update_day);
1495 1704
 			foreach ($alldata as $number) {
1496 1705
 				$this->addStatOwner($number['owner_name'],$number['owner_count'],'','',$reset);
1497 1706
 			}
1498
-			if ($globalDebug) echo 'Count all pilots...'."\n";
1707
+			if ($globalDebug) {
1708
+				echo 'Count all pilots...'."\n";
1709
+			}
1499 1710
 			$alldata = $Spotter->countAllPilots(false,0,$last_update_day);
1500 1711
 			foreach ($alldata as $number) {
1501 1712
 				$this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name'],'','',$number['format_source'],$reset);
1502 1713
 			}
1503 1714
 			
1504
-			if ($globalDebug) echo 'Count all departure airports...'."\n";
1715
+			if ($globalDebug) {
1716
+				echo 'Count all departure airports...'."\n";
1717
+			}
1505 1718
 			$pall = $Spotter->countAllDepartureAirports(false,0,$last_update_day);
1506
-			if ($globalDebug) echo 'Count all detected departure airports...'."\n";
1719
+			if ($globalDebug) {
1720
+				echo 'Count all detected departure airports...'."\n";
1721
+			}
1507 1722
         		$dall = $Spotter->countAllDetectedDepartureAirports(false,0,$last_update_day);
1508
-			if ($globalDebug) echo 'Order departure airports...'."\n";
1723
+			if ($globalDebug) {
1724
+				echo 'Order departure airports...'."\n";
1725
+			}
1509 1726
 	        	$alldata = array();
1510 1727
 	        	
1511 1728
     			foreach ($pall as $value) {
@@ -1516,7 +1733,9 @@  discard block
 block discarded – undo
1516 1733
     				$icao = $value['airport_departure_icao'];
1517 1734
         			if (isset($alldata[$icao])) {
1518 1735
     					$alldata[$icao]['airport_departure_icao_count'] = $alldata[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count'];
1519
-        			} else $alldata[$icao] = $value;
1736
+        			} else {
1737
+        				$alldata[$icao] = $value;
1738
+        			}
1520 1739
 			}
1521 1740
     			$count = array();
1522 1741
     			foreach ($alldata as $key => $row) {
@@ -1526,11 +1745,17 @@  discard block
 block discarded – undo
1526 1745
 			foreach ($alldata as $number) {
1527 1746
 				echo $this->addStatDepartureAirports($number['airport_departure_icao'],$number['airport_departure_name'],$number['airport_departure_city'],$number['airport_departure_country'],$number['airport_departure_icao_count'],'','',$reset);
1528 1747
 			}
1529
-			if ($globalDebug) echo 'Count all arrival airports...'."\n";
1748
+			if ($globalDebug) {
1749
+				echo 'Count all arrival airports...'."\n";
1750
+			}
1530 1751
 			$pall = $Spotter->countAllArrivalAirports(false,0,$last_update_day);
1531
-			if ($globalDebug) echo 'Count all detected arrival airports...'."\n";
1752
+			if ($globalDebug) {
1753
+				echo 'Count all detected arrival airports...'."\n";
1754
+			}
1532 1755
         		$dall = $Spotter->countAllDetectedArrivalAirports(false,0,$last_update_day);
1533
-			if ($globalDebug) echo 'Order arrival airports...'."\n";
1756
+			if ($globalDebug) {
1757
+				echo 'Order arrival airports...'."\n";
1758
+			}
1534 1759
 	        	$alldata = array();
1535 1760
     			foreach ($pall as $value) {
1536 1761
 	        		$icao = $value['airport_arrival_icao'];
@@ -1540,7 +1765,9 @@  discard block
 block discarded – undo
1540 1765
     				$icao = $value['airport_arrival_icao'];
1541 1766
         			if (isset($alldata[$icao])) {
1542 1767
         				$alldata[$icao]['airport_arrival_icao_count'] = $alldata[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count'];
1543
-	        		} else $alldata[$icao] = $value;
1768
+	        		} else {
1769
+	        			$alldata[$icao] = $value;
1770
+	        		}
1544 1771
     			}
1545 1772
         		$count = array();
1546 1773
         		foreach ($alldata as $key => $row) {
@@ -1551,7 +1778,9 @@  discard block
 block discarded – undo
1551 1778
 				echo $this->addStatArrivalAirports($number['airport_arrival_icao'],$number['airport_arrival_name'],$number['airport_arrival_city'],$number['airport_arrival_country'],$number['airport_arrival_icao_count'],'','',$reset);
1552 1779
 			}
1553 1780
 			if ($Connection->tableExists('countries')) {
1554
-				if ($globalDebug) echo 'Count all flights by countries...'."\n";
1781
+				if ($globalDebug) {
1782
+					echo 'Count all flights by countries...'."\n";
1783
+				}
1555 1784
 				$SpotterArchive = new SpotterArchive();
1556 1785
 				$alldata = $SpotterArchive->countAllFlightOverCountries(false,0,$last_update_day);
1557 1786
 				foreach ($alldata as $number) {
@@ -1563,46 +1792,66 @@  discard block
 block discarded – undo
1563 1792
 			// Add by month using getstat if month finish...
1564 1793
 
1565 1794
 			//if (date('m',strtotime($last_update_day)) != date('m')) {
1566
-			if ($globalDebug) echo 'Count all flights by months...'."\n";
1795
+			if ($globalDebug) {
1796
+				echo 'Count all flights by months...'."\n";
1797
+			}
1567 1798
 			$Spotter = new Spotter($this->db);
1568 1799
 			$alldata = $Spotter->countAllMonths();
1569 1800
 			$lastyear = false;
1570 1801
 			foreach ($alldata as $number) {
1571
-				if ($number['year_name'] != date('Y')) $lastyear = true;
1802
+				if ($number['year_name'] != date('Y')) {
1803
+					$lastyear = true;
1804
+				}
1572 1805
 				$this->addStat('flights_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])));
1573 1806
 			}
1574
-			if ($globalDebug) echo 'Count all military flights by months...'."\n";
1807
+			if ($globalDebug) {
1808
+				echo 'Count all military flights by months...'."\n";
1809
+			}
1575 1810
 			$alldata = $Spotter->countAllMilitaryMonths();
1576 1811
 			foreach ($alldata as $number) {
1577 1812
 				$this->addStat('military_flights_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])));
1578 1813
 			}
1579
-			if ($globalDebug) echo 'Count all owners by months...'."\n";
1814
+			if ($globalDebug) {
1815
+				echo 'Count all owners by months...'."\n";
1816
+			}
1580 1817
 			$alldata = $Spotter->countAllMonthsOwners();
1581 1818
 			foreach ($alldata as $number) {
1582 1819
 				$this->addStat('owners_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])));
1583 1820
 			}
1584
-			if ($globalDebug) echo 'Count all pilots by months...'."\n";
1821
+			if ($globalDebug) {
1822
+				echo 'Count all pilots by months...'."\n";
1823
+			}
1585 1824
 			$alldata = $Spotter->countAllMonthsPilots();
1586 1825
 			foreach ($alldata as $number) {
1587 1826
 				$this->addStat('pilots_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])));
1588 1827
 			}
1589
-			if ($globalDebug) echo 'Count all airlines by months...'."\n";
1828
+			if ($globalDebug) {
1829
+				echo 'Count all airlines by months...'."\n";
1830
+			}
1590 1831
 			$alldata = $Spotter->countAllMonthsAirlines();
1591 1832
 			foreach ($alldata as $number) {
1592 1833
 				$this->addStat('airlines_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])));
1593 1834
 			}
1594
-			if ($globalDebug) echo 'Count all aircrafts by months...'."\n";
1835
+			if ($globalDebug) {
1836
+				echo 'Count all aircrafts by months...'."\n";
1837
+			}
1595 1838
 			$alldata = $Spotter->countAllMonthsAircrafts();
1596 1839
 			foreach ($alldata as $number) {
1597 1840
 				$this->addStat('aircrafts_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])));
1598 1841
 			}
1599
-			if ($globalDebug) echo 'Count all real arrivals by months...'."\n";
1842
+			if ($globalDebug) {
1843
+				echo 'Count all real arrivals by months...'."\n";
1844
+			}
1600 1845
 			$alldata = $Spotter->countAllMonthsRealArrivals();
1601 1846
 			foreach ($alldata as $number) {
1602 1847
 				$this->addStat('realarrivals_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])));
1603 1848
 			}
1604
-			if ($globalDebug) echo 'Airports data...'."\n";
1605
-			if ($globalDebug) echo '...Departure'."\n";
1849
+			if ($globalDebug) {
1850
+				echo 'Airports data...'."\n";
1851
+			}
1852
+			if ($globalDebug) {
1853
+				echo '...Departure'."\n";
1854
+			}
1606 1855
 			$this->deleteStatAirport('daily');
1607 1856
 //			$pall = $Spotter->getLast7DaysAirportsDeparture();
1608 1857
   //      		$dall = $Spotter->getLast7DaysDetectedAirportsDeparture();
@@ -1723,44 +1972,62 @@  discard block
 block discarded – undo
1723 1972
 			// Count by airlines
1724 1973
 			echo '--- Stats by airlines ---'."\n";
1725 1974
 			if ($Connection->tableExists('countries')) {
1726
-				if ($globalDebug) echo 'Count all flights by countries by airlines...'."\n";
1975
+				if ($globalDebug) {
1976
+					echo 'Count all flights by countries by airlines...'."\n";
1977
+				}
1727 1978
 				$SpotterArchive = new SpotterArchive();
1728 1979
 				$alldata = $SpotterArchive->countAllFlightOverCountriesByAirlines(false,0,$last_update_day);
1729 1980
 				foreach ($alldata as $number) {
1730 1981
 					$this->addStatCountry($number['flight_country_iso2'],$number['flight_country_iso3'],$number['flight_country'],$number['flight_count'],$number['airline_icao'],'',$reset);
1731 1982
 				}
1732 1983
 			}
1733
-			if ($globalDebug) echo 'Count all aircraft types by airlines...'."\n";
1984
+			if ($globalDebug) {
1985
+				echo 'Count all aircraft types by airlines...'."\n";
1986
+			}
1734 1987
 			$Spotter = new Spotter($this->db);
1735 1988
 			$alldata = $Spotter->countAllAircraftTypesByAirlines(false,0,$last_update_day);
1736 1989
 			foreach ($alldata as $number) {
1737 1990
 				$this->addStatAircraft($number['aircraft_icao'],$number['aircraft_icao_count'],$number['aircraft_name'],$number['aircraft_manufacturer'],$number['airline_icao'],'',$reset);
1738 1991
 			}
1739
-			if ($globalDebug) echo 'Count all aircraft registrations by airlines...'."\n";
1992
+			if ($globalDebug) {
1993
+				echo 'Count all aircraft registrations by airlines...'."\n";
1994
+			}
1740 1995
 			$alldata = $Spotter->countAllAircraftRegistrationsByAirlines(false,0,$last_update_day);
1741 1996
 			foreach ($alldata as $number) {
1742 1997
 				$this->addStatAircraftRegistration($number['registration'],$number['aircraft_registration_count'],$number['aircraft_icao'],$number['airline_icao'],'',$reset);
1743 1998
 			}
1744
-			if ($globalDebug) echo 'Count all callsigns by airlines...'."\n";
1999
+			if ($globalDebug) {
2000
+				echo 'Count all callsigns by airlines...'."\n";
2001
+			}
1745 2002
 			$alldata = $Spotter->countAllCallsignsByAirlines(false,0,$last_update_day);
1746 2003
 			foreach ($alldata as $number) {
1747 2004
 				$this->addStatCallsign($number['callsign_icao'],$number['callsign_icao_count'],$number['airline_icao'],'',$reset);
1748 2005
 			}
1749
-			if ($globalDebug) echo 'Count all owners by airlines...'."\n";
2006
+			if ($globalDebug) {
2007
+				echo 'Count all owners by airlines...'."\n";
2008
+			}
1750 2009
 			$alldata = $Spotter->countAllOwnersByAirlines(false,0,$last_update_day);
1751 2010
 			foreach ($alldata as $number) {
1752 2011
 				$this->addStatOwner($number['owner_name'],$number['owner_count'],$number['airline_icao'],'',$reset);
1753 2012
 			}
1754
-			if ($globalDebug) echo 'Count all pilots by airlines...'."\n";
2013
+			if ($globalDebug) {
2014
+				echo 'Count all pilots by airlines...'."\n";
2015
+			}
1755 2016
 			$alldata = $Spotter->countAllPilotsByAirlines(false,0,$last_update_day);
1756 2017
 			foreach ($alldata as $number) {
1757 2018
 				$this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name'],$number['airline_icao'],'',$number['format_source'],$reset);
1758 2019
 			}
1759
-			if ($globalDebug) echo 'Count all departure airports by airlines...'."\n";
2020
+			if ($globalDebug) {
2021
+				echo 'Count all departure airports by airlines...'."\n";
2022
+			}
1760 2023
 			$pall = $Spotter->countAllDepartureAirportsByAirlines(false,0,$last_update_day);
1761
-			if ($globalDebug) echo 'Count all detected departure airports by airlines...'."\n";
2024
+			if ($globalDebug) {
2025
+				echo 'Count all detected departure airports by airlines...'."\n";
2026
+			}
1762 2027
        			$dall = $Spotter->countAllDetectedDepartureAirportsByAirlines(false,0,$last_update_day);
1763
-			if ($globalDebug) echo 'Order detected departure airports by airlines...'."\n";
2028
+			if ($globalDebug) {
2029
+				echo 'Order detected departure airports by airlines...'."\n";
2030
+			}
1764 2031
 	        	//$alldata = array();
1765 2032
     			foreach ($dall as $value) {
1766 2033
     				$icao = $value['airport_departure_icao'];
@@ -1781,11 +2048,17 @@  discard block
 block discarded – undo
1781 2048
 			foreach ($alldata as $number) {
1782 2049
 				echo $this->addStatDepartureAirports($number['airport_departure_icao'],$number['airport_departure_name'],$number['airport_departure_city'],$number['airport_departure_country'],$number['airport_departure_icao_count'],$number['airline_icao'],'',$reset);
1783 2050
 			}
1784
-			if ($globalDebug) echo 'Count all arrival airports by airlines...'."\n";
2051
+			if ($globalDebug) {
2052
+				echo 'Count all arrival airports by airlines...'."\n";
2053
+			}
1785 2054
 			$pall = $Spotter->countAllArrivalAirportsByAirlines(false,0,$last_update_day);
1786
-			if ($globalDebug) echo 'Count all detected arrival airports by airlines...'."\n";
2055
+			if ($globalDebug) {
2056
+				echo 'Count all detected arrival airports by airlines...'."\n";
2057
+			}
1787 2058
         		$dall = $Spotter->countAllDetectedArrivalAirportsByAirlines(false,0,$last_update_day);
1788
-			if ($globalDebug) echo 'Order arrival airports by airlines...'."\n";
2059
+			if ($globalDebug) {
2060
+				echo 'Order arrival airports by airlines...'."\n";
2061
+			}
1789 2062
 	        	//$alldata = array();
1790 2063
     			foreach ($dall as $value) {
1791 2064
     				$icao = $value['airport_arrival_icao'];
@@ -1804,37 +2077,53 @@  discard block
 block discarded – undo
1804 2077
     			}
1805 2078
     			$alldata = $pall;
1806 2079
                         foreach ($alldata as $number) {
1807
-				if ($number['airline_icao'] != '') echo $this->addStatArrivalAirports($number['airport_arrival_icao'],$number['airport_arrival_name'],$number['airport_arrival_city'],$number['airport_arrival_country'],$number['airport_arrival_icao_count'],$number['airline_icao'],'',$reset);
2080
+				if ($number['airline_icao'] != '') {
2081
+					echo $this->addStatArrivalAirports($number['airport_arrival_icao'],$number['airport_arrival_name'],$number['airport_arrival_city'],$number['airport_arrival_country'],$number['airport_arrival_icao_count'],$number['airline_icao'],'',$reset);
2082
+				}
2083
+			}
2084
+			if ($globalDebug) {
2085
+				echo 'Count all flights by months by airlines...'."\n";
1808 2086
 			}
1809
-			if ($globalDebug) echo 'Count all flights by months by airlines...'."\n";
1810 2087
 			$Spotter = new Spotter($this->db);
1811 2088
 			$alldata = $Spotter->countAllMonthsByAirlines();
1812 2089
 			$lastyear = false;
1813 2090
 			foreach ($alldata as $number) {
1814
-				if ($number['year_name'] != date('Y')) $lastyear = true;
2091
+				if ($number['year_name'] != date('Y')) {
2092
+					$lastyear = true;
2093
+				}
1815 2094
 				$this->addStat('flights_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']);
1816 2095
 			}
1817
-			if ($globalDebug) echo 'Count all owners by months by airlines...'."\n";
2096
+			if ($globalDebug) {
2097
+				echo 'Count all owners by months by airlines...'."\n";
2098
+			}
1818 2099
 			$alldata = $Spotter->countAllMonthsOwnersByAirlines();
1819 2100
 			foreach ($alldata as $number) {
1820 2101
 				$this->addStat('owners_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']);
1821 2102
 			}
1822
-			if ($globalDebug) echo 'Count all pilots by months by airlines...'."\n";
2103
+			if ($globalDebug) {
2104
+				echo 'Count all pilots by months by airlines...'."\n";
2105
+			}
1823 2106
 			$alldata = $Spotter->countAllMonthsPilotsByAirlines();
1824 2107
 			foreach ($alldata as $number) {
1825 2108
 				$this->addStat('pilots_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']);
1826 2109
 			}
1827
-			if ($globalDebug) echo 'Count all aircrafts by months by airlines...'."\n";
2110
+			if ($globalDebug) {
2111
+				echo 'Count all aircrafts by months by airlines...'."\n";
2112
+			}
1828 2113
 			$alldata = $Spotter->countAllMonthsAircraftsByAirlines();
1829 2114
 			foreach ($alldata as $number) {
1830 2115
 				$this->addStat('aircrafts_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']);
1831 2116
 			}
1832
-			if ($globalDebug) echo 'Count all real arrivals by months by airlines...'."\n";
2117
+			if ($globalDebug) {
2118
+				echo 'Count all real arrivals by months by airlines...'."\n";
2119
+			}
1833 2120
 			$alldata = $Spotter->countAllMonthsRealArrivalsByAirlines();
1834 2121
 			foreach ($alldata as $number) {
1835 2122
 				$this->addStat('realarrivals_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']);
1836 2123
 			}
1837
-			if ($globalDebug) echo '...Departure'."\n";
2124
+			if ($globalDebug) {
2125
+				echo '...Departure'."\n";
2126
+			}
1838 2127
 			$pall = $Spotter->getLast7DaysAirportsDepartureByAirlines();
1839 2128
         		$dall = $Spotter->getLast7DaysDetectedAirportsDepartureByAirlines();
1840 2129
     			foreach ($dall as $value) {
@@ -1857,7 +2146,9 @@  discard block
 block discarded – undo
1857 2146
 			foreach ($alldata as $number) {
1858 2147
 				$this->addStatDepartureAirportsDaily($number['date'],$number['departure_airport_icao'],$number['departure_airport_name'],$number['departure_airport_city'],$number['departure_airport_country'],$number['departure_airport_count'],$number['airline_icao']);
1859 2148
 			}
1860
-			if ($globalDebug) echo '...Arrival'."\n";
2149
+			if ($globalDebug) {
2150
+				echo '...Arrival'."\n";
2151
+			}
1861 2152
 			$pall = $Spotter->getLast7DaysAirportsArrivalByAirlines();
1862 2153
         		$dall = $Spotter->getLast7DaysDetectedAirportsArrivalByAirlines();
1863 2154
     			foreach ($dall as $value) {
@@ -1881,13 +2172,19 @@  discard block
 block discarded – undo
1881 2172
 				$this->addStatArrivalAirportsDaily($number['date'],$number['arrival_airport_icao'],$number['arrival_airport_name'],$number['arrival_airport_city'],$number['arrival_airport_country'],$number['arrival_airport_count'],$number['airline_icao']);
1882 2173
 			}
1883 2174
 
1884
-			if ($globalDebug) echo 'Flights data...'."\n";
1885
-			if ($globalDebug) echo '-> countAllDatesLastMonth...'."\n";
2175
+			if ($globalDebug) {
2176
+				echo 'Flights data...'."\n";
2177
+			}
2178
+			if ($globalDebug) {
2179
+				echo '-> countAllDatesLastMonth...'."\n";
2180
+			}
1886 2181
 			$alldata = $Spotter->countAllDatesLastMonthByAirlines();
1887 2182
 			foreach ($alldata as $number) {
1888 2183
 				$this->addStatFlight('month',$number['date_name'],$number['date_count'], $number['airline_icao']);
1889 2184
 			}
1890
-			if ($globalDebug) echo '-> countAllDates...'."\n";
2185
+			if ($globalDebug) {
2186
+				echo '-> countAllDates...'."\n";
2187
+			}
1891 2188
 			//$previousdata = $this->countAllDatesByAirlines();
1892 2189
 			$alldata = $Common->array_merge_noappend($previousdatabyairlines,$Spotter->countAllDatesByAirlines());
1893 2190
 			$values = array();
@@ -1900,7 +2197,9 @@  discard block
 block discarded – undo
1900 2197
 				$this->addStatFlight('date',$number['date_name'],$number['date_count'],$number['airline_icao']);
1901 2198
 			}
1902 2199
 			
1903
-			if ($globalDebug) echo '-> countAllHours...'."\n";
2200
+			if ($globalDebug) {
2201
+				echo '-> countAllHours...'."\n";
2202
+			}
1904 2203
 			$alldata = $Spotter->countAllHoursByAirlines('hour');
1905 2204
 			foreach ($alldata as $number) {
1906 2205
 				$this->addStatFlight('hour',$number['hour_name'],$number['hour_count'],$number['airline_icao']);
@@ -1908,7 +2207,9 @@  discard block
 block discarded – undo
1908 2207
 			
1909 2208
 
1910 2209
 			// Stats by filters
1911
-			if (!isset($globalStatsFilters) || $globalStatsFilters == '') $globalStatsFilters = array();
2210
+			if (!isset($globalStatsFilters) || $globalStatsFilters == '') {
2211
+				$globalStatsFilters = array();
2212
+			}
1912 2213
 			foreach ($globalStatsFilters as $name => $filter) {
1913 2214
 				//$filter_name = $filter['name'];
1914 2215
 				$filter_name = $name;
@@ -1916,11 +2217,15 @@  discard block
 block discarded – undo
1916 2217
 				$last_update = $this->getLastStatsUpdate('last_update_stats_'.$filter_name);
1917 2218
 				if (isset($last_update[0]['value'])) {
1918 2219
 					$last_update_day = $last_update[0]['value'];
1919
-				} else $last_update_day = '2012-12-12 12:12:12';
2220
+				} else {
2221
+					$last_update_day = '2012-12-12 12:12:12';
2222
+				}
1920 2223
 				$reset = false;
1921 2224
 
1922 2225
 				// Count by filter
1923
-				if ($globalDebug) echo '--- Stats for filter '.$filter_name.' ---'."\n";
2226
+				if ($globalDebug) {
2227
+					echo '--- Stats for filter '.$filter_name.' ---'."\n";
2228
+				}
1924 2229
 				$Spotter = new Spotter($this->db);
1925 2230
 				$alldata = $Spotter->countAllAircraftTypes(false,0,$last_update_day,$filter);
1926 2231
 				foreach ($alldata as $number) {
@@ -1957,7 +2262,9 @@  discard block
 block discarded – undo
1957 2262
 	    				$icao = $value['airport_departure_icao'];
1958 2263
         				if (isset($alldata[$icao])) {
1959 2264
     						$alldata[$icao]['airport_departure_icao_count'] = $alldata[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count'];
1960
-        				} else $alldata[$icao] = $value;
2265
+        				} else {
2266
+        					$alldata[$icao] = $value;
2267
+        				}
1961 2268
 				}
1962 2269
 	    			$count = array();
1963 2270
     				foreach ($alldata as $key => $row) {
@@ -1978,7 +2285,9 @@  discard block
 block discarded – undo
1978 2285
 	    				$icao = $value['airport_arrival_icao'];
1979 2286
         				if (isset($alldata[$icao])) {
1980 2287
         					$alldata[$icao]['airport_arrival_icao_count'] = $alldata[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count'];
1981
-		        		} else $alldata[$icao] = $value;
2288
+		        		} else {
2289
+		        			$alldata[$icao] = $value;
2290
+		        		}
1982 2291
 	    			}
1983 2292
         			$count = array();
1984 2293
         			foreach ($alldata as $key => $row) {
@@ -1992,7 +2301,9 @@  discard block
 block discarded – undo
1992 2301
 				$alldata = $Spotter->countAllMonths($filter);
1993 2302
 				$lastyear = false;
1994 2303
 				foreach ($alldata as $number) {
1995
-					if ($number['year_name'] != date('Y')) $lastyear = true;
2304
+					if ($number['year_name'] != date('Y')) {
2305
+						$lastyear = true;
2306
+					}
1996 2307
 					$this->addStat('flights_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),'',$filter_name);
1997 2308
 				}
1998 2309
 				$alldata = $Spotter->countAllMonthsOwners($filter);
Please login to merge, or discard this patch.
owner-statistics-arrival-airport.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -12,8 +12,12 @@
 block discarded – undo
12 12
 $year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT);
13 13
 $month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT);
14 14
 $filter = array();
15
-if ($year != '') $filter = array_merge($filter,array('year' => $year));
16
-if ($month != '') $filter = array_merge($filter,array('month' => $month));
15
+if ($year != '') {
16
+	$filter = array_merge($filter,array('year' => $year));
17
+}
18
+if ($month != '') {
19
+	$filter = array_merge($filter,array('month' => $month));
20
+}
17 21
 
18 22
 $spotter_array = $Spotter->getSpotterDataByOwner($owner,"0,1", $sort,$filter);
19 23
 
Please login to merge, or discard this patch.
pilot-detailed.php 1 patch
Braces   +21 added lines, -7 removed lines patch added patch discarded remove patch
@@ -39,8 +39,12 @@  discard block
 block discarded – undo
39 39
 	$year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT);
40 40
 	$month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT);
41 41
 	$filter = array();
42
-	if ($year != '') $filter = array_merge($filter,array('year' => $year));
43
-	if ($month != '') $filter = array_merge($filter,array('month' => $month));
42
+	if ($year != '') {
43
+		$filter = array_merge($filter,array('year' => $year));
44
+	}
45
+	if ($month != '') {
46
+		$filter = array_merge($filter,array('month' => $month));
47
+	}
44 48
 	if ($sort != '') 
45 49
 	{
46 50
 		$spotter_array = $Spotter->getSpotterDataByPilot($pilot,$limit_start.",".$absolute_difference, $sort,$filter);
@@ -58,8 +62,12 @@  discard block
 block discarded – undo
58 62
 	{
59 63
 		$title = sprintf(_("Detailed View for %s"),$spotter_array[0]['pilot_name']);
60 64
 		$ident = $spotter_array[0]['ident'];
61
-		if (isset($spotter_array[0]['latitude'])) $latitude = $spotter_array[0]['latitude'];
62
-		if (isset($spotter_array[0]['longitude'])) $longitude = $spotter_array[0]['longitude'];
65
+		if (isset($spotter_array[0]['latitude'])) {
66
+			$latitude = $spotter_array[0]['latitude'];
67
+		}
68
+		if (isset($spotter_array[0]['longitude'])) {
69
+			$longitude = $spotter_array[0]['longitude'];
70
+		}
63 71
 		require_once('header.php');
64 72
 		/*
65 73
 		if (isset($globalArchive) && $globalArchive) {
@@ -112,12 +120,18 @@  discard block
 block discarded – undo
112 120
 		*/
113 121
 		print '<div class="info column">';
114 122
 		print '<h1>'.$spotter_array[0]['pilot_name'].'</h1>';
115
-		if (isset($spotter_array[0]['pilot_id']) && $spotter_array[0]['pilot_id'] != '') print '<div><span class="label">'._("Pilot ID").'</span>'.$spotter_array[0]['pilot_id'].'</div>';
123
+		if (isset($spotter_array[0]['pilot_id']) && $spotter_array[0]['pilot_id'] != '') {
124
+			print '<div><span class="label">'._("Pilot ID").'</span>'.$spotter_array[0]['pilot_id'].'</div>';
125
+		}
116 126
 		if ($year == '' && $month == '') {
117 127
 			$Stats = new Stats();
118 128
 			$flights = $Stats->getStatsPilot($pilot);
119
-		} else $flights = 0;
120
-		if ($flight == 0) $flights = $Spotter->countFlightsByPilot($pilot,$filter);
129
+		} else {
130
+			$flights = 0;
131
+		}
132
+		if ($flight == 0) {
133
+			$flights = $Spotter->countFlightsByPilot($pilot,$filter);
134
+		}
121 135
 		print '<div><span class="label">'._("Flights").'</span>'.$flights.'</div>';
122 136
 		$aircraft_type = count($Spotter->countAllAircraftTypesByPilot($pilot,$filter));
123 137
 		print '<div><span class="label">'._("Aircrafts type").'</span>'.$aircraft_type.'</div>';
Please login to merge, or discard this patch.
owner-sub-menu.php 1 patch
Braces   +77 added lines, -11 removed lines patch added patch discarded remove patch
@@ -3,20 +3,50 @@  discard block
 block discarded – undo
3 3
 </span>
4 4
 <div class="stats_airline">
5 5
 	<form id="changedate" method="post">
6
-		<input type="month" name="date" onchange="statsdatechange(this);" value="<?php if (isset($year) && $year != '') echo $year.'-'; ?><?php if (isset($month) && $month != '') echo $month; ?>" />
6
+		<input type="month" name="date" onchange="statsdatechange(this);" value="<?php if (isset($year) && $year != '') {
7
+	echo $year.'-';
8
+}
9
+?><?php if (isset($month) && $month != '') {
10
+	echo $month;
11
+}
12
+?>" />
7 13
 	</form>
8 14
 </div>
9 15
 <div class="sub-menu sub-menu-container">
10 16
 	<ul class="nav nav-pills">
11
-		<li><a href="<?php print $globalURL; ?>/owner/<?php print $_GET['owner']; ?><?php if (isset($year) && $year != '') echo '/'.$year; ?><?php if (isset($month) && $month != '') echo '/'.$month; ?>" <?php if (strtolower($current_page) == "owner-detailed"){ print 'class="active"'; } ?>><?php echo _("Detailed"); ?></a></li>
17
+		<li><a href="<?php print $globalURL; ?>/owner/<?php print $_GET['owner']; ?><?php if (isset($year) && $year != '') {
18
+	echo '/'.$year;
19
+}
20
+?><?php if (isset($month) && $month != '') {
21
+	echo '/'.$month;
22
+}
23
+?>" <?php if (strtolower($current_page) == "owner-detailed"){ print 'class="active"'; } ?>><?php echo _("Detailed"); ?></a></li>
12 24
 		<li class="dropdown">
13 25
 		    <a class="dropdown-toggle <?php if(strtolower($current_page) == "owner-statistics-aircraft" || strtolower($current_page) == "owner-statistics-registration" || strtolower($current_page) == "owner-statistics-manufacturer"){ print 'active'; } ?>" data-toggle="dropdown" href="#">
14 26
 		      <?php echo _("Aircraft"); ?> <span class="caret"></span>
15 27
 		    </a>
16 28
 		    <ul class="dropdown-menu" role="menu">
17
-		      <li><a href="<?php print $globalURL; ?>/owner/statistics/aircraft/<?php print $_GET['owner']; ?><?php if (isset($year) && $year != '') echo '/'.$year; ?><?php if (isset($month) && $month != '') echo '/'.$month; ?>"><?php echo _("Aircraft Type"); ?></a></li>
18
-					<li><a href="<?php print $globalURL; ?>/owner/statistics/registration/<?php print $_GET['owner']; ?><?php if (isset($year) && $year != '') echo '/'.$year; ?><?php if (isset($month) && $month != '') echo '/'.$month; ?>"><?php echo _("Registration"); ?></a></li>
19
-					<li><a href="<?php print $globalURL; ?>/owner/statistics/manufacturer/<?php print $_GET['owner']; ?><?php if (isset($year) && $year != '') echo '/'.$year; ?><?php if (isset($month) && $month != '') echo '/'.$month; ?>"><?php echo _("Manufacturer"); ?></a></li>
29
+		      <li><a href="<?php print $globalURL; ?>/owner/statistics/aircraft/<?php print $_GET['owner']; ?><?php if (isset($year) && $year != '') {
30
+	echo '/'.$year;
31
+}
32
+?><?php if (isset($month) && $month != '') {
33
+	echo '/'.$month;
34
+}
35
+?>"><?php echo _("Aircraft Type"); ?></a></li>
36
+					<li><a href="<?php print $globalURL; ?>/owner/statistics/registration/<?php print $_GET['owner']; ?><?php if (isset($year) && $year != '') {
37
+	echo '/'.$year;
38
+}
39
+?><?php if (isset($month) && $month != '') {
40
+	echo '/'.$month;
41
+}
42
+?>"><?php echo _("Registration"); ?></a></li>
43
+					<li><a href="<?php print $globalURL; ?>/owner/statistics/manufacturer/<?php print $_GET['owner']; ?><?php if (isset($year) && $year != '') {
44
+	echo '/'.$year;
45
+}
46
+?><?php if (isset($month) && $month != '') {
47
+	echo '/'.$month;
48
+}
49
+?>"><?php echo _("Manufacturer"); ?></a></li>
20 50
 		    </ul>
21 51
 		</li>
22 52
 		<li class="dropdown">
@@ -24,13 +54,49 @@  discard block
 block discarded – undo
24 54
 		      <?php echo _("Airport"); ?> <span class="caret"></span>
25 55
 		    </a>
26 56
 		    <ul class="dropdown-menu" role="menu">
27
-		      <li><a href="<?php print $globalURL; ?>/owner/statistics/departure-airport/<?php print $_GET['owner']; ?><?php if (isset($year) && $year != '') echo '/'.$year; ?><?php if (isset($month) && $month != '') echo '/'.$month; ?>"><?php echo _("Departure Airport"); ?></a></li>
28
-		      <li><a href="<?php print $globalURL; ?>/owner/statistics/departure-airport-country/<?php print $_GET['owner']; ?><?php if (isset($year) && $year != '') echo '/'.$year; ?><?php if (isset($month) && $month != '') echo '/'.$month; ?>"><?php echo _("Departure Airport by Country"); ?></a></li>
29
-			  <li><a href="<?php print $globalURL; ?>/owner/statistics/arrival-airport/<?php print $_GET['owner']; ?><?php if (isset($year) && $year != '') echo '/'.$year; ?><?php if (isset($month) && $month != '') echo '/'.$month; ?>"><?php echo _("Arrival Airport"); ?></a></li>
30
-			  <li><a href="<?php print $globalURL; ?>/owner/statistics/arrival-airport-country/<?php print $_GET['owner']; ?><?php if (isset($year) && $year != '') echo '/'.$year; ?><?php if (isset($month) && $month != '') echo '/'.$month; ?>"><?php echo _("Arrival Airport by Country"); ?></a></li>
57
+		      <li><a href="<?php print $globalURL; ?>/owner/statistics/departure-airport/<?php print $_GET['owner']; ?><?php if (isset($year) && $year != '') {
58
+	echo '/'.$year;
59
+}
60
+?><?php if (isset($month) && $month != '') {
61
+	echo '/'.$month;
62
+}
63
+?>"><?php echo _("Departure Airport"); ?></a></li>
64
+		      <li><a href="<?php print $globalURL; ?>/owner/statistics/departure-airport-country/<?php print $_GET['owner']; ?><?php if (isset($year) && $year != '') {
65
+	echo '/'.$year;
66
+}
67
+?><?php if (isset($month) && $month != '') {
68
+	echo '/'.$month;
69
+}
70
+?>"><?php echo _("Departure Airport by Country"); ?></a></li>
71
+			  <li><a href="<?php print $globalURL; ?>/owner/statistics/arrival-airport/<?php print $_GET['owner']; ?><?php if (isset($year) && $year != '') {
72
+	echo '/'.$year;
73
+}
74
+?><?php if (isset($month) && $month != '') {
75
+	echo '/'.$month;
76
+}
77
+?>"><?php echo _("Arrival Airport"); ?></a></li>
78
+			  <li><a href="<?php print $globalURL; ?>/owner/statistics/arrival-airport-country/<?php print $_GET['owner']; ?><?php if (isset($year) && $year != '') {
79
+	echo '/'.$year;
80
+}
81
+?><?php if (isset($month) && $month != '') {
82
+	echo '/'.$month;
83
+}
84
+?>"><?php echo _("Arrival Airport by Country"); ?></a></li>
31 85
 		    </ul>
32 86
 		</li>
33
-		<li><a href="<?php print $globalURL; ?>/owner/statistics/route/<?php print $_GET['owner']; ?><?php if (isset($year) && $year != '') echo '/'.$year; ?><?php if (isset($month) && $month != '') echo '/'.$month; ?>" <?php if (strtolower($current_page) == "owner-statistics-route"){ print 'class="active"'; } ?>><?php echo _("Route"); ?></a></li>
34
-		<li><a href="<?php print $globalURL; ?>/owner/statistics/time/<?php print $_GET['owner']; ?><?php if (isset($year) && $year != '') echo '/'.$year; ?><?php if (isset($month) && $month != '') echo '/'.$month; ?>" <?php if (strtolower($current_page) == "owner-statistics-time"){ print 'class="active"'; } ?>><?php echo _("Time"); ?></a></li>
87
+		<li><a href="<?php print $globalURL; ?>/owner/statistics/route/<?php print $_GET['owner']; ?><?php if (isset($year) && $year != '') {
88
+	echo '/'.$year;
89
+}
90
+?><?php if (isset($month) && $month != '') {
91
+	echo '/'.$month;
92
+}
93
+?>" <?php if (strtolower($current_page) == "owner-statistics-route"){ print 'class="active"'; } ?>><?php echo _("Route"); ?></a></li>
94
+		<li><a href="<?php print $globalURL; ?>/owner/statistics/time/<?php print $_GET['owner']; ?><?php if (isset($year) && $year != '') {
95
+	echo '/'.$year;
96
+}
97
+?><?php if (isset($month) && $month != '') {
98
+	echo '/'.$month;
99
+}
100
+?>" <?php if (strtolower($current_page) == "owner-statistics-time"){ print 'class="active"'; } ?>><?php echo _("Time"); ?></a></li>
35 101
 	</ul>
36 102
 </div>
37 103
\ No newline at end of file
Please login to merge, or discard this patch.
owner-statistics-arrival-airport-country.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -12,8 +12,12 @@
 block discarded – undo
12 12
 $year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT);
13 13
 $month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT);
14 14
 $filter = array();
15
-if ($year != '') $filter = array_merge($filter,array('year' => $year));
16
-if ($month != '') $filter = array_merge($filter,array('month' => $month));
15
+if ($year != '') {
16
+	$filter = array_merge($filter,array('year' => $year));
17
+}
18
+if ($month != '') {
19
+	$filter = array_merge($filter,array('month' => $month));
20
+}
17 21
 $spotter_array = $Spotter->getSpotterDataByOwner($owner,"0,1", $sort, $filter);
18 22
 
19 23
 if (!empty($spotter_array))
Please login to merge, or discard this patch.
pilot-statistics-aircraft.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -12,8 +12,12 @@
 block discarded – undo
12 12
 $year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT);
13 13
 $month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT);
14 14
 $filter = array();
15
-if ($year != '') $filter = array_merge($filter,array('year' => $year));
16
-if ($month != '') $filter = array_merge($filter,array('month' => $month));
15
+if ($year != '') {
16
+	$filter = array_merge($filter,array('year' => $year));
17
+}
18
+if ($month != '') {
19
+	$filter = array_merge($filter,array('month' => $month));
20
+}
17 21
 if ($sort != '') {
18 22
 	$spotter_array = $Spotter->getSpotterDataByPilot($pilot,"0,1", $sort,$filter);
19 23
 } else {
Please login to merge, or discard this patch.