Completed
Push — master ( ef12b3...43e73e )
by Yannick
07:02
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.
Spacing   +791 added lines, -791 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
 
@@ -2005,10 +2005,10 @@  discard block
 block discarded – undo
2005 2005
 	*/
2006 2006
 	public function getAllAirlineInfo($airline_icao, $fromsource = NULL)
2007 2007
 	{
2008
-		$airline_icao = strtoupper(filter_var($airline_icao,FILTER_SANITIZE_STRING));
2008
+		$airline_icao = strtoupper(filter_var($airline_icao, FILTER_SANITIZE_STRING));
2009 2009
 		if ($airline_icao == 'NA') {
2010 2010
 			$airline_array = array();
2011
-			$airline_array[] = array('name' => 'Not Available','iata' => 'NA', 'icao' => 'NA', 'callsign' => '', 'country' => 'NA', 'type' =>'');
2011
+			$airline_array[] = array('name' => 'Not Available', 'iata' => 'NA', 'icao' => 'NA', 'callsign' => '', 'country' => 'NA', 'type' =>'');
2012 2012
 			return $airline_array;
2013 2013
 		} else {
2014 2014
 			if (strlen($airline_icao) == 2) {
@@ -2029,7 +2029,7 @@  discard block
 block discarded – undo
2029 2029
 			if ($fromsource === NULL) {
2030 2030
 				$sth->execute(array(':airline_icao' => $airline_icao));
2031 2031
 			} else {
2032
-				$sth->execute(array(':airline_icao' => $airline_icao,':fromsource' => $fromsource));
2032
+				$sth->execute(array(':airline_icao' => $airline_icao, ':fromsource' => $fromsource));
2033 2033
 			}
2034 2034
                         /*
2035 2035
 			$airline_array = array();
@@ -2070,12 +2070,12 @@  discard block
 block discarded – undo
2070 2070
 	*/
2071 2071
 	public function getAllAircraftInfo($aircraft_type)
2072 2072
 	{
2073
-		$aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING);
2073
+		$aircraft_type = filter_var($aircraft_type, FILTER_SANITIZE_STRING);
2074 2074
 
2075 2075
 		if ($aircraft_type == 'NA') {
2076
-			return array(array('icao' => 'NA','type' => 'Not Available', 'manufacturer' => 'Not Available', 'aircraft_shadow' => NULL));
2076
+			return array(array('icao' => 'NA', 'type' => 'Not Available', 'manufacturer' => 'Not Available', 'aircraft_shadow' => NULL));
2077 2077
 		}
2078
-		$query  = "SELECT aircraft.icao, aircraft.type,aircraft.manufacturer,aircraft.aircraft_shadow FROM aircraft WHERE aircraft.icao = :aircraft_type";
2078
+		$query = "SELECT aircraft.icao, aircraft.type,aircraft.manufacturer,aircraft.aircraft_shadow FROM aircraft WHERE aircraft.icao = :aircraft_type";
2079 2079
 		
2080 2080
 		$sth = $this->db->prepare($query);
2081 2081
 		$sth->execute(array(':aircraft_type' => $aircraft_type));
@@ -2107,7 +2107,7 @@  discard block
 block discarded – undo
2107 2107
 	*/
2108 2108
 	public function getAircraftIcao($aircraft_type)
2109 2109
 	{
2110
-		$aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING);
2110
+		$aircraft_type = filter_var($aircraft_type, FILTER_SANITIZE_STRING);
2111 2111
 		$all_aircraft = array('737-300' => 'B733',
2112 2112
 				'777-200' => 'B772',
2113 2113
 				'777-200ER' => 'B772',
@@ -2119,10 +2119,10 @@  discard block
 block discarded – undo
2119 2119
 				'A380' => 'A388');
2120 2120
 		if (isset($all_aircraft[$aircraft_type])) return $all_aircraft[$aircraft_type];
2121 2121
 
2122
-		$query  = "SELECT aircraft.icao FROM aircraft WHERE aircraft.type LIKE :saircraft_type OR aircraft.type = :aircraft_type OR aircraft.icao = :aircraft_type LIMIT 1";
2122
+		$query = "SELECT aircraft.icao FROM aircraft WHERE aircraft.type LIKE :saircraft_type OR aircraft.type = :aircraft_type OR aircraft.icao = :aircraft_type LIMIT 1";
2123 2123
 		$aircraft_type = strtoupper($aircraft_type);
2124 2124
 		$sth = $this->db->prepare($query);
2125
-		$sth->execute(array(':saircraft_type' => '%'.$aircraft_type.'%',':aircraft_type' => $aircraft_type,));
2125
+		$sth->execute(array(':saircraft_type' => '%'.$aircraft_type.'%', ':aircraft_type' => $aircraft_type,));
2126 2126
 		$result = $sth->fetchAll(PDO::FETCH_ASSOC);
2127 2127
 		if (isset($result[0]['icao'])) return $result[0]['icao'];
2128 2128
 		else return '';
@@ -2137,9 +2137,9 @@  discard block
 block discarded – undo
2137 2137
 	*/
2138 2138
 	public function getAllAircraftType($aircraft_modes)
2139 2139
 	{
2140
-		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
2140
+		$aircraft_modes = filter_var($aircraft_modes, FILTER_SANITIZE_STRING);
2141 2141
 
2142
-		$query  = "SELECT aircraft_modes.ICAOTypeCode FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes LIMIT 1";
2142
+		$query = "SELECT aircraft_modes.ICAOTypeCode FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes LIMIT 1";
2143 2143
 		
2144 2144
 		$sth = $this->db->prepare($query);
2145 2145
 		$sth->execute(array(':aircraft_modes' => $aircraft_modes));
@@ -2159,8 +2159,8 @@  discard block
 block discarded – undo
2159 2159
 	*/
2160 2160
 	public function getOperator($operator)
2161 2161
 	{
2162
-		$operator = filter_var($operator,FILTER_SANITIZE_STRING);
2163
-		$query  = "SELECT translation.operator_correct FROM translation WHERE translation.operator = :operator LIMIT 1";
2162
+		$operator = filter_var($operator, FILTER_SANITIZE_STRING);
2163
+		$query = "SELECT translation.operator_correct FROM translation WHERE translation.operator = :operator LIMIT 1";
2164 2164
 		
2165 2165
 		$sth = $this->db->prepare($query);
2166 2166
 		$sth->execute(array(':operator' => $operator));
@@ -2180,9 +2180,9 @@  discard block
 block discarded – undo
2180 2180
 	*/
2181 2181
 	public function getRouteInfo($callsign)
2182 2182
 	{
2183
-		$callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
2183
+		$callsign = filter_var($callsign, FILTER_SANITIZE_STRING);
2184 2184
                 if ($callsign == '') return array();
2185
-		$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";
2185
+		$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";
2186 2186
 		
2187 2187
 		$sth = $this->db->prepare($query);
2188 2188
 		$sth->execute(array(':callsign' => $callsign));
@@ -2202,9 +2202,9 @@  discard block
 block discarded – undo
2202 2202
 	*/
2203 2203
 	public function getAircraftInfoByRegistration($registration)
2204 2204
 	{
2205
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
2205
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
2206 2206
 
2207
-		$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";
2207
+		$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";
2208 2208
 		
2209 2209
 		$sth = $this->db->prepare($query);
2210 2210
 		$sth->execute(array(':registration' => $registration));
@@ -2212,7 +2212,7 @@  discard block
 block discarded – undo
2212 2212
 		$aircraft_array = array();
2213 2213
 		$temp_array = array();
2214 2214
 		
2215
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2215
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2216 2216
 		{
2217 2217
 			$temp_array['airline_icao'] = $row['airline_icao'];
2218 2218
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
@@ -2234,10 +2234,10 @@  discard block
 block discarded – undo
2234 2234
 	*/
2235 2235
 	public function getAircraftOwnerByRegistration($registration)
2236 2236
 	{
2237
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
2237
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
2238 2238
 		$Connection = new Connection($this->db);
2239 2239
 		if ($Connection->tableExists('aircraft_owner')) {
2240
-			$query  = "SELECT aircraft_owner.base, aircraft_owner.owner, aircraft_owner.date_first_reg FROM aircraft_owner WHERE registration = :registration LIMIT 1";
2240
+			$query = "SELECT aircraft_owner.base, aircraft_owner.owner, aircraft_owner.date_first_reg FROM aircraft_owner WHERE registration = :registration LIMIT 1";
2241 2241
 			$sth = $this->db->prepare($query);
2242 2242
 			$sth->execute(array(':registration' => $registration));
2243 2243
 
@@ -2255,7 +2255,7 @@  discard block
 block discarded – undo
2255 2255
 	public function getAllFlightsforSitemap()
2256 2256
 	{
2257 2257
 		//$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 ";
2258
-		$query  = "SELECT spotter_output.spotter_id FROM spotter_output ORDER BY spotter_id DESC LIMIT 200 OFFSET 0";
2258
+		$query = "SELECT spotter_output.spotter_id FROM spotter_output ORDER BY spotter_id DESC LIMIT 200 OFFSET 0";
2259 2259
 		
2260 2260
 		$sth = $this->db->prepare($query);
2261 2261
 		$sth->execute();
@@ -2302,7 +2302,7 @@  discard block
 block discarded – undo
2302 2302
 		$manufacturer_array = array();
2303 2303
 		$temp_array = array();
2304 2304
 		
2305
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2305
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2306 2306
 		{
2307 2307
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
2308 2308
 
@@ -2336,7 +2336,7 @@  discard block
 block discarded – undo
2336 2336
 		$aircraft_array = array();
2337 2337
 		$temp_array = array();
2338 2338
 		
2339
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2339
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2340 2340
 		{
2341 2341
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
2342 2342
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
@@ -2357,7 +2357,7 @@  discard block
 block discarded – undo
2357 2357
 	*/
2358 2358
 	public function getAllAircraftRegistrations()
2359 2359
 	{
2360
-		$query  = "SELECT DISTINCT spotter_output.registration 
2360
+		$query = "SELECT DISTINCT spotter_output.registration 
2361 2361
 				FROM spotter_output  
2362 2362
 				WHERE spotter_output.registration <> '' 
2363 2363
 				ORDER BY spotter_output.registration ASC";
@@ -2368,7 +2368,7 @@  discard block
 block discarded – undo
2368 2368
 		$aircraft_array = array();
2369 2369
 		$temp_array = array();
2370 2370
 		
2371
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2371
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2372 2372
 		{
2373 2373
 			$temp_array['registration'] = $row['registration'];
2374 2374
 
@@ -2388,7 +2388,7 @@  discard block
 block discarded – undo
2388 2388
 	public function getAllSourceName($type = '')
2389 2389
 	{
2390 2390
 		$query_values = array();
2391
-		$query  = "SELECT DISTINCT spotter_output.source_name 
2391
+		$query = "SELECT DISTINCT spotter_output.source_name 
2392 2392
 				FROM spotter_output  
2393 2393
 				WHERE spotter_output.source_name <> ''";
2394 2394
 		if ($type != '') {
@@ -2404,7 +2404,7 @@  discard block
 block discarded – undo
2404 2404
 		$source_array = array();
2405 2405
 		$temp_array = array();
2406 2406
 		
2407
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2407
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2408 2408
 		{
2409 2409
 			$temp_array['source_name'] = $row['source_name'];
2410 2410
 			$source_array[] = $temp_array;
@@ -2420,10 +2420,10 @@  discard block
 block discarded – undo
2420 2420
 	* @return Array list of airline names
2421 2421
 	*
2422 2422
 	*/
2423
-	public function getAllAirlineNames($airline_type = '',$forsource = NULL)
2423
+	public function getAllAirlineNames($airline_type = '', $forsource = NULL)
2424 2424
 	{
2425
-		global $globalAirlinesSource,$globalVATSIM, $globalIVAO;
2426
-		$airline_type = filter_var($airline_type,FILTER_SANITIZE_STRING);
2425
+		global $globalAirlinesSource, $globalVATSIM, $globalIVAO;
2426
+		$airline_type = filter_var($airline_type, FILTER_SANITIZE_STRING);
2427 2427
 		if ($airline_type == '' || $airline_type == 'all') {
2428 2428
 			/*
2429 2429
 			$query  = "SELECT DISTINCT spotter_output.airline_icao AS airline_icao, spotter_output.airline_name AS airline_name, spotter_output.airline_type AS airline_type
@@ -2442,7 +2442,7 @@  discard block
 block discarded – undo
2442 2442
 				$query_data = array(':forsource' => $forsource);
2443 2443
 			}
2444 2444
 		} else {
2445
-			$query  = "SELECT DISTINCT spotter_output.airline_icao AS airline_icao, spotter_output.airline_name AS airline_name, spotter_output.airline_type AS airline_type
2445
+			$query = "SELECT DISTINCT spotter_output.airline_icao AS airline_icao, spotter_output.airline_name AS airline_name, spotter_output.airline_type AS airline_type
2446 2446
 					FROM spotter_output
2447 2447
 					WHERE spotter_output.airline_icao <> '' 
2448 2448
 					AND spotter_output.airline_type = :airline_type 
@@ -2456,7 +2456,7 @@  discard block
 block discarded – undo
2456 2456
 		$airline_array = array();
2457 2457
 		$temp_array = array();
2458 2458
 		
2459
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2459
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2460 2460
 		{
2461 2461
 			$temp_array['airline_icao'] = $row['airline_icao'];
2462 2462
 			$temp_array['airline_name'] = $row['airline_name'];
@@ -2477,7 +2477,7 @@  discard block
 block discarded – undo
2477 2477
 	public function getAllAirlineCountries()
2478 2478
 	{
2479 2479
 		
2480
-		$query  = "SELECT DISTINCT spotter_output.airline_country AS airline_country
2480
+		$query = "SELECT DISTINCT spotter_output.airline_country AS airline_country
2481 2481
 				FROM spotter_output  
2482 2482
 				WHERE spotter_output.airline_country <> '' 
2483 2483
 				ORDER BY spotter_output.airline_country ASC";
@@ -2489,7 +2489,7 @@  discard block
 block discarded – undo
2489 2489
 		$airline_array = array();
2490 2490
 		$temp_array = array();
2491 2491
 		
2492
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2492
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2493 2493
 		{
2494 2494
 			$temp_array['airline_country'] = $row['airline_country'];
2495 2495
 
@@ -2511,7 +2511,7 @@  discard block
 block discarded – undo
2511 2511
 	{
2512 2512
 		$airport_array = array();
2513 2513
 
2514
-		$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
2514
+		$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
2515 2515
 				FROM spotter_output 
2516 2516
 				WHERE spotter_output.departure_airport_icao <> '' AND spotter_output.departure_airport_icao <> 'NA' 
2517 2517
 				ORDER BY spotter_output.departure_airport_city ASC";
@@ -2521,7 +2521,7 @@  discard block
 block discarded – undo
2521 2521
 		$sth->execute();
2522 2522
 
2523 2523
 		$temp_array = array();
2524
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2524
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2525 2525
 		{
2526 2526
 			$temp_array['airport_icao'] = $row['airport_icao'];
2527 2527
 			$temp_array['airport_name'] = $row['airport_name'];
@@ -2531,7 +2531,7 @@  discard block
 block discarded – undo
2531 2531
 			$airport_array[$row['airport_city'].",".$row['airport_name']] = $temp_array;
2532 2532
 		}
2533 2533
 
2534
-		$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
2534
+		$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
2535 2535
 								FROM spotter_output 
2536 2536
 								WHERE spotter_output.arrival_airport_icao <> '' AND spotter_output.arrival_airport_icao <> 'NA' 
2537 2537
 								ORDER BY spotter_output.arrival_airport_city ASC";
@@ -2539,7 +2539,7 @@  discard block
 block discarded – undo
2539 2539
 		$sth = $this->db->prepare($query);
2540 2540
 		$sth->execute();
2541 2541
 
2542
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2542
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2543 2543
 			{
2544 2544
 		//	if ($airport_array[$row['airport_city'].",".$row['airport_name']]['airport_icao'] != $row['airport_icao'])
2545 2545
 		//	{
@@ -2579,14 +2579,14 @@  discard block
 block discarded – undo
2579 2579
    
2580 2580
 		$temp_array = array();
2581 2581
 		
2582
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2582
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2583 2583
 		{
2584 2584
 			$temp_array['airport_country'] = $row['airport_country'];
2585 2585
 
2586 2586
 			$airport_array[$row['airport_country']] = $temp_array;
2587 2587
 		}
2588 2588
 								
2589
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country
2589
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country
2590 2590
 								FROM spotter_output
2591 2591
 								WHERE spotter_output.arrival_airport_country <> '' 
2592 2592
 								ORDER BY spotter_output.arrival_airport_country ASC";
@@ -2594,7 +2594,7 @@  discard block
 block discarded – undo
2594 2594
 		$sth = $this->db->prepare($query);
2595 2595
 		$sth->execute();
2596 2596
 		
2597
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2597
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2598 2598
 		{
2599 2599
 			if (isset($airport_array[$row['airport_country']]['airport_country']) && $airport_array[$row['airport_country']]['airport_country'] != $row['airport_country'])
2600 2600
 			{
@@ -2617,9 +2617,9 @@  discard block
 block discarded – undo
2617 2617
 	*/
2618 2618
 	public function getAllCountries()
2619 2619
 	{
2620
-		$Connection= new Connection($this->db);
2620
+		$Connection = new Connection($this->db);
2621 2621
 		if ($Connection->tableExists('countries')) {
2622
-			$query  = "SELECT countries.name AS airport_country
2622
+			$query = "SELECT countries.name AS airport_country
2623 2623
 				FROM countries
2624 2624
 				ORDER BY countries.name ASC";
2625 2625
 			$sth = $this->db->prepare($query);
@@ -2628,13 +2628,13 @@  discard block
 block discarded – undo
2628 2628
 			$temp_array = array();
2629 2629
 			$country_array = array();
2630 2630
 		
2631
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
2631
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2632 2632
 			{
2633 2633
 				$temp_array['country'] = $row['airport_country'];
2634 2634
 				$country_array[$row['airport_country']] = $temp_array;
2635 2635
 			}
2636 2636
 		} else {
2637
-			$query  = "SELECT DISTINCT spotter_output.departure_airport_country AS airport_country
2637
+			$query = "SELECT DISTINCT spotter_output.departure_airport_country AS airport_country
2638 2638
 								FROM spotter_output
2639 2639
 								WHERE spotter_output.departure_airport_country <> '' 
2640 2640
 								ORDER BY spotter_output.departure_airport_country ASC";
@@ -2644,13 +2644,13 @@  discard block
 block discarded – undo
2644 2644
    
2645 2645
 			$temp_array = array();
2646 2646
 			$country_array = array();
2647
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
2647
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2648 2648
 			{
2649 2649
 				$temp_array['country'] = $row['airport_country'];
2650 2650
 				$country_array[$row['airport_country']] = $temp_array;
2651 2651
 			}
2652 2652
 
2653
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country
2653
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country
2654 2654
 								FROM spotter_output
2655 2655
 								WHERE spotter_output.arrival_airport_country <> '' 
2656 2656
 								ORDER BY spotter_output.arrival_airport_country ASC";
@@ -2658,7 +2658,7 @@  discard block
 block discarded – undo
2658 2658
 		$sth = $this->db->prepare($query);
2659 2659
 		$sth->execute();
2660 2660
 		
2661
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2661
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2662 2662
 		{
2663 2663
 			if ($country_array[$row['airport_country']]['country'] != $row['airport_country'])
2664 2664
 			{
@@ -2668,7 +2668,7 @@  discard block
 block discarded – undo
2668 2668
 			}
2669 2669
 		}
2670 2670
 		
2671
-		$query  = "SELECT DISTINCT spotter_output.airline_country AS airline_country
2671
+		$query = "SELECT DISTINCT spotter_output.airline_country AS airline_country
2672 2672
 								FROM spotter_output  
2673 2673
 								WHERE spotter_output.airline_country <> '' 
2674 2674
 								ORDER BY spotter_output.airline_country ASC";
@@ -2676,7 +2676,7 @@  discard block
 block discarded – undo
2676 2676
 		$sth = $this->db->prepare($query);
2677 2677
 		$sth->execute();
2678 2678
 		
2679
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2679
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2680 2680
 		{
2681 2681
 			if (isset($country_array[$row['airline_country']]['country']) && $country_array[$row['airline_country']]['country'] != $row['airline_country'])
2682 2682
 			{
@@ -2700,7 +2700,7 @@  discard block
 block discarded – undo
2700 2700
 	*/
2701 2701
 	public function getAllIdents()
2702 2702
 	{
2703
-		$query  = "SELECT DISTINCT spotter_output.ident
2703
+		$query = "SELECT DISTINCT spotter_output.ident
2704 2704
 								FROM spotter_output
2705 2705
 								WHERE spotter_output.ident <> '' 
2706 2706
 								ORDER BY spotter_output.date ASC LIMIT 700 OFFSET 0";
@@ -2711,7 +2711,7 @@  discard block
 block discarded – undo
2711 2711
 		$ident_array = array();
2712 2712
 		$temp_array = array();
2713 2713
 		
2714
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2714
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2715 2715
 		{
2716 2716
 			$temp_array['ident'] = $row['ident'];
2717 2717
 			$ident_array[] = $temp_array;
@@ -3047,12 +3047,12 @@  discard block
 block discarded – undo
3047 3047
 		} else $offset = '+00:00';
3048 3048
 
3049 3049
 		if ($globalDBdriver == 'mysql') {
3050
-			$query  = "SELECT DISTINCT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) as date
3050
+			$query = "SELECT DISTINCT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) as date
3051 3051
 								FROM spotter_output
3052 3052
 								WHERE spotter_output.date <> '' 
3053 3053
 								ORDER BY spotter_output.date ASC LIMIT 0,200";
3054 3054
 		} else {
3055
-			$query  = "SELECT DISTINCT to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') as date
3055
+			$query = "SELECT DISTINCT to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') as date
3056 3056
 								FROM spotter_output
3057 3057
 								WHERE spotter_output.date <> '' 
3058 3058
 								ORDER BY spotter_output.date ASC LIMIT 0,200";
@@ -3064,7 +3064,7 @@  discard block
 block discarded – undo
3064 3064
 		$date_array = array();
3065 3065
 		$temp_array = array();
3066 3066
 		
3067
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3067
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3068 3068
 		{
3069 3069
 			$temp_array['date'] = $row['date'];
3070 3070
 
@@ -3084,7 +3084,7 @@  discard block
 block discarded – undo
3084 3084
 	*/
3085 3085
 	public function getAllRoutes()
3086 3086
 	{
3087
-		$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 
3087
+		$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 
3088 3088
 				FROM spotter_output
3089 3089
 				WHERE spotter_output.ident <> '' 
3090 3090
 				GROUP BY route
@@ -3095,7 +3095,7 @@  discard block
 block discarded – undo
3095 3095
 
3096 3096
 		$routes_array = array();
3097 3097
 		$temp_array = array();
3098
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3098
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3099 3099
 		{
3100 3100
 			$temp_array['route'] = $row['route'];
3101 3101
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -3114,21 +3114,21 @@  discard block
 block discarded – undo
3114 3114
 	* @return String success or false
3115 3115
 	*
3116 3116
 	*/	
3117
-	public function updateIdentSpotterData($flightaware_id = '', $ident = '',$fromsource = NULL)
3117
+	public function updateIdentSpotterData($flightaware_id = '', $ident = '', $fromsource = NULL)
3118 3118
 	{
3119 3119
 		if (!is_numeric(substr($ident, 0, 3)))
3120 3120
 		{
3121 3121
 			if (is_numeric(substr(substr($ident, 0, 3), -1, 1))) {
3122
-				$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2),$fromsource);
3122
+				$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2), $fromsource);
3123 3123
 			} elseif (is_numeric(substr(substr($ident, 0, 4), -1, 1))) {
3124
-				$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3),$fromsource);
3124
+				$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3), $fromsource);
3125 3125
 			} else {
3126 3126
 				$airline_array = $this->getAllAirlineInfo("NA");
3127 3127
 			}
3128 3128
 			if (count($airline_array) == 0) {
3129 3129
 				$airline_array = $this->getAllAirlineInfo("NA");
3130 3130
 			}
3131
-			if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == ""){
3131
+			if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == "") {
3132 3132
 				$airline_array = $this->getAllAirlineInfo("NA");
3133 3133
 			}
3134 3134
 		} else {
@@ -3141,7 +3141,7 @@  discard block
 block discarded – undo
3141 3141
 
3142 3142
 
3143 3143
 		$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';
3144
-                $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);
3144
+                $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);
3145 3145
 
3146 3146
 		try {
3147 3147
 			$sth = $this->db->prepare($query);
@@ -3162,11 +3162,11 @@  discard block
 block discarded – undo
3162 3162
 	* @return String success or false
3163 3163
 	*
3164 3164
 	*/	
3165
-	public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '',$arrival_airport_time = '')
3165
+	public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '', $arrival_airport_time = '')
3166 3166
 	{
3167 3167
 		if ($groundspeed == '') $groundspeed = NULL;
3168 3168
 		$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';
3169
-                $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);
3169
+                $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);
3170 3170
 
3171 3171
 		try {
3172 3172
 			$sth = $this->db->prepare($query);
@@ -3206,7 +3206,7 @@  discard block
 block discarded – undo
3206 3206
 	* @param String $verticalrate vertival rate of flight
3207 3207
 	* @return String success or false
3208 3208
 	*/
3209
-	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 = '')
3209
+	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 = '')
3210 3210
 	{
3211 3211
 		global $globalURL, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalDebugTimeElapsed, $globalAirlinesSource, $globalVAM;
3212 3212
 		
@@ -3230,13 +3230,13 @@  discard block
 block discarded – undo
3230 3230
 				if ($ModeS != '') {
3231 3231
 					$timeelapsed = microtime(true);
3232 3232
 					$registration = $this->getAircraftRegistrationBymodeS($ModeS);
3233
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3233
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3234 3234
 				} else {
3235
-					$myhex = explode('-',$flightaware_id);
3235
+					$myhex = explode('-', $flightaware_id);
3236 3236
 					if (count($myhex) > 0) {
3237 3237
 						$timeelapsed = microtime(true);
3238 3238
 						$registration = $this->getAircraftRegistrationBymodeS($myhex[0]);
3239
-						if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3239
+						if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3240 3240
 					}
3241 3241
 				}
3242 3242
 			}
@@ -3258,24 +3258,24 @@  discard block
 block discarded – undo
3258 3258
 				{
3259 3259
 					$timeelapsed = microtime(true);
3260 3260
 					if (is_numeric(substr(substr($ident, 0, 3), -1, 1))) {
3261
-						$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2),$fromsource);
3261
+						$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2), $fromsource);
3262 3262
 					} elseif (is_numeric(substr(substr($ident, 0, 4), -1, 1))) {
3263
-						$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3),$fromsource);
3263
+						$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3), $fromsource);
3264 3264
 					} else {
3265 3265
 						$airline_array = $this->getAllAirlineInfo("NA");
3266 3266
 					}
3267 3267
 					if (count($airline_array) == 0) {
3268 3268
 						$airline_array = $this->getAllAirlineInfo("NA");
3269 3269
 					}
3270
-					if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == ""){
3270
+					if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == "") {
3271 3271
 						$airline_array = $this->getAllAirlineInfo("NA");
3272 3272
 					}
3273
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3273
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3274 3274
 
3275 3275
 				} else {
3276 3276
 					$timeelapsed = microtime(true);
3277 3277
 					$airline_array = $this->getAllAirlineInfo("NA");
3278
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3278
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3279 3279
 				}
3280 3280
 			}
3281 3281
 		} else $airline_array = array();
@@ -3292,27 +3292,27 @@  discard block
 block discarded – undo
3292 3292
 				{
3293 3293
 					$timeelapsed = microtime(true);
3294 3294
 					$aircraft_array = $this->getAllAircraftInfo("NA");
3295
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3295
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3296 3296
 				} else {
3297 3297
 					$timeelapsed = microtime(true);
3298 3298
 					$aircraft_array = $this->getAllAircraftInfo($aircraft_icao);
3299
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3299
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3300 3300
 				}
3301 3301
 			}
3302 3302
 		} else {
3303 3303
 			if ($ModeS != '') {
3304 3304
 				$timeelapsed = microtime(true);
3305 3305
 				$aircraft_icao = $this->getAllAircraftType($ModeS);
3306
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3306
+				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3307 3307
 				if ($aircraft_icao == "" || $aircraft_icao == "XXXX")
3308 3308
 				{
3309 3309
 					$timeelapsed = microtime(true);
3310 3310
 					$aircraft_array = $this->getAllAircraftInfo("NA");
3311
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3311
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3312 3312
 				} else {
3313 3313
 					$timeelapsed = microtime(true);
3314 3314
 					$aircraft_array = $this->getAllAircraftInfo($aircraft_icao);
3315
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3315
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3316 3316
 				}
3317 3317
 			}
3318 3318
 		}
@@ -3327,7 +3327,7 @@  discard block
 block discarded – undo
3327 3327
 			} else {
3328 3328
 				$timeelapsed = microtime(true);
3329 3329
 				$departure_airport_array = $this->getAllAirportInfo($departure_airport_icao);
3330
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3330
+				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3331 3331
 			}
3332 3332
 		}
3333 3333
 		
@@ -3341,7 +3341,7 @@  discard block
 block discarded – undo
3341 3341
 			} else {
3342 3342
 				$timeelapsed = microtime(true);
3343 3343
 				$arrival_airport_array = $this->getAllAirportInfo($arrival_airport_icao);
3344
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3344
+				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3345 3345
 			}
3346 3346
 		}
3347 3347
 
@@ -3405,7 +3405,7 @@  discard block
 block discarded – undo
3405 3405
 		{
3406 3406
 			$timeelapsed = microtime(true);
3407 3407
 			$image_array = $Image->getSpotterImage($registration);
3408
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3408
+			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3409 3409
 			if (!isset($image_array[0]['registration']))
3410 3410
 			{
3411 3411
 				//echo "Add image !!!! \n";
@@ -3413,7 +3413,7 @@  discard block
 block discarded – undo
3413 3413
 			}
3414 3414
 			$timeelapsed = microtime(true);
3415 3415
 			$owner_info = $this->getAircraftOwnerByRegistration($registration);
3416
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3416
+			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3417 3417
 			if ($owner_info['owner'] != '') $aircraft_owner = ucwords(strtolower($owner_info['owner']));
3418 3418
 		}
3419 3419
     
@@ -3421,33 +3421,33 @@  discard block
 block discarded – undo
3421 3421
 		{
3422 3422
             		if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao'];
3423 3423
             		else $airline_icao = '';
3424
-			$image_array = $Image->getSpotterImage('',$aircraft_icao,$airline_icao);
3424
+			$image_array = $Image->getSpotterImage('', $aircraft_icao, $airline_icao);
3425 3425
 			if (!isset($image_array[0]['registration']))
3426 3426
 			{
3427 3427
 				//echo "Add image !!!! \n";
3428
-				$Image->addSpotterImage('',$aircraft_icao,$airline_icao);
3428
+				$Image->addSpotterImage('', $aircraft_icao, $airline_icao);
3429 3429
 			}
3430 3430
 		}
3431 3431
     
