Completed
Push — master ( e17801...597a61 )
by Yannick
25:55
created
statistics-aircraft.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -6,12 +6,12 @@  discard block
 block discarded – undo
6 6
 $title = _("Statistics").' - '._("Most common Aircraft");
7 7
 
8 8
 if (!isset($filter_name)) $filter_name = '';
9
-$airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING);
9
+$airline_icao = (string) filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING);
10 10
 if ($airline_icao == '' && isset($globalFilter)) {
11 11
     if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
12 12
 }
13
-$year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT);
14
-$month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT);
13
+$year = filter_input(INPUT_GET, 'year', FILTER_SANITIZE_NUMBER_INT);
14
+$month = filter_input(INPUT_GET, 'month', FILTER_SANITIZE_NUMBER_INT);
15 15
 
16 16
 require_once('header.php');
17 17
 
@@ -23,10 +23,10 @@  discard block
 block discarded – undo
23 23
 	</div>
24 24
 	<p>'._("Below are the <strong>Top 10</strong> most common aircraft types.").'</p>';
25 25
 	  
26
-$aircraft_array = $Stats->countAllAircraftTypes(true,$airline_icao,$filter_name,$year,$month);
26
+$aircraft_array = $Stats->countAllAircraftTypes(true, $airline_icao, $filter_name, $year, $month);
27 27
 print '<div id="chart" class="chart" width="100%"></div><script>';
28 28
 $aircraft_data = '';
29
-foreach($aircraft_array as $aircraft_item)
29
+foreach ($aircraft_array as $aircraft_item)
30 30
 {
31 31
 	if ($aircraft_item['aircraft_manufacturer'] == 'Not Available') $aircraft_data .= '[" ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],';
32 32
 	else $aircraft_data .= '["'.$aircraft_item['aircraft_manufacturer'].' '.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],';
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 	print '</thead>';
53 53
 	print '<tbody>';
54 54
 	$i = 1;
55
-	foreach($aircraft_array as $aircraft_item)
55
+	foreach ($aircraft_array as $aircraft_item)
56 56
 	{
57 57
 		print '<tr>';
58 58
 		print '<td><strong>'.$i.'</strong></td>';
Please login to merge, or discard this patch.
atc-data.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -5,8 +5,8 @@  discard block
 block discarded – undo
5 5
 $ATC = new ATC();
6 6
 
7 7
 if (isset($_GET['atcid'])) {
8
-	$atcid = filter_input(INPUT_GET,'atcid',FILTER_SANITIZE_NUMBER_INT);
9
-	$atcident = filter_input(INPUT_GET,'atcident',FILTER_SANITIZE_STRING);
8
+	$atcid = filter_input(INPUT_GET, 'atcid', FILTER_SANITIZE_NUMBER_INT);
9
+	$atcident = filter_input(INPUT_GET, 'atcident', FILTER_SANITIZE_STRING);
10 10
 	$atc_data = $ATC->getById($atcid);
11 11
 	if (!isset($atc_data[0])) $atc_data = $ATC->getByIdent($atcident);
12 12
  ?>
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 print '</div>';
39 39
 
40 40
 //print '<div><span>'._("Country").'</span>'.$spotter_item['country'].'</div>';
41
-print '<div><span>'._("Coordinates").'</span>'.round($spotter_item['latitude'],3).', '.round($spotter_item['longitude'],3).'</div>';
41
+print '<div><span>'._("Coordinates").'</span>'.round($spotter_item['latitude'], 3).', '.round($spotter_item['longitude'], 3).'</div>';
42 42
 if ($spotter_item['atc_range'] > 0) {
43 43
     print '<div><span>'._("Range").'</span>';
44 44
     print $spotter_item['atc_range'];
Please login to merge, or discard this patch.
statistics.php 1 patch
Spacing   +136 added lines, -136 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
 }
20 20
 
21 21
 if (!isset($filter_name)) $filter_name = '';
22
-$airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING);
22
+$airline_icao = (string) filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING);
23 23
 if ($type == 'aircraft' && $airline_icao == '' && isset($globalFilter)) {
24 24
 	if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
25 25
 }
@@ -34,8 +34,8 @@  discard block
 block discarded – undo
34 34
 	$title = _("Statistics");
35 35
 }
36 36
 
37
-$year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT);
38
-$month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT);
37
+$year = filter_input(INPUT_GET, 'year', FILTER_SANITIZE_NUMBER_INT);
38
+$month = filter_input(INPUT_GET, 'month', FILTER_SANITIZE_NUMBER_INT);
39 39
 
40 40
 require_once('header.php');
41 41
 
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 			date_default_timezone_set('UTC');
63 63
 			$lastupdate = strtotime($last_update[0]['value']);
64 64
 			if (isset($globalTimezone) && $globalTimezone != '') date_default_timezone_set($globalTimezone);
65
-			print '<i>Last update: '.date('Y-m-d G:i:s',$lastupdate).'</i>';
65
+			print '<i>Last update: '.date('Y-m-d G:i:s', $lastupdate).'</i>';
66 66
 		}
67 67
 	}
68 68
 ?>
@@ -74,31 +74,31 @@  discard block
 block discarded – undo
74 74
 <?php
