Completed
Push — master ( d636a6...772110 )
by Yannick
07:07
created
statistics-airline.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 	  </div>
15 15
     	<p>'._("Below are the <strong>Top 10</strong> most common airlines.").'</p>';
16 16
 
17
-$airline_array = $Stats->countAllAirlines(true,$filter_name);
17
+$airline_array = $Stats->countAllAirlines(true, $filter_name);
18 18
 print '<div id="chart" class="chart" width="100%"></div>
19 19
       	<script> 
20 20
       		google.load("visualization", "1", {packages:["corechart"]});
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
             var data = google.visualization.arrayToDataTable([
24 24
             	["'._("Airline").'", "'._("# of times").'"], ';
25 25
 $airline_data = '';
26
-foreach($airline_array as $airline_item)
26
+foreach ($airline_array as $airline_item)
27 27
 {
28 28
 	$airline_data .= '[ "'.$airline_item['airline_name'].' ('.$airline_item['airline_icao'].')",'.$airline_item['airline_count'].'],';
29 29
 }
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 	print '</thead>';
59 59
 	print '<tbody>';
60 60
 	$i = 1;
61
-	foreach($airline_array as $airline_item)
61
+	foreach ($airline_array as $airline_item)
62 62
 	{
63 63
 		print '<tr>';
64 64
 		print '<td><strong>'.$i.'</strong></td>';
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -5,7 +5,9 @@
 block discarded – undo
5 5
 $Spotter = new Spotter();
6 6
 $title = _("Statistics").' - '._("Most common Route by Airport");
7 7
 require_once('header.php');
8
-if (!isset($filter_name)) $filter_name = '';
8
+if (!isset($filter_name)) {
9
+	$filter_name = '';
10
+}
9 11
 include('statistics-sub-menu.php'); 
10 12
 
11 13
 print '<script type="text/javascript" src="https://www.google.com/jsapi"></script>
Please login to merge, or discard this patch.
statistics.php 3 patches
Braces   +53 added lines, -30 removed lines patch added patch discarded remove patch
@@ -6,7 +6,9 @@  discard block
 block discarded – undo
6 6
 $Stats = new Stats();
7 7
 $title = _("Statistics");
8 8
 
9
-if (!isset($filter_name)) $filter_name = '';
9
+if (!isset($filter_name)) {
10
+	$filter_name = '';
11
+}
10 12
 $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING);
11 13
 if ($airline_icao == 'all') {
12 14
 	unset($_COOKIE['stats_airline_icao']);
@@ -15,8 +17,10 @@  discard block
 block discarded – undo
15 17
 } elseif ($airline_icao == '' && isset($_COOKIE['stats_airline_icao'])) {
16 18
 	$airline_icao = $_COOKIE['stats_airline_icao'];
17 19
 } elseif ($airline_icao == '' && isset($globalFilter)) {
18
-	if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
19
-}
20
+	if (isset($globalFilter['airline'])) {
21
+		$airline_icao = $globalFilter['airline'][0];
22
+	}
23
+	}
20 24
 setcookie('stats_airline_icao',$airline_icao);
21 25
 require_once('header.php');
22 26
 
@@ -36,7 +40,9 @@  discard block
 block discarded – undo
36 40
 	if (isset($last_update[0]['value'])) {
37 41
 		date_default_timezone_set('UTC');
38 42
 		$lastupdate = strtotime($last_update[0]['value']);
39
-		if (isset($globalTimezone) && $globalTimezone != '') date_default_timezone_set($globalTimezone);
43
+		if (isset($globalTimezone) && $globalTimezone != '') {
44
+			date_default_timezone_set($globalTimezone);
45
+		}
40 46
 		print '<i>Last update: '.date('Y-m-d G:i:s',$lastupdate).'</i>';
41 47
 	}
42 48
     ?>
@@ -89,8 +95,9 @@  discard block
 block discarded – undo
89 95
                 <h2><?php echo _("Top 10 Most Common Aircraft Type"); ?></h2>
90 96
                  <?php
91 97
                   $aircraft_array = $Stats->countAllAircraftTypes(true,$airline_icao,$filter_name);
92
-		    if (count($aircraft_array) == 0) print _("No data available");
93
-		    else {
98
+		    if (count($aircraft_array) == 0) {
99
+		    	print _("No data available");
100
+		    } else {
94 101
 
95 102
                     print '<div id="chart1" class="chart" width="100%"></div>
96 103
                     <script> 
@@ -136,8 +143,9 @@  discard block
 block discarded – undo
136 143
                 <h2><?php echo _("Top 10 Most Common Airline"); ?></h2>
137 144
                  <?php
138 145
                   $airline_array = $Stats->countAllAirlines(true,$filter_name);
139
-		    if (count($airline_array) == 0) print _("No data available");
140
-		    else {
146
+		    if (count($airline_array) == 0) {
147
+		    	print _("No data available");
148
+		    } else {
141 149
 
142 150
                   print '<div id="chart2" class="chart" width="100%"></div>
143 151
                     <script> 
@@ -197,8 +205,9 @@  discard block
 block discarded – undo
197 205
                 <h2><?php echo _("Top 10 Most Common Pilots"); ?></h2>
198 206
                  <?php
199 207
                   $pilot_array = $Stats->countAllPilots(true,$airline_icao,$filter_name);
200
-		    if (count($pilot_array) == 0) print _("No data available");
201
-		    else {
208
+		    if (count($pilot_array) == 0) {
209
+		    	print _("No data available");
210
+		    } else {
202 211
 
203 212
                   print '<div id="chart7" class="chart" width="100%"></div>
204 213
                     <script> 
@@ -244,8 +253,9 @@  discard block
 block discarded – undo
244 253
                 <h2><?php echo _("Top 10 Most Common Owners"); ?></h2>
245 254
                  <?php
246 255
                   $owner_array = $Stats->countAllOwners(true,$airline_icao,$filter_name);
247
-		    if (count($owner_array) == 0) print _("No data available");
248
-		    else {
256
+		    if (count($owner_array) == 0) {
257
+		    	print _("No data available");
258
+		    } else {
249 259
 
250 260
                   print '<div id="chart7" class="chart" width="100%"></div>
251 261
                     <script> 
@@ -293,8 +303,9 @@  discard block
 block discarded – undo
293 303
                 <h2><?php echo _("Top 20 Most Common Country a Flight was Over"); ?></h2>
294 304
                  <?php
295 305
                   //$flightover_array = $Stats->countAllFlightOverCountries();
296
-		    if (count($flightover_array) == 0) print _("No data available");
297
-		    else {
306
+		    if (count($flightover_array) == 0) {
307
+		    	print _("No data available");
308
+		    } else {
298 309
 
299 310
                   print '<div id="chart10" class="chart" width="100%"></div>
300 311
                     <script> 
@@ -346,8 +357,9 @@  discard block
 block discarded – undo
346 357
                 <h2><?php echo _("Top 10 Most Common Departure Airports"); ?></h2>
347 358
                 <?php
348 359
                 $airport_airport_array = $Stats->countAllDepartureAirports($airline_icao,$filter_name);
349
-		    if (count($airport_airport_array) == 0) print _("No data available");
350
-		    else {
360
+		    if (count($airport_airport_array) == 0) {
361
+		    	print _("No data available");
362
+		    } else {
351 363
 
352 364
                  print '<div id="chart3" class="chart" width="100%"></div>
353 365
                 <script>
@@ -396,8 +408,9 @@  discard block
 block discarded – undo
396 408
                 <h2><?php echo _("Top 10 Most Common Arrival Airports"); ?></h2>
397 409
                 <?php
398 410
                 $airport_airport_array2 = $Stats->countAllArrivalAirports($airline_icao,$filter_name);
399
-		    if (count($airport_airport_array2) == 0) print _("No data available");
400
-		    else {
411
+		    if (count($airport_airport_array2) == 0) {
412
+		    	print _("No data available");
413
+		    } else {
401 414
 
402 415
                 print '<div id="chart4" class="chart" width="100%"></div>
403 416
                 <script>
@@ -448,8 +461,9 @@  discard block
 block discarded – undo
448 461
                 <h2><?php echo _("Busiest Months of the last 12 Months"); ?></h2>
449 462
                 <?php
450 463
                   $year_array = $Stats->countAllMonthsLastYear($airline_icao,$filter_name);
451
-		    if (count($year_array) == 0) print _("No data available");
452
-		    else {
464
+		    if (count($year_array) == 0) {
465
+		    	print _("No data available");
466
+		    } else {
453 467
                   print '<div id="chart8" class="chart" width="100%"></div>
454 468
                     <script> 
455 469
                         google.load("visualization", "1", {packages:["corechart"]});
@@ -494,8 +508,9 @@  discard block
 block discarded – undo
494 508
                 <h2><?php echo _("Busiest Day in the last Month"); ?></h2>
495 509
                 <?php
496 510
                   $month_array = $Stats->countAllDatesLastMonth($airline_icao,$filter_name);
497
-		    if (count($month_array) == 0) print _("No data available");
498
-		    else {
511
+		    if (count($month_array) == 0) {
512
+		    	print _("No data available");
513
+		    } else {
499 514
                   print '<div id="chart9" class="chart" width="100%"></div>
500 515
                     <script> 
501 516
                         google.load("visualization", "1", {packages:["corechart"]});
@@ -540,8 +555,9 @@  discard block
 block discarded – undo
540 555
                 <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2>
541 556
                 <?php
542 557
                     $date_array = $Stats->countAllDatesLast7Days($airline_icao,$filter_name);
543
-		    if (empty($date_array)) print _("No data available");
544
-		    else {
558
+		    if (empty($date_array)) {
559
+		    	print _("No data available");
560
+		    } else {
545 561
                   print '<div id="chart5" class="chart" width="100%"></div>
546 562
                     <script> 
547 563
                         google.load("visualization", "1", {packages:["corechart"]});
@@ -587,8 +603,9 @@  discard block
 block discarded – undo
587 603
                 <h2><?php echo _("Busiest Time of the Day"); ?></h2>
588 604
                 <?php
589 605
                   $hour_array = $Stats->countAllHours('hour',true,$airline_icao,$filter_name);
590
-		    if (empty($hour_array)) print _("No data available");
591
-		    else {
606
+		    if (empty($hour_array)) {
607
+		    	print _("No data available");
608
+		    } else {
592 609
 
593 610
                   print '<div id="chart6" class="chart" width="100%"></div>
594 611
                     <script> 
@@ -656,8 +673,11 @@  discard block
 block discarded – undo
656 673
 					$distance = $distance;
657 674
 					$unit = 'km';
658 675
 				}
659
-        			if (!isset($polar_data)) $polar_data = '{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}';
660
-        	    		else $polar_data = $polar_data.',{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}';
676
+        			if (!isset($polar_data)) {
677
+        				$polar_data = '{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}';
678
+        			} else {
679
+        	    			$polar_data = $polar_data.',{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}';
680
+        	    		}
661 681
         		    }
662 682
         	?>
663 683
             <div class="col-md-6">
@@ -704,8 +724,11 @@  discard block
 block discarded – undo
704 724
         		foreach ($msg as $eachmsg) {
705 725
         		    //$eachmsg = $msg[0];
706 726
         		    $data = $eachmsg['source_data'];
707
-        		    if ($data > 500) $max = (round(($data+100)/100))*100;
708
-        		    else $max = 500;
727
+        		    if ($data > 500) {
728
+        		    	$max = (round(($data+100)/100))*100;
729
+        		    } else {
730
+        		    	$max = 500;
731
+        		    }
709 732
         	?>
710 733
         	<div id="msg-<?php print str_replace(' ','_',strtolower($eachmsg['source_name'])); ?>" class="col-md-4"></div>
711 734
         	<script>
Please login to merge, or discard this patch.
Indentation   +224 added lines, -224 removed lines patch added patch discarded remove patch
@@ -39,11 +39,11 @@  discard block
 block discarded – undo
39 39
 		if (isset($globalTimezone) && $globalTimezone != '') date_default_timezone_set($globalTimezone);
40 40
 		print '<i>Last update: '.date('Y-m-d G:i:s',$lastupdate).'</i>';
41 41
 	}
42
-    ?>
42
+	?>
43 43
     </div>
44 44
     <?php    
45 45
 	// print_r($Stats->getAllAirlineNames()); 
46
-    ?>
46
+	?>
47 47
     <?php include('statistics-sub-menu.php'); ?>
48 48
     <div class="row global-stats">
49 49
         <div class="col-md-2"><span class="type"><?php echo _("Flights"); ?></span><span><?php print number_format($Stats->countOverallFlights($airline_icao,$filter_name)); ?></span></div> 
@@ -51,23 +51,23 @@  discard block
 block discarded – undo
51 51
         <div class="col-md-2"><span class="type"><?php echo _("Arrivals seen"); ?></span><span><?php print number_format($Stats->countOverallArrival($airline_icao,$filter_name)); ?></span></div> 
52 52
         <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
53 53
 	<?php
54
-	    if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) {
54
+		if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) {
55 55
 	?>
56 56
     	    <div class="col-md-2"><span class="type"><?php echo _("Pilots"); ?></span><span><?php print number_format($Stats->countOverallPilots($airline_icao,$filter_name)); ?></span></div> 
57 57
 	    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
58 58
         <?php
59
-    	    } else {
60
-    	?>
59
+			} else {
60
+		?>
61 61
     	    <div class="col-md-2"><span class="type"><?php echo _("Owners"); ?></span><span><?php print number_format($Stats->countOverallOwners($airline_icao,$filter_name)); ?></span></div> 
62 62
 	    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
63 63
     	<?php
64
-    	    }
65
-    	?>
64
+			}
65
+		?>
66 66
         <div class="col-md-2"><span class="type"><?php echo _("Aircrafts"); ?></span><span><?php print number_format($Stats->countOverallAircrafts($airline_icao,$filter_name)); ?></span></div> 
67 67
         <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
68 68
         <?php
69
-    		if ($airline_icao == '') {
70
-    	?>
69
+			if ($airline_icao == '') {
70
+		?>
71 71
         <div class="col-md-2"><span class="type"><?php echo _("Airlines"); ?></span><span><?php print number_format($Stats->countOverallAirlines($filter_name)); ?></span></div>
72 72
 	<!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
73 73
 	<?php
@@ -88,25 +88,25 @@  discard block
 block discarded – undo
88 88
             <div class="col-md-6">
89 89
                 <h2><?php echo _("Top 10 Most Common Aircraft Type"); ?></h2>
90 90
                  <?php
91
-                  $aircraft_array = $Stats->countAllAircraftTypes(true,$airline_icao,$filter_name);
92
-		    if (count($aircraft_array) == 0) print _("No data available");
93
-		    else {
91
+				  $aircraft_array = $Stats->countAllAircraftTypes(true,$airline_icao,$filter_name);
92
+			if (count($aircraft_array) == 0) print _("No data available");
93
+			else {
94 94
 
95
-                    print '<div id="chart1" class="chart" width="100%"></div>
95
+					print '<div id="chart1" class="chart" width="100%"></div>
96 96
                     <script> 
97 97
                         google.load("visualization", "1", {packages:["corechart"]});
98 98
                       google.setOnLoadCallback(drawChart1);
99 99
                       function drawChart1() {
100 100
                         var data = google.visualization.arrayToDataTable([
101 101
                             ["'._("Aircraft").'", "'._("# of times").'"], ';
102
-                            $aircraft_data = '';
103
-                          foreach($aircraft_array as $aircraft_item)
104
-                                    {
105
-                                            $aircraft_data .= '[ "'.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],';
106
-                                    }
107
-                                    $aircraft_data = substr($aircraft_data, 0, -1);
108
-                                    print $aircraft_data;
109
-                        print ']);
102
+							$aircraft_data = '';
103
+						  foreach($aircraft_array as $aircraft_item)
104
+									{
105
+											$aircraft_data .= '[ "'.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],';
106
+									}
107
+									$aircraft_data = substr($aircraft_data, 0, -1);
108
+									print $aircraft_data;
109
+						print ']);
110 110
 
111 111
                         var options = {
112 112
                             chartArea: {"width": "80%", "height": "60%"},
@@ -121,8 +121,8 @@  discard block
 block discarded – undo
121 121
                               drawChart1();
122 122
                             });
123 123
                   </script>';
124
-                  }
125
-                  ?>
124
+				  }
125
+				  ?>
126 126
                 <div class="more">
127 127
                     <a href="<?php print $globalURL; ?>/statistics/aircraft" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
128 128
                 </div>
@@ -130,30 +130,30 @@  discard block
 block discarded – undo
130 130
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
131 131
 <?php
132 132
 //    echo $airline_icao;
133
-    if ($airline_icao == '' || $airline_icao == 'all') {
133
+	if ($airline_icao == '' || $airline_icao == 'all') {
134 134
 ?>
135 135
             <div class="col-md-6">
136 136
                 <h2><?php echo _("Top 10 Most Common Airline"); ?></h2>
137 137
                  <?php
138
-                  $airline_array = $Stats->countAllAirlines(true,$filter_name);
139
-		    if (count($airline_array) == 0) print _("No data available");
140
-		    else {
138
+				  $airline_array = $Stats->countAllAirlines(true,$filter_name);
139
+			if (count($airline_array) == 0) print _("No data available");
140
+			else {
141 141
 
142
-                  print '<div id="chart2" class="chart" width="100%"></div>
142
+				  print '<div id="chart2" class="chart" width="100%"></div>
143 143
                     <script> 
144 144
                         google.load("visualization", "1", {packages:["corechart"]});
145 145
                       google.setOnLoadCallback(drawChart2);
146 146
                       function drawChart2() {
147 147
                         var data = google.visualization.arrayToDataTable([
148 148
                             ["'._("Airline").'", "'._("# of times").'"], ';
149
-                            $airline_data = '';
150
-                          foreach($airline_array as $airline_item)
151
-                                    {
152
-                                            $airline_data .= '[ "'.$airline_item['airline_name'].' ('.$airline_item['airline_icao'].')",'.$airline_item['airline_count'].'],';
153
-                                    }
154
-                                    $airline_data = substr($airline_data, 0, -1);
155
-                                    print $airline_data;
156
-                        print ']);
149
+							$airline_data = '';
150
+						  foreach($airline_array as $airline_item)
151
+									{
152
+											$airline_data .= '[ "'.$airline_item['airline_name'].' ('.$airline_item['airline_icao'].')",'.$airline_item['airline_count'].'],';
153
+									}
154
+									$airline_data = substr($airline_data, 0, -1);
155
+									print $airline_data;
156
+						print ']);
157 157
 
158 158
                         var options = {
159 159
                             chartArea: {"width": "80%", "height": "60%"},
@@ -168,8 +168,8 @@  discard block
 block discarded – undo
168 168
                               drawChart2();
169 169
                             });
170 170
                   </script>';
171
-                  }
172
-                  ?>
171
+				  }
172
+				  ?>
173 173
                 <div class="more">
174 174
                     <a href="<?php print $globalURL; ?>/statistics/airline" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
175 175
                 </div>
@@ -177,44 +177,44 @@  discard block
 block discarded – undo
177 177
         </div>
178 178
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
179 179
 <?php
180
-    }
180
+	}
181 181
 ?>
182 182
         <div class="row column">
183 183
 
184 184
 	    <?php
185
-                 $flightover_array = $Stats->countAllFlightOverCountries($airline_icao,$filter_name);
185
+				 $flightover_array = $Stats->countAllFlightOverCountries($airline_icao,$filter_name);
186 186
 		if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) {
187
-		    if (empty($flightover_array)) {
188
-	    ?>
187
+			if (empty($flightover_array)) {
188
+		?>
189 189
             <div class="col-md-12">
190 190
             <?php
191
-        	    } else {
192
-            ?>
191
+				} else {
192
+			?>
193 193
             <div class="col-md-6">
194 194
             <?php
195
-            	    }
196
-            ?>
195
+					}
196
+			?>
197 197
                 <h2><?php echo _("Top 10 Most Common Pilots"); ?></h2>
198 198
                  <?php
199
-                  $pilot_array = $Stats->countAllPilots(true,$airline_icao,$filter_name);
200
-		    if (count($pilot_array) == 0) print _("No data available");
201
-		    else {
199
+				  $pilot_array = $Stats->countAllPilots(true,$airline_icao,$filter_name);
200
+			if (count($pilot_array) == 0) print _("No data available");
201
+			else {
202 202
 
203
-                  print '<div id="chart7" class="chart" width="100%"></div>
203
+				  print '<div id="chart7" class="chart" width="100%"></div>
204 204
                     <script> 
205 205
                         google.load("visualization", "1", {packages:["corechart"]});
206 206
                       google.setOnLoadCallback(drawChart7);
207 207
                       function drawChart7() {
208 208
                         var data = google.visualization.arrayToDataTable([
209 209
                             ["'._("Pilots").'", "'._("# of times").'"], ';
210
-                            $pilot_data = '';
211
-                          foreach($pilot_array as $pilot_item)
212
-                                    {
213
-                                            $pilot_data .= '[ "'.$pilot_item['pilot_name'].' ('.$pilot_item['pilot_id'].')",'.$pilot_item['pilot_count'].'],';
214
-                                    }
215
-                                    $pilot_data = substr($pilot_data, 0, -1);
216
-                                    print $pilot_data;
217
-                        print ']);
210
+							$pilot_data = '';
211
+						  foreach($pilot_array as $pilot_item)
212
+									{
213
+											$pilot_data .= '[ "'.$pilot_item['pilot_name'].' ('.$pilot_item['pilot_id'].')",'.$pilot_item['pilot_count'].'],';
214
+									}
215
+									$pilot_data = substr($pilot_data, 0, -1);
216
+									print $pilot_data;
217
+						print ']);
218 218
 
219 219
                         var options = {
220 220
                             chartArea: {"width": "80%", "height": "60%"},
@@ -229,8 +229,8 @@  discard block
 block discarded – undo
229 229
                               drawChart7();
230 230
                             });
231 231
                   </script>';
232
-                  }
233
-                  ?>
232
+				  }
233
+				  ?>
234 234
                 <div class="more">
235 235
                     <a href="<?php print $globalURL; ?>/statistics/pilot" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
236 236
                 </div>
@@ -238,30 +238,30 @@  discard block
 block discarded – undo
238 238
         
239 239
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
240 240
         <?php
241
-    	    } else {
242
-    	?>
241
+			} else {
242
+		?>
243 243
             <div class="col-md-6">
244 244
                 <h2><?php echo _("Top 10 Most Common Owners"); ?></h2>
245 245
                  <?php
246
-                  $owner_array = $Stats->countAllOwners(true,$airline_icao,$filter_name);
247
-		    if (count($owner_array) == 0) print _("No data available");
248
-		    else {
246
+				  $owner_array = $Stats->countAllOwners(true,$airline_icao,$filter_name);
247
+			if (count($owner_array) == 0) print _("No data available");
248
+			else {
249 249
 
250
-                  print '<div id="chart7" class="chart" width="100%"></div>
250
+				  print '<div id="chart7" class="chart" width="100%"></div>
251 251
                     <script> 
252 252
                         google.load("visualization", "1", {packages:["corechart"]});
253 253
                       google.setOnLoadCallback(drawChart7);
254 254
                       function drawChart7() {
255 255
                         var data = google.visualization.arrayToDataTable([
256 256
                             ["'._("Owner").'", "'._("# of times").'"], ';
257
-                            $owner_data = '';
258
-                          foreach($owner_array as $owner_item)
259
-                                    {
260
-                                            $owner_data .= '[ "'.$owner_item['owner_name'].'",'.$owner_item['owner_count'].'],';
261
-                                    }
262
-                                    $owner_data = substr($owner_data, 0, -1);
263
-                                    print $owner_data;
264
-                        print ']);
257
+							$owner_data = '';
258
+						  foreach($owner_array as $owner_item)
259
+									{
260
+											$owner_data .= '[ "'.$owner_item['owner_name'].'",'.$owner_item['owner_count'].'],';
261
+									}
262
+									$owner_data = substr($owner_data, 0, -1);
263
+									print $owner_data;
264
+						print ']);
265 265
 
266 266
                         var options = {
267 267
                             chartArea: {"width": "80%", "height": "60%"},
@@ -276,8 +276,8 @@  discard block
 block discarded – undo
276 276
                               drawChart7();
277 277
                             });
278 278
                   </script>';
279
-                  }
280
-                  ?>
279
+				  }
280
+				  ?>
281 281
                 <div class="more">
282 282
                     <a href="<?php print $globalURL; ?>/statistics/owner" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
283 283
                 </div>
@@ -285,32 +285,32 @@  discard block
 block discarded – undo
285 285
         
286 286
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
287 287
         <?php
288
-    	    }
289
-    	    if (!empty($flightover_array)) {
290
-    	?>
288
+			}
289
+			if (!empty($flightover_array)) {
290
+		?>
291 291
     	
292 292
             <div class="col-md-6">
293 293
                 <h2><?php echo _("Top 20 Most Common Country a Flight was Over"); ?></h2>
294 294
                  <?php
295
-                  //$flightover_array = $Stats->countAllFlightOverCountries();
296
-		    if (count($flightover_array) == 0) print _("No data available");
297
-		    else {
295
+				  //$flightover_array = $Stats->countAllFlightOverCountries();
296
+			if (count($flightover_array) == 0) print _("No data available");
297
+			else {
298 298
 
299
-                  print '<div id="chart10" class="chart" width="100%"></div>
299
+				  print '<div id="chart10" class="chart" width="100%"></div>
300 300
                     <script> 
301 301
                         google.load("visualization", "1", {packages:["corechart"]});
302 302
                       google.setOnLoadCallback(drawChart10);
303 303
                       function drawChart10() {
304 304
                         var data = google.visualization.arrayToDataTable([
305 305
                             ["'._("Country").'", "'._("# of times").'"], ';
306
-                            $flightover_data = '';
307
-                          foreach($flightover_array as $flightover_item)
308
-                                    {
309
-                                            $flightover_data .= '[ "'.$flightover_item['flight_country'].' ('.$flightover_item['flight_country_iso2'].')",'.$flightover_item['flight_count'].'],';
310
-                                    }
311
-                                    $flightover_data = substr($flightover_data, 0, -1);
312
-                                    print $flightover_data;
313
-                        print ']);
306
+							$flightover_data = '';
307
+						  foreach($flightover_array as $flightover_item)
308
+									{
309
+											$flightover_data .= '[ "'.$flightover_item['flight_country'].' ('.$flightover_item['flight_country_iso2'].')",'.$flightover_item['flight_count'].'],';
310
+									}
311
+									$flightover_data = substr($flightover_data, 0, -1);
312
+									print $flightover_data;
313
+						print ']);
314 314
 
315 315
                         var options = {
316 316
                             chartArea: {"width": "80%", "height": "60%"},
@@ -327,15 +327,15 @@  discard block
 block discarded – undo
327 327
                               drawChart10();
328 328
                             });
329 329
                   </script>';
330
-                  }
331
-                  ?>
330
+				  }
331
+				  ?>
332 332
                 <div class="more">
333 333
                     <a href="<?php print $globalURL; ?>/statistics/country" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
334 334
                 </div>
335 335
             </div>
336 336
         <?php
337
-            }
338
-        ?>
337
+			}
338
+		?>
339 339
         </div>
340 340
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
341 341
 
@@ -345,11 +345,11 @@  discard block
 block discarded – undo
345 345
             <div class="col-md-6">
346 346
                 <h2><?php echo _("Top 10 Most Common Departure Airports"); ?></h2>
347 347
                 <?php
348
-                $airport_airport_array = $Stats->countAllDepartureAirports(true,$airline_icao,$filter_name);
349
-		    if (count($airport_airport_array) == 0) print _("No data available");
350
-		    else {
348
+				$airport_airport_array = $Stats->countAllDepartureAirports(true,$airline_icao,$filter_name);
349
+			if (count($airport_airport_array) == 0) print _("No data available");
350
+			else {
351 351
 
352
-                 print '<div id="chart3" class="chart" width="100%"></div>
352
+				 print '<div id="chart3" class="chart" width="100%"></div>
353 353
                 <script>
354 354
                 google.load("visualization", "1", {packages:["geochart"]});
355 355
                 google.setOnLoadCallback(drawCharts3);
@@ -360,17 +360,17 @@  discard block
 block discarded – undo
360 360
 
361 361
                 var data = google.visualization.arrayToDataTable([ 
362 362
                     ["'._("Airport").'", "'._("# of times").'"],';
363
-                    $airport_data = '';
364
-                  foreach($airport_airport_array as $airport_item)
365
-                        {
366
-                            $name = $airport_item['airport_departure_city'].', '.$airport_item['airport_departure_country'].' ('.$airport_item['airport_departure_icao'].')';
367
-                            $name = str_replace("'", "", $name);
368
-                            $name = str_replace('"', "", $name);
369
-                            $airport_data .= '[ "'.$name.'",'.$airport_item['airport_departure_icao_count'].'],';
370
-                        }
371
-                        $airport_data = substr($airport_data, 0, -1);
372
-                        print $airport_data;
373
-                print ']);
363
+					$airport_data = '';
364
+				  foreach($airport_airport_array as $airport_item)
365
+						{
366
+							$name = $airport_item['airport_departure_city'].', '.$airport_item['airport_departure_country'].' ('.$airport_item['airport_departure_icao'].')';
367
+							$name = str_replace("'", "", $name);
368
+							$name = str_replace('"', "", $name);
369
+							$airport_data .= '[ "'.$name.'",'.$airport_item['airport_departure_icao_count'].'],';
370
+						}
371
+						$airport_data = substr($airport_data, 0, -1);
372
+						print $airport_data;
373
+				print ']);
374 374
 
375 375
                 var options = {
376 376
                     legend: {position: "none"},
@@ -384,8 +384,8 @@  discard block
 block discarded – undo
384 384
                 chart.draw(data, options);
385 385
               }
386 386
                 </script>';
387
-                }
388
-              ?>
387
+				}
388
+			  ?>
389 389
               <div class="more">
390 390
                 <a href="<?php print $globalURL; ?>/statistics/airport-departure" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
391 391
               </div>
@@ -395,11 +395,11 @@  discard block
 block discarded – undo
395 395
             <div class="col-md-6">
396 396
                 <h2><?php echo _("Top 10 Most Common Arrival Airports"); ?></h2>
397 397
                 <?php
398
-                $airport_airport_array2 = $Stats->countAllArrivalAirports(true,$airline_icao,$filter_name);
399
-		    if (count($airport_airport_array2) == 0) print _("No data available");
400
-		    else {
398
+				$airport_airport_array2 = $Stats->countAllArrivalAirports(true,$airline_icao,$filter_name);
399
+			if (count($airport_airport_array2) == 0) print _("No data available");
400
+			else {
401 401
 
402
-                print '<div id="chart4" class="chart" width="100%"></div>
402
+				print '<div id="chart4" class="chart" width="100%"></div>
403 403
                 <script>
404 404
                 google.load("visualization", "1", {packages:["geochart"]});
405 405
                 google.setOnLoadCallback(drawCharts4);
@@ -410,17 +410,17 @@  discard block
 block discarded – undo
410 410
 
411 411
                 var data = google.visualization.arrayToDataTable([ 
412 412
                     ["'._("Airport").'", "'._("# of times").'"],';
413
-                    $airport_data2 = '';
414
-                  foreach($airport_airport_array2 as $airport_item2)
415
-                        {
416
-                            $name2 = $airport_item2['airport_arrival_city'].', '.$airport_item2['airport_arrival_country'].' ('.$airport_item2['airport_arrival_icao'].')';
417
-                            $name2 = str_replace("'", "", $name2);
418
-                            $name2 = str_replace('"', "", $name2);
419
-                            $airport_data2 .= '[ "'.$name2.'",'.$airport_item2['airport_arrival_icao_count'].'],';
420
-                        }
421
-                        $airport_data2 = substr($airport_data2, 0, -1);
422
-                        print $airport_data2;
423
-                print ']);
413
+					$airport_data2 = '';
414
+				  foreach($airport_airport_array2 as $airport_item2)
415
+						{
416
+							$name2 = $airport_item2['airport_arrival_city'].', '.$airport_item2['airport_arrival_country'].' ('.$airport_item2['airport_arrival_icao'].')';
417
+							$name2 = str_replace("'", "", $name2);
418
+							$name2 = str_replace('"', "", $name2);
419
+							$airport_data2 .= '[ "'.$name2.'",'.$airport_item2['airport_arrival_icao_count'].'],';
420
+						}
421
+						$airport_data2 = substr($airport_data2, 0, -1);
422
+						print $airport_data2;
423
+				print ']);
424 424
 
425 425
                 var options = {
426 426
                     legend: {position: "none"},
@@ -434,8 +434,8 @@  discard block
 block discarded – undo
434 434
                 chart.draw(data, options);
435 435
               }
436 436
                 </script>';
437
-                }
438
-              ?>
437
+				}
438
+			  ?>
439 439
               <div class="more">
440 440
                 <a href="<?php print $globalURL; ?>/statistics/airport-arrival" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
441 441
               </div>
@@ -447,24 +447,24 @@  discard block
 block discarded – undo
447 447
             <div class="col-md-6">
448 448
                 <h2><?php echo _("Busiest Months of the last 12 Months"); ?></h2>
449 449
                 <?php
450
-                  $year_array = $Stats->countAllMonthsLastYear(true,$airline_icao,$filter_name);
451
-		    if (count($year_array) == 0) print _("No data available");
452
-		    else {
453
-                  print '<div id="chart8" class="chart" width="100%"></div>
450
+				  $year_array = $Stats->countAllMonthsLastYear(true,$airline_icao,$filter_name);
451
+			if (count($year_array) == 0) print _("No data available");
452
+			else {
453
+				  print '<div id="chart8" class="chart" width="100%"></div>
454 454
                     <script> 
455 455
                         google.load("visualization", "1", {packages:["corechart"]});
456 456
                       google.setOnLoadCallback(drawChart8);
457 457
                       function drawChart8() {
458 458
                         var data = google.visualization.arrayToDataTable([
459 459
                             ["'._("Month").'", "'._("# of Flights").'"], ';
460
-                            $year_data = '';
461
-                          foreach($year_array as $year_item)
462
-                                    {
463
-                                        $year_data .= '[ "'.date('F, Y',strtotime($year_item['year_name'].'-'.$year_item['month_name'].'-01')).'",'.$year_item['date_count'].'],';
464
-                                    }
465
-                                    $year_data = substr($year_data, 0, -1);
466
-                                    print $year_data;
467
-                        print ']);
460
+							$year_data = '';
461
+						  foreach($year_array as $year_item)
462
+									{
463
+										$year_data .= '[ "'.date('F, Y',strtotime($year_item['year_name'].'-'.$year_item['month_name'].'-01')).'",'.$year_item['date_count'].'],';
464
+									}
465
+									$year_data = substr($year_data, 0, -1);
466
+									print $year_data;
467
+						print ']);
468 468
 
469 469
                         var options = {
470 470
                             legend: {position: "none"},
@@ -482,8 +482,8 @@  discard block
 block discarded – undo
482 482
                               drawChart8();
483 483
                             });
484 484
                   </script>';
485
-                  }
486
-                  ?>
485
+				  }
486
+				  ?>
487 487
                 <div class="more">
488 488
                     <a href="<?php print $globalURL; ?>/statistics/year" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
489 489
                 </div>
@@ -493,24 +493,24 @@  discard block
 block discarded – undo
493 493
             <div class="col-md-6">
494 494
                 <h2><?php echo _("Busiest Day in the last Month"); ?></h2>
495 495
                 <?php
496
-                  $month_array = $Stats->countAllDatesLastMonth($airline_icao,$filter_name);
497
-		    if (count($month_array) == 0) print _("No data available");
498
-		    else {
499
-                  print '<div id="chart9" class="chart" width="100%"></div>
496
+				  $month_array = $Stats->countAllDatesLastMonth($airline_icao,$filter_name);
497
+			if (count($month_array) == 0) print _("No data available");
498
+			else {
499
+				  print '<div id="chart9" class="chart" width="100%"></div>
500 500
                     <script> 
501 501
                         google.load("visualization", "1", {packages:["corechart"]});
502 502
                       google.setOnLoadCallback(drawChart9);
503 503
                       function drawChart9() {
504 504
                         var data = google.visualization.arrayToDataTable([
505 505
                             ["'._("Day").'", "'._("# of Flights").'"], ';
506
-                            $month_data = '';
507
-                          foreach($month_array as $month_item)
508
-                                    {
509
-                                        $month_data .= '[ "'.date('F j, Y',strtotime($month_item['date_name'])).'",'.$month_item['date_count'].'],';
510
-                                    }
511
-                                    $month_data = substr($month_data, 0, -1);
512
-                                    print $month_data;
513
-                        print ']);
506
+							$month_data = '';
507
+						  foreach($month_array as $month_item)
508
+									{
509
+										$month_data .= '[ "'.date('F j, Y',strtotime($month_item['date_name'])).'",'.$month_item['date_count'].'],';
510
+									}
511
+									$month_data = substr($month_data, 0, -1);
512
+									print $month_data;
513
+						print ']);
514 514
 
515 515
                         var options = {
516 516
                             legend: {position: "none"},
@@ -528,8 +528,8 @@  discard block
 block discarded – undo
528 528
                               drawChart9();
529 529
                             });
530 530
                   </script>';
531
-                  }
532
-                  ?>
531
+				  }
532
+				  ?>
533 533
                 <div class="more">
534 534
                     <a href="<?php print $globalURL; ?>/statistics/month" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
535 535
                 </div>
@@ -539,25 +539,25 @@  discard block
 block discarded – undo
539 539
             <div class="col-md-6">
540 540
                 <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2>
541 541
                 <?php
542
-                    $date_array = $Stats->countAllDatesLast7Days($airline_icao,$filter_name);
543
-		    if (empty($date_array)) print _("No data available");
544
-		    else {
545
-                  print '<div id="chart5" class="chart" width="100%"></div>
542
+					$date_array = $Stats->countAllDatesLast7Days($airline_icao,$filter_name);
543
+			if (empty($date_array)) print _("No data available");
544
+			else {
545
+				  print '<div id="chart5" class="chart" width="100%"></div>
546 546
                     <script> 
547 547
                         google.load("visualization", "1", {packages:["corechart"]});
548 548
                       google.setOnLoadCallback(drawChart5);
549 549
                       function drawChart5() {
550 550
                         var data = google.visualization.arrayToDataTable([
551 551
                             ["'._("Date").'", "'._("# of Flights").'"], ';
552
-                            $date_data = '';
552
+							$date_data = '';
553 553
                         
554
-                          foreach($date_array as $date_item)
555
-                                    {
556
-                                        $date_data .= '[ "'.date("F j, Y", strtotime($date_item['date_name'])).'",'.$date_item['date_count'].'],';
557
-                                    }
558
-                                    $date_data = substr($date_data, 0, -1);
559
-                                    print $date_data;
560
-                        print ']);
554
+						  foreach($date_array as $date_item)
555
+									{
556
+										$date_data .= '[ "'.date("F j, Y", strtotime($date_item['date_name'])).'",'.$date_item['date_count'].'],';
557
+									}
558
+									$date_data = substr($date_data, 0, -1);
559
+									print $date_data;
560
+						print ']);
561 561
 
562 562
                         var options = {
563 563
                             legend: {position: "none"},
@@ -575,8 +575,8 @@  discard block
 block discarded – undo
575 575
                               drawChart5();
576 576
                             });
577 577
                   </script>';
578
-                  }
579
-                  ?>
578
+				  }
579
+				  ?>
580 580
                 <div class="more">
581 581
                     <a href="<?php print $globalURL; ?>/statistics/date" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
582 582
                 </div>
@@ -586,25 +586,25 @@  discard block
 block discarded – undo
586 586
             <div class="col-md-6">
587 587
                 <h2><?php echo _("Busiest Time of the Day"); ?></h2>
588 588
                 <?php
589
-                  $hour_array = $Stats->countAllHours('hour',true,$airline_icao,$filter_name);
590
-		    if (empty($hour_array)) print _("No data available");
591
-		    else {
589
+				  $hour_array = $Stats->countAllHours('hour',true,$airline_icao,$filter_name);
590
+			if (empty($hour_array)) print _("No data available");
591
+			else {
592 592
 
593
-                  print '<div id="chart6" class="chart" width="100%"></div>
593
+				  print '<div id="chart6" class="chart" width="100%"></div>
594 594
                     <script> 
595 595
                         google.load("visualization", "1", {packages:["corechart"]});
596 596
                       google.setOnLoadCallback(drawChart6);
597 597
                       function drawChart6() {
598 598
                         var data = google.visualization.arrayToDataTable([
599 599
                             ["'._("Hour").'", "'._("# of Flights").'"], ';
600
-                            $hour_data = '';
601
-                          foreach($hour_array as $hour_item)
602
-                                    {
603
-                                        $hour_data .= '[ "'.$hour_item['hour_name'].':00",'.$hour_item['hour_count'].'],';
604
-                                    }
605
-                                    $hour_data = substr($hour_data, 0, -1);
606
-                                    print $hour_data;
607
-                        print ']);
600
+							$hour_data = '';
601
+						  foreach($hour_array as $hour_item)
602
+									{
603
+										$hour_data .= '[ "'.$hour_item['hour_name'].':00",'.$hour_item['hour_count'].'],';
604
+									}
605
+									$hour_data = substr($hour_data, 0, -1);
606
+									print $hour_data;
607
+						print ']);
608 608
 
609 609
                         var options = {
610 610
                             legend: {position: "none"},
@@ -622,8 +622,8 @@  discard block
 block discarded – undo
622 622
                               drawChart6();
623 623
                             });
624 624
                   </script>';
625
-                  }
626
-                ?>
625
+				  }
626
+				?>
627 627
                 <div class="more">
628 628
                     <a href="<?php print $globalURL; ?>/statistics/time" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
629 629
                 </div>
@@ -631,21 +631,21 @@  discard block
 block discarded – undo
631 631
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
632 632
         </div>
633 633
 <?php
634
-    if ($airline_icao == '' && $filter_name == '') {
634
+	if ($airline_icao == '' && $filter_name == '') {
635 635
 ?>
636 636
         <div class="row column">
637 637
         	<?php
638
-        	    $polar = $Stats->getStatsSource(date('Y-m-d'),'polar');
639
-        	    if (!empty($polar)) {
640
-            		print '<h2>'._("Coverage pattern").'</h2>';
641
-        		foreach ($polar as $eachpolar) {
642
-        		    unset($polar_data);
643
-	        	    $Spotter = new Spotter();
644
-        		    $data = json_decode($eachpolar['source_data']);
645
-        		    foreach($data as $value => $key) {
646
-        			$direction = $Spotter->parseDirection(($value*22.5));
647
-        			$distance = $key;
648
-        			$unit = 'km';
638
+				$polar = $Stats->getStatsSource(date('Y-m-d'),'polar');
639
+				if (!empty($polar)) {
640
+					print '<h2>'._("Coverage pattern").'</h2>';
641
+				foreach ($polar as $eachpolar) {
642
+					unset($polar_data);
643
+					$Spotter = new Spotter();
644
+					$data = json_decode($eachpolar['source_data']);
645
+					foreach($data as $value => $key) {
646
+					$direction = $Spotter->parseDirection(($value*22.5));
647
+					$distance = $key;
648
+					$unit = 'km';
649 649
 				if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) {
650 650
 					$distance = round($distance*0.539957);
651 651
 					$unit = 'nm';
@@ -656,10 +656,10 @@  discard block
 block discarded – undo
656 656
 					$distance = $distance;
657 657
 					$unit = 'km';
658 658
 				}
659
-        			if (!isset($polar_data)) $polar_data = '{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}';
660
-        	    		else $polar_data = $polar_data.',{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}';
661
-        		    }
662
-        	?>
659
+					if (!isset($polar_data)) $polar_data = '{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}';
660
+						else $polar_data = $polar_data.',{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}';
661
+					}
662
+			?>
663 663
             <div class="col-md-6">
664 664
                 <h4><?php print $eachpolar['source_name']; ?></h4>
665 665
         	<div id="polar-<?php print str_replace(' ','_',strtolower($eachpolar['source_name'])); ?>" class="chart" width="100%"></div>
@@ -691,22 +691,22 @@  discard block
 block discarded – undo
691 691
 		</script>
692 692
             </div>
693 693
             <?php
694
-        	    }
695
-        	}
696
-            ?>
694
+				}
695
+			}
696
+			?>
697 697
         </div>
698 698
         <div class="row column">
699 699
             <div class="col-md-6">
700 700
         	<?php
701
-        	    $msg = $Stats->getStatsSource(date('Y-m-d'),'msg');
702
-        	    if (!empty($msg)) {
703
-            		print '<h2>'._("Messages received").'</h2>';
704
-        		foreach ($msg as $eachmsg) {
705
-        		    //$eachmsg = $msg[0];
706
-        		    $data = $eachmsg['source_data'];
707
-        		    if ($data > 500) $max = (round(($data+100)/100))*100;
708
-        		    else $max = 500;
709
-        	?>
701
+				$msg = $Stats->getStatsSource(date('Y-m-d'),'msg');
702
+				if (!empty($msg)) {
703
+					print '<h2>'._("Messages received").'</h2>';
704
+				foreach ($msg as $eachmsg) {
705
+					//$eachmsg = $msg[0];
706
+					$data = $eachmsg['source_data'];
707
+					if ($data > 500) $max = (round(($data+100)/100))*100;
708
+					else $max = 500;
709
+			?>
710 710
         	<div id="msg-<?php print str_replace(' ','_',strtolower($eachmsg['source_name'])); ?>" class="col-md-4"></div>
711 711
         	<script>
712 712
 		      var g = new JustGage({
@@ -722,9 +722,9 @@  discard block
 block discarded – undo
722 722
 			  });
723 723
 		</script>
724 724
             <?php
725
-        	   }
726
-        	}
727
-            ?>
725
+			   }
726
+			}
727
+			?>
728 728
             </div>
729 729
         </div>
730 730
         <div class="row column">
@@ -751,19 +751,19 @@  discard block
 block discarded – undo
751 751
 				$hist_data .= '[ "'.$distance.'",'.$nb.'],';
752 752
 			}
753 753
 			$hist_data = substr($hist_data, 0, -1);
754
-            ?>
754
+			?>
755 755
             <div class="col-md-6">
756 756
                 <h2><?php echo sprintf(_("Flights Distance for %s"),$source); ?></h2>
757 757
                 <?php
758
-                  print '<div id="charthist-'.str_replace(' ','_',strtolower($source)).'" class="chart" width="100%"></div>
758
+				  print '<div id="charthist-'.str_replace(' ','_',strtolower($source)).'" class="chart" width="100%"></div>
759 759
                     <script> 
760 760
                         google.load("visualization", "1", {packages:["corechart"]});
761 761
                       google.setOnLoadCallback(drawCharthist_'.str_replace(' ','_',strtolower($source)).');
762 762
                       function drawCharthist_'.str_replace(' ','_',strtolower($source)).'() {
763 763
                         var data = google.visualization.arrayToDataTable([
764 764
                             ["'._("Distance").'", "'._("# of Flights").'"], ';
765
-                            print $hist_data;
766
-                        print ']);
765
+							print $hist_data;
766
+						print ']);
767 767
 
768 768
                         var options = {
769 769
                             legend: {position: "none"},
@@ -781,15 +781,15 @@  discard block
 block discarded – undo
781 781
                               drawCharthist_'.str_replace(' ','_',strtolower($source)).'();
782 782
                             });
783 783
                   </script>';
784
-        	?>
784
+			?>
785 785
     	    </div>
786 786
 	    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
787 787
         	<?php
788
-                  }
789
-                ?>
788
+				  }
789
+				?>
790 790
         </div>
791 791
 <?php
792
-    }
792
+	}
793 793
 ?>
794 794
     </div>
795 795
 </div>  
Please login to merge, or discard this patch.
Spacing   +69 added lines, -69 removed lines patch added patch discarded remove patch
@@ -7,17 +7,17 @@  discard block
 block discarded – undo
7 7
 $title = _("Statistics");
8 8
 
9 9
 if (!isset($filter_name)) $filter_name = '';
10
-$airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING);
10
+$airline_icao = (string) filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING);
11 11
 if ($airline_icao == 'all') {
12 12
 	unset($_COOKIE['stats_airline_icao']);
13
-	setcookie('stats_airline_icao', '', time()-3600);
13
+	setcookie('stats_airline_icao', '', time() - 3600);
14 14
 	$airline_icao = '';
15 15
 } elseif ($airline_icao == '' && isset($_COOKIE['stats_airline_icao'])) {
16 16
 	$airline_icao = $_COOKIE['stats_airline_icao'];
17 17
 } elseif ($airline_icao == '' && isset($globalFilter)) {
18 18
 	if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
19 19
 }
20
-setcookie('stats_airline_icao',$airline_icao);
20
+setcookie('stats_airline_icao', $airline_icao);
21 21
 require_once('header.php');
22 22
 
23 23
 ?>
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 		date_default_timezone_set('UTC');
38 38
 		$lastupdate = strtotime($last_update[0]['value']);
39 39
 		if (isset($globalTimezone) && $globalTimezone != '') date_default_timezone_set($globalTimezone);
40
-		print '<i>Last update: '.date('Y-m-d G:i:s',$lastupdate).'</i>';
40
+		print '<i>Last update: '.date('Y-m-d G:i:s', $lastupdate).'</i>';
41 41
 	}
42 42
     ?>
43 43
     </div>
@@ -46,30 +46,30 @@  discard block
 block discarded – undo
46 46
     ?>
47 47
     <?php include('statistics-sub-menu.php'); ?>
48 48
     <div class="row global-stats">
49
-        <div class="col-md-2"><span class="type"><?php echo _("Flights"); ?></span><span><?php print number_format($Stats->countOverallFlights($airline_icao,$filter_name)); ?></span></div> 
50
-	<!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
51
-        <div class="col-md-2"><span class="type"><?php echo _("Arrivals seen"); ?></span><span><?php print number_format($Stats->countOverallArrival($airline_icao,$filter_name)); ?></span></div> 
52
-        <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
49
+        <div class="col-md-2"><span class="type"><?php echo _("Flights"); ?></span><span><?php print number_format($Stats->countOverallFlights($airline_icao, $filter_name)); ?></span></div> 
50
+	<!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
51
+        <div class="col-md-2"><span class="type"><?php echo _("Arrivals seen"); ?></span><span><?php print number_format($Stats->countOverallArrival($airline_icao, $filter_name)); ?></span></div> 
52
+        <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
53 53
 	<?php
54 54
 	    if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) {
55 55
 	?>
56
-    	    <div class="col-md-2"><span class="type"><?php echo _("Pilots"); ?></span><span><?php print number_format($Stats->countOverallPilots($airline_icao,$filter_name)); ?></span></div> 
57
-	    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
56
+    	    <div class="col-md-2"><span class="type"><?php echo _("Pilots"); ?></span><span><?php print number_format($Stats->countOverallPilots($airline_icao, $filter_name)); ?></span></div> 
57
+	    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
58 58
         <?php
59 59
     	    } else {
60 60
     	?>
61
-    	    <div class="col-md-2"><span class="type"><?php echo _("Owners"); ?></span><span><?php print number_format($Stats->countOverallOwners($airline_icao,$filter_name)); ?></span></div> 
62
-	    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
61
+    	    <div class="col-md-2"><span class="type"><?php echo _("Owners"); ?></span><span><?php print number_format($Stats->countOverallOwners($airline_icao, $filter_name)); ?></span></div> 
62
+	    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
63 63
     	<?php
64 64
     	    }
65 65
     	?>
66
-        <div class="col-md-2"><span class="type"><?php echo _("Aircrafts"); ?></span><span><?php print number_format($Stats->countOverallAircrafts($airline_icao,$filter_name)); ?></span></div> 
67
-        <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
66
+        <div class="col-md-2"><span class="type"><?php echo _("Aircrafts"); ?></span><span><?php print number_format($Stats->countOverallAircrafts($airline_icao, $filter_name)); ?></span></div> 
67
+        <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
68 68
         <?php
69 69
     		if ($airline_icao == '') {
70 70
     	?>
71 71
         <div class="col-md-2"><span class="type"><?php echo _("Airlines"); ?></span><span><?php print number_format($Stats->countOverallAirlines($filter_name)); ?></span></div>
72
-	<!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
72
+	<!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
73 73
 	<?php
74 74
 		}
75 75
 	?>
@@ -77,18 +77,18 @@  discard block
 block discarded – undo
77 77
 		if (!(isset($globalIVAO) && $globalIVAO) && !(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalphpVMS) && $globalphpVMS)) {
78 78
 	?>
79 79
         <div class="col-md-2"><span class="type"><?php echo _("Military"); ?></span><span><?php print number_format($Stats->countOverallMilitaryFlights($filter_name)); ?></span></div> 
80
-	<!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
80
+	<!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
81 81
 	<?php
82 82
 		}
83 83
 	?>
84 84
     </div>
85
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
85
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
86 86
     <div class="specific-stats">
87 87
         <div class="row column">
88 88
             <div class="col-md-6">
89 89
                 <h2><?php echo _("Top 10 Most Common Aircraft Type"); ?></h2>
90 90
                  <?php
91
-                  $aircraft_array = $Stats->countAllAircraftTypes(true,$airline_icao,$filter_name);
91
+                  $aircraft_array = $Stats->countAllAircraftTypes(true, $airline_icao, $filter_name);
92 92
 		    if (count($aircraft_array) == 0) print _("No data available");
93 93
 		    else {
94 94
 
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
                         var data = google.visualization.arrayToDataTable([
101 101
                             ["'._("Aircraft").'", "'._("# of times").'"], ';
102 102
                             $aircraft_data = '';
103
-                          foreach($aircraft_array as $aircraft_item)
103
+                          foreach ($aircraft_array as $aircraft_item)
104 104
                                     {
105 105
                                             $aircraft_data .= '[ "'.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],';
106 106
                                     }
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
                     <a href="<?php print $globalURL; ?>/statistics/aircraft" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
128 128
                 </div>
129 129
             </div>
130
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
130
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
131 131
 <?php
132 132
 //    echo $airline_icao;
133 133
     if ($airline_icao == '' || $airline_icao == 'all') {
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
             <div class="col-md-6">
136 136
                 <h2><?php echo _("Top 10 Most Common Airline"); ?></h2>
137 137
                  <?php
138
-                  $airline_array = $Stats->countAllAirlines(true,$filter_name);
138
+                  $airline_array = $Stats->countAllAirlines(true, $filter_name);
139 139
 		    if (count($airline_array) == 0) print _("No data available");
140 140
 		    else {
141 141
 
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
                         var data = google.visualization.arrayToDataTable([
148 148
                             ["'._("Airline").'", "'._("# of times").'"], ';
149 149
                             $airline_data = '';
150
-                          foreach($airline_array as $airline_item)
150
+                          foreach ($airline_array as $airline_item)
151 151
                                     {
152 152
                                             $airline_data .= '[ "'.$airline_item['airline_name'].' ('.$airline_item['airline_icao'].')",'.$airline_item['airline_count'].'],';
153 153
                                     }
@@ -175,14 +175,14 @@  discard block
 block discarded – undo
175 175
                 </div>
176 176
             </div>
177 177
         </div>
178
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
178
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
179 179
 <?php
180 180
     }
181 181
 ?>
182 182
         <div class="row column">
183 183
 
184 184
 	    <?php
185
-                 $flightover_array = $Stats->countAllFlightOverCountries($airline_icao,$filter_name);
185
+                 $flightover_array = $Stats->countAllFlightOverCountries($airline_icao, $filter_name);
186 186
 		if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) {
187 187
 		    if (empty($flightover_array)) {
188 188
 	    ?>
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
             ?>
197 197
                 <h2><?php echo _("Top 10 Most Common Pilots"); ?></h2>
198 198
                  <?php
199
-                  $pilot_array = $Stats->countAllPilots(true,$airline_icao,$filter_name);
199
+                  $pilot_array = $Stats->countAllPilots(true, $airline_icao, $filter_name);
200 200
 		    if (count($pilot_array) == 0) print _("No data available");
201 201
 		    else {
202 202
 
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
                         var data = google.visualization.arrayToDataTable([
209 209
                             ["'._("Pilots").'", "'._("# of times").'"], ';
210 210
                             $pilot_data = '';
211
-                          foreach($pilot_array as $pilot_item)
211
+                          foreach ($pilot_array as $pilot_item)
212 212
                                     {
213 213
                                             $pilot_data .= '[ "'.$pilot_item['pilot_name'].' ('.$pilot_item['pilot_id'].')",'.$pilot_item['pilot_count'].'],';
214 214
                                     }
@@ -236,14 +236,14 @@  discard block
 block discarded – undo
236 236
                 </div>
237 237
             </div>
238 238
         
239
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
239
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
240 240
         <?php
241 241
     	    } else {
242 242
     	?>
243 243
             <div class="col-md-6">
244 244
                 <h2><?php echo _("Top 10 Most Common Owners"); ?></h2>
245 245
                  <?php
246
-                  $owner_array = $Stats->countAllOwners(true,$airline_icao,$filter_name);
246
+                  $owner_array = $Stats->countAllOwners(true, $airline_icao, $filter_name);
247 247
 		    if (count($owner_array) == 0) print _("No data available");
248 248
 		    else {
249 249
 
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
                         var data = google.visualization.arrayToDataTable([
256 256
                             ["'._("Owner").'", "'._("# of times").'"], ';
257 257
                             $owner_data = '';
258
-                          foreach($owner_array as $owner_item)
258
+                          foreach ($owner_array as $owner_item)
259 259
                                     {
260 260
                                             $owner_data .= '[ "'.$owner_item['owner_name'].'",'.$owner_item['owner_count'].'],';
261 261
                                     }
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
                 </div>
284 284
             </div>
285 285
         
286
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
286
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
287 287
         <?php
288 288
     	    }
289 289
     	    if (!empty($flightover_array)) {
@@ -304,7 +304,7 @@  discard block
 block discarded – undo
304 304
                         var data = google.visualization.arrayToDataTable([
305 305
                             ["'._("Country").'", "'._("# of times").'"], ';
306 306
                             $flightover_data = '';
307
-                          foreach($flightover_array as $flightover_item)
307
+                          foreach ($flightover_array as $flightover_item)
308 308
                                     {
309 309
                                             $flightover_data .= '[ "'.$flightover_item['flight_country'].' ('.$flightover_item['flight_country_iso2'].')",'.$flightover_item['flight_count'].'],';
310 310
                                     }
@@ -337,7 +337,7 @@  discard block
 block discarded – undo
337 337
             }
338 338
         ?>
339 339
         </div>
340
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
340
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
341 341
 
342 342
     	
343 343
         </div>
@@ -345,7 +345,7 @@  discard block
 block discarded – undo
345 345
             <div class="col-md-6">
346 346
                 <h2><?php echo _("Top 10 Most Common Departure Airports"); ?></h2>
347 347
                 <?php
348
-                $airport_airport_array = $Stats->countAllDepartureAirports(true,$airline_icao,$filter_name);
348
+                $airport_airport_array = $Stats->countAllDepartureAirports(true, $airline_icao, $filter_name);
349 349
 		    if (count($airport_airport_array) == 0) print _("No data available");
350 350
 		    else {
351 351
 
@@ -361,7 +361,7 @@  discard block
 block discarded – undo
361 361
                 var data = google.visualization.arrayToDataTable([ 
362 362
                     ["'._("Airport").'", "'._("# of times").'"],';
363 363
                     $airport_data = '';
364
-                  foreach($airport_airport_array as $airport_item)
364
+                  foreach ($airport_airport_array as $airport_item)
365 365
                         {
366 366
                             $name = $airport_item['airport_departure_city'].', '.$airport_item['airport_departure_country'].' ('.$airport_item['airport_departure_icao'].')';
367 367
                             $name = str_replace("'", "", $name);
@@ -390,12 +390,12 @@  discard block
 block discarded – undo
390 390
                 <a href="<?php print $globalURL; ?>/statistics/airport-departure" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
391 391
               </div>
392 392
             </div>
393
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
393
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
394 394
 
395 395
             <div class="col-md-6">
396 396
                 <h2><?php echo _("Top 10 Most Common Arrival Airports"); ?></h2>
397 397
                 <?php
398
-                $airport_airport_array2 = $Stats->countAllArrivalAirports(true,$airline_icao,$filter_name);
398
+                $airport_airport_array2 = $Stats->countAllArrivalAirports(true, $airline_icao, $filter_name);
399 399
 		    if (count($airport_airport_array2) == 0) print _("No data available");
400 400
 		    else {
401 401
 
@@ -411,7 +411,7 @@  discard block
 block discarded – undo
411 411
                 var data = google.visualization.arrayToDataTable([ 
412 412
                     ["'._("Airport").'", "'._("# of times").'"],';
413 413
                     $airport_data2 = '';
414
-                  foreach($airport_airport_array2 as $airport_item2)
414
+                  foreach ($airport_airport_array2 as $airport_item2)
415 415
                         {
416 416
                             $name2 = $airport_item2['airport_arrival_city'].', '.$airport_item2['airport_arrival_country'].' ('.$airport_item2['airport_arrival_icao'].')';
417 417
                             $name2 = str_replace("'", "", $name2);
@@ -441,13 +441,13 @@  discard block
 block discarded – undo
441 441
               </div>
442 442
             </div>
443 443
         </div>
444
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
444
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
445 445
 
446 446
         <div class="row column">
447 447
             <div class="col-md-6">
448 448
                 <h2><?php echo _("Busiest Months of the last 12 Months"); ?></h2>
449 449
                 <?php
450
-                  $year_array = $Stats->countAllMonthsLastYear(true,$airline_icao,$filter_name);
450
+                  $year_array = $Stats->countAllMonthsLastYear(true, $airline_icao, $filter_name);
451 451
 		    if (count($year_array) == 0) print _("No data available");
452 452
 		    else {
453 453
                   print '<div id="chart8" class="chart" width="100%"></div>
@@ -458,9 +458,9 @@  discard block
 block discarded – undo
458 458
                         var data = google.visualization.arrayToDataTable([
459 459
                             ["'._("Month").'", "'._("# of Flights").'"], ';
460 460
                             $year_data = '';
461
-                          foreach($year_array as $year_item)
461
+                          foreach ($year_array as $year_item)
462 462
                                     {
463
-                                        $year_data .= '[ "'.date('F, Y',strtotime($year_item['year_name'].'-'.$year_item['month_name'].'-01')).'",'.$year_item['date_count'].'],';
463
+                                        $year_data .= '[ "'.date('F, Y', strtotime($year_item['year_name'].'-'.$year_item['month_name'].'-01')).'",'.$year_item['date_count'].'],';
464 464
                                     }
465 465
                                     $year_data = substr($year_data, 0, -1);
466 466
                                     print $year_data;
@@ -488,12 +488,12 @@  discard block
 block discarded – undo
488 488
                     <a href="<?php print $globalURL; ?>/statistics/year" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
489 489
                 </div>
490 490
             </div>
491
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
491
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
492 492
 
493 493
             <div class="col-md-6">
494 494
                 <h2><?php echo _("Busiest Day in the last Month"); ?></h2>
495 495
                 <?php
496
-                  $month_array = $Stats->countAllDatesLastMonth($airline_icao,$filter_name);
496
+                  $month_array = $Stats->countAllDatesLastMonth($airline_icao, $filter_name);
497 497
 		    if (count($month_array) == 0) print _("No data available");
498 498
 		    else {
499 499
                   print '<div id="chart9" class="chart" width="100%"></div>
@@ -504,9 +504,9 @@  discard block
 block discarded – undo
504 504
                         var data = google.visualization.arrayToDataTable([
505 505
                             ["'._("Day").'", "'._("# of Flights").'"], ';
506 506
                             $month_data = '';
507
-                          foreach($month_array as $month_item)
507
+                          foreach ($month_array as $month_item)
508 508
                                     {
509
-                                        $month_data .= '[ "'.date('F j, Y',strtotime($month_item['date_name'])).'",'.$month_item['date_count'].'],';
509
+                                        $month_data .= '[ "'.date('F j, Y', strtotime($month_item['date_name'])).'",'.$month_item['date_count'].'],';
510 510
                                     }
511 511
                                     $month_data = substr($month_data, 0, -1);
512 512
                                     print $month_data;
@@ -534,12 +534,12 @@  discard block
 block discarded – undo
534 534
                     <a href="<?php print $globalURL; ?>/statistics/month" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
535 535
                 </div>
536 536
             </div>
537
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
537
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
538 538
 
539 539
             <div class="col-md-6">
540 540
                 <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2>
541 541
                 <?php
542
-                    $date_array = $Stats->countAllDatesLast7Days($airline_icao,$filter_name);
542
+                    $date_array = $Stats->countAllDatesLast7Days($airline_icao, $filter_name);
543 543
 		    if (empty($date_array)) print _("No data available");
544 544
 		    else {
545 545
                   print '<div id="chart5" class="chart" width="100%"></div>
@@ -551,7 +551,7 @@  discard block
 block discarded – undo
551 551
                             ["'._("Date").'", "'._("# of Flights").'"], ';
552 552
                             $date_data = '';
553 553
                         
554
-                          foreach($date_array as $date_item)
554
+                          foreach ($date_array as $date_item)
555 555
                                     {
556 556
                                         $date_data .= '[ "'.date("F j, Y", strtotime($date_item['date_name'])).'",'.$date_item['date_count'].'],';
557 557
                                     }
@@ -581,12 +581,12 @@  discard block
 block discarded – undo
581 581
                     <a href="<?php print $globalURL; ?>/statistics/date" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
582 582
                 </div>
583 583
             </div>
584
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
584
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
585 585
 
586 586
             <div class="col-md-6">
587 587
                 <h2><?php echo _("Busiest Time of the Day"); ?></h2>
588 588
                 <?php
589
-                  $hour_array = $Stats->countAllHours('hour',true,$airline_icao,$filter_name);
589
+                  $hour_array = $Stats->countAllHours('hour', true, $airline_icao, $filter_name);
590 590
 		    if (empty($hour_array)) print _("No data available");
591 591
 		    else {
592 592
 
@@ -598,7 +598,7 @@  discard block
 block discarded – undo
598 598
                         var data = google.visualization.arrayToDataTable([
599 599
                             ["'._("Hour").'", "'._("# of Flights").'"], ';
600 600
                             $hour_data = '';
601
-                          foreach($hour_array as $hour_item)
601
+                          foreach ($hour_array as $hour_item)
602 602
                                     {
603 603
                                         $hour_data .= '[ "'.$hour_item['hour_name'].':00",'.$hour_item['hour_count'].'],';
604 604
                                     }
@@ -628,21 +628,21 @@  discard block
 block discarded – undo
628 628
                     <a href="<?php print $globalURL; ?>/statistics/time" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
629 629
                 </div>
630 630
             </div>
631
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
631
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
632 632
         </div>
633 633
 <?php
634 634
     if ($airline_icao == '' && $filter_name == '') {
635 635
 ?>
636 636
         <div class="row column">
637 637
         	<?php
638
-        	    $polar = $Stats->getStatsSource(date('Y-m-d'),'polar');
638
+        	    $polar = $Stats->getStatsSource(date('Y-m-d'), 'polar');
639 639
         	    if (!empty($polar)) {
640 640
             		print '<h2>'._("Coverage pattern").'</h2>';
641 641
         		foreach ($polar as $eachpolar) {
642 642
         		    unset($polar_data);
643 643
 	        	    $Spotter = new Spotter();
644 644
         		    $data = json_decode($eachpolar['source_data']);
645
-        		    foreach($data as $value => $key) {
645
+        		    foreach ($data as $value => $key) {
646 646
         			$direction = $Spotter->parseDirection(($value*22.5));
647 647
         			$distance = $key;
648 648
         			$unit = 'km';
@@ -662,7 +662,7 @@  discard block
 block discarded – undo
662 662
         	?>
663 663
             <div class="col-md-6">
664 664
                 <h4><?php print $eachpolar['source_name']; ?></h4>
665
-        	<div id="polar-<?php print str_replace(' ','_',strtolower($eachpolar['source_name'])); ?>" class="chart" width="100%"></div>
665
+        	<div id="polar-<?php print str_replace(' ', '_', strtolower($eachpolar['source_name'])); ?>" class="chart" width="100%"></div>
666 666
         	<script>
667 667
         	    (function() {
668 668
         	    var margin = {top: 100, right: 100, bottom: 100, left: 100},
@@ -686,7 +686,7 @@  discard block
 block discarded – undo
686 686
 		      color: color,
687 687
 		      unit: '<?php echo $unit; ?>'
688 688
 		    };
689
-		    RadarChart("#polar-<?php print str_replace(' ','_',strtolower($eachpolar['source_name'])); ?>", data, radarChartOptions);
689
+		    RadarChart("#polar-<?php print str_replace(' ', '_', strtolower($eachpolar['source_name'])); ?>", data, radarChartOptions);
690 690
 		    })();
691 691
 		</script>
692 692
             </div>
@@ -698,19 +698,19 @@  discard block
 block discarded – undo
698 698
         <div class="row column">
699 699
             <div class="col-md-6">
700 700
         	<?php
701
-        	    $msg = $Stats->getStatsSource(date('Y-m-d'),'msg');
701
+        	    $msg = $Stats->getStatsSource(date('Y-m-d'), 'msg');
702 702
         	    if (!empty($msg)) {
703 703
             		print '<h2>'._("Messages received").'</h2>';
704 704
         		foreach ($msg as $eachmsg) {
705 705
         		    //$eachmsg = $msg[0];
706 706
         		    $data = $eachmsg['source_data'];
707
-        		    if ($data > 500) $max = (round(($data+100)/100))*100;
707
+        		    if ($data > 500) $max = (round(($data + 100)/100))*100;
708 708
         		    else $max = 500;
709 709
         	?>
710
-        	<div id="msg-<?php print str_replace(' ','_',strtolower($eachmsg['source_name'])); ?>" class="col-md-4"></div>
710
+        	<div id="msg-<?php print str_replace(' ', '_', strtolower($eachmsg['source_name'])); ?>" class="col-md-4"></div>
711 711
         	<script>
712 712
 		      var g = new JustGage({
713
-			    id: "msg-<?php print str_replace(' ','_',strtolower($eachmsg['source_name'])); ?>",
713
+			    id: "msg-<?php print str_replace(' ', '_', strtolower($eachmsg['source_name'])); ?>",
714 714
 			    value: <?php echo $data; ?>,
715 715
 			    min: 0,
716 716
 			    max: <?php print $max; ?>,
@@ -730,12 +730,12 @@  discard block
 block discarded – undo
730 730
         <div class="row column">
731 731
 
732 732
             <?php
733
-		$hist = $Stats->getStatsSource(date('Y-m-d'),'hist');
733
+		$hist = $Stats->getStatsSource(date('Y-m-d'), 'hist');
734 734
 		foreach ($hist as $hists) {
735 735
 			$hist_data = '';
736 736
 			$source = $hists['source_name'];
737 737
 			$hist_array = json_decode($hists['source_data']);
738
-			foreach($hist_array as $distance => $nb)
738
+			foreach ($hist_array as $distance => $nb)
739 739
 			{
740 740
 				$unit = 'km';
741 741
 				if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) {
@@ -753,13 +753,13 @@  discard block
 block discarded – undo
753 753
 			$hist_data = substr($hist_data, 0, -1);
754 754
             ?>
755 755
             <div class="col-md-6">
756
-                <h2><?php echo sprintf(_("Flights Distance for %s"),$source); ?></h2>
756
+                <h2><?php echo sprintf(_("Flights Distance for %s"), $source); ?></h2>
757 757
                 <?php
758
-                  print '<div id="charthist-'.str_replace(' ','_',strtolower($source)).'" class="chart" width="100%"></div>
758
+                  print '<div id="charthist-'.str_replace(' ', '_', strtolower($source)).'" class="chart" width="100%"></div>
759 759
                     <script> 
760 760
                         google.load("visualization", "1", {packages:["corechart"]});
761
-                      google.setOnLoadCallback(drawCharthist_'.str_replace(' ','_',strtolower($source)).');
762
-                      function drawCharthist_'.str_replace(' ','_',strtolower($source)).'() {
761
+                      google.setOnLoadCallback(drawCharthist_'.str_replace(' ', '_', strtolower($source)).');
762
+                      function drawCharthist_'.str_replace(' ', '_', strtolower($source)).'() {
763 763
                         var data = google.visualization.arrayToDataTable([
764 764
                             ["'._("Distance").'", "'._("# of Flights").'"], ';
765 765
                             print $hist_data;
@@ -774,16 +774,16 @@  discard block
 block discarded – undo
774 774
                             colors: ["#1a3151"]
775 775
                         };
776 776
 
777
-                        var chart = new google.visualization.AreaChart(document.getElementById("charthist-'.str_replace(' ','_',strtolower($source)).'"));
777
+                        var chart = new google.visualization.AreaChart(document.getElementById("charthist-'.str_replace(' ', '_', strtolower($source)).'"));
778 778
                         chart.draw(data, options);
779 779
                       }
780 780
                       $(window).resize(function(){
781
-                              drawCharthist_'.str_replace(' ','_',strtolower($source)).'();
781
+                              drawCharthist_'.str_replace(' ', '_', strtolower($source)).'();
782 782
                             });
783 783
                   </script>';
784 784
         	?>
785 785
     	    </div>
786
-	    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
786
+	    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
787 787
         	<?php
788 788
                   }
789 789
                 ?>
Please login to merge, or discard this patch.
statistics-airline-country.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 	  </div>
15 15
       <p>'._("Below are the <strong>Top 10</strong> countries that an airline belongs to.").'</p>';
16 16
 
17
-$airline_array = $Stats->countAllAirlineCountries(true,$filter_name);
17
+$airline_array = $Stats->countAllAirlineCountries(true, $filter_name);
18 18
 if (count($airline_array) > 0) {
19 19
 print '<div id="chartCountry" class="chart" width="100%"></div>
20 20
       	<script> 
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
             var data = google.visualization.arrayToDataTable([
25 25
             	["'._("Country").'", "'._("# of times").'"], ';
26 26
 $country_data = '';
27
-foreach($airline_array as $airline_item)
27
+foreach ($airline_array as $airline_item)
28 28
 {
29 29
 	$country_data .= '[ "'.$airline_item['airline_country'].'",'.$airline_item['airline_country_count'].'],';
30 30
 }
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 	print '</thead>';
59 59
 	print '<tbody>';
60 60
 	$i = 1;
61
-	foreach($airline_array as $airline_item)
61
+	foreach ($airline_array as $airline_item)
62 62
 	{
63 63
 		print '<tr>';
64 64
 		print '<td><strong>'.$i.'</strong></td>';
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -5,7 +5,9 @@
 block discarded – undo
5 5
 $Spotter = new Spotter();
6 6
 $title = _("Statistics").' - '._("Most common Route by Airport");
7 7
 require_once('header.php');
8
-if (!isset($filter_name)) $filter_name = '';
8
+if (!isset($filter_name)) {
9
+	$filter_name = '';
10
+}
9 11
 include('statistics-sub-menu.php'); 
10 12
 
11 13
 print '<script type="text/javascript" src="https://www.google.com/jsapi"></script>
Please login to merge, or discard this patch.
index.php 3 patches
Indentation   +72 added lines, -72 removed lines patch added patch discarded remove patch
@@ -36,12 +36,12 @@  discard block
 block discarded – undo
36 36
 <div id="showdetails" class="showdetails"></div>
37 37
 <div id="infobox" class="infobox"><h4><?php echo _("Aircrafts detected"); ?></h4><br /><i class="fa fa-spinner fa-pulse fa-fw"></i></div>
38 38
 <?php
39
-    if ((!isset($_COOKIE['MapFormat']) && isset($globalMap3Ddefault) && $globalMap3Ddefault) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d')) {
39
+	if ((!isset($_COOKIE['MapFormat']) && isset($globalMap3Ddefault) && $globalMap3Ddefault) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d')) {
40 40
 
41 41
 ?>
42 42
 <script src="<?php echo $globalURL; ?>/js/map.3d.js.php"></script>
43 43
 <?php
44
-    }
44
+	}
45 45
 ?>
46 46
 <div id="dialog" title="<?php echo _("Session has timed-out"); ?>">
47 47
   <p><?php echo _("In order to save data consumption web page times out after 30 minutes. Close this dialog to continue."); ?></p>
@@ -55,34 +55,34 @@  discard block
 block discarded – undo
55 55
 	<li><a href="#" onclick="getUserLocation(); return false;" title="<?php echo _("Plot your Location"); ?>"><i class="fa fa-map-marker"></i></a></li>
56 56
 	<li><a href="#" onclick="getCompassDirection(); return false;" title="<?php echo _("Compass Mode"); ?>"><i class="fa fa-compass"></i></a></li>
57 57
 <?php
58
-    if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
58
+	if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
59 59
 	if (isset($globalArchive) && $globalArchive == TRUE) {
60 60
 ?>
61 61
 	<li><a href="#archive" role="tab" title="<?php echo _("Archive"); ?>"><i class="fa fa-archive"></i></a></li>
62 62
 <?php
63 63
 	}
64
-    }
64
+	}
65 65
 ?>
66 66
 	<li><a href="#home" role="tab" title="<?php echo _("Layers"); ?>"><i class="fa fa-map"></i></a></li>
67 67
 	<li><a href="#filters" role="tab" title="<?php echo _("Filters"); ?>"><i class="fa fa-filter"></i></a></li>
68 68
 	<li><a href="#settings" role="tab" title="<?php echo _("Settings"); ?>"><i class="fa fa-gears"></i></a></li>
69 69
 <?php
70
-    if (isset($globalMap3D) && $globalMap3D) {
70
+	if (isset($globalMap3D) && $globalMap3D) {
71 71
 	if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) {
72 72
 ?>
73 73
 	<li><a href="#" onclick="show3D(); return false;" role="tab" title="3D"><b>3D</b></a></li>
74 74
 <?php
75
-        } else {
76
-    	    if (isset($globalMapSatellites) && $globalMapSatellites) {
75
+		} else {
76
+			if (isset($globalMapSatellites) && $globalMapSatellites) {
77 77
 ?>
78 78
 	<li><a href="#satellites" role="tab" title="<?php echo _("Satellites"); ?>"><i class="satellite"></i></a></li>
79 79
 <?php
80
-	    }
80
+		}
81 81
 ?>
82 82
 	<li><a href="#" onclick="show2D(); return false;" role="tab" title="2D"><b>2D</b></a></li>
83 83
 <?php
84 84
 	}
85
-    }
85
+	}
86 86
 ?>
87 87
     </ul>
88 88
 
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
 ?>
157 157
         </div>
158 158
 <?php
159
-    if (isset($globalArchive) && $globalArchive == TRUE) {
159
+	if (isset($globalArchive) && $globalArchive == TRUE) {
160 160
 ?>
161 161
         <div class="sidebar-pane" id="archive">
162 162
 	    <h1 class="sidebar-header"><?php echo _("Playback"); ?> <i>Bêta</i><span class="sidebar-close"><i class="fa fa-caret-left"></i></span></h1>
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
 	    </form>
217 217
 	</div>
218 218
 <?php
219
-    }
219
+	}
220 220
 ?>
221 221
         <div class="sidebar-pane" id="settings">
222 222
 	    <h1 class="sidebar-header"><?php echo _("Settings"); ?><span class="sidebar-close"><i class="fa fa-caret-left"></i></span></h1>
@@ -227,56 +227,56 @@  discard block
 block discarded – undo
227 227
 			    <?php
228 228
 				if (!isset($_COOKIE['MapType']) || $_COOKIE['MapType'] == '') $MapType = $globalMapProvider;
229 229
 				else $MapType = $_COOKIE['MapType'];
230
-			    ?>
230
+				?>
231 231
 			    <?php
232 232
 				if (isset($globalBingMapKey) && $globalBingMapKey != '') {
233
-			    ?>
233
+				?>
234 234
 			    <option value="Bing-Aerial"<?php if ($MapType == 'Bing-Aerial') print ' selected'; ?>>Bing-Aerial</option>
235 235
 			    <option value="Bing-Hybrid"<?php if ($MapType == 'Bing-Hybrid') print ' selected'; ?>>Bing-Hybrid</option>
236 236
 			    <option value="Bing-Road"<?php if ($MapType == 'Bing-Road') print ' selected'; ?>>Bing-Road</option>
237 237
 			    <?php
238 238
 				}
239
-			    ?>
239
+				?>
240 240
 			    <?php
241
-			        if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) {
242
-			    ?>
241
+					if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) {
242
+				?>
243 243
 			    <?php
244
-				    if (isset($globalHereappId) && $globalHereappId != '' && isset($globalHereappCode) && $globalHereappCode != '') {
245
-			    ?>
244
+					if (isset($globalHereappId) && $globalHereappId != '' && isset($globalHereappCode) && $globalHereappCode != '') {
245
+				?>
246 246
 			    <option value="Here-Aerial"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Aerial</option>
247 247
 			    <option value="Here-Hybrid"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Hybrid</option>
248 248
 			    <option value="Here-Road"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Road</option>
249 249
 			    <?php
250
-				    }
251
-			    ?>
250
+					}
251
+				?>
252 252
 			    <?php
253
-				    if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '') {
254
-			    ?>
253
+					if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '') {
254
+				?>
255 255
 			    <option value="Google-Roadmap"<?php if ($MapType == 'Google-Roadmap') print ' selected'; ?>>Google Roadmap</option>
256 256
 			    <option value="Google-Satellite"<?php if ($MapType == 'Google-Satellite') print ' selected'; ?>>Google Satellite</option>
257 257
 			    <option value="Google-Hybrid"<?php if ($MapType == 'Google-Hybrid') print ' selected'; ?>>Google Hybrid</option>
258 258
 			    <option value="Google-Terrain"<?php if ($MapType == 'Google-Terrain') print ' selected'; ?>>Google Terrain</option>
259 259
 			    <?php
260
-				    }
261
-			    ?>
260
+					}
261
+				?>
262 262
 			    <?php
263
-				    if (isset($globalMapQuestKey) && $globalMapQuestKey != '') {
264
-			    ?>
263
+					if (isset($globalMapQuestKey) && $globalMapQuestKey != '') {
264
+				?>
265 265
 			    <option value="MapQuest-OSM"<?php if ($MapType == 'MapQuest-OSM') print ' selected'; ?>>MapQuest-OSM</option>
266 266
 			    <option value="MapQuest-Aerial"<?php if ($MapType == 'MapQuest-Aerial') print ' selected'; ?>>MapQuest-Aerial</option>
267 267
 			    <option value="MapQuest-Hybrid"<?php if ($MapType == 'MapQuest-Hybrid') print ' selected'; ?>>MapQuest-Hybrid</option>
268 268
 			    <?php
269
-				    }
270
-			    ?>
269
+					}
270
+				?>
271 271
 			    <option value="Yandex"<?php if ($MapType == 'Yandex') print ' selected'; ?>>Yandex</option>
272 272
 			    <?php
273 273
 				}
274
-			    ?>
274
+				?>
275 275
 			    <?php
276
-				    if (isset($globalMapboxToken) && $globalMapboxToken != '') {
276
+					if (isset($globalMapboxToken) && $globalMapboxToken != '') {
277 277
 					if (!isset($_COOKIE['MapTypeId'])) $MapBoxId = 'default';
278 278
 					else $MapBoxId = $_COOKIE['MapTypeId'];
279
-			    ?>
279
+				?>
280 280
 			    <option value="Mapbox-default"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'default') print ' selected'; ?>>Mapbox default</option>
281 281
 			    <option value="Mapbox-mapbox.streets"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets') print ' selected'; ?>>Mapbox streets</option>
282 282
 			    <option value="Mapbox-mapbox.light"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.light') print ' selected'; ?>>Mapbox light</option>
@@ -290,13 +290,13 @@  discard block
 block discarded – undo
290 290
 			    <option value="Mapbox-mapbox.pirates"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pirates') print ' selected'; ?>>Mapbox pirates</option>
291 291
 			    <option value="Mapbox-mapbox.emerald"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.emerald') print ' selected'; ?>>Mapbox emerald</option>
292 292
 			    <?php
293
-				    }
294
-			    ?>
293
+					}
294
+				?>
295 295
 			    <option value="OpenStreetMap"<?php if ($MapType == 'OpenStreetMap') print ' selected'; ?>>OpenStreetMap</option>
296 296
 			</select>
297 297
 		    </li>
298 298
 <?php
299
-    if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
299
+	if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
300 300
 ?>
301 301
 		    <li><?php echo _("Type of Terrain:"); ?>
302 302
 			<select  class="selectpicker" onchange="terrainType(this);">
@@ -306,10 +306,10 @@  discard block
 block discarded – undo
306 306
 			</select>
307 307
 		    </li>
308 308
 <?php
309
-    }
309
+	}
310 310
 ?>
311 311
 <?php
312
-    if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') {
312
+	if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') {
313 313
 ?>
314 314
 		    
315 315
 		    <li><div class="checkbox"><label><input type="checkbox" name="flightpopup" value="1" onclick="clickFlightPopup(this)" <?php if (isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true') print 'checked'; ?> ><?php echo _("Display flight info as popup"); ?></label></div></li>
@@ -317,54 +317,54 @@  discard block
 block discarded – undo
317 317
 		    <li><div class="checkbox"><label><input type="checkbox" name="flightroute" value="1" onclick="clickFlightRoute(this)" <?php if ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == 'true') || !isset($_COOKIE['MapRoute'])) print 'checked'; ?> ><?php echo _("Display flight route on click"); ?></label></div></li>
318 318
 		    <li><div class="checkbox"><label><input type="checkbox" name="flightestimation" value="1" onclick="clickFlightEstimation(this)" <?php if ((isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'true') || (!isset($_COOKIE['flightestimation']) && !isset($globalMapEstimation)) || (!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation)) print 'checked'; ?> ><?php echo _("Planes animate between updates"); ?></label></div></li>
319 319
 <?php
320
-    }
320
+	}
321 321
 ?>
322 322
 		    <li><div class="checkbox"><label><input type="checkbox" name="displayairports" value="1" onclick="clickDisplayAirports(this)" <?php if (isset($_COOKIE['displayairports']) && $_COOKIE['displayairports'] == 'true') print 'checked'; ?> ><?php echo _("Display airports on map"); ?></label></div></li>
323 323
 <?php
324
-    if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
324
+	if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
325 325
 ?>
326 326
 		    <li><div class="checkbox"><label><input type="checkbox" name="displayminimap" value="1" onclick="clickDisplayMinimap(this)" <?php if (!isset($_COOKIE['displayminimap']) || (isset($_COOKIE['displayminimap']) && $_COOKIE['displayminimap'] == 'true')) print 'checked'; ?> ><?php echo _("Show mini-map"); ?></label></div></li>
327 327
 <?php
328
-    }
328
+	}
329 329
 ?>
330 330
 
331 331
 		    <?php
332 332
 			if (function_exists('array_column')) {
333
-			    if (array_search(TRUE, array_column($globalSources, 'sourcestats')) !== FALSE) {
334
-		    ?>
333
+				if (array_search(TRUE, array_column($globalSources, 'sourcestats')) !== FALSE) {
334
+			?>
335 335
 		    <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) print 'checked'; ?> ><?php echo _("Display polar on map"); ?></label></div></li>
336 336
 		    <?php
337
-			    }
337
+				}
338 338
 			} elseif (isset($globalSources)) {
339
-			    $dispolar = false;
340
-			    foreach ($globalSources as $testsource) {
341
-			        if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) $dispolar = true;
342
-			    }
343
-			    if ($dispolar) {
344
-		    ?>
339
+				$dispolar = false;
340
+				foreach ($globalSources as $testsource) {
341
+					if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) $dispolar = true;
342
+				}
343
+				if ($dispolar) {
344
+			?>
345 345
 		    <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) print 'checked'; ?> ><?php echo _("Display polar on map"); ?></label></div></li>
346 346
 		    <?php
347
-			    }
348
-		        }
349
-		    ?>
347
+				}
348
+				}
349
+			?>
350 350
 <?php
351
-    if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') {
351
+	if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') {
352 352
 ?>
353 353
 
354 354
 		    <?php
355
-		        if (extension_loaded('gd') && function_exists('gd_info')) {
356
-		    ?>
355
+				if (extension_loaded('gd') && function_exists('gd_info')) {
356
+			?>
357 357
 		    <li><input type="checkbox" name="aircraftcoloraltitude" value="1" onclick="iconColorAltitude(this)" <?php if (isset($_COOKIE['IconColorAltitude']) && $_COOKIE['IconColorAltitude'] == 'true') print 'checked'; ?> ><?php echo _("Aircraft icon color based on altitude"); ?></li>
358 358
 		    <?php 
359 359
 			if (!isset($_COOKIE['IconColorAltitude']) || $_COOKIE['IconColorAltitude'] == 'false') {
360
-		    ?>
360
+			?>
361 361
 		    <li><?php echo _("Aircraft icon color:"); ?>
362 362
 			<input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(aircraftcolor.value);" value="#<?php if (isset($_COOKIE['IconColor'])) print $_COOKIE['IconColor']; elseif (isset($globalAircraftIconColor)) print $globalAircraftIconColor; else print '1a3151'; ?>">
363 363
 		    </li>
364 364
 		    <?php
365
-			    }
366
-		        }
367
-		    ?>
365
+				}
366
+				}
367
+			?>
368 368
 		    <li><?php echo _("Show airport icon at zoom level:"); ?>
369 369
 			<div class="range">
370 370
 			    <input type="range" min="0" max="19" step="1" name="airportzoom" onchange="range.value=value;airportDisplayZoom(airportzoom.value);" value="<?php if (isset($_COOKIE['AirportZoom'])) print $_COOKIE['AirportZoom']; elseif (isset($globalAirportZoom)) print $globalAirportZoom; else print '7'; ?>">
@@ -372,7 +372,7 @@  discard block
 block discarded – undo
372 372
 			</div>
373 373
 		    </li>
374 374
 <?php
375
-    }
375
+	}
376 376
 ?>
377 377
 		    <li><?php echo _("Distance unit:"); ?>
378 378
 			<select class="selectpicker" onchange="unitdistance(this);">
@@ -405,16 +405,16 @@  discard block
 block discarded – undo
405 405
 		    <ul>
406 406
 		    <?php
407 407
 			if (((isset($globalVATSIM) && $globalVATSIM) || isset($globalIVAO) && $globalIVAO || isset($globalphpVMS) && $globalphpVMS) && (!isset($globalMapVAchoose) || $globalMapVAchoose)) {
408
-		    ?>
408
+			?>
409 409
 			<?php if (isset($globalVATSIM) && $globalVATSIM) { ?><li><input type="checkbox" name="vatsim" value="1" onclick="clickVATSIM(this)" <?php if ((isset($_COOKIE['ShowVATSIM']) && $_COOKIE['ShowVATSIM'] == 'true') || !isset($_COOKIE['ShowVATSIM'])) print 'checked'; ?> ><?php echo _("Display VATSIM data"); ?></li><?php } ?>
410 410
 			<?php if (isset($globalIVAO) && $globalIVAO) { ?><li><input type="checkbox" name="ivao" value="1" onclick="clickIVAO(this)" <?php if ((isset($_COOKIE['ShowIVAO']) && $_COOKIE['ShowIVAO'] == 'true') || !isset($_COOKIE['ShowIVAO'])) print 'checked'; ?> ><?php echo _("Display IVAO data"); ?></li><?php } ?>
411 411
 			<?php if (isset($globalphpVMS) && $globalphpVMS) { ?><li><input type="checkbox" name="phpvms" value="1" onclick="clickphpVMS(this)" <?php if ((isset($_COOKIE['ShowVMS']) && $_COOKIE['ShowVMS'] == 'true') || !isset($_COOKIE['ShowVMS'])) print 'checked'; ?> ><?php echo _("Display phpVMS data"); ?></li><?php } ?>
412 412
 		    <?php
413 413
 			}
414
-		    ?>
414
+			?>
415 415
 		    <?php
416 416
 			if (!(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalphpVMS) && $globalphpVMS) && isset($globalSBS1) && $globalSBS1 && isset($globalAPRS) && $globalAPRS && (!isset($globalMapchoose) || $globalMapchoose)) {
417
-		    ?>
417
+			?>
418 418
 			<?php if (isset($globalSBS1) && $globalSBS1) { ?>
419 419
 			    <li><div class="checkbox"><label><input type="checkbox" name="sbs" value="1" onclick="clickSBS1(this)" <?php if ((isset($_COOKIE['ShowSBS1']) && $_COOKIE['ShowSBS1'] == 'true') || !isset($_COOKIE['ShowSBS1'])) print 'checked'; ?> ><?php echo _("Display ADS-B data"); ?></label></div></li>
420 420
 			<?php } ?>
@@ -423,7 +423,7 @@  discard block
 block discarded – undo
423 423
 			<?php } ?>
424 424
 		    <?php
425 425
 			}
426
-		    ?>
426
+			?>
427 427
 		    <li><?php echo _("Display airlines:"); ?>
428 428
 		    <br/>
429 429
 			<select class="selectpicker" multiple onchange="airlines(this);" id="display_airlines">
@@ -438,12 +438,12 @@  discard block
 block discarded – undo
438 438
 						echo '<option value="'.$airline['airline_icao'].'">'.$airline_name.'</option>';
439 439
 					}
440 440
 				}
441
-			    ?>
441
+				?>
442 442
 			</select>
443 443
 		    </li>
444 444
 		    <?php
445 445
 			if (isset($globalAPRS) && $globalAPRS) {
446
-		    ?>
446
+			?>
447 447
 		    <li><?php echo _("Display APRS sources name:"); ?>
448 448
 			<select class="selectpicker" multiple onchange="sources(this);">
449 449
 			    <?php
@@ -455,15 +455,15 @@  discard block
 block discarded – undo
455 455
 						echo '<option value="'.$source['source_name'].'">'.$source['source_name'].'</option>';
456 456
 					}
457 457
 				}
458
-			    ?>
458
+				?>
459 459
 			</select>
460 460
 		    </li>
461 461
 		    <?php
462 462
 			}
463
-		    ?>
463
+			?>
464 464
 		    <?php
465 465
 			if (!(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalphpVMS) && $globalphpVMS)) {
466
-		    ?>
466
+			?>
467 467
 		    <li><?php echo _("Display airlines of type:"); ?><br/>
468 468
 			<select class="selectpicker" onchange="airlinestype(this);">
469 469
 			    <option value="all"<?php if (!isset($_COOKIE['airlinestype']) || $_COOKIE['airlinestype'] == 'all' || $_COOKIE['airlinestype'] == '') echo ' selected'; ?>><?php echo _("All"); ?></option>
@@ -474,7 +474,7 @@  discard block
 block discarded – undo
474 474
 		    </li>
475 475
 		    <?php
476 476
 			}
477
-		    ?>
477
+			?>
478 478
 		    <li>
479 479
 			<?php echo _("Display flight with ident:"); ?>
480 480
 			<input type="text" name="identfilter" id="identfilter" value="<?php if (isset($_COOKIE['identfilter'])) print $_COOKIE['identfilter']; ?>" />
@@ -487,7 +487,7 @@  discard block
 block discarded – undo
487 487
 	    </form>
488 488
     	</div>
489 489
 <?php
490
-    if (isset($globalMapSatellites) && $globalMapSatellites && isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
490
+	if (isset($globalMapSatellites) && $globalMapSatellites && isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
491 491
 ?>
492 492
         <div class="sidebar-pane" id="satellites">
493 493
 	    <h1 class="sidebar-header"><?php echo _("Satellites"); ?><span class="sidebar-close"><i class="fa fa-caret-left"></i></span></h1>
@@ -527,14 +527,14 @@  discard block
 block discarded – undo
527 527
 						print '<option value="'.$type['tle_type'].'">'.$type_name.'</option>';
528 528
 					}
529 529
 				}
530
-			    ?>
530
+				?>
531 531
 			</select>
532 532
 		    </li>
533 533
 		</ul>
534 534
 	    </form>
535 535
 	</div>
536 536
 <?php
537
-    }
537
+	}
538 538
 ?>
539 539
     </div>
540 540
 </div>
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
4 4
 require_once('require/class.Language.php');
5 5
 require_once('require/class.Satellite.php');
6 6
 
7
-$trackident = filter_input(INPUT_GET,'trackid',FILTER_SANITIZE_STRING);
7
+$trackident = filter_input(INPUT_GET, 'trackid', FILTER_SANITIZE_STRING);
8 8
 if ($trackident != '') {
9 9
 	require_once('require/class.SpotterLive.php');
10 10
 	$SpotterLive = new SpotterLive();
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 		$spotterid = $Spotter->getSpotterIDBasedOnFlightAwareID($trackident);
15 15
 		header('Location: '.$globalURL.'/flightid/'.$spotterid);
16 16
 	} else {
17
-		setcookie('MapTrack',$resulttrackident[0]['flightaware_id']);
17
+		setcookie('MapTrack', $resulttrackident[0]['flightaware_id']);
18 18
 	}
19 19
 } else {
20 20
 	unset($_COOKIE['MapTrack']);
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
 		        <div class="form-group">
168 168
 			    <label>From (UTC):</label>
169 169
 		            <div class='input-group date' id='datetimepicker1'>
170
-            			<input type='text' name="start_date" class="form-control" value="<?php if (isset($_POST['start_date'])) print $_POST['start_date']; elseif (isset($_COOKIE['archive_begin'])) print date("m/d/Y h:i a",$_COOKIE['archive_begin']); ?>" required />
170
+            			<input type='text' name="start_date" class="form-control" value="<?php if (isset($_POST['start_date'])) print $_POST['start_date']; elseif (isset($_COOKIE['archive_begin'])) print date("m/d/Y h:i a", $_COOKIE['archive_begin']); ?>" required />
171 171
 		                <span class="input-group-addon">
172 172
             			    <span class="glyphicon glyphicon-calendar"></span>
173 173
 		                </span>
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
 		        <div class="form-group">
177 177
 			    <label>To (UTC):</label>
178 178
 		            <div class='input-group date' id='datetimepicker2'>
179
-		                <input type='text' name="end_date" class="form-control" value="<?php if (isset($_POST['end_date'])) print $_POST['end_date']; elseif (isset($_COOKIE['archive_end'])) print date("m/d/Y h:i a",$_COOKIE['archive_end']); ?>" />
179
+		                <input type='text' name="end_date" class="form-control" value="<?php if (isset($_POST['end_date'])) print $_POST['end_date']; elseif (isset($_COOKIE['archive_end'])) print date("m/d/Y h:i a", $_COOKIE['archive_end']); ?>" />
180 180
             			<span class="input-group-addon">
181 181
 		                    <span class="glyphicon glyphicon-calendar"></span>
182 182
             			</span>
@@ -301,8 +301,8 @@  discard block
 block discarded – undo
301 301
 		    <li><?php echo _("Type of Terrain:"); ?>
302 302
 			<select  class="selectpicker" onchange="terrainType(this);">
303 303
 			    <option value="stk"<?php if (!isset($_COOKIE['MapTerrain']) || $_COOKIE['MapTerrain'] == 'stk') print ' selected'; ?>>stk terrain</option>
304
-			    <option value="ellipsoid"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'ellipsoid') print ' selected';?>>ellipsoid</option>
305
-			    <option value="vrterrain"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'vrterrain') print ' selected';?>>vr terrain</option>
304
+			    <option value="ellipsoid"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'ellipsoid') print ' selected'; ?>>ellipsoid</option>
305
+			    <option value="vrterrain"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'vrterrain') print ' selected'; ?>>vr terrain</option>
306 306
 			</select>
307 307
 		    </li>
308 308
 <?php
@@ -429,10 +429,10 @@  discard block
 block discarded – undo
429 429
 			<select class="selectpicker" multiple onchange="airlines(this);" id="display_airlines">
430 430
 			    <?php
431 431
 				$Spotter = new Spotter();
432
-				foreach($Spotter->getAllAirlineNames() as $airline) {
432
+				foreach ($Spotter->getAllAirlineNames() as $airline) {
433 433
 					$airline_name = $airline['airline_name'];
434
-					if (strlen($airline_name) > 30) $airline_name = substr($airline_name,0,30).'...';
435
-					if (isset($_COOKIE['Airlines']) && in_array($airline['airline_icao'],explode(',',$_COOKIE['Airlines']))) {
434
+					if (strlen($airline_name) > 30) $airline_name = substr($airline_name, 0, 30).'...';
435
+					if (isset($_COOKIE['Airlines']) && in_array($airline['airline_icao'], explode(',', $_COOKIE['Airlines']))) {
436 436
 						echo '<option value="'.$airline['airline_icao'].'" selected>'.$airline_name.'</option>';
437 437
 					} else {
438 438
 						echo '<option value="'.$airline['airline_icao'].'">'.$airline_name.'</option>';
@@ -448,8 +448,8 @@  discard block
 block discarded – undo
448 448
 			<select class="selectpicker" multiple onchange="sources(this);">
449 449
 			    <?php
450 450
 				$Spotter = new Spotter();
451
-				foreach($Spotter->getAllSourceName('aprs') as $source) {
452
-					if (isset($_COOKIE['Sources']) && in_array($source['source_name'],explode(',',$_COOKIE['Sources']))) {
451
+				foreach ($Spotter->getAllSourceName('aprs') as $source) {
452
+					if (isset($_COOKIE['Sources']) && in_array($source['source_name'], explode(',', $_COOKIE['Sources']))) {
453 453
 						echo '<option value="'.$source['source_name'].'" selected>'.$source['source_name'].'</option>';
454 454
 					} else {
455 455
 						echo '<option value="'.$source['source_name'].'">'.$source['source_name'].'</option>';
@@ -521,7 +521,7 @@  discard block
 block discarded – undo
521 521
 					else if ($type_name == 'radar') $type_name = 'Radar Calibration';
522 522
 					else if ($type_name == 'tle-new') $type_name = 'Last 30 days launches';
523 523
 					
524
-					if (isset($_COOKIE['sattypes']) && in_array($type['tle_type'],explode(',',$_COOKIE['sattypes']))) {
524
+					if (isset($_COOKIE['sattypes']) && in_array($type['tle_type'], explode(',', $_COOKIE['sattypes']))) {
525 525
 						print '<option value="'.$type['tle_type'].'" selected>'.$type_name.'</option>';
526 526
 					} else {
527 527
 						print '<option value="'.$type['tle_type'].'">'.$type_name.'</option>';
Please login to merge, or discard this patch.
Braces   +357 added lines, -95 removed lines patch added patch discarded remove patch
@@ -135,11 +135,26 @@  discard block
 block discarded – undo
135 135
 				<li><div class="checkbox"><label><input type="checkbox" name="notamcb" value="1" onclick="showNotam();" /><?php echo _("Display NOTAM"); ?></label></div></li>
136 136
 				<li><?php echo _("NOTAM scope:"); ?>
137 137
 					<select class="selectpicker" onchange="notamscope(this);">
138
-						<option<?php if (!isset($_COOKIE['notamscope']) || $_COOKIE['notamscope'] == 'All') print ' selected'; ?>>All</option>
139
-						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport/Enroute warning') print ' selected'; ?>>Airport/Enroute warning</option>
140
-						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport warning') print ' selected'; ?>>Airport warning</option>
141
-						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Navigation warning') print ' selected'; ?>>Navigation warning</option>
142
-						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Enroute warning') print ' selected'; ?>>Enroute warning</option>
138
+						<option<?php if (!isset($_COOKIE['notamscope']) || $_COOKIE['notamscope'] == 'All') {
139
+	print ' selected';
140
+}
141
+?>>All</option>
142
+						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport/Enroute warning') {
143
+	print ' selected';
144
+}
145
+?>>Airport/Enroute warning</option>
146
+						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport warning') {
147
+	print ' selected';
148
+}
149
+?>>Airport warning</option>
150
+						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Navigation warning') {
151
+	print ' selected';
152
+}
153
+?>>Navigation warning</option>
154
+						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Enroute warning') {
155
+	print ' selected';
156
+}
157
+?>>Enroute warning</option>
143 158
 					</select
144 159
 				</li>
145 160
 			</ul>
@@ -167,7 +182,12 @@  discard block
 block discarded – undo
167 182
 		        <div class="form-group">
168 183
 			    <label>From (UTC):</label>
169 184
 		            <div class='input-group date' id='datetimepicker1'>
170
-            			<input type='text' name="start_date" class="form-control" value="<?php if (isset($_POST['start_date'])) print $_POST['start_date']; elseif (isset($_COOKIE['archive_begin'])) print date("m/d/Y h:i a",$_COOKIE['archive_begin']); ?>" required />
185
+            			<input type='text' name="start_date" class="form-control" value="<?php if (isset($_POST['start_date'])) {
186
+	print $_POST['start_date'];
187
+} elseif (isset($_COOKIE['archive_begin'])) {
188
+	print date("m/d/Y h:i a",$_COOKIE['archive_begin']);
189
+}
190
+?>" required />
171 191
 		                <span class="input-group-addon">
172 192
             			    <span class="glyphicon glyphicon-calendar"></span>
173 193
 		                </span>
@@ -176,7 +196,12 @@  discard block
 block discarded – undo
176 196
 		        <div class="form-group">
177 197
 			    <label>To (UTC):</label>
178 198
 		            <div class='input-group date' id='datetimepicker2'>
179
-		                <input type='text' name="end_date" class="form-control" value="<?php if (isset($_POST['end_date'])) print $_POST['end_date']; elseif (isset($_COOKIE['archive_end'])) print date("m/d/Y h:i a",$_COOKIE['archive_end']); ?>" />
199
+		                <input type='text' name="end_date" class="form-control" value="<?php if (isset($_POST['end_date'])) {
200
+	print $_POST['end_date'];
201
+} elseif (isset($_COOKIE['archive_end'])) {
202
+	print date("m/d/Y h:i a",$_COOKIE['archive_end']);
203
+}
204
+?>" />
180 205
             			<span class="input-group-addon">
181 206
 		                    <span class="glyphicon glyphicon-calendar"></span>
182 207
             			</span>
@@ -202,8 +227,20 @@  discard block
 block discarded – undo
202 227
 
203 228
 		    <li><?php echo _("Playback speed:"); ?>
204 229
 			<div class="range">
205
-			    <input type="range" min="0" max="50" step="1" name="archivespeed" onChange="archivespeedrange.value=value;" value="<?php  if (isset($_POST['archivespeed'])) print $_POST['archivespeed']; elseif (isset($_COOKIE['archive_speed'])) print $_COOKIE['archive_speed']; else print '1'; ?>">
206
-			    <output id="archivespeedrange"><?php  if (isset($_COOKIE['archive_speed'])) print $_COOKIE['archive_speed']; else print '1'; ?></output>
230
+			    <input type="range" min="0" max="50" step="1" name="archivespeed" onChange="archivespeedrange.value=value;" value="<?php  if (isset($_POST['archivespeed'])) {
231
+	print $_POST['archivespeed'];
232
+} elseif (isset($_COOKIE['archive_speed'])) {
233
+	print $_COOKIE['archive_speed'];
234
+} else {
235
+	print '1';
236
+}
237
+?>">
238
+			    <output id="archivespeedrange"><?php  if (isset($_COOKIE['archive_speed'])) {
239
+	print $_COOKIE['archive_speed'];
240
+} else {
241
+	print '1';
242
+}
243
+?></output>
207 244
 			</div>
208 245
 		    </li>
209 246
 		    <li><input type="submit" name="archive" value="Show archive" class="btn btn-primary" /></li>
@@ -225,15 +262,27 @@  discard block
 block discarded – undo
225 262
 		    <li><?php echo _("Type of Map:"); ?>
226 263
 			<select  class="selectpicker" onchange="mapType(this);">
227 264
 			    <?php
228
-				if (!isset($_COOKIE['MapType']) || $_COOKIE['MapType'] == '') $MapType = $globalMapProvider;
229
-				else $MapType = $_COOKIE['MapType'];
265
+				if (!isset($_COOKIE['MapType']) || $_COOKIE['MapType'] == '') {
266
+					$MapType = $globalMapProvider;
267
+				} else {
268
+					$MapType = $_COOKIE['MapType'];
269
+				}
230 270
 			    ?>
231 271
 			    <?php
232 272
 				if (isset($globalBingMapKey) && $globalBingMapKey != '') {
233 273
 			    ?>
234
-			    <option value="Bing-Aerial"<?php if ($MapType == 'Bing-Aerial') print ' selected'; ?>>Bing-Aerial</option>
235
-			    <option value="Bing-Hybrid"<?php if ($MapType == 'Bing-Hybrid') print ' selected'; ?>>Bing-Hybrid</option>
236
-			    <option value="Bing-Road"<?php if ($MapType == 'Bing-Road') print ' selected'; ?>>Bing-Road</option>
274
+			    <option value="Bing-Aerial"<?php if ($MapType == 'Bing-Aerial') {
275
+	print ' selected';
276
+}
277
+?>>Bing-Aerial</option>
278
+			    <option value="Bing-Hybrid"<?php if ($MapType == 'Bing-Hybrid') {
279
+	print ' selected';
280
+}
281
+?>>Bing-Hybrid</option>
282
+			    <option value="Bing-Road"<?php if ($MapType == 'Bing-Road') {
283
+	print ' selected';
284
+}
285
+?>>Bing-Road</option>
237 286
 			    <?php
238 287
 				}
239 288
 			    ?>
@@ -243,56 +292,131 @@  discard block
 block discarded – undo
243 292
 			    <?php
244 293
 				    if (isset($globalHereappId) && $globalHereappId != '' && isset($globalHereappCode) && $globalHereappCode != '') {
245 294
 			    ?>
246
-			    <option value="Here-Aerial"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Aerial</option>
247
-			    <option value="Here-Hybrid"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Hybrid</option>
248
-			    <option value="Here-Road"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Road</option>
295
+			    <option value="Here-Aerial"<?php if ($MapType == 'Here') {
296
+	print ' selected';
297
+}
298
+?>>Here-Aerial</option>
299
+			    <option value="Here-Hybrid"<?php if ($MapType == 'Here') {
300
+	print ' selected';
301
+}
302
+?>>Here-Hybrid</option>
303
+			    <option value="Here-Road"<?php if ($MapType == 'Here') {
304
+	print ' selected';
305
+}
306
+?>>Here-Road</option>
249 307
 			    <?php
250 308
 				    }
251 309
 			    ?>
252 310
 			    <?php
253 311
 				    if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '') {
254 312
 			    ?>
255
-			    <option value="Google-Roadmap"<?php if ($MapType == 'Google-Roadmap') print ' selected'; ?>>Google Roadmap</option>
256
-			    <option value="Google-Satellite"<?php if ($MapType == 'Google-Satellite') print ' selected'; ?>>Google Satellite</option>
257
-			    <option value="Google-Hybrid"<?php if ($MapType == 'Google-Hybrid') print ' selected'; ?>>Google Hybrid</option>
258
-			    <option value="Google-Terrain"<?php if ($MapType == 'Google-Terrain') print ' selected'; ?>>Google Terrain</option>
313
+			    <option value="Google-Roadmap"<?php if ($MapType == 'Google-Roadmap') {
314
+	print ' selected';
315
+}
316
+?>>Google Roadmap</option>
317
+			    <option value="Google-Satellite"<?php if ($MapType == 'Google-Satellite') {
318
+	print ' selected';
319
+}
320
+?>>Google Satellite</option>
321
+			    <option value="Google-Hybrid"<?php if ($MapType == 'Google-Hybrid') {
322
+	print ' selected';
323
+}
324
+?>>Google Hybrid</option>
325
+			    <option value="Google-Terrain"<?php if ($MapType == 'Google-Terrain') {
326
+	print ' selected';
327
+}
328
+?>>Google Terrain</option>
259 329
 			    <?php
260 330
 				    }
261 331
 			    ?>
262 332
 			    <?php
263 333
 				    if (isset($globalMapQuestKey) && $globalMapQuestKey != '') {
264 334
 			    ?>
265
-			    <option value="MapQuest-OSM"<?php if ($MapType == 'MapQuest-OSM') print ' selected'; ?>>MapQuest-OSM</option>
266
-			    <option value="MapQuest-Aerial"<?php if ($MapType == 'MapQuest-Aerial') print ' selected'; ?>>MapQuest-Aerial</option>
267
-			    <option value="MapQuest-Hybrid"<?php if ($MapType == 'MapQuest-Hybrid') print ' selected'; ?>>MapQuest-Hybrid</option>
335
+			    <option value="MapQuest-OSM"<?php if ($MapType == 'MapQuest-OSM') {
336
+	print ' selected';
337
+}
338
+?>>MapQuest-OSM</option>
339
+			    <option value="MapQuest-Aerial"<?php if ($MapType == 'MapQuest-Aerial') {
340
+	print ' selected';
341
+}
342
+?>>MapQuest-Aerial</option>
343
+			    <option value="MapQuest-Hybrid"<?php if ($MapType == 'MapQuest-Hybrid') {
344
+	print ' selected';
345
+}
346
+?>>MapQuest-Hybrid</option>
268 347
 			    <?php
269 348
 				    }
270 349
 			    ?>
271
-			    <option value="Yandex"<?php if ($MapType == 'Yandex') print ' selected'; ?>>Yandex</option>
350
+			    <option value="Yandex"<?php if ($MapType == 'Yandex') {
351
+	print ' selected';
352
+}
353
+?>>Yandex</option>
272 354
 			    <?php
273 355
 				}
274 356
 			    ?>
275 357
 			    <?php
276 358
 				    if (isset($globalMapboxToken) && $globalMapboxToken != '') {
277
-					if (!isset($_COOKIE['MapTypeId'])) $MapBoxId = 'default';
278
-					else $MapBoxId = $_COOKIE['MapTypeId'];
359
+					if (!isset($_COOKIE['MapTypeId'])) {
360
+						$MapBoxId = 'default';
361
+					} else {
362
+						$MapBoxId = $_COOKIE['MapTypeId'];
363
+					}
279 364
 			    ?>
280
-			    <option value="Mapbox-default"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'default') print ' selected'; ?>>Mapbox default</option>
281
-			    <option value="Mapbox-mapbox.streets"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets') print ' selected'; ?>>Mapbox streets</option>
282
-			    <option value="Mapbox-mapbox.light"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.light') print ' selected'; ?>>Mapbox light</option>
283
-			    <option value="Mapbox-mapbox.dark"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.dark') print ' selected'; ?>>Mapbox dark</option>
284
-			    <option value="Mapbox-mapbox.satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.satellite') print ' selected'; ?>>Mapbox satellite</option>
285
-			    <option value="Mapbox-mapbox.streets-satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-satellite') print ' selected'; ?>>Mapbox streets-satellite</option>
286
-			    <option value="Mapbox-mapbox.streets-basic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-basic') print ' selected'; ?>>Mapbox streets-basic</option>
287
-			    <option value="Mapbox-mapbox.comic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.comic') print ' selected'; ?>>Mapbox comic</option>
288
-			    <option value="Mapbox-mapbox.outdoors"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.outdoors') print ' selected'; ?>>Mapbox outdoors</option>
289
-			    <option value="Mapbox-mapbox.pencil"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pencil') print ' selected'; ?>>Mapbox pencil</option>
290
-			    <option value="Mapbox-mapbox.pirates"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pirates') print ' selected'; ?>>Mapbox pirates</option>
291
-			    <option value="Mapbox-mapbox.emerald"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.emerald') print ' selected'; ?>>Mapbox emerald</option>
365
+			    <option value="Mapbox-default"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'default') {
366
+	print ' selected';
367
+}
368
+?>>Mapbox default</option>
369
+			    <option value="Mapbox-mapbox.streets"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets') {
370
+	print ' selected';
371
+}
372
+?>>Mapbox streets</option>
373
+			    <option value="Mapbox-mapbox.light"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.light') {
374
+	print ' selected';
375
+}
376
+?>>Mapbox light</option>
377
+			    <option value="Mapbox-mapbox.dark"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.dark') {
378
+	print ' selected';
379
+}
380
+?>>Mapbox dark</option>
381
+			    <option value="Mapbox-mapbox.satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.satellite') {
382
+	print ' selected';
383
+}
384
+?>>Mapbox satellite</option>
385
+			    <option value="Mapbox-mapbox.streets-satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-satellite') {
386
+	print ' selected';
387
+}
388
+?>>Mapbox streets-satellite</option>
389
+			    <option value="Mapbox-mapbox.streets-basic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-basic') {
390
+	print ' selected';
391
+}
392
+?>>Mapbox streets-basic</option>
393
+			    <option value="Mapbox-mapbox.comic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.comic') {
394
+	print ' selected';
395
+}
396
+?>>Mapbox comic</option>
397
+			    <option value="Mapbox-mapbox.outdoors"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.outdoors') {
398
+	print ' selected';
399
+}
400
+?>>Mapbox outdoors</option>
401
+			    <option value="Mapbox-mapbox.pencil"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pencil') {
402
+	print ' selected';
403
+}
404
+?>>Mapbox pencil</option>
405
+			    <option value="Mapbox-mapbox.pirates"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pirates') {
406
+	print ' selected';
407
+}
408
+?>>Mapbox pirates</option>
409
+			    <option value="Mapbox-mapbox.emerald"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.emerald') {
410
+	print ' selected';
411
+}
412
+?>>Mapbox emerald</option>
292 413
 			    <?php
293 414
 				    }
294 415
 			    ?>
295
-			    <option value="OpenStreetMap"<?php if ($MapType == 'OpenStreetMap') print ' selected'; ?>>OpenStreetMap</option>
416
+			    <option value="OpenStreetMap"<?php if ($MapType == 'OpenStreetMap') {
417
+	print ' selected';
418
+}
419
+?>>OpenStreetMap</option>
296 420
 			</select>
297 421
 		    </li>
298 422
 <?php
@@ -300,9 +424,18 @@  discard block
 block discarded – undo
300 424
 ?>
301 425
 		    <li><?php echo _("Type of Terrain:"); ?>
302 426
 			<select  class="selectpicker" onchange="terrainType(this);">
303
-			    <option value="stk"<?php if (!isset($_COOKIE['MapTerrain']) || $_COOKIE['MapTerrain'] == 'stk') print ' selected'; ?>>stk terrain</option>
304
-			    <option value="ellipsoid"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'ellipsoid') print ' selected';?>>ellipsoid</option>
305
-			    <option value="vrterrain"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'vrterrain') print ' selected';?>>vr terrain</option>
427
+			    <option value="stk"<?php if (!isset($_COOKIE['MapTerrain']) || $_COOKIE['MapTerrain'] == 'stk') {
428
+	print ' selected';
429
+}
430
+?>>stk terrain</option>
431
+			    <option value="ellipsoid"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'ellipsoid') {
432
+	print ' selected';
433
+}
434
+?>>ellipsoid</option>
435
+			    <option value="vrterrain"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'vrterrain') {
436
+	print ' selected';
437
+}
438
+?>>vr terrain</option>
306 439
 			</select>
307 440
 		    </li>
308 441
 <?php
@@ -312,18 +445,36 @@  discard block
 block discarded – undo
312 445
     if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') {
313 446
 ?>
314 447
 		    
315
-		    <li><div class="checkbox"><label><input type="checkbox" name="flightpopup" value="1" onclick="clickFlightPopup(this)" <?php if (isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true') print 'checked'; ?> ><?php echo _("Display flight info as popup"); ?></label></div></li>
316
-		    <li><div class="checkbox"><label><input type="checkbox" name="flightpath" value="1" onclick="clickFlightPath(this)" <?php if ((isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true') || !isset($_COOKIE['flightpath'])) print 'checked'; ?> ><?php echo _("Display flight path"); ?></label></div></li>
317
-		    <li><div class="checkbox"><label><input type="checkbox" name="flightroute" value="1" onclick="clickFlightRoute(this)" <?php if ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == 'true') || !isset($_COOKIE['MapRoute'])) print 'checked'; ?> ><?php echo _("Display flight route on click"); ?></label></div></li>
318
-		    <li><div class="checkbox"><label><input type="checkbox" name="flightestimation" value="1" onclick="clickFlightEstimation(this)" <?php if ((isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'true') || (!isset($_COOKIE['flightestimation']) && !isset($globalMapEstimation)) || (!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation)) print 'checked'; ?> ><?php echo _("Planes animate between updates"); ?></label></div></li>
448
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightpopup" value="1" onclick="clickFlightPopup(this)" <?php if (isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true') {
449
+	print 'checked';
450
+}
451
+?> ><?php echo _("Display flight info as popup"); ?></label></div></li>
452
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightpath" value="1" onclick="clickFlightPath(this)" <?php if ((isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true') || !isset($_COOKIE['flightpath'])) {
453
+	print 'checked';
454
+}
455
+?> ><?php echo _("Display flight path"); ?></label></div></li>
456
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightroute" value="1" onclick="clickFlightRoute(this)" <?php if ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == 'true') || !isset($_COOKIE['MapRoute'])) {
457
+	print 'checked';
458
+}
459
+?> ><?php echo _("Display flight route on click"); ?></label></div></li>
460
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightestimation" value="1" onclick="clickFlightEstimation(this)" <?php if ((isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'true') || (!isset($_COOKIE['flightestimation']) && !isset($globalMapEstimation)) || (!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation)) {
461
+	print 'checked';
462
+}
463
+?> ><?php echo _("Planes animate between updates"); ?></label></div></li>
319 464
 <?php
320 465
     }
321 466
 ?>
322
-		    <li><div class="checkbox"><label><input type="checkbox" name="displayairports" value="1" onclick="clickDisplayAirports(this)" <?php if (isset($_COOKIE['displayairports']) && $_COOKIE['displayairports'] == 'true') print 'checked'; ?> ><?php echo _("Display airports on map"); ?></label></div></li>
467
+		    <li><div class="checkbox"><label><input type="checkbox" name="displayairports" value="1" onclick="clickDisplayAirports(this)" <?php if (isset($_COOKIE['displayairports']) && $_COOKIE['displayairports'] == 'true') {
468
+	print 'checked';
469
+}
470
+?> ><?php echo _("Display airports on map"); ?></label></div></li>
323 471
 <?php
324 472
     if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
325 473
 ?>
326
-		    <li><div class="checkbox"><label><input type="checkbox" name="displayminimap" value="1" onclick="clickDisplayMinimap(this)" <?php if (!isset($_COOKIE['displayminimap']) || (isset($_COOKIE['displayminimap']) && $_COOKIE['displayminimap'] == 'true')) print 'checked'; ?> ><?php echo _("Show mini-map"); ?></label></div></li>
474
+		    <li><div class="checkbox"><label><input type="checkbox" name="displayminimap" value="1" onclick="clickDisplayMinimap(this)" <?php if (!isset($_COOKIE['displayminimap']) || (isset($_COOKIE['displayminimap']) && $_COOKIE['displayminimap'] == 'true')) {
475
+	print 'checked';
476
+}
477
+?> ><?php echo _("Show mini-map"); ?></label></div></li>
327 478
 <?php
328 479
     }
329 480
 ?>
@@ -332,17 +483,25 @@  discard block
 block discarded – undo
332 483
 			if (function_exists('array_column')) {
333 484
 			    if (array_search(TRUE, array_column($globalSources, 'sourcestats')) !== FALSE) {
334 485
 		    ?>
335
-		    <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) print 'checked'; ?> ><?php echo _("Display polar on map"); ?></label></div></li>
486
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) {
487
+	print 'checked';
488
+}
489
+?> ><?php echo _("Display polar on map"); ?></label></div></li>
336 490
 		    <?php
337 491
 			    }
338 492
 			} elseif (isset($globalSources)) {
339 493
 			    $dispolar = false;
340 494
 			    foreach ($globalSources as $testsource) {
341
-			        if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) $dispolar = true;
495
+			        if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) {
496
+			        	$dispolar = true;
497
+			        }
342 498
 			    }
343 499
 			    if ($dispolar) {
344 500
 		    ?>
345
-		    <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) print 'checked'; ?> ><?php echo _("Display polar on map"); ?></label></div></li>
501
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) {
502
+	print 'checked';
503
+}
504
+?> ><?php echo _("Display polar on map"); ?></label></div></li>
346 505
 		    <?php
347 506
 			    }
348 507
 		        }
@@ -354,12 +513,22 @@  discard block
 block discarded – undo
354 513
 		    <?php
355 514
 		        if (extension_loaded('gd') && function_exists('gd_info')) {
356 515
 		    ?>
357
-		    <li><input type="checkbox" name="aircraftcoloraltitude" value="1" onclick="iconColorAltitude(this)" <?php if (isset($_COOKIE['IconColorAltitude']) && $_COOKIE['IconColorAltitude'] == 'true') print 'checked'; ?> ><?php echo _("Aircraft icon color based on altitude"); ?></li>
516
+		    <li><input type="checkbox" name="aircraftcoloraltitude" value="1" onclick="iconColorAltitude(this)" <?php if (isset($_COOKIE['IconColorAltitude']) && $_COOKIE['IconColorAltitude'] == 'true') {
517
+	print 'checked';
518
+}
519
+?> ><?php echo _("Aircraft icon color based on altitude"); ?></li>
358 520
 		    <?php 
359 521
 			if (!isset($_COOKIE['IconColorAltitude']) || $_COOKIE['IconColorAltitude'] == 'false') {
360 522
 		    ?>
361 523
 		    <li><?php echo _("Aircraft icon color:"); ?>
362
-			<input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(aircraftcolor.value);" value="#<?php if (isset($_COOKIE['IconColor'])) print $_COOKIE['IconColor']; elseif (isset($globalAircraftIconColor)) print $globalAircraftIconColor; else print '1a3151'; ?>">
524
+			<input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(aircraftcolor.value);" value="#<?php if (isset($_COOKIE['IconColor'])) {
525
+	print $_COOKIE['IconColor'];
526
+} elseif (isset($globalAircraftIconColor)) {
527
+	print $globalAircraftIconColor;
528
+} else {
529
+	print '1a3151';
530
+}
531
+?>">
363 532
 		    </li>
364 533
 		    <?php
365 534
 			    }
@@ -367,8 +536,22 @@  discard block
 block discarded – undo
367 536
 		    ?>
368 537
 		    <li><?php echo _("Show airport icon at zoom level:"); ?>
369 538
 			<div class="range">
370
-			    <input type="range" min="0" max="19" step="1" name="airportzoom" onchange="range.value=value;airportDisplayZoom(airportzoom.value);" value="<?php if (isset($_COOKIE['AirportZoom'])) print $_COOKIE['AirportZoom']; elseif (isset($globalAirportZoom)) print $globalAirportZoom; else print '7'; ?>">
371
-			    <output id="range"><?php if (isset($_COOKIE['AirportZoom'])) print $_COOKIE['AirportZoom']; elseif (isset($globalAirportZoom)) print $globalAirportZoom; else print '7'; ?></output>
539
+			    <input type="range" min="0" max="19" step="1" name="airportzoom" onchange="range.value=value;airportDisplayZoom(airportzoom.value);" value="<?php if (isset($_COOKIE['AirportZoom'])) {
540
+	print $_COOKIE['AirportZoom'];
541
+} elseif (isset($globalAirportZoom)) {
542
+	print $globalAirportZoom;
543
+} else {
544
+	print '7';
545
+}
546
+?>">
547
+			    <output id="range"><?php if (isset($_COOKIE['AirportZoom'])) {
548
+	print $_COOKIE['AirportZoom'];
549
+} elseif (isset($globalAirportZoom)) {
550
+	print $globalAirportZoom;
551
+} else {
552
+	print '7';
553
+}
554
+?></output>
372 555
 			</div>
373 556
 		    </li>
374 557
 <?php
@@ -376,22 +559,46 @@  discard block
 block discarded – undo
376 559
 ?>
377 560
 		    <li><?php echo _("Distance unit:"); ?>
378 561
 			<select class="selectpicker" onchange="unitdistance(this);">
379
-			    <option value="km"<?php if ((!isset($_COOKIE['unitdistance']) && (!isset($globalUnitDistance) || (isset($globalUnitDistance) && $globalUnitDistance == 'km'))) || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'km')) echo ' selected'; ?>>km</option>
380
-			    <option value="nm"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) echo ' selected'; ?>>nm</option>
381
-			    <option value="mi"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) echo ' selected'; ?>>mi</option>
562
+			    <option value="km"<?php if ((!isset($_COOKIE['unitdistance']) && (!isset($globalUnitDistance) || (isset($globalUnitDistance) && $globalUnitDistance == 'km'))) || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'km')) {
563
+	echo ' selected';
564
+}
565
+?>>km</option>
566
+			    <option value="nm"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) {
567
+	echo ' selected';
568
+}
569
+?>>nm</option>
570
+			    <option value="mi"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) {
571
+	echo ' selected';
572
+}
573
+?>>mi</option>
382 574
 		        </select>
383 575
 		    </li>
384 576
 		    <li><?php echo _("Altitude unit:"); ?>
385 577
 			<select class="selectpicker" onchange="unitaltitude(this);">
386
-			    <option value="m"<?php if ((!isset($_COOKIE['unitaltitude']) && (!isset($globalUnitAltitude) || (isset($globalUnitAltitude) && $globalUnitAltitude == 'm'))) || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'm')) echo ' selected'; ?>>m</option>
387
-			    <option value="feet"<?php if ((!isset($_COOKIE['unitaltitude']) && isset($globalUnitAltitude) && $globalUnitAltitude == 'feet') || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'feet')) echo ' selected'; ?>>feet</option>
578
+			    <option value="m"<?php if ((!isset($_COOKIE['unitaltitude']) && (!isset($globalUnitAltitude) || (isset($globalUnitAltitude) && $globalUnitAltitude == 'm'))) || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'm')) {
579
+	echo ' selected';
580
+}
581
+?>>m</option>
582
+			    <option value="feet"<?php if ((!isset($_COOKIE['unitaltitude']) && isset($globalUnitAltitude) && $globalUnitAltitude == 'feet') || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'feet')) {
583
+	echo ' selected';
584
+}
585
+?>>feet</option>
388 586
 		        </select>
389 587
 		    </li>
390 588
 		    <li><?php echo _("Speed unit:"); ?>
391 589
 			<select class="selectpicker" onchange="unitspeed(this);">
392
-			    <option value="kmh"<?php if ((!isset($_COOKIE['unitspeed']) && (!isset($globalUnitSpeed) || (isset($globalUnitSpeed) && $globalUnitSpeed == 'kmh'))) || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'kmh')) echo ' selected'; ?>>km/h</option>
393
-			    <option value="mph"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'mph') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'mph')) echo ' selected'; ?>>mph</option>
394
-			    <option value="knots"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'knots') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'knots')) echo ' selected'; ?>>knots</option>
590
+			    <option value="kmh"<?php if ((!isset($_COOKIE['unitspeed']) && (!isset($globalUnitSpeed) || (isset($globalUnitSpeed) && $globalUnitSpeed == 'kmh'))) || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'kmh')) {
591
+	echo ' selected';
592
+}
593
+?>>km/h</option>
594
+			    <option value="mph"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'mph') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'mph')) {
595
+	echo ' selected';
596
+}
597
+?>>mph</option>
598
+			    <option value="knots"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'knots') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'knots')) {
599
+	echo ' selected';
600
+}
601
+?>>knots</option>
395 602
 		        </select>
396 603
 		    </li>
397 604
 
@@ -406,9 +613,18 @@  discard block
 block discarded – undo
406 613
 		    <?php
407 614
 			if (((isset($globalVATSIM) && $globalVATSIM) || isset($globalIVAO) && $globalIVAO || isset($globalphpVMS) && $globalphpVMS) && (!isset($globalMapVAchoose) || $globalMapVAchoose)) {
408 615
 		    ?>
409
-			<?php if (isset($globalVATSIM) && $globalVATSIM) { ?><li><input type="checkbox" name="vatsim" value="1" onclick="clickVATSIM(this)" <?php if ((isset($_COOKIE['ShowVATSIM']) && $_COOKIE['ShowVATSIM'] == 'true') || !isset($_COOKIE['ShowVATSIM'])) print 'checked'; ?> ><?php echo _("Display VATSIM data"); ?></li><?php } ?>
410
-			<?php if (isset($globalIVAO) && $globalIVAO) { ?><li><input type="checkbox" name="ivao" value="1" onclick="clickIVAO(this)" <?php if ((isset($_COOKIE['ShowIVAO']) && $_COOKIE['ShowIVAO'] == 'true') || !isset($_COOKIE['ShowIVAO'])) print 'checked'; ?> ><?php echo _("Display IVAO data"); ?></li><?php } ?>
411
-			<?php if (isset($globalphpVMS) && $globalphpVMS) { ?><li><input type="checkbox" name="phpvms" value="1" onclick="clickphpVMS(this)" <?php if ((isset($_COOKIE['ShowVMS']) && $_COOKIE['ShowVMS'] == 'true') || !isset($_COOKIE['ShowVMS'])) print 'checked'; ?> ><?php echo _("Display phpVMS data"); ?></li><?php } ?>
616
+			<?php if (isset($globalVATSIM) && $globalVATSIM) { ?><li><input type="checkbox" name="vatsim" value="1" onclick="clickVATSIM(this)" <?php if ((isset($_COOKIE['ShowVATSIM']) && $_COOKIE['ShowVATSIM'] == 'true') || !isset($_COOKIE['ShowVATSIM'])) {
617
+	print 'checked';
618
+}
619
+?> ><?php echo _("Display VATSIM data"); ?></li><?php } ?>
620
+			<?php if (isset($globalIVAO) && $globalIVAO) { ?><li><input type="checkbox" name="ivao" value="1" onclick="clickIVAO(this)" <?php if ((isset($_COOKIE['ShowIVAO']) && $_COOKIE['ShowIVAO'] == 'true') || !isset($_COOKIE['ShowIVAO'])) {
621
+	print 'checked';
622
+}
623
+?> ><?php echo _("Display IVAO data"); ?></li><?php } ?>
624
+			<?php if (isset($globalphpVMS) && $globalphpVMS) { ?><li><input type="checkbox" name="phpvms" value="1" onclick="clickphpVMS(this)" <?php if ((isset($_COOKIE['ShowVMS']) && $_COOKIE['ShowVMS'] == 'true') || !isset($_COOKIE['ShowVMS'])) {
625
+	print 'checked';
626
+}
627
+?> ><?php echo _("Display phpVMS data"); ?></li><?php } ?>
412 628
 		    <?php
413 629
 			}
414 630
 		    ?>
@@ -416,10 +632,16 @@  discard block
 block discarded – undo
416 632
 			if (!(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalphpVMS) && $globalphpVMS) && isset($globalSBS1) && $globalSBS1 && isset($globalAPRS) && $globalAPRS && (!isset($globalMapchoose) || $globalMapchoose)) {
417 633
 		    ?>
418 634
 			<?php if (isset($globalSBS1) && $globalSBS1) { ?>
419
-			    <li><div class="checkbox"><label><input type="checkbox" name="sbs" value="1" onclick="clickSBS1(this)" <?php if ((isset($_COOKIE['ShowSBS1']) && $_COOKIE['ShowSBS1'] == 'true') || !isset($_COOKIE['ShowSBS1'])) print 'checked'; ?> ><?php echo _("Display ADS-B data"); ?></label></div></li>
635
+			    <li><div class="checkbox"><label><input type="checkbox" name="sbs" value="1" onclick="clickSBS1(this)" <?php if ((isset($_COOKIE['ShowSBS1']) && $_COOKIE['ShowSBS1'] == 'true') || !isset($_COOKIE['ShowSBS1'])) {
636
+	print 'checked';
637
+}
638
+?> ><?php echo _("Display ADS-B data"); ?></label></div></li>
420 639
 			<?php } ?>
421 640
 			<?php if (isset($globalAPRS) && $globalAPRS) { ?>
422
-			    <li><div class="checkbox"><label><input type="checkbox" name="aprs" value="1" onclick="clickAPRS(this)" <?php if ((isset($_COOKIE['ShowAPRS']) && $_COOKIE['ShowAPRS'] == 'true') || !isset($_COOKIE['ShowAPRS'])) print 'checked'; ?> ><?php echo _("Display APRS data"); ?></label></div></li>
641
+			    <li><div class="checkbox"><label><input type="checkbox" name="aprs" value="1" onclick="clickAPRS(this)" <?php if ((isset($_COOKIE['ShowAPRS']) && $_COOKIE['ShowAPRS'] == 'true') || !isset($_COOKIE['ShowAPRS'])) {
642
+	print 'checked';
643
+}
644
+?> ><?php echo _("Display APRS data"); ?></label></div></li>
423 645
 			<?php } ?>
424 646
 		    <?php
425 647
 			}
@@ -431,7 +653,9 @@  discard block
 block discarded – undo
431 653
 				$Spotter = new Spotter();
432 654
 				foreach($Spotter->getAllAirlineNames() as $airline) {
433 655
 					$airline_name = $airline['airline_name'];
434
-					if (strlen($airline_name) > 30) $airline_name = substr($airline_name,0,30).'...';
656
+					if (strlen($airline_name) > 30) {
657
+						$airline_name = substr($airline_name,0,30).'...';
658
+					}
435 659
 					if (isset($_COOKIE['Airlines']) && in_array($airline['airline_icao'],explode(',',$_COOKIE['Airlines']))) {
436 660
 						echo '<option value="'.$airline['airline_icao'].'" selected>'.$airline_name.'</option>';
437 661
 					} else {
@@ -466,10 +690,22 @@  discard block
 block discarded – undo
466 690
 		    ?>
467 691
 		    <li><?php echo _("Display airlines of type:"); ?><br/>
468 692
 			<select class="selectpicker" onchange="airlinestype(this);">
469
-			    <option value="all"<?php if (!isset($_COOKIE['airlinestype']) || $_COOKIE['airlinestype'] == 'all' || $_COOKIE['airlinestype'] == '') echo ' selected'; ?>><?php echo _("All"); ?></option>
470
-			    <option value="passenger"<?php if (isset($_COOKIE['airlinestype']) && $_COOKIE['airlinestype'] == 'passenger') echo ' selected'; ?>><?php echo _("Passenger"); ?></option>
471
-			    <option value="cargo"<?php if (isset($_COOKIE['airlinestype']) && $_COOKIE['airlinestype'] == 'cargo') echo ' selected'; ?>><?php echo _("Cargo"); ?></option>
472
-			    <option value="military"<?php if (isset($_COOKIE['airlinestype']) && $_COOKIE['airlinestype'] == 'military') echo ' selected'; ?>><?php echo _("Military"); ?></option>
693
+			    <option value="all"<?php if (!isset($_COOKIE['airlinestype']) || $_COOKIE['airlinestype'] == 'all' || $_COOKIE['airlinestype'] == '') {
694
+	echo ' selected';
695
+}
696
+?>><?php echo _("All"); ?></option>
697
+			    <option value="passenger"<?php if (isset($_COOKIE['airlinestype']) && $_COOKIE['airlinestype'] == 'passenger') {
698
+	echo ' selected';
699
+}
700
+?>><?php echo _("Passenger"); ?></option>
701
+			    <option value="cargo"<?php if (isset($_COOKIE['airlinestype']) && $_COOKIE['airlinestype'] == 'cargo') {
702
+	echo ' selected';
703
+}
704
+?>><?php echo _("Cargo"); ?></option>
705
+			    <option value="military"<?php if (isset($_COOKIE['airlinestype']) && $_COOKIE['airlinestype'] == 'military') {
706
+	echo ' selected';
707
+}
708
+?>><?php echo _("Military"); ?></option>
473 709
 			</select>
474 710
 		    </li>
475 711
 		    <?php
@@ -477,7 +713,10 @@  discard block
 block discarded – undo
477 713
 		    ?>
478 714
 		    <li>
479 715
 			<?php echo _("Display flight with ident:"); ?>
480
-			<input type="text" name="identfilter" id="identfilter" value="<?php if (isset($_COOKIE['identfilter'])) print $_COOKIE['identfilter']; ?>" />
716
+			<input type="text" name="identfilter" id="identfilter" value="<?php if (isset($_COOKIE['identfilter'])) {
717
+	print $_COOKIE['identfilter'];
718
+}
719
+?>" />
481 720
 		    </li>
482 721
 		</ul>
483 722
 	    </form>
@@ -493,7 +732,10 @@  discard block
 block discarded – undo
493 732
 	    <h1 class="sidebar-header"><?php echo _("Satellites"); ?><span class="sidebar-close"><i class="fa fa-caret-left"></i></span></h1>
494 733
 	    <form>
495 734
 		<ul>
496
-		    <li><div class="checkbox"><label><input type="checkbox" name="displayiss" value="1" onclick="clickDisplayISS(this)" <?php if (isset($_COOKIE['displayiss']) && $_COOKIE['displayiss'] == 'true') print 'checked'; ?> ><?php echo _("Show ISS, Tiangong-1 and Tiangong-2 on map"); ?></label></div></li>
735
+		    <li><div class="checkbox"><label><input type="checkbox" name="displayiss" value="1" onclick="clickDisplayISS(this)" <?php if (isset($_COOKIE['displayiss']) && $_COOKIE['displayiss'] == 'true') {
736
+	print 'checked';
737
+}
738
+?> ><?php echo _("Show ISS, Tiangong-1 and Tiangong-2 on map"); ?></label></div></li>
497 739
 		    <li><?php echo _("Type:"); ?>
498 740
 			<select class="selectpicker" multiple onchange="sattypes(this);">
499 741
 			    <?php
@@ -501,25 +743,45 @@  discard block
 block discarded – undo
501 743
 				$types = $Satellite->get_tle_types();
502 744
 				foreach ($types as $type) {
503 745
 					$type_name = $type['tle_type'];
504
-					if ($type_name == 'musson') $type_name = 'Russian LEO Navigation';
505
-					else if ($type_name == 'nnss') $type_name = 'Navi Navigation Satellite System';
506
-					else if ($type_name == 'sbas') $type_name = 'Satellite-Based Augmentation System';
507
-					else if ($type_name == 'glo-ops') $type_name = 'Glonass Operational';
508
-					else if ($type_name == 'gps-ops') $type_name = 'GPS Operational';
509
-					else if ($type_name == 'argos') $type_name = 'ARGOS Data Collection System';
510
-					else if ($type_name == 'tdrss') $type_name = 'Tracking and Data Relay Satellite System';
511
-					else if ($type_name == 'sarsat') $type_name = 'Search & Rescue';
512
-					else if ($type_name == 'dmc') $type_name = 'Disaster Monitoring';
513
-					else if ($type_name == 'resource') $type_name = 'Earth Resources';
514
-					else if ($type_name == 'stations') $type_name = 'Space Stations';
515
-					else if ($type_name == 'geo') $type_name = 'Geostationary';
516
-					else if ($type_name == 'amateur') $type_name = 'Amateur Radio';
517
-					else if ($type_name == 'x-comm') $type_name = 'Experimental';
518
-					else if ($type_name == 'other-comm') $type_name = 'Other Comm';
519
-					else if ($type_name == 'science') $type_name = 'Space & Earth Science';
520
-					else if ($type_name == 'military') $type_name = 'Miscellaneous Military';
521
-					else if ($type_name == 'radar') $type_name = 'Radar Calibration';
522
-					else if ($type_name == 'tle-new') $type_name = 'Last 30 days launches';
746
+					if ($type_name == 'musson') {
747
+						$type_name = 'Russian LEO Navigation';
748
+					} else if ($type_name == 'nnss') {
749
+						$type_name = 'Navi Navigation Satellite System';
750
+					} else if ($type_name == 'sbas') {
751
+						$type_name = 'Satellite-Based Augmentation System';
752
+					} else if ($type_name == 'glo-ops') {
753
+						$type_name = 'Glonass Operational';
754
+					} else if ($type_name == 'gps-ops') {
755
+						$type_name = 'GPS Operational';
756
+					} else if ($type_name == 'argos') {
757
+						$type_name = 'ARGOS Data Collection System';
758
+					} else if ($type_name == 'tdrss') {
759
+						$type_name = 'Tracking and Data Relay Satellite System';
760
+					} else if ($type_name == 'sarsat') {
761
+						$type_name = 'Search & Rescue';
762
+					} else if ($type_name == 'dmc') {
763
+						$type_name = 'Disaster Monitoring';
764
+					} else if ($type_name == 'resource') {
765
+						$type_name = 'Earth Resources';
766
+					} else if ($type_name == 'stations') {
767
+						$type_name = 'Space Stations';
768
+					} else if ($type_name == 'geo') {
769
+						$type_name = 'Geostationary';
770
+					} else if ($type_name == 'amateur') {
771
+						$type_name = 'Amateur Radio';
772
+					} else if ($type_name == 'x-comm') {
773
+						$type_name = 'Experimental';
774
+					} else if ($type_name == 'other-comm') {
775
+						$type_name = 'Other Comm';
776
+					} else if ($type_name == 'science') {
777
+						$type_name = 'Space & Earth Science';
778
+					} else if ($type_name == 'military') {
779
+						$type_name = 'Miscellaneous Military';
780
+					} else if ($type_name == 'radar') {
781
+						$type_name = 'Radar Calibration';
782
+					} else if ($type_name == 'tle-new') {
783
+						$type_name = 'Last 30 days launches';
784
+					}
523 785
 					
524 786
 					if (isset($_COOKIE['sattypes']) && in_array($type['tle_type'],explode(',',$_COOKIE['sattypes']))) {
525 787
 						print '<option value="'.$type['tle_type'].'" selected>'.$type_name.'</option>';
Please login to merge, or discard this patch.
date-statistics-registration.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -3,8 +3,8 @@  discard block
 block discarded – undo
3 3
 require_once('require/class.Spotter.php');
4 4
 require_once('require/class.Language.php');
5 5
 $Spotter = new Spotter();
6
-$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING);
7
-$spotter_array = $Spotter->getSpotterDataByDate($_GET['date'],"0,1", $sort);
6
+$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING);
7
+$spotter_array = $Spotter->getSpotterDataByDate($_GET['date'], "0,1", $sort);
8 8
 
9 9
 if (!empty($spotter_array))
10 10
 {
@@ -20,13 +20,13 @@  discard block
 block discarded – undo
20 20
 	print '</div>';
21 21
 
22 22
 	print '<div class="info column">';
23
-	print '<h1>'.sprintf(_("Flights from %s"),date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</h1>';
23
+	print '<h1>'.sprintf(_("Flights from %s"), date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</h1>';
24 24
 	print '</div>';
25 25
 
26 26
 	include('date-sub-menu.php');
27 27
 	print '<div class="column">';
28 28
 	print '<h2>'._("Most Common Aircraft by Registration").'</h2>';
29
-	print '<p>'.sprintf(_("The statistic below shows the most common aircraft by registration of flights on <strong>%s</strong>."),date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</p>';
29
+	print '<p>'.sprintf(_("The statistic below shows the most common aircraft by registration of flights on <strong>%s</strong>."), date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</p>';
30 30
 
31 31
 	$aircraft_array = $Spotter->countAllAircraftRegistrationByDate($_GET['date']);
32 32
 	if (!empty($aircraft_array))
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 		print '</thead>';
44 44
 		print '<tbody>';
45 45
 		$i = 1;
46
-		foreach($aircraft_array as $aircraft_item)
46
+		foreach ($aircraft_array as $aircraft_item)
47 47
 		{
48 48
 			print '<tr>';
49 49
 			print '<td><strong>'.$i.'</strong></td>';
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 				if (isset($aircraft_item['aircraft_type'])) {
54 54
 					print '<a href="'.$globalURL.'/registration/'.$aircraft_item['registration'].'"><img src="'.$aircraft_item['image_thumbnail'].'" class="img-rounded" data-toggle="popover" title="'.$aircraft_item['registration'].' - '.$aircraft_item['aircraft_icao'].' - '.$aircraft_item['airline_name'].'" alt="'.$aircraft_item['registration'].' - '.$aircraft_item['aircraft_type'].' - '.$aircraft_item['airline_name'].'" data-content="'._("Registration:").' '.$aircraft_item['registration'].'<br />'._("Aircraft:").' '.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')<br />'._("Airline:").' '.$aircraft_item['airline_name'].'" data-html="true" width="100px" /></a>';
55 55
 				} else {
56
-					print '<a href="'.$globalURL.'/registration/'.$aircraft_item['registration'].'"><img src="'.$aircraft_item['image_thumbnail'].'" class="img-rounded" data-toggle="popover" title="'.$aircraft_item['registration'].' - '.$aircraft_item['aircraft_icao'].' - '.$aircraft_item['airline_name'].'" alt="'.$aircraft_item['registration'].' - '.$aircraft_item['airline_name'].'" data-content="'._("Registration:").' '.$aircraft_item['registration'].'<br />'._("Aircraft:").' '.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')<br />'._("Airline:");' '.$aircraft_item['airline_name'].'" data-html="true" width="100px" /></a>';
56
+					print '<a href="'.$globalURL.'/registration/'.$aircraft_item['registration'].'"><img src="'.$aircraft_item['image_thumbnail'].'" class="img-rounded" data-toggle="popover" title="'.$aircraft_item['registration'].' - '.$aircraft_item['aircraft_icao'].' - '.$aircraft_item['airline_name'].'" alt="'.$aircraft_item['registration'].' - '.$aircraft_item['airline_name'].'" data-content="'._("Registration:").' '.$aircraft_item['registration'].'<br />'._("Aircraft:").' '.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')<br />'._("Airline:"); ' '.$aircraft_item['airline_name'].'" data-html="true" width="100px" /></a>';
57 57
 				}
58 58
 				print '</td>';
59 59
 			} else {
Please login to merge, or discard this patch.
require/class.SpotterArchive.php 4 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@
 block discarded – undo
11 11
     /**
12 12
     * Get SQL query part for filter used
13 13
     * @param Array $filter the filter
14
-    * @return Array the SQL part
14
+    * @return string the SQL part
15 15
     */
16 16
     public function getFilter($filter = array(),$where = false,$and = false) {
17 17
 	global $globalFilter, $globalStatsFilters, $globalFilterName;
Please login to merge, or discard this patch.
Indentation   +561 added lines, -561 removed lines patch added patch discarded remove patch
@@ -8,47 +8,47 @@  discard block
 block discarded – undo
8 8
 		$this->db = $Connection->db;
9 9
 	}
10 10
 
11
-    /**
12
-    * Get SQL query part for filter used
13
-    * @param Array $filter the filter
14
-    * @return Array the SQL part
15
-    */
16
-    public function getFilter($filter = array(),$where = false,$and = false) {
11
+	/**
12
+	 * Get SQL query part for filter used
13
+	 * @param Array $filter the filter
14
+	 * @return Array the SQL part
15
+	 */
16
+	public function getFilter($filter = array(),$where = false,$and = false) {
17 17
 	global $globalFilter, $globalStatsFilters, $globalFilterName;
18 18
 	if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) $filter = array_merge($globalStatsFilters[$globalFilterName],$filter);
19 19
 	if (is_array($globalFilter)) $filter = array_merge($globalFilter,$filter);
20 20
 	$filter_query_join = '';
21 21
 	$filter_query_where = '';
22 22
 	if (isset($filter['airlines']) && !empty($filter['airlines'])) {
23
-	    if ($filter['airlines'][0] != '') {
23
+		if ($filter['airlines'][0] != '') {
24 24
 		$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_archive_output.flightaware_id";
25
-	    }
25
+		}
26 26
 	}
27 27
 	
28 28
 	if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
29
-	    $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_archive_output.flightaware_id ";
29
+		$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_archive_output.flightaware_id ";
30 30
 	}
31 31
 	if (isset($filter['pilots_id']) && !empty($filter['pilots_id'])) {
32
-	    $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.pilot_id IN ('".implode("','",$filter['pilots_id'])."')) so ON so.flightaware_id = spotter_archive_output.flightaware_id";
32
+		$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.pilot_id IN ('".implode("','",$filter['pilots_id'])."')) so ON so.flightaware_id = spotter_archive_output.flightaware_id";
33 33
 	}
34 34
 	if (isset($filter['source']) && !empty($filter['source'])) {
35
-	    $filter_query_where = " WHERE format_source IN ('".implode("','",$filter['source'])."')";
35
+		$filter_query_where = " WHERE format_source IN ('".implode("','",$filter['source'])."')";
36 36
 	}
37 37
 	if (isset($filter['ident']) && !empty($filter['ident'])) {
38
-	    $filter_query_where = " WHERE ident = '".$filter['ident']."'";
38
+		$filter_query_where = " WHERE ident = '".$filter['ident']."'";
39 39
 	}
40 40
 	if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
41
-	    if ($filter_query_where == '') {
41
+		if ($filter_query_where == '') {
42 42
 		$filter_query_where = " WHERE format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
43
-	    } else {
43
+		} else {
44 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';
48 48
 	elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND';
49 49
 	$filter_query = $filter_query_join.$filter_query_where;
50 50
 	return $filter_query;
51
-    }
51
+	}
52 52
 
53 53
 	// Spotter_archive
54 54
 	public function addSpotterArchiveData($flightaware_id = '', $ident = '', $registration = '', $airline_name = '', $airline_icao = '', $airline_country = '', $airline_type = '', $aircraft_icao = '', $aircraft_shadow = '', $aircraft_name = '', $aircraft_manufacturer = '', $departure_airport_icao = '', $departure_airport_name = '', $departure_airport_city = '', $departure_airport_country = '', $departure_airport_time = '',$arrival_airport_icao = '', $arrival_airport_name = '', $arrival_airport_city ='', $arrival_airport_country = '', $arrival_airport_time = '', $route_stop = '', $date = '',$latitude = '', $longitude = '', $waypoints = '', $altitude = '', $heading = '', $ground_speed = '', $squawk = '', $ModeS = '', $pilot_id = '', $pilot_name = '',$verticalrate = '',$format_source = '', $source_name = '', $over_country = '') {
@@ -79,44 +79,44 @@  discard block
 block discarded – undo
79 79
 	}
80 80
 
81 81
 
82
-        /**
83
-        * Gets all the spotter information based on a particular callsign
84
-        *
85
-        * @return Array the spotter information
86
-        *
87
-        */
88
-        public function getLastArchiveSpotterDataByIdent($ident)
89
-        {
82
+		/**
83
+		 * Gets all the spotter information based on a particular callsign
84
+		 *
85
+		 * @return Array the spotter information
86
+		 *
87
+		 */
88
+		public function getLastArchiveSpotterDataByIdent($ident)
89
+		{
90 90
 		$Spotter = new Spotter($this->db);
91
-                date_default_timezone_set('UTC');
91
+				date_default_timezone_set('UTC');
92 92
 
93
-                $ident = filter_var($ident, FILTER_SANITIZE_STRING);
94
-                //$query  = "SELECT spotter_archive.* FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate LIMIT 1";
95
-                $query  = "SELECT spotter_archive.* FROM spotter_archive WHERE ident = :ident ORDER BY date DESC LIMIT 1";
93
+				$ident = filter_var($ident, FILTER_SANITIZE_STRING);
94
+				//$query  = "SELECT spotter_archive.* FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate LIMIT 1";
95
+				$query  = "SELECT spotter_archive.* FROM spotter_archive WHERE ident = :ident ORDER BY date DESC LIMIT 1";
96 96
 
97
-                $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident));
97
+				$spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident));
98 98
 
99
-                return $spotter_array;
100
-        }
99
+				return $spotter_array;
100
+		}
101 101
 
102 102
 
103
-        /**
104
-        * Gets last the spotter information based on a particular id
105
-        *
106
-        * @return Array the spotter information
107
-        *
108
-        */
109
-        public function getLastArchiveSpotterDataById($id)
110
-        {
111
-    		$Spotter = new Spotter($this->db);
112
-                date_default_timezone_set('UTC');
113
-                $id = filter_var($id, FILTER_SANITIZE_STRING);
114
-                //$query  = SpotterArchive->$global_query." WHERE spotter_archive.flightaware_id = :id";
115
-                //$query  = "SELECT spotter_archive.* FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.flightaware_id = :id GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate LIMIT 1";
116
-                $query  = "SELECT * FROM spotter_archive WHERE flightaware_id = :id ORDER BY date DESC LIMIT 1";
103
+		/**
104
+		 * Gets last the spotter information based on a particular id
105
+		 *
106
+		 * @return Array the spotter information
107
+		 *
108
+		 */
109
+		public function getLastArchiveSpotterDataById($id)
110
+		{
111
+			$Spotter = new Spotter($this->db);
112
+				date_default_timezone_set('UTC');
113
+				$id = filter_var($id, FILTER_SANITIZE_STRING);
114
+				//$query  = SpotterArchive->$global_query." WHERE spotter_archive.flightaware_id = :id";
115
+				//$query  = "SELECT spotter_archive.* FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.flightaware_id = :id GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate LIMIT 1";
116
+				$query  = "SELECT * FROM spotter_archive WHERE flightaware_id = :id ORDER BY date DESC LIMIT 1";
117 117
 
118 118
 //              $spotter_array = Spotter->getDataFromDB($query,array(':id' => $id));
119
-                  /*
119
+				  /*
120 120
                 try {
121 121
                         $Connection = new Connection();
122 122
                         $sth = Connection->$db->prepare($query);
@@ -126,232 +126,232 @@  discard block
 block discarded – undo
126 126
                 }
127 127
                 $spotter_array = $sth->fetchAll(PDO->FETCH_ASSOC);
128 128
                 */
129
-                $spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id));
130
-
131
-                return $spotter_array;
132
-        }
133
-
134
-        /**
135
-        * Gets all the spotter information based on a particular id
136
-        *
137
-        * @return Array the spotter information
138
-        *
139
-        */
140
-        public function getAllArchiveSpotterDataById($id)
141
-        {
142
-                date_default_timezone_set('UTC');
143
-                $id = filter_var($id, FILTER_SANITIZE_STRING);
144
-                $query  = $this->global_query." WHERE spotter_archive.flightaware_id = :id";
129
+				$spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id));
130
+
131
+				return $spotter_array;
132
+		}
133
+
134
+		/**
135
+		 * Gets all the spotter information based on a particular id
136
+		 *
137
+		 * @return Array the spotter information
138
+		 *
139
+		 */
140
+		public function getAllArchiveSpotterDataById($id)
141
+		{
142
+				date_default_timezone_set('UTC');
143
+				$id = filter_var($id, FILTER_SANITIZE_STRING);
144
+				$query  = $this->global_query." WHERE spotter_archive.flightaware_id = :id";
145 145
 
146 146
 //              $spotter_array = Spotter->getDataFromDB($query,array(':id' => $id));
147 147
 
148
-                try {
149
-                        $sth = $this->db->prepare($query);
150
-                        $sth->execute(array(':id' => $id));
151
-                } catch(PDOException $e) {
152
-                        echo $e->getMessage();
153
-                        die;
154
-                }
155
-                $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
156
-
157
-                return $spotter_array;
158
-        }
159
-
160
-        /**
161
-        * Gets coordinate & time spotter information based on a particular id
162
-        *
163
-        * @return Array the spotter information
164
-        *
165
-        */
166
-        public function getCoordArchiveSpotterDataById($id)
167
-        {
168
-                date_default_timezone_set('UTC');
169
-                $id = filter_var($id, FILTER_SANITIZE_STRING);
170
-                $query  = "SELECT spotter_archive.latitude, spotter_archive.longitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id";
148
+				try {
149
+						$sth = $this->db->prepare($query);
150
+						$sth->execute(array(':id' => $id));
151
+				} catch(PDOException $e) {
152
+						echo $e->getMessage();
153
+						die;
154
+				}
155
+				$spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
156
+
157
+				return $spotter_array;
158
+		}
159
+
160
+		/**
161
+		 * Gets coordinate & time spotter information based on a particular id
162
+		 *
163
+		 * @return Array the spotter information
164
+		 *
165
+		 */
166
+		public function getCoordArchiveSpotterDataById($id)
167
+		{
168
+				date_default_timezone_set('UTC');
169
+				$id = filter_var($id, FILTER_SANITIZE_STRING);
170
+				$query  = "SELECT spotter_archive.latitude, spotter_archive.longitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id";
171 171
 
172 172
 //              $spotter_array = Spotter->getDataFromDB($query,array(':id' => $id));
173 173
 
174
-                try {
175
-                        $sth = $this->db->prepare($query);
176
-                        $sth->execute(array(':id' => $id));
177
-                } catch(PDOException $e) {
178
-                        echo $e->getMessage();
179
-                        die;
180
-                }
181
-                $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
174
+				try {
175
+						$sth = $this->db->prepare($query);
176
+						$sth->execute(array(':id' => $id));
177
+				} catch(PDOException $e) {
178
+						echo $e->getMessage();
179
+						die;
180
+				}
181
+				$spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
182 182
 
183
-                return $spotter_array;
184
-        }
183
+				return $spotter_array;
184
+		}
185 185
 
186 186
 
187
-        /**
188
-        * Gets altitude information based on a particular callsign
189
-        *
190
-        * @return Array the spotter information
191
-        *
192
-        */
193
-        public function getAltitudeArchiveSpotterDataByIdent($ident)
194
-        {
187
+		/**
188
+		 * Gets altitude information based on a particular callsign
189
+		 *
190
+		 * @return Array the spotter information
191
+		 *
192
+		 */
193
+		public function getAltitudeArchiveSpotterDataByIdent($ident)
194
+		{
195 195
 
196
-                date_default_timezone_set('UTC');
196
+				date_default_timezone_set('UTC');
197 197
 
198
-                $ident = filter_var($ident, FILTER_SANITIZE_STRING);
199
-                $query  = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.ident = :ident";
198
+				$ident = filter_var($ident, FILTER_SANITIZE_STRING);
199
+				$query  = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.ident = :ident";
200 200
 
201
-                try {
202
-                        $sth = $this->db->prepare($query);
203
-                        $sth->execute(array(':ident' => $ident));
204
-                } catch(PDOException $e) {
205
-                        echo $e->getMessage();
206
-                        die;
207
-                }
208
-                $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
201
+				try {
202
+						$sth = $this->db->prepare($query);
203
+						$sth->execute(array(':ident' => $ident));
204
+				} catch(PDOException $e) {
205
+						echo $e->getMessage();
206
+						die;
207
+				}
208
+				$spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
209 209
 
210
-                return $spotter_array;
211
-        }
210
+				return $spotter_array;
211
+		}
212 212
 
213
-        /**
214
-        * Gets altitude information based on a particular id
215
-        *
216
-        * @return Array the spotter information
217
-        *
218
-        */
219
-        public function getAltitudeArchiveSpotterDataById($id)
220
-        {
213
+		/**
214
+		 * Gets altitude information based on a particular id
215
+		 *
216
+		 * @return Array the spotter information
217
+		 *
218
+		 */
219
+		public function getAltitudeArchiveSpotterDataById($id)
220
+		{
221 221
 
222
-                date_default_timezone_set('UTC');
222
+				date_default_timezone_set('UTC');
223 223
 
224
-                $id = filter_var($id, FILTER_SANITIZE_STRING);
225
-                $query  = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id ORDER BY date";
224
+				$id = filter_var($id, FILTER_SANITIZE_STRING);
225
+				$query  = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id ORDER BY date";
226 226
 
227
-                try {
228
-                        $sth = $this->db->prepare($query);
229
-                        $sth->execute(array(':id' => $id));
230
-                } catch(PDOException $e) {
231
-                        echo $e->getMessage();
232
-                        die;
233
-                }
234
-                $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
227
+				try {
228
+						$sth = $this->db->prepare($query);
229
+						$sth->execute(array(':id' => $id));
230
+				} catch(PDOException $e) {
231
+						echo $e->getMessage();
232
+						die;
233
+				}
234
+				$spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
235 235
 
236
-                return $spotter_array;
237
-        }
236
+				return $spotter_array;
237
+		}
238 238
 
239
-        /**
240
-        * Gets altitude & speed information based on a particular id
241
-        *
242
-        * @return Array the spotter information
243
-        *
244
-        */
245
-        public function getAltitudeSpeedArchiveSpotterDataById($id)
246
-        {
239
+		/**
240
+		 * Gets altitude & speed information based on a particular id
241
+		 *
242
+		 * @return Array the spotter information
243
+		 *
244
+		 */
245
+		public function getAltitudeSpeedArchiveSpotterDataById($id)
246
+		{
247 247
 
248
-                date_default_timezone_set('UTC');
248
+				date_default_timezone_set('UTC');
249 249
 
250
-                $id = filter_var($id, FILTER_SANITIZE_STRING);
251
-                $query  = "SELECT spotter_archive.altitude, spotter_archive.ground_speed, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id ORDER BY date";
250
+				$id = filter_var($id, FILTER_SANITIZE_STRING);
251
+				$query  = "SELECT spotter_archive.altitude, spotter_archive.ground_speed, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id ORDER BY date";
252 252
 
253
-                try {
254
-                        $sth = $this->db->prepare($query);
255
-                        $sth->execute(array(':id' => $id));
256
-                } catch(PDOException $e) {
257
-                        echo $e->getMessage();
258
-                        die;
259
-                }
260
-                $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
253
+				try {
254
+						$sth = $this->db->prepare($query);
255
+						$sth->execute(array(':id' => $id));
256
+				} catch(PDOException $e) {
257
+						echo $e->getMessage();
258
+						die;
259
+				}
260
+				$spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
261 261
 
262
-                return $spotter_array;
263
-        }
262
+				return $spotter_array;
263
+		}
264 264
 
265 265
 
266
-        /**
267
-        * Gets altitude information based on a particular callsign
268
-        *
269
-        * @return Array the spotter information
270
-        *
271
-        */
272
-        public function getLastAltitudeArchiveSpotterDataByIdent($ident)
273
-        {
266
+		/**
267
+		 * Gets altitude information based on a particular callsign
268
+		 *
269
+		 * @return Array the spotter information
270
+		 *
271
+		 */
272
+		public function getLastAltitudeArchiveSpotterDataByIdent($ident)
273
+		{
274 274
 
275
-                date_default_timezone_set('UTC');
275
+				date_default_timezone_set('UTC');
276 276
 
277
-                $ident = filter_var($ident, FILTER_SANITIZE_STRING);
278
-                $query  = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate LIMIT 1";
277
+				$ident = filter_var($ident, FILTER_SANITIZE_STRING);
278
+				$query  = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate LIMIT 1";
279 279
 //                $query  = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.ident = :ident";
280 280
 
281
-                try {
282
-                        $sth = $this->db->prepare($query);
283
-                        $sth->execute(array(':ident' => $ident));
284
-                } catch(PDOException $e) {
285
-                        echo $e->getMessage();
286
-                        die;
287
-                }
288
-                $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
281
+				try {
282
+						$sth = $this->db->prepare($query);
283
+						$sth->execute(array(':ident' => $ident));
284
+				} catch(PDOException $e) {
285
+						echo $e->getMessage();
286
+						die;
287
+				}
288
+				$spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
289 289
 
290
-                return $spotter_array;
291
-        }
290
+				return $spotter_array;
291
+		}
292 292
 
293 293
 
294 294
 
295
-       /**
296
-        * Gets all the archive spotter information
297
-        *
298
-        * @return Array the spotter information
299
-        *
300
-        */
301
-        public function getSpotterArchiveData($ident,$flightaware_id,$date)
302
-        {
303
-    		$Spotter = new Spotter($this->db);
304
-                $ident = filter_var($ident, FILTER_SANITIZE_STRING);
305
-                $query  = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.flightaware_id = :flightaware_id AND l.date LIKE :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate";
295
+	   /**
296
+	    * Gets all the archive spotter information
297
+	    *
298
+	    * @return Array the spotter information
299
+	    *
300
+	    */
301
+		public function getSpotterArchiveData($ident,$flightaware_id,$date)
302
+		{
303
+			$Spotter = new Spotter($this->db);
304
+				$ident = filter_var($ident, FILTER_SANITIZE_STRING);
305
+				$query  = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.flightaware_id = :flightaware_id AND l.date LIKE :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate";
306 306
 
307
-                $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident,':flightaware_id' => $flightaware_id,':date' => $date.'%'));
307
+				$spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident,':flightaware_id' => $flightaware_id,':date' => $date.'%'));
308 308
 
309
-                return $spotter_array;
310
-        }
309
+				return $spotter_array;
310
+		}
311 311
         
312
-        public function deleteSpotterArchiveTrackData()
313
-        {
312
+		public function deleteSpotterArchiveTrackData()
313
+		{
314 314
 		global $globalArchiveKeepTrackMonths;
315
-                date_default_timezone_set('UTC');
315
+				date_default_timezone_set('UTC');
316 316
 		$query = 'DELETE FROM spotter_archive WHERE spotter_archive.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$globalArchiveKeepTrackMonths.' MONTH)';
317
-                try {
318
-                        $sth = $this->db->prepare($query);
319
-                        $sth->execute();
320
-                } catch(PDOException $e) {
321
-                        echo $e->getMessage();
322
-                        die;
323
-                }
317
+				try {
318
+						$sth = $this->db->prepare($query);
319
+						$sth->execute();
320
+				} catch(PDOException $e) {
321
+						echo $e->getMessage();
322
+						die;
323
+				}
324 324
 	}
325 325
 
326 326
 	/**
327
-        * Gets Minimal Live Spotter data
328
-        *
329
-        * @return Array the spotter information
330
-        *
331
-        */
332
-        public function getMinLiveSpotterData($begindate,$enddate,$filter = array())
333
-        {
334
-                global $globalDBdriver, $globalLiveInterval;
335
-                date_default_timezone_set('UTC');
336
-
337
-                $filter_query = '';
338
-                if (isset($filter['source']) && !empty($filter['source'])) {
339
-                        $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') ";
340
-                }
341
-                // Use spotter_output also ?
342
-                if (isset($filter['airlines']) && !empty($filter['airlines'])) {
343
-                        $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id ";
344
-                }
345
-                if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
346
-                        $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_archive.flightaware_id ";
347
-                }
348
-                if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
349
-                        $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
350
-                }
351
-
352
-                //if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
353
-                if ($globalDBdriver == 'mysql') {
354
-                        /*
327
+	 * Gets Minimal Live Spotter data
328
+	 *
329
+	 * @return Array the spotter information
330
+	 *
331
+	 */
332
+		public function getMinLiveSpotterData($begindate,$enddate,$filter = array())
333
+		{
334
+				global $globalDBdriver, $globalLiveInterval;
335
+				date_default_timezone_set('UTC');
336
+
337
+				$filter_query = '';
338
+				if (isset($filter['source']) && !empty($filter['source'])) {
339
+						$filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') ";
340
+				}
341
+				// Use spotter_output also ?
342
+				if (isset($filter['airlines']) && !empty($filter['airlines'])) {
343
+						$filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id ";
344
+				}
345
+				if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
346
+						$filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_archive.flightaware_id ";
347
+				}
348
+				if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
349
+						$filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
350
+				}
351
+
352
+				//if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
353
+				if ($globalDBdriver == 'mysql') {
354
+						/*
355 355
                         $query  = 'SELECT a.aircraft_shadow, spotter_archive.ident, spotter_archive.flightaware_id, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk 
356 356
                     		    FROM spotter_archive 
357 357
                     		    INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE (l.date BETWEEN '."'".$begindate."'".' AND '."'".$enddate."'".') GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate '.$filter_query.'LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON spotter_archive.aircraft_icao = a.icao';
@@ -370,56 +370,56 @@  discard block
 block discarded – undo
370 370
 				    INNER JOIN (SELECT * FROM aircraft) a on spotter_archive.aircraft_icao = a.icao
371 371
 				    WHERE spotter_archive.date BETWEEN '."'".$begindate."'".' AND '."'".$begindate."'".' 
372 372
                         	    '.$filter_query.' ORDER BY flightaware_id';
373
-                } else {
374
-                        //$query  = 'SELECT spotter_archive.ident, spotter_archive.flightaware_id, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, a.aircraft_shadow FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate '.$filter_query.'INNER JOIN (SELECT * FROM aircraft) a on spotter_archive.aircraft_icao = a.icao';
375
-                        $query  = 'SELECT spotter_archive.date,spotter_archive.flightaware_id, spotter_archive.ident, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, a.aircraft_shadow,a.engine_type, a.engine_count, a.wake_category 
373
+				} else {
374
+						//$query  = 'SELECT spotter_archive.ident, spotter_archive.flightaware_id, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, a.aircraft_shadow FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate '.$filter_query.'INNER JOIN (SELECT * FROM aircraft) a on spotter_archive.aircraft_icao = a.icao';
375
+						$query  = 'SELECT spotter_archive.date,spotter_archive.flightaware_id, spotter_archive.ident, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, a.aircraft_shadow,a.engine_type, a.engine_count, a.wake_category 
376 376
                         	    FROM spotter_archive 
377 377
                         	    INNER JOIN (SELECT * FROM aircraft) a on spotter_archive.aircraft_icao = a.icao
378 378
                         	    WHERE spotter_archive.date >= '."'".$begindate."'".' AND spotter_archive.date <= '."'".$enddate."'".'
379 379
                         	    '.$filter_query.' ORDER BY flightaware_id';
380
-                }
381
-                //echo $query;
382
-                try {
383
-                        $sth = $this->db->prepare($query);
384
-                        $sth->execute();
385
-                } catch(PDOException $e) {
386
-                        echo $e->getMessage();
387
-                        die;
388
-                }
389
-                $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
390
-
391
-                return $spotter_array;
392
-        }
380
+				}
381
+				//echo $query;
382
+				try {
383
+						$sth = $this->db->prepare($query);
384
+						$sth->execute();
385
+				} catch(PDOException $e) {
386
+						echo $e->getMessage();
387
+						die;
388
+				}
389
+				$spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
390
+
391
+				return $spotter_array;
392
+		}
393 393
 
394 394
 	/**
395
-        * Gets Minimal Live Spotter data
396
-        *
397
-        * @return Array the spotter information
398
-        *
399
-        */
400
-        public function getMinLiveSpotterDataPlayback($begindate,$enddate,$filter = array())
401
-        {
402
-                global $globalDBdriver, $globalLiveInterval;
403
-                date_default_timezone_set('UTC');
404
-
405
-                $filter_query = '';
406
-                if (isset($filter['source']) && !empty($filter['source'])) {
407
-                        $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') ";
408
-                }
409
-                // Should use spotter_output also ?
410
-                if (isset($filter['airlines']) && !empty($filter['airlines'])) {
411
-                        $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id ";
412
-                }
413
-                if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
414
-                        $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_archive.flightaware_id ";
415
-                }
416
-                if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
417
-                        $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
418
-                }
419
-
420
-                //if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
421
-                if ($globalDBdriver == 'mysql') {
422
-                        /*
395
+	 * Gets Minimal Live Spotter data
396
+	 *
397
+	 * @return Array the spotter information
398
+	 *
399
+	 */
400
+		public function getMinLiveSpotterDataPlayback($begindate,$enddate,$filter = array())
401
+		{
402
+				global $globalDBdriver, $globalLiveInterval;
403
+				date_default_timezone_set('UTC');
404
+
405
+				$filter_query = '';
406
+				if (isset($filter['source']) && !empty($filter['source'])) {
407
+						$filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') ";
408
+				}
409
+				// Should use spotter_output also ?
410
+				if (isset($filter['airlines']) && !empty($filter['airlines'])) {
411
+						$filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id ";
412
+				}
413
+				if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
414
+						$filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_archive.flightaware_id ";
415
+				}
416
+				if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
417
+						$filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
418
+				}
419
+
420
+				//if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
421
+				if ($globalDBdriver == 'mysql') {
422
+						/*
423 423
                         $query  = 'SELECT a.aircraft_shadow, spotter_archive.ident, spotter_archive.flightaware_id, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk 
424 424
                     		    FROM spotter_archive 
425 425
                     		    INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE (l.date BETWEEN '."'".$begindate."'".' AND '."'".$enddate."'".') GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate '.$filter_query.'LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON spotter_archive.aircraft_icao = a.icao';
@@ -430,95 +430,95 @@  discard block
 block discarded – undo
430 430
 				    WHERE (spotter_archive_output.date BETWEEN '."'".$begindate."'".' AND '."'".$enddate."'".') 
431 431
                         	    '.$filter_query.' GROUP BY spotter_archive_output.flightaware_id, spotter_archive_output.ident, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao, spotter_archive_output.arrival_airport_icao, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk, a.aircraft_shadow';
432 432
 
433
-                } else {
434
-                        //$query  = 'SELECT spotter_archive_output.ident, spotter_archive_output.flightaware_id, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao as departure_airport, spotter_archive_output.arrival_airport_icao as arrival_airport, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk, a.aircraft_shadow FROM spotter_archive_output INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive_output l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_archive_output.flightaware_id = s.flightaware_id AND spotter_archive_output.date = s.maxdate '.$filter_query.'INNER JOIN (SELECT * FROM aircraft) a on spotter_archive_output.aircraft_icao = a.icao';
435
-                       /*
433
+				} else {
434
+						//$query  = 'SELECT spotter_archive_output.ident, spotter_archive_output.flightaware_id, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao as departure_airport, spotter_archive_output.arrival_airport_icao as arrival_airport, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk, a.aircraft_shadow FROM spotter_archive_output INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive_output l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_archive_output.flightaware_id = s.flightaware_id AND spotter_archive_output.date = s.maxdate '.$filter_query.'INNER JOIN (SELECT * FROM aircraft) a on spotter_archive_output.aircraft_icao = a.icao';
435
+					   /*
436 436
                         $query  = 'SELECT spotter_archive_output.ident, spotter_archive_output.flightaware_id, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao as departure_airport, spotter_archive_output.arrival_airport_icao as arrival_airport, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk, a.aircraft_shadow
437 437
                         	    FROM spotter_archive_output 
438 438
                         	    INNER JOIN (SELECT * FROM aircraft) a on spotter_archive_output.aircraft_icao = a.icao
439 439
                         	    WHERE spotter_archive_output.date >= '."'".$begindate."'".' AND spotter_archive_output.date <= '."'".$enddate."'".'
440 440
                         	    '.$filter_query.' GROUP BY spotter_archive_output.flightaware_id, spotter_archive_output.ident, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao, spotter_archive_output.arrival_airport_icao, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk, a.aircraft_shadow';
441 441
                         */
442
-                        $query  = 'SELECT DISTINCT spotter_archive_output.flightaware_id, spotter_archive_output.ident, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao as departure_airport, spotter_archive_output.arrival_airport_icao as arrival_airport, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk, a.aircraft_shadow
442
+						$query  = 'SELECT DISTINCT spotter_archive_output.flightaware_id, spotter_archive_output.ident, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao as departure_airport, spotter_archive_output.arrival_airport_icao as arrival_airport, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk, a.aircraft_shadow
443 443
                         	    FROM spotter_archive_output 
444 444
                         	    INNER JOIN (SELECT * FROM aircraft) a on spotter_archive_output.aircraft_icao = a.icao
445 445
                         	    WHERE spotter_archive_output.date >= '."'".$begindate."'".' AND spotter_archive_output.date <= '."'".$enddate."'".'
446 446
                         	    '.$filter_query.' LIMIT 200 OFFSET 0';
447 447
 //                        	    .' GROUP BY spotter_output.flightaware_id, spotter_output.ident, spotter_output.aircraft_icao, spotter_output.departure_airport_icao, spotter_output.arrival_airport_icao, spotter_output.latitude, spotter_output.longitude, spotter_output.altitude, spotter_output.heading, spotter_output.ground_speed, spotter_output.squawk, a.aircraft_shadow';
448 448
                         	    
449
-                }
450
-                //echo $query;
451
-                try {
452
-                        $sth = $this->db->prepare($query);
453
-                        $sth->execute();
454
-                } catch(PDOException $e) {
455
-                        echo $e->getMessage();
456
-                        die;
457
-                }
458
-                $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
459
-
460
-                return $spotter_array;
461
-        }
449
+				}
450
+				//echo $query;
451
+				try {
452
+						$sth = $this->db->prepare($query);
453
+						$sth->execute();
454
+				} catch(PDOException $e) {
455
+						echo $e->getMessage();
456
+						die;
457
+				}
458
+				$spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
459
+
460
+				return $spotter_array;
461
+		}
462 462
 
463 463
 	 /**
464
-        * Gets count Live Spotter data
465
-        *
466
-        * @return Array the spotter information
467
-        *
468
-        */
469
-        public function getLiveSpotterCount($begindate,$enddate,$filter = array())
470
-        {
471
-                global $globalDBdriver, $globalLiveInterval;
472
-                date_default_timezone_set('UTC');
473
-
474
-                $filter_query = '';
475
-                if (isset($filter['source']) && !empty($filter['source'])) {
476
-                        $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') ";
477
-                }
478
-                if (isset($filter['airlines']) && !empty($filter['airlines'])) {
479
-                        $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id ";
480
-                }
481
-                if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
482
-                        $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_archive.flightaware_id ";
483
-                }
484
-                if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
485
-                        $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
486
-                }
487
-
488
-                //if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
489
-                if ($globalDBdriver == 'mysql') {
464
+	  * Gets count Live Spotter data
465
+	  *
466
+	  * @return Array the spotter information
467
+	  *
468
+	  */
469
+		public function getLiveSpotterCount($begindate,$enddate,$filter = array())
470
+		{
471
+				global $globalDBdriver, $globalLiveInterval;
472
+				date_default_timezone_set('UTC');
473
+
474
+				$filter_query = '';
475
+				if (isset($filter['source']) && !empty($filter['source'])) {
476
+						$filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') ";
477
+				}
478
+				if (isset($filter['airlines']) && !empty($filter['airlines'])) {
479
+						$filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id ";
480
+				}
481
+				if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
482
+						$filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_archive.flightaware_id ";
483
+				}
484
+				if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
485
+						$filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
486
+				}
487
+
488
+				//if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
489
+				if ($globalDBdriver == 'mysql') {
490 490
 			$query = 'SELECT COUNT(DISTINCT flightaware_id) as nb 
491 491
 			FROM spotter_archive l 
492 492
 			WHERE (l.date BETWEEN DATE_SUB('."'".$begindate."'".',INTERVAL '.$globalLiveInterval.' SECOND) AND '."'".$begindate."'".')'.$filter_query;
493
-                } else {
493
+				} else {
494 494
 			$query = 'SELECT COUNT(DISTINCT flightaware_id) as nb FROM spotter_archive l WHERE (l.date BETWEEN '."'".$begindate."' - INTERVAL '".$globalLiveInterval." SECONDS' AND "."'".$enddate."'".')'.$filter_query;
495
-                }
496
-                //echo $query;
497
-                try {
498
-                        $sth = $this->db->prepare($query);
499
-                        $sth->execute();
500
-                } catch(PDOException $e) {
501
-                        echo $e->getMessage();
502
-                        die;
503
-                }
495
+				}
496
+				//echo $query;
497
+				try {
498
+						$sth = $this->db->prepare($query);
499
+						$sth->execute();
500
+				} catch(PDOException $e) {
501
+						echo $e->getMessage();
502
+						die;
503
+				}
504 504
 		$result = $sth->fetch(PDO::FETCH_ASSOC);
505 505
 		$sth->closeCursor();
506
-                return $result['nb'];
506
+				return $result['nb'];
507 507
 
508
-        }
508
+		}
509 509
 
510 510
 
511 511
 
512 512
 	// Spotter_Archive_output
513 513
 	
514
-    /**
515
-    * Gets all the spotter information
516
-    *
517
-    * @return Array the spotter information
518
-    *
519
-    */
520
-    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 = '', $filters=array())
521
-    {
514
+	/**
515
+	 * Gets all the spotter information
516
+	 *
517
+	 * @return Array the spotter information
518
+	 *
519
+	 */
520
+	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 = '', $filters=array())
521
+	{
522 522
 	global $globalTimezone, $globalDBdriver;
523 523
 	require_once(dirname(__FILE__).'/class.Translation.php');
524 524
 	$Translation = new Translation();
@@ -532,159 +532,159 @@  discard block
 block discarded – undo
532 532
 	$filter_query = $this->getFilter($filters);
533 533
 	if ($q != "")
534 534
 	{
535
-	    if (!is_string($q))
536
-	    {
535
+		if (!is_string($q))
536
+		{
537 537
 		return false;
538
-	    } else {
538
+		} else {
539 539
 	        
540 540
 		$q_array = explode(" ", $q);
541 541
 		
542 542
 		foreach ($q_array as $q_item){
543
-		    $additional_query .= " AND (";
544
-		    $additional_query .= "(spotter_archive_output.spotter_id like '%".$q_item."%') OR ";
545
-		    $additional_query .= "(spotter_archive_output.aircraft_icao like '%".$q_item."%') OR ";
546
-		    $additional_query .= "(spotter_archive_output.aircraft_name like '%".$q_item."%') OR ";
547
-		    $additional_query .= "(spotter_archive_output.aircraft_manufacturer like '%".$q_item."%') OR ";
548
-		    $additional_query .= "(spotter_archive_output.airline_icao like '%".$q_item."%') OR ";
549
-		    $additional_query .= "(spotter_archive_output.airline_name like '%".$q_item."%') OR ";
550
-		    $additional_query .= "(spotter_archive_output.airline_country like '%".$q_item."%') OR ";
551
-		    $additional_query .= "(spotter_archive_output.departure_airport_icao like '%".$q_item."%') OR ";
552
-		    $additional_query .= "(spotter_archive_output.departure_airport_name like '%".$q_item."%') OR ";
553
-		    $additional_query .= "(spotter_archive_output.departure_airport_city like '%".$q_item."%') OR ";
554
-		    $additional_query .= "(spotter_archive_output.departure_airport_country like '%".$q_item."%') OR ";
555
-		    $additional_query .= "(spotter_archive_output.arrival_airport_icao like '%".$q_item."%') OR ";
556
-		    $additional_query .= "(spotter_archive_output.arrival_airport_name like '%".$q_item."%') OR ";
557
-		    $additional_query .= "(spotter_archive_output.arrival_airport_city like '%".$q_item."%') OR ";
558
-		    $additional_query .= "(spotter_archive_output.arrival_airport_country like '%".$q_item."%') OR ";
559
-		    $additional_query .= "(spotter_archive_output.registration like '%".$q_item."%') OR ";
560
-		    $additional_query .= "(spotter_archive_output.owner_name like '%".$q_item."%') OR ";
561
-		    $additional_query .= "(spotter_archive_output.pilot_id like '%".$q_item."%') OR ";
562
-		    $additional_query .= "(spotter_archive_output.pilot_name like '%".$q_item."%') OR ";
563
-		    $additional_query .= "(spotter_archive_output.ident like '%".$q_item."%') OR ";
564
-		    $translate = $Translation->ident2icao($q_item);
565
-		    if ($translate != $q_item) $additional_query .= "(spotter_archive_output.ident like '%".$translate."%') OR ";
566
-		    $additional_query .= "(spotter_archive_output.highlight like '%".$q_item."%')";
567
-		    $additional_query .= ")";
543
+			$additional_query .= " AND (";
544
+			$additional_query .= "(spotter_archive_output.spotter_id like '%".$q_item."%') OR ";
545
+			$additional_query .= "(spotter_archive_output.aircraft_icao like '%".$q_item."%') OR ";
546
+			$additional_query .= "(spotter_archive_output.aircraft_name like '%".$q_item."%') OR ";
547
+			$additional_query .= "(spotter_archive_output.aircraft_manufacturer like '%".$q_item."%') OR ";
548
+			$additional_query .= "(spotter_archive_output.airline_icao like '%".$q_item."%') OR ";
549
+			$additional_query .= "(spotter_archive_output.airline_name like '%".$q_item."%') OR ";
550
+			$additional_query .= "(spotter_archive_output.airline_country like '%".$q_item."%') OR ";
551
+			$additional_query .= "(spotter_archive_output.departure_airport_icao like '%".$q_item."%') OR ";
552
+			$additional_query .= "(spotter_archive_output.departure_airport_name like '%".$q_item."%') OR ";
553
+			$additional_query .= "(spotter_archive_output.departure_airport_city like '%".$q_item."%') OR ";
554
+			$additional_query .= "(spotter_archive_output.departure_airport_country like '%".$q_item."%') OR ";
555
+			$additional_query .= "(spotter_archive_output.arrival_airport_icao like '%".$q_item."%') OR ";
556
+			$additional_query .= "(spotter_archive_output.arrival_airport_name like '%".$q_item."%') OR ";
557
+			$additional_query .= "(spotter_archive_output.arrival_airport_city like '%".$q_item."%') OR ";
558
+			$additional_query .= "(spotter_archive_output.arrival_airport_country like '%".$q_item."%') OR ";
559
+			$additional_query .= "(spotter_archive_output.registration like '%".$q_item."%') OR ";
560
+			$additional_query .= "(spotter_archive_output.owner_name like '%".$q_item."%') OR ";
561
+			$additional_query .= "(spotter_archive_output.pilot_id like '%".$q_item."%') OR ";
562
+			$additional_query .= "(spotter_archive_output.pilot_name like '%".$q_item."%') OR ";
563
+			$additional_query .= "(spotter_archive_output.ident like '%".$q_item."%') OR ";
564
+			$translate = $Translation->ident2icao($q_item);
565
+			if ($translate != $q_item) $additional_query .= "(spotter_archive_output.ident like '%".$translate."%') OR ";
566
+			$additional_query .= "(spotter_archive_output.highlight like '%".$q_item."%')";
567
+			$additional_query .= ")";
568
+		}
568 569
 		}
569
-	    }
570 570
 	}
571 571
 	
572 572
 	if ($registration != "")
573 573
 	{
574
-	    $registration = filter_var($registration,FILTER_SANITIZE_STRING);
575
-	    if (!is_string($registration))
576
-	    {
574
+		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
575
+		if (!is_string($registration))
576
+		{
577 577
 		return false;
578
-	    } else {
578
+		} else {
579 579
 		$additional_query .= " AND (spotter_archive_output.registration = '".$registration."')";
580
-	    }
580
+		}
581 581
 	}
582 582
 	
583 583
 	if ($aircraft_icao != "")
584 584
 	{
585
-	    $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
586
-	    if (!is_string($aircraft_icao))
587
-	    {
585
+		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
586
+		if (!is_string($aircraft_icao))
587
+		{
588 588
 		return false;
589
-	    } else {
589
+		} else {
590 590
 		$additional_query .= " AND (spotter_archive_output.aircraft_icao = '".$aircraft_icao."')";
591
-	    }
591
+		}
592 592
 	}
593 593
 	
594 594
 	if ($aircraft_manufacturer != "")
595 595
 	{
596
-	    $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
597
-	    if (!is_string($aircraft_manufacturer))
598
-	    {
596
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
597
+		if (!is_string($aircraft_manufacturer))
598
+		{
599 599
 		return false;
600
-	    } else {
600
+		} else {
601 601
 		$additional_query .= " AND (spotter_archive_output.aircraft_manufacturer = '".$aircraft_manufacturer."')";
602
-	    }
602
+		}
603 603
 	}
604 604
 	
605 605
 	if ($highlights == "true")
606 606
 	{
607
-	    if (!is_string($highlights))
608
-	    {
607
+		if (!is_string($highlights))
608
+		{
609 609
 		return false;
610
-	    } else {
610
+		} else {
611 611
 		$additional_query .= " AND (spotter_archive_output.highlight <> '')";
612
-	    }
612
+		}
613 613
 	}
614 614
 	
615 615
 	if ($airline_icao != "")
616 616
 	{
617
-	    $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
618
-	    if (!is_string($airline_icao))
619
-	    {
617
+		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
618
+		if (!is_string($airline_icao))
619
+		{
620 620
 		return false;
621
-	    } else {
621
+		} else {
622 622
 		$additional_query .= " AND (spotter_archive_output.airline_icao = '".$airline_icao."')";
623
-	    }
623
+		}
624 624
 	}
625 625
 	
626 626
 	if ($airline_country != "")
627 627
 	{
628
-	    $airline_country = filter_var($airline_country,FILTER_SANITIZE_STRING);
629
-	    if (!is_string($airline_country))
630
-	    {
628
+		$airline_country = filter_var($airline_country,FILTER_SANITIZE_STRING);
629
+		if (!is_string($airline_country))
630
+		{
631 631
 		return false;
632
-	    } else {
632
+		} else {
633 633
 		$additional_query .= " AND (spotter_archive_output.airline_country = '".$airline_country."')";
634
-	    }
634
+		}
635 635
 	}
636 636
 	
637 637
 	if ($airline_type != "")
638 638
 	{
639
-	    $airline_type = filter_var($airline_type,FILTER_SANITIZE_STRING);
640
-	    if (!is_string($airline_type))
641
-	    {
639
+		$airline_type = filter_var($airline_type,FILTER_SANITIZE_STRING);
640
+		if (!is_string($airline_type))
641
+		{
642 642
 		return false;
643
-	    } else {
643
+		} else {
644 644
 		if ($airline_type == "passenger")
645 645
 		{
646
-		    $additional_query .= " AND (spotter_archive_output.airline_type = 'passenger')";
646
+			$additional_query .= " AND (spotter_archive_output.airline_type = 'passenger')";
647 647
 		}
648 648
 		if ($airline_type == "cargo")
649 649
 		{
650
-		    $additional_query .= " AND (spotter_archive_output.airline_type = 'cargo')";
650
+			$additional_query .= " AND (spotter_archive_output.airline_type = 'cargo')";
651 651
 		}
652 652
 		if ($airline_type == "military")
653 653
 		{
654
-		    $additional_query .= " AND (spotter_archive_output.airline_type = 'military')";
654
+			$additional_query .= " AND (spotter_archive_output.airline_type = 'military')";
655
+		}
655 656
 		}
656
-	    }
657 657
 	}
658 658
 	
659 659
 	if ($airport != "")
660 660
 	{
661
-	    $airport = filter_var($airport,FILTER_SANITIZE_STRING);
662
-	    if (!is_string($airport))
663
-	    {
661
+		$airport = filter_var($airport,FILTER_SANITIZE_STRING);
662
+		if (!is_string($airport))
663
+		{
664 664
 		return false;
665
-	    } else {
665
+		} else {
666 666
 		$additional_query .= " AND ((spotter_archive_output.departure_airport_icao = '".$airport."') OR (spotter_archive_output.arrival_airport_icao = '".$airport."'))";
667
-	    }
667
+		}
668 668
 	}
669 669
 	
670 670
 	if ($airport_country != "")
671 671
 	{
672
-	    $airport_country = filter_var($airport_country,FILTER_SANITIZE_STRING);
673
-	    if (!is_string($airport_country))
674
-	    {
672
+		$airport_country = filter_var($airport_country,FILTER_SANITIZE_STRING);
673
+		if (!is_string($airport_country))
674
+		{
675 675
 		return false;
676
-	    } else {
676
+		} else {
677 677
 		$additional_query .= " AND ((spotter_archive_output.departure_airport_country = '".$airport_country."') OR (spotter_archive_output.arrival_airport_country = '".$airport_country."'))";
678
-	    }
678
+		}
679 679
 	}
680 680
     
681 681
 	if ($callsign != "")
682 682
 	{
683
-	    $callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
684
-	    if (!is_string($callsign))
685
-	    {
683
+		$callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
684
+		if (!is_string($callsign))
685
+		{
686 686
 		return false;
687
-	    } else {
687
+		} else {
688 688
 		$translate = $Translation->ident2icao($callsign);
689 689
 		if ($translate != $callsign) {
690 690
 			$additional_query .= " AND (spotter_archive_output.ident = :callsign OR spotter_archive_output.ident = :translate)";
@@ -692,99 +692,99 @@  discard block
 block discarded – undo
692 692
 		} else {
693 693
 			$additional_query .= " AND (spotter_archive_output.ident = '".$callsign."')";
694 694
 		}
695
-	    }
695
+		}
696 696
 	}
697 697
 
698 698
 	if ($owner != "")
699 699
 	{
700
-	    $owner = filter_var($owner,FILTER_SANITIZE_STRING);
701
-	    if (!is_string($owner))
702
-	    {
700
+		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
701
+		if (!is_string($owner))
702
+		{
703 703
 		return false;
704
-	    } else {
704
+		} else {
705 705
 		$additional_query .= " AND (spotter_archive_output.owner_name = '".$owner."')";
706
-	    }
706
+		}
707 707
 	}
708 708
 
709 709
 	if ($pilot_name != "")
710 710
 	{
711
-	    $pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING);
712
-	    if (!is_string($pilot_name))
713
-	    {
711
+		$pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING);
712
+		if (!is_string($pilot_name))
713
+		{
714 714
 		return false;
715
-	    } else {
715
+		} else {
716 716
 		$additional_query .= " AND (spotter_archive_output.pilot_name = '".$pilot_name."')";
717
-	    }
717
+		}
718 718
 	}