3432
-		$flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING);
3433
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
3434
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
3435
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
3436
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
3437
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
3438
-		$latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
3439
-		$longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
3440
-		$waypoints = filter_var($waypoints,FILTER_SANITIZE_STRING);
3441
-		$altitude = filter_var($altitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
3442
-		$heading = filter_var($heading,FILTER_SANITIZE_NUMBER_INT);
3443
-		$groundspeed = filter_var($groundspeed,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
3444
-		$squawk = filter_var($squawk,FILTER_SANITIZE_NUMBER_INT);
3445
-		$route_stop = filter_var($route_stop,FILTER_SANITIZE_STRING);
3446
-		$ModeS = filter_var($ModeS,FILTER_SANITIZE_STRING);
3447
-		$pilot_id = filter_var($pilot_id,FILTER_SANITIZE_STRING);
3448
-		$pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING);
3449
-		$format_source = filter_var($format_source,FILTER_SANITIZE_STRING);
3450
-		$verticalrate = filter_var($verticalrate,FILTER_SANITIZE_NUMBER_INT);
3432
+		$flightaware_id = filter_var($flightaware_id, FILTER_SANITIZE_STRING);
3433
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
3434
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
3435
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
3436
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
3437
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
3438
+		$latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
3439
+		$longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
3440
+		$waypoints = filter_var($waypoints, FILTER_SANITIZE_STRING);
3441
+		$altitude = filter_var($altitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
3442
+		$heading = filter_var($heading, FILTER_SANITIZE_NUMBER_INT);
3443
+		$groundspeed = filter_var($groundspeed, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
3444
+		$squawk = filter_var($squawk, FILTER_SANITIZE_NUMBER_INT);
3445
+		$route_stop = filter_var($route_stop, FILTER_SANITIZE_STRING);
3446
+		$ModeS = filter_var($ModeS, FILTER_SANITIZE_STRING);
3447
+		$pilot_id = filter_var($pilot_id, FILTER_SANITIZE_STRING);
3448
+		$pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING);
3449
+		$format_source = filter_var($format_source, FILTER_SANITIZE_STRING);
3450
+		$verticalrate = filter_var($verticalrate, FILTER_SANITIZE_NUMBER_INT);
3451 3451
 	
3452 3452
 		if (count($airline_array) == 0) 
3453 3453
 		{
@@ -3471,7 +3471,7 @@  discard block
 block discarded – undo
3471 3471
                 if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
3472 3472
                 if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
3473 3473
                 if (!isset($aircraft_owner)) $aircraft_owner = NULL;
3474
-                $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) 
3474
+                $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) 
3475 3475
                 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)";
3476 3476
 
3477 3477
                 $airline_name = $airline_array[0]['name'];
@@ -3481,7 +3481,7 @@  discard block
 block discarded – undo
3481 3481
 		if ($airline_type == '') {
3482 3482
 			$timeelapsed = microtime(true);
3483 3483
 			$airline_type = $this->getAircraftTypeBymodeS($ModeS);
3484
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3484
+			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3485 3485
 		}
3486 3486
 		if ($airline_type == null) $airline_type = '';
3487 3487
                 $aircraft_type = $aircraft_array[0]['type'];
@@ -3492,7 +3492,7 @@  discard block
 block discarded – undo
3492 3492
                 $arrival_airport_name = $arrival_airport_array[0]['name'];
3493 3493
                 $arrival_airport_city = $arrival_airport_array[0]['city'];
3494 3494
                 $arrival_airport_country = $arrival_airport_array[0]['country'];
3495
-                $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);
3495
+                $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);
3496 3496
 
