Completed
Push — master ( 7b031c...3082e8 )
by Yannick
11:44
created
statistics-manufacturer.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -6,20 +6,20 @@  discard block
 block discarded – undo
6 6
 $title = _("Statistics").' - '._("Most common Aircraft Manufacturer");
7 7
 
8 8
 if (!isset($filter_name)) $filter_name = '';
9
-$airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING);
9
+$airline_icao = (string) filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING);
10 10
 if ($airline_icao == 'all') {
11 11
     unset($_COOKIE['stats_airline_icao']);
12
-    setcookie('stats_airline_icao', '', time()-3600);
12
+    setcookie('stats_airline_icao', '', time() - 3600);
13 13
     $airline_icao = '';
14 14
 } elseif ($airline_icao == '' && isset($_COOKIE['stats_airline_icao'])) {
15 15
     $airline_icao = $_COOKIE['stats_airline_icao'];
16 16
 } elseif ($airline_icao == '' && isset($globalFilter)) {
17 17
     if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
18 18
 }
19
-setcookie('stats_airline_icao',$airline_icao);
19
+setcookie('stats_airline_icao', $airline_icao);
20 20
 
21
-$year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT);
22
-$month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT);
21
+$year = filter_input(INPUT_GET, 'year', FILTER_SANITIZE_NUMBER_INT);
22
+$month = filter_input(INPUT_GET, 'month', FILTER_SANITIZE_NUMBER_INT);
23 23
 
24 24
 require_once('header.php');
25 25
 include('statistics-sub-menu.php'); 
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 		 </div>
31 31
     	<p>'._("Below are the <strong>Top 10</strong> most common aircraft manufacturers.").'</p>';
32 32
  
33
-$manufacturers_array = $Stats->countAllAircraftManufacturers(true,$airline_icao,$filter_name,$year,$month);
33
+$manufacturers_array = $Stats->countAllAircraftManufacturers(true, $airline_icao, $filter_name, $year, $month);
34 34
 print '<div id="chart" class="chart" width="100%"></div>
35 35
       	<script> 