719 719
 	
720 720
 	if ($pilot_id != "")
721 721
 	{
722
-	    $pilot_id = filter_var($pilot_id,FILTER_SANITIZE_NUMBER_INT);
723
-	    if (!is_string($pilot_id))
724
-	    {
722
+		$pilot_id = filter_var($pilot_id,FILTER_SANITIZE_NUMBER_INT);
723
+		if (!is_string($pilot_id))
724
+		{
725 725
 		return false;
726
-	    } else {
726
+		} else {
727 727
 		$additional_query .= " AND (spotter_archive_output.pilot_id = '".$pilot_id."')";
728
-	    }
728
+		}
729 729
 	}
730 730
 	
731 731
 	if ($departure_airport_route != "")
732 732
 	{
733
-	    $departure_airport_route = filter_var($departure_airport_route,FILTER_SANITIZE_STRING);
734
-	    if (!is_string($departure_airport_route))
735
-	    {
733
+		$departure_airport_route = filter_var($departure_airport_route,FILTER_SANITIZE_STRING);
734
+		if (!is_string($departure_airport_route))
735
+		{
736 736
 		return false;
737
-	    } else {
737
+		} else {
738 738
 		$additional_query .= " AND (spotter_archive_output.departure_airport_icao = '".$departure_airport_route."')";
739
-	    }
739
+		}
740 740
 	}