75 75
 	if ($type == 'aircraft') {
76 76
 ?>
77
-        <span><span class="badge"><?php print number_format($Stats->countOverallFlights($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Flights"); ?></span>
78
-	<!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
79
-        <span><span class="badge"><?php print number_format($Stats->countOverallArrival($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Arrivals seen"); ?></span>
80
-        <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
77
+        <span><span class="badge"><?php print number_format($Stats->countOverallFlights($airline_icao, $filter_name, $year, $month)); ?></span> <?php echo _("Flights"); ?></span>
78
+	<!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
79
+        <span><span class="badge"><?php print number_format($Stats->countOverallArrival($airline_icao, $filter_name, $year, $month)); ?></span> <?php echo _("Arrivals seen"); ?></span>
80
+        <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
81 81
 	<?php
82 82
 	    if ((isset($globalUsePilot) && $globalUsePilot) || !isset($globalUsePilot) && ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || (isset($globalVAM) && $globalVAM))) {
83 83
  	?>
84
-    	    <span><span class="badge"><?php print number_format($Stats->countOverallPilots($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Pilots"); ?></span>
85
-	    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
84
+    	    <span><span class="badge"><?php print number_format($Stats->countOverallPilots($airline_icao, $filter_name, $year, $month)); ?></span> <?php echo _("Pilots"); ?></span>
85
+	    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
86 86
         <?php
87 87
     	    }
88 88
 	    if ((isset($globalUseOwner) && $globalUseOwner) || (!isset($globalUseOwner) && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalVAM) || !$globalVAM))) {
89 89
     	?>
90
-    	    <span><span class="badge"><?php print number_format($Stats->countOverallOwners($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Owners"); ?></span>
91
-	    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
90
+    	    <span><span class="badge"><?php print number_format($Stats->countOverallOwners($airline_icao, $filter_name, $year, $month)); ?></span> <?php echo _("Owners"); ?></span>
91
+	    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
92 92
     	<?php
93 93
     	    }
94 94
     	?>
95
-        <span><span class="badge"><?php print number_format($Stats->countOverallAircrafts($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Aircrafts types"); ?></span>
96
-        <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
95
+        <span><span class="badge"><?php print number_format($Stats->countOverallAircrafts($airline_icao, $filter_name, $year, $month)); ?></span> <?php echo _("Aircrafts types"); ?></span>
96
+        <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
97 97
         <?php
98 98
     		if ($airline_icao == '') {
99 99
     	?>
100
-        <span><span class="badge"><?php print number_format($Stats->countOverallAirlines($filter_name,$year,$month)); ?></span> <?php echo _("Airlines"); ?></span>
101
-	<!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
100
+        <span><span class="badge"><?php print number_format($Stats->countOverallAirlines($filter_name, $year, $month)); ?></span> <?php echo _("Airlines"); ?></span>
101
+	<!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
102 102
 	<?php
103 103
 		}
104 104
 	?>
@@ -106,8 +106,8 @@  discard block
 block discarded – undo
106 106
 		if (!(isset($globalVA) && $globalVA) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalphpVMS) && $globalphpVMS) && !(isset($globalVAM) && $globalVAM)) {
107 107
 			if ($airline_icao == '' || $airline_icao == 'all') {
108 108
 	?>
109
-        <span><span class="badge"><?php print number_format($Stats->countOverallMilitaryFlights($filter_name,$year,$month)); ?></span> <?php echo _("Military"); ?></span>
110
-	<!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
109
+        <span><span class="badge"><?php print number_format($Stats->countOverallMilitaryFlights($filter_name, $year, $month)); ?></span> <?php echo _("Military"); ?></span>
110
+	<!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
111 111
 	<?php
112 112
 			}
113 113
 		}
@@ -115,22 +115,22 @@  discard block
 block discarded – undo
115 115
 <?php
116 116
 	} elseif ($type == 'marine') {
117 117
 ?>
118
-	<span><span class="badge"><?php print number_format($Marine->countOverallMarine(array(),$year,$month)); ?></span> <?php echo _("Vessels"); ?></span>
119
-	<!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
120
-	<span><span class="badge"><?php print number_format($Marine->countOverallMarineTypes(array(),$year,$month)); ?></span> <?php echo _("Types"); ?></span>
121
-	<!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
118
+	<span><span class="badge"><?php print number_format($Marine->countOverallMarine(array(), $year, $month)); ?></span> <?php echo _("Vessels"); ?></span>
119
+	<!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
120
+	<span><span class="badge"><?php print number_format($Marine->countOverallMarineTypes(array(), $year, $month)); ?></span> <?php echo _("Types"); ?></span>
121
+	<!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
122 122
 <?php
123 123
 	} elseif ($type == 'tracker') {
124 124
 ?>
125
-	<span><span class="badge"><?php print number_format($Tracker->countOverallTracker(array(),$year,$month)); ?></span> <?php echo _("Trackers"); ?></span>
126
-	<!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
127
-	<span><span class="badge"><?php print number_format($Tracker->countOverallTrackerTypes(array(),$year,$month)); ?></span> <?php echo _("Types"); ?></span>
128
-	<!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
125
+	<span><span class="badge"><?php print number_format($Tracker->countOverallTracker(array(), $year, $month)); ?></span> <?php echo _("Trackers"); ?></span>
126
+	<!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
127
+	<span><span class="badge"><?php print number_format($Tracker->countOverallTrackerTypes(array(), $year, $month)); ?></span> <?php echo _("Types"); ?></span>
128
+	<!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
129 129
 <?php
130 130
 	}
131 131
 ?>
132 132
     </p>
133
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
133
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
134 134
     <div class="specific-stats">
135 135
 <?php
136 136
 	if ($type == 'aircraft') {
@@ -139,12 +139,12 @@  discard block
 block discarded – undo
139 139
             <div class="col-md-6">
140 140
                 <h2><?php echo _("Top 10 Most Common Aircraft Type"); ?></h2>
141 141
                  <?php
142
-                  $aircraft_array = $Stats->countAllAircraftTypes(true,$airline_icao,$filter_name,$year,$month);
142
+                  $aircraft_array = $Stats->countAllAircraftTypes(true, $airline_icao, $filter_name, $year, $month);
143 143
 		    if (count($aircraft_array) == 0) print _("No data available");
144 144
 		    else {
145 145
                     print '<div id="chart1" class="chart" width="100%"></div><script>';
146 146
                     $aircraft_data = '';
147
-                    foreach($aircraft_array as $aircraft_item)
147
+                    foreach ($aircraft_array as $aircraft_item)
148 148
                     {
149 149
                         if ($aircraft_item['aircraft_manufacturer'] == 'Not Available') $aircraft_data .= '[" ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],';
150 150
                         else $aircraft_data .= '["'.$aircraft_item['aircraft_manufacturer'].' '.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],';
@@ -174,17 +174,17 @@  discard block
 block discarded – undo
174 174
             	    ?>
175 175
                 </div>
176 176
             </div>
177
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
177
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
178 178
 <?php
179 179
 //    echo $airline_icao;
180 180
 		if ($airline_icao == '' || $airline_icao == 'all') {
181
-			$airline_array = $Stats->countAllAirlines(true,$filter_name,$year,$month);
181
+			$airline_array = $Stats->countAllAirlines(true, $filter_name, $year, $month);
182 182
 			if (count($airline_array) > 0) {
183 183
 				print '<div class="col-md-6">';
184 184
 				print '<h2>'._("Top 10 Most Common Airline").'</h2>';
185 185
 				print '<div id="chart2" class="chart" width="100%"></div><script>';
186 186
 				$airline_data = '';
187
-				foreach($airline_array as $airline_item)
187
+				foreach ($airline_array as $airline_item)
188 188
 				{
189 189
 					$airline_data .= '["'.$airline_item['airline_name'].' ('.$airline_item['airline_icao'].')",'.$airline_item['airline_count'].'],';
190 190
 				}
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
 			}
211 211
 ?>
212 212
         </div>
213
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
213
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
214 214
 <?php
215 215
 		}
216 216
 ?>
@@ -224,12 +224,12 @@  discard block
 block discarded – undo
224 224
             <div class="col-md-6">
225 225
                 <h2><?php echo _("Top 10 Most Common Vessel Type"); ?></h2>
226 226
                  <?php
227
-                    $marine_array = $Marine->countAllMarineTypes(true,0,'',array(),$year,$month);
227
+                    $marine_array = $Marine->countAllMarineTypes(true, 0, '', array(), $year, $month);
228 228
 		    if (count($marine_array) == 0) print _("No data available");
229 229
 		    else {
230 230
                     print '<div id="chart1" class="chart" width="100%"></div><script>';
231 231
                     $marine_data = '';
232
-                    foreach($marine_array as $marine_item)
232
+                    foreach ($marine_array as $marine_item)
233 233
                     {
234 234
                         $marine_data .= '["'.$marine_item['marine_type'].'",'.$marine_item['marine_type_count'].'],';
235 235
                     }
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
             	    ?>
261 261
                 </div>
262 262
             </div>
263
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
263
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
264 264
 <!--	</div>-->
265 265
 <?php
266 266
 	}
@@ -272,12 +272,12 @@  discard block
 block discarded – undo
272 272
             <div class="col-md-6">
273 273
                 <h2><?php echo _("Top 10 Most Common Tracker Type"); ?></h2>
274 274
                  <?php
275
-                  $tracker_array = $Tracker->countAllTrackerTypes(true,0,'',array(),$year,$month);
275
+                  $tracker_array = $Tracker->countAllTrackerTypes(true, 0, '', array(), $year, $month);
276 276
 		    if (count($tracker_array) == 0) print _("No data available");
277 277
 		    else {
278 278
                     print '<div id="chart1" class="chart" width="100%"></div><script>';
279 279
                     $tracker_data = '';
280
-                    foreach($tracker_array as $tracker_item)
280
+                    foreach ($tracker_array as $tracker_item)
281 281
                     {
282 282
                         $tracker_data .= '["'.$tracker_item['tracker_type'].'",'.$tracker_item['tracker_type_count'].'],';
283 283
                     }
@@ -308,7 +308,7 @@  discard block
 block discarded – undo
308 308
             	    ?>
309 309
                 </div>
310 310
             </div>
311
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
311
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
312 312
 <!--	</div>-->
313 313
 <?php
314 314
 	}
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
 ?>
319 319
         <div class="row column">
320 320
 <?php
321
-		$flightover_array = $Stats->countAllFlightOverCountries(false,$airline_icao,$filter_name,$year,$month);
321
+		$flightover_array = $Stats->countAllFlightOverCountries(false, $airline_icao, $filter_name, $year, $month);
322 322
 		//if ((isset($globalVA) && $globalVA) ||(isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) {
323 323
 		if ((isset($globalUsePilot) && $globalUsePilot) || !isset($globalUsePilot) && ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || (isset($globalVAM) && $globalVAM))) {
324 324
 			if (empty($flightover_array)) {
@@ -329,12 +329,12 @@  discard block
 block discarded – undo
329 329
 ?>
330 330
                 <h2><?php echo _("Top 10 Most Common Pilots"); ?></h2>
331 331
 <?php
332
-			$pilot_array = $Stats->countAllPilots(true,$airline_icao,$filter_name,$year,$month);
332
+			$pilot_array = $Stats->countAllPilots(true, $airline_icao, $filter_name, $year, $month);
333 333
 			if (count($pilot_array) == 0) print _("No data available");
334 334
 			else {
335 335
 				print '<div id="chart7" class="chart" width="100%"></div><script>';
336 336
 				$pilot_data = '';
337
-				foreach($pilot_array as $pilot_item)
337
+				foreach ($pilot_array as $pilot_item)
338 338
 				{
339 339
 					$pilot_data .= '["'.$pilot_item['pilot_name'].' ('.$pilot_item['pilot_id'].')",'.$pilot_item['pilot_count'].'],';
340 340
 				}
@@ -356,7 +356,7 @@  discard block
 block discarded – undo
356 356
 ?>
357 357
             </div>
358 358
         
359
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
359
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
360 360
 <?php
361 361
 		}
362 362
 		// else {
@@ -365,12 +365,12 @@  discard block
 block discarded – undo
365 365
             <div class="col-md-6">
366 366
                 <h2><?php echo _("Top 10 Most Common Owners"); ?></h2>
367 367
 <?php
368
-			$owner_array = $Stats->countAllOwners(true,$airline_icao,$filter_name,$year,$month);
368
+			$owner_array = $Stats->countAllOwners(true, $airline_icao, $filter_name, $year, $month);
369 369
 			if (count($owner_array) == 0) print _("No data available");
370 370
 			else {
371 371
 				print '<div id="chart7" class="chart" width="100%"></div><script>';
372 372
 				$owner_data = '';
373
-				foreach($owner_array as $owner_item)
373
+				foreach ($owner_array as $owner_item)
374 374
 				{
375 375
 					$owner_data .= '["'.$owner_item['owner_name'].'",'.$owner_item['owner_count'].'],';
376 376
 				}
@@ -390,7 +390,7 @@  discard block
 block discarded – undo
390 390
                 </div>
391 391
             </div>
392 392
         
393
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
393
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
394 394
 <?php
395 395
 		}
396 396
 		if (!empty($flightover_array)) {
@@ -404,7 +404,7 @@  discard block
 block discarded – undo
404 404
 				print '<div id="chart10" class="chart" width="100%"></div><script>';
405 405
 				print 'var series = [';
406 406
 				$flightover_data = '';
407
-				foreach($flightover_array as $flightover_item)
407
+				foreach ($flightover_array as $flightover_item)
408 408
 				{
409 409
 					$flightover_data .= '[ "'.$flightover_item['flight_country_iso3'].'",'.$flightover_item['flight_count'].'],';
410 410
 				}
@@ -450,7 +450,7 @@  discard block
 block discarded – undo
450 450
 		}
451 451
 ?>
452 452
         </div>
453
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
453
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
454 454
 
455 455
     	
456 456
         </div>
@@ -470,7 +470,7 @@  discard block
 block discarded – undo
470 470
 			print '<div id="chart10" class="chart" width="100%"></div><script>';
471 471
 			print 'var series = [';
472 472
 			$flightover_data = '';
473
-			foreach($flightover_array as $flightover_item)
473
+			foreach ($flightover_array as $flightover_item)
474 474
 			{
475 475
 				$flightover_data .= '[ "'.$flightover_item['marine_country_iso3'].'",'.$flightover_item['marine_count'].'],';
476 476
 			}
@@ -530,7 +530,7 @@  discard block
 block discarded – undo
530 530
 			print '<div id="chart10" class="chart" width="100%"></div><script>';
531 531
 			print 'var series = [';
532 532
 			$flightover_data = '';
533
-			foreach($flightover_array as $flightover_item)
533
+			foreach ($flightover_array as $flightover_item)
534 534
 			{
535 535
 				$flightover_data .= '[ "'.$flightover_item['flight_country_iso3'].'",'.$flightover_item['flight_count'].'],';
536 536
 			}
@@ -583,14 +583,14 @@  discard block
 block discarded – undo
583 583
         <div class="row column">
584 584
             <div class="col-md-6">
585 585
 <?php
586
-		$airport_airport_array = $Stats->countAllDepartureAirports(true,$airline_icao,$filter_name,$year,$month);
586
+		$airport_airport_array = $Stats->countAllDepartureAirports(true, $airline_icao, $filter_name, $year, $month);
587 587
 		if (count($airport_airport_array) > 0) {
588 588
 			print '<h2>'._("Top 10 Most Common Departure Airports").'</h2>';
589 589
 			print '<div id="chart3" class="chart" width="100%"></div><script>';
590 590
 			print "\n";
591 591
 			print 'var series = [';
592 592
 			$airport_data = '';
593
-			foreach($airport_airport_array as $airport_item)
593
+			foreach ($airport_airport_array as $airport_item)
594 594
 			{
595 595
 				$airport_data .= '[ "'.$airport_item['airport_departure_icao_count'].'", "'.$airport_item['airport_departure_icao'].'",'.$airport_item['airport_departure_latitude'].','.$airport_item['airport_departure_longitude'].'],';
596 596
 			}
@@ -641,18 +641,18 @@  discard block
 block discarded – undo
641 641
 		}
642 642
 ?>
643 643
             </div>
644
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
644
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
645 645
 
646 646
             <div class="col-md-6">
647 647
 <?php
648
-		$airport_airport_array2 = $Stats->countAllArrivalAirports(true,$airline_icao,$filter_name,$year,$month);
648
+		$airport_airport_array2 = $Stats->countAllArrivalAirports(true, $airline_icao, $filter_name, $year, $month);
649 649
 		if (count($airport_airport_array2) > 0) {
650 650
 			print '<h2>'._("Top 10 Most Common Arrival Airports").'</h2>';
651 651
 			print '<div id="chart4" class="chart" width="100%"></div><script>';
652 652
 			print "\n";
653 653
 			print 'var series = [';
654 654
 			$airport_data = '';
655
-			foreach($airport_airport_array2 as $airport_item)
655
+			foreach ($airport_airport_array2 as $airport_item)
656 656
 			{
657 657
 				$airport_data .= '[ "'.$airport_item['airport_arrival_icao_count'].'", "'.$airport_item['airport_arrival_icao'].'",'.$airport_item['airport_arrival_latitude'].','.$airport_item['airport_arrival_longitude'].'],';
658 658
 			}
@@ -704,7 +704,7 @@  discard block
 block discarded – undo
704 704
 ?>
705 705
             </div>
706 706
         </div>
707
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
707
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
708 708
 <?php 
709 709
 	}
710 710
 ?>
@@ -718,19 +718,19 @@  discard block
 block discarded – undo
718 718
             <div class="col-md-6">
719 719
                 <h2><?php echo _("Busiest Months of the last 12 Months"); ?></h2>
720 720
 <?php
721
-			$year_array = $Stats->countAllMonthsLastYear(true,$airline_icao,$filter_name);
721
+			$year_array = $Stats->countAllMonthsLastYear(true, $airline_icao, $filter_name);
722 722
 			if (count($year_array) == 0) print _("No data available");
723 723
 			else {
724 724
 				print '<div id="chart8" class="chart" width="100%"></div><script>';
725 725
 				$year_data = '';
726 726
 				$year_cnt = '';
727
-				foreach($year_array as $year_item)
727
+				foreach ($year_array as $year_item)
728 728
 				{
729 729
 					$year_data .= '"'.$year_item['year_name'].'-'.$year_item['month_name'].'-01'.'",';
730 730
 					$year_cnt .= $year_item['date_count'].',';
731 731
 				}
732 732
 				$year_data = "['x',".substr($year_data, 0, -1)."]";
733
-				$year_cnt = "['flights',".substr($year_cnt,0,-1)."]";
733
+				$year_cnt = "['flights',".substr($year_cnt, 0, -1)."]";
734 734
 				print 'c3.generate({
735 735
 				    bindto: "#chart8",
736 736
 				    data: { x: "x",
@@ -743,23 +743,23 @@  discard block
 block discarded – undo
743 743
                     <a href="<?php print $globalURL; ?>/statistics/year<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
744 744
                 </div>
745 745
             </div>
746
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
746
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
747 747
             <div class="col-md-6">
748 748
                 <h2><?php echo _("Busiest Day in the last Month"); ?></h2>
749 749
 <?php
750
-			$month_array = $Stats->countAllDatesLastMonth($airline_icao,$filter_name);
750
+			$month_array = $Stats->countAllDatesLastMonth($airline_icao, $filter_name);
751 751
 			if (count($month_array) == 0) print _("No data available");
752 752
 			else {
753 753
 				print '<div id="chart9" class="chart" width="100%"></div><script>';
754 754
 				$month_data = '';
755 755
 				$month_cnt = '';
756
-				foreach($month_array as $month_item)
756
+				foreach ($month_array as $month_item)
757 757
 				{
758 758
 					$month_data .= '"'.$month_item['date_name'].'",';
759 759
 					$month_cnt .= $month_item['date_count'].',';
760 760
 				}
761 761
 				$month_data = "['x',".substr($month_data, 0, -1)."]";
762
-				$month_cnt = "['flights',".substr($month_cnt,0,-1)."]";
762
+				$month_cnt = "['flights',".substr($month_cnt, 0, -1)."]";
763 763
 				print 'c3.generate({
764 764
 				    bindto: "#chart9",
765 765
 				    data: { x: "x",
@@ -772,24 +772,24 @@  discard block
 block discarded – undo
772 772
                     <a href="<?php print $globalURL; ?>/statistics/month<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
773 773
                 </div>
774 774
             </div>
775
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
775
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
776 776
 
777 777
             <div class="col-md-6">
778 778
                 <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2>
779 779
 <?php
780
-			$date_array = $Stats->countAllDatesLast7Days($airline_icao,$filter_name);
780
+			$date_array = $Stats->countAllDatesLast7Days($airline_icao, $filter_name);
781 781
 			if (empty($date_array)) print _("No data available");
782 782
 			else {
783 783
 				print '<div id="chart5" class="chart" width="100%"></div><script>';
784 784
 				$date_data = '';
785 785
 				$date_cnt = '';
786
-				foreach($date_array as $date_item)
786
+				foreach ($date_array as $date_item)
787 787
 				{
788 788
 					$date_data .= '"'.$date_item['date_name'].'",';
789 789
 					$date_cnt .= $date_item['date_count'].',';
790 790
 				}
791 791
 				$date_data = "['x',".substr($date_data, 0, -1)."]";
792
-				$date_cnt = "['flights',".substr($date_cnt,0,-1)."]";
792
+				$date_cnt = "['flights',".substr($date_cnt, 0, -1)."]";
793 793
 				print 'c3.generate({
794 794
 				    bindto: "#chart5",
795 795
 				    data: { x: "x",
@@ -802,23 +802,23 @@  discard block
 block discarded – undo
802 802
                     <a href="<?php print $globalURL; ?>/statistics/date<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
803 803
                 </div>
804 804
             </div>
805
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
805
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
806 806
             <div class="col-md-6">
807 807
                 <h2><?php echo _("Busiest Time of the Day"); ?></h2>
808 808
 <?php
809
-			$hour_array = $Stats->countAllHours('hour',true,$airline_icao,$filter_name);
809
+			$hour_array = $Stats->countAllHours('hour', true, $airline_icao, $filter_name);
810 810
 			if (empty($hour_array)) print _("No data available");
811 811
 			else {
812 812
 				print '<div id="chart6" class="chart" width="100%"></div><script>';
813 813
 				$hour_data = '';
814 814
 				$hour_cnt = '';
815
-				foreach($hour_array as $hour_item)
815
+				foreach ($hour_array as $hour_item)
816 816
 				{
817 817
 					$hour_data .= '"'.$hour_item['hour_name'].':00",';
818 818
 					$hour_cnt .= $hour_item['hour_count'].',';
819 819
 				}
820 820
 				$hour_data = "[".substr($hour_data, 0, -1)."]";
821
-				$hour_cnt = "['flights',".substr($hour_cnt,0,-1)."]";
821
+				$hour_cnt = "['flights',".substr($hour_cnt, 0, -1)."]";
822 822
 				print 'c3.generate({
823 823
 				    bindto: "#chart6",
824 824
 				    data: {
@@ -831,7 +831,7 @@  discard block
 block discarded – undo
831 831
                     <a href="<?php print $globalURL; ?>/statistics/time<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
832 832
                 </div>
833 833
             </div>
834
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
834
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
835 835
         </div>
836 836
 <?php
837 837
 		}
@@ -849,19 +849,19 @@  discard block
 block discarded – undo
849 849
             <div class="col-md-6">
850 850
                 <h2><?php echo _("Busiest Months of the last 12 Months"); ?></h2>
851 851
 <?php
852
-			$year_array = $Marine->countAllMonthsLastYear(true,$airline_icao,$filter_name);
852
+			$year_array = $Marine->countAllMonthsLastYear(true, $airline_icao, $filter_name);
853 853
 			if (count($year_array) == 0) print _("No data available");
854 854
 			else {
855 855
 				print '<div id="chart8" class="chart" width="100%"></div><script>';
856 856
 				$year_data = '';
857 857
 				$year_cnt = '';
858
-				foreach($year_array as $year_item)
858
+				foreach ($year_array as $year_item)
859 859
 				{
860 860
 					$year_data .= '"'.$year_item['year_name'].'-'.$year_item['month_name'].'-01'.'",';
861 861
 					$year_cnt .= $year_item['date_count'].',';
862 862
 				}
863 863
 				$year_data = "['x',".substr($year_data, 0, -1)."]";
864
-				$year_cnt = "['vessels',".substr($year_cnt,0,-1)."]";
864
+				$year_cnt = "['vessels',".substr($year_cnt, 0, -1)."]";
865 865
 				print 'c3.generate({
866 866
 				    bindto: "#chart8",
867 867
 				    data: { x: "x",
@@ -875,23 +875,23 @@  discard block
 block discarded – undo
875 875
                 </div>
876 876
             </div>
877 877
             
878
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
878
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
879 879
             <div class="col-md-6">
880 880
                 <h2><?php echo _("Busiest Day in the last Month"); ?></h2>
881 881
 <?php
882
-			$month_array = $Marine->countAllDatesLastMonth($airline_icao,$filter_name);
882
+			$month_array = $Marine->countAllDatesLastMonth($airline_icao, $filter_name);
883 883
 			if (count($month_array) == 0) print _("No data available");
884 884
 			else {
885 885
 				print '<div id="chart9" class="chart" width="100%"></div><script>';
886 886
 				$month_data = '';
887 887
 				$month_cnt = '';
888
-				foreach($month_array as $month_item)
888
+				foreach ($month_array as $month_item)
889 889
 				{
890 890
 					$month_data .= '"'.$month_item['date_name'].'",';
891 891
 					$month_cnt .= $month_item['date_count'].',';
892 892
 				}
893 893
 				$month_data = "['x',".substr($month_data, 0, -1)."]";
894
-				$month_cnt = "['vessels',".substr($month_cnt,0,-1)."]";
894
+				$month_cnt = "['vessels',".substr($month_cnt, 0, -1)."]";
895 895
 				print 'c3.generate({
896 896
 				    bindto: "#chart9",
897 897
 				    data: { x: "x",
@@ -904,24 +904,24 @@  discard block
 block discarded – undo
904 904
                     <a href="<?php print $globalURL; ?>/marine/statistics/month" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
905 905
                 </div>
906 906
             </div>
907
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
907
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
908 908
 
909 909
             <div class="col-md-6">
910 910
                 <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2>
911 911
 <?php
912
-			$date_array = $Marine->countAllDatesLast7Days($airline_icao,$filter_name);
912
+			$date_array = $Marine->countAllDatesLast7Days($airline_icao, $filter_name);
913 913
 			if (empty($date_array)) print _("No data available");
914 914
 			else {
915 915
 				print '<div id="chart5" class="chart" width="100%"></div><script>';
916 916
 				$date_data = '';
917 917
 				$date_cnt = '';
918
-				foreach($date_array as $date_item)
918
+				foreach ($date_array as $date_item)
919 919
 				{
920 920
 					$date_data .= '"'.$date_item['date_name'].'",';
921 921
 					$date_cnt .= $date_item['date_count'].',';
922 922
 				}
923 923
 				$date_data = "['x',".substr($date_data, 0, -1)."]";
924
-				$date_cnt = "['vessels',".substr($date_cnt,0,-1)."]";
924
+				$date_cnt = "['vessels',".substr($date_cnt, 0, -1)."]";
925 925
 				print 'c3.generate({
926 926
 				    bindto: "#chart5",
927 927
 				    data: { x: "x",
@@ -934,23 +934,23 @@  discard block
 block discarded – undo
934 934
                     <a href="<?php print $globalURL; ?>/marine/statistics/date" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
935 935
                 </div>
936 936
             </div>
937
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
937
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
938 938
             <div class="col-md-6">
939 939
                 <h2><?php echo _("Busiest Time of the Day"); ?></h2>
940 940
 <?php
941
-			$hour_array = $Marine->countAllHours('hour',true,$airline_icao,$filter_name);
941
+			$hour_array = $Marine->countAllHours('hour', true, $airline_icao, $filter_name);
942 942
 			if (empty($hour_array)) print _("No data available");
943 943
 			else {
944 944
 				print '<div id="chart6" class="chart" width="100%"></div><script>';
945 945
 				$hour_data = '';
946 946
 				$hour_cnt = '';
947
-				foreach($hour_array as $hour_item)
947
+				foreach ($hour_array as $hour_item)
948 948
 				{
949 949
 					$hour_data .= '"'.$hour_item['hour_name'].':00",';
950 950
 					$hour_cnt .= $hour_item['hour_count'].',';
951 951
 				}
952 952
 				$hour_data = "[".substr($hour_data, 0, -1)."]";
953
-				$hour_cnt = "['vessels',".substr($hour_cnt,0,-1)."]";
953
+				$hour_cnt = "['vessels',".substr($hour_cnt, 0, -1)."]";
954 954
 				print 'c3.generate({
955 955
 				    bindto: "#chart6",
956 956
 				    data: {
@@ -963,7 +963,7 @@  discard block
 block discarded – undo
963 963
                     <a href="<?php print $globalURL; ?>/marine/statistics/time" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
964 964
                 </div>
965 965
             </div>
966
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
966
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
967 967
         </div>
968 968
 <?php
969 969
 		}
@@ -987,13 +987,13 @@  discard block
 block discarded – undo
987 987
 				print '<div id="chart8" class="chart" width="100%"></div><script>';
988 988
 				$year_data = '';
989 989
 				$year_cnt = '';
990
-				foreach($year_array as $year_item)
990
+				foreach ($year_array as $year_item)
991 991
 				{
992 992
 					$year_data .= '"'.$year_item['year_name'].'-'.$year_item['month_name'].'-01'.'",';
993 993
 					$year_cnt .= $year_item['date_count'].',';
994 994
 				}
995 995
 				$year_data = "['x',".substr($year_data, 0, -1)."]";
996
-				$year_cnt = "['trackers',".substr($year_cnt,0,-1)."]";
996
+				$year_cnt = "['trackers',".substr($year_cnt, 0, -1)."]";
997 997
 				print 'c3.generate({
998 998
 				    bindto: "#chart8",
999 999
 				    data: { x: "x",
@@ -1007,7 +1007,7 @@  discard block
 block discarded – undo
1007 1007
                 </div>
1008 1008
             </div>
1009 1009
             
1010
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
1010
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
1011 1011
             <div class="col-md-6">
1012 1012
                 <h2><?php echo _("Busiest Day in the last Month"); ?></h2>
1013 1013
 <?php
@@ -1017,13 +1017,13 @@  discard block
 block discarded – undo
1017 1017
 				print '<div id="chart9" class="chart" width="100%"></div><script>';
1018 1018
 				$month_data = '';
1019 1019
 				$month_cnt = '';
1020
-				foreach($month_array as $month_item)
1020
+				foreach ($month_array as $month_item)
1021 1021
 				{
1022 1022
 					$month_data .= '"'.$month_item['date_name'].'",';
1023 1023
 					$month_cnt .= $month_item['date_count'].',';
1024 1024
 				}
1025 1025
 				$month_data = "['x',".substr($month_data, 0, -1)."]";
1026
-				$month_cnt = "['trackers',".substr($month_cnt,0,-1)."]";
1026
+				$month_cnt = "['trackers',".substr($month_cnt, 0, -1)."]";
1027 1027
 				print 'c3.generate({
1028 1028
 				    bindto: "#chart9",
1029 1029
 				    data: { x: "x",
@@ -1036,7 +1036,7 @@  discard block
 block discarded – undo
1036 1036
                     <a href="<?php print $globalURL; ?>/tracker/statistics/month" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
1037 1037
                 </div>
1038 1038
             </div>
1039
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
1039
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
1040 1040
 
1041 1041
             <div class="col-md-6">
1042 1042
                 <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2>
@@ -1047,13 +1047,13 @@  discard block
 block discarded – undo
1047 1047
 				print '<div id="chart5" class="chart" width="100%"></div><script>';
1048 1048
 				$date_data = '';
1049 1049
 				$date_cnt = '';
1050
-				foreach($date_array as $date_item)
1050
+				foreach ($date_array as $date_item)
1051 1051
 				{
1052 1052
 					$date_data .= '"'.$date_item['date_name'].'",';
1053 1053
 					$date_cnt .= $date_item['date_count'].',';
1054 1054
 				}
1055 1055
 				$date_data = "['x',".substr($date_data, 0, -1)."]";
1056
-				$date_cnt = "['trackers',".substr($date_cnt,0,-1)."]";
1056
+				$date_cnt = "['trackers',".substr($date_cnt, 0, -1)."]";
1057 1057
 				print 'c3.generate({
1058 1058
 				    bindto: "#chart5",
1059 1059
 				    data: { x: "x",
@@ -1066,23 +1066,23 @@  discard block
 block discarded – undo
1066 1066
                     <a href="<?php print $globalURL; ?>/marine/statistics/date" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
1067 1067
                 </div>
1068 1068
             </div>
1069
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
1069
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
1070 1070
             <div class="col-md-6">
1071 1071
                 <h2><?php echo _("Busiest Time of the Day"); ?></h2>
1072 1072
 <?php
1073
-			$hour_array = $Tracker->countAllHours('hour',true);
1073
+			$hour_array = $Tracker->countAllHours('hour', true);
1074 1074
 			if (empty($hour_array)) print _("No data available");
1075 1075
 			else {
1076 1076
 				print '<div id="chart6" class="chart" width="100%"></div><script>';
1077 1077
 				$hour_data = '';
1078 1078
 				$hour_cnt = '';
1079
-				foreach($hour_array as $hour_item)
1079
+				foreach ($hour_array as $hour_item)
1080 1080
 				{
1081 1081
 					$hour_data .= '"'.$hour_item['hour_name'].':00",';
1082 1082
 					$hour_cnt .= $hour_item['hour_count'].',';
1083 1083
 				}
1084 1084
 				$hour_data = "[".substr($hour_data, 0, -1)."]";
1085
-				$hour_cnt = "['trackers',".substr($hour_cnt,0,-1)."]";
1085
+				$hour_cnt = "['trackers',".substr($hour_cnt, 0, -1)."]";
1086 1086
 				print 'c3.generate({
1087 1087
 				    bindto: "#chart6",
1088 1088
 				    data: {
@@ -1095,7 +1095,7 @@  discard block
 block discarded – undo
1095 1095
                     <a href="<?php print $globalURL; ?>/tracker/statistics/time" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
1096 1096
                 </div>
1097 1097
             </div>
1098
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
1098
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
1099 1099
         </div>
1100 1100
 <?php
1101 1101
 		}
@@ -1119,13 +1119,13 @@  discard block
 block discarded – undo
1119 1119
 				print '<div id="chart32" class="chart" width="100%"></div><script>';
1120 1120
 				$year_data = '';
1121 1121
 				$year_cnt = '';
1122
-				foreach($year_array as $year_item)
1122
+				foreach ($year_array as $year_item)
1123 1123
 				{
1124 1124
 					$year_data .= '"'.$year_item['year'].'-01-01",';
1125 1125
 					$year_cnt .= $year_item['count'].',';
1126 1126
 				}
1127 1127
 				$year_data = "['x',".substr($year_data, 0, -1)."]";
1128
-				$year_cnt = "['flights',".substr($year_cnt,0,-1)."]";
1128
+				$year_cnt = "['flights',".substr($year_cnt, 0, -1)."]";
1129 1129
 				print 'c3.generate({
1130 1130
 				    bindto: "#chart32",
1131 1131
 				    data: { x: "x",
@@ -1138,7 +1138,7 @@  discard block
 block discarded – undo
1138 1138
                     <a href="<?php print $globalURL; ?>/statistics/fatalities/year" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
1139 1139
                 </div>
1140 1140
             </div>
1141
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
1141
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
1142 1142
 
1143 1143
         <div class="row column">
1144 1144
             <div class="col-md-6">
@@ -1150,13 +1150,13 @@  discard block
 block discarded – undo
1150 1150
 				print '<div id="chart33" class="chart" width="100%"></div><script>';
1151 1151
 				$year_data = '';
1152 1152
 				$year_cnt = '';
1153
-				foreach($year_array as $year_item)
1153
+				foreach ($year_array as $year_item)
1154 1154
 				{
1155 1155
 					$year_data .= '"'.$year_item['year'].'-'.$year_item['month'].'-01",';
1156 1156
 					$year_cnt .= $year_item['count'].',';
1157 1157
 				}
1158 1158
 				$year_data = "['x',".substr($year_data, 0, -1)."]";
1159
-				$year_cnt = "['flights',".substr($year_cnt,0,-1)."]";
1159
+				$year_cnt = "['flights',".substr($year_cnt, 0, -1)."]";
1160 1160
 				print 'c3.generate({
1161 1161
 				    bindto: "#chart33",
1162 1162
 				    data: { x: "x",
@@ -1169,7 +1169,7 @@  discard block
 block discarded – undo
1169 1169
                     <a href="<?php print $globalURL; ?>/statistics/fatalities/month" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
1170 1170
                 </div>
1171 1171
             </div>
1172
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
1172
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
1173 1173
 <br/>
1174 1174
 <?php
1175 1175
 		}
@@ -1185,19 +1185,19 @@  discard block
 block discarded – undo
1185 1185
 			//$polar = $Stats->getStatsSource(date('Y-m-d'),'polar');
1186 1186
 			if ($year == '' && $month == '') {
1187 1187
 				if ($type == 'aircraft') {
1188
-					$polar = $Stats->getStatsSource('polar',date('Y'),date('m'),date('d'));
1188
+					$polar = $Stats->getStatsSource('polar', date('Y'), date('m'), date('d'));
1189 1189
 				} elseif ($type == 'marine') {
1190
-					$polar = $Stats->getStatsSource('polar_marine',date('Y'),date('m'),date('d'));
1190
+					$polar = $Stats->getStatsSource('polar_marine', date('Y'), date('m'), date('d'));
1191 1191
 				} elseif ($type == 'tracker') {
1192
-					$polar = $Stats->getStatsSource('polar_tracker',date('Y'),date('m'),date('d'));
1192
+					$polar = $Stats->getStatsSource('polar_tracker', date('Y'), date('m'), date('d'));
1193 1193
 				}
1194 1194
 			} else {
1195 1195
 				if ($type == 'aircraft') {
1196
-					$polar = $Stats->getStatsSource('polar',$year,$month);
1196
+					$polar = $Stats->getStatsSource('polar', $year, $month);
1197 1197
 				} elseif ($type == 'marine') {
1198
-					$polar = $Stats->getStatsSource('polar_marine',$year,$month);
1198
+					$polar = $Stats->getStatsSource('polar_marine', $year, $month);
1199 1199
 				} elseif ($type == 'tracker') {
1200
-					$polar = $Stats->getStatsSource('polar_tracker',$year,$month);
1200
+					$polar = $Stats->getStatsSource('polar_tracker', $year, $month);
1201 1201
 				}
1202 1202
 			}
1203 1203
 			if (!empty($polar)) {
@@ -1206,7 +1206,7 @@  discard block
 block discarded – undo
1206 1206
 					unset($polar_data);
1207 1207
 					$Spotter = new Spotter();
1208 1208
 					$data = json_decode($eachpolar['source_data']);
1209
-					foreach($data as $value => $key) {
1209
+					foreach ($data as $value => $key) {
1210 1210
 						$direction = $Spotter->parseDirection(($value*22.5));
1211 1211
 						$distance = $key;
1212 1212
 						$unit = 'km';
@@ -1226,7 +1226,7 @@  discard block
 block discarded – undo
1226 1226
 ?>
1227 1227
             <div class="col-md-6">
1228 1228
                 <h4><?php print $eachpolar['source_name']; ?></h4>
1229
-        	<div id="polar-<?php print str_replace(' ','_',strtolower($eachpolar['source_name'])); ?>" class="chart" width="100%"></div>
1229
+        	<div id="polar-<?php print str_replace(' ', '_', strtolower($eachpolar['source_name'])); ?>" class="chart" width="100%"></div>
1230 1230
         	<script>
1231 1231
         	    (function() {
1232 1232
         	    var margin = {top: 100, right: 100, bottom: 100, left: 100},
@@ -1250,7 +1250,7 @@  discard block
 block discarded – undo
1250 1250
 		      color: color,
1251 1251
 		      unit: '<?php echo $unit; ?>'
1252 1252
 		    };
1253
-		    RadarChart("#polar-<?php print str_replace(' ','_',strtolower($eachpolar['source_name'])); ?>", data, radarChartOptions);
1253
+		    RadarChart("#polar-<?php print str_replace(' ', '_', strtolower($eachpolar['source_name'])); ?>", data, radarChartOptions);
1254 1254
 		    })();
1255 1255
 		</script>
1256 1256
             </div>
@@ -1265,19 +1265,19 @@  discard block
 block discarded – undo
1265 1265
 			//$msg = $Stats->getStatsSource(date('Y-m-d'),'msg');
1266 1266
 			if ($year == '' && $month == '') {
1267 1267
 				if ($type == 'aircraft') {
1268
-					$msg = $Stats->getStatsSource('msg',date('Y'),date('m'),date('d'));
1268
+					$msg = $Stats->getStatsSource('msg', date('Y'), date('m'), date('d'));
1269 1269
 				} elseif ($type == 'marine') {
1270
-					$msg = $Stats->getStatsSource('msg_marine',date('Y'),date('m'),date('d'));
1270
+					$msg = $Stats->getStatsSource('msg_marine', date('Y'), date('m'), date('d'));
1271 1271
 				} elseif ($type == 'tracker') {
1272
-					$msg = $Stats->getStatsSource('msg_tracker',date('Y'),date('m'),date('d'));
1272
+					$msg = $Stats->getStatsSource('msg_tracker', date('Y'), date('m'), date('d'));
1273 1273
 				}
1274 1274
 			} else {
1275 1275
 				if ($type == 'aircraft') {
1276
-					$msg = $Stats->getStatsSource('msg',$year,$month);
1276
+					$msg = $Stats->getStatsSource('msg', $year, $month);
1277 1277
 				} elseif ($type == 'marine') {
1278
-					$msg = $Stats->getStatsSource('msg_marine',$year,$month);
1278
+					$msg = $Stats->getStatsSource('msg_marine', $year, $month);
1279 1279
 				} elseif ($type == 'tracker') {
1280
-					$msg = $Stats->getStatsSource('msg_tracker',$year,$month);
1280
+					$msg = $Stats->getStatsSource('msg_tracker', $year, $month);
1281 1281
 				}
1282 1282
 			}
1283 1283
 			if (!empty($msg)) {
@@ -1285,13 +1285,13 @@  discard block
 block discarded – undo
1285 1285
 				foreach ($msg as $eachmsg) {
1286 1286
 					//$eachmsg = $msg[0];
1287 1287
 					$data = $eachmsg['source_data'];
1288
-					if ($data > 500) $max = (round(($data+100)/100))*100;
1288
+					if ($data > 500) $max = (round(($data + 100)/100))*100;
1289 1289
 					else $max = 500;
1290 1290
 ?>
1291
-        	<div id="msg-<?php print str_replace(' ','_',strtolower($eachmsg['source_name'])); ?>" class="col-md-4"></div>
1291
+        	<div id="msg-<?php print str_replace(' ', '_', strtolower($eachmsg['source_name'])); ?>" class="col-md-4"></div>
1292 1292
         	<script>
1293 1293
 		      var g = new JustGage({
1294
-			    id: "msg-<?php print str_replace(' ','_',strtolower($eachmsg['source_name'])); ?>",
1294
+			    id: "msg-<?php print str_replace(' ', '_', strtolower($eachmsg['source_name'])); ?>",
1295 1295
 			    value: <?php echo $data; ?>,
1296 1296
 			    min: 0,
1297 1297
 			    max: <?php print $max; ?>,
@@ -1313,19 +1313,19 @@  discard block
 block discarded – undo
1313 1313
 		//$hist = $Stats->getStatsSource(date('Y-m-d'),'hist');
1314 1314
 			if ($year == '' && $month == '') {
1315 1315
 				if ($type == 'aircraft') {
1316
-					$hist = $Stats->getStatsSource('hist',date('Y'),date('m'),date('d'));
1316
+					$hist = $Stats->getStatsSource('hist', date('Y'), date('m'), date('d'));
1317 1317
 				} elseif ($type == 'marine') {
1318
-					$hist = $Stats->getStatsSource('hist_marine',date('Y'),date('m'),date('d'));
1318
+					$hist = $Stats->getStatsSource('hist_marine', date('Y'), date('m'), date('d'));
1319 1319
 				} elseif ($type == 'tracker') {
1320
-					$hist = $Stats->getStatsSource('hist_tracker',date('Y'),date('m'),date('d'));
1320
+					$hist = $Stats->getStatsSource('hist_tracker', date('Y'), date('m'), date('d'));
1321 1321
 				}
1322 1322
 			} else {
1323 1323
 				if ($type == 'aircraft') {
1324
-					$hist = $Stats->getStatsSource('hist',$year,$month);
1324
+					$hist = $Stats->getStatsSource('hist', $year, $month);
1325 1325
 				} elseif ($type == 'marine') {
1326
-					$hist = $Stats->getStatsSource('hist_marine',$year,$month);
1326
+					$hist = $Stats->getStatsSource('hist_marine', $year, $month);
1327 1327
 				} elseif ($type == 'tracker') {
1328
-					$hist = $Stats->getStatsSource('hist_tracker',$year,$month);
1328
+					$hist = $Stats->getStatsSource('hist_tracker', $year, $month);
1329 1329
 				}
1330 1330
 			}
1331 1331
 			foreach ($hist as $hists) {
@@ -1335,7 +1335,7 @@  discard block
 block discarded – undo
1335 1335
 				$source = $hists['source_name'];
1336 1336
 				$hist_array = json_decode($hists['source_data']);
1337 1337
 				$unit = 'km';
1338
-				foreach($hist_array as $distance => $nb)
1338
+				foreach ($hist_array as $distance => $nb)
1339 1339
 				{
1340 1340
 					if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) {
1341 1341
 						$distance = round($distance*0.539957);
@@ -1356,18 +1356,18 @@  discard block
 block discarded – undo
1356 1356
 				$nb_data = "['flights',".substr($nb_data, 0, -1)."]";
1357 1357
 ?>
1358 1358
             <div class="col-md-6">
1359
-                <h2><?php echo sprintf(_("Distance for %s"),$source); ?></h2>
1359
+                <h2><?php echo sprintf(_("Distance for %s"), $source); ?></h2>
1360 1360
 <?php
1361
-				print '<div id="charthist-'.str_replace(' ','_',strtolower($source)).'" class="chart" width="100%"></div><script>';
1361
+				print '<div id="charthist-'.str_replace(' ', '_', strtolower($source)).'" class="chart" width="100%"></div><script>';
1362 1362
 				print 'c3.generate({
1363
-				    bindto: "#charthist-'.str_replace(' ','_',strtolower($source)).'",
1363
+				    bindto: "#charthist-'.str_replace(' ', '_', strtolower($source)).'",
1364 1364
 				    data: { x: "x",
1365 1365
 				    columns: ['.$distance_data.','.$nb_data.'], types: { flights: "area"}, colors: { flights: "#1a3151"}},
1366 1366
 				    axis: { x: {label : { text: "Distance in '.$unit.'", position: "outer-right"}}, y: { label: "# of Flights"}},legend: { show: false }});';
1367 1367
 				print '</script>';
1368 1368
 ?>
1369 1369
     	    </div>
1370
-	    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
1370
+	    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
1371 1371
 <?php
1372 1372
 			}
1373 1373
 ?>
Please login to merge, or discard this patch.
table-output.php 1 patch
Spacing   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -4,8 +4,8 @@  discard block
 block discarded – undo
4 4
 
5 5
 require_once(dirname(__FILE__).'/require/class.Common.php');
6 6
 $Common = new Common();
7
-$showRouteStop = $Common->multiKeyExists($spotter_array,'route_stop');
8
-$showDuration = $Common->multiKeyExists($spotter_array,'duration');
7
+$showRouteStop = $Common->multiKeyExists($spotter_array, 'route_stop');
8
+$showDuration = $Common->multiKeyExists($spotter_array, 'duration');
9 9
 
10 10
 if (!isset($type)) $type = 'aircraft';
11 11
 
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
 	}
107 107
 	print '<th class="more"></th>';
108 108
 	print '</thead>';
109
-} else if (strtolower($current_page) == "upcoming"){
109
+} else if (strtolower($current_page) == "upcoming") {
110 110
 	print '<thead>';
111 111
 	if (!isset($globalNoAirlines) || $globalNoAirlines === FALSE) {
112 112
 		if ($_GET['sort'] == "airline_name_asc")
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
 	}
161 161
 	*/
162 162
 	print '</thead>';
163
-} else if (strtolower($current_page) == "acars-latest" || strtolower($current_page) == "acars-archive"){
163
+} else if (strtolower($current_page) == "acars-latest" || strtolower($current_page) == "acars-archive") {
164 164
 	print '<thead>';
165 165
 	print '<th class="aircraft_thumbnail"></th>';
166 166
 	print '<th class="logo">'._("Airline").'</th>';
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
 	print '</thead>';
198 198
 } else {
199 199
 
200
-	if ($hide_th_links === true){
200
+	if ($hide_th_links === true) {
201 201
 		print '<thead>';
202 202
 		print '<th class="aircraft_thumbnail"></th>';
203 203
 		if ($type == 'aircraft') {
@@ -454,7 +454,7 @@  discard block
 block discarded – undo
454 454
 }
455 455
 
456 456
 print '<tbody>'."\n";
457
-foreach($spotter_array as $spotter_item)
457
+foreach ($spotter_array as $spotter_item)
458 458
 {
459 459
 	if (isset($globalTimezone))
460 460
 	{
@@ -489,13 +489,13 @@  discard block
 block discarded – undo
489 489
 						$image_src = 'https://www.planespotters.net/Aviation_Photos/photo.show?id='.$planespotter_id;
490 490
 					}
491 491
 					if (isset($spotter_item['airline_name'])) {
492
-						print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['airline_name'].'" alt="'.$spotter_item['registration'].' - '.$spotter_item['airline_name'].'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Airline:").' '.$spotter_item['airline_name'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">&copy; '.$spotter_item['image_copyright'].'</div>';
492
+						print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['airline_name'].'" alt="'.$spotter_item['registration'].' - '.$spotter_item['airline_name'].'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Airline:").' '.$spotter_item['airline_name'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">&copy; '.$spotter_item['image_copyright'].'</div>';
493 493
 					} else {
494
-						print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '._("Not available").'" alt="'.$spotter_item['registration'].' - '._("Not available").'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Airline:").' '._("Not available").'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">&copy; '.$spotter_item['image_copyright'].'</div>';
494
+						print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '._("Not available").'" alt="'.$spotter_item['registration'].' - '._("Not available").'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Airline:").' '._("Not available").'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">&copy; '.$spotter_item['image_copyright'].'</div>';
495 495
 					}
496 496
 				} else {
497 497
 					if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') {
498
-						$image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']);
498
+						$image_thumbnail = preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']);
499 499
 					} else 	$image_thumbnail = $spotter_item['image_thumbnail'];
500 500
 					if (isset($spotter_item['airline_name'])) {
501 501
 						print '<img src="'.$image_thumbnail.'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['airline_name'].'" alt="'.$spotter_item['registration'].' - '.$spotter_item['airline_name'].'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Airline:").' '.$spotter_item['airline_name'].'" data-html="true" width="100px" />'."\n".'<div class="thumbnail-copyright">&copy; '.$spotter_item['image_copyright'].'</div>';
@@ -514,7 +514,7 @@  discard block
 block discarded – undo
514 514
 			{
515 515
 				print '<td class="aircraft_thumbnail">'."\n";
516 516
 				if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') {
517
-					$image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']);
517
+					$image_thumbnail = preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']);
518 518
 				} else 	$image_thumbnail = $spotter_item['image_thumbnail'];
519 519
 				if (isset($spotter_item['airline_name'])) {
520 520
 					print '<img src="'.$image_thumbnail.'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['mmsi'].'" alt="'.$spotter_item['mmsi'].'" data-content="'._("MMSI:").' '.$spotter_item['mmsi'].'" data-html="true" width="100px" />'."\n".'<div class="thumbnail-copyright">&copy; '.$spotter_item['image_copyright'].'</div>';
@@ -532,7 +532,7 @@  discard block
 block discarded – undo
532 532
 			{
533 533
 				print '<td class="aircraft_thumbnail">'."\n";
534 534
 				if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') {
535
-					$image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']);
535
+					$image_thumbnail = preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']);
536 536
 				} else 	$image_thumbnail = $spotter_item['image_thumbnail'];
537 537
 				print '<img src="'.$image_thumbnail.'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['ident'].'" alt="'.$spotter_item['type'].'" data-content="'._("Type:").' '.$spotter_item['type'].'" data-html="true" width="100px" />'."\n".'<div class="thumbnail-copyright">&copy; '.$spotter_item['image_copyright'].'</div>';
538 538
 				print '</td>'."\n";
@@ -576,7 +576,7 @@  discard block
 block discarded – undo
576 576
 				print '</td>'."\n";
577 577
 			}
578 578
 		}
579
-	} elseif(strtolower($current_page) != "currently" && strtolower($current_page) != "upcoming" && strtolower($current_page) != "acars-latest" && strtolower($current_page) != "acars-archive" && strtolower($current_page) != "accident-latest" && strtolower($current_page) != "incident-latest" && strtolower($current_page) != "accident-detailed" && strtolower($current_page) != "incident-detailed"){
579
+	} elseif (strtolower($current_page) != "currently" && strtolower($current_page) != "upcoming" && strtolower($current_page) != "acars-latest" && strtolower($current_page) != "acars-archive" && strtolower($current_page) != "accident-latest" && strtolower($current_page) != "incident-latest" && strtolower($current_page) != "accident-detailed" && strtolower($current_page) != "incident-detailed") {
580 580
 		if ($type == 'aircraft') {
581 581
 			if (!isset($spotter_item['squawk']) || $spotter_item['squawk'] == 0) {
582 582
 			    $spotter_item['squawk'] = '-';
@@ -593,17 +593,17 @@  discard block
 block discarded – undo
593 593
 						$image_src = 'https://www.planespotters.net/Aviation_Photos/photo.show?id='.$planespotter_id;
594 594
 					}
595 595
 					if (!isset($spotter_item['airline_name']) && isset($spotter_item['aircraft_name'])) {
596
-						print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '._("Not available").'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">&copy; '.$spotter_item['image_copyright'].'</div>';
596
+						print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '._("Not available").'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">&copy; '.$spotter_item['image_copyright'].'</div>';
597 597
 					} elseif (!isset($spotter_item['aircraft_name']) && isset($spotter_item['airline_name'])) {
598
-						print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '.$spotter_item['airline_name'].'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '.$spotter_item['airline_name'].'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '.$spotter_item['airline_name'].'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">&copy; '.$spotter_item['image_copyright'].'</div>';
598
+						print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '.$spotter_item['airline_name'].'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '.$spotter_item['airline_name'].'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '.$spotter_item['airline_name'].'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">&copy; '.$spotter_item['image_copyright'].'</div>';
599 599
 					} elseif (!isset($spotter_item['aircraft_name']) && !isset($spotter_item['airline_name'])) {
600
-						print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '._("Not available").'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">&copy; '.$spotter_item['image_copyright'].'</div>';
600
+						print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '._("Not available").'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">&copy; '.$spotter_item['image_copyright'].'</div>';
601 601
 					} else {
602
-						print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '.$spotter_item['airline_name'].'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '.$spotter_item['airline_name'].'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '.$spotter_item['airline_name'].'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">&copy; '.$spotter_item['image_copyright'].'</div>';
602
+						print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '.$spotter_item['airline_name'].'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '.$spotter_item['airline_name'].'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '.$spotter_item['airline_name'].'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">&copy; '.$spotter_item['image_copyright'].'</div>';
603 603
 					}
604 604
 				} else {
605 605
 					if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') {
606
-						$image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']);
606
+						$image_thumbnail = preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']);
607 607
 					} else 	$image_thumbnail = $spotter_item['image_thumbnail'];
608 608
 					if (!isset($spotter_item['airline_name']) && isset($spotter_item['aircraft_name'])) {
609 609
 						print '<a href="'.$globalURL.'/flightid/'.$spotter_item['spotter_id'].'"><img src="'.$image_thumbnail.'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '._("Not available").'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">&copy; '.$spotter_item['image_copyright'].'</div>';
@@ -636,7 +636,7 @@  discard block
 block discarded – undo
636 636
 			{
637 637
 				print '<td class="aircraft_thumbnail">'."\n";
638 638
 				if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') {
639
-					$image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']);
639
+					$image_thumbnail = preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']);
640 640
 				} else 	$image_thumbnail = $spotter_item['image_thumbnail'];
641 641
 				print '<img src="'.$image_thumbnail.'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['mmsi'].'" alt="'.$spotter_item['mmsi'].'" data-content="'._("MMSI:").' '.$spotter_item['mmsi'].'" data-html="true" width="100px" />'."\n".'<div class="thumbnail-copyright">&copy; '.$spotter_item['image_copyright'].'</div>';
642 642
 				print '</td>'."\n";
@@ -650,7 +650,7 @@  discard block
 block discarded – undo
650 650
 			{
651 651
 				print '<td class="aircraft_thumbnail">'."\n";
652 652
 				if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') {
653
-					$image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']);
653
+					$image_thumbnail = preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']);
654 654
 				} else 	$image_thumbnail = $spotter_item['image_thumbnail'];
655 655
 				print '<img src="'.$image_thumbnail.'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['ident'].'" alt="'.$spotter_item['type'].'" data-content="'._("Type:").' '.$spotter_item['type'].'" data-html="true" width="100px" />'."\n".'<div class="thumbnail-copyright">&copy; '.$spotter_item['image_copyright'].'</div>';
656 656
 				print '</td>'."\n";
@@ -759,7 +759,7 @@  discard block
 block discarded – undo
759 759
 		print '</td>'."\n";
760 760
 	}
761 761
 	// Aircraft type
762
-	if(strtolower($current_page) != "upcoming" && strtolower($current_page) != "acars-latest" && strtolower($current_page) != "acars-archive"){
762
+	if (strtolower($current_page) != "upcoming" && strtolower($current_page) != "acars-latest" && strtolower($current_page) != "acars-archive") {
763 763
 		print '<td class="type">'."\n";
764 764
 		if ($type == 'aircraft') {
765 765
 			if (!isset($spotter_item['aircraft_type']) && isset($spotter_item['aircraft_name'])) {
@@ -810,22 +810,22 @@  discard block
 block discarded – undo
810 810
 			}
811 811
 			if (isset($spotter_item['departure_airport_time']) && isset($spotter_item['real_departure_airport_time'])) {
812 812
 				if ($spotter_item['departure_airport_time'] > 2460) {
813
-					$departure_airport_time = date('H:m',$spotter_item['departure_airport_time']);
814
-				} else $departure_airport_time = substr($spotter_item['departure_airport_time'],0,-2).':'.substr($spotter_item['departure_airport_time'],-2);
813
+					$departure_airport_time = date('H:m', $spotter_item['departure_airport_time']);
814
+				} else $departure_airport_time = substr($spotter_item['departure_airport_time'], 0, -2).':'.substr($spotter_item['departure_airport_time'], -2);
815 815
 				if ($spotter_item['real_departure_airport_time'] > 2460) {
816
-					$real_departure_airport_time = date('H:m',$spotter_item['real_departure_airport_time']);
816
+					$real_departure_airport_time = date('H:m', $spotter_item['real_departure_airport_time']);
817 817
 				} else $real_departure_airport_time = $spotter_item['real_departure_airport_time'];
818 818
 				print '<br /><span class="airport_time">'.$departure_airport_time.' ('.$real_departure_airport_time.')</span>'."\n";
819 819
 			} elseif (isset($spotter_item['real_departure_airport_time']) && $spotter_item['real_departure_airport_time'] != 'NULL') {
820 820
 				if ($spotter_item['real_departure_airport_time'] > 2460) {
821
-					$real_departure_airport_time = date('H:m',$spotter_item['real_departure_airport_time']);
821
+					$real_departure_airport_time = date('H:m', $spotter_item['real_departure_airport_time']);
822 822
 				} else $real_departure_airport_time = $spotter_item['real_departure_airport_time'];
823 823
 				print '<br /><span class="airport_time">'.$real_departure_airport_time.'</span>'."\n";
824 824
 			} elseif (isset($spotter_item['departure_airport_time']) && $spotter_item['departure_airport_time'] != 'NULL') {
825 825
 				if ($spotter_item['departure_airport_time'] > 2460) {
826
-					$departure_airport_time = date('H:m',$spotter_item['departure_airport_time']);
826
+					$departure_airport_time = date('H:m', $spotter_item['departure_airport_time']);
827 827
 				} else {
828
-					$departure_airport_time = substr($spotter_item['departure_airport_time'],0,-2).':'.substr($spotter_item['departure_airport_time'],-2);
828
+					$departure_airport_time = substr($spotter_item['departure_airport_time'], 0, -2).':'.substr($spotter_item['departure_airport_time'], -2);
829 829
 				}
830 830
 				print '<br /><span class="airport_time">'.$departure_airport_time.'</span>'."\n";
831 831
 			}
@@ -840,7 +840,7 @@  discard block
 block discarded – undo
840 840
 						$latitude = $spotter_item['latitude'];
841 841
 						$longitude = $spotter_item['longitude'];
842 842
 					}
843
-					$distance = $Spotter->getAirportDistance($spotter_item['departure_airport'],$latitude,$longitude);
843
+					$distance = $Spotter->getAirportDistance($spotter_item['departure_airport'], $latitude, $longitude);
844 844
 				} else $distance = '';
845 845
 				if ($distance != '') {
846 846
 					if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) {
@@ -883,20 +883,20 @@  discard block
 block discarded – undo
883 883
 			}
884 884
 			if (isset($spotter_item['arrival_airport_time']) && isset($spotter_item['real_arrival_airport_time'])) {
885 885
 				if ($spotter_item['arrival_airport_time'] > 2460) {
886
-					$arrival_airport_time = date('H:m',$spotter_item['arrival_airport_time']);
886
+					$arrival_airport_time = date('H:m', $spotter_item['arrival_airport_time']);
887 887
 				} else $arrival_airport_time = $spotter_item['arrival_airport_time'];
888 888
 				if ($spotter_item['real_arrival_airport_time'] > 2460) {
889
-					$real_arrival_airport_time = date('H:m',$spotter_item['real_arrival_airport_time']);
889
+					$real_arrival_airport_time = date('H:m', $spotter_item['real_arrival_airport_time']);
890 890
 				} else $real_arrival_airport_time = $spotter_item['real_arrival_airport_time'];
891 891
 				print '<br /><span class="airport_time">'.$spotter_item['arrival_airport_time'].' ('.$spotter_item['real_arrival_airport_time'].')</span>'."\n";
892 892
 			} elseif (isset($spotter_item['real_arrival_airport_time'])) {
893 893
 				if ($spotter_item['real_arrival_airport_time'] > 2460) {
894
-					$real_arrival_airport_time = date('H:m',$spotter_item['real_arrival_airport_time']);
894
+					$real_arrival_airport_time = date('H:m', $spotter_item['real_arrival_airport_time']);
895 895
 				} else $real_arrival_airport_time = $spotter_item['real_arrival_airport_time'];
896 896
 				print '<br /><span class="airport_time">'.$real_arrival_airport_time.'</span>'."\n";
897 897
 			} elseif (isset($spotter_item['arrival_airport_time']) && $spotter_item['arrival_airport_time'] != 'NULL') {
898 898
 				if ($spotter_item['arrival_airport_time'] > 2460) {
899
-					$arrival_airport_time = date('H:m',$spotter_item['arrival_airport_time']);
899
+					$arrival_airport_time = date('H:m', $spotter_item['arrival_airport_time']);
900 900
 				} else $arrival_airport_time = $spotter_item['arrival_airport_time'];
901 901
 				print '<br /><span class="airport_time">'.$arrival_airport_time.'</span>'."\n";
902 902
 			}
@@ -909,7 +909,7 @@  discard block
 block discarded – undo
909 909
 						$latitude = $spotter_item['latitude'];
910 910
 						$longitude = $spotter_item['longitude'];
911 911
 					}
912
-					$distance = $Spotter->getAirportDistance($spotter_item['arrival_airport'],$latitude,$longitude);
912
+					$distance = $Spotter->getAirportDistance($spotter_item['arrival_airport'], $latitude, $longitude);
913 913
 				} else $distance = '';
914 914
 				if ($distance != '') {
915 915
 					if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) {
@@ -952,19 +952,19 @@  discard block
 block discarded – undo
952 952
 				print '<span class="mobile">-</span>'."\n";
953 953
 			} else {
954 954
 				if ((!isset($_COOKIE['unitdistance']) && ((isset($globalUnitDistance) && $globalUnitDistance == 'km') || !isset($globalUnitDistance))) || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'km')) {
955
-					print '<span class="nomobile">'.round($spotter_item['distance'],2).' km</span>'."\n";
956
-					print '<span class="mobile">'.round($spotter_item['distance'],2).' km</span><br />'."\n";
955
+					print '<span class="nomobile">'.round($spotter_item['distance'], 2).' km</span>'."\n";
956
+					print '<span class="mobile">'.round($spotter_item['distance'], 2).' km</span><br />'."\n";
957 957
 				} elseif ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) {
958
-					print '<span class="nomobile">'.round($spotter_item['distance']*0.621371,2).' mi</span>'."\n";
959
-					print '<span class="mobile">'.round($spotter_item['distance']*0.621371,2).' mi</span><br />'."\n";
958
+					print '<span class="nomobile">'.round($spotter_item['distance']*0.621371, 2).' mi</span>'."\n";
959
+					print '<span class="mobile">'.round($spotter_item['distance']*0.621371, 2).' mi</span><br />'."\n";
960 960
 				} elseif ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) {
961
-					print '<span class="nomobile">'.round($spotter_item['distance']*0.539957,2).' nm</span>'."\n";
962
-					print '<span class="mobile">'.round($spotter_item['distance']*0.539957,2).' nm</span><br />'."\n";
961
+					print '<span class="nomobile">'.round($spotter_item['distance']*0.539957, 2).' nm</span>'."\n";
962
+					print '<span class="mobile">'.round($spotter_item['distance']*0.539957, 2).' nm</span><br />'."\n";
963 963
 				}
964 964
 			}
965 965
 			print '</td>'."\n";
966 966
 		}
967
-		if(strtolower($current_page) != "upcoming"){
967
+		if (strtolower($current_page) != "upcoming") {
968 968
 			if ($type == 'aircraft') {
969 969
 				//if ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) {
970 970
 				if ((isset($globalUsePilot) && $globalUsePilot) || !isset($globalUsePilot) && ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || (isset($globalVAM) && $globalVAM))) {
@@ -1007,7 +1007,7 @@  discard block
 block discarded – undo
1007 1007
 		
1008 1008
 		if ($showRouteStop) {
1009 1009
 		// Route stop
1010
-			if(strtolower($current_page) != "upcoming"){
1010
+			if (strtolower($current_page) != "upcoming") {
1011 1011
 				print '<td class="route_stop">'."\n";
1012 1012
 				if (!isset($spotter_item['route_stop']) || $spotter_item['route_stop'] == '' || $spotter_item['route_stop'] == 'NULL') {
1013 1013
 					print '<span class="nomobile">-</span>'."\n";
@@ -1026,11 +1026,11 @@  discard block
 block discarded – undo
1026 1026
 		}
1027 1027
 		if ($showDuration) {
1028 1028
 		// Duration
1029
-			if(strtolower($current_page) != "upcoming"){
1029
+			if (strtolower($current_page) != "upcoming") {
1030 1030
 				print '<td class="duration">'."\n";
1031 1031
 				if (isset($spotter_item['duration'])) {
1032
-					print '<span class="nomobile">'.gmdate('H:i:s',$spotter_item['duration']).'</span>'."\n";
1033
-					print '<span class="mobile">'.gmdate('H:i:s',$spotter_item['duration']).'</span>'."\n";
1032
+					print '<span class="nomobile">'.gmdate('H:i:s', $spotter_item['duration']).'</span>'."\n";
1033
+					print '<span class="mobile">'.gmdate('H:i:s', $spotter_item['duration']).'</span>'."\n";
1034 1034
 				} else {
1035 1035
 					print '<span class="nomobile">-</span>'."\n";
1036 1036
 					print '<span class="mobile">-</span>'."\n";
@@ -1043,7 +1043,7 @@  discard block
 block discarded – undo
1043 1043
 	if (strtolower($current_page) == "acars-latest" || strtolower($current_page) == "acars-archive") {
1044 1044
 		if (isset($spotter_item['decode']) && $spotter_item['decode'] != '') {
1045 1045
 			print '<td class="message"><p>'."\n";
1046
-			print str_replace(array("\r\n", "\n", "\r"),'<br />',$spotter_item['message']);
1046
+			print str_replace(array("\r\n", "\n", "\r"), '<br />', $spotter_item['message']);
1047 1047
 			print '</p><p class="decode">';
1048 1048
 			$decode_array = json_decode($spotter_item['decode']);
1049 1049
 			foreach ($decode_array as $key => $value) {
@@ -1053,7 +1053,7 @@  discard block
 block discarded – undo
1053 1053
 			print '</td>'."\n";
1054 1054
 		} else {
1055 1055
 			print '<td class="message">'."\n";
1056
-			print str_replace(array("\r\n", "\n", "\r"),'<br />',$spotter_item['message']);
1056
+			print str_replace(array("\r\n", "\n", "\r"), '<br />', $spotter_item['message']);
1057 1057
 			print '</td>'."\n";
1058 1058
 		}
1059 1059
 	}
@@ -1078,7 +1078,7 @@  discard block
 block discarded – undo
1078 1078
 		}
1079 1079
 		print '</td>'."\n";
1080 1080
 		print '<td class="message">'."\n";
1081
-		print str_replace(array("\r\n", "\n", "\r"),'<br />',$spotter_item['message']);
1081
+		print str_replace(array("\r\n", "\n", "\r"), '<br />', $spotter_item['message']);
1082 1082
 		print '</td>'."\n";
1083 1083
 	}
1084 1084
 	if (strtolower($current_page) == "incident-latest" || strtolower($current_page) == "incident-detailed") {
@@ -1104,7 +1104,7 @@  discard block
 block discarded – undo
1104 1104
 		print '</td>'."\n";
1105 1105
 		*/
1106 1106
 		print '<td class="message">'."\n";
1107
-		print str_replace(array("\r\n", "\n", "\r"),'<br />',$spotter_item['message']);
1107
+		print str_replace(array("\r\n", "\n", "\r"), '<br />', $spotter_item['message']);
1108 1108
 		print '</td>'."\n";
1109 1109
 	}
1110 1110
 
Please login to merge, or discard this patch.
js/map.2d.js.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
2 2
 require_once('../require/settings.php');
3 3
 require_once('../require/class.Language.php'); 
4 4
 
5
-setcookie("MapFormat",'2d');
5
+setcookie("MapFormat", '2d');
6 6
 
7 7
 if (!isset($globalOpenWeatherMapKey)) $globalOpenWeatherMapKey = '';
8 8
 // Compressed GeoJson is used if true
@@ -20,10 +20,10 @@  discard block
 block discarded – undo
20 20
 	$lastupd = $_GET['archivespeed']*$archiveupdatetime;
21 21
 	if (isset($_GET['enddate']) && $_GET['enddate'] != '') $enddate = $_GET['enddate'];
22 22
 	else $enddate = time();
23
-	setcookie("archive_begin",$begindate);
24
-	setcookie("archive_end",$enddate);
25
-	setcookie("archive_update",$lastupd);
26
-	setcookie("archive_speed",$archivespeed);
23
+	setcookie("archive_begin", $begindate);
24
+	setcookie("archive_end", $enddate);
25
+	setcookie("archive_update", $lastupd);
26
+	setcookie("archive_speed", $archivespeed);
27 27
 ?>
28 28
 document.cookie =  'archive_begin=<?php print $begindate; ?>; expires=Thu, 2 Aug 2100 20:47:11 UTC; path=/';
29 29
 document.cookie =  'archive_end=<?php print $enddate; ?>; expires=Thu, 2 Aug 2100 20:47:11 UTC; path=/';
@@ -74,16 +74,16 @@  discard block
 block discarded – undo
74 74
 <?php
75 75
 	}
76 76
 	if (isset($_GET['ident'])) {
77
-		$ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING);
77
+		$ident = filter_input(INPUT_GET, 'ident', FILTER_SANITIZE_STRING);
78 78
 	}
79 79
 	if (isset($_GET['flightaware_id'])) {
80
-		$flightaware_id = filter_input(INPUT_GET,'flightaware_id',FILTER_SANITIZE_STRING);
80
+		$flightaware_id = filter_input(INPUT_GET, 'flightaware_id', FILTER_SANITIZE_STRING);
81 81
 	}
82 82
 	if (isset($_GET['latitude'])) {
83
-		$latitude = filter_input(INPUT_GET,'latitude',FILTER_SANITIZE_STRING);
83
+		$latitude = filter_input(INPUT_GET, 'latitude', FILTER_SANITIZE_STRING);
84 84
 	}
85 85
 	if (isset($_GET['longitude'])) {
86
-		$longitude = filter_input(INPUT_GET,'longitude',FILTER_SANITIZE_STRING);
86
+		$longitude = filter_input(INPUT_GET, 'longitude', FILTER_SANITIZE_STRING);
87 87
 	}
88 88
 ?>
89 89
 
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 	     || navigator.userAgent.match(/BlackBerry/i)
120 120
 	     || navigator.userAgent.match(/Windows Phone/i))
121 121
 	{
122
-		var zoom = <?php if (isset($globalLiveZoom)) print $globalLiveZoom-1; else print '8'; ?>;
122
+		var zoom = <?php if (isset($globalLiveZoom)) print $globalLiveZoom - 1; else print '8'; ?>;
123 123
 	} else {
124 124
 		var zoom = <?php if (isset($globalLiveZoom)) print $globalLiveZoom; else print '9'; ?>;
125 125
 	}
@@ -213,19 +213,19 @@  discard block
 block discarded – undo
213 213
 	map.addLayer(yandexLayer);
214 214
 <?php
215 215
 	} elseif ($MapType == 'Bing-Aerial') {
216
-		if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType','OpenStreetMap');
216
+		if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType', 'OpenStreetMap');
217 217
 ?>
218 218
 	var bingLayer = new L.tileLayer.bing({bingMapsKey: '<?php print $globalBingMapKey; ?>',imagerySet: 'Aerial'});
219 219
 	map.addLayer(bingLayer);
220 220
 <?php
221 221
 	} elseif ($MapType == 'Bing-Hybrid') {
222
-		if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType','OpenStreetMap');
222
+		if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType', 'OpenStreetMap');
223 223
 ?>
224 224
 	var bingLayer = new L.tileLayer.bing({bingMapsKey: '<?php print $globalBingMapKey; ?>',imagerySet: 'AerialWithLabels'});
225 225
 	map.addLayer(bingLayer);
226 226
 <?php
227 227
 	} elseif ($MapType == 'Bing-Road') {
228
-		if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType','OpenStreetMap');
228
+		if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType', 'OpenStreetMap');
229 229
 ?>
230 230
 	var bingLayer = new L.tileLayer.bing({bingMapsKey: '<?php print $globalBingMapKey; ?>',imagerySet: 'Road'});
231 231
 	map.addLayer(bingLayer);
Please login to merge, or discard this patch.
require/class.Accident.php 1 patch
Spacing   +54 added lines, -54 removed lines patch added patch discarded remove patch
@@ -29,20 +29,20 @@  discard block
 block discarded – undo
29 29
 	* @param String $date get data for a date
30 30
 	* @return Array Return Accidents data in array
31 31
 	*/
32
-	public function getAccidentData($limit = '',$type = '',$date = '') {
32
+	public function getAccidentData($limit = '', $type = '', $date = '') {
33 33
 		global $globalURL, $globalDBdriver;
34 34
 		$Image = new Image($this->db);
35 35
 		$Spotter = new Spotter($this->db);
36 36
 		$Translation = new Translation($this->db);
37
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
37
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
38 38
 		date_default_timezone_set('UTC');
39 39
 		$result = array();
40 40
 		$limit_query = '';
41 41
 		if ($limit != "")
42 42
 		{
43 43
 			$limit_array = explode(",", $limit);
44
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
45
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
44
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
45
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
46 46
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
47 47
 			{
48 48
 				$limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0];
@@ -51,29 +51,29 @@  discard block
 block discarded – undo
51 51
 
52 52
 		if ($type != '') {
53 53
 			if ($date != '') {
54
-				if (preg_match("/^[0-9]{4}-[0-9]{2}-[0-9]{2}$/",$date)) {
54
+				if (preg_match("/^[0-9]{4}-[0-9]{2}-[0-9]{2}$/", $date)) {
55 55
 					$query = "SELECT * FROM accidents WHERE accidents_id IN (SELECT max(accidents_id) FROM accidents WHERE type = :type AND date = :date GROUP BY registration) ORDER BY accidents.date DESC".$limit_query;
56 56
 					//$query = "SELECT accidents.registration, accidents.ident, accidents.date, accidents.url, accidents.country, accidents.place, accidents.title, accidents.fatalities, accidents.type, accidents.ident, accidents.aircraft_manufacturer, accidents.aircraft_name, accidents.airline_name, accidents.airline_icao, spotter_output.flightaware_id FROM accidents LEFT OUTER JOIN spotter_output ON accidents.registration = spotter_output.registration WHERE accidents_id IN (SELECT max(accidents_id) FROM accidents WHERE type = :type AND date = :date GROUP BY registration) ORDER BY accidents.date DESC".$limit_query;
57
-					$query_values = array(':type' => $type,':date' => $date);
58
-				} elseif (preg_match("/^[0-9]{4}-[0-9]{2}$/",$date)) {
57
+					$query_values = array(':type' => $type, ':date' => $date);
58
+				} elseif (preg_match("/^[0-9]{4}-[0-9]{2}$/", $date)) {
59 59
 					$query = "SELECT * FROM accidents WHERE accidents_id IN (SELECT max(accidents_id) FROM accidents WHERE type = :type AND date BETWEEN :dated AND :datef GROUP BY registration) ORDER BY accidents.date DESC".$limit_query;
60
-					$query_values = array(':type' => $type,':dated' => $date.'-01', ':datef' => $date.'-31');
61
-				} elseif (preg_match("/^[0-9]{4}$/",$date)) {
60
+					$query_values = array(':type' => $type, ':dated' => $date.'-01', ':datef' => $date.'-31');
61
+				} elseif (preg_match("/^[0-9]{4}$/", $date)) {
62 62
 					if ($globalDBdriver == 'mysql') {
63 63
 						$query = "SELECT * FROM accidents WHERE accidents_id IN (SELECT max(accidents_id) FROM accidents WHERE type = :type AND YEAR(date) = :date GROUP BY registration) ORDER BY accidents.date DESC".$limit_query;
64 64
 					} else {
65 65
 						$query = "SELECT * FROM accidents WHERE accidents_id IN (SELECT max(accidents_id) FROM accidents WHERE type = :type AND EXTRACT(YEAR FROM date) = :date GROUP BY registration) ORDER BY accidents.date DESC".$limit_query;
66 66
 					}
67
-					$query_values = array(':type' => $type,':date' => $date);
67
+					$query_values = array(':type' => $type, ':date' => $date);
68 68
 				} else {
69 69
 					$date = $date.'%';
70 70
 					if ($globalDBdriver == 'mysql') {
71 71
 						$query = "SELECT * FROM accidents WHERE accidents_id IN (SELECT max(accidents_id) FROM accidents WHERE type = :type AND DATE_FORMAT(date,'%Y-%m-%d') LIKE :date GROUP BY registration) ORDER BY accidents.date DESC".$limit_query;
72
-						$query_values = array(':type' => $type,':date' => $date);
72
+						$query_values = array(':type' => $type, ':date' => $date);
73 73
 					} else {
74 74
 						$query = "SELECT * FROM accidents WHERE accidents_id IN (SELECT max(accidents_id) FROM accidents WHERE type = :type AND to_char(date,'YYYY-MM-DD') LIKE :date GROUP BY registration) ORDER BY accidents.date DESC".$limit_query;
75 75
 						//$query = "SELECT accidents.registration, accidents.ident, accidents.date, accidents.url, accidents.country, accidents.place, accidents.title, accidents.fatalities, accidents.type, accidents.ident, accidents.aircraft_manufacturer, accidents.aircraft_name, accidents.airline_name, accidents.airline_icao, spotter_output.flightaware_id FROM accidents LEFT OUTER JOIN spotter_output ON accidents.registration = spotter_output.registration WHERE accidents_id IN (SELECT max(accidents_id) FROM accidents WHERE type = :type AND to_char(date,'YYYY-MM-DD') LIKE :date GROUP BY registration) ORDER BY accidents.date DESC".$limit_query;
76
-						$query_values = array(':type' => $type,':date' => $date);
76
+						$query_values = array(':type' => $type, ':date' => $date);
77 77
 					}
78 78
 				}
79 79
 			} else {
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 			}
84 84
 		} else {
85 85
 			if ($date != '') {
86
-				if (preg_match("/^[0-9]{4}-[0-9]{2}-[0-9]{2}$/",$date)) {
86
+				if (preg_match("/^[0-9]{4}-[0-9]{2}-[0-9]{2}$/", $date)) {
87 87
 					$query = "SELECT * FROM accidents WHERE accidents_id IN (SELECT max(accidents_id) FROM accidents WHERE date = :date GROUP BY registration) ORDER BY accidents.date DESC".$limit_query;
88 88
 					//$query = "SELECT accidents.registration, accidents.ident, accidents.date, accidents.url, accidents.country, accidents.place, accidents.title, accidents.fatalities, accidents.type, accidents.ident, accidents.aircraft_manufacturer, accidents.aircraft_name, accidents.airline_name, accidents.airline_icao, spotter_output.flightaware_id FROM accidents LEFT OUTER JOIN spotter_output ON accidents.registration = spotter_output.registration WHERE accidents_id IN (SELECT max(accidents_id) FROM accidents WHERE date = :date GROUP BY registration) ORDER BY accidents.date DESC".$limit_query;
89 89
 				} else {
@@ -102,19 +102,19 @@  discard block
 block discarded – undo
102 102
 		try {
103 103
 			$sth = $this->db->prepare($query);
104 104
 			$sth->execute($query_values);
105
-		} catch(PDOException $e) {
105
+		} catch (PDOException $e) {
106 106
 			echo "error : ".$e->getMessage();
107 107
 		}
108 108
 		$i = 0;
109 109
 		while ($row = $sth->fetch(PDO::FETCH_ASSOC)) {
110 110
 			//print_r($row);
111 111
 			//echo $row['flightaware_id'];
112
-			if (preg_match('/^[\w\-]+$/',$row['registration'])) {
112
+			if (preg_match('/^[\w\-]+$/', $row['registration'])) {
113 113
 				$data = array();
114 114
 				if ($row['registration'] != '') {
115 115
 					$image_array = $Image->getSpotterImage($row['registration']);
116
-					if (count($image_array) > 0) $data = array_merge($data,array('image' => $image_array[0]['image'],'image_thumbnail' => $image_array[0]['image_thumbnail'],'image_copyright' => $image_array[0]['image_copyright'],'image_source' => $image_array[0]['image_source'],'image_source_website' => $image_array[0]['image_source_website']));
117
-					else $data = array_merge($data,array('image' => '','image_thumbnail' => '','image_copyright' => '','image_source' => '','image_source_website' => ''));
116
+					if (count($image_array) > 0) $data = array_merge($data, array('image' => $image_array[0]['image'], 'image_thumbnail' => $image_array[0]['image_thumbnail'], 'image_copyright' => $image_array[0]['image_copyright'], 'image_source' => $image_array[0]['image_source'], 'image_source_website' => $image_array[0]['image_source_website']));
117
+					else $data = array_merge($data, array('image' => '', 'image_thumbnail' => '', 'image_copyright' => '', 'image_source' => '', 'image_source_website' => ''));
118 118
 					$aircraft_type = $Spotter->getAllAircraftTypeByRegistration($row['registration']);
119 119
 					$aircraft_info = $Spotter->getAllAircraftInfo($aircraft_type);
120 120
 					if (!empty($aircraft_info)) {
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 						$data['aircraft_name'] = $aircraft_info[0]['type'];
123 123
 						$data['aircraft_manufacturer'] = $aircraft_info[0]['manufacturer'];
124 124
 					} else {
125
-						$data = array_merge($data,array('aircraft_type' => 'NA'));
125
+						$data = array_merge($data, array('aircraft_type' => 'NA'));
126 126
 					}
127 127
 					$owner_data = $Spotter->getAircraftOwnerByRegistration($row['registration']);
128 128
 					if (!empty($owner_data)) {
@@ -130,18 +130,18 @@  discard block
 block discarded – undo
130 130
 						$data['aircraft_base'] = $owner_data['base'];
131 131
 						$data['aircraft_date_first_reg'] = $owner_data['date_first_reg'];
132 132
 					}
133
-				} else $data = array_merge($data,array('image' => '','image_thumbnail' => '','image_copyright' => '','image_source' => '','image_source_website' => ''));
133
+				} else $data = array_merge($data, array('image' => '', 'image_thumbnail' => '', 'image_copyright' => '', 'image_source' => '', 'image_source_website' => ''));
134 134
 				if ($row['registration'] == '') $row['registration'] = 'NA';
135 135
 				if ($row['ident'] == '') $row['ident'] = 'NA';
136
-				$identicao = $Spotter->getAllAirlineInfo(substr($row['ident'],0,3));
136
+				$identicao = $Spotter->getAllAirlineInfo(substr($row['ident'], 0, 3));
137 137
 				if (isset($identicao[0])) {
138
-					if (substr($row['ident'],0,2) == 'AF') {
139
-						if (filter_var(substr($row['ident'],2),FILTER_VALIDATE_INT,array("flags"=>FILTER_FLAG_ALLOW_OCTAL))) $icao = $row['ident'];
140
-						else $icao = 'AFR'.ltrim(substr($row['ident'],2),'0');
141
-					} else $icao = $identicao[0]['icao'].ltrim(substr($row['ident'],2),'0');
142
-					$data = array_merge($data,array('airline_icao' => $identicao[0]['icao'],'airline_name' => $identicao[0]['name']));
138
+					if (substr($row['ident'], 0, 2) == 'AF') {
139
+						if (filter_var(substr($row['ident'], 2), FILTER_VALIDATE_INT, array("flags"=>FILTER_FLAG_ALLOW_OCTAL))) $icao = $row['ident'];
140
+						else $icao = 'AFR'.ltrim(substr($row['ident'], 2), '0');
141
+					} else $icao = $identicao[0]['icao'].ltrim(substr($row['ident'], 2), '0');
142
+					$data = array_merge($data, array('airline_icao' => $identicao[0]['icao'], 'airline_name' => $identicao[0]['name']));
143 143
 				} else $icao = $row['ident'];
144
-				$icao = $Translation->checkTranslation($icao,false);
144
+				$icao = $Translation->checkTranslation($icao, false);
145 145
 				//$data = array_merge($data,array('registration' => $row['registration'], 'date' => $row['date'], 'ident' => $icao,'url' => $row['url']));
146 146
 				if ($row['airline_name'] != '' && !isset($data['airline_name'])) {
147 147
 					//echo 'Check airline info... for '.$row['airline_name'].' ';
@@ -150,11 +150,11 @@  discard block
 block discarded – undo
150 150
 					if (!empty($airline_info)) {
151 151
 						//echo 'data found !'."\n";
152 152
 						//print_r($airline_info);
153
-						$data = array_merge($data,$airline_info);
153
+						$data = array_merge($data, $airline_info);
154 154
 					} 
155 155
 					//else echo 'No data...'."\n";
156 156
 				}
157
-				$data = array_merge($row,$data);
157
+				$data = array_merge($row, $data);
158 158
 				if ($data['ident'] == null) $data['ident'] = $icao;
159 159
 				if ($data['title'] == null) {
160 160
 					$data['message'] = $row['type'].' of '.$row['registration'].' at '.$row['place'].','.$row['country'];
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
 		try {
191 191
 			$sth = $this->db->prepare($query);
192 192
 			$sth->execute();
193
-		} catch(PDOException $e) {
193
+		} catch (PDOException $e) {
194 194
 			echo "Error : ".$e->getMessage();
195 195
 		}
196 196
 		return $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
 		try {
211 211
 			$sth = $this->db->prepare($query);
212 212
 			$sth->execute();
213
-		} catch(PDOException $e) {
213
+		} catch (PDOException $e) {
214 214
 			echo "Error : ".$e->getMessage();
215 215
 		}
216 216
 		return $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -225,15 +225,15 @@  discard block
 block discarded – undo
225 225
 		if ($globalDebug) echo 'Import '.$file."\n";
226 226
 		$result = array();
227 227
 		if (file_exists($file)) {
228
-			if (($handle = fopen($file,'r')) !== FALSE) {
229
-				while (($data = fgetcsv($handle,2000,",")) !== FALSE) {
228
+			if (($handle = fopen($file, 'r')) !== FALSE) {
229
+				while (($data = fgetcsv($handle, 2000, ",")) !== FALSE) {
230 230
 					if (isset($data[1]) && $data[1] != '0000-00-00 00:00:00') {
231
-						$result[] = array('registration' => $data[0],'date' => strtotime($data[1]),'url' => $data[2],'country' => $data[3],'place' => $data[4],'title' => $data[5],'fatalities' => $data[6],'latitude' => $data[7],'longitude' => $data[8],'type' => $data[9],'ident' => $data[10],'aircraft_manufacturer' => $data[11],'aircraft_name' => $data[12],'operator' => $data[13],'source' => 'website_fam');
231
+						$result[] = array('registration' => $data[0], 'date' => strtotime($data[1]), 'url' => $data[2], 'country' => $data[3], 'place' => $data[4], 'title' => $data[5], 'fatalities' => $data[6], 'latitude' => $data[7], 'longitude' => $data[8], 'type' => $data[9], 'ident' => $data[10], 'aircraft_manufacturer' => $data[11], 'aircraft_name' => $data[12], 'operator' => $data[13], 'source' => 'website_fam');
232 232
 					}
233 233
 				}
234 234
 				fclose($handle);
235 235
 			}
236
-			if (!empty($result)) $this->add($result,true);
236
+			if (!empty($result)) $this->add($result, true);
237 237
 			elseif ($globalDebug) echo 'Nothing to import';
238 238
 		}
239 239
 	}
@@ -249,8 +249,8 @@  discard block
 block discarded – undo
249 249
 		$all_md5_new = array();
250 250
 		if (file_exists(dirname(__FILE__).'/../install/tmp/cr-all.md5')) {
251 251
 			if ($this->check_accidents_nb() > 0) {
252
-				if (($handle = fopen(dirname(__FILE__).'/../install/tmp/cr-all.md5','r')) !== FALSE) {
253
-					while (($data = fgetcsv($handle,2000,"\t")) !== FALSE) {
252
+				if (($handle = fopen(dirname(__FILE__).'/../install/tmp/cr-all.md5', 'r')) !== FALSE) {
253
+					while (($data = fgetcsv($handle, 2000, "\t")) !== FALSE) {
254 254
 						if (isset($data[1])) {
255 255
 							$year = $data[0];
256 256
 							$all_md5[$year] = $data[1];
@@ -260,10 +260,10 @@  discard block
 block discarded – undo
260 260
 				}
261 261
 			}
262 262
 		}
263
-		$Common->download('http://data.flightairmap.fr/data/cr/cr-all.md5',dirname(__FILE__).'/../install/tmp/cr-all.md5');
263
+		$Common->download('http://data.flightairmap.fr/data/cr/cr-all.md5', dirname(__FILE__).'/../install/tmp/cr-all.md5');
264 264
 		if (file_exists(dirname(__FILE__).'/../install/tmp/cr-all.md5')) {
265
-			if (($handle = fopen(dirname(__FILE__).'/../install/tmp/cr-all.md5','r')) !== FALSE) {
266
-				while (($data = fgetcsv($handle,2000,"\t")) !== FALSE) {
265
+			if (($handle = fopen(dirname(__FILE__).'/../install/tmp/cr-all.md5', 'r')) !== FALSE) {
266
+				while (($data = fgetcsv($handle, 2000, "\t")) !== FALSE) {
267 267
 					if (isset($data[1])) {
268 268
 						$year = $data[0];
269 269
 						$all_md5_new[$year] = $data[1];
@@ -272,10 +272,10 @@  discard block
 block discarded – undo
272 272
 				fclose($handle);
273 273
 			} elseif ($globalDebug) echo "Can't open ".dirname(__FILE__).'/../install/tmp/cr-all.md5';
274 274
 		} elseif ($globalDebug) echo 'Download cr-all.md5 failed. '.dirname(__FILE__).'/../install/tmp/cr-all.md5 not here.';
275
-		$result = $Common->arr_diff($all_md5_new,$all_md5);
275
+		$result = $Common->arr_diff($all_md5_new, $all_md5);
276 276
 		if (empty($result) && $globalDebug) echo 'Nothing to update';
277 277
 		foreach ($result as $file => $md5) {
278
-			$Common->download('http://data.flightairmap.fr/data/cr/'.$file,dirname(__FILE__).'/../install/tmp/'.$file);
278
+			$Common->download('http://data.flightairmap.fr/data/cr/'.$file, dirname(__FILE__).'/../install/tmp/'.$file);
279 279
 			if (file_exists(dirname(__FILE__).'/../install/tmp/'.$file)) $this->import(dirname(__FILE__).'/../install/tmp/'.$file);
280 280
 			elseif ($globalDebug) echo 'Download '.$file.' failed';
281 281
 		}
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
 	* Add data to DB
286 286
 	* @param Array $crash An array with accidents/incidents data
287 287
 	*/
288
-	public function add($crash,$new = false) {
288
+	public function add($crash, $new = false) {
289 289
 		global $globalTransaction, $globalDebug;
290 290
 		require_once('class.Connection.php');
291 291
 		require_once('class.Image.php');
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
 			$sthd->execute(array(':source' => $crash[0]['source']));
302 302
 		}
303 303
 		if ($globalTransaction) $Connection->db->beginTransaction();
304
-		$initial_array = array('ident' => null,'type' => 'accident','url' => null,'registration' => null, 'date' => null, 'place' => null,'country' => null, 'latitude' => null, 'longitude' => null, 'fatalities' => null, 'title' => '','source' => '','aircraft_manufacturer' => null,'aircraft_name' => null,'operator' => null);
304
+		$initial_array = array('ident' => null, 'type' => 'accident', 'url' => null, 'registration' => null, 'date' => null, 'place' => null, 'country' => null, 'latitude' => null, 'longitude' => null, 'fatalities' => null, 'title' => '', 'source' => '', 'aircraft_manufacturer' => null, 'aircraft_name' => null, 'operator' => null);
305 305
 		$query_check = 'SELECT COUNT(*) as nb FROM accidents WHERE registration = :registration AND date = :date AND type = :type AND source = :source';
306 306
 		$sth_check = $Connection->db->prepare($query_check);
307 307
 		$query = 'INSERT INTO accidents (aircraft_manufacturer,aircraft_name,ident,registration,date,url,country,place,title,fatalities,latitude,longitude,type,airline_name,source) VALUES (:aircraft_manufacturer,:aircraft_name,:ident,:registration,:date,:url,:country,:place,:title,:fatalities,:latitude,:longitude,:type,:airline_name,:source)';
@@ -314,15 +314,15 @@  discard block
 block discarded – undo
314 314
 				$cr = array_map(function($value) {
315 315
 					return $value === "" ? NULL : $value;
316 316
 				}, $cr);
317
-				if ($cr['date'] != '' && $cr['registration'] != null && $cr['registration'] != '' && $cr['registration'] != '?' && $cr['registration'] != '-' && strtolower($cr['registration']) != 'unknown' && $cr['date'] < time() && !preg_match('/\s/',$cr['registration'])) {
318
-					if (strpos($cr['registration'],'-') === FALSE) $cr['registration'] = $Spotter->convertAircraftRegistration($cr['registration']);
319
-					$query_check_values = array(':registration' => $cr['registration'],':date' => date('Y-m-d',$cr['date']),':type' => $cr['type'],':source' => $cr['source']);
317
+				if ($cr['date'] != '' && $cr['registration'] != null && $cr['registration'] != '' && $cr['registration'] != '?' && $cr['registration'] != '-' && strtolower($cr['registration']) != 'unknown' && $cr['date'] < time() && !preg_match('/\s/', $cr['registration'])) {
318
+					if (strpos($cr['registration'], '-') === FALSE) $cr['registration'] = $Spotter->convertAircraftRegistration($cr['registration']);
319
+					$query_check_values = array(':registration' => $cr['registration'], ':date' => date('Y-m-d', $cr['date']), ':type' => $cr['type'], ':source' => $cr['source']);
320 320
 					$sth_check->execute($query_check_values);
321 321
 					$result_check = $sth_check->fetch(PDO::FETCH_ASSOC);
322 322
 					if ($result_check['nb'] == 0) {
323
-						$query_values = array(':registration' => trim($cr['registration']),':date' => date('Y-m-d',$cr['date']),':url' => $cr['url'],':country' => $cr['country'],':place' => $cr['place'],':title' => $cr['title'],':fatalities' => $cr['fatalities'],':latitude' => $cr['latitude'],':longitude' => $cr['longitude'],':type' => $cr['type'],':source' => $cr['source'],':ident' => $cr['ident'],':aircraft_manufacturer' => $cr['aircraft_manufacturer'],':aircraft_name' => $cr['aircraft_name'],':airline_name' => $cr['operator']);
323
+						$query_values = array(':registration' => trim($cr['registration']), ':date' => date('Y-m-d', $cr['date']), ':url' => $cr['url'], ':country' => $cr['country'], ':place' => $cr['place'], ':title' => $cr['title'], ':fatalities' => $cr['fatalities'], ':latitude' => $cr['latitude'], ':longitude' => $cr['longitude'], ':type' => $cr['type'], ':source' => $cr['source'], ':ident' => $cr['ident'], ':aircraft_manufacturer' => $cr['aircraft_manufacturer'], ':aircraft_name' => $cr['aircraft_name'], ':airline_name' => $cr['operator']);
324 324
 						$sth->execute($query_values);
325
-						if ($cr['date'] > time()-(30*86400)) {
325
+						if ($cr['date'] > time() - (30*86400)) {
326 326
 							if (empty($Image->getSpotterImage($cr['registration']))) {
327 327
 								if ($globalDebug) echo "\t".'Get image for '.$cr['registration'].'...';
328 328
 								$Image->addSpotterImage($cr['registration']);
@@ -331,16 +331,16 @@  discard block
 block discarded – undo
331 331
 							// elseif ($globalDebug) echo 'Image already in DB'."\n";
332 332
 						}
333 333
 						if ($cr['title'] == '') $cr['title'] = $cr['registration'].' '.$cr['type'];
334
-						$Spotter->setHighlightFlightByRegistration($cr['registration'],$cr['title'],date('Y-m-d',$cr['date']));
334
+						$Spotter->setHighlightFlightByRegistration($cr['registration'], $cr['title'], date('Y-m-d', $cr['date']));
335 335
 					}
336 336
 				}
337
-				if ($globalTransaction && $j % 1000 == 0) {
337
+				if ($globalTransaction && $j%1000 == 0) {
338 338
 					$Connection->db->commit();
339 339
 					$Connection->db->beginTransaction();
340 340
 				}
341 341
 			}
342 342
 			if ($globalTransaction) $Connection->db->commit();
343
-		} catch(PDOException $e) {
343
+		} catch (PDOException $e) {
344 344
 			if ($globalTransaction) $Connection->db->rollBack();
345 345
 			echo $e->getMessage();
346 346
 		}
@@ -358,7 +358,7 @@  discard block
 block discarded – undo
358 358
 			$Connection = new Connection();
359 359
 			$sth = $Connection->db->prepare($query);
360 360
 			$sth->execute();
361
-		} catch(PDOException $e) {
361
+		} catch (PDOException $e) {
362 362
 			return "error : ".$e->getMessage();
363 363
 		}
364 364
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
 			$Connection = new Connection();
377 377
 			$sth = $Connection->db->prepare($query);
378 378
 			$sth->execute();
379
-		} catch(PDOException $e) {
379
+		} catch (PDOException $e) {
380 380
 			return "error : ".$e->getMessage();
381 381
 		}
382 382
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
@@ -391,7 +391,7 @@  discard block
 block discarded – undo
391 391
 			$Connection = new Connection();
392 392
 			$sth = $Connection->db->prepare($query);
393 393
 			$sth->execute();
394
-		} catch(PDOException $e) {
394
+		} catch (PDOException $e) {
395 395
 			return "error : ".$e->getMessage();
396 396
 		}
397 397
 	}
Please login to merge, or discard this patch.
require/class.SpotterLive.php 1 patch
Spacing   +127 added lines, -127 removed lines patch added patch discarded remove patch
@@ -16,62 +16,62 @@  discard block
 block discarded – undo
16 16
 	* @param Array $filter the filter
17 17
 	* @return Array the SQL part
18 18
 	*/
19
-	public function getFilter($filter = array(),$where = false,$and = false) {
19
+	public function getFilter($filter = array(), $where = false, $and = false) {
20 20
 		global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver;
21 21
 		$filters = array();
22 22
 		if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) {
23 23
 			if (isset($globalStatsFilters[$globalFilterName][0]['source'])) {
24 24
 				$filters = $globalStatsFilters[$globalFilterName];
25 25
 			} else {
26
-				$filter = array_merge($filter,$globalStatsFilters[$globalFilterName]);
26
+				$filter = array_merge($filter, $globalStatsFilters[$globalFilterName]);
27 27
 			}
28 28
 		}
29 29
 		if (isset($filter[0]['source'])) {
30
-			$filters = array_merge($filters,$filter);
30
+			$filters = array_merge($filters, $filter);
31 31
 		}
32
-		if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter);
32
+		if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter);
33 33
 		$filter_query_join = '';
34 34
 		$filter_query_where = '';
35
-		foreach($filters as $flt) {
35
+		foreach ($filters as $flt) {
36 36
 			if (isset($flt['airlines']) && !empty($flt['airlines'])) {
37 37
 				if ($flt['airlines'][0] != '') {
38 38
 					if (isset($flt['source'])) {
39
-						$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$flt['airlines'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) saf ON saf.flightaware_id = spotter_live.flightaware_id";
39
+						$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $flt['airlines'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) saf ON saf.flightaware_id = spotter_live.flightaware_id";
40 40
 					} else {
41
-						$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$flt['airlines'])."')) saf ON saf.flightaware_id = spotter_live.flightaware_id";
41
+						$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $flt['airlines'])."')) saf ON saf.flightaware_id = spotter_live.flightaware_id";
42 42
 					}
43 43
 				}
44 44
 			}
45 45
 			if (isset($flt['pilots_id']) && !empty($flt['pilots_id'])) {
46 46
 				if (isset($flt['source'])) {
47
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) spi ON spi.flightaware_id = spotter_live.flightaware_id";
47
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $flt['pilots_id'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) spi ON spi.flightaware_id = spotter_live.flightaware_id";
48 48
 				} else {
49
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."')) spi ON spi.flightaware_id = spotter_live.flightaware_id";
49
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $flt['pilots_id'])."')) spi ON spi.flightaware_id = spotter_live.flightaware_id";
50 50
 				}
51 51
 			}
52 52
 			if (isset($flt['idents']) && !empty($flt['idents'])) {
53 53
 				if (isset($flt['source'])) {
54
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.ident IN ('".implode("','",$flt['idents'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) spid ON spid.flightaware_id = spotter_live.flightaware_id";
54
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.ident IN ('".implode("','", $flt['idents'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) spid ON spid.flightaware_id = spotter_live.flightaware_id";
55 55
 				} else {
56
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.ident IN ('".implode("','",$flt['idents'])."')) spid ON spid.flightaware_id = spotter_live.flightaware_id";
56
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.ident IN ('".implode("','", $flt['idents'])."')) spid ON spid.flightaware_id = spotter_live.flightaware_id";
57 57
 				}
58 58
 			}
59 59
 			if (isset($flt['registrations']) && !empty($flt['registrations'])) {
60 60
 				if (isset($flt['source'])) {
61
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.registration IN ('".implode("','",$flt['registrations'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) sre ON sre.flightaware_id = spotter_live.flightaware_id";
61
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.registration IN ('".implode("','", $flt['registrations'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) sre ON sre.flightaware_id = spotter_live.flightaware_id";
62 62
 				} else {
63
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.registration IN ('".implode("','",$flt['registrations'])."')) sre ON sre.flightaware_id = spotter_live.flightaware_id";
63
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.registration IN ('".implode("','", $flt['registrations'])."')) sre ON sre.flightaware_id = spotter_live.flightaware_id";
64 64
 				}
65 65
 			}
66 66
 			if ((isset($flt['airlines']) && empty($flt['airlines']) && isset($flt['pilots_id']) && empty($flt['pilots_id']) && isset($flt['idents']) && empty($flt['idents'])) || (!isset($flt['airlines']) && !isset($flt['pilots_id']) && !isset($flt['idents']) && !isset($flt['registrations']))) {
67 67
 				if (isset($flt['source'])) {
68
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.format_source IN ('".implode("','",$flt['source'])."')) ssf ON ssf.flightaware_id = spotter_live.flightaware_id";
68
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.format_source IN ('".implode("','", $flt['source'])."')) ssf ON ssf.flightaware_id = spotter_live.flightaware_id";
69 69
 				}
70 70
 			}
71 71
 		}
72 72
 		if (isset($filter['airlines']) && !empty($filter['airlines'])) {
73 73
 			if ($filter['airlines'][0] != '') {
74
-				$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) sai ON sai.flightaware_id = spotter_live.flightaware_id";
74
+				$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) sai ON sai.flightaware_id = spotter_live.flightaware_id";
75 75
 			}
76 76
 		}
77 77
 		if (isset($filter['alliance']) && !empty($filter['alliance'])) {
@@ -81,10 +81,10 @@  discard block
 block discarded – undo
81 81
 			$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_live.flightaware_id ";
82 82
 		}
83 83
 		if (isset($filter['pilots_id']) && !empty($filter['pilots_id'])) {
84
-			$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$filter['pilots_id'])."')) sp ON sp.flightaware_id = spotter_live.flightaware_id";
84
+			$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $filter['pilots_id'])."')) sp ON sp.flightaware_id = spotter_live.flightaware_id";
85 85
 		}
86 86
 		if (isset($filter['source']) && !empty($filter['source'])) {
87
-			$filter_query_where .= " AND format_source IN ('".implode("','",$filter['source'])."')";
87
+			$filter_query_where .= " AND format_source IN ('".implode("','", $filter['source'])."')";
88 88
 		}
89 89
 		if (isset($filter['ident']) && !empty($filter['ident'])) {
90 90
 			$filter_query_where .= " AND ident = '".$filter['ident']."'";
@@ -113,15 +113,15 @@  discard block
 block discarded – undo
113 113
 					$filter_query_date .= " AND EXTRACT(DAY FROM spotter_output.date) = '".$filter['day']."'";
114 114
 				}
115 115
 			}
116
-			$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output".preg_replace('/^ AND/',' WHERE',$filter_query_date).") sd ON sd.flightaware_id = spotter_live.flightaware_id";
116
+			$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output".preg_replace('/^ AND/', ' WHERE', $filter_query_date).") sd ON sd.flightaware_id = spotter_live.flightaware_id";
117 117
 		}
118 118
 		if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
119
-			$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
119
+			$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')";
120 120
 		}
121 121
 		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
122 122
 		elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND';
123 123
 		if ($filter_query_where != '') {
124
-			$filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where);
124
+			$filter_query_where = preg_replace('/^ AND/', ' WHERE', $filter_query_where);
125 125
 		}
126 126
 		$filter_query = $filter_query_join.$filter_query_where;
127 127
 		return $filter_query;
@@ -144,8 +144,8 @@  discard block
 block discarded – undo
144 144
 		if ($limit != '')
145 145
 		{
146 146
 			$limit_array = explode(',', $limit);
147
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
148
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
147
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
148
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
149 149
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
150 150
 			{
151 151
 				$limit_query = ' LIMIT '.$limit_array[1].' OFFSET '.$limit_array[0];
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
 		} else {
170 170
 			$query  = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate".$filter_query.$orderby_query;
171 171
 		}
172
-		$spotter_array = $Spotter->getDataFromDB($query.$limit_query,array(),'',true);
172
+		$spotter_array = $Spotter->getDataFromDB($query.$limit_query, array(), '', true);
173 173
 
174 174
 		return $spotter_array;
175 175
 	}
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
 	{
185 185
 		global $globalDBdriver, $globalLiveInterval, $globalArchive;
186 186
 		date_default_timezone_set('UTC');
187
-		$filter_query = $this->getFilter($filter,true,true);
187
+		$filter_query = $this->getFilter($filter, true, true);
188 188
 		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
189 189
 		if ($globalDBdriver == 'mysql') {
190 190
 			if (isset($globalArchive) && $globalArchive === TRUE) {
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
 		try {
208 208
 			$sth = $this->db->prepare($query);
209 209
 			$sth->execute();
210
-		} catch(PDOException $e) {
210
+		} catch (PDOException $e) {
211 211
 			echo $e->getMessage();
212 212
 			die;
213 213
 		}
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
 		global $globalDBdriver, $globalLiveInterval, $globalArchive;
227 227
 		date_default_timezone_set('UTC');
228 228
 
229
-		$filter_query = $this->getFilter($filter,true,true);
229
+		$filter_query = $this->getFilter($filter, true, true);
230 230
 
231 231
 		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
232 232
 		if ($globalDBdriver == 'mysql') {
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
 				WHERE spotter_archive.latitude <> '0' AND spotter_archive.longitude <> '0' 
238 238
 				ORDER BY spotter_archive.flightaware_id, spotter_archive.date";
239 239
 				*/
240
-				$query  = 'SELECT * FROM (SELECT spotter_archive.ident, spotter_archive.flightaware_id, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, spotter_archive.date, spotter_archive.format_source 
240
+				$query = 'SELECT * FROM (SELECT spotter_archive.ident, spotter_archive.flightaware_id, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, spotter_archive.date, spotter_archive.format_source 
241 241
 				FROM spotter_archive INNER JOIN (SELECT flightaware_id FROM spotter_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= spotter_live.date) l ON l.flightaware_id = spotter_archive.flightaware_id 
242 242
 				UNION
243 243
 				SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
 				WHERE latitude <> '0' AND longitude <> '0' 
246 246
 				ORDER BY flightaware_id, date";
247 247
 			} else {
248
-				$query  = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
248
+				$query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
249 249
 				FROM spotter_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= spotter_live.date 
250 250
 				AND spotter_live.latitude <> '0' AND spotter_live.longitude <> '0' 
251 251
 				ORDER BY spotter_live.flightaware_id, spotter_live.date";
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
 				WHERE spotter_archive.latitude <> '0' AND spotter_archive.longitude <> '0' 
259 259
 				ORDER BY spotter_archive.flightaware_id, spotter_archive.date";
260 260
                                */
261
-				$query  = "SELECT * FROM (SELECT spotter_archive.ident, spotter_archive.flightaware_id, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, spotter_archive.date, spotter_archive.format_source 
261
+				$query = "SELECT * FROM (SELECT spotter_archive.ident, spotter_archive.flightaware_id, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, spotter_archive.date, spotter_archive.format_source 
262 262
 				FROM spotter_archive INNER JOIN (SELECT flightaware_id FROM spotter_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= spotter_live.date) l ON l.flightaware_id = spotter_archive.flightaware_id 
263 263
 				UNION
264 264
 				SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
 				ORDER BY flightaware_id, date";
269 269
 				//AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".round($globalLiveInterval*1000)." SECONDS' <= spotter_archive.date
270 270
 			} else {
271
-				$query  = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
271
+				$query = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
272 272
 				FROM spotter_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= spotter_live.date
273 273
 				AND spotter_live.latitude <> '0' AND spotter_live.longitude <> '0' 
274 274
 				ORDER BY spotter_live.flightaware_id, spotter_live.date";
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
     		try {
278 278
 			$sth = $this->db->prepare($query);
279 279
 			$sth->execute();
280
-		} catch(PDOException $e) {
280
+		} catch (PDOException $e) {
281 281
 			echo $e->getMessage();
282 282
 			die;
283 283
 		}
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
 	public function getLiveSpotterCount($filter = array())
295 295
 	{
296 296
 		global $globalDBdriver, $globalLiveInterval;
297
-		$filter_query = $this->getFilter($filter,true,true);
297
+		$filter_query = $this->getFilter($filter, true, true);
298 298
 
299 299
 		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
300 300
 		if ($globalDBdriver == 'mysql') {
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
 		try {
308 308
 			$sth = $this->db->prepare($query);
309 309
 			$sth->execute();
310
-		} catch(PDOException $e) {
310
+		} catch (PDOException $e) {
311 311
 			echo $e->getMessage();
312 312
 			die;
313 313
 		}
@@ -330,10 +330,10 @@  discard block
 block discarded – undo
330 330
 		$filter_query = $this->getFilter($filter);
331 331
 
332 332
 		if (is_array($coord)) {
333
-			$minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
334
-			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
335
-			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
336
-			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
333
+			$minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
334
+			$minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
335
+			$maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
336
+			$maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
337 337
 		} else return array();
338 338
 		if ($globalDBdriver == 'mysql') {
339 339
 			$query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate AND spotter_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND spotter_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.' GROUP BY spotter_live.flightaware_id'.$filter_query;
@@ -356,23 +356,23 @@  discard block
 block discarded – undo
356 356
 		global $globalDBdriver, $globalLiveInterval, $globalArchive;
357 357
 		$Spotter = new Spotter($this->db);
358 358
 		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
359
-		$filter_query = $this->getFilter($filter,true,true);
359
+		$filter_query = $this->getFilter($filter, true, true);
360 360
 
361 361
 		if (is_array($coord)) {
362
-			$minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
363
-			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
364
-			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
365
-			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
362
+			$minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
363
+			$minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
364
+			$maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
365
+			$maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
366 366
 		} else return array();
367 367
 		if ($globalDBdriver == 'mysql') {
368 368
 			if (isset($globalArchive) && $globalArchive === TRUE) {
369
-				$query  = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
369
+				$query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
370 370
 				FROM spotter_live 
371 371
 				'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= spotter_live.date 
372 372
 				AND spotter_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND spotter_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.'
373 373
 				AND spotter_live.latitude <> 0 AND spotter_live.longitude <> 0';
374 374
 			} else {
375
-				$query  = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
375
+				$query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
376 376
 				FROM spotter_live 
377 377
 				INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate 
378 378
 				    FROM spotter_live l 
@@ -384,14 +384,14 @@  discard block
 block discarded – undo
384 384
 			}
385 385
 		} else {
386 386
 			if (isset($globalArchive) && $globalArchive === TRUE) {
387
-				$query  = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
387
+				$query = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
388 388
 				FROM spotter_live 
389 389
 				".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= spotter_live.date 
390 390
 				AND spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." 
391 391
 				AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong." 
392 392
 				AND spotter_live.latitude <> '0' AND spotter_live.longitude <> '0'";
393 393
 			} else {
394
-				$query  = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
394
+				$query = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
395 395
 				FROM spotter_live 
396 396
 				INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate 
397 397
 				    FROM spotter_live l 
@@ -406,7 +406,7 @@  discard block
 block discarded – undo
406 406
 		try {
407 407
 			$sth = $this->db->prepare($query);
408 408
 			$sth->execute();
409
-		} catch(PDOException $e) {
409
+		} catch (PDOException $e) {
410 410
 			echo $e->getMessage();
411 411
 			die;
412 412
 		}
@@ -455,7 +455,7 @@  discard block
 block discarded – undo
455 455
                 if ($interval == '1m')
456 456
                 {
457 457
                     $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';
458
-                } else if ($interval == '15m'){
458
+                } else if ($interval == '15m') {
459 459
                     $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= spotter_live.date ';
460 460
                 } 
461 461
             }
@@ -463,14 +463,14 @@  discard block
 block discarded – undo
463 463
          $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';   
464 464
         }
465 465
 
466
-                $query  = "SELECT spotter_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_live 
466
+                $query = "SELECT spotter_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_live 
467 467
                    WHERE spotter_live.latitude <> '' 
468 468
                                    AND spotter_live.longitude <> '' 
469 469
                    ".$additional_query."
470 470
                    HAVING distance < :radius  
471 471
                                    ORDER BY distance";
472 472
 
473
-                $spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius));
473
+                $spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng, ':radius' => $radius));
474 474
 
475 475
                 return $spotter_array;
476 476
         }
@@ -488,9 +488,9 @@  discard block
 block discarded – undo
488 488
 		date_default_timezone_set('UTC');
489 489
 
490 490
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
491
-                $query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
491
+                $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
492 492
 
493
-		$spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident),'',true);
493
+		$spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident), '', true);
494 494
 
495 495
 		return $spotter_array;
496 496
 	}
@@ -501,16 +501,16 @@  discard block
 block discarded – undo
501 501
 	* @return Array the spotter information
502 502
 	*
503 503
 	*/
504
-	public function getDateLiveSpotterDataByIdent($ident,$date)
504
+	public function getDateLiveSpotterDataByIdent($ident, $date)
505 505
 	{
506 506
 		$Spotter = new Spotter($this->db);
507 507
 		date_default_timezone_set('UTC');
508 508
 
509 509
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
510
-                $query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
510
+                $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
511 511
 
512
-                $date = date('c',$date);
513
-		$spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident,':date' => $date));
512
+                $date = date('c', $date);
513
+		$spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident, ':date' => $date));
514 514
 
515 515
 		return $spotter_array;
516 516
 	}
@@ -526,8 +526,8 @@  discard block
 block discarded – undo
526 526
 		$Spotter = new Spotter($this->db);
527 527
 		date_default_timezone_set('UTC');
528 528
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
529
-		$query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
530
-		$spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id),'',true);
529
+		$query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
530
+		$spotter_array = $Spotter->getDataFromDB($query, array(':id' => $id), '', true);
531 531
 		return $spotter_array;
532 532
 	}
533 533
 
@@ -537,15 +537,15 @@  discard block
 block discarded – undo
537 537
 	* @return Array the spotter information
538 538
 	*
539 539
 	*/
540
-	public function getDateLiveSpotterDataById($id,$date)
540
+	public function getDateLiveSpotterDataById($id, $date)
541 541
 	{
542 542
 		$Spotter = new Spotter($this->db);
543 543
 		date_default_timezone_set('UTC');
544 544
 
545 545
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
546
-		$query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
547
-		$date = date('c',$date);
548
-		$spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id,':date' => $date),'',true);
546
+		$query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
547
+		$date = date('c', $date);
548
+		$spotter_array = $Spotter->getDataFromDB($query, array(':id' => $id, ':date' => $date), '', true);
549 549
 		return $spotter_array;
550 550
 	}
551 551
 
@@ -561,13 +561,13 @@  discard block
 block discarded – undo
561 561
 		date_default_timezone_set('UTC');
562 562
 
563 563
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
564
-                $query  = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident';
564
+                $query = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident';
565 565
 
566 566
     		try {
567 567
 			
568 568
 			$sth = $this->db->prepare($query);
569 569
 			$sth->execute(array(':ident' => $ident));
570
-		} catch(PDOException $e) {
570
+		} catch (PDOException $e) {
571 571
 			echo $e->getMessage();
572 572
 			die;
573 573
 		}
@@ -582,7 +582,7 @@  discard block
 block discarded – undo
582 582
 	* @return Array the spotter information
583 583
 	*
584 584
 	*/
585
-	public function getAllLiveSpotterDataById($id,$liveinterval = false)
585
+	public function getAllLiveSpotterDataById($id, $liveinterval = false)
586 586
 	{
587 587
 		global $globalDBdriver, $globalLiveInterval;
588 588
 		date_default_timezone_set('UTC');
@@ -601,7 +601,7 @@  discard block
 block discarded – undo
601 601
 		try {
602 602
 			$sth = $this->db->prepare($query);
603 603
 			$sth->execute(array(':id' => $id));
604
-		} catch(PDOException $e) {
604
+		} catch (PDOException $e) {
605 605
 			echo $e->getMessage();
606 606
 			die;
607 607
 		}
@@ -619,12 +619,12 @@  discard block
 block discarded – undo
619 619
 	{
620 620
 		date_default_timezone_set('UTC');
621 621
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
622
-		$query  = self::$global_query.' WHERE spotter_live.ident = :ident';
622
+		$query = self::$global_query.' WHERE spotter_live.ident = :ident';
623 623
     		try {
624 624
 			
625 625
 			$sth = $this->db->prepare($query);
626 626
 			$sth->execute(array(':ident' => $ident));
627
-		} catch(PDOException $e) {
627
+		} catch (PDOException $e) {
628 628
 			echo $e->getMessage();
629 629
 			die;
630 630
 		}
@@ -654,7 +654,7 @@  discard block
 block discarded – undo
654 654
 			
655 655
 			$sth = $this->db->prepare($query);
656 656
 			$sth->execute();
657
-		} catch(PDOException $e) {
657
+		} catch (PDOException $e) {
658 658
 			return "error";
659 659
 		}
660 660
 
@@ -677,14 +677,14 @@  discard block
 block discarded – undo
677 677
 				
678 678
 				$sth = $this->db->prepare($query);
679 679
 				$sth->execute();
680
-			} catch(PDOException $e) {
680
+			} catch (PDOException $e) {
681 681
 				return "error";
682 682
 			}
683 683
 			$query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN (';
684 684
                         $i = 0;
685
-                        $j =0;
685
+                        $j = 0;
686 686
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
687
-			foreach($all as $row)
687
+			foreach ($all as $row)
688 688
 			{
689 689
 				$i++;
690 690
 				$j++;
@@ -692,9 +692,9 @@  discard block
 block discarded – undo
692 692
 					if ($globalDebug) echo ".";
693 693
 				    	try {
694 694
 						
695
-						$sth = $this->db->prepare(substr($query_delete,0,-1).")");
695
+						$sth = $this->db->prepare(substr($query_delete, 0, -1).")");
696 696
 						$sth->execute();
697
-					} catch(PDOException $e) {
697
+					} catch (PDOException $e) {
698 698
 						return "error";
699 699
 					}
700 700
                                 	$query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN (';
@@ -705,9 +705,9 @@  discard block
 block discarded – undo
705 705
 			if ($i > 0) {
706 706
     				try {
707 707
 					
708
-					$sth = $this->db->prepare(substr($query_delete,0,-1).")");
708
+					$sth = $this->db->prepare(substr($query_delete, 0, -1).")");
709 709
 					$sth->execute();
710
-				} catch(PDOException $e) {
710
+				} catch (PDOException $e) {
711 711
 					return "error";
712 712
 				}
713 713
 			}
@@ -720,7 +720,7 @@  discard block
 block discarded – undo
720 720
 				
721 721
 				$sth = $this->db->prepare($query);
722 722
 				$sth->execute();
723
-			} catch(PDOException $e) {
723
+			} catch (PDOException $e) {
724 724
 				return "error";
725 725
 			}
726 726
 /*			$query_delete = "DELETE FROM spotter_live WHERE flightaware_id IN (";
@@ -768,13 +768,13 @@  discard block
 block discarded – undo
768 768
 	public function deleteLiveSpotterDataByIdent($ident)
769 769
 	{
770 770
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
771
-		$query  = 'DELETE FROM spotter_live WHERE ident = :ident';
771
+		$query = 'DELETE FROM spotter_live WHERE ident = :ident';
772 772
         
773 773
     		try {
774 774
 			
775 775
 			$sth = $this->db->prepare($query);
776 776
 			$sth->execute(array(':ident' => $ident));
777
-		} catch(PDOException $e) {
777
+		} catch (PDOException $e) {
778 778
 			return "error";
779 779
 		}
780 780
 
@@ -790,13 +790,13 @@  discard block
 block discarded – undo
790 790
 	public function deleteLiveSpotterDataById($id)
791 791
 	{
792 792
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
793
-		$query  = 'DELETE FROM spotter_live WHERE flightaware_id = :id';
793
+		$query = 'DELETE FROM spotter_live WHERE flightaware_id = :id';
794 794
         
795 795
     		try {
796 796
 			
797 797
 			$sth = $this->db->prepare($query);
798 798
 			$sth->execute(array(':id' => $id));
799
-		} catch(PDOException $e) {
799
+		} catch (PDOException $e) {
800 800
 			return "error";
801 801
 		}
802 802
 
@@ -814,13 +814,13 @@  discard block
 block discarded – undo
814 814
 	{
815 815
 		global $globalDBdriver, $globalTimezone;
816 816
 		if ($globalDBdriver == 'mysql') {
817
-			$query  = 'SELECT spotter_live.ident FROM spotter_live 
817
+			$query = 'SELECT spotter_live.ident FROM spotter_live 
818 818
 				WHERE spotter_live.ident = :ident 
819 819
 				AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) 
820 820
 				AND spotter_live.date < UTC_TIMESTAMP()';
821 821
 			$query_data = array(':ident' => $ident);
822 822
 		} else {
823
-			$query  = "SELECT spotter_live.ident FROM spotter_live 
823
+			$query = "SELECT spotter_live.ident FROM spotter_live 
824 824
 				WHERE spotter_live.ident = :ident 
825 825
 				AND spotter_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS'
826 826
 				AND spotter_live.date < now() AT TIME ZONE 'UTC'";
@@ -829,8 +829,8 @@  discard block
 block discarded – undo
829 829
 		
830 830
 		$sth = $this->db->prepare($query);
831 831
 		$sth->execute($query_data);
832
-		$ident_result='';
833
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
832
+		$ident_result = '';
833
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
834 834
 		{
835 835
 			$ident_result = $row['ident'];
836 836
 		}
@@ -847,13 +847,13 @@  discard block
 block discarded – undo
847 847
 	{
848 848
 		global $globalDBdriver, $globalTimezone;
849 849
 		if ($globalDBdriver == 'mysql') {
850
-			$query  = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
850
+			$query = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
851 851
 				WHERE spotter_live.ident = :ident 
852 852
 				AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE)'; 
853 853
 //				AND spotter_live.date < UTC_TIMESTAMP()";
854 854
 			$query_data = array(':ident' => $ident);
855 855
 		} else {
856
-			$query  = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
856
+			$query = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
857 857
 				WHERE spotter_live.ident = :ident 
858 858
 				AND spotter_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '30 MINUTES'";
859 859
 //				AND spotter_live.date < now() AT TIME ZONE 'UTC'";
@@ -862,8 +862,8 @@  discard block
 block discarded – undo
862 862
 		
863 863
 		$sth = $this->db->prepare($query);
864 864
 		$sth->execute($query_data);
865
-		$ident_result='';
866
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
865
+		$ident_result = '';
866
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
867 867
 		{
868 868
 			$ident_result = $row['flightaware_id'];
869 869
 		}
@@ -880,13 +880,13 @@  discard block
 block discarded – undo
880 880
 	{
881 881
 		global $globalDBdriver, $globalTimezone;
882 882
 		if ($globalDBdriver == 'mysql') {
883
-			$query  = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
883
+			$query = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
884 884
 				WHERE spotter_live.flightaware_id = :id 
885 885
 				AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 10 HOUR)'; 
886 886
 //				AND spotter_live.date < UTC_TIMESTAMP()";
887 887
 			$query_data = array(':id' => $id);
888 888
 		} else {
889
-			$query  = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
889
+			$query = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
890 890
 				WHERE spotter_live.flightaware_id = :id 
891 891
 				AND spotter_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '10 HOUR'";
892 892
 //				AND spotter_live.date < now() AT TIME ZONE 'UTC'";
@@ -895,8 +895,8 @@  discard block
 block discarded – undo
895 895
 		
896 896
 		$sth = $this->db->prepare($query);
897 897
 		$sth->execute($query_data);
898
-		$ident_result='';
899
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
898
+		$ident_result = '';
899
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
900 900
 		{
901 901
 			$ident_result = $row['flightaware_id'];
902 902
 		}
@@ -913,13 +913,13 @@  discard block
 block discarded – undo
913 913
 	{
914 914
 		global $globalDBdriver, $globalTimezone;
915 915
 		if ($globalDBdriver == 'mysql') {
916
-			$query  = 'SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live 
916
+			$query = 'SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live 
917 917
 				WHERE spotter_live.ModeS = :modes 
918 918
 				AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE)'; 
919 919
 //				AND spotter_live.date < UTC_TIMESTAMP()";
920 920
 			$query_data = array(':modes' => $modes);
921 921
 		} else {
922
-			$query  = "SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live 
922
+			$query = "SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live 
923 923
 				WHERE spotter_live.ModeS = :modes 
924 924
 				AND spotter_live.date >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '30 MINUTE'";
925 925
 //			//	AND spotter_live.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC'";
@@ -928,8 +928,8 @@  discard block
 block discarded – undo
928 928
 		
929 929
 		$sth = $this->db->prepare($query);
930 930
 		$sth->execute($query_data);
931
-		$ident_result='';
932
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
931
+		$ident_result = '';
932
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
933 933
 		{
934 934
 			//$ident_result = $row['spotter_live_id'];
935 935
 			$ident_result = $row['flightaware_id'];
@@ -948,7 +948,7 @@  discard block
 block discarded – undo
948 948
 	* @return String success or false
949 949
 	*
950 950
 	*/
951
-	public function addLiveSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $altitude_real = '',$heading = '', $groundspeed = '', $date = '',$departure_airport_time = '', $arrival_airport_time = '', $squawk = '', $route_stop = '', $ModeS = '', $putinarchive = false,$registration = '',$pilot_id = '', $pilot_name = '', $verticalrate = '', $noarchive = false, $ground = false,$format_source = '', $source_name = '', $over_country = '')
951
+	public function addLiveSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $altitude_real = '', $heading = '', $groundspeed = '', $date = '', $departure_airport_time = '', $arrival_airport_time = '', $squawk = '', $route_stop = '', $ModeS = '', $putinarchive = false, $registration = '', $pilot_id = '', $pilot_name = '', $verticalrate = '', $noarchive = false, $ground = false, $format_source = '', $source_name = '', $over_country = '')
952 952
 	{
953 953
 		global $globalURL, $globalArchive, $globalDebug;
954 954
 		$Common = new Common();
@@ -1048,27 +1048,27 @@  discard block
 block discarded – undo
1048 1048
 		if ($date == '') $date = date("Y-m-d H:i:s", time());
1049 1049
 
1050 1050
         
1051
-		$flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING);
1052
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
1053
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
1054
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
1055
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
1056
-		$latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1057
-		$longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1058
-		$waypoints = filter_var($waypoints,FILTER_SANITIZE_STRING);
1059
-		$altitude = filter_var($altitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1060
-		$altitude_real = filter_var($altitude_real,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1061
-		$heading = filter_var($heading,FILTER_SANITIZE_NUMBER_INT);
1062
-		$groundspeed = filter_var($groundspeed,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1063
-		$squawk = filter_var($squawk,FILTER_SANITIZE_NUMBER_INT);
1064
-		$route_stop = filter_var($route_stop,FILTER_SANITIZE_STRING);
1065
-		$ModeS = filter_var($ModeS,FILTER_SANITIZE_STRING);
1066
-		$pilot_id = filter_var($pilot_id,FILTER_SANITIZE_STRING);
1067
-		$pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING);
1068
-		$format_source = filter_var($format_source,FILTER_SANITIZE_STRING);
1069
-		$source_name = filter_var($source_name,FILTER_SANITIZE_STRING);
1070
-		$over_country = filter_var($over_country,FILTER_SANITIZE_STRING);
1071
-		$verticalrate = filter_var($verticalrate,FILTER_SANITIZE_NUMBER_INT);
1051
+		$flightaware_id = filter_var($flightaware_id, FILTER_SANITIZE_STRING);
1052
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
1053
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
1054
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
1055
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
1056
+		$latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1057
+		$longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1058
+		$waypoints = filter_var($waypoints, FILTER_SANITIZE_STRING);
1059
+		$altitude = filter_var($altitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1060
+		$altitude_real = filter_var($altitude_real, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1061
+		$heading = filter_var($heading, FILTER_SANITIZE_NUMBER_INT);
1062
+		$groundspeed = filter_var($groundspeed, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1063
+		$squawk = filter_var($squawk, FILTER_SANITIZE_NUMBER_INT);
1064
+		$route_stop = filter_var($route_stop, FILTER_SANITIZE_STRING);
1065
+		$ModeS = filter_var($ModeS, FILTER_SANITIZE_STRING);
1066
+		$pilot_id = filter_var($pilot_id, FILTER_SANITIZE_STRING);
1067
+		$pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING);
1068
+		$format_source = filter_var($format_source, FILTER_SANITIZE_STRING);
1069
+		$source_name = filter_var($source_name, FILTER_SANITIZE_STRING);
1070
+		$over_country = filter_var($over_country, FILTER_SANITIZE_STRING);
1071
+		$verticalrate = filter_var($verticalrate, FILTER_SANITIZE_NUMBER_INT);
1072 1072
 
1073 1073
 		$airline_name = '';
1074 1074
 		$airline_icao = '';
@@ -1090,10 +1090,10 @@  discard block
 block discarded – undo
1090 1090
 		$arrival_airport_country = '';
1091 1091
 		
1092 1092
             	
1093
-            	if ($squawk == '' || $Common->isInteger($squawk) === false ) $squawk = NULL;
1094
-            	if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) $verticalrate = NULL;
1095
-            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
1096
-            	if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
1093
+            	if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL;
1094
+            	if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL;
1095
+            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
1096
+            	if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
1097 1097
 		
1098 1098
 		$query = '';
1099 1099
 		if ($globalArchive) {
@@ -1104,19 +1104,19 @@  discard block
 block discarded – undo
1104 1104
 		$query  .= 'INSERT INTO spotter_live (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_shadow, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, latitude, longitude, waypoints, altitude, heading, ground_speed, date, departure_airport_time, arrival_airport_time, squawk, route_stop, ModeS, pilot_id, pilot_name, verticalrate, ground, format_source, source_name, over_country, real_altitude) 
1105 1105
 		VALUES (:flightaware_id,:ident,:registration,:airline_name,:airline_icao,:airline_country,:airline_type,:aircraft_icao,:aircraft_shadow,:aircraft_type,:aircraft_manufacturer,:departure_airport_icao,:departure_airport_name, :departure_airport_city, :departure_airport_country, :arrival_airport_icao, :arrival_airport_name, :arrival_airport_city, :arrival_airport_country, :latitude,:longitude,:waypoints,:altitude,:heading,:groundspeed,:date,:departure_airport_time,:arrival_airport_time,:squawk,:route_stop,:ModeS, :pilot_id, :pilot_name, :verticalrate, :ground, :format_source, :source_name, :over_country, :real_altitude)';
1106 1106
 
1107
-		$query_values = array(':flightaware_id' => $flightaware_id,':ident' => $ident, ':registration' => $registration,':airline_name' => $airline_name,':airline_icao' => $airline_icao,':airline_country' => $airline_country,':airline_type' => $airline_type,':aircraft_icao' => $aircraft_icao,':aircraft_shadow' => $aircraft_shadow,':aircraft_type' => $aircraft_type,':aircraft_manufacturer' => $aircraft_manufacturer,':departure_airport_icao' => $departure_airport_icao,':departure_airport_name' => $departure_airport_name,':departure_airport_city' => $departure_airport_city,':departure_airport_country' => $departure_airport_country,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_name' => $arrival_airport_name,':arrival_airport_city' => $arrival_airport_city,':arrival_airport_country' => $arrival_airport_country,':latitude' => $latitude,':longitude' => $longitude, ':waypoints' => $waypoints,':altitude' => $altitude,':heading' => $heading,':groundspeed' => $groundspeed,':date' => $date, ':departure_airport_time' => $departure_airport_time,':arrival_airport_time' => $arrival_airport_time, ':squawk' => $squawk,':route_stop' => $route_stop,':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':format_source' => $format_source,':ground' => $ground, ':source_name' => $source_name, ':over_country' => $over_country,':real_altitude' => $altitude_real);
1107
+		$query_values = array(':flightaware_id' => $flightaware_id, ':ident' => $ident, ':registration' => $registration, ':airline_name' => $airline_name, ':airline_icao' => $airline_icao, ':airline_country' => $airline_country, ':airline_type' => $airline_type, ':aircraft_icao' => $aircraft_icao, ':aircraft_shadow' => $aircraft_shadow, ':aircraft_type' => $aircraft_type, ':aircraft_manufacturer' => $aircraft_manufacturer, ':departure_airport_icao' => $departure_airport_icao, ':departure_airport_name' => $departure_airport_name, ':departure_airport_city' => $departure_airport_city, ':departure_airport_country' => $departure_airport_country, ':arrival_airport_icao' => $arrival_airport_icao, ':arrival_airport_name' => $arrival_airport_name, ':arrival_airport_city' => $arrival_airport_city, ':arrival_airport_country' => $arrival_airport_country, ':latitude' => $latitude, ':longitude' => $longitude, ':waypoints' => $waypoints, ':altitude' => $altitude, ':heading' => $heading, ':groundspeed' => $groundspeed, ':date' => $date, ':departure_airport_time' => $departure_airport_time, ':arrival_airport_time' => $arrival_airport_time, ':squawk' => $squawk, ':route_stop' => $route_stop, ':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':format_source' => $format_source, ':ground' => $ground, ':source_name' => $source_name, ':over_country' => $over_country, ':real_altitude' => $altitude_real);
1108 1108
 		try {
1109 1109
 			
1110 1110
 			$sth = $this->db->prepare($query);
1111 1111
 			$sth->execute($query_values);
1112 1112
 			$sth->closeCursor();
1113
-		} catch(PDOException $e) {
1113
+		} catch (PDOException $e) {
1114 1114
 			return "error : ".$e->getMessage();
1115 1115
 		}
1116 1116
 		if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) {
1117 1117
 		    if ($globalDebug) echo '(Add to SBS archive : ';
1118 1118
 		    $SpotterArchive = new SpotterArchive($this->db);
1119
-		    $result =  $SpotterArchive->addSpotterArchiveData($flightaware_id, $ident, $registration, $airline_name, $airline_icao, $airline_country, $airline_type, $aircraft_icao, $aircraft_shadow, $aircraft_name, $aircraft_manufacturer, $departure_airport_icao, $departure_airport_name, $departure_airport_city, $departure_airport_country, $departure_airport_time,$arrival_airport_icao, $arrival_airport_name, $arrival_airport_city, $arrival_airport_country, $arrival_airport_time, $route_stop, $date,$latitude, $longitude, $waypoints, $altitude, $altitude_real,$heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name,$verticalrate,$format_source,$source_name, $over_country);
1119
+		    $result = $SpotterArchive->addSpotterArchiveData($flightaware_id, $ident, $registration, $airline_name, $airline_icao, $airline_country, $airline_type, $aircraft_icao, $aircraft_shadow, $aircraft_name, $aircraft_manufacturer, $departure_airport_icao, $departure_airport_name, $departure_airport_city, $departure_airport_country, $departure_airport_time, $arrival_airport_icao, $arrival_airport_name, $arrival_airport_city, $arrival_airport_country, $arrival_airport_time, $route_stop, $date, $latitude, $longitude, $waypoints, $altitude, $altitude_real, $heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name, $verticalrate, $format_source, $source_name, $over_country);
1120 1120
 		    if ($globalDebug) echo $result.')';
1121 1121
 		} elseif ($globalDebug && $putinarchive !== true) {
1122 1122
 			echo '(Not adding to archive)';
@@ -1129,7 +1129,7 @@  discard block
 block discarded – undo
1129 1129
 
1130 1130
 	public function getOrderBy()
1131 1131
 	{
1132
-		$orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY spotter_live.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY spotter_live.aircraft_icao DESC"),"manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY spotter_live.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY spotter_live.aircraft_manufacturer DESC"),"airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY spotter_live.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY spotter_live.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY spotter_live.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY spotter_live.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY spotter_live.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY spotter_live.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY spotter_live.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY spotter_live.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY spotter_live.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY spotter_live.date DESC"));
1132
+		$orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY spotter_live.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY spotter_live.aircraft_icao DESC"), "manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY spotter_live.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY spotter_live.aircraft_manufacturer DESC"), "airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY spotter_live.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY spotter_live.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY spotter_live.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY spotter_live.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY spotter_live.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY spotter_live.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY spotter_live.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY spotter_live.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY spotter_live.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY spotter_live.date DESC"));
1133 1133
 		return $orderby;
1134 1134
 	}
1135 1135
 
Please login to merge, or discard this patch.
aircraft-data.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -11,14 +11,14 @@  discard block
 block discarded – undo
11 11
 
12 12
 $from_archive = false;
13 13
 if (isset($_GET['ident'])) {
14
-	$ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING);
14
+	$ident = filter_input(INPUT_GET, 'ident', FILTER_SANITIZE_STRING);
15 15
 	if (isset($_GET['currenttime'])) {
16
-		$currenttime = filter_input(INPUT_GET,'currenttime',FILTER_SANITIZE_NUMBER_INT);
16
+		$currenttime = filter_input(INPUT_GET, 'currenttime', FILTER_SANITIZE_NUMBER_INT);
17 17
 		$currenttime = round($currenttime/1000);
18
-		$spotter_array = $SpotterLive->getDateLiveSpotterDataByIdent($ident,$currenttime);
18
+		$spotter_array = $SpotterLive->getDateLiveSpotterDataByIdent($ident, $currenttime);
19 19
 		if (empty($spotter_array)) {
20 20
 			$from_archive = true;
21
-			$spotter_array = $SpotterArchive->getDateArchiveSpotterDataByIdent($ident,$currenttime);
21
+			$spotter_array = $SpotterArchive->getDateArchiveSpotterDataByIdent($ident, $currenttime);
22 22
 		}
23 23
 	} else {
24 24
 		$spotter_array = $SpotterLive->getLastLiveSpotterDataByIdent($ident);
@@ -29,15 +29,15 @@  discard block
 block discarded – undo
29 29
 	}
30 30
 }
31 31
 if (isset($_GET['flightaware_id'])) {
32
-	$flightaware_id = filter_input(INPUT_GET,'flightaware_id',FILTER_SANITIZE_STRING);
32
+	$flightaware_id = filter_input(INPUT_GET, 'flightaware_id', FILTER_SANITIZE_STRING);
33 33
 	if (isset($_GET['currenttime'])) {
34
-		$currenttime = filter_input(INPUT_GET,'currenttime',FILTER_SANITIZE_NUMBER_INT);
34
+		$currenttime = filter_input(INPUT_GET, 'currenttime', FILTER_SANITIZE_NUMBER_INT);
35 35
 		$currenttime = round($currenttime/1000);
36
-		$spotter_array = $SpotterLive->getDateLiveSpotterDataById($flightaware_id,$currenttime);
36
+		$spotter_array = $SpotterLive->getDateLiveSpotterDataById($flightaware_id, $currenttime);
37 37
 		if (empty($spotter_array)) {
38 38
 			$from_archive = true;
39 39
 //			$spotter_array = $SpotterArchive->getLastArchiveSpotterDataById($flightaware_id);
40
-			$spotter_array = $SpotterArchive->getDateArchiveSpotterDataById($flightaware_id,$currenttime);
40
+			$spotter_array = $SpotterArchive->getDateArchiveSpotterDataById($flightaware_id, $currenttime);
41 41
 		}
42 42
 	} else {
43 43
 		$spotter_array = $SpotterLive->getLastLiveSpotterDataById($flightaware_id);
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 if (isset($spotter_item['image_thumbnail']) && $spotter_item['image_thumbnail'] != "")
57 57
 {
58 58
 	if ($spotter_item['image_source'] == 'flickr' || $spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart') {
59
-		$image = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']);
59
+		$image = preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']);
60 60
 	} else $image = $spotter_item['image_thumbnail'];
61 61
 
62 62
 }
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 	print '<div class="nomobile airports"><div class="airport"><span class="code"><a href="'.$globalURL.'/airport/'.$spotter_item['departure_airport'].'" target="_blank">'.$spotter_item['departure_airport'].'</a></span>'.$spotter_item['departure_airport_city'].' '.$spotter_item['departure_airport_country'];
78 78
 	if (isset($spotter_item['departure_airport_time']) && $spotter_item['departure_airport_time'] != 'NULL') {
79 79
 		if ($spotter_item['departure_airport_time'] > 2460) {
80
-			print '<br /><span class="time">'.date('H:m',$spotter_item['departure_airport_time']).'</span>';
80
+			print '<br /><span class="time">'.date('H:m', $spotter_item['departure_airport_time']).'</span>';
81 81
 		} else {
82 82
 			print '<br /><span class="time">'.$spotter_item['departure_airport_time'].'</span>';
83 83
 		}
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 	print '<span class="code"><a href="'.$globalURL.'/airport/'.$spotter_item['arrival_airport'].'" target="_blank">'.$spotter_item['arrival_airport'].'</a></span>'.$spotter_item['arrival_airport_city'].' '.$spotter_item['arrival_airport_country'];
87 87
 	if (isset($spotter_item['arrival_airport_time']) && $spotter_item['arrival_airport_time'] != 'NULL') {
88 88
 		if ($spotter_item['arrival_airport_time'] > 2460) {
89
-			print '<br /><span class="time">'.date('H:m',$spotter_item['arrival_airport_time']).'</span>';
89
+			print '<br /><span class="time">'.date('H:m', $spotter_item['arrival_airport_time']).'</span>';
90 90
 		} else {
91 91
 			print '<br /><span class="time">'.$spotter_item['arrival_airport_time'].'</span>';
92 92
 		}
@@ -111,8 +111,8 @@  discard block
 block discarded – undo
111 111
 print '<div id ="altitude"><span>'._("Altitude").'</span>';
112 112
 if (isset($globalGroundAltitude) && $globalGroundAltitude) {
113 113
 	try {
114
-		$groundAltitude = $Elevation->getElevation($spotter_item['latitude'],$spotter_item['longitude']);
115
-	} catch(Exception $e) {
114
+		$groundAltitude = $Elevation->getElevation($spotter_item['latitude'], $spotter_item['longitude']);
115
+	} catch (Exception $e) {
116 116
 	}
117 117
 }
118 118
 
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 
182 182
 if (isset($globalVA) && $globalVA && isset($globalphpVMS) && $globalphpVMS && isset($globalVATSIM) && $globalVATSIM && isset($globalIVAO) && $globalIVAO && isset($spotter_item['format_source']) && $spotter_item['format_source'] != '' && $spotter_item['format_source'] != 'pireps') print '<div class="waypoints"><span>'._("Source").'</span>'.$spotter_item['format_source'].'</div>';
183 183
 if (isset($spotter_item['waypoints']) && $spotter_item['waypoints'] != '') print '<div class="waypoints"><span>'._("Route").'</span>'.$spotter_item['waypoints'].'</div>';
184
-if (isset($spotter_item['acars']['message'])) print '<div class="acars"><span>'._("Latest ACARS message").'</span>'.trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'<br/>',$spotter_item['acars']['message'])).'</div>';
184
+if (isset($spotter_item['acars']['message'])) print '<div class="acars"><span>'._("Latest ACARS message").'</span>'.trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '<br/>', $spotter_item['acars']['message'])).'</div>';
185 185
 if (isset($spotter_item['squawk']) && $spotter_item['squawk'] != '' && $spotter_item['squawk'] != 0) print '<div class="bottom">'._("Squawk:").' '.$spotter_item['squawk'].' - '.$spotter_item['squawk_usage'].'</div>';
186 186
 print '</div>';
187 187
 ?>
Please login to merge, or discard this patch.
manufacturer-detailed.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -4,16 +4,16 @@  discard block
 block discarded – undo
4 4
 require_once('require/class.Stats.php');
5 5
 require_once('require/class.Language.php');
6 6
 $Spotter = new Spotter();
7
-if (!isset($_GET['aircraft_manufacturer'])){
7
+if (!isset($_GET['aircraft_manufacturer'])) {
8 8
 	header('Location: '.$globalURL.'');
9 9
 } else {
10 10
 	//calculuation for the pagination
11
-	if(!isset($_GET['limit']))
11
+	if (!isset($_GET['limit']))
12 12
 	{
13 13
 		$limit_start = 0;
14 14
 		$limit_end = 25;
15 15
 		$absolute_difference = 25;
16
-	}  else {
16
+	} else {
17 17
 		$limit_explode = explode(",", $_GET['limit']);
18 18
 		$limit_start = $limit_explode[0];
19 19
 		$limit_end = $limit_explode[1];
@@ -27,19 +27,19 @@  discard block
 block discarded – undo
27 27
 	$limit_previous_1 = $limit_start - $absolute_difference;
28 28
 	$limit_previous_2 = $limit_end - $absolute_difference;
29 29
 	
30
-	$manufacturer = ucwords(str_replace("-", " ", filter_input(INPUT_GET,'aircraft_manufacturer',FILTER_SANITIZE_STRING)));
31
-	$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING);
30
+	$manufacturer = ucwords(str_replace("-", " ", filter_input(INPUT_GET, 'aircraft_manufacturer', FILTER_SANITIZE_STRING)));
31
+	$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING);
32 32
 	$page_url = $globalURL.'/manufacturer/'.$manufacturer;
33 33
 	
34 34
 	if ($sort != '') {
35
-		$spotter_array = $Spotter->getSpotterDataByManufacturer($manufacturer,$limit_start.",".$absolute_difference, $sort);
35
+		$spotter_array = $Spotter->getSpotterDataByManufacturer($manufacturer, $limit_start.",".$absolute_difference, $sort);
36 36
 	} else {
37
-		$spotter_array = $Spotter->getSpotterDataByManufacturer($manufacturer,$limit_start.",".$absolute_difference, '');
37
+		$spotter_array = $Spotter->getSpotterDataByManufacturer($manufacturer, $limit_start.",".$absolute_difference, '');
38 38
 	}
39 39
 	
40 40
 	if (!empty($spotter_array))
41 41
 	{
42
-		$title = sprintf(_("Detailed View for %s"),$manufacturer);
42
+		$title = sprintf(_("Detailed View for %s"), $manufacturer);
43 43
 
44 44
 		require_once('header.php');
45 45
 		print '<div class="select-item">';
@@ -48,9 +48,9 @@  discard block
 block discarded – undo
48 48
 		$Stats = new Stats();
49 49
 		$all_manufacturers = $Stats->getAllManufacturers();
50 50
 		if (empty($all_manufacturers)) $all_manufacturers = $Spotter->getAllManufacturers();
51
-		foreach($all_manufacturers as $all_manufacturer)
51
+		foreach ($all_manufacturers as $all_manufacturer)
52 52
 		{
53
-			if($_GET['aircraft_manufacturer'] == strtolower(str_replace(" ", "-", $all_manufacturer['aircraft_manufacturer'])))
53
+			if ($_GET['aircraft_manufacturer'] == strtolower(str_replace(" ", "-", $all_manufacturer['aircraft_manufacturer'])))
54 54
 			{
55 55
 				print '<option value="'.strtolower(str_replace(" ", "-", $all_manufacturer['aircraft_manufacturer'])).'" selected="selected">'.$all_manufacturer['aircraft_manufacturer'].'</option>';
56 56
 			} else {
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 		print '</div>';
68 68
 
69 69
 		print '<div class="table column">';
70
-		print '<p>'.sprintf(_("The table below shows the detailed information of all flights from <strong>%s</strong>."),$manufacturer).'</p>';
70
+		print '<p>'.sprintf(_("The table below shows the detailed information of all flights from <strong>%s</strong>."), $manufacturer).'</p>';
71 71
 
72 72
 		include('manufacturer-sub-menu.php');
73 73
 		include('table-output.php'); 
Please login to merge, or discard this patch.