36 36
       		google.load("visualization", "1", {packages:["corechart"]});
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
             var data = google.visualization.arrayToDataTable([
40 40
             	["'._("Aircraft Manufacturer").'", "'._("# of times").'"], ';
41 41
 $manufacturer_data = '';
42
-foreach($manufacturers_array as $manufacturer_item)
42
+foreach ($manufacturers_array as $manufacturer_item)
43 43
 {
44 44
 	$manufacturer_data .= '[ "'.$manufacturer_item['aircraft_manufacturer'].'",'.$manufacturer_item['aircraft_manufacturer_count'].'],';
45 45
 }
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 	print '</thead>';
73 73
 	print '<tbody>';
74 74
 	$i = 1;
75
-	foreach($manufacturers_array as $manufacturer_item)
75
+	foreach ($manufacturers_array as $manufacturer_item)
76 76
 	{
77 77
 		print '<tr>';
78 78
 		print '<td><strong>'.$i.'</strong></td>';
Please login to merge, or discard this patch.
statistics-sub-menu.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
 					} else {
20 20
 						print '<option value="all">All</option>';
21 21
 					}
22
-					foreach($airlines as $airline) {
22
+					foreach ($airlines as $airline) {
23 23
 						if (isset($airline_icao) && $airline_icao == $airline['airline_icao']) {
24 24
 							print '<option value="'.$airline['airline_icao'].'" selected>'.$airline['airline_name'].'</option>';
25 25
 						} else {
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 <div class="sub-menu sub-menu-container">
37 37
 	<ul class="nav">
38 38
 		<li class="dropdown">
39
-		    <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-aircraft" || strtolower($current_page) == "statistics-registration" || strtolower($current_page) == "statistics-manufacturer"){ print 'active'; } ?>" data-toggle="dropdown" href="#" >
39
+		    <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-aircraft" || strtolower($current_page) == "statistics-registration" || strtolower($current_page) == "statistics-manufacturer") { print 'active'; } ?>" data-toggle="dropdown" href="#" >
40 40
 		      <?php echo _("Aircraft"); ?> <span class="caret"></span>
41 41
 		    </a>
42 42
 		    <ul class="dropdown-menu">
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 		    </ul>
48 48
 		</li>
49 49
 		<li class="dropdown">
50
-		    <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-airline" || strtolower($current_page) == "statistics-airline-country" || strtolower($current_page) == "statistics-callsign"){ print 'active'; } ?>" data-toggle="dropdown" href="#">
50
+		    <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-airline" || strtolower($current_page) == "statistics-airline-country" || strtolower($current_page) == "statistics-callsign") { print 'active'; } ?>" data-toggle="dropdown" href="#">
51 51
 		      <?php echo _("Airline"); ?> <span class="caret"></span>
52 52
 		    </a>
53 53
 		    <ul class="dropdown-menu" role="menu">
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 		    </ul>
58 58
 		</li>
59 59
 		<li class="dropdown">
60
-		    <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-airport-departure" || strtolower($current_page) == "statistics-airport-departure-country" || strtolower($current_page) == "statistics-airport-arrival" || strtolower($current_page) == "statistics-airport-arrival-country"){ print 'active'; } ?>" data-toggle="dropdown" href="#">
60
+		    <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-airport-departure" || strtolower($current_page) == "statistics-airport-departure-country" || strtolower($current_page) == "statistics-airport-arrival" || strtolower($current_page) == "statistics-airport-arrival-country") { print 'active'; } ?>" data-toggle="dropdown" href="#">
61 61
 		      <?php echo _("Airport"); ?> <span class="caret"></span>
62 62
 		    </a>
63 63
 		    <ul class="dropdown-menu" role="menu">
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 		    </ul>
69 69
 		</li>
70 70
 		<li class="dropdown">
71
-		    <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-route-airport" || strtolower($current_page) == "statistics-route-waypoint"){ print 'active'; } ?>" data-toggle="dropdown" href="#">
71
+		    <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-route-airport" || strtolower($current_page) == "statistics-route-waypoint") { print 'active'; } ?>" data-toggle="dropdown" href="#">
72 72
 		      <?php echo _("Route"); ?> <span class="caret"></span>
73 73
 		    </a>
74 74
 		    <ul class="dropdown-menu" role="menu">
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 		    </ul>
78 78
 		</li>
79 79
 		<li class="dropdown">
80
-		    <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-date" || strtolower($current_page) == "statistics-time"){ print 'active'; } ?>" data-toggle="dropdown" href="#">
80
+		    <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-date" || strtolower($current_page) == "statistics-time") { print 'active'; } ?>" data-toggle="dropdown" href="#">
81 81
 		      <?php echo _("Date &amp; Time"); ?> <span class="caret"></span>
82 82
 		    </a>
83 83
 		    <ul class="dropdown-menu" role="menu">
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
 		    if (isset($globalAccidents) && $globalAccidents) {
90 90
 		?>
91 91
 		<li class="dropdown">
92
-		    <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-fatalities-year" || strtolower($current_page) == "statistics-fatalities-month"){ print 'active'; } ?>" data-toggle="dropdown" href="#">
92
+		    <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-fatalities-year" || strtolower($current_page) == "statistics-fatalities-month") { print 'active'; } ?>" data-toggle="dropdown" href="#">
93 93
 		      <?php echo _("Fatalities"); ?> <span class="caret"></span>
94 94
 		    </a>
95 95
 		    <ul class="dropdown-menu" role="menu">
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 <div class="sub-menu sub-menu-container">
109 109
 	<ul class="nav">
110 110
 		<li class="dropdown">
111
-		    <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-aircraft" || strtolower($current_page) == "statistics-registration" || strtolower($current_page) == "statistics-manufacturer"){ print 'active'; } ?>" data-toggle="dropdown" href="#" >
111
+		    <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-aircraft" || strtolower($current_page) == "statistics-registration" || strtolower($current_page) == "statistics-manufacturer") { print 'active'; } ?>" data-toggle="dropdown" href="#" >
112 112
 		      <?php echo _("Aircraft"); ?> <span class="caret"></span>
113 113
 		    </a>
114 114
 		    <ul class="dropdown-menu">
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 		    </ul>
120 120
 		</li>
121 121
 		<li class="dropdown">
122
-		    <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-airline" || strtolower($current_page) == "statistics-airline-country" || strtolower($current_page) == "statistics-callsign"){ print 'active'; } ?>" data-toggle="dropdown" href="#">
122
+		    <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-airline" || strtolower($current_page) == "statistics-airline-country" || strtolower($current_page) == "statistics-callsign") { print 'active'; } ?>" data-toggle="dropdown" href="#">
123 123
 		      <?php echo _("Airline"); ?> <span class="caret"></span>
124 124
 		    </a>
125 125
 		    <ul class="dropdown-menu" role="menu">
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
 		    </ul>
130 130
 		</li>
131 131
 		<li class="dropdown">
132
-		    <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-airport-departure" || strtolower($current_page) == "statistics-airport-departure-country" || strtolower($current_page) == "statistics-airport-arrival" || strtolower($current_page) == "statistics-airport-arrival-country"){ print 'active'; } ?>" data-toggle="dropdown" href="#">
132
+		    <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-airport-departure" || strtolower($current_page) == "statistics-airport-departure-country" || strtolower($current_page) == "statistics-airport-arrival" || strtolower($current_page) == "statistics-airport-arrival-country") { print 'active'; } ?>" data-toggle="dropdown" href="#">
133 133
 		      <?php echo _("Airport"); ?> <span class="caret"></span>
134 134
 		    </a>
135 135
 		    <ul class="dropdown-menu" role="menu">
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 		</li>
142 142
 		<!--
143 143
 		<li class="dropdown">
144
-		    <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-route-airport" || strtolower($current_page) == "statistics-route-waypoint"){ print 'active'; } ?>" data-toggle="dropdown" href="#">
144
+		    <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-route-airport" || strtolower($current_page) == "statistics-route-waypoint") { print 'active'; } ?>" data-toggle="dropdown" href="#">
145 145
 		      <?php echo _("Route"); ?> <span class="caret"></span>
146 146
 		    </a>
147 147
 		    <ul class="dropdown-menu" role="menu">
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
 		-->
153 153
 		<!--
154 154
 		<li class="dropdown">
155
-		    <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-date" || strtolower($current_page) == "statistics-time"){ print 'active'; } ?>" data-toggle="dropdown" href="#">
155
+		    <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-date" || strtolower($current_page) == "statistics-time") { print 'active'; } ?>" data-toggle="dropdown" href="#">
156 156
 		      <?php echo _("Date &amp; Time"); ?> <span class="caret"></span>
157 157
 		    </a>
158 158
 		    <ul class="dropdown-menu" role="menu">
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
 		?>
167 167
 		<!--
168 168
 		<li class="dropdown">
169
-		    <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-fatalities-year" || strtolower($current_page) == "statistics-fatalities-month"){ print 'active'; } ?>" data-toggle="dropdown" href="#">
169
+		    <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-fatalities-year" || strtolower($current_page) == "statistics-fatalities-month") { print 'active'; } ?>" data-toggle="dropdown" href="#">
170 170
 		      <?php echo _("Fatalities"); ?> <span class="caret"></span>
171 171
 		    </a>
172 172
 		    <ul class="dropdown-menu" role="menu">
Please login to merge, or discard this patch.
statistics-airline.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -6,8 +6,8 @@  discard block
 block discarded – undo
6 6
 $title = _("Statistics").' - '._("Most common Airline");
7 7
 require_once('header.php');
8 8
 if (!isset($filter_name)) $filter_name = '';
9
-$year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT);
10
-$month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT);
9
+$year = filter_input(INPUT_GET, 'year', FILTER_SANITIZE_NUMBER_INT);
10
+$month = filter_input(INPUT_GET, 'month', FILTER_SANITIZE_NUMBER_INT);
11 11
 include('statistics-sub-menu.php'); 
12 12
 
13 13
 print '<script type="text/javascript" src="https://www.google.com/jsapi"></script>
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
 	  </div>
17 17
     	<p>'._("Below are the <strong>Top 10</strong> most common airlines.").'</p>';
18 18
 
19
-$airline_array = $Stats->countAllAirlines(true,$filter_name,$year,$month);
19
+$airline_array = $Stats->countAllAirlines(true, $filter_name, $year, $month);
20 20
 print '<div id="chart" class="chart" width="100%"></div>
21 21
       	<script> 
22 22
       		google.load("visualization", "1", {packages:["corechart"]});
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
             var data = google.visualization.arrayToDataTable([
26 26
             	["'._("Airline").'", "'._("# of times").'"], ';
27 27
 $airline_data = '';
28
-foreach($airline_array as $airline_item)
28
+foreach ($airline_array as $airline_item)
29 29
 {
30 30
 	$airline_data .= '[ "'.$airline_item['airline_name'].' ('.$airline_item['airline_icao'].')",'.$airline_item['airline_count'].'],';
31 31
 }
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 	print '</thead>';
61 61
 	print '<tbody>';
62 62
 	$i = 1;
63
-	foreach($airline_array as $airline_item)
63
+	foreach ($airline_array as $airline_item)
64 64
 	{
65 65
 		print '<tr>';
66 66
 		print '<td><strong>'.$i.'</strong></td>';
Please login to merge, or discard this patch.
statistics-airport-arrival-country.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -6,19 +6,19 @@  discard block
 block discarded – undo
6 6
 $title = _("Statistics").' - '._("Most common Arrival Airport by Country");
7 7
 
8 8
 if (!isset($filter_name)) $filter_name = '';
9
-$airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING);
9
+$airline_icao = (string) filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING);
10 10
 if ($airline_icao == 'all') {
11 11
     unset($_COOKIE['stats_airline_icao']);
12
-    setcookie('stats_airline_icao', '', time()-3600);
12
+    setcookie('stats_airline_icao', '', time() - 3600);
13 13
     $airline_icao = '';
14 14
 } elseif ($airline_icao == '' && isset($_COOKIE['stats_airline_icao'])) {
15 15
     $airline_icao = $_COOKIE['stats_airline_icao'];
16 16
 } elseif ($airline_icao == '' && isset($globalFilter)) {
17 17
     if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
18 18
 }
19
-setcookie('stats_airline_icao',$airline_icao);
20
-$year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT);
21
-$month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT);
19
+setcookie('stats_airline_icao', $airline_icao);
20
+$year = filter_input(INPUT_GET, 'year', FILTER_SANITIZE_NUMBER_INT);
21
+$month = filter_input(INPUT_GET, 'month', FILTER_SANITIZE_NUMBER_INT);
22 22
 require_once('header.php');
23 23
 include('statistics-sub-menu.php'); 
24 24
 
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 	  </div>
29 29
     	 <p>'._("Below are the <strong>Top 10</strong> most common countries of all the arrival airports.").'</p>';
30 30
 
31
-$airport_country_array = $Stats->countAllArrivalCountries(true,$airline_icao,$filter_name,$year,$month);
31
+$airport_country_array = $Stats->countAllArrivalCountries(true, $airline_icao, $filter_name, $year, $month);
32 32
 
33 33
 print '<script>
34 34
     	google.load("visualization", "1", {packages:["geochart"]});
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
         	["'._("Country").'", "'._("# of times").'"],';
43 43
 
44 44
 $country_data = '';
45
-foreach($airport_country_array as $airport_item)
45
+foreach ($airport_country_array as $airport_item)
46 46
 {
47 47
 	$country_data .= '[ "'.$airport_item['airport_arrival_country'].'",'.$airport_item['airport_arrival_country_count'].'],';
48 48
 }
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 print '</thead>';
78 78
 print '<tbody>';
79 79
 $i = 1;
80
-foreach($airport_country_array as $airport_item)
80
+foreach ($airport_country_array as $airport_item)
81 81
 {
82 82
 	print '<tr>';
83 83
 	print '<td><strong>'.$i.'</strong></td>';
Please login to merge, or discard this patch.
statistics.php 1 patch
Spacing   +82 added lines, -82 removed lines patch added patch discarded remove patch
@@ -7,20 +7,20 @@  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
 
22
-$year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT);
23
-$month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT);
22
+$year = filter_input(INPUT_GET, 'year', FILTER_SANITIZE_NUMBER_INT);
23
+$month = filter_input(INPUT_GET, 'month', FILTER_SANITIZE_NUMBER_INT);
24 24
 
25 25
 require_once('header.php');
26 26
 
@@ -41,55 +41,55 @@  discard block
 block discarded – undo
41 41
 		date_default_timezone_set('UTC');
42 42
 		$lastupdate = strtotime($last_update[0]['value']);
43 43
 		if (isset($globalTimezone) && $globalTimezone != '') date_default_timezone_set($globalTimezone);
44
-		print '<i>Last update: '.date('Y-m-d G:i:s',$lastupdate).'</i>';
44
+		print '<i>Last update: '.date('Y-m-d G:i:s', $lastupdate).'</i>';
45 45
 	}
46 46
     ?>
47 47
     </div>
48 48
     <?php include('statistics-sub-menu.php'); ?>
49 49
     <p class="global-stats">
50
-        <span><span class="badge"><?php print number_format($Stats->countOverallFlights($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Flights"); ?></span>
51
-	<!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
52
-        <span><span class="badge"><?php print number_format($Stats->countOverallArrival($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Arrivals seen"); ?></span>
53
-        <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
50
+        <span><span class="badge"><?php print number_format($Stats->countOverallFlights($airline_icao, $filter_name, $year, $month)); ?></span> <?php echo _("Flights"); ?></span>
51
+	<!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
52
+        <span><span class="badge"><?php print number_format($Stats->countOverallArrival($airline_icao, $filter_name, $year, $month)); ?></span> <?php echo _("Arrivals seen"); ?></span>
53
+        <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
54 54
 	<?php
55 55
 	    if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) {
56 56
 	?>
57
-    	    <span><span class="badge"><?php print number_format($Stats->countOverallPilots($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Pilots"); ?></span>
58
-	    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
57
+    	    <span><span class="badge"><?php print number_format($Stats->countOverallPilots($airline_icao, $filter_name, $year, $month)); ?></span> <?php echo _("Pilots"); ?></span>
58
+	    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
59 59
         <?php
60 60
     	    } else {
61 61
     	?>
62
-    	    <span><span class="badge"><?php print number_format($Stats->countOverallOwners($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Owners"); ?></span>
63
-	    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
62
+    	    <span><span class="badge"><?php print number_format($Stats->countOverallOwners($airline_icao, $filter_name, $year, $month)); ?></span> <?php echo _("Owners"); ?></span>
63
+	    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
64 64
     	<?php
65 65
     	    }
66 66
     	?>
67
-        <span><span class="badge"><?php print number_format($Stats->countOverallAircrafts($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Aircrafts types"); ?></span>
68
-        <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
67
+        <span><span class="badge"><?php print number_format($Stats->countOverallAircrafts($airline_icao, $filter_name, $year, $month)); ?></span> <?php echo _("Aircrafts types"); ?></span>
68
+        <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
69 69
         <?php
70 70
     		if ($airline_icao == '') {
71 71
     	?>
72
-        <span><span class="badge"><?php print number_format($Stats->countOverallAirlines($filter_name,$year,$month)); ?></span> <?php echo _("Airlines"); ?></span>
73
-	<!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
72
+        <span><span class="badge"><?php print number_format($Stats->countOverallAirlines($filter_name, $year, $month)); ?></span> <?php echo _("Airlines"); ?></span>
73
+	<!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
74 74
 	<?php
75 75
 		}
76 76
 	?>
77 77
 	<?php
78 78
 		if (!(isset($globalIVAO) && $globalIVAO) && !(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalphpVMS) && $globalphpVMS)) {
79 79
 	?>
80
-        <span><span class="badge"><?php print number_format($Stats->countOverallMilitaryFlights($filter_name,$year,$month)); ?></span> <?php echo _("Military"); ?></span>
81
-	<!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
80
+        <span><span class="badge"><?php print number_format($Stats->countOverallMilitaryFlights($filter_name, $year, $month)); ?></span> <?php echo _("Military"); ?></span>
81
+	<!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
82 82
 	<?php
83 83
 		}
84 84
 	?>
85 85
     </p>
86
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
86
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
87 87
     <div class="specific-stats">
88 88
         <div class="row column">
89 89
             <div class="col-md-6">
90 90
                 <h2><?php echo _("Top 10 Most Common Aircraft Type"); ?></h2>
91 91
                  <?php
92
-                  $aircraft_array = $Stats->countAllAircraftTypes(true,$airline_icao,$filter_name,$year,$month);
92
+                  $aircraft_array = $Stats->countAllAircraftTypes(true, $airline_icao, $filter_name, $year, $month);
93 93
 		    if (count($aircraft_array) == 0) print _("No data available");
94 94
 		    else {
95 95
 
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
                         var data = google.visualization.arrayToDataTable([
102 102
                             ["'._("Aircraft").'", "'._("# of times").'"], ';
103 103
                             $aircraft_data = '';
104
-                          foreach($aircraft_array as $aircraft_item)
104
+                          foreach ($aircraft_array as $aircraft_item)
105 105
                                     {
106 106
                                             $aircraft_data .= '[ "'.$aircraft_item['aircraft_manufacturer'].' '.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],';
107 107
                                     }
@@ -138,11 +138,11 @@  discard block
 block discarded – undo
138 138
             	    ?>
139 139
                 </div>
140 140
             </div>
141
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
141
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
142 142
 <?php
143 143
 //    echo $airline_icao;
144 144
     if ($airline_icao == '' || $airline_icao == 'all') {
145
-	$airline_array = $Stats->countAllAirlines(true,$filter_name,$year,$month);
145
+	$airline_array = $Stats->countAllAirlines(true, $filter_name, $year, $month);
146 146
 	if (count($airline_array) > 0) {
147 147
             print '<div class="col-md-6">';
148 148
 	    print '<h2>'._("Top 10 Most Common Airline").'</h2>';
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
                         var data = google.visualization.arrayToDataTable([
155 155
                             ["'._("Airline").'", "'._("# of times").'"], ';
156 156
 	    $airline_data = '';
157
-	    foreach($airline_array as $airline_item)
157
+	    foreach ($airline_array as $airline_item)
158 158
 	    {
159 159
 		$airline_data .= '[ "'.$airline_item['airline_name'].' ('.$airline_item['airline_icao'].')",'.$airline_item['airline_count'].'],';
160 160
 	    }
@@ -184,13 +184,13 @@  discard block
 block discarded – undo
184 184
 	}
185 185
 ?>
186 186
         </div>
187
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
187
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
188 188
 <?php
189 189
     }
190 190
 ?>
191 191
         <div class="row column">
192 192
 <?php
193
-    $flightover_array = $Stats->countAllFlightOverCountries($airline_icao,$filter_name,$year,$month);
193
+    $flightover_array = $Stats->countAllFlightOverCountries($airline_icao, $filter_name, $year, $month);
194 194
     if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) {
195 195
 	if (empty($flightover_array)) {
196 196
 	    print '<div class="col-md-12">';
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
 ?>
201 201
                 <h2><?php echo _("Top 10 Most Common Pilots"); ?></h2>
202 202
 <?php
203
-	$pilot_array = $Stats->countAllPilots(true,$airline_icao,$filter_name,$year,$month);
203
+	$pilot_array = $Stats->countAllPilots(true, $airline_icao, $filter_name, $year, $month);
204 204
 	if (count($pilot_array) == 0) print _("No data available");
205 205
 	else {
206 206
 	    print '<div id="chart7" class="chart" width="100%"></div>
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
                         var data = google.visualization.arrayToDataTable([
212 212
                             ["'._("Pilots").'", "'._("# of times").'"], ';
213 213
 	    $pilot_data = '';
214
-	    foreach($pilot_array as $pilot_item)
214
+	    foreach ($pilot_array as $pilot_item)
215 215
 	    {
216 216
 		$pilot_data .= '[ "'.$pilot_item['pilot_name'].' ('.$pilot_item['pilot_id'].')",'.$pilot_item['pilot_count'].'],';
217 217
 	    }
@@ -239,14 +239,14 @@  discard block
 block discarded – undo
239 239
 ?>
240 240
             </div>
241 241
         
242
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
242
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
243 243
 <?php
244 244
     } else {
245 245
 ?>
246 246
             <div class="col-md-6">
247 247
                 <h2><?php echo _("Top 10 Most Common Owners"); ?></h2>
248 248
 <?php
249
-	$owner_array = $Stats->countAllOwners(true,$airline_icao,$filter_name,$year,$month);
249
+	$owner_array = $Stats->countAllOwners(true, $airline_icao, $filter_name, $year, $month);
250 250
 	if (count($owner_array) == 0) print _("No data available");
251 251
 	else {
252 252
 	    print '<div id="chart7" class="chart" width="100%"></div>
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
                         var data = google.visualization.arrayToDataTable([
258 258
                             ["'._("Owner").'", "'._("# of times").'"], ';
259 259
                             $owner_data = '';
260
-	    foreach($owner_array as $owner_item)
260
+	    foreach ($owner_array as $owner_item)
261 261
 	    {
262 262
 		$owner_data .= '[ "'.$owner_item['owner_name'].'",'.$owner_item['owner_count'].'],';
263 263
 	    }
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
                 </div>
286 286
             </div>
287 287
         
288
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
288
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
289 289
 <?php
290 290
     }
291 291
     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,14 +337,14 @@  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>
344 344
         <div class="row column">
345 345
             <div class="col-md-6">
346 346
 <?php
347
-    $airport_airport_array = $Stats->countAllDepartureAirports(true,$airline_icao,$filter_name,$year,$month);
347
+    $airport_airport_array = $Stats->countAllDepartureAirports(true, $airline_icao, $filter_name, $year, $month);
348 348
     if (count($airport_airport_array) > 0) {
349 349
 	print '<h2>'._("Top 10 Most Common Departure Airports").'</h2>';
350 350
 	print '<div id="chart3" class="chart" width="100%"></div>
@@ -359,7 +359,7 @@  discard block
 block discarded – undo
359 359
                 var data = google.visualization.arrayToDataTable([ 
360 360
                     ["'._("Airport").'", "'._("# of times").'"],';
361 361
                     $airport_data = '';
362
-	foreach($airport_airport_array as $airport_item)
362
+	foreach ($airport_airport_array as $airport_item)
363 363
 	{
364 364
 	    $name = $airport_item['airport_departure_city'].', '.$airport_item['airport_departure_country'].' ('.$airport_item['airport_departure_icao'].')';
365 365
 	    $name = str_replace("'", "", $name);
@@ -386,11 +386,11 @@  discard block
 block discarded – undo
386 386
     }
387 387
 ?>
388 388
             </div>
389
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
389
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
390 390
 
391 391
             <div class="col-md-6">
392 392
 <?php
393
-    $airport_airport_array2 = $Stats->countAllArrivalAirports(true,$airline_icao,$filter_name,$year,$month);
393
+    $airport_airport_array2 = $Stats->countAllArrivalAirports(true, $airline_icao, $filter_name, $year, $month);
394 394
     if (count($airport_airport_array2) > 0) {
395 395
 	print '<h2>'._("Top 10 Most Common Arrival Airports").'</h2>';
396 396
 	print '<div id="chart4" class="chart" width="100%"></div>
@@ -405,10 +405,10 @@  discard block
 block discarded – undo
405 405
                 var data = google.visualization.arrayToDataTable([ 
406 406
                     ["'._("Airport").'", "'._("# of times").'"],';
407 407
 	$airport_data2 = '';
408
-	foreach($airport_airport_array2 as $airport_item2)
408
+	foreach ($airport_airport_array2 as $airport_item2)
409 409
 	{
410 410
 	    $name2 = $airport_item2['airport_arrival_city'].', '.$airport_item2['airport_arrival_country'].' ('.$airport_item2['airport_arrival_icao'].')';
411
-	    $name2 = str_replace(array("'",'"'), '', $name2);
411
+	    $name2 = str_replace(array("'", '"'), '', $name2);
412 412
 	    $airport_data2 .= '[ "'.$name2.'",'.$airport_item2['airport_arrival_icao_count'].'],';
413 413
 	}
414 414
 	$airport_data2 = substr($airport_data2, 0, -1);
@@ -432,7 +432,7 @@  discard block
 block discarded – undo
432 432
 ?>
433 433
             </div>
434 434
         </div>
435
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
435
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
436 436
 <?php
437 437
     if ($year == '' && $month == '') {
438 438
 ?>
@@ -440,7 +440,7 @@  discard block
 block discarded – undo
440 440
             <div class="col-md-6">
441 441
                 <h2><?php echo _("Busiest Months of the last 12 Months"); ?></h2>
442 442
                 <?php
443
-                  $year_array = $Stats->countAllMonthsLastYear(true,$airline_icao,$filter_name);
443
+                  $year_array = $Stats->countAllMonthsLastYear(true, $airline_icao, $filter_name);
444 444
 		    if (count($year_array) == 0) print _("No data available");
445 445
 		    else {
446 446
                   print '<div id="chart8" class="chart" width="100%"></div>
@@ -451,9 +451,9 @@  discard block
 block discarded – undo
451 451
                         var data = google.visualization.arrayToDataTable([
452 452
                             ["'._("Month").'", "'._("# of Flights").'"], ';
453 453
                             $year_data = '';
454
-                          foreach($year_array as $year_item)
454
+                          foreach ($year_array as $year_item)
455 455
                                     {
456
-                                        $year_data .= '[ "'.date('F, Y',strtotime($year_item['year_name'].'-'.$year_item['month_name'].'-01')).'",'.$year_item['date_count'].'],';
456
+                                        $year_data .= '[ "'.date('F, Y', strtotime($year_item['year_name'].'-'.$year_item['month_name'].'-01')).'",'.$year_item['date_count'].'],';
457 457
                                     }
458 458
                                     $year_data = substr($year_data, 0, -1);
459 459
                                     print $year_data;
@@ -481,11 +481,11 @@  discard block
 block discarded – undo
481 481
                     <a href="<?php print $globalURL; ?>/statistics/year" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
482 482
                 </div>
483 483
             </div>
484
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
484
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
485 485
             <div class="col-md-6">
486 486
                 <h2><?php echo _("Busiest Day in the last Month"); ?></h2>
487 487
                 <?php
488
-                  $month_array = $Stats->countAllDatesLastMonth($airline_icao,$filter_name);
488
+                  $month_array = $Stats->countAllDatesLastMonth($airline_icao, $filter_name);
489 489
 		    if (count($month_array) == 0) print _("No data available");
490 490
 		    else {
491 491
                   print '<div id="chart9" class="chart" width="100%"></div>
@@ -496,9 +496,9 @@  discard block
 block discarded – undo
496 496
                         var data = google.visualization.arrayToDataTable([
497 497
                             ["'._("Day").'", "'._("# of Flights").'"], ';
498 498
                             $month_data = '';
499
-                          foreach($month_array as $month_item)
499
+                          foreach ($month_array as $month_item)
500 500
                                     {
501
-                                        $month_data .= '[ "'.date('F j, Y',strtotime($month_item['date_name'])).'",'.$month_item['date_count'].'],';
501
+                                        $month_data .= '[ "'.date('F j, Y', strtotime($month_item['date_name'])).'",'.$month_item['date_count'].'],';
502 502
                                     }
503 503
                                     $month_data = substr($month_data, 0, -1);
504 504
                                     print $month_data;
@@ -526,12 +526,12 @@  discard block
 block discarded – undo
526 526
                     <a href="<?php print $globalURL; ?>/statistics/month" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
527 527
                 </div>
528 528
             </div>
529
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
529
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
530 530
 
531 531
             <div class="col-md-6">
532 532
                 <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2>
533 533
                 <?php
534
-                    $date_array = $Stats->countAllDatesLast7Days($airline_icao,$filter_name);
534
+                    $date_array = $Stats->countAllDatesLast7Days($airline_icao, $filter_name);
535 535
 		    if (empty($date_array)) print _("No data available");
536 536
 		    else {
537 537
                   print '<div id="chart5" class="chart" width="100%"></div>
@@ -543,7 +543,7 @@  discard block
 block discarded – undo
543 543
                             ["'._("Date").'", "'._("# of Flights").'"], ';
544 544
                             $date_data = '';
545 545
                         
546
-                          foreach($date_array as $date_item)
546
+                          foreach ($date_array as $date_item)
547 547
                                     {
548 548
                                         $date_data .= '[ "'.date("F j, Y", strtotime($date_item['date_name'])).'",'.$date_item['date_count'].'],';
549 549
                                     }
@@ -573,11 +573,11 @@  discard block
 block discarded – undo
573 573
                     <a href="<?php print $globalURL; ?>/statistics/date" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
574 574
                 </div>
575 575
             </div>
576
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
576
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
577 577
             <div class="col-md-6">
578 578
                 <h2><?php echo _("Busiest Time of the Day"); ?></h2>
579 579
                 <?php
580
-                  $hour_array = $Stats->countAllHours('hour',true,$airline_icao,$filter_name);
580
+                  $hour_array = $Stats->countAllHours('hour', true, $airline_icao, $filter_name);
581 581
 		    if (empty($hour_array)) print _("No data available");
582 582
 		    else {
583 583
 
@@ -589,7 +589,7 @@  discard block
 block discarded – undo
589 589
                         var data = google.visualization.arrayToDataTable([
590 590
                             ["'._("Hour").'", "'._("# of Flights").'"], ';
591 591
                             $hour_data = '';
592
-                          foreach($hour_array as $hour_item)
592
+                          foreach ($hour_array as $hour_item)
593 593
                                     {
594 594
                                         $hour_data .= '[ "'.$hour_item['hour_name'].':00",'.$hour_item['hour_count'].'],';
595 595
                                     }
@@ -619,7 +619,7 @@  discard block
 block discarded – undo
619 619
                     <a href="<?php print $globalURL; ?>/statistics/time" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
620 620
                 </div>
621 621
             </div>
622
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
622
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
623 623
         </div>
624 624
 <?php
625 625
     }
@@ -645,7 +645,7 @@  discard block
 block discarded – undo
645 645
                         var data = google.visualization.arrayToDataTable([
646 646
                             ["'._("Year").'", "'._("# of Fatalities").'"], ';
647 647
                             $year_data = '';
648
-                          foreach($year_array as $year_item)
648
+                          foreach ($year_array as $year_item)
649 649
                                     {
650 650
                                         $year_data .= '[ "'.$year_item['year'].'",'.$year_item['count'].'],';
651 651
                                     }
@@ -675,7 +675,7 @@  discard block
 block discarded – undo
675 675
                     <a href="<?php print $globalURL; ?>/statistics/fatalities/year" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
676 676
                 </div>
677 677
             </div>
678
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
678
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
679 679
 
680 680
         <div class="row column">
681 681
             <div class="col-md-6">
@@ -694,9 +694,9 @@  discard block
 block discarded – undo
694 694
                         var data = google.visualization.arrayToDataTable([
695 695
                             ["'._("Month").'", "'._("# of Fatalities").'"], ';
696 696
                             $year_data = '';
697
-                          foreach($year_array as $year_item)
697
+                          foreach ($year_array as $year_item)
698 698
                                     {
699
-                                        $year_data .= '[ "'.date('F, Y',strtotime($year_item['year'].'-'.$year_item['month'].'-01')).'",'.$year_item['count'].'],';
699
+                                        $year_data .= '[ "'.date('F, Y', strtotime($year_item['year'].'-'.$year_item['month'].'-01')).'",'.$year_item['count'].'],';
700 700
                                     }
701 701
                                     $year_data = substr($year_data, 0, -1);
702 702
                                     print $year_data;
@@ -724,7 +724,7 @@  discard block
 block discarded – undo
724 724
                     <a href="<?php print $globalURL; ?>/statistics/fatalities/month" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
725 725
                 </div>
726 726
             </div>
727
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
727
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
728 728
 <br/>
729 729
 <?php
730 730
     }
@@ -737,9 +737,9 @@  discard block
 block discarded – undo
737 737
         	<?php
738 738
         	    //$polar = $Stats->getStatsSource(date('Y-m-d'),'polar');
739 739
         	    if ($year == '' && $month == '') {
740
-		        $polar = $Stats->getStatsSource('polar',date('Y'),date('m'),date('d'));
740
+		        $polar = $Stats->getStatsSource('polar', date('Y'), date('m'), date('d'));
741 741
 		    } else {
742
-        		$polar = $Stats->getStatsSource('polar',$year,$month);
742
+        		$polar = $Stats->getStatsSource('polar', $year, $month);
743 743
         	    }
744 744
         	    if (!empty($polar)) {
745 745
             		print '<h2>'._("Coverage pattern").'</h2>';
@@ -747,7 +747,7 @@  discard block
 block discarded – undo
747 747
         		    unset($polar_data);
748 748
 	        	    $Spotter = new Spotter();
749 749
         		    $data = json_decode($eachpolar['source_data']);
750
-        		    foreach($data as $value => $key) {
750
+        		    foreach ($data as $value => $key) {
751 751
         			$direction = $Spotter->parseDirection(($value*22.5));
752 752
         			$distance = $key;
753 753
         			$unit = 'km';
@@ -767,7 +767,7 @@  discard block
 block discarded – undo
767 767
         	?>
768 768
             <div class="col-md-6">
769 769
                 <h4><?php print $eachpolar['source_name']; ?></h4>
770
-        	<div id="polar-<?php print str_replace(' ','_',strtolower($eachpolar['source_name'])); ?>" class="chart" width="100%"></div>
770
+        	<div id="polar-<?php print str_replace(' ', '_', strtolower($eachpolar['source_name'])); ?>" class="chart" width="100%"></div>
771 771
         	<script>
772 772
         	    (function() {
773 773
         	    var margin = {top: 100, right: 100, bottom: 100, left: 100},
@@ -791,7 +791,7 @@  discard block
 block discarded – undo
791 791
 		      color: color,
792 792
 		      unit: '<?php echo $unit; ?>'
793 793
 		    };
794
-		    RadarChart("#polar-<?php print str_replace(' ','_',strtolower($eachpolar['source_name'])); ?>", data, radarChartOptions);
794
+		    RadarChart("#polar-<?php print str_replace(' ', '_', strtolower($eachpolar['source_name'])); ?>", data, radarChartOptions);
795 795
 		    })();
796 796
 		</script>
797 797
             </div>
@@ -805,22 +805,22 @@  discard block
 block discarded – undo
805 805
         	<?php
806 806
         	    //$msg = $Stats->getStatsSource(date('Y-m-d'),'msg');
807 807
         	    if ($year == '' && $month == '') {
808
-        		$msg = $Stats->getStatsSource('msg',date('Y'),date('m'),date('d'));
808
+        		$msg = $Stats->getStatsSource('msg', date('Y'), date('m'), date('d'));
809 809
         	    } else {
810
-        		$msg = $Stats->getStatsSource('msg',$year,$month);
810
+        		$msg = $Stats->getStatsSource('msg', $year, $month);
811 811
         	    }
812 812
         	    if (!empty($msg)) {
813 813
             		print '<h2>'._("Messages received").'</h2>';
814 814
         		foreach ($msg as $eachmsg) {
815 815
         		    //$eachmsg = $msg[0];
816 816
         		    $data = $eachmsg['source_data'];
817
-        		    if ($data > 500) $max = (round(($data+100)/100))*100;
817
+        		    if ($data > 500) $max = (round(($data + 100)/100))*100;
818 818
         		    else $max = 500;
819 819
         	?>
820
-        	<div id="msg-<?php print str_replace(' ','_',strtolower($eachmsg['source_name'])); ?>" class="col-md-4"></div>
820
+        	<div id="msg-<?php print str_replace(' ', '_', strtolower($eachmsg['source_name'])); ?>" class="col-md-4"></div>
821 821
         	<script>
822 822
 		      var g = new JustGage({
823
-			    id: "msg-<?php print str_replace(' ','_',strtolower($eachmsg['source_name'])); ?>",
823
+			    id: "msg-<?php print str_replace(' ', '_', strtolower($eachmsg['source_name'])); ?>",
824 824
 			    value: <?php echo $data; ?>,
825 825
 			    min: 0,
826 826
 			    max: <?php print $max; ?>,
@@ -842,15 +842,15 @@  discard block
 block discarded – undo
842 842
             <?php
843 843
 		//$hist = $Stats->getStatsSource(date('Y-m-d'),'hist');
844 844
 		if ($year == '' && $month == '') {
845
-			$hist = $Stats->getStatsSource('hist',date('Y'),date('m'),date('d'));
845
+			$hist = $Stats->getStatsSource('hist', date('Y'), date('m'), date('d'));
846 846
 		} else {
847
-			$hist = $Stats->getStatsSource('hist',$year,$month);
847
+			$hist = $Stats->getStatsSource('hist', $year, $month);
848 848
 		}
849 849
 		foreach ($hist as $hists) {
850 850
 			$hist_data = '';
851 851
 			$source = $hists['source_name'];
852 852
 			$hist_array = json_decode($hists['source_data']);
853
-			foreach($hist_array as $distance => $nb)
853
+			foreach ($hist_array as $distance => $nb)
854 854
 			{
855 855
 				$unit = 'km';
856 856
 				if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) {
@@ -868,13 +868,13 @@  discard block
 block discarded – undo
868 868
 			$hist_data = substr($hist_data, 0, -1);
869 869
             ?>
870 870
             <div class="col-md-6">
871
-                <h2><?php echo sprintf(_("Flights Distance for %s"),$source); ?></h2>
871
+                <h2><?php echo sprintf(_("Flights Distance for %s"), $source); ?></h2>
872 872
                 <?php
873
-                  print '<div id="charthist-'.str_replace(' ','_',strtolower($source)).'" class="chart" width="100%"></div>
873
+                  print '<div id="charthist-'.str_replace(' ', '_', strtolower($source)).'" class="chart" width="100%"></div>
874 874
                     <script> 
875 875
                         google.load("visualization", "1", {packages:["corechart"]});
876
-                      google.setOnLoadCallback(drawCharthist_'.str_replace(' ','_',strtolower($source)).');
877
-                      function drawCharthist_'.str_replace(' ','_',strtolower($source)).'() {
876
+                      google.setOnLoadCallback(drawCharthist_'.str_replace(' ', '_', strtolower($source)).');
877
+                      function drawCharthist_'.str_replace(' ', '_', strtolower($source)).'() {
878 878
                         var data = google.visualization.arrayToDataTable([
879 879
                             ["'._("Distance").'", "'._("# of Flights").'"], ';
880 880
                             print $hist_data;
@@ -889,16 +889,16 @@  discard block
 block discarded – undo
889 889
                             colors: ["#1a3151"]
890 890
                         };
891 891
 
892
-                        var chart = new google.visualization.AreaChart(document.getElementById("charthist-'.str_replace(' ','_',strtolower($source)).'"));
892
+                        var chart = new google.visualization.AreaChart(document.getElementById("charthist-'.str_replace(' ', '_', strtolower($source)).'"));
893 893
                         chart.draw(data, options);
894 894
                       }
895 895
                       $(window).resize(function(){
896
-                              drawCharthist_'.str_replace(' ','_',strtolower($source)).'();
896
+                              drawCharthist_'.str_replace(' ', '_', strtolower($source)).'();
897 897
                             });
898 898
                   </script>';
899 899
         	?>
900 900
     	    </div>
901
-	    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
901
+	    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
902 902
         	<?php
903 903
                   }
904 904
                 ?>
Please login to merge, or discard this patch.
statistics-registration.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -6,19 +6,19 @@  discard block
 block discarded – undo
6 6
 $title = _("Statistics").' - '._("Most common Aircraft Registrations");
7 7
 
8 8
 if (!isset($filter_name)) $filter_name = '';
9
-$airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING);
9
+$airline_icao = (string) filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING);
10 10
 if ($airline_icao == 'all') {
11 11
     unset($_COOKIE['stats_airline_icao']);
12
-    setcookie('stats_airline_icao', '', time()-3600);
12
+    setcookie('stats_airline_icao', '', time() - 3600);
13 13
     $airline_icao = '';
14 14
 } elseif ($airline_icao == '' && isset($_COOKIE['stats_airline_icao'])) {
15 15
     $airline_icao = $_COOKIE['stats_airline_icao'];
16 16
 } elseif ($airline_icao == '' && isset($globalFilter)) {
17 17
     if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
18 18
 }
19
-setcookie('stats_airline_icao',$airline_icao);
20
-$year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT);
21
-$month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT);
19
+setcookie('stats_airline_icao', $airline_icao);
20
+$year = filter_input(INPUT_GET, 'year', FILTER_SANITIZE_NUMBER_INT);
21
+$month = filter_input(INPUT_GET, 'month', FILTER_SANITIZE_NUMBER_INT);
22 22
 
23 23
 require_once('header.php');
24 24
 include('statistics-sub-menu.php'); 
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 	</div>
30 30
     	<p>'._("Below are the <strong>Top 10</strong> most common aircraft registrations.").'</p>';
31 31
   
32
-$registration_array = $Stats->countAllAircraftRegistrations(true,$airline_icao,$filter_name,$year,$month);
32
+$registration_array = $Stats->countAllAircraftRegistrations(true, $airline_icao, $filter_name, $year, $month);
33 33
 print '<div id="chart" class="chart" width="100%"></div>
34 34
       	    <script> 
35 35
       		google.load("visualization", "1", {packages:["corechart"]});
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
             var data = google.visualization.arrayToDataTable([
39 39
             	["'._("Aircraft Manufacturer").'", "'._("# of times").'"], ';
40 40
             	$registration_data = '';
41
-foreach($registration_array as $registration_item)
41
+foreach ($registration_array as $registration_item)
42 42
 {
43 43
 	$registration_data .= '[ "'.$registration_item['registration'].' - '.$registration_item['aircraft_name'].' ('.$registration_item['aircraft_icao'].')",'.$registration_item['aircraft_registration_count'].'],';
44 44
 }
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 	print '</thead>';
74 74
 	print '<tbody>';
75 75
 	$i = 1;
76
-	foreach($registration_array as $registration_item)
76
+	foreach ($registration_array as $registration_item)
77 77
 	{
78 78
 		print '<tr>';
79 79
 		print '<td><strong>'.$i.'</strong></td>';
Please login to merge, or discard this patch.
require/class.SpotterArchive.php 1 patch
Spacing   +107 added lines, -107 removed lines patch added patch discarded remove patch
@@ -13,45 +13,45 @@  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 18
 	$filters = array();
19 19
 	if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) {
20 20
 		if (isset($globalStatsFilters[$globalFilterName][0]['source'])) {
21 21
 			$filters = $globalStatsFilters[$globalFilterName];
22 22
 		} else {
23
-			$filter = array_merge($filter,$globalStatsFilters[$globalFilterName]);
23
+			$filter = array_merge($filter, $globalStatsFilters[$globalFilterName]);
24 24
 		}
25 25
 	}
26
-	if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter);
26
+	if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter);
27 27
 	$filter_query_join = '';
28 28
 	$filter_query_where = '';
29
-	foreach($filters as $flt) {
29
+	foreach ($filters as $flt) {
30 30
 	    if (isset($flt['airlines']) && !empty($flt['airlines'])) {
31 31
 		if ($flt['airlines'][0] != '') {
32 32
 		    if (isset($flt['source'])) {
33
-			$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','",$flt['airlines'])."') AND spotter_archive_output.format_source IN ('".implode("','",$flt['source'])."')) so ON so.flightaware_id = spotter_archive_output.flightaware_id";
33
+			$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','", $flt['airlines'])."') AND spotter_archive_output.format_source IN ('".implode("','", $flt['source'])."')) so ON so.flightaware_id = spotter_archive_output.flightaware_id";
34 34
 		    } else {
35
-			$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','",$flt['airlines'])."')) so ON so.flightaware_id = spotter_archive_output.flightaware_id";
35
+			$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','", $flt['airlines'])."')) so ON so.flightaware_id = spotter_archive_output.flightaware_id";
36 36
 		    }
37 37
 		}
38 38
 	    }
39 39
 	    if (isset($flt['pilots_id']) && !empty($flt['pilots_id'])) {
40 40
 		if (isset($flt['source'])) {
41
-		    $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."') AND spotter_archive_output.format_source IN ('".implode("','",$flt['source'])."')) so ON so.flightaware_id = spotter_archive_output.flightaware_id";
41
+		    $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.pilot_id IN ('".implode("','", $flt['pilots_id'])."') AND spotter_archive_output.format_source IN ('".implode("','", $flt['source'])."')) so ON so.flightaware_id = spotter_archive_output.flightaware_id";
42 42
 		} else {
43
-		    $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."')) so ON so.flightaware_id = spotter_archive_output.flightaware_id";
43
+		    $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.pilot_id IN ('".implode("','", $flt['pilots_id'])."')) so ON so.flightaware_id = spotter_archive_output.flightaware_id";
44 44
 		}
45 45
 	    }
46 46
 	    if ((isset($flt['airlines']) && empty($flt['airlines']) && isset($flt['pilots_id']) && empty($flt['pilots_id'])) || (!isset($flt['airlines']) && !isset($flt['pilots_id']))) {
47 47
 		if (isset($flt['source'])) {
48
-		    $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.format_source IN ('".implode("','",$flt['source'])."')) so ON so.flightaware_id = spotter_archive_output.flightaware_id";
48
+		    $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.format_source IN ('".implode("','", $flt['source'])."')) so ON so.flightaware_id = spotter_archive_output.flightaware_id";
49 49
 		}
50 50
 	    }
51 51
 	}
52 52
 	if (isset($filter['airlines']) && !empty($filter['airlines'])) {
53 53
 	    if ($filter['airlines'][0] != '') {
54
-		$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";
54
+		$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";
55 55
 	    }
56 56
 	}
57 57
 	
@@ -59,19 +59,19 @@  discard block
 block discarded – undo
59 59
 	    $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 ";
60 60
 	}
61 61
 	if (isset($filter['pilots_id']) && !empty($filter['pilots_id'])) {
62
-	    $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";
62
+	    $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";
63 63
 	}
64 64
 	if (isset($filter['source']) && !empty($filter['source'])) {
65
-	    $filter_query_where = " WHERE format_source IN ('".implode("','",$filter['source'])."')";
65
+	    $filter_query_where = " WHERE format_source IN ('".implode("','", $filter['source'])."')";
66 66
 	}
67 67
 	if (isset($filter['ident']) && !empty($filter['ident'])) {
68 68
 	    $filter_query_where = " WHERE ident = '".$filter['ident']."'";
69 69
 	}
70 70
 	if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
71 71
 	    if ($filter_query_where == '') {
72
-		$filter_query_where = " WHERE format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
72
+		$filter_query_where = " WHERE format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')";
73 73
 	    } else {
74
-		$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
74
+		$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')";
75 75
 	    }
76 76
 	}
77 77
 	if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
@@ -81,28 +81,28 @@  discard block
 block discarded – undo
81 81
     }
82 82
 
83 83
 	// Spotter_archive
84
-	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 = '') {
84
+	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 = '') {
85 85
 		require_once(dirname(__FILE__).'/class.Spotter.php');
86 86
 		if ($over_country == '') {
87 87
 			$Spotter = new Spotter($this->db);
88
-			$data_country = $Spotter->getCountryFromLatitudeLongitude($latitude,$longitude);
88
+			$data_country = $Spotter->getCountryFromLatitudeLongitude($latitude, $longitude);
89 89
 			if (!empty($data_country)) $country = $data_country['iso2'];
90 90
 			else $country = '';
91 91
 		} else $country = $over_country;
92
-		if ($airline_type === NULL) $airline_type ='';
92
+		if ($airline_type === NULL) $airline_type = '';
93 93
 	
94 94
 		//if ($country == '') echo "\n".'************ UNKNOW COUNTRY ****************'."\n";
95 95
 		//else echo "\n".'*/*/*/*/*/*/*/ Country : '.$country.' */*/*/*/*/*/*/*/*/'."\n";
96 96
 
97 97
 		// Route is not added in spotter_archive
98
-		$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)
98
+		$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)
99 99
 		        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)";
100 100
 
101
-		$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);
101
+		$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);
102 102
 		try {
103 103
 			$sth = $this->db->prepare($query);
104 104
 			$sth->execute($query_values);
105
-		} catch(PDOException $e) {
105
+		} catch (PDOException $e) {
106 106
 			return "error : ".$e->getMessage();
107 107
 		}
108 108
 		return "success";
@@ -122,9 +122,9 @@  discard block
 block discarded – undo
122 122
 
123 123
                 $ident = filter_var($ident, FILTER_SANITIZE_STRING);
124 124
                 //$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";
125
-                $query  = "SELECT spotter_archive.* FROM spotter_archive WHERE ident = :ident ORDER BY date DESC LIMIT 1";
125
+                $query = "SELECT spotter_archive.* FROM spotter_archive WHERE ident = :ident ORDER BY date DESC LIMIT 1";
126 126
 
127
-                $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident));
127
+                $spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident));
128 128
 
129 129
                 return $spotter_array;
130 130
         }
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
                 $id = filter_var($id, FILTER_SANITIZE_STRING);
144 144
                 //$query  = SpotterArchive->$global_query." WHERE spotter_archive.flightaware_id = :id";
145 145
                 //$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";
146
-                $query  = "SELECT * FROM spotter_archive WHERE flightaware_id = :id ORDER BY date DESC LIMIT 1";
146
+                $query = "SELECT * FROM spotter_archive WHERE flightaware_id = :id ORDER BY date DESC LIMIT 1";
147 147
 
148 148
 //              $spotter_array = Spotter->getDataFromDB($query,array(':id' => $id));
149 149
                   /*
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
                 }
157 157
                 $spotter_array = $sth->fetchAll(PDO->FETCH_ASSOC);
158 158
                 */
159
-                $spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id));
159
+                $spotter_array = $Spotter->getDataFromDB($query, array(':id' => $id));
160 160
 
161 161
                 return $spotter_array;
162 162
         }
@@ -171,14 +171,14 @@  discard block
 block discarded – undo
171 171
         {
172 172
                 date_default_timezone_set('UTC');
173 173
                 $id = filter_var($id, FILTER_SANITIZE_STRING);
174
-                $query  = $this->global_query." WHERE spotter_archive.flightaware_id = :id";
174
+                $query = $this->global_query." WHERE spotter_archive.flightaware_id = :id";
175 175
 
176 176
 //              $spotter_array = Spotter->getDataFromDB($query,array(':id' => $id));
177 177
 
178 178
                 try {
179 179
                         $sth = $this->db->prepare($query);
180 180
                         $sth->execute(array(':id' => $id));
181
-                } catch(PDOException $e) {
181
+                } catch (PDOException $e) {
182 182
                         echo $e->getMessage();
183 183
                         die;
184 184
                 }
@@ -197,14 +197,14 @@  discard block
 block discarded – undo
197 197
         {
198 198
                 date_default_timezone_set('UTC');
199 199
                 $id = filter_var($id, FILTER_SANITIZE_STRING);
200
-                $query  = "SELECT spotter_archive.latitude, spotter_archive.longitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id";
200
+                $query = "SELECT spotter_archive.latitude, spotter_archive.longitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id";
201 201
 
202 202
 //              $spotter_array = Spotter->getDataFromDB($query,array(':id' => $id));
203 203
 
204 204
                 try {
205 205
                         $sth = $this->db->prepare($query);
206 206
                         $sth->execute(array(':id' => $id));
207
-                } catch(PDOException $e) {
207
+                } catch (PDOException $e) {
208 208
                         echo $e->getMessage();
209 209
                         die;
210 210
                 }
@@ -226,12 +226,12 @@  discard block
 block discarded – undo
226 226
                 date_default_timezone_set('UTC');
227 227
 
228 228
                 $ident = filter_var($ident, FILTER_SANITIZE_STRING);
229
-                $query  = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.ident = :ident AND spotter_archive.latitude <> 0 AND spotter_archive.longitude <> 0 ORDER BY date";
229
+                $query = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.ident = :ident AND spotter_archive.latitude <> 0 AND spotter_archive.longitude <> 0 ORDER BY date";
230 230
 
231 231
                 try {
232 232
                         $sth = $this->db->prepare($query);
233 233
                         $sth->execute(array(':ident' => $ident));
234
-                } catch(PDOException $e) {
234
+                } catch (PDOException $e) {
235 235
                         echo $e->getMessage();
236 236
                         die;
237 237
                 }
@@ -252,12 +252,12 @@  discard block
 block discarded – undo
252 252
                 date_default_timezone_set('UTC');
253 253
 
254 254
                 $id = filter_var($id, FILTER_SANITIZE_STRING);
255
-                $query  = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id AND spotter_archive.latitude <> 0 AND spotter_archive.longitude <> 0 ORDER BY date";
255
+                $query = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id AND spotter_archive.latitude <> 0 AND spotter_archive.longitude <> 0 ORDER BY date";
256 256
 
257 257
                 try {
258 258
                         $sth = $this->db->prepare($query);
259 259
                         $sth->execute(array(':id' => $id));
260
-                } catch(PDOException $e) {
260
+                } catch (PDOException $e) {
261 261
                         echo $e->getMessage();
262 262
                         die;
263 263
                 }
@@ -278,12 +278,12 @@  discard block
 block discarded – undo
278 278
                 date_default_timezone_set('UTC');
279 279
 
280 280
                 $id = filter_var($id, FILTER_SANITIZE_STRING);
281
-                $query  = "SELECT spotter_archive.altitude, spotter_archive.ground_speed, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id ORDER BY date";
281
+                $query = "SELECT spotter_archive.altitude, spotter_archive.ground_speed, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id ORDER BY date";
282 282
 
283 283
                 try {
284 284
                         $sth = $this->db->prepare($query);
285 285
                         $sth->execute(array(':id' => $id));
286
-                } catch(PDOException $e) {
286
+                } catch (PDOException $e) {
287 287
                         echo $e->getMessage();
288 288
                         die;
289 289
                 }
@@ -305,13 +305,13 @@  discard block
 block discarded – undo
305 305
                 date_default_timezone_set('UTC');
306 306
 
307 307
                 $ident = filter_var($ident, FILTER_SANITIZE_STRING);
308
-                $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";
308
+                $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";
309 309
 //                $query  = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.ident = :ident";
310 310
 
311 311
                 try {
312 312
                         $sth = $this->db->prepare($query);
313 313
                         $sth->execute(array(':ident' => $ident));
314
-                } catch(PDOException $e) {
314
+                } catch (PDOException $e) {
315 315
                         echo $e->getMessage();
316 316
                         die;
317 317
                 }
@@ -328,13 +328,13 @@  discard block
 block discarded – undo
328 328
         * @return Array the spotter information
329 329
         *
330 330
         */
331
-        public function getSpotterArchiveData($ident,$flightaware_id,$date)
331
+        public function getSpotterArchiveData($ident, $flightaware_id, $date)
332 332
         {
333 333
     		$Spotter = new Spotter($this->db);
334 334
                 $ident = filter_var($ident, FILTER_SANITIZE_STRING);
335
-                $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";
335
+                $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";
336 336
 
337
-                $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident,':flightaware_id' => $flightaware_id,':date' => $date.'%'));
337
+                $spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident, ':flightaware_id' => $flightaware_id, ':date' => $date.'%'));
338 338
 
339 339
                 return $spotter_array;
340 340
         }
@@ -347,7 +347,7 @@  discard block
 block discarded – undo
347 347
                 try {
348 348
                         $sth = $this->db->prepare($query);
349 349
                         $sth->execute();
350
-                } catch(PDOException $e) {
350
+                } catch (PDOException $e) {
351 351
                         echo $e->getMessage();
352 352
                         die;
353 353
                 }
@@ -359,24 +359,24 @@  discard block
 block discarded – undo
359 359
         * @return Array the spotter information
360 360
         *
361 361
         */
362
-        public function getMinLiveSpotterData($begindate,$enddate,$filter = array())
362
+        public function getMinLiveSpotterData($begindate, $enddate, $filter = array())
363 363
         {
364 364
                 global $globalDBdriver, $globalLiveInterval;
365 365
                 date_default_timezone_set('UTC');
366 366
 
367 367
                 $filter_query = '';
368 368
                 if (isset($filter['source']) && !empty($filter['source'])) {
369
-                        $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') ";
369
+                        $filter_query .= " AND format_source IN ('".implode("','", $filter['source'])."') ";
370 370
                 }
371 371
                 // Use spotter_output also ?
372 372
                 if (isset($filter['airlines']) && !empty($filter['airlines'])) {
373
-                        $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 ";
373
+                        $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 ";
374 374
                 }
375 375
                 if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
376 376
                         $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 ";
377 377
                 }
378 378
                 if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
379
-                        $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
379
+                        $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')";
380 380
                 }
381 381
 
382 382
                 //if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
@@ -395,14 +395,14 @@  discard block
 block discarded – undo
395 395
 						GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id 
396 396
 				    AND spotter_archive.date = s.maxdate '.$filter_query.'LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON spotter_archive.aircraft_icao = a.icao';
397 397
 */
398
-			$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 
398
+			$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 
399 399
 				    FROM spotter_archive 
400 400
 				    INNER JOIN (SELECT * FROM aircraft) a on spotter_archive.aircraft_icao = a.icao
401 401
 				    WHERE spotter_archive.date BETWEEN '."'".$begindate."'".' AND '."'".$begindate."'".' 
402 402
                         	    '.$filter_query.' ORDER BY flightaware_id';
403 403
                 } else {
404 404
                         //$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';
405
-                        $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 
405
+                        $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 
406 406
                         	    FROM spotter_archive 
407 407
                         	    INNER JOIN (SELECT * FROM aircraft) a on spotter_archive.aircraft_icao = a.icao
408 408
                         	    WHERE spotter_archive.date >= '."'".$begindate."'".' AND spotter_archive.date <= '."'".$enddate."'".'
@@ -412,7 +412,7 @@  discard block
 block discarded – undo
412 412
                 try {
413 413
                         $sth = $this->db->prepare($query);
414 414
                         $sth->execute();
415
-                } catch(PDOException $e) {
415
+                } catch (PDOException $e) {
416 416
                         echo $e->getMessage();
417 417
                         die;
418 418
                 }
@@ -427,24 +427,24 @@  discard block
 block discarded – undo
427 427
         * @return Array the spotter information
428 428
         *
429 429
         */
430
-        public function getMinLiveSpotterDataPlayback($begindate,$enddate,$filter = array())
430
+        public function getMinLiveSpotterDataPlayback($begindate, $enddate, $filter = array())
431 431
         {
432 432
                 global $globalDBdriver, $globalLiveInterval;
433 433
                 date_default_timezone_set('UTC');
434 434
 
435 435
                 $filter_query = '';
436 436
                 if (isset($filter['source']) && !empty($filter['source'])) {
437
-                        $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') ";
437
+                        $filter_query .= " AND format_source IN ('".implode("','", $filter['source'])."') ";
438 438
                 }
439 439
                 // Should use spotter_output also ?
440 440
                 if (isset($filter['airlines']) && !empty($filter['airlines'])) {
441
-                        $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 ";
441
+                        $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 ";
442 442
                 }
443 443
                 if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
444 444
                         $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 ";
445 445
                 }
446 446
                 if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
447
-                        $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
447
+                        $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')";
448 448
                 }
449 449
 
450 450
                 //if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
@@ -454,7 +454,7 @@  discard block
 block discarded – undo
454 454
                     		    FROM spotter_archive 
455 455
                     		    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';
456 456
 			*/
457
-			$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 
457
+			$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 
458 458
 				    FROM spotter_archive_output 
459 459
 				    LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON spotter_archive_output.aircraft_icao = a.icao 
460 460
 				    WHERE (spotter_archive_output.date BETWEEN '."'".$begindate."'".' AND '."'".$enddate."'".') 
@@ -469,7 +469,7 @@  discard block
 block discarded – undo
469 469
                         	    WHERE spotter_archive_output.date >= '."'".$begindate."'".' AND spotter_archive_output.date <= '."'".$enddate."'".'
470 470
                         	    '.$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';
471 471
                         */
472
-                        $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
472
+                        $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
473 473
                         	    FROM spotter_archive_output 
474 474
                         	    INNER JOIN (SELECT * FROM aircraft) a on spotter_archive_output.aircraft_icao = a.icao
475 475
                         	    WHERE spotter_archive_output.date >= '."'".$begindate."'".' AND spotter_archive_output.date <= '."'".$enddate."'".'
@@ -481,7 +481,7 @@  discard block
 block discarded – undo
481 481
                 try {
482 482
                         $sth = $this->db->prepare($query);
483 483
                         $sth->execute();
484
-                } catch(PDOException $e) {
484
+                } catch (PDOException $e) {
485 485
                         echo $e->getMessage();
486 486
                         die;
487 487
                 }
@@ -496,23 +496,23 @@  discard block
 block discarded – undo
496 496
         * @return Array the spotter information
497 497
         *
498 498
         */
499
-        public function getLiveSpotterCount($begindate,$enddate,$filter = array())
499
+        public function getLiveSpotterCount($begindate, $enddate, $filter = array())
500 500
         {
501 501
                 global $globalDBdriver, $globalLiveInterval;
502 502
                 date_default_timezone_set('UTC');
503 503
 
504 504
                 $filter_query = '';
505 505
                 if (isset($filter['source']) && !empty($filter['source'])) {
506
-                        $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') ";
506
+                        $filter_query .= " AND format_source IN ('".implode("','", $filter['source'])."') ";
507 507
                 }
508 508
                 if (isset($filter['airlines']) && !empty($filter['airlines'])) {
509
-                        $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 ";
509
+                        $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 ";
510 510
                 }
511 511
                 if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
512 512
                         $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 ";
513 513
                 }
514 514
                 if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
515
-                        $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
515
+                        $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')";
516 516
                 }
517 517
 
518 518
                 //if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
@@ -527,7 +527,7 @@  discard block
 block discarded – undo
527 527
                 try {
528 528
                         $sth = $this->db->prepare($query);
529 529
                         $sth->execute();
530
-                } catch(PDOException $e) {
530
+                } catch (PDOException $e) {
531 531
                         echo $e->getMessage();
532 532
                         die;
533 533
                 }
@@ -547,7 +547,7 @@  discard block
 block discarded – undo
547 547
     * @return Array the spotter information
548 548
     *
549 549
     */
550
-    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())
550
+    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())
551 551
     {
552 552
 	global $globalTimezone, $globalDBdriver;
553 553
 	require_once(dirname(__FILE__).'/class.Translation.php');
@@ -569,7 +569,7 @@  discard block
 block discarded – undo
569 569
 	        
570 570
 		$q_array = explode(" ", $q);
571 571
 		
572
-		foreach ($q_array as $q_item){
572
+		foreach ($q_array as $q_item) {
573 573
 		    $additional_query .= " AND (";
574 574
 		    $additional_query .= "(spotter_archive_output.spotter_id like '%".$q_item."%') OR ";
575 575
 		    $additional_query .= "(spotter_archive_output.aircraft_icao like '%".$q_item."%') OR ";
@@ -601,7 +601,7 @@  discard block
 block discarded – undo
601 601
 	
602 602
 	if ($registration != "")
603 603
 	{
604
-	    $registration = filter_var($registration,FILTER_SANITIZE_STRING);
604
+	    $registration = filter_var($registration, FILTER_SANITIZE_STRING);
605 605
 	    if (!is_string($registration))
606 606
 	    {
607 607
 		return false;
@@ -612,7 +612,7 @@  discard block
 block discarded – undo
612 612
 	
613 613
 	if ($aircraft_icao != "")
614 614
 	{
615
-	    $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
615
+	    $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
616 616
 	    if (!is_string($aircraft_icao))
617 617
 	    {
618 618
 		return false;
@@ -623,7 +623,7 @@  discard block
 block discarded – undo
623 623
 	
624 624
 	if ($aircraft_manufacturer != "")
625 625
 	{
626
-	    $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
626
+	    $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
627 627
 	    if (!is_string($aircraft_manufacturer))
628 628
 	    {
629 629
 		return false;
@@ -644,7 +644,7 @@  discard block
 block discarded – undo
644 644
 	
645 645
 	if ($airline_icao != "")
646 646
 	{
647
-	    $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
647
+	    $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
648 648
 	    if (!is_string($airline_icao))
649 649
 	    {
650 650
 		return false;
@@ -655,7 +655,7 @@  discard block
 block discarded – undo
655 655
 	
656 656
 	if ($airline_country != "")
657 657
 	{
658
-	    $airline_country = filter_var($airline_country,FILTER_SANITIZE_STRING);
658
+	    $airline_country = filter_var($airline_country, FILTER_SANITIZE_STRING);
659 659
 	    if (!is_string($airline_country))
660 660
 	    {
661 661
 		return false;
@@ -666,7 +666,7 @@  discard block
 block discarded – undo
666 666
 	
667 667
 	if ($airline_type != "")
668 668
 	{
669
-	    $airline_type = filter_var($airline_type,FILTER_SANITIZE_STRING);
669
+	    $airline_type = filter_var($airline_type, FILTER_SANITIZE_STRING);
670 670
 	    if (!is_string($airline_type))
671 671
 	    {
672 672
 		return false;
@@ -688,7 +688,7 @@  discard block
 block discarded – undo
688 688
 	
689 689
 	if ($airport != "")
690 690
 	{
691
-	    $airport = filter_var($airport,FILTER_SANITIZE_STRING);
691
+	    $airport = filter_var($airport, FILTER_SANITIZE_STRING);
692 692
 	    if (!is_string($airport))
693 693
 	    {
694 694
 		return false;
@@ -699,7 +699,7 @@  discard block
 block discarded – undo
699 699
 	
700 700
 	if ($airport_country != "")
701 701
 	{
702
-	    $airport_country = filter_var($airport_country,FILTER_SANITIZE_STRING);
702
+	    $airport_country = filter_var($airport_country, FILTER_SANITIZE_STRING);
703 703
 	    if (!is_string($airport_country))
704 704
 	    {
705 705
 		return false;
@@ -710,7 +710,7 @@  discard block
 block discarded – undo
710 710
     
711 711
 	if ($callsign != "")
712 712
 	{
713
-	    $callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
713
+	    $callsign = filter_var($callsign, FILTER_SANITIZE_STRING);
714 714
 	    if (!is_string($callsign))
715 715
 	    {
716 716
 		return false;
@@ -718,7 +718,7 @@  discard block
 block discarded – undo
718 718
 		$translate = $Translation->ident2icao($callsign);
719 719
 		if ($translate != $callsign) {
720 720
 			$additional_query .= " AND (spotter_archive_output.ident = :callsign OR spotter_archive_output.ident = :translate)";
721
-			$query_values = array_merge($query_values,array(':callsign' => $callsign,':translate' => $translate));
721
+			$query_values = array_merge($query_values, array(':callsign' => $callsign, ':translate' => $translate));
722 722
 		} else {
723 723
 			$additional_query .= " AND (spotter_archive_output.ident = '".$callsign."')";
724 724
 		}
@@ -727,7 +727,7 @@  discard block
 block discarded – undo
727 727
 
728 728
 	if ($owner != "")
729 729
 	{
730
-	    $owner = filter_var($owner,FILTER_SANITIZE_STRING);
730
+	    $owner = filter_var($owner, FILTER_SANITIZE_STRING);
731 731
 	    if (!is_string($owner))
732 732
 	    {
733 733
 		return false;
@@ -738,7 +738,7 @@  discard block
 block discarded – undo
738 738
 
739 739
 	if ($pilot_name != "")
740 740
 	{
741
-	    $pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING);
741
+	    $pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING);
742 742
 	    if (!is_string($pilot_name))
743 743
 	    {
744 744
 		return false;
@@ -749,7 +749,7 @@  discard block
 block discarded – undo
749 749
 	
750 750
 	if ($pilot_id != "")
751 751
 	{
752
-	    $pilot_id = filter_var($pilot_id,FILTER_SANITIZE_NUMBER_INT);
752
+	    $pilot_id = filter_var($pilot_id, FILTER_SANITIZE_NUMBER_INT);
753 753
 	    if (!is_string($pilot_id))
754 754
 	    {
755 755
 		return false;
@@ -760,7 +760,7 @@  discard block
 block discarded – undo
760 760
 	
761 761
 	if ($departure_airport_route != "")
762 762
 	{
763
-	    $departure_airport_route = filter_var($departure_airport_route,FILTER_SANITIZE_STRING);
763
+	    $departure_airport_route = filter_var($departure_airport_route, FILTER_SANITIZE_STRING);
764 764
 	    if (!is_string($departure_airport_route))
765 765
 	    {
766 766
 		return false;
@@ -771,7 +771,7 @@  discard block
 block discarded – undo
771 771
 	
772 772
 	if ($arrival_airport_route != "")
773 773
 	{
774
-	    $arrival_airport_route = filter_var($arrival_airport_route,FILTER_SANITIZE_STRING);
774
+	    $arrival_airport_route = filter_var($arrival_airport_route, FILTER_SANITIZE_STRING);
775 775
 	    if (!is_string($arrival_airport_route))
776 776
 	    {
777 777
 		return false;
@@ -784,8 +784,8 @@  discard block
 block discarded – undo
784 784
 	{
785 785
 	    $altitude_array = explode(",", $altitude);
786 786
 	    
787
-	    $altitude_array[0] = filter_var($altitude_array[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
788
-	    $altitude_array[1] = filter_var($altitude_array[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
787
+	    $altitude_array[0] = filter_var($altitude_array[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
788
+	    $altitude_array[1] = filter_var($altitude_array[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
789 789
 	    
790 790
 
791 791
 	    if ($altitude_array[1] != "")
@@ -803,8 +803,8 @@  discard block
 block discarded – undo
803 803
 	{
804 804
 	    $date_array = explode(",", $date_posted);
805 805
 	    
806
-	    $date_array[0] = filter_var($date_array[0],FILTER_SANITIZE_STRING);
807
-	    $date_array[1] = filter_var($date_array[1],FILTER_SANITIZE_STRING);
806
+	    $date_array[0] = filter_var($date_array[0], FILTER_SANITIZE_STRING);
807
+	    $date_array[1] = filter_var($date_array[1], FILTER_SANITIZE_STRING);
808 808
 	    
809 809
 	    if ($globalTimezone != '') {
810 810
 		date_default_timezone_set($globalTimezone);
@@ -836,8 +836,8 @@  discard block
 block discarded – undo
836 836
 	{
837 837
 	    $limit_array = explode(",", $limit);
838 838
 	    
839
-	    $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
840
-	    $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
839
+	    $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
840
+	    $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
841 841
 	    
842 842
 	    if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
843 843
 	    {
@@ -848,8 +848,8 @@  discard block
 block discarded – undo
848 848
 	
849 849
 
850 850
 	if ($origLat != "" && $origLon != "" && $dist != "") {
851
-		$dist = number_format($dist*0.621371,2,'.','');
852
-		$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 
851
+		$dist = number_format($dist*0.621371, 2, '.', '');
852
+		$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 
853 853
                           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)) 
854 854
                           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";
855 855
 	} else {
@@ -866,12 +866,12 @@  discard block
 block discarded – undo
866 866
 			$additional_query .= " AND (spotter_archive_output.waypoints <> '')";
867 867
 		}
868 868
 
869
-		$query  = "SELECT spotter_archive_output.* FROM spotter_archive_output 
869
+		$query = "SELECT spotter_archive_output.* FROM spotter_archive_output 
870 870
 		    WHERE spotter_archive_output.ident <> '' 
871 871
 		    ".$additional_query."
872 872
 		    ".$filter_query.$orderby_query;
873 873
 	}
874
-	$spotter_array = $Spotter->getDataFromDB($query, $query_values,$limit_query);
874
+	$spotter_array = $Spotter->getDataFromDB($query, $query_values, $limit_query);
875 875
 
876 876
 	return $spotter_array;
877 877
     }
@@ -888,7 +888,7 @@  discard block
 block discarded – undo
888 888
                 try {
889 889
                         $sth = $this->db->prepare($query);
890 890
                         $sth->execute();
891
-                } catch(PDOException $e) {
891
+                } catch (PDOException $e) {
892 892
                         return "error";
893 893
                 }
894 894
 	}
@@ -925,8 +925,8 @@  discard block
 block discarded – undo
925 925
 	{
926 926
 	    $limit_array = explode(",", $limit);
927 927
 	    
928
-	    $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
929
-	    $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
928
+	    $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
929
+	    $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
930 930
 	    
931 931
 	    if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
932 932
 	    {
@@ -983,8 +983,8 @@  discard block
 block discarded – undo
983 983
 	{
984 984
 	    $limit_array = explode(",", $limit);
985 985
 	    
986
-	    $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
987
-	    $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
986
+	    $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
987
+	    $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
988 988
 	    
989 989
 	    if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
990 990
 	    {
@@ -1040,8 +1040,8 @@  discard block
 block discarded – undo
1040 1040
 	{
1041 1041
 	    $limit_array = explode(",", $limit);
1042 1042
 	    
1043
-	    $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1044
-	    $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1043
+	    $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1044
+	    $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1045 1045
 	    
1046 1046
 	    if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1047 1047
 	    {
@@ -1071,7 +1071,7 @@  discard block
 block discarded – undo
1071 1071
     * @return Array the airline country list
1072 1072
     *
1073 1073
     */
1074
-    public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '')
1074
+    public function countAllFlightOverCountries($limit = true, $olderthanmonths = 0, $sincedate = '')
1075 1075
     {
1076 1076
 	global $globalDBdriver;
1077 1077
 	/*
@@ -1100,7 +1100,7 @@  discard block
 block discarded – undo
1100 1100
 	$flight_array = array();
1101 1101
 	$temp_array = array();
1102 1102
         
1103
-	while($row = $sth->fetch(PDO::FETCH_ASSOC))
1103
+	while ($row = $sth->fetch(PDO::FETCH_ASSOC))
1104 1104
 	{
1105 1105
 	    $temp_array['flight_count'] = $row['nb'];
1106 1106
 	    $temp_array['flight_country'] = $row['name'];
@@ -1117,14 +1117,14 @@  discard block
 block discarded – undo
1117 1117
     * @return Array the spotter information
1118 1118
     *
1119 1119
     */
1120
-    public function getDateArchiveSpotterDataById($id,$date)
1120
+    public function getDateArchiveSpotterDataById($id, $date)
1121 1121
     {
1122 1122
 	$Spotter = new Spotter($this->db);
1123 1123
 	date_default_timezone_set('UTC');
1124 1124
 	$id = filter_var($id, FILTER_SANITIZE_STRING);
1125
-	$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';
1126
-	$date = date('c',$date);
1127
-	$spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id,':date' => $date));
1125
+	$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';
1126
+	$date = date('c', $date);
1127
+	$spotter_array = $Spotter->getDataFromDB($query, array(':id' => $id, ':date' => $date));
1128 1128
 	return $spotter_array;
1129 1129
     }
1130 1130
 
@@ -1134,14 +1134,14 @@  discard block
 block discarded – undo
1134 1134
     * @return Array the spotter information
1135 1135
     *
1136 1136
     */
1137
-    public function getDateArchiveSpotterDataByIdent($ident,$date)
1137
+    public function getDateArchiveSpotterDataByIdent($ident, $date)
1138 1138
     {
1139 1139
 	$Spotter = new Spotter($this->db);
1140 1140
 	date_default_timezone_set('UTC');
1141 1141
 	$ident = filter_var($ident, FILTER_SANITIZE_STRING);
1142
-	$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';
1143
-	$date = date('c',$date);
1144
-	$spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident,':date' => $date));
1142
+	$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';
1143
+	$date = date('c', $date);
1144
+	$spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident, ':date' => $date));
1145 1145
 	return $spotter_array;
1146 1146
     }
1147 1147
 
@@ -1151,7 +1151,7 @@  discard block
 block discarded – undo
1151 1151
     * @return Array the spotter information
1152 1152
     *
1153 1153
     */
1154
-    public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '',$filters = array())
1154
+    public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '', $filters = array())
1155 1155
     {
1156 1156
 	global $global_query;
1157 1157
 	$Spotter = new Spotter();
@@ -1159,7 +1159,7 @@  discard block
 block discarded – undo
1159 1159
 	$query_values = array();
1160 1160
 	$limit_query = '';
1161 1161
 	$additional_query = '';
1162
-	$filter_query = $this->getFilter($filters,true,true);
1162
+	$filter_query = $this->getFilter($filters, true, true);
1163 1163
 	
1164 1164
 	if ($airport != "")
1165 1165
 	{
@@ -1176,8 +1176,8 @@  discard block
 block discarded – undo
1176 1176
 	{
1177 1177
 	    $limit_array = explode(",", $limit);
1178 1178
 	    
1179
-	    $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1180
-	    $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1179
+	    $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1180
+	    $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1181 1181
 	    
1182 1182
 	    if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1183 1183
 	    {
Please login to merge, or discard this patch.
pilot-detailed.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -6,14 +6,14 @@  discard block
 block discarded – undo
6 6
 //require_once('require/class.SpotterLive.php');
7 7
 require_once('require/class.SpotterArchive.php');
8 8
 
9
-if (!isset($_GET['pilot'])){
9
+if (!isset($_GET['pilot'])) {
10 10
 	header('Location: '.$globalURL.'/');
11 11
 } else {
12 12
 	$Spotter = new Spotter();
13 13
 	$SpotterArchive = new SpotterArchive();
14 14
 	$Translation = new Translation();
15 15
 	//calculuation for the pagination
16
-	if(!isset($_GET['limit']))
16
+	if (!isset($_GET['limit']))
17 17
 	{
18 18
 		$limit_start = 0;
19 19
 		$limit_end = 25;
@@ -34,24 +34,24 @@  discard block
 block discarded – undo
34 34
 	
35 35
 	$page_url = $globalURL.'/pilot/'.$_GET['pilot'];
36 36
 	
37
-	$pilot = filter_input(INPUT_GET,'pilot',FILTER_SANITIZE_STRING);
38
-	$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING);
37
+	$pilot = filter_input(INPUT_GET, 'pilot', FILTER_SANITIZE_STRING);
38
+	$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING);
39 39
 	if ($sort != '') 
40 40
 	{
41
-		$spotter_array = $Spotter->getSpotterDataByPilot($pilot,$limit_start.",".$absolute_difference, $sort);
41
+		$spotter_array = $Spotter->getSpotterDataByPilot($pilot, $limit_start.",".$absolute_difference, $sort);
42 42
 		if (empty($spotter_array)) {
43
-			$spotter_array = $SpotterArchive->getSpotterDataByPilot($pilot,$limit_start.",".$absolute_difference, $sort);
43
+			$spotter_array = $SpotterArchive->getSpotterDataByPilot($pilot, $limit_start.",".$absolute_difference, $sort);
44 44
 		}
45 45
 	} else {
46
-		$spotter_array = $Spotter->getSpotterDataByPilot($pilot,$limit_start.",".$absolute_difference);
46
+		$spotter_array = $Spotter->getSpotterDataByPilot($pilot, $limit_start.",".$absolute_difference);
47 47
 		if (empty($spotter_array)) {
48
-			$spotter_array = $SpotterArchive->getSpotterDataByPilot($pilot,$limit_start.",".$absolute_difference);
48
+			$spotter_array = $SpotterArchive->getSpotterDataByPilot($pilot, $limit_start.",".$absolute_difference);
49 49
 		}
50 50
 	}
51 51
 
52 52
 	if (!empty($spotter_array))
53 53
 	{
54
-		$title = sprintf(_("Detailed View for %s"),$spotter_array[0]['pilot_name']);
54
+		$title = sprintf(_("Detailed View for %s"), $spotter_array[0]['pilot_name']);
55 55
 		$ident = $spotter_array[0]['ident'];
56 56
 		if (isset($spotter_array[0]['latitude'])) $latitude = $spotter_array[0]['latitude'];
57 57
 		if (isset($spotter_array[0]['longitude'])) $longitude = $spotter_array[0]['longitude'];
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 	
113 113
 		include('owner-sub-menu.php');
114 114
 		print '<div class="table column">';
115
-		print '<p>'.sprintf(_("The table below shows the detailed information of all flights with the pilot <strong>%s</strong>."),$spotter_array[0]['pilot_name']).'</p>';
115
+		print '<p>'.sprintf(_("The table below shows the detailed information of all flights with the pilot <strong>%s</strong>."), $spotter_array[0]['pilot_name']).'</p>';
116 116
 
117 117
 		include('table-output.php'); 
118 118
 		print '<div class="pagination">';
Please login to merge, or discard this patch.
owner-statistics-aircraft.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -7,17 +7,17 @@  discard block
 block discarded – undo
7 7
         die();
8 8
 }
9 9
 $Spotter = new Spotter();
10
-$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING);
11
-$owner = filter_input(INPUT_GET,'owner',FILTER_SANITIZE_STRING);
10
+$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING);
11
+$owner = filter_input(INPUT_GET, 'owner', FILTER_SANITIZE_STRING);
12 12
 if ($sort != '') {
13
-	$spotter_array = $Spotter->getSpotterDataByOwner($owner,"0,1", $sort);
13
+	$spotter_array = $Spotter->getSpotterDataByOwner($owner, "0,1", $sort);
14 14
 } else {
15
-	$spotter_array = $Spotter->getSpotterDataByOwner($owner,"0,1", '');
15
+	$spotter_array = $Spotter->getSpotterDataByOwner($owner, "0,1", '');
16 16
 }
17 17
 
18 18
 if (!empty($spotter_array))
19 19
 {
20
-	$title = sprintf(_("Most Common Aircraft of %s"),$spotter_array[0]['aircraft_owner']);
20
+	$title = sprintf(_("Most Common Aircraft of %s"), $spotter_array[0]['aircraft_owner']);
21 21
 	require_once('header.php');
22 22
 	print '<div class="info column">';
23 23
 	print '<h1>'.$spotter_array[0]['aircraft_owner'].'</h1>';
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 	include('owner-sub-menu.php');
29 29
 	print '<div class="column">';
30 30
 	print '<h2>'._("Most Common Aircraft").'</h2>';
31
-	print '<p>'.sprintf(_("The statistic below shows the most common aircrafts of flights owned by <strong>%s</strong>."),$spotter_array[0]['aircraft_owner']).'</p>';
31
+	print '<p>'.sprintf(_("The statistic below shows the most common aircrafts of flights owned by <strong>%s</strong>."), $spotter_array[0]['aircraft_owner']).'</p>';
32 32
 
33 33
 	$aircraft_array = $Spotter->countAllAircraftTypesByOwner($owner);
34 34
 	if (!empty($aircraft_array))
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 		print '</thead>';
43 43
 		print '<tbody>';
44 44
 		$i = 1;
45
-		foreach($aircraft_array as $aircraft_item)
45
+		foreach ($aircraft_array as $aircraft_item)
46 46
 		{
47 47
 			print '<tr>';
48 48
 			print '<td><strong>'.$i.'</strong></td>';
Please login to merge, or discard this patch.