741 741
 	
742 742
 	if ($arrival_airport_route != "")
743 743
 	{
744
-	    $arrival_airport_route = filter_var($arrival_airport_route,FILTER_SANITIZE_STRING);
745
-	    if (!is_string($arrival_airport_route))
746
-	    {
744
+		$arrival_airport_route = filter_var($arrival_airport_route,FILTER_SANITIZE_STRING);
745
+		if (!is_string($arrival_airport_route))
746
+		{
747 747
 		return false;
748
-	    } else {
748
+		} else {
749 749
 		$additional_query .= " AND (spotter_archive_output.arrival_airport_icao = '".$arrival_airport_route."')";
750
-	    }
750
+		}
751 751
 	}
752 752
 	
753 753
 	if ($altitude != "")
754 754
 	{
755
-	    $altitude_array = explode(",", $altitude);
755
+		$altitude_array = explode(",", $altitude);
756 756
 	    
757
-	    $altitude_array[0] = filter_var($altitude_array[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
758
-	    $altitude_array[1] = filter_var($altitude_array[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
757
+		$altitude_array[0] = filter_var($altitude_array[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
758
+		$altitude_array[1] = filter_var($altitude_array[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
759 759
 	    
760 760
 
761
-	    if ($altitude_array[1] != "")
762
-	    {                
761
+		if ($altitude_array[1] != "")
762
+		{                
763 763
 		$altitude_array[0] = substr($altitude_array[0], 0, -2);
764 764
 		$altitude_array[1] = substr($altitude_array[1], 0, -2);
765 765
 		$additional_query .= " AND altitude BETWEEN '".$altitude_array[0]."' AND '".$altitude_array[1]."' ";
766
-	    } else {
766
+		} else {
767 767
 		$altitude_array[0] = substr($altitude_array[0], 0, -2);
768 768
 		$additional_query .= " AND altitude <= '".$altitude_array[0]."' ";
769
-	    }
769
+		}
770 770
 	}
771 771
 	
772 772
 	if ($date_posted != "")
773 773
 	{
774
-	    $date_array = explode(",", $date_posted);
774
+		$date_array = explode(",", $date_posted);
775 775
 	    
776
-	    $date_array[0] = filter_var($date_array[0],FILTER_SANITIZE_STRING);
777
-	    $date_array[1] = filter_var($date_array[1],FILTER_SANITIZE_STRING);
776
+		$date_array[0] = filter_var($date_array[0],FILTER_SANITIZE_STRING);
777
+		$date_array[1] = filter_var($date_array[1],FILTER_SANITIZE_STRING);
778 778
 	    
779
-	    if ($globalTimezone != '') {
779
+		if ($globalTimezone != '') {
780 780
 		date_default_timezone_set($globalTimezone);
781 781
 		$datetime = new DateTime();
782 782
 		$offset = $datetime->format('P');
783
-	    } else $offset = '+00:00';
783
+		} else $offset = '+00:00';
784 784
 
785 785
 
786
-	    if ($date_array[1] != "")
787
-	    {                
786
+		if ($date_array[1] != "")
787
+		{                
788 788
 		$date_array[0] = date("Y-m-d H:i:s", strtotime($date_array[0]));
789 789
 		$date_array[1] = date("Y-m-d H:i:s", strtotime($date_array[1]));
790 790
 		if ($globalDBdriver == 'mysql') {
@@ -792,28 +792,28 @@  discard block
 block discarded – undo
792 792
 		} else {
793 793
 			$additional_query .= " AND spotter_archive_output.date::timestamp AT TIME ZONE INTERVAL ".$offset." >= CAST('".$date_array[0]."' AS TIMESTAMP) AND spotter_archive_output.date::timestamp AT TIME ZONE INTERVAL ".$offset." <= CAST('".$date_array[1]."' AS TIMESTAMP) ";
794 794
 		}
795
-	    } else {
795
+		} else {
796 796
 		$date_array[0] = date("Y-m-d H:i:s", strtotime($date_array[0]));
797
-                if ($globalDBdriver == 'mysql') {
797
+				if ($globalDBdriver == 'mysql') {
798 798
 			$additional_query .= " AND TIMESTAMP(CONVERT_TZ(spotter_archive_output.date,'+00:00', '".$offset."')) >= '".$date_array[0]."' ";
799 799
 		} else {
800 800
 			$additional_query .= " AND spotter_archive_output.date::timestamp AT TIME ZONE INTERVAL ".$offset." >= CAST('".$date_array[0]."' AS TIMESTAMP) ";
801 801
 		}
802
-	    }
802
+		}
803 803
 	}
804 804
 	
805 805
 	if ($limit != "")
806 806
 	{
807
-	    $limit_array = explode(",", $limit);
807
+		$limit_array = explode(",", $limit);
808 808
 	    
809
-	    $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
810
-	    $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
809
+		$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
810
+		$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
811 811
 	    
812
-	    if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
813
-	    {
812
+		if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
813
+		{
814 814
 		//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
815 815
 		$limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0];
816
-	    }
816
+		}
817 817
 	}
818 818
 	
819 819
 
@@ -844,33 +844,33 @@  discard block
 block discarded – undo
844 844
 	$spotter_array = $Spotter->getDataFromDB($query, $query_values,$limit_query);
845 845
 
846 846
 	return $spotter_array;
847
-    }
847
+	}
848 848
 
849
-    public function deleteSpotterArchiveData()
850
-    {
849
+	public function deleteSpotterArchiveData()
850
+	{
851 851
 		global $globalArchiveKeepMonths, $globalDBdriver;
852
-                date_default_timezone_set('UTC');
853
-                if ($globalDBdriver == 'mysql') {
852
+				date_default_timezone_set('UTC');
853
+				if ($globalDBdriver == 'mysql') {
854 854
 			$query = 'DELETE FROM spotter_archive_output WHERE spotter_archive_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$globalArchiveKeepMonths.' MONTH)';
855 855
 		} else {
856 856
 			$query = "DELETE FROM spotter_archive_output WHERE spotter_archive_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalArchiveKeepMonths." MONTH'";
857 857
 		}
858
-                try {
859
-                        $sth = $this->db->prepare($query);
860
-                        $sth->execute();
861
-                } catch(PDOException $e) {
862
-                        return "error";
863
-                }
858
+				try {
859
+						$sth = $this->db->prepare($query);
860
+						$sth->execute();
861
+				} catch(PDOException $e) {
862
+						return "error";
863
+				}
864 864
 	}
865 865
 
866
-    /**
867
-    * Gets all the spotter information based on the callsign
868
-    *
869
-    * @return Array the spotter information
870
-    *
871
-    */
872
-    public function getSpotterDataByIdent($ident = '', $limit = '', $sort = '')
873
-    {
866
+	/**
867
+	 * Gets all the spotter information based on the callsign
868
+	 *
869
+	 * @return Array the spotter information
870
+	 *
871
+	 */
872
+	public function getSpotterDataByIdent($ident = '', $limit = '', $sort = '')
873
+	{
874 874
 	$global_query = "SELECT spotter_archive_output.* FROM spotter_archive_output";
875 875
 	
876 876
 	date_default_timezone_set('UTC');
@@ -882,35 +882,35 @@  discard block
 block discarded – undo
882 882
 	
883 883
 	if ($ident != "")
884 884
 	{
885
-	    if (!is_string($ident))
886
-	    {
885
+		if (!is_string($ident))
886
+		{
887 887
 		return false;
888
-	    } else {
888
+		} else {
889 889
 		$additional_query = " AND (spotter_archive_output.ident = :ident)";
890 890
 		$query_values = array(':ident' => $ident);
891
-	    }
891
+		}
892 892
 	}
893 893
 	
894 894
 	if ($limit != "")
895 895
 	{
896
-	    $limit_array = explode(",", $limit);
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
-	    if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
902
-	    {
901
+		if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
902
+		{
903 903
 		//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
904 904
 		$limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0];
905
-	    }
905
+		}
906 906
 	}
907 907
 
908 908
 	if ($sort != "")
909 909
 	{
910
-	    $search_orderby_array = $Spotter->getOrderBy();
911
-	    $orderby_query = $search_orderby_array[$sort]['sql'];
910
+		$search_orderby_array = $Spotter->getOrderBy();
911
+		$orderby_query = $search_orderby_array[$sort]['sql'];
912 912
 	} else {
913
-	    $orderby_query = " ORDER BY spotter_archive_output.date DESC";
913
+		$orderby_query = " ORDER BY spotter_archive_output.date DESC";
914 914
 	}
915 915
 
916 916
 	$query = $global_query." WHERE spotter_archive_output.ident <> '' ".$additional_query." ".$orderby_query;
@@ -918,16 +918,16 @@  discard block
 block discarded – undo
918 918
 	$spotter_array = $Spotter->getDataFromDB($query, $query_values, $limit_query);
919 919
 
920 920
 	return $spotter_array;
921
-    }
922
-
923
-    /**
924
-    * Gets all number of flight over countries
925
-    *
926
-    * @return Array the airline country list
927
-    *
928
-    */
929
-    public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '')
930
-    {
921
+	}
922
+
923
+	/**
924
+	 * Gets all number of flight over countries
925
+	 *
926
+	 * @return Array the airline country list
927
+	 *
928
+	 */
929
+	public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '')
930
+	{
931 931
 	global $globalDBdriver;
932 932
 	/*
933 933
 	$query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb 
@@ -937,14 +937,14 @@  discard block
 block discarded – undo
937 937
 	$query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb
938 938
 		    FROM countries c, spotter_archive s
939 939
 		    WHERE c.iso2 = s.over_country ";
940
-                if ($olderthanmonths > 0) {
941
-            		if ($globalDBdriver == 'mysql') {
940
+				if ($olderthanmonths > 0) {
941
+					if ($globalDBdriver == 'mysql') {
942 942
 				$query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
943 943
 			} else {
944 944
 				$query .= "AND date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
945 945
 			}
946 946
 		}
947
-                if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
947
+				if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
948 948
 	$query .= "GROUP BY c.name, c.iso3, c.iso2 ORDER BY nb DESC";
949 949
 	if ($limit) $query .= " LIMIT 0,10";
950 950
       
@@ -957,23 +957,23 @@  discard block
 block discarded – undo
957 957
         
958 958
 	while($row = $sth->fetch(PDO::FETCH_ASSOC))
959 959
 	{
960
-	    $temp_array['flight_count'] = $row['nb'];
961
-	    $temp_array['flight_country'] = $row['name'];
962
-	    $temp_array['flight_country_iso3'] = $row['iso3'];
963
-	    $temp_array['flight_country_iso2'] = $row['iso2'];
964
-	    $flight_array[] = $temp_array;
960
+		$temp_array['flight_count'] = $row['nb'];
961
+		$temp_array['flight_country'] = $row['name'];
962
+		$temp_array['flight_country_iso3'] = $row['iso3'];
963
+		$temp_array['flight_country_iso2'] = $row['iso2'];
964
+		$flight_array[] = $temp_array;
965 965
 	}
966 966
 	return $flight_array;
967
-    }
968
-
969
-    /**
970
-    * Gets last spotter information based on a particular callsign
971
-    *
972
-    * @return Array the spotter information
973
-    *
974
-    */
975
-    public function getDateArchiveSpotterDataById($id,$date)
976
-    {
967
+	}
968
+
969
+	/**
970
+	 * Gets last spotter information based on a particular callsign
971
+	 *
972
+	 * @return Array the spotter information
973
+	 *
974
+	 */
975
+	public function getDateArchiveSpotterDataById($id,$date)
976
+	{
977 977
 	$Spotter = new Spotter($this->db);
978 978
 	date_default_timezone_set('UTC');
979 979
 	$id = filter_var($id, FILTER_SANITIZE_STRING);
@@ -981,16 +981,16 @@  discard block
 block discarded – undo
981 981
 	$date = date('c',$date);
982 982
 	$spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id,':date' => $date));
983 983
 	return $spotter_array;
984
-    }
985
-
986
-    /**
987
-    * Gets all the spotter information based on a particular callsign
988
-    *
989
-    * @return Array the spotter information
990
-    *
991
-    */
992
-    public function getDateArchiveSpotterDataByIdent($ident,$date)
993
-    {
984
+	}
985
+
986
+	/**
987
+	 * Gets all the spotter information based on a particular callsign
988
+	 *
989
+	 * @return Array the spotter information
990
+	 *
991
+	 */
992
+	public function getDateArchiveSpotterDataByIdent($ident,$date)
993
+	{
994 994
 	$Spotter = new Spotter($this->db);
995 995
 	date_default_timezone_set('UTC');
996 996
 	$ident = filter_var($ident, FILTER_SANITIZE_STRING);
@@ -998,16 +998,16 @@  discard block
 block discarded – undo
998 998
 	$date = date('c',$date);
999 999
 	$spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident,':date' => $date));
1000 1000
 	return $spotter_array;
1001
-    }
1002
-
1003
-    /**
1004
-    * Gets all the spotter information based on the airport
1005
-    *
1006
-    * @return Array the spotter information
1007
-    *
1008
-    */
1009
-    public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '',$filters = array())
1010
-    {
1001
+	}
1002
+
1003
+	/**
1004
+	 * Gets all the spotter information based on the airport
1005
+	 *
1006
+	 * @return Array the spotter information
1007
+	 *
1008
+	 */
1009
+	public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '',$filters = array())
1010
+	{
1011 1011
 	global $global_query;
1012 1012
 	$Spotter = new Spotter();
1013 1013
 	date_default_timezone_set('UTC');
@@ -1018,35 +1018,35 @@  discard block
 block discarded – undo
1018 1018
 	
1019 1019
 	if ($airport != "")
1020 1020
 	{
1021
-	    if (!is_string($airport))
1022
-	    {
1021
+		if (!is_string($airport))
1022
+		{
1023 1023
 		return false;
1024
-	    } else {
1024
+		} else {
1025 1025
 		$additional_query .= " AND ((spotter_archive_output.departure_airport_icao = :airport) OR (spotter_archive_output.arrival_airport_icao = :airport))";
1026 1026
 		$query_values = array(':airport' => $airport);
1027
-	    }
1027
+		}
1028 1028
 	}
1029 1029
 	
1030 1030
 	if ($limit != "")
1031 1031
 	{
1032
-	    $limit_array = explode(",", $limit);
1032
+		$limit_array = explode(",", $limit);
1033 1033
 	    
1034
-	    $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1035
-	    $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1034
+		$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1035
+		$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1036 1036
 	    
1037
-	    if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1038
-	    {
1037
+		if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1038
+		{
1039 1039
 		//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
1040 1040
 		$limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0];
1041
-	    }
1041
+		}
1042 1042
 	}