3497 3497
 		try {
3498 3498
 		        
@@ -3518,13 +3518,13 @@  discard block
 block discarded – undo
3518 3518
 	{
3519 3519
 		global $globalDBdriver, $globalTimezone;
3520 3520
 		if ($globalDBdriver == 'mysql') {
3521
-			$query  = "SELECT spotter_output.ident FROM spotter_output 
3521
+			$query = "SELECT spotter_output.ident FROM spotter_output 
3522 3522
 								WHERE spotter_output.ident = :ident 
3523 3523
 								AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) 
3524 3524
 								AND spotter_output.date < UTC_TIMESTAMP()";
3525 3525
 			$query_data = array(':ident' => $ident);
3526 3526
 		} else {
3527
-			$query  = "SELECT spotter_output.ident FROM spotter_output 
3527
+			$query = "SELECT spotter_output.ident FROM spotter_output 
3528 3528
 								WHERE spotter_output.ident = :ident 
3529 3529
 								AND spotter_output.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS'
3530 3530
 								AND spotter_output.date < now() AT TIME ZONE 'UTC'";
@@ -3533,8 +3533,8 @@  discard block
 block discarded – undo
3533 3533
 		
3534 3534
 		$sth = $this->db->prepare($query);
3535 3535
 		$sth->execute($query_data);
3536
-    		$ident_result='';
3537
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3536
+    		$ident_result = '';
3537
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3538 3538
 		{
3539 3539
 			$ident_result = $row['ident'];
3540 3540
 		}
@@ -3560,8 +3560,8 @@  discard block
 block discarded – undo
3560 3560
 				return false;
3561 3561
 			} else {
3562 3562
 				$q_array = explode(" ", $q);
3563
-				foreach ($q_array as $q_item){
3564
-					$q_item = filter_var($q_item,FILTER_SANITIZE_STRING);
3563
+				foreach ($q_array as $q_item) {
3564
+					$q_item = filter_var($q_item, FILTER_SANITIZE_STRING);
3565 3565
 					$additional_query .= " AND (";
3566 3566
 					$additional_query .= "(spotter_output.aircraft_icao like '%".$q_item."%') OR ";
3567 3567
 					$additional_query .= "(spotter_output.aircraft_name like '%".$q_item."%') OR ";
@@ -3576,11 +3576,11 @@  discard block
 block discarded – undo
3576 3576
 			}
3577 3577
 		}
3578 3578
 		if ($globalDBdriver == 'mysql') {
3579
-			$query  = "SELECT spotter_output.* FROM spotter_output 
3579
+			$query = "SELECT spotter_output.* FROM spotter_output 
3580 3580
 				WHERE spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 20 SECOND) ".$additional_query." 
3581 3581
 				AND spotter_output.date < UTC_TIMESTAMP()";
3582 3582
 		} else {
3583
-			$query  = "SELECT spotter_output.* FROM spotter_output 
3583
+			$query = "SELECT spotter_output.* FROM spotter_output 
3584 3584
 				WHERE spotter_output.date::timestamp >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '20 SECONDS' ".$additional_query." 
3585 3585
 				AND spotter_output.date::timestamp < CURRENT_TIMESTAMP AT TIME ZONE 'UTC'";
3586 3586
 		}
@@ -3600,7 +3600,7 @@  discard block
 block discarded – undo
3600 3600
 	public function countAllAirlines($limit = true, $olderthanmonths = 0, $sincedate = '')
3601 3601
 	{
3602 3602
 		global $globalDBdriver;
3603
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
3603
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
3604 3604
 		 			FROM spotter_output
3605 3605
 					WHERE spotter_output.airline_name <> '' AND spotter_output.airline_icao <> 'NA' ";
3606 3606
 		if ($olderthanmonths > 0) {
@@ -3625,7 +3625,7 @@  discard block
 block discarded – undo
3625 3625
  
3626 3626
 		$airline_array = array();
3627 3627
 		$temp_array = array();
3628
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3628
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3629 3629
 		{
3630 3630
 			$temp_array['airline_name'] = $row['airline_name'];
3631 3631
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -3642,11 +3642,11 @@  discard block
 block discarded – undo
3642 3642
 	* @return Array the pilots list
3643 3643
 	*
3644 3644
 	*/
3645
-	public function countAllPilots($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
3645
+	public function countAllPilots($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
3646 3646
 	{
3647 3647
 		global $globalDBdriver;
3648
-		$filter_query = $this->getFilter($filters,true,true);
3649
-		$query  = "SELECT DISTINCT spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count
3648
+		$filter_query = $this->getFilter($filters, true, true);
3649
+		$query = "SELECT DISTINCT spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count
3650 3650
 		 			FROM spotter_output".$filter_query." spotter_output.pilot_id <> '' ";
3651 3651
                 if ($olderthanmonths > 0) {
3652 3652
             		if ($globalDBdriver == 'mysql') {
@@ -3672,7 +3672,7 @@  discard block
 block discarded – undo
3672 3672
 		$airline_array = array();
3673 3673
 		$temp_array = array();
3674 3674
         
3675
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3675
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3676 3676
 		{
3677 3677
 			$temp_array['pilot_name'] = $row['pilot_name'];
3678 3678
 			$temp_array['pilot_id'] = $row['pilot_id'];
@@ -3691,7 +3691,7 @@  discard block
 block discarded – undo
3691 3691
 	public function countAllPilotsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '')
3692 3692
 	{
3693 3693
 		global $globalDBdriver;
3694
-		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count
3694
+		$query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count
3695 3695
 		 			FROM spotter_output WHERE spotter_output.pilot_id <> '' ";
3696 3696
                 if ($olderthanmonths > 0) {
3697 3697
             		if ($globalDBdriver == 'mysql') {
@@ -3717,7 +3717,7 @@  discard block
 block discarded – undo
3717 3717
 		$airline_array = array();
3718 3718
 		$temp_array = array();
3719 3719
         
3720
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3720
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3721 3721
 		{
3722 3722
 			$temp_array['pilot_name'] = $row['pilot_name'];
3723 3723
 			$temp_array['pilot_id'] = $row['pilot_id'];
@@ -3734,11 +3734,11 @@  discard block
 block discarded – undo
3734 3734
 	* @return Array the pilots list
3735 3735
 	*
3736 3736
 	*/
3737
-	public function countAllOwners($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
3737
+	public function countAllOwners($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
3738 3738
 	{
3739 3739
 		global $globalDBdriver;
3740
-		$filter_query = $this->getFilter($filters,true,true);
3741
-		$query  = "SELECT DISTINCT spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
3740
+		$filter_query = $this->getFilter($filters, true, true);
3741
+		$query = "SELECT DISTINCT spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
3742 3742
 		 			FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL ";
3743 3743
                 if ($olderthanmonths > 0) {
3744 3744
             		if ($globalDBdriver == 'mysql') {
@@ -3764,7 +3764,7 @@  discard block
 block discarded – undo
3764 3764
 		$airline_array = array();
3765 3765
 		$temp_array = array();
3766 3766
         
3767
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3767
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3768 3768
 		{
3769 3769
 			$temp_array['owner_name'] = $row['owner_name'];
3770 3770
 			$temp_array['owner_count'] = $row['owner_count'];
@@ -3782,7 +3782,7 @@  discard block
 block discarded – undo
3782 3782
 	public function countAllOwnersByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '')
3783 3783
 	{
3784 3784
 		global $globalDBdriver;
3785
-		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
3785
+		$query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
3786 3786
 		 			FROM spotter_output WHERE spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL ";
3787 3787
                 if ($olderthanmonths > 0) {
3788 3788
             		if ($globalDBdriver == 'mysql') {
@@ -3808,7 +3808,7 @@  discard block
 block discarded – undo
3808 3808
 		$airline_array = array();
3809 3809
 		$temp_array = array();
3810 3810
         
3811
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3811
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3812 3812
 		{
3813 3813
 			$temp_array['owner_name'] = $row['owner_name'];
3814 3814
 			$temp_array['owner_count'] = $row['owner_count'];
@@ -3826,9 +3826,9 @@  discard block
 block discarded – undo
3826 3826
 	*/
3827 3827
 	public function countAllAirlinesByAircraft($aircraft_icao)
3828 3828
 	{
3829
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
3829
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
3830 3830
 
3831
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
3831
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
3832 3832
 		 			FROM spotter_output
3833 3833
 					WHERE spotter_output.airline_name <> '' AND spotter_output.aircraft_icao = :aircraft_icao 
3834 3834
                     GROUP BY spotter_output.airline_name
@@ -3841,7 +3841,7 @@  discard block
 block discarded – undo
3841 3841
 		$airline_array = array();
3842 3842
 		$temp_array = array();
3843 3843
         
3844
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3844
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3845 3845
 		{
3846 3846
 			$temp_array['airline_name'] = $row['airline_name'];
3847 3847
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -3863,9 +3863,9 @@  discard block
 block discarded – undo
3863 3863
 	*/
3864 3864
 	public function countAllAirlineCountriesByAircraft($aircraft_icao)
3865 3865
 	{
3866
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
3866
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
3867 3867
       
3868
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
3868
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
3869 3869
 		 			FROM spotter_output
3870 3870
 					WHERE spotter_output.airline_country <> '' AND spotter_output.aircraft_icao = :aircraft_icao
3871 3871
                     GROUP BY spotter_output.airline_country
@@ -3879,7 +3879,7 @@  discard block
 block discarded – undo
3879 3879
 		$airline_country_array = array();
3880 3880
 		$temp_array = array();
3881 3881
         
3882
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3882
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3883 3883
 		{
3884 3884
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
3885 3885
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -3900,9 +3900,9 @@  discard block
 block discarded – undo
3900 3900
 	*/
3901 3901
 	public function countAllAirlinesByAirport($airport_icao)
3902 3902
 	{
3903
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
3903
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
3904 3904
 
3905
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
3905
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
3906 3906
 		 			FROM spotter_output
3907 3907
 					WHERE spotter_output.airline_name <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao ) 
3908 3908
                     GROUP BY spotter_output.airline_name
@@ -3915,7 +3915,7 @@  discard block
 block discarded – undo
3915 3915
 		$airline_array = array();
3916 3916
 		$temp_array = array();
3917 3917
         
3918
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3918
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3919 3919
 		{
3920 3920
 			$temp_array['airline_name'] = $row['airline_name'];
3921 3921
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -3936,9 +3936,9 @@  discard block
 block discarded – undo
3936 3936
 	*/
3937 3937
 	public function countAllAirlineCountriesByAirport($airport_icao)
3938 3938
 	{
3939
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
3939
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
3940 3940
       
3941
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
3941
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
3942 3942
 		 			FROM spotter_output
3943 3943
 					WHERE spotter_output.airline_country <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao )
3944 3944
 					GROUP BY spotter_output.airline_country
@@ -3952,7 +3952,7 @@  discard block
 block discarded – undo
3952 3952
 		$airline_country_array = array();
3953 3953
 		$temp_array = array();
3954 3954
         
3955
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3955
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3956 3956
 		{
3957 3957
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
3958 3958
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -3971,9 +3971,9 @@  discard block
 block discarded – undo
3971 3971
 	*/
3972 3972
 	public function countAllAirlinesByManufacturer($aircraft_manufacturer)
3973 3973
 	{
3974
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
3974
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
3975 3975
 
3976
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
3976
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
3977 3977
 		 			FROM spotter_output
3978 3978
 					WHERE spotter_output.aircraft_manufacturer = :aircraft_manufacturer 
3979 3979
 					GROUP BY spotter_output.airline_name
@@ -3985,7 +3985,7 @@  discard block
 block discarded – undo
3985 3985
 		$airline_array = array();
3986 3986
 		$temp_array = array();
3987 3987
         
3988
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3988
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3989 3989
 		{
3990 3990
 			$temp_array['airline_name'] = $row['airline_name'];
3991 3991
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4007,9 +4007,9 @@  discard block
 block discarded – undo
4007 4007
 	*/
4008 4008
 	public function countAllAirlineCountriesByManufacturer($aircraft_manufacturer)
4009 4009
 	{
4010
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
4010
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
4011 4011
       
4012
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4012
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4013 4013
 		 			FROM spotter_output
4014 4014
 					WHERE spotter_output.airline_country <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer 
4015 4015
 					GROUP BY spotter_output.airline_country
@@ -4023,7 +4023,7 @@  discard block
 block discarded – undo
4023 4023
 		$airline_country_array = array();
4024 4024
 		$temp_array = array();
4025 4025
         
4026
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4026
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4027 4027
 		{
4028 4028
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4029 4029
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4042,7 +4042,7 @@  discard block
 block discarded – undo
4042 4042
 	public function countAllAirlinesByDate($date)
4043 4043
 	{
4044 4044
 		global $globalTimezone, $globalDBdriver;
4045
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
4045
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
4046 4046
 
4047 4047
 		if ($globalTimezone != '') {
4048 4048
 			date_default_timezone_set($globalTimezone);
@@ -4051,13 +4051,13 @@  discard block
 block discarded – undo
4051 4051
 		} else $offset = '+00:00';
4052 4052
 
4053 4053
 		if ($globalDBdriver == 'mysql') {
4054
-			$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4054
+			$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4055 4055
 		 			FROM spotter_output
4056 4056
 					WHERE DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
4057 4057
 					GROUP BY spotter_output.airline_name
4058 4058
 					ORDER BY airline_count DESC";
4059 4059
 		} else {
4060
-			$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4060
+			$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4061 4061
 		 			FROM spotter_output
4062 4062
 					WHERE to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date 
4063 4063
 					GROUP BY spotter_output.airline_name
@@ -4069,7 +4069,7 @@  discard block
 block discarded – undo
4069 4069
 
4070 4070
 		$airline_array = array();
4071 4071
 		$temp_array = array();
4072
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4072
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4073 4073
 		{
4074 4074
 			$temp_array['airline_name'] = $row['airline_name'];
4075 4075
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4092,7 +4092,7 @@  discard block
 block discarded – undo
4092 4092
 	public function countAllAirlineCountriesByDate($date)
4093 4093
 	{
4094 4094
 		global $globalTimezone, $globalDBdriver;
4095
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
4095
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
4096 4096
 		if ($globalTimezone != '') {
4097 4097
 			date_default_timezone_set($globalTimezone);
4098 4098
 			$datetime = new DateTime($date);
@@ -4100,14 +4100,14 @@  discard block
 block discarded – undo
4100 4100
 		} else $offset = '+00:00';
4101 4101
 		
4102 4102
 		if ($globalDBdriver == 'mysql') {
4103
-			$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4103
+			$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4104 4104
 		 			FROM spotter_output
4105 4105
 					WHERE spotter_output.airline_country <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
4106 4106
 					GROUP BY spotter_output.airline_country
4107 4107
 					ORDER BY airline_country_count DESC
4108 4108
 					LIMIT 10 OFFSET 0";
4109 4109
 		} else {
4110
-			$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4110
+			$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4111 4111
 		 			FROM spotter_output
4112 4112
 					WHERE spotter_output.airline_country <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date 
4113 4113
 					GROUP BY spotter_output.airline_country
@@ -4120,7 +4120,7 @@  discard block
 block discarded – undo
4120 4120
  
4121 4121
 		$airline_country_array = array();
4122 4122
 		$temp_array = array();
4123
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4123
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4124 4124
 		{
4125 4125
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4126 4126
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4139,9 +4139,9 @@  discard block
 block discarded – undo
4139 4139
 	*/
4140 4140
 	public function countAllAirlinesByIdent($ident)
4141 4141
 	{
4142
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
4142
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
4143 4143
 
4144
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4144
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4145 4145
 		 		FROM spotter_output
4146 4146
 				WHERE spotter_output.ident = :ident  
4147 4147
 				GROUP BY spotter_output.airline_name
@@ -4154,7 +4154,7 @@  discard block
 block discarded – undo
4154 4154
 		$airline_array = array();
4155 4155
 		$temp_array = array();
4156 4156
         
4157
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4157
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4158 4158
 		{
4159 4159
 			$temp_array['airline_name'] = $row['airline_name'];
4160 4160
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4174,10 +4174,10 @@  discard block
 block discarded – undo
4174 4174
 	*/
4175 4175
 	public function countAllAirlinesByRoute($departure_airport_icao, $arrival_airport_icao)
4176 4176
 	{
4177
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
4178
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
4177
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
4178
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
4179 4179
 
4180
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4180
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4181 4181
 		 			FROM spotter_output
4182 4182
 					WHERE (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao) 
4183 4183
 					GROUP BY spotter_output.airline_name
@@ -4185,12 +4185,12 @@  discard block
 block discarded – undo
4185 4185
       
4186 4186
 		
4187 4187
 		$sth = $this->db->prepare($query);
4188
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao));
4188
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao));
4189 4189
       
4190 4190
 		$airline_array = array();
4191 4191
 		$temp_array = array();
4192 4192
         
4193
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4193
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4194 4194
 		{
4195 4195
 			$temp_array['airline_name'] = $row['airline_name'];
4196 4196
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4210,10 +4210,10 @@  discard block
 block discarded – undo
4210 4210
 	*/
4211 4211
 	public function countAllAirlineCountriesByRoute($departure_airport_icao, $arrival_airport_icao)
4212 4212
 	{
4213
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
4214
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
4213
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
4214
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
4215 4215
       
4216
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4216
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4217 4217
 		 		FROM spotter_output
4218 4218
 				WHERE spotter_output.airline_country <> '' AND (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao) 
4219 4219
 				GROUP BY spotter_output.airline_country
@@ -4222,11 +4222,11 @@  discard block
 block discarded – undo
4222 4222
       
4223 4223
 		
4224 4224
 		$sth = $this->db->prepare($query);
4225
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao));
4225
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao));
4226 4226
       
4227 4227
 		$airline_country_array = array();
4228 4228
 		$temp_array = array();
4229
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4229
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4230 4230
 		{
4231 4231
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4232 4232
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4246,9 +4246,9 @@  discard block
 block discarded – undo
4246 4246
 	*/
4247 4247
 	public function countAllAirlinesByCountry($country)
4248 4248
 	{
4249
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
4249
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
4250 4250
 
4251
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4251
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4252 4252
 		 		FROM spotter_output
4253 4253
 				WHERE ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country  
4254 4254
 				GROUP BY spotter_output.airline_name
@@ -4260,7 +4260,7 @@  discard block
 block discarded – undo
4260 4260
 
4261 4261
 		$airline_array = array();
4262 4262
 		$temp_array = array();
4263
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4263
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4264 4264
 		{
4265 4265
 			$temp_array['airline_name'] = $row['airline_name'];
4266 4266
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4281,9 +4281,9 @@  discard block
 block discarded – undo
4281 4281
 	*/
4282 4282
 	public function countAllAirlineCountriesByCountry($country)
4283 4283
 	{
4284
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
4284
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
4285 4285
       
4286
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4286
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4287 4287
 		 		FROM spotter_output
4288 4288
 				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 
4289 4289
 				GROUP BY spotter_output.airline_country
@@ -4296,7 +4296,7 @@  discard block
 block discarded – undo
4296 4296
 
4297 4297
 		$airline_country_array = array();
4298 4298
 		$temp_array = array();
4299
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4299
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4300 4300
 		{
4301 4301
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4302 4302
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4315,7 +4315,7 @@  discard block
 block discarded – undo
4315 4315
 	*/
4316 4316
 	public function countAllAirlineCountries($limit = true)
4317 4317
 	{
4318
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4318
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4319 4319
 		 			FROM spotter_output
4320 4320
 					WHERE spotter_output.airline_country <> '' AND spotter_output.airline_country <> 'NA' 
4321 4321
 					GROUP BY spotter_output.airline_country
@@ -4327,7 +4327,7 @@  discard block
 block discarded – undo
4327 4327
 
4328 4328
 		$airline_array = array();
4329 4329
 		$temp_array = array();
4330
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4330
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4331 4331
 		{
4332 4332
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4333 4333
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4343,10 +4343,10 @@  discard block
 block discarded – undo
4343 4343
 	* @return Array the airline country list
4344 4344
 	*
4345 4345
 	*/
4346
-	public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '')
4346
+	public function countAllFlightOverCountries($limit = true, $olderthanmonths = 0, $sincedate = '')
4347 4347
 	{
4348 4348
 		global $globalDBdriver;
4349
-		$Connection= new Connection($this->db);
4349
+		$Connection = new Connection($this->db);
4350 4350
 		if (!$Connection->tableExists('countries')) return array();
4351 4351
 		/*
4352 4352
 		$query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb 
@@ -4381,7 +4381,7 @@  discard block
 block discarded – undo
4381 4381
 		$flight_array = array();
4382 4382
 		$temp_array = array();
4383 4383
         
4384
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4384
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4385 4385
 		{
4386 4386
 			$temp_array['flight_count'] = $row['nb'];
4387 4387
 			$temp_array['flight_country'] = $row['name'];
@@ -4399,12 +4399,12 @@  discard block
 block discarded – undo
4399 4399
 	* @return Array the aircraft list
4400 4400
 	*
4401 4401
 	*/
4402
-	public function countAllAircraftTypes($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
4402
+	public function countAllAircraftTypes($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
4403 4403
 	{
4404 4404
 		global $globalDBdriver;
4405
-		$filter_query = $this->getFilter($filters,true,true);
4405
+		$filter_query = $this->getFilter($filters, true, true);
4406 4406
 
4407
-		$query  = "SELECT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer 
4407
+		$query = "SELECT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer 
4408 4408
 		    FROM spotter_output ".$filter_query." spotter_output.aircraft_name  <> '' AND spotter_output.aircraft_icao  <> ''";
4409 4409
 		if ($olderthanmonths > 0) {
4410 4410
 			if ($globalDBdriver == 'mysql') {
@@ -4429,7 +4429,7 @@  discard block
 block discarded – undo
4429 4429
 
4430 4430
 		$aircraft_array = array();
4431 4431
 		$temp_array = array();
4432
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4432
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4433 4433
 		{
4434 4434
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4435 4435
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -4446,10 +4446,10 @@  discard block
 block discarded – undo
4446 4446
 	* @return Array the aircraft list
4447 4447
 	*
4448 4448
 	*/
4449
-	public function countAllAircraftTypesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '')
4449
+	public function countAllAircraftTypesByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '')
4450 4450
 	{
4451 4451
 		global $globalDBdriver;
4452
-		$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 
4452
+		$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 
4453 4453
 		    FROM spotter_output
4454 4454
 		    WHERE spotter_output.aircraft_name  <> '' AND spotter_output.aircraft_icao  <> '' AND spotter_output.airline_icao <>'' AND spotter_output.airline_icao <> 'NA' ";
4455 4455
 		if ($olderthanmonths > 0) {
@@ -4475,7 +4475,7 @@  discard block
 block discarded – undo
4475 4475
 
4476 4476
 		$aircraft_array = array();
4477 4477
 		$temp_array = array();
4478
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4478
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4479 4479
 		{
4480 4480
 			$temp_array['airline_icao'] = $row['airline_icao'];
4481 4481
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
@@ -4497,9 +4497,9 @@  discard block
 block discarded – undo
4497 4497
 	public function countAllAircraftRegistrationByAircraft($aircraft_icao)
4498 4498
 	{
4499 4499
 		$Image = new Image($this->db);
4500
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
4500
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
4501 4501
 
4502
-		$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  
4502
+		$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  
4503 4503
 				FROM spotter_output
4504 4504
 				WHERE spotter_output.registration <> '' AND spotter_output.aircraft_icao = :aircraft_icao  
4505 4505
 				GROUP BY spotter_output.registration 
@@ -4511,14 +4511,14 @@  discard block
 block discarded – undo
4511 4511
 		$aircraft_array = array();
4512 4512
 		$temp_array = array();
4513 4513
         
4514
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4514
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4515 4515
 		{
4516 4516
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4517 4517
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
4518 4518
 			$temp_array['registration'] = $row['registration'];
4519 4519
 			$temp_array['airline_name'] = $row['airline_name'];
4520 4520
 			$temp_array['image_thumbnail'] = "";
4521
-			if($row['registration'] != "")
4521
+			if ($row['registration'] != "")
4522 4522
 			{
4523 4523
 				$image_array = $Image->getSpotterImage($row['registration']);
4524 4524
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -4539,9 +4539,9 @@  discard block
 block discarded – undo
4539 4539
 	*/
4540 4540
 	public function countAllAircraftTypesByAirline($airline_icao)
4541 4541
 	{
4542
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
4542
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
4543 4543
 
4544
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4544
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4545 4545
 				FROM spotter_output
4546 4546
 				WHERE spotter_output.aircraft_icao <> '' AND spotter_output.airline_icao = :airline_icao 
4547 4547
 				GROUP BY spotter_output.aircraft_name 
@@ -4553,7 +4553,7 @@  discard block
 block discarded – undo
4553 4553
 		$aircraft_array = array();
4554 4554
 		$temp_array = array();
4555 4555
 
4556
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4556
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4557 4557
 		{
4558 4558
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4559 4559
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -4574,9 +4574,9 @@  discard block
 block discarded – undo
4574 4574
 	public function countAllAircraftRegistrationByAirline($airline_icao)
4575 4575
 	{
4576 4576
 		$Image = new Image($this->db);
4577
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
4577
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
4578 4578
 
4579
-		$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   
4579
+		$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   
4580 4580
 				FROM spotter_output
4581 4581
 				WHERE spotter_output.registration <> '' AND spotter_output.airline_icao = :airline_icao 
4582 4582
 				GROUP BY spotter_output.registration 
@@ -4587,14 +4587,14 @@  discard block
 block discarded – undo
4587 4587
 
4588 4588
 		$aircraft_array = array();
4589 4589
 		$temp_array = array();
4590
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4590
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4591 4591
 		{
4592 4592
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4593 4593
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
4594 4594
 			$temp_array['registration'] = $row['registration'];
4595 4595
 			$temp_array['airline_name'] = $row['airline_name'];
4596 4596
 			$temp_array['image_thumbnail'] = "";
4597
-			if($row['registration'] != "")
4597
+			if ($row['registration'] != "")
4598 4598
 			{
4599 4599
 				$image_array = $Image->getSpotterImage($row['registration']);
4600 4600
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -4615,9 +4615,9 @@  discard block
 block discarded – undo
4615 4615
 	*/
4616 4616
 	public function countAllAircraftManufacturerByAirline($airline_icao)
4617 4617
 	{
4618
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
4618
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
4619 4619
 
4620
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
4620
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
4621 4621
 				FROM spotter_output
4622 4622
 				WHERE spotter_output.aircraft_manufacturer <> '' AND spotter_output.airline_icao = :airline_icao 
4623 4623
 				GROUP BY spotter_output.aircraft_manufacturer 
@@ -4629,7 +4629,7 @@  discard block
 block discarded – undo
4629 4629
 		$aircraft_array = array();
4630 4630
 		$temp_array = array();
4631 4631
 
4632
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4632
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4633 4633
 		{
4634 4634
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
4635 4635
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -4648,9 +4648,9 @@  discard block
 block discarded – undo
4648 4648
 	*/
4649 4649
 	public function countAllAircraftTypesByAirport($airport_icao)
4650 4650
 	{
4651
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
4651
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
4652 4652
 
4653
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4653
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4654 4654
 				FROM spotter_output
4655 4655
 				WHERE spotter_output.aircraft_icao <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao) 
4656 4656
 				GROUP BY spotter_output.aircraft_name 
@@ -4661,7 +4661,7 @@  discard block
 block discarded – undo
4661 4661
 
4662 4662
 		$aircraft_array = array();
4663 4663
 		$temp_array = array();
4664
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4664
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4665 4665
 		{
4666 4666
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4667 4667
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -4682,9 +4682,9 @@  discard block
 block discarded – undo
4682 4682
 	public function countAllAircraftRegistrationByAirport($airport_icao)
4683 4683
 	{
4684 4684
 		$Image = new Image($this->db);
4685
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
4685
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
4686 4686
 
4687
-		$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  
4687
+		$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  
4688 4688
                     FROM spotter_output
4689 4689
                     WHERE spotter_output.registration <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao)   
4690 4690
                     GROUP BY spotter_output.registration 
@@ -4696,14 +4696,14 @@  discard block
 block discarded – undo
4696 4696
 
4697 4697
 		$aircraft_array = array();
4698 4698
 		$temp_array = array();
4699
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4699
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4700 4700
 		{
4701 4701
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4702 4702
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
4703 4703
 			$temp_array['registration'] = $row['registration'];
4704 4704
 			$temp_array['airline_name'] = $row['airline_name'];
4705 4705
 			$temp_array['image_thumbnail'] = "";
4706
-			if($row['registration'] != "")
4706
+			if ($row['registration'] != "")
4707 4707
 			{
4708 4708
 				$image_array = $Image->getSpotterImage($row['registration']);
4709 4709
 				$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -4723,9 +4723,9 @@  discard block
 block discarded – undo
4723 4723
 	*/
4724 4724
 	public function countAllAircraftManufacturerByAirport($airport_icao)
4725 4725
 	{
4726
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
4726
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
4727 4727
 
4728
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
4728
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
4729 4729
                     FROM spotter_output
4730 4730
                     WHERE spotter_output.aircraft_manufacturer <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao)  
4731 4731
                     GROUP BY spotter_output.aircraft_manufacturer 
@@ -4737,7 +4737,7 @@  discard block
 block discarded – undo
4737 4737
 
4738 4738
 		$aircraft_array = array();
4739 4739
 		$temp_array = array();
4740
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4740
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4741 4741
 		{
4742 4742
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
4743 4743
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -4754,9 +4754,9 @@  discard block
 block discarded – undo
4754 4754
 	*/
4755 4755
 	public function countAllAircraftTypesByManufacturer($aircraft_manufacturer)
4756 4756
 	{
4757
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
4757
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
4758 4758
 
4759
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4759
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4760 4760
                     FROM spotter_output
4761 4761
                     WHERE spotter_output.aircraft_manufacturer = :aircraft_manufacturer
4762 4762
                     GROUP BY spotter_output.aircraft_name 
@@ -4766,7 +4766,7 @@  discard block
 block discarded – undo
4766 4766
 		$sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer));
4767 4767
 		$aircraft_array = array();
4768 4768
 		$temp_array = array();
4769
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4769
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4770 4770
 		{
4771 4771
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4772 4772
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -4786,9 +4786,9 @@  discard block
 block discarded – undo
4786 4786
 	public function countAllAircraftRegistrationByManufacturer($aircraft_manufacturer)
4787 4787
 	{
4788 4788
 		$Image = new Image($this->db);
4789
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
4789
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
4790 4790
 
4791
-		$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   
4791
+		$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   
4792 4792
                     FROM spotter_output
4793 4793
                     WHERE spotter_output.registration <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer   
4794 4794
                     GROUP BY spotter_output.registration 
@@ -4799,14 +4799,14 @@  discard block
 block discarded – undo
4799 4799
 		$sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer));
4800 4800
 		$aircraft_array = array();
4801 4801
 		$temp_array = array();
4802
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4802
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4803 4803
 		{
4804 4804
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4805 4805
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
4806 4806
 			$temp_array['registration'] = $row['registration'];
4807 4807
 			$temp_array['airline_name'] = $row['airline_name'];
4808 4808
 			$temp_array['image_thumbnail'] = "";
4809
-			if($row['registration'] != "")
4809
+			if ($row['registration'] != "")
4810 4810
 			{
4811 4811
 				$image_array = $Image->getSpotterImage($row['registration']);
4812 4812
 				$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -4826,7 +4826,7 @@  discard block
 block discarded – undo
4826 4826
 	public function countAllAircraftTypesByDate($date)
4827 4827
 	{
4828 4828
 		global $globalTimezone, $globalDBdriver;
4829
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
4829
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
4830 4830
 		if ($globalTimezone != '') {
4831 4831
 			date_default_timezone_set($globalTimezone);
4832 4832
 			$datetime = new DateTime($date);
@@ -4834,13 +4834,13 @@  discard block
 block discarded – undo
4834 4834
 		} else $offset = '+00:00';
4835 4835
 
4836 4836
 		if ($globalDBdriver == 'mysql') {
4837
-			$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4837
+			$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4838 4838
 					FROM spotter_output
4839 4839
 					WHERE DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date
4840 4840
 					GROUP BY spotter_output.aircraft_name 
4841 4841
 					ORDER BY aircraft_icao_count DESC";
4842 4842
 		} else {
4843
-			$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4843
+			$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4844 4844
 					FROM spotter_output
4845 4845
 					WHERE to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date
4846 4846
 					GROUP BY spotter_output.aircraft_name 
@@ -4852,7 +4852,7 @@  discard block
 block discarded – undo
4852 4852
 
4853 4853
 		$aircraft_array = array();
4854 4854
 		$temp_array = array();
4855
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4855
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4856 4856
 		{
4857 4857
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4858 4858
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -4874,7 +4874,7 @@  discard block
 block discarded – undo
4874 4874
 	{
4875 4875
 		global $globalTimezone, $globalDBdriver;
4876 4876
 		$Image = new Image($this->db);
4877
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
4877
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
4878 4878
 		if ($globalTimezone != '') {
4879 4879
 			date_default_timezone_set($globalTimezone);
4880 4880
 			$datetime = new DateTime($date);
@@ -4882,13 +4882,13 @@  discard block
 block discarded – undo
4882 4882
 		} else $offset = '+00:00';
4883 4883
 
4884 4884
 		if ($globalDBdriver == 'mysql') {
4885
-			$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    
4885
+			$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    
4886 4886
 					FROM spotter_output
4887 4887
 					WHERE spotter_output.registration <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
4888 4888
 					GROUP BY spotter_output.registration 
4889 4889
 					ORDER BY registration_count DESC";
4890 4890
 		} else {
4891
-			$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    
4891
+			$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    
4892 4892
 					FROM spotter_output
4893 4893
 					WHERE spotter_output.registration <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date 
4894 4894
 					GROUP BY spotter_output.registration 
@@ -4900,14 +4900,14 @@  discard block
 block discarded – undo
4900 4900
 
4901 4901
 		$aircraft_array = array();
4902 4902
 		$temp_array = array();
4903
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4903
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4904 4904
 		{
4905 4905
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4906 4906
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
4907 4907
 			$temp_array['registration'] = $row['registration'];
4908 4908
 			$temp_array['airline_name'] = $row['airline_name'];
4909 4909
 			$temp_array['image_thumbnail'] = "";
4910
-			if($row['registration'] != "")
4910
+			if ($row['registration'] != "")
4911 4911
 			{
4912 4912
 				$image_array = $Image->getSpotterImage($row['registration']);
4913 4913
 				$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -4929,7 +4929,7 @@  discard block
 block discarded – undo
4929 4929
 	public function countAllAircraftManufacturerByDate($date)
4930 4930
 	{
4931 4931
 		global $globalTimezone, $globalDBdriver;
4932
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
4932
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
4933 4933
 		if ($globalTimezone != '') {
4934 4934
 			date_default_timezone_set($globalTimezone);
4935 4935
 			$datetime = new DateTime($date);
@@ -4937,13 +4937,13 @@  discard block
 block discarded – undo
4937 4937
 		} else $offset = '+00:00';
4938 4938
 
4939 4939
 		if ($globalDBdriver == 'mysql') {
4940
-			$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
4940
+			$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
4941 4941
 				FROM spotter_output
4942 4942
 				WHERE spotter_output.aircraft_manufacturer <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
4943 4943
 				GROUP BY spotter_output.aircraft_manufacturer 
4944 4944
 				ORDER BY aircraft_manufacturer_count DESC";
4945 4945
 		} else {
4946
-			$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
4946
+			$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
4947 4947
 				FROM spotter_output
4948 4948
 				WHERE spotter_output.aircraft_manufacturer <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date 
4949 4949
 				GROUP BY spotter_output.aircraft_manufacturer 
@@ -4956,7 +4956,7 @@  discard block
 block discarded – undo
4956 4956
 		$aircraft_array = array();
4957 4957
 		$temp_array = array();
4958 4958
 
4959
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4959
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4960 4960
 		{
4961 4961
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
4962 4962
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -4975,9 +4975,9 @@  discard block
 block discarded – undo
4975 4975
 	*/
4976 4976
 	public function countAllAircraftTypesByIdent($ident)
4977 4977
 	{
4978
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
4978
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
4979 4979
 
4980
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4980
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4981 4981
 				FROM spotter_output
4982 4982
 				WHERE spotter_output.ident = :ident 
4983 4983
 				GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao
@@ -4989,7 +4989,7 @@  discard block
 block discarded – undo
4989 4989
 		$aircraft_array = array();
4990 4990
 		$temp_array = array();
4991 4991
 
4992
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4992
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4993 4993
 		{
4994 4994
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4995 4995
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -5010,9 +5010,9 @@  discard block
 block discarded – undo
5010 5010
 	public function countAllAircraftRegistrationByIdent($ident)
5011 5011
 	{
5012 5012
 		$Image = new Image($this->db);
5013
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
5013
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
5014 5014
 
5015
-		$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  
5015
+		$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  
5016 5016
                     FROM spotter_output
5017 5017
                     WHERE spotter_output.registration <> '' AND spotter_output.ident = :ident   
5018 5018
                     GROUP BY spotter_output.registration,spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name
@@ -5025,14 +5025,14 @@  discard block
 block discarded – undo
5025 5025
 		$aircraft_array = array();
5026 5026
 		$temp_array = array();
5027 5027
         
5028
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5028
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5029 5029
 		{
5030 5030
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5031 5031
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5032 5032
 			$temp_array['registration'] = $row['registration'];
5033 5033
 			$temp_array['airline_name'] = $row['airline_name'];
5034 5034
 			$temp_array['image_thumbnail'] = "";
5035
-			if($row['registration'] != "")
5035
+			if ($row['registration'] != "")
5036 5036
 			{
5037 5037
 				$image_array = $Image->getSpotterImage($row['registration']);
5038 5038
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5053,9 +5053,9 @@  discard block
 block discarded – undo
5053 5053
 	*/
5054 5054
 	public function countAllAircraftManufacturerByIdent($ident)
5055 5055
 	{
5056
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
5056
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
5057 5057
 
5058
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5058
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5059 5059
                     FROM spotter_output
5060 5060
                     WHERE spotter_output.aircraft_manufacturer <> '' AND spotter_output.ident = :ident  
5061 5061
                     GROUP BY spotter_output.aircraft_manufacturer 
@@ -5066,7 +5066,7 @@  discard block
 block discarded – undo
5066 5066
 		$sth->execute(array(':ident' => $ident));
5067 5067
 		$aircraft_array = array();
5068 5068
 		$temp_array = array();
5069
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5069
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5070 5070
 		{
5071 5071
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
5072 5072
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -5084,11 +5084,11 @@  discard block
 block discarded – undo
5084 5084
 	*/
5085 5085
 	public function countAllAircraftTypesByRoute($departure_airport_icao, $arrival_airport_icao)
5086 5086
 	{
5087
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
5088
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
5087
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
5088
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
5089 5089
 		
5090 5090
 
5091
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5091
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5092 5092
                     FROM spotter_output
5093 5093
                     WHERE (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao)
5094 5094
                     GROUP BY spotter_output.aircraft_name 
@@ -5096,10 +5096,10 @@  discard block
 block discarded – undo
5096 5096
  
5097 5097
 		
5098 5098
 		$sth = $this->db->prepare($query);
5099
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao));
5099
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao));
5100 5100
 		$aircraft_array = array();
5101 5101
 		$temp_array = array();
5102
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5102
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5103 5103
 		{
5104 5104
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5105 5105
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -5118,10 +5118,10 @@  discard block
 block discarded – undo
5118 5118
 	public function countAllAircraftRegistrationByRoute($departure_airport_icao, $arrival_airport_icao)
5119 5119
 	{
5120 5120
 		$Image = new Image($this->db);
5121
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
5122
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
5121
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
5122
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
5123 5123
 
5124
-		$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   
5124
+		$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   
5125 5125
                     FROM spotter_output
5126 5126
                     WHERE spotter_output.registration <> '' AND (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao)   
5127 5127
                     GROUP BY spotter_output.registration 
@@ -5129,19 +5129,19 @@  discard block
 block discarded – undo
5129 5129
 
5130 5130
 		
5131 5131
 		$sth = $this->db->prepare($query);
5132
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao));
5132
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao));
5133 5133
       
5134 5134
 		$aircraft_array = array();
5135 5135
 		$temp_array = array();
5136 5136
         
5137
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5137
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5138 5138
 		{
5139 5139
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5140 5140
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5141 5141
 			$temp_array['registration'] = $row['registration'];
5142 5142
 			$temp_array['airline_name'] = $row['airline_name'];
5143 5143
 			$temp_array['image_thumbnail'] = "";
5144
-			if($row['registration'] != "")
5144
+			if ($row['registration'] != "")
5145 5145
 			{
5146 5146
 				$image_array = $Image->getSpotterImage($row['registration']);
5147 5147
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5163,10 +5163,10 @@  discard block
 block discarded – undo
5163 5163
 	*/
5164 5164
 	public function countAllAircraftManufacturerByRoute($departure_airport_icao, $arrival_airport_icao)
5165 5165
 	{
5166
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
5167
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
5166
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
5167
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
5168 5168
 
5169
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5169
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5170 5170
                     FROM spotter_output
5171 5171
                     WHERE spotter_output.aircraft_manufacturer <> '' AND (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao) 
5172 5172
                     GROUP BY spotter_output.aircraft_manufacturer 
@@ -5174,12 +5174,12 @@  discard block
 block discarded – undo
5174 5174
 
5175 5175
 		
5176 5176
 		$sth = $this->db->prepare($query);
5177
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao));
5177
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao));
5178 5178
       
5179 5179
 		$aircraft_array = array();
5180 5180
 		$temp_array = array();
5181 5181
         
5182
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5182
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5183 5183
 		{
5184 5184
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
5185 5185
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -5201,9 +5201,9 @@  discard block
 block discarded – undo
5201 5201
 	*/
5202 5202
 	public function countAllAircraftTypesByCountry($country)
5203 5203
 	{
5204
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
5204
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
5205 5205
 
5206
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5206
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5207 5207
                     FROM spotter_output
5208 5208
                     WHERE ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country 
5209 5209
                     GROUP BY spotter_output.aircraft_name 
@@ -5216,7 +5216,7 @@  discard block
 block discarded – undo
5216 5216
 		$aircraft_array = array();
5217 5217
 		$temp_array = array();
5218 5218
         
5219
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5219
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5220 5220
 		{
5221 5221
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5222 5222
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -5238,9 +5238,9 @@  discard block
 block discarded – undo
5238 5238
 	public function countAllAircraftRegistrationByCountry($country)
5239 5239
 	{
5240 5240
 		$Image = new Image($this->db);
5241
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
5241
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
5242 5242
 
5243
-		$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 
5243
+		$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 
5244 5244
                     FROM spotter_output
5245 5245
                     WHERE spotter_output.registration <> '' AND (((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country)    
5246 5246
                     GROUP BY spotter_output.registration 
@@ -5253,14 +5253,14 @@  discard block
 block discarded – undo
5253 5253
 		$aircraft_array = array();
5254 5254
 		$temp_array = array();
5255 5255
         
5256
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5256
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5257 5257
 		{
5258 5258
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5259 5259
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5260 5260
 			$temp_array['registration'] = $row['registration'];
5261 5261
 			$temp_array['airline_name'] = $row['airline_name'];
5262 5262
 			$temp_array['image_thumbnail'] = "";
5263
-			if($row['registration'] != "")
5263
+			if ($row['registration'] != "")
5264 5264
 			{
5265 5265
 				$image_array = $Image->getSpotterImage($row['registration']);
5266 5266
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5282,9 +5282,9 @@  discard block
 block discarded – undo
5282 5282
 	*/
5283 5283
 	public function countAllAircraftManufacturerByCountry($country)
5284 5284
 	{
5285
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
5285
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
5286 5286
 
5287
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5287
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5288 5288
                     FROM spotter_output
5289 5289
                     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) 
5290 5290
                     GROUP BY spotter_output.aircraft_manufacturer 
@@ -5297,7 +5297,7 @@  discard block
 block discarded – undo
5297 5297
 		$aircraft_array = array();
5298 5298
 		$temp_array = array();
5299 5299
         
5300
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5300
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5301 5301
 		{
5302 5302
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
5303 5303
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -5318,8 +5318,8 @@  discard block
 block discarded – undo
5318 5318
 	*/
5319 5319
 	public function countAllAircraftManufacturers($filter = array())
5320 5320
 	{
5321
-		$filter_query = $this->getFilter($filter,true,true);
5322
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5321
+		$filter_query = $this->getFilter($filter, true, true);
5322
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5323 5323
                     FROM spotter_output ".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.aircraft_manufacturer <> 'Not Available'";
5324 5324
                 $query .= " GROUP BY spotter_output.aircraft_manufacturer
5325 5325
 					ORDER BY aircraft_manufacturer_count DESC
@@ -5332,7 +5332,7 @@  discard block
 block discarded – undo
5332 5332
 		$manufacturer_array = array();
5333 5333
 		$temp_array = array();
5334 5334
         
5335
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5335
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5336 5336
 		{
5337 5337
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
5338 5338
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -5351,12 +5351,12 @@  discard block
 block discarded – undo
5351 5351
 	* @return Array the aircraft list
5352 5352
 	*
5353 5353
 	*/
5354
-	public function countAllAircraftRegistrations($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
5354
+	public function countAllAircraftRegistrations($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
5355 5355
 	{
5356 5356
 		global $globalDBdriver;
5357 5357
 		$Image = new Image($this->db);
5358
-		$filter_query = $this->getFilter($filters,true,true);
5359
-		$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    
5358
+		$filter_query = $this->getFilter($filters, true, true);
5359
+		$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 5360
                     FROM spotter_output ".$filter_query." spotter_output.registration <> '' AND spotter_output.registration <> 'NA'";
5361 5361
                 if ($olderthanmonths > 0) {
5362 5362
             		if ($globalDBdriver == 'mysql') {
@@ -5384,7 +5384,7 @@  discard block
 block discarded – undo
5384 5384
 		$aircraft_array = array();
5385 5385
 		$temp_array = array();
5386 5386
         
5387
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5387
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5388 5388
 		{
5389 5389
 			$temp_array['registration'] = $row['registration'];
5390 5390
 			$temp_array['aircraft_registration_count'] = $row['aircraft_registration_count'];
@@ -5392,7 +5392,7 @@  discard block
 block discarded – undo
5392 5392
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5393 5393
 			$temp_array['airline_name'] = $row['airline_name'];
5394 5394
 			$temp_array['image_thumbnail'] = "";
5395
-			if($row['registration'] != "")
5395
+			if ($row['registration'] != "")
5396 5396
 			{
5397 5397
 				$image_array = $Image->getSpotterImage($row['registration']);
5398 5398
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5411,11 +5411,11 @@  discard block
 block discarded – undo
5411 5411
 	* @return Array the aircraft list
5412 5412
 	*
5413 5413
 	*/
5414
-	public function countAllAircraftRegistrationsByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '')
5414
+	public function countAllAircraftRegistrationsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '')
5415 5415
 	{
5416 5416
 		global $globalDBdriver;
5417 5417
 		$Image = new Image($this->db);
5418
-		$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    
5418
+		$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    
5419 5419
                     FROM spotter_output 
5420 5420
                     WHERE spotter_output.airline_icao <> '' AND spotter_output.registration <> '' AND spotter_output.registration <> 'NA' ";
5421 5421
                 if ($olderthanmonths > 0) {
@@ -5444,7 +5444,7 @@  discard block
 block discarded – undo
5444 5444
 		$aircraft_array = array();
5445 5445
 		$temp_array = array();
5446 5446
         
5447
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5447
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5448 5448
 		{
5449 5449
 			$temp_array['registration'] = $row['registration'];
5450 5450
 			$temp_array['aircraft_registration_count'] = $row['aircraft_registration_count'];
@@ -5453,7 +5453,7 @@  discard block
 block discarded – undo
5453 5453
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5454 5454
 			$temp_array['airline_name'] = $row['airline_name'];
5455 5455
 			$temp_array['image_thumbnail'] = "";
5456
-			if($row['registration'] != "")
5456
+			if ($row['registration'] != "")
5457 5457
 			{
5458 5458
 				$image_array = $Image->getSpotterImage($row['registration']);
5459 5459
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5472,11 +5472,11 @@  discard block
 block discarded – undo
5472 5472
 	* @return Array the airport list
5473 5473
 	*
5474 5474
 	*/
5475
-	public function countAllDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
5475
+	public function countAllDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
5476 5476
 	{
5477 5477
 		global $globalDBdriver;
5478
-		$filter_query = $this->getFilter($filters,true,true);
5479
-		$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 
5478
+		$filter_query = $this->getFilter($filters, true, true);
5479
+		$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 5480
 				FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA'";
5481 5481
                 if ($olderthanmonths > 0) {
5482 5482
             		if ($globalDBdriver == 'mysql') {
@@ -5505,7 +5505,7 @@  discard block
 block discarded – undo
5505 5505
 		$airport_array = array();
5506 5506
 		$temp_array = array();
5507 5507
         
5508
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5508
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5509 5509
 		{
5510 5510
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
5511 5511
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -5527,7 +5527,7 @@  discard block
 block discarded – undo
5527 5527
 	public function countAllDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '')
5528 5528
 	{
5529 5529
 		global $globalDBdriver;
5530
-		$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 
5530
+		$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 
5531 5531
 								FROM spotter_output
5532 5532
                     WHERE spotter_output.airline_icao <> '' AND spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' ";
5533 5533
                 if ($olderthanmonths > 0) {
@@ -5557,7 +5557,7 @@  discard block
 block discarded – undo
5557 5557
 		$airport_array = array();
5558 5558
 		$temp_array = array();
5559 5559
         
5560
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5560
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5561 5561
 		{
5562 5562
 			$temp_array['airline_icao'] = $row['airline_icao'];
5563 5563
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -5577,11 +5577,11 @@  discard block
 block discarded – undo
5577 5577
 	* @return Array the airport list
5578 5578
 	*
5579 5579
 	*/
5580
-	public function countAllDetectedDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
5580
+	public function countAllDetectedDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
5581 5581
 	{
5582 5582
 		global $globalDBdriver;
5583
-		$filter_query = $this->getFilter($filters,true,true);
5584
-		$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
5583
+		$filter_query = $this->getFilter($filters, true, true);
5584
+		$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 5585
 				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";
5586 5586
                 if ($olderthanmonths > 0) {
5587 5587
             		if ($globalDBdriver == 'mysql') {
@@ -5609,7 +5609,7 @@  discard block
 block discarded – undo
5609 5609
 		$airport_array = array();
5610 5610
 		$temp_array = array();
5611 5611
         
5612
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5612
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5613 5613
 		{
5614 5614
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
5615 5615
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -5631,7 +5631,7 @@  discard block
 block discarded – undo
5631 5631
 	public function countAllDetectedDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '')
5632 5632
 	{
5633 5633
 		global $globalDBdriver;
5634
-		$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
5634
+		$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
5635 5635
 				FROM spotter_output, airport
5636 5636
                     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 ";
5637 5637
                 if ($olderthanmonths > 0) {
@@ -5661,7 +5661,7 @@  discard block
 block discarded – undo
5661 5661
 		$airport_array = array();
5662 5662
 		$temp_array = array();
5663 5663
         
5664
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5664
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5665 5665
 		{
5666 5666
 			$temp_array['airline_icao'] = $row['airline_icao'];
5667 5667
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -5683,9 +5683,9 @@  discard block
 block discarded – undo
5683 5683
 	*/
5684 5684
 	public function countAllDepartureAirportsByAirline($airline_icao)
5685 5685
 	{
5686
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
5686
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
5687 5687
 
5688
-		$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 
5688
+		$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 
5689 5689
 								FROM spotter_output
5690 5690
                     WHERE spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.airline_icao = :airline_icao 
5691 5691
                     GROUP BY spotter_output.departure_airport_icao
@@ -5698,7 +5698,7 @@  discard block
 block discarded – undo
5698 5698
 		$airport_array = array();
5699 5699
 		$temp_array = array();
5700 5700
         
5701
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5701
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5702 5702
 		{
5703 5703
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
5704 5704
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -5722,9 +5722,9 @@  discard block
 block discarded – undo
5722 5722
 	*/
5723 5723
 	public function countAllDepartureAirportCountriesByAirline($airline_icao)
5724 5724
 	{
5725
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
5725
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
5726 5726
 					
5727
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
5727
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
5728 5728
 								FROM spotter_output 
5729 5729
                     WHERE spotter_output.departure_airport_country <> '' AND spotter_output.airline_icao = :airline_icao 
5730 5730
                     GROUP BY spotter_output.departure_airport_country
@@ -5737,7 +5737,7 @@  discard block
 block discarded – undo
5737 5737
 		$airport_array = array();
5738 5738
 		$temp_array = array();
5739 5739
         
5740
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5740
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5741 5741
 		{
5742 5742
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
5743 5743
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -5758,9 +5758,9 @@  discard block
 block discarded – undo
5758 5758
 	*/
5759 5759
 	public function countAllDepartureAirportsByAircraft($aircraft_icao)
5760 5760
 	{
5761
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
5761
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
5762 5762
 
5763
-		$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 
5763
+		$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 
5764 5764
 								FROM spotter_output
5765 5765
                     WHERE spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.aircraft_icao = :aircraft_icao 
5766 5766
                     GROUP BY spotter_output.departure_airport_icao
@@ -5773,7 +5773,7 @@  discard block
 block discarded – undo
5773 5773
 		$airport_array = array();
5774 5774
 		$temp_array = array();
5775 5775
         
5776
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5776
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5777 5777
 		{
5778 5778
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
5779 5779
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -5796,9 +5796,9 @@  discard block
 block discarded – undo
5796 5796
 	*/
5797 5797
 	public function countAllDepartureAirportCountriesByAircraft($aircraft_icao)
5798 5798
 	{
5799
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
5799
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
5800 5800
 					
5801
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
5801
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
5802 5802
 								FROM spotter_output 
5803 5803
                     WHERE spotter_output.departure_airport_country <> '' AND spotter_output.aircraft_icao = :aircraft_icao
5804 5804
                     GROUP BY spotter_output.departure_airport_country
@@ -5811,7 +5811,7 @@  discard block
 block discarded – undo
5811 5811
 		$airport_array = array();
5812 5812
 		$temp_array = array();
5813 5813
         
5814
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5814
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5815 5815
 		{
5816 5816
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
5817 5817
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -5831,9 +5831,9 @@  discard block
 block discarded – undo
5831 5831
 	*/
5832 5832
 	public function countAllDepartureAirportsByRegistration($registration)
5833 5833
 	{
5834
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
5834
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
5835 5835
 
5836
-		$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 
5836
+		$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 
5837 5837
 								FROM spotter_output
5838 5838
                     WHERE spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.registration = :registration 
5839 5839
                     GROUP BY spotter_output.departure_airport_icao
@@ -5846,7 +5846,7 @@  discard block
 block discarded – undo
5846 5846
 		$airport_array = array();
5847 5847
 		$temp_array = array();
5848 5848
         
5849
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5849
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5850 5850
 		{
5851 5851
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
5852 5852
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -5869,9 +5869,9 @@  discard block
 block discarded – undo
5869 5869
 	*/
5870 5870
 	public function countAllDepartureAirportCountriesByRegistration($registration)
5871 5871
 	{
5872
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
5872
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
5873 5873
 					
5874
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
5874
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
5875 5875
 								FROM spotter_output 
5876 5876
                     WHERE spotter_output.departure_airport_country <> '' AND spotter_output.registration = :registration 
5877 5877
                     GROUP BY spotter_output.departure_airport_country
@@ -5884,7 +5884,7 @@  discard block
 block discarded – undo
5884 5884
 		$airport_array = array();
5885 5885
 		$temp_array = array();
5886 5886
         
5887
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5887
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5888 5888
 		{
5889 5889
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
5890 5890
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -5904,9 +5904,9 @@  discard block
 block discarded – undo
5904 5904
 	*/
5905 5905
 	public function countAllDepartureAirportsByAirport($airport_icao)
5906 5906
 	{
5907
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
5907
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
5908 5908
 
5909
-		$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 
5909
+		$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 
5910 5910
 								FROM spotter_output
5911 5911
                     WHERE spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao = :airport_icao 
5912 5912
                     GROUP BY spotter_output.departure_airport_icao
@@ -5919,7 +5919,7 @@  discard block
 block discarded – undo
5919 5919
 		$airport_array = array();
5920 5920
 		$temp_array = array();
5921 5921
         
5922
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5922
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5923 5923
 		{
5924 5924
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
5925 5925
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -5942,9 +5942,9 @@  discard block
 block discarded – undo
5942 5942
 	*/
5943 5943
 	public function countAllDepartureAirportCountriesByAirport($airport_icao)
5944 5944
 	{
5945
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
5945
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
5946 5946
 					
5947
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
5947
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
5948 5948
 								FROM spotter_output 
5949 5949
                     WHERE spotter_output.departure_airport_country <> '' AND spotter_output.arrival_airport_icao = :airport_icao 
5950 5950
                     GROUP BY spotter_output.departure_airport_country
@@ -5957,7 +5957,7 @@  discard block
 block discarded – undo
5957 5957
 		$airport_array = array();
5958 5958
 		$temp_array = array();
5959 5959
         
5960
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5960
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5961 5961
 		{
5962 5962
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
5963 5963
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -5978,9 +5978,9 @@  discard block
 block discarded – undo
5978 5978
 	*/
5979 5979
 	public function countAllDepartureAirportsByManufacturer($aircraft_manufacturer)
5980 5980
 	{
5981
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
5981
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
5982 5982
 
5983
-		$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 
5983
+		$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 
5984 5984
 								FROM spotter_output
5985 5985
                     WHERE spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer 
5986 5986
                     GROUP BY spotter_output.departure_airport_icao
@@ -5993,7 +5993,7 @@  discard block
 block discarded – undo
5993 5993
 		$airport_array = array();
5994 5994
 		$temp_array = array();
5995 5995
         
5996
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5996
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5997 5997
 		{
5998 5998
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
5999 5999
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -6016,9 +6016,9 @@  discard block
 block discarded – undo
6016 6016
 	*/
6017 6017
 	public function countAllDepartureAirportCountriesByManufacturer($aircraft_manufacturer)
6018 6018
 	{
6019
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
6019
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
6020 6020
 					
6021
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6021
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6022 6022
 								FROM spotter_output 
6023 6023
                     WHERE spotter_output.departure_airport_country <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer 
6024 6024
                     GROUP BY spotter_output.departure_airport_country
@@ -6031,7 +6031,7 @@  discard block
 block discarded – undo
6031 6031
 		$airport_array = array();
6032 6032
 		$temp_array = array();
6033 6033
         
6034
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6034
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6035 6035
 		{
6036 6036
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
6037 6037
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -6052,7 +6052,7 @@  discard block
 block discarded – undo
6052 6052
 	public function countAllDepartureAirportsByDate($date)
6053 6053
 	{
6054 6054
 		global $globalTimezone, $globalDBdriver;
6055
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
6055
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
6056 6056
 
6057 6057
 		if ($globalTimezone != '') {
6058 6058
 			date_default_timezone_set($globalTimezone);
@@ -6061,13 +6061,13 @@  discard block
 block discarded – undo
6061 6061
 		} else $offset = '+00:00';
6062 6062
 
6063 6063
 		if ($globalDBdriver == 'mysql') {
6064
-			$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 
6064
+			$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 
6065 6065
 					FROM spotter_output
6066 6066
 					WHERE spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date
6067 6067
 					GROUP BY spotter_output.departure_airport_icao
6068 6068
 					ORDER BY airport_departure_icao_count DESC";
6069 6069
 		} else {
6070
-			$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 
6070
+			$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 
6071 6071
 					FROM spotter_output
6072 6072
 					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
6073 6073
 					GROUP BY spotter_output.departure_airport_icao
@@ -6080,7 +6080,7 @@  discard block
 block discarded – undo
6080 6080
 		$airport_array = array();
6081 6081
 		$temp_array = array();
6082 6082
         
6083
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6083
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6084 6084
 		{
6085 6085
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
6086 6086
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -6104,7 +6104,7 @@  discard block
 block discarded – undo
6104 6104
 	public function countAllDepartureAirportCountriesByDate($date)
6105 6105
 	{
6106 6106
 		global $globalTimezone, $globalDBdriver;
6107
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
6107
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
6108 6108
 		if ($globalTimezone != '') {
6109 6109
 			date_default_timezone_set($globalTimezone);
6110 6110
 			$datetime = new DateTime($date);
@@ -6112,13 +6112,13 @@  discard block
 block discarded – undo
6112 6112
 		} else $offset = '+00:00';
6113 6113
 
6114 6114
 		if ($globalDBdriver == 'mysql') {
6115
-			$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6115
+			$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6116 6116
 					FROM spotter_output 
6117 6117
 					WHERE spotter_output.departure_airport_country <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
6118 6118
 					GROUP BY spotter_output.departure_airport_country
6119 6119
 					ORDER BY airport_departure_country_count DESC";
6120 6120
 		} else {
6121
-			$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6121
+			$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6122 6122
 					FROM spotter_output 
6123 6123
 					WHERE spotter_output.departure_airport_country <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date 
6124 6124
 					GROUP BY spotter_output.departure_airport_country
@@ -6131,7 +6131,7 @@  discard block
 block discarded – undo
6131 6131
 		$airport_array = array();
6132 6132
 		$temp_array = array();
6133 6133
         
6134
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6134
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6135 6135
 		{
6136 6136
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
6137 6137
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -6151,9 +6151,9 @@  discard block
 block discarded – undo
6151 6151
 	*/
6152 6152
 	public function countAllDepartureAirportsByIdent($ident)
6153 6153
 	{
6154
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
6154
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
6155 6155
 
6156
-		$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 
6156
+		$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 
6157 6157
 		    FROM spotter_output
6158 6158
                     WHERE spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.ident = :ident 
6159 6159
                     GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
@@ -6166,7 +6166,7 @@  discard block
 block discarded – undo
6166 6166
 		$airport_array = array();
6167 6167
 		$temp_array = array();
6168 6168
         
6169
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6169
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6170 6170
 		{
6171 6171
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
6172 6172
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -6190,9 +6190,9 @@  discard block
 block discarded – undo
6190 6190
 	*/
6191 6191
 	public function countAllDepartureAirportCountriesByIdent($ident)
6192 6192
 	{
6193
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
6193
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
6194 6194
 					
6195
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6195
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6196 6196
 								FROM spotter_output 
6197 6197
                     WHERE spotter_output.departure_airport_country <> '' AND spotter_output.ident = :ident 
6198 6198
                     GROUP BY spotter_output.departure_airport_country
@@ -6205,7 +6205,7 @@  discard block
 block discarded – undo
6205 6205
 		$airport_array = array();
6206 6206
 		$temp_array = array();
6207 6207
         
6208
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6208
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6209 6209
 		{
6210 6210
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
6211 6211
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -6226,9 +6226,9 @@  discard block
 block discarded – undo
6226 6226
 	*/
6227 6227
 	public function countAllDepartureAirportsByCountry($country)
6228 6228
 	{
6229
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
6229
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
6230 6230
 
6231
-		$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 
6231
+		$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 
6232 6232
 								FROM spotter_output
6233 6233
                     WHERE ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country
6234 6234
                     GROUP BY spotter_output.departure_airport_icao
@@ -6241,7 +6241,7 @@  discard block
 block discarded – undo
6241 6241
 		$airport_array = array();
6242 6242
 		$temp_array = array();
6243 6243
         
6244
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6244
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6245 6245
 		{
6246 6246
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
6247 6247
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -6264,9 +6264,9 @@  discard block
 block discarded – undo
6264 6264
 	*/
6265 6265
 	public function countAllDepartureAirportCountriesByCountry($country)
6266 6266
 	{
6267
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
6267
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
6268 6268
 					
6269
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6269
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6270 6270
 								FROM spotter_output 
6271 6271
                     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 
6272 6272
                     GROUP BY spotter_output.departure_airport_country
@@ -6279,7 +6279,7 @@  discard block
 block discarded – undo
6279 6279
 		$airport_array = array();
6280 6280
 		$temp_array = array();
6281 6281
         
6282
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6282
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6283 6283
 		{
6284 6284
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
6285 6285
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -6297,11 +6297,11 @@  discard block
 block discarded – undo
6297 6297
 	* @return Array the airport list
6298 6298
 	*
6299 6299
 	*/
6300
-	public function countAllArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array())
6300
+	public function countAllArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false, $filters = array())
6301 6301
 	{
6302 6302
 		global $globalDBdriver;
6303
-		$filter_query = $this->getFilter($filters,true,true);
6304
-		$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 
6303
+		$filter_query = $this->getFilter($filters, true, true);
6304
+		$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 6305
 				FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA'";
6306 6306
                 if ($olderthanmonths > 0) {
6307 6307
             		if ($globalDBdriver == 'mysql') {
@@ -6336,7 +6336,7 @@  discard block
 block discarded – undo
6336 6336
 		$airport_array = array();
6337 6337
 		$temp_array = array();
6338 6338
         
6339
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6339
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6340 6340
 		{
6341 6341
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
6342 6342
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -6362,7 +6362,7 @@  discard block
 block discarded – undo
6362 6362
 	public function countAllArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false)
6363 6363
 	{
6364 6364
 		global $globalDBdriver;
6365
-		$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 
6365
+		$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 
6366 6366
 								FROM spotter_output 
6367 6367
                     WHERE spotter_output.airline_icao <> '' AND spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' ";
6368 6368
                 if ($olderthanmonths > 0) {
@@ -6398,7 +6398,7 @@  discard block
 block discarded – undo
6398 6398
 		$airport_array = array();
6399 6399
 		$temp_array = array();
6400 6400
         
6401
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6401
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6402 6402
 		{
6403 6403
 			$temp_array['airline_icao'] = $row['airline_icao'];
6404 6404
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
@@ -6423,11 +6423,11 @@  discard block
 block discarded – undo
6423 6423
 	* @return Array the airport list
6424 6424
 	*
6425 6425
 	*/
6426
-	public function countAllDetectedArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array())
6426
+	public function countAllDetectedArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false, $filters = array())
6427 6427
 	{
6428 6428
 		global $globalDBdriver;
6429
-		$filter_query = $this->getFilter($filters,true,true);
6430
-		$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 
6429
+		$filter_query = $this->getFilter($filters, true, true);
6430
+		$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 6431
 			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";
6432 6432
                 if ($olderthanmonths > 0) {
6433 6433
             		if ($globalDBdriver == 'mysql') {
@@ -6461,7 +6461,7 @@  discard block
 block discarded – undo
6461 6461
 		$airport_array = array();
6462 6462
 		$temp_array = array();
6463 6463
         
6464
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6464
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6465 6465
 		{
6466 6466
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
6467 6467
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -6484,10 +6484,10 @@  discard block
 block discarded – undo
6484 6484
 	* @return Array the airport list
6485 6485
 	*
6486 6486
 	*/
6487
-	public function countAllDetectedArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false)
6487
+	public function countAllDetectedArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false)
6488 6488
 	{
6489 6489
 		global $globalDBdriver;
6490
-		$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 
6490
+		$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 
6491 6491
 			FROM spotter_output, airport 
6492 6492
                     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 ";
6493 6493
                 if ($olderthanmonths > 0) {
@@ -6523,7 +6523,7 @@  discard block
 block discarded – undo
6523 6523
 		$airport_array = array();
6524 6524
 		$temp_array = array();
6525 6525
         
6526
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6526
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6527 6527
 		{
6528 6528
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
6529 6529
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -6549,9 +6549,9 @@  discard block
 block discarded – undo
6549 6549
 	*/
6550 6550
 	public function countAllArrivalAirportsByAirline($airline_icao)
6551 6551
 	{
6552
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
6552
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
6553 6553
 
6554
-		$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 
6554
+		$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 
6555 6555
 								FROM spotter_output 
6556 6556
                     WHERE spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.airline_icao = :airline_icao 
6557 6557
                     GROUP BY spotter_output.arrival_airport_icao
@@ -6564,7 +6564,7 @@  discard block
 block discarded – undo
6564 6564
 		$airport_array = array();
6565 6565
 		$temp_array = array();
6566 6566
         
6567
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6567
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6568 6568
 		{
6569 6569
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
6570 6570
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -6587,9 +6587,9 @@  discard block
 block discarded – undo
6587 6587
 	*/
6588 6588
 	public function countAllArrivalAirportCountriesByAirline($airline_icao)
6589 6589
 	{
6590
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
6590
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
6591 6591
 					
6592
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6592
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6593 6593
 								FROM spotter_output 
6594 6594
                     WHERE spotter_output.arrival_airport_country <> '' AND spotter_output.airline_icao = :airline_icao 
6595 6595
                     GROUP BY spotter_output.arrival_airport_country
@@ -6602,7 +6602,7 @@  discard block
 block discarded – undo
6602 6602
 		$airport_array = array();
6603 6603
 		$temp_array = array();
6604 6604
         
6605
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6605
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6606 6606
 		{
6607 6607
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
6608 6608
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -6622,9 +6622,9 @@  discard block
 block discarded – undo
6622 6622
 	*/
6623 6623
 	public function countAllArrivalAirportsByAircraft($aircraft_icao)
6624 6624
 	{
6625
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
6625
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
6626 6626
 
6627
-		$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 
6627
+		$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 
6628 6628
 								FROM spotter_output 
6629 6629
                     WHERE spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.aircraft_icao = :aircraft_icao 
6630 6630
                     GROUP BY spotter_output.arrival_airport_icao
@@ -6637,7 +6637,7 @@  discard block
 block discarded – undo
6637 6637
 		$airport_array = array();
6638 6638
 		$temp_array = array();
6639 6639
         
6640
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6640
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6641 6641
 		{
6642 6642
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
6643 6643
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -6661,9 +6661,9 @@  discard block
 block discarded – undo
6661 6661
 	*/
6662 6662
 	public function countAllArrivalAirportCountriesByAircraft($aircraft_icao)
6663 6663
 	{
6664
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
6664
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
6665 6665
 					
6666
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6666
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6667 6667
 								FROM spotter_output 
6668 6668
                     WHERE spotter_output.arrival_airport_country <> '' AND spotter_output.aircraft_icao = :aircraft_icao
6669 6669
                     GROUP BY spotter_output.arrival_airport_country
@@ -6676,7 +6676,7 @@  discard block
 block discarded – undo
6676 6676
 		$airport_array = array();
6677 6677
 		$temp_array = array();
6678 6678
         
6679
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6679
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6680 6680
 		{
6681 6681
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
6682 6682
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -6696,9 +6696,9 @@  discard block
 block discarded – undo
6696 6696
 	*/
6697 6697
 	public function countAllArrivalAirportsByRegistration($registration)
6698 6698
 	{
6699
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
6699
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
6700 6700
 
6701
-		$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 
6701
+		$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 
6702 6702
 								FROM spotter_output 
6703 6703
                     WHERE spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.registration = :registration 
6704 6704
                     GROUP BY spotter_output.arrival_airport_icao
@@ -6711,7 +6711,7 @@  discard block
 block discarded – undo
6711 6711
 		$airport_array = array();
6712 6712
 		$temp_array = array();
6713 6713
         
6714
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6714
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6715 6715
 		{
6716 6716
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
6717 6717
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -6734,9 +6734,9 @@  discard block
 block discarded – undo
6734 6734
 	*/
6735 6735
 	public function countAllArrivalAirportCountriesByRegistration($registration)
6736 6736
 	{
6737
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
6737
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
6738 6738
 					
6739
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6739
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6740 6740
 								FROM spotter_output 
6741 6741
                     WHERE spotter_output.arrival_airport_country <> '' AND spotter_output.registration = :registration 
6742 6742
                     GROUP BY spotter_output.arrival_airport_country
@@ -6749,7 +6749,7 @@  discard block
 block discarded – undo
6749 6749
 		$airport_array = array();
6750 6750
 		$temp_array = array();
6751 6751
         
6752
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6752
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6753 6753
 		{
6754 6754
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
6755 6755
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -6770,9 +6770,9 @@  discard block
 block discarded – undo
6770 6770
 	*/
6771 6771
 	public function countAllArrivalAirportsByAirport($airport_icao)
6772 6772
 	{
6773
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
6773
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
6774 6774
 
6775
-		$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 
6775
+		$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 
6776 6776
 								FROM spotter_output 
6777 6777
                     WHERE spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.departure_airport_icao = :airport_icao 
6778 6778
                     GROUP BY spotter_output.arrival_airport_icao
@@ -6785,7 +6785,7 @@  discard block
 block discarded – undo
6785 6785
 		$airport_array = array();
6786 6786
 		$temp_array = array();
6787 6787
         
6788
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6788
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6789 6789
 		{
6790 6790
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
6791 6791
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -6808,9 +6808,9 @@  discard block
 block discarded – undo
6808 6808
 	*/
6809 6809
 	public function countAllArrivalAirportCountriesByAirport($airport_icao)
6810 6810
 	{
6811
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
6811
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
6812 6812
 					
6813
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6813
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6814 6814
 								FROM spotter_output 
6815 6815
                     WHERE spotter_output.arrival_airport_country <> '' AND spotter_output.departure_airport_icao = :airport_icao 
6816 6816
                     GROUP BY spotter_output.arrival_airport_country
@@ -6823,7 +6823,7 @@  discard block
 block discarded – undo
6823 6823
 		$airport_array = array();
6824 6824
 		$temp_array = array();
6825 6825
         
6826
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6826
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6827 6827
 		{
6828 6828
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
6829 6829
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -6843,9 +6843,9 @@  discard block
 block discarded – undo
6843 6843
 	*/
6844 6844
 	public function countAllArrivalAirportsByManufacturer($aircraft_manufacturer)
6845 6845
 	{
6846
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
6846
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
6847 6847
 
6848
-		$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 
6848
+		$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 
6849 6849
 								FROM spotter_output 
6850 6850
                     WHERE spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer 
6851 6851
                     GROUP BY spotter_output.arrival_airport_icao
@@ -6858,7 +6858,7 @@  discard block
 block discarded – undo
6858 6858
 		$airport_array = array();
6859 6859
 		$temp_array = array();
6860 6860
         
6861
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6861
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6862 6862
 		{
6863 6863
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
6864 6864
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -6882,9 +6882,9 @@  discard block
 block discarded – undo
6882 6882
 	*/
6883 6883
 	public function countAllArrivalAirportCountriesByManufacturer($aircraft_manufacturer)
6884 6884
 	{
6885
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
6885
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
6886 6886
 					
6887
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6887
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6888 6888
 								FROM spotter_output 
6889 6889
                     WHERE spotter_output.arrival_airport_country <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer 
6890 6890
                     GROUP BY spotter_output.arrival_airport_country
@@ -6897,7 +6897,7 @@  discard block
 block discarded – undo
6897 6897
 		$airport_array = array();
6898 6898
 		$temp_array = array();
6899 6899
         
6900
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6900
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6901 6901
 		{
6902 6902
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
6903 6903
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -6919,7 +6919,7 @@  discard block
 block discarded – undo
6919 6919
 	public function countAllArrivalAirportsByDate($date)
6920 6920
 	{
6921 6921
 		global $globalTimezone, $globalDBdriver;
6922
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
6922
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
6923 6923
 		if ($globalTimezone != '') {
6924 6924
 			date_default_timezone_set($globalTimezone);
6925 6925
 			$datetime = new DateTime($date);
@@ -6927,13 +6927,13 @@  discard block
 block discarded – undo
6927 6927
 		} else $offset = '+00:00';
6928 6928
 
6929 6929
 		if ($globalDBdriver == 'mysql') {
6930
-			$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 
6930
+			$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 
6931 6931
 					FROM spotter_output 
6932 6932
 					WHERE spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date  
6933 6933
 					GROUP BY spotter_output.arrival_airport_icao
6934 6934
 					ORDER BY airport_arrival_icao_count DESC";
6935 6935
 		} else {
6936
-			$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 
6936
+			$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 
6937 6937
 					FROM spotter_output 
6938 6938
 					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  
6939 6939
 					GROUP BY spotter_output.arrival_airport_icao
@@ -6946,7 +6946,7 @@  discard block
 block discarded – undo
6946 6946
 		$airport_array = array();
6947 6947
 		$temp_array = array();
6948 6948
         
6949
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6949
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6950 6950
 		{
6951 6951
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
6952 6952
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -6970,7 +6970,7 @@  discard block
 block discarded – undo
6970 6970
 	public function countAllArrivalAirportCountriesByDate($date)
6971 6971
 	{
6972 6972
 		global $globalTimezone, $globalDBdriver;
6973
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
6973
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
6974 6974
 		if ($globalTimezone != '') {
6975 6975
 			date_default_timezone_set($globalTimezone);
6976 6976
 			$datetime = new DateTime($date);
@@ -6978,13 +6978,13 @@  discard block
 block discarded – undo
6978 6978
 		} else $offset = '+00:00';
6979 6979
 
6980 6980
 		if ($globalDBdriver == 'mysql') {
6981
-			$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6981
+			$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6982 6982
 					FROM spotter_output 
6983 6983
 					WHERE spotter_output.arrival_airport_country <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
6984 6984
 					GROUP BY spotter_output.arrival_airport_country
6985 6985
 					ORDER BY airport_arrival_country_count DESC";
6986 6986
 		} else {
6987
-			$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6987
+			$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6988 6988
 					FROM spotter_output 
6989 6989
 					WHERE spotter_output.arrival_airport_country <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date 
6990 6990
 					GROUP BY spotter_output.arrival_airport_country
@@ -6997,7 +6997,7 @@  discard block
 block discarded – undo
6997 6997
 		$airport_array = array();
6998 6998
 		$temp_array = array();
6999 6999
         
7000
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7000
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7001 7001
 		{
7002 7002
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
7003 7003
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -7017,9 +7017,9 @@  discard block
 block discarded – undo
7017 7017
 	*/
7018 7018
 	public function countAllArrivalAirportsByIdent($ident)
7019 7019
 	{
7020
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
7020
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
7021 7021
 
7022
-		$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 
7022
+		$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 
7023 7023
 		    FROM spotter_output 
7024 7024
                     WHERE spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.ident = :ident  
7025 7025
                     GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
@@ -7032,7 +7032,7 @@  discard block
 block discarded – undo
7032 7032
 		$airport_array = array();
7033 7033
 		$temp_array = array();
7034 7034
         
7035
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7035
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7036 7036
 		{
7037 7037
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
7038 7038
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -7055,9 +7055,9 @@  discard block
 block discarded – undo
7055 7055
 	*/
7056 7056
 	public function countAllArrivalAirportCountriesByIdent($ident)
7057 7057
 	{
7058
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
7058
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
7059 7059
 					
7060
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7060
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7061 7061
 								FROM spotter_output 
7062 7062
                     WHERE spotter_output.arrival_airport_country <> '' AND spotter_output.ident = :ident 
7063 7063
                     GROUP BY spotter_output.arrival_airport_country
@@ -7070,7 +7070,7 @@  discard block
 block discarded – undo
7070 7070
 		$airport_array = array();
7071 7071
 		$temp_array = array();
7072 7072
         
7073
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7073
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7074 7074
 		{
7075 7075
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
7076 7076
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -7091,9 +7091,9 @@  discard block
 block discarded – undo
7091 7091
 	*/
7092 7092
 	public function countAllArrivalAirportsByCountry($country)
7093 7093
 	{
7094
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
7094
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
7095 7095
 
7096
-		$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 
7096
+		$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 
7097 7097
 								FROM spotter_output 
7098 7098
                     WHERE ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country  
7099 7099
                     GROUP BY spotter_output.arrival_airport_icao
@@ -7106,7 +7106,7 @@  discard block
 block discarded – undo
7106 7106
 		$airport_array = array();
7107 7107
 		$temp_array = array();
7108 7108
         
7109
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7109
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7110 7110
 		{
7111 7111
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
7112 7112
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -7129,9 +7129,9 @@  discard block
 block discarded – undo
7129 7129
 	*/
7130 7130
 	public function countAllArrivalAirportCountriesByCountry($country)
7131 7131
 	{
7132
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
7132
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
7133 7133
 					
7134
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7134
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7135 7135
 								FROM spotter_output 
7136 7136
                     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 
7137 7137
                     GROUP BY spotter_output.arrival_airport_country
@@ -7144,7 +7144,7 @@  discard block
 block discarded – undo
7144 7144
 		$airport_array = array();
7145 7145
 		$temp_array = array();
7146 7146
         
7147
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7147
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7148 7148
 		{
7149 7149
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
7150 7150
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -7165,7 +7165,7 @@  discard block
 block discarded – undo
7165 7165
 	*/
7166 7166
 	public function countAllDepartureCountries($filters = array())
7167 7167
 	{
7168
-		$filter_query = $this->getFilter($filters,true,true);
7168
+		$filter_query = $this->getFilter($filters, true, true);
7169 7169
 		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7170 7170
 				FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.departure_airport_icao <> 'NA'";
7171 7171
 		$query .= " GROUP BY spotter_output.departure_airport_country
@@ -7179,7 +7179,7 @@  discard block
 block discarded – undo
7179 7179
 		$airport_array = array();
7180 7180
 		$temp_array = array();
7181 7181
         
7182
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7182
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7183 7183
 		{
7184 7184
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
7185 7185
 			$temp_array['airport_departure_country'] = $row['departure_airport_country'];
@@ -7197,9 +7197,9 @@  discard block
 block discarded – undo
7197 7197
 	* @return Array the airport arrival list
7198 7198
 	*
7199 7199
 	*/
7200
-	public function countAllArrivalCountries($limit = true,$filters = array())
7200
+	public function countAllArrivalCountries($limit = true, $filters = array())
7201 7201
 	{
7202
-		$filter_query = $this->getFilter($filters,true,true);
7202
+		$filter_query = $this->getFilter($filters, true, true);
7203 7203
 		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7204 7204
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.arrival_airport_icao <> 'NA'";
7205 7205
 		$query .= " GROUP BY spotter_output.arrival_airport_country
@@ -7213,7 +7213,7 @@  discard block
 block discarded – undo
7213 7213
 		$airport_array = array();
7214 7214
 		$temp_array = array();
7215 7215
         
7216
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7216
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7217 7217
 		{
7218 7218
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
7219 7219
 			$temp_array['airport_arrival_country'] = $row['arrival_airport_country'];
@@ -7237,7 +7237,7 @@  discard block
 block discarded – undo
7237 7237
 	public function countAllRoutes()
7238 7238
 	{
7239 7239
 		
7240
-		$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
7240
+		$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
7241 7241
 		    FROM spotter_output
7242 7242
                     WHERE spotter_output.ident <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> 'NA'
7243 7243
                     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
@@ -7251,7 +7251,7 @@  discard block
 block discarded – undo
7251 7251
 		$routes_array = array();
7252 7252
 		$temp_array = array();
7253 7253
         
7254
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7254
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7255 7255
 		{
7256 7256
 			$temp_array['route_count'] = $row['route_count'];
7257 7257
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -7280,9 +7280,9 @@  discard block
 block discarded – undo
7280 7280
 	*/
7281 7281
 	public function countAllRoutesByAircraft($aircraft_icao)
7282 7282
 	{
7283
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
7283
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
7284 7284
 		
7285
-		$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
7285
+		$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
7286 7286
 								FROM spotter_output
7287 7287
                     WHERE spotter_output.ident <> '' AND spotter_output.aircraft_icao = :aircraft_icao 
7288 7288
                     GROUP BY route
@@ -7295,7 +7295,7 @@  discard block
 block discarded – undo
7295 7295
 		$routes_array = array();
7296 7296
 		$temp_array = array();
7297 7297
         
7298
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7298
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7299 7299
 		{
7300 7300
 			$temp_array['route_count'] = $row['route_count'];
7301 7301
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -7324,7 +7324,7 @@  discard block
 block discarded – undo
7324 7324
 	{
7325 7325
 		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
7326 7326
 		
7327
-		$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
7327
+		$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
7328 7328
 								FROM spotter_output
7329 7329
                     WHERE spotter_output.ident <> '' AND spotter_output.registration = :registration 
7330 7330
                     GROUP BY route
@@ -7337,7 +7337,7 @@  discard block
 block discarded – undo
7337 7337
 		$routes_array = array();
7338 7338
 		$temp_array = array();
7339 7339
         
7340
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7340
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7341 7341
 		{
7342 7342
 			$temp_array['route_count'] = $row['route_count'];
7343 7343
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -7365,9 +7365,9 @@  discard block
 block discarded – undo
7365 7365
 	*/
7366 7366
 	public function countAllRoutesByAirline($airline_icao)
7367 7367
 	{
7368
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
7368
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
7369 7369
 		
7370
-		$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
7370
+		$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
7371 7371
 								FROM spotter_output
7372 7372
                     WHERE spotter_output.ident <> '' AND spotter_output.airline_icao = :airline_icao 
7373 7373
                     GROUP BY route
@@ -7380,7 +7380,7 @@  discard block
 block discarded – undo
7380 7380
 		$routes_array = array();
7381 7381
 		$temp_array = array();
7382 7382
         
7383
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7383
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7384 7384
 		{
7385 7385
 			$temp_array['route_count'] = $row['route_count'];
7386 7386
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -7408,9 +7408,9 @@  discard block
 block discarded – undo
7408 7408
 	*/
7409 7409
 	public function countAllRoutesByAirport($airport_icao)
7410 7410
 	{
7411
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
7411
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
7412 7412
 		
7413
-		$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
7413
+		$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
7414 7414
 								FROM spotter_output
7415 7415
                     WHERE spotter_output.ident <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao)
7416 7416
                     GROUP BY route
@@ -7423,7 +7423,7 @@  discard block
 block discarded – undo
7423 7423
 		$routes_array = array();
7424 7424
 		$temp_array = array();
7425 7425
         
7426
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7426
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7427 7427
 		{
7428 7428
 			$temp_array['route_count'] = $row['route_count'];
7429 7429
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -7451,9 +7451,9 @@  discard block
 block discarded – undo
7451 7451
 	*/
7452 7452
 	public function countAllRoutesByCountry($country)
7453 7453
 	{
7454
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
7454
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
7455 7455
 		
7456
-		$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
7456
+		$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
7457 7457
 								FROM spotter_output
7458 7458
                     WHERE spotter_output.ident <> '' AND ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country 
7459 7459
                     GROUP BY route
@@ -7466,7 +7466,7 @@  discard block
 block discarded – undo
7466 7466
 		$routes_array = array();
7467 7467
 		$temp_array = array();
7468 7468
         
7469
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7469
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7470 7470
 		{
7471 7471
 			$temp_array['route_count'] = $row['route_count'];
7472 7472
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -7494,7 +7494,7 @@  discard block
 block discarded – undo
7494 7494
 	public function countAllRoutesByDate($date)
7495 7495
 	{
7496 7496
 		global $globalTimezone, $globalDBdriver;
7497
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
7497
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
7498 7498
 		if ($globalTimezone != '') {
7499 7499
 			date_default_timezone_set($globalTimezone);
7500 7500
 			$datetime = new DateTime($date);
@@ -7502,13 +7502,13 @@  discard block
 block discarded – undo
7502 7502
 		} else $offset = '+00:00';
7503 7503
 		
7504 7504
 		if ($globalDBdriver == 'mysql') {
7505
-			$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
7505
+			$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
7506 7506
 					FROM spotter_output
7507 7507
 					WHERE spotter_output.ident <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date  
7508 7508
 					GROUP BY route
7509 7509
 					ORDER BY route_count DESC";
7510 7510
 		} else {
7511
-			$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
7511
+			$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
7512 7512
 					FROM spotter_output
7513 7513
 					WHERE spotter_output.ident <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date  
7514 7514
 					GROUP BY route
@@ -7521,7 +7521,7 @@  discard block
 block discarded – undo
7521 7521
 		$routes_array = array();
7522 7522
 		$temp_array = array();
7523 7523
         
7524
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7524
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7525 7525
 		{
7526 7526
 			$temp_array['route_count'] = $row['route_count'];
7527 7527
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -7548,9 +7548,9 @@  discard block
 block discarded – undo
7548 7548
 	*/
7549 7549
 	public function countAllRoutesByIdent($ident)
7550 7550
 	{
7551
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
7551
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
7552 7552
 		
7553
-		$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
7553
+		$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
7554 7554
 		    FROM spotter_output
7555 7555
                     WHERE spotter_output.ident <> '' AND spotter_output.ident = :ident   
7556 7556
                     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
@@ -7563,7 +7563,7 @@  discard block
 block discarded – undo
7563 7563
 		$routes_array = array();
7564 7564
 		$temp_array = array();
7565 7565
         
7566
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7566
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7567 7567
 		{
7568 7568
 			$temp_array['route_count'] = $row['route_count'];
7569 7569
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -7590,9 +7590,9 @@  discard block
 block discarded – undo
7590 7590
 	*/
7591 7591
 	public function countAllRoutesByManufacturer($aircraft_manufacturer)
7592 7592
 	{
7593
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
7593
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
7594 7594
 		
7595
-		$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
7595
+		$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
7596 7596
 		    FROM spotter_output
7597 7597
                     WHERE spotter_output.ident <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer   
7598 7598
                     GROUP BY route
@@ -7605,7 +7605,7 @@  discard block
 block discarded – undo
7605 7605
 		$routes_array = array();
7606 7606
 		$temp_array = array();
7607 7607
         
7608
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7608
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7609 7609
 		{
7610 7610
 			$temp_array['route_count'] = $row['route_count'];
7611 7611
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -7633,7 +7633,7 @@  discard block
 block discarded – undo
7633 7633
 	*/
7634 7634
 	public function countAllRoutesWithWaypoints()
7635 7635
 	{
7636
-		$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
7636
+		$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
7637 7637
 		    FROM spotter_output
7638 7638
                     WHERE spotter_output.ident <> '' AND spotter_output.waypoints <> '' 
7639 7639
                     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
@@ -7647,7 +7647,7 @@  discard block
 block discarded – undo
7647 7647
 		$routes_array = array();
7648 7648
 		$temp_array = array();
7649 7649
         
7650
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7650
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7651 7651
 		{
7652 7652
 			$temp_array['spotter_id'] = $row['spotter_id'];
7653 7653
 			$temp_array['route_count'] = $row['route_count'];
@@ -7675,11 +7675,11 @@  discard block
 block discarded – undo
7675 7675
 	* @return Array the callsign list
7676 7676
 	*
7677 7677
 	*/
7678
-	public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
7678
+	public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
7679 7679
 	{
7680 7680
 		global $globalDBdriver;
7681
-		$filter_query = $this->getFilter($filters,true,true);
7682
-		$query  = "SELECT DISTINCT spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name, spotter_output.airline_icao  
7681
+		$filter_query = $this->getFilter($filters, true, true);
7682
+		$query = "SELECT DISTINCT spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name, spotter_output.airline_icao  
7683 7683
                     FROM spotter_output".$filter_query." spotter_output.ident <> '' ";
7684 7684
 		 if ($olderthanmonths > 0) {
7685 7685
 			if ($globalDBdriver == 'mysql') $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)';
@@ -7698,7 +7698,7 @@  discard block
 block discarded – undo
7698 7698
 		$callsign_array = array();
7699 7699
 		$temp_array = array();
7700 7700
         
7701
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7701
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7702 7702
 		{
7703 7703
 			$temp_array['callsign_icao'] = $row['ident'];
7704 7704
 			$temp_array['airline_name'] = $row['airline_name'];
@@ -7720,7 +7720,7 @@  discard block
 block discarded – undo
7720 7720
 	public function countAllCallsignsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '')
7721 7721
 	{
7722 7722
 		global $globalDBdriver;
7723
-		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name  
7723
+		$query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name  
7724 7724
                     FROM spotter_output
7725 7725
                     WHERE spotter_output.ident <> ''  AND spotter_output.airline_icao <> '' ";
7726 7726
 		 if ($olderthanmonths > 0) {
@@ -7740,7 +7740,7 @@  discard block
 block discarded – undo
7740 7740
 		$callsign_array = array();
7741 7741
 		$temp_array = array();
7742 7742
         
7743
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7743
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7744 7744
 		{
7745 7745
 			$temp_array['callsign_icao'] = $row['ident'];
7746 7746
 			$temp_array['airline_name'] = $row['airline_name'];
@@ -7794,7 +7794,7 @@  discard block
 block discarded – undo
7794 7794
 		$date_array = array();
7795 7795
 		$temp_array = array();
7796 7796
         
7797
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7797
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7798 7798
 		{
7799 7799
 			$temp_array['date_name'] = $row['date_name'];
7800 7800
 			$temp_array['date_count'] = $row['date_count'];
@@ -7821,14 +7821,14 @@  discard block
 block discarded – undo
7821 7821
 		} else $offset = '+00:00';
7822 7822
 
7823 7823
 		if ($globalDBdriver == 'mysql') {
7824
-			$query  = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
7824
+			$query = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
7825 7825
 								FROM spotter_output 
7826 7826
 								WHERE spotter_output.airline_icao <> '' 
7827 7827
 								GROUP BY spotter_output.airline_icao, date_name 
7828 7828
 								ORDER BY date_count DESC
7829 7829
 								LIMIT 10 OFFSET 0";
7830 7830
 		} else {
7831
-			$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
7831
+			$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
7832 7832
 								FROM spotter_output 
7833 7833
 								WHERE spotter_output.airline_icao <> '' 
7834 7834
 								GROUP BY spotter_output.airline_icao, date_name 
@@ -7843,7 +7843,7 @@  discard block
 block discarded – undo
7843 7843
 		$date_array = array();
7844 7844
 		$temp_array = array();
7845 7845
         
7846
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7846
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7847 7847
 		{
7848 7848
 			$temp_array['date_name'] = $row['date_name'];
7849 7849
 			$temp_array['date_count'] = $row['date_count'];
@@ -7869,7 +7869,7 @@  discard block
 block discarded – undo
7869 7869
 			$datetime = new DateTime();
7870 7870
 			$offset = $datetime->format('P');
7871 7871
 		} else $offset = '+00:00';
7872
-		$filter_query = $this->getFilter($filters,true,true);
7872
+		$filter_query = $this->getFilter($filters, true, true);
7873 7873
 		if ($globalDBdriver == 'mysql') {
7874 7874
 			$query  = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
7875 7875
 								FROM spotter_output".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY)";
@@ -7890,7 +7890,7 @@  discard block
 block discarded – undo
7890 7890
 		$date_array = array();
7891 7891
 		$temp_array = array();
7892 7892
         
7893
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7893
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7894 7894
 		{
7895 7895
 			$temp_array['date_name'] = $row['date_name'];
7896 7896
 			$temp_array['date_count'] = $row['date_count'];
@@ -7915,7 +7915,7 @@  discard block
 block discarded – undo
7915 7915
 			$datetime = new DateTime();
7916 7916
 			$offset = $datetime->format('P');
7917 7917
 		} else $offset = '+00:00';
7918
-		$filter_query = $this->getFilter($filters,true,true);
7918
+		$filter_query = $this->getFilter($filters, true, true);
7919 7919
 		if ($globalDBdriver == 'mysql') {
7920 7920
 			$query  = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
7921 7921
 								FROM spotter_output".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MONTH)";
@@ -7936,7 +7936,7 @@  discard block
 block discarded – undo
7936 7936
 		$date_array = array();
7937 7937
 		$temp_array = array();
7938 7938
         
7939
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7939
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7940 7940
 		{
7941 7941
 			$temp_array['date_name'] = $row['date_name'];
7942 7942
 			$temp_array['date_count'] = $row['date_count'];
@@ -7964,14 +7964,14 @@  discard block
 block discarded – undo
7964 7964
 		} else $offset = '+00:00';
7965 7965
 		
7966 7966
 		if ($globalDBdriver == 'mysql') {
7967
-			$query  = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
7967
+			$query = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
7968 7968
 								FROM spotter_output 
7969 7969
 								WHERE spotter_output.airline_icao <> '' AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MONTH)
7970 7970
 								GROUP BY spotter_output.airline_icao, date_name 
7971 7971
 								ORDER BY spotter_output.date ASC";
7972 7972
 			$query_data = array(':offset' => $offset);
7973 7973
 		} else {
7974
-			$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
7974
+			$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
7975 7975
 								FROM spotter_output 
7976 7976
 								WHERE spotter_output.airline_icao <> '' AND spotter_output.date >= CURRENT_TIMESTAMP AT TIME ZONE INTERVAL :offset - INTERVAL '1 MONTHS'
7977 7977
 								GROUP BY spotter_output.airline_icao, date_name 
@@ -7985,7 +7985,7 @@  discard block
 block discarded – undo
7985 7985
 		$date_array = array();
7986 7986
 		$temp_array = array();
7987 7987
         
7988
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7988
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7989 7989
 		{
7990 7990
 			$temp_array['date_name'] = $row['date_name'];
7991 7991
 			$temp_array['date_count'] = $row['date_count'];
@@ -8032,7 +8032,7 @@  discard block
 block discarded – undo
8032 8032
 		$date_array = array();
8033 8033
 		$temp_array = array();
8034 8034
         
8035
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8035
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8036 8036
 		{
8037 8037
 			$temp_array['month_name'] = $row['month_name'];
8038 8038
 			$temp_array['year_name'] = $row['year_name'];
@@ -8060,13 +8060,13 @@  discard block
 block discarded – undo
8060 8060
 		} else $offset = '+00:00';
8061 8061
 
8062 8062
 		if ($globalDBdriver == 'mysql') {
8063
-			$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
8063
+			$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
8064 8064
 								FROM spotter_output 
8065 8065
 								WHERE spotter_output.airline_icao <> '' 
8066 8066
 								GROUP BY spotter_output.airline_icao, year_name, month_name 
8067 8067
 								ORDER BY date_count DESC";
8068 8068
 		} else {
8069
-			$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
8069
+			$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
8070 8070
 								FROM spotter_output 
8071 8071
 								WHERE spotter_output.airline_icao <> '' 
8072 8072
 								GROUP BY spotter_output.airline_icao, year_name, month_name 
@@ -8080,7 +8080,7 @@  discard block
 block discarded – undo
8080 8080
 		$date_array = array();
8081 8081
 		$temp_array = array();
8082 8082
         
8083
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8083
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8084 8084
 		{
8085 8085
 			$temp_array['month_name'] = $row['month_name'];
8086 8086
 			$temp_array['year_name'] = $row['year_name'];
@@ -8109,13 +8109,13 @@  discard block
 block discarded – undo
8109 8109
 		} else $offset = '+00:00';
8110 8110
 
8111 8111
 		if ($globalDBdriver == 'mysql') {
8112
-			$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
8112
+			$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
8113 8113
 								FROM spotter_output s
8114 8114
 								WHERE s.airline_type = 'military'
8115 8115
 								GROUP BY year_name, month_name 
8116 8116
 								ORDER BY date_count DESC";
8117 8117
 		} else {
8118
-			$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
8118
+			$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
8119 8119
 								FROM spotter_output s
8120 8120
 								WHERE s.airline_type = 'military'
8121 8121
 								GROUP BY year_name, month_name 
@@ -8128,7 +8128,7 @@  discard block
 block discarded – undo
8128 8128
 		$date_array = array();
8129 8129
 		$temp_array = array();
8130 8130
         
8131
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8131
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8132 8132
 		{
8133 8133
 			$temp_array['month_name'] = $row['month_name'];
8134 8134
 			$temp_array['year_name'] = $row['year_name'];
@@ -8156,13 +8156,13 @@  discard block
 block discarded – undo
8156 8156
 		} else $offset = '+00:00';
8157 8157
 
8158 8158
 		if ($globalDBdriver == 'mysql') {
8159
-			$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
8159
+			$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
8160 8160
 								FROM spotter_output 
8161 8161
 								WHERE owner_name <> ''
8162 8162
 								GROUP BY year_name, month_name
8163 8163
 								ORDER BY date_count DESC";
8164 8164
 		} else {
8165
-			$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
8165
+			$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
8166 8166
 								FROM spotter_output 
8167 8167
 								WHERE owner_name <> ''
8168 8168
 								GROUP BY year_name, month_name
@@ -8175,7 +8175,7 @@  discard block
 block discarded – undo
8175 8175
 		$date_array = array();
8176 8176
 		$temp_array = array();
8177 8177
         
8178
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8178
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8179 8179
 		{
8180 8180
 			$temp_array['month_name'] = $row['month_name'];
8181 8181
 			$temp_array['year_name'] = $row['year_name'];
@@ -8203,13 +8203,13 @@  discard block
 block discarded – undo
8203 8203
 		} else $offset = '+00:00';
8204 8204
 
8205 8205
 		if ($globalDBdriver == 'mysql') {
8206
-			$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
8206
+			$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 8207
 								FROM spotter_output 
8208 8208
 								WHERE owner_name <> '' AND spotter_output.airline_icao <> '' 
8209 8209
 								GROUP BY spotter_output.airline_icao, year_name, month_name
8210 8210
 								ORDER BY date_count DESC";
8211 8211
 		} else {
8212
-			$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
8212
+			$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 8213
 								FROM spotter_output 
8214 8214
 								WHERE owner_name <> '' AND spotter_output.airline_icao <> '' 
8215 8215
 								GROUP BY spotter_output.airline_icao, year_name, month_name
@@ -8222,7 +8222,7 @@  discard block
 block discarded – undo
8222 8222
 		$date_array = array();
8223 8223
 		$temp_array = array();
8224 8224
         
8225
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8225
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8226 8226
 		{
8227 8227
 			$temp_array['month_name'] = $row['month_name'];
8228 8228
 			$temp_array['year_name'] = $row['year_name'];
@@ -8251,13 +8251,13 @@  discard block
 block discarded – undo
8251 8251
 		} else $offset = '+00:00';
8252 8252
 
8253 8253
 		if ($globalDBdriver == 'mysql') {
8254
-			$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
8254
+			$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
8255 8255
 								FROM spotter_output 
8256 8256
 								WHERE pilot_id <> '' AND pilot_id IS NOT NULL
8257 8257
 								GROUP BY year_name, month_name
8258 8258
 								ORDER BY date_count DESC";
8259 8259
 		} else {
8260
-			$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
8260
+			$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 8261
 								FROM spotter_output 
8262 8262
 								WHERE pilot_id <> '' AND pilot_id IS NOT NULL
8263 8263
 								GROUP BY year_name, month_name
@@ -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'];
@@ -8393,13 +8393,13 @@  discard block
 block discarded – undo
8393 8393
 		} else $offset = '+00:00';
8394 8394
 
8395 8395
 		if ($globalDBdriver == 'mysql') {
8396
-			$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
8396
+			$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 8397
 								FROM spotter_output 
8398 8398
 								WHERE 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 
8404 8404
 								WHERE aircraft_icao <> '' 
8405 8405
 								GROUP BY year_name, month_name
@@ -8412,7 +8412,7 @@  discard block
 block discarded – undo
8412 8412
 		$date_array = array();
8413 8413
 		$temp_array = array();
8414 8414
         
8415
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8415
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8416 8416
 		{
8417 8417
 			$temp_array['month_name'] = $row['month_name'];
8418 8418
 			$temp_array['year_name'] = $row['year_name'];
@@ -8441,13 +8441,13 @@  discard block
 block discarded – undo
8441 8441
 		} else $offset = '+00:00';
8442 8442
 
8443 8443
 		if ($globalDBdriver == 'mysql') {
8444
-			$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
+			$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
8445 8445
 								FROM spotter_output 
8446 8446
 								WHERE aircraft_icao <> ''  AND spotter_output.airline_icao <> '' 
8447 8447
 								GROUP BY spotter_output.airline_icao, year_name, month_name
8448 8448
 								ORDER BY date_count DESC";
8449 8449
 		} else {
8450
-			$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
+			$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
8451 8451
 								FROM spotter_output 
8452 8452
 								WHERE aircraft_icao <> '' AND spotter_output.airline_icao <> '' 
8453 8453
 								GROUP BY spotter_output.airline_icao, year_name, month_name
@@ -8460,7 +8460,7 @@  discard block
 block discarded – undo
8460 8460
 		$date_array = array();
8461 8461
 		$temp_array = array();
8462 8462
         
8463
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8463
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8464 8464
 		{
8465 8465
 			$temp_array['month_name'] = $row['month_name'];
8466 8466
 			$temp_array['year_name'] = $row['year_name'];
@@ -8489,13 +8489,13 @@  discard block
 block discarded – undo
8489 8489
 		} else $offset = '+00:00';
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 
8494 8494
 								WHERE real_arrival_airport_icao <> '' 
8495 8495
 								GROUP BY year_name, month_name
8496 8496
 								ORDER BY date_count DESC";
8497 8497
 		} else {
8498
-			$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
+			$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
8499 8499
 								FROM spotter_output 
8500 8500
 								WHERE real_arrival_airport_icao <> '' 
8501 8501
 								GROUP BY year_name, month_name
@@ -8508,7 +8508,7 @@  discard block
 block discarded – undo
8508 8508
 		$date_array = array();
8509 8509
 		$temp_array = array();
8510 8510
         
8511
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8511
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8512 8512
 		{
8513 8513
 			$temp_array['month_name'] = $row['month_name'];
8514 8514
 			$temp_array['year_name'] = $row['year_name'];
@@ -8537,13 +8537,13 @@  discard block
 block discarded – undo
8537 8537
 		} else $offset = '+00:00';
8538 8538
 
8539 8539
 		if ($globalDBdriver == 'mysql') {
8540
-			$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
8540
+			$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
8541 8541
 								FROM spotter_output 
8542 8542
 								WHERE real_arrival_airport_icao <> '' AND spotter_output.airline_icao <> '' 
8543 8543
 								GROUP BY spotter_output.airline_icao, year_name, month_name
8544 8544
 								ORDER BY date_count DESC";
8545 8545
 		} else {
8546
-			$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
8546
+			$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
8547 8547
 								FROM spotter_output 
8548 8548
 								WHERE real_arrival_airport_icao <> '' AND spotter_output.airline_icao <> '' 
8549 8549
 								GROUP BY spotter_output.airline_icao, year_name, month_name
@@ -8556,7 +8556,7 @@  discard block
 block discarded – undo
8556 8556
 		$date_array = array();
8557 8557
 		$temp_array = array();
8558 8558
         
8559
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8559
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8560 8560
 		{
8561 8561
 			$temp_array['month_name'] = $row['month_name'];
8562 8562
 			$temp_array['year_name'] = $row['year_name'];
@@ -8584,7 +8584,7 @@  discard block
 block discarded – undo
8584 8584
 			$datetime = new DateTime();
8585 8585
 			$offset = $datetime->format('P');
8586 8586
 		} else $offset = '+00:00';
8587
-		$filter_query = $this->getFilter($filters,true,true);
8587
+		$filter_query = $this->getFilter($filters, true, true);
8588 8588
 		if ($globalDBdriver == 'mysql') {
8589 8589
 			$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
8590 8590
 								FROM spotter_output".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 YEAR)";
@@ -8605,7 +8605,7 @@  discard block
 block discarded – undo
8605 8605
 		$date_array = array();
8606 8606
 		$temp_array = array();
8607 8607
         
8608
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8608
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8609 8609
 		{
8610 8610
 			$temp_array['year_name'] = $row['year_name'];
8611 8611
 			$temp_array['month_name'] = $row['month_name'];
@@ -8625,7 +8625,7 @@  discard block
 block discarded – undo
8625 8625
 	* @return Array the hour list
8626 8626
 	*
8627 8627
 	*/
8628
-	public function countAllHours($orderby,$filters = array())
8628
+	public function countAllHours($orderby, $filters = array())
8629 8629
 	{
8630 8630
 		global $globalTimezone, $globalDBdriver;
8631 8631
 		if ($globalTimezone != '') {
@@ -8673,7 +8673,7 @@  discard block
 block discarded – undo
8673 8673
 		$hour_array = array();
8674 8674
 		$temp_array = array();
8675 8675
         
8676
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8676
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8677 8677
 		{
8678 8678
 			$temp_array['hour_name'] = $row['hour_name'];
8679 8679
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -8710,7 +8710,7 @@  discard block
 block discarded – undo
8710 8710
 		}
8711 8711
 		
8712 8712
 		if ($globalDBdriver == 'mysql') {
8713
-			$query  = "SELECT spotter_output.airline_icao, HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8713
+			$query = "SELECT spotter_output.airline_icao, HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8714 8714
 								FROM spotter_output 
8715 8715
 								WHERE spotter_output.airline_icao <> '' 
8716 8716
 								GROUP BY spotter_output.airline_icao, hour_name 
@@ -8724,7 +8724,7 @@  discard block
 block discarded – undo
8724 8724
   */    
8725 8725
 		$query_data = array(':offset' => $offset);
8726 8726
 		} else {
8727
-			$query  = "SELECT spotter_output.airline_icao, EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8727
+			$query = "SELECT spotter_output.airline_icao, EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8728 8728
 								FROM spotter_output 
8729 8729
 								WHERE spotter_output.airline_icao <> '' 
8730 8730
 								GROUP BY spotter_output.airline_icao, hour_name 
@@ -8738,7 +8738,7 @@  discard block
 block discarded – undo
8738 8738
 		$hour_array = array();
8739 8739
 		$temp_array = array();
8740 8740
         
8741
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8741
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8742 8742
 		{
8743 8743
 			$temp_array['hour_name'] = $row['hour_name'];
8744 8744
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -8767,16 +8767,16 @@  discard block
 block discarded – undo
8767 8767
 			$offset = $datetime->format('P');
8768 8768
 		} else $offset = '+00:00';
8769 8769
 
8770
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
8770
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
8771 8771
 
8772 8772
 		if ($globalDBdriver == 'mysql') {
8773
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8773
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8774 8774
 								FROM spotter_output 
8775 8775
 								WHERE spotter_output.airline_icao = :airline_icao
8776 8776
 								GROUP BY hour_name 
8777 8777
 								ORDER BY hour_name ASC";
8778 8778
 		} else {
8779
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8779
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8780 8780
 								FROM spotter_output 
8781 8781
 								WHERE spotter_output.airline_icao = :airline_icao
8782 8782
 								GROUP BY hour_name 
@@ -8784,12 +8784,12 @@  discard block
 block discarded – undo
8784 8784
 		}
8785 8785
 		
8786 8786
 		$sth = $this->db->prepare($query);
8787
-		$sth->execute(array(':airline_icao' => $airline_icao,':offset' => $offset));
8787
+		$sth->execute(array(':airline_icao' => $airline_icao, ':offset' => $offset));
8788 8788
       
8789 8789
 		$hour_array = array();
8790 8790
 		$temp_array = array();
8791 8791
         
8792
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8792
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8793 8793
 		{
8794 8794
 			$temp_array['hour_name'] = $row['hour_name'];
8795 8795
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -8812,7 +8812,7 @@  discard block
 block discarded – undo
8812 8812
 	public function countAllHoursByAircraft($aircraft_icao)
8813 8813
 	{
8814 8814
 		global $globalTimezone, $globalDBdriver;
8815
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
8815
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
8816 8816
 		if ($globalTimezone != '') {
8817 8817
 			date_default_timezone_set($globalTimezone);
8818 8818
 			$datetime = new DateTime();
@@ -8820,13 +8820,13 @@  discard block
 block discarded – undo
8820 8820
 		} else $offset = '+00:00';
8821 8821
 
8822 8822
 		if ($globalDBdriver == 'mysql') {
8823
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8823
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8824 8824
 								FROM spotter_output 
8825 8825
 								WHERE spotter_output.aircraft_icao = :aircraft_icao
8826 8826
 								GROUP BY hour_name 
8827 8827
 								ORDER BY hour_name ASC";
8828 8828
 		} else {
8829
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8829
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8830 8830
 								FROM spotter_output 
8831 8831
 								WHERE spotter_output.aircraft_icao = :aircraft_icao
8832 8832
 								GROUP BY hour_name 
@@ -8834,12 +8834,12 @@  discard block
 block discarded – undo
8834 8834
 		}
8835 8835
 		
8836 8836
 		$sth = $this->db->prepare($query);
8837
-		$sth->execute(array(':aircraft_icao' => $aircraft_icao,':offset' => $offset));
8837
+		$sth->execute(array(':aircraft_icao' => $aircraft_icao, ':offset' => $offset));
8838 8838
       
8839 8839
 		$hour_array = array();
8840 8840
 		$temp_array = array();
8841 8841
         
8842
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8842
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8843 8843
 		{
8844 8844
 			$temp_array['hour_name'] = $row['hour_name'];
8845 8845
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -8860,7 +8860,7 @@  discard block
 block discarded – undo
8860 8860
 	public function countAllHoursByRegistration($registration)
8861 8861
 	{
8862 8862
 		global $globalTimezone, $globalDBdriver;
8863
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
8863
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
8864 8864
 		if ($globalTimezone != '') {
8865 8865
 			date_default_timezone_set($globalTimezone);
8866 8866
 			$datetime = new DateTime();
@@ -8868,13 +8868,13 @@  discard block
 block discarded – undo
8868 8868
 		} else $offset = '+00:00';
8869 8869
 
8870 8870
 		if ($globalDBdriver == 'mysql') {
8871
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8871
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8872 8872
 								FROM spotter_output 
8873 8873
 								WHERE spotter_output.registration = :registration
8874 8874
 								GROUP BY hour_name 
8875 8875
 								ORDER BY hour_name ASC";
8876 8876
 		} else {
8877
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8877
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8878 8878
 								FROM spotter_output 
8879 8879
 								WHERE spotter_output.registration = :registration
8880 8880
 								GROUP BY hour_name 
@@ -8882,12 +8882,12 @@  discard block
 block discarded – undo
8882 8882
 		}
8883 8883
 		
8884 8884
 		$sth = $this->db->prepare($query);
8885
-		$sth->execute(array(':registration' => $registration,':offset' => $offset));
8885
+		$sth->execute(array(':registration' => $registration, ':offset' => $offset));
8886 8886
       
8887 8887
 		$hour_array = array();
8888 8888
 		$temp_array = array();
8889 8889
         
8890
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8890
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8891 8891
 		{
8892 8892
 			$temp_array['hour_name'] = $row['hour_name'];
8893 8893
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -8908,7 +8908,7 @@  discard block
 block discarded – undo
8908 8908
 	public function countAllHoursByAirport($airport_icao)
8909 8909
 	{
8910 8910
 		global $globalTimezone, $globalDBdriver;
8911
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
8911
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
8912 8912
 		if ($globalTimezone != '') {
8913 8913
 			date_default_timezone_set($globalTimezone);
8914 8914
 			$datetime = new DateTime();
@@ -8916,13 +8916,13 @@  discard block
 block discarded – undo
8916 8916
 		} else $offset = '+00:00';
8917 8917
 
8918 8918
 		if ($globalDBdriver == 'mysql') {
8919
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8919
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8920 8920
 								FROM spotter_output 
8921 8921
 								WHERE (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao)
8922 8922
 								GROUP BY hour_name 
8923 8923
 								ORDER BY hour_name ASC";
8924 8924
 		} else {
8925
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8925
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8926 8926
 								FROM spotter_output 
8927 8927
 								WHERE (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao)
8928 8928
 								GROUP BY hour_name 
@@ -8930,12 +8930,12 @@  discard block
 block discarded – undo
8930 8930
 		}
8931 8931
 		
8932 8932
 		$sth = $this->db->prepare($query);
8933
-		$sth->execute(array(':airport_icao' => $airport_icao,':offset' => $offset));
8933
+		$sth->execute(array(':airport_icao' => $airport_icao, ':offset' => $offset));
8934 8934
       
8935 8935
 		$hour_array = array();
8936 8936
 		$temp_array = array();
8937 8937
         
8938
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8938
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8939 8939
 		{
8940 8940
 			$temp_array['hour_name'] = $row['hour_name'];
8941 8941
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -8957,7 +8957,7 @@  discard block
 block discarded – undo
8957 8957
 	public function countAllHoursByManufacturer($aircraft_manufacturer)
8958 8958
 	{
8959 8959
 		global $globalTimezone, $globalDBdriver;
8960
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
8960
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
8961 8961
 		if ($globalTimezone != '') {
8962 8962
 			date_default_timezone_set($globalTimezone);
8963 8963
 			$datetime = new DateTime();
@@ -8965,13 +8965,13 @@  discard block
 block discarded – undo
8965 8965
 		} else $offset = '+00:00';
8966 8966
 
8967 8967
 		if ($globalDBdriver == 'mysql') {
8968
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8968
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8969 8969
 								FROM spotter_output 
8970 8970
 								WHERE spotter_output.aircraft_manufacturer = :aircraft_manufacturer
8971 8971
 								GROUP BY hour_name 
8972 8972
 								ORDER BY hour_name ASC";
8973 8973
 		} else {
8974
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8974
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8975 8975
 								FROM spotter_output 
8976 8976
 								WHERE spotter_output.aircraft_manufacturer = :aircraft_manufacturer
8977 8977
 								GROUP BY hour_name 
@@ -8979,12 +8979,12 @@  discard block
 block discarded – undo
8979 8979
 		}
8980 8980
 		
8981 8981
 		$sth = $this->db->prepare($query);
8982
-		$sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer,':offset' => $offset));
8982
+		$sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer, ':offset' => $offset));
8983 8983
       
8984 8984
 		$hour_array = array();
8985 8985
 		$temp_array = array();
8986 8986
         
8987
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8987
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8988 8988
 		{
8989 8989
 			$temp_array['hour_name'] = $row['hour_name'];
8990 8990
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -9006,7 +9006,7 @@  discard block
 block discarded – undo
9006 9006
 	public function countAllHoursByDate($date)
9007 9007
 	{
9008 9008
 		global $globalTimezone, $globalDBdriver;
9009
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
9009
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
9010 9010
 		if ($globalTimezone != '') {
9011 9011
 			date_default_timezone_set($globalTimezone);
9012 9012
 			$datetime = new DateTime($date);
@@ -9014,13 +9014,13 @@  discard block
 block discarded – undo
9014 9014
 		} else $offset = '+00:00';
9015 9015
 
9016 9016
 		if ($globalDBdriver == 'mysql') {
9017
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9017
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9018 9018
 								FROM spotter_output 
9019 9019
 								WHERE DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date
9020 9020
 								GROUP BY hour_name 
9021 9021
 								ORDER BY hour_name ASC";
9022 9022
 		} else {
9023
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9023
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9024 9024
 								FROM spotter_output 
9025 9025
 								WHERE to_char(spotter_output.date AT TIME ZONE INTERVAL :offset, 'YYYY-mm-dd') = :date
9026 9026
 								GROUP BY hour_name 
@@ -9033,7 +9033,7 @@  discard block
 block discarded – undo
9033 9033
 		$hour_array = array();
9034 9034
 		$temp_array = array();
9035 9035
         
9036
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9036
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9037 9037
 		{
9038 9038
 			$temp_array['hour_name'] = $row['hour_name'];
9039 9039
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -9055,7 +9055,7 @@  discard block
 block discarded – undo
9055 9055
 	public function countAllHoursByIdent($ident)
9056 9056
 	{
9057 9057
 		global $globalTimezone, $globalDBdriver;
9058
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
9058
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
9059 9059
 		if ($globalTimezone != '') {
9060 9060
 			date_default_timezone_set($globalTimezone);
9061 9061
 			$datetime = new DateTime();
@@ -9063,13 +9063,13 @@  discard block
 block discarded – undo
9063 9063
 		} else $offset = '+00:00';
9064 9064
 
9065 9065
 		if ($globalDBdriver == 'mysql') {
9066
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9066
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9067 9067
 								FROM spotter_output 
9068 9068
 								WHERE spotter_output.ident = :ident 
9069 9069
 								GROUP BY hour_name 
9070 9070
 								ORDER BY hour_name ASC";
9071 9071
 		} else {
9072
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9072
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9073 9073
 								FROM spotter_output 
9074 9074
 								WHERE spotter_output.ident = :ident 
9075 9075
 								GROUP BY hour_name 
@@ -9078,12 +9078,12 @@  discard block
 block discarded – undo
9078 9078
       
9079 9079
 		
9080 9080
 		$sth = $this->db->prepare($query);
9081
-		$sth->execute(array(':ident' => $ident,':offset' => $offset));
9081
+		$sth->execute(array(':ident' => $ident, ':offset' => $offset));
9082 9082
       
9083 9083
 		$hour_array = array();
9084 9084
 		$temp_array = array();
9085 9085
         
9086
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9086
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9087 9087
 		{
9088 9088
 			$temp_array['hour_name'] = $row['hour_name'];
9089 9089
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -9105,8 +9105,8 @@  discard block
 block discarded – undo
9105 9105
 	public function countAllHoursByRoute($departure_airport_icao, $arrival_airport_icao)
9106 9106
 	{
9107 9107
 		global $globalTimezone, $globalDBdriver;
9108
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
9109
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
9108
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
9109
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
9110 9110
 		if ($globalTimezone != '') {
9111 9111
 			date_default_timezone_set($globalTimezone);
9112 9112
 			$datetime = new DateTime();
@@ -9114,13 +9114,13 @@  discard block
 block discarded – undo
9114 9114
 		} else $offset = '+00:00';
9115 9115
 
9116 9116
 		if ($globalDBdriver == 'mysql') {
9117
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9117
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9118 9118
 								FROM spotter_output 
9119 9119
 								WHERE (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao)
9120 9120
 								GROUP BY hour_name 
9121 9121
 								ORDER BY hour_name ASC";
9122 9122
 		} else {
9123
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9123
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9124 9124
 								FROM spotter_output 
9125 9125
 								WHERE (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao)
9126 9126
 								GROUP BY hour_name 
@@ -9128,12 +9128,12 @@  discard block
 block discarded – undo
9128 9128
 		}
9129 9129
 		
9130 9130
 		$sth = $this->db->prepare($query);
9131
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao,':offset' => $offset));
9131
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao, ':offset' => $offset));
9132 9132
       
9133 9133
 		$hour_array = array();
9134 9134
 		$temp_array = array();
9135 9135
         
9136
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9136
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9137 9137
 		{
9138 9138
 			$temp_array['hour_name'] = $row['hour_name'];
9139 9139
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -9154,7 +9154,7 @@  discard block
 block discarded – undo
9154 9154
 	public function countAllHoursByCountry($country)
9155 9155
 	{
9156 9156
 		global $globalTimezone, $globalDBdriver;
9157
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
9157
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
9158 9158
 		if ($globalTimezone != '') {
9159 9159
 			date_default_timezone_set($globalTimezone);
9160 9160
 			$datetime = new DateTime();
@@ -9162,13 +9162,13 @@  discard block
 block discarded – undo
9162 9162
 		} else $offset = '+00:00';
9163 9163
 
9164 9164
 		if ($globalDBdriver == 'mysql') {
9165
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9165
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9166 9166
 								FROM spotter_output 
9167 9167
 								WHERE ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country
9168 9168
 								GROUP BY hour_name 
9169 9169
 								ORDER BY hour_name ASC";
9170 9170
 		} else {
9171
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9171
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9172 9172
 								FROM spotter_output 
9173 9173
 								WHERE ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country
9174 9174
 								GROUP BY hour_name 
@@ -9176,12 +9176,12 @@  discard block
 block discarded – undo
9176 9176
 		}
9177 9177
 		
9178 9178
 		$sth = $this->db->prepare($query);
9179
-		$sth->execute(array(':country' => $country,':offset' => $offset));
9179
+		$sth->execute(array(':country' => $country, ':offset' => $offset));
9180 9180
       
9181 9181
 		$hour_array = array();
9182 9182
 		$temp_array = array();
9183 9183
         
9184
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9184
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9185 9185
 		{
9186 9186
 			$temp_array['hour_name'] = $row['hour_name'];
9187 9187
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -9203,8 +9203,8 @@  discard block
 block discarded – undo
9203 9203
 	*/
9204 9204
 	public function countOverallAircrafts($filters = array())
9205 9205
 	{
9206
-		$filter_query = $this->getFilter($filters,true,true);
9207
-		$query  = "SELECT COUNT(DISTINCT spotter_output.aircraft_icao) AS aircraft_count  
9206
+		$filter_query = $this->getFilter($filters, true, true);
9207
+		$query = "SELECT COUNT(DISTINCT spotter_output.aircraft_icao) AS aircraft_count  
9208 9208
                     FROM spotter_output".$filter_query." spotter_output.ident <> ''";
9209 9209
 		$sth = $this->db->prepare($query);
9210 9210
 		$sth->execute();
@@ -9219,8 +9219,8 @@  discard block
 block discarded – undo
9219 9219
 	*/
9220 9220
 	public function countOverallArrival($filters = array())
9221 9221
 	{
9222
-		$filter_query = $this->getFilter($filters,true,true);
9223
-		$query  = "SELECT COUNT(spotter_output.real_arrival_airport_icao) AS arrival_count  
9222
+		$filter_query = $this->getFilter($filters, true, true);
9223
+		$query = "SELECT COUNT(spotter_output.real_arrival_airport_icao) AS arrival_count  
9224 9224
                     FROM spotter_output".$filter_query." spotter_output.arrival_airport_icao <> ''";
9225 9225
 		
9226 9226
 		$sth = $this->db->prepare($query);
@@ -9236,8 +9236,8 @@  discard block
 block discarded – undo
9236 9236
 	*/
9237 9237
 	public function countOverallPilots($filters = array())
9238 9238
 	{
9239
-		$filter_query = $this->getFilter($filters,true,true);
9240
-		$query  = "SELECT COUNT(DISTINCT spotter_output.pilot_id) AS pilot_count  
9239
+		$filter_query = $this->getFilter($filters, true, true);
9240
+		$query = "SELECT COUNT(DISTINCT spotter_output.pilot_id) AS pilot_count  
9241 9241
                     FROM spotter_output".$filter_query." spotter_output.pilot_id <> ''";
9242 9242
 		$sth = $this->db->prepare($query);
9243 9243
 		$sth->execute();
@@ -9252,8 +9252,8 @@  discard block
 block discarded – undo
9252 9252
 	*/
9253 9253
 	public function countOverallOwners($filters = array())
9254 9254
 	{
9255
-		$filter_query = $this->getFilter($filters,true,true);
9256
-		$query  = "SELECT COUNT(DISTINCT spotter_output.owner_name) AS owner_count  
9255
+		$filter_query = $this->getFilter($filters, true, true);
9256
+		$query = "SELECT COUNT(DISTINCT spotter_output.owner_name) AS owner_count  
9257 9257
                     FROM spotter_output".$filter_query." spotter_output.owner_name <> ''";
9258 9258
 		$sth = $this->db->prepare($query);
9259 9259
 		$sth->execute();
@@ -9286,8 +9286,8 @@  discard block
 block discarded – undo
9286 9286
 	*/
9287 9287
 	public function countOverallMilitaryFlights($filters = array())
9288 9288
 	{
9289
-		$filter_query = $this->getFilter($filters,true,true);
9290
-		$query  = "SELECT COUNT(s.spotter_id) AS flight_count  
9289
+		$filter_query = $this->getFilter($filters, true, true);
9290
+		$query = "SELECT COUNT(s.spotter_id) AS flight_count  
9291 9291
                     FROM spotter_output s, airlines a".$filter_query." s.airline_icao = a.icao AND a.type = 'military'";
9292 9292
       
9293 9293
 		$sth = $this->db->prepare($query);
@@ -9331,13 +9331,13 @@  discard block
 block discarded – undo
9331 9331
 		} else $offset = '+00:00';
9332 9332
 
9333 9333
 		if ($globalDBdriver == 'mysql') {
9334
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9334
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9335 9335
 								FROM spotter_output 
9336 9336
 								WHERE DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = CURDATE()
9337 9337
 								GROUP BY hour_name 
9338 9338
 								ORDER BY hour_name ASC";
9339 9339
 		} else {
9340
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9340
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9341 9341
 								FROM spotter_output 
9342 9342
 								WHERE to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = CAST(NOW() AS date)
9343 9343
 								GROUP BY hour_name 
@@ -9350,7 +9350,7 @@  discard block
 block discarded – undo
9350 9350
 		$hour_array = array();
9351 9351
 		$temp_array = array();
9352 9352
         
9353
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9353
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9354 9354
 		{
9355 9355
 			$temp_array['hour_name'] = $row['hour_name'];
9356 9356
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -9374,8 +9374,8 @@  discard block
 block discarded – undo
9374 9374
 		if ($limit != "")
9375 9375
 		{
9376 9376
 			$limit_array = explode(",", $limit);
9377
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
9378
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
9377
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
9378
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
9379 9379
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
9380 9380
 			{
9381 9381
 				//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
@@ -9430,7 +9430,7 @@  discard block
 block discarded – undo
9430 9430
 			    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')
9431 9431
 			    HAVING count(spotter_output.ident) > 5$orderby_query";
9432 9432
 			//echo $query;
9433
-			$spotter_array = $this->getDataFromDB($query.$limit_query,array(':timezone' => $globalTimezone));
9433
+			$spotter_array = $this->getDataFromDB($query.$limit_query, array(':timezone' => $globalTimezone));
9434 9434
 			/*
9435 9435
 			$sth = $this->db->prepare($query);
9436 9436
 			$sth->execute(array(':timezone' => $globalTimezone));
@@ -9449,9 +9449,9 @@  discard block
 block discarded – undo
9449 9449
 	*/
9450 9450
 	public function getSpotterIDBasedOnFlightAwareID($flightaware_id)
9451 9451
 	{
9452
-		$flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING);
9452
+		$flightaware_id = filter_var($flightaware_id, FILTER_SANITIZE_STRING);
9453 9453
 
9454
-		$query  = "SELECT spotter_output.spotter_id
9454
+		$query = "SELECT spotter_output.spotter_id
9455 9455
 								FROM spotter_output 
9456 9456
 								WHERE spotter_output.flightaware_id = '".$flightaware_id."'";
9457 9457
         
@@ -9459,7 +9459,7 @@  discard block
 block discarded – undo
9459 9459
 		$sth = $this->db->prepare($query);
9460 9460
 		$sth->execute();
9461 9461
 
9462
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9462
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9463 9463
 		{
9464 9464
 			return $row['spotter_id'];
9465 9465
 		}
@@ -9484,23 +9484,23 @@  discard block
 block discarded – undo
9484 9484
 		}
9485 9485
 		
9486 9486
 		$current_date = date("Y-m-d H:i:s");
9487
-		$date = date("Y-m-d H:i:s",strtotime($dateString." UTC"));
9487
+		$date = date("Y-m-d H:i:s", strtotime($dateString." UTC"));
9488 9488
 		
9489 9489
 		$diff = abs(strtotime($current_date) - strtotime($date));
9490 9490
 
9491
-		$time_array['years'] = floor($diff / (365*60*60*24)); 
9491
+		$time_array['years'] = floor($diff/(365*60*60*24)); 
9492 9492
 		$years = $time_array['years'];
9493 9493
 		
9494
-		$time_array['months'] = floor(($diff - $years * 365*60*60*24) / (30*60*60*24));
9494
+		$time_array['months'] = floor(($diff - $years*365*60*60*24)/(30*60*60*24));
9495 9495
 		$months = $time_array['months'];
9496 9496
 		
9497
-		$time_array['days'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24)/ (60*60*24));
9497
+		$time_array['days'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24)/(60*60*24));
9498 9498
 		$days = $time_array['days'];
9499
-		$time_array['hours'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24)/ (60*60));
9499
+		$time_array['hours'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24)/(60*60));
9500 9500
 		$hours = $time_array['hours'];
9501
-		$time_array['minutes'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60)/ 60);
9501
+		$time_array['minutes'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60)/60);
9502 9502
 		$minutes = $time_array['minutes'];
9503
-		$time_array['seconds'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60 - $minutes*60));  
9503
+		$time_array['seconds'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60 - $minutes*60));  
9504 9504
 		
9505 9505
 		return $time_array;	
9506 9506
 	}	
@@ -9526,63 +9526,63 @@  discard block
 block discarded – undo
9526 9526
 			$temp_array['direction_degree'] = $direction;
9527 9527
 			$temp_array['direction_shortname'] = "N";
9528 9528
 			$temp_array['direction_fullname'] = "North";
9529
-		} elseif ($direction >= 22.5 && $direction < 45){
9529
+		} elseif ($direction >= 22.5 && $direction < 45) {
9530 9530
 			$temp_array['direction_degree'] = $direction;
9531 9531
 			$temp_array['direction_shortname'] = "NNE";
9532 9532
 			$temp_array['direction_fullname'] = "North-Northeast";
9533
-		} elseif ($direction >= 45 && $direction < 67.5){
9533
+		} elseif ($direction >= 45 && $direction < 67.5) {
9534 9534
 			$temp_array['direction_degree'] = $direction;
9535 9535
 			$temp_array['direction_shortname'] = "NE";
9536 9536
 			$temp_array['direction_fullname'] = "Northeast";
9537
-		} elseif ($direction >= 67.5 && $direction < 90){
9537
+		} elseif ($direction >= 67.5 && $direction < 90) {
9538 9538
 			$temp_array['direction_degree'] = $direction;
9539 9539
 			$temp_array['direction_shortname'] = "ENE";
9540 9540
 			$temp_array['direction_fullname'] = "East-Northeast";
9541
-		} elseif ($direction >= 90 && $direction < 112.5){
9541
+		} elseif ($direction >= 90 && $direction < 112.5) {
9542 9542
 			$temp_array['direction_degree'] = $direction;
9543 9543
 			$temp_array['direction_shortname'] = "E";
9544 9544
 			$temp_array['direction_fullname'] = "East";
9545
-		} elseif ($direction >= 112.5 && $direction < 135){
9545
+		} elseif ($direction >= 112.5 && $direction < 135) {
9546 9546
 			$temp_array['direction_degree'] = $direction;
9547 9547
 			$temp_array['direction_shortname'] = "ESE";
9548 9548
 			$temp_array['direction_fullname'] = "East-Southeast";
9549
-		} elseif ($direction >= 135 && $direction < 157.5){
9549
+		} elseif ($direction >= 135 && $direction < 157.5) {
9550 9550
 			$temp_array['direction_degree'] = $direction;
9551 9551
 			$temp_array['direction_shortname'] = "SE";
9552 9552
 			$temp_array['direction_fullname'] = "Southeast";
9553
-		} elseif ($direction >= 157.5 && $direction < 180){
9553
+		} elseif ($direction >= 157.5 && $direction < 180) {
9554 9554
 			$temp_array['direction_degree'] = $direction;
9555 9555
 			$temp_array['direction_shortname'] = "SSE";
9556 9556
 			$temp_array['direction_fullname'] = "South-Southeast";
9557
-		} elseif ($direction >= 180 && $direction < 202.5){
9557
+		} elseif ($direction >= 180 && $direction < 202.5) {
9558 9558
 			$temp_array['direction_degree'] = $direction;
9559 9559
 			$temp_array['direction_shortname'] = "S";
9560 9560
 			$temp_array['direction_fullname'] = "South";
9561
-		} elseif ($direction >= 202.5 && $direction < 225){
9561
+		} elseif ($direction >= 202.5 && $direction < 225) {
9562 9562
 			$temp_array['direction_degree'] = $direction;
9563 9563
 			$temp_array['direction_shortname'] = "SSW";
9564 9564
 			$temp_array['direction_fullname'] = "South-Southwest";
9565
-		} elseif ($direction >= 225 && $direction < 247.5){
9565
+		} elseif ($direction >= 225 && $direction < 247.5) {
9566 9566
 			$temp_array['direction_degree'] = $direction;
9567 9567
 			$temp_array['direction_shortname'] = "SW";
9568 9568
 			$temp_array['direction_fullname'] = "Southwest";
9569
-		} elseif ($direction >= 247.5 && $direction < 270){
9569
+		} elseif ($direction >= 247.5 && $direction < 270) {
9570 9570
 			$temp_array['direction_degree'] = $direction;
9571 9571
 			$temp_array['direction_shortname'] = "WSW";
9572 9572
 			$temp_array['direction_fullname'] = "West-Southwest";
9573
-		} elseif ($direction >= 270 && $direction < 292.5){
9573
+		} elseif ($direction >= 270 && $direction < 292.5) {
9574 9574
 			$temp_array['direction_degree'] = $direction;
9575 9575
 			$temp_array['direction_shortname'] = "W";
9576 9576
 			$temp_array['direction_fullname'] = "West";
9577
-		} elseif ($direction >= 292.5 && $direction < 315){
9577
+		} elseif ($direction >= 292.5 && $direction < 315) {
9578 9578
 			$temp_array['direction_degree'] = $direction;
9579 9579
 			$temp_array['direction_shortname'] = "WNW";
9580 9580
 			$temp_array['direction_fullname'] = "West-Northwest";
9581
-		} elseif ($direction >= 315 && $direction < 337.5){
9581
+		} elseif ($direction >= 315 && $direction < 337.5) {
9582 9582
 			$temp_array['direction_degree'] = $direction;
9583 9583
 			$temp_array['direction_shortname'] = "NW";
9584 9584
 			$temp_array['direction_fullname'] = "Northwest";
9585
-		} elseif ($direction >= 337.5 && $direction < 360){
9585
+		} elseif ($direction >= 337.5 && $direction < 360) {
9586 9586
 			$temp_array['direction_degree'] = $direction;
9587 9587
 			$temp_array['direction_shortname'] = "NNW";
9588 9588
 			$temp_array['direction_fullname'] = "North-Northwest";
@@ -9635,9 +9635,9 @@  discard block
 block discarded – undo
9635 9635
 	*/
9636 9636
 	public function getAircraftRegistrationBymodeS($aircraft_modes)
9637 9637
 	{
9638
-		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
9638
+		$aircraft_modes = filter_var($aircraft_modes, FILTER_SANITIZE_STRING);
9639 9639
 	
9640
-		$query  = "SELECT aircraft_modes.Registration FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes LIMIT 1";
9640
+		$query = "SELECT aircraft_modes.Registration FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes LIMIT 1";
9641 9641
 		
9642 9642
 		$sth = $this->db->prepare($query);
9643 9643
 		$sth->execute(array(':aircraft_modes' => $aircraft_modes));
@@ -9659,9 +9659,9 @@  discard block
 block discarded – undo
9659 9659
 	*/
9660 9660
 	public function getAircraftTypeBymodeS($aircraft_modes)
9661 9661
 	{
9662
-		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
9662
+		$aircraft_modes = filter_var($aircraft_modes, FILTER_SANITIZE_STRING);
9663 9663
 	
9664
-		$query  = "SELECT aircraft_modes.type_flight FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes LIMIT 1";
9664
+		$query = "SELECT aircraft_modes.type_flight FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes LIMIT 1";
9665 9665
 		
9666 9666
 		$sth = $this->db->prepare($query);
9667 9667
 		$sth->execute(array(':aircraft_modes' => $aircraft_modes));
@@ -9681,11 +9681,11 @@  discard block
 block discarded – undo
9681 9681
 	* @param Float $longitude longitute of the flight
9682 9682
 	* @return String the countrie
9683 9683
 	*/
9684
-	public function getCountryFromLatitudeLongitude($latitude,$longitude)
9684
+	public function getCountryFromLatitudeLongitude($latitude, $longitude)
9685 9685
 	{
9686 9686
 		global $globalDBdriver, $globalDebug;
9687
-		$latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
9688
-		$longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
9687
+		$latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
9688
+		$longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
9689 9689
 	
9690 9690
 		$Connection = new Connection($this->db);
9691 9691
 		if (!$Connection->tableExists('countries')) return '';
@@ -9724,19 +9724,19 @@  discard block
 block discarded – undo
9724 9724
 	*/
9725 9725
 	public function convertAircraftRegistration($registration)
9726 9726
 	{
9727
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
9727
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
9728 9728
 		$registration_prefix = '';
9729 9729
 		$registration_1 = substr($registration, 0, 1);
9730 9730
 		$registration_2 = substr($registration, 0, 2);
9731 9731
 
9732 9732
 		//first get the prefix based on two characters
9733
-		$query  = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_2";
9733
+		$query = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_2";
9734 9734
       
9735 9735
 		
9736 9736
 		$sth = $this->db->prepare($query);
9737 9737
 		$sth->execute(array(':registration_2' => $registration_2));
9738 9738
         
9739
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9739
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9740 9740
 		{
9741 9741
 			$registration_prefix = $row['registration_prefix'];
9742 9742
 		}
@@ -9744,11 +9744,11 @@  discard block
 block discarded – undo
9744 9744
 		//if we didn't find a two chracter prefix lets just search the one with one character
9745 9745
 		if ($registration_prefix == '')
9746 9746
 		{
9747
-			$query  = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_1";
9747
+			$query = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_1";
9748 9748
 			$sth = $this->db->prepare($query);
9749 9749
 			$sth->execute(array(':registration_1' => $registration_1));
9750 9750
 	        
9751
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
9751
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9752 9752
 			{
9753 9753
 				$registration_prefix = $row['registration_prefix'];
9754 9754
 			}
@@ -9762,7 +9762,7 @@  discard block
 block discarded – undo
9762 9762
 			} else {
9763 9763
 				$registration = preg_replace("/^(.{1})/", "$1-", $registration);
9764 9764
 			}
9765
-		} else if(strlen($registration_prefix) == 2){
9765
+		} else if (strlen($registration_prefix) == 2) {
9766 9766
 			if (0 === strpos($registration, 'N')) {
9767 9767
 				$registration = preg_replace("/^(.{2})/", "$1", $registration);
9768 9768
 			} else {
@@ -9781,17 +9781,17 @@  discard block
 block discarded – undo
9781 9781
 	*/
9782 9782
 	public function countryFromAircraftRegistration($registration)
9783 9783
 	{
9784
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
9784
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
9785 9785
 		
9786 9786
 		$registration_prefix = '';
9787
-		$registration_test = explode('-',$registration);
9787
+		$registration_test = explode('-', $registration);
9788 9788
 		$country = '';
9789 9789
 		if ($registration_test[0] != $registration) {
9790 9790
 			$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1";
9791 9791
 	      
9792 9792
 			$sth = $this->db->prepare($query);
9793 9793
 			$sth->execute(array(':registration_1' => $registration_test[0]));
9794
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
9794
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9795 9795
 			{
9796 9796
 				//$registration_prefix = $row['registration_prefix'];
9797 9797
 				$country = $row['country'];
@@ -9802,13 +9802,13 @@  discard block
 block discarded – undo
9802 9802
 
9803 9803
 			$country = '';
9804 9804
 			//first get the prefix based on two characters
9805
-			$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_2 LIMIT 1";
9805
+			$query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_2 LIMIT 1";
9806 9806
       
9807 9807
 			
9808 9808
 			$sth = $this->db->prepare($query);
9809 9809
 			$sth->execute(array(':registration_2' => $registration_2));
9810 9810
         
9811
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
9811
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9812 9812
 			{
9813 9813
 				$registration_prefix = $row['registration_prefix'];
9814 9814
 				$country = $row['country'];
@@ -9817,12 +9817,12 @@  discard block
 block discarded – undo
9817 9817
 			//if we didn't find a two chracter prefix lets just search the one with one character
9818 9818
 			if ($registration_prefix == "")
9819 9819
 			{
9820
-				$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1";
9820
+				$query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1";
9821 9821
 	      
9822 9822
 				$sth = $this->db->prepare($query);
9823 9823
 				$sth->execute(array(':registration_1' => $registration_1));
9824 9824
 	        
9825
-				while($row = $sth->fetch(PDO::FETCH_ASSOC))
9825
+				while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9826 9826
 				{
9827 9827
 					//$registration_prefix = $row['registration_prefix'];
9828 9828
 					$country = $row['country'];
@@ -9839,9 +9839,9 @@  discard block
 block discarded – undo
9839 9839
 	* @param String $flightaware_id flightaware_id from spotter_output table
9840 9840
 	* @param String $highlight New highlight value
9841 9841
 	*/
9842
-	public function setHighlightFlight($flightaware_id,$highlight) {
9842
+	public function setHighlightFlight($flightaware_id, $highlight) {
9843 9843
 		
9844
-		$query  = "UPDATE spotter_output SET highlight = :highlight WHERE flightaware_id = :flightaware_id";
9844
+		$query = "UPDATE spotter_output SET highlight = :highlight WHERE flightaware_id = :flightaware_id";
9845 9845
 		$sth = $this->db->prepare($query);
9846 9846
 		$sth->execute(array(':flightaware_id' => $flightaware_id, ':highlight' => $highlight));
9847 9847
 	}
@@ -9870,7 +9870,7 @@  discard block
 block discarded – undo
9870 9870
 		
9871 9871
 		$bitly_data = json_decode($bitly_data);
9872 9872
 		$bitly_url = '';
9873
-		if ($bitly_data->status_txt = "OK"){
9873
+		if ($bitly_data->status_txt = "OK") {
9874 9874
 			$bitly_url = $bitly_data->data->url;
9875 9875
 		}
9876 9876
 
@@ -9880,7 +9880,7 @@  discard block
 block discarded – undo
9880 9880
 
9881 9881
 	public function getOrderBy()
9882 9882
 	{
9883
-		$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"));
9883
+		$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"));
9884 9884
 		
9885 9885
 		return $orderby;
9886 9886
 		
@@ -10014,14 +10014,14 @@  discard block
 block discarded – undo
10014 10014
 		}
10015 10015
 		$sth = $this->db->prepare($query);
10016 10016
 		$sth->execute();
10017
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10017
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10018 10018
 		{
10019 10019
 			$departure_airport_array = $this->getAllAirportInfo($row['fromairport_icao']);
10020 10020
 			$arrival_airport_array = $this->getAllAirportInfo($row['toairport_icao']);
10021 10021
 			if (count($departure_airport_array) > 0 && count($arrival_airport_array) > 0) {
10022
-				$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";
10022
+				$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";
10023 10023
 				$sthu = $this->db->prepare($update_query);
10024
-				$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']));
10024
+				$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']));
10025 10025
 			}
10026 10026
 		}
10027 10027
 		
@@ -10034,7 +10034,7 @@  discard block
 block discarded – undo
10034 10034
 		}
10035 10035
 		$sth = $this->db->prepare($query);
10036 10036
 		$sth->execute();
10037
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10037
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10038 10038
 		{
10039 10039
 			if (is_numeric(substr($row['ident'], -1, 1)))
10040 10040
 			{
@@ -10043,11 +10043,11 @@  discard block
 block discarded – undo
10043 10043
 				elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') $fromsource = 'ivao';
10044 10044
 				elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim';
10045 10045
 				elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao';
10046
-				$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3),$fromsource);
10046
+				$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3), $fromsource);
10047 10047
 				if (isset($airline_array[0]['name'])) {
10048
-					$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";
10048
+					$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";
10049 10049
 					$sthu = $this->db->prepare($update_query);
10050
-					$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']));
10050
+					$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']));
10051 10051
 				}
10052 10052
 			}
10053 10053
 		}
@@ -10067,18 +10067,18 @@  discard block
 block discarded – undo
10067 10067
 		}
10068 10068
 		$sth = $this->db->prepare($query);
10069 10069
 		$sth->execute();
10070
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10070
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10071 10071
 		{
10072 10072
 			if ($row['aircraft_icao'] != '') {
10073 10073
 				$aircraft_name = $this->getAllAircraftInfo($row['aircraft_icao']);
10074
-				if ($row['registration'] != ""){
10074
+				if ($row['registration'] != "") {
10075 10075
 					$image_array = $Image->getSpotterImage($row['registration']);
10076 10076
 					if (count($image_array) == 0) {
10077 10077
 						$Image->addSpotterImage($row['registration']);
10078 10078
 					}
10079 10079
 				}
10080 10080
 				if (count($aircraft_name) > 0) {
10081
-					$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";
10081
+					$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";
10082 10082
 					$sthu = $this->db->prepare($update_query);
10083 10083
 					$sthu->execute(array(':aircraft_name' => $aircraft_name[0]['type'], ':aircraft_manufacturer' => $aircraft_name[0]['manufacturer'], ':spotter_id' => $row['spotter_id']));
10084 10084
 				}
@@ -10093,10 +10093,10 @@  discard block
 block discarded – undo
10093 10093
 		$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";
10094 10094
 		$sth = $this->db->prepare($query);
10095 10095
 		$sth->execute();
10096
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10096
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10097 10097
 		{
10098 10098
 			if ($row['last_latitude'] != '' && $row['last_longitude'] != '') {
10099
-				$closestAirports = $this->closestAirports($row['last_latitude'],$row['last_longitude'],$globalClosestMinDist);
10099
+				$closestAirports = $this->closestAirports($row['last_latitude'], $row['last_longitude'], $globalClosestMinDist);
10100 10100
 				$airport_icao = '';
10101 10101
 				 if (isset($closestAirports[0])) {
10102 10102
 					if ($row['arrival_airport_icao'] == $closestAirports[0]['icao']) {
@@ -10110,7 +10110,7 @@  discard block
 block discarded – undo
10110 10110
 								break;
10111 10111
 							}
10112 10112
 						}
10113
-					} elseif ($row['last_altitude'] == 0 || ($row['last_altitude'] != '' && ($closestAirports[0]['altitude'] <= $row['last_altitude']*100+1000 && $row['last_altitude']*100 < $closestAirports[0]['altitude']+5000))) {
10113
+					} elseif ($row['last_altitude'] == 0 || ($row['last_altitude'] != '' && ($closestAirports[0]['altitude'] <= $row['last_altitude']*100 + 1000 && $row['last_altitude']*100 < $closestAirports[0]['altitude'] + 5000))) {
10114 10114
 						$airport_icao = $closestAirports[0]['icao'];
10115 10115
 						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";
10116 10116
 					} else {
@@ -10121,28 +10121,28 @@  discard block
 block discarded – undo
10121 10121
 				}
10122 10122
 				if ($row['real_arrival_airport_icao'] != $airport_icao) {
10123 10123
 					if ($globalDebug) echo "Updating airport to ".$airport_icao."...\n";
10124
-					$update_query="UPDATE spotter_output SET real_arrival_airport_icao = :airport_icao WHERE spotter_id = :spotter_id";
10124
+					$update_query = "UPDATE spotter_output SET real_arrival_airport_icao = :airport_icao WHERE spotter_id = :spotter_id";
10125 10125
 					$sthu = $this->db->prepare($update_query);
10126
-					$sthu->execute(array(':airport_icao' => $airport_icao,':spotter_id' => $row['spotter_id']));
10126
+					$sthu->execute(array(':airport_icao' => $airport_icao, ':spotter_id' => $row['spotter_id']));
10127 10127
 				}
10128 10128
 			}
10129 10129
 		}
10130 10130
 	}
10131 10131
 	
10132
-	public function closestAirports($origLat,$origLon,$dist = 10) {
10132
+	public function closestAirports($origLat, $origLon, $dist = 10) {
10133 10133
 		global $globalDBdriver;
10134
-		$dist = number_format($dist*0.621371,2,'.',''); // convert km to mile
10134
+		$dist = number_format($dist*0.621371, 2, '.', ''); // convert km to mile
10135 10135
 /*
10136 10136
 		$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 
10137 10137
                       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)) 
10138 10138
                       having distance < $dist ORDER BY distance limit 100;";
10139 10139
 */
10140 10140
 		if ($globalDBdriver == 'mysql') {
10141
-			$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 
10141
+			$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 
10142 10142
 	                      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)) 
10143 10143
 	                      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;";
10144 10144
                 } else {
10145
-			$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 
10145
+			$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 
10146 10146
 	                      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)) 
10147 10147
 	                      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;";
10148 10148
     		}
Please login to merge, or discard this patch.
Braces   +655 added lines, -227 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";
@@ -2053,7 +2167,9 @@  discard block
 block discarded – undo
2053 2167
 				$sth = $this->db->prepare($query);
2054 2168
 				$sth->execute(array(':fromsource' => $fromsource));
2055 2169
 				$row = $sth->fetch(PDO::FETCH_ASSOC);
2056
-				if ($row['nb'] == 0) $result = $this->getAllAirlineInfo($airline_icao);
2170
+				if ($row['nb'] == 0) {
2171
+					$result = $this->getAllAirlineInfo($airline_icao);
2172
+				}
2057 2173
 			}
2058 2174
 			return $result;
2059 2175
 		}
@@ -2117,15 +2233,20 @@  discard block
 block discarded – undo
2117 2233
 				'A320-211' => 'A320',
2118 2234
 				'747-8i' => 'B748',
2119 2235
 				'A380' => 'A388');
2120
-		if (isset($all_aircraft[$aircraft_type])) return $all_aircraft[$aircraft_type];
2236
+		if (isset($all_aircraft[$aircraft_type])) {
2237
+			return $all_aircraft[$aircraft_type];
2238
+		}
2121 2239
 
2122 2240
 		$query  = "SELECT aircraft.icao FROM aircraft WHERE aircraft.type LIKE :saircraft_type OR aircraft.type = :aircraft_type OR aircraft.icao = :aircraft_type LIMIT 1";
2123 2241
 		$aircraft_type = strtoupper($aircraft_type);
2124 2242
 		$sth = $this->db->prepare($query);
2125 2243
 		$sth->execute(array(':saircraft_type' => '%'.$aircraft_type.'%',':aircraft_type' => $aircraft_type,));
2126 2244
 		$result = $sth->fetchAll(PDO::FETCH_ASSOC);
2127
-		if (isset($result[0]['icao'])) return $result[0]['icao'];
2128
-		else return '';
2245
+		if (isset($result[0]['icao'])) {
2246
+			return $result[0]['icao'];
2247
+		} else {
2248
+			return '';
2249
+		}
2129 2250
 	}
2130 2251
 	
2131 2252
 	/**
@@ -2147,7 +2268,9 @@  discard block
 block discarded – undo
2147 2268
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
2148 2269
 		if (isset($row['icaotypecode'])) {
2149 2270
 			return $row['icaotypecode'];
2150
-		} else return '';
2271
+		} else {
2272
+			return '';
2273
+		}
2151 2274
 	}
2152 2275
 
2153 2276
 	/**
@@ -2168,7 +2291,9 @@  discard block
 block discarded – undo
2168 2291
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
2169 2292
 		if (isset($row['operator_correct'])) {
2170 2293
 			return $row['operator_correct'];
2171
-		} else return $operator;
2294
+		} else {
2295
+			return $operator;
2296
+		}
2172 2297
 	}
2173 2298
 
2174 2299
 	/**
@@ -2181,7 +2306,9 @@  discard block
 block discarded – undo
2181 2306
 	public function getRouteInfo($callsign)
2182 2307
 	{
2183 2308
 		$callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
2184
-                if ($callsign == '') return array();
2309
+                if ($callsign == '') {
2310
+                	return array();
2311
+                }
2185 2312
 		$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";
2186 2313
 		
2187 2314
 		$sth = $this->db->prepare($query);
@@ -2190,7 +2317,9 @@  discard block
 block discarded – undo
2190 2317
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
2191 2318
 		if (count($row) > 0) {
2192 2319
 			return $row;
2193
-		} else return array();
2320
+		} else {
2321
+			return array();
2322
+		}
2194 2323
 	}
2195 2324
 	
2196 2325
 	/**
@@ -2242,7 +2371,9 @@  discard block
 block discarded – undo
2242 2371
 			$sth->execute(array(':registration' => $registration));
2243 2372
 
2244 2373
 			return $sth->fetch(PDO::FETCH_ASSOC);
2245
-		} else return array();
2374
+		} else {
2375
+			return array();
2376
+		}
2246 2377
 	}
2247 2378
 	
2248 2379
   
@@ -2398,8 +2529,11 @@  discard block
 block discarded – undo
2398 2529
 		$query .= " ORDER BY spotter_output.source_name ASC";
2399 2530
 
2400 2531
 		$sth = $this->db->prepare($query);
2401
-		if (!empty($query_values)) $sth->execute($query_values);
2402
-		else $sth->execute();
2532
+		if (!empty($query_values)) {
2533
+			$sth->execute($query_values);
2534
+		} else {
2535
+			$sth->execute();
2536
+		}
2403 2537
 
2404 2538
 		$source_array = array();
2405 2539
 		$temp_array = array();
@@ -2431,9 +2565,13 @@  discard block
 block discarded – undo
2431 2565
 								WHERE spotter_output.airline_icao <> '' 
2432 2566
 								ORDER BY spotter_output.airline_name ASC";
2433 2567
 			*/
2434
-			if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $forsource = $globalAirlinesSource;
2435
-			elseif (isset($globalVATSIM) && $globalVATSIM) $forsource = 'vatsim';
2436
-			elseif (isset($globalIVAO) && $globalIVAO) $forsource = 'ivao';
2568
+			if (isset($globalAirlinesSource) && $globalAirlinesSource != '') {
2569
+				$forsource = $globalAirlinesSource;
2570
+			} elseif (isset($globalVATSIM) && $globalVATSIM) {
2571
+				$forsource = 'vatsim';
2572
+			} elseif (isset($globalIVAO) && $globalIVAO) {
2573
+				$forsource = 'ivao';
2574
+			}
2437 2575
 			if ($forsource === NULL) {
2438 2576
 				$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";
2439 2577
 				$query_data = array();
@@ -2731,7 +2869,9 @@  discard block
 block discarded – undo
2731 2869
 			date_default_timezone_set($globalTimezone);
2732 2870
 			$datetime = new DateTime();
2733 2871
 			$offset = $datetime->format('P');
2734
-		} else $offset = '+00:00';
2872
+		} else {
2873
+			$offset = '+00:00';
2874
+		}
2735 2875
 		if ($airport_icao == '') {
2736 2876
 			if ($globalDBdriver == 'mysql') {
2737 2877
 				$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";
@@ -2763,7 +2903,9 @@  discard block
 block discarded – undo
2763 2903
 			date_default_timezone_set($globalTimezone);
2764 2904
 			$datetime = new DateTime();
2765 2905
 			$offset = $datetime->format('P');
2766
-		} else $offset = '+00:00';
2906
+		} else {
2907
+			$offset = '+00:00';
2908
+		}
2767 2909
 		if ($airport_icao == '') {
2768 2910
 			if ($globalDBdriver == 'mysql') {
2769 2911
 				$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";
@@ -2795,7 +2937,9 @@  discard block
 block discarded – undo
2795 2937
 			date_default_timezone_set($globalTimezone);
2796 2938
 			$datetime = new DateTime();
2797 2939
 			$offset = $datetime->format('P');
2798
-		} else $offset = '+00:00';
2940
+		} else {
2941
+			$offset = '+00:00';
2942
+		}
2799 2943
 		if ($airport_icao == '') {
2800 2944
 			if ($globalDBdriver == 'mysql') {
2801 2945
 				$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 
@@ -2838,7 +2982,9 @@  discard block
 block discarded – undo
2838 2982
 			date_default_timezone_set($globalTimezone);
2839 2983
 			$datetime = new DateTime();
2840 2984
 			$offset = $datetime->format('P');
2841
-		} else $offset = '+00:00';
2985
+		} else {
2986
+			$offset = '+00:00';
2987
+		}
2842 2988
 		if ($airport_icao == '') {
2843 2989
 			if ($globalDBdriver == 'mysql') {
2844 2990
 				$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 
@@ -2882,7 +3028,9 @@  discard block
 block discarded – undo
2882 3028
 			date_default_timezone_set($globalTimezone);
2883 3029
 			$datetime = new DateTime();
2884 3030
 			$offset = $datetime->format('P');
2885
-		} else $offset = '+00:00';
3031
+		} else {
3032
+			$offset = '+00:00';
3033
+		}
2886 3034
 		if ($airport_icao == '') {
2887 3035
 			if ($globalDBdriver == 'mysql') {
2888 3036
 				$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";
@@ -2916,7 +3064,9 @@  discard block
 block discarded – undo
2916 3064
 			date_default_timezone_set($globalTimezone);
2917 3065
 			$datetime = new DateTime();
2918 3066
 			$offset = $datetime->format('P');
2919
-		} else $offset = '+00:00';
3067
+		} else {
3068
+			$offset = '+00:00';
3069
+		}
2920 3070
 		if ($airport_icao == '') {
2921 3071
 			if ($globalDBdriver == 'mysql') {
2922 3072
 				$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 
@@ -2962,7 +3112,9 @@  discard block
 block discarded – undo
2962 3112
 			date_default_timezone_set($globalTimezone);
2963 3113
 			$datetime = new DateTime();
2964 3114
 			$offset = $datetime->format('P');
2965
-		} else $offset = '+00:00';
3115
+		} else {
3116
+			$offset = '+00:00';
3117
+		}
2966 3118
 		if ($airport_icao == '') {
2967 3119
 			if ($globalDBdriver == 'mysql') {
2968 3120
 				$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";
@@ -2996,7 +3148,9 @@  discard block
 block discarded – undo
2996 3148
 			date_default_timezone_set($globalTimezone);
2997 3149
 			$datetime = new DateTime();
2998 3150
 			$offset = $datetime->format('P');
2999
-		} else $offset = '+00:00';
3151
+		} else {
3152
+			$offset = '+00:00';
3153
+		}
3000 3154
 		if ($airport_icao == '') {
3001 3155
 			if ($globalDBdriver == 'mysql') {
3002 3156
 				$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 
@@ -3044,7 +3198,9 @@  discard block
 block discarded – undo
3044 3198
 			date_default_timezone_set($globalTimezone);
3045 3199
 			$datetime = new DateTime();
3046 3200
 			$offset = $datetime->format('P');
3047
-		} else $offset = '+00:00';
3201
+		} else {
3202
+			$offset = '+00:00';
3203
+		}
3048 3204
 
3049 3205
 		if ($globalDBdriver == 'mysql') {
3050 3206
 			$query  = "SELECT DISTINCT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) as date
@@ -3164,7 +3320,9 @@  discard block
 block discarded – undo
3164 3320
 	*/	
3165 3321
 	public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '',$arrival_airport_time = '')
3166 3322
 	{
3167
-		if ($groundspeed == '') $groundspeed = NULL;
3323
+		if ($groundspeed == '') {
3324
+			$groundspeed = NULL;
3325
+		}
3168 3326
 		$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';
3169 3327
                 $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);
3170 3328
 
@@ -3214,10 +3372,18 @@  discard block
 block discarded – undo
3214 3372
 		$Image = new Image($this->db);
3215 3373
 		$Common = new Common();
3216 3374
 		
3217
-		if (!isset($globalIVAO)) $globalIVAO = FALSE;
3218
-		if (!isset($globalVATSIM)) $globalVATSIM = FALSE;
3219
-		if (!isset($globalphpVMS)) $globalphpVMS = FALSE;
3220
-		if (!isset($globalVAM)) $globalVAM = FALSE;
3375
+		if (!isset($globalIVAO)) {
3376
+			$globalIVAO = FALSE;
3377
+		}
3378
+		if (!isset($globalVATSIM)) {
3379
+			$globalVATSIM = FALSE;
3380
+		}
3381
+		if (!isset($globalphpVMS)) {
3382
+			$globalphpVMS = FALSE;
3383
+		}
3384
+		if (!isset($globalVAM)) {
3385
+			$globalVAM = FALSE;
3386
+		}
3221 3387
 		date_default_timezone_set('UTC');
3222 3388
 		
3223 3389
 		//getting the registration
@@ -3230,23 +3396,33 @@  discard block
 block discarded – undo
3230 3396
 				if ($ModeS != '') {
3231 3397
 					$timeelapsed = microtime(true);
3232 3398
 					$registration = $this->getAircraftRegistrationBymodeS($ModeS);
3233
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3399
+					if ($globalDebugTimeElapsed) {
3400
+						echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3401
+					}
3234 3402
 				} else {
3235 3403
 					$myhex = explode('-',$flightaware_id);
3236 3404
 					if (count($myhex) > 0) {
3237 3405
 						$timeelapsed = microtime(true);
3238 3406
 						$registration = $this->getAircraftRegistrationBymodeS($myhex[0]);
3239
-						if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3407
+						if ($globalDebugTimeElapsed) {
3408
+							echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3409
+						}
3240 3410
 					}
3241 3411
 				}
3242 3412
 			}
3243 3413
 		}
3244 3414
 		$fromsource = NULL;
3245
-		if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource;
3246
-		elseif ($format_source == 'vatsimtxt') $fromsource = 'vatsim';
3247
-		elseif ($format_source == 'whazzup') $fromsource = 'ivao';
3248
-		elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim';
3249
-		elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao';
3415
+		if (isset($globalAirlinesSource) && $globalAirlinesSource != '') {
3416
+			$fromsource = $globalAirlinesSource;
3417
+		} elseif ($format_source == 'vatsimtxt') {
3418
+			$fromsource = 'vatsim';
3419
+		} elseif ($format_source == 'whazzup') {
3420
+			$fromsource = 'ivao';
3421
+		} elseif (isset($globalVATSIM) && $globalVATSIM) {
3422
+			$fromsource = 'vatsim';
3423
+		} elseif (isset($globalIVAO) && $globalIVAO) {
3424
+			$fromsource = 'ivao';
3425
+		}
3250 3426
 		//getting the airline information
3251 3427
 		if ($ident != "")
3252 3428
 		{
@@ -3270,15 +3446,21 @@  discard block
 block discarded – undo
3270 3446
 					if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == ""){
3271 3447
 						$airline_array = $this->getAllAirlineInfo("NA");
3272 3448
 					}
3273
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3449
+					if ($globalDebugTimeElapsed) {
3450
+						echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3451
+					}
3274 3452
 
3275 3453
 				} else {
3276 3454
 					$timeelapsed = microtime(true);
3277 3455
 					$airline_array = $this->getAllAirlineInfo("NA");
3278
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3456
+					if ($globalDebugTimeElapsed) {
3457
+						echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3458
+					}
3279 3459
 				}
3280 3460
 			}
3281
-		} else $airline_array = array();
3461
+		} else {
3462
+			$airline_array = array();
3463
+		}
3282 3464
 		
3283 3465
 		//getting the aircraft information
3284 3466
 		$aircraft_array = array();
@@ -3292,27 +3474,37 @@  discard block
 block discarded – undo
3292 3474
 				{
3293 3475
 					$timeelapsed = microtime(true);
3294 3476
 					$aircraft_array = $this->getAllAircraftInfo("NA");
3295
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3477
+					if ($globalDebugTimeElapsed) {
3478
+						echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3479
+					}
3296 3480
 				} else {
3297 3481
 					$timeelapsed = microtime(true);
3298 3482
 					$aircraft_array = $this->getAllAircraftInfo($aircraft_icao);
3299
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3483
+					if ($globalDebugTimeElapsed) {
3484
+						echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3485
+					}
3300 3486
 				}
3301 3487
 			}
3302 3488
 		} else {
3303 3489
 			if ($ModeS != '') {
3304 3490
 				$timeelapsed = microtime(true);
3305 3491
 				$aircraft_icao = $this->getAllAircraftType($ModeS);
3306
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3492
+				if ($globalDebugTimeElapsed) {
3493
+					echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3494
+				}
3307 3495
 				if ($aircraft_icao == "" || $aircraft_icao == "XXXX")
3308 3496
 				{
3309 3497
 					$timeelapsed = microtime(true);
3310 3498
 					$aircraft_array = $this->getAllAircraftInfo("NA");
3311
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3499
+					if ($globalDebugTimeElapsed) {
3500
+						echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3501
+					}
3312 3502
 				} else {
3313 3503
 					$timeelapsed = microtime(true);
3314 3504
 					$aircraft_array = $this->getAllAircraftInfo($aircraft_icao);
3315
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3505
+					if ($globalDebugTimeElapsed) {
3506
+						echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3507
+					}
3316 3508
 				}
3317 3509
 			}
3318 3510
 		}
@@ -3327,7 +3519,9 @@  discard block
 block discarded – undo
3327 3519
 			} else {
3328 3520
 				$timeelapsed = microtime(true);
3329 3521
 				$departure_airport_array = $this->getAllAirportInfo($departure_airport_icao);
3330
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3522
+				if ($globalDebugTimeElapsed) {
3523
+					echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3524
+				}
3331 3525
 			}
3332 3526
 		}
3333 3527
 		
@@ -3341,7 +3535,9 @@  discard block
 block discarded – undo
3341 3535
 			} else {
3342 3536
 				$timeelapsed = microtime(true);
3343 3537
 				$arrival_airport_array = $this->getAllAirportInfo($arrival_airport_icao);
3344
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3538
+				if ($globalDebugTimeElapsed) {
3539
+					echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3540
+				}
3345 3541
 			}
3346 3542
 		}
3347 3543
 
@@ -3376,7 +3572,9 @@  discard block
 block discarded – undo
3376 3572
 			{
3377 3573
 				return false;
3378 3574
 			}
3379
-		} else $altitude = 0;
3575
+		} else {
3576
+			$altitude = 0;
3577
+		}
3380 3578
 		
3381 3579
 		if ($heading != "")
3382 3580
 		{
@@ -3405,7 +3603,9 @@  discard block
 block discarded – undo
3405 3603
 		{
3406 3604
 			$timeelapsed = microtime(true);
3407 3605
 			$image_array = $Image->getSpotterImage($registration);
3408
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3606
+			if ($globalDebugTimeElapsed) {
3607
+				echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3608
+			}
3409 3609
 			if (!isset($image_array[0]['registration']))
3410 3610
 			{
3411 3611
 				//echo "Add image !!!! \n";
@@ -3413,14 +3613,21 @@  discard block
 block discarded – undo
3413 3613
 			}
3414 3614
 			$timeelapsed = microtime(true);
3415 3615
 			$owner_info = $this->getAircraftOwnerByRegistration($registration);
3416
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3417
-			if ($owner_info['owner'] != '') $aircraft_owner = ucwords(strtolower($owner_info['owner']));
3616
+			if ($globalDebugTimeElapsed) {
3617
+				echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3618
+			}
3619
+			if ($owner_info['owner'] != '') {
3620
+				$aircraft_owner = ucwords(strtolower($owner_info['owner']));
3621
+			}
3418 3622
 		}
3419 3623
     
3420 3624
 		if ($globalIVAO && $aircraft_icao != '')
3421 3625
 		{
3422
-            		if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao'];
3423
-            		else $airline_icao = '';
3626
+            		if (isset($airline_array[0]['icao'])) {
3627
+            			$airline_icao = $airline_array[0]['icao'];
3628
+            		} else {
3629
+            			$airline_icao = '';
3630
+            		}
3424 3631
 			$image_array = $Image->getSpotterImage('',$aircraft_icao,$airline_icao);
3425 3632
 			if (!isset($image_array[0]['registration']))
3426 3633
 			{
@@ -3465,12 +3672,24 @@  discard block
 block discarded – undo
3465 3672
                 {
3466 3673
                         $arrival_airport_array = $this->getAllAirportInfo('NA');
3467 3674
                 }
3468
-                if ($registration == '') $registration = 'NA';
3469
-                if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL;
3470
-                if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL;
3471
-                if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
3472
-                if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
3473
-                if (!isset($aircraft_owner)) $aircraft_owner = NULL;
3675
+                if ($registration == '') {
3676
+                	$registration = 'NA';
3677
+                }
3678
+                if ($squawk == '' || $Common->isInteger($squawk) === false) {
3679
+                	$squawk = NULL;
3680
+                }
3681
+                if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) {
3682
+                	$verticalrate = NULL;
3683
+                }
3684
+                if ($heading == '' || $Common->isInteger($heading) === false) {
3685
+                	$heading = 0;
3686
+                }
3687
+                if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) {
3688
+                	$groundspeed = 0;
3689
+                }
3690
+                if (!isset($aircraft_owner)) {
3691
+                	$aircraft_owner = NULL;
3692
+                }
3474 3693
                 $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) 
3475 3694
                 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)";
3476 3695
 
@@ -3481,9 +3700,13 @@  discard block
 block discarded – undo
3481 3700
 		if ($airline_type == '') {
3482 3701
 			$timeelapsed = microtime(true);
3483 3702
 			$airline_type = $this->getAircraftTypeBymodeS($ModeS);
3484
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3703
+			if ($globalDebugTimeElapsed) {
3704
+				echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3705
+			}
3706
+		}
3707
+		if ($airline_type == null) {
3708
+			$airline_type = '';
3485 3709
 		}
3486
-		if ($airline_type == null) $airline_type = '';
3487 3710
                 $aircraft_type = $aircraft_array[0]['type'];
3488 3711
                 $aircraft_manufacturer = $aircraft_array[0]['manufacturer'];
3489 3712
                 $departure_airport_name = $departure_airport_array[0]['name'];
@@ -3618,7 +3841,9 @@  discard block
 block discarded – undo
3618 3841
 			}
3619 3842
 		}
3620 3843
 		$query .= "GROUP BY spotter_output.airline_name,spotter_output.airline_icao, spotter_output.airline_country ORDER BY airline_count DESC";
3621
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
3844
+		if ($limit) {
3845
+			$query .= " LIMIT 10 OFFSET 0";
3846
+		}
3622 3847
 		
3623 3848
 		$sth = $this->db->prepare($query);
3624 3849
 		$sth->execute();
@@ -3663,7 +3888,9 @@  discard block
 block discarded – undo
3663 3888
 			}
3664 3889
 		}
3665 3890
 		$query .= "GROUP BY spotter_output.pilot_id,spotter_output.pilot_name ORDER BY pilot_count DESC";
3666
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
3891
+		if ($limit) {
3892
+			$query .= " LIMIT 10 OFFSET 0";
3893
+		}
3667 3894
       
3668 3895
 		
3669 3896
 		$sth = $this->db->prepare($query);
@@ -3708,7 +3935,9 @@  discard block
 block discarded – undo
3708 3935
 			}
3709 3936
 		}
3710 3937
 		$query .= "GROUP BY spotter_output.airline_icao, spotter_output.pilot_id,spotter_output.pilot_name ORDER BY pilot_count DESC";
3711
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
3938
+		if ($limit) {
3939
+			$query .= " LIMIT 10 OFFSET 0";
3940
+		}
3712 3941
       
3713 3942
 		
3714 3943
 		$sth = $this->db->prepare($query);
@@ -3755,7 +3984,9 @@  discard block
 block discarded – undo
3755 3984
 			}
3756 3985
 		}
3757 3986
 		$query .= "GROUP BY spotter_output.owner_name ORDER BY owner_count DESC";
3758
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
3987
+		if ($limit) {
3988
+			$query .= " LIMIT 10 OFFSET 0";
3989
+		}
3759 3990
       
3760 3991
 		
3761 3992
 		$sth = $this->db->prepare($query);
@@ -3799,7 +4030,9 @@  discard block
 block discarded – undo
3799 4030
 			}
3800 4031
 		}
3801 4032
 		$query .= "GROUP BY spotter_output.airline_icao, spotter_output.owner_name ORDER BY owner_count DESC";
3802
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4033
+		if ($limit) {
4034
+			$query .= " LIMIT 10 OFFSET 0";
4035
+		}
3803 4036
       
3804 4037
 		
3805 4038
 		$sth = $this->db->prepare($query);
@@ -4048,7 +4281,9 @@  discard block
 block discarded – undo
4048 4281
 			date_default_timezone_set($globalTimezone);
4049 4282
 			$datetime = new DateTime($date);
4050 4283
 			$offset = $datetime->format('P');
4051
-		} else $offset = '+00:00';
4284
+		} else {
4285
+			$offset = '+00:00';
4286
+		}
4052 4287
 
4053 4288
 		if ($globalDBdriver == 'mysql') {
4054 4289
 			$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
@@ -4097,7 +4332,9 @@  discard block
 block discarded – undo
4097 4332
 			date_default_timezone_set($globalTimezone);
4098 4333
 			$datetime = new DateTime($date);
4099 4334
 			$offset = $datetime->format('P');
4100
-		} else $offset = '+00:00';
4335
+		} else {
4336
+			$offset = '+00:00';
4337
+		}
4101 4338
 		
4102 4339
 		if ($globalDBdriver == 'mysql') {
4103 4340
 			$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
@@ -4320,7 +4557,9 @@  discard block
 block discarded – undo
4320 4557
 					WHERE spotter_output.airline_country <> '' AND spotter_output.airline_country <> 'NA' 
4321 4558
 					GROUP BY spotter_output.airline_country
4322 4559
 					ORDER BY airline_country_count DESC";
4323
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4560
+		if ($limit) {
4561
+			$query .= " LIMIT 10 OFFSET 0";
4562
+		}
4324 4563
       
4325 4564
 		$sth = $this->db->prepare($query);
4326 4565
 		$sth->execute();
@@ -4347,7 +4586,9 @@  discard block
 block discarded – undo
4347 4586
 	{
4348 4587
 		global $globalDBdriver;
4349 4588
 		$Connection= new Connection($this->db);
4350
-		if (!$Connection->tableExists('countries')) return array();
4589
+		if (!$Connection->tableExists('countries')) {
4590
+			return array();
4591
+		}
4351 4592
 		/*
4352 4593
 		$query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb 
4353 4594
 					FROM countries c, spotter_output s
@@ -4372,7 +4613,9 @@  discard block
 block discarded – undo
4372 4613
 		}
4373 4614
 
4374 4615
 		$query .= "GROUP BY c.name ORDER BY nb DESC";
4375
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4616
+		if ($limit) {
4617
+			$query .= " LIMIT 10 OFFSET 0";
4618
+		}
4376 4619
       
4377 4620
 		
4378 4621
 		$sth = $this->db->prepare($query);
@@ -4422,7 +4665,9 @@  discard block
 block discarded – undo
4422 4665
 		}
4423 4666
 
4424 4667
 		$query .= " GROUP BY spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer ORDER BY aircraft_icao_count DESC";
4425
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4668
+		if ($limit) {
4669
+			$query .= " LIMIT 10 OFFSET 0";
4670
+		}
4426 4671
  
4427 4672
 		$sth = $this->db->prepare($query);
4428 4673
 		$sth->execute();
@@ -4468,7 +4713,9 @@  discard block
 block discarded – undo
4468 4713
 		}
4469 4714
 
4470 4715
 		$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";
4471
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4716
+		if ($limit) {
4717
+			$query .= " LIMIT 10 OFFSET 0";
4718
+		}
4472 4719
  
4473 4720
 		$sth = $this->db->prepare($query);
4474 4721
 		$sth->execute();
@@ -4521,7 +4768,9 @@  discard block
 block discarded – undo
4521 4768
 			if($row['registration'] != "")
4522 4769
 			{
4523 4770
 				$image_array = $Image->getSpotterImage($row['registration']);
4524
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
4771
+				if (isset($image_array[0]['image_thumbnail'])) {
4772
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
4773
+				}
4525 4774
 			}
4526 4775
 			$temp_array['registration_count'] = $row['registration_count'];
4527 4776
 
@@ -4597,7 +4846,9 @@  discard block
 block discarded – undo
4597 4846
 			if($row['registration'] != "")
4598 4847
 			{
4599 4848
 				$image_array = $Image->getSpotterImage($row['registration']);
4600
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
4849
+				if (isset($image_array[0]['image_thumbnail'])) {
4850
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
4851
+				}
4601 4852
 			}
4602 4853
 			$temp_array['registration_count'] = $row['registration_count'];
4603 4854
 
@@ -4831,7 +5082,9 @@  discard block
 block discarded – undo
4831 5082
 			date_default_timezone_set($globalTimezone);
4832 5083
 			$datetime = new DateTime($date);
4833 5084
 			$offset = $datetime->format('P');
4834
-		} else $offset = '+00:00';
5085
+		} else {
5086
+			$offset = '+00:00';
5087
+		}
4835 5088
 
4836 5089
 		if ($globalDBdriver == 'mysql') {
4837 5090
 			$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
@@ -4879,7 +5132,9 @@  discard block
 block discarded – undo
4879 5132
 			date_default_timezone_set($globalTimezone);
4880 5133
 			$datetime = new DateTime($date);
4881 5134
 			$offset = $datetime->format('P');
4882
-		} else $offset = '+00:00';
5135
+		} else {
5136
+			$offset = '+00:00';
5137
+		}
4883 5138
 
4884 5139
 		if ($globalDBdriver == 'mysql') {
4885 5140
 			$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    
@@ -4934,7 +5189,9 @@  discard block
 block discarded – undo
4934 5189
 			date_default_timezone_set($globalTimezone);
4935 5190
 			$datetime = new DateTime($date);
4936 5191
 			$offset = $datetime->format('P');
4937
-		} else $offset = '+00:00';
5192
+		} else {
5193
+			$offset = '+00:00';
5194
+		}
4938 5195
 
4939 5196
 		if ($globalDBdriver == 'mysql') {
4940 5197
 			$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
@@ -5035,8 +5292,11 @@  discard block
 block discarded – undo
5035 5292
 			if($row['registration'] != "")
5036 5293
 			{
5037 5294
 				$image_array = $Image->getSpotterImage($row['registration']);
5038
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5039
-				else $temp_array['image_thumbnail'] = '';
5295
+				if (isset($image_array[0]['image_thumbnail'])) {
5296
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5297
+				} else {
5298
+					$temp_array['image_thumbnail'] = '';
5299
+				}
5040 5300
 			}
5041 5301
 			$temp_array['registration_count'] = $row['registration_count'];
5042 5302
 			$aircraft_array[] = $temp_array;
@@ -5144,7 +5404,9 @@  discard block
 block discarded – undo
5144 5404
 			if($row['registration'] != "")
5145 5405
 			{
5146 5406
 				$image_array = $Image->getSpotterImage($row['registration']);
5147
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5407
+				if (isset($image_array[0]['image_thumbnail'])) {
5408
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5409
+				}
5148 5410
 			}
5149 5411
 			$temp_array['registration_count'] = $row['registration_count'];
5150 5412
           
@@ -5263,7 +5525,9 @@  discard block
 block discarded – undo
5263 5525
 			if($row['registration'] != "")
5264 5526
 			{
5265 5527
 				$image_array = $Image->getSpotterImage($row['registration']);
5266
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5528
+				if (isset($image_array[0]['image_thumbnail'])) {
5529
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5530
+				}
5267 5531
 			}
5268 5532
 			$temp_array['registration_count'] = $row['registration_count'];
5269 5533
           
@@ -5376,7 +5640,9 @@  discard block
 block discarded – undo
5376 5640
 		// if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5377 5641
 		//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5378 5642
                 $query .= " GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC";
5379
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5643
+		if ($limit) {
5644
+			$query .= " LIMIT 10 OFFSET 0";
5645
+		}
5380 5646
 		
5381 5647
 		$sth = $this->db->prepare($query);
5382 5648
 		$sth->execute();
@@ -5395,7 +5661,9 @@  discard block
 block discarded – undo
5395 5661
 			if($row['registration'] != "")
5396 5662
 			{
5397 5663
 				$image_array = $Image->getSpotterImage($row['registration']);
5398
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5664
+				if (isset($image_array[0]['image_thumbnail'])) {
5665
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5666
+				}
5399 5667
 			}
5400 5668
           
5401 5669
 			$aircraft_array[] = $temp_array;
@@ -5436,7 +5704,9 @@  discard block
 block discarded – undo
5436 5704
 		// if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5437 5705
 		//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5438 5706
                 $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";
5439
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5707
+		if ($limit) {
5708
+			$query .= " LIMIT 10 OFFSET 0";
5709
+		}
5440 5710
 		
5441 5711
 		$sth = $this->db->prepare($query);
5442 5712
 		$sth->execute();
@@ -5456,7 +5726,9 @@  discard block
 block discarded – undo
5456 5726
 			if($row['registration'] != "")
5457 5727
 			{
5458 5728
 				$image_array = $Image->getSpotterImage($row['registration']);
5459
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5729
+				if (isset($image_array[0]['image_thumbnail'])) {
5730
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5731
+				}
5460 5732
 			}
5461 5733
           
5462 5734
 			$aircraft_array[] = $temp_array;
@@ -5497,7 +5769,9 @@  discard block
 block discarded – undo
5497 5769
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5498 5770
                 $query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
5499 5771
 				ORDER BY airport_departure_icao_count DESC";
5500
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5772
+		if ($limit) {
5773
+			$query .= " LIMIT 10 OFFSET 0";
5774
+		}
5501 5775
       
5502 5776
 		$sth = $this->db->prepare($query);
5503 5777
 		$sth->execute();
@@ -5549,7 +5823,9 @@  discard block
 block discarded – undo
5549 5823
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5550 5824
                 $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
5551 5825
 				ORDER BY airport_departure_icao_count DESC";
5552
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5826
+		if ($limit) {
5827
+			$query .= " LIMIT 10 OFFSET 0";
5828
+		}
5553 5829
       
5554 5830
 		$sth = $this->db->prepare($query);
5555 5831
 		$sth->execute();
@@ -5601,7 +5877,9 @@  discard block
 block discarded – undo
5601 5877
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5602 5878
                 $query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
5603 5879
 				ORDER BY airport_departure_icao_count DESC";
5604
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5880
+		if ($limit) {
5881
+			$query .= " LIMIT 10 OFFSET 0";
5882
+		}
5605 5883
       
5606 5884
 		$sth = $this->db->prepare($query);
5607 5885
 		$sth->execute();
@@ -5653,7 +5931,9 @@  discard block
 block discarded – undo
5653 5931
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5654 5932
                 $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
5655 5933
 				ORDER BY airport_departure_icao_count DESC";
5656
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5934
+		if ($limit) {
5935
+			$query .= " LIMIT 10 OFFSET 0";
5936
+		}
5657 5937
       
5658 5938
 		$sth = $this->db->prepare($query);
5659 5939
 		$sth->execute();
@@ -6058,7 +6338,9 @@  discard block
 block discarded – undo
6058 6338
 			date_default_timezone_set($globalTimezone);
6059 6339
 			$datetime = new DateTime($date);
6060 6340
 			$offset = $datetime->format('P');
6061
-		} else $offset = '+00:00';
6341
+		} else {
6342
+			$offset = '+00:00';
6343
+		}
6062 6344
 
6063 6345
 		if ($globalDBdriver == 'mysql') {
6064 6346
 			$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 
@@ -6109,7 +6391,9 @@  discard block
 block discarded – undo
6109 6391
 			date_default_timezone_set($globalTimezone);
6110 6392
 			$datetime = new DateTime($date);
6111 6393
 			$offset = $datetime->format('P');
6112
-		} else $offset = '+00:00';
6394
+		} else {
6395
+			$offset = '+00:00';
6396
+		}
6113 6397
 
6114 6398
 		if ($globalDBdriver == 'mysql') {
6115 6399
 			$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
@@ -6327,7 +6611,9 @@  discard block
 block discarded – undo
6327 6611
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6328 6612
                 $query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
6329 6613
 					ORDER BY airport_arrival_icao_count DESC";
6330
-		if ($limit) $query .= " LIMIT 10";
6614
+		if ($limit) {
6615
+			$query .= " LIMIT 10";
6616
+		}
6331 6617
       
6332 6618
 		
6333 6619
 		$sth = $this->db->prepare($query);
@@ -6347,7 +6633,9 @@  discard block
 block discarded – undo
6347 6633
 			if ($icaoaskey) {
6348 6634
 				$icao = $row['arrival_airport_icao'];
6349 6635
 				$airport_array[$icao] = $temp_array;
6350
-			} else $airport_array[] = $temp_array;
6636
+			} else {
6637
+				$airport_array[] = $temp_array;
6638
+			}
6351 6639
 		}
6352 6640
 
6353 6641
 		return $airport_array;
@@ -6389,7 +6677,9 @@  discard block
 block discarded – undo
6389 6677
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6390 6678
                 $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
6391 6679
 					ORDER BY airport_arrival_icao_count DESC";
6392
-		if ($limit) $query .= " LIMIT 10";
6680
+		if ($limit) {
6681
+			$query .= " LIMIT 10";
6682
+		}
6393 6683
       
6394 6684
 		
6395 6685
 		$sth = $this->db->prepare($query);
@@ -6410,7 +6700,9 @@  discard block
 block discarded – undo
6410 6700
 			if ($icaoaskey) {
6411 6701
 				$icao = $row['arrival_airport_icao'];
6412 6702
 				$airport_array[$icao] = $temp_array;
6413
-			} else $airport_array[] = $temp_array;
6703
+			} else {
6704
+				$airport_array[] = $temp_array;
6705
+			}
6414 6706
 		}
6415 6707
 
6416 6708
 		return $airport_array;
@@ -6452,7 +6744,9 @@  discard block
 block discarded – undo
6452 6744
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6453 6745
                 $query .= " GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
6454 6746
 					ORDER BY airport_arrival_icao_count DESC";
6455
-		if ($limit) $query .= " LIMIT 10";
6747
+		if ($limit) {
6748
+			$query .= " LIMIT 10";
6749
+		}
6456 6750
       
6457 6751
 		
6458 6752
 		$sth = $this->db->prepare($query);
@@ -6472,7 +6766,9 @@  discard block
 block discarded – undo
6472 6766
 			if ($icaoaskey) {
6473 6767
 				$icao = $row['arrival_airport_icao'];
6474 6768
 				$airport_array[$icao] = $temp_array;
6475
-			} else $airport_array[] = $temp_array;
6769
+			} else {
6770
+				$airport_array[] = $temp_array;
6771
+			}
6476 6772
 		}
6477 6773
 
6478 6774
 		return $airport_array;
@@ -6514,7 +6810,9 @@  discard block
 block discarded – undo
6514 6810
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6515 6811
                 $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
6516 6812
 					ORDER BY airport_arrival_icao_count DESC";
6517
-		if ($limit) $query .= " LIMIT 10";
6813
+		if ($limit) {
6814
+			$query .= " LIMIT 10";
6815
+		}
6518 6816
       
6519 6817
 		
6520 6818
 		$sth = $this->db->prepare($query);
@@ -6535,7 +6833,9 @@  discard block
 block discarded – undo
6535 6833
 			if ($icaoaskey) {
6536 6834
 				$icao = $row['arrival_airport_icao'];
6537 6835
 				$airport_array[$icao] = $temp_array;
6538
-			} else $airport_array[] = $temp_array;
6836
+			} else {
6837
+				$airport_array[] = $temp_array;
6838
+			}
6539 6839
 		}
6540 6840
 
6541 6841
 		return $airport_array;
@@ -6924,7 +7224,9 @@  discard block
 block discarded – undo
6924 7224
 			date_default_timezone_set($globalTimezone);
6925 7225
 			$datetime = new DateTime($date);
6926 7226
 			$offset = $datetime->format('P');
6927
-		} else $offset = '+00:00';
7227
+		} else {
7228
+			$offset = '+00:00';
7229
+		}
6928 7230
 
6929 7231
 		if ($globalDBdriver == 'mysql') {
6930 7232
 			$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 
@@ -6975,7 +7277,9 @@  discard block
 block discarded – undo
6975 7277
 			date_default_timezone_set($globalTimezone);
6976 7278
 			$datetime = new DateTime($date);
6977 7279
 			$offset = $datetime->format('P');
6978
-		} else $offset = '+00:00';
7280
+		} else {
7281
+			$offset = '+00:00';
7282
+		}
6979 7283
 
6980 7284
 		if ($globalDBdriver == 'mysql') {
6981 7285
 			$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
@@ -7204,7 +7508,9 @@  discard block
 block discarded – undo
7204 7508
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.arrival_airport_icao <> 'NA'";
7205 7509
 		$query .= " GROUP BY spotter_output.arrival_airport_country
7206 7510
 					ORDER BY airport_arrival_country_count DESC";
7207
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
7511
+		if ($limit) {
7512
+			$query .= " LIMIT 10 OFFSET 0";
7513
+		}
7208 7514
       
7209 7515
 		
7210 7516
 		$sth = $this->db->prepare($query);
@@ -7499,7 +7805,9 @@  discard block
 block discarded – undo
7499 7805
 			date_default_timezone_set($globalTimezone);
7500 7806
 			$datetime = new DateTime($date);
7501 7807
 			$offset = $datetime->format('P');
7502
-		} else $offset = '+00:00';
7808
+		} else {
7809
+			$offset = '+00:00';
7810
+		}
7503 7811
 		
7504 7812
 		if ($globalDBdriver == 'mysql') {
7505 7813
 			$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
@@ -7682,15 +7990,23 @@  discard block
 block discarded – undo
7682 7990
 		$query  = "SELECT DISTINCT spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name, spotter_output.airline_icao  
7683 7991
                     FROM spotter_output".$filter_query." spotter_output.ident <> '' ";
7684 7992
 		 if ($olderthanmonths > 0) {
7685
-			if ($globalDBdriver == 'mysql') $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)';
7686
-			else $query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
7993
+			if ($globalDBdriver == 'mysql') {
7994
+				$query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)';
7995
+			} else {
7996
+				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
7997
+			}
7687 7998
 		}
7688 7999
 		if ($sincedate != '') {
7689
-			if ($globalDBdriver == 'mysql') $query .= " AND spotter_output.date > '".$sincedate."'";
7690
-			else $query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
8000
+			if ($globalDBdriver == 'mysql') {
8001
+				$query .= " AND spotter_output.date > '".$sincedate."'";
8002
+			} else {
8003
+				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
8004
+			}
7691 8005
 		}
7692 8006
 		$query .= " GROUP BY spotter_output.ident, spotter_output.airline_name, spotter_output.airline_icao ORDER BY callsign_icao_count DESC";
7693
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
8007
+		if ($limit) {
8008
+			$query .= " LIMIT 10 OFFSET 0";
8009
+		}
7694 8010
       		
7695 8011
 		$sth = $this->db->prepare($query);
7696 8012
 		$sth->execute();
@@ -7724,15 +8040,23 @@  discard block
 block discarded – undo
7724 8040
                     FROM spotter_output
7725 8041
                     WHERE spotter_output.ident <> ''  AND spotter_output.airline_icao <> '' ";
7726 8042
 		 if ($olderthanmonths > 0) {
7727
-			if ($globalDBdriver == 'mysql') $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
7728
-			else $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
8043
+			if ($globalDBdriver == 'mysql') {
8044
+				$query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
8045
+			} else {
8046
+				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
8047
+			}
7729 8048
 		}
7730 8049
 		if ($sincedate != '') {
7731
-			if ($globalDBdriver == 'mysql') $query .= "AND spotter_output.date > '".$sincedate."' ";
7732
-			else $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP) ";
8050
+			if ($globalDBdriver == 'mysql') {
8051
+				$query .= "AND spotter_output.date > '".$sincedate."' ";
8052
+			} else {
8053
+				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP) ";
8054
+			}
7733 8055
 		}
7734 8056
 		$query .= "GROUP BY spotter_output.airline_icao, spotter_output.ident, spotter_output.airline_name, spotter_output.airline_icao ORDER BY callsign_icao_count DESC";
7735
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
8057
+		if ($limit) {
8058
+			$query .= " LIMIT 10 OFFSET 0";
8059
+		}
7736 8060
       		
7737 8061
 		$sth = $this->db->prepare($query);
7738 8062
 		$sth->execute();
@@ -7769,7 +8093,9 @@  discard block
 block discarded – undo
7769 8093
 			date_default_timezone_set($globalTimezone);
7770 8094
 			$datetime = new DateTime();
7771 8095
 			$offset = $datetime->format('P');
7772
-		} else $offset = '+00:00';
8096
+		} else {
8097
+			$offset = '+00:00';
8098
+		}
7773 8099
 
7774 8100
 		if ($globalDBdriver == 'mysql') {
7775 8101
 			$query  = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -7818,7 +8144,9 @@  discard block
 block discarded – undo
7818 8144
 			date_default_timezone_set($globalTimezone);
7819 8145
 			$datetime = new DateTime();
7820 8146
 			$offset = $datetime->format('P');
7821
-		} else $offset = '+00:00';
8147
+		} else {
8148
+			$offset = '+00:00';
8149
+		}
7822 8150
 
7823 8151
 		if ($globalDBdriver == 'mysql') {
7824 8152
 			$query  = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -7868,7 +8196,9 @@  discard block
 block discarded – undo
7868 8196
 			date_default_timezone_set($globalTimezone);
7869 8197
 			$datetime = new DateTime();
7870 8198
 			$offset = $datetime->format('P');
7871
-		} else $offset = '+00:00';
8199
+		} else {
8200
+			$offset = '+00:00';
8201
+		}
7872 8202
 		$filter_query = $this->getFilter($filters,true,true);
7873 8203
 		if ($globalDBdriver == 'mysql') {
7874 8204
 			$query  = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -7914,7 +8244,9 @@  discard block
 block discarded – undo
7914 8244
 			date_default_timezone_set($globalTimezone);
7915 8245
 			$datetime = new DateTime();
7916 8246
 			$offset = $datetime->format('P');
7917
-		} else $offset = '+00:00';
8247
+		} else {
8248
+			$offset = '+00:00';
8249
+		}
7918 8250
 		$filter_query = $this->getFilter($filters,true,true);
7919 8251
 		if ($globalDBdriver == 'mysql') {
7920 8252
 			$query  = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -7961,7 +8293,9 @@  discard block
 block discarded – undo
7961 8293
 			date_default_timezone_set($globalTimezone);
7962 8294
 			$datetime = new DateTime();
7963 8295
 			$offset = $datetime->format('P');
7964
-		} else $offset = '+00:00';
8296
+		} else {
8297
+			$offset = '+00:00';
8298
+		}
7965 8299
 		
7966 8300
 		if ($globalDBdriver == 'mysql') {
7967 8301
 			$query  = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -8011,7 +8345,9 @@  discard block
 block discarded – undo
8011 8345
 			date_default_timezone_set($globalTimezone);
8012 8346
 			$datetime = new DateTime();
8013 8347
 			$offset = $datetime->format('P');
8014
-		} else $offset = '+00:00';
8348
+		} else {
8349
+			$offset = '+00:00';
8350
+		}
8015 8351
 
8016 8352
 		if ($globalDBdriver == 'mysql') {
8017 8353
 			$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
@@ -8057,7 +8393,9 @@  discard block
 block discarded – undo
8057 8393
 			date_default_timezone_set($globalTimezone);
8058 8394
 			$datetime = new DateTime();
8059 8395
 			$offset = $datetime->format('P');
8060
-		} else $offset = '+00:00';
8396
+		} else {
8397
+			$offset = '+00:00';
8398
+		}
8061 8399
 
8062 8400
 		if ($globalDBdriver == 'mysql') {
8063 8401
 			$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
@@ -8106,7 +8444,9 @@  discard block
 block discarded – undo
8106 8444
 			date_default_timezone_set($globalTimezone);
8107 8445
 			$datetime = new DateTime();
8108 8446
 			$offset = $datetime->format('P');
8109
-		} else $offset = '+00:00';
8447
+		} else {
8448
+			$offset = '+00:00';
8449
+		}
8110 8450
 
8111 8451
 		if ($globalDBdriver == 'mysql') {
8112 8452
 			$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
@@ -8153,7 +8493,9 @@  discard block
 block discarded – undo
8153 8493
 			date_default_timezone_set($globalTimezone);
8154 8494
 			$datetime = new DateTime();
8155 8495
 			$offset = $datetime->format('P');
8156
-		} else $offset = '+00:00';
8496
+		} else {
8497
+			$offset = '+00:00';
8498
+		}
8157 8499
 
8158 8500
 		if ($globalDBdriver == 'mysql') {
8159 8501
 			$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
@@ -8200,7 +8542,9 @@  discard block
 block discarded – undo
8200 8542
 			date_default_timezone_set($globalTimezone);
8201 8543
 			$datetime = new DateTime();
8202 8544
 			$offset = $datetime->format('P');
8203
-		} else $offset = '+00:00';
8545
+		} else {
8546
+			$offset = '+00:00';
8547
+		}
8204 8548
 
8205 8549
 		if ($globalDBdriver == 'mysql') {
8206 8550
 			$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
@@ -8248,7 +8592,9 @@  discard block
 block discarded – undo
8248 8592
 			date_default_timezone_set($globalTimezone);
8249 8593
 			$datetime = new DateTime();
8250 8594
 			$offset = $datetime->format('P');
8251
-		} else $offset = '+00:00';
8595
+		} else {
8596
+			$offset = '+00:00';
8597
+		}
8252 8598
 
8253 8599
 		if ($globalDBdriver == 'mysql') {
8254 8600
 			$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
@@ -8295,7 +8641,9 @@  discard block
 block discarded – undo
8295 8641
 			date_default_timezone_set($globalTimezone);
8296 8642
 			$datetime = new DateTime();
8297 8643
 			$offset = $datetime->format('P');
8298
-		} else $offset = '+00:00';
8644
+		} else {
8645
+			$offset = '+00:00';
8646
+		}
8299 8647
 
8300 8648
 		if ($globalDBdriver == 'mysql') {
8301 8649
 			$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
@@ -8343,7 +8691,9 @@  discard block
 block discarded – undo
8343 8691
 			date_default_timezone_set($globalTimezone);
8344 8692
 			$datetime = new DateTime();
8345 8693
 			$offset = $datetime->format('P');
8346
-		} else $offset = '+00:00';
8694
+		} else {
8695
+			$offset = '+00:00';
8696
+		}
8347 8697
 
8348 8698
 		if ($globalDBdriver == 'mysql') {
8349 8699
 			$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
@@ -8390,7 +8740,9 @@  discard block
 block discarded – undo
8390 8740
 			date_default_timezone_set($globalTimezone);
8391 8741
 			$datetime = new DateTime();
8392 8742
 			$offset = $datetime->format('P');
8393
-		} else $offset = '+00:00';
8743
+		} else {
8744
+			$offset = '+00:00';
8745
+		}
8394 8746
 
8395 8747
 		if ($globalDBdriver == 'mysql') {
8396 8748
 			$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
@@ -8438,7 +8790,9 @@  discard block
 block discarded – undo
8438 8790
 			date_default_timezone_set($globalTimezone);
8439 8791
 			$datetime = new DateTime();
8440 8792
 			$offset = $datetime->format('P');
8441
-		} else $offset = '+00:00';
8793
+		} else {
8794
+			$offset = '+00:00';
8795
+		}
8442 8796
 
8443 8797
 		if ($globalDBdriver == 'mysql') {
8444 8798
 			$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
@@ -8486,7 +8840,9 @@  discard block
 block discarded – undo
8486 8840
 			date_default_timezone_set($globalTimezone);
8487 8841
 			$datetime = new DateTime();
8488 8842
 			$offset = $datetime->format('P');
8489
-		} else $offset = '+00:00';
8843
+		} else {
8844
+			$offset = '+00:00';
8845
+		}
8490 8846
 
8491 8847
 		if ($globalDBdriver == 'mysql') {
8492 8848
 			$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
@@ -8534,7 +8890,9 @@  discard block
 block discarded – undo
8534 8890
 			date_default_timezone_set($globalTimezone);
8535 8891
 			$datetime = new DateTime();
8536 8892
 			$offset = $datetime->format('P');
8537
-		} else $offset = '+00:00';
8893
+		} else {
8894
+			$offset = '+00:00';
8895
+		}
8538 8896
 
8539 8897
 		if ($globalDBdriver == 'mysql') {
8540 8898
 			$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
@@ -8583,7 +8941,9 @@  discard block
 block discarded – undo
8583 8941
 			date_default_timezone_set($globalTimezone);
8584 8942
 			$datetime = new DateTime();
8585 8943
 			$offset = $datetime->format('P');
8586
-		} else $offset = '+00:00';
8944
+		} else {
8945
+			$offset = '+00:00';
8946
+		}
8587 8947
 		$filter_query = $this->getFilter($filters,true,true);
8588 8948
 		if ($globalDBdriver == 'mysql') {
8589 8949
 			$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
@@ -8632,7 +8992,9 @@  discard block
 block discarded – undo
8632 8992
 			date_default_timezone_set($globalTimezone);
8633 8993
 			$datetime = new DateTime();
8634 8994
 			$offset = $datetime->format('P');
8635
-		} else $offset = '+00:00';
8995
+		} else {
8996
+			$offset = '+00:00';
8997
+		}
8636 8998
 
8637 8999
 		$orderby_sql = '';
8638 9000
 		if ($orderby == "hour")
@@ -8697,7 +9059,9 @@  discard block
 block discarded – undo
8697 9059
 			date_default_timezone_set($globalTimezone);
8698 9060
 			$datetime = new DateTime();
8699 9061
 			$offset = $datetime->format('P');
8700
-		} else $offset = '+00:00';
9062
+		} else {
9063
+			$offset = '+00:00';
9064
+		}
8701 9065
 
8702 9066
 		$orderby_sql = '';
8703 9067
 		if ($orderby == "hour")
@@ -8765,7 +9129,9 @@  discard block
 block discarded – undo
8765 9129
 			date_default_timezone_set($globalTimezone);
8766 9130
 			$datetime = new DateTime();
8767 9131
 			$offset = $datetime->format('P');
8768
-		} else $offset = '+00:00';
9132
+		} else {
9133
+			$offset = '+00:00';
9134
+		}
8769 9135
 
8770 9136
 		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
8771 9137
 
@@ -8817,7 +9183,9 @@  discard block
 block discarded – undo
8817 9183
 			date_default_timezone_set($globalTimezone);
8818 9184
 			$datetime = new DateTime();
8819 9185
 			$offset = $datetime->format('P');
8820
-		} else $offset = '+00:00';
9186
+		} else {
9187
+			$offset = '+00:00';
9188
+		}
8821 9189
 
8822 9190
 		if ($globalDBdriver == 'mysql') {
8823 9191
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -8865,7 +9233,9 @@  discard block
 block discarded – undo
8865 9233
 			date_default_timezone_set($globalTimezone);
8866 9234
 			$datetime = new DateTime();
8867 9235
 			$offset = $datetime->format('P');
8868
-		} else $offset = '+00:00';
9236
+		} else {
9237
+			$offset = '+00:00';
9238
+		}
8869 9239
 
8870 9240
 		if ($globalDBdriver == 'mysql') {
8871 9241
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -8913,7 +9283,9 @@  discard block
 block discarded – undo
8913 9283
 			date_default_timezone_set($globalTimezone);
8914 9284
 			$datetime = new DateTime();
8915 9285
 			$offset = $datetime->format('P');
8916
-		} else $offset = '+00:00';
9286
+		} else {
9287
+			$offset = '+00:00';
9288
+		}
8917 9289
 
8918 9290
 		if ($globalDBdriver == 'mysql') {
8919 9291
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -8962,7 +9334,9 @@  discard block
 block discarded – undo
8962 9334
 			date_default_timezone_set($globalTimezone);
8963 9335
 			$datetime = new DateTime();
8964 9336
 			$offset = $datetime->format('P');
8965
-		} else $offset = '+00:00';
9337
+		} else {
9338
+			$offset = '+00:00';
9339
+		}
8966 9340
 
8967 9341
 		if ($globalDBdriver == 'mysql') {
8968 9342
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -9011,7 +9385,9 @@  discard block
 block discarded – undo
9011 9385
 			date_default_timezone_set($globalTimezone);
9012 9386
 			$datetime = new DateTime($date);
9013 9387
 			$offset = $datetime->format('P');
9014
-		} else $offset = '+00:00';
9388
+		} else {
9389
+			$offset = '+00:00';
9390
+		}
9015 9391
 
9016 9392
 		if ($globalDBdriver == 'mysql') {
9017 9393
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -9060,7 +9436,9 @@  discard block
 block discarded – undo
9060 9436
 			date_default_timezone_set($globalTimezone);
9061 9437
 			$datetime = new DateTime();
9062 9438
 			$offset = $datetime->format('P');
9063
-		} else $offset = '+00:00';
9439
+		} else {
9440
+			$offset = '+00:00';
9441
+		}
9064 9442
 
9065 9443
 		if ($globalDBdriver == 'mysql') {
9066 9444
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -9111,7 +9489,9 @@  discard block
 block discarded – undo
9111 9489
 			date_default_timezone_set($globalTimezone);
9112 9490
 			$datetime = new DateTime();
9113 9491
 			$offset = $datetime->format('P');
9114
-		} else $offset = '+00:00';
9492
+		} else {
9493
+			$offset = '+00:00';
9494
+		}
9115 9495
 
9116 9496
 		if ($globalDBdriver == 'mysql') {
9117 9497
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -9159,7 +9539,9 @@  discard block
 block discarded – undo
9159 9539
 			date_default_timezone_set($globalTimezone);
9160 9540
 			$datetime = new DateTime();
9161 9541
 			$offset = $datetime->format('P');
9162
-		} else $offset = '+00:00';
9542
+		} else {
9543
+			$offset = '+00:00';
9544
+		}
9163 9545
 
9164 9546
 		if ($globalDBdriver == 'mysql') {
9165 9547
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -9328,7 +9710,9 @@  discard block
 block discarded – undo
9328 9710
 			date_default_timezone_set($globalTimezone);
9329 9711
 			$datetime = new DateTime();
9330 9712
 			$offset = $datetime->format('P');
9331
-		} else $offset = '+00:00';
9713
+		} else {
9714
+			$offset = '+00:00';
9715
+		}
9332 9716
 
9333 9717
 		if ($globalDBdriver == 'mysql') {
9334 9718
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -9517,7 +9901,9 @@  discard block
 block discarded – undo
9517 9901
 	*/
9518 9902
 	public function parseDirection($direction = 0)
9519 9903
 	{
9520
-		if ($direction == '') $direction = 0;
9904
+		if ($direction == '') {
9905
+			$direction = 0;
9906
+		}
9521 9907
 		$direction_array = array();
9522 9908
 		$temp_array = array();
9523 9909
 
@@ -9618,7 +10004,9 @@  discard block
 block discarded – undo
9618 10004
 		if (isset($result->AirlineFlightInfoResult))
9619 10005
 		{
9620 10006
 			$registration = $result->AirlineFlightInfoResult->tailnumber;
9621
-		} else return '';
10007
+		} else {
10008
+			return '';
10009
+		}
9622 10010
 		
9623 10011
 		$registration = $this->convertAircraftRegistration($registration);
9624 10012
 		
@@ -9646,7 +10034,9 @@  discard block
 block discarded – undo
9646 10034
 		if (count($row) > 0) {
9647 10035
 		    //return $row['Registration'];
9648 10036
 		    return $row['registration'];
9649
-		} else return '';
10037
+		} else {
10038
+			return '';
10039
+		}
9650 10040
 	
9651 10041
 	}
9652 10042
 
@@ -9668,9 +10058,14 @@  discard block
 block discarded – undo
9668 10058
     
9669 10059
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
9670 10060
 		if (count($row) > 0) {
9671
-		    if ($row['type_flight'] == null) return '';
9672
-		    else return $row['type_flight'];
9673
-		} else return '';
10061
+		    if ($row['type_flight'] == null) {
10062
+		    	return '';
10063
+		    } else {
10064
+		    	return $row['type_flight'];
10065
+		    }
10066
+		} else {
10067
+			return '';
10068
+		}
9674 10069
 	
9675 10070
 	}
9676 10071
 
@@ -9688,7 +10083,9 @@  discard block
 block discarded – undo
9688 10083
 		$longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
9689 10084
 	
9690 10085
 		$Connection = new Connection($this->db);
9691
-		if (!$Connection->tableExists('countries')) return '';
10086
+		if (!$Connection->tableExists('countries')) {
10087
+			return '';
10088
+		}
9692 10089
 	
9693 10090
 		try {
9694 10091
 			/*
@@ -9707,9 +10104,13 @@  discard block
 block discarded – undo
9707 10104
 			$row = $sth->fetch(PDO::FETCH_ASSOC);
9708 10105
 			if (count($row) > 0) {
9709 10106
 				return $row;
9710
-			} else return '';
10107
+			} else {
10108
+				return '';
10109
+			}
9711 10110
 		} catch (PDOException $e) {
9712
-			if (isset($globalDebug) && $globalDebug) echo 'Error : '.$e->getMessage()."\n";
10111
+			if (isset($globalDebug) && $globalDebug) {
10112
+				echo 'Error : '.$e->getMessage()."\n";
10113
+			}
9713 10114
 			return '';
9714 10115
 		}
9715 10116
 	
@@ -9857,7 +10258,9 @@  discard block
 block discarded – undo
9857 10258
 	{
9858 10259
 		global $globalBitlyAccessToken;
9859 10260
 		
9860
-		if ($globalBitlyAccessToken == '') return $url;
10261
+		if ($globalBitlyAccessToken == '') {
10262
+			return $url;
10263
+		}
9861 10264
         
9862 10265
 		$google_url = 'https://api-ssl.bitly.com/v3/shorten?access_token='.$globalBitlyAccessToken.'&longUrl='.$url;
9863 10266
 		
@@ -10006,7 +10409,9 @@  discard block
 block discarded – undo
10006 10409
 		
10007 10410
 
10008 10411
 		// routes
10009
-		if ($globalDebug) print "Routes...\n";
10412
+		if ($globalDebug) {
10413
+			print "Routes...\n";
10414
+		}
10010 10415
 		if ($globalDBdriver == 'mysql') {
10011 10416
 			$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)";
10012 10417
 		} else {
@@ -10025,7 +10430,9 @@  discard block
 block discarded – undo
10025 10430
 			}
10026 10431
 		}
10027 10432
 		
10028
-		if ($globalDebug) print "Airlines...\n";
10433
+		if ($globalDebug) {
10434
+			print "Airlines...\n";
10435
+		}
10029 10436
 		//airlines
10030 10437
 		if ($globalDBdriver == 'mysql') {
10031 10438
 			$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)";
@@ -10039,10 +10446,15 @@  discard block
 block discarded – undo
10039 10446
 			if (is_numeric(substr($row['ident'], -1, 1)))
10040 10447
 			{
10041 10448
 				$fromsource = NULL;
10042
-				if (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') $fromsource = 'vatsim';
10043
-				elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') $fromsource = 'ivao';
10044
-				elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim';
10045
-				elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao';
10449
+				if (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') {
10450
+					$fromsource = 'vatsim';
10451
+				} elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') {
10452
+					$fromsource = 'ivao';
10453
+				} elseif (isset($globalVATSIM) && $globalVATSIM) {
10454
+					$fromsource = 'vatsim';
10455
+				} elseif (isset($globalIVAO) && $globalIVAO) {
10456
+					$fromsource = 'ivao';
10457
+				}
10046 10458
 				$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3),$fromsource);
10047 10459
 				if (isset($airline_array[0]['name'])) {
10048 10460
 					$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";
@@ -10052,13 +10464,17 @@  discard block
 block discarded – undo
10052 10464
 			}
10053 10465
 		}
10054 10466
 
10055
-		if ($globalDebug) print "Remove Duplicate in aircraft_modes...\n";
10467
+		if ($globalDebug) {
10468
+			print "Remove Duplicate in aircraft_modes...\n";
10469
+		}
10056 10470
 		//duplicate modes
10057 10471
 		$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";
10058 10472
 		$sth = $this->db->prepare($query);
10059 10473
 		$sth->execute();
10060 10474
 		
10061
-		if ($globalDebug) print "Aircraft...\n";
10475
+		if ($globalDebug) {
10476
+			print "Aircraft...\n";
10477
+		}
10062 10478
 		//aircraft
10063 10479
 		if ($globalDBdriver == 'mysql') {
10064 10480
 			$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)";
@@ -10101,26 +10517,38 @@  discard block
 block discarded – undo
10101 10517
 				 if (isset($closestAirports[0])) {
10102 10518
 					if ($row['arrival_airport_icao'] == $closestAirports[0]['icao']) {
10103 10519
 						$airport_icao = $closestAirports[0]['icao'];
10104
-						if ($globalDebug) echo "\o/ 1st ---++ Find arrival airport. airport_icao : ".$airport_icao."\n";
10520
+						if ($globalDebug) {
10521
+							echo "\o/ 1st ---++ Find arrival airport. airport_icao : ".$airport_icao."\n";
10522
+						}
10105 10523
 					} elseif (count($closestAirports > 1) && $row['arrival_airport_icao'] != '' && $row['arrival_airport_icao'] != 'NA') {
10106 10524
 						foreach ($closestAirports as $airport) {
10107 10525
 							if ($row['arrival_airport_icao'] == $airport['icao']) {
10108 10526
 								$airport_icao = $airport['icao'];
10109
-								if ($globalDebug) echo "\o/ try --++ Find arrival airport. airport_icao : ".$airport_icao."\n";
10527
+								if ($globalDebug) {
10528
+									echo "\o/ try --++ Find arrival airport. airport_icao : ".$airport_icao."\n";
10529
+								}
10110 10530
 								break;
10111 10531
 							}
10112 10532
 						}
10113 10533
 					} elseif ($row['last_altitude'] == 0 || ($row['last_altitude'] != '' && ($closestAirports[0]['altitude'] <= $row['last_altitude']*100+1000 && $row['last_altitude']*100 < $closestAirports[0]['altitude']+5000))) {
10114 10534
 						$airport_icao = $closestAirports[0]['icao'];
10115
-						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";
10535
+						if ($globalDebug) {
10536
+							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";
10537
+						}
10116 10538
 					} else {
10117
-						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";
10539
+						if ($globalDebug) {
10540
+							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";
10541
+						}
10118 10542
 					}
10119 10543
 				} else {
10120
-					if ($globalDebug) echo "----- No Airport near last coord. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist."\n";
10544
+					if ($globalDebug) {
10545
+						echo "----- No Airport near last coord. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist."\n";
10546
+					}
10121 10547
 				}
10122 10548
 				if ($row['real_arrival_airport_icao'] != $airport_icao) {
10123
-					if ($globalDebug) echo "Updating airport to ".$airport_icao."...\n";
10549
+					if ($globalDebug) {
10550
+						echo "Updating airport to ".$airport_icao."...\n";
10551
+					}
10124 10552
 					$update_query="UPDATE spotter_output SET real_arrival_airport_icao = :airport_icao WHERE spotter_id = :spotter_id";
10125 10553
 					$sthu = $this->db->prepare($update_query);
10126 10554
 					$sthu->execute(array(':airport_icao' => $airport_icao,':spotter_id' => $row['spotter_id']));
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.