Completed
Push — master ( acd68c...c7611e )
by Yannick
08:06
created
statistics.php 3 patches
Braces   +50 added lines, -29 removed lines patch added patch discarded remove patch
@@ -9,8 +9,10 @@  discard block
 block discarded – undo
9 9
 
10 10
 $airline_icao = filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING);
11 11
 if ($airline_icao == '' && isset($globalFilter)) {
12
-	if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
13
-}
12
+	if (isset($globalFilter['airline'])) {
13
+		$airline_icao = $globalFilter['airline'][0];
14
+	}
15
+	}
14 16
 
15 17
 ?>
16 18
 <script type="text/javascript" src="https://www.google.com/jsapi"></script>
@@ -28,7 +30,9 @@  discard block
 block discarded – undo
28 30
 	if (isset($last_update[0]['value'])) {
29 31
 		date_default_timezone_set('UTC');
30 32
 		$lastupdate = strtotime($last_update[0]['value']);
31
-		if (isset($globalTimezone) && $globalTimezone != '') date_default_timezone_set($globalTimezone);
33
+		if (isset($globalTimezone) && $globalTimezone != '') {
34
+			date_default_timezone_set($globalTimezone);
35
+		}
32 36
 		print '<i>Last update: '.date('Y-m-d G:i:s',$lastupdate).'</i>';
33 37
 	}
34 38
     ?>
@@ -81,8 +85,9 @@  discard block
 block discarded – undo
81 85
                 <h2><?php echo _("Top 10 Most Common Aircraft Type"); ?></h2>
82 86
                  <?php
83 87
                   $aircraft_array = $Stats->countAllAircraftTypes(true,$airline_icao);
84
-		    if (count($aircraft_array) == 0) print _("No data available");
85
-		    else {
88
+		    if (count($aircraft_array) == 0) {
89
+		    	print _("No data available");
90
+		    } else {
86 91
 
87 92
                     print '<div id="chart1" class="chart" width="100%"></div>
88 93
                     <script> 
@@ -127,8 +132,9 @@  discard block
 block discarded – undo
127 132
                 <h2><?php echo _("Top 10 Most Common Airline"); ?></h2>
128 133
                  <?php
129 134
                   $airline_array = $Stats->countAllAirlines();
130
-		    if (count($airline_array) == 0) print _("No data available");
131
-		    else {
135
+		    if (count($airline_array) == 0) {
136
+		    	print _("No data available");
137
+		    } else {
132 138
 
133 139
                   print '<div id="chart2" class="chart" width="100%"></div>
134 140
                     <script> 
@@ -189,8 +195,9 @@  discard block
 block discarded – undo
189 195
                 <h2><?php echo _("Top 10 Most Common Pilots"); ?></h2>
190 196
                  <?php
191 197
                   $pilot_array = $Stats->countAllPilots(true,$airline_icao);
192
-		    if (count($pilot_array) == 0) print _("No data available");
193
-		    else {
198
+		    if (count($pilot_array) == 0) {
199
+		    	print _("No data available");
200
+		    } else {
194 201
 
195 202
                   print '<div id="chart7" class="chart" width="100%"></div>
196 203
                     <script> 
@@ -236,8 +243,9 @@  discard block
 block discarded – undo
236 243
                 <h2><?php echo _("Top 10 Most Common Owners"); ?></h2>
237 244
                  <?php
238 245
                   $owner_array = $Stats->countAllOwners(true,$airline_icao);
239
-		    if (count($owner_array) == 0) print _("No data available");
240
-		    else {
246
+		    if (count($owner_array) == 0) {
247
+		    	print _("No data available");
248
+		    } else {
241 249
 
242 250
                   print '<div id="chart7" class="chart" width="100%"></div>
243 251
                     <script> 
@@ -286,8 +294,9 @@  discard block
 block discarded – undo
286 294
                 <h2><?php echo _("Top 20 Most Common Country a Flight was Over"); ?></h2>
287 295
                  <?php
288 296
                   //$flightover_array = $Stats->countAllFlightOverCountries();
289
-		    if (count($flightover_array) == 0) print _("No data available");
290
-		    else {
297
+		    if (count($flightover_array) == 0) {
298
+		    	print _("No data available");
299
+		    } else {
291 300
 
292 301
                   print '<div id="chart10" class="chart" width="100%"></div>
293 302
                     <script> 
@@ -339,8 +348,9 @@  discard block
 block discarded – undo
339 348
                 <h2><?php echo _("Top 10 Most Common Departure Airports"); ?></h2>
340 349
                 <?php
341 350
                 $airport_airport_array = $Stats->countAllDepartureAirports($airline_icao);
342
-		    if (count($airport_airport_array) == 0) print _("No data available");
343
-		    else {
351
+		    if (count($airport_airport_array) == 0) {
352
+		    	print _("No data available");
353
+		    } else {
344 354
 
345 355
                  print '<div id="chart3" class="chart" width="100%"></div>
346 356
                 <script>
@@ -389,8 +399,9 @@  discard block
 block discarded – undo
389 399
                 <h2><?php echo _("Top 10 Most Common Arrival Airports"); ?></h2>
390 400
                 <?php
391 401
                 $airport_airport_array2 = $Stats->countAllArrivalAirports($airline_icao);
392
-		    if (count($airport_airport_array2) == 0) print _("No data available");
393
-		    else {
402
+		    if (count($airport_airport_array2) == 0) {
403
+		    	print _("No data available");
404
+		    } else {
394 405
 
395 406
                 print '<div id="chart4" class="chart" width="100%"></div>
396 407
                 <script>
@@ -441,8 +452,9 @@  discard block
 block discarded – undo
441 452
                 <h2><?php echo _("Busiest Months of the last 12 Months"); ?></h2>
442 453
                 <?php
443 454
                   $year_array = $Stats->countAllMonthsLastYear($airline_icao);
444
-		    if (count($year_array) == 0) print _("No data available");
445
-		    else {
455
+		    if (count($year_array) == 0) {
456
+		    	print _("No data available");
457
+		    } else {
446 458
                   print '<div id="chart8" class="chart" width="100%"></div>
447 459
                     <script> 
448 460
                         google.load("visualization", "1", {packages:["corechart"]});
@@ -487,8 +499,9 @@  discard block
 block discarded – undo
487 499
                 <h2><?php echo _("Busiest Day in the last Month"); ?></h2>
488 500
                 <?php
489 501
                   $month_array = $Stats->countAllDatesLastMonth($airline_icao);
490
-		    if (count($month_array) == 0) print _("No data available");
491
-		    else {
502
+		    if (count($month_array) == 0) {
503
+		    	print _("No data available");
504
+		    } else {
492 505
                   print '<div id="chart9" class="chart" width="100%"></div>
493 506
                     <script> 
494 507
                         google.load("visualization", "1", {packages:["corechart"]});
@@ -533,8 +546,9 @@  discard block
 block discarded – undo
533 546
                 <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2>
534 547
                 <?php
535 548
                     $date_array = $Stats->countAllDatesLast7Days($airline_icao);
536
-		    if (empty($date_array)) print _("No data available");
537
-		    else {
549
+		    if (empty($date_array)) {
550
+		    	print _("No data available");
551
+		    } else {
538 552
                   print '<div id="chart5" class="chart" width="100%"></div>
539 553
                     <script> 
540 554
                         google.load("visualization", "1", {packages:["corechart"]});
@@ -580,8 +594,9 @@  discard block
 block discarded – undo
580 594
                 <h2><?php echo _("Busiest Time of the Day"); ?></h2>
581 595
                 <?php
582 596
                   $hour_array = $Stats->countAllHours('hour',$airline_icao);
583
-		    if (empty($hour_array)) print _("No data available");
584
-		    else {
597
+		    if (empty($hour_array)) {
598
+		    	print _("No data available");
599
+		    } else {
585 600
 
586 601
                   print '<div id="chart6" class="chart" width="100%"></div>
587 602
                     <script> 
@@ -649,8 +664,11 @@  discard block
 block discarded – undo
649 664
 					$distance = $distance;
650 665
 					$unit = 'km';
651 666
 				}
652
-        			if (!isset($polar_data)) $polar_data = '{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}';
653
-        	    		else $polar_data = $polar_data.',{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}';
667
+        			if (!isset($polar_data)) {
668
+        				$polar_data = '{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}';
669
+        			} else {
670
+        	    			$polar_data = $polar_data.',{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}';
671
+        	    		}
654 672
         		    }
655 673
         	?>
656 674
             <div class="col-md-6">
@@ -697,8 +715,11 @@  discard block
 block discarded – undo
697 715
         		foreach ($msg as $eachmsg) {
698 716
         		    //$eachmsg = $msg[0];
699 717
         		    $data = $eachmsg['source_data'];
700
-        		    if ($data > 500) $max = (round(($data+100)/100))*100;
701
-        		    else $max = 500;
718
+        		    if ($data > 500) {
719
+        		    	$max = (round(($data+100)/100))*100;
720
+        		    } else {
721
+        		    	$max = 500;
722
+        		    }
702 723
         	?>
703 724
         	<div id="msg-<?php print str_replace(' ','_',strtolower($eachmsg['source_name'])); ?>" class="col-md-4"></div>
704 725
         	<script>
Please login to merge, or discard this patch.
Indentation   +224 added lines, -224 removed lines patch added patch discarded remove patch
@@ -31,11 +31,11 @@  discard block
 block discarded – undo
31 31
 		if (isset($globalTimezone) && $globalTimezone != '') date_default_timezone_set($globalTimezone);
32 32
 		print '<i>Last update: '.date('Y-m-d G:i:s',$lastupdate).'</i>';
33 33
 	}
34
-    ?>
34
+	?>
35 35
     </div>
36 36
     <?php    
37 37
 	// print_r($Stats->getAllAirlineNames()); 
38
-    ?>
38
+	?>
39 39
     <?php include('statistics-sub-menu.php'); ?>
40 40
     <div class="row global-stats">
41 41
         <div class="col-md-2"><span class="type"><?php echo _("Flights"); ?></span><span><?php print number_format($Stats->countOverallFlights($airline_icao)); ?></span></div> 
@@ -43,23 +43,23 @@  discard block
 block discarded – undo
43 43
         <div class="col-md-2"><span class="type"><?php echo _("Arrivals seen"); ?></span><span><?php print number_format($Stats->countOverallArrival($airline_icao)); ?></span></div> 
44 44
         <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
45 45
 	<?php
46
-	    if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) {
46
+		if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) {
47 47
 	?>
48 48
     	    <div class="col-md-2"><span class="type"><?php echo _("Pilots"); ?></span><span><?php print number_format($Stats->countOverallPilots($airline_icao)); ?></span></div> 
49 49
 	    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
50 50
         <?php
51
-    	    } else {
52
-    	?>
51
+			} else {
52
+		?>
53 53
     	    <div class="col-md-2"><span class="type"><?php echo _("Owners"); ?></span><span><?php print number_format($Stats->countOverallOwners($airline_icao)); ?></span></div> 
54 54
 	    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
55 55
     	<?php
56
-    	    }
57
-    	?>
56
+			}
57
+		?>
58 58
         <div class="col-md-2"><span class="type"><?php echo _("Aircrafts"); ?></span><span><?php print number_format($Stats->countOverallAircrafts($airline_icao)); ?></span></div> 
59 59
         <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
60 60
         <?php
61
-    		if ($airline_icao == '') {
62
-    	?>
61
+			if ($airline_icao == '') {
62
+		?>
63 63
         <div class="col-md-2"><span class="type"><?php echo _("Airlines"); ?></span><span><?php print number_format($Stats->countOverallAirlines()); ?></span></div>
64 64
 	<!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
65 65
 	<?php
@@ -80,25 +80,25 @@  discard block
 block discarded – undo
80 80
             <div class="col-md-6">
81 81
                 <h2><?php echo _("Top 10 Most Common Aircraft Type"); ?></h2>
82 82
                  <?php
83
-                  $aircraft_array = $Stats->countAllAircraftTypes(true,$airline_icao);
84
-		    if (count($aircraft_array) == 0) print _("No data available");
85
-		    else {
83
+				  $aircraft_array = $Stats->countAllAircraftTypes(true,$airline_icao);
84
+			if (count($aircraft_array) == 0) print _("No data available");
85
+			else {
86 86
 
87
-                    print '<div id="chart1" class="chart" width="100%"></div>
87
+					print '<div id="chart1" class="chart" width="100%"></div>
88 88
                     <script> 
89 89
                         google.load("visualization", "1", {packages:["corechart"]});
90 90
                       google.setOnLoadCallback(drawChart1);
91 91
                       function drawChart1() {
92 92
                         var data = google.visualization.arrayToDataTable([
93 93
                             ["'._("Aircraft").'", "'._("# of times").'"], ';
94
-                            $aircraft_data = '';
95
-                          foreach($aircraft_array as $aircraft_item)
96
-                                    {
97
-                                            $aircraft_data .= '[ "'.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],';
98
-                                    }
99
-                                    $aircraft_data = substr($aircraft_data, 0, -1);
100
-                                    print $aircraft_data;
101
-                        print ']);
94
+							$aircraft_data = '';
95
+						  foreach($aircraft_array as $aircraft_item)
96
+									{
97
+											$aircraft_data .= '[ "'.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],';
98
+									}
99
+									$aircraft_data = substr($aircraft_data, 0, -1);
100
+									print $aircraft_data;
101
+						print ']);
102 102
 
103 103
                         var options = {
104 104
                             chartArea: {"width": "80%", "height": "60%"},
@@ -113,38 +113,38 @@  discard block
 block discarded – undo
113 113
                               drawChart1();
114 114
                             });
115 115
                   </script>';
116
-                  }
117
-                  ?>
116
+				  }
117
+				  ?>
118 118
                 <div class="more">
119 119
                     <a href="<?php print $globalURL; ?>/statistics/aircraft" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
120 120
                 </div>
121 121
             </div>
122 122
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
123 123
 <?php
124
-    if ($airline_icao == '') {
124
+	if ($airline_icao == '') {
125 125
 ?>
126 126
             <div class="col-md-6">
127 127
                 <h2><?php echo _("Top 10 Most Common Airline"); ?></h2>
128 128
                  <?php
129
-                  $airline_array = $Stats->countAllAirlines();
130
-		    if (count($airline_array) == 0) print _("No data available");
131
-		    else {
129
+				  $airline_array = $Stats->countAllAirlines();
130
+			if (count($airline_array) == 0) print _("No data available");
131
+			else {
132 132
 
133
-                  print '<div id="chart2" class="chart" width="100%"></div>
133
+				  print '<div id="chart2" class="chart" width="100%"></div>
134 134
                     <script> 
135 135
                         google.load("visualization", "1", {packages:["corechart"]});
136 136
                       google.setOnLoadCallback(drawChart2);
137 137
                       function drawChart2() {
138 138
                         var data = google.visualization.arrayToDataTable([
139 139
                             ["'._("Airline").'", "'._("# of times").'"], ';
140
-                            $airline_data = '';
141
-                          foreach($airline_array as $airline_item)
142
-                                    {
143
-                                            $airline_data .= '[ "'.$airline_item['airline_name'].' ('.$airline_item['airline_icao'].')",'.$airline_item['airline_count'].'],';
144
-                                    }
145
-                                    $airline_data = substr($airline_data, 0, -1);
146
-                                    print $airline_data;
147
-                        print ']);
140
+							$airline_data = '';
141
+						  foreach($airline_array as $airline_item)
142
+									{
143
+											$airline_data .= '[ "'.$airline_item['airline_name'].' ('.$airline_item['airline_icao'].')",'.$airline_item['airline_count'].'],';
144
+									}
145
+									$airline_data = substr($airline_data, 0, -1);
146
+									print $airline_data;
147
+						print ']);
148 148
 
149 149
                         var options = {
150 150
                             chartArea: {"width": "80%", "height": "60%"},
@@ -159,8 +159,8 @@  discard block
 block discarded – undo
159 159
                               drawChart2();
160 160
                             });
161 161
                   </script>';
162
-                  }
163
-                  ?>
162
+				  }
163
+				  ?>
164 164
                 <div class="more">
165 165
                     <a href="<?php print $globalURL; ?>/statistics/airline" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
166 166
                 </div>
@@ -168,44 +168,44 @@  discard block
 block discarded – undo
168 168
         </div>
169 169
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
170 170
 <?php
171
-    }
171
+	}
172 172
 ?>
173 173
         <div class="row column">
174 174
 
175 175
 	    <?php
176
-                 $flightover_array = $Stats->countAllFlightOverCountries($airline_icao);
176
+				 $flightover_array = $Stats->countAllFlightOverCountries($airline_icao);
177 177
 		if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) {
178
-		    if (empty($flightover_array)) {
179
-	    ?>
178
+			if (empty($flightover_array)) {
179
+		?>
180 180
             <div class="col-md-12">
181 181
             <?php
182
-        	    } else {
183
-            ?>
182
+				} else {
183
+			?>
184 184
             <div class="col-md-6">
185 185
             <?php
186
-            	    }
187
-            ?>
186
+					}
187
+			?>
188 188
                 <h2><?php echo _("Top 10 Most Common Pilots"); ?></h2>
189 189
                  <?php
190
-                  $pilot_array = $Stats->countAllPilots(true,$airline_icao);
191
-		    if (count($pilot_array) == 0) print _("No data available");
192
-		    else {
190
+				  $pilot_array = $Stats->countAllPilots(true,$airline_icao);
191
+			if (count($pilot_array) == 0) print _("No data available");
192
+			else {
193 193
 
194
-                  print '<div id="chart7" class="chart" width="100%"></div>
194
+				  print '<div id="chart7" class="chart" width="100%"></div>
195 195
                     <script> 
196 196
                         google.load("visualization", "1", {packages:["corechart"]});
197 197
                       google.setOnLoadCallback(drawChart7);
198 198
                       function drawChart7() {
199 199
                         var data = google.visualization.arrayToDataTable([
200 200
                             ["'._("Pilots").'", "'._("# of times").'"], ';
201
-                            $pilot_data = '';
202
-                          foreach($pilot_array as $pilot_item)
203
-                                    {
204
-                                            $pilot_data .= '[ "'.$pilot_item['pilot_name'].' ('.$pilot_item['pilot_id'].')",'.$pilot_item['pilot_count'].'],';
205
-                                    }
206
-                                    $pilot_data = substr($pilot_data, 0, -1);
207
-                                    print $pilot_data;
208
-                        print ']);
201
+							$pilot_data = '';
202
+						  foreach($pilot_array as $pilot_item)
203
+									{
204
+											$pilot_data .= '[ "'.$pilot_item['pilot_name'].' ('.$pilot_item['pilot_id'].')",'.$pilot_item['pilot_count'].'],';
205
+									}
206
+									$pilot_data = substr($pilot_data, 0, -1);
207
+									print $pilot_data;
208
+						print ']);
209 209
 
210 210
                         var options = {
211 211
                             chartArea: {"width": "80%", "height": "60%"},
@@ -220,8 +220,8 @@  discard block
 block discarded – undo
220 220
                               drawChart7();
221 221
                             });
222 222
                   </script>';
223
-                  }
224
-                  ?>
223
+				  }
224
+				  ?>
225 225
                 <div class="more">
226 226
                     <a href="<?php print $globalURL; ?>/statistics/pilot" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
227 227
                 </div>
@@ -229,30 +229,30 @@  discard block
 block discarded – undo
229 229
         
230 230
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
231 231
         <?php
232
-    	    } else {
233
-    	?>
232
+			} else {
233
+		?>
234 234
             <div class="col-md-6">
235 235
                 <h2><?php echo _("Top 10 Most Common Owners"); ?></h2>
236 236
                  <?php
237
-                  $owner_array = $Stats->countAllOwners(true,$airline_icao);
238
-		    if (count($owner_array) == 0) print _("No data available");
239
-		    else {
237
+				  $owner_array = $Stats->countAllOwners(true,$airline_icao);
238
+			if (count($owner_array) == 0) print _("No data available");
239
+			else {
240 240
 
241
-                  print '<div id="chart7" class="chart" width="100%"></div>
241
+				  print '<div id="chart7" class="chart" width="100%"></div>
242 242
                     <script> 
243 243
                         google.load("visualization", "1", {packages:["corechart"]});
244 244
                       google.setOnLoadCallback(drawChart7);
245 245
                       function drawChart7() {
246 246
                         var data = google.visualization.arrayToDataTable([
247 247
                             ["'._("Owner").'", "'._("# of times").'"], ';
248
-                            $owner_data = '';
249
-                          foreach($owner_array as $owner_item)
250
-                                    {
251
-                                            $owner_data .= '[ "'.$owner_item['owner_name'].'",'.$owner_item['owner_count'].'],';
252
-                                    }
253
-                                    $owner_data = substr($owner_data, 0, -1);
254
-                                    print $owner_data;
255
-                        print ']);
248
+							$owner_data = '';
249
+						  foreach($owner_array as $owner_item)
250
+									{
251
+											$owner_data .= '[ "'.$owner_item['owner_name'].'",'.$owner_item['owner_count'].'],';
252
+									}
253
+									$owner_data = substr($owner_data, 0, -1);
254
+									print $owner_data;
255
+						print ']);
256 256
 
257 257
                         var options = {
258 258
                             chartArea: {"width": "80%", "height": "60%"},
@@ -267,8 +267,8 @@  discard block
 block discarded – undo
267 267
                               drawChart7();
268 268
                             });
269 269
                   </script>';
270
-                  }
271
-                  ?>
270
+				  }
271
+				  ?>
272 272
                 <div class="more">
273 273
                     <a href="<?php print $globalURL; ?>/statistics/owner" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
274 274
                 </div>
@@ -276,32 +276,32 @@  discard block
 block discarded – undo
276 276
         
277 277
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
278 278
         <?php
279
-    	    }
280
-    	    if (!empty($flightover_array)) {
281
-    	?>
279
+			}
280
+			if (!empty($flightover_array)) {
281
+		?>
282 282
     	
283 283
             <div class="col-md-6">
284 284
                 <h2><?php echo _("Top 20 Most Common Country a Flight was Over"); ?></h2>
285 285
                  <?php
286
-                  //$flightover_array = $Stats->countAllFlightOverCountries();
287
-		    if (count($flightover_array) == 0) print _("No data available");
288
-		    else {
286
+				  //$flightover_array = $Stats->countAllFlightOverCountries();
287
+			if (count($flightover_array) == 0) print _("No data available");
288
+			else {
289 289
 
290
-                  print '<div id="chart10" class="chart" width="100%"></div>
290
+				  print '<div id="chart10" class="chart" width="100%"></div>
291 291
                     <script> 
292 292
                         google.load("visualization", "1", {packages:["corechart"]});
293 293
                       google.setOnLoadCallback(drawChart10);
294 294
                       function drawChart10() {
295 295
                         var data = google.visualization.arrayToDataTable([
296 296
                             ["'._("Country").'", "'._("# of times").'"], ';
297
-                            $flightover_data = '';
298
-                          foreach($flightover_array as $flightover_item)
299
-                                    {
300
-                                            $flightover_data .= '[ "'.$flightover_item['flight_country'].' ('.$flightover_item['flight_country_iso2'].')",'.$flightover_item['flight_count'].'],';
301
-                                    }
302
-                                    $flightover_data = substr($flightover_data, 0, -1);
303
-                                    print $flightover_data;
304
-                        print ']);
297
+							$flightover_data = '';
298
+						  foreach($flightover_array as $flightover_item)
299
+									{
300
+											$flightover_data .= '[ "'.$flightover_item['flight_country'].' ('.$flightover_item['flight_country_iso2'].')",'.$flightover_item['flight_count'].'],';
301
+									}
302
+									$flightover_data = substr($flightover_data, 0, -1);
303
+									print $flightover_data;
304
+						print ']);
305 305
 
306 306
                         var options = {
307 307
                             chartArea: {"width": "80%", "height": "60%"},
@@ -318,15 +318,15 @@  discard block
 block discarded – undo
318 318
                               drawChart10();
319 319
                             });
320 320
                   </script>';
321
-                  }
322
-                  ?>
321
+				  }
322
+				  ?>
323 323
                 <div class="more">
324 324
                     <a href="<?php print $globalURL; ?>/statistics/country" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
325 325
                 </div>
326 326
             </div>
327 327
         <?php
328
-            }
329
-        ?>
328
+			}
329
+		?>
330 330
         </div>
331 331
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
332 332
 
@@ -336,11 +336,11 @@  discard block
 block discarded – undo
336 336
             <div class="col-md-6">
337 337
                 <h2><?php echo _("Top 10 Most Common Departure Airports"); ?></h2>
338 338
                 <?php
339
-                $airport_airport_array = $Stats->countAllDepartureAirports($airline_icao);
340
-		    if (count($airport_airport_array) == 0) print _("No data available");
341
-		    else {
339
+				$airport_airport_array = $Stats->countAllDepartureAirports($airline_icao);
340
+			if (count($airport_airport_array) == 0) print _("No data available");
341
+			else {
342 342
 
343
-                 print '<div id="chart3" class="chart" width="100%"></div>
343
+				 print '<div id="chart3" class="chart" width="100%"></div>
344 344
                 <script>
345 345
                 google.load("visualization", "1", {packages:["geochart"]});
346 346
                 google.setOnLoadCallback(drawCharts3);
@@ -351,17 +351,17 @@  discard block
 block discarded – undo
351 351
 
352 352
                 var data = google.visualization.arrayToDataTable([ 
353 353
                     ["'._("Airport").'", "'._("# of times").'"],';
354
-                    $airport_data = '';
355
-                  foreach($airport_airport_array as $airport_item)
356
-                        {
357
-                            $name = $airport_item['airport_departure_city'].', '.$airport_item['airport_departure_country'].' ('.$airport_item['airport_departure_icao'].')';
358
-                            $name = str_replace("'", "", $name);
359
-                            $name = str_replace('"', "", $name);
360
-                            $airport_data .= '[ "'.$name.'",'.$airport_item['airport_departure_icao_count'].'],';
361
-                        }
362
-                        $airport_data = substr($airport_data, 0, -1);
363
-                        print $airport_data;
364
-                print ']);
354
+					$airport_data = '';
355
+				  foreach($airport_airport_array as $airport_item)
356
+						{
357
+							$name = $airport_item['airport_departure_city'].', '.$airport_item['airport_departure_country'].' ('.$airport_item['airport_departure_icao'].')';
358
+							$name = str_replace("'", "", $name);
359
+							$name = str_replace('"', "", $name);
360
+							$airport_data .= '[ "'.$name.'",'.$airport_item['airport_departure_icao_count'].'],';
361
+						}
362
+						$airport_data = substr($airport_data, 0, -1);
363
+						print $airport_data;
364
+				print ']);
365 365
 
366 366
                 var options = {
367 367
                     legend: {position: "none"},
@@ -375,8 +375,8 @@  discard block
 block discarded – undo
375 375
                 chart.draw(data, options);
376 376
               }
377 377
                 </script>';
378
-                }
379
-              ?>
378
+				}
379
+			  ?>
380 380
               <div class="more">
381 381
                 <a href="<?php print $globalURL; ?>/statistics/airport-departure" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
382 382
               </div>
@@ -386,11 +386,11 @@  discard block
 block discarded – undo
386 386
             <div class="col-md-6">
387 387
                 <h2><?php echo _("Top 10 Most Common Arrival Airports"); ?></h2>
388 388
                 <?php
389
-                $airport_airport_array2 = $Stats->countAllArrivalAirports($airline_icao);
390
-		    if (count($airport_airport_array2) == 0) print _("No data available");
391
-		    else {
389
+				$airport_airport_array2 = $Stats->countAllArrivalAirports($airline_icao);
390
+			if (count($airport_airport_array2) == 0) print _("No data available");
391
+			else {
392 392
 
393
-                print '<div id="chart4" class="chart" width="100%"></div>
393
+				print '<div id="chart4" class="chart" width="100%"></div>
394 394
                 <script>
395 395
                 google.load("visualization", "1", {packages:["geochart"]});
396 396
                 google.setOnLoadCallback(drawCharts4);
@@ -401,17 +401,17 @@  discard block
 block discarded – undo
401 401
 
402 402
                 var data = google.visualization.arrayToDataTable([ 
403 403
                     ["'._("Airport").'", "'._("# of times").'"],';
404
-                    $airport_data2 = '';
405
-                  foreach($airport_airport_array2 as $airport_item2)
406
-                        {
407
-                            $name2 = $airport_item2['airport_arrival_city'].', '.$airport_item2['airport_arrival_country'].' ('.$airport_item2['airport_arrival_icao'].')';
408
-                            $name2 = str_replace("'", "", $name2);
409
-                            $name2 = str_replace('"', "", $name2);
410
-                            $airport_data2 .= '[ "'.$name2.'",'.$airport_item2['airport_arrival_icao_count'].'],';
411
-                        }
412
-                        $airport_data2 = substr($airport_data2, 0, -1);
413
-                        print $airport_data2;
414
-                print ']);
404
+					$airport_data2 = '';
405
+				  foreach($airport_airport_array2 as $airport_item2)
406
+						{
407
+							$name2 = $airport_item2['airport_arrival_city'].', '.$airport_item2['airport_arrival_country'].' ('.$airport_item2['airport_arrival_icao'].')';
408
+							$name2 = str_replace("'", "", $name2);
409
+							$name2 = str_replace('"', "", $name2);
410
+							$airport_data2 .= '[ "'.$name2.'",'.$airport_item2['airport_arrival_icao_count'].'],';
411
+						}
412
+						$airport_data2 = substr($airport_data2, 0, -1);
413
+						print $airport_data2;
414
+				print ']);
415 415
 
416 416
                 var options = {
417 417
                     legend: {position: "none"},
@@ -425,8 +425,8 @@  discard block
 block discarded – undo
425 425
                 chart.draw(data, options);
426 426
               }
427 427
                 </script>';
428
-                }
429
-              ?>
428
+				}
429
+			  ?>
430 430
               <div class="more">
431 431
                 <a href="<?php print $globalURL; ?>/statistics/airport-arrival" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
432 432
               </div>
@@ -438,24 +438,24 @@  discard block
 block discarded – undo
438 438
             <div class="col-md-6">
439 439
                 <h2><?php echo _("Busiest Months of the last 12 Months"); ?></h2>
440 440
                 <?php
441
-                  $year_array = $Stats->countAllMonthsLastYear($airline_icao);
442
-		    if (count($year_array) == 0) print _("No data available");
443
-		    else {
444
-                  print '<div id="chart8" class="chart" width="100%"></div>
441
+				  $year_array = $Stats->countAllMonthsLastYear($airline_icao);
442
+			if (count($year_array) == 0) print _("No data available");
443
+			else {
444
+				  print '<div id="chart8" class="chart" width="100%"></div>
445 445
                     <script> 
446 446
                         google.load("visualization", "1", {packages:["corechart"]});
447 447
                       google.setOnLoadCallback(drawChart8);
448 448
                       function drawChart8() {
449 449
                         var data = google.visualization.arrayToDataTable([
450 450
                             ["'._("Month").'", "'._("# of Flights").'"], ';
451
-                            $year_data = '';
452
-                          foreach($year_array as $year_item)
453
-                                    {
454
-                                        $year_data .= '[ "'.date('F, Y',strtotime($year_item['year_name'].'-'.$year_item['month_name'].'-01')).'",'.$year_item['date_count'].'],';
455
-                                    }
456
-                                    $year_data = substr($year_data, 0, -1);
457
-                                    print $year_data;
458
-                        print ']);
451
+							$year_data = '';
452
+						  foreach($year_array as $year_item)
453
+									{
454
+										$year_data .= '[ "'.date('F, Y',strtotime($year_item['year_name'].'-'.$year_item['month_name'].'-01')).'",'.$year_item['date_count'].'],';
455
+									}
456
+									$year_data = substr($year_data, 0, -1);
457
+									print $year_data;
458
+						print ']);
459 459
 
460 460
                         var options = {
461 461
                             legend: {position: "none"},
@@ -473,8 +473,8 @@  discard block
 block discarded – undo
473 473
                               drawChart8();
474 474
                             });
475 475
                   </script>';
476
-                  }
477
-                  ?>
476
+				  }
477
+				  ?>
478 478
                 <div class="more">
479 479
                     <a href="<?php print $globalURL; ?>/statistics/year" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
480 480
                 </div>
@@ -484,24 +484,24 @@  discard block
 block discarded – undo
484 484
             <div class="col-md-6">
485 485
                 <h2><?php echo _("Busiest Day in the last Month"); ?></h2>
486 486
                 <?php
487
-                  $month_array = $Stats->countAllDatesLastMonth($airline_icao);
488
-		    if (count($month_array) == 0) print _("No data available");
489
-		    else {
490
-                  print '<div id="chart9" class="chart" width="100%"></div>
487
+				  $month_array = $Stats->countAllDatesLastMonth($airline_icao);
488
+			if (count($month_array) == 0) print _("No data available");
489
+			else {
490
+				  print '<div id="chart9" class="chart" width="100%"></div>
491 491
                     <script> 
492 492
                         google.load("visualization", "1", {packages:["corechart"]});
493 493
                       google.setOnLoadCallback(drawChart9);
494 494
                       function drawChart9() {
495 495
                         var data = google.visualization.arrayToDataTable([
496 496
                             ["'._("Day").'", "'._("# of Flights").'"], ';
497
-                            $month_data = '';
498
-                          foreach($month_array as $month_item)
499
-                                    {
500
-                                        $month_data .= '[ "'.date('F j, Y',strtotime($month_item['date_name'])).'",'.$month_item['date_count'].'],';
501
-                                    }
502
-                                    $month_data = substr($month_data, 0, -1);
503
-                                    print $month_data;
504
-                        print ']);
497
+							$month_data = '';
498
+						  foreach($month_array as $month_item)
499
+									{
500
+										$month_data .= '[ "'.date('F j, Y',strtotime($month_item['date_name'])).'",'.$month_item['date_count'].'],';
501
+									}
502
+									$month_data = substr($month_data, 0, -1);
503
+									print $month_data;
504
+						print ']);
505 505
 
506 506
                         var options = {
507 507
                             legend: {position: "none"},
@@ -519,8 +519,8 @@  discard block
 block discarded – undo
519 519
                               drawChart9();
520 520
                             });
521 521
                   </script>';
522
-                  }
523
-                  ?>
522
+				  }
523
+				  ?>
524 524
                 <div class="more">
525 525
                     <a href="<?php print $globalURL; ?>/statistics/month" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
526 526
                 </div>
@@ -530,25 +530,25 @@  discard block
 block discarded – undo
530 530
             <div class="col-md-6">
531 531
                 <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2>
532 532
                 <?php
533
-                    $date_array = $Stats->countAllDatesLast7Days($airline_icao);
534
-		    if (empty($date_array)) print _("No data available");
535
-		    else {
536
-                  print '<div id="chart5" class="chart" width="100%"></div>
533
+					$date_array = $Stats->countAllDatesLast7Days($airline_icao);
534
+			if (empty($date_array)) print _("No data available");
535
+			else {
536
+				  print '<div id="chart5" class="chart" width="100%"></div>
537 537
                     <script> 
538 538
                         google.load("visualization", "1", {packages:["corechart"]});
539 539
                       google.setOnLoadCallback(drawChart5);
540 540
                       function drawChart5() {
541 541
                         var data = google.visualization.arrayToDataTable([
542 542
                             ["'._("Date").'", "'._("# of Flights").'"], ';
543
-                            $date_data = '';
543
+							$date_data = '';
544 544
                         
545
-                          foreach($date_array as $date_item)
546
-                                    {
547
-                                        $date_data .= '[ "'.date("F j, Y", strtotime($date_item['date_name'])).'",'.$date_item['date_count'].'],';
548
-                                    }
549
-                                    $date_data = substr($date_data, 0, -1);
550
-                                    print $date_data;
551
-                        print ']);
545
+						  foreach($date_array as $date_item)
546
+									{
547
+										$date_data .= '[ "'.date("F j, Y", strtotime($date_item['date_name'])).'",'.$date_item['date_count'].'],';
548
+									}
549
+									$date_data = substr($date_data, 0, -1);
550
+									print $date_data;
551
+						print ']);
552 552
 
553 553
                         var options = {
554 554
                             legend: {position: "none"},
@@ -566,8 +566,8 @@  discard block
 block discarded – undo
566 566
                               drawChart5();
567 567
                             });
568 568
                   </script>';
569
-                  }
570
-                  ?>
569
+				  }
570
+				  ?>
571 571
                 <div class="more">
572 572
                     <a href="<?php print $globalURL; ?>/statistics/date" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
573 573
                 </div>
@@ -577,25 +577,25 @@  discard block
 block discarded – undo
577 577
             <div class="col-md-6">
578 578
                 <h2><?php echo _("Busiest Time of the Day"); ?></h2>
579 579
                 <?php
580
-                  $hour_array = $Stats->countAllHours('hour',$airline_icao);
581
-		    if (empty($hour_array)) print _("No data available");
582
-		    else {
580
+				  $hour_array = $Stats->countAllHours('hour',$airline_icao);
581
+			if (empty($hour_array)) print _("No data available");
582
+			else {
583 583
 
584
-                  print '<div id="chart6" class="chart" width="100%"></div>
584
+				  print '<div id="chart6" class="chart" width="100%"></div>
585 585
                     <script> 
586 586
                         google.load("visualization", "1", {packages:["corechart"]});
587 587
                       google.setOnLoadCallback(drawChart6);
588 588
                       function drawChart6() {
589 589
                         var data = google.visualization.arrayToDataTable([
590 590
                             ["'._("Hour").'", "'._("# of Flights").'"], ';
591
-                            $hour_data = '';
592
-                          foreach($hour_array as $hour_item)
593
-                                    {
594
-                                        $hour_data .= '[ "'.$hour_item['hour_name'].':00",'.$hour_item['hour_count'].'],';
595
-                                    }
596
-                                    $hour_data = substr($hour_data, 0, -1);
597
-                                    print $hour_data;
598
-                        print ']);
591
+							$hour_data = '';
592
+						  foreach($hour_array as $hour_item)
593
+									{
594
+										$hour_data .= '[ "'.$hour_item['hour_name'].':00",'.$hour_item['hour_count'].'],';
595
+									}
596
+									$hour_data = substr($hour_data, 0, -1);
597
+									print $hour_data;
598
+						print ']);
599 599
 
600 600
                         var options = {
601 601
                             legend: {position: "none"},
@@ -613,8 +613,8 @@  discard block
 block discarded – undo
613 613
                               drawChart6();
614 614
                             });
615 615
                   </script>';
616
-                  }
617
-                ?>
616
+				  }
617
+				?>
618 618
                 <div class="more">
619 619
                     <a href="<?php print $globalURL; ?>/statistics/time" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
620 620
                 </div>
@@ -622,21 +622,21 @@  discard block
 block discarded – undo
622 622
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
623 623
         </div>
624 624
 <?php
625
-    if ($airline_icao == '') {
625
+	if ($airline_icao == '') {
626 626
 ?>
627 627
         <div class="row column">
628 628
         	<?php
629
-        	    $polar = $Stats->getStatsSource(date('Y-m-d'),'polar');
630
-        	    if (!empty($polar)) {
631
-            		print '<h2>'._("Coverage pattern").'</h2>';
632
-        		foreach ($polar as $eachpolar) {
633
-        		    unset($polar_data);
634
-	        	    $Spotter = new Spotter();
635
-        		    $data = json_decode($eachpolar['source_data']);
636
-        		    foreach($data as $value => $key) {
637
-        			$direction = $Spotter->parseDirection(($value*22.5));
638
-        			$distance = $key;
639
-        			$unit = 'km';
629
+				$polar = $Stats->getStatsSource(date('Y-m-d'),'polar');
630
+				if (!empty($polar)) {
631
+					print '<h2>'._("Coverage pattern").'</h2>';
632
+				foreach ($polar as $eachpolar) {
633
+					unset($polar_data);
634
+					$Spotter = new Spotter();
635
+					$data = json_decode($eachpolar['source_data']);
636
+					foreach($data as $value => $key) {
637
+					$direction = $Spotter->parseDirection(($value*22.5));
638
+					$distance = $key;
639
+					$unit = 'km';
640 640
 				if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) {
641 641
 					$distance = round($distance*0.539957);
642 642
 					$unit = 'nm';
@@ -647,10 +647,10 @@  discard block
 block discarded – undo
647 647
 					$distance = $distance;
648 648
 					$unit = 'km';
649 649
 				}
650
-        			if (!isset($polar_data)) $polar_data = '{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}';
651
-        	    		else $polar_data = $polar_data.',{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}';
652
-        		    }
653
-        	?>
650
+					if (!isset($polar_data)) $polar_data = '{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}';
651
+						else $polar_data = $polar_data.',{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}';
652
+					}
653
+			?>
654 654
             <div class="col-md-6">
655 655
                 <h4><?php print $eachpolar['source_name']; ?></h4>
656 656
         	<div id="polar-<?php print str_replace(' ','_',strtolower($eachpolar['source_name'])); ?>" class="chart" width="100%"></div>
@@ -682,22 +682,22 @@  discard block
 block discarded – undo
682 682
 		</script>
683 683
             </div>
684 684
             <?php
685
-        	    }
686
-        	}
687
-            ?>
685
+				}
686
+			}
687
+			?>
688 688
         </div>
689 689
         <div class="row column">
690 690
             <div class="col-md-6">
691 691
         	<?php
692
-        	    $msg = $Stats->getStatsSource(date('Y-m-d'),'msg');
693
-        	    if (!empty($msg)) {
694
-            		print '<h2>'._("Messages received").'</h2>';
695
-        		foreach ($msg as $eachmsg) {
696
-        		    //$eachmsg = $msg[0];
697
-        		    $data = $eachmsg['source_data'];
698
-        		    if ($data > 500) $max = (round(($data+100)/100))*100;
699
-        		    else $max = 500;
700
-        	?>
692
+				$msg = $Stats->getStatsSource(date('Y-m-d'),'msg');
693
+				if (!empty($msg)) {
694
+					print '<h2>'._("Messages received").'</h2>';
695
+				foreach ($msg as $eachmsg) {
696
+					//$eachmsg = $msg[0];
697
+					$data = $eachmsg['source_data'];
698
+					if ($data > 500) $max = (round(($data+100)/100))*100;
699
+					else $max = 500;
700
+			?>
701 701
         	<div id="msg-<?php print str_replace(' ','_',strtolower($eachmsg['source_name'])); ?>" class="col-md-4"></div>
702 702
         	<script>
703 703
 		      var g = new JustGage({
@@ -713,9 +713,9 @@  discard block
 block discarded – undo
713 713
 			  });
714 714
 		</script>
715 715
             <?php
716
-        	   }
717
-        	}
718
-            ?>
716
+			   }
717
+			}
718
+			?>
719 719
             </div>
720 720
         </div>
721 721
         <div class="row column">
@@ -742,19 +742,19 @@  discard block
 block discarded – undo
742 742
 				$hist_data .= '[ "'.$distance.'",'.$nb.'],';
743 743
 			}
744 744
 			$hist_data = substr($hist_data, 0, -1);
745
-            ?>
745
+			?>
746 746
             <div class="col-md-6">
747 747
                 <h2><?php echo sprintf(_("Flights Distance for %s"),$source); ?></h2>
748 748
                 <?php
749
-                  print '<div id="charthist-'.str_replace(' ','_',strtolower($source)).'" class="chart" width="100%"></div>
749
+				  print '<div id="charthist-'.str_replace(' ','_',strtolower($source)).'" class="chart" width="100%"></div>
750 750
                     <script> 
751 751
                         google.load("visualization", "1", {packages:["corechart"]});
752 752
                       google.setOnLoadCallback(drawCharthist_'.str_replace(' ','_',strtolower($source)).');
753 753
                       function drawCharthist_'.str_replace(' ','_',strtolower($source)).'() {
754 754
                         var data = google.visualization.arrayToDataTable([
755 755
                             ["'._("Distance").'", "'._("# of Flights").'"], ';
756
-                            print $hist_data;
757
-                        print ']);
756
+							print $hist_data;
757
+						print ']);
758 758
 
759 759
                         var options = {
760 760
                             legend: {position: "none"},
@@ -772,15 +772,15 @@  discard block
 block discarded – undo
772 772
                               drawCharthist_'.str_replace(' ','_',strtolower($source)).'();
773 773
                             });
774 774
                   </script>';
775
-        	?>
775
+			?>
776 776
     	    </div>
777 777
 	    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
778 778
         	<?php
779
-                  }
780
-                ?>
779
+				  }
780
+				?>
781 781
         </div>
782 782
 <?php
783
-    }
783
+	}
784 784
 ?>
785 785
     </div>
786 786
 </div>  
Please login to merge, or discard this patch.
Spacing   +56 added lines, -56 removed lines patch added patch discarded remove patch
@@ -6,13 +6,13 @@  discard block
 block discarded – undo
6 6
 $Stats = new Stats();
7 7
 $title = _("Statistics");
8 8
 
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($_COOKIE['stats_airline_icao'])) {
11 11
 	$airline_icao = $_COOKIE['stats_airline_icao'];
12 12
 } elseif ($airline_icao == '' && isset($globalFilter)) {
13 13
 	if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
14 14
 }
15
-setcookie('stats_airline_icao',$airline_icao);
15
+setcookie('stats_airline_icao', $airline_icao);
16 16
 require_once('header.php');
17 17
 
18 18
 ?>
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 		date_default_timezone_set('UTC');
33 33
 		$lastupdate = strtotime($last_update[0]['value']);
34 34
 		if (isset($globalTimezone) && $globalTimezone != '') date_default_timezone_set($globalTimezone);
35
-		print '<i>Last update: '.date('Y-m-d G:i:s',$lastupdate).'</i>';
35
+		print '<i>Last update: '.date('Y-m-d G:i:s', $lastupdate).'</i>';
36 36
 	}
37 37
     ?>
38 38
     </div>
@@ -42,29 +42,29 @@  discard block
 block discarded – undo
42 42
     <?php include('statistics-sub-menu.php'); ?>
43 43
     <div class="row global-stats">
44 44
         <div class="col-md-2"><span class="type"><?php echo _("Flights"); ?></span><span><?php print number_format($Stats->countOverallFlights($airline_icao)); ?></span></div> 
45
-	<!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
45
+	<!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
46 46
         <div class="col-md-2"><span class="type"><?php echo _("Arrivals seen"); ?></span><span><?php print number_format($Stats->countOverallArrival($airline_icao)); ?></span></div> 
47
-        <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
47
+        <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
48 48
 	<?php
49 49
 	    if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) {
50 50
 	?>
51 51
     	    <div class="col-md-2"><span class="type"><?php echo _("Pilots"); ?></span><span><?php print number_format($Stats->countOverallPilots($airline_icao)); ?></span></div> 
52
-	    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
52
+	    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
53 53
         <?php
54 54
     	    } else {
55 55
     	?>
56 56
     	    <div class="col-md-2"><span class="type"><?php echo _("Owners"); ?></span><span><?php print number_format($Stats->countOverallOwners($airline_icao)); ?></span></div> 
57
-	    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
57
+	    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
58 58
     	<?php
59 59
     	    }
60 60
     	?>
61 61
         <div class="col-md-2"><span class="type"><?php echo _("Aircrafts"); ?></span><span><?php print number_format($Stats->countOverallAircrafts($airline_icao)); ?></span></div> 
62
-        <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
62
+        <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
63 63
         <?php
64 64
     		if ($airline_icao == '') {
65 65
     	?>
66 66
         <div class="col-md-2"><span class="type"><?php echo _("Airlines"); ?></span><span><?php print number_format($Stats->countOverallAirlines()); ?></span></div>
67
-	<!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
67
+	<!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
68 68
 	<?php
69 69
 		}
70 70
 	?>
@@ -72,18 +72,18 @@  discard block
 block discarded – undo
72 72
 		if (!(isset($globalIVAO) && $globalIVAO) && !(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalphpVMS) && $globalphpVMS)) {
73 73
 	?>
74 74
         <div class="col-md-2"><span class="type"><?php echo _("Military"); ?></span><span><?php print number_format($Stats->countOverallMilitaryFlights()); ?></span></div> 
75
-	<!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
75
+	<!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
76 76
 	<?php
77 77
 		}
78 78
 	?>
79 79
     </div>
80
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
80
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
81 81
     <div class="specific-stats">
82 82
         <div class="row column">
83 83
             <div class="col-md-6">
84 84
                 <h2><?php echo _("Top 10 Most Common Aircraft Type"); ?></h2>
85 85
                  <?php
86
-                  $aircraft_array = $Stats->countAllAircraftTypes(true,$airline_icao);
86
+                  $aircraft_array = $Stats->countAllAircraftTypes(true, $airline_icao);
87 87
 		    if (count($aircraft_array) == 0) print _("No data available");
88 88
 		    else {
89 89
 
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
                         var data = google.visualization.arrayToDataTable([
96 96
                             ["'._("Aircraft").'", "'._("# of times").'"], ';
97 97
                             $aircraft_data = '';
98
-                          foreach($aircraft_array as $aircraft_item)
98
+                          foreach ($aircraft_array as $aircraft_item)
99 99
                                     {
100 100
                                             $aircraft_data .= '[ "'.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],';
101 101
                                     }
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
                     <a href="<?php print $globalURL; ?>/statistics/aircraft" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
123 123
                 </div>
124 124
             </div>
125
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
125
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
126 126
 <?php
127 127
     if ($airline_icao == '') {
128 128
 ?>
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
                         var data = google.visualization.arrayToDataTable([
142 142
                             ["'._("Airline").'", "'._("# of times").'"], ';
143 143
                             $airline_data = '';
144
-                          foreach($airline_array as $airline_item)
144
+                          foreach ($airline_array as $airline_item)
145 145
                                     {
146 146
                                             $airline_data .= '[ "'.$airline_item['airline_name'].' ('.$airline_item['airline_icao'].')",'.$airline_item['airline_count'].'],';
147 147
                                     }
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
                 </div>
170 170
             </div>
171 171
         </div>
172
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
172
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
173 173
 <?php
174 174
     }
175 175
 ?>
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
             ?>
191 191
                 <h2><?php echo _("Top 10 Most Common Pilots"); ?></h2>
192 192
                  <?php
193
-                  $pilot_array = $Stats->countAllPilots(true,$airline_icao);
193
+                  $pilot_array = $Stats->countAllPilots(true, $airline_icao);
194 194
 		    if (count($pilot_array) == 0) print _("No data available");
195 195
 		    else {
196 196
 
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
                         var data = google.visualization.arrayToDataTable([
203 203
                             ["'._("Pilots").'", "'._("# of times").'"], ';
204 204
                             $pilot_data = '';
205
-                          foreach($pilot_array as $pilot_item)
205
+                          foreach ($pilot_array as $pilot_item)
206 206
                                     {
207 207
                                             $pilot_data .= '[ "'.$pilot_item['pilot_name'].' ('.$pilot_item['pilot_id'].')",'.$pilot_item['pilot_count'].'],';
208 208
                                     }
@@ -230,14 +230,14 @@  discard block
 block discarded – undo
230 230
                 </div>
231 231
             </div>
232 232
         
233
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
233
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
234 234
         <?php
235 235
     	    } else {
236 236
     	?>
237 237
             <div class="col-md-6">
238 238
                 <h2><?php echo _("Top 10 Most Common Owners"); ?></h2>
239 239
                  <?php
240
-                  $owner_array = $Stats->countAllOwners(true,$airline_icao);
240
+                  $owner_array = $Stats->countAllOwners(true, $airline_icao);
241 241
 		    if (count($owner_array) == 0) print _("No data available");
242 242
 		    else {
243 243
 
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
                         var data = google.visualization.arrayToDataTable([
250 250
                             ["'._("Owner").'", "'._("# of times").'"], ';
251 251
                             $owner_data = '';
252
-                          foreach($owner_array as $owner_item)
252
+                          foreach ($owner_array as $owner_item)
253 253
                                     {
254 254
                                             $owner_data .= '[ "'.$owner_item['owner_name'].'",'.$owner_item['owner_count'].'],';
255 255
                                     }
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
                 </div>
278 278
             </div>
279 279
         
280
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
280
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
281 281
         <?php
282 282
     	    }
283 283
     	    if (!empty($flightover_array)) {
@@ -298,7 +298,7 @@  discard block
 block discarded – undo
298 298
                         var data = google.visualization.arrayToDataTable([
299 299
                             ["'._("Country").'", "'._("# of times").'"], ';
300 300
                             $flightover_data = '';
301
-                          foreach($flightover_array as $flightover_item)
301
+                          foreach ($flightover_array as $flightover_item)
302 302
                                     {
303 303
                                             $flightover_data .= '[ "'.$flightover_item['flight_country'].' ('.$flightover_item['flight_country_iso2'].')",'.$flightover_item['flight_count'].'],';
304 304
                                     }
@@ -331,7 +331,7 @@  discard block
 block discarded – undo
331 331
             }
332 332
         ?>
333 333
         </div>
334
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
334
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
335 335
 
336 336
     	
337 337
         </div>
@@ -355,7 +355,7 @@  discard block
 block discarded – undo
355 355
                 var data = google.visualization.arrayToDataTable([ 
356 356
                     ["'._("Airport").'", "'._("# of times").'"],';
357 357
                     $airport_data = '';
358
-                  foreach($airport_airport_array as $airport_item)
358
+                  foreach ($airport_airport_array as $airport_item)
359 359
                         {
360 360
                             $name = $airport_item['airport_departure_city'].', '.$airport_item['airport_departure_country'].' ('.$airport_item['airport_departure_icao'].')';
361 361
                             $name = str_replace("'", "", $name);
@@ -384,7 +384,7 @@  discard block
 block discarded – undo
384 384
                 <a href="<?php print $globalURL; ?>/statistics/airport-departure" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
385 385
               </div>
386 386
             </div>
387
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
387
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
388 388
 
389 389
             <div class="col-md-6">
390 390
                 <h2><?php echo _("Top 10 Most Common Arrival Airports"); ?></h2>
@@ -405,7 +405,7 @@  discard block
 block discarded – undo
405 405
                 var data = google.visualization.arrayToDataTable([ 
406 406
                     ["'._("Airport").'", "'._("# of times").'"],';
407 407
                     $airport_data2 = '';
408
-                  foreach($airport_airport_array2 as $airport_item2)
408
+                  foreach ($airport_airport_array2 as $airport_item2)
409 409
                         {
410 410
                             $name2 = $airport_item2['airport_arrival_city'].', '.$airport_item2['airport_arrival_country'].' ('.$airport_item2['airport_arrival_icao'].')';
411 411
                             $name2 = str_replace("'", "", $name2);
@@ -435,7 +435,7 @@  discard block
 block discarded – undo
435 435
               </div>
436 436
             </div>
437 437
         </div>
438
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
438
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
439 439
 
440 440
         <div class="row column">
441 441
             <div class="col-md-6">
@@ -452,9 +452,9 @@  discard block
 block discarded – undo
452 452
                         var data = google.visualization.arrayToDataTable([
453 453
                             ["'._("Month").'", "'._("# of Flights").'"], ';
454 454
                             $year_data = '';
455
-                          foreach($year_array as $year_item)
455
+                          foreach ($year_array as $year_item)
456 456
                                     {
457
-                                        $year_data .= '[ "'.date('F, Y',strtotime($year_item['year_name'].'-'.$year_item['month_name'].'-01')).'",'.$year_item['date_count'].'],';
457
+                                        $year_data .= '[ "'.date('F, Y', strtotime($year_item['year_name'].'-'.$year_item['month_name'].'-01')).'",'.$year_item['date_count'].'],';
458 458
                                     }
459 459
                                     $year_data = substr($year_data, 0, -1);
460 460
                                     print $year_data;
@@ -482,7 +482,7 @@  discard block
 block discarded – undo
482 482
                     <a href="<?php print $globalURL; ?>/statistics/year" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
483 483
                 </div>
484 484
             </div>
485
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
485
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
486 486
 
487 487
             <div class="col-md-6">
488 488
                 <h2><?php echo _("Busiest Day in the last Month"); ?></h2>
@@ -498,9 +498,9 @@  discard block
 block discarded – undo
498 498
                         var data = google.visualization.arrayToDataTable([
499 499
                             ["'._("Day").'", "'._("# of Flights").'"], ';
500 500
                             $month_data = '';
501
-                          foreach($month_array as $month_item)
501
+                          foreach ($month_array as $month_item)
502 502
                                     {
503
-                                        $month_data .= '[ "'.date('F j, Y',strtotime($month_item['date_name'])).'",'.$month_item['date_count'].'],';
503
+                                        $month_data .= '[ "'.date('F j, Y', strtotime($month_item['date_name'])).'",'.$month_item['date_count'].'],';
504 504
                                     }
505 505
                                     $month_data = substr($month_data, 0, -1);
506 506
                                     print $month_data;
@@ -528,7 +528,7 @@  discard block
 block discarded – undo
528 528
                     <a href="<?php print $globalURL; ?>/statistics/month" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
529 529
                 </div>
530 530
             </div>
531
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
531
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
532 532
 
533 533
             <div class="col-md-6">
534 534
                 <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2>
@@ -545,7 +545,7 @@  discard block
 block discarded – undo
545 545
                             ["'._("Date").'", "'._("# of Flights").'"], ';
546 546
                             $date_data = '';
547 547
                         
548
-                          foreach($date_array as $date_item)
548
+                          foreach ($date_array as $date_item)
549 549
                                     {
550 550
                                         $date_data .= '[ "'.date("F j, Y", strtotime($date_item['date_name'])).'",'.$date_item['date_count'].'],';
551 551
                                     }
@@ -575,12 +575,12 @@  discard block
 block discarded – undo
575 575
                     <a href="<?php print $globalURL; ?>/statistics/date" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
576 576
                 </div>
577 577
             </div>
578
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
578
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
579 579
 
580 580
             <div class="col-md-6">
581 581
                 <h2><?php echo _("Busiest Time of the Day"); ?></h2>
582 582
                 <?php
583
-                  $hour_array = $Stats->countAllHours('hour',$airline_icao);
583
+                  $hour_array = $Stats->countAllHours('hour', $airline_icao);
584 584
 		    if (empty($hour_array)) print _("No data available");
585 585
 		    else {
586 586
 
@@ -592,7 +592,7 @@  discard block
 block discarded – undo
592 592
                         var data = google.visualization.arrayToDataTable([
593 593
                             ["'._("Hour").'", "'._("# of Flights").'"], ';
594 594
                             $hour_data = '';
595
-                          foreach($hour_array as $hour_item)
595
+                          foreach ($hour_array as $hour_item)
596 596
                                     {
597 597
                                         $hour_data .= '[ "'.$hour_item['hour_name'].':00",'.$hour_item['hour_count'].'],';
598 598
                                     }
@@ -622,21 +622,21 @@  discard block
 block discarded – undo
622 622
                     <a href="<?php print $globalURL; ?>/statistics/time" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
623 623
                 </div>
624 624
             </div>
625
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
625
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
626 626
         </div>
627 627
 <?php
628 628
     if ($airline_icao == '') {
629 629
 ?>
630 630
         <div class="row column">
631 631
         	<?php
632
-        	    $polar = $Stats->getStatsSource(date('Y-m-d'),'polar');
632
+        	    $polar = $Stats->getStatsSource(date('Y-m-d'), 'polar');
633 633
         	    if (!empty($polar)) {
634 634
             		print '<h2>'._("Coverage pattern").'</h2>';
635 635
         		foreach ($polar as $eachpolar) {
636 636
         		    unset($polar_data);
637 637
 	        	    $Spotter = new Spotter();
638 638
         		    $data = json_decode($eachpolar['source_data']);
639
-        		    foreach($data as $value => $key) {
639
+        		    foreach ($data as $value => $key) {
640 640
         			$direction = $Spotter->parseDirection(($value*22.5));
641 641
         			$distance = $key;
642 642
         			$unit = 'km';
@@ -656,7 +656,7 @@  discard block
 block discarded – undo
656 656
         	?>
657 657
             <div class="col-md-6">
658 658
                 <h4><?php print $eachpolar['source_name']; ?></h4>
659
-        	<div id="polar-<?php print str_replace(' ','_',strtolower($eachpolar['source_name'])); ?>" class="chart" width="100%"></div>
659
+        	<div id="polar-<?php print str_replace(' ', '_', strtolower($eachpolar['source_name'])); ?>" class="chart" width="100%"></div>
660 660
         	<script>
661 661
         	    (function() {
662 662
         	    var margin = {top: 100, right: 100, bottom: 100, left: 100},
@@ -680,7 +680,7 @@  discard block
 block discarded – undo
680 680
 		      color: color,
681 681
 		      unit: '<?php echo $unit; ?>'
682 682
 		    };
683
-		    RadarChart("#polar-<?php print str_replace(' ','_',strtolower($eachpolar['source_name'])); ?>", data, radarChartOptions);
683
+		    RadarChart("#polar-<?php print str_replace(' ', '_', strtolower($eachpolar['source_name'])); ?>", data, radarChartOptions);
684 684
 		    })();
685 685
 		</script>
686 686
             </div>
@@ -692,19 +692,19 @@  discard block
 block discarded – undo
692 692
         <div class="row column">
693 693
             <div class="col-md-6">
694 694
         	<?php
695
-        	    $msg = $Stats->getStatsSource(date('Y-m-d'),'msg');
695
+        	    $msg = $Stats->getStatsSource(date('Y-m-d'), 'msg');
696 696
         	    if (!empty($msg)) {
697 697
             		print '<h2>'._("Messages received").'</h2>';
698 698
         		foreach ($msg as $eachmsg) {
699 699
         		    //$eachmsg = $msg[0];
700 700
         		    $data = $eachmsg['source_data'];
701
-        		    if ($data > 500) $max = (round(($data+100)/100))*100;
701
+        		    if ($data > 500) $max = (round(($data + 100)/100))*100;
702 702
         		    else $max = 500;
703 703
         	?>
704
-        	<div id="msg-<?php print str_replace(' ','_',strtolower($eachmsg['source_name'])); ?>" class="col-md-4"></div>
704
+        	<div id="msg-<?php print str_replace(' ', '_', strtolower($eachmsg['source_name'])); ?>" class="col-md-4"></div>
705 705
         	<script>
706 706
 		      var g = new JustGage({
707
-			    id: "msg-<?php print str_replace(' ','_',strtolower($eachmsg['source_name'])); ?>",
707
+			    id: "msg-<?php print str_replace(' ', '_', strtolower($eachmsg['source_name'])); ?>",
708 708
 			    value: <?php echo $data; ?>,
709 709
 			    min: 0,
710 710
 			    max: <?php print $max; ?>,
@@ -724,12 +724,12 @@  discard block
 block discarded – undo
724 724
         <div class="row column">
725 725
 
726 726
             <?php
727
-		$hist = $Stats->getStatsSource(date('Y-m-d'),'hist');
727
+		$hist = $Stats->getStatsSource(date('Y-m-d'), 'hist');
728 728
 		foreach ($hist as $hists) {
729 729
 			$hist_data = '';
730 730
 			$source = $hists['source_name'];
731 731
 			$hist_array = json_decode($hists['source_data']);
732
-			foreach($hist_array as $distance => $nb)
732
+			foreach ($hist_array as $distance => $nb)
733 733
 			{
734 734
 				$unit = 'km';
735 735
 				if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) {
@@ -747,13 +747,13 @@  discard block
 block discarded – undo
747 747
 			$hist_data = substr($hist_data, 0, -1);
748 748
             ?>
749 749
             <div class="col-md-6">
750
-                <h2><?php echo sprintf(_("Flights Distance for %s"),$source); ?></h2>
750
+                <h2><?php echo sprintf(_("Flights Distance for %s"), $source); ?></h2>
751 751
                 <?php
752
-                  print '<div id="charthist-'.str_replace(' ','_',strtolower($source)).'" class="chart" width="100%"></div>
752
+                  print '<div id="charthist-'.str_replace(' ', '_', strtolower($source)).'" class="chart" width="100%"></div>
753 753
                     <script> 
754 754
                         google.load("visualization", "1", {packages:["corechart"]});
755
-                      google.setOnLoadCallback(drawCharthist_'.str_replace(' ','_',strtolower($source)).');
756
-                      function drawCharthist_'.str_replace(' ','_',strtolower($source)).'() {
755
+                      google.setOnLoadCallback(drawCharthist_'.str_replace(' ', '_', strtolower($source)).');
756
+                      function drawCharthist_'.str_replace(' ', '_', strtolower($source)).'() {
757 757
                         var data = google.visualization.arrayToDataTable([
758 758
                             ["'._("Distance").'", "'._("# of Flights").'"], ';
759 759
                             print $hist_data;
@@ -768,16 +768,16 @@  discard block
 block discarded – undo
768 768
                             colors: ["#1a3151"]
769 769
                         };
770 770
 
771
-                        var chart = new google.visualization.AreaChart(document.getElementById("charthist-'.str_replace(' ','_',strtolower($source)).'"));
771
+                        var chart = new google.visualization.AreaChart(document.getElementById("charthist-'.str_replace(' ', '_', strtolower($source)).'"));
772 772
                         chart.draw(data, options);
773 773
                       }
774 774
                       $(window).resize(function(){
775
-                              drawCharthist_'.str_replace(' ','_',strtolower($source)).'();
775
+                              drawCharthist_'.str_replace(' ', '_', strtolower($source)).'();
776 776
                             });
777 777
                   </script>';
778 778
         	?>
779 779
     	    </div>
780
-	    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
780
+	    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
781 781
         	<?php
782 782
                   }
783 783
                 ?>
Please login to merge, or discard this patch.
install/class.update_schema.php 3 patches
Indentation   +558 added lines, -558 removed lines patch added patch discarded remove patch
@@ -8,18 +8,18 @@  discard block
 block discarded – undo
8 8
 class update_schema {
9 9
 
10 10
 	public static function update_schedule() {
11
-	    $Connection = new Connection();
12
-	    $Schedule = new Schedule();
13
-	    $query = "SELECT * FROM schedule";
14
-            try {
15
-            	$sth = $Connection->db->prepare($query);
11
+		$Connection = new Connection();
12
+		$Schedule = new Schedule();
13
+		$query = "SELECT * FROM schedule";
14
+			try {
15
+				$sth = $Connection->db->prepare($query);
16 16
 		$sth->execute();
17
-    	    } catch(PDOException $e) {
17
+			} catch(PDOException $e) {
18 18
 		return "error : ".$e->getMessage()."\n";
19
-    	    }
20
-    	    while ($row = $sth->fetch(PDO::FETCH_ASSOC)) {
21
-    		$Schedule->addSchedule($row['ident'],$row['departure_airport_icao'],$row['departure_airport_time'],$row['arrival_airport_icao'],$row['arrival_airport_time']);
22
-    	    }
19
+			}
20
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC)) {
21
+			$Schedule->addSchedule($row['ident'],$row['departure_airport_icao'],$row['departure_airport_time'],$row['arrival_airport_icao'],$row['arrival_airport_time']);
22
+			}
23 23
 	
24 24
 	}
25 25
 /*
@@ -43,198 +43,198 @@  discard block
 block discarded – undo
43 43
     	}
44 44
 */	
45 45
 	private static function update_from_1() {
46
-    		$Connection = new Connection();
47
-    		// Add new column to routes table
48
-    		//$query = "ALTER TABLE `routes` ADD `FromAirport_Time` VARCHAR(10),`ToAirport_Time` VARCHAR(10),`Source` VARCHAR(255),`date_added` DATETIME DEFAULT CURRENT TIMESTAMP,`date_modified` DATETIME,`date_lastseen` DATETIME";
46
+			$Connection = new Connection();
47
+			// Add new column to routes table
48
+			//$query = "ALTER TABLE `routes` ADD `FromAirport_Time` VARCHAR(10),`ToAirport_Time` VARCHAR(10),`Source` VARCHAR(255),`date_added` DATETIME DEFAULT CURRENT TIMESTAMP,`date_modified` DATETIME,`date_lastseen` DATETIME";
49 49
 		$query = "ALTER TABLE `routes` ADD `FromAirport_Time` VARCHAR(10) NULL , ADD `ToAirport_Time` VARCHAR(10) NULL , ADD `Source` VARCHAR(255) NULL, ADD `date_added` timestamp DEFAULT CURRENT_TIMESTAMP, ADD `date_modified` timestamp NULL, ADD `date_lastseen` timestamp NULL";
50
-        	try {
51
-            	    $sth = $Connection->db->prepare($query);
52
-		    $sth->execute();
53
-    		} catch(PDOException $e) {
54
-		    return "error (add new columns to routes table) : ".$e->getMessage()."\n";
55
-    		}
56
-    		// Copy schedules data to routes table
57
-    		self::update_schedule();
58
-    		// Delete schedule table
50
+			try {
51
+					$sth = $Connection->db->prepare($query);
52
+			$sth->execute();
53
+			} catch(PDOException $e) {
54
+			return "error (add new columns to routes table) : ".$e->getMessage()."\n";
55
+			}
56
+			// Copy schedules data to routes table
57
+			self::update_schedule();
58
+			// Delete schedule table
59 59
 		$query = "DROP TABLE `schedule`";
60
-        	try {
61
-            	    $sth = $Connection->db->prepare($query);
62
-		    $sth->execute();
63
-    		} catch(PDOException $e) {
64
-		    return "error (delete schedule table) : ".$e->getMessage()."\n";
65
-    		}
66
-    		// Add source column
67
-    		$query = "ALTER TABLE `aircraft_modes` ADD `Source` VARCHAR(255) NULL";
68
-    		try {
69
-            	    $sth = $Connection->db->prepare($query);
70
-		    $sth->execute();
71
-    		} catch(PDOException $e) {
72
-		    return "error (add source column to aircraft_modes) : ".$e->getMessage()."\n";
73
-    		}
60
+			try {
61
+					$sth = $Connection->db->prepare($query);
62
+			$sth->execute();
63
+			} catch(PDOException $e) {
64
+			return "error (delete schedule table) : ".$e->getMessage()."\n";
65
+			}
66
+			// Add source column
67
+			$query = "ALTER TABLE `aircraft_modes` ADD `Source` VARCHAR(255) NULL";
68
+			try {
69
+					$sth = $Connection->db->prepare($query);
70
+			$sth->execute();
71
+			} catch(PDOException $e) {
72
+			return "error (add source column to aircraft_modes) : ".$e->getMessage()."\n";
73
+			}
74 74
 		// Delete unused column
75 75
 		$query = "ALTER TABLE `aircraft_modes`  DROP `SerialNo`,  DROP `OperatorFlagCode`,  DROP `Manufacturer`,  DROP `Type`,  DROP `FirstRegDate`,  DROP `CurrentRegDate`,  DROP `Country`,  DROP `PreviousID`,  DROP `DeRegDate`,  DROP `Status`,  DROP `PopularName`,  DROP `GenericName`,  DROP `AircraftClass`,  DROP `Engines`,  DROP `OwnershipStatus`,  DROP `RegisteredOwners`,  DROP `MTOW`,  DROP `TotalHours`,  DROP `YearBuilt`,  DROP `CofACategory`,  DROP `CofAExpiry`,  DROP `UserNotes`,  DROP `Interested`,  DROP `UserTag`,  DROP `InfoUrl`,  DROP `PictureUrl1`,  DROP `PictureUrl2`,  DROP `PictureUrl3`,  DROP `UserBool1`,  DROP `UserBool2`,  DROP `UserBool3`,  DROP `UserBool4`,  DROP `UserBool5`,  DROP `UserString1`,  DROP `UserString2`,  DROP `UserString3`,  DROP `UserString4`,  DROP `UserString5`,  DROP `UserInt1`,  DROP `UserInt2`,  DROP `UserInt3`,  DROP `UserInt4`,  DROP `UserInt5`";
76
-    		try {
77
-            	    $sth = $Connection->db->prepare($query);
78
-		    $sth->execute();
79
-    		} catch(PDOException $e) {
80
-		    return "error (Delete unused column of aircraft_modes) : ".$e->getMessage()."\n";
81
-    		}
76
+			try {
77
+					$sth = $Connection->db->prepare($query);
78
+			$sth->execute();
79
+			} catch(PDOException $e) {
80
+			return "error (Delete unused column of aircraft_modes) : ".$e->getMessage()."\n";
81
+			}
82 82
 		// Add ModeS column
83 83
 		$query = "ALTER TABLE `spotter_output`  ADD `ModeS` VARCHAR(255) NULL";
84
-    		try {
85
-            	    $sth = $Connection->db->prepare($query);
86
-		    $sth->execute();
87
-    		} catch(PDOException $e) {
88
-		    return "error (Add ModeS column in spotter_output) : ".$e->getMessage()."\n";
89
-    		}
84
+			try {
85
+					$sth = $Connection->db->prepare($query);
86
+			$sth->execute();
87
+			} catch(PDOException $e) {
88
+			return "error (Add ModeS column in spotter_output) : ".$e->getMessage()."\n";
89
+			}
90 90
 		$query = "ALTER TABLE `spotter_live`  ADD `ModeS` VARCHAR(255)";
91
-    		try {
92
-            	    $sth = $Connection->db->prepare($query);
93
-		    $sth->execute();
94
-    		} catch(PDOException $e) {
95
-		    return "error (Add ModeS column in spotter_live) : ".$e->getMessage()."\n";
96
-    		}
97
-    		// Add auto_increment for aircraft_modes
98
-    		$query = "ALTER TABLE `aircraft_modes` CHANGE `AircraftID` `AircraftID` INT(11) NOT NULL AUTO_INCREMENT";
99
-    		try {
100
-            	    $sth = $Connection->db->prepare($query);
101
-		    $sth->execute();
102
-    		} catch(PDOException $e) {
103
-		    return "error (Add Auto increment in aircraft_modes) : ".$e->getMessage()."\n";
104
-    		}
105
-    		$error = '';
91
+			try {
92
+					$sth = $Connection->db->prepare($query);
93
+			$sth->execute();
94
+			} catch(PDOException $e) {
95
+			return "error (Add ModeS column in spotter_live) : ".$e->getMessage()."\n";
96
+			}
97
+			// Add auto_increment for aircraft_modes
98
+			$query = "ALTER TABLE `aircraft_modes` CHANGE `AircraftID` `AircraftID` INT(11) NOT NULL AUTO_INCREMENT";
99
+			try {
100
+					$sth = $Connection->db->prepare($query);
101
+			$sth->execute();
102
+			} catch(PDOException $e) {
103
+			return "error (Add Auto increment in aircraft_modes) : ".$e->getMessage()."\n";
104
+			}
105
+			$error = '';
106 106
 		$error .= create_db::import_file('../db/acars_live.sql');
107 107
 		$error .= create_db::import_file('../db/config.sql');
108 108
 		// Update schema_version to 2
109 109
 		$query = "UPDATE `config` SET `value` = '2' WHERE `name` = 'schema_version'";
110
-        	try {
111
-            	    $sth = $Connection->db->prepare($query);
112
-		    $sth->execute();
113
-    		} catch(PDOException $e) {
114
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
115
-    		}
110
+			try {
111
+					$sth = $Connection->db->prepare($query);
112
+			$sth->execute();
113
+			} catch(PDOException $e) {
114
+			return "error (update schema_version) : ".$e->getMessage()."\n";
115
+			}
116 116
 		return $error;
117
-        }
117
+		}
118 118
 
119 119
 	private static function update_from_2() {
120
-    		$Connection = new Connection();
121
-    		// Add new column decode to acars_live table
120
+			$Connection = new Connection();
121
+			// Add new column decode to acars_live table
122 122
 		$query = "ALTER TABLE `acars_live` ADD `decode` TEXT";
123
-        	try {
124
-            	    $sth = $Connection->db->prepare($query);
125
-		    $sth->execute();
126
-    		} catch(PDOException $e) {
127
-		    return "error (add new columns to routes table) : ".$e->getMessage()."\n";
128
-    		}
129
-    		$error = '';
130
-    		// Create table acars_archive
123
+			try {
124
+					$sth = $Connection->db->prepare($query);
125
+			$sth->execute();
126
+			} catch(PDOException $e) {
127
+			return "error (add new columns to routes table) : ".$e->getMessage()."\n";
128
+			}
129
+			$error = '';
130
+			// Create table acars_archive
131 131
 		$error .= create_db::import_file('../db/acars_archive.sql');
132 132
 		// Update schema_version to 3
133 133
 		$query = "UPDATE `config` SET `value` = '3' WHERE `name` = 'schema_version'";
134
-        	try {
135
-            	    $sth = $Connection->db->prepare($query);
136
-		    $sth->execute();
137
-    		} catch(PDOException $e) {
138
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
139
-    		}
134
+			try {
135
+					$sth = $Connection->db->prepare($query);
136
+			$sth->execute();
137
+			} catch(PDOException $e) {
138
+			return "error (update schema_version) : ".$e->getMessage()."\n";
139
+			}
140 140
 		return $error;
141 141
 	}
142 142
 
143 143
 	private static function update_from_3() {
144
-    		$Connection = new Connection();
145
-    		// Add default CURRENT_TIMESTAMP to aircraft_modes column FirstCreated
144
+			$Connection = new Connection();
145
+			// Add default CURRENT_TIMESTAMP to aircraft_modes column FirstCreated
146 146
 		$query = "ALTER TABLE `aircraft_modes` CHANGE `FirstCreated` `FirstCreated` timestamp DEFAULT CURRENT_TIMESTAMP";
147
-        	try {
148
-            	    $sth = $Connection->db->prepare($query);
149
-		    $sth->execute();
150
-    		} catch(PDOException $e) {
151
-		    return "error (add new columns to aircraft_modes) : ".$e->getMessage()."\n";
152
-    		}
153
-    		// Add image_source_website column to spotter_image
147
+			try {
148
+					$sth = $Connection->db->prepare($query);
149
+			$sth->execute();
150
+			} catch(PDOException $e) {
151
+			return "error (add new columns to aircraft_modes) : ".$e->getMessage()."\n";
152
+			}
153
+			// Add image_source_website column to spotter_image
154 154
 		$query = "ALTER TABLE `spotter_image` ADD `image_source_website` VARCHAR(999) NULL";
155
-        	try {
156
-            	    $sth = $Connection->db->prepare($query);
157
-		    $sth->execute();
158
-    		} catch(PDOException $e) {
159
-		    return "error (add new columns to spotter_image) : ".$e->getMessage()."\n";
160
-    		}
161
-    		$error = '';
155
+			try {
156
+					$sth = $Connection->db->prepare($query);
157
+			$sth->execute();
158
+			} catch(PDOException $e) {
159
+			return "error (add new columns to spotter_image) : ".$e->getMessage()."\n";
160
+			}
161
+			$error = '';
162 162
 		// Update schema_version to 4
163 163
 		$query = "UPDATE `config` SET `value` = '4' WHERE `name` = 'schema_version'";
164
-        	try {
165
-            	    $sth = $Connection->db->prepare($query);
166
-		    $sth->execute();
167
-    		} catch(PDOException $e) {
168
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
169
-    		}
164
+			try {
165
+					$sth = $Connection->db->prepare($query);
166
+			$sth->execute();
167
+			} catch(PDOException $e) {
168
+			return "error (update schema_version) : ".$e->getMessage()."\n";
169
+			}
170 170
 		return $error;
171 171
 	}
172 172
 	
173 173
 	private static function update_from_4() {
174
-    		$Connection = new Connection();
174
+			$Connection = new Connection();
175 175
 	
176
-    		$error = '';
177
-    		// Create table acars_label
176
+			$error = '';
177
+			// Create table acars_label
178 178
 		$error .= create_db::import_file('../db/acars_label.sql');
179 179
 		if ($error == '') {
180
-		    // Update schema_version to 5
181
-		    $query = "UPDATE `config` SET `value` = '5' WHERE `name` = 'schema_version'";
182
-        	    try {
183
-            		$sth = $Connection->db->prepare($query);
180
+			// Update schema_version to 5
181
+			$query = "UPDATE `config` SET `value` = '5' WHERE `name` = 'schema_version'";
182
+				try {
183
+					$sth = $Connection->db->prepare($query);
184 184
 			$sth->execute();
185
-    		    } catch(PDOException $e) {
185
+				} catch(PDOException $e) {
186 186
 			return "error (update schema_version) : ".$e->getMessage()."\n";
187
-    		    }
188
-    		}
187
+				}
188
+			}
189 189
 		return $error;
190 190
 	}
191 191
 
192 192
 	private static function update_from_5() {
193
-    		$Connection = new Connection();
194
-    		// Add columns to translation
193
+			$Connection = new Connection();
194
+			// Add columns to translation
195 195
 		$query = "ALTER TABLE `translation` ADD `Source` VARCHAR(255) NULL, ADD `date_added` timestamp DEFAULT CURRENT_TIMESTAMP , ADD `date_modified` timestamp DEFAULT CURRENT_TIMESTAMP ;";
196
-        	try {
197
-            	    $sth = $Connection->db->prepare($query);
198
-		    $sth->execute();
199
-    		} catch(PDOException $e) {
200
-		    return "error (add new columns to translation) : ".$e->getMessage()."\n";
201
-    		}
202
-    		// Add aircraft_shadow column to aircraft
203
-    		$query = "ALTER TABLE `aircraft` ADD `aircraft_shadow` VARCHAR(255) NULL";
204
-        	try {
205
-            	    $sth = $Connection->db->prepare($query);
206
-		    $sth->execute();
207
-    		} catch(PDOException $e) {
208
-		    return "error (add new column to aircraft) : ".$e->getMessage()."\n";
209
-    		}
210
-    		// Add aircraft_shadow column to spotter_live
211
-    		$query = "ALTER TABLE `spotter_live` ADD `aircraft_shadow` VARCHAR(255) NULL";
212
-        	try {
213
-            	    $sth = $Connection->db->prepare($query);
214
-		    $sth->execute();
215
-    		} catch(PDOException $e) {
216
-		    return "error (add new column to spotter_live) : ".$e->getMessage()."\n";
217
-    		}
218
-    		$error = '';
219
-    		// Update table aircraft
196
+			try {
197
+					$sth = $Connection->db->prepare($query);
198
+			$sth->execute();
199
+			} catch(PDOException $e) {
200
+			return "error (add new columns to translation) : ".$e->getMessage()."\n";
201
+			}
202
+			// Add aircraft_shadow column to aircraft
203
+			$query = "ALTER TABLE `aircraft` ADD `aircraft_shadow` VARCHAR(255) NULL";
204
+			try {
205
+					$sth = $Connection->db->prepare($query);
206
+			$sth->execute();
207
+			} catch(PDOException $e) {
208
+			return "error (add new column to aircraft) : ".$e->getMessage()."\n";
209
+			}
210
+			// Add aircraft_shadow column to spotter_live
211
+			$query = "ALTER TABLE `spotter_live` ADD `aircraft_shadow` VARCHAR(255) NULL";
212
+			try {
213
+					$sth = $Connection->db->prepare($query);
214
+			$sth->execute();
215
+			} catch(PDOException $e) {
216
+			return "error (add new column to spotter_live) : ".$e->getMessage()."\n";
217
+			}
218
+			$error = '';
219
+			// Update table aircraft
220 220
 		$error .= create_db::import_file('../db/aircraft.sql');
221 221
 		$error .= create_db::import_file('../db/spotter_archive.sql');
222 222
 
223 223
 		// Update schema_version to 6
224 224
 		$query = "UPDATE `config` SET `value` = '6' WHERE `name` = 'schema_version'";
225
-        	try {
226
-            	    $sth = $Connection->db->prepare($query);
227
-		    $sth->execute();
228
-    		} catch(PDOException $e) {
229
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
230
-    		}
225
+			try {
226
+					$sth = $Connection->db->prepare($query);
227
+			$sth->execute();
228
+			} catch(PDOException $e) {
229
+			return "error (update schema_version) : ".$e->getMessage()."\n";
230
+			}
231 231
 		return $error;
232 232
 	}
233 233
 
234 234
 	private static function update_from_6() {
235
-    		$Connection = new Connection();
236
-    		if (!$Connection->indexExists('spotter_output','flightaware_id')) {
237
-    		    $query = "ALTER TABLE spotter_output ADD INDEX(flightaware_id);
235
+			$Connection = new Connection();
236
+			if (!$Connection->indexExists('spotter_output','flightaware_id')) {
237
+				$query = "ALTER TABLE spotter_output ADD INDEX(flightaware_id);
238 238
 			ALTER TABLE spotter_output ADD INDEX(date);
239 239
 			ALTER TABLE spotter_output ADD INDEX(ident);
240 240
 			ALTER TABLE spotter_live ADD INDEX(flightaware_id);
@@ -247,147 +247,147 @@  discard block
 block discarded – undo
247 247
 			ALTER TABLE aircraft ADD INDEX(icao);
248 248
 			ALTER TABLE airport ADD INDEX(icao);
249 249
 			ALTER TABLE translation ADD INDEX(Operator);";
250
-        	    try {
251
-            		$sth = $Connection->db->prepare($query);
250
+				try {
251
+					$sth = $Connection->db->prepare($query);
252 252
 			$sth->execute();
253
-    		    } catch(PDOException $e) {
253
+				} catch(PDOException $e) {
254 254
 			return "error (add some indexes) : ".$e->getMessage()."\n";
255
-    		    }
256
-    		}
257
-    		$error = '';
258
-    		// Update table countries
259
-    		if ($Connection->tableExists('airspace')) {
260
-    		    $error .= update_db::update_countries();
261
-		    if ($error != '') return $error;
255
+				}
256
+			}
257
+			$error = '';
258
+			// Update table countries
259
+			if ($Connection->tableExists('airspace')) {
260
+				$error .= update_db::update_countries();
261
+			if ($error != '') return $error;
262 262
 		}
263 263
 		// Update schema_version to 7
264 264
 		$query = "UPDATE `config` SET `value` = '7' WHERE `name` = 'schema_version'";
265
-        	try {
266
-            	    $sth = $Connection->db->prepare($query);
267
-		    $sth->execute();
268
-    		} catch(PDOException $e) {
269
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
270
-    		}
265
+			try {
266
+					$sth = $Connection->db->prepare($query);
267
+			$sth->execute();
268
+			} catch(PDOException $e) {
269
+			return "error (update schema_version) : ".$e->getMessage()."\n";
270
+			}
271 271
 		return $error;
272
-    	}
272
+		}
273 273
 
274 274
 	private static function update_from_7() {
275 275
 		global $globalDBname, $globalDBdriver;
276
-    		$Connection = new Connection();
277
-    		$query="ALTER TABLE spotter_live ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL;
276
+			$Connection = new Connection();
277
+			$query="ALTER TABLE spotter_live ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL;
278 278
     			ALTER TABLE spotter_output ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL;";
279
-        	try {
280
-            	    $sth = $Connection->db->prepare($query);
281
-		    $sth->execute();
282
-    		} catch(PDOException $e) {
283
-		    return "error (add pilot column to spotter_live and spotter_output) : ".$e->getMessage()."\n";
284
-    		}
285
-    		if ($globalDBdriver == 'mysql') {
286
-    		    $query = "SELECT ENGINE FROM information_schema.TABLES where TABLE_SCHEMA = '".$globalDBname."' AND TABLE_NAME = 'spotter_archive'";
287
-		    try {
288
-            		$sth = $Connection->db->prepare($query);
279
+			try {
280
+					$sth = $Connection->db->prepare($query);
289 281
 			$sth->execute();
290
-    		    } catch(PDOException $e) {
282
+			} catch(PDOException $e) {
283
+			return "error (add pilot column to spotter_live and spotter_output) : ".$e->getMessage()."\n";
284
+			}
285
+			if ($globalDBdriver == 'mysql') {
286
+				$query = "SELECT ENGINE FROM information_schema.TABLES where TABLE_SCHEMA = '".$globalDBname."' AND TABLE_NAME = 'spotter_archive'";
287
+			try {
288
+					$sth = $Connection->db->prepare($query);
289
+			$sth->execute();
290
+				} catch(PDOException $e) {
291 291
 			return "error (problem when select engine for spotter_engine) : ".$e->getMessage()."\n";
292
-    		    }
293
-    		    $row = $sth->fetch(PDO::FETCH_ASSOC);
294
-    		    if ($row['engine'] == 'ARCHIVE') {
292
+				}
293
+				$row = $sth->fetch(PDO::FETCH_ASSOC);
294
+				if ($row['engine'] == 'ARCHIVE') {
295 295
 			$query = "CREATE TABLE copy LIKE spotter_archive; 
296 296
 				ALTER TABLE copy ENGINE=ARCHIVE;
297 297
 				ALTER TABLE copy ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL;
298 298
 				INSERT INTO copy SELECT *, '' as pilot_name, '' as pilot_id FROM spotter_archive ORDER BY `spotter_archive_id`;
299 299
 				DROP TABLE spotter_archive;
300 300
 				RENAME TABLE copy TO spotter_archive;";
301
-            	    } else {
302
-    			$query="ALTER TABLE spotter_archive ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL";
303
-            	    }
304
-                } else {
305
-    		    $query="ALTER TABLE spotter_archive ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL";
306
-                }
307
-        	try {
308
-            	    $sth = $Connection->db->prepare($query);
309
-		    $sth->execute();
310
-    		} catch(PDOException $e) {
311
-		    return "error (add pilot column to spotter_archive) : ".$e->getMessage()."\n";
312
-    		}
301
+					} else {
302
+				$query="ALTER TABLE spotter_archive ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL";
303
+					}
304
+				} else {
305
+				$query="ALTER TABLE spotter_archive ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL";
306
+				}
307
+			try {
308
+					$sth = $Connection->db->prepare($query);
309
+			$sth->execute();
310
+			} catch(PDOException $e) {
311
+			return "error (add pilot column to spotter_archive) : ".$e->getMessage()."\n";
312
+			}
313 313
 
314
-    		$error = '';
315
-    		// Update table aircraft
314
+			$error = '';
315
+			// Update table aircraft
316 316
 		$error .= create_db::import_file('../db/source_location.sql');
317 317
 		if ($error != '') return $error;
318 318
 		// Update schema_version to 6
319 319
 		$query = "UPDATE `config` SET `value` = '8' WHERE `name` = 'schema_version'";
320
-        	try {
321
-            	    $sth = $Connection->db->prepare($query);
322
-		    $sth->execute();
323
-    		} catch(PDOException $e) {
324
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
325
-    		}
320
+			try {
321
+					$sth = $Connection->db->prepare($query);
322
+			$sth->execute();
323
+			} catch(PDOException $e) {
324
+			return "error (update schema_version) : ".$e->getMessage()."\n";
325
+			}
326 326
 		return $error;
327 327
 	}
328 328
 
329 329
 	private static function update_from_8() {
330
-    		$Connection = new Connection();
331
-    		$error = '';
332
-    		// Update table aircraft
330
+			$Connection = new Connection();
331
+			$error = '';
332
+			// Update table aircraft
333 333
 		$error .= create_db::import_file('../db/notam.sql');
334 334
 		if ($error != '') return $error;
335 335
 		$query = "DELETE FROM config WHERE name = 'last_update_db';
336 336
                         INSERT INTO config (name,value) VALUES ('last_update_db',NOW());
337 337
                         DELETE FROM config WHERE name = 'last_update_notam_db';
338 338
                         INSERT INTO config (name,value) VALUES ('last_update_notam_db',NOW());";
339
-        	try {
340
-            	    $sth = $Connection->db->prepare($query);
341
-		    $sth->execute();
342
-    		} catch(PDOException $e) {
343
-		    return "error (insert last_update values) : ".$e->getMessage()."\n";
344
-    		}
339
+			try {
340
+					$sth = $Connection->db->prepare($query);
341
+			$sth->execute();
342
+			} catch(PDOException $e) {
343
+			return "error (insert last_update values) : ".$e->getMessage()."\n";
344
+			}
345 345
 		$query = "UPDATE `config` SET `value` = '9' WHERE `name` = 'schema_version'";
346
-        	try {
347
-            	    $sth = $Connection->db->prepare($query);
348
-		    $sth->execute();
349
-    		} catch(PDOException $e) {
350
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
351
-    		}
346
+			try {
347
+					$sth = $Connection->db->prepare($query);
348
+			$sth->execute();
349
+			} catch(PDOException $e) {
350
+			return "error (update schema_version) : ".$e->getMessage()."\n";
351
+			}
352 352
 		return $error;
353 353
 	}
354 354
 
355 355
 	private static function update_from_9() {
356
-    		$Connection = new Connection();
357
-    		$query="ALTER TABLE spotter_live ADD verticalrate INT(11) NULL;
356
+			$Connection = new Connection();
357
+			$query="ALTER TABLE spotter_live ADD verticalrate INT(11) NULL;
358 358
     			ALTER TABLE spotter_output ADD verticalrate INT(11) NULL;";
359
-        	try {
360
-            	    $sth = $Connection->db->prepare($query);
361
-		    $sth->execute();
362
-    		} catch(PDOException $e) {
363
-		    return "error (add verticalrate column to spotter_live and spotter_output) : ".$e->getMessage()."\n";
364
-    		}
359
+			try {
360
+					$sth = $Connection->db->prepare($query);
361
+			$sth->execute();
362
+			} catch(PDOException $e) {
363
+			return "error (add verticalrate column to spotter_live and spotter_output) : ".$e->getMessage()."\n";
364
+			}
365 365
 		$error = '';
366
-    		// Update table atc
366
+			// Update table atc
367 367
 		$error .= create_db::import_file('../db/atc.sql');
368 368
 		if ($error != '') return $error;
369 369
 		
370 370
 		$query = "UPDATE `config` SET `value` = '10' WHERE `name` = 'schema_version'";
371
-        	try {
372
-            	    $sth = $Connection->db->prepare($query);
373
-		    $sth->execute();
374
-    		} catch(PDOException $e) {
375
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
376
-    		}
371
+			try {
372
+					$sth = $Connection->db->prepare($query);
373
+			$sth->execute();
374
+			} catch(PDOException $e) {
375
+			return "error (update schema_version) : ".$e->getMessage()."\n";
376
+			}
377 377
 		return $error;
378 378
 	}
379 379
 
380 380
 	private static function update_from_10() {
381
-    		$Connection = new Connection();
382
-    		$query="ALTER TABLE atc CHANGE `type` `type` ENUM('Observer','Flight Information','Delivery','Tower','Approach','ACC','Departure','Ground','Flight Service Station','Control Radar or Centre') CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL";
383
-        	try {
384
-            	    $sth = $Connection->db->prepare($query);
385
-		    $sth->execute();
386
-    		} catch(PDOException $e) {
387
-		    return "error (add new enum to ATC table) : ".$e->getMessage()."\n";
388
-    		}
381
+			$Connection = new Connection();
382
+			$query="ALTER TABLE atc CHANGE `type` `type` ENUM('Observer','Flight Information','Delivery','Tower','Approach','ACC','Departure','Ground','Flight Service Station','Control Radar or Centre') CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL";
383
+			try {
384
+					$sth = $Connection->db->prepare($query);
385
+			$sth->execute();
386
+			} catch(PDOException $e) {
387
+			return "error (add new enum to ATC table) : ".$e->getMessage()."\n";
388
+			}
389 389
 		$error = '';
390
-    		// Add tables
390
+			// Add tables
391 391
 		$error .= create_db::import_file('../db/aircraft_owner.sql');
392 392
 		if ($error != '') return $error;
393 393
 		$error .= create_db::import_file('../db/metar.sql');
@@ -398,76 +398,76 @@  discard block
 block discarded – undo
398 398
 		if ($error != '') return $error;
399 399
 		
400 400
 		$query = "UPDATE `config` SET `value` = '11' WHERE `name` = 'schema_version'";
401
-        	try {
402
-            	    $sth = $Connection->db->prepare($query);
403
-		    $sth->execute();
404
-    		} catch(PDOException $e) {
405
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
406
-    		}
401
+			try {
402
+					$sth = $Connection->db->prepare($query);
403
+			$sth->execute();
404
+			} catch(PDOException $e) {
405
+			return "error (update schema_version) : ".$e->getMessage()."\n";
406
+			}
407 407
 		return $error;
408 408
 	}
409 409
 
410 410
 	private static function update_from_11() {
411 411
 		global $globalDBdriver, $globalDBname;
412
-    		$Connection = new Connection();
413
-    		$query="ALTER TABLE spotter_output ADD owner_name VARCHAR(255) NULL DEFAULT NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE, ADD last_ground BOOLEAN NOT NULL DEFAULT FALSE, ADD last_seen DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, ADD last_latitude FLOAT NULL, ADD last_longitude FLOAT NULL, ADD last_altitude INT(11) NULL, ADD last_ground_speed INT(11), ADD real_arrival_airport_icao VARCHAR(999), ADD real_arrival_airport_time VARCHAR(20),ADD real_departure_airport_icao VARCHAR(999), ADD real_departure_airport_time VARCHAR(20)";
414
-        	try {
415
-            	    $sth = $Connection->db->prepare($query);
416
-		    $sth->execute();
417
-    		} catch(PDOException $e) {
418
-		    return "error (add owner_name & format_source column to spotter_output) : ".$e->getMessage()."\n";
419
-    		}
420
-    		$query="ALTER TABLE spotter_live ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE";
421
-        	try {
422
-            	    $sth = $Connection->db->prepare($query);
423
-		    $sth->execute();
424
-    		} catch(PDOException $e) {
425
-		    return "error (format_source column to spotter_live) : ".$e->getMessage()."\n";
426
-    		}
427
-    		if ($globalDBdriver == 'mysql') {
428
-    		    $query = "SELECT ENGINE FROM information_schema.TABLES where TABLE_SCHEMA = '".$globalDBname."' AND TABLE_NAME = 'spotter_archive'";
429
-		    try {
430
-            		$sth = $Connection->db->prepare($query);
412
+			$Connection = new Connection();
413
+			$query="ALTER TABLE spotter_output ADD owner_name VARCHAR(255) NULL DEFAULT NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE, ADD last_ground BOOLEAN NOT NULL DEFAULT FALSE, ADD last_seen DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, ADD last_latitude FLOAT NULL, ADD last_longitude FLOAT NULL, ADD last_altitude INT(11) NULL, ADD last_ground_speed INT(11), ADD real_arrival_airport_icao VARCHAR(999), ADD real_arrival_airport_time VARCHAR(20),ADD real_departure_airport_icao VARCHAR(999), ADD real_departure_airport_time VARCHAR(20)";
414
+			try {
415
+					$sth = $Connection->db->prepare($query);
416
+			$sth->execute();
417
+			} catch(PDOException $e) {
418
+			return "error (add owner_name & format_source column to spotter_output) : ".$e->getMessage()."\n";
419
+			}
420
+			$query="ALTER TABLE spotter_live ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE";
421
+			try {
422
+					$sth = $Connection->db->prepare($query);
431 423
 			$sth->execute();
432
-    		    } catch(PDOException $e) {
424
+			} catch(PDOException $e) {
425
+			return "error (format_source column to spotter_live) : ".$e->getMessage()."\n";
426
+			}
427
+			if ($globalDBdriver == 'mysql') {
428
+				$query = "SELECT ENGINE FROM information_schema.TABLES where TABLE_SCHEMA = '".$globalDBname."' AND TABLE_NAME = 'spotter_archive'";
429
+			try {
430
+					$sth = $Connection->db->prepare($query);
431
+			$sth->execute();
432
+				} catch(PDOException $e) {
433 433
 			return "error (problem when select engine for spotter_engine) : ".$e->getMessage()."\n";
434
-    		    }
435
-    		    $row = $sth->fetch(PDO::FETCH_ASSOC);
436
-    		    if ($row['engine'] == 'ARCHIVE') {
434
+				}
435
+				$row = $sth->fetch(PDO::FETCH_ASSOC);
436
+				if ($row['engine'] == 'ARCHIVE') {
437 437
 			$query = "CREATE TABLE copy LIKE spotter_archive; 
438 438
 				ALTER TABLE copy ENGINE=ARCHIVE;
439 439
 				ALTER TABLE copy ADD verticalrate INT(11) NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE;
440 440
 				INSERT INTO copy SELECT *, '' as verticalrate, '' as format_source, '0' as ground FROM spotter_archive ORDER BY `spotter_archive_id`;
441 441
 				DROP TABLE spotter_archive;
442 442
 				RENAME TABLE copy TO spotter_archive;";
443
-            	    } else {
444
-    			$query="ALTER TABLE spotter_archive ADD verticalrate INT(11) NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE";
445
-            	    }
446
-                } else {
447
-    		    $query="ALTER TABLE spotter_archive ADD verticalrate INT(11) NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE";
448
-                }
449
-        	try {
450
-            	    $sth = $Connection->db->prepare($query);
451
-		    $sth->execute();
452
-    		} catch(PDOException $e) {
453
-		    return "error (add columns to spotter_archive) : ".$e->getMessage()."\n";
454
-    		}
443
+					} else {
444
+				$query="ALTER TABLE spotter_archive ADD verticalrate INT(11) NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE";
445
+					}
446
+				} else {
447
+				$query="ALTER TABLE spotter_archive ADD verticalrate INT(11) NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE";
448
+				}
449
+			try {
450
+					$sth = $Connection->db->prepare($query);
451
+			$sth->execute();
452
+			} catch(PDOException $e) {
453
+			return "error (add columns to spotter_archive) : ".$e->getMessage()."\n";
454
+			}
455 455
 
456 456
 		$error = '';
457 457
 		
458 458
 		$query = "UPDATE `config` SET `value` = '12' WHERE `name` = 'schema_version'";
459
-        	try {
460
-            	    $sth = $Connection->db->prepare($query);
461
-		    $sth->execute();
462
-    		} catch(PDOException $e) {
463
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
464
-    		}
459
+			try {
460
+					$sth = $Connection->db->prepare($query);
461
+			$sth->execute();
462
+			} catch(PDOException $e) {
463
+			return "error (update schema_version) : ".$e->getMessage()."\n";
464
+			}
465 465
 		return $error;
466 466
 	}
467 467
 	private static function update_from_12() {
468
-    		$Connection = new Connection();
468
+			$Connection = new Connection();
469 469
 		$error = '';
470
-    		// Add tables
470
+			// Add tables
471 471
 		$error .= create_db::import_file('../db/stats.sql');
472 472
 		if ($error != '') return $error;
473 473
 		$error .= create_db::import_file('../db/stats_aircraft.sql');
@@ -484,166 +484,166 @@  discard block
 block discarded – undo
484 484
 		if ($error != '') return $error;
485 485
 		
486 486
 		$query = "UPDATE `config` SET `value` = '13' WHERE `name` = 'schema_version'";
487
-        	try {
488
-            	    $sth = $Connection->db->prepare($query);
489
-		    $sth->execute();
490
-    		} catch(PDOException $e) {
491
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
492
-    		}
487
+			try {
488
+					$sth = $Connection->db->prepare($query);
489
+			$sth->execute();
490
+			} catch(PDOException $e) {
491
+			return "error (update schema_version) : ".$e->getMessage()."\n";
492
+			}
493 493
 		return $error;
494 494
 	}
495 495
 
496 496
 	private static function update_from_13() {
497
-    		$Connection = new Connection();
498
-    		if (!$Connection->checkColumnName('spotter_archive_output','real_departure_airport_icao')) {
499
-    			$query="ALTER TABLE spotter_archive_output ADD real_departure_airport_icao VARCHAR(20), ADD real_departure_airport_time VARCHAR(20)";
497
+			$Connection = new Connection();
498
+			if (!$Connection->checkColumnName('spotter_archive_output','real_departure_airport_icao')) {
499
+				$query="ALTER TABLE spotter_archive_output ADD real_departure_airport_icao VARCHAR(20), ADD real_departure_airport_time VARCHAR(20)";
500 500
 			try {
501 501
 				$sth = $Connection->db->prepare($query);
502 502
 				$sth->execute();
503
-	    		} catch(PDOException $e) {
503
+				} catch(PDOException $e) {
504 504
 				return "error (update spotter_archive_output) : ".$e->getMessage()."\n";
505
-    			}
505
+				}
506 506
 		}
507
-    		$error = '';
507
+			$error = '';
508 508
 		$query = "UPDATE `config` SET `value` = '14' WHERE `name` = 'schema_version'";
509
-        	try {
510
-            	    $sth = $Connection->db->prepare($query);
511
-		    $sth->execute();
512
-    		} catch(PDOException $e) {
513
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
514
-    		}
509
+			try {
510
+					$sth = $Connection->db->prepare($query);
511
+			$sth->execute();
512
+			} catch(PDOException $e) {
513
+			return "error (update schema_version) : ".$e->getMessage()."\n";
514
+			}
515 515
 		return $error;
516 516
 	}
517 517
 
518 518
 	private static function update_from_14() {
519
-    		$Connection = new Connection();
519
+			$Connection = new Connection();
520 520
 		$error = '';
521
-    		// Add tables
522
-    		if (!$Connection->tableExists('stats_flight')) {
521
+			// Add tables
522
+			if (!$Connection->tableExists('stats_flight')) {
523 523
 			$error .= create_db::import_file('../db/stats_flight.sql');
524 524
 			if ($error != '') return $error;
525 525
 		}
526 526
 		$query = "UPDATE `config` SET `value` = '15' WHERE `name` = 'schema_version'";
527
-        	try {
528
-            	    $sth = $Connection->db->prepare($query);
529
-		    $sth->execute();
530
-    		} catch(PDOException $e) {
531
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
532
-    		}
527
+			try {
528
+					$sth = $Connection->db->prepare($query);
529
+			$sth->execute();
530
+			} catch(PDOException $e) {
531
+			return "error (update schema_version) : ".$e->getMessage()."\n";
532
+			}
533 533
 		return $error;
534 534
 	}
535 535
 
536 536
 
537 537
 	private static function update_from_15() {
538
-    		$Connection = new Connection();
538
+			$Connection = new Connection();
539 539
 		$error = '';
540
-    		// Add tables
541
-    		$query="ALTER TABLE `stats` CHANGE `stats_date` `stats_date` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP";
542
-        	try {
543
-            	    $sth = $Connection->db->prepare($query);
544
-		    $sth->execute();
545
-    		} catch(PDOException $e) {
546
-		    return "error (update stats) : ".$e->getMessage()."\n";
547
-    		}
540
+			// Add tables
541
+			$query="ALTER TABLE `stats` CHANGE `stats_date` `stats_date` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP";
542
+			try {
543
+					$sth = $Connection->db->prepare($query);
544
+			$sth->execute();
545
+			} catch(PDOException $e) {
546
+			return "error (update stats) : ".$e->getMessage()."\n";
547
+			}
548 548
 		if ($error != '') return $error;
549 549
 		$query = "UPDATE `config` SET `value` = '16' WHERE `name` = 'schema_version'";
550
-        	try {
551
-            	    $sth = $Connection->db->prepare($query);
552
-		    $sth->execute();
553
-    		} catch(PDOException $e) {
554
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
555
-    		}
550
+			try {
551
+					$sth = $Connection->db->prepare($query);
552
+			$sth->execute();
553
+			} catch(PDOException $e) {
554
+			return "error (update schema_version) : ".$e->getMessage()."\n";
555
+			}
556 556
 		return $error;
557 557
 	}
558 558
 
559 559
 	private static function update_from_16() {
560
-    		$Connection = new Connection();
560
+			$Connection = new Connection();
561 561
 		$error = '';
562
-    		// Add tables
563
-    		if (!$Connection->tableExists('stats_registration')) {
562
+			// Add tables
563
+			if (!$Connection->tableExists('stats_registration')) {
564 564
 			$error .= create_db::import_file('../db/stats_registration.sql');
565 565
 		}
566
-    		if (!$Connection->tableExists('stats_callsign')) {
566
+			if (!$Connection->tableExists('stats_callsign')) {
567 567
 			$error .= create_db::import_file('../db/stats_callsign.sql');
568 568
 		}
569 569
 		if ($error != '') return $error;
570 570
 		$query = "UPDATE `config` SET `value` = '17' WHERE `name` = 'schema_version'";
571
-        	try {
572
-            	    $sth = $Connection->db->prepare($query);
573
-		    $sth->execute();
574
-    		} catch(PDOException $e) {
575
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
576
-    		}
571
+			try {
572
+					$sth = $Connection->db->prepare($query);
573
+			$sth->execute();
574
+			} catch(PDOException $e) {
575
+			return "error (update schema_version) : ".$e->getMessage()."\n";
576
+			}
577 577
 		return $error;
578 578
 	}
579 579
 
580 580
 	private static function update_from_17() {
581
-    		$Connection = new Connection();
581
+			$Connection = new Connection();
582 582
 		$error = '';
583
-    		// Add tables
584
-    		if (!$Connection->tableExists('stats_country')) {
583
+			// Add tables
584
+			if (!$Connection->tableExists('stats_country')) {
585 585
 			$error .= create_db::import_file('../db/stats_country.sql');
586 586
 		}
587 587
 		if ($error != '') return $error;
588 588
 		$query = "UPDATE `config` SET `value` = '18' WHERE `name` = 'schema_version'";
589
-        	try {
590
-            	    $sth = $Connection->db->prepare($query);
591
-		    $sth->execute();
592
-    		} catch(PDOException $e) {
593
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
594
-    		}
589
+			try {
590
+					$sth = $Connection->db->prepare($query);
591
+			$sth->execute();
592
+			} catch(PDOException $e) {
593
+			return "error (update schema_version) : ".$e->getMessage()."\n";
594
+			}
595 595
 		return $error;
596 596
 	}
597 597
 	private static function update_from_18() {
598
-    		$Connection = new Connection();
598
+			$Connection = new Connection();
599 599
 		$error = '';
600
-    		// Modify stats_airport table
601
-    		if (!$Connection->checkColumnName('stats_airport','airport_name')) {
602
-    			$query = "ALTER TABLE `stats_airport` ADD `stats_type` VARCHAR(50) NOT NULL DEFAULT 'yearly', ADD `airport_name` VARCHAR(255) NOT NULL, ADD `date` DATE NULL DEFAULT NULL, DROP INDEX `airport_icao`, ADD UNIQUE `airport_icao` (`airport_icao`, `type`, `date`)";
603
-    	        	try {
604
-	            	    $sth = $Connection->db->prepare($query);
605
-			    $sth->execute();
606
-    			} catch(PDOException $e) {
607
-			    return "error (update stats) : ".$e->getMessage()."\n";
608
-    			}
609
-    		}
600
+			// Modify stats_airport table
601
+			if (!$Connection->checkColumnName('stats_airport','airport_name')) {
602
+				$query = "ALTER TABLE `stats_airport` ADD `stats_type` VARCHAR(50) NOT NULL DEFAULT 'yearly', ADD `airport_name` VARCHAR(255) NOT NULL, ADD `date` DATE NULL DEFAULT NULL, DROP INDEX `airport_icao`, ADD UNIQUE `airport_icao` (`airport_icao`, `type`, `date`)";
603
+					try {
604
+						$sth = $Connection->db->prepare($query);
605
+				$sth->execute();
606
+				} catch(PDOException $e) {
607
+				return "error (update stats) : ".$e->getMessage()."\n";
608
+				}
609
+			}
610 610
 		if ($error != '') return $error;
611 611
 		$query = "UPDATE `config` SET `value` = '19' WHERE `name` = 'schema_version'";
612
-        	try {
613
-            	    $sth = $Connection->db->prepare($query);
614
-		    $sth->execute();
615
-    		} catch(PDOException $e) {
616
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
617
-    		}
612
+			try {
613
+					$sth = $Connection->db->prepare($query);
614
+			$sth->execute();
615
+			} catch(PDOException $e) {
616
+			return "error (update schema_version) : ".$e->getMessage()."\n";
617
+			}
618 618
 		return $error;
619 619
 	}
620 620
 
621 621
 	private static function update_from_19() {
622
-    		$Connection = new Connection();
622
+			$Connection = new Connection();
623 623
 		$error = '';
624
-    		// Update airport table
624
+			// Update airport table
625 625
 		$error .= create_db::import_file('../db/airport.sql');
626 626
 		if ($error != '') return 'Import airport.sql : '.$error;
627 627
 		// Remove primary key on Spotter_Archive
628 628
 		$query = "alter table spotter_archive drop spotter_archive_id";
629
-        	try {
630
-            	    $sth = $Connection->db->prepare($query);
631
-		    $sth->execute();
632
-    		} catch(PDOException $e) {
633
-		    return "error (remove primary key on spotter_archive) : ".$e->getMessage()."\n";
634
-    		}
629
+			try {
630
+					$sth = $Connection->db->prepare($query);
631
+			$sth->execute();
632
+			} catch(PDOException $e) {
633
+			return "error (remove primary key on spotter_archive) : ".$e->getMessage()."\n";
634
+			}
635 635
 		$query = "alter table spotter_archive add spotter_archive_id INT(11)";
636
-        	try {
637
-            	    $sth = $Connection->db->prepare($query);
638
-		    $sth->execute();
639
-    		} catch(PDOException $e) {
640
-		    return "error (add id again on spotter_archive) : ".$e->getMessage()."\n";
641
-    		}
636
+			try {
637
+					$sth = $Connection->db->prepare($query);
638
+			$sth->execute();
639
+			} catch(PDOException $e) {
640
+			return "error (add id again on spotter_archive) : ".$e->getMessage()."\n";
641
+			}
642 642
 		if (!$Connection->checkColumnName('spotter_archive','over_country')) {
643 643
 			// Add column over_country
644
-    			$query = "ALTER TABLE `spotter_archive` ADD `over_country` VARCHAR(5) NULL DEFAULT NULL";
644
+				$query = "ALTER TABLE `spotter_archive` ADD `over_country` VARCHAR(5) NULL DEFAULT NULL";
645 645
 			try {
646
-            			$sth = $Connection->db->prepare($query);
646
+						$sth = $Connection->db->prepare($query);
647 647
 				$sth->execute();
648 648
 			} catch(PDOException $e) {
649 649
 				return "error (add over_country) : ".$e->getMessage()."\n";
@@ -651,9 +651,9 @@  discard block
 block discarded – undo
651 651
 		}
652 652
 		if (!$Connection->checkColumnName('spotter_live','over_country')) {
653 653
 			// Add column over_country
654
-    			$query = "ALTER TABLE `spotter_live` ADD `over_country` VARCHAR(5) NULL DEFAULT NULL";
654
+				$query = "ALTER TABLE `spotter_live` ADD `over_country` VARCHAR(5) NULL DEFAULT NULL";
655 655
 			try {
656
-            			$sth = $Connection->db->prepare($query);
656
+						$sth = $Connection->db->prepare($query);
657 657
 				$sth->execute();
658 658
 			} catch(PDOException $e) {
659 659
 				return "error (add over_country) : ".$e->getMessage()."\n";
@@ -661,74 +661,74 @@  discard block
 block discarded – undo
661 661
 		}
662 662
 		if (!$Connection->checkColumnName('spotter_output','source_name')) {
663 663
 			// Add source_name to spotter_output, spotter_live, spotter_archive, spotter_archive_output
664
-    			$query = "ALTER TABLE `spotter_output` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`";
664
+				$query = "ALTER TABLE `spotter_output` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`";
665 665
 			try {
666 666
 				$sth = $Connection->db->prepare($query);
667 667
 				$sth->execute();
668 668
 			} catch(PDOException $e) {
669 669
 				return "error (add source_name column) : ".$e->getMessage()."\n";
670
-    			}
671
-    		}
670
+				}
671
+			}
672 672
 		if (!$Connection->checkColumnName('spotter_live','source_name')) {
673 673
 			// Add source_name to spotter_output, spotter_live, spotter_archive, spotter_archive_output
674
-    			$query = "ALTER TABLE `spotter_live` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`";
674
+				$query = "ALTER TABLE `spotter_live` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`";
675 675
 			try {
676 676
 				$sth = $Connection->db->prepare($query);
677 677
 				$sth->execute();
678 678
 			} catch(PDOException $e) {
679 679
 				return "error (add source_name column) : ".$e->getMessage()."\n";
680
-    			}
681
-    		}
680
+				}
681
+			}
682 682
 		if (!$Connection->checkColumnName('spotter_archive_output','source_name')) {
683 683
 			// Add source_name to spotter_output, spotter_live, spotter_archive, spotter_archive_output
684
-    			$query = "ALTER TABLE `spotter_archive_output` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`";
684
+				$query = "ALTER TABLE `spotter_archive_output` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`";
685 685
 			try {
686 686
 				$sth = $Connection->db->prepare($query);
687 687
 				$sth->execute();
688 688
 			} catch(PDOException $e) {
689 689
 				return "error (add source_name column) : ".$e->getMessage()."\n";
690
-    			}
691
-    		}
690
+				}
691
+			}
692 692
 		if (!$Connection->checkColumnName('spotter_archive','source_name')) {
693 693
 			// Add source_name to spotter_output, spotter_live, spotter_archive, spotter_archive_output
694
-    			$query = "ALTER TABLE `spotter_archive` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`;";
694
+				$query = "ALTER TABLE `spotter_archive` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`;";
695 695
 			try {
696 696
 				$sth = $Connection->db->prepare($query);
697 697
 				$sth->execute();
698 698
 			} catch(PDOException $e) {
699 699
 				return "error (add source_name column) : ".$e->getMessage()."\n";
700
-    			}
701
-    		}
700
+				}
701
+			}
702 702
 		if ($error != '') return $error;
703 703
 		$query = "UPDATE `config` SET `value` = '20' WHERE `name` = 'schema_version'";
704
-        	try {
705
-            	    $sth = $Connection->db->prepare($query);
706
-		    $sth->execute();
707
-    		} catch(PDOException $e) {
708
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
709
-    		}
704
+			try {
705
+					$sth = $Connection->db->prepare($query);
706
+			$sth->execute();
707
+			} catch(PDOException $e) {
708
+			return "error (update schema_version) : ".$e->getMessage()."\n";
709
+			}
710 710
 		return $error;
711 711
 	}
712 712
 
713 713
 	private static function update_from_20() {
714 714
 		global $globalIVAO, $globalVATSIM, $globalphpVMS;
715
-    		$Connection = new Connection();
715
+			$Connection = new Connection();
716 716
 		$error = '';
717
-    		// Update airline table
718
-    		if (!$globalIVAO && !$globalVATSIM && !$globalphpVMS) {
717
+			// Update airline table
718
+			if (!$globalIVAO && !$globalVATSIM && !$globalphpVMS) {
719 719
 			$error .= create_db::import_file('../db/airlines.sql');
720 720
 			if ($error != '') return 'Import airlines.sql : '.$error;
721 721
 		}
722 722
 		if (!$Connection->checkColumnName('aircraft_modes','type_flight')) {
723 723
 			// Add column over_country
724
-    			$query = "ALTER TABLE `aircraft_modes` ADD `type_flight` VARCHAR(50) NULL DEFAULT NULL;";
725
-        		try {
724
+				$query = "ALTER TABLE `aircraft_modes` ADD `type_flight` VARCHAR(50) NULL DEFAULT NULL;";
725
+				try {
726 726
 				$sth = $Connection->db->prepare($query);
727 727
 				$sth->execute();
728 728
 			} catch(PDOException $e) {
729 729
 				return "error (add over_country) : ".$e->getMessage()."\n";
730
-    			}
731
-    		}
730
+				}
731
+			}
732 732
 		if ($error != '') return $error;
733 733
 		/*
734 734
     		if (!$globalIVAO && !$globalVATSIM && !$globalphpVMS) {
@@ -738,12 +738,12 @@  discard block
 block discarded – undo
738 738
 		}
739 739
 		*/
740 740
 		$query = "UPDATE `config` SET `value` = '21' WHERE `name` = 'schema_version'";
741
-        	try {
742
-            	    $sth = $Connection->db->prepare($query);
743
-		    $sth->execute();
744
-    		} catch(PDOException $e) {
745
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
746
-    		}
741
+			try {
742
+					$sth = $Connection->db->prepare($query);
743
+			$sth->execute();
744
+			} catch(PDOException $e) {
745
+			return "error (update schema_version) : ".$e->getMessage()."\n";
746
+			}
747 747
 		return $error;
748 748
 	}
749 749
 
@@ -762,35 +762,35 @@  discard block
 block discarded – undo
762 762
 			if ($error != '') return $error;
763 763
 		}
764 764
 		$query = "UPDATE `config` SET `value` = '22' WHERE `name` = 'schema_version'";
765
-        	try {
766
-            	    $sth = $Connection->db->prepare($query);
767
-		    $sth->execute();
768
-    		} catch(PDOException $e) {
769
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
770
-    		}
765
+			try {
766
+					$sth = $Connection->db->prepare($query);
767
+			$sth->execute();
768
+			} catch(PDOException $e) {
769
+			return "error (update schema_version) : ".$e->getMessage()."\n";
770
+			}
771 771
 		return $error;
772 772
 	}
773 773
 
774 774
 	private static function update_from_22() {
775 775
 		global $globalDBdriver;
776
-    		$Connection = new Connection();
776
+			$Connection = new Connection();
777 777
 		$error = '';
778 778
 		// Add table stats polar
779
-    		if (!$Connection->tableExists('stats_source')) {
779
+			if (!$Connection->tableExists('stats_source')) {
780 780
 			if ($globalDBdriver == 'mysql') {
781
-    				$error .= create_db::import_file('../db/stats_source.sql');
781
+					$error .= create_db::import_file('../db/stats_source.sql');
782 782
 			} else {
783 783
 				$error .= create_db::import_file('../db/pgsql/stats_source.sql');
784 784
 			}
785 785
 			if ($error != '') return $error;
786 786
 		}
787 787
 		$query = "UPDATE config SET value = '23' WHERE name = 'schema_version'";
788
-        	try {
789
-            	    $sth = $Connection->db->prepare($query);
790
-		    $sth->execute();
791
-    		} catch(PDOException $e) {
792
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
793
-    		}
788
+			try {
789
+					$sth = $Connection->db->prepare($query);
790
+			$sth->execute();
791
+			} catch(PDOException $e) {
792
+			return "error (update schema_version) : ".$e->getMessage()."\n";
793
+			}
794 794
 		return $error;
795 795
 	}
796 796
 
@@ -821,14 +821,14 @@  discard block
 block discarded – undo
821 821
 		}
822 822
 		if (!$Connection->checkColumnName('stats_aircraft','aircraft_manufacturer')) {
823 823
 			// Add aircraft_manufacturer to stats_aircraft
824
-    			$query = "ALTER TABLE stats_aircraft ADD aircraft_manufacturer VARCHAR(255) NULL";
824
+				$query = "ALTER TABLE stats_aircraft ADD aircraft_manufacturer VARCHAR(255) NULL";
825 825
 			try {
826 826
 				$sth = $Connection->db->prepare($query);
827 827
 				$sth->execute();
828 828
 			} catch(PDOException $e) {
829 829
 				return "error (add aircraft_manufacturer column) : ".$e->getMessage()."\n";
830
-    			}
831
-    		}
830
+				}
831
+			}
832 832
 		
833 833
 		$query = "UPDATE config SET value = '24' WHERE name = 'schema_version'";
834 834
 		try {
@@ -1095,129 +1095,129 @@  discard block
 block discarded – undo
1095 1095
 
1096 1096
 
1097 1097
 
1098
-    	public static function check_version($update = false) {
1099
-    	    global $globalDBname;
1100
-    	    $version = 0;
1101
-    	    $Connection = new Connection();
1102
-    	    if ($Connection->tableExists('aircraft')) {
1103
-    		if (!$Connection->tableExists('config')) {
1104
-    		    $version = '1';
1105
-    		    if ($update) return self::update_from_1();
1106
-    		    else return $version;
1098
+		public static function check_version($update = false) {
1099
+			global $globalDBname;
1100
+			$version = 0;
1101
+			$Connection = new Connection();
1102
+			if ($Connection->tableExists('aircraft')) {
1103
+			if (!$Connection->tableExists('config')) {
1104
+				$version = '1';
1105
+				if ($update) return self::update_from_1();
1106
+				else return $version;
1107 1107
 		} else {
1108
-    		    $Connection = new Connection();
1109
-		    $query = "SELECT value FROM config WHERE name = 'schema_version' LIMIT 1";
1110
-		    try {
1111
-            		$sth = $Connection->db->prepare($query);
1112
-		        $sth->execute();
1113
-		    } catch(PDOException $e) {
1108
+				$Connection = new Connection();
1109
+			$query = "SELECT value FROM config WHERE name = 'schema_version' LIMIT 1";
1110
+			try {
1111
+					$sth = $Connection->db->prepare($query);
1112
+				$sth->execute();
1113
+			} catch(PDOException $e) {
1114 1114
 			return "error : ".$e->getMessage()."\n";
1115
-    		    }
1116
-    		    $result = $sth->fetch(PDO::FETCH_ASSOC);
1117
-    		    if ($update) {
1118
-    			if ($result['value'] == '2') {
1119
-    			    $error = self::update_from_2();
1120
-    			    if ($error != '') return $error;
1121
-    			    else return self::check_version(true);
1122
-    			} elseif ($result['value'] == '3') {
1123
-    			    $error = self::update_from_3();
1124
-    			    if ($error != '') return $error;
1125
-    			    else return self::check_version(true);
1126
-    			} elseif ($result['value'] == '4') {
1127
-    			    $error = self::update_from_4();
1128
-    			    if ($error != '') return $error;
1129
-    			    else return self::check_version(true);
1130
-    			} elseif ($result['value'] == '5') {
1131
-    			    $error = self::update_from_5();
1132
-    			    if ($error != '') return $error;
1133
-    			    else return self::check_version(true);
1134
-    			} elseif ($result['value'] == '6') {
1135
-    			    $error = self::update_from_6();
1136
-    			    if ($error != '') return $error;
1137
-    			    else return self::check_version(true);
1138
-    			} elseif ($result['value'] == '7') {
1139
-    			    $error = self::update_from_7();
1140
-    			    if ($error != '') return $error;
1141
-    			    else return self::check_version(true);
1142
-    			} elseif ($result['value'] == '8') {
1143
-    			    $error = self::update_from_8();
1144
-    			    if ($error != '') return $error;
1145
-    			    else return self::check_version(true);
1146
-    			} elseif ($result['value'] == '9') {
1147
-    			    $error = self::update_from_9();
1148
-    			    if ($error != '') return $error;
1149
-    			    else return self::check_version(true);
1150
-    			} elseif ($result['value'] == '10') {
1151
-    			    $error = self::update_from_10();
1152
-    			    if ($error != '') return $error;
1153
-    			    else return self::check_version(true);
1154
-    			} elseif ($result['value'] == '11') {
1155
-    			    $error = self::update_from_11();
1156
-    			    if ($error != '') return $error;
1157
-    			    else return self::check_version(true);
1158
-    			} elseif ($result['value'] == '12') {
1159
-    			    $error = self::update_from_12();
1160
-    			    if ($error != '') return $error;
1161
-    			    else return self::check_version(true);
1162
-    			} elseif ($result['value'] == '13') {
1163
-    			    $error = self::update_from_13();
1164
-    			    if ($error != '') return $error;
1165
-    			    else return self::check_version(true);
1166
-    			} elseif ($result['value'] == '14') {
1167
-    			    $error = self::update_from_14();
1168
-    			    if ($error != '') return $error;
1169
-    			    else return self::check_version(true);
1170
-    			} elseif ($result['value'] == '15') {
1171
-    			    $error = self::update_from_15();
1172
-    			    if ($error != '') return $error;
1173
-    			    else return self::check_version(true);
1174
-    			} elseif ($result['value'] == '16') {
1175
-    			    $error = self::update_from_16();
1176
-    			    if ($error != '') return $error;
1177
-    			    else return self::check_version(true);
1178
-    			} elseif ($result['value'] == '17') {
1179
-    			    $error = self::update_from_17();
1180
-    			    if ($error != '') return $error;
1181
-    			    else return self::check_version(true);
1182
-    			} elseif ($result['value'] == '18') {
1183
-    			    $error = self::update_from_18();
1184
-    			    if ($error != '') return $error;
1185
-    			    else return self::check_version(true);
1186
-    			} elseif ($result['value'] == '19') {
1187
-    			    $error = self::update_from_19();
1188
-    			    if ($error != '') return $error;
1189
-    			    else return self::check_version(true);
1190
-    			} elseif ($result['value'] == '20') {
1191
-    			    $error = self::update_from_20();
1192
-    			    if ($error != '') return $error;
1193
-    			    else return self::check_version(true);
1194
-    			} elseif ($result['value'] == '21') {
1195
-    			    $error = self::update_from_21();
1196
-    			    if ($error != '') return $error;
1197
-    			    else return self::check_version(true);
1198
-    			} elseif ($result['value'] == '22') {
1199
-    			    $error = self::update_from_22();
1200
-    			    if ($error != '') return $error;
1201
-    			    else return self::check_version(true);
1202
-    			} elseif ($result['value'] == '23') {
1203
-    			    $error = self::update_from_23();
1204
-    			    if ($error != '') return $error;
1205
-    			    else return self::check_version(true);
1206
-    			} elseif ($result['value'] == '24') {
1207
-    			    $error = self::update_from_24();
1208
-    			    if ($error != '') return $error;
1209
-    			    else return self::check_version(true);
1210
-    			} elseif ($result['value'] == '25') {
1211
-    			    $error = self::update_from_25();
1212
-    			    if ($error != '') return $error;
1213
-    			    else return self::check_version(true);
1214
-    			} else return '';
1215
-    		    }
1216
-    		    else return $result['value'];
1115
+				}
1116
+				$result = $sth->fetch(PDO::FETCH_ASSOC);
1117
+				if ($update) {
1118
+				if ($result['value'] == '2') {
1119
+					$error = self::update_from_2();
1120
+					if ($error != '') return $error;
1121
+					else return self::check_version(true);
1122
+				} elseif ($result['value'] == '3') {
1123
+					$error = self::update_from_3();
1124
+					if ($error != '') return $error;
1125
+					else return self::check_version(true);
1126
+				} elseif ($result['value'] == '4') {
1127
+					$error = self::update_from_4();
1128
+					if ($error != '') return $error;
1129
+					else return self::check_version(true);
1130
+				} elseif ($result['value'] == '5') {
1131
+					$error = self::update_from_5();
1132
+					if ($error != '') return $error;
1133
+					else return self::check_version(true);
1134
+				} elseif ($result['value'] == '6') {
1135
+					$error = self::update_from_6();
1136
+					if ($error != '') return $error;
1137
+					else return self::check_version(true);
1138
+				} elseif ($result['value'] == '7') {
1139
+					$error = self::update_from_7();
1140
+					if ($error != '') return $error;
1141
+					else return self::check_version(true);
1142
+				} elseif ($result['value'] == '8') {
1143
+					$error = self::update_from_8();
1144
+					if ($error != '') return $error;
1145
+					else return self::check_version(true);
1146
+				} elseif ($result['value'] == '9') {
1147
+					$error = self::update_from_9();
1148
+					if ($error != '') return $error;
1149
+					else return self::check_version(true);
1150
+				} elseif ($result['value'] == '10') {
1151
+					$error = self::update_from_10();
1152
+					if ($error != '') return $error;
1153
+					else return self::check_version(true);
1154
+				} elseif ($result['value'] == '11') {
1155
+					$error = self::update_from_11();
1156
+					if ($error != '') return $error;
1157
+					else return self::check_version(true);
1158
+				} elseif ($result['value'] == '12') {
1159
+					$error = self::update_from_12();
1160
+					if ($error != '') return $error;
1161
+					else return self::check_version(true);
1162
+				} elseif ($result['value'] == '13') {
1163
+					$error = self::update_from_13();
1164
+					if ($error != '') return $error;
1165
+					else return self::check_version(true);
1166
+				} elseif ($result['value'] == '14') {
1167
+					$error = self::update_from_14();
1168
+					if ($error != '') return $error;
1169
+					else return self::check_version(true);
1170
+				} elseif ($result['value'] == '15') {
1171
+					$error = self::update_from_15();
1172
+					if ($error != '') return $error;
1173
+					else return self::check_version(true);
1174
+				} elseif ($result['value'] == '16') {
1175
+					$error = self::update_from_16();
1176
+					if ($error != '') return $error;
1177
+					else return self::check_version(true);
1178
+				} elseif ($result['value'] == '17') {
1179
+					$error = self::update_from_17();
1180
+					if ($error != '') return $error;
1181
+					else return self::check_version(true);
1182
+				} elseif ($result['value'] == '18') {
1183
+					$error = self::update_from_18();
1184
+					if ($error != '') return $error;
1185
+					else return self::check_version(true);
1186
+				} elseif ($result['value'] == '19') {
1187
+					$error = self::update_from_19();
1188
+					if ($error != '') return $error;
1189
+					else return self::check_version(true);
1190
+				} elseif ($result['value'] == '20') {
1191
+					$error = self::update_from_20();
1192
+					if ($error != '') return $error;
1193
+					else return self::check_version(true);
1194
+				} elseif ($result['value'] == '21') {
1195
+					$error = self::update_from_21();
1196
+					if ($error != '') return $error;
1197
+					else return self::check_version(true);
1198
+				} elseif ($result['value'] == '22') {
1199
+					$error = self::update_from_22();
1200
+					if ($error != '') return $error;
1201
+					else return self::check_version(true);
1202
+				} elseif ($result['value'] == '23') {
1203
+					$error = self::update_from_23();
1204
+					if ($error != '') return $error;
1205
+					else return self::check_version(true);
1206
+				} elseif ($result['value'] == '24') {
1207
+					$error = self::update_from_24();
1208
+					if ($error != '') return $error;
1209
+					else return self::check_version(true);
1210
+				} elseif ($result['value'] == '25') {
1211
+					$error = self::update_from_25();
1212
+					if ($error != '') return $error;
1213
+					else return self::check_version(true);
1214
+				} else return '';
1215
+				}
1216
+				else return $result['value'];
1217 1217
 		}
1218 1218
 		
1219
-	    } else return $version;
1220
-    	}
1219
+		} else return $version;
1220
+		}
1221 1221
     	
1222 1222
 }
1223 1223
 //echo update_schema::check_version();
Please login to merge, or discard this patch.
Braces   +220 added lines, -82 removed lines patch added patch discarded remove patch
@@ -258,7 +258,9 @@  discard block
 block discarded – undo
258 258
     		// Update table countries
259 259
     		if ($Connection->tableExists('airspace')) {
260 260
     		    $error .= update_db::update_countries();
261
-		    if ($error != '') return $error;
261
+		    if ($error != '') {
262
+		    	return $error;
263
+		    }
262 264
 		}
263 265
 		// Update schema_version to 7
264 266
 		$query = "UPDATE `config` SET `value` = '7' WHERE `name` = 'schema_version'";
@@ -314,7 +316,9 @@  discard block
 block discarded – undo
314 316
     		$error = '';
315 317
     		// Update table aircraft
316 318
 		$error .= create_db::import_file('../db/source_location.sql');
317
-		if ($error != '') return $error;
319
+		if ($error != '') {
320
+			return $error;
321
+		}
318 322
 		// Update schema_version to 6
319 323
 		$query = "UPDATE `config` SET `value` = '8' WHERE `name` = 'schema_version'";
320 324
         	try {
@@ -331,7 +335,9 @@  discard block
 block discarded – undo
331 335
     		$error = '';
332 336
     		// Update table aircraft
333 337
 		$error .= create_db::import_file('../db/notam.sql');
334
-		if ($error != '') return $error;
338
+		if ($error != '') {
339
+			return $error;
340
+		}
335 341
 		$query = "DELETE FROM config WHERE name = 'last_update_db';
336 342
                         INSERT INTO config (name,value) VALUES ('last_update_db',NOW());
337 343
                         DELETE FROM config WHERE name = 'last_update_notam_db';
@@ -365,7 +371,9 @@  discard block
 block discarded – undo
365 371
 		$error = '';
366 372
     		// Update table atc
367 373
 		$error .= create_db::import_file('../db/atc.sql');
368
-		if ($error != '') return $error;
374
+		if ($error != '') {
375
+			return $error;
376
+		}
369 377
 		
370 378
 		$query = "UPDATE `config` SET `value` = '10' WHERE `name` = 'schema_version'";
371 379
         	try {
@@ -389,13 +397,21 @@  discard block
 block discarded – undo
389 397
 		$error = '';
390 398
     		// Add tables
391 399
 		$error .= create_db::import_file('../db/aircraft_owner.sql');
392
-		if ($error != '') return $error;
400
+		if ($error != '') {
401
+			return $error;
402
+		}
393 403
 		$error .= create_db::import_file('../db/metar.sql');
394
-		if ($error != '') return $error;
404
+		if ($error != '') {
405
+			return $error;
406
+		}
395 407
 		$error .= create_db::import_file('../db/taf.sql');
396
-		if ($error != '') return $error;
408
+		if ($error != '') {
409
+			return $error;
410
+		}
397 411
 		$error .= create_db::import_file('../db/airport.sql');
398
-		if ($error != '') return $error;
412
+		if ($error != '') {
413
+			return $error;
414
+		}
399 415
 		
400 416
 		$query = "UPDATE `config` SET `value` = '11' WHERE `name` = 'schema_version'";
401 417
         	try {
@@ -469,19 +485,33 @@  discard block
 block discarded – undo
469 485
 		$error = '';
470 486
     		// Add tables
471 487
 		$error .= create_db::import_file('../db/stats.sql');
472
-		if ($error != '') return $error;
488
+		if ($error != '') {
489
+			return $error;
490
+		}
473 491
 		$error .= create_db::import_file('../db/stats_aircraft.sql');
474
-		if ($error != '') return $error;
492
+		if ($error != '') {
493
+			return $error;
494
+		}
475 495
 		$error .= create_db::import_file('../db/stats_airline.sql');
476
-		if ($error != '') return $error;
496
+		if ($error != '') {
497
+			return $error;
498
+		}
477 499
 		$error .= create_db::import_file('../db/stats_airport.sql');
478
-		if ($error != '') return $error;
500
+		if ($error != '') {
501
+			return $error;
502
+		}
479 503
 		$error .= create_db::import_file('../db/stats_owner.sql');
480
-		if ($error != '') return $error;
504
+		if ($error != '') {
505
+			return $error;
506
+		}
481 507
 		$error .= create_db::import_file('../db/stats_pilot.sql');
482
-		if ($error != '') return $error;
508
+		if ($error != '') {
509
+			return $error;
510
+		}
483 511
 		$error .= create_db::import_file('../db/spotter_archive_output.sql');
484
-		if ($error != '') return $error;
512
+		if ($error != '') {
513
+			return $error;
514
+		}
485 515
 		
486 516
 		$query = "UPDATE `config` SET `value` = '13' WHERE `name` = 'schema_version'";
487 517
         	try {
@@ -521,7 +551,9 @@  discard block
 block discarded – undo
521 551
     		// Add tables
522 552
     		if (!$Connection->tableExists('stats_flight')) {
523 553
 			$error .= create_db::import_file('../db/stats_flight.sql');
524
-			if ($error != '') return $error;
554
+			if ($error != '') {
555
+				return $error;
556
+			}
525 557
 		}
526 558
 		$query = "UPDATE `config` SET `value` = '15' WHERE `name` = 'schema_version'";
527 559
         	try {
@@ -545,7 +577,9 @@  discard block
 block discarded – undo
545 577
     		} catch(PDOException $e) {
546 578
 		    return "error (update stats) : ".$e->getMessage()."\n";
547 579
     		}
548
-		if ($error != '') return $error;
580
+		if ($error != '') {
581
+			return $error;
582
+		}
549 583
 		$query = "UPDATE `config` SET `value` = '16' WHERE `name` = 'schema_version'";
550 584
         	try {
551 585
             	    $sth = $Connection->db->prepare($query);
@@ -566,7 +600,9 @@  discard block
 block discarded – undo
566 600
     		if (!$Connection->tableExists('stats_callsign')) {
567 601
 			$error .= create_db::import_file('../db/stats_callsign.sql');
568 602
 		}
569
-		if ($error != '') return $error;
603
+		if ($error != '') {
604
+			return $error;
605
+		}
570 606
 		$query = "UPDATE `config` SET `value` = '17' WHERE `name` = 'schema_version'";
571 607
         	try {
572 608
             	    $sth = $Connection->db->prepare($query);
@@ -584,7 +620,9 @@  discard block
 block discarded – undo
584 620
     		if (!$Connection->tableExists('stats_country')) {
585 621
 			$error .= create_db::import_file('../db/stats_country.sql');
586 622
 		}
587
-		if ($error != '') return $error;
623
+		if ($error != '') {
624
+			return $error;
625
+		}
588 626
 		$query = "UPDATE `config` SET `value` = '18' WHERE `name` = 'schema_version'";
589 627
         	try {
590 628
             	    $sth = $Connection->db->prepare($query);
@@ -607,7 +645,9 @@  discard block
 block discarded – undo
607 645
 			    return "error (update stats) : ".$e->getMessage()."\n";
608 646
     			}
609 647
     		}
610
-		if ($error != '') return $error;
648
+		if ($error != '') {
649
+			return $error;
650
+		}
611 651
 		$query = "UPDATE `config` SET `value` = '19' WHERE `name` = 'schema_version'";
612 652
         	try {
613 653
             	    $sth = $Connection->db->prepare($query);
@@ -623,7 +663,9 @@  discard block
 block discarded – undo
623 663
 		$error = '';
624 664
     		// Update airport table
625 665
 		$error .= create_db::import_file('../db/airport.sql');
626
-		if ($error != '') return 'Import airport.sql : '.$error;
666
+		if ($error != '') {
667
+			return 'Import airport.sql : '.$error;
668
+		}
627 669
 		// Remove primary key on Spotter_Archive
628 670
 		$query = "alter table spotter_archive drop spotter_archive_id";
629 671
         	try {
@@ -699,7 +741,9 @@  discard block
 block discarded – undo
699 741
 				return "error (add source_name column) : ".$e->getMessage()."\n";
700 742
     			}
701 743
     		}
702
-		if ($error != '') return $error;
744
+		if ($error != '') {
745
+			return $error;
746
+		}
703 747
 		$query = "UPDATE `config` SET `value` = '20' WHERE `name` = 'schema_version'";
704 748
         	try {
705 749
             	    $sth = $Connection->db->prepare($query);
@@ -717,7 +761,9 @@  discard block
 block discarded – undo
717 761
     		// Update airline table
718 762
     		if (!$globalIVAO && !$globalVATSIM && !$globalphpVMS) {
719 763
 			$error .= create_db::import_file('../db/airlines.sql');
720
-			if ($error != '') return 'Import airlines.sql : '.$error;
764
+			if ($error != '') {
765
+				return 'Import airlines.sql : '.$error;
766
+			}
721 767
 		}
722 768
 		if (!$Connection->checkColumnName('aircraft_modes','type_flight')) {
723 769
 			// Add column over_country
@@ -729,7 +775,9 @@  discard block
 block discarded – undo
729 775
 				return "error (add over_country) : ".$e->getMessage()."\n";
730 776
     			}
731 777
     		}
732
-		if ($error != '') return $error;
778
+		if ($error != '') {
779
+			return $error;
780
+		}
733 781
 		/*
734 782
     		if (!$globalIVAO && !$globalVATSIM && !$globalphpVMS) {
735 783
 			// Force update ModeS (this will put type_flight data
@@ -759,7 +807,9 @@  discard block
 block discarded – undo
759 807
 			} catch(PDOException $e) {
760 808
 				return "error (rename type to stats_type on stats*) : ".$e->getMessage()."\n";
761 809
 			}
762
-			if ($error != '') return $error;
810
+			if ($error != '') {
811
+				return $error;
812
+			}
763 813
 		}
764 814
 		$query = "UPDATE `config` SET `value` = '22' WHERE `name` = 'schema_version'";
765 815
         	try {
@@ -782,7 +832,9 @@  discard block
 block discarded – undo
782 832
 			} else {
783 833
 				$error .= create_db::import_file('../db/pgsql/stats_source.sql');
784 834
 			}
785
-			if ($error != '') return $error;
835
+			if ($error != '') {
836
+				return $error;
837
+			}
786 838
 		}
787 839
 		$query = "UPDATE config SET value = '23' WHERE name = 'schema_version'";
788 840
         	try {
@@ -804,12 +856,16 @@  discard block
 block discarded – undo
804 856
 		if ($globalDBdriver == 'mysql') {
805 857
 			if (!$Connection->tableExists('tle')) {
806 858
 				$error .= create_db::import_file('../db/tle.sql');
807
-				if ($error != '') return $error;
859
+				if ($error != '') {
860
+					return $error;
861
+				}
808 862
 			}
809 863
 		} else {
810 864
 			if (!$Connection->tableExists('tle')) {
811 865
 				$error .= create_db::import_file('../db/pgsql/tle.sql');
812
-				if ($error != '') return $error;
866
+				if ($error != '') {
867
+					return $error;
868
+				}
813 869
 			}
814 870
 			$query = "create index flightaware_id_idx ON spotter_archive USING btree(flightaware_id)";
815 871
 			try {
@@ -849,7 +905,9 @@  discard block
 block discarded – undo
849 905
 		} else {
850 906
 			$error .= create_db::import_file('../db/pgsql/airlines.sql');
851 907
 		}
852
-		if ($error != '') return 'Import airlines.sql : '.$error;
908
+		if ($error != '') {
909
+			return 'Import airlines.sql : '.$error;
910
+		}
853 911
 		if (!$Connection->checkColumnName('airlines','forsource')) {
854 912
 			// Add forsource to airlines
855 913
 			$query = "ALTER TABLE airlines ADD forsource VARCHAR(255) NULL DEFAULT NULL";
@@ -1102,8 +1160,11 @@  discard block
 block discarded – undo
1102 1160
     	    if ($Connection->tableExists('aircraft')) {
1103 1161
     		if (!$Connection->tableExists('config')) {
1104 1162
     		    $version = '1';
1105
-    		    if ($update) return self::update_from_1();
1106
-    		    else return $version;
1163
+    		    if ($update) {
1164
+    		    	return self::update_from_1();
1165
+    		    } else {
1166
+    		    	return $version;
1167
+    		    }
1107 1168
 		} else {
1108 1169
     		    $Connection = new Connection();
1109 1170
 		    $query = "SELECT value FROM config WHERE name = 'schema_version' LIMIT 1";
@@ -1117,106 +1178,183 @@  discard block
 block discarded – undo
1117 1178
     		    if ($update) {
1118 1179
     			if ($result['value'] == '2') {
1119 1180
     			    $error = self::update_from_2();
1120
-    			    if ($error != '') return $error;
1121
-    			    else return self::check_version(true);
1181
+    			    if ($error != '') {
1182
+    			    	return $error;
1183
+    			    } else {
1184
+    			    	return self::check_version(true);
1185
+    			    }
1122 1186
     			} elseif ($result['value'] == '3') {
1123 1187
     			    $error = self::update_from_3();
1124
-    			    if ($error != '') return $error;
1125
-    			    else return self::check_version(true);
1188
+    			    if ($error != '') {
1189
+    			    	return $error;
1190
+    			    } else {
1191
+    			    	return self::check_version(true);
1192
+    			    }
1126 1193
     			} elseif ($result['value'] == '4') {
1127 1194
     			    $error = self::update_from_4();
1128
-    			    if ($error != '') return $error;
1129
-    			    else return self::check_version(true);
1195
+    			    if ($error != '') {
1196
+    			    	return $error;
1197
+    			    } else {
1198
+    			    	return self::check_version(true);
1199
+    			    }
1130 1200
     			} elseif ($result['value'] == '5') {
1131 1201
     			    $error = self::update_from_5();
1132
-    			    if ($error != '') return $error;
1133
-    			    else return self::check_version(true);
1202
+    			    if ($error != '') {
1203
+    			    	return $error;
1204
+    			    } else {
1205
+    			    	return self::check_version(true);
1206
+    			    }
1134 1207
     			} elseif ($result['value'] == '6') {
1135 1208
     			    $error = self::update_from_6();
1136
-    			    if ($error != '') return $error;
1137
-    			    else return self::check_version(true);
1209
+    			    if ($error != '') {
1210
+    			    	return $error;
1211
+    			    } else {
1212
+    			    	return self::check_version(true);
1213
+    			    }
1138 1214
     			} elseif ($result['value'] == '7') {
1139 1215
     			    $error = self::update_from_7();
1140
-    			    if ($error != '') return $error;
1141
-    			    else return self::check_version(true);
1216
+    			    if ($error != '') {
1217
+    			    	return $error;
1218
+    			    } else {
1219
+    			    	return self::check_version(true);
1220
+    			    }
1142 1221
     			} elseif ($result['value'] == '8') {
1143 1222
     			    $error = self::update_from_8();
1144
-    			    if ($error != '') return $error;
1145
-    			    else return self::check_version(true);
1223
+    			    if ($error != '') {
1224
+    			    	return $error;
1225
+    			    } else {
1226
+    			    	return self::check_version(true);
1227
+    			    }
1146 1228
     			} elseif ($result['value'] == '9') {
1147 1229
     			    $error = self::update_from_9();
1148
-    			    if ($error != '') return $error;
1149
-    			    else return self::check_version(true);
1230
+    			    if ($error != '') {
1231
+    			    	return $error;
1232
+    			    } else {
1233
+    			    	return self::check_version(true);
1234
+    			    }
1150 1235
     			} elseif ($result['value'] == '10') {
1151 1236
     			    $error = self::update_from_10();
1152
-    			    if ($error != '') return $error;
1153
-    			    else return self::check_version(true);
1237
+    			    if ($error != '') {
1238
+    			    	return $error;
1239
+    			    } else {
1240
+    			    	return self::check_version(true);
1241
+    			    }
1154 1242
     			} elseif ($result['value'] == '11') {
1155 1243
     			    $error = self::update_from_11();
1156
-    			    if ($error != '') return $error;
1157
-    			    else return self::check_version(true);
1244
+    			    if ($error != '') {
1245
+    			    	return $error;
1246
+    			    } else {
1247
+    			    	return self::check_version(true);
1248
+    			    }
1158 1249
     			} elseif ($result['value'] == '12') {
1159 1250
     			    $error = self::update_from_12();
1160
-    			    if ($error != '') return $error;
1161
-    			    else return self::check_version(true);
1251
+    			    if ($error != '') {
1252
+    			    	return $error;
1253
+    			    } else {
1254
+    			    	return self::check_version(true);
1255
+    			    }
1162 1256
     			} elseif ($result['value'] == '13') {
1163 1257
     			    $error = self::update_from_13();
1164
-    			    if ($error != '') return $error;
1165
-    			    else return self::check_version(true);
1258
+    			    if ($error != '') {
1259
+    			    	return $error;
1260
+    			    } else {
1261
+    			    	return self::check_version(true);
1262
+    			    }
1166 1263
     			} elseif ($result['value'] == '14') {
1167 1264
     			    $error = self::update_from_14();
1168
-    			    if ($error != '') return $error;
1169
-    			    else return self::check_version(true);
1265
+    			    if ($error != '') {
1266
+    			    	return $error;
1267
+    			    } else {
1268
+    			    	return self::check_version(true);
1269
+    			    }
1170 1270
     			} elseif ($result['value'] == '15') {
1171 1271
     			    $error = self::update_from_15();
1172
-    			    if ($error != '') return $error;
1173
-    			    else return self::check_version(true);
1272
+    			    if ($error != '') {
1273
+    			    	return $error;
1274
+    			    } else {
1275
+    			    	return self::check_version(true);
1276
+    			    }
1174 1277
     			} elseif ($result['value'] == '16') {
1175 1278
     			    $error = self::update_from_16();
1176
-    			    if ($error != '') return $error;
1177
-    			    else return self::check_version(true);
1279
+    			    if ($error != '') {
1280
+    			    	return $error;
1281
+    			    } else {
1282
+    			    	return self::check_version(true);
1283
+    			    }
1178 1284
     			} elseif ($result['value'] == '17') {
1179 1285
     			    $error = self::update_from_17();
1180
-    			    if ($error != '') return $error;
1181
-    			    else return self::check_version(true);
1286
+    			    if ($error != '') {
1287
+    			    	return $error;
1288
+    			    } else {
1289
+    			    	return self::check_version(true);
1290
+    			    }
1182 1291
     			} elseif ($result['value'] == '18') {
1183 1292
     			    $error = self::update_from_18();
1184
-    			    if ($error != '') return $error;
1185
-    			    else return self::check_version(true);
1293
+    			    if ($error != '') {
1294
+    			    	return $error;
1295
+    			    } else {
1296
+    			    	return self::check_version(true);
1297
+    			    }
1186 1298
     			} elseif ($result['value'] == '19') {
1187 1299
     			    $error = self::update_from_19();
1188
-    			    if ($error != '') return $error;
1189
-    			    else return self::check_version(true);
1300
+    			    if ($error != '') {
1301
+    			    	return $error;
1302
+    			    } else {
1303
+    			    	return self::check_version(true);
1304
+    			    }
1190 1305
     			} elseif ($result['value'] == '20') {
1191 1306
     			    $error = self::update_from_20();
1192
-    			    if ($error != '') return $error;
1193
-    			    else return self::check_version(true);
1307
+    			    if ($error != '') {
1308
+    			    	return $error;
1309
+    			    } else {
1310
+    			    	return self::check_version(true);
1311
+    			    }
1194 1312
     			} elseif ($result['value'] == '21') {
1195 1313
     			    $error = self::update_from_21();
1196
-    			    if ($error != '') return $error;
1197
-    			    else return self::check_version(true);
1314
+    			    if ($error != '') {
1315
+    			    	return $error;
1316
+    			    } else {
1317
+    			    	return self::check_version(true);
1318
+    			    }
1198 1319
     			} elseif ($result['value'] == '22') {
1199 1320
     			    $error = self::update_from_22();
1200
-    			    if ($error != '') return $error;
1201
-    			    else return self::check_version(true);
1321
+    			    if ($error != '') {
1322
+    			    	return $error;
1323
+    			    } else {
1324
+    			    	return self::check_version(true);
1325
+    			    }
1202 1326
     			} elseif ($result['value'] == '23') {
1203 1327
     			    $error = self::update_from_23();
1204
-    			    if ($error != '') return $error;
1205
-    			    else return self::check_version(true);
1328
+    			    if ($error != '') {
1329
+    			    	return $error;
1330
+    			    } else {
1331
+    			    	return self::check_version(true);
1332
+    			    }
1206 1333
     			} elseif ($result['value'] == '24') {
1207 1334
     			    $error = self::update_from_24();
1208
-    			    if ($error != '') return $error;
1209
-    			    else return self::check_version(true);
1335
+    			    if ($error != '') {
1336
+    			    	return $error;
1337
+    			    } else {
1338
+    			    	return self::check_version(true);
1339
+    			    }
1210 1340
     			} elseif ($result['value'] == '25') {
1211 1341
     			    $error = self::update_from_25();
1212
-    			    if ($error != '') return $error;
1213
-    			    else return self::check_version(true);
1214
-    			} else return '';
1342
+    			    if ($error != '') {
1343
+    			    	return $error;
1344
+    			    } else {
1345
+    			    	return self::check_version(true);
1346
+    			    }
1347
+    			} else {
1348
+    				return '';
1349
+    			}
1350
+    		    } else {
1351
+    		    	return $result['value'];
1215 1352
     		    }
1216
-    		    else return $result['value'];
1217 1353
 		}
1218 1354
 		
1219
-	    } else return $version;
1355
+	    } else {
1356
+	    	return $version;
1357
+	    }
1220 1358
     	}
1221 1359
     	
1222 1360
 }
Please login to merge, or discard this patch.
Spacing   +123 added lines, -123 removed lines patch added patch discarded remove patch
@@ -14,11 +14,11 @@  discard block
 block discarded – undo
14 14
             try {
15 15
             	$sth = $Connection->db->prepare($query);
16 16
 		$sth->execute();
17
-    	    } catch(PDOException $e) {
17
+    	    } catch (PDOException $e) {
18 18
 		return "error : ".$e->getMessage()."\n";
19 19
     	    }
20 20
     	    while ($row = $sth->fetch(PDO::FETCH_ASSOC)) {
21
-    		$Schedule->addSchedule($row['ident'],$row['departure_airport_icao'],$row['departure_airport_time'],$row['arrival_airport_icao'],$row['arrival_airport_time']);
21
+    		$Schedule->addSchedule($row['ident'], $row['departure_airport_icao'], $row['departure_airport_time'], $row['arrival_airport_icao'], $row['arrival_airport_time']);
22 22
     	    }
23 23
 	
24 24
 	}
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
         	try {
51 51
             	    $sth = $Connection->db->prepare($query);
52 52
 		    $sth->execute();
53
-    		} catch(PDOException $e) {
53
+    		} catch (PDOException $e) {
54 54
 		    return "error (add new columns to routes table) : ".$e->getMessage()."\n";
55 55
     		}
56 56
     		// Copy schedules data to routes table
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
         	try {
61 61
             	    $sth = $Connection->db->prepare($query);
62 62
 		    $sth->execute();
63
-    		} catch(PDOException $e) {
63
+    		} catch (PDOException $e) {
64 64
 		    return "error (delete schedule table) : ".$e->getMessage()."\n";
65 65
     		}
66 66
     		// Add source column
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
     		try {
69 69
             	    $sth = $Connection->db->prepare($query);
70 70
 		    $sth->execute();
71
-    		} catch(PDOException $e) {
71
+    		} catch (PDOException $e) {
72 72
 		    return "error (add source column to aircraft_modes) : ".$e->getMessage()."\n";
73 73
     		}
74 74
 		// Delete unused column
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
     		try {
77 77
             	    $sth = $Connection->db->prepare($query);
78 78
 		    $sth->execute();
79
-    		} catch(PDOException $e) {
79
+    		} catch (PDOException $e) {
80 80
 		    return "error (Delete unused column of aircraft_modes) : ".$e->getMessage()."\n";
81 81
     		}
82 82
 		// Add ModeS column
@@ -84,14 +84,14 @@  discard block
 block discarded – undo
84 84
     		try {
85 85
             	    $sth = $Connection->db->prepare($query);
86 86
 		    $sth->execute();
87
-    		} catch(PDOException $e) {
87
+    		} catch (PDOException $e) {
88 88
 		    return "error (Add ModeS column in spotter_output) : ".$e->getMessage()."\n";
89 89
     		}
90 90
 		$query = "ALTER TABLE `spotter_live`  ADD `ModeS` VARCHAR(255)";
91 91
     		try {
92 92
             	    $sth = $Connection->db->prepare($query);
93 93
 		    $sth->execute();
94
-    		} catch(PDOException $e) {
94
+    		} catch (PDOException $e) {
95 95
 		    return "error (Add ModeS column in spotter_live) : ".$e->getMessage()."\n";
96 96
     		}
97 97
     		// Add auto_increment for aircraft_modes
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
     		try {
100 100
             	    $sth = $Connection->db->prepare($query);
101 101
 		    $sth->execute();
102
-    		} catch(PDOException $e) {
102
+    		} catch (PDOException $e) {
103 103
 		    return "error (Add Auto increment in aircraft_modes) : ".$e->getMessage()."\n";
104 104
     		}
105 105
     		$error = '';
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
         	try {
111 111
             	    $sth = $Connection->db->prepare($query);
112 112
 		    $sth->execute();
113
-    		} catch(PDOException $e) {
113
+    		} catch (PDOException $e) {
114 114
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
115 115
     		}
116 116
 		return $error;
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
         	try {
124 124
             	    $sth = $Connection->db->prepare($query);
125 125
 		    $sth->execute();
126
-    		} catch(PDOException $e) {
126
+    		} catch (PDOException $e) {
127 127
 		    return "error (add new columns to routes table) : ".$e->getMessage()."\n";
128 128
     		}
129 129
     		$error = '';
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
         	try {
135 135
             	    $sth = $Connection->db->prepare($query);
136 136
 		    $sth->execute();
137
-    		} catch(PDOException $e) {
137
+    		} catch (PDOException $e) {
138 138
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
139 139
     		}
140 140
 		return $error;
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
         	try {
148 148
             	    $sth = $Connection->db->prepare($query);
149 149
 		    $sth->execute();
150
-    		} catch(PDOException $e) {
150
+    		} catch (PDOException $e) {
151 151
 		    return "error (add new columns to aircraft_modes) : ".$e->getMessage()."\n";
152 152
     		}
153 153
     		// Add image_source_website column to spotter_image
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
         	try {
156 156
             	    $sth = $Connection->db->prepare($query);
157 157
 		    $sth->execute();
158
-    		} catch(PDOException $e) {
158
+    		} catch (PDOException $e) {
159 159
 		    return "error (add new columns to spotter_image) : ".$e->getMessage()."\n";
160 160
     		}
161 161
     		$error = '';
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
         	try {
165 165
             	    $sth = $Connection->db->prepare($query);
166 166
 		    $sth->execute();
167
-    		} catch(PDOException $e) {
167
+    		} catch (PDOException $e) {
168 168
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
169 169
     		}
170 170
 		return $error;
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
         	    try {
183 183
             		$sth = $Connection->db->prepare($query);
184 184
 			$sth->execute();
185
-    		    } catch(PDOException $e) {
185
+    		    } catch (PDOException $e) {
186 186
 			return "error (update schema_version) : ".$e->getMessage()."\n";
187 187
     		    }
188 188
     		}
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
         	try {
197 197
             	    $sth = $Connection->db->prepare($query);
198 198
 		    $sth->execute();
199
-    		} catch(PDOException $e) {
199
+    		} catch (PDOException $e) {
200 200
 		    return "error (add new columns to translation) : ".$e->getMessage()."\n";
201 201
     		}
202 202
     		// Add aircraft_shadow column to aircraft
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
         	try {
205 205
             	    $sth = $Connection->db->prepare($query);
206 206
 		    $sth->execute();
207
-    		} catch(PDOException $e) {
207
+    		} catch (PDOException $e) {
208 208
 		    return "error (add new column to aircraft) : ".$e->getMessage()."\n";
209 209
     		}
210 210
     		// Add aircraft_shadow column to spotter_live
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
         	try {
213 213
             	    $sth = $Connection->db->prepare($query);
214 214
 		    $sth->execute();
215
-    		} catch(PDOException $e) {
215
+    		} catch (PDOException $e) {
216 216
 		    return "error (add new column to spotter_live) : ".$e->getMessage()."\n";
217 217
     		}
218 218
     		$error = '';
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
         	try {
226 226
             	    $sth = $Connection->db->prepare($query);
227 227
 		    $sth->execute();
228
-    		} catch(PDOException $e) {
228
+    		} catch (PDOException $e) {
229 229
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
230 230
     		}
231 231
 		return $error;
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
 
234 234
 	private static function update_from_6() {
235 235
     		$Connection = new Connection();
236
-    		if (!$Connection->indexExists('spotter_output','flightaware_id')) {
236
+    		if (!$Connection->indexExists('spotter_output', 'flightaware_id')) {
237 237
     		    $query = "ALTER TABLE spotter_output ADD INDEX(flightaware_id);
238 238
 			ALTER TABLE spotter_output ADD INDEX(date);
239 239
 			ALTER TABLE spotter_output ADD INDEX(ident);
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
         	    try {
251 251
             		$sth = $Connection->db->prepare($query);
252 252
 			$sth->execute();
253
-    		    } catch(PDOException $e) {
253
+    		    } catch (PDOException $e) {
254 254
 			return "error (add some indexes) : ".$e->getMessage()."\n";
255 255
     		    }
256 256
     		}
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
         	try {
266 266
             	    $sth = $Connection->db->prepare($query);
267 267
 		    $sth->execute();
268
-    		} catch(PDOException $e) {
268
+    		} catch (PDOException $e) {
269 269
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
270 270
     		}
271 271
 		return $error;
@@ -274,12 +274,12 @@  discard block
 block discarded – undo
274 274
 	private static function update_from_7() {
275 275
 		global $globalDBname, $globalDBdriver;
276 276
     		$Connection = new Connection();
277
-    		$query="ALTER TABLE spotter_live ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL;
277
+    		$query = "ALTER TABLE spotter_live ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL;
278 278
     			ALTER TABLE spotter_output ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL;";
279 279
         	try {
280 280
             	    $sth = $Connection->db->prepare($query);
281 281
 		    $sth->execute();
282
-    		} catch(PDOException $e) {
282
+    		} catch (PDOException $e) {
283 283
 		    return "error (add pilot column to spotter_live and spotter_output) : ".$e->getMessage()."\n";
284 284
     		}
285 285
     		if ($globalDBdriver == 'mysql') {
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
 		    try {
288 288
             		$sth = $Connection->db->prepare($query);
289 289
 			$sth->execute();
290
-    		    } catch(PDOException $e) {
290
+    		    } catch (PDOException $e) {
291 291
 			return "error (problem when select engine for spotter_engine) : ".$e->getMessage()."\n";
292 292
     		    }
293 293
     		    $row = $sth->fetch(PDO::FETCH_ASSOC);
@@ -299,15 +299,15 @@  discard block
 block discarded – undo
299 299
 				DROP TABLE spotter_archive;
300 300
 				RENAME TABLE copy TO spotter_archive;";
301 301
             	    } else {
302
-    			$query="ALTER TABLE spotter_archive ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL";
302
+    			$query = "ALTER TABLE spotter_archive ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL";
303 303
             	    }
304 304
                 } else {
305
-    		    $query="ALTER TABLE spotter_archive ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL";
305
+    		    $query = "ALTER TABLE spotter_archive ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL";
306 306
                 }
307 307
         	try {
308 308
             	    $sth = $Connection->db->prepare($query);
309 309
 		    $sth->execute();
310
-    		} catch(PDOException $e) {
310
+    		} catch (PDOException $e) {
311 311
 		    return "error (add pilot column to spotter_archive) : ".$e->getMessage()."\n";
312 312
     		}
313 313
 
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
         	try {
321 321
             	    $sth = $Connection->db->prepare($query);
322 322
 		    $sth->execute();
323
-    		} catch(PDOException $e) {
323
+    		} catch (PDOException $e) {
324 324
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
325 325
     		}
326 326
 		return $error;
@@ -339,14 +339,14 @@  discard block
 block discarded – undo
339 339
         	try {
340 340
             	    $sth = $Connection->db->prepare($query);
341 341
 		    $sth->execute();
342
-    		} catch(PDOException $e) {
342
+    		} catch (PDOException $e) {
343 343
 		    return "error (insert last_update values) : ".$e->getMessage()."\n";
344 344
     		}
345 345
 		$query = "UPDATE `config` SET `value` = '9' WHERE `name` = 'schema_version'";
346 346
         	try {
347 347
             	    $sth = $Connection->db->prepare($query);
348 348
 		    $sth->execute();
349
-    		} catch(PDOException $e) {
349
+    		} catch (PDOException $e) {
350 350
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
351 351
     		}
352 352
 		return $error;
@@ -354,12 +354,12 @@  discard block
 block discarded – undo
354 354
 
355 355
 	private static function update_from_9() {
356 356
     		$Connection = new Connection();
357
-    		$query="ALTER TABLE spotter_live ADD verticalrate INT(11) NULL;
357
+    		$query = "ALTER TABLE spotter_live ADD verticalrate INT(11) NULL;
358 358
     			ALTER TABLE spotter_output ADD verticalrate INT(11) NULL;";
359 359
         	try {
360 360
             	    $sth = $Connection->db->prepare($query);
361 361
 		    $sth->execute();
362
-    		} catch(PDOException $e) {
362
+    		} catch (PDOException $e) {
363 363
 		    return "error (add verticalrate column to spotter_live and spotter_output) : ".$e->getMessage()."\n";
364 364
     		}
365 365
 		$error = '';
@@ -371,7 +371,7 @@  discard block
 block discarded – undo
371 371
         	try {
372 372
             	    $sth = $Connection->db->prepare($query);
373 373
 		    $sth->execute();
374
-    		} catch(PDOException $e) {
374
+    		} catch (PDOException $e) {
375 375
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
376 376
     		}
377 377
 		return $error;
@@ -379,11 +379,11 @@  discard block
 block discarded – undo
379 379
 
380 380
 	private static function update_from_10() {
381 381
     		$Connection = new Connection();
382
-    		$query="ALTER TABLE atc CHANGE `type` `type` ENUM('Observer','Flight Information','Delivery','Tower','Approach','ACC','Departure','Ground','Flight Service Station','Control Radar or Centre') CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL";
382
+    		$query = "ALTER TABLE atc CHANGE `type` `type` ENUM('Observer','Flight Information','Delivery','Tower','Approach','ACC','Departure','Ground','Flight Service Station','Control Radar or Centre') CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL";
383 383
         	try {
384 384
             	    $sth = $Connection->db->prepare($query);
385 385
 		    $sth->execute();
386
-    		} catch(PDOException $e) {
386
+    		} catch (PDOException $e) {
387 387
 		    return "error (add new enum to ATC table) : ".$e->getMessage()."\n";
388 388
     		}
389 389
 		$error = '';
@@ -401,7 +401,7 @@  discard block
 block discarded – undo
401 401
         	try {
402 402
             	    $sth = $Connection->db->prepare($query);
403 403
 		    $sth->execute();
404
-    		} catch(PDOException $e) {
404
+    		} catch (PDOException $e) {
405 405
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
406 406
     		}
407 407
 		return $error;
@@ -410,18 +410,18 @@  discard block
 block discarded – undo
410 410
 	private static function update_from_11() {
411 411
 		global $globalDBdriver, $globalDBname;
412 412
     		$Connection = new Connection();
413
-    		$query="ALTER TABLE spotter_output ADD owner_name VARCHAR(255) NULL DEFAULT NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE, ADD last_ground BOOLEAN NOT NULL DEFAULT FALSE, ADD last_seen DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, ADD last_latitude FLOAT NULL, ADD last_longitude FLOAT NULL, ADD last_altitude INT(11) NULL, ADD last_ground_speed INT(11), ADD real_arrival_airport_icao VARCHAR(999), ADD real_arrival_airport_time VARCHAR(20),ADD real_departure_airport_icao VARCHAR(999), ADD real_departure_airport_time VARCHAR(20)";
413
+    		$query = "ALTER TABLE spotter_output ADD owner_name VARCHAR(255) NULL DEFAULT NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE, ADD last_ground BOOLEAN NOT NULL DEFAULT FALSE, ADD last_seen DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, ADD last_latitude FLOAT NULL, ADD last_longitude FLOAT NULL, ADD last_altitude INT(11) NULL, ADD last_ground_speed INT(11), ADD real_arrival_airport_icao VARCHAR(999), ADD real_arrival_airport_time VARCHAR(20),ADD real_departure_airport_icao VARCHAR(999), ADD real_departure_airport_time VARCHAR(20)";
414 414
         	try {
415 415
             	    $sth = $Connection->db->prepare($query);
416 416
 		    $sth->execute();
417
-    		} catch(PDOException $e) {
417
+    		} catch (PDOException $e) {
418 418
 		    return "error (add owner_name & format_source column to spotter_output) : ".$e->getMessage()."\n";
419 419
     		}
420
-    		$query="ALTER TABLE spotter_live ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE";
420
+    		$query = "ALTER TABLE spotter_live ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE";
421 421
         	try {
422 422
             	    $sth = $Connection->db->prepare($query);
423 423
 		    $sth->execute();
424
-    		} catch(PDOException $e) {
424
+    		} catch (PDOException $e) {
425 425
 		    return "error (format_source column to spotter_live) : ".$e->getMessage()."\n";
426 426
     		}
427 427
     		if ($globalDBdriver == 'mysql') {
@@ -429,7 +429,7 @@  discard block
 block discarded – undo
429 429
 		    try {
430 430
             		$sth = $Connection->db->prepare($query);
431 431
 			$sth->execute();
432
-    		    } catch(PDOException $e) {
432
+    		    } catch (PDOException $e) {
433 433
 			return "error (problem when select engine for spotter_engine) : ".$e->getMessage()."\n";
434 434
     		    }
435 435
     		    $row = $sth->fetch(PDO::FETCH_ASSOC);
@@ -441,15 +441,15 @@  discard block
 block discarded – undo
441 441
 				DROP TABLE spotter_archive;
442 442
 				RENAME TABLE copy TO spotter_archive;";
443 443
             	    } else {
444
-    			$query="ALTER TABLE spotter_archive ADD verticalrate INT(11) NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE";
444
+    			$query = "ALTER TABLE spotter_archive ADD verticalrate INT(11) NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE";
445 445
             	    }
446 446
                 } else {
447
-    		    $query="ALTER TABLE spotter_archive ADD verticalrate INT(11) NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE";
447
+    		    $query = "ALTER TABLE spotter_archive ADD verticalrate INT(11) NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE";
448 448
                 }
449 449
         	try {
450 450
             	    $sth = $Connection->db->prepare($query);
451 451
 		    $sth->execute();
452
-    		} catch(PDOException $e) {
452
+    		} catch (PDOException $e) {
453 453
 		    return "error (add columns to spotter_archive) : ".$e->getMessage()."\n";
454 454
     		}
455 455
 
@@ -459,7 +459,7 @@  discard block
 block discarded – undo
459 459
         	try {
460 460
             	    $sth = $Connection->db->prepare($query);
461 461
 		    $sth->execute();
462
-    		} catch(PDOException $e) {
462
+    		} catch (PDOException $e) {
463 463
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
464 464
     		}
465 465
 		return $error;
@@ -487,7 +487,7 @@  discard block
 block discarded – undo
487 487
         	try {
488 488
             	    $sth = $Connection->db->prepare($query);
489 489
 		    $sth->execute();
490
-    		} catch(PDOException $e) {
490
+    		} catch (PDOException $e) {
491 491
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
492 492
     		}
493 493
 		return $error;
@@ -495,12 +495,12 @@  discard block
 block discarded – undo
495 495
 
496 496
 	private static function update_from_13() {
497 497
     		$Connection = new Connection();
498
-    		if (!$Connection->checkColumnName('spotter_archive_output','real_departure_airport_icao')) {
499
-    			$query="ALTER TABLE spotter_archive_output ADD real_departure_airport_icao VARCHAR(20), ADD real_departure_airport_time VARCHAR(20)";
498
+    		if (!$Connection->checkColumnName('spotter_archive_output', 'real_departure_airport_icao')) {
499
+    			$query = "ALTER TABLE spotter_archive_output ADD real_departure_airport_icao VARCHAR(20), ADD real_departure_airport_time VARCHAR(20)";
500 500
 			try {
501 501
 				$sth = $Connection->db->prepare($query);
502 502
 				$sth->execute();
503
-	    		} catch(PDOException $e) {
503
+	    		} catch (PDOException $e) {
504 504
 				return "error (update spotter_archive_output) : ".$e->getMessage()."\n";
505 505
     			}
506 506
 		}
@@ -509,7 +509,7 @@  discard block
 block discarded – undo
509 509
         	try {
510 510
             	    $sth = $Connection->db->prepare($query);
511 511
 		    $sth->execute();
512
-    		} catch(PDOException $e) {
512
+    		} catch (PDOException $e) {
513 513
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
514 514
     		}
515 515
 		return $error;
@@ -527,7 +527,7 @@  discard block
 block discarded – undo
527 527
         	try {
528 528
             	    $sth = $Connection->db->prepare($query);
529 529
 		    $sth->execute();
530
-    		} catch(PDOException $e) {
530
+    		} catch (PDOException $e) {
531 531
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
532 532
     		}
533 533
 		return $error;
@@ -538,11 +538,11 @@  discard block
 block discarded – undo
538 538
     		$Connection = new Connection();
539 539
 		$error = '';
540 540
     		// Add tables
541
-    		$query="ALTER TABLE `stats` CHANGE `stats_date` `stats_date` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP";
541
+    		$query = "ALTER TABLE `stats` CHANGE `stats_date` `stats_date` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP";
542 542
         	try {
543 543
             	    $sth = $Connection->db->prepare($query);
544 544
 		    $sth->execute();
545
-    		} catch(PDOException $e) {
545
+    		} catch (PDOException $e) {
546 546
 		    return "error (update stats) : ".$e->getMessage()."\n";
547 547
     		}
548 548
 		if ($error != '') return $error;
@@ -550,7 +550,7 @@  discard block
 block discarded – undo
550 550
         	try {
551 551
             	    $sth = $Connection->db->prepare($query);
552 552
 		    $sth->execute();
553
-    		} catch(PDOException $e) {
553
+    		} catch (PDOException $e) {
554 554
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
555 555
     		}
556 556
 		return $error;
@@ -571,7 +571,7 @@  discard block
 block discarded – undo
571 571
         	try {
572 572
             	    $sth = $Connection->db->prepare($query);
573 573
 		    $sth->execute();
574
-    		} catch(PDOException $e) {
574
+    		} catch (PDOException $e) {
575 575
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
576 576
     		}
577 577
 		return $error;
@@ -589,7 +589,7 @@  discard block
 block discarded – undo
589 589
         	try {
590 590
             	    $sth = $Connection->db->prepare($query);
591 591
 		    $sth->execute();
592
-    		} catch(PDOException $e) {
592
+    		} catch (PDOException $e) {
593 593
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
594 594
     		}
595 595
 		return $error;
@@ -598,12 +598,12 @@  discard block
 block discarded – undo
598 598
     		$Connection = new Connection();
599 599
 		$error = '';
600 600
     		// Modify stats_airport table
601
-    		if (!$Connection->checkColumnName('stats_airport','airport_name')) {
601
+    		if (!$Connection->checkColumnName('stats_airport', 'airport_name')) {
602 602
     			$query = "ALTER TABLE `stats_airport` ADD `stats_type` VARCHAR(50) NOT NULL DEFAULT 'yearly', ADD `airport_name` VARCHAR(255) NOT NULL, ADD `date` DATE NULL DEFAULT NULL, DROP INDEX `airport_icao`, ADD UNIQUE `airport_icao` (`airport_icao`, `type`, `date`)";
603 603
     	        	try {
604 604
 	            	    $sth = $Connection->db->prepare($query);
605 605
 			    $sth->execute();
606
-    			} catch(PDOException $e) {
606
+    			} catch (PDOException $e) {
607 607
 			    return "error (update stats) : ".$e->getMessage()."\n";
608 608
     			}
609 609
     		}
@@ -612,7 +612,7 @@  discard block
 block discarded – undo
612 612
         	try {
613 613
             	    $sth = $Connection->db->prepare($query);
614 614
 		    $sth->execute();
615
-    		} catch(PDOException $e) {
615
+    		} catch (PDOException $e) {
616 616
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
617 617
     		}
618 618
 		return $error;
@@ -629,73 +629,73 @@  discard block
 block discarded – undo
629 629
         	try {
630 630
             	    $sth = $Connection->db->prepare($query);
631 631
 		    $sth->execute();
632
-    		} catch(PDOException $e) {
632
+    		} catch (PDOException $e) {
633 633
 		    return "error (remove primary key on spotter_archive) : ".$e->getMessage()."\n";
634 634
     		}
635 635
 		$query = "alter table spotter_archive add spotter_archive_id INT(11)";
636 636
         	try {
637 637
             	    $sth = $Connection->db->prepare($query);
638 638
 		    $sth->execute();
639
-    		} catch(PDOException $e) {
639
+    		} catch (PDOException $e) {
640 640
 		    return "error (add id again on spotter_archive) : ".$e->getMessage()."\n";
641 641
     		}
642
-		if (!$Connection->checkColumnName('spotter_archive','over_country')) {
642
+		if (!$Connection->checkColumnName('spotter_archive', 'over_country')) {
643 643
 			// Add column over_country
644 644
     			$query = "ALTER TABLE `spotter_archive` ADD `over_country` VARCHAR(5) NULL DEFAULT NULL";
645 645
 			try {
646 646
             			$sth = $Connection->db->prepare($query);
647 647
 				$sth->execute();
648
-			} catch(PDOException $e) {
648
+			} catch (PDOException $e) {
649 649
 				return "error (add over_country) : ".$e->getMessage()."\n";
650 650
 			}
651 651
 		}
652
-		if (!$Connection->checkColumnName('spotter_live','over_country')) {
652
+		if (!$Connection->checkColumnName('spotter_live', 'over_country')) {
653 653
 			// Add column over_country
654 654
     			$query = "ALTER TABLE `spotter_live` ADD `over_country` VARCHAR(5) NULL DEFAULT NULL";
655 655
 			try {
656 656
             			$sth = $Connection->db->prepare($query);
657 657
 				$sth->execute();
658
-			} catch(PDOException $e) {
658
+			} catch (PDOException $e) {
659 659
 				return "error (add over_country) : ".$e->getMessage()."\n";
660 660
 			}
661 661
 		}
662
-		if (!$Connection->checkColumnName('spotter_output','source_name')) {
662
+		if (!$Connection->checkColumnName('spotter_output', 'source_name')) {
663 663
 			// Add source_name to spotter_output, spotter_live, spotter_archive, spotter_archive_output
664 664
     			$query = "ALTER TABLE `spotter_output` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`";
665 665
 			try {
666 666
 				$sth = $Connection->db->prepare($query);
667 667
 				$sth->execute();
668
-			} catch(PDOException $e) {
668
+			} catch (PDOException $e) {
669 669
 				return "error (add source_name column) : ".$e->getMessage()."\n";
670 670
     			}
671 671
     		}
672
-		if (!$Connection->checkColumnName('spotter_live','source_name')) {
672
+		if (!$Connection->checkColumnName('spotter_live', 'source_name')) {
673 673
 			// Add source_name to spotter_output, spotter_live, spotter_archive, spotter_archive_output
674 674
     			$query = "ALTER TABLE `spotter_live` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`";
675 675
 			try {
676 676
 				$sth = $Connection->db->prepare($query);
677 677
 				$sth->execute();
678
-			} catch(PDOException $e) {
678
+			} catch (PDOException $e) {
679 679
 				return "error (add source_name column) : ".$e->getMessage()."\n";
680 680
     			}
681 681
     		}
682
-		if (!$Connection->checkColumnName('spotter_archive_output','source_name')) {
682
+		if (!$Connection->checkColumnName('spotter_archive_output', 'source_name')) {
683 683
 			// Add source_name to spotter_output, spotter_live, spotter_archive, spotter_archive_output
684 684
     			$query = "ALTER TABLE `spotter_archive_output` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`";
685 685
 			try {
686 686
 				$sth = $Connection->db->prepare($query);
687 687
 				$sth->execute();
688
-			} catch(PDOException $e) {
688
+			} catch (PDOException $e) {
689 689
 				return "error (add source_name column) : ".$e->getMessage()."\n";
690 690
     			}
691 691
     		}
692
-		if (!$Connection->checkColumnName('spotter_archive','source_name')) {
692
+		if (!$Connection->checkColumnName('spotter_archive', 'source_name')) {
693 693
 			// Add source_name to spotter_output, spotter_live, spotter_archive, spotter_archive_output
694 694
     			$query = "ALTER TABLE `spotter_archive` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`;";
695 695
 			try {
696 696
 				$sth = $Connection->db->prepare($query);
697 697
 				$sth->execute();
698
-			} catch(PDOException $e) {
698
+			} catch (PDOException $e) {
699 699
 				return "error (add source_name column) : ".$e->getMessage()."\n";
700 700
     			}
701 701
     		}
@@ -704,7 +704,7 @@  discard block
 block discarded – undo
704 704
         	try {
705 705
             	    $sth = $Connection->db->prepare($query);
706 706
 		    $sth->execute();
707
-    		} catch(PDOException $e) {
707
+    		} catch (PDOException $e) {
708 708
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
709 709
     		}
710 710
 		return $error;
@@ -719,13 +719,13 @@  discard block
 block discarded – undo
719 719
 			$error .= create_db::import_file('../db/airlines.sql');
720 720
 			if ($error != '') return 'Import airlines.sql : '.$error;
721 721
 		}
722
-		if (!$Connection->checkColumnName('aircraft_modes','type_flight')) {
722
+		if (!$Connection->checkColumnName('aircraft_modes', 'type_flight')) {
723 723
 			// Add column over_country
724 724
     			$query = "ALTER TABLE `aircraft_modes` ADD `type_flight` VARCHAR(50) NULL DEFAULT NULL;";
725 725
         		try {
726 726
 				$sth = $Connection->db->prepare($query);
727 727
 				$sth->execute();
728
-			} catch(PDOException $e) {
728
+			} catch (PDOException $e) {
729 729
 				return "error (add over_country) : ".$e->getMessage()."\n";
730 730
     			}
731 731
     		}
@@ -741,7 +741,7 @@  discard block
 block discarded – undo
741 741
         	try {
742 742
             	    $sth = $Connection->db->prepare($query);
743 743
 		    $sth->execute();
744
-    		} catch(PDOException $e) {
744
+    		} catch (PDOException $e) {
745 745
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
746 746
     		}
747 747
 		return $error;
@@ -750,13 +750,13 @@  discard block
 block discarded – undo
750 750
 	private static function update_from_21() {
751 751
 		$Connection = new Connection();
752 752
 		$error = '';
753
-		if (!$Connection->checkColumnName('stats_airport','stats_type')) {
753
+		if (!$Connection->checkColumnName('stats_airport', 'stats_type')) {
754 754
 			// Rename type to stats_type
755 755
 			$query = "ALTER TABLE `stats_airport` CHANGE `type` `stats_type` VARCHAR(50);ALTER TABLE `stats` CHANGE `type` `stats_type` VARCHAR(50);ALTER TABLE `stats_flight` CHANGE `type` `stats_type` VARCHAR(50);";
756 756
 			try {
757 757
 				$sth = $Connection->db->prepare($query);
758 758
 				$sth->execute();
759
-			} catch(PDOException $e) {
759
+			} catch (PDOException $e) {
760 760
 				return "error (rename type to stats_type on stats*) : ".$e->getMessage()."\n";
761 761
 			}
762 762
 			if ($error != '') return $error;
@@ -765,7 +765,7 @@  discard block
 block discarded – undo
765 765
         	try {
766 766
             	    $sth = $Connection->db->prepare($query);
767 767
 		    $sth->execute();
768
-    		} catch(PDOException $e) {
768
+    		} catch (PDOException $e) {
769 769
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
770 770
     		}
771 771
 		return $error;
@@ -788,7 +788,7 @@  discard block
 block discarded – undo
788 788
         	try {
789 789
             	    $sth = $Connection->db->prepare($query);
790 790
 		    $sth->execute();
791
-    		} catch(PDOException $e) {
791
+    		} catch (PDOException $e) {
792 792
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
793 793
     		}
794 794
 		return $error;
@@ -815,17 +815,17 @@  discard block
 block discarded – undo
815 815
 			try {
816 816
 				$sth = $Connection->db->prepare($query);
817 817
 				$sth->execute();
818
-			} catch(PDOException $e) {
818
+			} catch (PDOException $e) {
819 819
 				return "error (create index on spotter_archive) : ".$e->getMessage()."\n";
820 820
 			}
821 821
 		}
822
-		if (!$Connection->checkColumnName('stats_aircraft','aircraft_manufacturer')) {
822
+		if (!$Connection->checkColumnName('stats_aircraft', 'aircraft_manufacturer')) {
823 823
 			// Add aircraft_manufacturer to stats_aircraft
824 824
     			$query = "ALTER TABLE stats_aircraft ADD aircraft_manufacturer VARCHAR(255) NULL";
825 825
 			try {
826 826
 				$sth = $Connection->db->prepare($query);
827 827
 				$sth->execute();
828
-			} catch(PDOException $e) {
828
+			} catch (PDOException $e) {
829 829
 				return "error (add aircraft_manufacturer column) : ".$e->getMessage()."\n";
830 830
     			}
831 831
     		}
@@ -834,7 +834,7 @@  discard block
 block discarded – undo
834 834
 		try {
835 835
 			$sth = $Connection->db->prepare($query);
836 836
 			$sth->execute();
837
-		} catch(PDOException $e) {
837
+		} catch (PDOException $e) {
838 838
 			return "error (update schema_version) : ".$e->getMessage()."\n";
839 839
 		}
840 840
 		return $error;
@@ -850,23 +850,23 @@  discard block
 block discarded – undo
850 850
 			$error .= create_db::import_file('../db/pgsql/airlines.sql');
851 851
 		}
852 852
 		if ($error != '') return 'Import airlines.sql : '.$error;
853
-		if (!$Connection->checkColumnName('airlines','forsource')) {
853
+		if (!$Connection->checkColumnName('airlines', 'forsource')) {
854 854
 			// Add forsource to airlines
855 855
 			$query = "ALTER TABLE airlines ADD forsource VARCHAR(255) NULL DEFAULT NULL";
856 856
 			try {
857 857
 				$sth = $Connection->db->prepare($query);
858 858
 				$sth->execute();
859
-			} catch(PDOException $e) {
859
+			} catch (PDOException $e) {
860 860
 				return "error (add forsource column) : ".$e->getMessage()."\n";
861 861
 			}
862 862
 		}
863
-		if (!$Connection->checkColumnName('stats_aircraft','stats_airline')) {
863
+		if (!$Connection->checkColumnName('stats_aircraft', 'stats_airline')) {
864 864
 			// Add forsource to airlines
865 865
 			$query = "ALTER TABLE stats_aircraft ADD stats_airline VARCHAR(255) NULL DEFAULT '', ADD filter_name VARCHAR(255) NULL DEFAULT ''";
866 866
 			try {
867 867
 				$sth = $Connection->db->prepare($query);
868 868
 				$sth->execute();
869
-			} catch(PDOException $e) {
869
+			} catch (PDOException $e) {
870 870
 				return "error (add stats_airline & filter_name column in stats_aircraft) : ".$e->getMessage()."\n";
871 871
 			}
872 872
 			// Add unique key
@@ -878,17 +878,17 @@  discard block
 block discarded – undo
878 878
 			try {
879 879
 				$sth = $Connection->db->prepare($query);
880 880
 				$sth->execute();
881
-			} catch(PDOException $e) {
881
+			} catch (PDOException $e) {
882 882
 				return "error (add unique key in stats_aircraft) : ".$e->getMessage()."\n";
883 883
 			}
884 884
 		}
885
-		if (!$Connection->checkColumnName('stats_airport','stats_airline')) {
885
+		if (!$Connection->checkColumnName('stats_airport', 'stats_airline')) {
886 886
 			// Add forsource to airlines
887 887
 			$query = "ALTER TABLE stats_airport ADD stats_airline VARCHAR(255) NULL DEFAULT '', ADD filter_name VARCHAR(255) NULL DEFAULT ''";
888 888
 			try {
889 889
 				$sth = $Connection->db->prepare($query);
890 890
 				$sth->execute();
891
-			} catch(PDOException $e) {
891
+			} catch (PDOException $e) {
892 892
 				return "error (add filter_name column in stats_airport) : ".$e->getMessage()."\n";
893 893
 			}
894 894
 			// Add unique key
@@ -900,17 +900,17 @@  discard block
 block discarded – undo
900 900
 			try {
901 901
 				$sth = $Connection->db->prepare($query);
902 902
 				$sth->execute();
903
-			} catch(PDOException $e) {
903
+			} catch (PDOException $e) {
904 904
 				return "error (add unique key in stats_airport) : ".$e->getMessage()."\n";
905 905
 			}
906 906
 		}
907
-		if (!$Connection->checkColumnName('stats_country','stats_airline')) {
907
+		if (!$Connection->checkColumnName('stats_country', 'stats_airline')) {
908 908
 			// Add forsource to airlines
909 909
 			$query = "ALTER TABLE stats_country ADD stats_airline VARCHAR(255) NULL DEFAULT '', ADD filter_name VARCHAR(255) NULL DEFAULT ''";
910 910
 			try {
911 911
 				$sth = $Connection->db->prepare($query);
912 912
 				$sth->execute();
913
-			} catch(PDOException $e) {
913
+			} catch (PDOException $e) {
914 914
 				return "error (add stats_airline & filter_name column in stats_country) : ".$e->getMessage()."\n";
915 915
 			}
916 916
 			// Add unique key
@@ -922,37 +922,37 @@  discard block
 block discarded – undo
922 922
 			try {
923 923
 				$sth = $Connection->db->prepare($query);
924 924
 				$sth->execute();
925
-			} catch(PDOException $e) {
925
+			} catch (PDOException $e) {
926 926
 				return "error (add unique key in stats_airline) : ".$e->getMessage()."\n";
927 927
 			}
928 928
 		}
929
-		if (!$Connection->checkColumnName('stats_flight','stats_airline')) {
929
+		if (!$Connection->checkColumnName('stats_flight', 'stats_airline')) {
930 930
 			// Add forsource to airlines
931 931
 			$query = "ALTER TABLE stats_flight ADD stats_airline VARCHAR(255) NULL DEFAULT '', ADD filter_name VARCHAR(255) NULL DEFAULT ''";
932 932
 			try {
933 933
 				$sth = $Connection->db->prepare($query);
934 934
 				$sth->execute();
935
-			} catch(PDOException $e) {
935
+			} catch (PDOException $e) {
936 936
 				return "error (add stats_airline & filter_name column in stats_flight) : ".$e->getMessage()."\n";
937 937
 			}
938 938
 		}
939
-		if (!$Connection->checkColumnName('stats','stats_airline')) {
939
+		if (!$Connection->checkColumnName('stats', 'stats_airline')) {
940 940
 			// Add forsource to airlines
941 941
 			$query = "ALTER TABLE stats ADD stats_airline VARCHAR(255) NULL DEFAULT '', ADD filter_name VARCHAR(255) NULL DEFAULT ''";
942 942
 			try {
943 943
 				$sth = $Connection->db->prepare($query);
944 944
 				$sth->execute();
945
-			} catch(PDOException $e) {
945
+			} catch (PDOException $e) {
946 946
 				return "error (add stats_airline & filter_name column in stats) : ".$e->getMessage()."\n";
947 947
 			}
948 948
 		}
949
-		if ($globalDBdriver == 'mysql' && $Connection->indexExists('stats','type')) {
949
+		if ($globalDBdriver == 'mysql' && $Connection->indexExists('stats', 'type')) {
950 950
 			// Add unique key
951 951
 			$query = "drop index type on stats;ALTER TABLE stats ADD UNIQUE stats_type (stats_type,stats_date,stats_airline,filter_name);";
952 952
 			try {
953 953
 				$sth = $Connection->db->prepare($query);
954 954
 				$sth->execute();
955
-			} catch(PDOException $e) {
955
+			} catch (PDOException $e) {
956 956
 				return "error (add unique key in stats) : ".$e->getMessage()."\n";
957 957
 			}
958 958
 		
@@ -966,17 +966,17 @@  discard block
 block discarded – undo
966 966
 			try {
967 967
 				$sth = $Connection->db->prepare($query);
968 968
 				$sth->execute();
969
-			} catch(PDOException $e) {
969
+			} catch (PDOException $e) {
970 970
 				return "error (add unique key in stats) : ".$e->getMessage()."\n";
971 971
 			}
972 972
 		}
973
-		if (!$Connection->checkColumnName('stats_registration','stats_airline')) {
973
+		if (!$Connection->checkColumnName('stats_registration', 'stats_airline')) {
974 974
 			// Add forsource to airlines
975 975
 			$query = "ALTER TABLE stats_registration ADD stats_airline VARCHAR(255) NULL DEFAULT '', ADD filter_name VARCHAR(255) NULL DEFAULT ''";
976 976
 			try {
977 977
 				$sth = $Connection->db->prepare($query);
978 978
 				$sth->execute();
979
-			} catch(PDOException $e) {
979
+			} catch (PDOException $e) {
980 980
 				return "error (add stats_airline & filter_name column in stats_registration) : ".$e->getMessage()."\n";
981 981
 			}
982 982
 			// Add unique key
@@ -988,17 +988,17 @@  discard block
 block discarded – undo
988 988
 			try {
989 989
 				$sth = $Connection->db->prepare($query);
990 990
 				$sth->execute();
991
-			} catch(PDOException $e) {
991
+			} catch (PDOException $e) {
992 992
 				return "error (add unique key in stats_registration) : ".$e->getMessage()."\n";
993 993
 			}
994 994
 		}
995
-		if (!$Connection->checkColumnName('stats_callsign','filter_name')) {
995
+		if (!$Connection->checkColumnName('stats_callsign', 'filter_name')) {
996 996
 			// Add forsource to airlines
997 997
 			$query = "ALTER TABLE stats_callsign ADD filter_name VARCHAR(255) NULL DEFAULT ''";
998 998
 			try {
999 999
 				$sth = $Connection->db->prepare($query);
1000 1000
 				$sth->execute();
1001
-			} catch(PDOException $e) {
1001
+			} catch (PDOException $e) {
1002 1002
 				return "error (add filter_name column in stats_callsign) : ".$e->getMessage()."\n";
1003 1003
 			}
1004 1004
 			// Add unique key
@@ -1010,17 +1010,17 @@  discard block
 block discarded – undo
1010 1010
 			try {
1011 1011
 				$sth = $Connection->db->prepare($query);
1012 1012
 				$sth->execute();
1013
-			} catch(PDOException $e) {
1013
+			} catch (PDOException $e) {
1014 1014
 				return "error (add unique key in stats_callsign) : ".$e->getMessage()."\n";
1015 1015
 			}
1016 1016
 		}
1017
-		if (!$Connection->checkColumnName('stats_airline','filter_name')) {
1017
+		if (!$Connection->checkColumnName('stats_airline', 'filter_name')) {
1018 1018
 			// Add forsource to airlines
1019 1019
 			$query = "ALTER TABLE stats_airline ADD filter_name VARCHAR(255) NULL DEFAULT ''";
1020 1020
 			try {
1021 1021
 				$sth = $Connection->db->prepare($query);
1022 1022
 				$sth->execute();
1023
-			} catch(PDOException $e) {
1023
+			} catch (PDOException $e) {
1024 1024
 				return "error (add filter_name column in stats_airline) : ".$e->getMessage()."\n";
1025 1025
 			}
1026 1026
 			// Add unique key
@@ -1032,7 +1032,7 @@  discard block
 block discarded – undo
1032 1032
 			try {
1033 1033
 				$sth = $Connection->db->prepare($query);
1034 1034
 				$sth->execute();
1035
-			} catch(PDOException $e) {
1035
+			} catch (PDOException $e) {
1036 1036
 				return "error (add unique key in stats_callsign) : ".$e->getMessage()."\n";
1037 1037
 			}
1038 1038
 		}
@@ -1041,7 +1041,7 @@  discard block
 block discarded – undo
1041 1041
 		try {
1042 1042
 			$sth = $Connection->db->prepare($query);
1043 1043
 			$sth->execute();
1044
-		} catch(PDOException $e) {
1044
+		} catch (PDOException $e) {
1045 1045
 			return "error (update schema_version) : ".$e->getMessage()."\n";
1046 1046
 		}
1047 1047
 		return $error;
@@ -1051,13 +1051,13 @@  discard block
 block discarded – undo
1051 1051
 		global $globalDBdriver;
1052 1052
 		$Connection = new Connection();
1053 1053
 		$error = '';
1054
-		if (!$Connection->checkColumnName('stats_owner','stats_airline')) {
1054
+		if (!$Connection->checkColumnName('stats_owner', 'stats_airline')) {
1055 1055
 			// Add forsource to airlines
1056 1056
 			$query = "ALTER TABLE stats_owner ADD stats_airline VARCHAR(255) NULL DEFAULT '', ADD filter_name VARCHAR(255) NULL DEFAULT ''";
1057 1057
 			try {
1058 1058
 				$sth = $Connection->db->prepare($query);
1059 1059
 				$sth->execute();
1060
-			} catch(PDOException $e) {
1060
+			} catch (PDOException $e) {
1061 1061
 				return "error (add stats_airline & filter_name column in stats_owner) : ".$e->getMessage()."\n";
1062 1062
 			}
1063 1063
 			// Add unique key
@@ -1069,17 +1069,17 @@  discard block
 block discarded – undo
1069 1069
 			try {
1070 1070
 				$sth = $Connection->db->prepare($query);
1071 1071
 				$sth->execute();
1072
-			} catch(PDOException $e) {
1072
+			} catch (PDOException $e) {
1073 1073
 				return "error (add unique key in stats_owner) : ".$e->getMessage()."\n";
1074 1074
 			}
1075 1075
 		}
1076
-		if (!$Connection->checkColumnName('stats_pilot','stats_airline')) {
1076
+		if (!$Connection->checkColumnName('stats_pilot', 'stats_airline')) {
1077 1077
 			// Add forsource to airlines
1078 1078
 			$query = "ALTER TABLE stats_pilot ADD stats_airline VARCHAR(255) NULL DEFAULT '', ADD filter_name VARCHAR(255) NULL DEFAULT ''";
1079 1079
 			try {
1080 1080
 				$sth = $Connection->db->prepare($query);
1081 1081
 				$sth->execute();
1082
-			} catch(PDOException $e) {
1082
+			} catch (PDOException $e) {
1083 1083
 				return "error (add stats_airline & filter_name column in stats_pilot) : ".$e->getMessage()."\n";
1084 1084
 			}
1085 1085
 			// Add unique key
@@ -1091,7 +1091,7 @@  discard block
 block discarded – undo
1091 1091
 			try {
1092 1092
 				$sth = $Connection->db->prepare($query);
1093 1093
 				$sth->execute();
1094
-			} catch(PDOException $e) {
1094
+			} catch (PDOException $e) {
1095 1095
 				return "error (add unique key in stats_pilot) : ".$e->getMessage()."\n";
1096 1096
 			}
1097 1097
 		}
@@ -1099,7 +1099,7 @@  discard block
 block discarded – undo
1099 1099
 		try {
1100 1100
 			$sth = $Connection->db->prepare($query);
1101 1101
 			$sth->execute();
1102
-		} catch(PDOException $e) {
1102
+		} catch (PDOException $e) {
1103 1103
 			return "error (update schema_version) : ".$e->getMessage()."\n";
1104 1104
 		}
1105 1105
 		return $error;
@@ -1122,7 +1122,7 @@  discard block
 block discarded – undo
1122 1122
 		    try {
1123 1123
             		$sth = $Connection->db->prepare($query);
1124 1124
 		        $sth->execute();
1125
-		    } catch(PDOException $e) {
1125
+		    } catch (PDOException $e) {
1126 1126
 			return "error : ".$e->getMessage()."\n";
1127 1127
     		    }
1128 1128
     		    $result = $sth->fetch(PDO::FETCH_ASSOC);
Please login to merge, or discard this patch.
require/class.Spotter.php 4 patches
Indentation   +1265 added lines, -1265 removed lines patch added patch discarded remove patch
@@ -13,10 +13,10 @@  discard block
 block discarded – undo
13 13
 	}
14 14
 
15 15
 	/**
16
-	* Get SQL query part for filter used
17
-	* @param Array $filter the filter
18
-	* @return Array the SQL part
19
-	*/
16
+	 * Get SQL query part for filter used
17
+	 * @param Array $filter the filter
18
+	 * @return Array the SQL part
19
+	 */
20 20
 	public function getFilter($filter = array(),$where = false,$and = false) {
21 21
 		global $globalFilter;
22 22
 		if (is_array($globalFilter)) $filter = array_merge($globalFilter,$filter);
@@ -51,14 +51,14 @@  discard block
 block discarded – undo
51 51
 	}
52 52
 
53 53
 	/**
54
-	* Executes the SQL statements to get the spotter information
55
-	*
56
-	* @param String $query the SQL query
57
-	* @param Array $params parameter of the query
58
-	* @param String $limitQuery the limit query
59
-	* @return Array the spotter information
60
-	*
61
-	*/
54
+	 * Executes the SQL statements to get the spotter information
55
+	 *
56
+	 * @param String $query the SQL query
57
+	 * @param Array $params parameter of the query
58
+	 * @param String $limitQuery the limit query
59
+	 * @return Array the spotter information
60
+	 *
61
+	 */
62 62
 	public function getDataFromDB($query, $params = array(), $limitQuery = '')
63 63
 	{
64 64
 		global $globalSquawkCountry, $globalIVAO, $globalVATSIM, $globalphpVMS;
@@ -221,11 +221,11 @@  discard block
 block discarded – undo
221 221
 					if ($aircraft_array[0]['aircraft_shadow'] != NULL) {
222 222
 						$temp_array['aircraft_shadow'] = $aircraft_array[0]['aircraft_shadow'];
223 223
 					} else $temp_array['aircraft_shadow'] = 'default.png';
224
-                                } else {
225
-                            		$temp_array['aircraft_shadow'] = 'default.png';
224
+								} else {
225
+									$temp_array['aircraft_shadow'] = 'default.png';
226 226
 					$temp_array['aircraft_name'] = 'N/A';
227 227
 					$temp_array['aircraft_manufacturer'] = 'N/A';
228
-                            	}
228
+								}
229 229
 			}
230 230
 			$fromsource = NULL;
231 231
 			if (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') $fromsource = 'vatsim';
@@ -407,11 +407,11 @@  discard block
 block discarded – undo
407 407
 	
408 408
 	
409 409
 	/**
410
-	* Gets all the spotter information
411
-	*
412
-	* @return Array the spotter information
413
-	*
414
-	*/
410
+	 * Gets all the spotter information
411
+	 *
412
+	 * @return Array the spotter information
413
+	 *
414
+	 */
415 415
 	public function searchSpotterData($q = '', $registration = '', $aircraft_icao = '', $aircraft_manufacturer = '', $highlights = '', $airline_icao = '', $airline_country = '', $airline_type = '', $airport = '', $airport_country = '', $callsign = '', $departure_airport_route = '', $arrival_airport_route = '', $owner = '',$pilot_id = '',$pilot_name = '',$altitude = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '',$origLat = '',$origLon = '',$dist = '',$filter = array())
416 416
 	{
417 417
 		global $globalTimezone, $globalDBdriver;
@@ -758,11 +758,11 @@  discard block
 block discarded – undo
758 758
 	
759 759
 	
760 760
 	/**
761
-	* Gets all the spotter information based on the latest data entry
762
-	*
763
-	* @return Array the spotter information
764
-	*
765
-	*/
761
+	 * Gets all the spotter information based on the latest data entry
762
+	 *
763
+	 * @return Array the spotter information
764
+	 *
765
+	 */
766 766
 	public function getLatestSpotterData($limit = '', $sort = '', $filter = array())
767 767
 	{
768 768
 		global $global_query;
@@ -801,12 +801,12 @@  discard block
 block discarded – undo
801 801
 	}
802 802
     
803 803
     
804
-    /**
805
-	* Gets all the spotter information based on a user's latitude and longitude
806
-	*
807
-	* @return Array the spotter information
808
-	*
809
-	*/
804
+	/**
805
+	 * Gets all the spotter information based on a user's latitude and longitude
806
+	 *
807
+	 * @return Array the spotter information
808
+	 *
809
+	 */
810 810
 	public function getLatestSpotterForLayar($lat, $lng, $radius, $interval)
811 811
 	{
812 812
 		date_default_timezone_set('UTC');
@@ -834,7 +834,7 @@  discard block
 block discarded – undo
834 834
 				return false;
835 835
 			}
836 836
 		}
837
-    		$additional_query = '';
837
+			$additional_query = '';
838 838
 		if ($interval != "")
839 839
 		{
840 840
 			if (!is_string($interval))
@@ -874,12 +874,12 @@  discard block
 block discarded – undo
874 874
 	}
875 875
     
876 876
     
877
-    /**
878
-	* Gets all the spotter information sorted by the newest aircraft type
879
-	*
880
-	* @return Array the spotter information
881
-	*
882
-	*/
877
+	/**
878
+	 * Gets all the spotter information sorted by the newest aircraft type
879
+	 *
880
+	 * @return Array the spotter information
881
+	 *
882
+	 */
883 883
 	public function getNewestSpotterDataSortedByAircraftType($limit = '', $sort = '',$filter = array())
884 884
 	{
885 885
 		global $global_query;
@@ -920,11 +920,11 @@  discard block
 block discarded – undo
920 920
     
921 921
     
922 922
 	/**
923
-	* Gets all the spotter information sorted by the newest aircraft registration
924
-	*
925
-	* @return Array the spotter information
926
-	*
927
-	*/
923
+	 * Gets all the spotter information sorted by the newest aircraft registration
924
+	 *
925
+	 * @return Array the spotter information
926
+	 *
927
+	 */
928 928
 	public function getNewestSpotterDataSortedByAircraftRegistration($limit = '', $sort = '', $filter = array())
929 929
 	{
930 930
 		global $global_query;
@@ -964,11 +964,11 @@  discard block
 block discarded – undo
964 964
 
965 965
 
966 966
 	/**
967
-	* Gets all the spotter information sorted by the newest airline
968
-	*
969
-	* @return Array the spotter information
970
-	*
971
-	*/
967
+	 * Gets all the spotter information sorted by the newest airline
968
+	 *
969
+	 * @return Array the spotter information
970
+	 *
971
+	 */
972 972
 	public function getNewestSpotterDataSortedByAirline($limit = '', $sort = '',$filter = array())
973 973
 	{
974 974
 		global $global_query;
@@ -1007,12 +1007,12 @@  discard block
 block discarded – undo
1007 1007
 	}
1008 1008
     
1009 1009
     
1010
-    /**
1011
-	* Gets all the spotter information sorted by the newest departure airport
1012
-	*
1013
-	* @return Array the spotter information
1014
-	*
1015
-	*/
1010
+	/**
1011
+	 * Gets all the spotter information sorted by the newest departure airport
1012
+	 *
1013
+	 * @return Array the spotter information
1014
+	 *
1015
+	 */
1016 1016
 	public function getNewestSpotterDataSortedByDepartureAirport($limit = '', $sort = '', $filter = array())
1017 1017
 	{
1018 1018
 		global $global_query;
@@ -1054,11 +1054,11 @@  discard block
 block discarded – undo
1054 1054
 
1055 1055
 
1056 1056
 	/**
1057
-	* Gets all the spotter information sorted by the newest arrival airport
1058
-	*
1059
-	* @return Array the spotter information
1060
-	*
1061
-	*/
1057
+	 * Gets all the spotter information sorted by the newest arrival airport
1058
+	 *
1059
+	 * @return Array the spotter information
1060
+	 *
1061
+	 */
1062 1062
 	public function getNewestSpotterDataSortedByArrivalAirport($limit = '', $sort = '', $filter = array())
1063 1063
 	{
1064 1064
 		global $global_query;
@@ -1097,11 +1097,11 @@  discard block
 block discarded – undo
1097 1097
 	
1098 1098
 
1099 1099
 	/**
1100
-	* Gets all the spotter information based on the spotter id
1101
-	*
1102
-	* @return Array the spotter information
1103
-	*
1104
-	*/
1100
+	 * Gets all the spotter information based on the spotter id
1101
+	 *
1102
+	 * @return Array the spotter information
1103
+	 *
1104
+	 */
1105 1105
 	public function getSpotterDataByID($id = '')
1106 1106
 	{
1107 1107
 		global $global_query;
@@ -1123,11 +1123,11 @@  discard block
 block discarded – undo
1123 1123
 	
1124 1124
 	
1125 1125
 	/**
1126
-	* Gets all the spotter information based on the callsign
1127
-	*
1128
-	* @return Array the spotter information
1129
-	*
1130
-	*/
1126
+	 * Gets all the spotter information based on the callsign
1127
+	 *
1128
+	 * @return Array the spotter information
1129
+	 *
1130
+	 */
1131 1131
 	public function getSpotterDataByIdent($ident = '', $limit = '', $sort = '')
1132 1132
 	{
1133 1133
 		global $global_query;
@@ -1180,11 +1180,11 @@  discard block
 block discarded – undo
1180 1180
 	
1181 1181
 	
1182 1182
 	/**
1183
-	* Gets all the spotter information based on the aircraft type
1184
-	*
1185
-	* @return Array the spotter information
1186
-	*
1187
-	*/
1183
+	 * Gets all the spotter information based on the aircraft type
1184
+	 *
1185
+	 * @return Array the spotter information
1186
+	 *
1187
+	 */
1188 1188
 	public function getSpotterDataByAircraft($aircraft_type = '', $limit = '', $sort = '', $filter = array())
1189 1189
 	{
1190 1190
 		global $global_query;
@@ -1238,11 +1238,11 @@  discard block
 block discarded – undo
1238 1238
 	
1239 1239
 	
1240 1240
 	/**
1241
-	* Gets all the spotter information based on the aircraft registration
1242
-	*
1243
-	* @return Array the spotter information
1244
-	*
1245
-	*/
1241
+	 * Gets all the spotter information based on the aircraft registration
1242
+	 *
1243
+	 * @return Array the spotter information
1244
+	 *
1245
+	 */
1246 1246
 	public function getSpotterDataByRegistration($registration = '', $limit = '', $sort = '', $filter = array())
1247 1247
 	{
1248 1248
 		global $global_query;
@@ -1298,11 +1298,11 @@  discard block
 block discarded – undo
1298 1298
 	
1299 1299
 	
1300 1300
 	/**
1301
-	* Gets all the spotter information based on the airline
1302
-	*
1303
-	* @return Array the spotter information
1304
-	*
1305
-	*/
1301
+	 * Gets all the spotter information based on the airline
1302
+	 *
1303
+	 * @return Array the spotter information
1304
+	 *
1305
+	 */
1306 1306
 	public function getSpotterDataByAirline($airline = '', $limit = '', $sort = '')
1307 1307
 	{
1308 1308
 		global $global_query;
@@ -1354,11 +1354,11 @@  discard block
 block discarded – undo
1354 1354
 	
1355 1355
 	
1356 1356
 	/**
1357
-	* Gets all the spotter information based on the airport
1358
-	*
1359
-	* @return Array the spotter information
1360
-	*
1361
-	*/
1357
+	 * Gets all the spotter information based on the airport
1358
+	 *
1359
+	 * @return Array the spotter information
1360
+	 *
1361
+	 */
1362 1362
 	public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '')
1363 1363
 	{
1364 1364
 		global $global_query;
@@ -1411,11 +1411,11 @@  discard block
 block discarded – undo
1411 1411
 
1412 1412
 
1413 1413
 	/**
1414
-	* Gets all the spotter information based on the date
1415
-	*
1416
-	* @return Array the spotter information
1417
-	*
1418
-	*/
1414
+	 * Gets all the spotter information based on the date
1415
+	 *
1416
+	 * @return Array the spotter information
1417
+	 *
1418
+	 */
1419 1419
 	public function getSpotterDataByDate($date = '', $limit = '', $sort = '',$filter = array())
1420 1420
 	{
1421 1421
 		global $global_query, $globalTimezone, $globalDBdriver;
@@ -1492,11 +1492,11 @@  discard block
 block discarded – undo
1492 1492
 
1493 1493
 
1494 1494
 	/**
1495
-	* Gets all the spotter information based on the country name
1496
-	*
1497
-	* @return Array the spotter information
1498
-	*
1499
-	*/
1495
+	 * Gets all the spotter information based on the country name
1496
+	 *
1497
+	 * @return Array the spotter information
1498
+	 *
1499
+	 */
1500 1500
 	public function getSpotterDataByCountry($country = '', $limit = '', $sort = '')
1501 1501
 	{
1502 1502
 		global $global_query;
@@ -1549,11 +1549,11 @@  discard block
 block discarded – undo
1549 1549
 	
1550 1550
 	
1551 1551
 	/**
1552
-	* Gets all the spotter information based on the manufacturer name
1553
-	*
1554
-	* @return Array the spotter information
1555
-	*
1556
-	*/
1552
+	 * Gets all the spotter information based on the manufacturer name
1553
+	 *
1554
+	 * @return Array the spotter information
1555
+	 *
1556
+	 */
1557 1557
 	public function getSpotterDataByManufacturer($aircraft_manufacturer = '', $limit = '', $sort = '')
1558 1558
 	{
1559 1559
 		global $global_query;
@@ -1608,13 +1608,13 @@  discard block
 block discarded – undo
1608 1608
   
1609 1609
   
1610 1610
 	/**
1611
-	* Gets a list of all aircraft that take a route
1612
-	*
1613
-	* @param String $departure_airport_icao ICAO code of departure airport
1614
-	* @param String $arrival_airport_icao ICAO code of arrival airport
1615
-	* @return Array the spotter information
1616
-	*
1617
-	*/
1611
+	 * Gets a list of all aircraft that take a route
1612
+	 *
1613
+	 * @param String $departure_airport_icao ICAO code of departure airport
1614
+	 * @param String $arrival_airport_icao ICAO code of arrival airport
1615
+	 * @return Array the spotter information
1616
+	 *
1617
+	 */
1618 1618
 	public function getSpotterDataByRoute($departure_airport_icao = '', $arrival_airport_icao = '', $limit = '', $sort = '')
1619 1619
 	{
1620 1620
 		global $global_query;
@@ -1680,11 +1680,11 @@  discard block
 block discarded – undo
1680 1680
 	
1681 1681
 	
1682 1682
 	/**
1683
-	* Gets all the spotter information based on the special column in the table
1684
-	*
1685
-	* @return Array the spotter information
1686
-	*
1687
-	*/
1683
+	 * Gets all the spotter information based on the special column in the table
1684
+	 *
1685
+	 * @return Array the spotter information
1686
+	 *
1687
+	 */
1688 1688
 	public function getSpotterDataByHighlight($limit = '', $sort = '', $filter = array())
1689 1689
 	{
1690 1690
 		global $global_query;
@@ -1723,11 +1723,11 @@  discard block
 block discarded – undo
1723 1723
 	}
1724 1724
 
1725 1725
 	/**
1726
-	* Gets all the highlight based on a aircraft registration
1727
-	*
1728
-	* @return String the highlight text
1729
-	*
1730
-	*/
1726
+	 * Gets all the highlight based on a aircraft registration
1727
+	 *
1728
+	 * @return String the highlight text
1729
+	 *
1730
+	 */
1731 1731
 	public function getHighlightByRegistration($registration,$filter = array())
1732 1732
 	{
1733 1733
 		global $global_query;
@@ -1749,13 +1749,13 @@  discard block
 block discarded – undo
1749 1749
 
1750 1750
 	
1751 1751
 	/**
1752
-	* Gets the squawk usage from squawk code
1753
-	*
1754
-	* @param String $squawk squawk code
1755
-	* @param String $country country
1756
-	* @return String usage
1757
-	*
1758
-	*/
1752
+	 * Gets the squawk usage from squawk code
1753
+	 *
1754
+	 * @param String $squawk squawk code
1755
+	 * @param String $country country
1756
+	 * @return String usage
1757
+	 *
1758
+	 */
1759 1759
 	public function getSquawkUsage($squawk = '',$country = 'FR')
1760 1760
 	{
1761 1761
 		
@@ -1775,12 +1775,12 @@  discard block
 block discarded – undo
1775 1775
 	}
1776 1776
 
1777 1777
 	/**
1778
-	* Gets the airport icao from the iata
1779
-	*
1780
-	* @param String $airport_iata the iata code of the airport
1781
-	* @return String airport iata
1782
-	*
1783
-	*/
1778
+	 * Gets the airport icao from the iata
1779
+	 *
1780
+	 * @param String $airport_iata the iata code of the airport
1781
+	 * @return String airport iata
1782
+	 *
1783
+	 */
1784 1784
 	public function getAirportIcao($airport_iata = '')
1785 1785
 	{
1786 1786
 		
@@ -1799,14 +1799,14 @@  discard block
 block discarded – undo
1799 1799
 	}
1800 1800
 
1801 1801
 	/**
1802
-	* Gets the airport distance
1803
-	*
1804
-	* @param String $airport_icao the icao code of the airport
1805
-	* @param Float $latitude the latitude
1806
-	* @param Float $longitude the longitude
1807
-	* @return Float distance to the airport
1808
-	*
1809
-	*/
1802
+	 * Gets the airport distance
1803
+	 *
1804
+	 * @param String $airport_icao the icao code of the airport
1805
+	 * @param Float $latitude the latitude
1806
+	 * @param Float $longitude the longitude
1807
+	 * @return Float distance to the airport
1808
+	 *
1809
+	 */
1810 1810
 	public function getAirportDistance($airport_icao,$latitude,$longitude)
1811 1811
 	{
1812 1812
 		
@@ -1826,12 +1826,12 @@  discard block
 block discarded – undo
1826 1826
 	}
1827 1827
 	
1828 1828
 	/**
1829
-	* Gets the airport info based on the icao
1830
-	*
1831
-	* @param String $airport the icao code of the airport
1832
-	* @return Array airport information
1833
-	*
1834
-	*/
1829
+	 * Gets the airport info based on the icao
1830
+	 *
1831
+	 * @param String $airport the icao code of the airport
1832
+	 * @return Array airport information
1833
+	 *
1834
+	 */
1835 1835
 	public function getAllAirportInfo($airport = '')
1836 1836
 	{
1837 1837
 		
@@ -1877,12 +1877,12 @@  discard block
 block discarded – undo
1877 1877
 	}
1878 1878
 	
1879 1879
 	/**
1880
-	* Gets the airport info based on the country
1881
-	*
1882
-	* @param Array $countries Airports countries
1883
-	* @return Array airport information
1884
-	*
1885
-	*/
1880
+	 * Gets the airport info based on the country
1881
+	 *
1882
+	 * @param Array $countries Airports countries
1883
+	 * @return Array airport information
1884
+	 *
1885
+	 */
1886 1886
 	public function getAllAirportInfobyCountry($countries)
1887 1887
 	{
1888 1888
 		$lst_countries = '';
@@ -1920,12 +1920,12 @@  discard block
 block discarded – undo
1920 1920
 	}
1921 1921
 	
1922 1922
 	/**
1923
-	* Gets airports info based on the coord
1924
-	*
1925
-	* @param Array $coord Airports longitude min,latitude min, longitude max, latitude max
1926
-	* @return Array airport information
1927
-	*
1928
-	*/
1923
+	 * Gets airports info based on the coord
1924
+	 *
1925
+	 * @param Array $coord Airports longitude min,latitude min, longitude max, latitude max
1926
+	 * @return Array airport information
1927
+	 *
1928
+	 */
1929 1929
 	public function getAllAirportInfobyCoord($coord)
1930 1930
 	{
1931 1931
 		global $globalDBdriver;
@@ -1956,12 +1956,12 @@  discard block
 block discarded – undo
1956 1956
 	}
1957 1957
 
1958 1958
 	/**
1959
-	* Gets waypoints info based on the coord
1960
-	*
1961
-	* @param Array $coord waypoints coord
1962
-	* @return Array airport information
1963
-	*
1964
-	*/
1959
+	 * Gets waypoints info based on the coord
1960
+	 *
1961
+	 * @param Array $coord waypoints coord
1962
+	 * @return Array airport information
1963
+	 *
1964
+	 */
1965 1965
 	public function getAllWaypointsInfobyCoord($coord)
1966 1966
 	{
1967 1967
 		if (is_array($coord)) {
@@ -1995,12 +1995,12 @@  discard block
 block discarded – undo
1995 1995
 	
1996 1996
 	
1997 1997
 	/**
1998
-	* Gets the airline info based on the icao code or iata code
1999
-	*
2000
-	* @param String $airline_icao the iata code of the airport
2001
-	* @return Array airport information
2002
-	*
2003
-	*/
1998
+	 * Gets the airline info based on the icao code or iata code
1999
+	 *
2000
+	 * @param String $airline_icao the iata code of the airport
2001
+	 * @return Array airport information
2002
+	 *
2003
+	 */
2004 2004
 	public function getAllAirlineInfo($airline_icao, $fromsource = NULL)
2005 2005
 	{
2006 2006
 		$airline_icao = strtoupper(filter_var($airline_icao,FILTER_SANITIZE_STRING));
@@ -2029,7 +2029,7 @@  discard block
 block discarded – undo
2029 2029
 			} else {
2030 2030
 				$sth->execute(array(':airline_icao' => $airline_icao,':fromsource' => $fromsource));
2031 2031
 			}
2032
-                        /*
2032
+						/*
2033 2033
 			$airline_array = array();
2034 2034
 			$temp_array = array();
2035 2035
 		
@@ -2052,12 +2052,12 @@  discard block
 block discarded – undo
2052 2052
 	
2053 2053
 	
2054 2054
 	/**
2055
-	* Gets the aircraft info based on the aircraft type
2056
-	*
2057
-	* @param String $aircraft_type the aircraft type
2058
-	* @return Array aircraft information
2059
-	*
2060
-	*/
2055
+	 * Gets the aircraft info based on the aircraft type
2056
+	 *
2057
+	 * @param String $aircraft_type the aircraft type
2058
+	 * @return Array aircraft information
2059
+	 *
2060
+	 */
2061 2061
 	public function getAllAircraftInfo($aircraft_type)
2062 2062
 	{
2063 2063
 		$aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING);
@@ -2089,12 +2089,12 @@  discard block
 block discarded – undo
2089 2089
 	}
2090 2090
 
2091 2091
 	/**
2092
-	* Gets the aircraft icao based on the aircraft name/type
2093
-	*
2094
-	* @param String $aircraft_type the aircraft type
2095
-	* @return String aircraft information
2096
-	*
2097
-	*/
2092
+	 * Gets the aircraft icao based on the aircraft name/type
2093
+	 *
2094
+	 * @param String $aircraft_type the aircraft type
2095
+	 * @return String aircraft information
2096
+	 *
2097
+	 */
2098 2098
 	public function getAircraftIcao($aircraft_type)
2099 2099
 	{
2100 2100
 		$aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING);
@@ -2119,12 +2119,12 @@  discard block
 block discarded – undo
2119 2119
 	}
2120 2120
 	
2121 2121
 	/**
2122
-	* Gets the aircraft info based on the aircraft ident
2123
-	*
2124
-	* @param String $aircraft_modes the aircraft ident (hex)
2125
-	* @return String aircraft type
2126
-	*
2127
-	*/
2122
+	 * Gets the aircraft info based on the aircraft ident
2123
+	 *
2124
+	 * @param String $aircraft_modes the aircraft ident (hex)
2125
+	 * @return String aircraft type
2126
+	 *
2127
+	 */
2128 2128
 	public function getAllAircraftType($aircraft_modes)
2129 2129
 	{
2130 2130
 		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
@@ -2141,12 +2141,12 @@  discard block
 block discarded – undo
2141 2141
 	}
2142 2142
 
2143 2143
 	/**
2144
-	* Gets correct aircraft operator corde
2145
-	*
2146
-	* @param String $operator the aircraft operator code (callsign)
2147
-	* @return String aircraft operator code
2148
-	*
2149
-	*/
2144
+	 * Gets correct aircraft operator corde
2145
+	 *
2146
+	 * @param String $operator the aircraft operator code (callsign)
2147
+	 * @return String aircraft operator code
2148
+	 *
2149
+	 */
2150 2150
 	public function getOperator($operator)
2151 2151
 	{
2152 2152
 		$operator = filter_var($operator,FILTER_SANITIZE_STRING);
@@ -2162,16 +2162,16 @@  discard block
 block discarded – undo
2162 2162
 	}
2163 2163
 
2164 2164
 	/**
2165
-	* Gets the aircraft route based on the aircraft callsign
2166
-	*
2167
-	* @param String $callsign the aircraft callsign
2168
-	* @return Array aircraft type
2169
-	*
2170
-	*/
2165
+	 * Gets the aircraft route based on the aircraft callsign
2166
+	 *
2167
+	 * @param String $callsign the aircraft callsign
2168
+	 * @return Array aircraft type
2169
+	 *
2170
+	 */
2171 2171
 	public function getRouteInfo($callsign)
2172 2172
 	{
2173 2173
 		$callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
2174
-                if ($callsign == '') return array();
2174
+				if ($callsign == '') return array();
2175 2175
 		$query  = "SELECT routes.Operator_ICAO, routes.FromAirport_ICAO, routes.ToAirport_ICAO, routes.RouteStop, routes.FromAirport_Time, routes.ToAirport_Time FROM routes WHERE CallSign = :callsign LIMIT 1";
2176 2176
 		
2177 2177
 		$sth = $this->db->prepare($query);
@@ -2184,12 +2184,12 @@  discard block
 block discarded – undo
2184 2184
 	}
2185 2185
 	
2186 2186
 	/**
2187
-	* Gets the aircraft info based on the aircraft registration
2188
-	*
2189
-	* @param String $registration the aircraft registration
2190
-	* @return Array aircraft information
2191
-	*
2192
-	*/
2187
+	 * Gets the aircraft info based on the aircraft registration
2188
+	 *
2189
+	 * @param String $registration the aircraft registration
2190
+	 * @return Array aircraft information
2191
+	 *
2192
+	 */
2193 2193
 	public function getAircraftInfoByRegistration($registration)
2194 2194
 	{
2195 2195
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -2216,12 +2216,12 @@  discard block
 block discarded – undo
2216 2216
 	}
2217 2217
 	
2218 2218
 	/**
2219
-	* Gets the aircraft owner & base based on the aircraft registration
2220
-	*
2221
-	* @param String $registration the aircraft registration
2222
-	* @return Array aircraft information
2223
-	*
2224
-	*/
2219
+	 * Gets the aircraft owner & base based on the aircraft registration
2220
+	 *
2221
+	 * @param String $registration the aircraft registration
2222
+	 * @return Array aircraft information
2223
+	 *
2224
+	 */
2225 2225
 	public function getAircraftOwnerByRegistration($registration)
2226 2226
 	{
2227 2227
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -2237,11 +2237,11 @@  discard block
 block discarded – undo
2237 2237
 	
2238 2238
   
2239 2239
   /**
2240
-	* Gets all flights (but with only little info)
2241
-	*
2242
-	* @return Array basic flight information
2243
-	*
2244
-	*/
2240
+   * Gets all flights (but with only little info)
2241
+   *
2242
+   * @return Array basic flight information
2243
+   *
2244
+   */
2245 2245
 	public function getAllFlightsforSitemap()
2246 2246
 	{
2247 2247
 		//$query  = "SELECT spotter_output.spotter_id, spotter_output.ident, spotter_output.airline_name, spotter_output.aircraft_name, spotter_output.aircraft_icao FROM spotter_output ORDER BY LIMIT ";
@@ -2249,7 +2249,7 @@  discard block
 block discarded – undo
2249 2249
 		
2250 2250
 		$sth = $this->db->prepare($query);
2251 2251
 		$sth->execute();
2252
-                  /*
2252
+				  /*
2253 2253
 		$flight_array = array();
2254 2254
 		$temp_array = array();
2255 2255
 		
@@ -2271,11 +2271,11 @@  discard block
 block discarded – undo
2271 2271
 	}
2272 2272
   
2273 2273
 	/**
2274
-	* Gets a list of all aircraft manufacturers
2275
-	*
2276
-	* @return Array list of aircraft types
2277
-	*
2278
-	*/
2274
+	 * Gets a list of all aircraft manufacturers
2275
+	 *
2276
+	 * @return Array list of aircraft types
2277
+	 *
2278
+	 */
2279 2279
 	public function getAllManufacturers()
2280 2280
 	{
2281 2281
 		/*
@@ -2304,11 +2304,11 @@  discard block
 block discarded – undo
2304 2304
   
2305 2305
   
2306 2306
   /**
2307
-	* Gets a list of all aircraft types
2308
-	*
2309
-	* @return Array list of aircraft types
2310
-	*
2311
-	*/
2307
+   * Gets a list of all aircraft types
2308
+   *
2309
+   * @return Array list of aircraft types
2310
+   *
2311
+   */
2312 2312
 	public function getAllAircraftTypes()
2313 2313
 	{
2314 2314
 		/*
@@ -2340,11 +2340,11 @@  discard block
 block discarded – undo
2340 2340
 	
2341 2341
 	
2342 2342
 	/**
2343
-	* Gets a list of all aircraft registrations
2344
-	*
2345
-	* @return Array list of aircraft registrations
2346
-	*
2347
-	*/
2343
+	 * Gets a list of all aircraft registrations
2344
+	 *
2345
+	 * @return Array list of aircraft registrations
2346
+	 *
2347
+	 */
2348 2348
 	public function getAllAircraftRegistrations()
2349 2349
 	{
2350 2350
 		$query  = "SELECT DISTINCT spotter_output.registration 
@@ -2369,12 +2369,12 @@  discard block
 block discarded – undo
2369 2369
 	}
2370 2370
 
2371 2371
 	/**
2372
-	* Gets all source name
2373
-	*
2374
-	* @param String type format of source
2375
-	* @return Array list of source name
2376
-	*
2377
-	*/
2372
+	 * Gets all source name
2373
+	 *
2374
+	 * @param String type format of source
2375
+	 * @return Array list of source name
2376
+	 *
2377
+	 */
2378 2378
 	public function getAllSourceName($type = '')
2379 2379
 	{
2380 2380
 		$query_values = array();
@@ -2405,11 +2405,11 @@  discard block
 block discarded – undo
2405 2405
 
2406 2406
 
2407 2407
 	/**
2408
-	* Gets a list of all airline names
2409
-	*
2410
-	* @return Array list of airline names
2411
-	*
2412
-	*/
2408
+	 * Gets a list of all airline names
2409
+	 *
2410
+	 * @return Array list of airline names
2411
+	 *
2412
+	 */
2413 2413
 	public function getAllAirlineNames($airline_type = '')
2414 2414
 	{
2415 2415
 		$airline_type = filter_var($airline_type,FILTER_SANITIZE_STRING);
@@ -2452,11 +2452,11 @@  discard block
 block discarded – undo
2452 2452
 	
2453 2453
 	
2454 2454
 	/**
2455
-	* Gets a list of all airline countries
2456
-	*
2457
-	* @return Array list of airline countries
2458
-	*
2459
-	*/
2455
+	 * Gets a list of all airline countries
2456
+	 *
2457
+	 * @return Array list of airline countries
2458
+	 *
2459
+	 */
2460 2460
 	public function getAllAirlineCountries()
2461 2461
 	{
2462 2462
 		
@@ -2485,11 +2485,11 @@  discard block
 block discarded – undo
2485 2485
 	
2486 2486
 	
2487 2487
 	/**
2488
-	* Gets a list of all departure & arrival names
2489
-	*
2490
-	* @return Array list of airport names
2491
-	*
2492
-	*/
2488
+	 * Gets a list of all departure & arrival names
2489
+	 *
2490
+	 * @return Array list of airport names
2491
+	 *
2492
+	 */
2493 2493
 	public function getAllAirportNames()
2494 2494
 	{
2495 2495
 		$airport_array = array();
@@ -2540,11 +2540,11 @@  discard block
 block discarded – undo
2540 2540
 	
2541 2541
 	
2542 2542
 	/**
2543
-	* Gets a list of all departure & arrival airport countries
2544
-	*
2545
-	* @return Array list of airport countries
2546
-	*
2547
-	*/
2543
+	 * Gets a list of all departure & arrival airport countries
2544
+	 *
2545
+	 * @return Array list of airport countries
2546
+	 *
2547
+	 */
2548 2548
 	public function getAllAirportCountries()
2549 2549
 	{
2550 2550
 		$airport_array = array();
@@ -2593,11 +2593,11 @@  discard block
 block discarded – undo
2593 2593
 	
2594 2594
 	
2595 2595
 	/**
2596
-	* Gets a list of all countries (airline, departure airport & arrival airport)
2597
-	*
2598
-	* @return Array list of countries
2599
-	*
2600
-	*/
2596
+	 * Gets a list of all countries (airline, departure airport & arrival airport)
2597
+	 *
2598
+	 * @return Array list of countries
2599
+	 *
2600
+	 */
2601 2601
 	public function getAllCountries()
2602 2602
 	{
2603 2603
 		$Connection= new Connection($this->db);
@@ -2676,11 +2676,11 @@  discard block
 block discarded – undo
2676 2676
 	
2677 2677
 	
2678 2678
 	/**
2679
-	* Gets a list of all idents/callsigns
2680
-	*
2681
-	* @return Array list of ident/callsign names
2682
-	*
2683
-	*/
2679
+	 * Gets a list of all idents/callsigns
2680
+	 *
2681
+	 * @return Array list of ident/callsign names
2682
+	 *
2683
+	 */
2684 2684
 	public function getAllIdents()
2685 2685
 	{
2686 2686
 		$query  = "SELECT DISTINCT spotter_output.ident
@@ -2704,9 +2704,9 @@  discard block
 block discarded – undo
2704 2704
 	}
2705 2705
 
2706 2706
 	/**
2707
-	* Get a list of flights from airport since 7 days
2708
-	* @return Array number, icao, name and city of airports
2709
-	*/
2707
+	 * Get a list of flights from airport since 7 days
2708
+	 * @return Array number, icao, name and city of airports
2709
+	 */
2710 2710
 
2711 2711
 	public function getLast7DaysAirportsDeparture($airport_icao = '') {
2712 2712
 		global $globalTimezone, $globalDBdriver;
@@ -2736,9 +2736,9 @@  discard block
 block discarded – undo
2736 2736
 	}
2737 2737
 
2738 2738
 	/**
2739
-	* Get a list of flights from airport since 7 days
2740
-	* @return Array number, icao, name and city of airports
2741
-	*/
2739
+	 * Get a list of flights from airport since 7 days
2740
+	 * @return Array number, icao, name and city of airports
2741
+	 */
2742 2742
 
2743 2743
 	public function getLast7DaysAirportsDepartureByAirlines($airport_icao = '') {
2744 2744
 		global $globalTimezone, $globalDBdriver;
@@ -2768,9 +2768,9 @@  discard block
 block discarded – undo
2768 2768
 	}
2769 2769
 
2770 2770
 	/**
2771
-	* Get a list of flights from detected airport since 7 days
2772
-	* @return Array number, icao, name and city of airports
2773
-	*/
2771
+	 * Get a list of flights from detected airport since 7 days
2772
+	 * @return Array number, icao, name and city of airports
2773
+	 */
2774 2774
 
2775 2775
 	public function getLast7DaysDetectedAirportsDeparture($airport_icao = '') {
2776 2776
 		global $globalTimezone, $globalDBdriver;
@@ -2811,9 +2811,9 @@  discard block
 block discarded – undo
2811 2811
 	}
2812 2812
 
2813 2813
 	/**
2814
-	* Get a list of flights from detected airport since 7 days
2815
-	* @return Array number, icao, name and city of airports
2816
-	*/
2814
+	 * Get a list of flights from detected airport since 7 days
2815
+	 * @return Array number, icao, name and city of airports
2816
+	 */
2817 2817
 
2818 2818
 	public function getLast7DaysDetectedAirportsDepartureByAirlines($airport_icao = '') {
2819 2819
 		global $globalTimezone, $globalDBdriver;
@@ -2855,9 +2855,9 @@  discard block
 block discarded – undo
2855 2855
 
2856 2856
 
2857 2857
 	/**
2858
-	* Get a list of flights to airport since 7 days
2859
-	* @return Array number, icao, name and city of airports
2860
-	*/
2858
+	 * Get a list of flights to airport since 7 days
2859
+	 * @return Array number, icao, name and city of airports
2860
+	 */
2861 2861
 
2862 2862
 	public function getLast7DaysAirportsArrival($airport_icao = '') {
2863 2863
 		global $globalTimezone, $globalDBdriver;
@@ -2889,9 +2889,9 @@  discard block
 block discarded – undo
2889 2889
 
2890 2890
 
2891 2891
 	/**
2892
-	* Get a list of flights detected to airport since 7 days
2893
-	* @return Array number, icao, name and city of airports
2894
-	*/
2892
+	 * Get a list of flights detected to airport since 7 days
2893
+	 * @return Array number, icao, name and city of airports
2894
+	 */
2895 2895
 
2896 2896
 	public function getLast7DaysDetectedAirportsArrival($airport_icao = '') {
2897 2897
 		global $globalTimezone, $globalDBdriver;
@@ -2935,9 +2935,9 @@  discard block
 block discarded – undo
2935 2935
 
2936 2936
 
2937 2937
 	/**
2938
-	* Get a list of flights to airport since 7 days
2939
-	* @return Array number, icao, name and city of airports
2940
-	*/
2938
+	 * Get a list of flights to airport since 7 days
2939
+	 * @return Array number, icao, name and city of airports
2940
+	 */
2941 2941
 
2942 2942
 	public function getLast7DaysAirportsArrivalByAirlines($airport_icao = '') {
2943 2943
 		global $globalTimezone, $globalDBdriver;
@@ -2969,9 +2969,9 @@  discard block
 block discarded – undo
2969 2969
 
2970 2970
 
2971 2971
 	/**
2972
-	* Get a list of flights detected to airport since 7 days
2973
-	* @return Array number, icao, name and city of airports
2974
-	*/
2972
+	 * Get a list of flights detected to airport since 7 days
2973
+	 * @return Array number, icao, name and city of airports
2974
+	 */
2975 2975
 
2976 2976
 	public function getLast7DaysDetectedAirportsArrivalByAirlines($airport_icao = '') {
2977 2977
 		global $globalTimezone, $globalDBdriver;
@@ -3015,11 +3015,11 @@  discard block
 block discarded – undo
3015 3015
 
3016 3016
 
3017 3017
 	/**
3018
-	* Gets a list of all dates
3019
-	*
3020
-	* @return Array list of date names
3021
-	*
3022
-	*/
3018
+	 * Gets a list of all dates
3019
+	 *
3020
+	 * @return Array list of date names
3021
+	 *
3022
+	 */
3023 3023
 	public function getAllDates()
3024 3024
 	{
3025 3025
 		global $globalTimezone, $globalDBdriver;
@@ -3060,11 +3060,11 @@  discard block
 block discarded – undo
3060 3060
 	
3061 3061
 	
3062 3062
 	/**
3063
-	* Gets all route combinations
3064
-	*
3065
-	* @return Array the route list
3066
-	*
3067
-	*/
3063
+	 * Gets all route combinations
3064
+	 *
3065
+	 * @return Array the route list
3066
+	 *
3067
+	 */
3068 3068
 	public function getAllRoutes()
3069 3069
 	{
3070 3070
 		$query  = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route,  spotter_output.departure_airport_icao, spotter_output.arrival_airport_icao 
@@ -3090,13 +3090,13 @@  discard block
 block discarded – undo
3090 3090
 	}
3091 3091
 
3092 3092
 	/**
3093
-	* Update ident spotter data
3094
-	*
3095
-	* @param String $flightaware_id the ID from flightaware
3096
-	* @param String $ident the flight ident
3097
-	* @return String success or false
3098
-	*
3099
-	*/	
3093
+	 * Update ident spotter data
3094
+	 *
3095
+	 * @param String $flightaware_id the ID from flightaware
3096
+	 * @param String $ident the flight ident
3097
+	 * @return String success or false
3098
+	 *
3099
+	 */	
3100 3100
 	public function updateIdentSpotterData($flightaware_id = '', $ident = '',$fromsource = NULL)
3101 3101
 	{
3102 3102
 		if (!is_numeric(substr($ident, 0, 3)))
@@ -3117,14 +3117,14 @@  discard block
 block discarded – undo
3117 3117
 		} else {
3118 3118
 			$airline_array = $this->getAllAirlineInfo("NA");
3119 3119
 		}
3120
-                $airline_name = $airline_array[0]['name'];
3121
-                $airline_icao = $airline_array[0]['icao'];
3122
-                $airline_country = $airline_array[0]['country'];
3123
-                $airline_type = $airline_array[0]['type'];
3120
+				$airline_name = $airline_array[0]['name'];
3121
+				$airline_icao = $airline_array[0]['icao'];
3122
+				$airline_country = $airline_array[0]['country'];
3123
+				$airline_type = $airline_array[0]['type'];
3124 3124
 
3125 3125
 
3126 3126
 		$query = 'UPDATE spotter_output SET ident = :ident, airline_name = :airline_name, airline_icao = :airline_icao, airline_country = :airline_country, airline_type = :airline_type WHERE flightaware_id = :flightaware_id';
3127
-                $query_values = array(':flightaware_id' => $flightaware_id,':ident' => $ident,':airline_name' => $airline_name,':airline_icao' => $airline_icao,':airline_country' => $airline_country,':airline_type' => $airline_type);
3127
+				$query_values = array(':flightaware_id' => $flightaware_id,':ident' => $ident,':airline_name' => $airline_name,':airline_icao' => $airline_icao,':airline_country' => $airline_country,':airline_type' => $airline_type);
3128 3128
 
3129 3129
 		try {
3130 3130
 			$sth = $this->db->prepare($query);
@@ -3137,19 +3137,19 @@  discard block
 block discarded – undo
3137 3137
 
3138 3138
 	}
3139 3139
 	/**
3140
-	* Update latest spotter data
3141
-	*
3142
-	* @param String $flightaware_id the ID from flightaware
3143
-	* @param String $ident the flight ident
3144
-	* @param String $arrival_airport_icao the arrival airport
3145
-	* @return String success or false
3146
-	*
3147
-	*/	
3140
+	 * Update latest spotter data
3141
+	 *
3142
+	 * @param String $flightaware_id the ID from flightaware
3143
+	 * @param String $ident the flight ident
3144
+	 * @param String $arrival_airport_icao the arrival airport
3145
+	 * @return String success or false
3146
+	 *
3147
+	 */	
3148 3148
 	public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '',$arrival_airport_time = '')
3149 3149
 	{
3150 3150
 		if ($groundspeed == '') $groundspeed = NULL;
3151 3151
 		$query = 'UPDATE spotter_output SET ident = :ident, last_latitude = :last_latitude, last_longitude = :last_longitude, last_altitude = :last_altitude, last_ground = :last_ground, last_seen = :last_seen, real_arrival_airport_icao = :real_arrival_airport_icao, real_arrival_airport_time = :real_arrival_airport_time, last_ground_speed = :last_ground_speed WHERE flightaware_id = :flightaware_id';
3152
-                $query_values = array(':flightaware_id' => $flightaware_id,':real_arrival_airport_icao' => $arrival_airport_icao,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_altitude' => $altitude,':last_ground_speed' => $groundspeed,':last_seen' => $date,':real_arrival_airport_time' => $arrival_airport_time, ':last_ground' => $ground, ':ident' => $ident);
3152
+				$query_values = array(':flightaware_id' => $flightaware_id,':real_arrival_airport_icao' => $arrival_airport_icao,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_altitude' => $altitude,':last_ground_speed' => $groundspeed,':last_seen' => $date,':real_arrival_airport_time' => $arrival_airport_time, ':last_ground' => $ground, ':ident' => $ident);
3153 3153
 
3154 3154
 		try {
3155 3155
 			$sth = $this->db->prepare($query);
@@ -3163,32 +3163,32 @@  discard block
 block discarded – undo
3163 3163
 	}
3164 3164
 
3165 3165
 	/**
3166
-	* Adds a new spotter data
3167
-	*
3168
-	* @param String $flightaware_id the ID from flightaware
3169
-	* @param String $ident the flight ident
3170
-	* @param String $aircraft_icao the aircraft type
3171
-	* @param String $departure_airport_icao the departure airport
3172
-	* @param String $arrival_airport_icao the arrival airport
3173
-	* @param String $latitude latitude of flight
3174
-	* @param String $longitude latitude of flight
3175
-	* @param String $waypoints waypoints of flight
3176
-	* @param String $altitude altitude of flight
3177
-	* @param String $heading heading of flight
3178
-	* @param String $groundspeed speed of flight
3179
-	* @param String $date date of flight
3180
-	* @param String $departure_airport_time departure time of flight
3181
-	* @param String $arrival_airport_time arrival time of flight
3182
-	* @param String $squawk squawk code of flight
3183
-	* @param String $route_stop route stop of flight
3184
-	* @param String $highlight highlight or not
3185
-	* @param String $ModeS ModesS code of flight
3186
-	* @param String $registration registration code of flight
3187
-	* @param String $pilot_id pilot id of flight (for virtual airlines)
3188
-	* @param String $pilot_name pilot name of flight (for virtual airlines)
3189
-	* @param String $verticalrate vertival rate of flight
3190
-	* @return String success or false
3191
-	*/
3166
+	 * Adds a new spotter data
3167
+	 *
3168
+	 * @param String $flightaware_id the ID from flightaware
3169
+	 * @param String $ident the flight ident
3170
+	 * @param String $aircraft_icao the aircraft type
3171
+	 * @param String $departure_airport_icao the departure airport
3172
+	 * @param String $arrival_airport_icao the arrival airport
3173
+	 * @param String $latitude latitude of flight
3174
+	 * @param String $longitude latitude of flight
3175
+	 * @param String $waypoints waypoints of flight
3176
+	 * @param String $altitude altitude of flight
3177
+	 * @param String $heading heading of flight
3178
+	 * @param String $groundspeed speed of flight
3179
+	 * @param String $date date of flight
3180
+	 * @param String $departure_airport_time departure time of flight
3181
+	 * @param String $arrival_airport_time arrival time of flight
3182
+	 * @param String $squawk squawk code of flight
3183
+	 * @param String $route_stop route stop of flight
3184
+	 * @param String $highlight highlight or not
3185
+	 * @param String $ModeS ModesS code of flight
3186
+	 * @param String $registration registration code of flight
3187
+	 * @param String $pilot_id pilot id of flight (for virtual airlines)
3188
+	 * @param String $pilot_name pilot name of flight (for virtual airlines)
3189
+	 * @param String $verticalrate vertival rate of flight
3190
+	 * @return String success or false
3191
+	 */
3192 3192
 	public function addSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $departure_airport_time = '', $arrival_airport_time = '',$squawk = '', $route_stop = '', $highlight = '', $ModeS = '', $registration = '',$pilot_id = '', $pilot_name = '', $verticalrate = '', $ground = false,$format_source = '', $source_name = '')
3193 3193
 	{
3194 3194
 		global $globalURL, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalDebugTimeElapsed;
@@ -3400,8 +3400,8 @@  discard block
 block discarded – undo
3400 3400
     
3401 3401
 		if ($globalIVAO && $aircraft_icao != '')
3402 3402
 		{
3403
-            		if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao'];
3404
-            		else $airline_icao = '';
3403
+					if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao'];
3404
+					else $airline_icao = '';
3405 3405
 			$image_array = $Image->getSpotterImage('',$aircraft_icao,$airline_icao);
3406 3406
 			if (!isset($image_array[0]['registration']))
3407 3407
 			{
@@ -3432,48 +3432,48 @@  discard block
 block discarded – undo
3432 3432
 	
3433 3433
 		if (count($airline_array) == 0) 
3434 3434
 		{
3435
-                        $airline_array = $this->getAllAirlineInfo('NA');
3436
-                }
3437
-                if (count($aircraft_array) == 0) 
3438
-                {
3439
-                        $aircraft_array = $this->getAllAircraftInfo('NA');
3440
-                }
3441
-                if (count($departure_airport_array) == 0) 
3442
-                {
3443
-                        $departure_airport_array = $this->getAllAirportInfo('NA');
3444
-                }
3445
-                if (count($arrival_airport_array) == 0) 
3446
-                {
3447
-                        $arrival_airport_array = $this->getAllAirportInfo('NA');
3448
-                }
3449
-                if ($registration == '') $registration = 'NA';
3450
-                if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL;
3451
-                if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL;
3452
-                if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
3453
-                if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
3454
-                if (!isset($aircraft_owner)) $aircraft_owner = NULL;
3455
-                $query  = "INSERT INTO spotter_output (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, latitude, longitude, waypoints, altitude, heading, ground_speed, date, departure_airport_time, arrival_airport_time, squawk, route_stop,highlight,ModeS, pilot_id, pilot_name, verticalrate, owner_name, ground, format_source, source_name) 
3435
+						$airline_array = $this->getAllAirlineInfo('NA');
3436
+				}
3437
+				if (count($aircraft_array) == 0) 
3438
+				{
3439
+						$aircraft_array = $this->getAllAircraftInfo('NA');
3440
+				}
3441
+				if (count($departure_airport_array) == 0) 
3442
+				{
3443
+						$departure_airport_array = $this->getAllAirportInfo('NA');
3444
+				}
3445
+				if (count($arrival_airport_array) == 0) 
3446
+				{
3447
+						$arrival_airport_array = $this->getAllAirportInfo('NA');
3448
+				}
3449
+				if ($registration == '') $registration = 'NA';
3450
+				if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL;
3451
+				if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL;
3452
+				if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
3453
+				if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
3454
+				if (!isset($aircraft_owner)) $aircraft_owner = NULL;
3455
+				$query  = "INSERT INTO spotter_output (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, latitude, longitude, waypoints, altitude, heading, ground_speed, date, departure_airport_time, arrival_airport_time, squawk, route_stop,highlight,ModeS, pilot_id, pilot_name, verticalrate, owner_name, ground, format_source, source_name) 
3456 3456
                 VALUES (:flightaware_id,:ident,:registration,:airline_name,:airline_icao,:airline_country,:airline_type,:aircraft_icao,:aircraft_type,:aircraft_manufacturer,:departure_airport_icao,:departure_airport_name,:departure_airport_city,:departure_airport_country, :arrival_airport_icao, :arrival_airport_name, :arrival_airport_city, :arrival_airport_country, :latitude,:longitude,:waypoints,:altitude,:heading,:groundspeed,:date, :departure_airport_time, :arrival_airport_time, :squawk, :route_stop, :highlight, :ModeS, :pilot_id, :pilot_name, :verticalrate, :owner_name,:ground, :format_source, :source_name)";
3457 3457
 
3458
-                $airline_name = $airline_array[0]['name'];
3459
-                $airline_icao = $airline_array[0]['icao'];
3460
-                $airline_country = $airline_array[0]['country'];
3461
-                $airline_type = $airline_array[0]['type'];
3458
+				$airline_name = $airline_array[0]['name'];
3459
+				$airline_icao = $airline_array[0]['icao'];
3460
+				$airline_country = $airline_array[0]['country'];
3461
+				$airline_type = $airline_array[0]['type'];
3462 3462
 		if ($airline_type == '') {
3463 3463
 			$timeelapsed = microtime(true);
3464 3464
 			$airline_type = $this->getAircraftTypeBymodeS($ModeS);
3465 3465
 			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3466 3466
 		}
3467 3467
 		if ($airline_type == null) $airline_type = '';
3468
-                $aircraft_type = $aircraft_array[0]['type'];
3469
-                $aircraft_manufacturer = $aircraft_array[0]['manufacturer'];
3470
-                $departure_airport_name = $departure_airport_array[0]['name'];
3471
-                $departure_airport_city = $departure_airport_array[0]['city'];
3472
-                $departure_airport_country = $departure_airport_array[0]['country'];
3473
-                $arrival_airport_name = $arrival_airport_array[0]['name'];
3474
-                $arrival_airport_city = $arrival_airport_array[0]['city'];
3475
-                $arrival_airport_country = $arrival_airport_array[0]['country'];
3476
-                $query_values = array(':flightaware_id' => $flightaware_id,':ident' => $ident, ':registration' => $registration,':airline_name' => $airline_name,':airline_icao' => $airline_icao,':airline_country' => $airline_country,':airline_type' => $airline_type,':aircraft_icao' => $aircraft_icao,':aircraft_type' => $aircraft_type,':aircraft_manufacturer' => $aircraft_manufacturer,':departure_airport_icao' => $departure_airport_icao,':departure_airport_name' => $departure_airport_name,':departure_airport_city' => $departure_airport_city,':departure_airport_country' => $departure_airport_country,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_name' => $arrival_airport_name,':arrival_airport_city' => $arrival_airport_city,':arrival_airport_country' => $arrival_airport_country,':latitude' => $latitude,':longitude' => $longitude, ':waypoints' => $waypoints,':altitude' => $altitude,':heading' => $heading,':groundspeed' => $groundspeed,':date' => $date,':departure_airport_time' => $departure_airport_time,':arrival_airport_time' => $arrival_airport_time, ':squawk' => $squawk, ':route_stop' => $route_stop, ':highlight' => $highlight, ':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':owner_name' => $aircraft_owner, ':format_source' => $format_source, ':ground' => $ground, ':source_name' => $source_name);
3468
+				$aircraft_type = $aircraft_array[0]['type'];
3469
+				$aircraft_manufacturer = $aircraft_array[0]['manufacturer'];
3470
+				$departure_airport_name = $departure_airport_array[0]['name'];
3471
+				$departure_airport_city = $departure_airport_array[0]['city'];
3472
+				$departure_airport_country = $departure_airport_array[0]['country'];
3473
+				$arrival_airport_name = $arrival_airport_array[0]['name'];
3474
+				$arrival_airport_city = $arrival_airport_array[0]['city'];
3475
+				$arrival_airport_country = $arrival_airport_array[0]['country'];
3476
+				$query_values = array(':flightaware_id' => $flightaware_id,':ident' => $ident, ':registration' => $registration,':airline_name' => $airline_name,':airline_icao' => $airline_icao,':airline_country' => $airline_country,':airline_type' => $airline_type,':aircraft_icao' => $aircraft_icao,':aircraft_type' => $aircraft_type,':aircraft_manufacturer' => $aircraft_manufacturer,':departure_airport_icao' => $departure_airport_icao,':departure_airport_name' => $departure_airport_name,':departure_airport_city' => $departure_airport_city,':departure_airport_country' => $departure_airport_country,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_name' => $arrival_airport_name,':arrival_airport_city' => $arrival_airport_city,':arrival_airport_country' => $arrival_airport_country,':latitude' => $latitude,':longitude' => $longitude, ':waypoints' => $waypoints,':altitude' => $altitude,':heading' => $heading,':groundspeed' => $groundspeed,':date' => $date,':departure_airport_time' => $departure_airport_time,':arrival_airport_time' => $arrival_airport_time, ':squawk' => $squawk, ':route_stop' => $route_stop, ':highlight' => $highlight, ':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':owner_name' => $aircraft_owner, ':format_source' => $format_source, ':ground' => $ground, ':source_name' => $source_name);
3477 3477
 
3478 3478
 		try {
3479 3479
 		        
@@ -3481,7 +3481,7 @@  discard block
 block discarded – undo
3481 3481
 			$sth->execute($query_values);
3482 3482
 			$this->db = null;
3483 3483
 		} catch (PDOException $e) {
3484
-		    return "error : ".$e->getMessage();
3484
+			return "error : ".$e->getMessage();
3485 3485
 		}
3486 3486
 		
3487 3487
 		return "success";
@@ -3490,11 +3490,11 @@  discard block
 block discarded – undo
3490 3490
 	
3491 3491
   
3492 3492
 	/**
3493
-	* Gets the aircraft ident within the last hour
3494
-	*
3495
-	* @return String the ident
3496
-	*
3497
-	*/
3493
+	 * Gets the aircraft ident within the last hour
3494
+	 *
3495
+	 * @return String the ident
3496
+	 *
3497
+	 */
3498 3498
 	public function getIdentFromLastHour($ident)
3499 3499
 	{
3500 3500
 		global $globalDBdriver, $globalTimezone;
@@ -3510,11 +3510,11 @@  discard block
 block discarded – undo
3510 3510
 								AND spotter_output.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS'
3511 3511
 								AND spotter_output.date < now() AT TIME ZONE 'UTC'";
3512 3512
 			$query_data = array(':ident' => $ident);
3513
-    		}
3513
+			}
3514 3514
 		
3515 3515
 		$sth = $this->db->prepare($query);
3516 3516
 		$sth->execute($query_data);
3517
-    		$ident_result='';
3517
+			$ident_result='';
3518 3518
 		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3519 3519
 		{
3520 3520
 			$ident_result = $row['ident'];
@@ -3525,11 +3525,11 @@  discard block
 block discarded – undo
3525 3525
 	
3526 3526
 	
3527 3527
 	/**
3528
-	* Gets the aircraft data from the last 20 seconds
3529
-	*
3530
-	* @return Array the spotter data
3531
-	*
3532
-	*/
3528
+	 * Gets the aircraft data from the last 20 seconds
3529
+	 *
3530
+	 * @return Array the spotter data
3531
+	 *
3532
+	 */
3533 3533
 	public function getRealTimeData($q = '')
3534 3534
 	{
3535 3535
 		global $globalDBdriver;
@@ -3573,11 +3573,11 @@  discard block
 block discarded – undo
3573 3573
 	
3574 3574
 	
3575 3575
 	 /**
3576
-	* Gets all airlines that have flown over
3577
-	*
3578
-	* @return Array the airline list
3579
-	*
3580
-	*/
3576
+	  * Gets all airlines that have flown over
3577
+	  *
3578
+	  * @return Array the airline list
3579
+	  *
3580
+	  */
3581 3581
 	public function countAllAirlines($limit = true, $olderthanmonths = 0, $sincedate = '')
3582 3582
 	{
3583 3583
 		global $globalDBdriver;
@@ -3591,7 +3591,7 @@  discard block
 block discarded – undo
3591 3591
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
3592 3592
 			}
3593 3593
 		}
3594
-                if ($sincedate != '') {
3594
+				if ($sincedate != '') {
3595 3595
 			if ($globalDBdriver == 'mysql') {
3596 3596
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
3597 3597
 			} else {
@@ -3618,26 +3618,26 @@  discard block
 block discarded – undo
3618 3618
 	}
3619 3619
 
3620 3620
 	 /**
3621
-	* Gets all pilots that have flown over
3622
-	*
3623
-	* @return Array the pilots list
3624
-	*
3625
-	*/
3621
+	  * Gets all pilots that have flown over
3622
+	  *
3623
+	  * @return Array the pilots list
3624
+	  *
3625
+	  */
3626 3626
 	public function countAllPilots($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
3627 3627
 	{
3628 3628
 		global $globalDBdriver;
3629 3629
 		$filter_query = $this->getFilter($filters,true,true);
3630 3630
 		$query  = "SELECT DISTINCT spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count
3631 3631
 		 			FROM spotter_output".$filter_query." spotter_output.pilot_id <> '' ";
3632
-                if ($olderthanmonths > 0) {
3633
-            		if ($globalDBdriver == 'mysql') {
3632
+				if ($olderthanmonths > 0) {
3633
+					if ($globalDBdriver == 'mysql') {
3634 3634
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
3635 3635
 			} else {
3636 3636
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
3637 3637
 			}
3638 3638
 		}
3639
-                if ($sincedate != '') {
3640
-            		if ($globalDBdriver == 'mysql') {
3639
+				if ($sincedate != '') {
3640
+					if ($globalDBdriver == 'mysql') {
3641 3641
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
3642 3642
 			} else {
3643 3643
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -3664,25 +3664,25 @@  discard block
 block discarded – undo
3664 3664
 	}
3665 3665
 	
3666 3666
 		 /**
3667
-	* Gets all pilots that have flown over
3668
-	*
3669
-	* @return Array the pilots list
3670
-	*
3671
-	*/
3667
+		  * Gets all pilots that have flown over
3668
+		  *
3669
+		  * @return Array the pilots list
3670
+		  *
3671
+		  */
3672 3672
 	public function countAllPilotsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '')
3673 3673
 	{
3674 3674
 		global $globalDBdriver;
3675 3675
 		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count
3676 3676
 		 			FROM spotter_output WHERE spotter_output.pilot_id <> '' ";
3677
-                if ($olderthanmonths > 0) {
3678
-            		if ($globalDBdriver == 'mysql') {
3677
+				if ($olderthanmonths > 0) {
3678
+					if ($globalDBdriver == 'mysql') {
3679 3679
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
3680 3680
 			} else {
3681 3681
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
3682 3682
 			}
3683 3683
 		}
3684
-                if ($sincedate != '') {
3685
-            		if ($globalDBdriver == 'mysql') {
3684
+				if ($sincedate != '') {
3685
+					if ($globalDBdriver == 'mysql') {
3686 3686
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
3687 3687
 			} else {
3688 3688
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -3710,26 +3710,26 @@  discard block
 block discarded – undo
3710 3710
 	}
3711 3711
 	
3712 3712
 	 /**
3713
-	* Gets all owner that have flown over
3714
-	*
3715
-	* @return Array the pilots list
3716
-	*
3717
-	*/
3713
+	  * Gets all owner that have flown over
3714
+	  *
3715
+	  * @return Array the pilots list
3716
+	  *
3717
+	  */
3718 3718
 	public function countAllOwners($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
3719 3719
 	{
3720 3720
 		global $globalDBdriver;
3721 3721
 		$filter_query = $this->getFilter($filters,true,true);
3722 3722
 		$query  = "SELECT DISTINCT spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
3723 3723
 		 			FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL ";
3724
-                if ($olderthanmonths > 0) {
3725
-            		if ($globalDBdriver == 'mysql') {
3724
+				if ($olderthanmonths > 0) {
3725
+					if ($globalDBdriver == 'mysql') {
3726 3726
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
3727 3727
 			} else {
3728 3728
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
3729 3729
 			}
3730 3730
 		}
3731
-                if ($sincedate != '') {
3732
-            		if ($globalDBdriver == 'mysql') {
3731
+				if ($sincedate != '') {
3732
+					if ($globalDBdriver == 'mysql') {
3733 3733
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
3734 3734
 			} else {
3735 3735
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -3755,25 +3755,25 @@  discard block
 block discarded – undo
3755 3755
 	}
3756 3756
 	
3757 3757
 	 /**
3758
-	* Gets all owner that have flown over
3759
-	*
3760
-	* @return Array the pilots list
3761
-	*
3762
-	*/
3758
+	  * Gets all owner that have flown over
3759
+	  *
3760
+	  * @return Array the pilots list
3761
+	  *
3762
+	  */
3763 3763
 	public function countAllOwnersByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '')
3764 3764
 	{
3765 3765
 		global $globalDBdriver;
3766 3766
 		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
3767 3767
 		 			FROM spotter_output WHERE spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL ";
3768
-                if ($olderthanmonths > 0) {
3769
-            		if ($globalDBdriver == 'mysql') {
3768
+				if ($olderthanmonths > 0) {
3769
+					if ($globalDBdriver == 'mysql') {
3770 3770
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
3771 3771
 			} else {
3772 3772
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
3773 3773
 			}
3774 3774
 		}
3775
-                if ($sincedate != '') {
3776
-            		if ($globalDBdriver == 'mysql') {
3775
+				if ($sincedate != '') {
3776
+					if ($globalDBdriver == 'mysql') {
3777 3777
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
3778 3778
 			} else {
3779 3779
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -3800,11 +3800,11 @@  discard block
 block discarded – undo
3800 3800
 	}
3801 3801
 
3802 3802
 	/**
3803
-	* Gets all airlines that have flown over by aircraft
3804
-	*
3805
-	* @return Array the airline list
3806
-	*
3807
-	*/
3803
+	 * Gets all airlines that have flown over by aircraft
3804
+	 *
3805
+	 * @return Array the airline list
3806
+	 *
3807
+	 */
3808 3808
 	public function countAllAirlinesByAircraft($aircraft_icao)
3809 3809
 	{
3810 3810
 		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
@@ -3837,11 +3837,11 @@  discard block
 block discarded – undo
3837 3837
 
3838 3838
 
3839 3839
 	/**
3840
-	* Gets all airline countries that have flown over by aircraft
3841
-	*
3842
-	* @return Array the airline country list
3843
-	*
3844
-	*/
3840
+	 * Gets all airline countries that have flown over by aircraft
3841
+	 *
3842
+	 * @return Array the airline country list
3843
+	 *
3844
+	 */
3845 3845
 	public function countAllAirlineCountriesByAircraft($aircraft_icao)
3846 3846
 	{
3847 3847
 		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
@@ -3874,11 +3874,11 @@  discard block
 block discarded – undo
3874 3874
 	
3875 3875
 	
3876 3876
 	/**
3877
-	* Gets all airlines that have flown over by airport
3878
-	*
3879
-	* @return Array the airline list
3880
-	*
3881
-	*/
3877
+	 * Gets all airlines that have flown over by airport
3878
+	 *
3879
+	 * @return Array the airline list
3880
+	 *
3881
+	 */
3882 3882
 	public function countAllAirlinesByAirport($airport_icao)
3883 3883
 	{
3884 3884
 		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
@@ -3910,11 +3910,11 @@  discard block
 block discarded – undo
3910 3910
 
3911 3911
 
3912 3912
 	/**
3913
-	* Gets all airline countries that have flown over by airport icao
3914
-	*
3915
-	* @return Array the airline country list
3916
-	*
3917
-	*/
3913
+	 * Gets all airline countries that have flown over by airport icao
3914
+	 *
3915
+	 * @return Array the airline country list
3916
+	 *
3917
+	 */
3918 3918
 	public function countAllAirlineCountriesByAirport($airport_icao)
3919 3919
 	{
3920 3920
 		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
@@ -3945,11 +3945,11 @@  discard block
 block discarded – undo
3945 3945
 
3946 3946
 
3947 3947
 	/**
3948
-	* Gets all airlines that have flown over by aircraft manufacturer
3949
-	*
3950
-	* @return Array the airline list
3951
-	*
3952
-	*/
3948
+	 * Gets all airlines that have flown over by aircraft manufacturer
3949
+	 *
3950
+	 * @return Array the airline list
3951
+	 *
3952
+	 */
3953 3953
 	public function countAllAirlinesByManufacturer($aircraft_manufacturer)
3954 3954
 	{
3955 3955
 		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
@@ -3981,11 +3981,11 @@  discard block
 block discarded – undo
3981 3981
 
3982 3982
 
3983 3983
 	/**
3984
-	* Gets all airline countries that have flown over by aircraft manufacturer
3985
-	*
3986
-	* @return Array the airline country list
3987
-	*
3988
-	*/
3984
+	 * Gets all airline countries that have flown over by aircraft manufacturer
3985
+	 *
3986
+	 * @return Array the airline country list
3987
+	 *
3988
+	 */
3989 3989
 	public function countAllAirlineCountriesByManufacturer($aircraft_manufacturer)
3990 3990
 	{
3991 3991
 		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
@@ -4015,11 +4015,11 @@  discard block
 block discarded – undo
4015 4015
 
4016 4016
 
4017 4017
 	/**
4018
-	* Gets all airlines that have flown over by date
4019
-	*
4020
-	* @return Array the airline list
4021
-	*
4022
-	*/
4018
+	 * Gets all airlines that have flown over by date
4019
+	 *
4020
+	 * @return Array the airline list
4021
+	 *
4022
+	 */
4023 4023
 	public function countAllAirlinesByDate($date)
4024 4024
 	{
4025 4025
 		global $globalTimezone, $globalDBdriver;
@@ -4065,11 +4065,11 @@  discard block
 block discarded – undo
4065 4065
 	
4066 4066
 	
4067 4067
 	/**
4068
-	* Gets all airline countries that have flown over by date
4069
-	*
4070
-	* @return Array the airline country list
4071
-	*
4072
-	*/
4068
+	 * Gets all airline countries that have flown over by date
4069
+	 *
4070
+	 * @return Array the airline country list
4071
+	 *
4072
+	 */
4073 4073
 	public function countAllAirlineCountriesByDate($date)
4074 4074
 	{
4075 4075
 		global $globalTimezone, $globalDBdriver;
@@ -4113,11 +4113,11 @@  discard block
 block discarded – undo
4113 4113
 
4114 4114
 
4115 4115
 	/**
4116
-	* Gets all airlines that have flown over by ident/callsign
4117
-	*
4118
-	* @return Array the airline list
4119
-	*
4120
-	*/
4116
+	 * Gets all airlines that have flown over by ident/callsign
4117
+	 *
4118
+	 * @return Array the airline list
4119
+	 *
4120
+	 */
4121 4121
 	public function countAllAirlinesByIdent($ident)
4122 4122
 	{
4123 4123
 		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
@@ -4148,11 +4148,11 @@  discard block
 block discarded – undo
4148 4148
 	}
4149 4149
 
4150 4150
 	/**
4151
-	* Gets all airlines that have flown over by route
4152
-	*
4153
-	* @return Array the airline list
4154
-	*
4155
-	*/
4151
+	 * Gets all airlines that have flown over by route
4152
+	 *
4153
+	 * @return Array the airline list
4154
+	 *
4155
+	 */
4156 4156
 	public function countAllAirlinesByRoute($departure_airport_icao, $arrival_airport_icao)
4157 4157
 	{
4158 4158
 		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
@@ -4184,11 +4184,11 @@  discard block
 block discarded – undo
4184 4184
 	}
4185 4185
 
4186 4186
 	/**
4187
-	* Gets all airline countries that have flown over by route
4188
-	*
4189
-	* @return Array the airline country list
4190
-	*
4191
-	*/
4187
+	 * Gets all airline countries that have flown over by route
4188
+	 *
4189
+	 * @return Array the airline country list
4190
+	 *
4191
+	 */
4192 4192
 	public function countAllAirlineCountriesByRoute($departure_airport_icao, $arrival_airport_icao)
4193 4193
 	{
4194 4194
 		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
@@ -4220,11 +4220,11 @@  discard block
 block discarded – undo
4220 4220
 
4221 4221
 
4222 4222
 	/**
4223
-	* Gets all airlines that have flown over by country
4224
-	*
4225
-	* @return Array the airline list
4226
-	*
4227
-	*/
4223
+	 * Gets all airlines that have flown over by country
4224
+	 *
4225
+	 * @return Array the airline list
4226
+	 *
4227
+	 */
4228 4228
 	public function countAllAirlinesByCountry($country)
4229 4229
 	{
4230 4230
 		$country = filter_var($country,FILTER_SANITIZE_STRING);
@@ -4255,11 +4255,11 @@  discard block
 block discarded – undo
4255 4255
 
4256 4256
 
4257 4257
 	/**
4258
-	* Gets all airline countries that have flown over by country
4259
-	*
4260
-	* @return Array the airline country list
4261
-	*
4262
-	*/
4258
+	 * Gets all airline countries that have flown over by country
4259
+	 *
4260
+	 * @return Array the airline country list
4261
+	 *
4262
+	 */
4263 4263
 	public function countAllAirlineCountriesByCountry($country)
4264 4264
 	{
4265 4265
 		$country = filter_var($country,FILTER_SANITIZE_STRING);
@@ -4289,11 +4289,11 @@  discard block
 block discarded – undo
4289 4289
 
4290 4290
 
4291 4291
 	/**
4292
-	* Gets all airlines countries
4293
-	*
4294
-	* @return Array the airline country list
4295
-	*
4296
-	*/
4292
+	 * Gets all airlines countries
4293
+	 *
4294
+	 * @return Array the airline country list
4295
+	 *
4296
+	 */
4297 4297
 	public function countAllAirlineCountries($limit = true)
4298 4298
 	{
4299 4299
 		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
@@ -4319,11 +4319,11 @@  discard block
 block discarded – undo
4319 4319
 	}
4320 4320
 
4321 4321
 	/**
4322
-	* Gets all number of flight over countries
4323
-	*
4324
-	* @return Array the airline country list
4325
-	*
4326
-	*/
4322
+	 * Gets all number of flight over countries
4323
+	 *
4324
+	 * @return Array the airline country list
4325
+	 *
4326
+	 */
4327 4327
 	public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '')
4328 4328
 	{
4329 4329
 		global $globalDBdriver;
@@ -4335,15 +4335,15 @@  discard block
 block discarded – undo
4335 4335
 		$query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb 
4336 4336
 					FROM countries c, spotter_live s
4337 4337
 					WHERE c.iso2 = s.over_country ";
4338
-                if ($olderthanmonths > 0) {
4338
+				if ($olderthanmonths > 0) {
4339 4339
 			if ($globalDBdriver == 'mysql') {
4340 4340
 				$query .= 'AND spotter_live.date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
4341 4341
 			} else {
4342 4342
 				$query .= "AND spotter_live.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
4343 4343
 			}
4344 4344
 		}
4345
-                if ($sincedate != '') {
4346
-            		if ($globalDBdriver == 'mysql') {
4345
+				if ($sincedate != '') {
4346
+					if ($globalDBdriver == 'mysql') {
4347 4347
 				$query .= "AND spotter_live.date > '".$sincedate."' ";
4348 4348
 			} else {
4349 4349
 				$query .= "AND spotter_live.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -4373,11 +4373,11 @@  discard block
 block discarded – undo
4373 4373
 	
4374 4374
 	
4375 4375
 	/**
4376
-	* Gets all aircraft types that have flown over
4377
-	*
4378
-	* @return Array the aircraft list
4379
-	*
4380
-	*/
4376
+	 * Gets all aircraft types that have flown over
4377
+	 *
4378
+	 * @return Array the aircraft list
4379
+	 *
4380
+	 */
4381 4381
 	public function countAllAircraftTypes($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
4382 4382
 	{
4383 4383
 		global $globalDBdriver;
@@ -4420,11 +4420,11 @@  discard block
 block discarded – undo
4420 4420
 	}
4421 4421
 
4422 4422
 	/**
4423
-	* Gets all aircraft types that have flown over by airline
4424
-	*
4425
-	* @return Array the aircraft list
4426
-	*
4427
-	*/
4423
+	 * Gets all aircraft types that have flown over by airline
4424
+	 *
4425
+	 * @return Array the aircraft list
4426
+	 *
4427
+	 */
4428 4428
 	public function countAllAircraftTypesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '')
4429 4429
 	{
4430 4430
 		global $globalDBdriver;
@@ -4468,11 +4468,11 @@  discard block
 block discarded – undo
4468 4468
 
4469 4469
 
4470 4470
 	/**
4471
-	* Gets all aircraft registration that have flown over by aircaft icao
4472
-	*
4473
-	* @return Array the aircraft list
4474
-	*
4475
-	*/
4471
+	 * Gets all aircraft registration that have flown over by aircaft icao
4472
+	 *
4473
+	 * @return Array the aircraft list
4474
+	 *
4475
+	 */
4476 4476
 	public function countAllAircraftRegistrationByAircraft($aircraft_icao)
4477 4477
 	{
4478 4478
 		$Image = new Image($this->db);
@@ -4511,11 +4511,11 @@  discard block
 block discarded – undo
4511 4511
 
4512 4512
 
4513 4513
 	/**
4514
-	* Gets all aircraft types that have flown over by airline icao
4515
-	*
4516
-	* @return Array the aircraft list
4517
-	*
4518
-	*/
4514
+	 * Gets all aircraft types that have flown over by airline icao
4515
+	 *
4516
+	 * @return Array the aircraft list
4517
+	 *
4518
+	 */
4519 4519
 	public function countAllAircraftTypesByAirline($airline_icao)
4520 4520
 	{
4521 4521
 		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
@@ -4545,11 +4545,11 @@  discard block
 block discarded – undo
4545 4545
 
4546 4546
 
4547 4547
 	/**
4548
-	* Gets all aircraft registration that have flown over by airline icao
4549
-	*
4550
-	* @return Array the aircraft list
4551
-	*
4552
-	*/
4548
+	 * Gets all aircraft registration that have flown over by airline icao
4549
+	 *
4550
+	 * @return Array the aircraft list
4551
+	 *
4552
+	 */
4553 4553
 	public function countAllAircraftRegistrationByAirline($airline_icao)
4554 4554
 	{
4555 4555
 		$Image = new Image($this->db);
@@ -4587,11 +4587,11 @@  discard block
 block discarded – undo
4587 4587
 
4588 4588
 
4589 4589
 	/**
4590
-	* Gets all aircraft manufacturer that have flown over by airline icao
4591
-	*
4592
-	* @return Array the aircraft list
4593
-	*
4594
-	*/
4590
+	 * Gets all aircraft manufacturer that have flown over by airline icao
4591
+	 *
4592
+	 * @return Array the aircraft list
4593
+	 *
4594
+	 */
4595 4595
 	public function countAllAircraftManufacturerByAirline($airline_icao)
4596 4596
 	{
4597 4597
 		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
@@ -4620,11 +4620,11 @@  discard block
 block discarded – undo
4620 4620
 
4621 4621
 
4622 4622
 	/**
4623
-	* Gets all aircraft types that have flown over by airline icao
4624
-	*
4625
-	* @return Array the aircraft list
4626
-	*
4627
-	*/
4623
+	 * Gets all aircraft types that have flown over by airline icao
4624
+	 *
4625
+	 * @return Array the aircraft list
4626
+	 *
4627
+	 */
4628 4628
 	public function countAllAircraftTypesByAirport($airport_icao)
4629 4629
 	{
4630 4630
 		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
@@ -4653,11 +4653,11 @@  discard block
 block discarded – undo
4653 4653
 
4654 4654
 
4655 4655
 	/**
4656
-	* Gets all aircraft registration that have flown over by airport icao
4657
-	*
4658
-	* @return Array the aircraft list
4659
-	*
4660
-	*/
4656
+	 * Gets all aircraft registration that have flown over by airport icao
4657
+	 *
4658
+	 * @return Array the aircraft list
4659
+	 *
4660
+	 */
4661 4661
 	public function countAllAircraftRegistrationByAirport($airport_icao)
4662 4662
 	{
4663 4663
 		$Image = new Image($this->db);
@@ -4695,11 +4695,11 @@  discard block
 block discarded – undo
4695 4695
 	
4696 4696
 	
4697 4697
 	/**
4698
-	* Gets all aircraft manufacturer that have flown over by airport icao
4699
-	*
4700
-	* @return Array the aircraft list
4701
-	*
4702
-	*/
4698
+	 * Gets all aircraft manufacturer that have flown over by airport icao
4699
+	 *
4700
+	 * @return Array the aircraft list
4701
+	 *
4702
+	 */
4703 4703
 	public function countAllAircraftManufacturerByAirport($airport_icao)
4704 4704
 	{
4705 4705
 		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
@@ -4726,11 +4726,11 @@  discard block
 block discarded – undo
4726 4726
 	}
4727 4727
 
4728 4728
 	/**
4729
-	* Gets all aircraft types that have flown over by aircraft manufacturer
4730
-	*
4731
-	* @return Array the aircraft list
4732
-	*
4733
-	*/
4729
+	 * Gets all aircraft types that have flown over by aircraft manufacturer
4730
+	 *
4731
+	 * @return Array the aircraft list
4732
+	 *
4733
+	 */
4734 4734
 	public function countAllAircraftTypesByManufacturer($aircraft_manufacturer)
4735 4735
 	{
4736 4736
 		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
@@ -4757,11 +4757,11 @@  discard block
 block discarded – undo
4757 4757
 
4758 4758
 
4759 4759
 	/**
4760
-	* Gets all aircraft registration that have flown over by aircaft manufacturer
4761
-	*
4762
-	* @return Array the aircraft list
4763
-	*
4764
-	*/
4760
+	 * Gets all aircraft registration that have flown over by aircaft manufacturer
4761
+	 *
4762
+	 * @return Array the aircraft list
4763
+	 *
4764
+	 */
4765 4765
 	public function countAllAircraftRegistrationByManufacturer($aircraft_manufacturer)
4766 4766
 	{
4767 4767
 		$Image = new Image($this->db);
@@ -4797,11 +4797,11 @@  discard block
 block discarded – undo
4797 4797
 	}
4798 4798
 
4799 4799
 	/**
4800
-	* Gets all aircraft types that have flown over by date
4801
-	*
4802
-	* @return Array the aircraft list
4803
-	*
4804
-	*/
4800
+	 * Gets all aircraft types that have flown over by date
4801
+	 *
4802
+	 * @return Array the aircraft list
4803
+	 *
4804
+	 */
4805 4805
 	public function countAllAircraftTypesByDate($date)
4806 4806
 	{
4807 4807
 		global $globalTimezone, $globalDBdriver;
@@ -4844,11 +4844,11 @@  discard block
 block discarded – undo
4844 4844
 
4845 4845
 
4846 4846
 	/**
4847
-	* Gets all aircraft registration that have flown over by date
4848
-	*
4849
-	* @return Array the aircraft list
4850
-	*
4851
-	*/
4847
+	 * Gets all aircraft registration that have flown over by date
4848
+	 *
4849
+	 * @return Array the aircraft list
4850
+	 *
4851
+	 */
4852 4852
 	public function countAllAircraftRegistrationByDate($date)
4853 4853
 	{
4854 4854
 		global $globalTimezone, $globalDBdriver;
@@ -4900,11 +4900,11 @@  discard block
 block discarded – undo
4900 4900
 
4901 4901
 
4902 4902
 	/**
4903
-	* Gets all aircraft manufacturer that have flown over by date
4904
-	*
4905
-	* @return Array the aircraft manufacturer list
4906
-	*
4907
-	*/
4903
+	 * Gets all aircraft manufacturer that have flown over by date
4904
+	 *
4905
+	 * @return Array the aircraft manufacturer list
4906
+	 *
4907
+	 */
4908 4908
 	public function countAllAircraftManufacturerByDate($date)
4909 4909
 	{
4910 4910
 		global $globalTimezone, $globalDBdriver;
@@ -4947,11 +4947,11 @@  discard block
 block discarded – undo
4947 4947
 
4948 4948
 
4949 4949
 	/**
4950
-	* Gets all aircraft types that have flown over by ident/callsign
4951
-	*
4952
-	* @return Array the aircraft list
4953
-	*
4954
-	*/
4950
+	 * Gets all aircraft types that have flown over by ident/callsign
4951
+	 *
4952
+	 * @return Array the aircraft list
4953
+	 *
4954
+	 */
4955 4955
 	public function countAllAircraftTypesByIdent($ident)
4956 4956
 	{
4957 4957
 		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
@@ -4981,11 +4981,11 @@  discard block
 block discarded – undo
4981 4981
 
4982 4982
 
4983 4983
 	/**
4984
-	* Gets all aircraft registration that have flown over by ident/callsign
4985
-	*
4986
-	* @return Array the aircraft list
4987
-	*
4988
-	*/
4984
+	 * Gets all aircraft registration that have flown over by ident/callsign
4985
+	 *
4986
+	 * @return Array the aircraft list
4987
+	 *
4988
+	 */
4989 4989
 	public function countAllAircraftRegistrationByIdent($ident)
4990 4990
 	{
4991 4991
 		$Image = new Image($this->db);
@@ -5025,11 +5025,11 @@  discard block
 block discarded – undo
5025 5025
 
5026 5026
 
5027 5027
 	/**
5028
-	* Gets all aircraft manufacturer that have flown over by ident/callsign
5029
-	*
5030
-	* @return Array the aircraft manufacturer list
5031
-	*
5032
-	*/
5028
+	 * Gets all aircraft manufacturer that have flown over by ident/callsign
5029
+	 *
5030
+	 * @return Array the aircraft manufacturer list
5031
+	 *
5032
+	 */
5033 5033
 	public function countAllAircraftManufacturerByIdent($ident)
5034 5034
 	{
5035 5035
 		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
@@ -5056,11 +5056,11 @@  discard block
 block discarded – undo
5056 5056
 
5057 5057
 
5058 5058
 	/**
5059
-	* Gets all aircraft types that have flown over by route
5060
-	*
5061
-	* @return Array the aircraft list
5062
-	*
5063
-	*/
5059
+	 * Gets all aircraft types that have flown over by route
5060
+	 *
5061
+	 * @return Array the aircraft list
5062
+	 *
5063
+	 */
5064 5064
 	public function countAllAircraftTypesByRoute($departure_airport_icao, $arrival_airport_icao)
5065 5065
 	{
5066 5066
 		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
@@ -5089,11 +5089,11 @@  discard block
 block discarded – undo
5089 5089
 	}
5090 5090
 
5091 5091
 	/**
5092
-	* Gets all aircraft registration that have flown over by route
5093
-	*
5094
-	* @return Array the aircraft list
5095
-	*
5096
-	*/
5092
+	 * Gets all aircraft registration that have flown over by route
5093
+	 *
5094
+	 * @return Array the aircraft list
5095
+	 *
5096
+	 */
5097 5097
 	public function countAllAircraftRegistrationByRoute($departure_airport_icao, $arrival_airport_icao)
5098 5098
 	{
5099 5099
 		$Image = new Image($this->db);
@@ -5135,11 +5135,11 @@  discard block
 block discarded – undo
5135 5135
 	
5136 5136
 	
5137 5137
 	/**
5138
-	* Gets all aircraft manufacturer that have flown over by route
5139
-	*
5140
-	* @return Array the aircraft manufacturer list
5141
-	*
5142
-	*/
5138
+	 * Gets all aircraft manufacturer that have flown over by route
5139
+	 *
5140
+	 * @return Array the aircraft manufacturer list
5141
+	 *
5142
+	 */
5143 5143
 	public function countAllAircraftManufacturerByRoute($departure_airport_icao, $arrival_airport_icao)
5144 5144
 	{
5145 5145
 		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
@@ -5173,11 +5173,11 @@  discard block
 block discarded – undo
5173 5173
 	
5174 5174
 	
5175 5175
 	/**
5176
-	* Gets all aircraft types that have flown over by country
5177
-	*
5178
-	* @return Array the aircraft list
5179
-	*
5180
-	*/
5176
+	 * Gets all aircraft types that have flown over by country
5177
+	 *
5178
+	 * @return Array the aircraft list
5179
+	 *
5180
+	 */
5181 5181
 	public function countAllAircraftTypesByCountry($country)
5182 5182
 	{
5183 5183
 		$country = filter_var($country,FILTER_SANITIZE_STRING);
@@ -5209,11 +5209,11 @@  discard block
 block discarded – undo
5209 5209
 
5210 5210
 
5211 5211
 	/**
5212
-	* Gets all aircraft registration that have flown over by country
5213
-	*
5214
-	* @return Array the aircraft list
5215
-	*
5216
-	*/
5212
+	 * Gets all aircraft registration that have flown over by country
5213
+	 *
5214
+	 * @return Array the aircraft list
5215
+	 *
5216
+	 */
5217 5217
 	public function countAllAircraftRegistrationByCountry($country)
5218 5218
 	{
5219 5219
 		$Image = new Image($this->db);
@@ -5254,11 +5254,11 @@  discard block
 block discarded – undo
5254 5254
 	
5255 5255
 	
5256 5256
 	/**
5257
-	* Gets all aircraft manufacturer that have flown over by country
5258
-	*
5259
-	* @return Array the aircraft manufacturer list
5260
-	*
5261
-	*/
5257
+	 * Gets all aircraft manufacturer that have flown over by country
5258
+	 *
5259
+	 * @return Array the aircraft manufacturer list
5260
+	 *
5261
+	 */
5262 5262
 	public function countAllAircraftManufacturerByCountry($country)
5263 5263
 	{
5264 5264
 		$country = filter_var($country,FILTER_SANITIZE_STRING);
@@ -5290,17 +5290,17 @@  discard block
 block discarded – undo
5290 5290
 	
5291 5291
 	
5292 5292
 	/**
5293
-	* Gets all aircraft manufacturers that have flown over
5294
-	*
5295
-	* @return Array the aircraft list
5296
-	*
5297
-	*/
5293
+	 * Gets all aircraft manufacturers that have flown over
5294
+	 *
5295
+	 * @return Array the aircraft list
5296
+	 *
5297
+	 */
5298 5298
 	public function countAllAircraftManufacturers($filter = array())
5299 5299
 	{
5300 5300
 		$filter_query = $this->getFilter($filter,true,true);
5301 5301
 		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5302 5302
                     FROM spotter_output ".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.aircraft_manufacturer <> 'Not Available'";
5303
-                $query .= " GROUP BY spotter_output.aircraft_manufacturer
5303
+				$query .= " GROUP BY spotter_output.aircraft_manufacturer
5304 5304
 					ORDER BY aircraft_manufacturer_count DESC
5305 5305
 					LIMIT 10";
5306 5306
       
@@ -5325,11 +5325,11 @@  discard block
 block discarded – undo
5325 5325
 	
5326 5326
 	
5327 5327
 	/**
5328
-	* Gets all aircraft registrations that have flown over
5329
-	*
5330
-	* @return Array the aircraft list
5331
-	*
5332
-	*/
5328
+	 * Gets all aircraft registrations that have flown over
5329
+	 *
5330
+	 * @return Array the aircraft list
5331
+	 *
5332
+	 */
5333 5333
 	public function countAllAircraftRegistrations($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
5334 5334
 	{
5335 5335
 		global $globalDBdriver;
@@ -5337,15 +5337,15 @@  discard block
 block discarded – undo
5337 5337
 		$filter_query = $this->getFilter($filters,true,true);
5338 5338
 		$query  = "SELECT DISTINCT spotter_output.registration, COUNT(spotter_output.registration) AS aircraft_registration_count, spotter_output.aircraft_icao,  spotter_output.aircraft_name, spotter_output.airline_name    
5339 5339
                     FROM spotter_output ".$filter_query." spotter_output.registration <> '' AND spotter_output.registration <> 'NA'";
5340
-                if ($olderthanmonths > 0) {
5341
-            		if ($globalDBdriver == 'mysql') {
5340
+				if ($olderthanmonths > 0) {
5341
+					if ($globalDBdriver == 'mysql') {
5342 5342
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
5343 5343
 			} else {
5344 5344
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
5345 5345
 			}
5346 5346
 		}
5347
-                if ($sincedate != '') {
5348
-            		if ($globalDBdriver == 'mysql') {
5347
+				if ($sincedate != '') {
5348
+					if ($globalDBdriver == 'mysql') {
5349 5349
 				$query .= " AND spotter_output.date > '".$sincedate."'";
5350 5350
 			} else {
5351 5351
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -5354,7 +5354,7 @@  discard block
 block discarded – undo
5354 5354
 
5355 5355
 		// if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5356 5356
 		//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5357
-                $query .= " GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC";
5357
+				$query .= " GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC";
5358 5358
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5359 5359
 		
5360 5360
 		$sth = $this->db->prepare($query);
@@ -5385,11 +5385,11 @@  discard block
 block discarded – undo
5385 5385
 
5386 5386
 
5387 5387
 	/**
5388
-	* Gets all aircraft registrations that have flown over
5389
-	*
5390
-	* @return Array the aircraft list
5391
-	*
5392
-	*/
5388
+	 * Gets all aircraft registrations that have flown over
5389
+	 *
5390
+	 * @return Array the aircraft list
5391
+	 *
5392
+	 */
5393 5393
 	public function countAllAircraftRegistrationsByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '')
5394 5394
 	{
5395 5395
 		global $globalDBdriver;
@@ -5397,15 +5397,15 @@  discard block
 block discarded – undo
5397 5397
 		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.registration, COUNT(spotter_output.registration) AS aircraft_registration_count, spotter_output.aircraft_icao,  spotter_output.aircraft_name, spotter_output.airline_name    
5398 5398
                     FROM spotter_output 
5399 5399
                     WHERE spotter_output.airline_icao <> '' AND spotter_output.registration <> '' AND spotter_output.registration <> 'NA' ";
5400
-                if ($olderthanmonths > 0) {
5401
-            		if ($globalDBdriver == 'mysql') {
5400
+				if ($olderthanmonths > 0) {
5401
+					if ($globalDBdriver == 'mysql') {
5402 5402
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
5403 5403
 			} else {
5404 5404
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
5405 5405
 			}
5406 5406
 		}
5407
-                if ($sincedate != '') {
5408
-            		if ($globalDBdriver == 'mysql') {
5407
+				if ($sincedate != '') {
5408
+					if ($globalDBdriver == 'mysql') {
5409 5409
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
5410 5410
 			} else {
5411 5411
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -5414,7 +5414,7 @@  discard block
 block discarded – undo
5414 5414
 
5415 5415
 		// if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5416 5416
 		//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5417
-                $query .= "GROUP BY spotter_output.airline_icao, spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC";
5417
+				$query .= "GROUP BY spotter_output.airline_icao, spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC";
5418 5418
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5419 5419
 		
5420 5420
 		$sth = $this->db->prepare($query);
@@ -5446,35 +5446,35 @@  discard block
 block discarded – undo
5446 5446
 	
5447 5447
 	
5448 5448
 	/**
5449
-	* Gets all departure airports of the airplanes that have flown over
5450
-	*
5451
-	* @return Array the airport list
5452
-	*
5453
-	*/
5449
+	 * Gets all departure airports of the airplanes that have flown over
5450
+	 *
5451
+	 * @return Array the airport list
5452
+	 *
5453
+	 */
5454 5454
 	public function countAllDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
5455 5455
 	{
5456 5456
 		global $globalDBdriver;
5457 5457
 		$filter_query = $this->getFilter($filters,true,true);
5458 5458
 		$query  = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
5459 5459
 				FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA'";
5460
-                if ($olderthanmonths > 0) {
5461
-            		if ($globalDBdriver == 'mysql') {
5460
+				if ($olderthanmonths > 0) {
5461
+					if ($globalDBdriver == 'mysql') {
5462 5462
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
5463 5463
 			} else {
5464 5464
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
5465 5465
 			}
5466
-                }
5467
-                if ($sincedate != '') {
5468
-            		if ($globalDBdriver == 'mysql') {
5466
+				}
5467
+				if ($sincedate != '') {
5468
+					if ($globalDBdriver == 'mysql') {
5469 5469
 				$query .= " AND spotter_output.date > '".$sincedate."'";
5470 5470
 			} else {
5471 5471
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
5472 5472
 			}
5473 5473
 		}
5474 5474
 
5475
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5476
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5477
-                $query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
5475
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5476
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5477
+				$query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
5478 5478
 				ORDER BY airport_departure_icao_count DESC";
5479 5479
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5480 5480
       
@@ -5498,35 +5498,35 @@  discard block
 block discarded – undo
5498 5498
 	}
5499 5499
 
5500 5500
 	/**
5501
-	* Gets all departure airports of the airplanes that have flown over
5502
-	*
5503
-	* @return Array the airport list
5504
-	*
5505
-	*/
5501
+	 * Gets all departure airports of the airplanes that have flown over
5502
+	 *
5503
+	 * @return Array the airport list
5504
+	 *
5505
+	 */
5506 5506
 	public function countAllDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '')
5507 5507
 	{
5508 5508
 		global $globalDBdriver;
5509 5509
 		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
5510 5510
 								FROM spotter_output
5511 5511
                     WHERE spotter_output.airline_icao <> '' AND spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' ";
5512
-                if ($olderthanmonths > 0) {
5513
-            		if ($globalDBdriver == 'mysql') {
5512
+				if ($olderthanmonths > 0) {
5513
+					if ($globalDBdriver == 'mysql') {
5514 5514
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
5515 5515
 			} else {
5516 5516
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
5517 5517
 			}
5518
-                }
5519
-                if ($sincedate != '') {
5520
-            		if ($globalDBdriver == 'mysql') {
5518
+				}
5519
+				if ($sincedate != '') {
5520
+					if ($globalDBdriver == 'mysql') {
5521 5521
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
5522 5522
 			} else {
5523 5523
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
5524 5524
 			}
5525 5525
 		}
5526 5526
 
5527
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5528
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5529
-                $query .= "GROUP BY spotter_output.airline_icao, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
5527
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5528
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5529
+				$query .= "GROUP BY spotter_output.airline_icao, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
5530 5530
 				ORDER BY airport_departure_icao_count DESC";
5531 5531
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5532 5532
       
@@ -5551,34 +5551,34 @@  discard block
 block discarded – undo
5551 5551
 	}
5552 5552
 
5553 5553
 	/**
5554
-	* Gets all detected departure airports of the airplanes that have flown over
5555
-	*
5556
-	* @return Array the airport list
5557
-	*
5558
-	*/
5554
+	 * Gets all detected departure airports of the airplanes that have flown over
5555
+	 *
5556
+	 * @return Array the airport list
5557
+	 *
5558
+	 */
5559 5559
 	public function countAllDetectedDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
5560 5560
 	{
5561 5561
 		global $globalDBdriver;
5562 5562
 		$filter_query = $this->getFilter($filters,true,true);
5563 5563
 		$query  = "SELECT DISTINCT spotter_output.real_departure_airport_icao AS departure_airport_icao, COUNT(spotter_output.real_departure_airport_icao) AS airport_departure_icao_count, airport.name as departure_airport_name, airport.city as departure_airport_city, airport.country as departure_airport_country
5564 5564
 				FROM spotter_output, airport".$filter_query." spotter_output.real_departure_airport_icao <> '' AND spotter_output.real_departure_airport_icao <> 'NA' AND airport.icao = spotter_output.real_departure_airport_icao";
5565
-                if ($olderthanmonths > 0) {
5566
-            		if ($globalDBdriver == 'mysql') {
5565
+				if ($olderthanmonths > 0) {
5566
+					if ($globalDBdriver == 'mysql') {
5567 5567
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
5568 5568
 			} else {
5569 5569
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
5570 5570
 			}
5571
-                }
5572
-                if ($sincedate != '') {
5573
-            		if ($globalDBdriver == 'mysql') {
5571
+				}
5572
+				if ($sincedate != '') {
5573
+					if ($globalDBdriver == 'mysql') {
5574 5574
 				$query .= " AND spotter_output.date > '".$sincedate."'";
5575 5575
 			} else {
5576 5576
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
5577 5577
 			}
5578 5578
 		}
5579
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5580
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5581
-                $query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
5579
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5580
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5581
+				$query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
5582 5582
 				ORDER BY airport_departure_icao_count DESC";
5583 5583
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5584 5584
       
@@ -5602,35 +5602,35 @@  discard block
 block discarded – undo
5602 5602
 	}
5603 5603
 	
5604 5604
 	/**
5605
-	* Gets all detected departure airports of the airplanes that have flown over
5606
-	*
5607
-	* @return Array the airport list
5608
-	*
5609
-	*/
5605
+	 * Gets all detected departure airports of the airplanes that have flown over
5606
+	 *
5607
+	 * @return Array the airport list
5608
+	 *
5609
+	 */
5610 5610
 	public function countAllDetectedDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '')
5611 5611
 	{
5612 5612
 		global $globalDBdriver;
5613 5613
 		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.real_departure_airport_icao AS departure_airport_icao, COUNT(spotter_output.real_departure_airport_icao) AS airport_departure_icao_count, airport.name as departure_airport_name, airport.city as departure_airport_city, airport.country as departure_airport_country
5614 5614
 				FROM spotter_output, airport
5615 5615
                     WHERE spotter_output.airline_icao <> '' AND spotter_output.real_departure_airport_icao <> '' AND spotter_output.real_departure_airport_icao <> 'NA' AND airport.icao = spotter_output.real_departure_airport_icao ";
5616
-                if ($olderthanmonths > 0) {
5617
-            		if ($globalDBdriver == 'mysql') {
5616
+				if ($olderthanmonths > 0) {
5617
+					if ($globalDBdriver == 'mysql') {
5618 5618
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
5619 5619
 			} else {
5620 5620
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
5621 5621
 			}
5622
-                }
5623
-                if ($sincedate != '') {
5624
-            		if ($globalDBdriver == 'mysql') {
5622
+				}
5623
+				if ($sincedate != '') {
5624
+					if ($globalDBdriver == 'mysql') {
5625 5625
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
5626 5626
 			} else {
5627 5627
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP) ";
5628 5628
 			}
5629 5629
 		}
5630 5630
 
5631
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5632
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5633
-                $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
5631
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5632
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5633
+				$query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
5634 5634
 				ORDER BY airport_departure_icao_count DESC";
5635 5635
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5636 5636
       
@@ -5655,11 +5655,11 @@  discard block
 block discarded – undo
5655 5655
 	}	
5656 5656
 	
5657 5657
 	/**
5658
-	* Gets all departure airports of the airplanes that have flown over based on an airline icao
5659
-	*
5660
-	* @return Array the airport list
5661
-	*
5662
-	*/
5658
+	 * Gets all departure airports of the airplanes that have flown over based on an airline icao
5659
+	 *
5660
+	 * @return Array the airport list
5661
+	 *
5662
+	 */
5663 5663
 	public function countAllDepartureAirportsByAirline($airline_icao)
5664 5664
 	{
5665 5665
 		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
@@ -5694,11 +5694,11 @@  discard block
 block discarded – undo
5694 5694
 	
5695 5695
 	
5696 5696
 	/**
5697
-	* Gets all departure airports by country of the airplanes that have flown over based on an airline icao
5698
-	*
5699
-	* @return Array the airport list
5700
-	*
5701
-	*/
5697
+	 * Gets all departure airports by country of the airplanes that have flown over based on an airline icao
5698
+	 *
5699
+	 * @return Array the airport list
5700
+	 *
5701
+	 */
5702 5702
 	public function countAllDepartureAirportCountriesByAirline($airline_icao)
5703 5703
 	{
5704 5704
 		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
@@ -5730,11 +5730,11 @@  discard block
 block discarded – undo
5730 5730
 	
5731 5731
 	
5732 5732
 	/**
5733
-	* Gets all departure airports of the airplanes that have flown over based on an aircraft icao
5734
-	*
5735
-	* @return Array the airport list
5736
-	*
5737
-	*/
5733
+	 * Gets all departure airports of the airplanes that have flown over based on an aircraft icao
5734
+	 *
5735
+	 * @return Array the airport list
5736
+	 *
5737
+	 */
5738 5738
 	public function countAllDepartureAirportsByAircraft($aircraft_icao)
5739 5739
 	{
5740 5740
 		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
@@ -5768,11 +5768,11 @@  discard block
 block discarded – undo
5768 5768
 	
5769 5769
 	
5770 5770
 	/**
5771
-	* Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao
5772
-	*
5773
-	* @return Array the airport list
5774
-	*
5775
-	*/
5771
+	 * Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao
5772
+	 *
5773
+	 * @return Array the airport list
5774
+	 *
5775
+	 */
5776 5776
 	public function countAllDepartureAirportCountriesByAircraft($aircraft_icao)
5777 5777
 	{
5778 5778
 		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
@@ -5803,11 +5803,11 @@  discard block
 block discarded – undo
5803 5803
 	
5804 5804
 	
5805 5805
 	/**
5806
-	* Gets all departure airports of the airplanes that have flown over based on an aircraft registration
5807
-	*
5808
-	* @return Array the airport list
5809
-	*
5810
-	*/
5806
+	 * Gets all departure airports of the airplanes that have flown over based on an aircraft registration
5807
+	 *
5808
+	 * @return Array the airport list
5809
+	 *
5810
+	 */
5811 5811
 	public function countAllDepartureAirportsByRegistration($registration)
5812 5812
 	{
5813 5813
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -5841,11 +5841,11 @@  discard block
 block discarded – undo
5841 5841
 	
5842 5842
 	
5843 5843
 	/**
5844
-	* Gets all departure airports by country of the airplanes that have flown over based on an aircraft registration
5845
-	*
5846
-	* @return Array the airport list
5847
-	*
5848
-	*/
5844
+	 * Gets all departure airports by country of the airplanes that have flown over based on an aircraft registration
5845
+	 *
5846
+	 * @return Array the airport list
5847
+	 *
5848
+	 */
5849 5849
 	public function countAllDepartureAirportCountriesByRegistration($registration)
5850 5850
 	{
5851 5851
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -5876,11 +5876,11 @@  discard block
 block discarded – undo
5876 5876
 	
5877 5877
 	
5878 5878
 	/**
5879
-	* Gets all departure airports of the airplanes that have flown over based on an arrivl airport icao
5880
-	*
5881
-	* @return Array the airport list
5882
-	*
5883
-	*/
5879
+	 * Gets all departure airports of the airplanes that have flown over based on an arrivl airport icao
5880
+	 *
5881
+	 * @return Array the airport list
5882
+	 *
5883
+	 */
5884 5884
 	public function countAllDepartureAirportsByAirport($airport_icao)
5885 5885
 	{
5886 5886
 		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
@@ -5914,11 +5914,11 @@  discard block
 block discarded – undo
5914 5914
 	
5915 5915
 	
5916 5916
 	/**
5917
-	* Gets all departure airports by country of the airplanes that have flown over based on an airport icao
5918
-	*
5919
-	* @return Array the airport list
5920
-	*
5921
-	*/
5917
+	 * Gets all departure airports by country of the airplanes that have flown over based on an airport icao
5918
+	 *
5919
+	 * @return Array the airport list
5920
+	 *
5921
+	 */
5922 5922
 	public function countAllDepartureAirportCountriesByAirport($airport_icao)
5923 5923
 	{
5924 5924
 		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
@@ -5950,11 +5950,11 @@  discard block
 block discarded – undo
5950 5950
 	
5951 5951
 	
5952 5952
 	/**
5953
-	* Gets all departure airports of the airplanes that have flown over based on an aircraft manufacturer
5954
-	*
5955
-	* @return Array the airport list
5956
-	*
5957
-	*/
5953
+	 * Gets all departure airports of the airplanes that have flown over based on an aircraft manufacturer
5954
+	 *
5955
+	 * @return Array the airport list
5956
+	 *
5957
+	 */
5958 5958
 	public function countAllDepartureAirportsByManufacturer($aircraft_manufacturer)
5959 5959
 	{
5960 5960
 		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
@@ -5988,11 +5988,11 @@  discard block
 block discarded – undo
5988 5988
 	
5989 5989
 	
5990 5990
 	/**
5991
-	* Gets all departure airports by country of the airplanes that have flown over based on an aircraft manufacturer
5992
-	*
5993
-	* @return Array the airport list
5994
-	*
5995
-	*/
5991
+	 * Gets all departure airports by country of the airplanes that have flown over based on an aircraft manufacturer
5992
+	 *
5993
+	 * @return Array the airport list
5994
+	 *
5995
+	 */
5996 5996
 	public function countAllDepartureAirportCountriesByManufacturer($aircraft_manufacturer)
5997 5997
 	{
5998 5998
 		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
@@ -6023,11 +6023,11 @@  discard block
 block discarded – undo
6023 6023
 	
6024 6024
 	
6025 6025
 	/**
6026
-	* Gets all departure airports of the airplanes that have flown over based on a date
6027
-	*
6028
-	* @return Array the airport list
6029
-	*
6030
-	*/
6026
+	 * Gets all departure airports of the airplanes that have flown over based on a date
6027
+	 *
6028
+	 * @return Array the airport list
6029
+	 *
6030
+	 */
6031 6031
 	public function countAllDepartureAirportsByDate($date)
6032 6032
 	{
6033 6033
 		global $globalTimezone, $globalDBdriver;
@@ -6075,11 +6075,11 @@  discard block
 block discarded – undo
6075 6075
 	
6076 6076
 	
6077 6077
 	/**
6078
-	* Gets all departure airports by country of the airplanes that have flown over based on a date
6079
-	*
6080
-	* @return Array the airport list
6081
-	*
6082
-	*/
6078
+	 * Gets all departure airports by country of the airplanes that have flown over based on a date
6079
+	 *
6080
+	 * @return Array the airport list
6081
+	 *
6082
+	 */
6083 6083
 	public function countAllDepartureAirportCountriesByDate($date)
6084 6084
 	{
6085 6085
 		global $globalTimezone, $globalDBdriver;
@@ -6123,11 +6123,11 @@  discard block
 block discarded – undo
6123 6123
 	
6124 6124
 	
6125 6125
 	/**
6126
-	* Gets all departure airports of the airplanes that have flown over based on a ident/callsign
6127
-	*
6128
-	* @return Array the airport list
6129
-	*
6130
-	*/
6126
+	 * Gets all departure airports of the airplanes that have flown over based on a ident/callsign
6127
+	 *
6128
+	 * @return Array the airport list
6129
+	 *
6130
+	 */
6131 6131
 	public function countAllDepartureAirportsByIdent($ident)
6132 6132
 	{
6133 6133
 		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
@@ -6162,11 +6162,11 @@  discard block
 block discarded – undo
6162 6162
 	
6163 6163
 	
6164 6164
 	/**
6165
-	* Gets all departure airports by country of the airplanes that have flown over based on a callsign/ident
6166
-	*
6167
-	* @return Array the airport list
6168
-	*
6169
-	*/
6165
+	 * Gets all departure airports by country of the airplanes that have flown over based on a callsign/ident
6166
+	 *
6167
+	 * @return Array the airport list
6168
+	 *
6169
+	 */
6170 6170
 	public function countAllDepartureAirportCountriesByIdent($ident)
6171 6171
 	{
6172 6172
 		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
@@ -6198,11 +6198,11 @@  discard block
 block discarded – undo
6198 6198
 	
6199 6199
 	
6200 6200
 	/**
6201
-	* Gets all departure airports of the airplanes that have flown over based on a country
6202
-	*
6203
-	* @return Array the airport list
6204
-	*
6205
-	*/
6201
+	 * Gets all departure airports of the airplanes that have flown over based on a country
6202
+	 *
6203
+	 * @return Array the airport list
6204
+	 *
6205
+	 */
6206 6206
 	public function countAllDepartureAirportsByCountry($country)
6207 6207
 	{
6208 6208
 		$country = filter_var($country,FILTER_SANITIZE_STRING);
@@ -6236,11 +6236,11 @@  discard block
 block discarded – undo
6236 6236
 
6237 6237
 
6238 6238
 	/**
6239
-	* Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao
6240
-	*
6241
-	* @return Array the airport list
6242
-	*
6243
-	*/
6239
+	 * Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao
6240
+	 *
6241
+	 * @return Array the airport list
6242
+	 *
6243
+	 */
6244 6244
 	public function countAllDepartureAirportCountriesByCountry($country)
6245 6245
 	{
6246 6246
 		$country = filter_var($country,FILTER_SANITIZE_STRING);
@@ -6271,40 +6271,40 @@  discard block
 block discarded – undo
6271 6271
 	
6272 6272
 
6273 6273
 	/**
6274
-	* Gets all arrival airports of the airplanes that have flown over
6275
-	*
6276
-	* @return Array the airport list
6277
-	*
6278
-	*/
6274
+	 * Gets all arrival airports of the airplanes that have flown over
6275
+	 *
6276
+	 * @return Array the airport list
6277
+	 *
6278
+	 */
6279 6279
 	public function countAllArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array())
6280 6280
 	{
6281 6281
 		global $globalDBdriver;
6282 6282
 		$filter_query = $this->getFilter($filters,true,true);
6283 6283
 		$query  = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
6284 6284
 				FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA'";
6285
-                if ($olderthanmonths > 0) {
6286
-            		if ($globalDBdriver == 'mysql') {
6285
+				if ($olderthanmonths > 0) {
6286
+					if ($globalDBdriver == 'mysql') {
6287 6287
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
6288 6288
 			} else {
6289 6289
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
6290 6290
 			}
6291
-                if ($sincedate != '') {
6292
-            		if ($globalDBdriver == 'mysql') {
6291
+				if ($sincedate != '') {
6292
+					if ($globalDBdriver == 'mysql') {
6293 6293
 				$query .= " AND spotter_output.date > '".$sincedate."'";
6294 6294
 			} else {
6295 6295
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
6296 6296
 			}
6297 6297
 		}
6298
-            		if ($globalDBdriver == 'mysql') {
6298
+					if ($globalDBdriver == 'mysql') {
6299 6299
 				$query .= " AND spotter_output.date > '".$sincedate."'";
6300 6300
 			} else {
6301 6301
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
6302 6302
 			}
6303 6303
 		}
6304 6304
 
6305
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6306
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6307
-                $query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
6305
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6306
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6307
+				$query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
6308 6308
 					ORDER BY airport_arrival_icao_count DESC";
6309 6309
 		if ($limit) $query .= " LIMIT 10";
6310 6310
       
@@ -6333,40 +6333,40 @@  discard block
 block discarded – undo
6333 6333
 	}
6334 6334
 
6335 6335
 	/**
6336
-	* Gets all arrival airports of the airplanes that have flown over
6337
-	*
6338
-	* @return Array the airport list
6339
-	*
6340
-	*/
6336
+	 * Gets all arrival airports of the airplanes that have flown over
6337
+	 *
6338
+	 * @return Array the airport list
6339
+	 *
6340
+	 */
6341 6341
 	public function countAllArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false)
6342 6342
 	{
6343 6343
 		global $globalDBdriver;
6344 6344
 		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
6345 6345
 								FROM spotter_output 
6346 6346
                     WHERE spotter_output.airline_icao <> '' AND spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' ";
6347
-                if ($olderthanmonths > 0) {
6348
-            		if ($globalDBdriver == 'mysql') {
6347
+				if ($olderthanmonths > 0) {
6348
+					if ($globalDBdriver == 'mysql') {
6349 6349
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
6350 6350
 			} else {
6351 6351
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
6352 6352
 			}
6353
-                if ($sincedate != '') {
6354
-            		if ($globalDBdriver == 'mysql') {
6353
+				if ($sincedate != '') {
6354
+					if ($globalDBdriver == 'mysql') {
6355 6355
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
6356 6356
 			} else {
6357 6357
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
6358 6358
 			}
6359 6359
 		}
6360
-            		if ($globalDBdriver == 'mysql') {
6360
+					if ($globalDBdriver == 'mysql') {
6361 6361
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
6362 6362
 			} else {
6363 6363
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
6364 6364
 			}
6365 6365
 		}
6366 6366
 
6367
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6368
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6369
-                $query .= "GROUP BY spotter_output.airline_icao,spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
6367
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6368
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6369
+				$query .= "GROUP BY spotter_output.airline_icao,spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
6370 6370
 					ORDER BY airport_arrival_icao_count DESC";
6371 6371
 		if ($limit) $query .= " LIMIT 10";
6372 6372
       
@@ -6397,39 +6397,39 @@  discard block
 block discarded – undo
6397 6397
 
6398 6398
 
6399 6399
 	/**
6400
-	* Gets all detected arrival airports of the airplanes that have flown over
6401
-	*
6402
-	* @return Array the airport list
6403
-	*
6404
-	*/
6400
+	 * Gets all detected arrival airports of the airplanes that have flown over
6401
+	 *
6402
+	 * @return Array the airport list
6403
+	 *
6404
+	 */
6405 6405
 	public function countAllDetectedArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array())
6406 6406
 	{
6407 6407
 		global $globalDBdriver;
6408 6408
 		$filter_query = $this->getFilter($filters,true,true);
6409 6409
 		$query  = "SELECT DISTINCT spotter_output.real_arrival_airport_icao as arrival_airport_icao, COUNT(spotter_output.real_arrival_airport_icao) AS airport_arrival_icao_count, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country 
6410 6410
 			FROM spotter_output, airport".$filter_query." spotter_output.real_arrival_airport_icao <> '' AND spotter_output.real_arrival_airport_icao <> 'NA' AND airport.icao = spotter_output.real_arrival_airport_icao";
6411
-                if ($olderthanmonths > 0) {
6412
-            		if ($globalDBdriver == 'mysql') {
6411
+				if ($olderthanmonths > 0) {
6412
+					if ($globalDBdriver == 'mysql') {
6413 6413
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
6414 6414
 			} else {
6415 6415
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
6416 6416
 			}
6417
-                if ($sincedate != '') {
6418
-            		if ($globalDBdriver == 'mysql') {
6417
+				if ($sincedate != '') {
6418
+					if ($globalDBdriver == 'mysql') {
6419 6419
 				$query .= " AND spotter_output.date > '".$sincedate."'";
6420 6420
 			} else {
6421 6421
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
6422 6422
 			}
6423 6423
 		}
6424
-            		if ($globalDBdriver == 'mysql') {
6424
+					if ($globalDBdriver == 'mysql') {
6425 6425
 				$query .= " AND spotter_output.date > '".$sincedate."'";
6426 6426
 			} else {
6427 6427
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
6428 6428
 			}
6429 6429
 		}
6430
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6431
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6432
-                $query .= " GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
6430
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6431
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6432
+				$query .= " GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
6433 6433
 					ORDER BY airport_arrival_icao_count DESC";
6434 6434
 		if ($limit) $query .= " LIMIT 10";
6435 6435
       
@@ -6458,40 +6458,40 @@  discard block
 block discarded – undo
6458 6458
 	}
6459 6459
 	
6460 6460
 	/**
6461
-	* Gets all detected arrival airports of the airplanes that have flown over
6462
-	*
6463
-	* @return Array the airport list
6464
-	*
6465
-	*/
6461
+	 * Gets all detected arrival airports of the airplanes that have flown over
6462
+	 *
6463
+	 * @return Array the airport list
6464
+	 *
6465
+	 */
6466 6466
 	public function countAllDetectedArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false)
6467 6467
 	{
6468 6468
 		global $globalDBdriver;
6469 6469
 		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.real_arrival_airport_icao as arrival_airport_icao, COUNT(spotter_output.real_arrival_airport_icao) AS airport_arrival_icao_count, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country 
6470 6470
 			FROM spotter_output, airport 
6471 6471
                     WHERE spotter_output.airline_icao <> '' AND spotter_output.real_arrival_airport_icao <> '' AND spotter_output.real_arrival_airport_icao <> 'NA' AND airport.icao = spotter_output.real_arrival_airport_icao ";
6472
-                if ($olderthanmonths > 0) {
6473
-            		if ($globalDBdriver == 'mysql') {
6472
+				if ($olderthanmonths > 0) {
6473
+					if ($globalDBdriver == 'mysql') {
6474 6474
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
6475 6475
 			} else {
6476 6476
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
6477 6477
 			}
6478
-                if ($sincedate != '') {
6479
-            		if ($globalDBdriver == 'mysql') {
6478
+				if ($sincedate != '') {
6479
+					if ($globalDBdriver == 'mysql') {
6480 6480
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
6481 6481
 			} else {
6482 6482
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
6483 6483
 			}
6484 6484
 		}
6485
-            		if ($globalDBdriver == 'mysql') {
6485
+					if ($globalDBdriver == 'mysql') {
6486 6486
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
6487 6487
 			} else {
6488 6488
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
6489 6489
 			}
6490 6490
 		}
6491 6491
 
6492
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6493
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6494
-                $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
6492
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6493
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6494
+				$query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
6495 6495
 					ORDER BY airport_arrival_icao_count DESC";
6496 6496
 		if ($limit) $query .= " LIMIT 10";
6497 6497
       
@@ -6521,11 +6521,11 @@  discard block
 block discarded – undo
6521 6521
 	}	
6522 6522
 	
6523 6523
 	/**
6524
-	* Gets all arrival airports of the airplanes that have flown over based on an airline icao
6525
-	*
6526
-	* @return Array the airport list
6527
-	*
6528
-	*/
6524
+	 * Gets all arrival airports of the airplanes that have flown over based on an airline icao
6525
+	 *
6526
+	 * @return Array the airport list
6527
+	 *
6528
+	 */
6529 6529
 	public function countAllArrivalAirportsByAirline($airline_icao)
6530 6530
 	{
6531 6531
 		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
@@ -6559,11 +6559,11 @@  discard block
 block discarded – undo
6559 6559
 	
6560 6560
 	
6561 6561
 	/**
6562
-	* Gets all arrival airports by country of the airplanes that have flown over based on an airline icao
6563
-	*
6564
-	* @return Array the airport list
6565
-	*
6566
-	*/
6562
+	 * Gets all arrival airports by country of the airplanes that have flown over based on an airline icao
6563
+	 *
6564
+	 * @return Array the airport list
6565
+	 *
6566
+	 */
6567 6567
 	public function countAllArrivalAirportCountriesByAirline($airline_icao)
6568 6568
 	{
6569 6569
 		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
@@ -6594,11 +6594,11 @@  discard block
 block discarded – undo
6594 6594
 	
6595 6595
 	
6596 6596
 	/**
6597
-	* Gets all arrival airports of the airplanes that have flown over based on an aircraft icao
6598
-	*
6599
-	* @return Array the airport list
6600
-	*
6601
-	*/
6597
+	 * Gets all arrival airports of the airplanes that have flown over based on an aircraft icao
6598
+	 *
6599
+	 * @return Array the airport list
6600
+	 *
6601
+	 */
6602 6602
 	public function countAllArrivalAirportsByAircraft($aircraft_icao)
6603 6603
 	{
6604 6604
 		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
@@ -6633,11 +6633,11 @@  discard block
 block discarded – undo
6633 6633
 	
6634 6634
 	
6635 6635
 	/**
6636
-	* Gets all arrival airports by country of the airplanes that have flown over based on an aircraft icao
6637
-	*
6638
-	* @return Array the airport list
6639
-	*
6640
-	*/
6636
+	 * Gets all arrival airports by country of the airplanes that have flown over based on an aircraft icao
6637
+	 *
6638
+	 * @return Array the airport list
6639
+	 *
6640
+	 */
6641 6641
 	public function countAllArrivalAirportCountriesByAircraft($aircraft_icao)
6642 6642
 	{
6643 6643
 		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
@@ -6668,11 +6668,11 @@  discard block
 block discarded – undo
6668 6668
 	
6669 6669
 	
6670 6670
 	/**
6671
-	* Gets all arrival airports of the airplanes that have flown over based on an aircraft registration
6672
-	*
6673
-	* @return Array the airport list
6674
-	*
6675
-	*/
6671
+	 * Gets all arrival airports of the airplanes that have flown over based on an aircraft registration
6672
+	 *
6673
+	 * @return Array the airport list
6674
+	 *
6675
+	 */
6676 6676
 	public function countAllArrivalAirportsByRegistration($registration)
6677 6677
 	{
6678 6678
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -6706,11 +6706,11 @@  discard block
 block discarded – undo
6706 6706
 	
6707 6707
 	
6708 6708
 	/**
6709
-	* Gets all arrival airports by country of the airplanes that have flown over based on an aircraft registration
6710
-	*
6711
-	* @return Array the airport list
6712
-	*
6713
-	*/
6709
+	 * Gets all arrival airports by country of the airplanes that have flown over based on an aircraft registration
6710
+	 *
6711
+	 * @return Array the airport list
6712
+	 *
6713
+	 */
6714 6714
 	public function countAllArrivalAirportCountriesByRegistration($registration)
6715 6715
 	{
6716 6716
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -6742,11 +6742,11 @@  discard block
 block discarded – undo
6742 6742
 	
6743 6743
 	
6744 6744
 	/**
6745
-	* Gets all arrival airports of the airplanes that have flown over based on an departure airport
6746
-	*
6747
-	* @return Array the airport list
6748
-	*
6749
-	*/
6745
+	 * Gets all arrival airports of the airplanes that have flown over based on an departure airport
6746
+	 *
6747
+	 * @return Array the airport list
6748
+	 *
6749
+	 */
6750 6750
 	public function countAllArrivalAirportsByAirport($airport_icao)
6751 6751
 	{
6752 6752
 		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
@@ -6780,11 +6780,11 @@  discard block
 block discarded – undo
6780 6780
 	
6781 6781
 	
6782 6782
 	/**
6783
-	* Gets all arrival airports by country of the airplanes that have flown over based on an airport icao
6784
-	*
6785
-	* @return Array the airport list
6786
-	*
6787
-	*/
6783
+	 * Gets all arrival airports by country of the airplanes that have flown over based on an airport icao
6784
+	 *
6785
+	 * @return Array the airport list
6786
+	 *
6787
+	 */
6788 6788
 	public function countAllArrivalAirportCountriesByAirport($airport_icao)
6789 6789
 	{
6790 6790
 		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
@@ -6815,11 +6815,11 @@  discard block
 block discarded – undo
6815 6815
 	
6816 6816
 	
6817 6817
 	/**
6818
-	* Gets all arrival airports of the airplanes that have flown over based on a aircraft manufacturer
6819
-	*
6820
-	* @return Array the airport list
6821
-	*
6822
-	*/
6818
+	 * Gets all arrival airports of the airplanes that have flown over based on a aircraft manufacturer
6819
+	 *
6820
+	 * @return Array the airport list
6821
+	 *
6822
+	 */
6823 6823
 	public function countAllArrivalAirportsByManufacturer($aircraft_manufacturer)
6824 6824
 	{
6825 6825
 		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
@@ -6854,11 +6854,11 @@  discard block
 block discarded – undo
6854 6854
 	
6855 6855
 	
6856 6856
 	/**
6857
-	* Gets all arrival airports by country of the airplanes that have flown over based on a aircraft manufacturer
6858
-	*
6859
-	* @return Array the airport list
6860
-	*
6861
-	*/
6857
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a aircraft manufacturer
6858
+	 *
6859
+	 * @return Array the airport list
6860
+	 *
6861
+	 */
6862 6862
 	public function countAllArrivalAirportCountriesByManufacturer($aircraft_manufacturer)
6863 6863
 	{
6864 6864
 		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
@@ -6890,11 +6890,11 @@  discard block
 block discarded – undo
6890 6890
 	
6891 6891
 	
6892 6892
 	/**
6893
-	* Gets all arrival airports of the airplanes that have flown over based on a date
6894
-	*
6895
-	* @return Array the airport list
6896
-	*
6897
-	*/
6893
+	 * Gets all arrival airports of the airplanes that have flown over based on a date
6894
+	 *
6895
+	 * @return Array the airport list
6896
+	 *
6897
+	 */
6898 6898
 	public function countAllArrivalAirportsByDate($date)
6899 6899
 	{
6900 6900
 		global $globalTimezone, $globalDBdriver;
@@ -6941,11 +6941,11 @@  discard block
 block discarded – undo
6941 6941
 	
6942 6942
 	
6943 6943
 	/**
6944
-	* Gets all arrival airports by country of the airplanes that have flown over based on a date
6945
-	*
6946
-	* @return Array the airport list
6947
-	*
6948
-	*/
6944
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a date
6945
+	 *
6946
+	 * @return Array the airport list
6947
+	 *
6948
+	 */
6949 6949
 	public function countAllArrivalAirportCountriesByDate($date)
6950 6950
 	{
6951 6951
 		global $globalTimezone, $globalDBdriver;
@@ -6989,11 +6989,11 @@  discard block
 block discarded – undo
6989 6989
 	
6990 6990
 	
6991 6991
 	/**
6992
-	* Gets all arrival airports of the airplanes that have flown over based on a ident/callsign
6993
-	*
6994
-	* @return Array the airport list
6995
-	*
6996
-	*/
6992
+	 * Gets all arrival airports of the airplanes that have flown over based on a ident/callsign
6993
+	 *
6994
+	 * @return Array the airport list
6995
+	 *
6996
+	 */
6997 6997
 	public function countAllArrivalAirportsByIdent($ident)
6998 6998
 	{
6999 6999
 		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
@@ -7027,11 +7027,11 @@  discard block
 block discarded – undo
7027 7027
 	
7028 7028
 	
7029 7029
 	/**
7030
-	* Gets all arrival airports by country of the airplanes that have flown over based on a callsign/ident
7031
-	*
7032
-	* @return Array the airport list
7033
-	*
7034
-	*/
7030
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a callsign/ident
7031
+	 *
7032
+	 * @return Array the airport list
7033
+	 *
7034
+	 */
7035 7035
 	public function countAllArrivalAirportCountriesByIdent($ident)
7036 7036
 	{
7037 7037
 		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
@@ -7063,11 +7063,11 @@  discard block
 block discarded – undo
7063 7063
 	
7064 7064
 	
7065 7065
 	/**
7066
-	* Gets all arrival airports of the airplanes that have flown over based on a country
7067
-	*
7068
-	* @return Array the airport list
7069
-	*
7070
-	*/
7066
+	 * Gets all arrival airports of the airplanes that have flown over based on a country
7067
+	 *
7068
+	 * @return Array the airport list
7069
+	 *
7070
+	 */
7071 7071
 	public function countAllArrivalAirportsByCountry($country)
7072 7072
 	{
7073 7073
 		$country = filter_var($country,FILTER_SANITIZE_STRING);
@@ -7101,11 +7101,11 @@  discard block
 block discarded – undo
7101 7101
 	
7102 7102
 	
7103 7103
 	/**
7104
-	* Gets all arrival airports by country of the airplanes that have flown over based on a country
7105
-	*
7106
-	* @return Array the airport list
7107
-	*
7108
-	*/
7104
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a country
7105
+	 *
7106
+	 * @return Array the airport list
7107
+	 *
7108
+	 */
7109 7109
 	public function countAllArrivalAirportCountriesByCountry($country)
7110 7110
 	{
7111 7111
 		$country = filter_var($country,FILTER_SANITIZE_STRING);
@@ -7137,11 +7137,11 @@  discard block
 block discarded – undo
7137 7137
 
7138 7138
 
7139 7139
 	/**
7140
-	* Counts all airport departure countries
7141
-	*
7142
-	* @return Array the airport departure list
7143
-	*
7144
-	*/
7140
+	 * Counts all airport departure countries
7141
+	 *
7142
+	 * @return Array the airport departure list
7143
+	 *
7144
+	 */
7145 7145
 	public function countAllDepartureCountries($filters = array())
7146 7146
 	{
7147 7147
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7171,11 +7171,11 @@  discard block
 block discarded – undo
7171 7171
 	
7172 7172
 	
7173 7173
 	/**
7174
-	* Counts all airport arrival countries
7175
-	*
7176
-	* @return Array the airport arrival list
7177
-	*
7178
-	*/
7174
+	 * Counts all airport arrival countries
7175
+	 *
7176
+	 * @return Array the airport arrival list
7177
+	 *
7178
+	 */
7179 7179
 	public function countAllArrivalCountries($limit = true,$filters = array())
7180 7180
 	{
7181 7181
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7208,11 +7208,11 @@  discard block
 block discarded – undo
7208 7208
 
7209 7209
 
7210 7210
 	/**
7211
-	* Gets all route combinations
7212
-	*
7213
-	* @return Array the route list
7214
-	*
7215
-	*/
7211
+	 * Gets all route combinations
7212
+	 *
7213
+	 * @return Array the route list
7214
+	 *
7215
+	 */
7216 7216
 	public function countAllRoutes()
7217 7217
 	{
7218 7218
 		
@@ -7252,11 +7252,11 @@  discard block
 block discarded – undo
7252 7252
 	
7253 7253
 	
7254 7254
 	/**
7255
-	* Gets all route combinations based on an aircraft
7256
-	*
7257
-	* @return Array the route list
7258
-	*
7259
-	*/
7255
+	 * Gets all route combinations based on an aircraft
7256
+	 *
7257
+	 * @return Array the route list
7258
+	 *
7259
+	 */
7260 7260
 	public function countAllRoutesByAircraft($aircraft_icao)
7261 7261
 	{
7262 7262
 		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
@@ -7294,11 +7294,11 @@  discard block
 block discarded – undo
7294 7294
 	
7295 7295
 	
7296 7296
 	/**
7297
-	* Gets all route combinations based on an aircraft registration
7298
-	*
7299
-	* @return Array the route list
7300
-	*
7301
-	*/
7297
+	 * Gets all route combinations based on an aircraft registration
7298
+	 *
7299
+	 * @return Array the route list
7300
+	 *
7301
+	 */
7302 7302
 	public function countAllRoutesByRegistration($registration)
7303 7303
 	{
7304 7304
 		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
@@ -7337,11 +7337,11 @@  discard block
 block discarded – undo
7337 7337
 	
7338 7338
 	
7339 7339
 	/**
7340
-	* Gets all route combinations based on an airline
7341
-	*
7342
-	* @return Array the route list
7343
-	*
7344
-	*/
7340
+	 * Gets all route combinations based on an airline
7341
+	 *
7342
+	 * @return Array the route list
7343
+	 *
7344
+	 */
7345 7345
 	public function countAllRoutesByAirline($airline_icao)
7346 7346
 	{
7347 7347
 		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
@@ -7380,11 +7380,11 @@  discard block
 block discarded – undo
7380 7380
 	
7381 7381
 	
7382 7382
 	/**
7383
-	* Gets all route combinations based on an airport
7384
-	*
7385
-	* @return Array the route list
7386
-	*
7387
-	*/
7383
+	 * Gets all route combinations based on an airport
7384
+	 *
7385
+	 * @return Array the route list
7386
+	 *
7387
+	 */
7388 7388
 	public function countAllRoutesByAirport($airport_icao)
7389 7389
 	{
7390 7390
 		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
@@ -7423,11 +7423,11 @@  discard block
 block discarded – undo
7423 7423
 	
7424 7424
 	
7425 7425
 	/**
7426
-	* Gets all route combinations based on an country
7427
-	*
7428
-	* @return Array the route list
7429
-	*
7430
-	*/
7426
+	 * Gets all route combinations based on an country
7427
+	 *
7428
+	 * @return Array the route list
7429
+	 *
7430
+	 */
7431 7431
 	public function countAllRoutesByCountry($country)
7432 7432
 	{
7433 7433
 		$country = filter_var($country,FILTER_SANITIZE_STRING);
@@ -7465,11 +7465,11 @@  discard block
 block discarded – undo
7465 7465
 
7466 7466
 
7467 7467
 	/**
7468
-	* Gets all route combinations based on an date
7469
-	*
7470
-	* @return Array the route list
7471
-	*
7472
-	*/
7468
+	 * Gets all route combinations based on an date
7469
+	 *
7470
+	 * @return Array the route list
7471
+	 *
7472
+	 */
7473 7473
 	public function countAllRoutesByDate($date)
7474 7474
 	{
7475 7475
 		global $globalTimezone, $globalDBdriver;
@@ -7520,11 +7520,11 @@  discard block
 block discarded – undo
7520 7520
 	
7521 7521
 	
7522 7522
 	/**
7523
-	* Gets all route combinations based on an ident/callsign
7524
-	*
7525
-	* @return Array the route list
7526
-	*
7527
-	*/
7523
+	 * Gets all route combinations based on an ident/callsign
7524
+	 *
7525
+	 * @return Array the route list
7526
+	 *
7527
+	 */
7528 7528
 	public function countAllRoutesByIdent($ident)
7529 7529
 	{
7530 7530
 		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
@@ -7562,11 +7562,11 @@  discard block
 block discarded – undo
7562 7562
 	
7563 7563
 	
7564 7564
 	/**
7565
-	* Gets all route combinations based on an manufacturer
7566
-	*
7567
-	* @return Array the route list
7568
-	*
7569
-	*/
7565
+	 * Gets all route combinations based on an manufacturer
7566
+	 *
7567
+	 * @return Array the route list
7568
+	 *
7569
+	 */
7570 7570
 	public function countAllRoutesByManufacturer($aircraft_manufacturer)
7571 7571
 	{
7572 7572
 		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
@@ -7605,11 +7605,11 @@  discard block
 block discarded – undo
7605 7605
 	
7606 7606
 	
7607 7607
 	/**
7608
-	* Gets all route combinations with waypoints
7609
-	*
7610
-	* @return Array the route list
7611
-	*
7612
-	*/
7608
+	 * Gets all route combinations with waypoints
7609
+	 *
7610
+	 * @return Array the route list
7611
+	 *
7612
+	 */
7613 7613
 	public function countAllRoutesWithWaypoints()
7614 7614
 	{
7615 7615
 		$query  = "SELECT DISTINCT spotter_output.waypoints AS route, count(spotter_output.waypoints) AS route_count, spotter_output.spotter_id, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
@@ -7649,11 +7649,11 @@  discard block
 block discarded – undo
7649 7649
 	
7650 7650
 	
7651 7651
 	/**
7652
-	* Gets all callsigns that have flown over
7653
-	*
7654
-	* @return Array the callsign list
7655
-	*
7656
-	*/
7652
+	 * Gets all callsigns that have flown over
7653
+	 *
7654
+	 * @return Array the callsign list
7655
+	 *
7656
+	 */
7657 7657
 	public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
7658 7658
 	{
7659 7659
 		global $globalDBdriver;
@@ -7691,11 +7691,11 @@  discard block
 block discarded – undo
7691 7691
 	}
7692 7692
 
7693 7693
 	/**
7694
-	* Gets all callsigns that have flown over
7695
-	*
7696
-	* @return Array the callsign list
7697
-	*
7698
-	*/
7694
+	 * Gets all callsigns that have flown over
7695
+	 *
7696
+	 * @return Array the callsign list
7697
+	 *
7698
+	 */
7699 7699
 	public function countAllCallsignsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '')
7700 7700
 	{
7701 7701
 		global $globalDBdriver;
@@ -7736,11 +7736,11 @@  discard block
 block discarded – undo
7736 7736
 
7737 7737
 
7738 7738
 	/**
7739
-	* Counts all dates
7740
-	*
7741
-	* @return Array the date list
7742
-	*
7743
-	*/
7739
+	 * Counts all dates
7740
+	 *
7741
+	 * @return Array the date list
7742
+	 *
7743
+	 */
7744 7744
 	public function countAllDates($filters = array())
7745 7745
 	{
7746 7746
 		global $globalTimezone, $globalDBdriver;
@@ -7785,11 +7785,11 @@  discard block
 block discarded – undo
7785 7785
 	}
7786 7786
 	
7787 7787
 	/**
7788
-	* Counts all dates
7789
-	*
7790
-	* @return Array the date list
7791
-	*
7792
-	*/
7788
+	 * Counts all dates
7789
+	 *
7790
+	 * @return Array the date list
7791
+	 *
7792
+	 */
7793 7793
 	public function countAllDatesByAirlines()
7794 7794
 	{
7795 7795
 		global $globalTimezone, $globalDBdriver;
@@ -7835,11 +7835,11 @@  discard block
 block discarded – undo
7835 7835
 	}	
7836 7836
 	
7837 7837
 	/**
7838
-	* Counts all dates during the last 7 days
7839
-	*
7840
-	* @return Array the date list
7841
-	*
7842
-	*/
7838
+	 * Counts all dates during the last 7 days
7839
+	 *
7840
+	 * @return Array the date list
7841
+	 *
7842
+	 */
7843 7843
 	public function countAllDatesLast7Days($filters = array())
7844 7844
 	{
7845 7845
 		global $globalTimezone, $globalDBdriver;
@@ -7861,7 +7861,7 @@  discard block
 block discarded – undo
7861 7861
 			$query .= " GROUP BY date_name 
7862 7862
 								ORDER BY date_name ASC";
7863 7863
 			$query_data = array(':offset' => $offset);
7864
-    		}
7864
+			}
7865 7865
 		
7866 7866
 		$sth = $this->db->prepare($query);
7867 7867
 		$sth->execute($query_data);
@@ -7881,11 +7881,11 @@  discard block
 block discarded – undo
7881 7881
 	}
7882 7882
 
7883 7883
 	/**
7884
-	* Counts all dates during the last month
7885
-	*
7886
-	* @return Array the date list
7887
-	*
7888
-	*/
7884
+	 * Counts all dates during the last month
7885
+	 *
7886
+	 * @return Array the date list
7887
+	 *
7888
+	 */
7889 7889
 	public function countAllDatesLastMonth($filters = array())
7890 7890
 	{
7891 7891
 		global $globalTimezone, $globalDBdriver;
@@ -7907,7 +7907,7 @@  discard block
 block discarded – undo
7907 7907
 			$query .= " GROUP BY date_name 
7908 7908
 								ORDER BY date_name ASC";
7909 7909
 			$query_data = array(':offset' => $offset);
7910
-    		}
7910
+			}
7911 7911
 		
7912 7912
 		$sth = $this->db->prepare($query);
7913 7913
 		$sth->execute($query_data);
@@ -7928,11 +7928,11 @@  discard block
 block discarded – undo
7928 7928
 
7929 7929
 
7930 7930
 	/**
7931
-	* Counts all dates during the last month
7932
-	*
7933
-	* @return Array the date list
7934
-	*
7935
-	*/
7931
+	 * Counts all dates during the last month
7932
+	 *
7933
+	 * @return Array the date list
7934
+	 *
7935
+	 */
7936 7936
 	public function countAllDatesLastMonthByAirlines()
7937 7937
 	{
7938 7938
 		global $globalTimezone, $globalDBdriver;
@@ -7956,7 +7956,7 @@  discard block
 block discarded – undo
7956 7956
 								GROUP BY spotter_output.airline_icao, date_name 
7957 7957
 								ORDER BY date_name ASC";
7958 7958
 			$query_data = array(':offset' => $offset);
7959
-    		}
7959
+			}
7960 7960
 		
7961 7961
 		$sth = $this->db->prepare($query);
7962 7962
 		$sth->execute($query_data);
@@ -7978,11 +7978,11 @@  discard block
 block discarded – undo
7978 7978
 	
7979 7979
 
7980 7980
 	/**
7981
-	* Counts all month
7982
-	*
7983
-	* @return Array the month list
7984
-	*
7985
-	*/
7981
+	 * Counts all month
7982
+	 *
7983
+	 * @return Array the month list
7984
+	 *
7985
+	 */
7986 7986
 	public function countAllMonths($filters = array())
7987 7987
 	{
7988 7988
 		global $globalTimezone, $globalDBdriver;
@@ -8026,11 +8026,11 @@  discard block
 block discarded – undo
8026 8026
 	}
8027 8027
 
8028 8028
 	/**
8029
-	* Counts all month
8030
-	*
8031
-	* @return Array the month list
8032
-	*
8033
-	*/
8029
+	 * Counts all month
8030
+	 *
8031
+	 * @return Array the month list
8032
+	 *
8033
+	 */
8034 8034
 	public function countAllMonthsByAirlines()
8035 8035
 	{
8036 8036
 		global $globalTimezone, $globalDBdriver;
@@ -8075,11 +8075,11 @@  discard block
 block discarded – undo
8075 8075
 	}
8076 8076
 
8077 8077
 	/**
8078
-	* Counts all military month
8079
-	*
8080
-	* @return Array the month list
8081
-	*
8082
-	*/
8078
+	 * Counts all military month
8079
+	 *
8080
+	 * @return Array the month list
8081
+	 *
8082
+	 */
8083 8083
 	public function countAllMilitaryMonths()
8084 8084
 	{
8085 8085
 		global $globalTimezone, $globalDBdriver;
@@ -8122,11 +8122,11 @@  discard block
 block discarded – undo
8122 8122
 	}
8123 8123
 	
8124 8124
 	/**
8125
-	* Counts all month owners
8126
-	*
8127
-	* @return Array the month list
8128
-	*
8129
-	*/
8125
+	 * Counts all month owners
8126
+	 *
8127
+	 * @return Array the month list
8128
+	 *
8129
+	 */
8130 8130
 	public function countAllMonthsOwners()
8131 8131
 	{
8132 8132
 		global $globalTimezone, $globalDBdriver;
@@ -8169,11 +8169,11 @@  discard block
 block discarded – undo
8169 8169
 	}
8170 8170
 	
8171 8171
 	/**
8172
-	* Counts all month owners
8173
-	*
8174
-	* @return Array the month list
8175
-	*
8176
-	*/
8172
+	 * Counts all month owners
8173
+	 *
8174
+	 * @return Array the month list
8175
+	 *
8176
+	 */
8177 8177
 	public function countAllMonthsOwnersByAirlines()
8178 8178
 	{
8179 8179
 		global $globalTimezone, $globalDBdriver;
@@ -8217,11 +8217,11 @@  discard block
 block discarded – undo
8217 8217
 	}
8218 8218
 
8219 8219
 	/**
8220
-	* Counts all month pilot
8221
-	*
8222
-	* @return Array the month list
8223
-	*
8224
-	*/
8220
+	 * Counts all month pilot
8221
+	 *
8222
+	 * @return Array the month list
8223
+	 *
8224
+	 */
8225 8225
 	public function countAllMonthsPilots()
8226 8226
 	{
8227 8227
 		global $globalTimezone, $globalDBdriver;
@@ -8264,11 +8264,11 @@  discard block
 block discarded – undo
8264 8264
 	}
8265 8265
 	
8266 8266
 	/**
8267
-	* Counts all month pilot
8268
-	*
8269
-	* @return Array the month list
8270
-	*
8271
-	*/
8267
+	 * Counts all month pilot
8268
+	 *
8269
+	 * @return Array the month list
8270
+	 *
8271
+	 */
8272 8272
 	public function countAllMonthsPilotsByAirlines()
8273 8273
 	{
8274 8274
 		global $globalTimezone, $globalDBdriver;
@@ -8312,11 +8312,11 @@  discard block
 block discarded – undo
8312 8312
 	}
8313 8313
 
8314 8314
 	/**
8315
-	* Counts all month airline
8316
-	*
8317
-	* @return Array the month list
8318
-	*
8319
-	*/
8315
+	 * Counts all month airline
8316
+	 *
8317
+	 * @return Array the month list
8318
+	 *
8319
+	 */
8320 8320
 	public function countAllMonthsAirlines()
8321 8321
 	{
8322 8322
 		global $globalTimezone, $globalDBdriver;
@@ -8359,11 +8359,11 @@  discard block
 block discarded – undo
8359 8359
 	}
8360 8360
 	
8361 8361
 	/**
8362
-	* Counts all month aircraft
8363
-	*
8364
-	* @return Array the month list
8365
-	*
8366
-	*/
8362
+	 * Counts all month aircraft
8363
+	 *
8364
+	 * @return Array the month list
8365
+	 *
8366
+	 */
8367 8367
 	public function countAllMonthsAircrafts()
8368 8368
 	{
8369 8369
 		global $globalTimezone, $globalDBdriver;
@@ -8407,11 +8407,11 @@  discard block
 block discarded – undo
8407 8407
 	
8408 8408
 
8409 8409
 	/**
8410
-	* Counts all month aircraft
8411
-	*
8412
-	* @return Array the month list
8413
-	*
8414
-	*/
8410
+	 * Counts all month aircraft
8411
+	 *
8412
+	 * @return Array the month list
8413
+	 *
8414
+	 */
8415 8415
 	public function countAllMonthsAircraftsByAirlines()
8416 8416
 	{
8417 8417
 		global $globalTimezone, $globalDBdriver;
@@ -8455,11 +8455,11 @@  discard block
 block discarded – undo
8455 8455
 	}
8456 8456
 
8457 8457
 	/**
8458
-	* Counts all month real arrival
8459
-	*
8460
-	* @return Array the month list
8461
-	*
8462
-	*/
8458
+	 * Counts all month real arrival
8459
+	 *
8460
+	 * @return Array the month list
8461
+	 *
8462
+	 */
8463 8463
 	public function countAllMonthsRealArrivals()
8464 8464
 	{
8465 8465
 		global $globalTimezone, $globalDBdriver;
@@ -8503,11 +8503,11 @@  discard block
 block discarded – undo
8503 8503
 	
8504 8504
 
8505 8505
 	/**
8506
-	* Counts all month real arrival
8507
-	*
8508
-	* @return Array the month list
8509
-	*
8510
-	*/
8506
+	 * Counts all month real arrival
8507
+	 *
8508
+	 * @return Array the month list
8509
+	 *
8510
+	 */
8511 8511
 	public function countAllMonthsRealArrivalsByAirlines()
8512 8512
 	{
8513 8513
 		global $globalTimezone, $globalDBdriver;
@@ -8552,11 +8552,11 @@  discard block
 block discarded – undo
8552 8552
 	
8553 8553
 
8554 8554
 	/**
8555
-	* Counts all dates during the last year
8556
-	*
8557
-	* @return Array the date list
8558
-	*
8559
-	*/
8555
+	 * Counts all dates during the last year
8556
+	 *
8557
+	 * @return Array the date list
8558
+	 *
8559
+	 */
8560 8560
 	public function countAllMonthsLastYear($filters)
8561 8561
 	{
8562 8562
 		global $globalTimezone, $globalDBdriver;
@@ -8578,7 +8578,7 @@  discard block
 block discarded – undo
8578 8578
 			$query .= " GROUP BY year_name, month_name
8579 8579
 								ORDER BY year_name, month_name ASC";
8580 8580
 			$query_data = array(':offset' => $offset);
8581
-    		}
8581
+			}
8582 8582
 		
8583 8583
 		$sth = $this->db->prepare($query);
8584 8584
 		$sth->execute($query_data);
@@ -8601,11 +8601,11 @@  discard block
 block discarded – undo
8601 8601
 	
8602 8602
 	
8603 8603
 	/**
8604
-	* Counts all hours
8605
-	*
8606
-	* @return Array the hour list
8607
-	*
8608
-	*/
8604
+	 * Counts all hours
8605
+	 *
8606
+	 * @return Array the hour list
8607
+	 *
8608
+	 */
8609 8609
 	public function countAllHours($orderby,$filters = array())
8610 8610
 	{
8611 8611
 		global $globalTimezone, $globalDBdriver;
@@ -8666,11 +8666,11 @@  discard block
 block discarded – undo
8666 8666
 	}
8667 8667
 	
8668 8668
 	/**
8669
-	* Counts all hours
8670
-	*
8671
-	* @return Array the hour list
8672
-	*
8673
-	*/
8669
+	 * Counts all hours
8670
+	 *
8671
+	 * @return Array the hour list
8672
+	 *
8673
+	 */
8674 8674
 	public function countAllHoursByAirlines($orderby)
8675 8675
 	{
8676 8676
 		global $globalTimezone, $globalDBdriver;
@@ -8734,11 +8734,11 @@  discard block
 block discarded – undo
8734 8734
 
8735 8735
 
8736 8736
 	/**
8737
-	* Counts all hours by airline
8738
-	*
8739
-	* @return Array the hour list
8740
-	*
8741
-	*/
8737
+	 * Counts all hours by airline
8738
+	 *
8739
+	 * @return Array the hour list
8740
+	 *
8741
+	 */
8742 8742
 	public function countAllHoursByAirline($airline_icao)
8743 8743
 	{
8744 8744
 		global $globalTimezone, $globalDBdriver;
@@ -8785,11 +8785,11 @@  discard block
 block discarded – undo
8785 8785
 	
8786 8786
 	
8787 8787
 	/**
8788
-	* Counts all hours by aircraft
8789
-	*
8790
-	* @return Array the hour list
8791
-	*
8792
-	*/
8788
+	 * Counts all hours by aircraft
8789
+	 *
8790
+	 * @return Array the hour list
8791
+	 *
8792
+	 */
8793 8793
 	public function countAllHoursByAircraft($aircraft_icao)
8794 8794
 	{
8795 8795
 		global $globalTimezone, $globalDBdriver;
@@ -8833,11 +8833,11 @@  discard block
 block discarded – undo
8833 8833
 	
8834 8834
 	
8835 8835
 	/**
8836
-	* Counts all hours by aircraft registration
8837
-	*
8838
-	* @return Array the hour list
8839
-	*
8840
-	*/
8836
+	 * Counts all hours by aircraft registration
8837
+	 *
8838
+	 * @return Array the hour list
8839
+	 *
8840
+	 */
8841 8841
 	public function countAllHoursByRegistration($registration)
8842 8842
 	{
8843 8843
 		global $globalTimezone, $globalDBdriver;
@@ -8881,11 +8881,11 @@  discard block
 block discarded – undo
8881 8881
 	
8882 8882
 	
8883 8883
 	/**
8884
-	* Counts all hours by airport
8885
-	*
8886
-	* @return Array the hour list
8887
-	*
8888
-	*/
8884
+	 * Counts all hours by airport
8885
+	 *
8886
+	 * @return Array the hour list
8887
+	 *
8888
+	 */
8889 8889
 	public function countAllHoursByAirport($airport_icao)
8890 8890
 	{
8891 8891
 		global $globalTimezone, $globalDBdriver;
@@ -8930,11 +8930,11 @@  discard block
 block discarded – undo
8930 8930
 	
8931 8931
 	
8932 8932
 	/**
8933
-	* Counts all hours by manufacturer
8934
-	*
8935
-	* @return Array the hour list
8936
-	*
8937
-	*/
8933
+	 * Counts all hours by manufacturer
8934
+	 *
8935
+	 * @return Array the hour list
8936
+	 *
8937
+	 */
8938 8938
 	public function countAllHoursByManufacturer($aircraft_manufacturer)
8939 8939
 	{
8940 8940
 		global $globalTimezone, $globalDBdriver;
@@ -8979,11 +8979,11 @@  discard block
 block discarded – undo
8979 8979
 	
8980 8980
 	
8981 8981
 	/**
8982
-	* Counts all hours by date
8983
-	*
8984
-	* @return Array the hour list
8985
-	*
8986
-	*/
8982
+	 * Counts all hours by date
8983
+	 *
8984
+	 * @return Array the hour list
8985
+	 *
8986
+	 */
8987 8987
 	public function countAllHoursByDate($date)
8988 8988
 	{
8989 8989
 		global $globalTimezone, $globalDBdriver;
@@ -9028,11 +9028,11 @@  discard block
 block discarded – undo
9028 9028
 	
9029 9029
 	
9030 9030
 	/**
9031
-	* Counts all hours by a ident/callsign
9032
-	*
9033
-	* @return Array the hour list
9034
-	*
9035
-	*/
9031
+	 * Counts all hours by a ident/callsign
9032
+	 *
9033
+	 * @return Array the hour list
9034
+	 *
9035
+	 */
9036 9036
 	public function countAllHoursByIdent($ident)
9037 9037
 	{
9038 9038
 		global $globalTimezone, $globalDBdriver;
@@ -9078,11 +9078,11 @@  discard block
 block discarded – undo
9078 9078
 	
9079 9079
 	
9080 9080
 	/**
9081
-	* Counts all hours by route
9082
-	*
9083
-	* @return Array the hour list
9084
-	*
9085
-	*/
9081
+	 * Counts all hours by route
9082
+	 *
9083
+	 * @return Array the hour list
9084
+	 *
9085
+	 */
9086 9086
 	public function countAllHoursByRoute($departure_airport_icao, $arrival_airport_icao)
9087 9087
 	{
9088 9088
 		global $globalTimezone, $globalDBdriver;
@@ -9127,11 +9127,11 @@  discard block
 block discarded – undo
9127 9127
 	
9128 9128
 	
9129 9129
 	/**
9130
-	* Counts all hours by country
9131
-	*
9132
-	* @return Array the hour list
9133
-	*
9134
-	*/
9130
+	 * Counts all hours by country
9131
+	 *
9132
+	 * @return Array the hour list
9133
+	 *
9134
+	 */
9135 9135
 	public function countAllHoursByCountry($country)
9136 9136
 	{
9137 9137
 		global $globalTimezone, $globalDBdriver;
@@ -9177,11 +9177,11 @@  discard block
 block discarded – undo
9177 9177
 
9178 9178
 
9179 9179
 	/**
9180
-	* Counts all aircraft that have flown over
9181
-	*
9182
-	* @return Integer the number of aircrafts
9183
-	*
9184
-	*/
9180
+	 * Counts all aircraft that have flown over
9181
+	 *
9182
+	 * @return Integer the number of aircrafts
9183
+	 *
9184
+	 */
9185 9185
 	public function countOverallAircrafts($filters = array())
9186 9186
 	{
9187 9187
 		$filter_query = $this->getFilter($filters,true,true);
@@ -9193,11 +9193,11 @@  discard block
 block discarded – undo
9193 9193
 	}
9194 9194
 
9195 9195
 	/**
9196
-	* Counts all flight that really arrival
9197
-	*
9198
-	* @return Integer the number of aircrafts
9199
-	*
9200
-	*/
9196
+	 * Counts all flight that really arrival
9197
+	 *
9198
+	 * @return Integer the number of aircrafts
9199
+	 *
9200
+	 */
9201 9201
 	public function countOverallArrival($filters = array())
9202 9202
 	{
9203 9203
 		$filter_query = $this->getFilter($filters,true,true);
@@ -9210,11 +9210,11 @@  discard block
 block discarded – undo
9210 9210
 	}
9211 9211
 
9212 9212
 	/**
9213
-	* Counts all pilots that have flown over
9214
-	*
9215
-	* @return Integer the number of pilots
9216
-	*
9217
-	*/
9213
+	 * Counts all pilots that have flown over
9214
+	 *
9215
+	 * @return Integer the number of pilots
9216
+	 *
9217
+	 */
9218 9218
 	public function countOverallPilots($filters = array())
9219 9219
 	{
9220 9220
 		$filter_query = $this->getFilter($filters,true,true);
@@ -9226,11 +9226,11 @@  discard block
 block discarded – undo
9226 9226
 	}
9227 9227
 
9228 9228
 	/**
9229
-	* Counts all owners that have flown over
9230
-	*
9231
-	* @return Integer the number of owners
9232
-	*
9233
-	*/
9229
+	 * Counts all owners that have flown over
9230
+	 *
9231
+	 * @return Integer the number of owners
9232
+	 *
9233
+	 */
9234 9234
 	public function countOverallOwners($filters = array())
9235 9235
 	{
9236 9236
 		$filter_query = $this->getFilter($filters,true,true);
@@ -9243,11 +9243,11 @@  discard block
 block discarded – undo
9243 9243
 	
9244 9244
 	
9245 9245
 	/**
9246
-	* Counts all flights that have flown over
9247
-	*
9248
-	* @return Integer the number of flights
9249
-	*
9250
-	*/
9246
+	 * Counts all flights that have flown over
9247
+	 *
9248
+	 * @return Integer the number of flights
9249
+	 *
9250
+	 */
9251 9251
 	public function countOverallFlights($filters = array())
9252 9252
 	{
9253 9253
 		$query  = "SELECT COUNT(spotter_output.spotter_id) AS flight_count  
@@ -9260,11 +9260,11 @@  discard block
 block discarded – undo
9260 9260
 	}
9261 9261
 	
9262 9262
 	/**
9263
-	* Counts all military flights that have flown over
9264
-	*
9265
-	* @return Integer the number of flights
9266
-	*
9267
-	*/
9263
+	 * Counts all military flights that have flown over
9264
+	 *
9265
+	 * @return Integer the number of flights
9266
+	 *
9267
+	 */
9268 9268
 	public function countOverallMilitaryFlights($filters = array())
9269 9269
 	{
9270 9270
 		$filter_query = $this->getFilter($filters,true,true);
@@ -9279,11 +9279,11 @@  discard block
 block discarded – undo
9279 9279
 	
9280 9280
 	
9281 9281
 	/**
9282
-	* Counts all airlines that have flown over
9283
-	*
9284
-	* @return Integer the number of airlines
9285
-	*
9286
-	*/
9282
+	 * Counts all airlines that have flown over
9283
+	 *
9284
+	 * @return Integer the number of airlines
9285
+	 *
9286
+	 */
9287 9287
 	public function countOverallAirlines($filters = array())
9288 9288
 	{
9289 9289
 		$query  = "SELECT COUNT(DISTINCT spotter_output.airline_name) AS airline_count 
@@ -9297,11 +9297,11 @@  discard block
 block discarded – undo
9297 9297
 
9298 9298
   
9299 9299
 	/**
9300
-	* Counts all hours of today
9301
-	*
9302
-	* @return Array the hour list
9303
-	*
9304
-	*/
9300
+	 * Counts all hours of today
9301
+	 *
9302
+	 * @return Array the hour list
9303
+	 *
9304
+	 */
9305 9305
 	public function countAllHoursFromToday()
9306 9306
 	{
9307 9307
 		global $globalTimezone, $globalDBdriver;
@@ -9342,11 +9342,11 @@  discard block
 block discarded – undo
9342 9342
 	}
9343 9343
     
9344 9344
 	/**
9345
-	* Gets all the spotter information based on calculated upcoming flights
9346
-	*
9347
-	* @return Array the spotter information
9348
-	*
9349
-	*/
9345
+	 * Gets all the spotter information based on calculated upcoming flights
9346
+	 *
9347
+	 * @return Array the spotter information
9348
+	 *
9349
+	 */
9350 9350
 	public function getUpcomingFlights($limit = '', $sort = '')
9351 9351
 	{
9352 9352
 		global $global_query, $globalDBdriver, $globalTimezone;
@@ -9422,12 +9422,12 @@  discard block
 block discarded – undo
9422 9422
 	}
9423 9423
     
9424 9424
     
9425
-     /**
9426
-	* Gets the Barrie Spotter ID based on the FlightAware ID
9427
-	*
9428
-	* @return Integer the Barrie Spotter ID
9425
+	 /**
9426
+	  * Gets the Barrie Spotter ID based on the FlightAware ID
9427
+	  *
9428
+	  * @return Integer the Barrie Spotter ID
9429 9429
 q	*
9430
-	*/
9430
+	  */
9431 9431
 	public function getSpotterIDBasedOnFlightAwareID($flightaware_id)
9432 9432
 	{
9433 9433
 		$flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING);
@@ -9448,13 +9448,13 @@  discard block
 block discarded – undo
9448 9448
   
9449 9449
  
9450 9450
 	/**
9451
-	* Parses a date string
9452
-	*
9453
-	* @param String $dateString the date string
9454
-	* @param String $timezone the timezone of a user
9455
-	* @return Array the time information
9456
-	*
9457
-	*/
9451
+	 * Parses a date string
9452
+	 *
9453
+	 * @param String $dateString the date string
9454
+	 * @param String $timezone the timezone of a user
9455
+	 * @return Array the time information
9456
+	 *
9457
+	 */
9458 9458
 	public function parseDateString($dateString, $timezone = '')
9459 9459
 	{
9460 9460
 		$time_array = array();
@@ -9490,12 +9490,12 @@  discard block
 block discarded – undo
9490 9490
 	
9491 9491
 	
9492 9492
 	/**
9493
-	* Parses the direction degrees to working
9494
-	*
9495
-	* @param Float $direction the direction in degrees
9496
-	* @return Array the direction information
9497
-	*
9498
-	*/
9493
+	 * Parses the direction degrees to working
9494
+	 *
9495
+	 * @param Float $direction the direction in degrees
9496
+	 * @return Array the direction information
9497
+	 *
9498
+	 */
9499 9499
 	public function parseDirection($direction = 0)
9500 9500
 	{
9501 9501
 		if ($direction == '') $direction = 0;
@@ -9574,12 +9574,12 @@  discard block
 block discarded – undo
9574 9574
 	
9575 9575
 	
9576 9576
 	/**
9577
-	* Gets the aircraft registration
9578
-	*
9579
-	* @param String $flightaware_id the flight aware id
9580
-	* @return String the aircraft registration
9581
-	*
9582
-	*/
9577
+	 * Gets the aircraft registration
9578
+	 *
9579
+	 * @param String $flightaware_id the flight aware id
9580
+	 * @return String the aircraft registration
9581
+	 *
9582
+	 */
9583 9583
 	
9584 9584
 	public function getAircraftRegistration($flightaware_id)
9585 9585
 	{
@@ -9608,12 +9608,12 @@  discard block
 block discarded – undo
9608 9608
 
9609 9609
 
9610 9610
 	/**
9611
-	* Gets the aircraft registration from ModeS
9612
-	*
9613
-	* @param String $aircraft_modes the flight ModeS in hex
9614
-	* @return String the aircraft registration
9615
-	*
9616
-	*/
9611
+	 * Gets the aircraft registration from ModeS
9612
+	 *
9613
+	 * @param String $aircraft_modes the flight ModeS in hex
9614
+	 * @return String the aircraft registration
9615
+	 *
9616
+	 */
9617 9617
 	public function getAircraftRegistrationBymodeS($aircraft_modes)
9618 9618
 	{
9619 9619
 		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
@@ -9625,19 +9625,19 @@  discard block
 block discarded – undo
9625 9625
     
9626 9626
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
9627 9627
 		if (count($row) > 0) {
9628
-		    //return $row['Registration'];
9629
-		    return $row['registration'];
9628
+			//return $row['Registration'];
9629
+			return $row['registration'];
9630 9630
 		} else return '';
9631 9631
 	
9632 9632
 	}
9633 9633
 
9634 9634
 	/**
9635
-	* Gets the aircraft type from ModeS
9636
-	*
9637
-	* @param String $aircraft_modes the flight ModeS in hex
9638
-	* @return String the aircraft type
9639
-	*
9640
-	*/
9635
+	 * Gets the aircraft type from ModeS
9636
+	 *
9637
+	 * @param String $aircraft_modes the flight ModeS in hex
9638
+	 * @return String the aircraft type
9639
+	 *
9640
+	 */
9641 9641
 	public function getAircraftTypeBymodeS($aircraft_modes)
9642 9642
 	{
9643 9643
 		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
@@ -9649,19 +9649,19 @@  discard block
 block discarded – undo
9649 9649
     
9650 9650
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
9651 9651
 		if (count($row) > 0) {
9652
-		    if ($row['type_flight'] == null) return '';
9653
-		    else return $row['type_flight'];
9652
+			if ($row['type_flight'] == null) return '';
9653
+			else return $row['type_flight'];
9654 9654
 		} else return '';
9655 9655
 	
9656 9656
 	}
9657 9657
 
9658 9658
 	/**
9659
-	* Gets Countrie from latitude/longitude
9660
-	*
9661
-	* @param Float $latitude latitute of the flight
9662
-	* @param Float $longitude longitute of the flight
9663
-	* @return String the countrie
9664
-	*/
9659
+	 * Gets Countrie from latitude/longitude
9660
+	 *
9661
+	 * @param Float $latitude latitute of the flight
9662
+	 * @param Float $longitude longitute of the flight
9663
+	 * @return String the countrie
9664
+	 */
9665 9665
 	public function getCountryFromLatitudeLongitude($latitude,$longitude)
9666 9666
 	{
9667 9667
 		global $globalDBdriver, $globalDebug;
@@ -9694,12 +9694,12 @@  discard block
 block discarded – undo
9694 9694
 	}
9695 9695
 
9696 9696
 	/**
9697
-	* converts the registration code using the country prefix
9698
-	*
9699
-	* @param String $registration the aircraft registration
9700
-	* @return String the aircraft registration
9701
-	*
9702
-	*/
9697
+	 * converts the registration code using the country prefix
9698
+	 *
9699
+	 * @param String $registration the aircraft registration
9700
+	 * @return String the aircraft registration
9701
+	 *
9702
+	 */
9703 9703
 	public function convertAircraftRegistration($registration)
9704 9704
 	{
9705 9705
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -9751,12 +9751,12 @@  discard block
 block discarded – undo
9751 9751
 	}
9752 9752
 
9753 9753
 	/**
9754
-	* Country from the registration code
9755
-	*
9756
-	* @param String $registration the aircraft registration
9757
-	* @return String the country
9758
-	*
9759
-	*/
9754
+	 * Country from the registration code
9755
+	 *
9756
+	 * @param String $registration the aircraft registration
9757
+	 * @return String the country
9758
+	 *
9759
+	 */
9760 9760
 	public function countryFromAircraftRegistration($registration)
9761 9761
 	{
9762 9762
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -9775,8 +9775,8 @@  discard block
 block discarded – undo
9775 9775
 				$country = $row['country'];
9776 9776
 			}
9777 9777
 		} else {
9778
-    			$registration_1 = substr($registration, 0, 1);
9779
-		        $registration_2 = substr($registration, 0, 2);
9778
+				$registration_1 = substr($registration, 0, 1);
9779
+				$registration_2 = substr($registration, 0, 2);
9780 9780
 
9781 9781
 			$country = '';
9782 9782
 			//first get the prefix based on two characters
@@ -9812,11 +9812,11 @@  discard block
 block discarded – undo
9812 9812
 	}
9813 9813
 	
9814 9814
 	/**
9815
-	* Set a new highlight value for a flight
9816
-	*
9817
-	* @param String $flightaware_id flightaware_id from spotter_output table
9818
-	* @param String $highlight New highlight value
9819
-	*/
9815
+	 * Set a new highlight value for a flight
9816
+	 *
9817
+	 * @param String $flightaware_id flightaware_id from spotter_output table
9818
+	 * @param String $highlight New highlight value
9819
+	 */
9820 9820
 	public function setHighlightFlight($flightaware_id,$highlight) {
9821 9821
 		
9822 9822
 		$query  = "UPDATE spotter_output SET highlight = :highlight WHERE flightaware_id = :flightaware_id";
@@ -9825,12 +9825,12 @@  discard block
 block discarded – undo
9825 9825
 	}
9826 9826
 	
9827 9827
 	/**
9828
-	* Gets the short url from bit.ly
9829
-	*
9830
-	* @param String $url the full url
9831
-	* @return String the bit.ly url
9832
-	*
9833
-	*/
9828
+	 * Gets the short url from bit.ly
9829
+	 *
9830
+	 * @param String $url the full url
9831
+	 * @return String the bit.ly url
9832
+	 *
9833
+	 */
9834 9834
 	public function getBitlyURL($url)
9835 9835
 	{
9836 9836
 		global $globalBitlyAccessToken;
@@ -10119,11 +10119,11 @@  discard block
 block discarded – undo
10119 10119
 			$query="SELECT name, icao, latitude, longitude, altitude, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(latitude*pi()/180)*POWER(SIN(($origLon-longitude)*pi()/180/2),2))) as distance 
10120 10120
 	                      FROM airport WHERE longitude between ($origLon-$dist/cos(radians($origLat))*69) and ($origLon+$dist/cos(radians($origLat)*69)) and latitude between ($origLat-($dist/69)) and ($origLat+($dist/69)) 
10121 10121
 	                      AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(latitude*pi()/180)*POWER(SIN(($origLon-longitude)*pi()/180/2),2)))) < $dist ORDER BY distance limit 100;";
10122
-                } else {
10122
+				} else {
10123 10123
 			$query="SELECT name, icao, latitude, longitude, altitude, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(longitude as double precision))*pi()/180/2),2))) as distance 
10124 10124
 	                      FROM airport WHERE CAST(longitude as double precision) between ($origLon-$dist/cos(radians($origLat))*69) and ($origLon+$dist/cos(radians($origLat))*69) and CAST(latitude as double precision) between ($origLat-($dist/69)) and ($origLat+($dist/69)) 
10125 10125
 	                      AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(longitude as double precision))*pi()/180/2),2)))) < $dist ORDER BY distance limit 100;";
10126
-    		}
10126
+			}
10127 10127
 		$sth = $this->db->prepare($query);
10128 10128
 		$sth->execute();
10129 10129
 		return $sth->fetchAll(PDO::FETCH_ASSOC);
Please login to merge, or discard this patch.
Doc Comments   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 	/**
16 16
 	* Get SQL query part for filter used
17 17
 	* @param Array $filter the filter
18
-	* @return Array the SQL part
18
+	* @return string the SQL part
19 19
 	*/
20 20
 	public function getFilter($filter = array(),$where = false,$and = false) {
21 21
 		global $globalFilter;
@@ -8612,6 +8612,7 @@  discard block
 block discarded – undo
8612 8612
 	/**
8613 8613
 	* Counts all hours
8614 8614
 	*
8615
+	* @param string $orderby
8615 8616
 	* @return Array the hour list
8616 8617
 	*
8617 8618
 	*/
@@ -8677,6 +8678,7 @@  discard block
 block discarded – undo
8677 8678
 	/**
8678 8679
 	* Counts all hours
8679 8680
 	*
8681
+	* @param string $orderby
8680 8682
 	* @return Array the hour list
8681 8683
 	*
8682 8684
 	*/
@@ -9501,7 +9503,7 @@  discard block
 block discarded – undo
9501 9503
 	/**
9502 9504
 	* Parses the direction degrees to working
9503 9505
 	*
9504
-	* @param Float $direction the direction in degrees
9506
+	* @param integer $direction the direction in degrees
9505 9507
 	* @return Array the direction information
9506 9508
 	*
9507 9509
 	*/
Please login to merge, or discard this patch.
Braces   +658 added lines, -228 removed lines patch added patch discarded remove patch
@@ -19,7 +19,9 @@  discard block
 block discarded – undo
19 19
 	*/
20 20
 	public function getFilter($filter = array(),$where = false,$and = false) {
21 21
 		global $globalFilter;
22
-		if (is_array($globalFilter)) $filter = array_merge($globalFilter,$filter);
22
+		if (is_array($globalFilter)) {
23
+			$filter = array_merge($globalFilter,$filter);
24
+		}
23 25
 		$filter_query_join = '';
24 26
 		$filter_query_where = '';
25 27
 		if (isset($filter['airlines']) && !empty($filter['airlines'])) {
@@ -44,8 +46,11 @@  discard block
 block discarded – undo
44 46
 				$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
45 47
 			}
46 48
 		}
47
-		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
48
-		elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND';
49
+		if ($filter_query_where == '' && $where) {
50
+			$filter_query_where = ' WHERE';
51
+		} elseif ($filter_query_where != '' && $and) {
52
+			$filter_query_where .= ' AND';
53
+		}
49 54
 		$filter_query = $filter_query_join.$filter_query_where;
50 55
 		return $filter_query;
51 56
 	}
@@ -65,10 +70,18 @@  discard block
 block discarded – undo
65 70
 		$Image = new Image($this->db);
66 71
 		$Schedule = new Schedule($this->db);
67 72
 		$ACARS = new ACARS($this->db);
68
-		if (!isset($globalIVAO)) $globalIVAO = FALSE;
69
-		if (!isset($globalVATSIM)) $globalVATSIM = FALSE;
70
-		if (!isset($globalphpVMS)) $globalphpVMS = FALSE;
71
-		if (!isset($globalVAM)) $globalVAM = FALSE;
73
+		if (!isset($globalIVAO)) {
74
+			$globalIVAO = FALSE;
75
+		}
76
+		if (!isset($globalVATSIM)) {
77
+			$globalVATSIM = FALSE;
78
+		}
79
+		if (!isset($globalphpVMS)) {
80
+			$globalphpVMS = FALSE;
81
+		}
82
+		if (!isset($globalVAM)) {
83
+			$globalVAM = FALSE;
84
+		}
72 85
 		date_default_timezone_set('UTC');
73 86
 		
74 87
 		if (!is_string($query))
@@ -115,21 +128,35 @@  discard block
 block discarded – undo
115 128
 			} else {
116 129
 				$temp_array['spotter_id'] = '';
117 130
 			}
118
-			if (isset($row['flightaware_id'])) $temp_array['flightaware_id'] = $row['flightaware_id'];
119
-			if (isset($row['modes'])) $temp_array['modes'] = $row['modes'];
131
+			if (isset($row['flightaware_id'])) {
132
+				$temp_array['flightaware_id'] = $row['flightaware_id'];
133
+			}
134
+			if (isset($row['modes'])) {
135
+				$temp_array['modes'] = $row['modes'];
136
+			}
120 137
 			$temp_array['ident'] = $row['ident'];
121 138
 			if (isset($row['registration']) && $row['registration'] != '') {
122 139
 				$temp_array['registration'] = $row['registration'];
123 140
 			} elseif (isset($temp_array['modes'])) {
124 141
 				$temp_array['registration'] = $this->getAircraftRegistrationBymodeS($temp_array['modes']);
125
-			} else $temp_array['registration'] = '';
126
-			if (isset($row['aircraft_icao'])) $temp_array['aircraft_type'] = $row['aircraft_icao'];
142
+			} else {
143
+				$temp_array['registration'] = '';
144
+			}
145
+			if (isset($row['aircraft_icao'])) {
146
+				$temp_array['aircraft_type'] = $row['aircraft_icao'];
147
+			}
127 148
 			
128 149
 			$temp_array['departure_airport'] = $row['departure_airport_icao'];
129 150
 			$temp_array['arrival_airport'] = $row['arrival_airport_icao'];
130
-			if (isset($row['real_arrival_airport_icao']) && $row['real_arrival_airport_icao'] != NULL) $temp_array['real_arrival_airport'] = $row['real_arrival_airport_icao'];
131
-			if (isset($row['latitude'])) $temp_array['latitude'] = $row['latitude'];
132
-			if (isset($row['longitude'])) $temp_array['longitude'] = $row['longitude'];
151
+			if (isset($row['real_arrival_airport_icao']) && $row['real_arrival_airport_icao'] != NULL) {
152
+				$temp_array['real_arrival_airport'] = $row['real_arrival_airport_icao'];
153
+			}
154
+			if (isset($row['latitude'])) {
155
+				$temp_array['latitude'] = $row['latitude'];
156
+			}
157
+			if (isset($row['longitude'])) {
158
+				$temp_array['longitude'] = $row['longitude'];
159
+			}
133 160
 			/*
134 161
 			if (Connection->tableExists('countries')) {
135 162
 				$country_info = $this->getCountryFromLatitudeLongitude($temp_array['latitude'],$temp_array['longitude']);
@@ -139,8 +166,12 @@  discard block
 block discarded – undo
139 166
 				}
140 167
 			}
141 168
 			*/
142
-			if (isset($row['waypoints'])) $temp_array['waypoints'] = $row['waypoints'];
143
-			if (isset($row['format_source'])) $temp_array['format_source'] = $row['format_source'];
169
+			if (isset($row['waypoints'])) {
170
+				$temp_array['waypoints'] = $row['waypoints'];
171
+			}
172
+			if (isset($row['format_source'])) {
173
+				$temp_array['format_source'] = $row['format_source'];
174
+			}
144 175
 			if (isset($row['route_stop'])) {
145 176
 				$temp_array['route_stop'] = $row['route_stop'];
146 177
 				if ($row['route_stop'] != '') {
@@ -159,13 +190,19 @@  discard block
 block discarded – undo
159 190
 					}
160 191
 				}
161 192
 			}
162
-			if (isset($row['altitude'])) $temp_array['altitude'] = $row['altitude'];
193
+			if (isset($row['altitude'])) {
194
+				$temp_array['altitude'] = $row['altitude'];
195
+			}
163 196
 			if (isset($row['heading'])) {
164 197
 				$temp_array['heading'] = $row['heading'];
165 198
 				$heading_direction = $this->parseDirection($row['heading']);
166
-				if (isset($heading_direction[0]['direction_fullname'])) $temp_array['heading_name'] = $heading_direction[0]['direction_fullname'];
199
+				if (isset($heading_direction[0]['direction_fullname'])) {
200
+					$temp_array['heading_name'] = $heading_direction[0]['direction_fullname'];
201
+				}
202
+			}
203
+			if (isset($row['ground_speed'])) {
204
+				$temp_array['ground_speed'] = $row['ground_speed'];
167 205
 			}
168
-			if (isset($row['ground_speed'])) $temp_array['ground_speed'] = $row['ground_speed'];
169 206
 			$temp_array['image'] = "";
170 207
 			$temp_array['image_thumbnail'] = "";
171 208
 			$temp_array['image_source'] = "";
@@ -173,7 +210,9 @@  discard block
 block discarded – undo
173 210
  
174 211
 			if (isset($row['highlight'])) {
175 212
 				$temp_array['highlight'] = $row['highlight'];
176
-			} else $temp_array['highlight'] = '';
213
+			} else {
214
+				$temp_array['highlight'] = '';
215
+			}
177 216
 			
178 217
 			if (isset($row['date'])) {
179 218
 				$dateArray = $this->parseDateString($row['date']);
@@ -221,7 +260,9 @@  discard block
 block discarded – undo
221 260
 				
222 261
 					if ($aircraft_array[0]['aircraft_shadow'] != NULL) {
223 262
 						$temp_array['aircraft_shadow'] = $aircraft_array[0]['aircraft_shadow'];
224
-					} else $temp_array['aircraft_shadow'] = 'default.png';
263
+					} else {
264
+						$temp_array['aircraft_shadow'] = 'default.png';
265
+					}
225 266
                                 } else {
226 267
                             		$temp_array['aircraft_shadow'] = 'default.png';
227 268
 					$temp_array['aircraft_name'] = 'N/A';
@@ -229,11 +270,17 @@  discard block
 block discarded – undo
229 270
                             	}
230 271
 			}
231 272
 			$fromsource = NULL;
232
-			if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource;
233
-			elseif (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') $fromsource = 'vatsim';
234
-			elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') $fromsource = 'ivao';
235
-			elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim';
236
-			elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao';
273
+			if (isset($globalAirlinesSource) && $globalAirlinesSource != '') {
274
+				$fromsource = $globalAirlinesSource;
275
+			} elseif (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') {
276
+				$fromsource = 'vatsim';
277
+			} elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') {
278
+				$fromsource = 'ivao';
279
+			} elseif (isset($globalVATSIM) && $globalVATSIM) {
280
+				$fromsource = 'vatsim';
281
+			} elseif (isset($globalIVAO) && $globalIVAO) {
282
+				$fromsource = 'ivao';
283
+			}
237 284
 			if (!isset($row['airline_name']) || $row['airline_name'] == '') {
238 285
 				if (!is_numeric(substr($row['ident'], 0, 3))) {
239 286
 					if (is_numeric(substr($row['ident'], 2, 1))) {
@@ -256,12 +303,18 @@  discard block
 block discarded – undo
256 303
 				}
257 304
 			} else {
258 305
 				$temp_array['airline_icao'] = $row['airline_icao'];
259
-				if (isset($row['airline_iata'])) $temp_array['airline_iata'] = $row['airline_iata'];
260
-				else $temp_array['airline_iata'] = '';
306
+				if (isset($row['airline_iata'])) {
307
+					$temp_array['airline_iata'] = $row['airline_iata'];
308
+				} else {
309
+					$temp_array['airline_iata'] = '';
310
+				}
261 311
 				$temp_array['airline_name'] = $row['airline_name'];
262 312
 				$temp_array['airline_country'] = $row['airline_country'];
263
-				if (isset($row['airline_callsign'])) $temp_array['airline_callsign'] = $row['airline_callsign'];
264
-				else $temp_array['airline_callsign'] = 'N/A';
313
+				if (isset($row['airline_callsign'])) {
314
+					$temp_array['airline_callsign'] = $row['airline_callsign'];
315
+				} else {
316
+					$temp_array['airline_callsign'] = 'N/A';
317
+				}
265 318
 				$temp_array['airline_type'] = $row['airline_type'];
266 319
 			}
267 320
 			if (isset($temp_array['airline_iata']) && $temp_array['airline_iata'] != '') {
@@ -277,7 +330,9 @@  discard block
 block discarded – undo
277 330
 			}
278 331
 			if ($temp_array['registration'] != "" && !$globalIVAO && !$globalVATSIM && !$globalphpVMS && !$globalVAM && !isset($temp_array['aircraft_owner'])) {
279 332
 				$owner_info = $this->getAircraftOwnerByRegistration($temp_array['registration']);
280
-				if ($owner_info['owner'] != '') $temp_array['aircraft_owner'] = ucwords(strtolower($owner_info['owner']));
333
+				if ($owner_info['owner'] != '') {
334
+					$temp_array['aircraft_owner'] = ucwords(strtolower($owner_info['owner']));
335
+				}
281 336
 				$temp_array['aircraft_base'] = $owner_info['base'];
282 337
 				$temp_array['aircraft_date_first_reg'] = $owner_info['date_first_reg'];
283 338
 			}
@@ -285,9 +340,14 @@  discard block
 block discarded – undo
285 340
 			if($temp_array['registration'] != "" || ($globalIVAO && isset($temp_array['aircraft_type']) && $temp_array['aircraft_type'] != ''))
286 341
 			{
287 342
 				if ($globalIVAO) {
288
-					if (isset($temp_array['airline_icao']))	$image_array = $Image->getSpotterImage('',$temp_array['aircraft_type'],$temp_array['airline_icao']);
289
-					else $image_array = $Image->getSpotterImage('',$temp_array['aircraft_type']);
290
-				} else $image_array = $Image->getSpotterImage($temp_array['registration']);
343
+					if (isset($temp_array['airline_icao'])) {
344
+						$image_array = $Image->getSpotterImage('',$temp_array['aircraft_type'],$temp_array['airline_icao']);
345
+					} else {
346
+						$image_array = $Image->getSpotterImage('',$temp_array['aircraft_type']);
347
+					}
348
+				} else {
349
+					$image_array = $Image->getSpotterImage($temp_array['registration']);
350
+				}
291 351
 				if (count($image_array) > 0) {
292 352
 					$temp_array['image'] = $image_array[0]['image'];
293 353
 					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -337,7 +397,9 @@  discard block
 block discarded – undo
337 397
 			//if ($row['departure_airport_icao'] != '' && $row['departure_airport_name'] == '') {
338 398
 			if ($row['departure_airport_icao'] != '') {
339 399
 				$departure_airport_array = $this->getAllAirportInfo($row['departure_airport_icao']);
340
-				if (!isset($departure_airport_array[0]['name'])) $departure_airport_array = $this->getAllAirportInfo('NA');
400
+				if (!isset($departure_airport_array[0]['name'])) {
401
+					$departure_airport_array = $this->getAllAirportInfo('NA');
402
+				}
341 403
 			/*
342 404
 			} elseif ($row['departure_airport_name'] != '') {
343 405
 				$temp_array['departure_airport_name'] = $row['departure_airport_name'];
@@ -345,7 +407,9 @@  discard block
 block discarded – undo
345 407
 				$temp_array['departure_airport_country'] = $row['departure_airport_country'];
346 408
 				$temp_array['departure_airport_icao'] = $row['departure_airport_icao'];
347 409
 			*/
348
-			} else $departure_airport_array = $this->getAllAirportInfo('NA');
410
+			} else {
411
+				$departure_airport_array = $this->getAllAirportInfo('NA');
412
+			}
349 413
 			if (isset($departure_airport_array[0]['name'])) {
350 414
 				$temp_array['departure_airport_name'] = $departure_airport_array[0]['name'];
351 415
 				$temp_array['departure_airport_city'] = $departure_airport_array[0]['city'];
@@ -365,8 +429,12 @@  discard block
 block discarded – undo
365 429
 			
366 430
 			if ($row['arrival_airport_icao'] != '') {
367 431
 				$arrival_airport_array = $this->getAllAirportInfo($row['arrival_airport_icao']);
368
-				if (count($arrival_airport_array) == 0) $arrival_airport_array = $this->getAllAirportInfo('NA');
369
-			} else $arrival_airport_array = $this->getAllAirportInfo('NA');
432
+				if (count($arrival_airport_array) == 0) {
433
+					$arrival_airport_array = $this->getAllAirportInfo('NA');
434
+				}
435
+			} else {
436
+				$arrival_airport_array = $this->getAllAirportInfo('NA');
437
+			}
370 438
 			if (isset($arrival_airport_array[0]['name'])) {
371 439
 				$temp_array['arrival_airport_name'] = $arrival_airport_array[0]['name'];
372 440
 				$temp_array['arrival_airport_city'] = $arrival_airport_array[0]['city'];
@@ -382,27 +450,45 @@  discard block
 block discarded – undo
382 450
 				$temp_array['arrival_airport_time'] = $row['arrival_airport_time'];
383 451
 			}
384 452
 			*/
385
-			if (isset($row['pilot_id']) && $row['pilot_id'] != '') $temp_array['pilot_id'] = $row['pilot_id'];
386
-			if (isset($row['pilot_name']) && $row['pilot_name'] != '') $temp_array['pilot_name'] = $row['pilot_name'];
387
-			if (isset($row['source_name']) && $row['source_name'] != '') $temp_array['source_name'] = $row['source_name'];
388
-			if (isset($row['over_country']) && $row['over_country'] != '') $temp_array['over_country'] = $row['over_country'];
389
-			if (isset($row['distance']) && $row['distance'] != '') $temp_array['distance'] = $row['distance'];
453
+			if (isset($row['pilot_id']) && $row['pilot_id'] != '') {
454
+				$temp_array['pilot_id'] = $row['pilot_id'];
455
+			}
456
+			if (isset($row['pilot_name']) && $row['pilot_name'] != '') {
457
+				$temp_array['pilot_name'] = $row['pilot_name'];
458
+			}
459
+			if (isset($row['source_name']) && $row['source_name'] != '') {
460
+				$temp_array['source_name'] = $row['source_name'];
461
+			}
462
+			if (isset($row['over_country']) && $row['over_country'] != '') {
463
+				$temp_array['over_country'] = $row['over_country'];
464
+			}
465
+			if (isset($row['distance']) && $row['distance'] != '') {
466
+				$temp_array['distance'] = $row['distance'];
467
+			}
390 468
 			if (isset($row['squawk'])) {
391 469
 				$temp_array['squawk'] = $row['squawk'];
392 470
 				if ($row['squawk'] != '' && isset($temp_array['country_iso2'])) {
393 471
 					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$temp_array['country_iso2']);
394
-					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
472
+					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) {
473
+						$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
474
+					}
395 475
 				} elseif ($row['squawk'] != '' && isset($temp_array['over_country'])) {
396 476
 					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$temp_array['over_country']);
397
-					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
398
-				} elseif ($row['squawk'] != '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
477
+					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) {
478
+						$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
479
+					}
480
+				} elseif ($row['squawk'] != '' && isset($globalSquawkCountry)) {
481
+					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
482
+				}
399 483
 			}
400 484
     			
401 485
 			$temp_array['query_number_rows'] = $num_rows;
402 486
 			
403 487
 			$spotter_array[] = $temp_array;
404 488
 		}
405
-		if ($num_rows == 0) return array();
489
+		if ($num_rows == 0) {
490
+			return array();
491
+		}
406 492
 		$spotter_array[0]['query_number_rows'] = $num_rows;
407 493
 		return $spotter_array;
408 494
 	}	
@@ -435,7 +521,9 @@  discard block
 block discarded – undo
435 521
 				foreach ($q_array as $q_item){
436 522
 					$q_item = filter_var($q_item,FILTER_SANITIZE_STRING);
437 523
 					$additional_query .= " AND (";
438
-					if (is_int($q_item)) $additional_query .= "(spotter_output.spotter_id like '%".$q_item."%') OR ";
524
+					if (is_int($q_item)) {
525
+						$additional_query .= "(spotter_output.spotter_id like '%".$q_item."%') OR ";
526
+					}
439 527
 					$additional_query .= "(spotter_output.aircraft_icao like '%".$q_item."%') OR ";
440 528
 					$additional_query .= "(spotter_output.aircraft_name like '%".$q_item."%') OR ";
441 529
 					$additional_query .= "(spotter_output.aircraft_manufacturer like '%".$q_item."%') OR ";
@@ -456,7 +544,9 @@  discard block
 block discarded – undo
456 544
 					$additional_query .= "(spotter_output.pilot_name like '%".$q_item."%') OR ";
457 545
 					$additional_query .= "(spotter_output.ident like '%".$q_item."%') OR ";
458 546
 					$translate = $Translation->ident2icao($q_item);
459
-					if ($translate != $q_item) $additional_query .= "(spotter_output.ident like '%".$translate."%') OR ";
547
+					if ($translate != $q_item) {
548
+						$additional_query .= "(spotter_output.ident like '%".$translate."%') OR ";
549
+					}
460 550
 					$additional_query .= "(spotter_output.highlight like '%".$q_item."%')";
461 551
 					$additional_query .= ")";
462 552
 				}
@@ -683,7 +773,9 @@  discard block
 block discarded – undo
683 773
 				date_default_timezone_set($globalTimezone);
684 774
 				$datetime = new DateTime();
685 775
 				$offset = $datetime->format('P');
686
-			} else $offset = '+00:00';
776
+			} else {
777
+				$offset = '+00:00';
778
+			}
687 779
 
688 780
 			if ($date_array[1] != "")
689 781
 			{
@@ -715,8 +807,12 @@  discard block
 block discarded – undo
715 807
 			{
716 808
 				//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
717 809
 				$limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0];
718
-			} else $limit_query = "";
719
-		} else $limit_query = "";
810
+			} else {
811
+				$limit_query = "";
812
+			}
813
+		} else {
814
+			$limit_query = "";
815
+		}
720 816
 
721 817
 
722 818
 		if ($sort != "")
@@ -784,8 +880,12 @@  discard block
 block discarded – undo
784 880
 			{
785 881
 				//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
786 882
 				$limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0];
787
-			} else $limit_query = "";
788
-		} else $limit_query = "";
883
+			} else {
884
+				$limit_query = "";
885
+			}
886
+		} else {
887
+			$limit_query = "";
888
+		}
789 889
 		
790 890
 		if ($sort != "")
791 891
 		{
@@ -1109,7 +1209,9 @@  discard block
 block discarded – undo
1109 1209
 		global $global_query;
1110 1210
 		
1111 1211
 		date_default_timezone_set('UTC');
1112
-		if ($id == '') return array();
1212
+		if ($id == '') {
1213
+			return array();
1214
+		}
1113 1215
 		$additional_query = "spotter_output.spotter_id = :id";
1114 1216
 		$query_values = array(':id' => $id);
1115 1217
 
@@ -1746,7 +1848,9 @@  discard block
 block discarded – undo
1746 1848
 		{
1747 1849
 			$highlight = $row['highlight'];
1748 1850
 		}
1749
-		if (isset($highlight)) return $highlight;
1851
+		if (isset($highlight)) {
1852
+			return $highlight;
1853
+		}
1750 1854
 	}
1751 1855
 
1752 1856
 	
@@ -1773,7 +1877,9 @@  discard block
 block discarded – undo
1773 1877
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
1774 1878
 		if (count($row) > 0) {
1775 1879
 			return $row['usage'];
1776
-		} else return '';
1880
+		} else {
1881
+			return '';
1882
+		}
1777 1883
 	}
1778 1884
 
1779 1885
 	/**
@@ -1797,7 +1903,9 @@  discard block
 block discarded – undo
1797 1903
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
1798 1904
 		if (count($row) > 0) {
1799 1905
 			return $row['icao'];
1800
-		} else return '';
1906
+		} else {
1907
+			return '';
1908
+		}
1801 1909
 	}
1802 1910
 
1803 1911
 	/**
@@ -1824,7 +1932,9 @@  discard block
 block discarded – undo
1824 1932
 			$airport_longitude = $row['longitude'];
1825 1933
 			$Common = new Common();
1826 1934
 			return $Common->distance($latitude,$longitude,$airport_latitude,$airport_longitude);
1827
-		} else return '';
1935
+		} else {
1936
+			return '';
1937
+		}
1828 1938
 	}
1829 1939
 	
1830 1940
 	/**
@@ -1936,7 +2046,9 @@  discard block
 block discarded – undo
1936 2046
 			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1937 2047
 			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1938 2048
 			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1939
-		} else return array();
2049
+		} else {
2050
+			return array();
2051
+		}
1940 2052
 		if ($globalDBdriver == 'mysql') {
1941 2053
 			$query  = "SELECT airport.* FROM airport WHERE airport.latitude BETWEEN ".$minlat." AND ".$maxlat." AND airport.longitude BETWEEN ".$minlong." AND ".$maxlong." AND airport.type != 'closed'";
1942 2054
 		} else {
@@ -1971,7 +2083,9 @@  discard block
 block discarded – undo
1971 2083
 			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1972 2084
 			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1973 2085
 			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1974
-		} else return array();
2086
+		} else {
2087
+			return array();
2088
+		}
1975 2089
 		//$query  = "SELECT waypoints.* FROM waypoints WHERE waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong;
1976 2090
 		$query  = "SELECT waypoints.* FROM waypoints WHERE (waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong.") OR (waypoints.latitude_end BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_end BETWEEN ".$minlong." AND ".$maxlong.")";
1977 2091
 		//$query  = "SELECT waypoints.* FROM waypoints";
@@ -2006,7 +2120,9 @@  discard block
 block discarded – undo
2006 2120
 	public function getAllAirlineInfo($airline_icao, $fromsource = NULL)
2007 2121
 	{
2008 2122
 		global $globalUseRealAirlines;
2009
-		if (isset($globalUseRealAirlines) && $globalUseRealAirlines) $fromsource = NULL;
2123
+		if (isset($globalUseRealAirlines) && $globalUseRealAirlines) {
2124
+			$fromsource = NULL;
2125
+		}
2010 2126
 		$airline_icao = strtoupper(filter_var($airline_icao,FILTER_SANITIZE_STRING));
2011 2127
 		if ($airline_icao == 'NA') {
2012 2128
 			$airline_array = array();
@@ -2055,7 +2171,9 @@  discard block
 block discarded – undo
2055 2171
 				$sth = $this->db->prepare($query);
2056 2172
 				$sth->execute(array(':fromsource' => $fromsource));
2057 2173
 				$row = $sth->fetch(PDO::FETCH_ASSOC);
2058
-				if ($row['nb'] == 0) $result = $this->getAllAirlineInfo($airline_icao);
2174
+				if ($row['nb'] == 0) {
2175
+					$result = $this->getAllAirlineInfo($airline_icao);
2176
+				}
2059 2177
 			}
2060 2178
 			return $result;
2061 2179
 		}
@@ -2119,15 +2237,20 @@  discard block
 block discarded – undo
2119 2237
 				'A320-211' => 'A320',
2120 2238
 				'747-8i' => 'B748',
2121 2239
 				'A380' => 'A388');
2122
-		if (isset($all_aircraft[$aircraft_type])) return $all_aircraft[$aircraft_type];
2240
+		if (isset($all_aircraft[$aircraft_type])) {
2241
+			return $all_aircraft[$aircraft_type];
2242
+		}
2123 2243
 
2124 2244
 		$query  = "SELECT aircraft.icao FROM aircraft WHERE aircraft.type LIKE :saircraft_type OR aircraft.type = :aircraft_type OR aircraft.icao = :aircraft_type LIMIT 1";
2125 2245
 		$aircraft_type = strtoupper($aircraft_type);
2126 2246
 		$sth = $this->db->prepare($query);
2127 2247
 		$sth->execute(array(':saircraft_type' => '%'.$aircraft_type.'%',':aircraft_type' => $aircraft_type,));
2128 2248
 		$result = $sth->fetchAll(PDO::FETCH_ASSOC);
2129
-		if (isset($result[0]['icao'])) return $result[0]['icao'];
2130
-		else return '';
2249
+		if (isset($result[0]['icao'])) {
2250
+			return $result[0]['icao'];
2251
+		} else {
2252
+			return '';
2253
+		}
2131 2254
 	}
2132 2255
 	
2133 2256
 	/**
@@ -2149,7 +2272,9 @@  discard block
 block discarded – undo
2149 2272
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
2150 2273
 		if (isset($row['icaotypecode'])) {
2151 2274
 			return $row['icaotypecode'];
2152
-		} else return '';
2275
+		} else {
2276
+			return '';
2277
+		}
2153 2278
 	}
2154 2279
 
2155 2280
 	/**
@@ -2170,7 +2295,9 @@  discard block
 block discarded – undo
2170 2295
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
2171 2296
 		if (isset($row['operator_correct'])) {
2172 2297
 			return $row['operator_correct'];
2173
-		} else return $operator;
2298
+		} else {
2299
+			return $operator;
2300
+		}
2174 2301
 	}
2175 2302
 
2176 2303
 	/**
@@ -2183,7 +2310,9 @@  discard block
 block discarded – undo
2183 2310
 	public function getRouteInfo($callsign)
2184 2311
 	{
2185 2312
 		$callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
2186
-                if ($callsign == '') return array();
2313
+                if ($callsign == '') {
2314
+                	return array();
2315
+                }
2187 2316
 		$query  = "SELECT routes.Operator_ICAO, routes.FromAirport_ICAO, routes.ToAirport_ICAO, routes.RouteStop, routes.FromAirport_Time, routes.ToAirport_Time FROM routes WHERE CallSign = :callsign LIMIT 1";
2188 2317
 		
2189 2318
 		$sth = $this->db->prepare($query);
@@ -2192,7 +2321,9 @@  discard block
 block discarded – undo
2192 2321
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
2193 2322
 		if (count($row) > 0) {
2194 2323
 			return $row;
2195
-		} else return array();
2324
+		} else {
2325
+			return array();
2326
+		}
2196 2327
 	}
2197 2328
 	
2198 2329
 	/**
@@ -2244,7 +2375,9 @@  discard block
 block discarded – undo
2244 2375
 			$sth->execute(array(':registration' => $registration));
2245 2376
 
2246 2377
 			return $sth->fetch(PDO::FETCH_ASSOC);
2247
-		} else return array();
2378
+		} else {
2379
+			return array();
2380
+		}
2248 2381
 	}
2249 2382
 	
2250 2383
   
@@ -2400,8 +2533,11 @@  discard block
 block discarded – undo
2400 2533
 		$query .= " ORDER BY spotter_output.source_name ASC";
2401 2534
 
2402 2535
 		$sth = $this->db->prepare($query);
2403
-		if (!empty($query_values)) $sth->execute($query_values);
2404
-		else $sth->execute();
2536
+		if (!empty($query_values)) {
2537
+			$sth->execute($query_values);
2538
+		} else {
2539
+			$sth->execute();
2540
+		}
2405 2541
 
2406 2542
 		$source_array = array();
2407 2543
 		$temp_array = array();
@@ -2433,9 +2569,13 @@  discard block
 block discarded – undo
2433 2569
 								WHERE spotter_output.airline_icao <> '' 
2434 2570
 								ORDER BY spotter_output.airline_name ASC";
2435 2571
 			*/
2436
-			if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $forsource = $globalAirlinesSource;
2437
-			elseif (isset($globalVATSIM) && $globalVATSIM) $forsource = 'vatsim';
2438
-			elseif (isset($globalIVAO) && $globalIVAO) $forsource = 'ivao';
2572
+			if (isset($globalAirlinesSource) && $globalAirlinesSource != '') {
2573
+				$forsource = $globalAirlinesSource;
2574
+			} elseif (isset($globalVATSIM) && $globalVATSIM) {
2575
+				$forsource = 'vatsim';
2576
+			} elseif (isset($globalIVAO) && $globalIVAO) {
2577
+				$forsource = 'ivao';
2578
+			}
2439 2579
 			if ($forsource === NULL) {
2440 2580
 				$query = "SELECT DISTINCT icao AS airline_icao, name AS airline_name, type AS airline_type FROM airlines WHERE forsource IS NULL ORDER BY name ASC";
2441 2581
 				$query_data = array();
@@ -2733,7 +2873,9 @@  discard block
 block discarded – undo
2733 2873
 			date_default_timezone_set($globalTimezone);
2734 2874
 			$datetime = new DateTime();
2735 2875
 			$offset = $datetime->format('P');
2736
-		} else $offset = '+00:00';
2876
+		} else {
2877
+			$offset = '+00:00';
2878
+		}
2737 2879
 		if ($airport_icao == '') {
2738 2880
 			if ($globalDBdriver == 'mysql') {
2739 2881
 				$query = "SELECT COUNT(departure_airport_icao) AS departure_airport_count, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date FROM `spotter_output` WHERE spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 7 DAY) AND departure_airport_icao <> 'NA' GROUP BY departure_airport_icao, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d'), departure_airport_name, departure_airport_city, departure_airport_country ORDER BY departure_airport_count DESC";
@@ -2765,7 +2907,9 @@  discard block
 block discarded – undo
2765 2907
 			date_default_timezone_set($globalTimezone);
2766 2908
 			$datetime = new DateTime();
2767 2909
 			$offset = $datetime->format('P');
2768
-		} else $offset = '+00:00';
2910
+		} else {
2911
+			$offset = '+00:00';
2912
+		}
2769 2913
 		if ($airport_icao == '') {
2770 2914
 			if ($globalDBdriver == 'mysql') {
2771 2915
 				$query = "SELECT spotter_output.airline_icao, COUNT(departure_airport_icao) AS departure_airport_count, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date FROM `spotter_output` WHERE spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 7 DAY) AND departure_airport_icao <> 'NA' AND spotter_output.airline_icao <> '' GROUP BY spotter_output.airline_icao, departure_airport_icao, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d'), departure_airport_name, departure_airport_city, departure_airport_country ORDER BY departure_airport_count DESC";
@@ -2797,7 +2941,9 @@  discard block
 block discarded – undo
2797 2941
 			date_default_timezone_set($globalTimezone);
2798 2942
 			$datetime = new DateTime();
2799 2943
 			$offset = $datetime->format('P');
2800
-		} else $offset = '+00:00';
2944
+		} else {
2945
+			$offset = '+00:00';
2946
+		}
2801 2947
 		if ($airport_icao == '') {
2802 2948
 			if ($globalDBdriver == 'mysql') {
2803 2949
 				$query = "SELECT COUNT(real_departure_airport_icao) AS departure_airport_count, real_departure_airport_icao AS departure_airport_icao, airport.name AS departure_airport_name, airport.city AS departure_airport_city, airport.country AS departure_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date 
@@ -2840,7 +2986,9 @@  discard block
 block discarded – undo
2840 2986
 			date_default_timezone_set($globalTimezone);
2841 2987
 			$datetime = new DateTime();
2842 2988
 			$offset = $datetime->format('P');
2843
-		} else $offset = '+00:00';
2989
+		} else {
2990
+			$offset = '+00:00';
2991
+		}
2844 2992
 		if ($airport_icao == '') {
2845 2993
 			if ($globalDBdriver == 'mysql') {
2846 2994
 				$query = "SELECT spotter_output.airline_icao, COUNT(real_departure_airport_icao) AS departure_airport_count, real_departure_airport_icao AS departure_airport_icao, airport.name AS departure_airport_name, airport.city AS departure_airport_city, airport.country AS departure_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date 
@@ -2884,7 +3032,9 @@  discard block
 block discarded – undo
2884 3032
 			date_default_timezone_set($globalTimezone);
2885 3033
 			$datetime = new DateTime();
2886 3034
 			$offset = $datetime->format('P');
2887
-		} else $offset = '+00:00';
3035
+		} else {
3036
+			$offset = '+00:00';
3037
+		}
2888 3038
 		if ($airport_icao == '') {
2889 3039
 			if ($globalDBdriver == 'mysql') {
2890 3040
 				$query = "SELECT COUNT(arrival_airport_icao) AS arrival_airport_count, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date FROM `spotter_output` WHERE spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 7 DAY) AND arrival_airport_icao <> 'NA' GROUP BY arrival_airport_icao, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d'), arrival_airport_name, arrival_airport_city, arrival_airport_country ORDER BY arrival_airport_count DESC";
@@ -2918,7 +3068,9 @@  discard block
 block discarded – undo
2918 3068
 			date_default_timezone_set($globalTimezone);
2919 3069
 			$datetime = new DateTime();
2920 3070
 			$offset = $datetime->format('P');
2921
-		} else $offset = '+00:00';
3071
+		} else {
3072
+			$offset = '+00:00';
3073
+		}
2922 3074
 		if ($airport_icao == '') {
2923 3075
 			if ($globalDBdriver == 'mysql') {
2924 3076
 				$query = "SELECT COUNT(real_arrival_airport_icao) AS arrival_airport_count, real_arrival_airport_icao AS arrival_airport_icao, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date 
@@ -2964,7 +3116,9 @@  discard block
 block discarded – undo
2964 3116
 			date_default_timezone_set($globalTimezone);
2965 3117
 			$datetime = new DateTime();
2966 3118
 			$offset = $datetime->format('P');
2967
-		} else $offset = '+00:00';
3119
+		} else {
3120
+			$offset = '+00:00';
3121
+		}
2968 3122
 		if ($airport_icao == '') {
2969 3123
 			if ($globalDBdriver == 'mysql') {
2970 3124
 				$query = "SELECT spotter_output.airline_icao, COUNT(arrival_airport_icao) AS arrival_airport_count, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date FROM `spotter_output` WHERE spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 7 DAY) AND arrival_airport_icao <> 'NA' AND spotter_output.airline_icao <> '' GROUP BY spotter_output.airline_icao, arrival_airport_icao, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d'), arrival_airport_name, arrival_airport_city, arrival_airport_country ORDER BY arrival_airport_count DESC";
@@ -2998,7 +3152,9 @@  discard block
 block discarded – undo
2998 3152
 			date_default_timezone_set($globalTimezone);
2999 3153
 			$datetime = new DateTime();
3000 3154
 			$offset = $datetime->format('P');
3001
-		} else $offset = '+00:00';
3155
+		} else {
3156
+			$offset = '+00:00';
3157
+		}
3002 3158
 		if ($airport_icao == '') {
3003 3159
 			if ($globalDBdriver == 'mysql') {
3004 3160
 				$query = "SELECT spotter_output.airline_icao, COUNT(real_arrival_airport_icao) AS arrival_airport_count, real_arrival_airport_icao AS arrival_airport_icao, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date 
@@ -3046,7 +3202,9 @@  discard block
 block discarded – undo
3046 3202
 			date_default_timezone_set($globalTimezone);
3047 3203
 			$datetime = new DateTime();
3048 3204
 			$offset = $datetime->format('P');
3049
-		} else $offset = '+00:00';
3205
+		} else {
3206
+			$offset = '+00:00';
3207
+		}
3050 3208
 
3051 3209
 		if ($globalDBdriver == 'mysql') {
3052 3210
 			$query  = "SELECT DISTINCT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) as date
@@ -3166,7 +3324,9 @@  discard block
 block discarded – undo
3166 3324
 	*/	
3167 3325
 	public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '',$arrival_airport_time = '')
3168 3326
 	{
3169
-		if ($groundspeed == '') $groundspeed = NULL;
3327
+		if ($groundspeed == '') {
3328
+			$groundspeed = NULL;
3329
+		}
3170 3330
 		$query = 'UPDATE spotter_output SET ident = :ident, last_latitude = :last_latitude, last_longitude = :last_longitude, last_altitude = :last_altitude, last_ground = :last_ground, last_seen = :last_seen, real_arrival_airport_icao = :real_arrival_airport_icao, real_arrival_airport_time = :real_arrival_airport_time, last_ground_speed = :last_ground_speed WHERE flightaware_id = :flightaware_id';
3171 3331
                 $query_values = array(':flightaware_id' => $flightaware_id,':real_arrival_airport_icao' => $arrival_airport_icao,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_altitude' => $altitude,':last_ground_speed' => $groundspeed,':last_seen' => $date,':real_arrival_airport_time' => $arrival_airport_time, ':last_ground' => $ground, ':ident' => $ident);
3172 3332
 
@@ -3216,10 +3376,18 @@  discard block
 block discarded – undo
3216 3376
 		$Image = new Image($this->db);
3217 3377
 		$Common = new Common();
3218 3378
 		
3219
-		if (!isset($globalIVAO)) $globalIVAO = FALSE;
3220
-		if (!isset($globalVATSIM)) $globalVATSIM = FALSE;
3221
-		if (!isset($globalphpVMS)) $globalphpVMS = FALSE;
3222
-		if (!isset($globalVAM)) $globalVAM = FALSE;
3379
+		if (!isset($globalIVAO)) {
3380
+			$globalIVAO = FALSE;
3381
+		}
3382
+		if (!isset($globalVATSIM)) {
3383
+			$globalVATSIM = FALSE;
3384
+		}
3385
+		if (!isset($globalphpVMS)) {
3386
+			$globalphpVMS = FALSE;
3387
+		}
3388
+		if (!isset($globalVAM)) {
3389
+			$globalVAM = FALSE;
3390
+		}
3223 3391
 		date_default_timezone_set('UTC');
3224 3392
 		
3225 3393
 		//getting the registration
@@ -3232,23 +3400,33 @@  discard block
 block discarded – undo
3232 3400
 				if ($ModeS != '') {
3233 3401
 					$timeelapsed = microtime(true);
3234 3402
 					$registration = $this->getAircraftRegistrationBymodeS($ModeS);
3235
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3403
+					if ($globalDebugTimeElapsed) {
3404
+						echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3405
+					}
3236 3406
 				} else {
3237 3407
 					$myhex = explode('-',$flightaware_id);
3238 3408
 					if (count($myhex) > 0) {
3239 3409
 						$timeelapsed = microtime(true);
3240 3410
 						$registration = $this->getAircraftRegistrationBymodeS($myhex[0]);
3241
-						if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3411
+						if ($globalDebugTimeElapsed) {
3412
+							echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3413
+						}
3242 3414
 					}
3243 3415
 				}
3244 3416
 			}
3245 3417
 		}
3246 3418
 		$fromsource = NULL;
3247
-		if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource;
3248
-		elseif ($format_source == 'vatsimtxt') $fromsource = 'vatsim';
3249
-		elseif ($format_source == 'whazzup') $fromsource = 'ivao';
3250
-		elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim';
3251
-		elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao';
3419
+		if (isset($globalAirlinesSource) && $globalAirlinesSource != '') {
3420
+			$fromsource = $globalAirlinesSource;
3421
+		} elseif ($format_source == 'vatsimtxt') {
3422
+			$fromsource = 'vatsim';
3423
+		} elseif ($format_source == 'whazzup') {
3424
+			$fromsource = 'ivao';
3425
+		} elseif (isset($globalVATSIM) && $globalVATSIM) {
3426
+			$fromsource = 'vatsim';
3427
+		} elseif (isset($globalIVAO) && $globalIVAO) {
3428
+			$fromsource = 'ivao';
3429
+		}
3252 3430
 		//getting the airline information
3253 3431
 		if ($ident != "")
3254 3432
 		{
@@ -3272,15 +3450,21 @@  discard block
 block discarded – undo
3272 3450
 					if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == ""){
3273 3451
 						$airline_array = $this->getAllAirlineInfo("NA");
3274 3452
 					}
3275
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3453
+					if ($globalDebugTimeElapsed) {
3454
+						echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3455
+					}
3276 3456
 
3277 3457
 				} else {
3278 3458
 					$timeelapsed = microtime(true);
3279 3459
 					$airline_array = $this->getAllAirlineInfo("NA");
3280
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3460
+					if ($globalDebugTimeElapsed) {
3461
+						echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3462
+					}
3281 3463
 				}
3282 3464
 			}
3283
-		} else $airline_array = array();
3465
+		} else {
3466
+			$airline_array = array();
3467
+		}
3284 3468
 		
3285 3469
 		//getting the aircraft information
3286 3470
 		$aircraft_array = array();
@@ -3294,27 +3478,37 @@  discard block
 block discarded – undo
3294 3478
 				{
3295 3479
 					$timeelapsed = microtime(true);
3296 3480
 					$aircraft_array = $this->getAllAircraftInfo("NA");
3297
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3481
+					if ($globalDebugTimeElapsed) {
3482
+						echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3483
+					}
3298 3484
 				} else {
3299 3485
 					$timeelapsed = microtime(true);
3300 3486
 					$aircraft_array = $this->getAllAircraftInfo($aircraft_icao);
3301
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3487
+					if ($globalDebugTimeElapsed) {
3488
+						echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3489
+					}
3302 3490
 				}
3303 3491
 			}
3304 3492
 		} else {
3305 3493
 			if ($ModeS != '') {
3306 3494
 				$timeelapsed = microtime(true);
3307 3495
 				$aircraft_icao = $this->getAllAircraftType($ModeS);
3308
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3496
+				if ($globalDebugTimeElapsed) {
3497
+					echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3498
+				}
3309 3499
 				if ($aircraft_icao == "" || $aircraft_icao == "XXXX")
3310 3500
 				{
3311 3501
 					$timeelapsed = microtime(true);
3312 3502
 					$aircraft_array = $this->getAllAircraftInfo("NA");
3313
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3503
+					if ($globalDebugTimeElapsed) {
3504
+						echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3505
+					}
3314 3506
 				} else {
3315 3507
 					$timeelapsed = microtime(true);
3316 3508
 					$aircraft_array = $this->getAllAircraftInfo($aircraft_icao);
3317
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3509
+					if ($globalDebugTimeElapsed) {
3510
+						echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3511
+					}
3318 3512
 				}
3319 3513
 			}
3320 3514
 		}
@@ -3329,7 +3523,9 @@  discard block
 block discarded – undo
3329 3523
 			} else {
3330 3524
 				$timeelapsed = microtime(true);
3331 3525
 				$departure_airport_array = $this->getAllAirportInfo($departure_airport_icao);
3332
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3526
+				if ($globalDebugTimeElapsed) {
3527
+					echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3528
+				}
3333 3529
 			}
3334 3530
 		}
3335 3531
 		
@@ -3343,7 +3539,9 @@  discard block
 block discarded – undo
3343 3539
 			} else {
3344 3540
 				$timeelapsed = microtime(true);
3345 3541
 				$arrival_airport_array = $this->getAllAirportInfo($arrival_airport_icao);
3346
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3542
+				if ($globalDebugTimeElapsed) {
3543
+					echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3544
+				}
3347 3545
 			}
3348 3546
 		}
3349 3547
 
@@ -3378,7 +3576,9 @@  discard block
 block discarded – undo
3378 3576
 			{
3379 3577
 				return false;
3380 3578
 			}
3381
-		} else $altitude = 0;
3579
+		} else {
3580
+			$altitude = 0;
3581
+		}
3382 3582
 		
3383 3583
 		if ($heading != "")
3384 3584
 		{
@@ -3407,7 +3607,9 @@  discard block
 block discarded – undo
3407 3607
 		{
3408 3608
 			$timeelapsed = microtime(true);
3409 3609
 			$image_array = $Image->getSpotterImage($registration);
3410
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3610
+			if ($globalDebugTimeElapsed) {
3611
+				echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3612
+			}
3411 3613
 			if (!isset($image_array[0]['registration']))
3412 3614
 			{
3413 3615
 				//echo "Add image !!!! \n";
@@ -3415,14 +3617,21 @@  discard block
 block discarded – undo
3415 3617
 			}
3416 3618
 			$timeelapsed = microtime(true);
3417 3619
 			$owner_info = $this->getAircraftOwnerByRegistration($registration);
3418
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3419
-			if ($owner_info['owner'] != '') $aircraft_owner = ucwords(strtolower($owner_info['owner']));
3620
+			if ($globalDebugTimeElapsed) {
3621
+				echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3622
+			}
3623
+			if ($owner_info['owner'] != '') {
3624
+				$aircraft_owner = ucwords(strtolower($owner_info['owner']));
3625
+			}
3420 3626
 		}
3421 3627
     
3422 3628
 		if ($globalIVAO && $aircraft_icao != '')
3423 3629
 		{
3424
-            		if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao'];
3425
-            		else $airline_icao = '';
3630
+            		if (isset($airline_array[0]['icao'])) {
3631
+            			$airline_icao = $airline_array[0]['icao'];
3632
+            		} else {
3633
+            			$airline_icao = '';
3634
+            		}
3426 3635
 			$image_array = $Image->getSpotterImage('',$aircraft_icao,$airline_icao);
3427 3636
 			if (!isset($image_array[0]['registration']))
3428 3637
 			{
@@ -3467,12 +3676,24 @@  discard block
 block discarded – undo
3467 3676
                 {
3468 3677
                         $arrival_airport_array = $this->getAllAirportInfo('NA');
3469 3678
                 }
3470
-                if ($registration == '') $registration = 'NA';
3471
-                if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL;
3472
-                if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL;
3473
-                if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
3474
-                if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
3475
-                if (!isset($aircraft_owner)) $aircraft_owner = NULL;
3679
+                if ($registration == '') {
3680
+                	$registration = 'NA';
3681
+                }
3682
+                if ($squawk == '' || $Common->isInteger($squawk) === false) {
3683
+                	$squawk = NULL;
3684
+                }
3685
+                if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) {
3686
+                	$verticalrate = NULL;
3687
+                }
3688
+                if ($heading == '' || $Common->isInteger($heading) === false) {
3689
+                	$heading = 0;
3690
+                }
3691
+                if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) {
3692
+                	$groundspeed = 0;
3693
+                }
3694
+                if (!isset($aircraft_owner)) {
3695
+                	$aircraft_owner = NULL;
3696
+                }
3476 3697
                 $query  = "INSERT INTO spotter_output (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, latitude, longitude, waypoints, altitude, heading, ground_speed, date, departure_airport_time, arrival_airport_time, squawk, route_stop,highlight,ModeS, pilot_id, pilot_name, verticalrate, owner_name, ground, format_source, source_name) 
3477 3698
                 VALUES (:flightaware_id,:ident,:registration,:airline_name,:airline_icao,:airline_country,:airline_type,:aircraft_icao,:aircraft_type,:aircraft_manufacturer,:departure_airport_icao,:departure_airport_name,:departure_airport_city,:departure_airport_country, :arrival_airport_icao, :arrival_airport_name, :arrival_airport_city, :arrival_airport_country, :latitude,:longitude,:waypoints,:altitude,:heading,:groundspeed,:date, :departure_airport_time, :arrival_airport_time, :squawk, :route_stop, :highlight, :ModeS, :pilot_id, :pilot_name, :verticalrate, :owner_name,:ground, :format_source, :source_name)";
3478 3699
 
@@ -3483,9 +3704,13 @@  discard block
 block discarded – undo
3483 3704
 		if ($airline_type == '') {
3484 3705
 			$timeelapsed = microtime(true);
3485 3706
 			$airline_type = $this->getAircraftTypeBymodeS($ModeS);
3486
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3707
+			if ($globalDebugTimeElapsed) {
3708
+				echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3709
+			}
3710
+		}
3711
+		if ($airline_type == null) {
3712
+			$airline_type = '';
3487 3713
 		}
3488
-		if ($airline_type == null) $airline_type = '';
3489 3714
                 $aircraft_type = $aircraft_array[0]['type'];
3490 3715
                 $aircraft_manufacturer = $aircraft_array[0]['manufacturer'];
3491 3716
                 $departure_airport_name = $departure_airport_array[0]['name'];
@@ -3620,7 +3845,9 @@  discard block
 block discarded – undo
3620 3845
 			}
3621 3846
 		}
3622 3847
 		$query .= "GROUP BY spotter_output.airline_name,spotter_output.airline_icao, spotter_output.airline_country ORDER BY airline_count DESC";
3623
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
3848
+		if ($limit) {
3849
+			$query .= " LIMIT 10 OFFSET 0";
3850
+		}
3624 3851
 		
3625 3852
 		$sth = $this->db->prepare($query);
3626 3853
 		$sth->execute();
@@ -3665,7 +3892,9 @@  discard block
 block discarded – undo
3665 3892
 			}
3666 3893
 		}
3667 3894
 		$query .= "GROUP BY spotter_output.pilot_id,spotter_output.pilot_name ORDER BY pilot_count DESC";
3668
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
3895
+		if ($limit) {
3896
+			$query .= " LIMIT 10 OFFSET 0";
3897
+		}
3669 3898
       
3670 3899
 		
3671 3900
 		$sth = $this->db->prepare($query);
@@ -3710,7 +3939,9 @@  discard block
 block discarded – undo
3710 3939
 			}
3711 3940
 		}
3712 3941
 		$query .= "GROUP BY spotter_output.airline_icao, spotter_output.pilot_id,spotter_output.pilot_name ORDER BY pilot_count DESC";
3713
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
3942
+		if ($limit) {
3943
+			$query .= " LIMIT 10 OFFSET 0";
3944
+		}
3714 3945
       
3715 3946
 		
3716 3947
 		$sth = $this->db->prepare($query);
@@ -3757,7 +3988,9 @@  discard block
 block discarded – undo
3757 3988
 			}
3758 3989
 		}
3759 3990
 		$query .= "GROUP BY spotter_output.owner_name ORDER BY owner_count DESC";
3760
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
3991
+		if ($limit) {
3992
+			$query .= " LIMIT 10 OFFSET 0";
3993
+		}
3761 3994
       
3762 3995
 		
3763 3996
 		$sth = $this->db->prepare($query);
@@ -3801,7 +4034,9 @@  discard block
 block discarded – undo
3801 4034
 			}
3802 4035
 		}
3803 4036
 		$query .= "GROUP BY spotter_output.airline_icao, spotter_output.owner_name ORDER BY owner_count DESC";
3804
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4037
+		if ($limit) {
4038
+			$query .= " LIMIT 10 OFFSET 0";
4039
+		}
3805 4040
       
3806 4041
 		
3807 4042
 		$sth = $this->db->prepare($query);
@@ -4050,7 +4285,9 @@  discard block
 block discarded – undo
4050 4285
 			date_default_timezone_set($globalTimezone);
4051 4286
 			$datetime = new DateTime($date);
4052 4287
 			$offset = $datetime->format('P');
4053
-		} else $offset = '+00:00';
4288
+		} else {
4289
+			$offset = '+00:00';
4290
+		}
4054 4291
 
4055 4292
 		if ($globalDBdriver == 'mysql') {
4056 4293
 			$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
@@ -4099,7 +4336,9 @@  discard block
 block discarded – undo
4099 4336
 			date_default_timezone_set($globalTimezone);
4100 4337
 			$datetime = new DateTime($date);
4101 4338
 			$offset = $datetime->format('P');
4102
-		} else $offset = '+00:00';
4339
+		} else {
4340
+			$offset = '+00:00';
4341
+		}
4103 4342
 		
4104 4343
 		if ($globalDBdriver == 'mysql') {
4105 4344
 			$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
@@ -4322,7 +4561,9 @@  discard block
 block discarded – undo
4322 4561
 					WHERE spotter_output.airline_country <> '' AND spotter_output.airline_country <> 'NA' 
4323 4562
 					GROUP BY spotter_output.airline_country
4324 4563
 					ORDER BY airline_country_count DESC";
4325
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4564
+		if ($limit) {
4565
+			$query .= " LIMIT 10 OFFSET 0";
4566
+		}
4326 4567
       
4327 4568
 		$sth = $this->db->prepare($query);
4328 4569
 		$sth->execute();
@@ -4349,7 +4590,9 @@  discard block
 block discarded – undo
4349 4590
 	{
4350 4591
 		global $globalDBdriver;
4351 4592
 		$Connection= new Connection($this->db);
4352
-		if (!$Connection->tableExists('countries')) return array();
4593
+		if (!$Connection->tableExists('countries')) {
4594
+			return array();
4595
+		}
4353 4596
 		/*
4354 4597
 		$query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb 
4355 4598
 					FROM countries c, spotter_output s
@@ -4374,7 +4617,9 @@  discard block
 block discarded – undo
4374 4617
 		}
4375 4618
 
4376 4619
 		$query .= "GROUP BY c.name ORDER BY nb DESC";
4377
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4620
+		if ($limit) {
4621
+			$query .= " LIMIT 10 OFFSET 0";
4622
+		}
4378 4623
       
4379 4624
 		
4380 4625
 		$sth = $this->db->prepare($query);
@@ -4424,7 +4669,9 @@  discard block
 block discarded – undo
4424 4669
 		}
4425 4670
 
4426 4671
 		$query .= " GROUP BY spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer ORDER BY aircraft_icao_count DESC";
4427
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4672
+		if ($limit) {
4673
+			$query .= " LIMIT 10 OFFSET 0";
4674
+		}
4428 4675
  
4429 4676
 		$sth = $this->db->prepare($query);
4430 4677
 		$sth->execute();
@@ -4470,7 +4717,9 @@  discard block
 block discarded – undo
4470 4717
 		}
4471 4718
 
4472 4719
 		$query .= "GROUP BY spotter_output.airline_icao, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer ORDER BY aircraft_icao_count DESC";
4473
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4720
+		if ($limit) {
4721
+			$query .= " LIMIT 10 OFFSET 0";
4722
+		}
4474 4723
  
4475 4724
 		$sth = $this->db->prepare($query);
4476 4725
 		$sth->execute();
@@ -4523,7 +4772,9 @@  discard block
 block discarded – undo
4523 4772
 			if($row['registration'] != "")
4524 4773
 			{
4525 4774
 				$image_array = $Image->getSpotterImage($row['registration']);
4526
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
4775
+				if (isset($image_array[0]['image_thumbnail'])) {
4776
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
4777
+				}
4527 4778
 			}
4528 4779
 			$temp_array['registration_count'] = $row['registration_count'];
4529 4780
 
@@ -4599,7 +4850,9 @@  discard block
 block discarded – undo
4599 4850
 			if($row['registration'] != "")
4600 4851
 			{
4601 4852
 				$image_array = $Image->getSpotterImage($row['registration']);
4602
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
4853
+				if (isset($image_array[0]['image_thumbnail'])) {
4854
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
4855
+				}
4603 4856
 			}
4604 4857
 			$temp_array['registration_count'] = $row['registration_count'];
4605 4858
 
@@ -4833,7 +5086,9 @@  discard block
 block discarded – undo
4833 5086
 			date_default_timezone_set($globalTimezone);
4834 5087
 			$datetime = new DateTime($date);
4835 5088
 			$offset = $datetime->format('P');
4836
-		} else $offset = '+00:00';
5089
+		} else {
5090
+			$offset = '+00:00';
5091
+		}
4837 5092
 
4838 5093
 		if ($globalDBdriver == 'mysql') {
4839 5094
 			$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
@@ -4881,7 +5136,9 @@  discard block
 block discarded – undo
4881 5136
 			date_default_timezone_set($globalTimezone);
4882 5137
 			$datetime = new DateTime($date);
4883 5138
 			$offset = $datetime->format('P');
4884
-		} else $offset = '+00:00';
5139
+		} else {
5140
+			$offset = '+00:00';
5141
+		}
4885 5142
 
4886 5143
 		if ($globalDBdriver == 'mysql') {
4887 5144
 			$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name    
@@ -4936,7 +5193,9 @@  discard block
 block discarded – undo
4936 5193
 			date_default_timezone_set($globalTimezone);
4937 5194
 			$datetime = new DateTime($date);
4938 5195
 			$offset = $datetime->format('P');
4939
-		} else $offset = '+00:00';
5196
+		} else {
5197
+			$offset = '+00:00';
5198
+		}
4940 5199
 
4941 5200
 		if ($globalDBdriver == 'mysql') {
4942 5201
 			$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
@@ -5037,8 +5296,11 @@  discard block
 block discarded – undo
5037 5296
 			if($row['registration'] != "")
5038 5297
 			{
5039 5298
 				$image_array = $Image->getSpotterImage($row['registration']);
5040
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5041
-				else $temp_array['image_thumbnail'] = '';
5299
+				if (isset($image_array[0]['image_thumbnail'])) {
5300
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5301
+				} else {
5302
+					$temp_array['image_thumbnail'] = '';
5303
+				}
5042 5304
 			}
5043 5305
 			$temp_array['registration_count'] = $row['registration_count'];
5044 5306
 			$aircraft_array[] = $temp_array;
@@ -5146,7 +5408,9 @@  discard block
 block discarded – undo
5146 5408
 			if($row['registration'] != "")
5147 5409
 			{
5148 5410
 				$image_array = $Image->getSpotterImage($row['registration']);
5149
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5411
+				if (isset($image_array[0]['image_thumbnail'])) {
5412
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5413
+				}
5150 5414
 			}
5151 5415
 			$temp_array['registration_count'] = $row['registration_count'];
5152 5416
           
@@ -5265,7 +5529,9 @@  discard block
 block discarded – undo
5265 5529
 			if($row['registration'] != "")
5266 5530
 			{
5267 5531
 				$image_array = $Image->getSpotterImage($row['registration']);
5268
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5532
+				if (isset($image_array[0]['image_thumbnail'])) {
5533
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5534
+				}
5269 5535
 			}
5270 5536
 			$temp_array['registration_count'] = $row['registration_count'];
5271 5537
           
@@ -5378,7 +5644,9 @@  discard block
 block discarded – undo
5378 5644
 		// if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5379 5645
 		//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5380 5646
                 $query .= " GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC";
5381
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5647
+		if ($limit) {
5648
+			$query .= " LIMIT 10 OFFSET 0";
5649
+		}
5382 5650
 		
5383 5651
 		$sth = $this->db->prepare($query);
5384 5652
 		$sth->execute();
@@ -5397,7 +5665,9 @@  discard block
 block discarded – undo
5397 5665
 			if($row['registration'] != "")
5398 5666
 			{
5399 5667
 				$image_array = $Image->getSpotterImage($row['registration']);
5400
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5668
+				if (isset($image_array[0]['image_thumbnail'])) {
5669
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5670
+				}
5401 5671
 			}
5402 5672
           
5403 5673
 			$aircraft_array[] = $temp_array;
@@ -5438,7 +5708,9 @@  discard block
 block discarded – undo
5438 5708
 		// if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5439 5709
 		//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5440 5710
                 $query .= "GROUP BY spotter_output.airline_icao, spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC";
5441
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5711
+		if ($limit) {
5712
+			$query .= " LIMIT 10 OFFSET 0";
5713
+		}
5442 5714
 		
5443 5715
 		$sth = $this->db->prepare($query);
5444 5716
 		$sth->execute();
@@ -5458,7 +5730,9 @@  discard block
 block discarded – undo
5458 5730
 			if($row['registration'] != "")
5459 5731
 			{
5460 5732
 				$image_array = $Image->getSpotterImage($row['registration']);
5461
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5733
+				if (isset($image_array[0]['image_thumbnail'])) {
5734
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5735
+				}
5462 5736
 			}
5463 5737
           
5464 5738
 			$aircraft_array[] = $temp_array;
@@ -5499,7 +5773,9 @@  discard block
 block discarded – undo
5499 5773
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5500 5774
                 $query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
5501 5775
 				ORDER BY airport_departure_icao_count DESC";
5502
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5776
+		if ($limit) {
5777
+			$query .= " LIMIT 10 OFFSET 0";
5778
+		}
5503 5779
       
5504 5780
 		$sth = $this->db->prepare($query);
5505 5781
 		$sth->execute();
@@ -5551,7 +5827,9 @@  discard block
 block discarded – undo
5551 5827
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5552 5828
                 $query .= "GROUP BY spotter_output.airline_icao, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
5553 5829
 				ORDER BY airport_departure_icao_count DESC";
5554
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5830
+		if ($limit) {
5831
+			$query .= " LIMIT 10 OFFSET 0";
5832
+		}
5555 5833
       
5556 5834
 		$sth = $this->db->prepare($query);
5557 5835
 		$sth->execute();
@@ -5603,7 +5881,9 @@  discard block
 block discarded – undo
5603 5881
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5604 5882
                 $query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
5605 5883
 				ORDER BY airport_departure_icao_count DESC";
5606
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5884
+		if ($limit) {
5885
+			$query .= " LIMIT 10 OFFSET 0";
5886
+		}
5607 5887
       
5608 5888
 		$sth = $this->db->prepare($query);
5609 5889
 		$sth->execute();
@@ -5655,7 +5935,9 @@  discard block
 block discarded – undo
5655 5935
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5656 5936
                 $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
5657 5937
 				ORDER BY airport_departure_icao_count DESC";
5658
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5938
+		if ($limit) {
5939
+			$query .= " LIMIT 10 OFFSET 0";
5940
+		}
5659 5941
       
5660 5942
 		$sth = $this->db->prepare($query);
5661 5943
 		$sth->execute();
@@ -6060,7 +6342,9 @@  discard block
 block discarded – undo
6060 6342
 			date_default_timezone_set($globalTimezone);
6061 6343
 			$datetime = new DateTime($date);
6062 6344
 			$offset = $datetime->format('P');
6063
-		} else $offset = '+00:00';
6345
+		} else {
6346
+			$offset = '+00:00';
6347
+		}
6064 6348
 
6065 6349
 		if ($globalDBdriver == 'mysql') {
6066 6350
 			$query  = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
@@ -6111,7 +6395,9 @@  discard block
 block discarded – undo
6111 6395
 			date_default_timezone_set($globalTimezone);
6112 6396
 			$datetime = new DateTime($date);
6113 6397
 			$offset = $datetime->format('P');
6114
-		} else $offset = '+00:00';
6398
+		} else {
6399
+			$offset = '+00:00';
6400
+		}
6115 6401
 
6116 6402
 		if ($globalDBdriver == 'mysql') {
6117 6403
 			$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
@@ -6329,7 +6615,9 @@  discard block
 block discarded – undo
6329 6615
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6330 6616
                 $query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
6331 6617
 					ORDER BY airport_arrival_icao_count DESC";
6332
-		if ($limit) $query .= " LIMIT 10";
6618
+		if ($limit) {
6619
+			$query .= " LIMIT 10";
6620
+		}
6333 6621
       
6334 6622
 		
6335 6623
 		$sth = $this->db->prepare($query);
@@ -6349,7 +6637,9 @@  discard block
 block discarded – undo
6349 6637
 			if ($icaoaskey) {
6350 6638
 				$icao = $row['arrival_airport_icao'];
6351 6639
 				$airport_array[$icao] = $temp_array;
6352
-			} else $airport_array[] = $temp_array;
6640
+			} else {
6641
+				$airport_array[] = $temp_array;
6642
+			}
6353 6643
 		}
6354 6644
 
6355 6645
 		return $airport_array;
@@ -6391,7 +6681,9 @@  discard block
 block discarded – undo
6391 6681
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6392 6682
                 $query .= "GROUP BY spotter_output.airline_icao,spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
6393 6683
 					ORDER BY airport_arrival_icao_count DESC";
6394
-		if ($limit) $query .= " LIMIT 10";
6684
+		if ($limit) {
6685
+			$query .= " LIMIT 10";
6686
+		}
6395 6687
       
6396 6688
 		
6397 6689
 		$sth = $this->db->prepare($query);
@@ -6412,7 +6704,9 @@  discard block
 block discarded – undo
6412 6704
 			if ($icaoaskey) {
6413 6705
 				$icao = $row['arrival_airport_icao'];
6414 6706
 				$airport_array[$icao] = $temp_array;
6415
-			} else $airport_array[] = $temp_array;
6707
+			} else {
6708
+				$airport_array[] = $temp_array;
6709
+			}
6416 6710
 		}
6417 6711
 
6418 6712
 		return $airport_array;
@@ -6454,7 +6748,9 @@  discard block
 block discarded – undo
6454 6748
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6455 6749
                 $query .= " GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
6456 6750
 					ORDER BY airport_arrival_icao_count DESC";
6457
-		if ($limit) $query .= " LIMIT 10";
6751
+		if ($limit) {
6752
+			$query .= " LIMIT 10";
6753
+		}
6458 6754
       
6459 6755
 		
6460 6756
 		$sth = $this->db->prepare($query);
@@ -6474,7 +6770,9 @@  discard block
 block discarded – undo
6474 6770
 			if ($icaoaskey) {
6475 6771
 				$icao = $row['arrival_airport_icao'];
6476 6772
 				$airport_array[$icao] = $temp_array;
6477
-			} else $airport_array[] = $temp_array;
6773
+			} else {
6774
+				$airport_array[] = $temp_array;
6775
+			}
6478 6776
 		}
6479 6777
 
6480 6778
 		return $airport_array;
@@ -6516,7 +6814,9 @@  discard block
 block discarded – undo
6516 6814
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6517 6815
                 $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
6518 6816
 					ORDER BY airport_arrival_icao_count DESC";
6519
-		if ($limit) $query .= " LIMIT 10";
6817
+		if ($limit) {
6818
+			$query .= " LIMIT 10";
6819
+		}
6520 6820
       
6521 6821
 		
6522 6822
 		$sth = $this->db->prepare($query);
@@ -6537,7 +6837,9 @@  discard block
 block discarded – undo
6537 6837
 			if ($icaoaskey) {
6538 6838
 				$icao = $row['arrival_airport_icao'];
6539 6839
 				$airport_array[$icao] = $temp_array;
6540
-			} else $airport_array[] = $temp_array;
6840
+			} else {
6841
+				$airport_array[] = $temp_array;
6842
+			}
6541 6843
 		}
6542 6844
 
6543 6845
 		return $airport_array;
@@ -6926,7 +7228,9 @@  discard block
 block discarded – undo
6926 7228
 			date_default_timezone_set($globalTimezone);
6927 7229
 			$datetime = new DateTime($date);
6928 7230
 			$offset = $datetime->format('P');
6929
-		} else $offset = '+00:00';
7231
+		} else {
7232
+			$offset = '+00:00';
7233
+		}
6930 7234
 
6931 7235
 		if ($globalDBdriver == 'mysql') {
6932 7236
 			$query  = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
@@ -6977,7 +7281,9 @@  discard block
 block discarded – undo
6977 7281
 			date_default_timezone_set($globalTimezone);
6978 7282
 			$datetime = new DateTime($date);
6979 7283
 			$offset = $datetime->format('P');
6980
-		} else $offset = '+00:00';
7284
+		} else {
7285
+			$offset = '+00:00';
7286
+		}
6981 7287
 
6982 7288
 		if ($globalDBdriver == 'mysql') {
6983 7289
 			$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
@@ -7206,7 +7512,9 @@  discard block
 block discarded – undo
7206 7512
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.arrival_airport_icao <> 'NA'";
7207 7513
 		$query .= " GROUP BY spotter_output.arrival_airport_country
7208 7514
 					ORDER BY airport_arrival_country_count DESC";
7209
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
7515
+		if ($limit) {
7516
+			$query .= " LIMIT 10 OFFSET 0";
7517
+		}
7210 7518
       
7211 7519
 		
7212 7520
 		$sth = $this->db->prepare($query);
@@ -7501,7 +7809,9 @@  discard block
 block discarded – undo
7501 7809
 			date_default_timezone_set($globalTimezone);
7502 7810
 			$datetime = new DateTime($date);
7503 7811
 			$offset = $datetime->format('P');
7504
-		} else $offset = '+00:00';
7812
+		} else {
7813
+			$offset = '+00:00';
7814
+		}
7505 7815
 		
7506 7816
 		if ($globalDBdriver == 'mysql') {
7507 7817
 			$query  = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
@@ -7684,15 +7994,23 @@  discard block
 block discarded – undo
7684 7994
 		$query  = "SELECT DISTINCT spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name, spotter_output.airline_icao  
7685 7995
                     FROM spotter_output".$filter_query." spotter_output.ident <> '' ";
7686 7996
 		 if ($olderthanmonths > 0) {
7687
-			if ($globalDBdriver == 'mysql') $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)';
7688
-			else $query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
7997
+			if ($globalDBdriver == 'mysql') {
7998
+				$query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)';
7999
+			} else {
8000
+				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
8001
+			}
7689 8002
 		}
7690 8003
 		if ($sincedate != '') {
7691
-			if ($globalDBdriver == 'mysql') $query .= " AND spotter_output.date > '".$sincedate."'";
7692
-			else $query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
8004
+			if ($globalDBdriver == 'mysql') {
8005
+				$query .= " AND spotter_output.date > '".$sincedate."'";
8006
+			} else {
8007
+				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
8008
+			}
7693 8009
 		}
7694 8010
 		$query .= " GROUP BY spotter_output.ident, spotter_output.airline_name, spotter_output.airline_icao ORDER BY callsign_icao_count DESC";
7695
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
8011
+		if ($limit) {
8012
+			$query .= " LIMIT 10 OFFSET 0";
8013
+		}
7696 8014
       		
7697 8015
 		$sth = $this->db->prepare($query);
7698 8016
 		$sth->execute();
@@ -7726,15 +8044,23 @@  discard block
 block discarded – undo
7726 8044
                     FROM spotter_output
7727 8045
                     WHERE spotter_output.ident <> ''  AND spotter_output.airline_icao <> '' ";
7728 8046
 		 if ($olderthanmonths > 0) {
7729
-			if ($globalDBdriver == 'mysql') $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
7730
-			else $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
8047
+			if ($globalDBdriver == 'mysql') {
8048
+				$query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
8049
+			} else {
8050
+				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
8051
+			}
7731 8052
 		}
7732 8053
 		if ($sincedate != '') {
7733
-			if ($globalDBdriver == 'mysql') $query .= "AND spotter_output.date > '".$sincedate."' ";
7734
-			else $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP) ";
8054
+			if ($globalDBdriver == 'mysql') {
8055
+				$query .= "AND spotter_output.date > '".$sincedate."' ";
8056
+			} else {
8057
+				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP) ";
8058
+			}
7735 8059
 		}
7736 8060
 		$query .= "GROUP BY spotter_output.airline_icao, spotter_output.ident, spotter_output.airline_name, spotter_output.airline_icao ORDER BY callsign_icao_count DESC";
7737
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
8061
+		if ($limit) {
8062
+			$query .= " LIMIT 10 OFFSET 0";
8063
+		}
7738 8064
       		
7739 8065
 		$sth = $this->db->prepare($query);
7740 8066
 		$sth->execute();
@@ -7771,7 +8097,9 @@  discard block
 block discarded – undo
7771 8097
 			date_default_timezone_set($globalTimezone);
7772 8098
 			$datetime = new DateTime();
7773 8099
 			$offset = $datetime->format('P');
7774
-		} else $offset = '+00:00';
8100
+		} else {
8101
+			$offset = '+00:00';
8102
+		}
7775 8103
 
7776 8104
 		if ($globalDBdriver == 'mysql') {
7777 8105
 			$query  = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -7820,7 +8148,9 @@  discard block
 block discarded – undo
7820 8148
 			date_default_timezone_set($globalTimezone);
7821 8149
 			$datetime = new DateTime();
7822 8150
 			$offset = $datetime->format('P');
7823
-		} else $offset = '+00:00';
8151
+		} else {
8152
+			$offset = '+00:00';
8153
+		}
7824 8154
 
7825 8155
 		if ($globalDBdriver == 'mysql') {
7826 8156
 			$query  = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -7870,7 +8200,9 @@  discard block
 block discarded – undo
7870 8200
 			date_default_timezone_set($globalTimezone);
7871 8201
 			$datetime = new DateTime();
7872 8202
 			$offset = $datetime->format('P');
7873
-		} else $offset = '+00:00';
8203
+		} else {
8204
+			$offset = '+00:00';
8205
+		}
7874 8206
 		$filter_query = $this->getFilter($filters,true,true);
7875 8207
 		if ($globalDBdriver == 'mysql') {
7876 8208
 			$query  = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -7916,7 +8248,9 @@  discard block
 block discarded – undo
7916 8248
 			date_default_timezone_set($globalTimezone);
7917 8249
 			$datetime = new DateTime();
7918 8250
 			$offset = $datetime->format('P');
7919
-		} else $offset = '+00:00';
8251
+		} else {
8252
+			$offset = '+00:00';
8253
+		}
7920 8254
 		$filter_query = $this->getFilter($filters,true,true);
7921 8255
 		if ($globalDBdriver == 'mysql') {
7922 8256
 			$query  = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -7963,7 +8297,9 @@  discard block
 block discarded – undo
7963 8297
 			date_default_timezone_set($globalTimezone);
7964 8298
 			$datetime = new DateTime();
7965 8299
 			$offset = $datetime->format('P');
7966
-		} else $offset = '+00:00';
8300
+		} else {
8301
+			$offset = '+00:00';
8302
+		}
7967 8303
 		
7968 8304
 		if ($globalDBdriver == 'mysql') {
7969 8305
 			$query  = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -8013,7 +8349,9 @@  discard block
 block discarded – undo
8013 8349
 			date_default_timezone_set($globalTimezone);
8014 8350
 			$datetime = new DateTime();
8015 8351
 			$offset = $datetime->format('P');
8016
-		} else $offset = '+00:00';
8352
+		} else {
8353
+			$offset = '+00:00';
8354
+		}
8017 8355
 
8018 8356
 		if ($globalDBdriver == 'mysql') {
8019 8357
 			$query  = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(*) as date_count
@@ -8059,7 +8397,9 @@  discard block
 block discarded – undo
8059 8397
 			date_default_timezone_set($globalTimezone);
8060 8398
 			$datetime = new DateTime();
8061 8399
 			$offset = $datetime->format('P');
8062
-		} else $offset = '+00:00';
8400
+		} else {
8401
+			$offset = '+00:00';
8402
+		}
8063 8403
 
8064 8404
 		if ($globalDBdriver == 'mysql') {
8065 8405
 			$query  = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(*) as date_count
@@ -8108,7 +8448,9 @@  discard block
 block discarded – undo
8108 8448
 			date_default_timezone_set($globalTimezone);
8109 8449
 			$datetime = new DateTime();
8110 8450
 			$offset = $datetime->format('P');
8111
-		} else $offset = '+00:00';
8451
+		} else {
8452
+			$offset = '+00:00';
8453
+		}
8112 8454
 
8113 8455
 		if ($globalDBdriver == 'mysql') {
8114 8456
 			$query  = "SELECT YEAR(CONVERT_TZ(s.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(s.date,'+00:00', :offset)) AS month_name, count(*) as date_count
@@ -8155,7 +8497,9 @@  discard block
 block discarded – undo
8155 8497
 			date_default_timezone_set($globalTimezone);
8156 8498
 			$datetime = new DateTime();
8157 8499
 			$offset = $datetime->format('P');
8158
-		} else $offset = '+00:00';
8500
+		} else {
8501
+			$offset = '+00:00';
8502
+		}
8159 8503
 
8160 8504
 		if ($globalDBdriver == 'mysql') {
8161 8505
 			$query  = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct owner_name) as date_count
@@ -8202,7 +8546,9 @@  discard block
 block discarded – undo
8202 8546
 			date_default_timezone_set($globalTimezone);
8203 8547
 			$datetime = new DateTime();
8204 8548
 			$offset = $datetime->format('P');
8205
-		} else $offset = '+00:00';
8549
+		} else {
8550
+			$offset = '+00:00';
8551
+		}
8206 8552
 
8207 8553
 		if ($globalDBdriver == 'mysql') {
8208 8554
 			$query  = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct owner_name) as date_count
@@ -8250,7 +8596,9 @@  discard block
 block discarded – undo
8250 8596
 			date_default_timezone_set($globalTimezone);
8251 8597
 			$datetime = new DateTime();
8252 8598
 			$offset = $datetime->format('P');
8253
-		} else $offset = '+00:00';
8599
+		} else {
8600
+			$offset = '+00:00';
8601
+		}
8254 8602
 
8255 8603
 		if ($globalDBdriver == 'mysql') {
8256 8604
 			$query  = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct pilot_id) as date_count
@@ -8297,7 +8645,9 @@  discard block
 block discarded – undo
8297 8645
 			date_default_timezone_set($globalTimezone);
8298 8646
 			$datetime = new DateTime();
8299 8647
 			$offset = $datetime->format('P');
8300
-		} else $offset = '+00:00';
8648
+		} else {
8649
+			$offset = '+00:00';
8650
+		}
8301 8651
 
8302 8652
 		if ($globalDBdriver == 'mysql') {
8303 8653
 			$query  = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct pilot_id) as date_count
@@ -8345,7 +8695,9 @@  discard block
 block discarded – undo
8345 8695
 			date_default_timezone_set($globalTimezone);
8346 8696
 			$datetime = new DateTime();
8347 8697
 			$offset = $datetime->format('P');
8348
-		} else $offset = '+00:00';
8698
+		} else {
8699
+			$offset = '+00:00';
8700
+		}
8349 8701
 
8350 8702
 		if ($globalDBdriver == 'mysql') {
8351 8703
 			$query  = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct airline_icao) as date_count
@@ -8392,7 +8744,9 @@  discard block
 block discarded – undo
8392 8744
 			date_default_timezone_set($globalTimezone);
8393 8745
 			$datetime = new DateTime();
8394 8746
 			$offset = $datetime->format('P');
8395
-		} else $offset = '+00:00';
8747
+		} else {
8748
+			$offset = '+00:00';
8749
+		}
8396 8750
 
8397 8751
 		if ($globalDBdriver == 'mysql') {
8398 8752
 			$query  = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct aircraft_icao) as date_count
@@ -8440,7 +8794,9 @@  discard block
 block discarded – undo
8440 8794
 			date_default_timezone_set($globalTimezone);
8441 8795
 			$datetime = new DateTime();
8442 8796
 			$offset = $datetime->format('P');
8443
-		} else $offset = '+00:00';
8797
+		} else {
8798
+			$offset = '+00:00';
8799
+		}
8444 8800
 
8445 8801
 		if ($globalDBdriver == 'mysql') {
8446 8802
 			$query  = "SELECT spotter_output.airline_icao,YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct aircraft_icao) as date_count
@@ -8488,7 +8844,9 @@  discard block
 block discarded – undo
8488 8844
 			date_default_timezone_set($globalTimezone);
8489 8845
 			$datetime = new DateTime();
8490 8846
 			$offset = $datetime->format('P');
8491
-		} else $offset = '+00:00';
8847
+		} else {
8848
+			$offset = '+00:00';
8849
+		}
8492 8850
 
8493 8851
 		if ($globalDBdriver == 'mysql') {
8494 8852
 			$query  = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(real_arrival_airport_icao) as date_count
@@ -8536,7 +8894,9 @@  discard block
 block discarded – undo
8536 8894
 			date_default_timezone_set($globalTimezone);
8537 8895
 			$datetime = new DateTime();
8538 8896
 			$offset = $datetime->format('P');
8539
-		} else $offset = '+00:00';
8897
+		} else {
8898
+			$offset = '+00:00';
8899
+		}
8540 8900
 
8541 8901
 		if ($globalDBdriver == 'mysql') {
8542 8902
 			$query  = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(real_arrival_airport_icao) as date_count
@@ -8585,7 +8945,9 @@  discard block
 block discarded – undo
8585 8945
 			date_default_timezone_set($globalTimezone);
8586 8946
 			$datetime = new DateTime();
8587 8947
 			$offset = $datetime->format('P');
8588
-		} else $offset = '+00:00';
8948
+		} else {
8949
+			$offset = '+00:00';
8950
+		}
8589 8951
 		$filter_query = $this->getFilter($filters,true,true);
8590 8952
 		if ($globalDBdriver == 'mysql') {
8591 8953
 			$query  = "SELECT MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name, count(*) as date_count
@@ -8634,7 +8996,9 @@  discard block
 block discarded – undo
8634 8996
 			date_default_timezone_set($globalTimezone);
8635 8997
 			$datetime = new DateTime();
8636 8998
 			$offset = $datetime->format('P');
8637
-		} else $offset = '+00:00';
8999
+		} else {
9000
+			$offset = '+00:00';
9001
+		}
8638 9002
 
8639 9003
 		$orderby_sql = '';
8640 9004
 		if ($orderby == "hour")
@@ -8699,7 +9063,9 @@  discard block
 block discarded – undo
8699 9063
 			date_default_timezone_set($globalTimezone);
8700 9064
 			$datetime = new DateTime();
8701 9065
 			$offset = $datetime->format('P');
8702
-		} else $offset = '+00:00';
9066
+		} else {
9067
+			$offset = '+00:00';
9068
+		}
8703 9069
 
8704 9070
 		$orderby_sql = '';
8705 9071
 		if ($orderby == "hour")
@@ -8767,7 +9133,9 @@  discard block
 block discarded – undo
8767 9133
 			date_default_timezone_set($globalTimezone);
8768 9134
 			$datetime = new DateTime();
8769 9135
 			$offset = $datetime->format('P');
8770
-		} else $offset = '+00:00';
9136
+		} else {
9137
+			$offset = '+00:00';
9138
+		}
8771 9139
 
8772 9140
 		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
8773 9141
 
@@ -8819,7 +9187,9 @@  discard block
 block discarded – undo
8819 9187
 			date_default_timezone_set($globalTimezone);
8820 9188
 			$datetime = new DateTime();
8821 9189
 			$offset = $datetime->format('P');
8822
-		} else $offset = '+00:00';
9190
+		} else {
9191
+			$offset = '+00:00';
9192
+		}
8823 9193
 
8824 9194
 		if ($globalDBdriver == 'mysql') {
8825 9195
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -8867,7 +9237,9 @@  discard block
 block discarded – undo
8867 9237
 			date_default_timezone_set($globalTimezone);
8868 9238
 			$datetime = new DateTime();
8869 9239
 			$offset = $datetime->format('P');
8870
-		} else $offset = '+00:00';
9240
+		} else {
9241
+			$offset = '+00:00';
9242
+		}
8871 9243
 
8872 9244
 		if ($globalDBdriver == 'mysql') {
8873 9245
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -8915,7 +9287,9 @@  discard block
 block discarded – undo
8915 9287
 			date_default_timezone_set($globalTimezone);
8916 9288
 			$datetime = new DateTime();
8917 9289
 			$offset = $datetime->format('P');
8918
-		} else $offset = '+00:00';
9290
+		} else {
9291
+			$offset = '+00:00';
9292
+		}
8919 9293
 
8920 9294
 		if ($globalDBdriver == 'mysql') {
8921 9295
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -8964,7 +9338,9 @@  discard block
 block discarded – undo
8964 9338
 			date_default_timezone_set($globalTimezone);
8965 9339
 			$datetime = new DateTime();
8966 9340
 			$offset = $datetime->format('P');
8967
-		} else $offset = '+00:00';
9341
+		} else {
9342
+			$offset = '+00:00';
9343
+		}
8968 9344
 
8969 9345
 		if ($globalDBdriver == 'mysql') {
8970 9346
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -9013,7 +9389,9 @@  discard block
 block discarded – undo
9013 9389
 			date_default_timezone_set($globalTimezone);
9014 9390
 			$datetime = new DateTime($date);
9015 9391
 			$offset = $datetime->format('P');
9016
-		} else $offset = '+00:00';
9392
+		} else {
9393
+			$offset = '+00:00';
9394
+		}
9017 9395
 
9018 9396
 		if ($globalDBdriver == 'mysql') {
9019 9397
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -9062,7 +9440,9 @@  discard block
 block discarded – undo
9062 9440
 			date_default_timezone_set($globalTimezone);
9063 9441
 			$datetime = new DateTime();
9064 9442
 			$offset = $datetime->format('P');
9065
-		} else $offset = '+00:00';
9443
+		} else {
9444
+			$offset = '+00:00';
9445
+		}
9066 9446
 
9067 9447
 		if ($globalDBdriver == 'mysql') {
9068 9448
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -9113,7 +9493,9 @@  discard block
 block discarded – undo
9113 9493
 			date_default_timezone_set($globalTimezone);
9114 9494
 			$datetime = new DateTime();
9115 9495
 			$offset = $datetime->format('P');
9116
-		} else $offset = '+00:00';
9496
+		} else {
9497
+			$offset = '+00:00';
9498
+		}
9117 9499
 
9118 9500
 		if ($globalDBdriver == 'mysql') {
9119 9501
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -9161,7 +9543,9 @@  discard block
 block discarded – undo
9161 9543
 			date_default_timezone_set($globalTimezone);
9162 9544
 			$datetime = new DateTime();
9163 9545
 			$offset = $datetime->format('P');
9164
-		} else $offset = '+00:00';
9546
+		} else {
9547
+			$offset = '+00:00';
9548
+		}
9165 9549
 
9166 9550
 		if ($globalDBdriver == 'mysql') {
9167 9551
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -9330,7 +9714,9 @@  discard block
 block discarded – undo
9330 9714
 			date_default_timezone_set($globalTimezone);
9331 9715
 			$datetime = new DateTime();
9332 9716
 			$offset = $datetime->format('P');
9333
-		} else $offset = '+00:00';
9717
+		} else {
9718
+			$offset = '+00:00';
9719
+		}
9334 9720
 
9335 9721
 		if ($globalDBdriver == 'mysql') {
9336 9722
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -9519,7 +9905,9 @@  discard block
 block discarded – undo
9519 9905
 	*/
9520 9906
 	public function parseDirection($direction = 0)
9521 9907
 	{
9522
-		if ($direction == '') $direction = 0;
9908
+		if ($direction == '') {
9909
+			$direction = 0;
9910
+		}
9523 9911
 		$direction_array = array();
9524 9912
 		$temp_array = array();
9525 9913
 
@@ -9620,7 +10008,9 @@  discard block
 block discarded – undo
9620 10008
 		if (isset($result->AirlineFlightInfoResult))
9621 10009
 		{
9622 10010
 			$registration = $result->AirlineFlightInfoResult->tailnumber;
9623
-		} else return '';
10011
+		} else {
10012
+			return '';
10013
+		}
9624 10014
 		
9625 10015
 		$registration = $this->convertAircraftRegistration($registration);
9626 10016
 		
@@ -9648,7 +10038,9 @@  discard block
 block discarded – undo
9648 10038
 		if (count($row) > 0) {
9649 10039
 		    //return $row['Registration'];
9650 10040
 		    return $row['registration'];
9651
-		} else return '';
10041
+		} else {
10042
+			return '';
10043
+		}
9652 10044
 	
9653 10045
 	}
9654 10046
 
@@ -9670,9 +10062,14 @@  discard block
 block discarded – undo
9670 10062
     
9671 10063
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
9672 10064
 		if (count($row) > 0) {
9673
-		    if ($row['type_flight'] == null) return '';
9674
-		    else return $row['type_flight'];
9675
-		} else return '';
10065
+		    if ($row['type_flight'] == null) {
10066
+		    	return '';
10067
+		    } else {
10068
+		    	return $row['type_flight'];
10069
+		    }
10070
+		} else {
10071
+			return '';
10072
+		}
9676 10073
 	
9677 10074
 	}
9678 10075
 
@@ -9690,7 +10087,9 @@  discard block
 block discarded – undo
9690 10087
 		$longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
9691 10088
 	
9692 10089
 		$Connection = new Connection($this->db);
9693
-		if (!$Connection->tableExists('countries')) return '';
10090
+		if (!$Connection->tableExists('countries')) {
10091
+			return '';
10092
+		}
9694 10093
 	
9695 10094
 		try {
9696 10095
 			/*
@@ -9709,9 +10108,13 @@  discard block
 block discarded – undo
9709 10108
 			$row = $sth->fetch(PDO::FETCH_ASSOC);
9710 10109
 			if (count($row) > 0) {
9711 10110
 				return $row;
9712
-			} else return '';
10111
+			} else {
10112
+				return '';
10113
+			}
9713 10114
 		} catch (PDOException $e) {
9714
-			if (isset($globalDebug) && $globalDebug) echo 'Error : '.$e->getMessage()."\n";
10115
+			if (isset($globalDebug) && $globalDebug) {
10116
+				echo 'Error : '.$e->getMessage()."\n";
10117
+			}
9715 10118
 			return '';
9716 10119
 		}
9717 10120
 	
@@ -9859,7 +10262,9 @@  discard block
 block discarded – undo
9859 10262
 	{
9860 10263
 		global $globalBitlyAccessToken;
9861 10264
 		
9862
-		if ($globalBitlyAccessToken == '') return $url;
10265
+		if ($globalBitlyAccessToken == '') {
10266
+			return $url;
10267
+		}
9863 10268
         
9864 10269
 		$google_url = 'https://api-ssl.bitly.com/v3/shorten?access_token='.$globalBitlyAccessToken.'&longUrl='.$url;
9865 10270
 		
@@ -10008,7 +10413,9 @@  discard block
 block discarded – undo
10008 10413
 		
10009 10414
 
10010 10415
 		// routes
10011
-		if ($globalDebug) print "Routes...\n";
10416
+		if ($globalDebug) {
10417
+			print "Routes...\n";
10418
+		}
10012 10419
 		if ($globalDBdriver == 'mysql') {
10013 10420
 			$query = "SELECT spotter_output.spotter_id, routes.FromAirport_ICAO, routes.ToAirport_ICAO FROM spotter_output, routes WHERE spotter_output.ident = routes.CallSign AND ( spotter_output.departure_airport_icao != routes.FromAirport_ICAO OR spotter_output.arrival_airport_icao != routes.ToAirport_ICAO) AND routes.FromAirport_ICAO != '' AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 DAY)";
10014 10421
 		} else {
@@ -10027,7 +10434,9 @@  discard block
 block discarded – undo
10027 10434
 			}
10028 10435
 		}
10029 10436
 		
10030
-		if ($globalDebug) print "Airlines...\n";
10437
+		if ($globalDebug) {
10438
+			print "Airlines...\n";
10439
+		}
10031 10440
 		//airlines
10032 10441
 		if ($globalDBdriver == 'mysql') {
10033 10442
 			$query  = "SELECT spotter_output.spotter_id, spotter_output.ident FROM spotter_output WHERE (spotter_output.airline_name = '' OR spotter_output.airline_name = 'Not Available') AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 DAY)";
@@ -10041,10 +10450,15 @@  discard block
 block discarded – undo
10041 10450
 			if (is_numeric(substr($row['ident'], -1, 1)))
10042 10451
 			{
10043 10452
 				$fromsource = NULL;
10044
-				if (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') $fromsource = 'vatsim';
10045
-				elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') $fromsource = 'ivao';
10046
-				elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim';
10047
-				elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao';
10453
+				if (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') {
10454
+					$fromsource = 'vatsim';
10455
+				} elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') {
10456
+					$fromsource = 'ivao';
10457
+				} elseif (isset($globalVATSIM) && $globalVATSIM) {
10458
+					$fromsource = 'vatsim';
10459
+				} elseif (isset($globalIVAO) && $globalIVAO) {
10460
+					$fromsource = 'ivao';
10461
+				}
10048 10462
 				$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3),$fromsource);
10049 10463
 				if (isset($airline_array[0]['name'])) {
10050 10464
 					$update_query  = "UPDATE spotter_output SET spotter_output.airline_name = :airline_name, spotter_output.airline_icao = :airline_icao, spotter_output.airline_country = :airline_country, spotter_output.airline_type = :airline_type WHERE spotter_output.spotter_id = :spotter_id";
@@ -10054,13 +10468,17 @@  discard block
 block discarded – undo
10054 10468
 			}
10055 10469
 		}
10056 10470
 
10057
-		if ($globalDebug) print "Remove Duplicate in aircraft_modes...\n";
10471
+		if ($globalDebug) {
10472
+			print "Remove Duplicate in aircraft_modes...\n";
10473
+		}
10058 10474
 		//duplicate modes
10059 10475
 		$query = "DELETE aircraft_modes FROM aircraft_modes LEFT OUTER JOIN (SELECT max(`AircraftID`) as `AircraftID`,`ModeS` FROM `aircraft_modes` group by ModeS) as KeepRows ON aircraft_modes.AircraftID = KeepRows.AircraftID WHERE KeepRows.AircraftID IS NULL";
10060 10476
 		$sth = $this->db->prepare($query);
10061 10477
 		$sth->execute();
10062 10478
 		
10063
-		if ($globalDebug) print "Aircraft...\n";
10479
+		if ($globalDebug) {
10480
+			print "Aircraft...\n";
10481
+		}
10064 10482
 		//aircraft
10065 10483
 		if ($globalDBdriver == 'mysql') {
10066 10484
 			$query  = "SELECT spotter_output.spotter_id, spotter_output.aircraft_icao, spotter_output.registration FROM spotter_output WHERE (spotter_output.aircraft_name = '' OR spotter_output.aircraft_name = 'Not Available') AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY)";
@@ -10103,26 +10521,38 @@  discard block
 block discarded – undo
10103 10521
 				 if (isset($closestAirports[0])) {
10104 10522
 					if ($row['arrival_airport_icao'] == $closestAirports[0]['icao']) {
10105 10523
 						$airport_icao = $closestAirports[0]['icao'];
10106
-						if ($globalDebug) echo "\o/ 1st ---++ Find arrival airport. airport_icao : ".$airport_icao."\n";
10524
+						if ($globalDebug) {
10525
+							echo "\o/ 1st ---++ Find arrival airport. airport_icao : ".$airport_icao."\n";
10526
+						}
10107 10527
 					} elseif (count($closestAirports > 1) && $row['arrival_airport_icao'] != '' && $row['arrival_airport_icao'] != 'NA') {
10108 10528
 						foreach ($closestAirports as $airport) {
10109 10529
 							if ($row['arrival_airport_icao'] == $airport['icao']) {
10110 10530
 								$airport_icao = $airport['icao'];
10111
-								if ($globalDebug) echo "\o/ try --++ Find arrival airport. airport_icao : ".$airport_icao."\n";
10531
+								if ($globalDebug) {
10532
+									echo "\o/ try --++ Find arrival airport. airport_icao : ".$airport_icao."\n";
10533
+								}
10112 10534
 								break;
10113 10535
 							}
10114 10536
 						}
10115 10537
 					} elseif ($row['last_altitude'] == 0 || ($row['last_altitude'] != '' && ($closestAirports[0]['altitude'] <= $row['last_altitude']*100+1000 && $row['last_altitude']*100 < $closestAirports[0]['altitude']+5000))) {
10116 10538
 						$airport_icao = $closestAirports[0]['icao'];
10117
-						if ($globalDebug) echo "\o/ NP --++ Find arrival airport. Airport ICAO : ".$airport_icao." !  Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist." - Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.($row['last_altitude']*100)."\n";
10539
+						if ($globalDebug) {
10540
+							echo "\o/ NP --++ Find arrival airport. Airport ICAO : ".$airport_icao." !  Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist." - Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.($row['last_altitude']*100)."\n";
10541
+						}
10118 10542
 					} else {
10119
-						if ($globalDebug) echo "----- Can't find arrival airport. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist." - Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.($row['last_altitude']*100)."\n";
10543
+						if ($globalDebug) {
10544
+							echo "----- Can't find arrival airport. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist." - Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.($row['last_altitude']*100)."\n";
10545
+						}
10120 10546
 					}
10121 10547
 				} else {
10122
-					if ($globalDebug) echo "----- No Airport near last coord. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist."\n";
10548
+					if ($globalDebug) {
10549
+						echo "----- No Airport near last coord. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist."\n";
10550
+					}
10123 10551
 				}
10124 10552
 				if ($row['real_arrival_airport_icao'] != $airport_icao) {
10125
-					if ($globalDebug) echo "Updating airport to ".$airport_icao."...\n";
10553
+					if ($globalDebug) {
10554
+						echo "Updating airport to ".$airport_icao."...\n";
10555
+					}
10126 10556
 					$update_query="UPDATE spotter_output SET real_arrival_airport_icao = :airport_icao WHERE spotter_id = :spotter_id";
10127 10557
 					$sthu = $this->db->prepare($update_query);
10128 10558
 					$sthu->execute(array(':airport_icao' => $airport_icao,':spotter_id' => $row['spotter_id']));
Please login to merge, or discard this patch.
Spacing   +795 added lines, -795 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
4 4
 require_once(dirname(__FILE__).'/class.Image.php');
5 5
 $global_query = "SELECT spotter_output.* FROM spotter_output";
6 6
 
7
-class Spotter{
7
+class Spotter {
8 8
 	public $db;
9 9
 	
10 10
 	public function __construct($dbc = null) {
@@ -17,14 +17,14 @@  discard block
 block discarded – undo
17 17
 	* @param Array $filter the filter
18 18
 	* @return Array the SQL part
19 19
 	*/
20
-	public function getFilter($filter = array(),$where = false,$and = false) {
20
+	public function getFilter($filter = array(), $where = false, $and = false) {
21 21
 		global $globalFilter;
22
-		if (is_array($globalFilter)) $filter = array_merge($globalFilter,$filter);
22
+		if (is_array($globalFilter)) $filter = array_merge($globalFilter, $filter);
23 23
 		$filter_query_join = '';
24 24
 		$filter_query_where = '';
25 25
 		if (isset($filter['airlines']) && !empty($filter['airlines'])) {
26 26
 			if ($filter['airlines'][0] != '') {
27
-				$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
27
+				$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
28 28
 			}
29 29
 		}
30 30
 		
@@ -32,16 +32,16 @@  discard block
 block discarded – undo
32 32
 			$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_output.flightaware_id ";
33 33
 		}
34 34
 		if (isset($filter['pilots_id']) && !empty($filter['pilots_id'])) {
35
-			$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$filter['pilots_id'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
35
+			$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $filter['pilots_id'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
36 36
 		}
37 37
 		if (isset($filter['source']) && !empty($filter['source'])) {
38
-			$filter_query_where = " WHERE format_source IN ('".implode("','",$filter['source'])."')";
38
+			$filter_query_where = " WHERE format_source IN ('".implode("','", $filter['source'])."')";
39 39
 		}
40 40
 		if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
41 41
 			if ($filter_query_where == '') {
42
-				$filter_query_where = " WHERE format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
42
+				$filter_query_where = " WHERE format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')";
43 43
 			} else {
44
-				$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
44
+				$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')";
45 45
 			}
46 46
 		}
47 47
 		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
 			$sth = $this->db->prepare($query.$limitQuery);
90 90
 			$sth->execute($params);
91 91
 		} catch (PDOException $e) {
92
-			printf("Invalid query : %s\nWhole query: %s\n",$e->getMessage(), $query.$limitQuery);
92
+			printf("Invalid query : %s\nWhole query: %s\n", $e->getMessage(), $query.$limitQuery);
93 93
 			exit();
94 94
 		}
95 95
 		
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 		$spotter_array = array();
100 100
 		
101 101
 
102
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
102
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
103 103
 		{
104 104
 			$num_rows++;
105 105
 			$temp_array = array();
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 			if (isset($row['route_stop'])) {
145 145
 				$temp_array['route_stop'] = $row['route_stop'];
146 146
 				if ($row['route_stop'] != '') {
147
-					$allroute = explode(' ',$row['route_stop']);
147
+					$allroute = explode(' ', $row['route_stop']);
148 148
 			
149 149
 					foreach ($allroute as $route) {
150 150
 						$route_airport_array = $this->getAllAirportInfo($route);
@@ -199,11 +199,11 @@  discard block
 block discarded – undo
199 199
 				{
200 200
 					$temp_array['date'] = "about ".$dateArray['hours']." hours ago";
201 201
 				} else {
202
-					$temp_array['date'] = date("M j Y, g:i a",strtotime($row['date']." UTC"));
202
+					$temp_array['date'] = date("M j Y, g:i a", strtotime($row['date']." UTC"));
203 203
 				}
204 204
 				$temp_array['date_minutes_past'] = $dateArray['minutes'];
205
-				$temp_array['date_iso_8601'] = date("c",strtotime($row['date']." UTC"));
206
-				$temp_array['date_rfc_2822'] = date("r",strtotime($row['date']." UTC"));
205
+				$temp_array['date_iso_8601'] = date("c", strtotime($row['date']." UTC"));
206
+				$temp_array['date_rfc_2822'] = date("r", strtotime($row['date']." UTC"));
207 207
 				$temp_array['date_unix'] = strtotime($row['date']." UTC");
208 208
 			}
209 209
 			
@@ -237,9 +237,9 @@  discard block
 block discarded – undo
237 237
 			if (!isset($row['airline_name']) || $row['airline_name'] == '') {
238 238
 				if (!is_numeric(substr($row['ident'], 0, 3))) {
239 239
 					if (is_numeric(substr($row['ident'], 2, 1))) {
240
-						$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 2),$fromsource);
240
+						$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 2), $fromsource);
241 241
 					} elseif (is_numeric(substr($row['ident'], 3, 1))) {
242
-						$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3),$fromsource);
242
+						$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3), $fromsource);
243 243
 					} else {
244 244
 						$airline_array = $this->getAllAirlineInfo('NA');
245 245
 					}
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
 				$temp_array['airline_type'] = $row['airline_type'];
266 266
 			}
267 267
 			if (isset($temp_array['airline_iata']) && $temp_array['airline_iata'] != '') {
268
-				$acars_array = $ACARS->getLiveAcarsData($temp_array['airline_iata'].substr($temp_array['ident'],3));
268
+				$acars_array = $ACARS->getLiveAcarsData($temp_array['airline_iata'].substr($temp_array['ident'], 3));
269 269
 				//$acars_array = ACARS->getLiveAcarsData('BA40YL');
270 270
 				if (count($acars_array) > 0) {
271 271
 					$temp_array['acars'] = $acars_array;
@@ -282,11 +282,11 @@  discard block
 block discarded – undo
282 282
 				$temp_array['aircraft_date_first_reg'] = $owner_info['date_first_reg'];
283 283
 			}
284 284
 
285
-			if($temp_array['registration'] != "" || ($globalIVAO && isset($temp_array['aircraft_type']) && $temp_array['aircraft_type'] != ''))
285
+			if ($temp_array['registration'] != "" || ($globalIVAO && isset($temp_array['aircraft_type']) && $temp_array['aircraft_type'] != ''))
286 286
 			{
287 287
 				if ($globalIVAO) {
288
-					if (isset($temp_array['airline_icao']))	$image_array = $Image->getSpotterImage('',$temp_array['aircraft_type'],$temp_array['airline_icao']);
289
-					else $image_array = $Image->getSpotterImage('',$temp_array['aircraft_type']);
288
+					if (isset($temp_array['airline_icao']))	$image_array = $Image->getSpotterImage('', $temp_array['aircraft_type'], $temp_array['airline_icao']);
289
+					else $image_array = $Image->getSpotterImage('', $temp_array['aircraft_type']);
290 290
 				} else $image_array = $Image->getSpotterImage($temp_array['registration']);
291 291
 				if (count($image_array) > 0) {
292 292
 					$temp_array['image'] = $image_array[0]['image'];
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
 			if (isset($row['arrival_airport_time']) && $row['arrival_airport_time'] != '') {
310 310
 				$temp_array['arrival_airport_time'] = $row['arrival_airport_time'];
311 311
 			}
312
-			if ((!isset($globalIVAO) || ! $globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalVAM) || !$globalVAM)) {
312
+			if ((!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalVAM) || !$globalVAM)) {
313 313
 				$schedule_array = $Schedule->getSchedule($temp_array['ident']);
314 314
 				//print_r($schedule_array);
315 315
 				if (count($schedule_array) > 0) {
@@ -390,12 +390,12 @@  discard block
 block discarded – undo
390 390
 			if (isset($row['squawk'])) {
391 391
 				$temp_array['squawk'] = $row['squawk'];
392 392
 				if ($row['squawk'] != '' && isset($temp_array['country_iso2'])) {
393
-					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$temp_array['country_iso2']);
394
-					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
393
+					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $temp_array['country_iso2']);
394
+					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $globalSquawkCountry);
395 395
 				} elseif ($row['squawk'] != '' && isset($temp_array['over_country'])) {
396
-					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$temp_array['over_country']);
397
-					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
398
-				} elseif ($row['squawk'] != '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
396
+					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $temp_array['over_country']);
397
+					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $globalSquawkCountry);
398
+				} elseif ($row['squawk'] != '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $globalSquawkCountry);
399 399
 			}
400 400
     			
401 401
 			$temp_array['query_number_rows'] = $num_rows;
@@ -414,7 +414,7 @@  discard block
 block discarded – undo
414 414
 	* @return Array the spotter information
415 415
 	*
416 416
 	*/
417
-	public function searchSpotterData($q = '', $registration = '', $aircraft_icao = '', $aircraft_manufacturer = '', $highlights = '', $airline_icao = '', $airline_country = '', $airline_type = '', $airport = '', $airport_country = '', $callsign = '', $departure_airport_route = '', $arrival_airport_route = '', $owner = '',$pilot_id = '',$pilot_name = '',$altitude = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '',$origLat = '',$origLon = '',$dist = '',$filter = array())
417
+	public function searchSpotterData($q = '', $registration = '', $aircraft_icao = '', $aircraft_manufacturer = '', $highlights = '', $airline_icao = '', $airline_country = '', $airline_type = '', $airport = '', $airport_country = '', $callsign = '', $departure_airport_route = '', $arrival_airport_route = '', $owner = '', $pilot_id = '', $pilot_name = '', $altitude = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '', $origLat = '', $origLon = '', $dist = '', $filter = array())
418 418
 	{
419 419
 		global $globalTimezone, $globalDBdriver;
420 420
 		require_once(dirname(__FILE__).'/class.Translation.php');
@@ -424,7 +424,7 @@  discard block
 block discarded – undo
424 424
 
425 425
 		$query_values = array();
426 426
 		$additional_query = '';
427
-		$filter_query = $this->getFilter($filter,true,true);
427
+		$filter_query = $this->getFilter($filter, true, true);
428 428
 		if ($q != "")
429 429
 		{
430 430
 			if (!is_string($q))
@@ -432,8 +432,8 @@  discard block
 block discarded – undo
432 432
 				return false;
433 433
 			} else {
434 434
 				$q_array = explode(" ", $q);
435
-				foreach ($q_array as $q_item){
436
-					$q_item = filter_var($q_item,FILTER_SANITIZE_STRING);
435
+				foreach ($q_array as $q_item) {
436
+					$q_item = filter_var($q_item, FILTER_SANITIZE_STRING);
437 437
 					$additional_query .= " AND (";
438 438
 					if (is_int($q_item)) $additional_query .= "(spotter_output.spotter_id like '%".$q_item."%') OR ";
439 439
 					$additional_query .= "(spotter_output.aircraft_icao like '%".$q_item."%') OR ";
@@ -465,37 +465,37 @@  discard block
 block discarded – undo
465 465
 
466 466
 		if ($registration != "")
467 467
 		{
468
-			$registration = filter_var($registration,FILTER_SANITIZE_STRING);
468
+			$registration = filter_var($registration, FILTER_SANITIZE_STRING);
469 469
 			if (!is_string($registration))
470 470
 			{
471 471
 				return false;
472 472
 			} else {
473 473
 				$additional_query .= " AND spotter_output.registration = :registration";
474
-				$query_values = array_merge($query_values,array(':registration' => $registration));
474
+				$query_values = array_merge($query_values, array(':registration' => $registration));
475 475
 			}
476 476
 		}
477 477
 
478 478
 		if ($aircraft_icao != "")
479 479
 		{
480
-			$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
480
+			$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
481 481
 			if (!is_string($aircraft_icao))
482 482
 			{
483 483
 				return false;
484 484
 			} else {
485 485
 				$additional_query .= " AND spotter_output.aircraft_icao = :aircraft_icao";
486
-				$query_values = array_merge($query_values,array(':aircraft_icao' => $aircraft_icao));
486
+				$query_values = array_merge($query_values, array(':aircraft_icao' => $aircraft_icao));
487 487
 			}
488 488
 		}
489 489
 
490 490
 		if ($aircraft_manufacturer != "")
491 491
 		{
492
-			$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
492
+			$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
493 493
 			if (!is_string($aircraft_manufacturer))
494 494
 			{
495 495
 				return false;
496 496
 			} else {
497 497
 				$additional_query .= " AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer";
498
-				$query_values = array_merge($query_values,array(':aircraft_manufacturer' => $aircraft_manufacturer));
498
+				$query_values = array_merge($query_values, array(':aircraft_manufacturer' => $aircraft_manufacturer));
499 499
 			}
500 500
 		}
501 501
 
@@ -511,25 +511,25 @@  discard block
 block discarded – undo
511 511
 
512 512
 		if ($airline_icao != "")
513 513
 		{
514
-			$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
514
+			$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
515 515
 			if (!is_string($airline_icao))
516 516
 			{
517 517
 				return false;
518 518
 			} else {
519 519
 				$additional_query .= " AND spotter_output.airline_icao = :airline_icao";
520
-				$query_values = array_merge($query_values,array(':airline_icao' => $airline_icao));
520
+				$query_values = array_merge($query_values, array(':airline_icao' => $airline_icao));
521 521
 			}
522 522
 		}
523 523
 
524 524
 		if ($airline_country != "")
525 525
 		{
526
-			$airline_country = filter_var($airline_country,FILTER_SANITIZE_STRING);
526
+			$airline_country = filter_var($airline_country, FILTER_SANITIZE_STRING);
527 527
 			if (!is_string($airline_country))
528 528
 			{
529 529
 				return false;
530 530
 			} else {
531 531
 				$additional_query .= " AND spotter_output.airline_country = :airline_country";
532
-				$query_values = array_merge($query_values,array(':airline_country' => $airline_country));
532
+				$query_values = array_merge($query_values, array(':airline_country' => $airline_country));
533 533
 			}
534 534
 		}
535 535
 
@@ -556,31 +556,31 @@  discard block
 block discarded – undo
556 556
 
557 557
 		if ($airport != "")
558 558
 		{
559
-			$airport = filter_var($airport,FILTER_SANITIZE_STRING);
559
+			$airport = filter_var($airport, FILTER_SANITIZE_STRING);
560 560
 			if (!is_string($airport))
561 561
 			{
562 562
 				return false;
563 563
 			} else {
564 564
 				$additional_query .= " AND (spotter_output.departure_airport_icao = :airport OR spotter_output.arrival_airport_icao = :airport)";
565
-				$query_values = array_merge($query_values,array(':airport' => $airport));
565
+				$query_values = array_merge($query_values, array(':airport' => $airport));
566 566
 			}
567 567
 		}
568 568
 
569 569
 		if ($airport_country != "")
570 570
 		{
571
-			$airport_country = filter_var($airport_country,FILTER_SANITIZE_STRING);
571
+			$airport_country = filter_var($airport_country, FILTER_SANITIZE_STRING);
572 572
 			if (!is_string($airport_country))
573 573
 			{
574 574
 				return false;
575 575
 			} else {
576 576
 				$additional_query .= " AND (spotter_output.departure_airport_country = :airport_country OR spotter_output.arrival_airport_country = :airport_country)";
577
-				$query_values = array_merge($query_values,array(':airport_country' => $airport_country));
577
+				$query_values = array_merge($query_values, array(':airport_country' => $airport_country));
578 578
 			}
579 579
 		}
580 580
     
581 581
 		if ($callsign != "")
582 582
 		{
583
-			$callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
583
+			$callsign = filter_var($callsign, FILTER_SANITIZE_STRING);
584 584
 			if (!is_string($callsign))
585 585
 			{
586 586
 				return false;
@@ -588,79 +588,79 @@  discard block
 block discarded – undo
588 588
 				$translate = $Translation->ident2icao($callsign);
589 589
 				if ($translate != $callsign) {
590 590
 					$additional_query .= " AND (spotter_output.ident = :callsign OR spotter_output.ident = :translate)";
591
-					$query_values = array_merge($query_values,array(':callsign' => $callsign,':translate' => $translate));
591
+					$query_values = array_merge($query_values, array(':callsign' => $callsign, ':translate' => $translate));
592 592
 				} else {
593 593
 					$additional_query .= " AND spotter_output.ident = :callsign";
594
-					$query_values = array_merge($query_values,array(':callsign' => $callsign));
594
+					$query_values = array_merge($query_values, array(':callsign' => $callsign));
595 595
 				}
596 596
 			}
597 597
 		}
598 598
 
599 599
 		if ($owner != "")
600 600
 		{
601
-			$owner = filter_var($owner,FILTER_SANITIZE_STRING);
601
+			$owner = filter_var($owner, FILTER_SANITIZE_STRING);
602 602
 			if (!is_string($owner))
603 603
 			{
604 604
 				return false;
605 605
 			} else {
606 606
 				$additional_query .= " AND spotter_output.owner_name = :owner";
607
-				$query_values = array_merge($query_values,array(':owner' => $owner));
607
+				$query_values = array_merge($query_values, array(':owner' => $owner));
608 608
 			}
609 609
 		}
610 610
 
611 611
 		if ($pilot_name != "")
612 612
 		{
613
-			$pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING);
613
+			$pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING);
614 614
 			if (!is_string($pilot_name))
615 615
 			{
616 616
 				return false;
617 617
 			} else {
618 618
 				$additional_query .= " AND spotter_output.pilot_name = :pilot_name";
619
-				$query_values = array_merge($query_values,array(':pilot_name' => $pilot_name));
619
+				$query_values = array_merge($query_values, array(':pilot_name' => $pilot_name));
620 620
 			}
621 621
 		}
622 622
 
623 623
 		if ($pilot_id != "")
624 624
 		{
625
-			$pilot_id = filter_var($pilot_id,FILTER_SANITIZE_NUMBER_INT);
625
+			$pilot_id = filter_var($pilot_id, FILTER_SANITIZE_NUMBER_INT);
626 626
 			if (!is_string($pilot_id))
627 627
 			{
628 628
 				return false;
629 629
 			} else {
630 630
 				$additional_query .= " AND spotter_output.pilot_id = :pilot_id";
631
-				$query_values = array_merge($query_values,array(':pilot_id' => $pilot_id));
631
+				$query_values = array_merge($query_values, array(':pilot_id' => $pilot_id));
632 632
 			}
633 633
 		}
634 634
 
635 635
 		if ($departure_airport_route != "")
636 636
 		{
637
-			$departure_airport_route = filter_var($departure_airport_route,FILTER_SANITIZE_STRING);
637
+			$departure_airport_route = filter_var($departure_airport_route, FILTER_SANITIZE_STRING);
638 638
 			if (!is_string($departure_airport_route))
639 639
 			{
640 640
 				return false;
641 641
 			} else {
642 642
 				$additional_query .= " AND spotter_output.departure_airport_icao = :departure_airport_route";
643
-				$query_values = array_merge($query_values,array(':departure_airport_route' => $departure_airport_route));
643
+				$query_values = array_merge($query_values, array(':departure_airport_route' => $departure_airport_route));
644 644
 			}
645 645
 		}
646 646
 
647 647
 		if ($arrival_airport_route != "")
648 648
 		{
649
-			$arrival_airport_route = filter_var($arrival_airport_route,FILTER_SANITIZE_STRING);
649
+			$arrival_airport_route = filter_var($arrival_airport_route, FILTER_SANITIZE_STRING);
650 650
 			if (!is_string($arrival_airport_route))
651 651
 			{
652 652
 				return false;
653 653
 			} else {
654 654
 				$additional_query .= " AND spotter_output.arrival_airport_icao = :arrival_airport_route";
655
-				$query_values = array_merge($query_values,array(':arrival_airport_route' => $arrival_airport_route));
655
+				$query_values = array_merge($query_values, array(':arrival_airport_route' => $arrival_airport_route));
656 656
 			}
657 657
 		}
658 658
 
659 659
 		if ($altitude != "")
660 660
 		{
661 661
 			$altitude_array = explode(",", $altitude);
662
-			$altitude_array[0] = filter_var($altitude_array[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
663
-			$altitude_array[1] = filter_var($altitude_array[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
662
+			$altitude_array[0] = filter_var($altitude_array[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
663
+			$altitude_array[1] = filter_var($altitude_array[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
664 664
 
665 665
 			if ($altitude_array[1] != "")
666 666
 			{                
@@ -676,8 +676,8 @@  discard block
 block discarded – undo
676 676
 		if ($date_posted != "")
677 677
 		{
678 678
 			$date_array = explode(",", $date_posted);
679
-			$date_array[0] = filter_var($date_array[0],FILTER_SANITIZE_STRING);
680
-			$date_array[1] = filter_var($date_array[1],FILTER_SANITIZE_STRING);
679
+			$date_array[0] = filter_var($date_array[0], FILTER_SANITIZE_STRING);
680
+			$date_array[1] = filter_var($date_array[1], FILTER_SANITIZE_STRING);
681 681
 
682 682
 			if ($globalTimezone != '') {
683 683
 				date_default_timezone_set($globalTimezone);
@@ -708,8 +708,8 @@  discard block
 block discarded – undo
708 708
 		{
709 709
 			$limit_array = explode(",", $limit);
710 710
 			
711
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
712
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
711
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
712
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
713 713
 			
714 714
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
715 715
 			{
@@ -738,23 +738,23 @@  discard block
 block discarded – undo
738 738
 
739 739
 
740 740
 		if ($origLat != "" && $origLon != "" && $dist != "") {
741
-			$dist = number_format($dist*0.621371,2,'.',''); // convert km to mile
741
+			$dist = number_format($dist*0.621371, 2, '.', ''); // convert km to mile
742 742
 
743 743
 			if ($globalDBdriver == 'mysql') {
744
-				$query="SELECT spotter_output.*, 1.60935*3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - spotter_archive.latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(spotter_archive.latitude*pi()/180)*POWER(SIN(($origLon-spotter_archive.longitude)*pi()/180/2),2))) as distance 
744
+				$query = "SELECT spotter_output.*, 1.60935*3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - spotter_archive.latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(spotter_archive.latitude*pi()/180)*POWER(SIN(($origLon-spotter_archive.longitude)*pi()/180/2),2))) as distance 
745 745
 						FROM spotter_output, spotter_archive".$filter_query." spotter_output.flightaware_id = spotter_archive.flightaware_id AND spotter_output.ident <> '' ".$additional_query."AND spotter_archive.longitude between ($origLon-$dist/cos(radians($origLat))*69) and ($origLon+$dist/cos(radians($origLat)*69)) and spotter_archive.latitude between ($origLat-($dist/69)) and ($origLat+($dist/69)) 
746 746
 						AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - spotter_archive.latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(spotter_archive.latitude*pi()/180)*POWER(SIN(($origLon-spotter_archive.longitude)*pi()/180/2),2)))) < $dist".$orderby_query;
747 747
 			} else {
748
-				$query="SELECT spotter_output.*, 1.60935 * 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(spotter_archive.latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(spotter_archive.latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(spotter_archive.longitude as double precision))*pi()/180/2),2))) as distance 
748
+				$query = "SELECT spotter_output.*, 1.60935 * 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(spotter_archive.latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(spotter_archive.latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(spotter_archive.longitude as double precision))*pi()/180/2),2))) as distance 
749 749
 						FROM spotter_output, spotter_archive".$filter_query." spotter_output.flightaware_id = spotter_archive.flightaware_id AND spotter_output.ident <> '' ".$additional_query."AND CAST(spotter_archive.longitude as double precision) between ($origLon-$dist/cos(radians($origLat))*69) and ($origLon+$dist/cos(radians($origLat))*69) and CAST(spotter_archive.latitude as double precision) between ($origLat-($dist/69)) and ($origLat+($dist/69)) 
750 750
 						AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(spotter_archive.latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(spotter_archive.latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(spotter_archive.longitude as double precision))*pi()/180/2),2)))) < $dist".$filter_query.$orderby_query;
751 751
 			}
752 752
 		} else {		
753
-			$query  = "SELECT spotter_output.* FROM spotter_output ".$filter_query." spotter_output.ident <> '' 
753
+			$query = "SELECT spotter_output.* FROM spotter_output ".$filter_query." spotter_output.ident <> '' 
754 754
 					".$additional_query."
755 755
 					".$orderby_query;
756 756
 		}
757
-		$spotter_array = $this->getDataFromDB($query, $query_values,$limit_query);
757
+		$spotter_array = $this->getDataFromDB($query, $query_values, $limit_query);
758 758
 		return $spotter_array;
759 759
 	}
760 760
 	
@@ -777,8 +777,8 @@  discard block
 block discarded – undo
777 777
 		{
778 778
 			$limit_array = explode(",", $limit);
779 779
 			
780
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
781
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
780
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
781
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
782 782
 			
783 783
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
784 784
 			{
@@ -795,9 +795,9 @@  discard block
 block discarded – undo
795 795
 			$orderby_query = " ORDER BY spotter_output.date DESC";
796 796
 		}
797 797
 
798
-		$query  = $global_query.$filter_query." ".$orderby_query;
798
+		$query = $global_query.$filter_query." ".$orderby_query;
799 799
 
800
-		$spotter_array = $this->getDataFromDB($query, array(),$limit_query);
800
+		$spotter_array = $this->getDataFromDB($query, array(), $limit_query);
801 801
 
802 802
 		return $spotter_array;
803 803
 	}
@@ -843,34 +843,34 @@  discard block
 block discarded – undo
843 843
 			{
844 844
 				return false;
845 845
 			} else {
846
-				if ($interval == "30m"){
846
+				if ($interval == "30m") {
847 847
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE) <= $this_output.date ';
848
-				} else if ($interval == "1h"){
848
+				} else if ($interval == "1h") {
849 849
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) <= $this_output.date ';
850
-				} else if ($interval == "3h"){
850
+				} else if ($interval == "3h") {
851 851
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 3 HOUR) <= $this_output.date ';
852
-				} else if ($interval == "6h"){
852
+				} else if ($interval == "6h") {
853 853
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 6 HOUR) <= $this_output.date ';
854
-				} else if ($interval == "12h"){
854
+				} else if ($interval == "12h") {
855 855
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 12 HOUR) <= $this_output.date ';
856
-				} else if ($interval == "24h"){
856
+				} else if ($interval == "24h") {
857 857
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 24 HOUR) <= $this_output.date ';
858
-				} else if ($interval == "7d"){
858
+				} else if ($interval == "7d") {
859 859
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY) <= $this_output.date ';
860
-				} else if ($interval == "30d"){
860
+				} else if ($interval == "30d") {
861 861
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 DAY) <= $this_output.date ';
862 862
 				} 
863 863
 			}
864 864
 		}
865 865
 
866
-		$query  = "SELECT spotter_output.*, ( 6371 * acos( cos( radians($lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians($lng) ) + sin( radians($lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_output 
866
+		$query = "SELECT spotter_output.*, ( 6371 * acos( cos( radians($lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians($lng) ) + sin( radians($lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_output 
867 867
                    WHERE spotter_output.latitude <> '' 
868 868
 				   AND spotter_output.longitude <> '' 
869 869
                    ".$additional_query."
870 870
                    HAVING distance < :radius  
871 871
 				   ORDER BY distance";
872 872
 
873
-		$spotter_array = $this->getDataFromDB($query, array(':radius' => $radius),$limit_query);
873
+		$spotter_array = $this->getDataFromDB($query, array(':radius' => $radius), $limit_query);
874 874
 
875 875
 		return $spotter_array;
876 876
 	}
@@ -882,21 +882,21 @@  discard block
 block discarded – undo
882 882
 	* @return Array the spotter information
883 883
 	*
884 884
 	*/
885
-	public function getNewestSpotterDataSortedByAircraftType($limit = '', $sort = '',$filter = array())
885
+	public function getNewestSpotterDataSortedByAircraftType($limit = '', $sort = '', $filter = array())
886 886
 	{
887 887
 		global $global_query;
888 888
 		
889 889
 		date_default_timezone_set('UTC');
890 890
 
891
-		$filter_query = $this->getFilter($filter,true,true);
891
+		$filter_query = $this->getFilter($filter, true, true);
892 892
 
893 893
 		$limit_query = '';
894 894
 		if ($limit != "")
895 895
 		{
896 896
 			$limit_array = explode(",", $limit);
897 897
 			
898
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
899
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
898
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
899
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
900 900
 			
901 901
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
902 902
 			{
@@ -913,7 +913,7 @@  discard block
 block discarded – undo
913 913
 			$orderby_query = " ORDER BY spotter_output.date DESC ";
914 914
 		}
915 915
 
916
-		$query  = $global_query." ".$filter_query." spotter_output.aircraft_name <> '' GROUP BY spotter_output.aircraft_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query;
916
+		$query = $global_query." ".$filter_query." spotter_output.aircraft_name <> '' GROUP BY spotter_output.aircraft_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query;
917 917
 
918 918
 		$spotter_array = $this->getDataFromDB($query, array(), $limit_query);
919 919
 
@@ -932,15 +932,15 @@  discard block
 block discarded – undo
932 932
 		global $global_query;
933 933
 		
934 934
 		date_default_timezone_set('UTC');
935
-		$filter_query = $this->getFilter($filter,true,true);
935
+		$filter_query = $this->getFilter($filter, true, true);
936 936
 
937 937
 		$limit_query = '';
938 938
 		if ($limit != "")
939 939
 		{
940 940
 			$limit_array = explode(",", $limit);
941 941
 			
942
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
943
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
942
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
943
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
944 944
 			
945 945
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
946 946
 			{
@@ -957,7 +957,7 @@  discard block
 block discarded – undo
957 957
 			$orderby_query = " ORDER BY spotter_output.date DESC ";
958 958
 		}
959 959
 
960
-		$query  = $global_query." ".$filter_query." spotter_output.registration <> '' GROUP BY spotter_output.registration,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query;
960
+		$query = $global_query." ".$filter_query." spotter_output.registration <> '' GROUP BY spotter_output.registration,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query;
961 961
 
962 962
 		$spotter_array = $this->getDataFromDB($query, array(), $limit_query);
963 963
 
@@ -971,20 +971,20 @@  discard block
 block discarded – undo
971 971
 	* @return Array the spotter information
972 972
 	*
973 973
 	*/
974
-	public function getNewestSpotterDataSortedByAirline($limit = '', $sort = '',$filter = array())
974
+	public function getNewestSpotterDataSortedByAirline($limit = '', $sort = '', $filter = array())
975 975
 	{
976 976
 		global $global_query;
977 977
 		
978 978
 		date_default_timezone_set('UTC');
979
-		$filter_query = $this->getFilter($filter,true,true);
979
+		$filter_query = $this->getFilter($filter, true, true);
980 980
 		
981 981
 		$limit_query = '';
982 982
 		if ($limit != "")
983 983
 		{
984 984
 			$limit_array = explode(",", $limit);
985 985
 			
986
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
987
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
986
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
987
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
988 988
 			
989 989
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
990 990
 			{
@@ -1001,7 +1001,7 @@  discard block
 block discarded – undo
1001 1001
 			$orderby_query = " ORDER BY spotter_output.date DESC ";
1002 1002
 		}
1003 1003
 
1004
-		$query  = $global_query." ".$filter_query." spotter_output.airline_name <> '' GROUP BY spotter_output.airline_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query;
1004
+		$query = $global_query." ".$filter_query." spotter_output.airline_name <> '' GROUP BY spotter_output.airline_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query;
1005 1005
 
1006 1006
 		$spotter_array = $this->getDataFromDB($query, array(), $limit_query);
1007 1007
 
@@ -1021,7 +1021,7 @@  discard block
 block discarded – undo
1021 1021
 		
1022 1022
 		date_default_timezone_set('UTC');
1023 1023
 		
1024
-		$filter_query = $this->getFilter($filter,true,true);
1024
+		$filter_query = $this->getFilter($filter, true, true);
1025 1025
 		
1026 1026
 		$limit_query = '';
1027 1027
 		
@@ -1029,8 +1029,8 @@  discard block
 block discarded – undo
1029 1029
 		{
1030 1030
 			$limit_array = explode(",", $limit);
1031 1031
 			
1032
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1033
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1032
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1033
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1034 1034
 			
1035 1035
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1036 1036
 			{
@@ -1047,7 +1047,7 @@  discard block
 block discarded – undo
1047 1047
 			$orderby_query = " ORDER BY spotter_output.date DESC ";
1048 1048
 		}
1049 1049
 
1050
-		$query  = $global_query." ".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' GROUP BY spotter_output.departure_airport_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query;
1050
+		$query = $global_query." ".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' GROUP BY spotter_output.departure_airport_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query;
1051 1051
 
1052 1052
 		$spotter_array = $this->getDataFromDB($query, array(), $limit_query);
1053 1053
 
@@ -1066,14 +1066,14 @@  discard block
 block discarded – undo
1066 1066
 		global $global_query;
1067 1067
 		
1068 1068
 		date_default_timezone_set('UTC');
1069
-		$filter_query = $this->getFilter($filter,true,true);
1069
+		$filter_query = $this->getFilter($filter, true, true);
1070 1070
 		$limit_query = '';
1071 1071
 		if ($limit != "")
1072 1072
 		{
1073 1073
 			$limit_array = explode(",", $limit);
1074 1074
 			
1075
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1076
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1075
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1076
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1077 1077
 			
1078 1078
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1079 1079
 			{
@@ -1090,7 +1090,7 @@  discard block
 block discarded – undo
1090 1090
 			$orderby_query = " ORDER BY spotter_output.date DESC ";
1091 1091
 		}
1092 1092
 
1093
-		$query  = $global_query.$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' GROUP BY spotter_output.arrival_airport_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query;
1093
+		$query = $global_query.$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' GROUP BY spotter_output.arrival_airport_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query;
1094 1094
 
1095 1095
 		$spotter_array = $this->getDataFromDB($query, array(), $limit_query);
1096 1096
 
@@ -1114,9 +1114,9 @@  discard block
 block discarded – undo
1114 1114
 		$query_values = array(':id' => $id);
1115 1115
 
1116 1116
 		//$query  = $global_query." WHERE spotter_output.ident <> '' ".$additional_query." ";
1117
-		$query  = $global_query." WHERE ".$additional_query." ";
1117
+		$query = $global_query." WHERE ".$additional_query." ";
1118 1118
 
1119
-		$spotter_array = $this->getDataFromDB($query,$query_values);
1119
+		$spotter_array = $this->getDataFromDB($query, $query_values);
1120 1120
 
1121 1121
 		return $spotter_array;
1122 1122
 	}
@@ -1154,8 +1154,8 @@  discard block
 block discarded – undo
1154 1154
 		{
1155 1155
 			$limit_array = explode(",", $limit);
1156 1156
 			
1157
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1158
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1157
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1158
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1159 1159
 			
1160 1160
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1161 1161
 			{
@@ -1196,7 +1196,7 @@  discard block
 block discarded – undo
1196 1196
 		$query_values = array();
1197 1197
 		$limit_query = '';
1198 1198
 		$additional_query = '';
1199
-		$filter_query = $this->getFilter($filter,true,true);
1199
+		$filter_query = $this->getFilter($filter, true, true);
1200 1200
 		
1201 1201
 		if ($aircraft_type != "")
1202 1202
 		{
@@ -1213,8 +1213,8 @@  discard block
 block discarded – undo
1213 1213
 		{
1214 1214
 			$limit_array = explode(",", $limit);
1215 1215
 			
1216
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1217
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1216
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1217
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1218 1218
 			
1219 1219
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1220 1220
 			{
@@ -1254,7 +1254,7 @@  discard block
 block discarded – undo
1254 1254
 		$query_values = array();
1255 1255
 		$limit_query = '';
1256 1256
 		$additional_query = '';
1257
-		$filter_query = $this->getFilter($filter,true,true);
1257
+		$filter_query = $this->getFilter($filter, true, true);
1258 1258
 		
1259 1259
 		if ($registration != "")
1260 1260
 		{
@@ -1271,8 +1271,8 @@  discard block
 block discarded – undo
1271 1271
 		{
1272 1272
 			$limit_array = explode(",", $limit);
1273 1273
 			
1274
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1275
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1274
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1275
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1276 1276
 			
1277 1277
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1278 1278
 			{
@@ -1330,8 +1330,8 @@  discard block
 block discarded – undo
1330 1330
 		{
1331 1331
 			$limit_array = explode(",", $limit);
1332 1332
 			
1333
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1334
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1333
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1334
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1335 1335
 			
1336 1336
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1337 1337
 			{
@@ -1385,8 +1385,8 @@  discard block
 block discarded – undo
1385 1385
 		{
1386 1386
 			$limit_array = explode(",", $limit);
1387 1387
 			
1388
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1389
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1388
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1389
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1390 1390
 			
1391 1391
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1392 1392
 			{
@@ -1418,7 +1418,7 @@  discard block
 block discarded – undo
1418 1418
 	* @return Array the spotter information
1419 1419
 	*
1420 1420
 	*/
1421
-	public function getSpotterDataByDate($date = '', $limit = '', $sort = '',$filter = array())
1421
+	public function getSpotterDataByDate($date = '', $limit = '', $sort = '', $filter = array())
1422 1422
 	{
1423 1423
 		global $global_query, $globalTimezone, $globalDBdriver;
1424 1424
 		
@@ -1428,19 +1428,19 @@  discard block
 block discarded – undo
1428 1428
 
1429 1429
 		$filter_query = '';
1430 1430
 		if (isset($filter['source']) && !empty($filter['source'])) {
1431
-			$filter_query = " AND format_source IN ('".implode("','",$filter['source'])."')";
1431
+			$filter_query = " AND format_source IN ('".implode("','", $filter['source'])."')";
1432 1432
 		}
1433 1433
 		if (isset($filter['airlines']) && !empty($filter['airlines'])) {
1434
-			$filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_live.flightaware_id";
1434
+			$filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) so ON so.flightaware_id = spotter_live.flightaware_id";
1435 1435
 		}
1436 1436
 		if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
1437 1437
 			$filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_live.flightaware_id ";
1438 1438
 		}
1439 1439
 		if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
1440
-			$filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
1440
+			$filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')";
1441 1441
 		}
1442 1442
 		if (isset($filter['pilots_id']) && !empty($filter['pilots_id'])) {
1443
-			$filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$filter['pilots_id'])."')) so ON so.flightaware_id = spotter_live.flightaware_id";
1443
+			$filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $filter['pilots_id'])."')) so ON so.flightaware_id = spotter_live.flightaware_id";
1444 1444
 		}
1445 1445
 	
1446 1446
 		
@@ -1468,8 +1468,8 @@  discard block
 block discarded – undo
1468 1468
 		{
1469 1469
 			$limit_array = explode(",", $limit);
1470 1470
 			
1471
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1472
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1471
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1472
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1473 1473
 			
1474 1474
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1475 1475
 			{
@@ -1524,8 +1524,8 @@  discard block
 block discarded – undo
1524 1524
 		{
1525 1525
 			$limit_array = explode(",", $limit);
1526 1526
 			
1527
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1528
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1527
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1528
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1529 1529
 			
1530 1530
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1531 1531
 			{
@@ -1581,8 +1581,8 @@  discard block
 block discarded – undo
1581 1581
 		{
1582 1582
 			$limit_array = explode(",", $limit);
1583 1583
 			
1584
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1585
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1584
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1585
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1586 1586
 			
1587 1587
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1588 1588
 			{
@@ -1630,7 +1630,7 @@  discard block
 block discarded – undo
1630 1630
 			{
1631 1631
 				return false;
1632 1632
 			} else {
1633
-				$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
1633
+				$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
1634 1634
 				$additional_query .= " AND (spotter_output.departure_airport_icao = :departure_airport_icao)";
1635 1635
 				$query_values = array(':departure_airport_icao' => $departure_airport_icao);
1636 1636
 			}
@@ -1642,9 +1642,9 @@  discard block
 block discarded – undo
1642 1642
 			{
1643 1643
 				return false;
1644 1644
 			} else {
1645
-				$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
1645
+				$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
1646 1646
 				$additional_query .= " AND (spotter_output.arrival_airport_icao = :arrival_airport_icao)";
1647
-				$query_values = array_merge($query_values,array(':arrival_airport_icao' => $arrival_airport_icao));
1647
+				$query_values = array_merge($query_values, array(':arrival_airport_icao' => $arrival_airport_icao));
1648 1648
 			}
1649 1649
 		}
1650 1650
 		
@@ -1652,8 +1652,8 @@  discard block
 block discarded – undo
1652 1652
 		{
1653 1653
 			$limit_array = explode(",", $limit);
1654 1654
 			
1655
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1656
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1655
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1656
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1657 1657
 			
1658 1658
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1659 1659
 			{
@@ -1692,15 +1692,15 @@  discard block
 block discarded – undo
1692 1692
 		global $global_query;
1693 1693
 		
1694 1694
 		date_default_timezone_set('UTC');
1695
-		$filter_query = $this->getFilter($filter,true,true);
1695
+		$filter_query = $this->getFilter($filter, true, true);
1696 1696
 		$limit_query = '';
1697 1697
 		
1698 1698
 		if ($limit != "")
1699 1699
 		{
1700 1700
 			$limit_array = explode(",", $limit);
1701 1701
 			
1702
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1703
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1702
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1703
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1704 1704
 			
1705 1705
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1706 1706
 			{
@@ -1717,7 +1717,7 @@  discard block
 block discarded – undo
1717 1717
 			$orderby_query = " ORDER BY spotter_output.date DESC";
1718 1718
 		}
1719 1719
 
1720
-		$query  = $global_query.$filter_query." spotter_output.highlight <> '' ".$orderby_query;
1720
+		$query = $global_query.$filter_query." spotter_output.highlight <> '' ".$orderby_query;
1721 1721
 
1722 1722
 		$spotter_array = $this->getDataFromDB($query, array(), $limit_query);
1723 1723
 
@@ -1730,19 +1730,19 @@  discard block
 block discarded – undo
1730 1730
 	* @return String the highlight text
1731 1731
 	*
1732 1732
 	*/
1733
-	public function getHighlightByRegistration($registration,$filter = array())
1733
+	public function getHighlightByRegistration($registration, $filter = array())
1734 1734
 	{
1735 1735
 		global $global_query;
1736 1736
 		
1737 1737
 		date_default_timezone_set('UTC');
1738
-		$filter_query = $this->getFilter($filter,true,true);
1739
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
1738
+		$filter_query = $this->getFilter($filter, true, true);
1739
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
1740 1740
 		
1741
-		$query  = $global_query.$filter_query." spotter_output.highlight <> '' AND spotter_output.registration = :registration";
1741
+		$query = $global_query.$filter_query." spotter_output.highlight <> '' AND spotter_output.registration = :registration";
1742 1742
 		$sth = $this->db->prepare($query);
1743 1743
 		$sth->execute(array(':registration' => $registration));
1744 1744
 
1745
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
1745
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
1746 1746
 		{
1747 1747
 			$highlight = $row['highlight'];
1748 1748
 		}
@@ -1758,14 +1758,14 @@  discard block
 block discarded – undo
1758 1758
 	* @return String usage
1759 1759
 	*
1760 1760
 	*/
1761
-	public function getSquawkUsage($squawk = '',$country = 'FR')
1761
+	public function getSquawkUsage($squawk = '', $country = 'FR')
1762 1762
 	{
1763 1763
 		
1764
-		$squawk = filter_var($squawk,FILTER_SANITIZE_STRING);
1765
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
1764
+		$squawk = filter_var($squawk, FILTER_SANITIZE_STRING);
1765
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
1766 1766
 
1767 1767
 		$query  = "SELECT squawk.* FROM squawk WHERE squawk.code = :squawk AND squawk.country = :country LIMIT 1";
1768
-		$query_values = array(':squawk' => ltrim($squawk,'0'), ':country' => $country);
1768
+		$query_values = array(':squawk' => ltrim($squawk, '0'), ':country' => $country);
1769 1769
 		
1770 1770
 		$sth = $this->db->prepare($query);
1771 1771
 		$sth->execute($query_values);
@@ -1786,9 +1786,9 @@  discard block
 block discarded – undo
1786 1786
 	public function getAirportIcao($airport_iata = '')
1787 1787
 	{
1788 1788
 		
1789
-		$airport_iata = filter_var($airport_iata,FILTER_SANITIZE_STRING);
1789
+		$airport_iata = filter_var($airport_iata, FILTER_SANITIZE_STRING);
1790 1790
 
1791
-		$query  = "SELECT airport.* FROM airport WHERE airport.iata = :airport LIMIT 1";
1791
+		$query = "SELECT airport.* FROM airport WHERE airport.iata = :airport LIMIT 1";
1792 1792
 		$query_values = array(':airport' => $airport_iata);
1793 1793
 		
1794 1794
 		$sth = $this->db->prepare($query);
@@ -1809,12 +1809,12 @@  discard block
 block discarded – undo
1809 1809
 	* @return Float distance to the airport
1810 1810
 	*
1811 1811
 	*/
1812
-	public function getAirportDistance($airport_icao,$latitude,$longitude)
1812
+	public function getAirportDistance($airport_icao, $latitude, $longitude)
1813 1813
 	{
1814 1814
 		
1815
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
1815
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
1816 1816
 
1817
-		$query  = "SELECT airport.latitude, airport.longitude FROM airport WHERE airport.icao = :airport LIMIT 1";
1817
+		$query = "SELECT airport.latitude, airport.longitude FROM airport WHERE airport.icao = :airport LIMIT 1";
1818 1818
 		$query_values = array(':airport' => $airport_icao);
1819 1819
 		$sth = $this->db->prepare($query);
1820 1820
 		$sth->execute($query_values);
@@ -1823,7 +1823,7 @@  discard block
 block discarded – undo
1823 1823
 			$airport_latitude = $row['latitude'];
1824 1824
 			$airport_longitude = $row['longitude'];
1825 1825
 			$Common = new Common();
1826
-			return $Common->distance($latitude,$longitude,$airport_latitude,$airport_longitude);
1826
+			return $Common->distance($latitude, $longitude, $airport_latitude, $airport_longitude);
1827 1827
 		} else return '';
1828 1828
 	}
1829 1829
 	
@@ -1837,11 +1837,11 @@  discard block
 block discarded – undo
1837 1837
 	public function getAllAirportInfo($airport = '')
1838 1838
 	{
1839 1839
 		
1840
-		$airport = filter_var($airport,FILTER_SANITIZE_STRING);
1840
+		$airport = filter_var($airport, FILTER_SANITIZE_STRING);
1841 1841
 
1842 1842
 		$query_values = array();
1843 1843
 		if ($airport == 'NA') {
1844
-			return array(array('name' => 'Not available','city' => 'N/A', 'country' => 'N/A','iata' => 'NA','icao' => 'NA','altitude' => NULL,'latitude' => 0,'longitude' => 0,'type' => 'NA','home_link' => '','wikipedia_link' => '','image_thumb' => '', 'image' => ''));
1844
+			return array(array('name' => 'Not available', 'city' => 'N/A', 'country' => 'N/A', 'iata' => 'NA', 'icao' => 'NA', 'altitude' => NULL, 'latitude' => 0, 'longitude' => 0, 'type' => 'NA', 'home_link' => '', 'wikipedia_link' => '', 'image_thumb' => '', 'image' => ''));
1845 1845
 		} elseif ($airport == '') {
1846 1846
 			$query  = "SELECT airport.name, airport.city, airport.country, airport.iata, airport.icao, airport.latitude, airport.longitude, airport.altitude, airport.type, airport.home_link, airport.wikipedia_link, airport.image_thumb, airport.image FROM airport";
1847 1847
 		} else {
@@ -1889,14 +1889,14 @@  discard block
 block discarded – undo
1889 1889
 	{
1890 1890
 		$lst_countries = '';
1891 1891
 		foreach ($countries as $country) {
1892
-			$country = filter_var($country,FILTER_SANITIZE_STRING);
1892
+			$country = filter_var($country, FILTER_SANITIZE_STRING);
1893 1893
 			if ($lst_countries == '') {
1894 1894
 				$lst_countries = "'".$country."'";
1895 1895
 			} else {
1896 1896
 				$lst_countries .= ",'".$country."'";
1897 1897
 			}
1898 1898
 		}
1899
-		$query  = "SELECT airport.* FROM airport WHERE airport.country IN (".$lst_countries.")";
1899
+		$query = "SELECT airport.* FROM airport WHERE airport.country IN (".$lst_countries.")";
1900 1900
 		
1901 1901
 		$sth = $this->db->prepare($query);
1902 1902
 		$sth->execute();
@@ -1904,7 +1904,7 @@  discard block
 block discarded – undo
1904 1904
 		$airport_array = array();
1905 1905
 		$temp_array = array();
1906 1906
 		
1907
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
1907
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
1908 1908
 		{
1909 1909
 			$temp_array['name'] = $row['name'];
1910 1910
 			$temp_array['city'] = $row['city'];
@@ -1932,10 +1932,10 @@  discard block
 block discarded – undo
1932 1932
 	{
1933 1933
 		global $globalDBdriver;
1934 1934
 		if (is_array($coord)) {
1935
-			$minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1936
-			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1937
-			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1938
-			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1935
+			$minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1936
+			$minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1937
+			$maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1938
+			$maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1939 1939
 		} else return array();
1940 1940
 		if ($globalDBdriver == 'mysql') {
1941 1941
 			$query  = "SELECT airport.* FROM airport WHERE airport.latitude BETWEEN ".$minlat." AND ".$maxlat." AND airport.longitude BETWEEN ".$minlong." AND ".$maxlong." AND airport.type != 'closed'";
@@ -1947,7 +1947,7 @@  discard block
 block discarded – undo
1947 1947
     
1948 1948
 		$airport_array = array();
1949 1949
 		
1950
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
1950
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
1951 1951
 		{
1952 1952
 			$temp_array = $row;
1953 1953
 
@@ -1967,13 +1967,13 @@  discard block
 block discarded – undo
1967 1967
 	public function getAllWaypointsInfobyCoord($coord)
1968 1968
 	{
1969 1969
 		if (is_array($coord)) {
1970
-			$minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1971
-			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1972
-			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1973
-			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1970
+			$minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1971
+			$minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1972
+			$maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1973
+			$maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1974 1974
 		} else return array();
1975 1975
 		//$query  = "SELECT waypoints.* FROM waypoints WHERE waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong;
1976
-		$query  = "SELECT waypoints.* FROM waypoints WHERE (waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong.") OR (waypoints.latitude_end BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_end BETWEEN ".$minlong." AND ".$maxlong.")";
1976
+		$query = "SELECT waypoints.* FROM waypoints WHERE (waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong.") OR (waypoints.latitude_end BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_end BETWEEN ".$minlong." AND ".$maxlong.")";
1977 1977
 		//$query  = "SELECT waypoints.* FROM waypoints";
1978 1978
 		//$query  = "SELECT waypoints.* FROM waypoints INNER JOIN (SELECT waypoints.* FROM waypoints WHERE waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong.") w ON w.name_end = waypoints.name_begin OR w.name_begin = waypoints.name_begin OR w.name_begin = waypoints.name_end OR w.name_end = waypoints.name_end";
1979 1979
 		//$query = "SELECT * FROM waypoints LEFT JOIN waypoints w ON waypoints.name_end = w.name_begin WHERE waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong;
@@ -1985,7 +1985,7 @@  discard block
 block discarded – undo
1985 1985
     
1986 1986
 		$waypoints_array = array();
1987 1987
 		
1988
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
1988
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
1989 1989
 		{
1990 1990
 			$temp_array = $row;
1991 1991
 
@@ -2007,10 +2007,10 @@  discard block
 block discarded – undo
2007 2007
 	{
2008 2008
 		global $globalUseRealAirlines;
2009 2009
 		if (isset($globalUseRealAirlines) && $globalUseRealAirlines) $fromsource = NULL;
2010
-		$airline_icao = strtoupper(filter_var($airline_icao,FILTER_SANITIZE_STRING));
2010
+		$airline_icao = strtoupper(filter_var($airline_icao, FILTER_SANITIZE_STRING));
2011 2011
 		if ($airline_icao == 'NA') {
2012 2012
 			$airline_array = array();
2013
-			$airline_array[] = array('name' => 'Not Available','iata' => 'NA', 'icao' => 'NA', 'callsign' => '', 'country' => 'NA', 'type' =>'');
2013
+			$airline_array[] = array('name' => 'Not Available', 'iata' => 'NA', 'icao' => 'NA', 'callsign' => '', 'country' => 'NA', 'type' =>'');
2014 2014
 			return $airline_array;
2015 2015
 		} else {
2016 2016
 			if (strlen($airline_icao) == 2) {
@@ -2031,7 +2031,7 @@  discard block
 block discarded – undo
2031 2031
 			if ($fromsource === NULL) {
2032 2032
 				$sth->execute(array(':airline_icao' => $airline_icao));
2033 2033
 			} else {
2034
-				$sth->execute(array(':airline_icao' => $airline_icao,':fromsource' => $fromsource));
2034
+				$sth->execute(array(':airline_icao' => $airline_icao, ':fromsource' => $fromsource));
2035 2035
 			}
2036 2036
                         /*
2037 2037
 			$airline_array = array();
@@ -2072,12 +2072,12 @@  discard block
 block discarded – undo
2072 2072
 	*/
2073 2073
 	public function getAllAircraftInfo($aircraft_type)
2074 2074
 	{
2075
-		$aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING);
2075
+		$aircraft_type = filter_var($aircraft_type, FILTER_SANITIZE_STRING);
2076 2076
 
2077 2077
 		if ($aircraft_type == 'NA') {
2078
-			return array(array('icao' => 'NA','type' => 'Not Available', 'manufacturer' => 'Not Available', 'aircraft_shadow' => NULL));
2078
+			return array(array('icao' => 'NA', 'type' => 'Not Available', 'manufacturer' => 'Not Available', 'aircraft_shadow' => NULL));
2079 2079
 		}
2080
-		$query  = "SELECT aircraft.icao, aircraft.type,aircraft.manufacturer,aircraft.aircraft_shadow FROM aircraft WHERE aircraft.icao = :aircraft_type";
2080
+		$query = "SELECT aircraft.icao, aircraft.type,aircraft.manufacturer,aircraft.aircraft_shadow FROM aircraft WHERE aircraft.icao = :aircraft_type";
2081 2081
 		
2082 2082
 		$sth = $this->db->prepare($query);
2083 2083
 		$sth->execute(array(':aircraft_type' => $aircraft_type));
@@ -2109,7 +2109,7 @@  discard block
 block discarded – undo
2109 2109
 	*/
2110 2110
 	public function getAircraftIcao($aircraft_type)
2111 2111
 	{
2112
-		$aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING);
2112
+		$aircraft_type = filter_var($aircraft_type, FILTER_SANITIZE_STRING);
2113 2113
 		$all_aircraft = array('737-300' => 'B733',
2114 2114
 				'777-200' => 'B772',
2115 2115
 				'777-200ER' => 'B772',
@@ -2121,10 +2121,10 @@  discard block
 block discarded – undo
2121 2121
 				'A380' => 'A388');
2122 2122
 		if (isset($all_aircraft[$aircraft_type])) return $all_aircraft[$aircraft_type];
2123 2123
 
2124
-		$query  = "SELECT aircraft.icao FROM aircraft WHERE aircraft.type LIKE :saircraft_type OR aircraft.type = :aircraft_type OR aircraft.icao = :aircraft_type LIMIT 1";
2124
+		$query = "SELECT aircraft.icao FROM aircraft WHERE aircraft.type LIKE :saircraft_type OR aircraft.type = :aircraft_type OR aircraft.icao = :aircraft_type LIMIT 1";
2125 2125
 		$aircraft_type = strtoupper($aircraft_type);
2126 2126
 		$sth = $this->db->prepare($query);
2127
-		$sth->execute(array(':saircraft_type' => '%'.$aircraft_type.'%',':aircraft_type' => $aircraft_type,));
2127
+		$sth->execute(array(':saircraft_type' => '%'.$aircraft_type.'%', ':aircraft_type' => $aircraft_type,));
2128 2128
 		$result = $sth->fetchAll(PDO::FETCH_ASSOC);
2129 2129
 		if (isset($result[0]['icao'])) return $result[0]['icao'];
2130 2130
 		else return '';
@@ -2139,9 +2139,9 @@  discard block
 block discarded – undo
2139 2139
 	*/
2140 2140
 	public function getAllAircraftType($aircraft_modes)
2141 2141
 	{
2142
-		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
2142
+		$aircraft_modes = filter_var($aircraft_modes, FILTER_SANITIZE_STRING);
2143 2143
 
2144
-		$query  = "SELECT aircraft_modes.ICAOTypeCode FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes LIMIT 1";
2144
+		$query = "SELECT aircraft_modes.ICAOTypeCode FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes LIMIT 1";
2145 2145
 		
2146 2146
 		$sth = $this->db->prepare($query);
2147 2147
 		$sth->execute(array(':aircraft_modes' => $aircraft_modes));
@@ -2161,8 +2161,8 @@  discard block
 block discarded – undo
2161 2161
 	*/
2162 2162
 	public function getOperator($operator)
2163 2163
 	{
2164
-		$operator = filter_var($operator,FILTER_SANITIZE_STRING);
2165
-		$query  = "SELECT translation.operator_correct FROM translation WHERE translation.operator = :operator LIMIT 1";
2164
+		$operator = filter_var($operator, FILTER_SANITIZE_STRING);
2165
+		$query = "SELECT translation.operator_correct FROM translation WHERE translation.operator = :operator LIMIT 1";
2166 2166
 		
2167 2167
 		$sth = $this->db->prepare($query);
2168 2168
 		$sth->execute(array(':operator' => $operator));
@@ -2182,9 +2182,9 @@  discard block
 block discarded – undo
2182 2182
 	*/
2183 2183
 	public function getRouteInfo($callsign)
2184 2184
 	{
2185
-		$callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
2185
+		$callsign = filter_var($callsign, FILTER_SANITIZE_STRING);
2186 2186
                 if ($callsign == '') return array();
2187
-		$query  = "SELECT routes.Operator_ICAO, routes.FromAirport_ICAO, routes.ToAirport_ICAO, routes.RouteStop, routes.FromAirport_Time, routes.ToAirport_Time FROM routes WHERE CallSign = :callsign LIMIT 1";
2187
+		$query = "SELECT routes.Operator_ICAO, routes.FromAirport_ICAO, routes.ToAirport_ICAO, routes.RouteStop, routes.FromAirport_Time, routes.ToAirport_Time FROM routes WHERE CallSign = :callsign LIMIT 1";
2188 2188
 		
2189 2189
 		$sth = $this->db->prepare($query);
2190 2190
 		$sth->execute(array(':callsign' => $callsign));
@@ -2204,9 +2204,9 @@  discard block
 block discarded – undo
2204 2204
 	*/
2205 2205
 	public function getAircraftInfoByRegistration($registration)
2206 2206
 	{
2207
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
2207
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
2208 2208
 
2209
-		$query  = "SELECT spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer, spotter_output.airline_icao FROM spotter_output WHERE spotter_output.registration = :registration";
2209
+		$query = "SELECT spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer, spotter_output.airline_icao FROM spotter_output WHERE spotter_output.registration = :registration";
2210 2210
 		
2211 2211
 		$sth = $this->db->prepare($query);
2212 2212
 		$sth->execute(array(':registration' => $registration));
@@ -2214,7 +2214,7 @@  discard block
 block discarded – undo
2214 2214
 		$aircraft_array = array();
2215 2215
 		$temp_array = array();
2216 2216
 		
2217
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2217
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2218 2218
 		{
2219 2219
 			$temp_array['airline_icao'] = $row['airline_icao'];
2220 2220
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
@@ -2236,10 +2236,10 @@  discard block
 block discarded – undo
2236 2236
 	*/
2237 2237
 	public function getAircraftOwnerByRegistration($registration)
2238 2238
 	{
2239
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
2239
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
2240 2240
 		$Connection = new Connection($this->db);
2241 2241
 		if ($Connection->tableExists('aircraft_owner')) {
2242
-			$query  = "SELECT aircraft_owner.base, aircraft_owner.owner, aircraft_owner.date_first_reg FROM aircraft_owner WHERE registration = :registration LIMIT 1";
2242
+			$query = "SELECT aircraft_owner.base, aircraft_owner.owner, aircraft_owner.date_first_reg FROM aircraft_owner WHERE registration = :registration LIMIT 1";
2243 2243
 			$sth = $this->db->prepare($query);
2244 2244
 			$sth->execute(array(':registration' => $registration));
2245 2245
 
@@ -2257,7 +2257,7 @@  discard block
 block discarded – undo
2257 2257
 	public function getAllFlightsforSitemap()
2258 2258
 	{
2259 2259
 		//$query  = "SELECT spotter_output.spotter_id, spotter_output.ident, spotter_output.airline_name, spotter_output.aircraft_name, spotter_output.aircraft_icao FROM spotter_output ORDER BY LIMIT ";
2260
-		$query  = "SELECT spotter_output.spotter_id FROM spotter_output ORDER BY spotter_id DESC LIMIT 200 OFFSET 0";
2260
+		$query = "SELECT spotter_output.spotter_id FROM spotter_output ORDER BY spotter_id DESC LIMIT 200 OFFSET 0";
2261 2261
 		
2262 2262
 		$sth = $this->db->prepare($query);
2263 2263
 		$sth->execute();
@@ -2304,7 +2304,7 @@  discard block
 block discarded – undo
2304 2304
 		$manufacturer_array = array();
2305 2305
 		$temp_array = array();
2306 2306
 		
2307
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2307
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2308 2308
 		{
2309 2309
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
2310 2310
 
@@ -2338,7 +2338,7 @@  discard block
 block discarded – undo
2338 2338
 		$aircraft_array = array();
2339 2339
 		$temp_array = array();
2340 2340
 		
2341
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2341
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2342 2342
 		{
2343 2343
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
2344 2344
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
@@ -2359,7 +2359,7 @@  discard block
 block discarded – undo
2359 2359
 	*/
2360 2360
 	public function getAllAircraftRegistrations()
2361 2361
 	{
2362
-		$query  = "SELECT DISTINCT spotter_output.registration 
2362
+		$query = "SELECT DISTINCT spotter_output.registration 
2363 2363
 				FROM spotter_output  
2364 2364
 				WHERE spotter_output.registration <> '' 
2365 2365
 				ORDER BY spotter_output.registration ASC";
@@ -2370,7 +2370,7 @@  discard block
 block discarded – undo
2370 2370
 		$aircraft_array = array();
2371 2371
 		$temp_array = array();
2372 2372
 		
2373
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2373
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2374 2374
 		{
2375 2375
 			$temp_array['registration'] = $row['registration'];
2376 2376
 
@@ -2390,7 +2390,7 @@  discard block
 block discarded – undo
2390 2390
 	public function getAllSourceName($type = '')
2391 2391
 	{
2392 2392
 		$query_values = array();
2393
-		$query  = "SELECT DISTINCT spotter_output.source_name 
2393
+		$query = "SELECT DISTINCT spotter_output.source_name 
2394 2394
 				FROM spotter_output  
2395 2395
 				WHERE spotter_output.source_name <> ''";
2396 2396
 		if ($type != '') {
@@ -2406,7 +2406,7 @@  discard block
 block discarded – undo
2406 2406
 		$source_array = array();
2407 2407
 		$temp_array = array();
2408 2408
 		
2409
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2409
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2410 2410
 		{
2411 2411
 			$temp_array['source_name'] = $row['source_name'];
2412 2412
 			$source_array[] = $temp_array;
@@ -2422,10 +2422,10 @@  discard block
 block discarded – undo
2422 2422
 	* @return Array list of airline names
2423 2423
 	*
2424 2424
 	*/
2425
-	public function getAllAirlineNames($airline_type = '',$forsource = NULL)
2425
+	public function getAllAirlineNames($airline_type = '', $forsource = NULL)
2426 2426
 	{
2427
-		global $globalAirlinesSource,$globalVATSIM, $globalIVAO;
2428
-		$airline_type = filter_var($airline_type,FILTER_SANITIZE_STRING);
2427
+		global $globalAirlinesSource, $globalVATSIM, $globalIVAO;
2428
+		$airline_type = filter_var($airline_type, FILTER_SANITIZE_STRING);
2429 2429
 		if ($airline_type == '' || $airline_type == 'all') {
2430 2430
 			/*
2431 2431
 			$query  = "SELECT DISTINCT spotter_output.airline_icao AS airline_icao, spotter_output.airline_name AS airline_name, spotter_output.airline_type AS airline_type
@@ -2444,7 +2444,7 @@  discard block
 block discarded – undo
2444 2444
 				$query_data = array(':forsource' => $forsource);
2445 2445
 			}
2446 2446
 		} else {
2447
-			$query  = "SELECT DISTINCT spotter_output.airline_icao AS airline_icao, spotter_output.airline_name AS airline_name, spotter_output.airline_type AS airline_type
2447
+			$query = "SELECT DISTINCT spotter_output.airline_icao AS airline_icao, spotter_output.airline_name AS airline_name, spotter_output.airline_type AS airline_type
2448 2448
 					FROM spotter_output
2449 2449
 					WHERE spotter_output.airline_icao <> '' 
2450 2450
 					AND spotter_output.airline_type = :airline_type 
@@ -2458,7 +2458,7 @@  discard block
 block discarded – undo
2458 2458
 		$airline_array = array();
2459 2459
 		$temp_array = array();
2460 2460
 		
2461
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2461
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2462 2462
 		{
2463 2463
 			$temp_array['airline_icao'] = $row['airline_icao'];
2464 2464
 			$temp_array['airline_name'] = $row['airline_name'];
@@ -2479,7 +2479,7 @@  discard block
 block discarded – undo
2479 2479
 	public function getAllAirlineCountries()
2480 2480
 	{
2481 2481
 		
2482
-		$query  = "SELECT DISTINCT spotter_output.airline_country AS airline_country
2482
+		$query = "SELECT DISTINCT spotter_output.airline_country AS airline_country
2483 2483
 				FROM spotter_output  
2484 2484
 				WHERE spotter_output.airline_country <> '' 
2485 2485
 				ORDER BY spotter_output.airline_country ASC";
@@ -2491,7 +2491,7 @@  discard block
 block discarded – undo
2491 2491
 		$airline_array = array();
2492 2492
 		$temp_array = array();
2493 2493
 		
2494
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2494
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2495 2495
 		{
2496 2496
 			$temp_array['airline_country'] = $row['airline_country'];
2497 2497
 
@@ -2513,7 +2513,7 @@  discard block
 block discarded – undo
2513 2513
 	{
2514 2514
 		$airport_array = array();
2515 2515
 
2516
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_icao AS airport_icao, spotter_output.departure_airport_name AS airport_name, spotter_output.departure_airport_city AS airport_city, spotter_output.departure_airport_country AS airport_country
2516
+		$query = "SELECT DISTINCT spotter_output.departure_airport_icao AS airport_icao, spotter_output.departure_airport_name AS airport_name, spotter_output.departure_airport_city AS airport_city, spotter_output.departure_airport_country AS airport_country
2517 2517
 				FROM spotter_output 
2518 2518
 				WHERE spotter_output.departure_airport_icao <> '' AND spotter_output.departure_airport_icao <> 'NA' 
2519 2519
 				ORDER BY spotter_output.departure_airport_city ASC";
@@ -2523,7 +2523,7 @@  discard block
 block discarded – undo
2523 2523
 		$sth->execute();
2524 2524
 
2525 2525
 		$temp_array = array();
2526
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2526
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2527 2527
 		{
2528 2528
 			$temp_array['airport_icao'] = $row['airport_icao'];
2529 2529
 			$temp_array['airport_name'] = $row['airport_name'];
@@ -2533,7 +2533,7 @@  discard block
 block discarded – undo
2533 2533
 			$airport_array[$row['airport_city'].",".$row['airport_name']] = $temp_array;
2534 2534
 		}
2535 2535
 
2536
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_icao AS airport_icao, spotter_output.arrival_airport_name AS airport_name, spotter_output.arrival_airport_city AS airport_city, spotter_output.arrival_airport_country AS airport_country
2536
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_icao AS airport_icao, spotter_output.arrival_airport_name AS airport_name, spotter_output.arrival_airport_city AS airport_city, spotter_output.arrival_airport_country AS airport_country
2537 2537
 								FROM spotter_output 
2538 2538
 								WHERE spotter_output.arrival_airport_icao <> '' AND spotter_output.arrival_airport_icao <> 'NA' 
2539 2539
 								ORDER BY spotter_output.arrival_airport_city ASC";
@@ -2541,7 +2541,7 @@  discard block
 block discarded – undo
2541 2541
 		$sth = $this->db->prepare($query);
2542 2542
 		$sth->execute();
2543 2543
 
2544
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2544
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2545 2545
 			{
2546 2546
 		//	if ($airport_array[$row['airport_city'].",".$row['airport_name']]['airport_icao'] != $row['airport_icao'])
2547 2547
 		//	{
@@ -2581,14 +2581,14 @@  discard block
 block discarded – undo
2581 2581
    
2582 2582
 		$temp_array = array();
2583 2583
 		
2584
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2584
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2585 2585
 		{
2586 2586
 			$temp_array['airport_country'] = $row['airport_country'];
2587 2587
 
2588 2588
 			$airport_array[$row['airport_country']] = $temp_array;
2589 2589
 		}
2590 2590
 								
2591
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country
2591
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country
2592 2592
 								FROM spotter_output
2593 2593
 								WHERE spotter_output.arrival_airport_country <> '' 
2594 2594
 								ORDER BY spotter_output.arrival_airport_country ASC";
@@ -2596,7 +2596,7 @@  discard block
 block discarded – undo
2596 2596
 		$sth = $this->db->prepare($query);
2597 2597
 		$sth->execute();
2598 2598
 		
2599
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2599
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2600 2600
 		{
2601 2601
 			if (isset($airport_array[$row['airport_country']]['airport_country']) && $airport_array[$row['airport_country']]['airport_country'] != $row['airport_country'])
2602 2602
 			{
@@ -2619,9 +2619,9 @@  discard block
 block discarded – undo
2619 2619
 	*/
2620 2620
 	public function getAllCountries()
2621 2621
 	{
2622
-		$Connection= new Connection($this->db);
2622
+		$Connection = new Connection($this->db);
2623 2623
 		if ($Connection->tableExists('countries')) {
2624
-			$query  = "SELECT countries.name AS airport_country
2624
+			$query = "SELECT countries.name AS airport_country
2625 2625
 				FROM countries
2626 2626
 				ORDER BY countries.name ASC";
2627 2627
 			$sth = $this->db->prepare($query);
@@ -2630,13 +2630,13 @@  discard block
 block discarded – undo
2630 2630
 			$temp_array = array();
2631 2631
 			$country_array = array();
2632 2632
 		
2633
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
2633
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2634 2634
 			{
2635 2635
 				$temp_array['country'] = $row['airport_country'];
2636 2636
 				$country_array[$row['airport_country']] = $temp_array;
2637 2637
 			}
2638 2638
 		} else {
2639
-			$query  = "SELECT DISTINCT spotter_output.departure_airport_country AS airport_country
2639
+			$query = "SELECT DISTINCT spotter_output.departure_airport_country AS airport_country
2640 2640
 								FROM spotter_output
2641 2641
 								WHERE spotter_output.departure_airport_country <> '' 
2642 2642
 								ORDER BY spotter_output.departure_airport_country ASC";
@@ -2646,13 +2646,13 @@  discard block
 block discarded – undo
2646 2646
    
2647 2647
 			$temp_array = array();
2648 2648
 			$country_array = array();
2649
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
2649
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2650 2650
 			{
2651 2651
 				$temp_array['country'] = $row['airport_country'];
2652 2652
 				$country_array[$row['airport_country']] = $temp_array;
2653 2653
 			}
2654 2654
 
2655
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country
2655
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country
2656 2656
 								FROM spotter_output
2657 2657
 								WHERE spotter_output.arrival_airport_country <> '' 
2658 2658
 								ORDER BY spotter_output.arrival_airport_country ASC";
@@ -2660,7 +2660,7 @@  discard block
 block discarded – undo
2660 2660
 		$sth = $this->db->prepare($query);
2661 2661
 		$sth->execute();
2662 2662
 		
2663
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2663
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2664 2664
 		{
2665 2665
 			if ($country_array[$row['airport_country']]['country'] != $row['airport_country'])
2666 2666
 			{
@@ -2670,7 +2670,7 @@  discard block
 block discarded – undo
2670 2670
 			}
2671 2671
 		}
2672 2672
 		
2673
-		$query  = "SELECT DISTINCT spotter_output.airline_country AS airline_country
2673
+		$query = "SELECT DISTINCT spotter_output.airline_country AS airline_country
2674 2674
 								FROM spotter_output  
2675 2675
 								WHERE spotter_output.airline_country <> '' 
2676 2676
 								ORDER BY spotter_output.airline_country ASC";
@@ -2678,7 +2678,7 @@  discard block
 block discarded – undo
2678 2678
 		$sth = $this->db->prepare($query);
2679 2679
 		$sth->execute();
2680 2680
 		
2681
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2681
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2682 2682
 		{
2683 2683
 			if (isset($country_array[$row['airline_country']]['country']) && $country_array[$row['airline_country']]['country'] != $row['airline_country'])
2684 2684
 			{
@@ -2702,7 +2702,7 @@  discard block
 block discarded – undo
2702 2702
 	*/
2703 2703
 	public function getAllIdents()
2704 2704
 	{
2705
-		$query  = "SELECT DISTINCT spotter_output.ident
2705
+		$query = "SELECT DISTINCT spotter_output.ident
2706 2706
 								FROM spotter_output
2707 2707
 								WHERE spotter_output.ident <> '' 
2708 2708
 								ORDER BY spotter_output.date ASC LIMIT 700 OFFSET 0";
@@ -2713,7 +2713,7 @@  discard block
 block discarded – undo
2713 2713
 		$ident_array = array();
2714 2714
 		$temp_array = array();
2715 2715
 		
2716
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2716
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2717 2717
 		{
2718 2718
 			$temp_array['ident'] = $row['ident'];
2719 2719
 			$ident_array[] = $temp_array;
@@ -3049,12 +3049,12 @@  discard block
 block discarded – undo
3049 3049
 		} else $offset = '+00:00';
3050 3050
 
3051 3051
 		if ($globalDBdriver == 'mysql') {
3052
-			$query  = "SELECT DISTINCT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) as date
3052
+			$query = "SELECT DISTINCT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) as date
3053 3053
 								FROM spotter_output
3054 3054
 								WHERE spotter_output.date <> '' 
3055 3055
 								ORDER BY spotter_output.date ASC LIMIT 0,200";
3056 3056
 		} else {
3057
-			$query  = "SELECT DISTINCT to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') as date
3057
+			$query = "SELECT DISTINCT to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') as date
3058 3058
 								FROM spotter_output
3059 3059
 								WHERE spotter_output.date <> '' 
3060 3060
 								ORDER BY spotter_output.date ASC LIMIT 0,200";
@@ -3066,7 +3066,7 @@  discard block
 block discarded – undo
3066 3066
 		$date_array = array();
3067 3067
 		$temp_array = array();
3068 3068
 		
3069
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3069
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3070 3070
 		{
3071 3071
 			$temp_array['date'] = $row['date'];
3072 3072
 
@@ -3086,7 +3086,7 @@  discard block
 block discarded – undo
3086 3086
 	*/
3087 3087
 	public function getAllRoutes()
3088 3088
 	{
3089
-		$query  = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route,  spotter_output.departure_airport_icao, spotter_output.arrival_airport_icao 
3089
+		$query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route,  spotter_output.departure_airport_icao, spotter_output.arrival_airport_icao 
3090 3090
 				FROM spotter_output
3091 3091
 				WHERE spotter_output.ident <> '' 
3092 3092
 				GROUP BY route
@@ -3097,7 +3097,7 @@  discard block
 block discarded – undo
3097 3097
 
3098 3098
 		$routes_array = array();
3099 3099
 		$temp_array = array();
3100
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3100
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3101 3101
 		{
3102 3102
 			$temp_array['route'] = $row['route'];
3103 3103
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -3116,21 +3116,21 @@  discard block
 block discarded – undo
3116 3116
 	* @return String success or false
3117 3117
 	*
3118 3118
 	*/	
3119
-	public function updateIdentSpotterData($flightaware_id = '', $ident = '',$fromsource = NULL)
3119
+	public function updateIdentSpotterData($flightaware_id = '', $ident = '', $fromsource = NULL)
3120 3120
 	{
3121 3121
 		if (!is_numeric(substr($ident, 0, 3)))
3122 3122
 		{
3123 3123
 			if (is_numeric(substr(substr($ident, 0, 3), -1, 1))) {
3124
-				$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2),$fromsource);
3124
+				$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2), $fromsource);
3125 3125
 			} elseif (is_numeric(substr(substr($ident, 0, 4), -1, 1))) {
3126
-				$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3),$fromsource);
3126
+				$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3), $fromsource);
3127 3127
 			} else {
3128 3128
 				$airline_array = $this->getAllAirlineInfo("NA");
3129 3129
 			}
3130 3130
 			if (count($airline_array) == 0) {
3131 3131
 				$airline_array = $this->getAllAirlineInfo("NA");
3132 3132
 			}
3133
-			if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == ""){
3133
+			if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == "") {
3134 3134
 				$airline_array = $this->getAllAirlineInfo("NA");
3135 3135
 			}
3136 3136
 		} else {
@@ -3143,7 +3143,7 @@  discard block
 block discarded – undo
3143 3143
 
3144 3144
 
3145 3145
 		$query = 'UPDATE spotter_output SET ident = :ident, airline_name = :airline_name, airline_icao = :airline_icao, airline_country = :airline_country, airline_type = :airline_type WHERE flightaware_id = :flightaware_id';
3146
-                $query_values = array(':flightaware_id' => $flightaware_id,':ident' => $ident,':airline_name' => $airline_name,':airline_icao' => $airline_icao,':airline_country' => $airline_country,':airline_type' => $airline_type);
3146
+                $query_values = array(':flightaware_id' => $flightaware_id, ':ident' => $ident, ':airline_name' => $airline_name, ':airline_icao' => $airline_icao, ':airline_country' => $airline_country, ':airline_type' => $airline_type);
3147 3147
 
3148 3148
 		try {
3149 3149
 			$sth = $this->db->prepare($query);
@@ -3164,11 +3164,11 @@  discard block
 block discarded – undo
3164 3164
 	* @return String success or false
3165 3165
 	*
3166 3166
 	*/	
3167
-	public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '',$arrival_airport_time = '')
3167
+	public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '', $arrival_airport_time = '')
3168 3168
 	{
3169 3169
 		if ($groundspeed == '') $groundspeed = NULL;
3170 3170
 		$query = 'UPDATE spotter_output SET ident = :ident, last_latitude = :last_latitude, last_longitude = :last_longitude, last_altitude = :last_altitude, last_ground = :last_ground, last_seen = :last_seen, real_arrival_airport_icao = :real_arrival_airport_icao, real_arrival_airport_time = :real_arrival_airport_time, last_ground_speed = :last_ground_speed WHERE flightaware_id = :flightaware_id';
3171
-                $query_values = array(':flightaware_id' => $flightaware_id,':real_arrival_airport_icao' => $arrival_airport_icao,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_altitude' => $altitude,':last_ground_speed' => $groundspeed,':last_seen' => $date,':real_arrival_airport_time' => $arrival_airport_time, ':last_ground' => $ground, ':ident' => $ident);
3171
+                $query_values = array(':flightaware_id' => $flightaware_id, ':real_arrival_airport_icao' => $arrival_airport_icao, ':last_latitude' => $latitude, ':last_longitude' => $longitude, ':last_altitude' => $altitude, ':last_ground_speed' => $groundspeed, ':last_seen' => $date, ':real_arrival_airport_time' => $arrival_airport_time, ':last_ground' => $ground, ':ident' => $ident);
3172 3172
 
3173 3173
 		try {
3174 3174
 			$sth = $this->db->prepare($query);
@@ -3208,7 +3208,7 @@  discard block
 block discarded – undo
3208 3208
 	* @param String $verticalrate vertival rate of flight
3209 3209
 	* @return String success or false
3210 3210
 	*/
3211
-	public function addSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $departure_airport_time = '', $arrival_airport_time = '',$squawk = '', $route_stop = '', $highlight = '', $ModeS = '', $registration = '',$pilot_id = '', $pilot_name = '', $verticalrate = '', $ground = false,$format_source = '', $source_name = '')
3211
+	public function addSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $departure_airport_time = '', $arrival_airport_time = '', $squawk = '', $route_stop = '', $highlight = '', $ModeS = '', $registration = '', $pilot_id = '', $pilot_name = '', $verticalrate = '', $ground = false, $format_source = '', $source_name = '')
3212 3212
 	{
3213 3213
 		global $globalURL, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalDebugTimeElapsed, $globalAirlinesSource, $globalVAM;
3214 3214
 		
@@ -3232,13 +3232,13 @@  discard block
 block discarded – undo
3232 3232
 				if ($ModeS != '') {
3233 3233
 					$timeelapsed = microtime(true);
3234 3234
 					$registration = $this->getAircraftRegistrationBymodeS($ModeS);
3235
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3235
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3236 3236
 				} else {
3237
-					$myhex = explode('-',$flightaware_id);
3237
+					$myhex = explode('-', $flightaware_id);
3238 3238
 					if (count($myhex) > 0) {
3239 3239
 						$timeelapsed = microtime(true);
3240 3240
 						$registration = $this->getAircraftRegistrationBymodeS($myhex[0]);
3241
-						if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3241
+						if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3242 3242
 					}
3243 3243
 				}
3244 3244
 			}
@@ -3260,24 +3260,24 @@  discard block
 block discarded – undo
3260 3260
 				{
3261 3261
 					$timeelapsed = microtime(true);
3262 3262
 					if (is_numeric(substr(substr($ident, 0, 3), -1, 1))) {
3263
-						$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2),$fromsource);
3263
+						$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2), $fromsource);
3264 3264
 					} elseif (is_numeric(substr(substr($ident, 0, 4), -1, 1))) {
3265
-						$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3),$fromsource);
3265
+						$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3), $fromsource);
3266 3266
 					} else {
3267 3267
 						$airline_array = $this->getAllAirlineInfo("NA");
3268 3268
 					}
3269 3269
 					if (count($airline_array) == 0) {
3270 3270
 						$airline_array = $this->getAllAirlineInfo("NA");
3271 3271
 					}
3272
-					if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == ""){
3272
+					if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == "") {
3273 3273
 						$airline_array = $this->getAllAirlineInfo("NA");
3274 3274
 					}
3275
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3275
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3276 3276
 
3277 3277
 				} else {
3278 3278
 					$timeelapsed = microtime(true);
3279 3279
 					$airline_array = $this->getAllAirlineInfo("NA");
3280
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3280
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3281 3281
 				}
3282 3282
 			}
3283 3283
 		} else $airline_array = array();
@@ -3294,27 +3294,27 @@  discard block
 block discarded – undo
3294 3294
 				{
3295 3295
 					$timeelapsed = microtime(true);
3296 3296
 					$aircraft_array = $this->getAllAircraftInfo("NA");
3297
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3297
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3298 3298
 				} else {
3299 3299
 					$timeelapsed = microtime(true);
3300 3300
 					$aircraft_array = $this->getAllAircraftInfo($aircraft_icao);
3301
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3301
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3302 3302
 				}
3303 3303
 			}
3304 3304
 		} else {
3305 3305
 			if ($ModeS != '') {
3306 3306
 				$timeelapsed = microtime(true);
3307 3307
 				$aircraft_icao = $this->getAllAircraftType($ModeS);
3308
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3308
+				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3309 3309
 				if ($aircraft_icao == "" || $aircraft_icao == "XXXX")
3310 3310
 				{
3311 3311
 					$timeelapsed = microtime(true);
3312 3312
 					$aircraft_array = $this->getAllAircraftInfo("NA");
3313
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3313
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3314 3314
 				} else {
3315 3315
 					$timeelapsed = microtime(true);
3316 3316
 					$aircraft_array = $this->getAllAircraftInfo($aircraft_icao);
3317
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3317
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3318 3318
 				}
3319 3319
 			}
3320 3320
 		}
@@ -3329,7 +3329,7 @@  discard block
 block discarded – undo
3329 3329
 			} else {
3330 3330
 				$timeelapsed = microtime(true);
3331 3331
 				$departure_airport_array = $this->getAllAirportInfo($departure_airport_icao);
3332
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3332
+				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3333 3333
 			}
3334 3334
 		}
3335 3335
 		
@@ -3343,7 +3343,7 @@  discard block
 block discarded – undo
3343 3343
 			} else {
3344 3344
 				$timeelapsed = microtime(true);
3345 3345
 				$arrival_airport_array = $this->getAllAirportInfo($arrival_airport_icao);
3346
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3346
+				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3347 3347
 			}
3348 3348
 		}
3349 3349
 
@@ -3407,7 +3407,7 @@  discard block
 block discarded – undo
3407 3407
 		{
3408 3408
 			$timeelapsed = microtime(true);
3409 3409
 			$image_array = $Image->getSpotterImage($registration);
3410
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3410
+			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3411 3411
 			if (!isset($image_array[0]['registration']))
3412 3412
 			{
3413 3413
 				//echo "Add image !!!! \n";
@@ -3415,7 +3415,7 @@  discard block
 block discarded – undo
3415 3415
 			}
3416 3416
 			$timeelapsed = microtime(true);
3417 3417
 			$owner_info = $this->getAircraftOwnerByRegistration($registration);
3418
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3418
+			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3419 3419
 			if ($owner_info['owner'] != '') $aircraft_owner = ucwords(strtolower($owner_info['owner']));
3420 3420
 		}
3421 3421
     
@@ -3423,33 +3423,33 @@  discard block
 block discarded – undo
3423 3423
 		{
3424 3424
             		if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao'];
3425 3425
             		else $airline_icao = '';
3426
-			$image_array = $Image->getSpotterImage('',$aircraft_icao,$airline_icao);
3426
+			$image_array = $Image->getSpotterImage('', $aircraft_icao, $airline_icao);
3427 3427
 			if (!isset($image_array[0]['registration']))
3428 3428
 			{
3429 3429
 				//echo "Add image !!!! \n";
3430
-				$Image->addSpotterImage('',$aircraft_icao,$airline_icao);
3430
+				$Image->addSpotterImage('', $aircraft_icao, $airline_icao);
3431 3431
 			}
3432 3432
 		}
3433 3433
     
3434
-		$flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING);
3435
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
3436
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
3437
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
3438
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
3439
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
3440
-		$latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
3441
-		$longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
3442
-		$waypoints = filter_var($waypoints,FILTER_SANITIZE_STRING);
3443
-		$altitude = filter_var($altitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
3444
-		$heading = filter_var($heading,FILTER_SANITIZE_NUMBER_INT);
3445
-		$groundspeed = filter_var($groundspeed,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
3446
-		$squawk = filter_var($squawk,FILTER_SANITIZE_NUMBER_INT);
3447
-		$route_stop = filter_var($route_stop,FILTER_SANITIZE_STRING);
3448
-		$ModeS = filter_var($ModeS,FILTER_SANITIZE_STRING);
3449
-		$pilot_id = filter_var($pilot_id,FILTER_SANITIZE_STRING);
3450
-		$pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING);
3451
-		$format_source = filter_var($format_source,FILTER_SANITIZE_STRING);
3452
-		$verticalrate = filter_var($verticalrate,FILTER_SANITIZE_NUMBER_INT);
3434
+		$flightaware_id = filter_var($flightaware_id, FILTER_SANITIZE_STRING);
3435
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
3436
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
3437
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
3438
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
3439
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
3440
+		$latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
3441
+		$longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
3442
+		$waypoints = filter_var($waypoints, FILTER_SANITIZE_STRING);
3443
+		$altitude = filter_var($altitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
3444
+		$heading = filter_var($heading, FILTER_SANITIZE_NUMBER_INT);
3445
+		$groundspeed = filter_var($groundspeed, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
3446
+		$squawk = filter_var($squawk, FILTER_SANITIZE_NUMBER_INT);
3447
+		$route_stop = filter_var($route_stop, FILTER_SANITIZE_STRING);
3448
+		$ModeS = filter_var($ModeS, FILTER_SANITIZE_STRING);
3449
+		$pilot_id = filter_var($pilot_id, FILTER_SANITIZE_STRING);
3450
+		$pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING);
3451
+		$format_source = filter_var($format_source, FILTER_SANITIZE_STRING);
3452
+		$verticalrate = filter_var($verticalrate, FILTER_SANITIZE_NUMBER_INT);
3453 3453
 	
3454 3454
 		if (count($airline_array) == 0) 
3455 3455
 		{
@@ -3473,7 +3473,7 @@  discard block
 block discarded – undo
3473 3473
                 if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
3474 3474
                 if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
3475 3475
                 if (!isset($aircraft_owner)) $aircraft_owner = NULL;
3476
-                $query  = "INSERT INTO spotter_output (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, latitude, longitude, waypoints, altitude, heading, ground_speed, date, departure_airport_time, arrival_airport_time, squawk, route_stop,highlight,ModeS, pilot_id, pilot_name, verticalrate, owner_name, ground, format_source, source_name) 
3476
+                $query = "INSERT INTO spotter_output (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, latitude, longitude, waypoints, altitude, heading, ground_speed, date, departure_airport_time, arrival_airport_time, squawk, route_stop,highlight,ModeS, pilot_id, pilot_name, verticalrate, owner_name, ground, format_source, source_name) 
3477 3477
                 VALUES (:flightaware_id,:ident,:registration,:airline_name,:airline_icao,:airline_country,:airline_type,:aircraft_icao,:aircraft_type,:aircraft_manufacturer,:departure_airport_icao,:departure_airport_name,:departure_airport_city,:departure_airport_country, :arrival_airport_icao, :arrival_airport_name, :arrival_airport_city, :arrival_airport_country, :latitude,:longitude,:waypoints,:altitude,:heading,:groundspeed,:date, :departure_airport_time, :arrival_airport_time, :squawk, :route_stop, :highlight, :ModeS, :pilot_id, :pilot_name, :verticalrate, :owner_name,:ground, :format_source, :source_name)";
3478 3478
 
3479 3479
                 $airline_name = $airline_array[0]['name'];
@@ -3483,7 +3483,7 @@  discard block
 block discarded – undo
3483 3483
 		if ($airline_type == '') {
3484 3484
 			$timeelapsed = microtime(true);
3485 3485
 			$airline_type = $this->getAircraftTypeBymodeS($ModeS);
3486
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3486
+			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3487 3487
 		}
3488 3488
 		if ($airline_type == null) $airline_type = '';
3489 3489
                 $aircraft_type = $aircraft_array[0]['type'];
@@ -3494,7 +3494,7 @@  discard block
 block discarded – undo
3494 3494
                 $arrival_airport_name = $arrival_airport_array[0]['name'];
3495 3495
                 $arrival_airport_city = $arrival_airport_array[0]['city'];
3496 3496
                 $arrival_airport_country = $arrival_airport_array[0]['country'];
3497
-                $query_values = array(':flightaware_id' => $flightaware_id,':ident' => $ident, ':registration' => $registration,':airline_name' => $airline_name,':airline_icao' => $airline_icao,':airline_country' => $airline_country,':airline_type' => $airline_type,':aircraft_icao' => $aircraft_icao,':aircraft_type' => $aircraft_type,':aircraft_manufacturer' => $aircraft_manufacturer,':departure_airport_icao' => $departure_airport_icao,':departure_airport_name' => $departure_airport_name,':departure_airport_city' => $departure_airport_city,':departure_airport_country' => $departure_airport_country,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_name' => $arrival_airport_name,':arrival_airport_city' => $arrival_airport_city,':arrival_airport_country' => $arrival_airport_country,':latitude' => $latitude,':longitude' => $longitude, ':waypoints' => $waypoints,':altitude' => $altitude,':heading' => $heading,':groundspeed' => $groundspeed,':date' => $date,':departure_airport_time' => $departure_airport_time,':arrival_airport_time' => $arrival_airport_time, ':squawk' => $squawk, ':route_stop' => $route_stop, ':highlight' => $highlight, ':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':owner_name' => $aircraft_owner, ':format_source' => $format_source, ':ground' => $ground, ':source_name' => $source_name);
3497
+                $query_values = array(':flightaware_id' => $flightaware_id, ':ident' => $ident, ':registration' => $registration, ':airline_name' => $airline_name, ':airline_icao' => $airline_icao, ':airline_country' => $airline_country, ':airline_type' => $airline_type, ':aircraft_icao' => $aircraft_icao, ':aircraft_type' => $aircraft_type, ':aircraft_manufacturer' => $aircraft_manufacturer, ':departure_airport_icao' => $departure_airport_icao, ':departure_airport_name' => $departure_airport_name, ':departure_airport_city' => $departure_airport_city, ':departure_airport_country' => $departure_airport_country, ':arrival_airport_icao' => $arrival_airport_icao, ':arrival_airport_name' => $arrival_airport_name, ':arrival_airport_city' => $arrival_airport_city, ':arrival_airport_country' => $arrival_airport_country, ':latitude' => $latitude, ':longitude' => $longitude, ':waypoints' => $waypoints, ':altitude' => $altitude, ':heading' => $heading, ':groundspeed' => $groundspeed, ':date' => $date, ':departure_airport_time' => $departure_airport_time, ':arrival_airport_time' => $arrival_airport_time, ':squawk' => $squawk, ':route_stop' => $route_stop, ':highlight' => $highlight, ':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':owner_name' => $aircraft_owner, ':format_source' => $format_source, ':ground' => $ground, ':source_name' => $source_name);
3498 3498
 
3499 3499
 		try {
3500 3500
 		        
@@ -3520,13 +3520,13 @@  discard block
 block discarded – undo
3520 3520
 	{
3521 3521
 		global $globalDBdriver, $globalTimezone;
3522 3522
 		if ($globalDBdriver == 'mysql') {
3523
-			$query  = "SELECT spotter_output.ident FROM spotter_output 
3523
+			$query = "SELECT spotter_output.ident FROM spotter_output 
3524 3524
 								WHERE spotter_output.ident = :ident 
3525 3525
 								AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) 
3526 3526
 								AND spotter_output.date < UTC_TIMESTAMP()";
3527 3527
 			$query_data = array(':ident' => $ident);
3528 3528
 		} else {
3529
-			$query  = "SELECT spotter_output.ident FROM spotter_output 
3529
+			$query = "SELECT spotter_output.ident FROM spotter_output 
3530 3530
 								WHERE spotter_output.ident = :ident 
3531 3531
 								AND spotter_output.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS'
3532 3532
 								AND spotter_output.date < now() AT TIME ZONE 'UTC'";
@@ -3535,8 +3535,8 @@  discard block
 block discarded – undo
3535 3535
 		
3536 3536
 		$sth = $this->db->prepare($query);
3537 3537
 		$sth->execute($query_data);
3538
-    		$ident_result='';
3539
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3538
+    		$ident_result = '';
3539
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3540 3540
 		{
3541 3541
 			$ident_result = $row['ident'];
3542 3542
 		}
@@ -3562,8 +3562,8 @@  discard block
 block discarded – undo
3562 3562
 				return false;
3563 3563
 			} else {
3564 3564
 				$q_array = explode(" ", $q);
3565
-				foreach ($q_array as $q_item){
3566
-					$q_item = filter_var($q_item,FILTER_SANITIZE_STRING);
3565
+				foreach ($q_array as $q_item) {
3566
+					$q_item = filter_var($q_item, FILTER_SANITIZE_STRING);
3567 3567
 					$additional_query .= " AND (";
3568 3568
 					$additional_query .= "(spotter_output.aircraft_icao like '%".$q_item."%') OR ";
3569 3569
 					$additional_query .= "(spotter_output.aircraft_name like '%".$q_item."%') OR ";
@@ -3578,11 +3578,11 @@  discard block
 block discarded – undo
3578 3578
 			}
3579 3579
 		}
3580 3580
 		if ($globalDBdriver == 'mysql') {
3581
-			$query  = "SELECT spotter_output.* FROM spotter_output 
3581
+			$query = "SELECT spotter_output.* FROM spotter_output 
3582 3582
 				WHERE spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 20 SECOND) ".$additional_query." 
3583 3583
 				AND spotter_output.date < UTC_TIMESTAMP()";
3584 3584
 		} else {
3585
-			$query  = "SELECT spotter_output.* FROM spotter_output 
3585
+			$query = "SELECT spotter_output.* FROM spotter_output 
3586 3586
 				WHERE spotter_output.date::timestamp >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '20 SECONDS' ".$additional_query." 
3587 3587
 				AND spotter_output.date::timestamp < CURRENT_TIMESTAMP AT TIME ZONE 'UTC'";
3588 3588
 		}
@@ -3602,7 +3602,7 @@  discard block
 block discarded – undo
3602 3602
 	public function countAllAirlines($limit = true, $olderthanmonths = 0, $sincedate = '')
3603 3603
 	{
3604 3604
 		global $globalDBdriver;
3605
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
3605
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
3606 3606
 		 			FROM spotter_output
3607 3607
 					WHERE spotter_output.airline_name <> '' AND spotter_output.airline_icao <> 'NA' ";
3608 3608
 		if ($olderthanmonths > 0) {
@@ -3627,7 +3627,7 @@  discard block
 block discarded – undo
3627 3627
  
3628 3628
 		$airline_array = array();
3629 3629
 		$temp_array = array();
3630
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3630
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3631 3631
 		{
3632 3632
 			$temp_array['airline_name'] = $row['airline_name'];
3633 3633
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -3644,11 +3644,11 @@  discard block
 block discarded – undo
3644 3644
 	* @return Array the pilots list
3645 3645
 	*
3646 3646
 	*/
3647
-	public function countAllPilots($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
3647
+	public function countAllPilots($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
3648 3648
 	{
3649 3649
 		global $globalDBdriver;
3650
-		$filter_query = $this->getFilter($filters,true,true);
3651
-		$query  = "SELECT DISTINCT spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count
3650
+		$filter_query = $this->getFilter($filters, true, true);
3651
+		$query = "SELECT DISTINCT spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count
3652 3652
 		 			FROM spotter_output".$filter_query." spotter_output.pilot_id <> '' ";
3653 3653
                 if ($olderthanmonths > 0) {
3654 3654
             		if ($globalDBdriver == 'mysql') {
@@ -3674,7 +3674,7 @@  discard block
 block discarded – undo
3674 3674
 		$airline_array = array();
3675 3675
 		$temp_array = array();
3676 3676
         
3677
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3677
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3678 3678
 		{
3679 3679
 			$temp_array['pilot_name'] = $row['pilot_name'];
3680 3680
 			$temp_array['pilot_id'] = $row['pilot_id'];
@@ -3693,7 +3693,7 @@  discard block
 block discarded – undo
3693 3693
 	public function countAllPilotsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '')
3694 3694
 	{
3695 3695
 		global $globalDBdriver;
3696
-		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count
3696
+		$query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count
3697 3697
 		 			FROM spotter_output WHERE spotter_output.pilot_id <> '' ";
3698 3698
                 if ($olderthanmonths > 0) {
3699 3699
             		if ($globalDBdriver == 'mysql') {
@@ -3719,7 +3719,7 @@  discard block
 block discarded – undo
3719 3719
 		$airline_array = array();
3720 3720
 		$temp_array = array();
3721 3721
         
3722
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3722
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3723 3723
 		{
3724 3724
 			$temp_array['pilot_name'] = $row['pilot_name'];
3725 3725
 			$temp_array['pilot_id'] = $row['pilot_id'];
@@ -3736,11 +3736,11 @@  discard block
 block discarded – undo
3736 3736
 	* @return Array the pilots list
3737 3737
 	*
3738 3738
 	*/
3739
-	public function countAllOwners($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
3739
+	public function countAllOwners($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
3740 3740
 	{
3741 3741
 		global $globalDBdriver;
3742
-		$filter_query = $this->getFilter($filters,true,true);
3743
-		$query  = "SELECT DISTINCT spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
3742
+		$filter_query = $this->getFilter($filters, true, true);
3743
+		$query = "SELECT DISTINCT spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
3744 3744
 		 			FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL ";
3745 3745
                 if ($olderthanmonths > 0) {
3746 3746
             		if ($globalDBdriver == 'mysql') {
@@ -3766,7 +3766,7 @@  discard block
 block discarded – undo
3766 3766
 		$airline_array = array();
3767 3767
 		$temp_array = array();
3768 3768
         
3769
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3769
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3770 3770
 		{
3771 3771
 			$temp_array['owner_name'] = $row['owner_name'];
3772 3772
 			$temp_array['owner_count'] = $row['owner_count'];
@@ -3784,7 +3784,7 @@  discard block
 block discarded – undo
3784 3784
 	public function countAllOwnersByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '')
3785 3785
 	{
3786 3786
 		global $globalDBdriver;
3787
-		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
3787
+		$query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
3788 3788
 		 			FROM spotter_output WHERE spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL ";
3789 3789
                 if ($olderthanmonths > 0) {
3790 3790
             		if ($globalDBdriver == 'mysql') {
@@ -3810,7 +3810,7 @@  discard block
 block discarded – undo
3810 3810
 		$airline_array = array();
3811 3811
 		$temp_array = array();
3812 3812
         
3813
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3813
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3814 3814
 		{
3815 3815
 			$temp_array['owner_name'] = $row['owner_name'];
3816 3816
 			$temp_array['owner_count'] = $row['owner_count'];
@@ -3828,9 +3828,9 @@  discard block
 block discarded – undo
3828 3828
 	*/
3829 3829
 	public function countAllAirlinesByAircraft($aircraft_icao)
3830 3830
 	{
3831
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
3831
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
3832 3832
 
3833
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
3833
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
3834 3834
 		 			FROM spotter_output
3835 3835
 					WHERE spotter_output.airline_name <> '' AND spotter_output.aircraft_icao = :aircraft_icao 
3836 3836
                     GROUP BY spotter_output.airline_name
@@ -3843,7 +3843,7 @@  discard block
 block discarded – undo
3843 3843
 		$airline_array = array();
3844 3844
 		$temp_array = array();
3845 3845
         
3846
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3846
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3847 3847
 		{
3848 3848
 			$temp_array['airline_name'] = $row['airline_name'];
3849 3849
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -3865,9 +3865,9 @@  discard block
 block discarded – undo
3865 3865
 	*/
3866 3866
 	public function countAllAirlineCountriesByAircraft($aircraft_icao)
3867 3867
 	{
3868
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
3868
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
3869 3869
       
3870
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
3870
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
3871 3871
 		 			FROM spotter_output
3872 3872
 					WHERE spotter_output.airline_country <> '' AND spotter_output.aircraft_icao = :aircraft_icao
3873 3873
                     GROUP BY spotter_output.airline_country
@@ -3881,7 +3881,7 @@  discard block
 block discarded – undo
3881 3881
 		$airline_country_array = array();
3882 3882
 		$temp_array = array();
3883 3883
         
3884
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3884
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3885 3885
 		{
3886 3886
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
3887 3887
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -3902,9 +3902,9 @@  discard block
 block discarded – undo
3902 3902
 	*/
3903 3903
 	public function countAllAirlinesByAirport($airport_icao)
3904 3904
 	{
3905
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
3905
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
3906 3906
 
3907
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
3907
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
3908 3908
 		 			FROM spotter_output
3909 3909
 					WHERE spotter_output.airline_name <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao ) 
3910 3910
                     GROUP BY spotter_output.airline_name
@@ -3917,7 +3917,7 @@  discard block
 block discarded – undo
3917 3917
 		$airline_array = array();
3918 3918
 		$temp_array = array();
3919 3919
         
3920
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3920
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3921 3921
 		{
3922 3922
 			$temp_array['airline_name'] = $row['airline_name'];
3923 3923
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -3938,9 +3938,9 @@  discard block
 block discarded – undo
3938 3938
 	*/
3939 3939
 	public function countAllAirlineCountriesByAirport($airport_icao)
3940 3940
 	{
3941
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
3941
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
3942 3942
       
3943
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
3943
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
3944 3944
 		 			FROM spotter_output
3945 3945
 					WHERE spotter_output.airline_country <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao )
3946 3946
 					GROUP BY spotter_output.airline_country
@@ -3954,7 +3954,7 @@  discard block
 block discarded – undo
3954 3954
 		$airline_country_array = array();
3955 3955
 		$temp_array = array();
3956 3956
         
3957
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3957
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3958 3958
 		{
3959 3959
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
3960 3960
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -3973,9 +3973,9 @@  discard block
 block discarded – undo
3973 3973
 	*/
3974 3974
 	public function countAllAirlinesByManufacturer($aircraft_manufacturer)
3975 3975
 	{
3976
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
3976
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
3977 3977
 
3978
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
3978
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
3979 3979
 		 			FROM spotter_output
3980 3980
 					WHERE spotter_output.aircraft_manufacturer = :aircraft_manufacturer 
3981 3981
 					GROUP BY spotter_output.airline_name
@@ -3987,7 +3987,7 @@  discard block
 block discarded – undo
3987 3987
 		$airline_array = array();
3988 3988
 		$temp_array = array();
3989 3989
         
3990
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3990
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3991 3991
 		{
3992 3992
 			$temp_array['airline_name'] = $row['airline_name'];
3993 3993
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4009,9 +4009,9 @@  discard block
 block discarded – undo
4009 4009
 	*/
4010 4010
 	public function countAllAirlineCountriesByManufacturer($aircraft_manufacturer)
4011 4011
 	{
4012
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
4012
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
4013 4013
       
4014
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4014
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4015 4015
 		 			FROM spotter_output
4016 4016
 					WHERE spotter_output.airline_country <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer 
4017 4017
 					GROUP BY spotter_output.airline_country
@@ -4025,7 +4025,7 @@  discard block
 block discarded – undo
4025 4025
 		$airline_country_array = array();
4026 4026
 		$temp_array = array();
4027 4027
         
4028
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4028
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4029 4029
 		{
4030 4030
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4031 4031
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4044,7 +4044,7 @@  discard block
 block discarded – undo
4044 4044
 	public function countAllAirlinesByDate($date)
4045 4045
 	{
4046 4046
 		global $globalTimezone, $globalDBdriver;
4047
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
4047
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
4048 4048
 
4049 4049
 		if ($globalTimezone != '') {
4050 4050
 			date_default_timezone_set($globalTimezone);
@@ -4053,13 +4053,13 @@  discard block
 block discarded – undo
4053 4053
 		} else $offset = '+00:00';
4054 4054
 
4055 4055
 		if ($globalDBdriver == 'mysql') {
4056
-			$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4056
+			$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4057 4057
 		 			FROM spotter_output
4058 4058
 					WHERE DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
4059 4059
 					GROUP BY spotter_output.airline_name
4060 4060
 					ORDER BY airline_count DESC";
4061 4061
 		} else {
4062
-			$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4062
+			$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4063 4063
 		 			FROM spotter_output
4064 4064
 					WHERE to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date 
4065 4065
 					GROUP BY spotter_output.airline_name
@@ -4071,7 +4071,7 @@  discard block
 block discarded – undo
4071 4071
 
4072 4072
 		$airline_array = array();
4073 4073
 		$temp_array = array();
4074
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4074
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4075 4075
 		{
4076 4076
 			$temp_array['airline_name'] = $row['airline_name'];
4077 4077
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4094,7 +4094,7 @@  discard block
 block discarded – undo
4094 4094
 	public function countAllAirlineCountriesByDate($date)
4095 4095
 	{
4096 4096
 		global $globalTimezone, $globalDBdriver;
4097
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
4097
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
4098 4098
 		if ($globalTimezone != '') {
4099 4099
 			date_default_timezone_set($globalTimezone);
4100 4100
 			$datetime = new DateTime($date);
@@ -4102,14 +4102,14 @@  discard block
 block discarded – undo
4102 4102
 		} else $offset = '+00:00';
4103 4103
 		
4104 4104
 		if ($globalDBdriver == 'mysql') {
4105
-			$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4105
+			$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4106 4106
 		 			FROM spotter_output
4107 4107
 					WHERE spotter_output.airline_country <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
4108 4108
 					GROUP BY spotter_output.airline_country
4109 4109
 					ORDER BY airline_country_count DESC
4110 4110
 					LIMIT 10 OFFSET 0";
4111 4111
 		} else {
4112
-			$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4112
+			$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4113 4113
 		 			FROM spotter_output
4114 4114
 					WHERE spotter_output.airline_country <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date 
4115 4115
 					GROUP BY spotter_output.airline_country
@@ -4122,7 +4122,7 @@  discard block
 block discarded – undo
4122 4122
  
4123 4123
 		$airline_country_array = array();
4124 4124
 		$temp_array = array();
4125
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4125
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4126 4126
 		{
4127 4127
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4128 4128
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4141,9 +4141,9 @@  discard block
 block discarded – undo
4141 4141
 	*/
4142 4142
 	public function countAllAirlinesByIdent($ident)
4143 4143
 	{
4144
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
4144
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
4145 4145
 
4146
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4146
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4147 4147
 		 		FROM spotter_output
4148 4148
 				WHERE spotter_output.ident = :ident  
4149 4149
 				GROUP BY spotter_output.airline_name
@@ -4156,7 +4156,7 @@  discard block
 block discarded – undo
4156 4156
 		$airline_array = array();
4157 4157
 		$temp_array = array();
4158 4158
         
4159
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4159
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4160 4160
 		{
4161 4161
 			$temp_array['airline_name'] = $row['airline_name'];
4162 4162
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4176,10 +4176,10 @@  discard block
 block discarded – undo
4176 4176
 	*/
4177 4177
 	public function countAllAirlinesByRoute($departure_airport_icao, $arrival_airport_icao)
4178 4178
 	{
4179
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
4180
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
4179
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
4180
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
4181 4181
 
4182
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4182
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4183 4183
 		 			FROM spotter_output
4184 4184
 					WHERE (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao) 
4185 4185
 					GROUP BY spotter_output.airline_name
@@ -4187,12 +4187,12 @@  discard block
 block discarded – undo
4187 4187
       
4188 4188
 		
4189 4189
 		$sth = $this->db->prepare($query);
4190
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao));
4190
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao));
4191 4191
       
4192 4192
 		$airline_array = array();
4193 4193
 		$temp_array = array();
4194 4194
         
4195
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4195
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4196 4196
 		{
4197 4197
 			$temp_array['airline_name'] = $row['airline_name'];
4198 4198
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4212,10 +4212,10 @@  discard block
 block discarded – undo
4212 4212
 	*/
4213 4213
 	public function countAllAirlineCountriesByRoute($departure_airport_icao, $arrival_airport_icao)
4214 4214
 	{
4215
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
4216
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
4215
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
4216
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
4217 4217
       
4218
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4218
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4219 4219
 		 		FROM spotter_output
4220 4220
 				WHERE spotter_output.airline_country <> '' AND (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao) 
4221 4221
 				GROUP BY spotter_output.airline_country
@@ -4224,11 +4224,11 @@  discard block
 block discarded – undo
4224 4224
       
4225 4225
 		
4226 4226
 		$sth = $this->db->prepare($query);
4227
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao));
4227
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao));
4228 4228
       
4229 4229
 		$airline_country_array = array();
4230 4230
 		$temp_array = array();
4231
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4231
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4232 4232
 		{
4233 4233
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4234 4234
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4248,9 +4248,9 @@  discard block
 block discarded – undo
4248 4248
 	*/
4249 4249
 	public function countAllAirlinesByCountry($country)
4250 4250
 	{
4251
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
4251
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
4252 4252
 
4253
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4253
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4254 4254
 		 		FROM spotter_output
4255 4255
 				WHERE ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country  
4256 4256
 				GROUP BY spotter_output.airline_name
@@ -4262,7 +4262,7 @@  discard block
 block discarded – undo
4262 4262
 
4263 4263
 		$airline_array = array();
4264 4264
 		$temp_array = array();
4265
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4265
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4266 4266
 		{
4267 4267
 			$temp_array['airline_name'] = $row['airline_name'];
4268 4268
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4283,9 +4283,9 @@  discard block
 block discarded – undo
4283 4283
 	*/
4284 4284
 	public function countAllAirlineCountriesByCountry($country)
4285 4285
 	{
4286
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
4286
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
4287 4287
       
4288
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4288
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4289 4289
 		 		FROM spotter_output
4290 4290
 				WHERE spotter_output.airline_country <> '' AND ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country 
4291 4291
 				GROUP BY spotter_output.airline_country
@@ -4298,7 +4298,7 @@  discard block
 block discarded – undo
4298 4298
 
4299 4299
 		$airline_country_array = array();
4300 4300
 		$temp_array = array();
4301
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4301
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4302 4302
 		{
4303 4303
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4304 4304
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4317,7 +4317,7 @@  discard block
 block discarded – undo
4317 4317
 	*/
4318 4318
 	public function countAllAirlineCountries($limit = true)
4319 4319
 	{
4320
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4320
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4321 4321
 		 			FROM spotter_output
4322 4322
 					WHERE spotter_output.airline_country <> '' AND spotter_output.airline_country <> 'NA' 
4323 4323
 					GROUP BY spotter_output.airline_country
@@ -4329,7 +4329,7 @@  discard block
 block discarded – undo
4329 4329
 
4330 4330
 		$airline_array = array();
4331 4331
 		$temp_array = array();
4332
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4332
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4333 4333
 		{
4334 4334
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4335 4335
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4345,10 +4345,10 @@  discard block
 block discarded – undo
4345 4345
 	* @return Array the airline country list
4346 4346
 	*
4347 4347
 	*/
4348
-	public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '')
4348
+	public function countAllFlightOverCountries($limit = true, $olderthanmonths = 0, $sincedate = '')
4349 4349
 	{
4350 4350
 		global $globalDBdriver;
4351
-		$Connection= new Connection($this->db);
4351
+		$Connection = new Connection($this->db);
4352 4352
 		if (!$Connection->tableExists('countries')) return array();
4353 4353
 		/*
4354 4354
 		$query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb 
@@ -4383,7 +4383,7 @@  discard block
 block discarded – undo
4383 4383
 		$flight_array = array();
4384 4384
 		$temp_array = array();
4385 4385
         
4386
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4386
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4387 4387
 		{
4388 4388
 			$temp_array['flight_count'] = $row['nb'];
4389 4389
 			$temp_array['flight_country'] = $row['name'];
@@ -4401,12 +4401,12 @@  discard block
 block discarded – undo
4401 4401
 	* @return Array the aircraft list
4402 4402
 	*
4403 4403
 	*/
4404
-	public function countAllAircraftTypes($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
4404
+	public function countAllAircraftTypes($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
4405 4405
 	{
4406 4406
 		global $globalDBdriver;
4407
-		$filter_query = $this->getFilter($filters,true,true);
4407
+		$filter_query = $this->getFilter($filters, true, true);
4408 4408
 
4409
-		$query  = "SELECT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer 
4409
+		$query = "SELECT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer 
4410 4410
 		    FROM spotter_output ".$filter_query." spotter_output.aircraft_name  <> '' AND spotter_output.aircraft_icao  <> ''";
4411 4411
 		if ($olderthanmonths > 0) {
4412 4412
 			if ($globalDBdriver == 'mysql') {
@@ -4431,7 +4431,7 @@  discard block
 block discarded – undo
4431 4431
 
4432 4432
 		$aircraft_array = array();
4433 4433
 		$temp_array = array();
4434
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4434
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4435 4435
 		{
4436 4436
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4437 4437
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -4448,10 +4448,10 @@  discard block
 block discarded – undo
4448 4448
 	* @return Array the aircraft list
4449 4449
 	*
4450 4450
 	*/
4451
-	public function countAllAircraftTypesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '')
4451
+	public function countAllAircraftTypesByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '')
4452 4452
 	{
4453 4453
 		global $globalDBdriver;
4454
-		$query  = "SELECT spotter_output.airline_icao, spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer 
4454
+		$query = "SELECT spotter_output.airline_icao, spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer 
4455 4455
 		    FROM spotter_output
4456 4456
 		    WHERE spotter_output.aircraft_name  <> '' AND spotter_output.aircraft_icao  <> '' AND spotter_output.airline_icao <>'' AND spotter_output.airline_icao <> 'NA' ";
4457 4457
 		if ($olderthanmonths > 0) {
@@ -4477,7 +4477,7 @@  discard block
 block discarded – undo
4477 4477
 
4478 4478
 		$aircraft_array = array();
4479 4479
 		$temp_array = array();
4480
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4480
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4481 4481
 		{
4482 4482
 			$temp_array['airline_icao'] = $row['airline_icao'];
4483 4483
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
@@ -4499,9 +4499,9 @@  discard block
 block discarded – undo
4499 4499
 	public function countAllAircraftRegistrationByAircraft($aircraft_icao)
4500 4500
 	{
4501 4501
 		$Image = new Image($this->db);
4502
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
4502
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
4503 4503
 
4504
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name  
4504
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name  
4505 4505
 				FROM spotter_output
4506 4506
 				WHERE spotter_output.registration <> '' AND spotter_output.aircraft_icao = :aircraft_icao  
4507 4507
 				GROUP BY spotter_output.registration 
@@ -4513,14 +4513,14 @@  discard block
 block discarded – undo
4513 4513
 		$aircraft_array = array();
4514 4514
 		$temp_array = array();
4515 4515
         
4516
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4516
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4517 4517
 		{
4518 4518
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4519 4519
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
4520 4520
 			$temp_array['registration'] = $row['registration'];
4521 4521
 			$temp_array['airline_name'] = $row['airline_name'];
4522 4522
 			$temp_array['image_thumbnail'] = "";
4523
-			if($row['registration'] != "")
4523
+			if ($row['registration'] != "")
4524 4524
 			{
4525 4525
 				$image_array = $Image->getSpotterImage($row['registration']);
4526 4526
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -4541,9 +4541,9 @@  discard block
 block discarded – undo
4541 4541
 	*/
4542 4542
 	public function countAllAircraftTypesByAirline($airline_icao)
4543 4543
 	{
4544
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
4544
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
4545 4545
 
4546
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4546
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4547 4547
 				FROM spotter_output
4548 4548
 				WHERE spotter_output.aircraft_icao <> '' AND spotter_output.airline_icao = :airline_icao 
4549 4549
 				GROUP BY spotter_output.aircraft_name 
@@ -4555,7 +4555,7 @@  discard block
 block discarded – undo
4555 4555
 		$aircraft_array = array();
4556 4556
 		$temp_array = array();
4557 4557
 
4558
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4558
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4559 4559
 		{
4560 4560
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4561 4561
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -4576,9 +4576,9 @@  discard block
 block discarded – undo
4576 4576
 	public function countAllAircraftRegistrationByAirline($airline_icao)
4577 4577
 	{
4578 4578
 		$Image = new Image($this->db);
4579
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
4579
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
4580 4580
 
4581
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name   
4581
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name   
4582 4582
 				FROM spotter_output
4583 4583
 				WHERE spotter_output.registration <> '' AND spotter_output.airline_icao = :airline_icao 
4584 4584
 				GROUP BY spotter_output.registration 
@@ -4589,14 +4589,14 @@  discard block
 block discarded – undo
4589 4589
 
4590 4590
 		$aircraft_array = array();
4591 4591
 		$temp_array = array();
4592
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4592
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4593 4593
 		{
4594 4594
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4595 4595
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
4596 4596
 			$temp_array['registration'] = $row['registration'];
4597 4597
 			$temp_array['airline_name'] = $row['airline_name'];
4598 4598
 			$temp_array['image_thumbnail'] = "";
4599
-			if($row['registration'] != "")
4599
+			if ($row['registration'] != "")
4600 4600
 			{
4601 4601
 				$image_array = $Image->getSpotterImage($row['registration']);
4602 4602
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -4617,9 +4617,9 @@  discard block
 block discarded – undo
4617 4617
 	*/
4618 4618
 	public function countAllAircraftManufacturerByAirline($airline_icao)
4619 4619
 	{
4620
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
4620
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
4621 4621
 
4622
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
4622
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
4623 4623
 				FROM spotter_output
4624 4624
 				WHERE spotter_output.aircraft_manufacturer <> '' AND spotter_output.airline_icao = :airline_icao 
4625 4625
 				GROUP BY spotter_output.aircraft_manufacturer 
@@ -4631,7 +4631,7 @@  discard block
 block discarded – undo
4631 4631
 		$aircraft_array = array();
4632 4632
 		$temp_array = array();
4633 4633
 
4634
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4634
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4635 4635
 		{
4636 4636
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
4637 4637
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -4650,9 +4650,9 @@  discard block
 block discarded – undo
4650 4650
 	*/
4651 4651
 	public function countAllAircraftTypesByAirport($airport_icao)
4652 4652
 	{
4653
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
4653
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
4654 4654
 
4655
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4655
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4656 4656
 				FROM spotter_output
4657 4657
 				WHERE spotter_output.aircraft_icao <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao) 
4658 4658
 				GROUP BY spotter_output.aircraft_name 
@@ -4663,7 +4663,7 @@  discard block
 block discarded – undo
4663 4663
 
4664 4664
 		$aircraft_array = array();
4665 4665
 		$temp_array = array();
4666
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4666
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4667 4667
 		{
4668 4668
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4669 4669
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -4684,9 +4684,9 @@  discard block
 block discarded – undo
4684 4684
 	public function countAllAircraftRegistrationByAirport($airport_icao)
4685 4685
 	{
4686 4686
 		$Image = new Image($this->db);
4687
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
4687
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
4688 4688
 
4689
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name  
4689
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name  
4690 4690
                     FROM spotter_output
4691 4691
                     WHERE spotter_output.registration <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao)   
4692 4692
                     GROUP BY spotter_output.registration 
@@ -4698,14 +4698,14 @@  discard block
 block discarded – undo
4698 4698
 
4699 4699
 		$aircraft_array = array();
4700 4700
 		$temp_array = array();
4701
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4701
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4702 4702
 		{
4703 4703
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4704 4704
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
4705 4705
 			$temp_array['registration'] = $row['registration'];
4706 4706
 			$temp_array['airline_name'] = $row['airline_name'];
4707 4707
 			$temp_array['image_thumbnail'] = "";
4708
-			if($row['registration'] != "")
4708
+			if ($row['registration'] != "")
4709 4709
 			{
4710 4710
 				$image_array = $Image->getSpotterImage($row['registration']);
4711 4711
 				$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -4725,9 +4725,9 @@  discard block
 block discarded – undo
4725 4725
 	*/
4726 4726
 	public function countAllAircraftManufacturerByAirport($airport_icao)
4727 4727
 	{
4728
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
4728
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
4729 4729
 
4730
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
4730
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
4731 4731
                     FROM spotter_output
4732 4732
                     WHERE spotter_output.aircraft_manufacturer <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao)  
4733 4733
                     GROUP BY spotter_output.aircraft_manufacturer 
@@ -4739,7 +4739,7 @@  discard block
 block discarded – undo
4739 4739
 
4740 4740
 		$aircraft_array = array();
4741 4741
 		$temp_array = array();
4742
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4742
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4743 4743
 		{
4744 4744
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
4745 4745
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -4756,9 +4756,9 @@  discard block
 block discarded – undo
4756 4756
 	*/
4757 4757
 	public function countAllAircraftTypesByManufacturer($aircraft_manufacturer)
4758 4758
 	{
4759
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
4759
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
4760 4760
 
4761
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4761
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4762 4762
                     FROM spotter_output
4763 4763
                     WHERE spotter_output.aircraft_manufacturer = :aircraft_manufacturer
4764 4764
                     GROUP BY spotter_output.aircraft_name 
@@ -4768,7 +4768,7 @@  discard block
 block discarded – undo
4768 4768
 		$sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer));
4769 4769
 		$aircraft_array = array();
4770 4770
 		$temp_array = array();
4771
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4771
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4772 4772
 		{
4773 4773
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4774 4774
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -4788,9 +4788,9 @@  discard block
 block discarded – undo
4788 4788
 	public function countAllAircraftRegistrationByManufacturer($aircraft_manufacturer)
4789 4789
 	{
4790 4790
 		$Image = new Image($this->db);
4791
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
4791
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
4792 4792
 
4793
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name   
4793
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name   
4794 4794
                     FROM spotter_output
4795 4795
                     WHERE spotter_output.registration <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer   
4796 4796
                     GROUP BY spotter_output.registration 
@@ -4801,14 +4801,14 @@  discard block
 block discarded – undo
4801 4801
 		$sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer));
4802 4802
 		$aircraft_array = array();
4803 4803
 		$temp_array = array();
4804
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4804
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4805 4805
 		{
4806 4806
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4807 4807
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
4808 4808
 			$temp_array['registration'] = $row['registration'];
4809 4809
 			$temp_array['airline_name'] = $row['airline_name'];
4810 4810
 			$temp_array['image_thumbnail'] = "";
4811
-			if($row['registration'] != "")
4811
+			if ($row['registration'] != "")
4812 4812
 			{
4813 4813
 				$image_array = $Image->getSpotterImage($row['registration']);
4814 4814
 				$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -4828,7 +4828,7 @@  discard block
 block discarded – undo
4828 4828
 	public function countAllAircraftTypesByDate($date)
4829 4829
 	{
4830 4830
 		global $globalTimezone, $globalDBdriver;
4831
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
4831
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
4832 4832
 		if ($globalTimezone != '') {
4833 4833
 			date_default_timezone_set($globalTimezone);
4834 4834
 			$datetime = new DateTime($date);
@@ -4836,13 +4836,13 @@  discard block
 block discarded – undo
4836 4836
 		} else $offset = '+00:00';
4837 4837
 
4838 4838
 		if ($globalDBdriver == 'mysql') {
4839
-			$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4839
+			$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4840 4840
 					FROM spotter_output
4841 4841
 					WHERE DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date
4842 4842
 					GROUP BY spotter_output.aircraft_name 
4843 4843
 					ORDER BY aircraft_icao_count DESC";
4844 4844
 		} else {
4845
-			$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4845
+			$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4846 4846
 					FROM spotter_output
4847 4847
 					WHERE to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date
4848 4848
 					GROUP BY spotter_output.aircraft_name 
@@ -4854,7 +4854,7 @@  discard block
 block discarded – undo
4854 4854
 
4855 4855
 		$aircraft_array = array();
4856 4856
 		$temp_array = array();
4857
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4857
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4858 4858
 		{
4859 4859
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4860 4860
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -4876,7 +4876,7 @@  discard block
 block discarded – undo
4876 4876
 	{
4877 4877
 		global $globalTimezone, $globalDBdriver;
4878 4878
 		$Image = new Image($this->db);
4879
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
4879
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
4880 4880
 		if ($globalTimezone != '') {
4881 4881
 			date_default_timezone_set($globalTimezone);
4882 4882
 			$datetime = new DateTime($date);
@@ -4884,13 +4884,13 @@  discard block
 block discarded – undo
4884 4884
 		} else $offset = '+00:00';
4885 4885
 
4886 4886
 		if ($globalDBdriver == 'mysql') {
4887
-			$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name    
4887
+			$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name    
4888 4888
 					FROM spotter_output
4889 4889
 					WHERE spotter_output.registration <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
4890 4890
 					GROUP BY spotter_output.registration 
4891 4891
 					ORDER BY registration_count DESC";
4892 4892
 		} else {
4893
-			$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name    
4893
+			$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name    
4894 4894
 					FROM spotter_output
4895 4895
 					WHERE spotter_output.registration <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date 
4896 4896
 					GROUP BY spotter_output.registration 
@@ -4902,14 +4902,14 @@  discard block
 block discarded – undo
4902 4902
 
4903 4903
 		$aircraft_array = array();
4904 4904
 		$temp_array = array();
4905
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4905
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4906 4906
 		{
4907 4907
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4908 4908
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
4909 4909
 			$temp_array['registration'] = $row['registration'];
4910 4910
 			$temp_array['airline_name'] = $row['airline_name'];
4911 4911
 			$temp_array['image_thumbnail'] = "";
4912
-			if($row['registration'] != "")
4912
+			if ($row['registration'] != "")
4913 4913
 			{
4914 4914
 				$image_array = $Image->getSpotterImage($row['registration']);
4915 4915
 				$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -4931,7 +4931,7 @@  discard block
 block discarded – undo
4931 4931
 	public function countAllAircraftManufacturerByDate($date)
4932 4932
 	{
4933 4933
 		global $globalTimezone, $globalDBdriver;
4934
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
4934
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
4935 4935
 		if ($globalTimezone != '') {
4936 4936
 			date_default_timezone_set($globalTimezone);
4937 4937
 			$datetime = new DateTime($date);
@@ -4939,13 +4939,13 @@  discard block
 block discarded – undo
4939 4939
 		} else $offset = '+00:00';
4940 4940
 
4941 4941
 		if ($globalDBdriver == 'mysql') {
4942
-			$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
4942
+			$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
4943 4943
 				FROM spotter_output
4944 4944
 				WHERE spotter_output.aircraft_manufacturer <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
4945 4945
 				GROUP BY spotter_output.aircraft_manufacturer 
4946 4946
 				ORDER BY aircraft_manufacturer_count DESC";
4947 4947
 		} else {
4948
-			$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
4948
+			$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
4949 4949
 				FROM spotter_output
4950 4950
 				WHERE spotter_output.aircraft_manufacturer <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date 
4951 4951
 				GROUP BY spotter_output.aircraft_manufacturer 
@@ -4958,7 +4958,7 @@  discard block
 block discarded – undo
4958 4958
 		$aircraft_array = array();
4959 4959
 		$temp_array = array();
4960 4960
 
4961
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4961
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4962 4962
 		{
4963 4963
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
4964 4964
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -4977,9 +4977,9 @@  discard block
 block discarded – undo
4977 4977
 	*/
4978 4978
 	public function countAllAircraftTypesByIdent($ident)
4979 4979
 	{
4980
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
4980
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
4981 4981
 
4982
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4982
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4983 4983
 				FROM spotter_output
4984 4984
 				WHERE spotter_output.ident = :ident 
4985 4985
 				GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao
@@ -4991,7 +4991,7 @@  discard block
 block discarded – undo
4991 4991
 		$aircraft_array = array();
4992 4992
 		$temp_array = array();
4993 4993
 
4994
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4994
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4995 4995
 		{
4996 4996
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4997 4997
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -5012,9 +5012,9 @@  discard block
 block discarded – undo
5012 5012
 	public function countAllAircraftRegistrationByIdent($ident)
5013 5013
 	{
5014 5014
 		$Image = new Image($this->db);
5015
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
5015
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
5016 5016
 
5017
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name  
5017
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name  
5018 5018
                     FROM spotter_output
5019 5019
                     WHERE spotter_output.registration <> '' AND spotter_output.ident = :ident   
5020 5020
                     GROUP BY spotter_output.registration,spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name
@@ -5027,14 +5027,14 @@  discard block
 block discarded – undo
5027 5027
 		$aircraft_array = array();
5028 5028
 		$temp_array = array();
5029 5029
         
5030
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5030
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5031 5031
 		{
5032 5032
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5033 5033
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5034 5034
 			$temp_array['registration'] = $row['registration'];
5035 5035
 			$temp_array['airline_name'] = $row['airline_name'];
5036 5036
 			$temp_array['image_thumbnail'] = "";
5037
-			if($row['registration'] != "")
5037
+			if ($row['registration'] != "")
5038 5038
 			{
5039 5039
 				$image_array = $Image->getSpotterImage($row['registration']);
5040 5040
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5055,9 +5055,9 @@  discard block
 block discarded – undo
5055 5055
 	*/
5056 5056
 	public function countAllAircraftManufacturerByIdent($ident)
5057 5057
 	{
5058
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
5058
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
5059 5059
 
5060
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5060
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5061 5061
                     FROM spotter_output
5062 5062
                     WHERE spotter_output.aircraft_manufacturer <> '' AND spotter_output.ident = :ident  
5063 5063
                     GROUP BY spotter_output.aircraft_manufacturer 
@@ -5068,7 +5068,7 @@  discard block
 block discarded – undo
5068 5068
 		$sth->execute(array(':ident' => $ident));
5069 5069
 		$aircraft_array = array();
5070 5070
 		$temp_array = array();
5071
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5071
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5072 5072
 		{
5073 5073
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
5074 5074
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -5086,11 +5086,11 @@  discard block
 block discarded – undo
5086 5086
 	*/
5087 5087
 	public function countAllAircraftTypesByRoute($departure_airport_icao, $arrival_airport_icao)
5088 5088
 	{
5089
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
5090
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
5089
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
5090
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
5091 5091
 		
5092 5092
 
5093
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5093
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5094 5094
                     FROM spotter_output
5095 5095
                     WHERE (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao)
5096 5096
                     GROUP BY spotter_output.aircraft_name 
@@ -5098,10 +5098,10 @@  discard block
 block discarded – undo
5098 5098
  
5099 5099
 		
5100 5100
 		$sth = $this->db->prepare($query);
5101
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao));
5101
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao));
5102 5102
 		$aircraft_array = array();
5103 5103
 		$temp_array = array();
5104
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5104
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5105 5105
 		{
5106 5106
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5107 5107
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -5120,10 +5120,10 @@  discard block
 block discarded – undo
5120 5120
 	public function countAllAircraftRegistrationByRoute($departure_airport_icao, $arrival_airport_icao)
5121 5121
 	{
5122 5122
 		$Image = new Image($this->db);
5123
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
5124
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
5123
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
5124
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
5125 5125
 
5126
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name   
5126
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name   
5127 5127
                     FROM spotter_output
5128 5128
                     WHERE spotter_output.registration <> '' AND (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao)   
5129 5129
                     GROUP BY spotter_output.registration 
@@ -5131,19 +5131,19 @@  discard block
 block discarded – undo
5131 5131
 
5132 5132
 		
5133 5133
 		$sth = $this->db->prepare($query);
5134
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao));
5134
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao));
5135 5135
       
5136 5136
 		$aircraft_array = array();
5137 5137
 		$temp_array = array();
5138 5138
         
5139
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5139
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5140 5140
 		{
5141 5141
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5142 5142
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5143 5143
 			$temp_array['registration'] = $row['registration'];
5144 5144
 			$temp_array['airline_name'] = $row['airline_name'];
5145 5145
 			$temp_array['image_thumbnail'] = "";
5146
-			if($row['registration'] != "")
5146
+			if ($row['registration'] != "")
5147 5147
 			{
5148 5148
 				$image_array = $Image->getSpotterImage($row['registration']);
5149 5149
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5165,10 +5165,10 @@  discard block
 block discarded – undo
5165 5165
 	*/
5166 5166
 	public function countAllAircraftManufacturerByRoute($departure_airport_icao, $arrival_airport_icao)
5167 5167
 	{
5168
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
5169
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
5168
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
5169
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
5170 5170
 
5171
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5171
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5172 5172
                     FROM spotter_output
5173 5173
                     WHERE spotter_output.aircraft_manufacturer <> '' AND (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao) 
5174 5174
                     GROUP BY spotter_output.aircraft_manufacturer 
@@ -5176,12 +5176,12 @@  discard block
 block discarded – undo
5176 5176
 
5177 5177
 		
5178 5178
 		$sth = $this->db->prepare($query);
5179
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao));
5179
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao));
5180 5180
       
5181 5181
 		$aircraft_array = array();
5182 5182
 		$temp_array = array();
5183 5183
         
5184
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5184
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5185 5185
 		{
5186 5186
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
5187 5187
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -5203,9 +5203,9 @@  discard block
 block discarded – undo
5203 5203
 	*/
5204 5204
 	public function countAllAircraftTypesByCountry($country)
5205 5205
 	{
5206
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
5206
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
5207 5207
 
5208
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5208
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5209 5209
                     FROM spotter_output
5210 5210
                     WHERE ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country 
5211 5211
                     GROUP BY spotter_output.aircraft_name 
@@ -5218,7 +5218,7 @@  discard block
 block discarded – undo
5218 5218
 		$aircraft_array = array();
5219 5219
 		$temp_array = array();
5220 5220
         
5221
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5221
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5222 5222
 		{
5223 5223
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5224 5224
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -5240,9 +5240,9 @@  discard block
 block discarded – undo
5240 5240
 	public function countAllAircraftRegistrationByCountry($country)
5241 5241
 	{
5242 5242
 		$Image = new Image($this->db);
5243
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
5243
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
5244 5244
 
5245
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name 
5245
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name 
5246 5246
                     FROM spotter_output
5247 5247
                     WHERE spotter_output.registration <> '' AND (((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country)    
5248 5248
                     GROUP BY spotter_output.registration 
@@ -5255,14 +5255,14 @@  discard block
 block discarded – undo
5255 5255
 		$aircraft_array = array();
5256 5256
 		$temp_array = array();
5257 5257
         
5258
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5258
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5259 5259
 		{
5260 5260
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5261 5261
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5262 5262
 			$temp_array['registration'] = $row['registration'];
5263 5263
 			$temp_array['airline_name'] = $row['airline_name'];
5264 5264
 			$temp_array['image_thumbnail'] = "";
5265
-			if($row['registration'] != "")
5265
+			if ($row['registration'] != "")
5266 5266
 			{
5267 5267
 				$image_array = $Image->getSpotterImage($row['registration']);
5268 5268
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5284,9 +5284,9 @@  discard block
 block discarded – undo
5284 5284
 	*/
5285 5285
 	public function countAllAircraftManufacturerByCountry($country)
5286 5286
 	{
5287
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
5287
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
5288 5288
 
5289
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5289
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5290 5290
                     FROM spotter_output
5291 5291
                     WHERE spotter_output.aircraft_manufacturer <> '' AND (((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country) 
5292 5292
                     GROUP BY spotter_output.aircraft_manufacturer 
@@ -5299,7 +5299,7 @@  discard block
 block discarded – undo
5299 5299
 		$aircraft_array = array();
5300 5300
 		$temp_array = array();
5301 5301
         
5302
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5302
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5303 5303
 		{
5304 5304
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
5305 5305
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -5320,8 +5320,8 @@  discard block
 block discarded – undo
5320 5320
 	*/
5321 5321
 	public function countAllAircraftManufacturers($filter = array())
5322 5322
 	{
5323
-		$filter_query = $this->getFilter($filter,true,true);
5324
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5323
+		$filter_query = $this->getFilter($filter, true, true);
5324
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5325 5325
                     FROM spotter_output ".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.aircraft_manufacturer <> 'Not Available'";
5326 5326
                 $query .= " GROUP BY spotter_output.aircraft_manufacturer
5327 5327
 					ORDER BY aircraft_manufacturer_count DESC
@@ -5334,7 +5334,7 @@  discard block
 block discarded – undo
5334 5334
 		$manufacturer_array = array();
5335 5335
 		$temp_array = array();
5336 5336
         
5337
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5337
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5338 5338
 		{
5339 5339
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
5340 5340
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -5353,12 +5353,12 @@  discard block
 block discarded – undo
5353 5353
 	* @return Array the aircraft list
5354 5354
 	*
5355 5355
 	*/
5356
-	public function countAllAircraftRegistrations($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
5356
+	public function countAllAircraftRegistrations($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
5357 5357
 	{
5358 5358
 		global $globalDBdriver;
5359 5359
 		$Image = new Image($this->db);
5360
-		$filter_query = $this->getFilter($filters,true,true);
5361
-		$query  = "SELECT DISTINCT spotter_output.registration, COUNT(spotter_output.registration) AS aircraft_registration_count, spotter_output.aircraft_icao,  spotter_output.aircraft_name, spotter_output.airline_name    
5360
+		$filter_query = $this->getFilter($filters, true, true);
5361
+		$query = "SELECT DISTINCT spotter_output.registration, COUNT(spotter_output.registration) AS aircraft_registration_count, spotter_output.aircraft_icao,  spotter_output.aircraft_name, spotter_output.airline_name    
5362 5362
                     FROM spotter_output ".$filter_query." spotter_output.registration <> '' AND spotter_output.registration <> 'NA'";
5363 5363
                 if ($olderthanmonths > 0) {
5364 5364
             		if ($globalDBdriver == 'mysql') {
@@ -5386,7 +5386,7 @@  discard block
 block discarded – undo
5386 5386
 		$aircraft_array = array();
5387 5387
 		$temp_array = array();
5388 5388
         
5389
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5389
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5390 5390
 		{
5391 5391
 			$temp_array['registration'] = $row['registration'];
5392 5392
 			$temp_array['aircraft_registration_count'] = $row['aircraft_registration_count'];
@@ -5394,7 +5394,7 @@  discard block
 block discarded – undo
5394 5394
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5395 5395
 			$temp_array['airline_name'] = $row['airline_name'];
5396 5396
 			$temp_array['image_thumbnail'] = "";
5397
-			if($row['registration'] != "")
5397
+			if ($row['registration'] != "")
5398 5398
 			{
5399 5399
 				$image_array = $Image->getSpotterImage($row['registration']);
5400 5400
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5413,11 +5413,11 @@  discard block
 block discarded – undo
5413 5413
 	* @return Array the aircraft list
5414 5414
 	*
5415 5415
 	*/
5416
-	public function countAllAircraftRegistrationsByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '')
5416
+	public function countAllAircraftRegistrationsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '')
5417 5417
 	{
5418 5418
 		global $globalDBdriver;
5419 5419
 		$Image = new Image($this->db);
5420
-		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.registration, COUNT(spotter_output.registration) AS aircraft_registration_count, spotter_output.aircraft_icao,  spotter_output.aircraft_name, spotter_output.airline_name    
5420
+		$query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.registration, COUNT(spotter_output.registration) AS aircraft_registration_count, spotter_output.aircraft_icao,  spotter_output.aircraft_name, spotter_output.airline_name    
5421 5421
                     FROM spotter_output 
5422 5422
                     WHERE spotter_output.airline_icao <> '' AND spotter_output.registration <> '' AND spotter_output.registration <> 'NA' ";
5423 5423
                 if ($olderthanmonths > 0) {
@@ -5446,7 +5446,7 @@  discard block
 block discarded – undo
5446 5446
 		$aircraft_array = array();
5447 5447
 		$temp_array = array();
5448 5448
         
5449
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5449
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5450 5450
 		{
5451 5451
 			$temp_array['registration'] = $row['registration'];
5452 5452
 			$temp_array['aircraft_registration_count'] = $row['aircraft_registration_count'];
@@ -5455,7 +5455,7 @@  discard block
 block discarded – undo
5455 5455
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5456 5456
 			$temp_array['airline_name'] = $row['airline_name'];
5457 5457
 			$temp_array['image_thumbnail'] = "";
5458
-			if($row['registration'] != "")
5458
+			if ($row['registration'] != "")
5459 5459
 			{
5460 5460
 				$image_array = $Image->getSpotterImage($row['registration']);
5461 5461
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5474,11 +5474,11 @@  discard block
 block discarded – undo
5474 5474
 	* @return Array the airport list
5475 5475
 	*
5476 5476
 	*/
5477
-	public function countAllDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
5477
+	public function countAllDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
5478 5478
 	{
5479 5479
 		global $globalDBdriver;
5480
-		$filter_query = $this->getFilter($filters,true,true);
5481
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
5480
+		$filter_query = $this->getFilter($filters, true, true);
5481
+		$query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
5482 5482
 				FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA'";
5483 5483
                 if ($olderthanmonths > 0) {
5484 5484
             		if ($globalDBdriver == 'mysql') {
@@ -5507,7 +5507,7 @@  discard block
 block discarded – undo
5507 5507
 		$airport_array = array();
5508 5508
 		$temp_array = array();
5509 5509
         
5510
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5510
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5511 5511
 		{
5512 5512
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
5513 5513
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -5529,7 +5529,7 @@  discard block
 block discarded – undo
5529 5529
 	public function countAllDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '')
5530 5530
 	{
5531 5531
 		global $globalDBdriver;
5532
-		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
5532
+		$query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
5533 5533
 								FROM spotter_output
5534 5534
                     WHERE spotter_output.airline_icao <> '' AND spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' ";
5535 5535
                 if ($olderthanmonths > 0) {
@@ -5559,7 +5559,7 @@  discard block
 block discarded – undo
5559 5559
 		$airport_array = array();
5560 5560
 		$temp_array = array();
5561 5561
         
5562
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5562
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5563 5563
 		{
5564 5564
 			$temp_array['airline_icao'] = $row['airline_icao'];
5565 5565
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -5579,11 +5579,11 @@  discard block
 block discarded – undo
5579 5579
 	* @return Array the airport list
5580 5580
 	*
5581 5581
 	*/
5582
-	public function countAllDetectedDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
5582
+	public function countAllDetectedDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
5583 5583
 	{
5584 5584
 		global $globalDBdriver;
5585
-		$filter_query = $this->getFilter($filters,true,true);
5586
-		$query  = "SELECT DISTINCT spotter_output.real_departure_airport_icao AS departure_airport_icao, COUNT(spotter_output.real_departure_airport_icao) AS airport_departure_icao_count, airport.name as departure_airport_name, airport.city as departure_airport_city, airport.country as departure_airport_country
5585
+		$filter_query = $this->getFilter($filters, true, true);
5586
+		$query = "SELECT DISTINCT spotter_output.real_departure_airport_icao AS departure_airport_icao, COUNT(spotter_output.real_departure_airport_icao) AS airport_departure_icao_count, airport.name as departure_airport_name, airport.city as departure_airport_city, airport.country as departure_airport_country
5587 5587
 				FROM spotter_output, airport".$filter_query." spotter_output.real_departure_airport_icao <> '' AND spotter_output.real_departure_airport_icao <> 'NA' AND airport.icao = spotter_output.real_departure_airport_icao";
5588 5588
                 if ($olderthanmonths > 0) {
5589 5589
             		if ($globalDBdriver == 'mysql') {
@@ -5611,7 +5611,7 @@  discard block
 block discarded – undo
5611 5611
 		$airport_array = array();
5612 5612
 		$temp_array = array();
5613 5613
         
5614
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5614
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5615 5615
 		{
5616 5616
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
5617 5617
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -5633,7 +5633,7 @@  discard block
 block discarded – undo
5633 5633
 	public function countAllDetectedDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '')
5634 5634
 	{
5635 5635
 		global $globalDBdriver;
5636
-		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.real_departure_airport_icao AS departure_airport_icao, COUNT(spotter_output.real_departure_airport_icao) AS airport_departure_icao_count, airport.name as departure_airport_name, airport.city as departure_airport_city, airport.country as departure_airport_country
5636
+		$query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.real_departure_airport_icao AS departure_airport_icao, COUNT(spotter_output.real_departure_airport_icao) AS airport_departure_icao_count, airport.name as departure_airport_name, airport.city as departure_airport_city, airport.country as departure_airport_country
5637 5637
 				FROM spotter_output, airport
5638 5638
                     WHERE spotter_output.airline_icao <> '' AND spotter_output.real_departure_airport_icao <> '' AND spotter_output.real_departure_airport_icao <> 'NA' AND airport.icao = spotter_output.real_departure_airport_icao ";
5639 5639
                 if ($olderthanmonths > 0) {
@@ -5663,7 +5663,7 @@  discard block
 block discarded – undo
5663 5663
 		$airport_array = array();
5664 5664
 		$temp_array = array();
5665 5665
         
5666
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5666
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5667 5667
 		{
5668 5668
 			$temp_array['airline_icao'] = $row['airline_icao'];
5669 5669
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -5685,9 +5685,9 @@  discard block
 block discarded – undo
5685 5685
 	*/
5686 5686
 	public function countAllDepartureAirportsByAirline($airline_icao)
5687 5687
 	{
5688
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
5688
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
5689 5689
 
5690
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
5690
+		$query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
5691 5691
 								FROM spotter_output
5692 5692
                     WHERE spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.airline_icao = :airline_icao 
5693 5693
                     GROUP BY spotter_output.departure_airport_icao
@@ -5700,7 +5700,7 @@  discard block
 block discarded – undo
5700 5700
 		$airport_array = array();
5701 5701
 		$temp_array = array();
5702 5702
         
5703
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5703
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5704 5704
 		{
5705 5705
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
5706 5706
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -5724,9 +5724,9 @@  discard block
 block discarded – undo
5724 5724
 	*/
5725 5725
 	public function countAllDepartureAirportCountriesByAirline($airline_icao)
5726 5726
 	{
5727
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
5727
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
5728 5728
 					
5729
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
5729
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
5730 5730
 								FROM spotter_output 
5731 5731
                     WHERE spotter_output.departure_airport_country <> '' AND spotter_output.airline_icao = :airline_icao 
5732 5732
                     GROUP BY spotter_output.departure_airport_country
@@ -5739,7 +5739,7 @@  discard block
 block discarded – undo
5739 5739
 		$airport_array = array();
5740 5740
 		$temp_array = array();
5741 5741
         
5742
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5742
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5743 5743
 		{
5744 5744
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
5745 5745
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -5760,9 +5760,9 @@  discard block
 block discarded – undo
5760 5760
 	*/
5761 5761
 	public function countAllDepartureAirportsByAircraft($aircraft_icao)
5762 5762
 	{
5763
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
5763
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
5764 5764
 
5765
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
5765
+		$query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
5766 5766
 								FROM spotter_output
5767 5767
                     WHERE spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.aircraft_icao = :aircraft_icao 
5768 5768
                     GROUP BY spotter_output.departure_airport_icao
@@ -5775,7 +5775,7 @@  discard block
 block discarded – undo
5775 5775
 		$airport_array = array();
5776 5776
 		$temp_array = array();
5777 5777
         
5778
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5778
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5779 5779
 		{
5780 5780
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
5781 5781
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -5798,9 +5798,9 @@  discard block
 block discarded – undo
5798 5798
 	*/
5799 5799
 	public function countAllDepartureAirportCountriesByAircraft($aircraft_icao)
5800 5800
 	{
5801
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
5801
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
5802 5802
 					
5803
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
5803
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
5804 5804
 								FROM spotter_output 
5805 5805
                     WHERE spotter_output.departure_airport_country <> '' AND spotter_output.aircraft_icao = :aircraft_icao
5806 5806
                     GROUP BY spotter_output.departure_airport_country
@@ -5813,7 +5813,7 @@  discard block
 block discarded – undo
5813 5813
 		$airport_array = array();
5814 5814
 		$temp_array = array();
5815 5815
         
5816
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5816
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5817 5817
 		{
5818 5818
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
5819 5819
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -5833,9 +5833,9 @@  discard block
 block discarded – undo
5833 5833
 	*/
5834 5834
 	public function countAllDepartureAirportsByRegistration($registration)
5835 5835
 	{
5836
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
5836
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
5837 5837
 
5838
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
5838
+		$query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
5839 5839
 								FROM spotter_output
5840 5840
                     WHERE spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.registration = :registration 
5841 5841
                     GROUP BY spotter_output.departure_airport_icao
@@ -5848,7 +5848,7 @@  discard block
 block discarded – undo
5848 5848
 		$airport_array = array();
5849 5849
 		$temp_array = array();
5850 5850
         
5851
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5851
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5852 5852
 		{
5853 5853
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
5854 5854
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -5871,9 +5871,9 @@  discard block
 block discarded – undo
5871 5871
 	*/
5872 5872
 	public function countAllDepartureAirportCountriesByRegistration($registration)
5873 5873
 	{
5874
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
5874
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
5875 5875
 					
5876
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
5876
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
5877 5877
 								FROM spotter_output 
5878 5878
                     WHERE spotter_output.departure_airport_country <> '' AND spotter_output.registration = :registration 
5879 5879
                     GROUP BY spotter_output.departure_airport_country
@@ -5886,7 +5886,7 @@  discard block
 block discarded – undo
5886 5886
 		$airport_array = array();
5887 5887
 		$temp_array = array();
5888 5888
         
5889
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5889
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5890 5890
 		{
5891 5891
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
5892 5892
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -5906,9 +5906,9 @@  discard block
 block discarded – undo
5906 5906
 	*/
5907 5907
 	public function countAllDepartureAirportsByAirport($airport_icao)
5908 5908
 	{
5909
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
5909
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
5910 5910
 
5911
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
5911
+		$query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
5912 5912
 								FROM spotter_output
5913 5913
                     WHERE spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao = :airport_icao 
5914 5914
                     GROUP BY spotter_output.departure_airport_icao
@@ -5921,7 +5921,7 @@  discard block
 block discarded – undo
5921 5921
 		$airport_array = array();
5922 5922
 		$temp_array = array();
5923 5923
         
5924
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5924
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5925 5925
 		{
5926 5926
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
5927 5927
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -5944,9 +5944,9 @@  discard block
 block discarded – undo
5944 5944
 	*/
5945 5945
 	public function countAllDepartureAirportCountriesByAirport($airport_icao)
5946 5946
 	{
5947
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
5947
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
5948 5948
 					
5949
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
5949
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
5950 5950
 								FROM spotter_output 
5951 5951
                     WHERE spotter_output.departure_airport_country <> '' AND spotter_output.arrival_airport_icao = :airport_icao 
5952 5952
                     GROUP BY spotter_output.departure_airport_country
@@ -5959,7 +5959,7 @@  discard block
 block discarded – undo
5959 5959
 		$airport_array = array();
5960 5960
 		$temp_array = array();
5961 5961
         
5962
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5962
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5963 5963
 		{
5964 5964
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
5965 5965
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -5980,9 +5980,9 @@  discard block
 block discarded – undo
5980 5980
 	*/
5981 5981
 	public function countAllDepartureAirportsByManufacturer($aircraft_manufacturer)
5982 5982
 	{
5983
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
5983
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
5984 5984
 
5985
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
5985
+		$query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
5986 5986
 								FROM spotter_output
5987 5987
                     WHERE spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer 
5988 5988
                     GROUP BY spotter_output.departure_airport_icao
@@ -5995,7 +5995,7 @@  discard block
 block discarded – undo
5995 5995
 		$airport_array = array();
5996 5996
 		$temp_array = array();
5997 5997
         
5998
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5998
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5999 5999
 		{
6000 6000
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
6001 6001
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -6018,9 +6018,9 @@  discard block
 block discarded – undo
6018 6018
 	*/
6019 6019
 	public function countAllDepartureAirportCountriesByManufacturer($aircraft_manufacturer)
6020 6020
 	{
6021
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
6021
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
6022 6022
 					
6023
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6023
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6024 6024
 								FROM spotter_output 
6025 6025
                     WHERE spotter_output.departure_airport_country <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer 
6026 6026
                     GROUP BY spotter_output.departure_airport_country
@@ -6033,7 +6033,7 @@  discard block
 block discarded – undo
6033 6033
 		$airport_array = array();
6034 6034
 		$temp_array = array();
6035 6035
         
6036
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6036
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6037 6037
 		{
6038 6038
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
6039 6039
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -6054,7 +6054,7 @@  discard block
 block discarded – undo
6054 6054
 	public function countAllDepartureAirportsByDate($date)
6055 6055
 	{
6056 6056
 		global $globalTimezone, $globalDBdriver;
6057
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
6057
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
6058 6058
 
6059 6059
 		if ($globalTimezone != '') {
6060 6060
 			date_default_timezone_set($globalTimezone);
@@ -6063,13 +6063,13 @@  discard block
 block discarded – undo
6063 6063
 		} else $offset = '+00:00';
6064 6064
 
6065 6065
 		if ($globalDBdriver == 'mysql') {
6066
-			$query  = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
6066
+			$query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
6067 6067
 					FROM spotter_output
6068 6068
 					WHERE spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date
6069 6069
 					GROUP BY spotter_output.departure_airport_icao
6070 6070
 					ORDER BY airport_departure_icao_count DESC";
6071 6071
 		} else {
6072
-			$query  = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
6072
+			$query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
6073 6073
 					FROM spotter_output
6074 6074
 					WHERE spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date
6075 6075
 					GROUP BY spotter_output.departure_airport_icao
@@ -6082,7 +6082,7 @@  discard block
 block discarded – undo
6082 6082
 		$airport_array = array();
6083 6083
 		$temp_array = array();
6084 6084
         
6085
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6085
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6086 6086
 		{
6087 6087
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
6088 6088
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -6106,7 +6106,7 @@  discard block
 block discarded – undo
6106 6106
 	public function countAllDepartureAirportCountriesByDate($date)
6107 6107
 	{
6108 6108
 		global $globalTimezone, $globalDBdriver;
6109
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
6109
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
6110 6110
 		if ($globalTimezone != '') {
6111 6111
 			date_default_timezone_set($globalTimezone);
6112 6112
 			$datetime = new DateTime($date);
@@ -6114,13 +6114,13 @@  discard block
 block discarded – undo
6114 6114
 		} else $offset = '+00:00';
6115 6115
 
6116 6116
 		if ($globalDBdriver == 'mysql') {
6117
-			$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6117
+			$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6118 6118
 					FROM spotter_output 
6119 6119
 					WHERE spotter_output.departure_airport_country <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
6120 6120
 					GROUP BY spotter_output.departure_airport_country
6121 6121
 					ORDER BY airport_departure_country_count DESC";
6122 6122
 		} else {
6123
-			$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6123
+			$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6124 6124
 					FROM spotter_output 
6125 6125
 					WHERE spotter_output.departure_airport_country <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date 
6126 6126
 					GROUP BY spotter_output.departure_airport_country
@@ -6133,7 +6133,7 @@  discard block
 block discarded – undo
6133 6133
 		$airport_array = array();
6134 6134
 		$temp_array = array();
6135 6135
         
6136
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6136
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6137 6137
 		{
6138 6138
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
6139 6139
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -6153,9 +6153,9 @@  discard block
 block discarded – undo
6153 6153
 	*/
6154 6154
 	public function countAllDepartureAirportsByIdent($ident)
6155 6155
 	{
6156
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
6156
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
6157 6157
 
6158
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
6158
+		$query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
6159 6159
 		    FROM spotter_output
6160 6160
                     WHERE spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.ident = :ident 
6161 6161
                     GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
@@ -6168,7 +6168,7 @@  discard block
 block discarded – undo
6168 6168
 		$airport_array = array();
6169 6169
 		$temp_array = array();
6170 6170
         
6171
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6171
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6172 6172
 		{
6173 6173
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
6174 6174
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -6192,9 +6192,9 @@  discard block
 block discarded – undo
6192 6192
 	*/
6193 6193
 	public function countAllDepartureAirportCountriesByIdent($ident)
6194 6194
 	{
6195
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
6195
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
6196 6196
 					
6197
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6197
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6198 6198
 								FROM spotter_output 
6199 6199
                     WHERE spotter_output.departure_airport_country <> '' AND spotter_output.ident = :ident 
6200 6200
                     GROUP BY spotter_output.departure_airport_country
@@ -6207,7 +6207,7 @@  discard block
 block discarded – undo
6207 6207
 		$airport_array = array();
6208 6208
 		$temp_array = array();
6209 6209
         
6210
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6210
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6211 6211
 		{
6212 6212
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
6213 6213
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -6228,9 +6228,9 @@  discard block
 block discarded – undo
6228 6228
 	*/
6229 6229
 	public function countAllDepartureAirportsByCountry($country)
6230 6230
 	{
6231
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
6231
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
6232 6232
 
6233
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
6233
+		$query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
6234 6234
 								FROM spotter_output
6235 6235
                     WHERE ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country
6236 6236
                     GROUP BY spotter_output.departure_airport_icao
@@ -6243,7 +6243,7 @@  discard block
 block discarded – undo
6243 6243
 		$airport_array = array();
6244 6244
 		$temp_array = array();
6245 6245
         
6246
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6246
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6247 6247
 		{
6248 6248
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
6249 6249
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -6266,9 +6266,9 @@  discard block
 block discarded – undo
6266 6266
 	*/
6267 6267
 	public function countAllDepartureAirportCountriesByCountry($country)
6268 6268
 	{
6269
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
6269
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
6270 6270
 					
6271
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6271
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6272 6272
 								FROM spotter_output 
6273 6273
                     WHERE spotter_output.departure_airport_country <> '' AND ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country 
6274 6274
                     GROUP BY spotter_output.departure_airport_country
@@ -6281,7 +6281,7 @@  discard block
 block discarded – undo
6281 6281
 		$airport_array = array();
6282 6282
 		$temp_array = array();
6283 6283
         
6284
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6284
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6285 6285
 		{
6286 6286
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
6287 6287
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -6299,11 +6299,11 @@  discard block
 block discarded – undo
6299 6299
 	* @return Array the airport list
6300 6300
 	*
6301 6301
 	*/
6302
-	public function countAllArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array())
6302
+	public function countAllArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false, $filters = array())
6303 6303
 	{
6304 6304
 		global $globalDBdriver;
6305
-		$filter_query = $this->getFilter($filters,true,true);
6306
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
6305
+		$filter_query = $this->getFilter($filters, true, true);
6306
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
6307 6307
 				FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA'";
6308 6308
                 if ($olderthanmonths > 0) {
6309 6309
             		if ($globalDBdriver == 'mysql') {
@@ -6338,7 +6338,7 @@  discard block
 block discarded – undo
6338 6338
 		$airport_array = array();
6339 6339
 		$temp_array = array();
6340 6340
         
6341
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6341
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6342 6342
 		{
6343 6343
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
6344 6344
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -6364,7 +6364,7 @@  discard block
 block discarded – undo
6364 6364
 	public function countAllArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false)
6365 6365
 	{
6366 6366
 		global $globalDBdriver;
6367
-		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
6367
+		$query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
6368 6368
 								FROM spotter_output 
6369 6369
                     WHERE spotter_output.airline_icao <> '' AND spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' ";
6370 6370
                 if ($olderthanmonths > 0) {
@@ -6400,7 +6400,7 @@  discard block
 block discarded – undo
6400 6400
 		$airport_array = array();
6401 6401
 		$temp_array = array();
6402 6402
         
6403
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6403
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6404 6404
 		{
6405 6405
 			$temp_array['airline_icao'] = $row['airline_icao'];
6406 6406
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
@@ -6425,11 +6425,11 @@  discard block
 block discarded – undo
6425 6425
 	* @return Array the airport list
6426 6426
 	*
6427 6427
 	*/
6428
-	public function countAllDetectedArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array())
6428
+	public function countAllDetectedArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false, $filters = array())
6429 6429
 	{
6430 6430
 		global $globalDBdriver;
6431
-		$filter_query = $this->getFilter($filters,true,true);
6432
-		$query  = "SELECT DISTINCT spotter_output.real_arrival_airport_icao as arrival_airport_icao, COUNT(spotter_output.real_arrival_airport_icao) AS airport_arrival_icao_count, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country 
6431
+		$filter_query = $this->getFilter($filters, true, true);
6432
+		$query = "SELECT DISTINCT spotter_output.real_arrival_airport_icao as arrival_airport_icao, COUNT(spotter_output.real_arrival_airport_icao) AS airport_arrival_icao_count, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country 
6433 6433
 			FROM spotter_output, airport".$filter_query." spotter_output.real_arrival_airport_icao <> '' AND spotter_output.real_arrival_airport_icao <> 'NA' AND airport.icao = spotter_output.real_arrival_airport_icao";
6434 6434
                 if ($olderthanmonths > 0) {
6435 6435
             		if ($globalDBdriver == 'mysql') {
@@ -6463,7 +6463,7 @@  discard block
 block discarded – undo
6463 6463
 		$airport_array = array();
6464 6464
 		$temp_array = array();
6465 6465
         
6466
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6466
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6467 6467
 		{
6468 6468
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
6469 6469
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -6486,10 +6486,10 @@  discard block
 block discarded – undo
6486 6486
 	* @return Array the airport list
6487 6487
 	*
6488 6488
 	*/
6489
-	public function countAllDetectedArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false)
6489
+	public function countAllDetectedArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false)
6490 6490
 	{
6491 6491
 		global $globalDBdriver;
6492
-		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.real_arrival_airport_icao as arrival_airport_icao, COUNT(spotter_output.real_arrival_airport_icao) AS airport_arrival_icao_count, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country 
6492
+		$query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.real_arrival_airport_icao as arrival_airport_icao, COUNT(spotter_output.real_arrival_airport_icao) AS airport_arrival_icao_count, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country 
6493 6493
 			FROM spotter_output, airport 
6494 6494
                     WHERE spotter_output.airline_icao <> '' AND spotter_output.real_arrival_airport_icao <> '' AND spotter_output.real_arrival_airport_icao <> 'NA' AND airport.icao = spotter_output.real_arrival_airport_icao ";
6495 6495
                 if ($olderthanmonths > 0) {
@@ -6525,7 +6525,7 @@  discard block
 block discarded – undo
6525 6525
 		$airport_array = array();
6526 6526
 		$temp_array = array();
6527 6527
         
6528
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6528
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6529 6529
 		{
6530 6530
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
6531 6531
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -6551,9 +6551,9 @@  discard block
 block discarded – undo
6551 6551
 	*/
6552 6552
 	public function countAllArrivalAirportsByAirline($airline_icao)
6553 6553
 	{
6554
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
6554
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
6555 6555
 
6556
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
6556
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
6557 6557
 								FROM spotter_output 
6558 6558
                     WHERE spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.airline_icao = :airline_icao 
6559 6559
                     GROUP BY spotter_output.arrival_airport_icao
@@ -6566,7 +6566,7 @@  discard block
 block discarded – undo
6566 6566
 		$airport_array = array();
6567 6567
 		$temp_array = array();
6568 6568
         
6569
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6569
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6570 6570
 		{
6571 6571
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
6572 6572
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -6589,9 +6589,9 @@  discard block
 block discarded – undo
6589 6589
 	*/
6590 6590
 	public function countAllArrivalAirportCountriesByAirline($airline_icao)
6591 6591
 	{
6592
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
6592
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
6593 6593
 					
6594
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6594
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6595 6595
 								FROM spotter_output 
6596 6596
                     WHERE spotter_output.arrival_airport_country <> '' AND spotter_output.airline_icao = :airline_icao 
6597 6597
                     GROUP BY spotter_output.arrival_airport_country
@@ -6604,7 +6604,7 @@  discard block
 block discarded – undo
6604 6604
 		$airport_array = array();
6605 6605
 		$temp_array = array();
6606 6606
         
6607
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6607
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6608 6608
 		{
6609 6609
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
6610 6610
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -6624,9 +6624,9 @@  discard block
 block discarded – undo
6624 6624
 	*/
6625 6625
 	public function countAllArrivalAirportsByAircraft($aircraft_icao)
6626 6626
 	{
6627
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
6627
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
6628 6628
 
6629
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
6629
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
6630 6630
 								FROM spotter_output 
6631 6631
                     WHERE spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.aircraft_icao = :aircraft_icao 
6632 6632
                     GROUP BY spotter_output.arrival_airport_icao
@@ -6639,7 +6639,7 @@  discard block
 block discarded – undo
6639 6639
 		$airport_array = array();
6640 6640
 		$temp_array = array();
6641 6641
         
6642
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6642
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6643 6643
 		{
6644 6644
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
6645 6645
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -6663,9 +6663,9 @@  discard block
 block discarded – undo
6663 6663
 	*/
6664 6664
 	public function countAllArrivalAirportCountriesByAircraft($aircraft_icao)
6665 6665
 	{
6666
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
6666
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
6667 6667
 					
6668
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6668
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6669 6669
 								FROM spotter_output 
6670 6670
                     WHERE spotter_output.arrival_airport_country <> '' AND spotter_output.aircraft_icao = :aircraft_icao
6671 6671
                     GROUP BY spotter_output.arrival_airport_country
@@ -6678,7 +6678,7 @@  discard block
 block discarded – undo
6678 6678
 		$airport_array = array();
6679 6679
 		$temp_array = array();
6680 6680
         
6681
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6681
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6682 6682
 		{
6683 6683
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
6684 6684
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -6698,9 +6698,9 @@  discard block
 block discarded – undo
6698 6698
 	*/
6699 6699
 	public function countAllArrivalAirportsByRegistration($registration)
6700 6700
 	{
6701
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
6701
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
6702 6702
 
6703
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
6703
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
6704 6704
 								FROM spotter_output 
6705 6705
                     WHERE spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.registration = :registration 
6706 6706
                     GROUP BY spotter_output.arrival_airport_icao
@@ -6713,7 +6713,7 @@  discard block
 block discarded – undo
6713 6713
 		$airport_array = array();
6714 6714
 		$temp_array = array();
6715 6715
         
6716
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6716
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6717 6717
 		{
6718 6718
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
6719 6719
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -6736,9 +6736,9 @@  discard block
 block discarded – undo
6736 6736
 	*/
6737 6737
 	public function countAllArrivalAirportCountriesByRegistration($registration)
6738 6738
 	{
6739
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
6739
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
6740 6740
 					
6741
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6741
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6742 6742
 								FROM spotter_output 
6743 6743
                     WHERE spotter_output.arrival_airport_country <> '' AND spotter_output.registration = :registration 
6744 6744
                     GROUP BY spotter_output.arrival_airport_country
@@ -6751,7 +6751,7 @@  discard block
 block discarded – undo
6751 6751
 		$airport_array = array();
6752 6752
 		$temp_array = array();
6753 6753
         
6754
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6754
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6755 6755
 		{
6756 6756
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
6757 6757
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -6772,9 +6772,9 @@  discard block
 block discarded – undo
6772 6772
 	*/
6773 6773
 	public function countAllArrivalAirportsByAirport($airport_icao)
6774 6774
 	{
6775
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
6775
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
6776 6776
 
6777
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
6777
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
6778 6778
 								FROM spotter_output 
6779 6779
                     WHERE spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.departure_airport_icao = :airport_icao 
6780 6780
                     GROUP BY spotter_output.arrival_airport_icao
@@ -6787,7 +6787,7 @@  discard block
 block discarded – undo
6787 6787
 		$airport_array = array();
6788 6788
 		$temp_array = array();
6789 6789
         
6790
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6790
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6791 6791
 		{
6792 6792
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
6793 6793
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -6810,9 +6810,9 @@  discard block
 block discarded – undo
6810 6810
 	*/
6811 6811
 	public function countAllArrivalAirportCountriesByAirport($airport_icao)
6812 6812
 	{
6813
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
6813
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
6814 6814
 					
6815
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6815
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6816 6816
 								FROM spotter_output 
6817 6817
                     WHERE spotter_output.arrival_airport_country <> '' AND spotter_output.departure_airport_icao = :airport_icao 
6818 6818
                     GROUP BY spotter_output.arrival_airport_country
@@ -6825,7 +6825,7 @@  discard block
 block discarded – undo
6825 6825
 		$airport_array = array();
6826 6826
 		$temp_array = array();
6827 6827
         
6828
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6828
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6829 6829
 		{
6830 6830
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
6831 6831
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -6845,9 +6845,9 @@  discard block
 block discarded – undo
6845 6845
 	*/
6846 6846
 	public function countAllArrivalAirportsByManufacturer($aircraft_manufacturer)
6847 6847
 	{
6848
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
6848
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
6849 6849
 
6850
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
6850
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
6851 6851
 								FROM spotter_output 
6852 6852
                     WHERE spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer 
6853 6853
                     GROUP BY spotter_output.arrival_airport_icao
@@ -6860,7 +6860,7 @@  discard block
 block discarded – undo
6860 6860
 		$airport_array = array();
6861 6861
 		$temp_array = array();
6862 6862
         
6863
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6863
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6864 6864
 		{
6865 6865
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
6866 6866
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -6884,9 +6884,9 @@  discard block
 block discarded – undo
6884 6884
 	*/
6885 6885
 	public function countAllArrivalAirportCountriesByManufacturer($aircraft_manufacturer)
6886 6886
 	{
6887
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
6887
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
6888 6888
 					
6889
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6889
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6890 6890
 								FROM spotter_output 
6891 6891
                     WHERE spotter_output.arrival_airport_country <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer 
6892 6892
                     GROUP BY spotter_output.arrival_airport_country
@@ -6899,7 +6899,7 @@  discard block
 block discarded – undo
6899 6899
 		$airport_array = array();
6900 6900
 		$temp_array = array();
6901 6901
         
6902
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6902
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6903 6903
 		{
6904 6904
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
6905 6905
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -6921,7 +6921,7 @@  discard block
 block discarded – undo
6921 6921
 	public function countAllArrivalAirportsByDate($date)
6922 6922
 	{
6923 6923
 		global $globalTimezone, $globalDBdriver;
6924
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
6924
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
6925 6925
 		if ($globalTimezone != '') {
6926 6926
 			date_default_timezone_set($globalTimezone);
6927 6927
 			$datetime = new DateTime($date);
@@ -6929,13 +6929,13 @@  discard block
 block discarded – undo
6929 6929
 		} else $offset = '+00:00';
6930 6930
 
6931 6931
 		if ($globalDBdriver == 'mysql') {
6932
-			$query  = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
6932
+			$query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
6933 6933
 					FROM spotter_output 
6934 6934
 					WHERE spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date  
6935 6935
 					GROUP BY spotter_output.arrival_airport_icao
6936 6936
 					ORDER BY airport_arrival_icao_count DESC";
6937 6937
 		} else {
6938
-			$query  = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
6938
+			$query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
6939 6939
 					FROM spotter_output 
6940 6940
 					WHERE spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date  
6941 6941
 					GROUP BY spotter_output.arrival_airport_icao
@@ -6948,7 +6948,7 @@  discard block
 block discarded – undo
6948 6948
 		$airport_array = array();
6949 6949
 		$temp_array = array();
6950 6950
         
6951
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6951
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6952 6952
 		{
6953 6953
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
6954 6954
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -6972,7 +6972,7 @@  discard block
 block discarded – undo
6972 6972
 	public function countAllArrivalAirportCountriesByDate($date)
6973 6973
 	{
6974 6974
 		global $globalTimezone, $globalDBdriver;
6975
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
6975
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
6976 6976
 		if ($globalTimezone != '') {
6977 6977
 			date_default_timezone_set($globalTimezone);
6978 6978
 			$datetime = new DateTime($date);
@@ -6980,13 +6980,13 @@  discard block
 block discarded – undo
6980 6980
 		} else $offset = '+00:00';
6981 6981
 
6982 6982
 		if ($globalDBdriver == 'mysql') {
6983
-			$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6983
+			$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6984 6984
 					FROM spotter_output 
6985 6985
 					WHERE spotter_output.arrival_airport_country <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
6986 6986
 					GROUP BY spotter_output.arrival_airport_country
6987 6987
 					ORDER BY airport_arrival_country_count DESC";
6988 6988
 		} else {
6989
-			$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6989
+			$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6990 6990
 					FROM spotter_output 
6991 6991
 					WHERE spotter_output.arrival_airport_country <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date 
6992 6992
 					GROUP BY spotter_output.arrival_airport_country
@@ -6999,7 +6999,7 @@  discard block
 block discarded – undo
6999 6999
 		$airport_array = array();
7000 7000
 		$temp_array = array();
7001 7001
         
7002
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7002
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7003 7003
 		{
7004 7004
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
7005 7005
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -7019,9 +7019,9 @@  discard block
 block discarded – undo
7019 7019
 	*/
7020 7020
 	public function countAllArrivalAirportsByIdent($ident)
7021 7021
 	{
7022
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
7022
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
7023 7023
 
7024
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
7024
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
7025 7025
 		    FROM spotter_output 
7026 7026
                     WHERE spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.ident = :ident  
7027 7027
                     GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
@@ -7034,7 +7034,7 @@  discard block
 block discarded – undo
7034 7034
 		$airport_array = array();
7035 7035
 		$temp_array = array();
7036 7036
         
7037
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7037
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7038 7038
 		{
7039 7039
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
7040 7040
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -7057,9 +7057,9 @@  discard block
 block discarded – undo
7057 7057
 	*/
7058 7058
 	public function countAllArrivalAirportCountriesByIdent($ident)
7059 7059
 	{
7060
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
7060
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
7061 7061
 					
7062
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7062
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7063 7063
 								FROM spotter_output 
7064 7064
                     WHERE spotter_output.arrival_airport_country <> '' AND spotter_output.ident = :ident 
7065 7065
                     GROUP BY spotter_output.arrival_airport_country
@@ -7072,7 +7072,7 @@  discard block
 block discarded – undo
7072 7072
 		$airport_array = array();
7073 7073
 		$temp_array = array();
7074 7074
         
7075
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7075
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7076 7076
 		{
7077 7077
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
7078 7078
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -7093,9 +7093,9 @@  discard block
 block discarded – undo
7093 7093
 	*/
7094 7094
 	public function countAllArrivalAirportsByCountry($country)
7095 7095
 	{
7096
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
7096
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
7097 7097
 
7098
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
7098
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
7099 7099
 								FROM spotter_output 
7100 7100
                     WHERE ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country  
7101 7101
                     GROUP BY spotter_output.arrival_airport_icao
@@ -7108,7 +7108,7 @@  discard block
 block discarded – undo
7108 7108
 		$airport_array = array();
7109 7109
 		$temp_array = array();
7110 7110
         
7111
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7111
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7112 7112
 		{
7113 7113
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
7114 7114
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -7131,9 +7131,9 @@  discard block
 block discarded – undo
7131 7131
 	*/
7132 7132
 	public function countAllArrivalAirportCountriesByCountry($country)
7133 7133
 	{
7134
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
7134
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
7135 7135
 					
7136
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7136
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7137 7137
 								FROM spotter_output 
7138 7138
                     WHERE spotter_output.arrival_airport_country <> '' AND ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country 
7139 7139
                     GROUP BY spotter_output.arrival_airport_country
@@ -7146,7 +7146,7 @@  discard block
 block discarded – undo
7146 7146
 		$airport_array = array();
7147 7147
 		$temp_array = array();
7148 7148
         
7149
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7149
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7150 7150
 		{
7151 7151
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
7152 7152
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -7167,7 +7167,7 @@  discard block
 block discarded – undo
7167 7167
 	*/
7168 7168
 	public function countAllDepartureCountries($filters = array())
7169 7169
 	{
7170
-		$filter_query = $this->getFilter($filters,true,true);
7170
+		$filter_query = $this->getFilter($filters, true, true);
7171 7171
 		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7172 7172
 				FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.departure_airport_icao <> 'NA'";
7173 7173
 		$query .= " GROUP BY spotter_output.departure_airport_country
@@ -7181,7 +7181,7 @@  discard block
 block discarded – undo
7181 7181
 		$airport_array = array();
7182 7182
 		$temp_array = array();
7183 7183
         
7184
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7184
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7185 7185
 		{
7186 7186
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
7187 7187
 			$temp_array['airport_departure_country'] = $row['departure_airport_country'];
@@ -7199,9 +7199,9 @@  discard block
 block discarded – undo
7199 7199
 	* @return Array the airport arrival list
7200 7200
 	*
7201 7201
 	*/
7202
-	public function countAllArrivalCountries($limit = true,$filters = array())
7202
+	public function countAllArrivalCountries($limit = true, $filters = array())
7203 7203
 	{
7204
-		$filter_query = $this->getFilter($filters,true,true);
7204
+		$filter_query = $this->getFilter($filters, true, true);
7205 7205
 		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7206 7206
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.arrival_airport_icao <> 'NA'";
7207 7207
 		$query .= " GROUP BY spotter_output.arrival_airport_country
@@ -7215,7 +7215,7 @@  discard block
 block discarded – undo
7215 7215
 		$airport_array = array();
7216 7216
 		$temp_array = array();
7217 7217
         
7218
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7218
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7219 7219
 		{
7220 7220
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
7221 7221
 			$temp_array['airport_arrival_country'] = $row['arrival_airport_country'];
@@ -7239,7 +7239,7 @@  discard block
 block discarded – undo
7239 7239
 	public function countAllRoutes()
7240 7240
 	{
7241 7241
 		
7242
-		$query  = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7242
+		$query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7243 7243
 		    FROM spotter_output
7244 7244
                     WHERE spotter_output.ident <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> 'NA'
7245 7245
                     GROUP BY route,spotter_output.departure_airport_icao, spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
@@ -7253,7 +7253,7 @@  discard block
 block discarded – undo
7253 7253
 		$routes_array = array();
7254 7254
 		$temp_array = array();
7255 7255
         
7256
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7256
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7257 7257
 		{
7258 7258
 			$temp_array['route_count'] = $row['route_count'];
7259 7259
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -7282,9 +7282,9 @@  discard block
 block discarded – undo
7282 7282
 	*/
7283 7283
 	public function countAllRoutesByAircraft($aircraft_icao)
7284 7284
 	{
7285
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
7285
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
7286 7286
 		
7287
-		$query  = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7287
+		$query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7288 7288
 								FROM spotter_output
7289 7289
                     WHERE spotter_output.ident <> '' AND spotter_output.aircraft_icao = :aircraft_icao 
7290 7290
                     GROUP BY route
@@ -7297,7 +7297,7 @@  discard block
 block discarded – undo
7297 7297
 		$routes_array = array();
7298 7298
 		$temp_array = array();
7299 7299
         
7300
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7300
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7301 7301
 		{
7302 7302
 			$temp_array['route_count'] = $row['route_count'];
7303 7303
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -7326,7 +7326,7 @@  discard block
 block discarded – undo
7326 7326
 	{
7327 7327
 		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
7328 7328
 		
7329
-		$query  = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7329
+		$query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7330 7330
 								FROM spotter_output
7331 7331
                     WHERE spotter_output.ident <> '' AND spotter_output.registration = :registration 
7332 7332
                     GROUP BY route
@@ -7339,7 +7339,7 @@  discard block
 block discarded – undo
7339 7339
 		$routes_array = array();
7340 7340
 		$temp_array = array();
7341 7341
         
7342
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7342
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7343 7343
 		{
7344 7344
 			$temp_array['route_count'] = $row['route_count'];
7345 7345
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -7367,9 +7367,9 @@  discard block
 block discarded – undo
7367 7367
 	*/
7368 7368
 	public function countAllRoutesByAirline($airline_icao)
7369 7369
 	{
7370
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
7370
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
7371 7371
 		
7372
-		$query  = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7372
+		$query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7373 7373
 								FROM spotter_output
7374 7374
                     WHERE spotter_output.ident <> '' AND spotter_output.airline_icao = :airline_icao 
7375 7375
                     GROUP BY route
@@ -7382,7 +7382,7 @@  discard block
 block discarded – undo
7382 7382
 		$routes_array = array();
7383 7383
 		$temp_array = array();
7384 7384
         
7385
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7385
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7386 7386
 		{
7387 7387
 			$temp_array['route_count'] = $row['route_count'];
7388 7388
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -7410,9 +7410,9 @@  discard block
 block discarded – undo
7410 7410
 	*/
7411 7411
 	public function countAllRoutesByAirport($airport_icao)
7412 7412
 	{
7413
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
7413
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
7414 7414
 		
7415
-		$query  = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7415
+		$query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7416 7416
 								FROM spotter_output
7417 7417
                     WHERE spotter_output.ident <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao)
7418 7418
                     GROUP BY route
@@ -7425,7 +7425,7 @@  discard block
 block discarded – undo
7425 7425
 		$routes_array = array();
7426 7426
 		$temp_array = array();
7427 7427
         
7428
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7428
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7429 7429
 		{
7430 7430
 			$temp_array['route_count'] = $row['route_count'];
7431 7431
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -7453,9 +7453,9 @@  discard block
 block discarded – undo
7453 7453
 	*/
7454 7454
 	public function countAllRoutesByCountry($country)
7455 7455
 	{
7456
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
7456
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
7457 7457
 		
7458
-		$query  = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7458
+		$query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7459 7459
 								FROM spotter_output
7460 7460
                     WHERE spotter_output.ident <> '' AND ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country 
7461 7461
                     GROUP BY route
@@ -7468,7 +7468,7 @@  discard block
 block discarded – undo
7468 7468
 		$routes_array = array();
7469 7469
 		$temp_array = array();
7470 7470
         
7471
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7471
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7472 7472
 		{
7473 7473
 			$temp_array['route_count'] = $row['route_count'];
7474 7474
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -7496,7 +7496,7 @@  discard block
 block discarded – undo
7496 7496
 	public function countAllRoutesByDate($date)
7497 7497
 	{
7498 7498
 		global $globalTimezone, $globalDBdriver;
7499
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
7499
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
7500 7500
 		if ($globalTimezone != '') {
7501 7501
 			date_default_timezone_set($globalTimezone);
7502 7502
 			$datetime = new DateTime($date);
@@ -7504,13 +7504,13 @@  discard block
 block discarded – undo
7504 7504
 		} else $offset = '+00:00';
7505 7505
 		
7506 7506
 		if ($globalDBdriver == 'mysql') {
7507
-			$query  = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7507
+			$query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7508 7508
 					FROM spotter_output
7509 7509
 					WHERE spotter_output.ident <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date  
7510 7510
 					GROUP BY route
7511 7511
 					ORDER BY route_count DESC";
7512 7512
 		} else {
7513
-			$query  = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7513
+			$query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7514 7514
 					FROM spotter_output
7515 7515
 					WHERE spotter_output.ident <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date  
7516 7516
 					GROUP BY route
@@ -7523,7 +7523,7 @@  discard block
 block discarded – undo
7523 7523
 		$routes_array = array();
7524 7524
 		$temp_array = array();
7525 7525
         
7526
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7526
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7527 7527
 		{
7528 7528
 			$temp_array['route_count'] = $row['route_count'];
7529 7529
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -7550,9 +7550,9 @@  discard block
 block discarded – undo
7550 7550
 	*/
7551 7551
 	public function countAllRoutesByIdent($ident)
7552 7552
 	{
7553
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
7553
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
7554 7554
 		
7555
-		$query  = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7555
+		$query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7556 7556
 		    FROM spotter_output
7557 7557
                     WHERE spotter_output.ident <> '' AND spotter_output.ident = :ident   
7558 7558
                     GROUP BY route, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
@@ -7565,7 +7565,7 @@  discard block
 block discarded – undo
7565 7565
 		$routes_array = array();
7566 7566
 		$temp_array = array();
7567 7567
         
7568
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7568
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7569 7569
 		{
7570 7570
 			$temp_array['route_count'] = $row['route_count'];
7571 7571
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -7592,9 +7592,9 @@  discard block
 block discarded – undo
7592 7592
 	*/
7593 7593
 	public function countAllRoutesByManufacturer($aircraft_manufacturer)
7594 7594
 	{
7595
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
7595
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
7596 7596
 		
7597
-		$query  = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7597
+		$query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7598 7598
 		    FROM spotter_output
7599 7599
                     WHERE spotter_output.ident <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer   
7600 7600
                     GROUP BY route
@@ -7607,7 +7607,7 @@  discard block
 block discarded – undo
7607 7607
 		$routes_array = array();
7608 7608
 		$temp_array = array();
7609 7609
         
7610
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7610
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7611 7611
 		{
7612 7612
 			$temp_array['route_count'] = $row['route_count'];
7613 7613
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -7635,7 +7635,7 @@  discard block
 block discarded – undo
7635 7635
 	*/
7636 7636
 	public function countAllRoutesWithWaypoints()
7637 7637
 	{
7638
-		$query  = "SELECT DISTINCT spotter_output.waypoints AS route, count(spotter_output.waypoints) AS route_count, spotter_output.spotter_id, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7638
+		$query = "SELECT DISTINCT spotter_output.waypoints AS route, count(spotter_output.waypoints) AS route_count, spotter_output.spotter_id, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7639 7639
 		    FROM spotter_output
7640 7640
                     WHERE spotter_output.ident <> '' AND spotter_output.waypoints <> '' 
7641 7641
                     GROUP BY route, spotter_output.spotter_id, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
@@ -7649,7 +7649,7 @@  discard block
 block discarded – undo
7649 7649
 		$routes_array = array();
7650 7650
 		$temp_array = array();
7651 7651
         
7652
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7652
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7653 7653
 		{
7654 7654
 			$temp_array['spotter_id'] = $row['spotter_id'];
7655 7655
 			$temp_array['route_count'] = $row['route_count'];
@@ -7677,11 +7677,11 @@  discard block
 block discarded – undo
7677 7677
 	* @return Array the callsign list
7678 7678
 	*
7679 7679
 	*/
7680
-	public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
7680
+	public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
7681 7681
 	{
7682 7682
 		global $globalDBdriver;
7683
-		$filter_query = $this->getFilter($filters,true,true);
7684
-		$query  = "SELECT DISTINCT spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name, spotter_output.airline_icao  
7683
+		$filter_query = $this->getFilter($filters, true, true);
7684
+		$query = "SELECT DISTINCT spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name, spotter_output.airline_icao  
7685 7685
                     FROM spotter_output".$filter_query." spotter_output.ident <> '' ";
7686 7686
 		 if ($olderthanmonths > 0) {
7687 7687
 			if ($globalDBdriver == 'mysql') $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)';
@@ -7700,7 +7700,7 @@  discard block
 block discarded – undo
7700 7700
 		$callsign_array = array();
7701 7701
 		$temp_array = array();
7702 7702
         
7703
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7703
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7704 7704
 		{
7705 7705
 			$temp_array['callsign_icao'] = $row['ident'];
7706 7706
 			$temp_array['airline_name'] = $row['airline_name'];
@@ -7722,7 +7722,7 @@  discard block
 block discarded – undo
7722 7722
 	public function countAllCallsignsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '')
7723 7723
 	{
7724 7724
 		global $globalDBdriver;
7725
-		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name  
7725
+		$query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name  
7726 7726
                     FROM spotter_output
7727 7727
                     WHERE spotter_output.ident <> ''  AND spotter_output.airline_icao <> '' ";
7728 7728
 		 if ($olderthanmonths > 0) {
@@ -7742,7 +7742,7 @@  discard block
 block discarded – undo
7742 7742
 		$callsign_array = array();
7743 7743
 		$temp_array = array();
7744 7744
         
7745
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7745
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7746 7746
 		{
7747 7747
 			$temp_array['callsign_icao'] = $row['ident'];
7748 7748
 			$temp_array['airline_name'] = $row['airline_name'];
@@ -7796,7 +7796,7 @@  discard block
 block discarded – undo
7796 7796
 		$date_array = array();
7797 7797
 		$temp_array = array();
7798 7798
         
7799
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7799
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7800 7800
 		{
7801 7801
 			$temp_array['date_name'] = $row['date_name'];
7802 7802
 			$temp_array['date_count'] = $row['date_count'];
@@ -7823,14 +7823,14 @@  discard block
 block discarded – undo
7823 7823
 		} else $offset = '+00:00';
7824 7824
 
7825 7825
 		if ($globalDBdriver == 'mysql') {
7826
-			$query  = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
7826
+			$query = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
7827 7827
 								FROM spotter_output 
7828 7828
 								WHERE spotter_output.airline_icao <> '' 
7829 7829
 								GROUP BY spotter_output.airline_icao, date_name 
7830 7830
 								ORDER BY date_count DESC
7831 7831
 								LIMIT 10 OFFSET 0";
7832 7832
 		} else {
7833
-			$query  = "SELECT spotter_output.airline_icao, to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') AS date_name, count(*) as date_count
7833
+			$query = "SELECT spotter_output.airline_icao, to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') AS date_name, count(*) as date_count
7834 7834
 								FROM spotter_output 
7835 7835
 								WHERE spotter_output.airline_icao <> '' 
7836 7836
 								GROUP BY spotter_output.airline_icao, date_name 
@@ -7845,7 +7845,7 @@  discard block
 block discarded – undo
7845 7845
 		$date_array = array();
7846 7846
 		$temp_array = array();
7847 7847
         
7848
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7848
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7849 7849
 		{
7850 7850
 			$temp_array['date_name'] = $row['date_name'];
7851 7851
 			$temp_array['date_count'] = $row['date_count'];
@@ -7871,7 +7871,7 @@  discard block
 block discarded – undo
7871 7871
 			$datetime = new DateTime();
7872 7872
 			$offset = $datetime->format('P');
7873 7873
 		} else $offset = '+00:00';
7874
-		$filter_query = $this->getFilter($filters,true,true);
7874
+		$filter_query = $this->getFilter($filters, true, true);
7875 7875
 		if ($globalDBdriver == 'mysql') {
7876 7876
 			$query  = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
7877 7877
 								FROM spotter_output".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY)";
@@ -7892,7 +7892,7 @@  discard block
 block discarded – undo
7892 7892
 		$date_array = array();
7893 7893
 		$temp_array = array();
7894 7894
         
7895
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7895
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7896 7896
 		{
7897 7897
 			$temp_array['date_name'] = $row['date_name'];
7898 7898
 			$temp_array['date_count'] = $row['date_count'];
@@ -7917,7 +7917,7 @@  discard block
 block discarded – undo
7917 7917
 			$datetime = new DateTime();
7918 7918
 			$offset = $datetime->format('P');
7919 7919
 		} else $offset = '+00:00';
7920
-		$filter_query = $this->getFilter($filters,true,true);
7920
+		$filter_query = $this->getFilter($filters, true, true);
7921 7921
 		if ($globalDBdriver == 'mysql') {
7922 7922
 			$query  = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
7923 7923
 								FROM spotter_output".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MONTH)";
@@ -7938,7 +7938,7 @@  discard block
 block discarded – undo
7938 7938
 		$date_array = array();
7939 7939
 		$temp_array = array();
7940 7940
         
7941
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7941
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7942 7942
 		{
7943 7943
 			$temp_array['date_name'] = $row['date_name'];
7944 7944
 			$temp_array['date_count'] = $row['date_count'];
@@ -7966,14 +7966,14 @@  discard block
 block discarded – undo
7966 7966
 		} else $offset = '+00:00';
7967 7967
 		
7968 7968
 		if ($globalDBdriver == 'mysql') {
7969
-			$query  = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
7969
+			$query = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
7970 7970
 								FROM spotter_output 
7971 7971
 								WHERE spotter_output.airline_icao <> '' AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MONTH)
7972 7972
 								GROUP BY spotter_output.airline_icao, date_name 
7973 7973
 								ORDER BY spotter_output.date ASC";
7974 7974
 			$query_data = array(':offset' => $offset);
7975 7975
 		} else {
7976
-			$query  = "SELECT spotter_output.airline_icao, to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') AS date_name, count(*) as date_count
7976
+			$query = "SELECT spotter_output.airline_icao, to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') AS date_name, count(*) as date_count
7977 7977
 								FROM spotter_output 
7978 7978
 								WHERE spotter_output.airline_icao <> '' AND spotter_output.date >= CURRENT_TIMESTAMP AT TIME ZONE INTERVAL :offset - INTERVAL '1 MONTHS'
7979 7979
 								GROUP BY spotter_output.airline_icao, date_name 
@@ -7987,7 +7987,7 @@  discard block
 block discarded – undo
7987 7987
 		$date_array = array();
7988 7988
 		$temp_array = array();
7989 7989
         
7990
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7990
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7991 7991
 		{
7992 7992
 			$temp_array['date_name'] = $row['date_name'];
7993 7993
 			$temp_array['date_count'] = $row['date_count'];
@@ -8034,7 +8034,7 @@  discard block
 block discarded – undo
8034 8034
 		$date_array = array();
8035 8035
 		$temp_array = array();
8036 8036
         
8037
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8037
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8038 8038
 		{
8039 8039
 			$temp_array['month_name'] = $row['month_name'];
8040 8040
 			$temp_array['year_name'] = $row['year_name'];
@@ -8062,13 +8062,13 @@  discard block
 block discarded – undo
8062 8062
 		} else $offset = '+00:00';
8063 8063
 
8064 8064
 		if ($globalDBdriver == 'mysql') {
8065
-			$query  = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(*) as date_count
8065
+			$query = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(*) as date_count
8066 8066
 								FROM spotter_output 
8067 8067
 								WHERE spotter_output.airline_icao <> '' 
8068 8068
 								GROUP BY spotter_output.airline_icao, year_name, month_name 
8069 8069
 								ORDER BY date_count DESC";
8070 8070
 		} else {
8071
-			$query  = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(*) as date_count
8071
+			$query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(*) as date_count
8072 8072
 								FROM spotter_output 
8073 8073
 								WHERE spotter_output.airline_icao <> '' 
8074 8074
 								GROUP BY spotter_output.airline_icao, year_name, month_name 
@@ -8082,7 +8082,7 @@  discard block
 block discarded – undo
8082 8082
 		$date_array = array();
8083 8083
 		$temp_array = array();
8084 8084
         
8085
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8085
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8086 8086
 		{
8087 8087
 			$temp_array['month_name'] = $row['month_name'];
8088 8088
 			$temp_array['year_name'] = $row['year_name'];
@@ -8111,13 +8111,13 @@  discard block
 block discarded – undo
8111 8111
 		} else $offset = '+00:00';
8112 8112
 
8113 8113
 		if ($globalDBdriver == 'mysql') {
8114
-			$query  = "SELECT YEAR(CONVERT_TZ(s.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(s.date,'+00:00', :offset)) AS month_name, count(*) as date_count
8114
+			$query = "SELECT YEAR(CONVERT_TZ(s.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(s.date,'+00:00', :offset)) AS month_name, count(*) as date_count
8115 8115
 								FROM spotter_output s
8116 8116
 								WHERE s.airline_type = 'military'
8117 8117
 								GROUP BY year_name, month_name 
8118 8118
 								ORDER BY date_count DESC";
8119 8119
 		} else {
8120
-			$query  = "SELECT EXTRACT(YEAR FROM s.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM s.date AT TIME ZONE INTERVAL :offset) AS month_name, count(*) as date_count
8120
+			$query = "SELECT EXTRACT(YEAR FROM s.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM s.date AT TIME ZONE INTERVAL :offset) AS month_name, count(*) as date_count
8121 8121
 								FROM spotter_output s
8122 8122
 								WHERE s.airline_type = 'military'
8123 8123
 								GROUP BY year_name, month_name 
@@ -8130,7 +8130,7 @@  discard block
 block discarded – undo
8130 8130
 		$date_array = array();
8131 8131
 		$temp_array = array();
8132 8132
         
8133
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8133
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8134 8134
 		{
8135 8135
 			$temp_array['month_name'] = $row['month_name'];
8136 8136
 			$temp_array['year_name'] = $row['year_name'];
@@ -8156,15 +8156,15 @@  discard block
 block discarded – undo
8156 8156
 			$datetime = new DateTime();
8157 8157
 			$offset = $datetime->format('P');
8158 8158
 		} else $offset = '+00:00';
8159
-		$filter_query = $this->getFilter($filters,true,true);
8159
+		$filter_query = $this->getFilter($filters, true, true);
8160 8160
 
8161 8161
 		if ($globalDBdriver == 'mysql') {
8162
-			$query  = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct owner_name) as date_count
8162
+			$query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct owner_name) as date_count
8163 8163
 								FROM spotter_output".$filter_query." owner_name <> ''
8164 8164
 								GROUP BY year_name, month_name
8165 8165
 								ORDER BY date_count DESC";
8166 8166
 		} else {
8167
-			$query  = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct owner_name) as date_count
8167
+			$query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct owner_name) as date_count
8168 8168
 								FROM spotter_output".$filter_query." owner_name <> ''
8169 8169
 								GROUP BY year_name, month_name
8170 8170
 								ORDER BY date_count DESC";
@@ -8176,7 +8176,7 @@  discard block
 block discarded – undo
8176 8176
 		$date_array = array();
8177 8177
 		$temp_array = array();
8178 8178
         
8179
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8179
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8180 8180
 		{
8181 8181
 			$temp_array['month_name'] = $row['month_name'];
8182 8182
 			$temp_array['year_name'] = $row['year_name'];
@@ -8204,13 +8204,13 @@  discard block
 block discarded – undo
8204 8204
 		} else $offset = '+00:00';
8205 8205
 
8206 8206
 		if ($globalDBdriver == 'mysql') {
8207
-			$query  = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct owner_name) as date_count
8207
+			$query = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct owner_name) as date_count
8208 8208
 								FROM spotter_output 
8209 8209
 								WHERE owner_name <> '' AND spotter_output.airline_icao <> '' 
8210 8210
 								GROUP BY spotter_output.airline_icao, year_name, month_name
8211 8211
 								ORDER BY date_count DESC";
8212 8212
 		} else {
8213
-			$query  = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct owner_name) as date_count
8213
+			$query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct owner_name) as date_count
8214 8214
 								FROM spotter_output 
8215 8215
 								WHERE owner_name <> '' AND spotter_output.airline_icao <> '' 
8216 8216
 								GROUP BY spotter_output.airline_icao, year_name, month_name
@@ -8223,7 +8223,7 @@  discard block
 block discarded – undo
8223 8223
 		$date_array = array();
8224 8224
 		$temp_array = array();
8225 8225
         
8226
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8226
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8227 8227
 		{
8228 8228
 			$temp_array['month_name'] = $row['month_name'];
8229 8229
 			$temp_array['year_name'] = $row['year_name'];
@@ -8250,15 +8250,15 @@  discard block
 block discarded – undo
8250 8250
 			$datetime = new DateTime();
8251 8251
 			$offset = $datetime->format('P');
8252 8252
 		} else $offset = '+00:00';
8253
-		$filter_query = $this->getFilter($filters,true,true);
8253
+		$filter_query = $this->getFilter($filters, true, true);
8254 8254
 
8255 8255
 		if ($globalDBdriver == 'mysql') {
8256
-			$query  = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct pilot_id) as date_count
8256
+			$query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct pilot_id) as date_count
8257 8257
 								FROM spotter_output".$filter_query." pilot_id <> '' AND pilot_id IS NOT NULL
8258 8258
 								GROUP BY year_name, month_name
8259 8259
 								ORDER BY date_count DESC";
8260 8260
 		} else {
8261
-			$query  = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct pilot_id) as date_count
8261
+			$query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct pilot_id) as date_count
8262 8262
 								FROM spotter_output".$filter_query." pilot_id <> '' AND pilot_id IS NOT NULL
8263 8263
 								GROUP BY year_name, month_name
8264 8264
 								ORDER BY date_count DESC";
@@ -8270,7 +8270,7 @@  discard block
 block discarded – undo
8270 8270
 		$date_array = array();
8271 8271
 		$temp_array = array();
8272 8272
         
8273
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8273
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8274 8274
 		{
8275 8275
 			$temp_array['month_name'] = $row['month_name'];
8276 8276
 			$temp_array['year_name'] = $row['year_name'];
@@ -8298,13 +8298,13 @@  discard block
 block discarded – undo
8298 8298
 		} else $offset = '+00:00';
8299 8299
 
8300 8300
 		if ($globalDBdriver == 'mysql') {
8301
-			$query  = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct pilot_id) as date_count
8301
+			$query = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct pilot_id) as date_count
8302 8302
 								FROM spotter_output 
8303 8303
 								WHERE spotter_output.airline_icao <> '' AND pilot_id <> '' AND pilot_id IS NOT NULL
8304 8304
 								GROUP BY spotter_output.airline_icao,year_name, month_name
8305 8305
 								ORDER BY date_count DESC";
8306 8306
 		} else {
8307
-			$query  = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct pilot_id) as date_count
8307
+			$query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct pilot_id) as date_count
8308 8308
 								FROM spotter_output 
8309 8309
 								WHERE spotter_output.airline_icao <> '' AND pilot_id <> '' AND pilot_id IS NOT NULL
8310 8310
 								GROUP BY spotter_output.airline_icao, year_name, month_name
@@ -8317,7 +8317,7 @@  discard block
 block discarded – undo
8317 8317
 		$date_array = array();
8318 8318
 		$temp_array = array();
8319 8319
         
8320
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8320
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8321 8321
 		{
8322 8322
 			$temp_array['month_name'] = $row['month_name'];
8323 8323
 			$temp_array['year_name'] = $row['year_name'];
@@ -8346,13 +8346,13 @@  discard block
 block discarded – undo
8346 8346
 		} else $offset = '+00:00';
8347 8347
 
8348 8348
 		if ($globalDBdriver == 'mysql') {
8349
-			$query  = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct airline_icao) as date_count
8349
+			$query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct airline_icao) as date_count
8350 8350
 								FROM spotter_output 
8351 8351
 								WHERE airline_icao <> '' 
8352 8352
 								GROUP BY year_name, month_name
8353 8353
 								ORDER BY date_count DESC";
8354 8354
 		} else {
8355
-			$query  = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct airline_icao) as date_count
8355
+			$query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct airline_icao) as date_count
8356 8356
 								FROM spotter_output 
8357 8357
 								WHERE airline_icao <> '' 
8358 8358
 								GROUP BY year_name, month_name
@@ -8365,7 +8365,7 @@  discard block
 block discarded – undo
8365 8365
 		$date_array = array();
8366 8366
 		$temp_array = array();
8367 8367
         
8368
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8368
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8369 8369
 		{
8370 8370
 			$temp_array['month_name'] = $row['month_name'];
8371 8371
 			$temp_array['year_name'] = $row['year_name'];
@@ -8391,15 +8391,15 @@  discard block
 block discarded – undo
8391 8391
 			$datetime = new DateTime();
8392 8392
 			$offset = $datetime->format('P');
8393 8393
 		} else $offset = '+00:00';
8394
-		$filter_query = $this->getFilter($filters,true,true);
8394
+		$filter_query = $this->getFilter($filters, true, true);
8395 8395
 
8396 8396
 		if ($globalDBdriver == 'mysql') {
8397
-			$query  = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct aircraft_icao) as date_count
8397
+			$query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct aircraft_icao) as date_count
8398 8398
 								FROM spotter_output".$filter_query." aircraft_icao <> '' 
8399 8399
 								GROUP BY year_name, month_name
8400 8400
 								ORDER BY date_count DESC";
8401 8401
 		} else {
8402
-			$query  = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct aircraft_icao) as date_count
8402
+			$query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct aircraft_icao) as date_count
8403 8403
 								FROM spotter_output".$filter_query." aircraft_icao <> '' 
8404 8404
 								GROUP BY year_name, month_name
8405 8405
 								ORDER BY date_count DESC";
@@ -8411,7 +8411,7 @@  discard block
 block discarded – undo
8411 8411
 		$date_array = array();
8412 8412
 		$temp_array = array();
8413 8413
         
8414
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8414
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8415 8415
 		{
8416 8416
 			$temp_array['month_name'] = $row['month_name'];
8417 8417
 			$temp_array['year_name'] = $row['year_name'];
@@ -8440,13 +8440,13 @@  discard block
 block discarded – undo
8440 8440
 		} else $offset = '+00:00';
8441 8441
 
8442 8442
 		if ($globalDBdriver == 'mysql') {
8443
-			$query  = "SELECT spotter_output.airline_icao,YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct aircraft_icao) as date_count
8443
+			$query = "SELECT spotter_output.airline_icao,YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct aircraft_icao) as date_count
8444 8444
 								FROM spotter_output 
8445 8445
 								WHERE aircraft_icao <> ''  AND spotter_output.airline_icao <> '' 
8446 8446
 								GROUP BY spotter_output.airline_icao, year_name, month_name
8447 8447
 								ORDER BY date_count DESC";
8448 8448
 		} else {
8449
-			$query  = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct aircraft_icao) as date_count
8449
+			$query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct aircraft_icao) as date_count
8450 8450
 								FROM spotter_output 
8451 8451
 								WHERE aircraft_icao <> '' AND spotter_output.airline_icao <> '' 
8452 8452
 								GROUP BY spotter_output.airline_icao, year_name, month_name
@@ -8459,7 +8459,7 @@  discard block
 block discarded – undo
8459 8459
 		$date_array = array();
8460 8460
 		$temp_array = array();
8461 8461
         
8462
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8462
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8463 8463
 		{
8464 8464
 			$temp_array['month_name'] = $row['month_name'];
8465 8465
 			$temp_array['year_name'] = $row['year_name'];
@@ -8486,15 +8486,15 @@  discard block
 block discarded – undo
8486 8486
 			$datetime = new DateTime();
8487 8487
 			$offset = $datetime->format('P');
8488 8488
 		} else $offset = '+00:00';
8489
-		$filter_query = $this->getFilter($filters,true,true);
8489
+		$filter_query = $this->getFilter($filters, true, true);
8490 8490
 
8491 8491
 		if ($globalDBdriver == 'mysql') {
8492
-			$query  = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(real_arrival_airport_icao) as date_count
8492
+			$query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(real_arrival_airport_icao) as date_count
8493 8493
 								FROM spotter_output".$filter_query." real_arrival_airport_icao <> '' 
8494 8494
 								GROUP BY year_name, month_name
8495 8495
 								ORDER BY date_count DESC";
8496 8496
 		} else {
8497
-			$query  = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(real_arrival_airport_icao) as date_count
8497
+			$query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(real_arrival_airport_icao) as date_count
8498 8498
 								FROM spotter_output".$filter_query." real_arrival_airport_icao <> '' 
8499 8499
 								GROUP BY year_name, month_name
8500 8500
 								ORDER BY date_count DESC";
@@ -8506,7 +8506,7 @@  discard block
 block discarded – undo
8506 8506
 		$date_array = array();
8507 8507
 		$temp_array = array();
8508 8508
         
8509
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8509
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8510 8510
 		{
8511 8511
 			$temp_array['month_name'] = $row['month_name'];
8512 8512
 			$temp_array['year_name'] = $row['year_name'];
@@ -8535,13 +8535,13 @@  discard block
 block discarded – undo
8535 8535
 		} else $offset = '+00:00';
8536 8536
 
8537 8537
 		if ($globalDBdriver == 'mysql') {
8538
-			$query  = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(real_arrival_airport_icao) as date_count
8538
+			$query = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(real_arrival_airport_icao) as date_count
8539 8539
 								FROM spotter_output 
8540 8540
 								WHERE real_arrival_airport_icao <> '' AND spotter_output.airline_icao <> '' 
8541 8541
 								GROUP BY spotter_output.airline_icao, year_name, month_name
8542 8542
 								ORDER BY date_count DESC";
8543 8543
 		} else {
8544
-			$query  = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(real_arrival_airport_icao) as date_count
8544
+			$query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(real_arrival_airport_icao) as date_count
8545 8545
 								FROM spotter_output 
8546 8546
 								WHERE real_arrival_airport_icao <> '' AND spotter_output.airline_icao <> '' 
8547 8547
 								GROUP BY spotter_output.airline_icao, year_name, month_name
@@ -8554,7 +8554,7 @@  discard block
 block discarded – undo
8554 8554
 		$date_array = array();
8555 8555
 		$temp_array = array();
8556 8556
         
8557
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8557
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8558 8558
 		{
8559 8559
 			$temp_array['month_name'] = $row['month_name'];
8560 8560
 			$temp_array['year_name'] = $row['year_name'];
@@ -8582,7 +8582,7 @@  discard block
 block discarded – undo
8582 8582
 			$datetime = new DateTime();
8583 8583
 			$offset = $datetime->format('P');
8584 8584
 		} else $offset = '+00:00';
8585
-		$filter_query = $this->getFilter($filters,true,true);
8585
+		$filter_query = $this->getFilter($filters, true, true);
8586 8586
 		if ($globalDBdriver == 'mysql') {
8587 8587
 			$query  = "SELECT MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name, count(*) as date_count
8588 8588
 								FROM spotter_output".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 YEAR)";
@@ -8603,7 +8603,7 @@  discard block
 block discarded – undo
8603 8603
 		$date_array = array();
8604 8604
 		$temp_array = array();
8605 8605
         
8606
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8606
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8607 8607
 		{
8608 8608
 			$temp_array['year_name'] = $row['year_name'];
8609 8609
 			$temp_array['month_name'] = $row['month_name'];
@@ -8623,7 +8623,7 @@  discard block
 block discarded – undo
8623 8623
 	* @return Array the hour list
8624 8624
 	*
8625 8625
 	*/
8626
-	public function countAllHours($orderby,$filters = array())
8626
+	public function countAllHours($orderby, $filters = array())
8627 8627
 	{
8628 8628
 		global $globalTimezone, $globalDBdriver;
8629 8629
 		if ($globalTimezone != '') {
@@ -8671,7 +8671,7 @@  discard block
 block discarded – undo
8671 8671
 		$hour_array = array();
8672 8672
 		$temp_array = array();
8673 8673
         
8674
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8674
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8675 8675
 		{
8676 8676
 			$temp_array['hour_name'] = $row['hour_name'];
8677 8677
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -8708,7 +8708,7 @@  discard block
 block discarded – undo
8708 8708
 		}
8709 8709
 		
8710 8710
 		if ($globalDBdriver == 'mysql') {
8711
-			$query  = "SELECT spotter_output.airline_icao, HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8711
+			$query = "SELECT spotter_output.airline_icao, HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8712 8712
 								FROM spotter_output 
8713 8713
 								WHERE spotter_output.airline_icao <> '' 
8714 8714
 								GROUP BY spotter_output.airline_icao, hour_name 
@@ -8722,7 +8722,7 @@  discard block
 block discarded – undo
8722 8722
   */    
8723 8723
 		$query_data = array(':offset' => $offset);
8724 8724
 		} else {
8725
-			$query  = "SELECT spotter_output.airline_icao, EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8725
+			$query = "SELECT spotter_output.airline_icao, EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8726 8726
 								FROM spotter_output 
8727 8727
 								WHERE spotter_output.airline_icao <> '' 
8728 8728
 								GROUP BY spotter_output.airline_icao, hour_name 
@@ -8736,7 +8736,7 @@  discard block
 block discarded – undo
8736 8736
 		$hour_array = array();
8737 8737
 		$temp_array = array();
8738 8738
         
8739
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8739
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8740 8740
 		{
8741 8741
 			$temp_array['hour_name'] = $row['hour_name'];
8742 8742
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -8765,16 +8765,16 @@  discard block
 block discarded – undo
8765 8765
 			$offset = $datetime->format('P');
8766 8766
 		} else $offset = '+00:00';
8767 8767
 
8768
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
8768
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
8769 8769
 
8770 8770
 		if ($globalDBdriver == 'mysql') {
8771
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8771
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8772 8772
 								FROM spotter_output 
8773 8773
 								WHERE spotter_output.airline_icao = :airline_icao
8774 8774
 								GROUP BY hour_name 
8775 8775
 								ORDER BY hour_name ASC";
8776 8776
 		} else {
8777
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8777
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8778 8778
 								FROM spotter_output 
8779 8779
 								WHERE spotter_output.airline_icao = :airline_icao
8780 8780
 								GROUP BY hour_name 
@@ -8782,12 +8782,12 @@  discard block
 block discarded – undo
8782 8782
 		}
8783 8783
 		
8784 8784
 		$sth = $this->db->prepare($query);
8785
-		$sth->execute(array(':airline_icao' => $airline_icao,':offset' => $offset));
8785
+		$sth->execute(array(':airline_icao' => $airline_icao, ':offset' => $offset));
8786 8786
       
8787 8787
 		$hour_array = array();
8788 8788
 		$temp_array = array();
8789 8789
         
8790
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8790
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8791 8791
 		{
8792 8792
 			$temp_array['hour_name'] = $row['hour_name'];
8793 8793
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -8810,7 +8810,7 @@  discard block
 block discarded – undo
8810 8810
 	public function countAllHoursByAircraft($aircraft_icao)
8811 8811
 	{
8812 8812
 		global $globalTimezone, $globalDBdriver;
8813
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
8813
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
8814 8814
 		if ($globalTimezone != '') {
8815 8815
 			date_default_timezone_set($globalTimezone);
8816 8816
 			$datetime = new DateTime();
@@ -8818,13 +8818,13 @@  discard block
 block discarded – undo
8818 8818
 		} else $offset = '+00:00';
8819 8819
 
8820 8820
 		if ($globalDBdriver == 'mysql') {
8821
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8821
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8822 8822
 								FROM spotter_output 
8823 8823
 								WHERE spotter_output.aircraft_icao = :aircraft_icao
8824 8824
 								GROUP BY hour_name 
8825 8825
 								ORDER BY hour_name ASC";
8826 8826
 		} else {
8827
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8827
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8828 8828
 								FROM spotter_output 
8829 8829
 								WHERE spotter_output.aircraft_icao = :aircraft_icao
8830 8830
 								GROUP BY hour_name 
@@ -8832,12 +8832,12 @@  discard block
 block discarded – undo
8832 8832
 		}
8833 8833
 		
8834 8834
 		$sth = $this->db->prepare($query);
8835
-		$sth->execute(array(':aircraft_icao' => $aircraft_icao,':offset' => $offset));
8835
+		$sth->execute(array(':aircraft_icao' => $aircraft_icao, ':offset' => $offset));
8836 8836
       
8837 8837
 		$hour_array = array();
8838 8838
 		$temp_array = array();
8839 8839
         
8840
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8840
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8841 8841
 		{
8842 8842
 			$temp_array['hour_name'] = $row['hour_name'];
8843 8843
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -8858,7 +8858,7 @@  discard block
 block discarded – undo
8858 8858
 	public function countAllHoursByRegistration($registration)
8859 8859
 	{
8860 8860
 		global $globalTimezone, $globalDBdriver;
8861
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
8861
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
8862 8862
 		if ($globalTimezone != '') {
8863 8863
 			date_default_timezone_set($globalTimezone);
8864 8864
 			$datetime = new DateTime();
@@ -8866,13 +8866,13 @@  discard block
 block discarded – undo
8866 8866
 		} else $offset = '+00:00';
8867 8867
 
8868 8868
 		if ($globalDBdriver == 'mysql') {
8869
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8869
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8870 8870
 								FROM spotter_output 
8871 8871
 								WHERE spotter_output.registration = :registration
8872 8872
 								GROUP BY hour_name 
8873 8873
 								ORDER BY hour_name ASC";
8874 8874
 		} else {
8875
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8875
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8876 8876
 								FROM spotter_output 
8877 8877
 								WHERE spotter_output.registration = :registration
8878 8878
 								GROUP BY hour_name 
@@ -8880,12 +8880,12 @@  discard block
 block discarded – undo
8880 8880
 		}
8881 8881
 		
8882 8882
 		$sth = $this->db->prepare($query);
8883
-		$sth->execute(array(':registration' => $registration,':offset' => $offset));
8883
+		$sth->execute(array(':registration' => $registration, ':offset' => $offset));
8884 8884
       
8885 8885
 		$hour_array = array();
8886 8886
 		$temp_array = array();
8887 8887
         
8888
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8888
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8889 8889
 		{
8890 8890
 			$temp_array['hour_name'] = $row['hour_name'];
8891 8891
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -8906,7 +8906,7 @@  discard block
 block discarded – undo
8906 8906
 	public function countAllHoursByAirport($airport_icao)
8907 8907
 	{
8908 8908
 		global $globalTimezone, $globalDBdriver;
8909
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
8909
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
8910 8910
 		if ($globalTimezone != '') {
8911 8911
 			date_default_timezone_set($globalTimezone);
8912 8912
 			$datetime = new DateTime();
@@ -8914,13 +8914,13 @@  discard block
 block discarded – undo
8914 8914
 		} else $offset = '+00:00';
8915 8915
 
8916 8916
 		if ($globalDBdriver == 'mysql') {
8917
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8917
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8918 8918
 								FROM spotter_output 
8919 8919
 								WHERE (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao)
8920 8920
 								GROUP BY hour_name 
8921 8921
 								ORDER BY hour_name ASC";
8922 8922
 		} else {
8923
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8923
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8924 8924
 								FROM spotter_output 
8925 8925
 								WHERE (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao)
8926 8926
 								GROUP BY hour_name 
@@ -8928,12 +8928,12 @@  discard block
 block discarded – undo
8928 8928
 		}
8929 8929
 		
8930 8930
 		$sth = $this->db->prepare($query);
8931
-		$sth->execute(array(':airport_icao' => $airport_icao,':offset' => $offset));
8931
+		$sth->execute(array(':airport_icao' => $airport_icao, ':offset' => $offset));
8932 8932
       
8933 8933
 		$hour_array = array();
8934 8934
 		$temp_array = array();
8935 8935
         
8936
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8936
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8937 8937
 		{
8938 8938
 			$temp_array['hour_name'] = $row['hour_name'];
8939 8939
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -8955,7 +8955,7 @@  discard block
 block discarded – undo
8955 8955
 	public function countAllHoursByManufacturer($aircraft_manufacturer)
8956 8956
 	{
8957 8957
 		global $globalTimezone, $globalDBdriver;
8958
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
8958
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
8959 8959
 		if ($globalTimezone != '') {
8960 8960
 			date_default_timezone_set($globalTimezone);
8961 8961
 			$datetime = new DateTime();
@@ -8963,13 +8963,13 @@  discard block
 block discarded – undo
8963 8963
 		} else $offset = '+00:00';
8964 8964
 
8965 8965
 		if ($globalDBdriver == 'mysql') {
8966
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8966
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8967 8967
 								FROM spotter_output 
8968 8968
 								WHERE spotter_output.aircraft_manufacturer = :aircraft_manufacturer
8969 8969
 								GROUP BY hour_name 
8970 8970
 								ORDER BY hour_name ASC";
8971 8971
 		} else {
8972
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8972
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8973 8973
 								FROM spotter_output 
8974 8974
 								WHERE spotter_output.aircraft_manufacturer = :aircraft_manufacturer
8975 8975
 								GROUP BY hour_name 
@@ -8977,12 +8977,12 @@  discard block
 block discarded – undo
8977 8977
 		}
8978 8978
 		
8979 8979
 		$sth = $this->db->prepare($query);
8980
-		$sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer,':offset' => $offset));
8980
+		$sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer, ':offset' => $offset));
8981 8981
       
8982 8982
 		$hour_array = array();
8983 8983
 		$temp_array = array();
8984 8984
         
8985
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8985
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8986 8986
 		{
8987 8987
 			$temp_array['hour_name'] = $row['hour_name'];
8988 8988
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -9004,7 +9004,7 @@  discard block
 block discarded – undo
9004 9004
 	public function countAllHoursByDate($date)
9005 9005
 	{
9006 9006
 		global $globalTimezone, $globalDBdriver;
9007
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
9007
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
9008 9008
 		if ($globalTimezone != '') {
9009 9009
 			date_default_timezone_set($globalTimezone);
9010 9010
 			$datetime = new DateTime($date);
@@ -9012,13 +9012,13 @@  discard block
 block discarded – undo
9012 9012
 		} else $offset = '+00:00';
9013 9013
 
9014 9014
 		if ($globalDBdriver == 'mysql') {
9015
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9015
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9016 9016
 								FROM spotter_output 
9017 9017
 								WHERE DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date
9018 9018
 								GROUP BY hour_name 
9019 9019
 								ORDER BY hour_name ASC";
9020 9020
 		} else {
9021
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9021
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9022 9022
 								FROM spotter_output 
9023 9023
 								WHERE to_char(spotter_output.date AT TIME ZONE INTERVAL :offset, 'YYYY-mm-dd') = :date
9024 9024
 								GROUP BY hour_name 
@@ -9031,7 +9031,7 @@  discard block
 block discarded – undo
9031 9031
 		$hour_array = array();
9032 9032
 		$temp_array = array();
9033 9033
         
9034
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9034
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9035 9035
 		{
9036 9036
 			$temp_array['hour_name'] = $row['hour_name'];
9037 9037
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -9053,7 +9053,7 @@  discard block
 block discarded – undo
9053 9053
 	public function countAllHoursByIdent($ident)
9054 9054
 	{
9055 9055
 		global $globalTimezone, $globalDBdriver;
9056
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
9056
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
9057 9057
 		if ($globalTimezone != '') {
9058 9058
 			date_default_timezone_set($globalTimezone);
9059 9059
 			$datetime = new DateTime();
@@ -9061,13 +9061,13 @@  discard block
 block discarded – undo
9061 9061
 		} else $offset = '+00:00';
9062 9062
 
9063 9063
 		if ($globalDBdriver == 'mysql') {
9064
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9064
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9065 9065
 								FROM spotter_output 
9066 9066
 								WHERE spotter_output.ident = :ident 
9067 9067
 								GROUP BY hour_name 
9068 9068
 								ORDER BY hour_name ASC";
9069 9069
 		} else {
9070
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9070
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9071 9071
 								FROM spotter_output 
9072 9072
 								WHERE spotter_output.ident = :ident 
9073 9073
 								GROUP BY hour_name 
@@ -9076,12 +9076,12 @@  discard block
 block discarded – undo
9076 9076
       
9077 9077
 		
9078 9078
 		$sth = $this->db->prepare($query);
9079
-		$sth->execute(array(':ident' => $ident,':offset' => $offset));
9079
+		$sth->execute(array(':ident' => $ident, ':offset' => $offset));
9080 9080
       
9081 9081
 		$hour_array = array();
9082 9082
 		$temp_array = array();
9083 9083
         
9084
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9084
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9085 9085
 		{
9086 9086
 			$temp_array['hour_name'] = $row['hour_name'];
9087 9087
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -9103,8 +9103,8 @@  discard block
 block discarded – undo
9103 9103
 	public function countAllHoursByRoute($departure_airport_icao, $arrival_airport_icao)
9104 9104
 	{
9105 9105
 		global $globalTimezone, $globalDBdriver;
9106
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
9107
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
9106
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
9107
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
9108 9108
 		if ($globalTimezone != '') {
9109 9109
 			date_default_timezone_set($globalTimezone);
9110 9110
 			$datetime = new DateTime();
@@ -9112,13 +9112,13 @@  discard block
 block discarded – undo
9112 9112
 		} else $offset = '+00:00';
9113 9113
 
9114 9114
 		if ($globalDBdriver == 'mysql') {
9115
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9115
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9116 9116
 								FROM spotter_output 
9117 9117
 								WHERE (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao)
9118 9118
 								GROUP BY hour_name 
9119 9119
 								ORDER BY hour_name ASC";
9120 9120
 		} else {
9121
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9121
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9122 9122
 								FROM spotter_output 
9123 9123
 								WHERE (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao)
9124 9124
 								GROUP BY hour_name 
@@ -9126,12 +9126,12 @@  discard block
 block discarded – undo
9126 9126
 		}
9127 9127
 		
9128 9128
 		$sth = $this->db->prepare($query);
9129
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao,':offset' => $offset));
9129
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao, ':offset' => $offset));
9130 9130
       
9131 9131
 		$hour_array = array();
9132 9132
 		$temp_array = array();
9133 9133
         
9134
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9134
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9135 9135
 		{
9136 9136
 			$temp_array['hour_name'] = $row['hour_name'];
9137 9137
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -9152,7 +9152,7 @@  discard block
 block discarded – undo
9152 9152
 	public function countAllHoursByCountry($country)
9153 9153
 	{
9154 9154
 		global $globalTimezone, $globalDBdriver;
9155
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
9155
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
9156 9156
 		if ($globalTimezone != '') {
9157 9157
 			date_default_timezone_set($globalTimezone);
9158 9158
 			$datetime = new DateTime();
@@ -9160,13 +9160,13 @@  discard block
 block discarded – undo
9160 9160
 		} else $offset = '+00:00';
9161 9161
 
9162 9162
 		if ($globalDBdriver == 'mysql') {
9163
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9163
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9164 9164
 								FROM spotter_output 
9165 9165
 								WHERE ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country
9166 9166
 								GROUP BY hour_name 
9167 9167
 								ORDER BY hour_name ASC";
9168 9168
 		} else {
9169
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9169
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9170 9170
 								FROM spotter_output 
9171 9171
 								WHERE ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country
9172 9172
 								GROUP BY hour_name 
@@ -9174,12 +9174,12 @@  discard block
 block discarded – undo
9174 9174
 		}
9175 9175
 		
9176 9176
 		$sth = $this->db->prepare($query);
9177
-		$sth->execute(array(':country' => $country,':offset' => $offset));
9177
+		$sth->execute(array(':country' => $country, ':offset' => $offset));
9178 9178
       
9179 9179
 		$hour_array = array();
9180 9180
 		$temp_array = array();
9181 9181
         
9182
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9182
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9183 9183
 		{
9184 9184
 			$temp_array['hour_name'] = $row['hour_name'];
9185 9185
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -9201,8 +9201,8 @@  discard block
 block discarded – undo
9201 9201
 	*/
9202 9202
 	public function countOverallAircrafts($filters = array())
9203 9203
 	{
9204
-		$filter_query = $this->getFilter($filters,true,true);
9205
-		$query  = "SELECT COUNT(DISTINCT spotter_output.aircraft_icao) AS aircraft_count  
9204
+		$filter_query = $this->getFilter($filters, true, true);
9205
+		$query = "SELECT COUNT(DISTINCT spotter_output.aircraft_icao) AS aircraft_count  
9206 9206
                     FROM spotter_output".$filter_query." spotter_output.ident <> ''";
9207 9207
 		$sth = $this->db->prepare($query);
9208 9208
 		$sth->execute();
@@ -9217,8 +9217,8 @@  discard block
 block discarded – undo
9217 9217
 	*/
9218 9218
 	public function countOverallArrival($filters = array())
9219 9219
 	{
9220
-		$filter_query = $this->getFilter($filters,true,true);
9221
-		$query  = "SELECT COUNT(spotter_output.real_arrival_airport_icao) AS arrival_count  
9220
+		$filter_query = $this->getFilter($filters, true, true);
9221
+		$query = "SELECT COUNT(spotter_output.real_arrival_airport_icao) AS arrival_count  
9222 9222
                     FROM spotter_output".$filter_query." spotter_output.arrival_airport_icao <> ''";
9223 9223
 		
9224 9224
 		$sth = $this->db->prepare($query);
@@ -9234,8 +9234,8 @@  discard block
 block discarded – undo
9234 9234
 	*/
9235 9235
 	public function countOverallPilots($filters = array())
9236 9236
 	{
9237
-		$filter_query = $this->getFilter($filters,true,true);
9238
-		$query  = "SELECT COUNT(DISTINCT spotter_output.pilot_id) AS pilot_count  
9237
+		$filter_query = $this->getFilter($filters, true, true);
9238
+		$query = "SELECT COUNT(DISTINCT spotter_output.pilot_id) AS pilot_count  
9239 9239
                     FROM spotter_output".$filter_query." spotter_output.pilot_id <> ''";
9240 9240
 		$sth = $this->db->prepare($query);
9241 9241
 		$sth->execute();
@@ -9250,8 +9250,8 @@  discard block
 block discarded – undo
9250 9250
 	*/
9251 9251
 	public function countOverallOwners($filters = array())
9252 9252
 	{
9253
-		$filter_query = $this->getFilter($filters,true,true);
9254
-		$query  = "SELECT COUNT(DISTINCT spotter_output.owner_name) AS owner_count  
9253
+		$filter_query = $this->getFilter($filters, true, true);
9254
+		$query = "SELECT COUNT(DISTINCT spotter_output.owner_name) AS owner_count  
9255 9255
                     FROM spotter_output".$filter_query." spotter_output.owner_name <> ''";
9256 9256
 		$sth = $this->db->prepare($query);
9257 9257
 		$sth->execute();
@@ -9284,8 +9284,8 @@  discard block
 block discarded – undo
9284 9284
 	*/
9285 9285
 	public function countOverallMilitaryFlights($filters = array())
9286 9286
 	{
9287
-		$filter_query = $this->getFilter($filters,true,true);
9288
-		$query  = "SELECT COUNT(s.spotter_id) AS flight_count  
9287
+		$filter_query = $this->getFilter($filters, true, true);
9288
+		$query = "SELECT COUNT(s.spotter_id) AS flight_count  
9289 9289
                     FROM spotter_output s, airlines a".$filter_query." s.airline_icao = a.icao AND a.type = 'military'";
9290 9290
       
9291 9291
 		$sth = $this->db->prepare($query);
@@ -9329,13 +9329,13 @@  discard block
 block discarded – undo
9329 9329
 		} else $offset = '+00:00';
9330 9330
 
9331 9331
 		if ($globalDBdriver == 'mysql') {
9332
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9332
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9333 9333
 								FROM spotter_output 
9334 9334
 								WHERE DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = CURDATE()
9335 9335
 								GROUP BY hour_name 
9336 9336
 								ORDER BY hour_name ASC";
9337 9337
 		} else {
9338
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9338
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9339 9339
 								FROM spotter_output 
9340 9340
 								WHERE to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = CAST(NOW() AS date)
9341 9341
 								GROUP BY hour_name 
@@ -9348,7 +9348,7 @@  discard block
 block discarded – undo
9348 9348
 		$hour_array = array();
9349 9349
 		$temp_array = array();
9350 9350
         
9351
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9351
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9352 9352
 		{
9353 9353
 			$temp_array['hour_name'] = $row['hour_name'];
9354 9354
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -9372,8 +9372,8 @@  discard block
 block discarded – undo
9372 9372
 		if ($limit != "")
9373 9373
 		{
9374 9374
 			$limit_array = explode(",", $limit);
9375
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
9376
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
9375
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
9376
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
9377 9377
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
9378 9378
 			{
9379 9379
 				//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
@@ -9428,7 +9428,7 @@  discard block
 block discarded – undo
9428 9428
 			    GROUP BY spotter_output.ident,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time, to_char(spotter_output.date,'HH')
9429 9429
 			    HAVING count(spotter_output.ident) > 5$orderby_query";
9430 9430
 			//echo $query;
9431
-			$spotter_array = $this->getDataFromDB($query.$limit_query,array(':timezone' => $globalTimezone));
9431
+			$spotter_array = $this->getDataFromDB($query.$limit_query, array(':timezone' => $globalTimezone));
9432 9432
 			/*
9433 9433
 			$sth = $this->db->prepare($query);
9434 9434
 			$sth->execute(array(':timezone' => $globalTimezone));
@@ -9447,9 +9447,9 @@  discard block
 block discarded – undo
9447 9447
 	*/
9448 9448
 	public function getSpotterIDBasedOnFlightAwareID($flightaware_id)
9449 9449
 	{
9450
-		$flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING);
9450
+		$flightaware_id = filter_var($flightaware_id, FILTER_SANITIZE_STRING);
9451 9451
 
9452
-		$query  = "SELECT spotter_output.spotter_id
9452
+		$query = "SELECT spotter_output.spotter_id
9453 9453
 								FROM spotter_output 
9454 9454
 								WHERE spotter_output.flightaware_id = '".$flightaware_id."'";
9455 9455
         
@@ -9457,7 +9457,7 @@  discard block
 block discarded – undo
9457 9457
 		$sth = $this->db->prepare($query);
9458 9458
 		$sth->execute();
9459 9459
 
9460
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9460
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9461 9461
 		{
9462 9462
 			return $row['spotter_id'];
9463 9463
 		}
@@ -9482,23 +9482,23 @@  discard block
 block discarded – undo
9482 9482
 		}
9483 9483
 		
9484 9484
 		$current_date = date("Y-m-d H:i:s");
9485
-		$date = date("Y-m-d H:i:s",strtotime($dateString." UTC"));
9485
+		$date = date("Y-m-d H:i:s", strtotime($dateString." UTC"));
9486 9486
 		
9487 9487
 		$diff = abs(strtotime($current_date) - strtotime($date));
9488 9488
 
9489
-		$time_array['years'] = floor($diff / (365*60*60*24)); 
9489
+		$time_array['years'] = floor($diff/(365*60*60*24)); 
9490 9490
 		$years = $time_array['years'];
9491 9491
 		
9492
-		$time_array['months'] = floor(($diff - $years * 365*60*60*24) / (30*60*60*24));
9492
+		$time_array['months'] = floor(($diff - $years*365*60*60*24)/(30*60*60*24));
9493 9493
 		$months = $time_array['months'];
9494 9494
 		
9495
-		$time_array['days'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24)/ (60*60*24));
9495
+		$time_array['days'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24)/(60*60*24));
9496 9496
 		$days = $time_array['days'];
9497
-		$time_array['hours'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24)/ (60*60));
9497
+		$time_array['hours'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24)/(60*60));
9498 9498
 		$hours = $time_array['hours'];
9499
-		$time_array['minutes'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60)/ 60);
9499
+		$time_array['minutes'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60)/60);
9500 9500
 		$minutes = $time_array['minutes'];
9501
-		$time_array['seconds'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60 - $minutes*60));  
9501
+		$time_array['seconds'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60 - $minutes*60));  
9502 9502
 		
9503 9503
 		return $time_array;	
9504 9504
 	}	
@@ -9524,63 +9524,63 @@  discard block
 block discarded – undo
9524 9524
 			$temp_array['direction_degree'] = $direction;
9525 9525
 			$temp_array['direction_shortname'] = "N";
9526 9526
 			$temp_array['direction_fullname'] = "North";
9527
-		} elseif ($direction >= 22.5 && $direction < 45){
9527
+		} elseif ($direction >= 22.5 && $direction < 45) {
9528 9528
 			$temp_array['direction_degree'] = $direction;
9529 9529
 			$temp_array['direction_shortname'] = "NNE";
9530 9530
 			$temp_array['direction_fullname'] = "North-Northeast";
9531
-		} elseif ($direction >= 45 && $direction < 67.5){
9531
+		} elseif ($direction >= 45 && $direction < 67.5) {
9532 9532
 			$temp_array['direction_degree'] = $direction;
9533 9533
 			$temp_array['direction_shortname'] = "NE";
9534 9534
 			$temp_array['direction_fullname'] = "Northeast";
9535
-		} elseif ($direction >= 67.5 && $direction < 90){
9535
+		} elseif ($direction >= 67.5 && $direction < 90) {
9536 9536
 			$temp_array['direction_degree'] = $direction;
9537 9537
 			$temp_array['direction_shortname'] = "ENE";
9538 9538
 			$temp_array['direction_fullname'] = "East-Northeast";
9539
-		} elseif ($direction >= 90 && $direction < 112.5){
9539
+		} elseif ($direction >= 90 && $direction < 112.5) {
9540 9540
 			$temp_array['direction_degree'] = $direction;
9541 9541
 			$temp_array['direction_shortname'] = "E";
9542 9542
 			$temp_array['direction_fullname'] = "East";
9543
-		} elseif ($direction >= 112.5 && $direction < 135){
9543
+		} elseif ($direction >= 112.5 && $direction < 135) {
9544 9544
 			$temp_array['direction_degree'] = $direction;
9545 9545
 			$temp_array['direction_shortname'] = "ESE";
9546 9546
 			$temp_array['direction_fullname'] = "East-Southeast";
9547
-		} elseif ($direction >= 135 && $direction < 157.5){
9547
+		} elseif ($direction >= 135 && $direction < 157.5) {
9548 9548
 			$temp_array['direction_degree'] = $direction;
9549 9549
 			$temp_array['direction_shortname'] = "SE";
9550 9550
 			$temp_array['direction_fullname'] = "Southeast";
9551
-		} elseif ($direction >= 157.5 && $direction < 180){
9551
+		} elseif ($direction >= 157.5 && $direction < 180) {
9552 9552
 			$temp_array['direction_degree'] = $direction;
9553 9553
 			$temp_array['direction_shortname'] = "SSE";
9554 9554
 			$temp_array['direction_fullname'] = "South-Southeast";
9555
-		} elseif ($direction >= 180 && $direction < 202.5){
9555
+		} elseif ($direction >= 180 && $direction < 202.5) {
9556 9556
 			$temp_array['direction_degree'] = $direction;
9557 9557
 			$temp_array['direction_shortname'] = "S";
9558 9558
 			$temp_array['direction_fullname'] = "South";
9559
-		} elseif ($direction >= 202.5 && $direction < 225){
9559
+		} elseif ($direction >= 202.5 && $direction < 225) {
9560 9560
 			$temp_array['direction_degree'] = $direction;
9561 9561
 			$temp_array['direction_shortname'] = "SSW";
9562 9562
 			$temp_array['direction_fullname'] = "South-Southwest";
9563
-		} elseif ($direction >= 225 && $direction < 247.5){
9563
+		} elseif ($direction >= 225 && $direction < 247.5) {
9564 9564
 			$temp_array['direction_degree'] = $direction;
9565 9565
 			$temp_array['direction_shortname'] = "SW";
9566 9566
 			$temp_array['direction_fullname'] = "Southwest";
9567
-		} elseif ($direction >= 247.5 && $direction < 270){
9567
+		} elseif ($direction >= 247.5 && $direction < 270) {
9568 9568
 			$temp_array['direction_degree'] = $direction;
9569 9569
 			$temp_array['direction_shortname'] = "WSW";
9570 9570
 			$temp_array['direction_fullname'] = "West-Southwest";
9571
-		} elseif ($direction >= 270 && $direction < 292.5){
9571
+		} elseif ($direction >= 270 && $direction < 292.5) {
9572 9572
 			$temp_array['direction_degree'] = $direction;
9573 9573
 			$temp_array['direction_shortname'] = "W";
9574 9574
 			$temp_array['direction_fullname'] = "West";
9575
-		} elseif ($direction >= 292.5 && $direction < 315){
9575
+		} elseif ($direction >= 292.5 && $direction < 315) {
9576 9576
 			$temp_array['direction_degree'] = $direction;
9577 9577
 			$temp_array['direction_shortname'] = "WNW";
9578 9578
 			$temp_array['direction_fullname'] = "West-Northwest";
9579
-		} elseif ($direction >= 315 && $direction < 337.5){
9579
+		} elseif ($direction >= 315 && $direction < 337.5) {
9580 9580
 			$temp_array['direction_degree'] = $direction;
9581 9581
 			$temp_array['direction_shortname'] = "NW";
9582 9582
 			$temp_array['direction_fullname'] = "Northwest";
9583
-		} elseif ($direction >= 337.5 && $direction < 360){
9583
+		} elseif ($direction >= 337.5 && $direction < 360) {
9584 9584
 			$temp_array['direction_degree'] = $direction;
9585 9585
 			$temp_array['direction_shortname'] = "NNW";
9586 9586
 			$temp_array['direction_fullname'] = "North-Northwest";
@@ -9633,9 +9633,9 @@  discard block
 block discarded – undo
9633 9633
 	*/
9634 9634
 	public function getAircraftRegistrationBymodeS($aircraft_modes)
9635 9635
 	{
9636
-		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
9636
+		$aircraft_modes = filter_var($aircraft_modes, FILTER_SANITIZE_STRING);
9637 9637
 	
9638
-		$query  = "SELECT aircraft_modes.Registration FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes LIMIT 1";
9638
+		$query = "SELECT aircraft_modes.Registration FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes LIMIT 1";
9639 9639
 		
9640 9640
 		$sth = $this->db->prepare($query);
9641 9641
 		$sth->execute(array(':aircraft_modes' => $aircraft_modes));
@@ -9657,9 +9657,9 @@  discard block
 block discarded – undo
9657 9657
 	*/
9658 9658
 	public function getAircraftTypeBymodeS($aircraft_modes)
9659 9659
 	{
9660
-		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
9660
+		$aircraft_modes = filter_var($aircraft_modes, FILTER_SANITIZE_STRING);
9661 9661
 	
9662
-		$query  = "SELECT aircraft_modes.type_flight FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes LIMIT 1";
9662
+		$query = "SELECT aircraft_modes.type_flight FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes LIMIT 1";
9663 9663
 		
9664 9664
 		$sth = $this->db->prepare($query);
9665 9665
 		$sth->execute(array(':aircraft_modes' => $aircraft_modes));
@@ -9679,11 +9679,11 @@  discard block
 block discarded – undo
9679 9679
 	* @param Float $longitude longitute of the flight
9680 9680
 	* @return String the countrie
9681 9681
 	*/
9682
-	public function getCountryFromLatitudeLongitude($latitude,$longitude)
9682
+	public function getCountryFromLatitudeLongitude($latitude, $longitude)
9683 9683
 	{
9684 9684
 		global $globalDBdriver, $globalDebug;
9685
-		$latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
9686
-		$longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
9685
+		$latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
9686
+		$longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
9687 9687
 	
9688 9688
 		$Connection = new Connection($this->db);
9689 9689
 		if (!$Connection->tableExists('countries')) return '';
@@ -9722,19 +9722,19 @@  discard block
 block discarded – undo
9722 9722
 	*/
9723 9723
 	public function convertAircraftRegistration($registration)
9724 9724
 	{
9725
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
9725
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
9726 9726
 		$registration_prefix = '';
9727 9727
 		$registration_1 = substr($registration, 0, 1);
9728 9728
 		$registration_2 = substr($registration, 0, 2);
9729 9729
 
9730 9730
 		//first get the prefix based on two characters
9731
-		$query  = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_2";
9731
+		$query = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_2";
9732 9732
       
9733 9733
 		
9734 9734
 		$sth = $this->db->prepare($query);
9735 9735
 		$sth->execute(array(':registration_2' => $registration_2));
9736 9736
         
9737
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9737
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9738 9738
 		{
9739 9739
 			$registration_prefix = $row['registration_prefix'];
9740 9740
 		}
@@ -9742,11 +9742,11 @@  discard block
 block discarded – undo
9742 9742
 		//if we didn't find a two chracter prefix lets just search the one with one character
9743 9743
 		if ($registration_prefix == '')
9744 9744
 		{
9745
-			$query  = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_1";
9745
+			$query = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_1";
9746 9746
 			$sth = $this->db->prepare($query);
9747 9747
 			$sth->execute(array(':registration_1' => $registration_1));
9748 9748
 	        
9749
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
9749
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9750 9750
 			{
9751 9751
 				$registration_prefix = $row['registration_prefix'];
9752 9752
 			}
@@ -9760,7 +9760,7 @@  discard block
 block discarded – undo
9760 9760
 			} else {
9761 9761
 				$registration = preg_replace("/^(.{1})/", "$1-", $registration);
9762 9762
 			}
9763
-		} else if(strlen($registration_prefix) == 2){
9763
+		} else if (strlen($registration_prefix) == 2) {
9764 9764
 			if (0 === strpos($registration, 'N')) {
9765 9765
 				$registration = preg_replace("/^(.{2})/", "$1", $registration);
9766 9766
 			} else {
@@ -9779,17 +9779,17 @@  discard block
 block discarded – undo
9779 9779
 	*/
9780 9780
 	public function countryFromAircraftRegistration($registration)
9781 9781
 	{
9782
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
9782
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
9783 9783
 		
9784 9784
 		$registration_prefix = '';
9785
-		$registration_test = explode('-',$registration);
9785
+		$registration_test = explode('-', $registration);
9786 9786
 		$country = '';
9787 9787
 		if ($registration_test[0] != $registration) {
9788 9788
 			$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1";
9789 9789
 	      
9790 9790
 			$sth = $this->db->prepare($query);
9791 9791
 			$sth->execute(array(':registration_1' => $registration_test[0]));
9792
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
9792
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9793 9793
 			{
9794 9794
 				//$registration_prefix = $row['registration_prefix'];
9795 9795
 				$country = $row['country'];
@@ -9800,13 +9800,13 @@  discard block
 block discarded – undo
9800 9800
 
9801 9801
 			$country = '';
9802 9802
 			//first get the prefix based on two characters
9803
-			$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_2 LIMIT 1";
9803
+			$query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_2 LIMIT 1";
9804 9804
       
9805 9805
 			
9806 9806
 			$sth = $this->db->prepare($query);
9807 9807
 			$sth->execute(array(':registration_2' => $registration_2));
9808 9808
         
9809
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
9809
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9810 9810
 			{
9811 9811
 				$registration_prefix = $row['registration_prefix'];
9812 9812
 				$country = $row['country'];
@@ -9815,12 +9815,12 @@  discard block
 block discarded – undo
9815 9815
 			//if we didn't find a two chracter prefix lets just search the one with one character
9816 9816
 			if ($registration_prefix == "")
9817 9817
 			{
9818
-				$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1";
9818
+				$query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1";
9819 9819
 	      
9820 9820
 				$sth = $this->db->prepare($query);
9821 9821
 				$sth->execute(array(':registration_1' => $registration_1));
9822 9822
 	        
9823
-				while($row = $sth->fetch(PDO::FETCH_ASSOC))
9823
+				while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9824 9824
 				{
9825 9825
 					//$registration_prefix = $row['registration_prefix'];
9826 9826
 					$country = $row['country'];
@@ -9837,9 +9837,9 @@  discard block
 block discarded – undo
9837 9837
 	* @param String $flightaware_id flightaware_id from spotter_output table
9838 9838
 	* @param String $highlight New highlight value
9839 9839
 	*/
9840
-	public function setHighlightFlight($flightaware_id,$highlight) {
9840
+	public function setHighlightFlight($flightaware_id, $highlight) {
9841 9841
 		
9842
-		$query  = "UPDATE spotter_output SET highlight = :highlight WHERE flightaware_id = :flightaware_id";
9842
+		$query = "UPDATE spotter_output SET highlight = :highlight WHERE flightaware_id = :flightaware_id";
9843 9843
 		$sth = $this->db->prepare($query);
9844 9844
 		$sth->execute(array(':flightaware_id' => $flightaware_id, ':highlight' => $highlight));
9845 9845
 	}
@@ -9868,7 +9868,7 @@  discard block
 block discarded – undo
9868 9868
 		
9869 9869
 		$bitly_data = json_decode($bitly_data);
9870 9870
 		$bitly_url = '';
9871
-		if ($bitly_data->status_txt = "OK"){
9871
+		if ($bitly_data->status_txt = "OK") {
9872 9872
 			$bitly_url = $bitly_data->data->url;
9873 9873
 		}
9874 9874
 
@@ -9878,7 +9878,7 @@  discard block
 block discarded – undo
9878 9878
 
9879 9879
 	public function getOrderBy()
9880 9880
 	{
9881
-		$orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY spotter_output.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY spotter_output.aircraft_icao DESC"),"manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY spotter_output.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY spotter_output.aircraft_manufacturer DESC"),"airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY spotter_output.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY spotter_output.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY spotter_output.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY spotter_output.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY spotter_output.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY spotter_output.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY spotter_output.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY spotter_output.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY spotter_output.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY spotter_output.date DESC"),"distance_asc" => array("key" => "distance_asc","value" => "Distance - ASC","sql" => "ORDER BY distance ASC"),"distance_desc" => array("key" => "distance_desc","value" => "Distance - DESC","sql" => "ORDER BY distance DESC"));
9881
+		$orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY spotter_output.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY spotter_output.aircraft_icao DESC"), "manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY spotter_output.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY spotter_output.aircraft_manufacturer DESC"), "airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY spotter_output.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY spotter_output.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY spotter_output.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY spotter_output.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY spotter_output.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY spotter_output.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY spotter_output.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY spotter_output.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY spotter_output.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY spotter_output.date DESC"), "distance_asc" => array("key" => "distance_asc", "value" => "Distance - ASC", "sql" => "ORDER BY distance ASC"), "distance_desc" => array("key" => "distance_desc", "value" => "Distance - DESC", "sql" => "ORDER BY distance DESC"));
9882 9882
 		
9883 9883
 		return $orderby;
9884 9884
 		
@@ -10012,14 +10012,14 @@  discard block
 block discarded – undo
10012 10012
 		}
10013 10013
 		$sth = $this->db->prepare($query);
10014 10014
 		$sth->execute();
10015
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10015
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10016 10016
 		{
10017 10017
 			$departure_airport_array = $this->getAllAirportInfo($row['fromairport_icao']);
10018 10018
 			$arrival_airport_array = $this->getAllAirportInfo($row['toairport_icao']);
10019 10019
 			if (count($departure_airport_array) > 0 && count($arrival_airport_array) > 0) {
10020
-				$update_query="UPDATE spotter_output SET departure_airport_icao = :fromicao, arrival_airport_icao = :toicao, departure_airport_name = :departure_airport_name, departure_airport_city = :departure_airport_city, departure_airport_country = :departure_airport_country, arrival_airport_name = :arrival_airport_name, arrival_airport_city = :arrival_airport_city, arrival_airport_country = :arrival_airport_country WHERE spotter_id = :spotter_id";
10020
+				$update_query = "UPDATE spotter_output SET departure_airport_icao = :fromicao, arrival_airport_icao = :toicao, departure_airport_name = :departure_airport_name, departure_airport_city = :departure_airport_city, departure_airport_country = :departure_airport_country, arrival_airport_name = :arrival_airport_name, arrival_airport_city = :arrival_airport_city, arrival_airport_country = :arrival_airport_country WHERE spotter_id = :spotter_id";
10021 10021
 				$sthu = $this->db->prepare($update_query);
10022
-				$sthu->execute(array(':fromicao' => $row['fromairport_icao'],':toicao' => $row['toairport_icao'],':spotter_id' => $row['spotter_id'],':departure_airport_name' => $departure_airport_array[0]['name'],':departure_airport_city' => $departure_airport_array[0]['city'],':departure_airport_country' => $departure_airport_array[0]['country'],':arrival_airport_name' => $arrival_airport_array[0]['name'],':arrival_airport_city' => $arrival_airport_array[0]['city'],':arrival_airport_country' => $arrival_airport_array[0]['country']));
10022
+				$sthu->execute(array(':fromicao' => $row['fromairport_icao'], ':toicao' => $row['toairport_icao'], ':spotter_id' => $row['spotter_id'], ':departure_airport_name' => $departure_airport_array[0]['name'], ':departure_airport_city' => $departure_airport_array[0]['city'], ':departure_airport_country' => $departure_airport_array[0]['country'], ':arrival_airport_name' => $arrival_airport_array[0]['name'], ':arrival_airport_city' => $arrival_airport_array[0]['city'], ':arrival_airport_country' => $arrival_airport_array[0]['country']));
10023 10023
 			}
10024 10024
 		}
10025 10025
 		
@@ -10032,7 +10032,7 @@  discard block
 block discarded – undo
10032 10032
 		}
10033 10033
 		$sth = $this->db->prepare($query);
10034 10034
 		$sth->execute();
10035
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10035
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10036 10036
 		{
10037 10037
 			if (is_numeric(substr($row['ident'], -1, 1)))
10038 10038
 			{
@@ -10041,11 +10041,11 @@  discard block
 block discarded – undo
10041 10041
 				elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') $fromsource = 'ivao';
10042 10042
 				elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim';
10043 10043
 				elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao';
10044
-				$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3),$fromsource);
10044
+				$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3), $fromsource);
10045 10045
 				if (isset($airline_array[0]['name'])) {
10046
-					$update_query  = "UPDATE spotter_output SET spotter_output.airline_name = :airline_name, spotter_output.airline_icao = :airline_icao, spotter_output.airline_country = :airline_country, spotter_output.airline_type = :airline_type WHERE spotter_output.spotter_id = :spotter_id";
10046
+					$update_query = "UPDATE spotter_output SET spotter_output.airline_name = :airline_name, spotter_output.airline_icao = :airline_icao, spotter_output.airline_country = :airline_country, spotter_output.airline_type = :airline_type WHERE spotter_output.spotter_id = :spotter_id";
10047 10047
 					$sthu = $this->db->prepare($update_query);
10048
-					$sthu->execute(array(':airline_name' => $airline_array[0]['name'],':airline_icao' => $airline_array[0]['icao'], ':airline_country' => $airline_array[0]['country'], ':airline_type' => $airline_array[0]['type'], ':spotter_id' => $row['spotter_id']));
10048
+					$sthu->execute(array(':airline_name' => $airline_array[0]['name'], ':airline_icao' => $airline_array[0]['icao'], ':airline_country' => $airline_array[0]['country'], ':airline_type' => $airline_array[0]['type'], ':spotter_id' => $row['spotter_id']));
10049 10049
 				}
10050 10050
 			}
10051 10051
 		}
@@ -10065,18 +10065,18 @@  discard block
 block discarded – undo
10065 10065
 		}
10066 10066
 		$sth = $this->db->prepare($query);
10067 10067
 		$sth->execute();
10068
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10068
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10069 10069
 		{
10070 10070
 			if ($row['aircraft_icao'] != '') {
10071 10071
 				$aircraft_name = $this->getAllAircraftInfo($row['aircraft_icao']);
10072
-				if ($row['registration'] != ""){
10072
+				if ($row['registration'] != "") {
10073 10073
 					$image_array = $Image->getSpotterImage($row['registration']);
10074 10074
 					if (count($image_array) == 0) {
10075 10075
 						$Image->addSpotterImage($row['registration']);
10076 10076
 					}
10077 10077
 				}
10078 10078
 				if (count($aircraft_name) > 0) {
10079
-					$update_query  = "UPDATE spotter_output SET spotter_output.aircraft_name = :aircraft_name, spotter_output.aircraft_manufacturer = :aircraft_manufacturer WHERE spotter_output.spotter_id = :spotter_id";
10079
+					$update_query = "UPDATE spotter_output SET spotter_output.aircraft_name = :aircraft_name, spotter_output.aircraft_manufacturer = :aircraft_manufacturer WHERE spotter_output.spotter_id = :spotter_id";
10080 10080
 					$sthu = $this->db->prepare($update_query);
10081 10081
 					$sthu->execute(array(':aircraft_name' => $aircraft_name[0]['type'], ':aircraft_manufacturer' => $aircraft_name[0]['manufacturer'], ':spotter_id' => $row['spotter_id']));
10082 10082
 				}
@@ -10091,10 +10091,10 @@  discard block
 block discarded – undo
10091 10091
 		$query = "SELECT spotter_output.spotter_id, spotter_output.last_latitude, spotter_output.last_longitude, spotter_output.last_altitude, spotter_output.arrival_airport_icao, spotter_output.real_arrival_airport_icao FROM spotter_output";
10092 10092
 		$sth = $this->db->prepare($query);
10093 10093
 		$sth->execute();
10094
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10094
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10095 10095
 		{
10096 10096
 			if ($row['last_latitude'] != '' && $row['last_longitude'] != '') {
10097
-				$closestAirports = $this->closestAirports($row['last_latitude'],$row['last_longitude'],$globalClosestMinDist);
10097
+				$closestAirports = $this->closestAirports($row['last_latitude'], $row['last_longitude'], $globalClosestMinDist);
10098 10098
 				$airport_icao = '';
10099 10099
 				 if (isset($closestAirports[0])) {
10100 10100
 					if ($row['arrival_airport_icao'] == $closestAirports[0]['icao']) {
@@ -10108,7 +10108,7 @@  discard block
 block discarded – undo
10108 10108
 								break;
10109 10109
 							}
10110 10110
 						}
10111
-					} elseif ($row['last_altitude'] == 0 || ($row['last_altitude'] != '' && ($closestAirports[0]['altitude'] <= $row['last_altitude']*100+1000 && $row['last_altitude']*100 < $closestAirports[0]['altitude']+5000))) {
10111
+					} elseif ($row['last_altitude'] == 0 || ($row['last_altitude'] != '' && ($closestAirports[0]['altitude'] <= $row['last_altitude']*100 + 1000 && $row['last_altitude']*100 < $closestAirports[0]['altitude'] + 5000))) {
10112 10112
 						$airport_icao = $closestAirports[0]['icao'];
10113 10113
 						if ($globalDebug) echo "\o/ NP --++ Find arrival airport. Airport ICAO : ".$airport_icao." !  Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist." - Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.($row['last_altitude']*100)."\n";
10114 10114
 					} else {
@@ -10119,28 +10119,28 @@  discard block
 block discarded – undo
10119 10119
 				}
10120 10120
 				if ($row['real_arrival_airport_icao'] != $airport_icao) {
10121 10121
 					if ($globalDebug) echo "Updating airport to ".$airport_icao."...\n";
10122
-					$update_query="UPDATE spotter_output SET real_arrival_airport_icao = :airport_icao WHERE spotter_id = :spotter_id";
10122
+					$update_query = "UPDATE spotter_output SET real_arrival_airport_icao = :airport_icao WHERE spotter_id = :spotter_id";
10123 10123
 					$sthu = $this->db->prepare($update_query);
10124
-					$sthu->execute(array(':airport_icao' => $airport_icao,':spotter_id' => $row['spotter_id']));
10124
+					$sthu->execute(array(':airport_icao' => $airport_icao, ':spotter_id' => $row['spotter_id']));
10125 10125
 				}
10126 10126
 			}
10127 10127
 		}
10128 10128
 	}
10129 10129
 	
10130
-	public function closestAirports($origLat,$origLon,$dist = 10) {
10130
+	public function closestAirports($origLat, $origLon, $dist = 10) {
10131 10131
 		global $globalDBdriver;
10132
-		$dist = number_format($dist*0.621371,2,'.',''); // convert km to mile
10132
+		$dist = number_format($dist*0.621371, 2, '.', ''); // convert km to mile
10133 10133
 /*
10134 10134
 		$query="SELECT name, icao, latitude, longitude, altitude, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - abs(latitude))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(abs(latitude)*pi()/180)*POWER(SIN(($origLon-longitude)*pi()/180/2),2))) as distance 
10135 10135
                       FROM airport WHERE longitude between ($origLon-$dist/abs(cos(radians($origLat))*69)) and ($origLon+$dist/abs(cos(radians($origLat))*69)) and latitude between ($origLat-($dist/69)) and ($origLat+($dist/69)) 
10136 10136
                       having distance < $dist ORDER BY distance limit 100;";
10137 10137
 */
10138 10138
 		if ($globalDBdriver == 'mysql') {
10139
-			$query="SELECT name, icao, latitude, longitude, altitude, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(latitude*pi()/180)*POWER(SIN(($origLon-longitude)*pi()/180/2),2))) as distance 
10139
+			$query = "SELECT name, icao, latitude, longitude, altitude, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(latitude*pi()/180)*POWER(SIN(($origLon-longitude)*pi()/180/2),2))) as distance 
10140 10140
 	                      FROM airport WHERE longitude between ($origLon-$dist/cos(radians($origLat))*69) and ($origLon+$dist/cos(radians($origLat)*69)) and latitude between ($origLat-($dist/69)) and ($origLat+($dist/69)) 
10141 10141
 	                      AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(latitude*pi()/180)*POWER(SIN(($origLon-longitude)*pi()/180/2),2)))) < $dist ORDER BY distance limit 100;";
10142 10142
                 } else {
10143
-			$query="SELECT name, icao, latitude, longitude, altitude, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(longitude as double precision))*pi()/180/2),2))) as distance 
10143
+			$query = "SELECT name, icao, latitude, longitude, altitude, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(longitude as double precision))*pi()/180/2),2))) as distance 
10144 10144
 	                      FROM airport WHERE CAST(longitude as double precision) between ($origLon-$dist/cos(radians($origLat))*69) and ($origLon+$dist/cos(radians($origLat))*69) and CAST(latitude as double precision) between ($origLat-($dist/69)) and ($origLat+($dist/69)) 
10145 10145
 	                      AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(longitude as double precision))*pi()/180/2),2)))) < $dist ORDER BY distance limit 100;";
10146 10146
     		}
Please login to merge, or discard this patch.
statistics-airport-arrival-country.php 3 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -5,13 +5,13 @@  discard block
 block discarded – undo
5 5
 $Stats = new Stats();
6 6
 $title = _("Statistics").' - '._("Most common Arrival Airport by Country");
7 7
 
8
-$airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING);
8
+$airline_icao = (string) filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING);
9 9
 if ($airline_icao == '' && isset($_COOKIE['stats_airline_icao'])) {
10 10
     $airline_icao = $_COOKIE['stats_airline_icao'];
11 11
 } elseif ($airline_icao == '' && isset($globalFilter)) {
12 12
     if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
13 13
 }
14
-setcookie('stats_airline_icao',$airline_icao);
14
+setcookie('stats_airline_icao', $airline_icao);
15 15
 
16 16
 require_once('header.php');
17 17
 include('statistics-sub-menu.php'); 
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 	  </div>
23 23
     	 <p>'._("Below are the <strong>Top 10</strong> most common countries of all the arrival airports.").'</p>';
24 24
 
25
-$airport_country_array = $Stats->countAllArrivalCountries(true,$airline_icao);
25
+$airport_country_array = $Stats->countAllArrivalCountries(true, $airline_icao);
26 26
 
27 27
 print '<script>
28 28
     	google.load("visualization", "1", {packages:["geochart"]});
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
         	["'._("Country").'", "'._("# of times").'"],';
37 37
 
38 38
 $country_data = '';
39
-foreach($airport_country_array as $airport_item)
39
+foreach ($airport_country_array as $airport_item)
40 40
 {
41 41
 	$country_data .= '[ "'.$airport_item['airport_arrival_country'].'",'.$airport_item['airport_arrival_country_count'].'],';
42 42
 }
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 print '</thead>';
72 72
 print '<tbody>';
73 73
 $i = 1;
74
-foreach($airport_country_array as $airport_item)
74
+foreach ($airport_country_array as $airport_item)
75 75
 {
76 76
 	print '<tr>';
77 77
 	print '<td><strong>'.$i.'</strong></td>';
Please login to merge, or discard this patch.
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -7,9 +7,9 @@
 block discarded – undo
7 7
 
8 8
 $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING);
9 9
 if ($airline_icao == '' && isset($_COOKIE['stats_airline_icao'])) {
10
-    $airline_icao = $_COOKIE['stats_airline_icao'];
10
+	$airline_icao = $_COOKIE['stats_airline_icao'];
11 11
 } elseif ($airline_icao == '' && isset($globalFilter)) {
12
-    if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
12
+	if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
13 13
 }
14 14
 setcookie('stats_airline_icao',$airline_icao);
15 15
 
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -9,8 +9,10 @@
 block discarded – undo
9 9
 if ($airline_icao == '' && isset($_COOKIE['stats_airline_icao'])) {
10 10
     $airline_icao = $_COOKIE['stats_airline_icao'];
11 11
 } elseif ($airline_icao == '' && isset($globalFilter)) {
12
-    if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
13
-}
12
+    if (isset($globalFilter['airline'])) {
13
+    	$airline_icao = $globalFilter['airline'][0];
14
+    }
15
+    }
14 16
 setcookie('stats_airline_icao',$airline_icao);
15 17
 
16 18
 require_once('header.php');
Please login to merge, or discard this patch.
statistics-date.php 3 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -5,13 +5,13 @@  discard block
 block discarded – undo
5 5
 $Stats = new Stats();
6 6
 $title = _("Statistics").' - '._("Busiest Day");
7 7
 
8
-$airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING);
8
+$airline_icao = (string) filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING);
9 9
 if ($airline_icao == '' && isset($_COOKIE['stats_airline_icao'])) {
10 10
     $airline_icao = $_COOKIE['stats_airline_icao'];
11 11
 } elseif ($airline_icao == '' && isset($globalFilter)) {
12 12
     if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
13 13
 }
14
-setcookie('stats_airline_icao',$airline_icao);
14
+setcookie('stats_airline_icao', $airline_icao);
15 15
 
16 16
 require_once('header.php');
17 17
 include('statistics-sub-menu.php'); 
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
             	["'._("Date").'", "'._("# of Flights").'"], ';
36 36
 
37 37
 $date_data = '';
38
-foreach($date_array as $date_item)
38
+foreach ($date_array as $date_item)
39 39
 {
40 40
 	$date_data .= '[ "'.date("F j, Y", strtotime($date_item['date_name'])).'",'.$date_item['date_count'].'],';
41 41
 }
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
       </script>';
62 62
 }
63 63
 if (isset($globalDBArchiveMonths) && $globalDBArchiveMonths > 0) {
64
-	print '<p>'.sprintf(_("Below are the <strong>Top 10</strong> most busiest dates of last %d month(s)."),$globalDBArchiveMonths).'</p>';
64
+	print '<p>'.sprintf(_("Below are the <strong>Top 10</strong> most busiest dates of last %d month(s)."), $globalDBArchiveMonths).'</p>';
65 65
 } else {
66 66
 	print '<p>'._("Below are the <strong>Top 10</strong> most busiest dates.").'</p>';
67 67
 }
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 	print '</thead>';
78 78
 	print '<tbody>';
79 79
 	$i = 1;
80
-	foreach($date_array as $date_item)
80
+	foreach ($date_array as $date_item)
81 81
 	{
82 82
 		print '<tr>';
83 83
 		print '<td><strong>'.$i.'</strong></td>';
Please login to merge, or discard this patch.
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -7,9 +7,9 @@
 block discarded – undo
7 7
 
8 8
 $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING);
9 9
 if ($airline_icao == '' && isset($_COOKIE['stats_airline_icao'])) {
10
-    $airline_icao = $_COOKIE['stats_airline_icao'];
10
+	$airline_icao = $_COOKIE['stats_airline_icao'];
11 11
 } elseif ($airline_icao == '' && isset($globalFilter)) {
12
-    if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
12
+	if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
13 13
 }
14 14
 setcookie('stats_airline_icao',$airline_icao);
15 15
 
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -9,8 +9,10 @@
 block discarded – undo
9 9
 if ($airline_icao == '' && isset($_COOKIE['stats_airline_icao'])) {
10 10
     $airline_icao = $_COOKIE['stats_airline_icao'];
11 11
 } elseif ($airline_icao == '' && isset($globalFilter)) {
12
-    if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
13
-}
12
+    if (isset($globalFilter['airline'])) {
13
+    	$airline_icao = $globalFilter['airline'][0];
14
+    }
15
+    }
14 16
 setcookie('stats_airline_icao',$airline_icao);
15 17
 
16 18
 require_once('header.php');
Please login to merge, or discard this patch.
statistics-month.php 3 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -5,13 +5,13 @@  discard block
 block discarded – undo
5 5
 $Stats = new Stats();
6 6
 $title = _("Statistics").' - '._("Busiest Month of Last Year");
7 7
 
8
-$airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING);
8
+$airline_icao = (string) filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING);
9 9
 if ($airline_icao == '' && isset($_COOKIE['stats_airline_icao'])) {
10 10
     $airline_icao = $_COOKIE['stats_airline_icao'];
11 11
 } elseif ($airline_icao == '' && isset($globalFilter)) {
12 12
     if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
13 13
 }
14
-setcookie('stats_airline_icao',$airline_icao);
14
+setcookie('stats_airline_icao', $airline_icao);
15 15
 
16 16
 require_once('header.php');
17 17
 include('statistics-sub-menu.php'); 
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
             	["'._("Month").'", "'._("# of Flights").'"], ';
33 33
 
34 34
 $date_data = '';
35
-foreach($date_array as $date_item)
35
+foreach ($date_array as $date_item)
36 36
 {
37 37
 	$date_data .= '[ "'.date("F j, Y", strtotime($date_item['date_name'])).'",'.$date_item['date_count'].'],';
38 38
 }
@@ -69,12 +69,12 @@  discard block
 block discarded – undo
69 69
 	print '</thead>';
70 70
 	print '<tbody>';
71 71
 	$i = 1;
72
-	foreach($date_array as $date_item)
72
+	foreach ($date_array as $date_item)
73 73
 	{
74 74
 		print '<tr>';
75 75
 		print '<td><strong>'.$i.'</strong></td>';
76 76
 		print '<td>';
77
-		print '<a href="'.$globalURL.'/date/'.date('Y-m-d',strtotime($date_item['date_name'])).'">'.date("l F j, Y", strtotime($date_item['date_name'])).'</a>';
77
+		print '<a href="'.$globalURL.'/date/'.date('Y-m-d', strtotime($date_item['date_name'])).'">'.date("l F j, Y", strtotime($date_item['date_name'])).'</a>';
78 78
 		print '</td>';
79 79
 		print '<td>';
80 80
 		print $date_item['date_count'];
Please login to merge, or discard this patch.
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -7,9 +7,9 @@
 block discarded – undo
7 7
 
8 8
 $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING);
9 9
 if ($airline_icao == '' && isset($_COOKIE['stats_airline_icao'])) {
10
-    $airline_icao = $_COOKIE['stats_airline_icao'];
10
+	$airline_icao = $_COOKIE['stats_airline_icao'];
11 11
 } elseif ($airline_icao == '' && isset($globalFilter)) {
12
-    if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
12
+	if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
13 13
 }
14 14
 setcookie('stats_airline_icao',$airline_icao);
15 15
 
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -9,8 +9,10 @@
 block discarded – undo
9 9
 if ($airline_icao == '' && isset($_COOKIE['stats_airline_icao'])) {
10 10
     $airline_icao = $_COOKIE['stats_airline_icao'];
11 11
 } elseif ($airline_icao == '' && isset($globalFilter)) {
12
-    if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
13
-}
12
+    if (isset($globalFilter['airline'])) {
13
+    	$airline_icao = $globalFilter['airline'][0];
14
+    }
15
+    }
14 16
 setcookie('stats_airline_icao',$airline_icao);
15 17
 
16 18
 require_once('header.php');
Please login to merge, or discard this patch.
statistics-year.php 3 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -5,13 +5,13 @@  discard block
 block discarded – undo
5 5
 $Stats = new Stats();
6 6
 $title = _("Statistics").' - '._("Busiest Month of Last Year");
7 7
 
8
-$airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING);
8
+$airline_icao = (string) filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING);
9 9
 if ($airline_icao == '' && isset($_COOKIE['stats_airline_icao'])) {
10 10
     $airline_icao = $_COOKIE['stats_airline_icao'];
11 11
 } elseif ($airline_icao == '' && isset($globalFilter)) {
12 12
     if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
13 13
 }
14
-setcookie('stats_airline_icao',$airline_icao);
14
+setcookie('stats_airline_icao', $airline_icao);
15 15
 
16 16
 require_once('header.php');
17 17
 include('statistics-sub-menu.php');
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 	</div>
22 22
       <p>'._("Below is a chart that plots the busiest month during the <strong>last year</strong>.").'</p>';
23 23
 
24
-$date_array = $Stats->countAllMonthsLastYear(true,$airline_icao);
24
+$date_array = $Stats->countAllMonthsLastYear(true, $airline_icao);
25 25
 print '<div id="chart" class="chart" width="100%"></div>
26 26
       	<script> 
27 27
       		google.load("visualization", "1", {packages:["corechart"]});
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
             	["'._("Month").'", "'._("# of Flights").'"], ';
32 32
 
33 33
 $date_data = '';
34
-foreach($date_array as $date_item)
34
+foreach ($date_array as $date_item)
35 35
 {
36 36
 	$date_data .= '[ "'.date("F, Y", strtotime($date_item['year_name'].'-'.$date_item['month_name'].'-01')).'",'.$date_item['date_count'].'],';
37 37
 }
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 	print '</thead>';
69 69
 	print '<tbody>';
70 70
 	$i = 1;
71
-	foreach($date_array as $date_item)
71
+	foreach ($date_array as $date_item)
72 72
 	{
73 73
 		print '<tr>';
74 74
 		print '<td><strong>'.$i.'</strong></td>';
Please login to merge, or discard this patch.
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -7,9 +7,9 @@
 block discarded – undo
7 7
 
8 8
 $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING);
9 9
 if ($airline_icao == '' && isset($_COOKIE['stats_airline_icao'])) {
10
-    $airline_icao = $_COOKIE['stats_airline_icao'];
10
+	$airline_icao = $_COOKIE['stats_airline_icao'];
11 11
 } elseif ($airline_icao == '' && isset($globalFilter)) {
12
-    if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
12
+	if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
13 13
 }
14 14
 setcookie('stats_airline_icao',$airline_icao);
15 15
 
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -9,8 +9,10 @@
 block discarded – undo
9 9
 if ($airline_icao == '' && isset($_COOKIE['stats_airline_icao'])) {
10 10
     $airline_icao = $_COOKIE['stats_airline_icao'];
11 11
 } elseif ($airline_icao == '' && isset($globalFilter)) {
12
-    if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
13
-}
12
+    if (isset($globalFilter['airline'])) {
13
+    	$airline_icao = $globalFilter['airline'][0];
14
+    }
15
+    }
14 16
 setcookie('stats_airline_icao',$airline_icao);
15 17
 
16 18
 require_once('header.php');
Please login to merge, or discard this patch.
statistics-aircraft.php 3 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -5,13 +5,13 @@  discard block
 block discarded – undo
5 5
 $Stats = new Stats();
6 6
 $title = _("Statistics").' - '._("Most common Aircraft");
7 7
 
8
-$airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING);
8
+$airline_icao = (string) filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING);
9 9
 if ($airline_icao == '' && isset($_COOKIE['stats_airline_icao'])) {
10 10
     $airline_icao = $_COOKIE['stats_airline_icao'];
11 11
 } elseif ($airline_icao == '' && isset($globalFilter)) {
12 12
     if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
13 13
 }
14
-setcookie('stats_airline_icao',$airline_icao);
14
+setcookie('stats_airline_icao', $airline_icao);
15 15
 
16 16
 require_once('header.php');
17 17
 
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 	</div>
23 23
 	<p>'._("Below are the <strong>Top 10</strong> most common aircraft types.").'</p>';
24 24
 	  
25
-$aircraft_array = $Stats->countAllAircraftTypes(true,$airline_icao);
25
+$aircraft_array = $Stats->countAllAircraftTypes(true, $airline_icao);
26 26
 print '<div id="chart" class="chart" width="100%"></div>
27 27
       	<script> 
28 28
       		google.load("visualization", "1", {packages:["corechart"]});
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
             var data = google.visualization.arrayToDataTable([
32 32
             	["'._("Aircraft").'", "'._("# of times").'"], ';
33 33
 $aircraft_data = '';
34
-foreach($aircraft_array as $aircraft_item)
34
+foreach ($aircraft_array as $aircraft_item)
35 35
 {
36 36
 	$aircraft_data .= '[ "'.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],';
37 37
 }
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 	print '</thead>';
65 65
 	print '<tbody>';
66 66
 	$i = 1;
67
-	foreach($aircraft_array as $aircraft_item)
67
+	foreach ($aircraft_array as $aircraft_item)
68 68
 	{
69 69
 		print '<tr>';
70 70
 		print '<td><strong>'.$i.'</strong></td>';
Please login to merge, or discard this patch.
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -7,9 +7,9 @@
 block discarded – undo
7 7
 
8 8
 $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING);
9 9
 if ($airline_icao == '' && isset($_COOKIE['stats_airline_icao'])) {
10
-    $airline_icao = $_COOKIE['stats_airline_icao'];
10
+	$airline_icao = $_COOKIE['stats_airline_icao'];
11 11
 } elseif ($airline_icao == '' && isset($globalFilter)) {
12
-    if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
12
+	if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
13 13
 }
14 14
 setcookie('stats_airline_icao',$airline_icao);
15 15
 
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -9,8 +9,10 @@
 block discarded – undo
9 9
 if ($airline_icao == '' && isset($_COOKIE['stats_airline_icao'])) {
10 10
     $airline_icao = $_COOKIE['stats_airline_icao'];
11 11
 } elseif ($airline_icao == '' && isset($globalFilter)) {
12
-    if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
13
-}
12
+    if (isset($globalFilter['airline'])) {
13
+    	$airline_icao = $globalFilter['airline'][0];
14
+    }
15
+    }
14 16
 setcookie('stats_airline_icao',$airline_icao);
15 17
 
16 18
 require_once('header.php');
Please login to merge, or discard this patch.
statistics-airport-arrival.php 3 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -5,13 +5,13 @@  discard block
 block discarded – undo
5 5
 $Stats = new Stats();
6 6
 $title = _("Statistics").' - '._("Most common Arrival Airport");
7 7
 
8
-$airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING);
8
+$airline_icao = (string) filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING);
9 9
 if ($airline_icao == '' && isset($_COOKIE['stats_airline_icao'])) {
10 10
     $airline_icao = $_COOKIE['stats_airline_icao'];
11 11
 } elseif ($airline_icao == '' && isset($globalFilter)) {
12 12
     if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
13 13
 }
14
-setcookie('stats_airline_icao',$airline_icao);
14
+setcookie('stats_airline_icao', $airline_icao);
15 15
 
16 16
 require_once('header.php');
17 17
 include('statistics-sub-menu.php'); 
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 	  </div>
23 23
     	 <p>'._("Below are the <strong>Top 10</strong> most common arrival airports.").'</p>';
24 24
 
25
-$airport_airport_array = $Stats->countAllArrivalAirports(true,$airline_icao);
25
+$airport_airport_array = $Stats->countAllArrivalAirports(true, $airline_icao);
26 26
 print '<script>
27 27
     	google.load("visualization", "1", {packages:["geochart"]});
28 28
     	google.setOnLoadCallback(drawCharts);
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
         	["'._("Airport").'", "'._("# of times").'"],';
36 36
 
37 37
 $airport_data = '';
38
-foreach($airport_airport_array as $airport_item)
38
+foreach ($airport_airport_array as $airport_item)
39 39
 {
40 40
 	$name = $airport_item['airport_arrival_city'].', '.$airport_item['airport_arrival_country'].' ('.$airport_item['airport_arrival_icao'].')';
41 41
 	$name = str_replace("'", "", $name);
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 print '</thead>';
76 76
 print '<tbody>';
77 77
 $i = 1;
78
-foreach($airport_airport_array as $airport_item)
78
+foreach ($airport_airport_array as $airport_item)
79 79
 {
80 80
 	print '<tr>';
81 81
 	print '<td><strong>'.$i.'</strong></td>';
Please login to merge, or discard this patch.
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -7,9 +7,9 @@
 block discarded – undo
7 7
 
8 8
 $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING);
9 9
 if ($airline_icao == '' && isset($_COOKIE['stats_airline_icao'])) {
10
-    $airline_icao = $_COOKIE['stats_airline_icao'];
10
+	$airline_icao = $_COOKIE['stats_airline_icao'];
11 11
 } elseif ($airline_icao == '' && isset($globalFilter)) {
12
-    if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
12
+	if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
13 13
 }
14 14
 setcookie('stats_airline_icao',$airline_icao);
15 15
 
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -9,8 +9,10 @@
 block discarded – undo
9 9
 if ($airline_icao == '' && isset($_COOKIE['stats_airline_icao'])) {
10 10
     $airline_icao = $_COOKIE['stats_airline_icao'];
11 11
 } elseif ($airline_icao == '' && isset($globalFilter)) {
12
-    if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
13
-}
12
+    if (isset($globalFilter['airline'])) {
13
+    	$airline_icao = $globalFilter['airline'][0];
14
+    }
15
+    }
14 16
 setcookie('stats_airline_icao',$airline_icao);
15 17
 
16 18
 require_once('header.php');
Please login to merge, or discard this patch.