1043 1043
 	
1044 1044
 	if ($sort != "")
1045 1045
 	{
1046
-	    $search_orderby_array = $Spotter->getOrderBy();
1047
-	    $orderby_query = $search_orderby_array[$sort]['sql'];
1046
+		$search_orderby_array = $Spotter->getOrderBy();
1047
+		$orderby_query = $search_orderby_array[$sort]['sql'];
1048 1048
 	} else {
1049
-	    $orderby_query = " ORDER BY spotter_archive_output.date DESC";
1049
+		$orderby_query = " ORDER BY spotter_archive_output.date DESC";
1050 1050
 	}
1051 1051
 
1052 1052
 	$query = $global_query.$filter_query." spotter_archive_output.ident <> '' ".$additional_query." AND ((spotter_archive_output.departure_airport_icao <> 'NA') AND (spotter_archive_output.arrival_airport_icao <> 'NA')) ".$orderby_query;
@@ -1054,6 +1054,6 @@  discard block
 block discarded – undo
1054 1054
 	$spotter_array = $Spotter->getDataFromDB($query, $query_values, $limit_query);
1055 1055
 
1056 1056
 	return $spotter_array;
1057
-    }
1057
+	}
1058 1058
 }
1059 1059
 ?>
1060 1060
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +97 added lines, -97 removed lines patch added patch discarded remove patch
@@ -13,15 +13,15 @@  discard block
 block discarded – undo
13 13
     * @param Array $filter the filter
14 14
     * @return Array the SQL part
15 15
     */
16
-    public function getFilter($filter = array(),$where = false,$and = false) {
16
+    public function getFilter($filter = array(), $where = false, $and = false) {
17 17
 	global $globalFilter, $globalStatsFilters, $globalFilterName;
18
-	if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) $filter = array_merge($globalStatsFilters[$globalFilterName],$filter);
19
-	if (is_array($globalFilter)) $filter = array_merge($globalFilter,$filter);
18
+	if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) $filter = array_merge($globalStatsFilters[$globalFilterName], $filter);
19
+	if (is_array($globalFilter)) $filter = array_merge($globalFilter, $filter);
20 20
 	$filter_query_join = '';
21 21
 	$filter_query_where = '';
22 22
 	if (isset($filter['airlines']) && !empty($filter['airlines'])) {
23 23
 	    if ($filter['airlines'][0] != '') {
24
-		$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_archive_output.flightaware_id";
24
+		$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) so ON so.flightaware_id = spotter_archive_output.flightaware_id";
25 25
 	    }
26 26
 	}
27 27
 	
@@ -29,19 +29,19 @@  discard block
 block discarded – undo
29 29
 	    $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_archive_output.flightaware_id ";
30 30
 	}
31 31
 	if (isset($filter['pilots_id']) && !empty($filter['pilots_id'])) {
32
-	    $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.pilot_id IN ('".implode("','",$filter['pilots_id'])."')) so ON so.flightaware_id = spotter_archive_output.flightaware_id";
32
+	    $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.pilot_id IN ('".implode("','", $filter['pilots_id'])."')) so ON so.flightaware_id = spotter_archive_output.flightaware_id";
33 33
 	}
34 34
 	if (isset($filter['source']) && !empty($filter['source'])) {
35
-	    $filter_query_where = " WHERE format_source IN ('".implode("','",$filter['source'])."')";
35
+	    $filter_query_where = " WHERE format_source IN ('".implode("','", $filter['source'])."')";
36 36
 	}
37 37
 	if (isset($filter['ident']) && !empty($filter['ident'])) {
38 38
 	    $filter_query_where = " WHERE ident = '".$filter['ident']."'";
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';
@@ -51,28 +51,28 @@  discard block
 block discarded – undo
51 51
     }
52 52
 
53 53
 	// Spotter_archive
54
-	public function addSpotterArchiveData($flightaware_id = '', $ident = '', $registration = '', $airline_name = '', $airline_icao = '', $airline_country = '', $airline_type = '', $aircraft_icao = '', $aircraft_shadow = '', $aircraft_name = '', $aircraft_manufacturer = '', $departure_airport_icao = '', $departure_airport_name = '', $departure_airport_city = '', $departure_airport_country = '', $departure_airport_time = '',$arrival_airport_icao = '', $arrival_airport_name = '', $arrival_airport_city ='', $arrival_airport_country = '', $arrival_airport_time = '', $route_stop = '', $date = '',$latitude = '', $longitude = '', $waypoints = '', $altitude = '', $heading = '', $ground_speed = '', $squawk = '', $ModeS = '', $pilot_id = '', $pilot_name = '',$verticalrate = '',$format_source = '', $source_name = '', $over_country = '') {
54
+	public function addSpotterArchiveData($flightaware_id = '', $ident = '', $registration = '', $airline_name = '', $airline_icao = '', $airline_country = '', $airline_type = '', $aircraft_icao = '', $aircraft_shadow = '', $aircraft_name = '', $aircraft_manufacturer = '', $departure_airport_icao = '', $departure_airport_name = '', $departure_airport_city = '', $departure_airport_country = '', $departure_airport_time = '', $arrival_airport_icao = '', $arrival_airport_name = '', $arrival_airport_city = '', $arrival_airport_country = '', $arrival_airport_time = '', $route_stop = '', $date = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $heading = '', $ground_speed = '', $squawk = '', $ModeS = '', $pilot_id = '', $pilot_name = '', $verticalrate = '', $format_source = '', $source_name = '', $over_country = '') {
55 55
 		require_once(dirname(__FILE__).'/class.Spotter.php');
56 56
 		if ($over_country == '') {
57 57
 			$Spotter = new Spotter($this->db);
58
-			$data_country = $Spotter->getCountryFromLatitudeLongitude($latitude,$longitude);
58
+			$data_country = $Spotter->getCountryFromLatitudeLongitude($latitude, $longitude);
59 59
 			if (!empty($data_country)) $country = $data_country['iso2'];
60 60
 			else $country = '';
61 61
 		} else $country = $over_country;
62
-		if ($airline_type === NULL) $airline_type ='';
62
+		if ($airline_type === NULL) $airline_type = '';
63 63
 	
64 64
 		//if ($country == '') echo "\n".'************ UNKNOW COUNTRY ****************'."\n";
65 65
 		//else echo "\n".'*/*/*/*/*/*/*/ Country : '.$country.' */*/*/*/*/*/*/*/*/'."\n";
66 66
 
67 67
 		// Route is not added in spotter_archive
68
-		$query  = "INSERT INTO spotter_archive (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_shadow, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, departure_airport_time,arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, arrival_airport_time, route_stop, date,latitude, longitude, waypoints, altitude, heading, ground_speed, squawk, ModeS, pilot_id, pilot_name, verticalrate,format_source,over_country,source_name)
68
+		$query = "INSERT INTO spotter_archive (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_shadow, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, departure_airport_time,arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, arrival_airport_time, route_stop, date,latitude, longitude, waypoints, altitude, heading, ground_speed, squawk, ModeS, pilot_id, pilot_name, verticalrate,format_source,over_country,source_name)
69 69
 		        VALUES (:flightaware_id, :ident, :registration, :airline_name, :airline_icao, :airline_country, :airline_type, :aircraft_icao, :aircraft_shadow, :aircraft_name, :aircraft_manufacturer, :departure_airport_icao, :departure_airport_name, :departure_airport_city, :departure_airport_country, :departure_airport_time,:arrival_airport_icao, :arrival_airport_name, :arrival_airport_city, :arrival_airport_country, :arrival_airport_time, :route_stop, :date,:latitude, :longitude, :waypoints, :altitude, :heading, :ground_speed, :squawk, :ModeS, :pilot_id, :pilot_name, :verticalrate, :format_source, :over_country, :source_name)";
70 70
 
71
-		$query_values = array(':flightaware_id' => $flightaware_id, ':ident' => $ident, ':registration' => $registration, ':airline_name' => $airline_name, ':airline_icao' => $airline_icao, ':airline_country' => $airline_country, ':airline_type' => $airline_type, ':aircraft_icao' => $aircraft_icao, ':aircraft_shadow' => $aircraft_shadow, ':aircraft_name' => $aircraft_name, ':aircraft_manufacturer' => $aircraft_manufacturer, ':departure_airport_icao' => $departure_airport_icao, ':departure_airport_name' => $departure_airport_name, ':departure_airport_city' => $departure_airport_city, ':departure_airport_country' => $departure_airport_country, ':departure_airport_time' => $departure_airport_time,':arrival_airport_icao' => $arrival_airport_icao, ':arrival_airport_name' => $arrival_airport_name, ':arrival_airport_city' => $arrival_airport_city, ':arrival_airport_country' => $arrival_airport_country, ':arrival_airport_time' => $arrival_airport_time, ':route_stop' => $route_stop, ':date' => $date,':latitude' => $latitude, ':longitude' => $longitude, ':waypoints' => $waypoints, ':altitude' => $altitude, ':heading' => $heading, ':ground_speed' => $ground_speed, ':squawk' => $squawk, ':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':format_source' => $format_source, ':over_country' => $country, ':source_name' => $source_name);
71
+		$query_values = array(':flightaware_id' => $flightaware_id, ':ident' => $ident, ':registration' => $registration, ':airline_name' => $airline_name, ':airline_icao' => $airline_icao, ':airline_country' => $airline_country, ':airline_type' => $airline_type, ':aircraft_icao' => $aircraft_icao, ':aircraft_shadow' => $aircraft_shadow, ':aircraft_name' => $aircraft_name, ':aircraft_manufacturer' => $aircraft_manufacturer, ':departure_airport_icao' => $departure_airport_icao, ':departure_airport_name' => $departure_airport_name, ':departure_airport_city' => $departure_airport_city, ':departure_airport_country' => $departure_airport_country, ':departure_airport_time' => $departure_airport_time, ':arrival_airport_icao' => $arrival_airport_icao, ':arrival_airport_name' => $arrival_airport_name, ':arrival_airport_city' => $arrival_airport_city, ':arrival_airport_country' => $arrival_airport_country, ':arrival_airport_time' => $arrival_airport_time, ':route_stop' => $route_stop, ':date' => $date, ':latitude' => $latitude, ':longitude' => $longitude, ':waypoints' => $waypoints, ':altitude' => $altitude, ':heading' => $heading, ':ground_speed' => $ground_speed, ':squawk' => $squawk, ':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':format_source' => $format_source, ':over_country' => $country, ':source_name' => $source_name);
72 72
 		try {
73 73
 			$sth = $this->db->prepare($query);
74 74
 			$sth->execute($query_values);
75
-		} catch(PDOException $e) {
75
+		} catch (PDOException $e) {
76 76
 			return "error : ".$e->getMessage();
77 77
 		}
78 78
 		return "success";
@@ -92,9 +92,9 @@  discard block
 block discarded – undo
92 92
 
93 93
                 $ident = filter_var($ident, FILTER_SANITIZE_STRING);
94 94
                 //$query  = "SELECT spotter_archive.* FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate LIMIT 1";
95
-                $query  = "SELECT spotter_archive.* FROM spotter_archive WHERE ident = :ident ORDER BY date DESC LIMIT 1";
95
+                $query = "SELECT spotter_archive.* FROM spotter_archive WHERE ident = :ident ORDER BY date DESC LIMIT 1";
96 96
 
97
-                $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident));
97
+                $spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident));
98 98
 
99 99
                 return $spotter_array;
100 100
         }
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
                 $id = filter_var($id, FILTER_SANITIZE_STRING);
114 114
                 //$query  = SpotterArchive->$global_query." WHERE spotter_archive.flightaware_id = :id";
115 115
                 //$query  = "SELECT spotter_archive.* FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.flightaware_id = :id GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate LIMIT 1";
116
-                $query  = "SELECT * FROM spotter_archive WHERE flightaware_id = :id ORDER BY date DESC LIMIT 1";
116
+                $query = "SELECT * FROM spotter_archive WHERE flightaware_id = :id ORDER BY date DESC LIMIT 1";
117 117
 
118 118
 //              $spotter_array = Spotter->getDataFromDB($query,array(':id' => $id));
119 119
                   /*
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
                 }
127 127
                 $spotter_array = $sth->fetchAll(PDO->FETCH_ASSOC);
128 128
                 */
129
-                $spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id));
129
+                $spotter_array = $Spotter->getDataFromDB($query, array(':id' => $id));
130 130
 
131 131
                 return $spotter_array;
132 132
         }
@@ -141,14 +141,14 @@  discard block
 block discarded – undo
141 141
         {
142 142
                 date_default_timezone_set('UTC');
143 143
                 $id = filter_var($id, FILTER_SANITIZE_STRING);
144
-                $query  = $this->global_query." WHERE spotter_archive.flightaware_id = :id";
144
+                $query = $this->global_query." WHERE spotter_archive.flightaware_id = :id";
145 145
 
146 146
 //              $spotter_array = Spotter->getDataFromDB($query,array(':id' => $id));
147 147
 
148 148
                 try {
149 149
                         $sth = $this->db->prepare($query);
150 150
                         $sth->execute(array(':id' => $id));
151
-                } catch(PDOException $e) {
151
+                } catch (PDOException $e) {
152 152
                         echo $e->getMessage();
153 153
                         die;
154 154
                 }
@@ -167,14 +167,14 @@  discard block
 block discarded – undo
167 167
         {
168 168
                 date_default_timezone_set('UTC');
169 169
                 $id = filter_var($id, FILTER_SANITIZE_STRING);
170
-                $query  = "SELECT spotter_archive.latitude, spotter_archive.longitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id";
170
+                $query = "SELECT spotter_archive.latitude, spotter_archive.longitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id";
171 171
 
172 172
 //              $spotter_array = Spotter->getDataFromDB($query,array(':id' => $id));
173 173
 
174 174
                 try {
175 175
                         $sth = $this->db->prepare($query);
176 176
                         $sth->execute(array(':id' => $id));
177
-                } catch(PDOException $e) {
177
+                } catch (PDOException $e) {
178 178
                         echo $e->getMessage();
179 179
                         die;
180 180
                 }
@@ -196,12 +196,12 @@  discard block
 block discarded – undo
196 196
                 date_default_timezone_set('UTC');
197 197
 
198 198
                 $ident = filter_var($ident, FILTER_SANITIZE_STRING);
199
-                $query  = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.ident = :ident";
199
+                $query = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.ident = :ident";
200 200
 
201 201
                 try {
202 202
                         $sth = $this->db->prepare($query);
203 203
                         $sth->execute(array(':ident' => $ident));
204
-                } catch(PDOException $e) {
204
+                } catch (PDOException $e) {
205 205
                         echo $e->getMessage();
206 206
                         die;
207 207
                 }
@@ -222,12 +222,12 @@  discard block
 block discarded – undo
222 222
                 date_default_timezone_set('UTC');
223 223
 
224 224
                 $id = filter_var($id, FILTER_SANITIZE_STRING);
225
-                $query  = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id ORDER BY date";
225
+                $query = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id ORDER BY date";
226 226
 
227 227
                 try {
228 228
                         $sth = $this->db->prepare($query);
229 229
                         $sth->execute(array(':id' => $id));
230
-                } catch(PDOException $e) {
230
+                } catch (PDOException $e) {
231 231
                         echo $e->getMessage();
232 232
                         die;
233 233
                 }
@@ -248,12 +248,12 @@  discard block
 block discarded – undo
248 248
                 date_default_timezone_set('UTC');
249 249
 
250 250
                 $id = filter_var($id, FILTER_SANITIZE_STRING);
251
-                $query  = "SELECT spotter_archive.altitude, spotter_archive.ground_speed, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id ORDER BY date";
251
+                $query = "SELECT spotter_archive.altitude, spotter_archive.ground_speed, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id ORDER BY date";
252 252
 
253 253
                 try {
254 254
                         $sth = $this->db->prepare($query);
255 255
                         $sth->execute(array(':id' => $id));
256
-                } catch(PDOException $e) {
256
+                } catch (PDOException $e) {
257 257
                         echo $e->getMessage();
258 258
                         die;
259 259
                 }
@@ -275,13 +275,13 @@  discard block
 block discarded – undo
275 275
                 date_default_timezone_set('UTC');
276 276
 
277 277
                 $ident = filter_var($ident, FILTER_SANITIZE_STRING);
278
-                $query  = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate LIMIT 1";
278
+                $query = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate LIMIT 1";
279 279
 //                $query  = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.ident = :ident";
280 280
 
281 281
                 try {
282 282
                         $sth = $this->db->prepare($query);
283 283
                         $sth->execute(array(':ident' => $ident));
284
-                } catch(PDOException $e) {
284
+                } catch (PDOException $e) {
285 285
                         echo $e->getMessage();
286 286
                         die;
287 287
                 }
@@ -298,13 +298,13 @@  discard block
 block discarded – undo
298 298
         * @return Array the spotter information
299 299
         *
300 300
         */
301
-        public function getSpotterArchiveData($ident,$flightaware_id,$date)
301
+        public function getSpotterArchiveData($ident, $flightaware_id, $date)
302 302
         {
303 303
     		$Spotter = new Spotter($this->db);
304 304
                 $ident = filter_var($ident, FILTER_SANITIZE_STRING);
305
-                $query  = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.flightaware_id = :flightaware_id AND l.date LIKE :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate";
305
+                $query = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.flightaware_id = :flightaware_id AND l.date LIKE :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate";
306 306
 
307
-                $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident,':flightaware_id' => $flightaware_id,':date' => $date.'%'));
307
+                $spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident, ':flightaware_id' => $flightaware_id, ':date' => $date.'%'));
308 308
 
309 309
                 return $spotter_array;
310 310
         }
@@ -317,7 +317,7 @@  discard block
 block discarded – undo
317 317
                 try {
318 318
                         $sth = $this->db->prepare($query);
319 319
                         $sth->execute();
320
-                } catch(PDOException $e) {
320
+                } catch (PDOException $e) {
321 321
                         echo $e->getMessage();
322 322
                         die;
323 323
                 }
@@ -329,24 +329,24 @@  discard block
 block discarded – undo
329 329
         * @return Array the spotter information
330 330
         *
331 331
         */
332
-        public function getMinLiveSpotterData($begindate,$enddate,$filter = array())
332
+        public function getMinLiveSpotterData($begindate, $enddate, $filter = array())
333 333
         {
334 334
                 global $globalDBdriver, $globalLiveInterval;
335 335
                 date_default_timezone_set('UTC');
336 336
 
337 337
                 $filter_query = '';
338 338
                 if (isset($filter['source']) && !empty($filter['source'])) {
339
-                        $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') ";
339
+                        $filter_query .= " AND format_source IN ('".implode("','", $filter['source'])."') ";
340 340
                 }
341 341
                 // Use spotter_output also ?
342 342
                 if (isset($filter['airlines']) && !empty($filter['airlines'])) {
343
-                        $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id ";
343
+                        $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id ";
344 344
                 }
345 345
                 if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
346 346
                         $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_archive.flightaware_id ";
347 347
                 }
348 348
                 if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
349
-                        $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
349
+                        $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')";
350 350
                 }
351 351
 
352 352
                 //if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
@@ -365,14 +365,14 @@  discard block
 block discarded – undo
365 365
 						GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id 
366 366
 				    AND spotter_archive.date = s.maxdate '.$filter_query.'LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON spotter_archive.aircraft_icao = a.icao';
367 367
 */
368
-			$query  = 'SELECT spotter_archive.date,spotter_archive.flightaware_id, spotter_archive.ident, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, a.aircraft_shadow,a.engine_type, a.engine_count, a.wake_category 
368
+			$query = 'SELECT spotter_archive.date,spotter_archive.flightaware_id, spotter_archive.ident, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, a.aircraft_shadow,a.engine_type, a.engine_count, a.wake_category 
369 369
 				    FROM spotter_archive 
370 370
 				    INNER JOIN (SELECT * FROM aircraft) a on spotter_archive.aircraft_icao = a.icao
371 371
 				    WHERE spotter_archive.date BETWEEN '."'".$begindate."'".' AND '."'".$begindate."'".' 
372 372
                         	    '.$filter_query.' ORDER BY flightaware_id';
373 373
                 } else {
374 374
                         //$query  = 'SELECT spotter_archive.ident, spotter_archive.flightaware_id, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, a.aircraft_shadow FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate '.$filter_query.'INNER JOIN (SELECT * FROM aircraft) a on spotter_archive.aircraft_icao = a.icao';
375
-                        $query  = 'SELECT spotter_archive.date,spotter_archive.flightaware_id, spotter_archive.ident, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, a.aircraft_shadow,a.engine_type, a.engine_count, a.wake_category 
375
+                        $query = 'SELECT spotter_archive.date,spotter_archive.flightaware_id, spotter_archive.ident, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, a.aircraft_shadow,a.engine_type, a.engine_count, a.wake_category 
376 376
                         	    FROM spotter_archive 
377 377
                         	    INNER JOIN (SELECT * FROM aircraft) a on spotter_archive.aircraft_icao = a.icao
378 378
                         	    WHERE spotter_archive.date >= '."'".$begindate."'".' AND spotter_archive.date <= '."'".$enddate."'".'
@@ -382,7 +382,7 @@  discard block
 block discarded – undo
382 382
                 try {
383 383
                         $sth = $this->db->prepare($query);
384 384
                         $sth->execute();
385
-                } catch(PDOException $e) {
385
+                } catch (PDOException $e) {
386 386
                         echo $e->getMessage();
387 387
                         die;
388 388
                 }
@@ -397,24 +397,24 @@  discard block
 block discarded – undo
397 397
         * @return Array the spotter information
398 398
         *
399 399
         */
400
-        public function getMinLiveSpotterDataPlayback($begindate,$enddate,$filter = array())
400
+        public function getMinLiveSpotterDataPlayback($begindate, $enddate, $filter = array())
401 401
         {
402 402
                 global $globalDBdriver, $globalLiveInterval;
403 403
                 date_default_timezone_set('UTC');
404 404
 
405 405
                 $filter_query = '';
406 406
                 if (isset($filter['source']) && !empty($filter['source'])) {
407
-                        $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') ";
407
+                        $filter_query .= " AND format_source IN ('".implode("','", $filter['source'])."') ";
408 408
                 }
409 409
                 // Should use spotter_output also ?
410 410
                 if (isset($filter['airlines']) && !empty($filter['airlines'])) {
411
-                        $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id ";
411
+                        $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id ";
412 412
                 }
413 413
                 if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
414 414
                         $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_archive.flightaware_id ";
415 415
                 }
416 416
                 if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
417
-                        $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
417
+                        $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')";
418 418
                 }
419 419
 
420 420
                 //if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
@@ -424,7 +424,7 @@  discard block
 block discarded – undo
424 424
                     		    FROM spotter_archive 
425 425
                     		    INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE (l.date BETWEEN '."'".$begindate."'".' AND '."'".$enddate."'".') GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate '.$filter_query.'LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON spotter_archive.aircraft_icao = a.icao';
426 426
 			*/
427
-			$query  = 'SELECT a.aircraft_shadow, spotter_archive_output.ident, spotter_archive_output.flightaware_id, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao as departure_airport, spotter_archive_output.arrival_airport_icao as arrival_airport, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk 
427
+			$query = 'SELECT a.aircraft_shadow, spotter_archive_output.ident, spotter_archive_output.flightaware_id, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao as departure_airport, spotter_archive_output.arrival_airport_icao as arrival_airport, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk 
428 428
 				    FROM spotter_archive_output 
429 429
 				    LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON spotter_archive_output.aircraft_icao = a.icao 
430 430
 				    WHERE (spotter_archive_output.date BETWEEN '."'".$begindate."'".' AND '."'".$enddate."'".') 
@@ -439,7 +439,7 @@  discard block
 block discarded – undo
439 439
                         	    WHERE spotter_archive_output.date >= '."'".$begindate."'".' AND spotter_archive_output.date <= '."'".$enddate."'".'
440 440
                         	    '.$filter_query.' GROUP BY spotter_archive_output.flightaware_id, spotter_archive_output.ident, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao, spotter_archive_output.arrival_airport_icao, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk, a.aircraft_shadow';
441 441
                         */
442
-                        $query  = 'SELECT DISTINCT spotter_archive_output.flightaware_id, spotter_archive_output.ident, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao as departure_airport, spotter_archive_output.arrival_airport_icao as arrival_airport, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk, a.aircraft_shadow
442
+                        $query = 'SELECT DISTINCT spotter_archive_output.flightaware_id, spotter_archive_output.ident, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao as departure_airport, spotter_archive_output.arrival_airport_icao as arrival_airport, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk, a.aircraft_shadow
443 443
                         	    FROM spotter_archive_output 
444 444
                         	    INNER JOIN (SELECT * FROM aircraft) a on spotter_archive_output.aircraft_icao = a.icao
445 445
                         	    WHERE spotter_archive_output.date >= '."'".$begindate."'".' AND spotter_archive_output.date <= '."'".$enddate."'".'
@@ -451,7 +451,7 @@  discard block
 block discarded – undo
451 451
                 try {
452 452
                         $sth = $this->db->prepare($query);
453 453
                         $sth->execute();
454
-                } catch(PDOException $e) {
454
+                } catch (PDOException $e) {
455 455
                         echo $e->getMessage();
456 456
                         die;
457 457
                 }
@@ -466,23 +466,23 @@  discard block
 block discarded – undo
466 466
         * @return Array the spotter information
467 467
         *
468 468
         */
469
-        public function getLiveSpotterCount($begindate,$enddate,$filter = array())
469
+        public function getLiveSpotterCount($begindate, $enddate, $filter = array())
470 470
         {
471 471
                 global $globalDBdriver, $globalLiveInterval;
472 472
                 date_default_timezone_set('UTC');
473 473
 
474 474
                 $filter_query = '';
475 475
                 if (isset($filter['source']) && !empty($filter['source'])) {
476
-                        $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') ";
476
+                        $filter_query .= " AND format_source IN ('".implode("','", $filter['source'])."') ";
477 477
                 }
478 478
                 if (isset($filter['airlines']) && !empty($filter['airlines'])) {
479
-                        $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id ";
479
+                        $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id ";
480 480
                 }
481 481
                 if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
482 482
                         $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_archive.flightaware_id ";
483 483
                 }
484 484
                 if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
485
-                        $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
485
+                        $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')";
486 486
                 }
487 487
 
488 488
                 //if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
@@ -497,7 +497,7 @@  discard block
 block discarded – undo
497 497
                 try {
498 498
                         $sth = $this->db->prepare($query);
499 499
                         $sth->execute();
500
-                } catch(PDOException $e) {
500
+                } catch (PDOException $e) {
501 501
                         echo $e->getMessage();
502 502
                         die;
503 503
                 }
@@ -517,7 +517,7 @@  discard block
 block discarded – undo
517 517
     * @return Array the spotter information
518 518
     *
519 519
     */
520
-    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 = '', $filters=array())
520
+    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 = '', $filters = array())
521 521
     {
522 522
 	global $globalTimezone, $globalDBdriver;
523 523
 	require_once(dirname(__FILE__).'/class.Translation.php');
@@ -539,7 +539,7 @@  discard block
 block discarded – undo
539 539
 	        
540 540
 		$q_array = explode(" ", $q);
541 541
 		
542
-		foreach ($q_array as $q_item){
542
+		foreach ($q_array as $q_item) {
543 543
 		    $additional_query .= " AND (";
544 544
 		    $additional_query .= "(spotter_archive_output.spotter_id like '%".$q_item."%') OR ";
545 545
 		    $additional_query .= "(spotter_archive_output.aircraft_icao like '%".$q_item."%') OR ";
@@ -571,7 +571,7 @@  discard block
 block discarded – undo
571 571
 	
572 572
 	if ($registration != "")
573 573
 	{
574
-	    $registration = filter_var($registration,FILTER_SANITIZE_STRING);
574
+	    $registration = filter_var($registration, FILTER_SANITIZE_STRING);
575 575
 	    if (!is_string($registration))
576 576
 	    {
577 577
 		return false;
@@ -582,7 +582,7 @@  discard block
 block discarded – undo
582 582
 	
583 583
 	if ($aircraft_icao != "")
584 584
 	{
585
-	    $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
585
+	    $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
586 586
 	    if (!is_string($aircraft_icao))
587 587
 	    {
588 588
 		return false;
@@ -593,7 +593,7 @@  discard block
 block discarded – undo
593 593
 	
594 594
 	if ($aircraft_manufacturer != "")
595 595
 	{
596
-	    $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
596
+	    $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
597 597
 	    if (!is_string($aircraft_manufacturer))
598 598
 	    {
599 599
 		return false;
@@ -614,7 +614,7 @@  discard block
 block discarded – undo
614 614
 	
615 615
 	if ($airline_icao != "")
616 616
 	{
617
-	    $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
617
+	    $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
618 618
 	    if (!is_string($airline_icao))
619 619
 	    {
620 620
 		return false;
@@ -625,7 +625,7 @@  discard block
 block discarded – undo
625 625
 	
626 626
 	if ($airline_country != "")
627 627
 	{
628
-	    $airline_country = filter_var($airline_country,FILTER_SANITIZE_STRING);
628
+	    $airline_country = filter_var($airline_country, FILTER_SANITIZE_STRING);
629 629
 	    if (!is_string($airline_country))
630 630
 	    {
631 631
 		return false;
@@ -636,7 +636,7 @@  discard block
 block discarded – undo
636 636
 	
637 637
 	if ($airline_type != "")
638 638
 	{
639
-	    $airline_type = filter_var($airline_type,FILTER_SANITIZE_STRING);
639
+	    $airline_type = filter_var($airline_type, FILTER_SANITIZE_STRING);
640 640
 	    if (!is_string($airline_type))
641 641
 	    {
642 642
 		return false;
@@ -658,7 +658,7 @@  discard block
 block discarded – undo
658 658
 	
659 659
 	if ($airport != "")
660 660
 	{
661
-	    $airport = filter_var($airport,FILTER_SANITIZE_STRING);
661
+	    $airport = filter_var($airport, FILTER_SANITIZE_STRING);
662 662
 	    if (!is_string($airport))
663 663
 	    {
664 664
 		return false;
@@ -669,7 +669,7 @@  discard block
 block discarded – undo
669 669
 	
670 670
 	if ($airport_country != "")
671 671
 	{
672
-	    $airport_country = filter_var($airport_country,FILTER_SANITIZE_STRING);
672
+	    $airport_country = filter_var($airport_country, FILTER_SANITIZE_STRING);
673 673
 	    if (!is_string($airport_country))
674 674
 	    {
675 675
 		return false;
@@ -680,7 +680,7 @@  discard block
 block discarded – undo
680 680
     
681 681
 	if ($callsign != "")
682 682
 	{
683
-	    $callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
683
+	    $callsign = filter_var($callsign, FILTER_SANITIZE_STRING);
684 684
 	    if (!is_string($callsign))
685 685
 	    {
686 686
 		return false;
@@ -688,7 +688,7 @@  discard block
 block discarded – undo
688 688
 		$translate = $Translation->ident2icao($callsign);
689 689
 		if ($translate != $callsign) {
690 690
 			$additional_query .= " AND (spotter_archive_output.ident = :callsign OR spotter_archive_output.ident = :translate)";
691
-			$query_values = array_merge($query_values,array(':callsign' => $callsign,':translate' => $translate));
691
+			$query_values = array_merge($query_values, array(':callsign' => $callsign, ':translate' => $translate));
692 692
 		} else {
693 693
 			$additional_query .= " AND (spotter_archive_output.ident = '".$callsign."')";
694 694
 		}
@@ -697,7 +697,7 @@  discard block
 block discarded – undo
697 697
 
698 698
 	if ($owner != "")
699 699
 	{
700
-	    $owner = filter_var($owner,FILTER_SANITIZE_STRING);
700
+	    $owner = filter_var($owner, FILTER_SANITIZE_STRING);
701 701
 	    if (!is_string($owner))
702 702
 	    {
703 703
 		return false;
@@ -708,7 +708,7 @@  discard block
 block discarded – undo
708 708
 
709 709
 	if ($pilot_name != "")
710 710
 	{
711
-	    $pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING);
711
+	    $pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING);
712 712
 	    if (!is_string($pilot_name))
713 713
 	    {
714 714
 		return false;
@@ -719,7 +719,7 @@  discard block
 block discarded – undo
719 719
 	
720 720
 	if ($pilot_id != "")
721 721
 	{
722
-	    $pilot_id = filter_var($pilot_id,FILTER_SANITIZE_NUMBER_INT);
722
+	    $pilot_id = filter_var($pilot_id, FILTER_SANITIZE_NUMBER_INT);
723 723
 	    if (!is_string($pilot_id))
724 724
 	    {
725 725
 		return false;
@@ -730,7 +730,7 @@  discard block
 block discarded – undo
730 730
 	
731 731
 	if ($departure_airport_route != "")
732 732
 	{
733
-	    $departure_airport_route = filter_var($departure_airport_route,FILTER_SANITIZE_STRING);
733
+	    $departure_airport_route = filter_var($departure_airport_route, FILTER_SANITIZE_STRING);
734 734
 	    if (!is_string($departure_airport_route))
735 735
 	    {
736 736
 		return false;
@@ -741,7 +741,7 @@  discard block
 block discarded – undo
741 741
 	
742 742
 	if ($arrival_airport_route != "")
743 743
 	{
744
-	    $arrival_airport_route = filter_var($arrival_airport_route,FILTER_SANITIZE_STRING);
744
+	    $arrival_airport_route = filter_var($arrival_airport_route, FILTER_SANITIZE_STRING);
745 745
 	    if (!is_string($arrival_airport_route))
746 746
 	    {
747 747
 		return false;
@@ -754,8 +754,8 @@  discard block
 block discarded – undo
754 754
 	{
755 755
 	    $altitude_array = explode(",", $altitude);
756 756
 	    
757
-	    $altitude_array[0] = filter_var($altitude_array[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
758
-	    $altitude_array[1] = filter_var($altitude_array[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
757
+	    $altitude_array[0] = filter_var($altitude_array[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
758
+	    $altitude_array[1] = filter_var($altitude_array[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
759 759
 	    
760 760
 
761 761
 	    if ($altitude_array[1] != "")
@@ -773,8 +773,8 @@  discard block
 block discarded – undo
773 773
 	{
774 774
 	    $date_array = explode(",", $date_posted);
775 775
 	    
776
-	    $date_array[0] = filter_var($date_array[0],FILTER_SANITIZE_STRING);
777
-	    $date_array[1] = filter_var($date_array[1],FILTER_SANITIZE_STRING);
776
+	    $date_array[0] = filter_var($date_array[0], FILTER_SANITIZE_STRING);
777
+	    $date_array[1] = filter_var($date_array[1], FILTER_SANITIZE_STRING);
778 778
 	    
779 779
 	    if ($globalTimezone != '') {
780 780
 		date_default_timezone_set($globalTimezone);
@@ -806,8 +806,8 @@  discard block
 block discarded – undo
806 806
 	{
807 807
 	    $limit_array = explode(",", $limit);
808 808
 	    
809
-	    $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
810
-	    $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
809
+	    $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
810
+	    $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
811 811
 	    
812 812
 	    if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
813 813
 	    {
@@ -818,8 +818,8 @@  discard block
 block discarded – undo
818 818
 	
819 819
 
820 820
 	if ($origLat != "" && $origLon != "" && $dist != "") {
821
-		$dist = number_format($dist*0.621371,2,'.','');
822
-		$query="SELECT spotter_archive_output.*, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - ABS(CAST(spotter_archive.latitude as double precision)))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(ABS(CAST(spotter_archive.latitude as double precision))*pi()/180)*POWER(SIN(($origLon-CAST(spotter_archive.longitude as double precision))*pi()/180/2),2))) as distance 
821
+		$dist = number_format($dist*0.621371, 2, '.', '');
822
+		$query = "SELECT spotter_archive_output.*, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - ABS(CAST(spotter_archive.latitude as double precision)))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(ABS(CAST(spotter_archive.latitude as double precision))*pi()/180)*POWER(SIN(($origLon-CAST(spotter_archive.longitude as double precision))*pi()/180/2),2))) as distance 
823 823
                           FROM spotter_archive_output, spotter_archive WHERE spotter_output_archive.flightaware_id = spotter_archive.flightaware_id AND spotter_output.ident <> '' ".$additional_query."AND CAST(spotter_archive.longitude as double precision) between ($origLon-$dist/ABS(cos(radians($origLat))*69)) and ($origLon+$dist/ABS(cos(radians($origLat))*69)) and CAST(spotter_archive.latitude as double precision) between ($origLat-($dist/69)) and ($origLat+($dist/69)) 
824 824
                           AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - ABS(CAST(spotter_archive.latitude as double precision)))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(ABS(CAST(spotter_archive.latitude as double precision))*pi()/180)*POWER(SIN(($origLon-CAST(spotter_archive.longitude as double precision))*pi()/180/2),2)))) < $dist".$filter_query." ORDER BY distance";
825 825
 	} else {
@@ -836,12 +836,12 @@  discard block
 block discarded – undo
836 836
 			$additional_query .= " AND (spotter_archive_output.waypoints <> '')";
837 837
 		}
838 838
 
839
-		$query  = "SELECT spotter_archive_output.* FROM spotter_archive_output 
839
+		$query = "SELECT spotter_archive_output.* FROM spotter_archive_output 
840 840
 		    WHERE spotter_archive_output.ident <> '' 
841 841
 		    ".$additional_query."
842 842
 		    ".$filter_query.$orderby_query;
843 843
 	}
844
-	$spotter_array = $Spotter->getDataFromDB($query, $query_values,$limit_query);
844
+	$spotter_array = $Spotter->getDataFromDB($query, $query_values, $limit_query);
845 845
 
846 846
 	return $spotter_array;
847 847
     }
@@ -858,7 +858,7 @@  discard block
 block discarded – undo
858 858
                 try {
859 859
                         $sth = $this->db->prepare($query);
860 860
                         $sth->execute();
861
-                } catch(PDOException $e) {
861
+                } catch (PDOException $e) {
862 862
                         return "error";
863 863
                 }
864 864
 	}
@@ -895,8 +895,8 @@  discard block
 block discarded – undo
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
 	    {
@@ -926,7 +926,7 @@  discard block
 block discarded – undo
926 926
     * @return Array the airline country list
927 927
     *
928 928
     */
929
-    public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '')
929
+    public function countAllFlightOverCountries($limit = true, $olderthanmonths = 0, $sincedate = '')
930 930
     {
931 931
 	global $globalDBdriver;
932 932
 	/*
@@ -955,7 +955,7 @@  discard block
 block discarded – undo
955 955
 	$flight_array = array();
956 956
 	$temp_array = array();
957 957
         
958
-	while($row = $sth->fetch(PDO::FETCH_ASSOC))
958
+	while ($row = $sth->fetch(PDO::FETCH_ASSOC))
959 959
 	{
960 960
 	    $temp_array['flight_count'] = $row['nb'];
961 961
 	    $temp_array['flight_country'] = $row['name'];
@@ -972,14 +972,14 @@  discard block
 block discarded – undo
972 972
     * @return Array the spotter information
973 973
     *
974 974
     */
975
-    public function getDateArchiveSpotterDataById($id,$date)
975
+    public function getDateArchiveSpotterDataById($id, $date)
976 976
     {
977 977
 	$Spotter = new Spotter($this->db);
978 978
 	date_default_timezone_set('UTC');
979 979
 	$id = filter_var($id, FILTER_SANITIZE_STRING);
980
-	$query  = 'SELECT spotter_archive.* FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.flightaware_id = :id AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate ORDER BY spotter_archive.date DESC';
981
-	$date = date('c',$date);
982
-	$spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id,':date' => $date));
980
+	$query = 'SELECT spotter_archive.* FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.flightaware_id = :id AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate ORDER BY spotter_archive.date DESC';
981
+	$date = date('c', $date);
982
+	$spotter_array = $Spotter->getDataFromDB($query, array(':id' => $id, ':date' => $date));
983 983
 	return $spotter_array;
984 984
     }
985 985
 
@@ -989,14 +989,14 @@  discard block
 block discarded – undo
989 989
     * @return Array the spotter information
990 990
     *
991 991
     */
992
-    public function getDateArchiveSpotterDataByIdent($ident,$date)
992
+    public function getDateArchiveSpotterDataByIdent($ident, $date)
993 993
     {
994 994
 	$Spotter = new Spotter($this->db);
995 995
 	date_default_timezone_set('UTC');
996 996
 	$ident = filter_var($ident, FILTER_SANITIZE_STRING);
997
-	$query  = 'SELECT spotter_archive.* FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate ORDER BY spotter_archive.date DESC';
998
-	$date = date('c',$date);
999
-	$spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident,':date' => $date));
997
+	$query = 'SELECT spotter_archive.* FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate ORDER BY spotter_archive.date DESC';
998
+	$date = date('c', $date);
999
+	$spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident, ':date' => $date));
1000 1000
 	return $spotter_array;
1001 1001
     }
1002 1002
 
@@ -1006,7 +1006,7 @@  discard block
 block discarded – undo
1006 1006
     * @return Array the spotter information
1007 1007
     *
1008 1008
     */
1009
-    public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '',$filters = array())
1009
+    public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '', $filters = array())
1010 1010
     {
1011 1011
 	global $global_query;
1012 1012
 	$Spotter = new Spotter();
@@ -1014,7 +1014,7 @@  discard block
 block discarded – undo
1014 1014
 	$query_values = array();
1015 1015
 	$limit_query = '';
1016 1016
 	$additional_query = '';
1017
-	$filter_query = $this->getFilter($filters,true,true);
1017
+	$filter_query = $this->getFilter($filters, true, true);
1018 1018
 	
1019 1019
 	if ($airport != "")
1020 1020
 	{
@@ -1031,8 +1031,8 @@  discard block
 block discarded – undo
1031 1031
 	{
1032 1032
 	    $limit_array = explode(",", $limit);
1033 1033
 	    
1034
-	    $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1035
-	    $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1034
+	    $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1035
+	    $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1036 1036
 	    
1037 1037
 	    if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1038 1038
 	    {
Please login to merge, or discard this patch.
Braces   +34 added lines, -12 removed lines patch added patch discarded remove patch
@@ -15,8 +15,12 @@  discard block
 block discarded – undo
15 15
     */
16 16
     public function getFilter($filter = array(),$where = false,$and = false) {
17 17
 	global $globalFilter, $globalStatsFilters, $globalFilterName;
18
-	if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) $filter = array_merge($globalStatsFilters[$globalFilterName],$filter);
19
-	if (is_array($globalFilter)) $filter = array_merge($globalFilter,$filter);
18
+	if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) {
19
+		$filter = array_merge($globalStatsFilters[$globalFilterName],$filter);
20
+	}
21
+	if (is_array($globalFilter)) {
22
+		$filter = array_merge($globalFilter,$filter);
23
+	}
20 24
 	$filter_query_join = '';
21 25
 	$filter_query_where = '';
22 26
 	if (isset($filter['airlines']) && !empty($filter['airlines'])) {
@@ -44,8 +48,11 @@  discard block
 block discarded – undo
44 48
 		$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
45 49
 	    }
46 50
 	}
47
-	if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
48
-	elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND';
51
+	if ($filter_query_where == '' && $where) {
52
+		$filter_query_where = ' WHERE';
53
+	} elseif ($filter_query_where != '' && $and) {
54
+		$filter_query_where .= ' AND';
55
+	}
49 56
 	$filter_query = $filter_query_join.$filter_query_where;
50 57
 	return $filter_query;
51 58
     }
@@ -56,10 +63,17 @@  discard block
 block discarded – undo
56 63
 		if ($over_country == '') {
57 64
 			$Spotter = new Spotter($this->db);
58 65
 			$data_country = $Spotter->getCountryFromLatitudeLongitude($latitude,$longitude);
59
-			if (!empty($data_country)) $country = $data_country['iso2'];
60
-			else $country = '';
61
-		} else $country = $over_country;
62
-		if ($airline_type === NULL) $airline_type ='';
66
+			if (!empty($data_country)) {
67
+				$country = $data_country['iso2'];
68
+			} else {
69
+				$country = '';
70
+			}
71
+		} else {
72
+			$country = $over_country;
73
+		}
74
+		if ($airline_type === NULL) {
75
+			$airline_type ='';
76
+		}
63 77
 	
64 78
 		//if ($country == '') echo "\n".'************ UNKNOW COUNTRY ****************'."\n";
65 79
 		//else echo "\n".'*/*/*/*/*/*/*/ Country : '.$country.' */*/*/*/*/*/*/*/*/'."\n";
@@ -562,7 +576,9 @@  discard block
 block discarded – undo
562 576
 		    $additional_query .= "(spotter_archive_output.pilot_name like '%".$q_item."%') OR ";
563 577
 		    $additional_query .= "(spotter_archive_output.ident like '%".$q_item."%') OR ";
564 578
 		    $translate = $Translation->ident2icao($q_item);
565
-		    if ($translate != $q_item) $additional_query .= "(spotter_archive_output.ident like '%".$translate."%') OR ";
579
+		    if ($translate != $q_item) {
580
+		    	$additional_query .= "(spotter_archive_output.ident like '%".$translate."%') OR ";
581
+		    }
566 582
 		    $additional_query .= "(spotter_archive_output.highlight like '%".$q_item."%')";
567 583
 		    $additional_query .= ")";
568 584
 		}
@@ -780,7 +796,9 @@  discard block
 block discarded – undo
780 796
 		date_default_timezone_set($globalTimezone);
781 797
 		$datetime = new DateTime();
782 798
 		$offset = $datetime->format('P');
783
-	    } else $offset = '+00:00';
799
+	    } else {
800
+	    	$offset = '+00:00';
801
+	    }
784 802
 
785 803
 
786 804
 	    if ($date_array[1] != "")
@@ -944,9 +962,13 @@  discard block
 block discarded – undo
944 962
 				$query .= "AND date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
945 963
 			}
946 964
 		}
947
-                if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
965
+                if ($sincedate != '') {
966
+                	$query .= "AND date > '".$sincedate."' ";
967
+                }
948 968
 	$query .= "GROUP BY c.name, c.iso3, c.iso2 ORDER BY nb DESC";
949
-	if ($limit) $query .= " LIMIT 0,10";
969
+	if ($limit) {
970
+		$query .= " LIMIT 0,10";
971
+	}
950 972
       
951 973
 	
952 974
 	$sth = $this->db->prepare($query);
Please login to merge, or discard this patch.