Completed
Push — master ( 012813...8fb9b9 )
by Yannick
08:10
created
registration-statistics-time.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -3,14 +3,14 @@  discard block
 block discarded – undo
3 3
 require_once('require/class.Spotter.php');
4 4
 require_once('require/class.Language.php');
5 5
 $Spotter = new Spotter();
6
-$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING);
7
-$registration = filter_input(INPUT_GET,'registration',FILTER_SANITIZE_STRING);
6
+$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING);
7
+$registration = filter_input(INPUT_GET, 'registration', FILTER_SANITIZE_STRING);
8 8
 $spotter_array = $Spotter->getSpotterDataByRegistration($registration, "0,1", $sort);
9 9
 $aircraft_array = $Spotter->getAircraftInfoByRegistration($registration);
10 10
 
11 11
 if (!empty($spotter_array))
12 12
 {
13
-	$title = sprintf(_("Most Common Time of Day of aircraft with registration %s"),$registration);
13
+	$title = sprintf(_("Most Common Time of Day of aircraft with registration %s"), $registration);
14 14
 	require_once('header.php');
15 15
   
16 16
 	print '<div class="info column">';
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
 	include('registration-sub-menu.php');
24 24
 	print '<div class="column">';
25 25
 	print '<h2>'._("Most Common Time of Day").'</h2>';
26
-	print '<p>'.sprintf(_("The statistic below shows the most common time of day from aircraft with registration <strong>%s</strong>."),$registration).'</p>';
26
+	print '<p>'.sprintf(_("The statistic below shows the most common time of day from aircraft with registration <strong>%s</strong>."), $registration).'</p>';
27 27
 
28 28
 	$hour_array = $Spotter->countAllHoursByRegistration($registration);
29 29
 	print '<script type="text/javascript" src="https://www.google.com/jsapi"></script>';
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
             var data = google.visualization.arrayToDataTable([
36 36
             	["'._("Hour").'", "'._("# of Flights").'"], ';
37 37
             	$hour_data = '';
38
-	foreach($hour_array as $hour_item)
38
+	foreach ($hour_array as $hour_item)
39 39
 	{
40 40
 		$hour_data .= '[ "'.date("ga", strtotime($hour_item['hour_name'].":00")).'",'.$hour_item['hour_count'].'],';
41 41
 	}
Please login to merge, or discard this patch.
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@
 block discarded – undo
38 38
           function drawChart() {
39 39
             var data = google.visualization.arrayToDataTable([
40 40
             	["'._("Hour").'", "'._("# of Flights").'"], ';
41
-            	$hour_data = '';
41
+				$hour_data = '';
42 42
 	foreach($hour_array as $hour_item)
43 43
 	{
44 44
 		$hour_data .= '[ "'.date("ga", strtotime($hour_item['hour_name'].":00")).'",'.$hour_item['hour_count'].'],';
Please login to merge, or discard this patch.
country-statistics-registration.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -7,8 +7,8 @@  discard block
 block discarded – undo
7 7
         die();
8 8
 }
9 9
 $Spotter = new Spotter();
10
-$country = ucwords(str_replace("-", " ", filter_input(INPUT_GET,'country',FILTER_SANITIZE_STRING)));
11
-$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING);
10
+$country = ucwords(str_replace("-", " ", filter_input(INPUT_GET, 'country', FILTER_SANITIZE_STRING)));
11
+$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING);
12 12
 if (isset($_GET['sort'])) {
13 13
 	$spotter_array = $Spotter->getSpotterDataByCountry($country, "0,1", $sort);
14 14
 } else {
@@ -17,16 +17,16 @@  discard block
 block discarded – undo
17 17
 
18 18
 if (!empty($spotter_array))
19 19
 {
20
-	$title = sprintf(_("Most Common Aircraft by registration from %s"),$country);
20
+	$title = sprintf(_("Most Common Aircraft by registration from %s"), $country);
21 21
 	require_once('header.php');
22 22
 	print '<div class="select-item">';
23 23
 	print '<form action="'.$globalURL.'/country" method="post">';
24 24
 	print '<select name="country" class="selectpicker" data-live-search="true">';
25 25
 	print '<option></option>';
26 26
 	$all_countries = $Spotter->getAllCountries();
27
-	foreach($all_countries as $all_country)
27
+	foreach ($all_countries as $all_country)
28 28
 	{
29
-		if($country == $all_country['country'])
29
+		if ($country == $all_country['country'])
30 30
 		{
31 31
 			print '<option value="'.strtolower(str_replace(" ", "-", $all_country['country'])).'" selected="selected">'.$all_country['country'].'</option>';
32 32
 		} else {
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 	if ($_GET['country'] != "NA")
42 42
 	{
43 43
 		print '<div class="info column">';
44
-		print '<h1>'.sprintf(_("Airports &amp; Airlines from %s"),$country).'</h1>';
44
+		print '<h1>'.sprintf(_("Airports &amp; Airlines from %s"), $country).'</h1>';
45 45
 		print '</div>';
46 46
 	} else {
47 47
 		print '<div class="alert alert-warning">'._("This special country profile shows all flights that do <u>not</u> have a country of a airline or departure/arrival airport associated with them.").'</div>';
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 	include('country-sub-menu.php');
51 51
 	print '<div class="column">';
52 52
 	print '<h2>'._("Most Common Aircraft by Registration").'</h2>';
53
-	print '<p>'.sprintf(_("The statistic below shows the most common aircraft by registration of airlines or departure/arrival airports from <strong>%s</strong>."),$country).'</p>';
53
+	print '<p>'.sprintf(_("The statistic below shows the most common aircraft by registration of airlines or departure/arrival airports from <strong>%s</strong>."), $country).'</p>';
54 54
 	$aircraft_array = $Spotter->countAllAircraftRegistrationByCountry($country);
55 55
 	if (!empty($aircraft_array))
56 56
 	{
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 		print '</thead>';
66 66
 		print '<tbody>';
67 67
 		$i = 1;
68
-		foreach($aircraft_array as $aircraft_item)
68
+		foreach ($aircraft_array as $aircraft_item)
69 69
 		{
70 70
 			print '<tr>';
71 71
 			print '<td><strong>'.$i.'</strong></td>';
Please login to merge, or discard this patch.
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -3,8 +3,8 @@
 block discarded – undo
3 3
 require_once('require/class.Spotter.php');
4 4
 require_once('require/class.Language.php');
5 5
 if (!isset($_GET['country'])) {
6
-        header('Location: '.$globalURL.'/country');
7
-        die();
6
+		header('Location: '.$globalURL.'/country');
7
+		die();
8 8
 }
9 9
 $Spotter = new Spotter();
10 10
 $country = ucwords(str_replace("-", " ", filter_input(INPUT_GET,'country',FILTER_SANITIZE_STRING)));
Please login to merge, or discard this patch.
route.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -5,8 +5,8 @@
 block discarded – undo
5 5
 
6 6
 if ($_POST['departure_airport'] != "" || $_POST['arrival_airport'])
7 7
 {
8
-	$departure_airport = filter_input(INPUT_POST,'departure_airport',FILTER_SANITIZE_STRING);
9
-	$arrival_airport = filter_input(INPUT_POST,'arrival_airport',FILTER_SANITIZE_STRING);
8
+	$departure_airport = filter_input(INPUT_POST, 'departure_airport', FILTER_SANITIZE_STRING);
9
+	$arrival_airport = filter_input(INPUT_POST, 'arrival_airport', FILTER_SANITIZE_STRING);
10 10
 	header('Location: '.$globalURL.'/route/'.$departure_airport.'/'.$arrival_airport);
11 11
 } else {
12 12
 	header('Location: '.$globalURL);
Please login to merge, or discard this patch.
registration-statistics-arrival-airport.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -3,16 +3,16 @@  discard block
 block discarded – undo
3 3
 require_once('require/class.Spotter.php');
4 4
 require_once('require/class.Language.php');
5 5
 $Spotter = new Spotter();
6
-$sort=filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING);
7
-$registration = filter_input(INPUT_GET,'registration',FILTER_SANITIZE_STRING);
6
+$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING);
7
+$registration = filter_input(INPUT_GET, 'registration', FILTER_SANITIZE_STRING);
8 8
 if ($registration != '') {
9 9
 	$spotter_array = $Spotter->getSpotterDataByRegistration($registration, "0,1", $sort);
10 10
 	$aircraft_array = $Spotter->getAircraftInfoByRegistration($registration);
11
-} else $spotter_array=array();
11
+} else $spotter_array = array();
12 12
 
13 13
 if (!empty($spotter_array))
14 14
 {
15
-	$title = sprintf(_("Most Common Arrival Airports of aircraft with registration %s"),$registration);
15
+	$title = sprintf(_("Most Common Arrival Airports of aircraft with registration %s"), $registration);
16 16
 
17 17
 	require_once('header.php');
18 18
 		print '<div class="info column">';
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 	include('registration-sub-menu.php');
26 26
 	print '<div class="column">';
27 27
 	print '<h2>'._("Most Common Arrival Airports").'</h2>';
28
-	print '<p>'.sprintf(_("The statistic below shows all arrival airports of flights with aircraft registration <strong>%s</strong>."),$registration).'</p>';
28
+	print '<p>'.sprintf(_("The statistic below shows all arrival airports of flights with aircraft registration <strong>%s</strong>."), $registration).'</p>';
29 29
 	$airport_airport_array = $Spotter->countAllArrivalAirportsByRegistration($registration);
30 30
 	print '<script type="text/javascript" src="https://www.google.com/jsapi"></script>
31 31
     	<script>
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
         	["'._("Airport").'", "'._("# of times").'"],';
41 41
 
42 42
 	$airport_data = '';
43
-	foreach($airport_airport_array as $airport_item)
43
+	foreach ($airport_airport_array as $airport_item)
44 44
 	{
45 45
 		$name = $airport_item['airport_arrival_city'].', '.$airport_item['airport_arrival_country'].' ('.$airport_item['airport_arrival_icao'].')';
46 46
 		$name = str_replace("'", "", $name);
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 	print '</thead>';
79 79
 	print '<tbody>';
80 80
 	$i = 1;
81
-	foreach($airport_airport_array as $airport_item)
81
+	foreach ($airport_airport_array as $airport_item)
82 82
 	{
83 83
 		print '<tr>';
84 84
 		print '<td><strong>'.$i.'</strong></td>';
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -8,7 +8,9 @@
 block discarded – undo
8 8
 if ($registration != '') {
9 9
 	$spotter_array = $Spotter->getSpotterDataByRegistration($registration, "0,1", $sort);
10 10
 	$aircraft_array = $Spotter->getAircraftInfoByRegistration($registration);
11
-} else $spotter_array=array();
11
+} else {
12
+	$spotter_array=array();
13
+}
12 14
 
13 15
 if (!empty($spotter_array))
14 16
 {
Please login to merge, or discard this patch.
sitemap.php 2 patches
Indentation   +107 added lines, -107 removed lines patch added patch discarded remove patch
@@ -15,9 +15,9 @@  discard block
 block discarded – undo
15 15
 		foreach($spotter_array as $spotter_item)
16 16
 		{
17 17
 			$output .= '<url>';
18
-			    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/flightid/'.$spotter_item['spotter_id'].'</loc>';
19
-			    $output .= '<lastmod>'.date("c", time()).'</lastmod>';
20
-			    $output .= '<changefreq>weekly</changefreq>';
18
+				$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/flightid/'.$spotter_item['spotter_id'].'</loc>';
19
+				$output .= '<lastmod>'.date("c", time()).'</lastmod>';
20
+				$output .= '<changefreq>weekly</changefreq>';
21 21
 			$output .= '</url>';
22 22
 		}
23 23
 	$output .= '</urlset>';
@@ -32,9 +32,9 @@  discard block
 block discarded – undo
32 32
 		foreach($aircraft_types as $aircraft_item)
33 33
 		{
34 34
 			$output .= '<url>';
35
-			    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/aircraft/'.$aircraft_item['aircraft_icao'].'</loc>';
36
-			    $output .= '<lastmod>'.date("c", time()).'</lastmod>';
37
-			    $output .= '<changefreq>daily</changefreq>';
35
+				$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/aircraft/'.$aircraft_item['aircraft_icao'].'</loc>';
36
+				$output .= '<lastmod>'.date("c", time()).'</lastmod>';
37
+				$output .= '<changefreq>daily</changefreq>';
38 38
 			$output .= '</url>';
39 39
 		}
40 40
 	$output .= '</urlset>';
@@ -49,9 +49,9 @@  discard block
 block discarded – undo
49 49
 		foreach($aircraft_registrations as $aircraft_item)
50 50
 		{
51 51
 			$output .= '<url>';
52
-			    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/registration/'.$aircraft_item['registration'].'</loc>';
53
-			    $output .= '<lastmod>'.date("c", time()).'</lastmod>';
54
-			    $output .= '<changefreq>daily</changefreq>';
52
+				$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/registration/'.$aircraft_item['registration'].'</loc>';
53
+				$output .= '<lastmod>'.date("c", time()).'</lastmod>';
54
+				$output .= '<changefreq>daily</changefreq>';
55 55
 			$output .= '</url>';
56 56
 		}
57 57
 	$output .= '</urlset>';
@@ -65,9 +65,9 @@  discard block
 block discarded – undo
65 65
 		foreach($airline_names as $airline_item)
66 66
 		{
67 67
 			$output .= '<url>';
68
-			    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/airline/'.$airline_item['airline_icao'].'</loc>';
69
-			    $output .= '<lastmod>'.date("c", time()).'</lastmod>';
70
-			    $output .= '<changefreq>daily</changefreq>';
68
+				$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/airline/'.$airline_item['airline_icao'].'</loc>';
69
+				$output .= '<lastmod>'.date("c", time()).'</lastmod>';
70
+				$output .= '<changefreq>daily</changefreq>';
71 71
 			$output .= '</url>';
72 72
 		}
73 73
 	$output .= '</urlset>';
@@ -81,9 +81,9 @@  discard block
 block discarded – undo
81 81
 		foreach($airport_names as $airport_item)
82 82
 		{
83 83
 			$output .= '<url>';
84
-			    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/airport/'.$airport_item['airport_icao'].'</loc>';
85
-			    $output .= '<lastmod>'.date("c", time()).'</lastmod>';
86
-			    $output .= '<changefreq>daily</changefreq>';
84
+				$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/airport/'.$airport_item['airport_icao'].'</loc>';
85
+				$output .= '<lastmod>'.date("c", time()).'</lastmod>';
86
+				$output .= '<changefreq>daily</changefreq>';
87 87
 			$output .= '</url>';
88 88
 		}
89 89
 	$output .= '</urlset>';
@@ -97,9 +97,9 @@  discard block
 block discarded – undo
97 97
 		foreach($manufacturer_names as $manufacturer_item)
98 98
 		{
99 99
 			$output .= '<url>';
100
-			    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/manufacturer/'.strtolower(str_replace(" ", "-", $manufacturer_item['aircraft_manufacturer'])).'</loc>';
101
-			    $output .= '<lastmod>'.date("c", time()).'</lastmod>';
102
-			    $output .= '<changefreq>daily</changefreq>';
100
+				$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/manufacturer/'.strtolower(str_replace(" ", "-", $manufacturer_item['aircraft_manufacturer'])).'</loc>';
101
+				$output .= '<lastmod>'.date("c", time()).'</lastmod>';
102
+				$output .= '<changefreq>daily</changefreq>';
103 103
 			$output .= '</url>';
104 104
 		}
105 105
 	$output .= '</urlset>';
@@ -113,9 +113,9 @@  discard block
 block discarded – undo
113 113
 		foreach($country_names as $country_item)
114 114
 		{
115 115
 			$output .= '<url>';
116
-			    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/country/'.strtolower(str_replace(" ", "-", $country_item['country'])).'</loc>';
117
-			    $output .= '<lastmod>'.date("c", time()).'</lastmod>';
118
-			    $output .= '<changefreq>daily</changefreq>';
116
+				$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/country/'.strtolower(str_replace(" ", "-", $country_item['country'])).'</loc>';
117
+				$output .= '<lastmod>'.date("c", time()).'</lastmod>';
118
+				$output .= '<changefreq>daily</changefreq>';
119 119
 			$output .= '</url>';
120 120
 		}
121 121
 	$output .= '</urlset>';
@@ -130,9 +130,9 @@  discard block
 block discarded – undo
130 130
 		{
131 131
 			if (ctype_alnum($ident_item['ident'])) {
132 132
 				$output .= '<url>';
133
-				    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/ident/'.$ident_item['ident'].'</loc>';
134
-				    $output .= '<lastmod>'.date("c", time()).'</lastmod>';
135
-				    $output .= '<changefreq>daily</changefreq>';
133
+					$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/ident/'.$ident_item['ident'].'</loc>';
134
+					$output .= '<lastmod>'.date("c", time()).'</lastmod>';
135
+					$output .= '<changefreq>daily</changefreq>';
136 136
 				$output .= '</url>';
137 137
 			}
138 138
 		}
@@ -147,9 +147,9 @@  discard block
 block discarded – undo
147 147
 		foreach($date_names as $date_item)
148 148
 		{
149 149
 			$output .= '<url>';
150
-			    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/date/'.date("Y-m-d", strtotime($date_item['date'])).'</loc>';
151
-			    $output .= '<lastmod>'.date("c", time()).'</lastmod>';
152
-			    $output .= '<changefreq>daily</changefreq>';
150
+				$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/date/'.date("Y-m-d", strtotime($date_item['date'])).'</loc>';
151
+				$output .= '<lastmod>'.date("c", time()).'</lastmod>';
152
+				$output .= '<changefreq>daily</changefreq>';
153 153
 			$output .= '</url>';
154 154
 		}
155 155
 	$output .= '</urlset>';
@@ -163,9 +163,9 @@  discard block
 block discarded – undo
163 163
 		foreach($route_names as $route_item)
164 164
 		{
165 165
 			$output .= '<url>';
166
-			    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/route/'.$route_item['airport_departure_icao'].'/'.$route_item['airport_arrival_icao'].'</loc>';
167
-			    $output .= '<lastmod>'.date("c", time()).'</lastmod>';
168
-			    $output .= '<changefreq>daily</changefreq>';
166
+				$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/route/'.$route_item['airport_departure_icao'].'/'.$route_item['airport_arrival_icao'].'</loc>';
167
+				$output .= '<lastmod>'.date("c", time()).'</lastmod>';
168
+				$output .= '<changefreq>daily</changefreq>';
169 169
 			$output .= '</url>';
170 170
 		}
171 171
 	$output .= '</urlset>';
@@ -177,117 +177,117 @@  discard block
 block discarded – undo
177 177
 		
178 178
 		/* STATIC PAGES */
179 179
 		$output .= '<url>';
180
-		    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/</loc>';
181
-		    $output .= '<lastmod>'.date("c", time()).'</lastmod>';
182
-		    $output .= '<changefreq>daily</changefreq>';
180
+			$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/</loc>';
181
+			$output .= '<lastmod>'.date("c", time()).'</lastmod>';
182
+			$output .= '<changefreq>daily</changefreq>';
183 183
 		$output .= '</url>';
184 184
 		$output .= '<url>';
185
-		    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/latest</loc>';
186
-		    $output .= '<lastmod>'.date("c", time()).'</lastmod>';
187
-		    $output .= '<changefreq>daily</changefreq>';
185
+			$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/latest</loc>';
186
+			$output .= '<lastmod>'.date("c", time()).'</lastmod>';
187
+			$output .= '<changefreq>daily</changefreq>';
188 188
 		$output .= '</url>';
189 189
 		$output .= '<url>';
190
-		    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/highlights</loc>';
191
-		    $output .= '<lastmod>'.date("c", time()).'</lastmod>';
192
-		    $output .= '<changefreq>daily</changefreq>';
190
+			$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/highlights</loc>';
191
+			$output .= '<lastmod>'.date("c", time()).'</lastmod>';
192
+			$output .= '<changefreq>daily</changefreq>';
193 193
 		$output .= '</url>';
194 194
 		$output .= '<url>';
195
-		    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/aircraft</loc>';
196
-		    $output .= '<lastmod>'.date("c", time()).'</lastmod>';
197
-		    $output .= '<changefreq>daily</changefreq>';
195
+			$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/aircraft</loc>';
196
+			$output .= '<lastmod>'.date("c", time()).'</lastmod>';
197
+			$output .= '<changefreq>daily</changefreq>';
198 198
 		$output .= '</url>';
199 199
 		$output .= '<url>';
200
-		    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/airline</loc>';
201
-		    $output .= '<lastmod>'.date("c", time()).'</lastmod>';
202
-		    $output .= '<changefreq>daily</changefreq>';
200
+			$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/airline</loc>';
201
+			$output .= '<lastmod>'.date("c", time()).'</lastmod>';
202
+			$output .= '<changefreq>daily</changefreq>';
203 203
 		$output .= '</url>';
204 204
 		$output .= '<url>';
205
-		    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/airport</loc>';
206
-		    $output .= '<lastmod>'.date("c", time()).'</lastmod>';
207
-		    $output .= '<changefreq>daily</changefreq>';
205
+			$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/airport</loc>';
206
+			$output .= '<lastmod>'.date("c", time()).'</lastmod>';
207
+			$output .= '<changefreq>daily</changefreq>';
208 208
 		$output .= '</url>';
209 209
 		$output .= '<url>';
210
-		    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/search</loc>';
211
-		    $output .= '<lastmod>'.date("c", time()).'</lastmod>';
212
-		    $output .= '<changefreq>daily</changefreq>';
210
+			$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/search</loc>';
211
+			$output .= '<lastmod>'.date("c", time()).'</lastmod>';
212
+			$output .= '<changefreq>daily</changefreq>';
213 213
 		$output .= '</url>';
214 214
 		$output .= '<url>';
215
-		    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/about</loc>';
216
-		    $output .= '<lastmod>'.date("c", time()).'</lastmod>';
217
-		    $output .= '<changefreq>weekly</changefreq>';
215
+			$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/about</loc>';
216
+			$output .= '<lastmod>'.date("c", time()).'</lastmod>';
217
+			$output .= '<changefreq>weekly</changefreq>';
218 218
 		$output .= '</url>';
219 219
 		
220 220
 		
221 221
 		/* STATISTIC PAGES */
222 222
 		$output .= '<url>';
223
-		    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/statistics/aircraft</loc>';
224
-		    $output .= '<lastmod>'.date("c", time()).'</lastmod>';
225
-		    $output .= '<changefreq>daily</changefreq>';
223
+			$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/statistics/aircraft</loc>';
224
+			$output .= '<lastmod>'.date("c", time()).'</lastmod>';
225
+			$output .= '<changefreq>daily</changefreq>';
226 226
 		$output .= '</url>';
227 227
 		$output .= '<url>';
228
-		    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/statistics/registration</loc>';
229
-		    $output .= '<lastmod>'.date("c", time()).'</lastmod>';
230
-		    $output .= '<changefreq>daily</changefreq>';
228
+			$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/statistics/registration</loc>';
229
+			$output .= '<lastmod>'.date("c", time()).'</lastmod>';
230
+			$output .= '<changefreq>daily</changefreq>';
231 231
 		$output .= '</url>';
232 232
 		$output .= '<url>';
233
-		    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/statistics/manufacturer</loc>';
234
-		    $output .= '<lastmod>'.date("c", time()).'</lastmod>';
235
-		    $output .= '<changefreq>daily</changefreq>';
233
+			$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/statistics/manufacturer</loc>';
234
+			$output .= '<lastmod>'.date("c", time()).'</lastmod>';
235
+			$output .= '<changefreq>daily</changefreq>';
236 236
 		$output .= '</url>';
237 237
 		$output .= '<url>';
238
-		    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/statistics/airline</loc>';
239
-		    $output .= '<lastmod>'.date("c", time()).'</lastmod>';
240
-		    $output .= '<changefreq>daily</changefreq>';
238
+			$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/statistics/airline</loc>';
239
+			$output .= '<lastmod>'.date("c", time()).'</lastmod>';
240
+			$output .= '<changefreq>daily</changefreq>';
241 241
 		$output .= '</url>';
242 242
 		$output .= '<url>';
243
-		    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/statistics/airline-country</loc>';
244
-		    $output .= '<lastmod>'.date("c", time()).'</lastmod>';
245
-		    $output .= '<changefreq>daily</changefreq>';
243
+			$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/statistics/airline-country</loc>';
244
+			$output .= '<lastmod>'.date("c", time()).'</lastmod>';
245
+			$output .= '<changefreq>daily</changefreq>';
246 246
 		$output .= '</url>';
247 247
 		$output .= '<url>';
248
-		    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/statistics/airport-departure</loc>';
249
-		    $output .= '<lastmod>'.date("c", time()).'</lastmod>';
250
-		    $output .= '<changefreq>daily</changefreq>';
248
+			$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/statistics/airport-departure</loc>';
249
+			$output .= '<lastmod>'.date("c", time()).'</lastmod>';
250
+			$output .= '<changefreq>daily</changefreq>';
251 251
 		$output .= '</url>';
252 252
 		$output .= '<url>';
253
-		    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/statistics/airport-departure-country</loc>';
254
-		    $output .= '<lastmod>'.date("c", time()).'</lastmod>';
255
-		    $output .= '<changefreq>daily</changefreq>';
253
+			$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/statistics/airport-departure-country</loc>';
254
+			$output .= '<lastmod>'.date("c", time()).'</lastmod>';
255
+			$output .= '<changefreq>daily</changefreq>';
256 256
 		$output .= '</url>';
257 257
 		$output .= '<url>';
258
-		    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/statistics/airport-arrival</loc>';
259
-		    $output .= '<lastmod>'.date("c", time()).'</lastmod>';
260
-		    $output .= '<changefreq>daily</changefreq>';
258
+			$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/statistics/airport-arrival</loc>';
259
+			$output .= '<lastmod>'.date("c", time()).'</lastmod>';
260
+			$output .= '<changefreq>daily</changefreq>';
261 261
 		$output .= '</url>';
262 262
 		$output .= '<url>';
263
-		    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/statistics/airport-arrival-country</loc>';
264
-		    $output .= '<lastmod>'.date("c", time()).'</lastmod>';
265
-		    $output .= '<changefreq>daily</changefreq>';
263
+			$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/statistics/airport-arrival-country</loc>';
264
+			$output .= '<lastmod>'.date("c", time()).'</lastmod>';
265
+			$output .= '<changefreq>daily</changefreq>';
266 266
 		$output .= '</url>';
267 267
 		$output .= '<url>';
268
-		    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/statistics/route-airport</loc>';
269
-		    $output .= '<lastmod>'.date("c", time()).'</lastmod>';
270
-		    $output .= '<changefreq>daily</changefreq>';
268
+			$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/statistics/route-airport</loc>';
269
+			$output .= '<lastmod>'.date("c", time()).'</lastmod>';
270
+			$output .= '<changefreq>daily</changefreq>';
271 271
 		$output .= '</url>';
272 272
 		$output .= '<url>';
273
-		    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/statistics/route-waypoint</loc>';
274
-		    $output .= '<lastmod>'.date("c", time()).'</lastmod>';
275
-		    $output .= '<changefreq>daily</changefreq>';
273
+			$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/statistics/route-waypoint</loc>';
274
+			$output .= '<lastmod>'.date("c", time()).'</lastmod>';
275
+			$output .= '<changefreq>daily</changefreq>';
276 276
 		$output .= '</url>';
277 277
 		$output .= '<url>';
278
-		    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/statistics/callsign</loc>';
279
-		    $output .= '<lastmod>'.date("c", time()).'</lastmod>';
280
-		    $output .= '<changefreq>daily</changefreq>';
278
+			$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/statistics/callsign</loc>';
279
+			$output .= '<lastmod>'.date("c", time()).'</lastmod>';
280
+			$output .= '<changefreq>daily</changefreq>';
281 281
 		$output .= '</url>';
282 282
 		$output .= '<url>';
283
-		    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/statistics/date</loc>';
284
-		    $output .= '<lastmod>'.date("c", time()).'</lastmod>';
285
-		    $output .= '<changefreq>daily</changefreq>';
283
+			$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/statistics/date</loc>';
284
+			$output .= '<lastmod>'.date("c", time()).'</lastmod>';
285
+			$output .= '<changefreq>daily</changefreq>';
286 286
 		$output .= '</url>';
287 287
 		$output .= '<url>';
288
-		    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/statistics/time</loc>';
289
-		    $output .= '<lastmod>'.date("c", time()).'</lastmod>';
290
-		    $output .= '<changefreq>daily</changefreq>';
288
+			$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/statistics/time</loc>';
289
+			$output .= '<lastmod>'.date("c", time()).'</lastmod>';
290
+			$output .= '<changefreq>daily</changefreq>';
291 291
 		$output .= '</url>';
292 292
 	$output .= '</urlset>';
293 293
 	
@@ -297,37 +297,37 @@  discard block
 block discarded – undo
297 297
 	$output .= '<?xml version="1.0" encoding="UTF-8"?>';
298 298
 	$output .= '<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">';
299 299
 		$output .= '<sitemap>';
300
-	    	$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/sitemap/static</loc>';
300
+			$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/sitemap/static</loc>';
301 301
 		$output .= '</sitemap>';
302 302
 		$output .= '<sitemap>';
303
-	    	$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/sitemap/flight</loc>';
303
+			$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/sitemap/flight</loc>';
304 304
 		$output .= '</sitemap>';
305 305
 		$output .= '<sitemap>';
306
-	    	$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/sitemap/aircraft</loc>';
306
+			$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/sitemap/aircraft</loc>';
307 307
 		$output .= '</sitemap>';
308 308
 		$output .= '<sitemap>';
309
-	    	$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/sitemap/registration</loc>';
309
+			$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/sitemap/registration</loc>';
310 310
 		$output .= '</sitemap>';
311 311
 		$output .= '<sitemap>';
312
-	    	$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/sitemap/airline</loc>';
312
+			$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/sitemap/airline</loc>';
313 313
 		$output .= '</sitemap>';
314 314
 		$output .= '<sitemap>';
315
-	    	$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/sitemap/airport</loc>';
315
+			$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/sitemap/airport</loc>';
316 316
 		$output .= '</sitemap>';
317 317
 		$output .= '<sitemap>';
318
-	    	$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/sitemap/manufacturer</loc>';
318
+			$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/sitemap/manufacturer</loc>';
319 319
 		$output .= '</sitemap>';
320 320
 		$output .= '<sitemap>';
321
-	    	$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/sitemap/country</loc>';
321
+			$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/sitemap/country</loc>';
322 322
 		$output .= '</sitemap>';
323 323
 		$output .= '<sitemap>';
324
-	    	$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/sitemap/ident</loc>';
324
+			$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/sitemap/ident</loc>';
325 325
 		$output .= '</sitemap>';
326 326
 		$output .= '<sitemap>';
327
-	    	$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/sitemap/date</loc>';
327
+			$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/sitemap/date</loc>';
328 328
 		$output .= '</sitemap>';
329 329
 		$output .= '<sitemap>';
330
-	    	$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/sitemap/route</loc>';
330
+			$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/sitemap/route</loc>';
331 331
 		$output .= '</sitemap>';
332 332
 	$output .= '</sitemapindex>';
333 333
 	
Please login to merge, or discard this patch.
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
 	$output .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">';
13 13
 
14 14
 		$spotter_array = $Spotter->getAllFlightsforSitemap();
15
-		foreach($spotter_array as $spotter_item)
15
+		foreach ($spotter_array as $spotter_item)
16 16
 		{
17 17
 			$output .= '<url>';
18 18
 			    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/flightid/'.$spotter_item['spotter_id'].'</loc>';
@@ -23,13 +23,13 @@  discard block
 block discarded – undo
23 23
 	$output .= '</urlset>';
24 24
 	
25 25
 	
26
-} else if (isset($_GET['type']) && $_GET['type'] == "aircraft"){
26
+} else if (isset($_GET['type']) && $_GET['type'] == "aircraft") {
27 27
 
28 28
 	$output .= '<?xml version="1.0" encoding="UTF-8"?>';
29 29
 	$output .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">';
30 30
 
31 31
 		$aircraft_types = $Spotter->getAllAircraftTypes();
32
-		foreach($aircraft_types as $aircraft_item)
32
+		foreach ($aircraft_types as $aircraft_item)
33 33
 		{
34 34
 			$output .= '<url>';
35 35
 			    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/aircraft/'.$aircraft_item['aircraft_icao'].'</loc>';
@@ -40,13 +40,13 @@  discard block
 block discarded – undo
40 40
 	$output .= '</urlset>';
41 41
 	
42 42
 	
43
-} else if (isset($_GET['type']) && $_GET['type'] == "registration"){
43
+} else if (isset($_GET['type']) && $_GET['type'] == "registration") {
44 44
 
45 45
 	$output .= '<?xml version="1.0" encoding="UTF-8"?>';
46 46
 	$output .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">';
47 47
 
48 48
 		$aircraft_registrations = $Spotter->getAllAircraftRegistrations();
49
-		foreach($aircraft_registrations as $aircraft_item)
49
+		foreach ($aircraft_registrations as $aircraft_item)
50 50
 		{
51 51
 			$output .= '<url>';
52 52
 			    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/registration/'.$aircraft_item['registration'].'</loc>';
@@ -56,13 +56,13 @@  discard block
 block discarded – undo
56 56
 		}
57 57
 	$output .= '</urlset>';
58 58
 	
59
-} else if (isset($_GET['type']) && $_GET['type'] == "airline"){
59
+} else if (isset($_GET['type']) && $_GET['type'] == "airline") {
60 60
 
61 61
 	$output .= '<?xml version="1.0" encoding="UTF-8"?>';
62 62
 	$output .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">';
63 63
 
64 64
 		$airline_names = $Spotter->getAllAirlineNames();
65
-		foreach($airline_names as $airline_item)
65
+		foreach ($airline_names as $airline_item)
66 66
 		{
67 67
 			$output .= '<url>';
68 68
 			    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/airline/'.$airline_item['airline_icao'].'</loc>';
@@ -72,13 +72,13 @@  discard block
 block discarded – undo
72 72
 		}
73 73
 	$output .= '</urlset>';
74 74
 	
75
-} else if (isset($_GET['type']) && $_GET['type'] == "airport"){
75
+} else if (isset($_GET['type']) && $_GET['type'] == "airport") {
76 76
 
77 77
 	$output .= '<?xml version="1.0" encoding="UTF-8"?>';
78 78
 	$output .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">';
79 79
 
80 80
 		$airport_names = $Spotter->getAllAirportNames();
81
-		foreach($airport_names as $airport_item)
81
+		foreach ($airport_names as $airport_item)
82 82
 		{
83 83
 			$output .= '<url>';
84 84
 			    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/airport/'.$airport_item['airport_icao'].'</loc>';
@@ -88,13 +88,13 @@  discard block
 block discarded – undo
88 88
 		}
89 89
 	$output .= '</urlset>';
90 90
 	
91
-} else if (isset($_GET['type']) && $_GET['type'] == "manufacturer"){
91
+} else if (isset($_GET['type']) && $_GET['type'] == "manufacturer") {
92 92
 
93 93
 	$output .= '<?xml version="1.0" encoding="UTF-8"?>';
94 94
 	$output .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">';
95 95
 
96 96
 		$manufacturer_names = $Spotter->getAllManufacturers();
97
-		foreach($manufacturer_names as $manufacturer_item)
97
+		foreach ($manufacturer_names as $manufacturer_item)
98 98
 		{
99 99
 			$output .= '<url>';
100 100
 			    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/manufacturer/'.strtolower(str_replace(" ", "-", $manufacturer_item['aircraft_manufacturer'])).'</loc>';
@@ -104,13 +104,13 @@  discard block
 block discarded – undo
104 104
 		}
105 105
 	$output .= '</urlset>';
106 106
 	
107
-} else if (isset($_GET['type']) && $_GET['type'] == "country"){
107
+} else if (isset($_GET['type']) && $_GET['type'] == "country") {
108 108
 
109 109
 	$output .= '<?xml version="1.0" encoding="UTF-8"?>';
110 110
 	$output .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">';
111 111
 
112 112
 		$country_names = $Spotter->getAllCountries();
113
-		foreach($country_names as $country_item)
113
+		foreach ($country_names as $country_item)
114 114
 		{
115 115
 			$output .= '<url>';
116 116
 			    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/country/'.strtolower(str_replace(" ", "-", $country_item['country'])).'</loc>';
@@ -120,13 +120,13 @@  discard block
 block discarded – undo
120 120
 		}
121 121
 	$output .= '</urlset>';
122 122
 	
123
-} else if (isset($_GET['type']) && $_GET['type'] == "ident"){
123
+} else if (isset($_GET['type']) && $_GET['type'] == "ident") {
124 124
 
125 125
 	$output .= '<?xml version="1.0" encoding="UTF-8"?>';
126 126
 	$output .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">';
127 127
 
128 128
 		$ident_names = $Spotter->getAllIdents();
129
-		foreach($ident_names as $ident_item)
129
+		foreach ($ident_names as $ident_item)
130 130
 		{
131 131
 			if (ctype_alnum($ident_item['ident'])) {
132 132
 				$output .= '<url>';
@@ -138,13 +138,13 @@  discard block
 block discarded – undo
138 138
 		}
139 139
 	$output .= '</urlset>';
140 140
 	
141
-} else if (isset($_GET['type']) && $_GET['type'] == "date"){
141
+} else if (isset($_GET['type']) && $_GET['type'] == "date") {
142 142
 
143 143
 	$output .= '<?xml version="1.0" encoding="UTF-8"?>';
144 144
 	$output .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">';
145 145
 
146 146
 		$date_names = $Spotter->getAllDates();
147
-		foreach($date_names as $date_item)
147
+		foreach ($date_names as $date_item)
148 148
 		{
149 149
 			$output .= '<url>';
150 150
 			    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/date/'.date("Y-m-d", strtotime($date_item['date'])).'</loc>';
@@ -154,13 +154,13 @@  discard block
 block discarded – undo
154 154
 		}
155 155
 	$output .= '</urlset>';
156 156
 	
157
-} else if (isset($_GET['type']) && $_GET['type'] == "route"){
157
+} else if (isset($_GET['type']) && $_GET['type'] == "route") {
158 158
 
159 159
 	$output .= '<?xml version="1.0" encoding="UTF-8"?>';
160 160
 	$output .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">';
161 161
 
162 162
 		$route_names = $Spotter->getAllRoutes();
163
-		foreach($route_names as $route_item)
163
+		foreach ($route_names as $route_item)
164 164
 		{
165 165
 			$output .= '<url>';
166 166
 			    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/route/'.$route_item['airport_departure_icao'].'/'.$route_item['airport_arrival_icao'].'</loc>';
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
 		}
171 171
 	$output .= '</urlset>';
172 172
 	
173
-} else if (isset($_GET['type']) && $_GET['type'] == "static"){
173
+} else if (isset($_GET['type']) && $_GET['type'] == "static") {
174 174
 
175 175
 	$output .= '<?xml version="1.0" encoding="UTF-8"?>';
176 176
 	$output .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">';
Please login to merge, or discard this patch.
polar-geojson.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -17,10 +17,10 @@  discard block
 block discarded – undo
17 17
 header('Content-Type: text/javascript');
18 18
 
19 19
 
20
-$polar = $Stats->getStatsSource(date('Y-m-d'),'polar');
20
+$polar = $Stats->getStatsSource(date('Y-m-d'), 'polar');
21 21
 $output = '{"type": "FeatureCollection","features": [';
22 22
 if (!empty($polar)) {
23
-	foreach($polar as $eachpolar) {
23
+	foreach ($polar as $eachpolar) {
24 24
 		$data = json_decode($eachpolar['source_data']);
25 25
 		$name = $eachpolar['source_name'];
26 26
 		$coord = $Location->getLocationInfobySourceName($name);
@@ -33,15 +33,15 @@  discard block
 block discarded – undo
33 33
 			$initial_longitude = $globalCenterLongitude;
34 34
 		}
35 35
 		$first = '';
36
-		foreach($data as $value => $key) {
37
-			$final_coord = $Common->getCoordfromDistanceBearing($initial_latitude,$initial_longitude,$value*22.5,$key);
38
-			if ($first == '') $first = '['.round($final_coord['longitude'],5).','.round($final_coord['latitude'],5).']';
36
+		foreach ($data as $value => $key) {
37
+			$final_coord = $Common->getCoordfromDistanceBearing($initial_latitude, $initial_longitude, $value*22.5, $key);
38
+			if ($first == '') $first = '['.round($final_coord['longitude'], 5).','.round($final_coord['latitude'], 5).']';
39 39
 			$output .= '['.$final_coord['longitude'].','.$final_coord['latitude'].'],';
40 40
 		}
41 41
 		$output .= $first;
42 42
 		$output .= ']]}},';
43 43
 	}
44
-	$output  = substr($output, 0, -1);
44
+	$output = substr($output, 0, -1);
45 45
 }
46 46
 $output .= ']}';
47 47
 print $output;
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -35,7 +35,9 @@
 block discarded – undo
35 35
 		$first = '';
36 36
 		foreach($data as $value => $key) {
37 37
 			$final_coord = $Common->getCoordfromDistanceBearing($initial_latitude,$initial_longitude,$value*22.5,$key);
38
-			if ($first == '') $first = '['.round($final_coord['longitude'],5).','.round($final_coord['latitude'],5).']';
38
+			if ($first == '') {
39
+				$first = '['.round($final_coord['longitude'],5).','.round($final_coord['latitude'],5).']';
40
+			}
39 41
 			$output .= '['.$final_coord['longitude'].','.$final_coord['latitude'].'],';
40 42
 		}
41 43
 		$output .= $first;
Please login to merge, or discard this patch.
archive-geojson.php 3 patches
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -9,10 +9,10 @@  discard block
 block discarded – undo
9 9
 $Common = new Common();
10 10
 
11 11
 if (isset($_GET['download'])) {
12
-    if ($_GET['download'] == "true")
13
-    {
12
+	if ($_GET['download'] == "true")
13
+	{
14 14
 	header('Content-disposition: attachment; filename="flightairmap.json"');
15
-    }
15
+	}
16 16
 }
17 17
 header('Content-Type: text/javascript');
18 18
 
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 				}
92 92
 
93 93
 				//waypoint plotting
94
-                /*
94
+				/*
95 95
 				$output .= '{';
96 96
 					$output .= '"type": "Feature",';
97 97
 						$output .= '"properties": {';
@@ -270,8 +270,8 @@  discard block
 block discarded – undo
270 270
 					$output_time .= (strtotime($spotter_history['date'])*1000).',';
271 271
 				}
272 272
 				if (isset($output_time)) {
273
-				    $output_time  = substr($output_time, 0, -1);
274
-				    $output .= '"time": ['.$output_time.'],';
273
+					$output_time  = substr($output_time, 0, -1);
274
+					$output .= '"time": ['.$output_time.'],';
275 275
 				}
276 276
 
277 277
 
@@ -285,8 +285,8 @@  discard block
 block discarded – undo
285 285
 						$output .= '"coordinates": [';
286 286
 						
287 287
 				if (isset($output_history)) {
288
-				    $output_history  = substr($output_history, 0, -1);
289
-				    $output .= $output_history;
288
+					$output_history  = substr($output_history, 0, -1);
289
+					$output .= $output_history;
290 290
 				}
291 291
 				
292 292
 						$output .= ']';
Please login to merge, or discard this patch.
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -23,13 +23,13 @@  discard block
 block discarded – undo
23 23
 $min = false;
24 24
 $allhistory = false;
25 25
 $filter['source'] = array();
26
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['ShowVATSIM']) && $_COOKIE['ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt'));
27
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['ShowIVAO']) && $_COOKIE['ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup'));
28
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['ShowVMS']) && $_COOKIE['ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars'));
29
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['ShowSBS1']) && $_COOKIE['ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs'));
30
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['ShowAPRS']) && $_COOKIE['ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs'));
31
-if (isset($_COOKIE['Airlines']) && $_COOKIE['Airlines'] != '') $filter['airlines'] = explode(',',$_COOKIE['Airlines']);
32
-if (isset($_COOKIE['Sources']) && $_COOKIE['Sources'] != '') $filter['source_aprs'] = explode(',',$_COOKIE['Sources']);
26
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['ShowVATSIM']) && $_COOKIE['ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'], array('vatsimtxt'));
27
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['ShowIVAO']) && $_COOKIE['ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'], array('whazzup'));
28
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['ShowVMS']) && $_COOKIE['ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'], array('phpvmacars'));
29
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['ShowSBS1']) && $_COOKIE['ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'], array('sbs'));
30
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['ShowAPRS']) && $_COOKIE['ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'], array('aprs'));
31
+if (isset($_COOKIE['Airlines']) && $_COOKIE['Airlines'] != '') $filter['airlines'] = explode(',', $_COOKIE['Airlines']);
32
+if (isset($_COOKIE['Sources']) && $_COOKIE['Sources'] != '') $filter['source_aprs'] = explode(',', $_COOKIE['Sources']);
33 33
 if (isset($_COOKIE['airlinestype']) && $_COOKIE['airlinestype'] != 'all') $filter['airlinestype'] = $_COOKIE['airlinestype'];
34 34
 
35 35
 if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) {
@@ -37,12 +37,12 @@  discard block
 block discarded – undo
37 37
 }
38 38
 
39 39
 if (isset($_GET['ident'])) {
40
-	$ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING);
40
+	$ident = filter_input(INPUT_GET, 'ident', FILTER_SANITIZE_STRING);
41 41
 	$from_archive = true;
42 42
 	$spotter_array = $SpotterArchive->getLastArchiveSpotterDataByIdent($ident);
43 43
 	$allhistory = true;
44 44
 } elseif (isset($_GET['flightaware_id'])) {
45
-	$flightaware_id = filter_input(INPUT_GET,'flightaware_id',FILTER_SANITIZE_STRING);
45
+	$flightaware_id = filter_input(INPUT_GET, 'flightaware_id', FILTER_SANITIZE_STRING);
46 46
 	$from_archive = true;
47 47
 	$spotter_array = $SpotterArchive->getLastArchiveSpotterDataById($flightaware_id);
48 48
 	$allhistory = true;
@@ -50,20 +50,20 @@  discard block
 block discarded – undo
50 50
 	$from_archive = true;
51 51
 //	$begindate = filter_input(INPUT_GET,'begindate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~')));
52 52
 //	$enddate = filter_input(INPUT_GET,'enddate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~')));
53
-	$begindate = filter_input(INPUT_GET,'begindate',FILTER_SANITIZE_NUMBER_INT);
54
-	$enddate = filter_input(INPUT_GET,'enddate',FILTER_SANITIZE_NUMBER_INT);
55
-	$archivespeed = filter_input(INPUT_GET,'speed',FILTER_SANITIZE_NUMBER_INT);
56
-	$begindate = date('Y-m-d H:i:s',$begindate);
57
-	$enddate = date('Y-m-d H:i:s',$enddate);
58
-	$spotter_array = $SpotterArchive->getMinLiveSpotterDataPlayback($begindate,$enddate,$filter);
53
+	$begindate = filter_input(INPUT_GET, 'begindate', FILTER_SANITIZE_NUMBER_INT);
54
+	$enddate = filter_input(INPUT_GET, 'enddate', FILTER_SANITIZE_NUMBER_INT);
55
+	$archivespeed = filter_input(INPUT_GET, 'speed', FILTER_SANITIZE_NUMBER_INT);
56
+	$begindate = date('Y-m-d H:i:s', $begindate);
57
+	$enddate = date('Y-m-d H:i:s', $enddate);
58
+	$spotter_array = $SpotterArchive->getMinLiveSpotterDataPlayback($begindate, $enddate, $filter);
59 59
 }
60 60
 
61 61
 if (!empty($spotter_array)) {
62
-	$flightcnt = $SpotterArchive->getLiveSpotterCount($begindate,$enddate,$filter);
62
+	$flightcnt = $SpotterArchive->getLiveSpotterCount($begindate, $enddate, $filter);
63 63
 	if ($flightcnt == '') $flightcnt = 0;
64 64
 } else $flightcnt = 0;
65 65
 
66
-$sqltime = round(microtime(true)-$begintime,2);
66
+$sqltime = round(microtime(true) - $begintime, 2);
67 67
 
68 68
 //var_dump($spotter_array);
69 69
 $j = 0;
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 		if (!empty($spotter_array) && is_array($spotter_array))
79 79
 		{
80 80
 			$output .= '"features": [';
81
-			foreach($spotter_array as $spotter_item)
81
+			foreach ($spotter_array as $spotter_item)
82 82
 			{
83 83
 				$j++;
84 84
 				date_default_timezone_set('UTC');
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
 						if (isset($spotter_item['registration'])) $output .= '"registration": "'.$spotter_item['registration'].'",';
162 162
 						if (isset($spotter_item['aircraft_name']) && isset($spotter_item['aircraft_type'])) {
163 163
 							$output .= '"aircraft_name": "'.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')",';
164
-							$output .= '"aircraft_wiki": "http://'.strtolower($globalLanguage).'.wikipedia.org/wiki/'.urlencode(str_replace(' ','_',$spotter_item['aircraft_name'])).'",';
164
+							$output .= '"aircraft_wiki": "http://'.strtolower($globalLanguage).'.wikipedia.org/wiki/'.urlencode(str_replace(' ', '_', $spotter_item['aircraft_name'])).'",';
165 165
 						} elseif (isset($spotter_item['aircraft_type'])) {
166 166
 							$output .= '"aircraft_name": "NA ('.$spotter_item['aircraft_type'].')",';
167 167
 						} elseif (!$min) {
@@ -228,15 +228,15 @@  discard block
 block discarded – undo
228 228
 						if ($compress)$output .= '"h": "'.$spotter_item['heading'].'",';
229 229
 						else $output .= '"heading": "'.$spotter_item['heading'].'",';
230 230
 						
231
-						if (isset($archivespeed)) $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$spotter_item['heading'],$archivespeed);
232
-						else $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$spotter_item['heading']);
231
+						if (isset($archivespeed)) $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $spotter_item['heading'], $archivespeed);
232
+						else $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $spotter_item['heading']);
233 233
 						//$output .= '"nextlatitude": "'.$nextcoord['latitude'].'",';
234 234
 						//$output .= '"nextlongitude": "'.$nextcoord['longitude'].'",';
235 235
 						$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
236 236
 
237 237
 						if (!$min) $output .= '"image": "'.$image.'",';
238 238
 						if (isset($spotter_item['image_copyright']) && $spotter_item['image_copyright'] != '') {
239
-							$output .= '"image_copyright": "'.str_replace('"',"'",trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$spotter_item['image_copyright']))).'",';
239
+							$output .= '"image_copyright": "'.str_replace('"', "'", trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '', $spotter_item['image_copyright']))).'",';
240 240
 						}
241 241
 						if (isset($spotter_item['image_source_website'])) {
242 242
 							$output .= '"image_source_website": "'.urlencode($spotter_item['image_source_website']).'",';
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
 							$output .= '"waypoints": "'.$spotter_item['waypoints'].'",';
259 259
 						}
260 260
 						if (isset($spotter_item['acars'])) {
261
-							$output .= '"acars": "'.trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"), '<br />',$spotter_item['acars']['message'])).'",';
261
+							$output .= '"acars": "'.trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '<br />', $spotter_item['acars']['message'])).'",';
262 262
 						}
263 263
 						$spotter_history_array = $SpotterArchive->getCoordArchiveSpotterDataById($spotter_item['flightaware_id']);
264 264
 						//$spotter_history_array = array();
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
 					$output_time .= (strtotime($spotter_history['date'])*1000).',';
271 271
 				}
272 272
 				if (isset($output_time)) {
273
-				    $output_time  = substr($output_time, 0, -1);
273
+				    $output_time = substr($output_time, 0, -1);
274 274
 				    $output .= '"time": ['.$output_time.'],';
275 275
 				}
276 276
 
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
 						$output .= '"coordinates": [';
286 286
 						
287 287
 				if (isset($output_history)) {
288
-				    $output_history  = substr($output_history, 0, -1);
288
+				    $output_history = substr($output_history, 0, -1);
289 289
 				    $output .= $output_history;
290 290
 				}
291 291
 				
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
 			$output  = substr($output, 0, -1);
298 298
 			$output .= ']';
299 299
 			$output .= ',"initial_sqltime": "'.$sqltime.'",';
300
-			$output .= '"totaltime": "'.round(microtime(true)-$begintime,2).'",';
300
+			$output .= '"totaltime": "'.round(microtime(true) - $begintime, 2).'",';
301 301
 			if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",';
302 302
 			$output .= '"fc": "'.$flightcnt.'"';
303 303
 		} else {
Please login to merge, or discard this patch.
Braces   +120 added lines, -46 removed lines patch added patch discarded remove patch
@@ -16,21 +16,40 @@  discard block
 block discarded – undo
16 16
 }
17 17
 header('Content-Type: text/javascript');
18 18
 
19
-if (!isset($globalJsonCompress)) $compress = true;
20
-else $compress = $globalJsonCompress;
19
+if (!isset($globalJsonCompress)) {
20
+	$compress = true;
21
+} else {
22
+	$compress = $globalJsonCompress;
23
+}
21 24
 
22 25
 $from_archive = false;
23 26
 $min = false;
24 27
 $allhistory = false;
25 28
 $filter['source'] = array();
26
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['ShowVATSIM']) && $_COOKIE['ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt'));
27
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['ShowIVAO']) && $_COOKIE['ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup'));
28
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['ShowVMS']) && $_COOKIE['ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars'));
29
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['ShowSBS1']) && $_COOKIE['ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs'));
30
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['ShowAPRS']) && $_COOKIE['ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs'));
31
-if (isset($_COOKIE['Airlines']) && $_COOKIE['Airlines'] != '') $filter['airlines'] = explode(',',$_COOKIE['Airlines']);
32
-if (isset($_COOKIE['Sources']) && $_COOKIE['Sources'] != '') $filter['source_aprs'] = explode(',',$_COOKIE['Sources']);
33
-if (isset($_COOKIE['airlinestype']) && $_COOKIE['airlinestype'] != 'all') $filter['airlinestype'] = $_COOKIE['airlinestype'];
29
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['ShowVATSIM']) && $_COOKIE['ShowVATSIM'] == 'true') {
30
+	$filter['source'] = array_merge($filter['source'],array('vatsimtxt'));
31
+}
32
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['ShowIVAO']) && $_COOKIE['ShowIVAO'] == 'true') {
33
+	$filter['source'] = array_merge($filter['source'],array('whazzup'));
34
+}
35
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['ShowVMS']) && $_COOKIE['ShowVMS'] == 'true') {
36
+	$filter['source'] = array_merge($filter['source'],array('phpvmacars'));
37
+}
38
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['ShowSBS1']) && $_COOKIE['ShowSBS1'] == 'true') {
39
+	$filter['source'] = array_merge($filter['source'],array('sbs'));
40
+}
41
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['ShowAPRS']) && $_COOKIE['ShowAPRS'] == 'true') {
42
+	$filter['source'] = array_merge($filter['source'],array('aprs'));
43
+}
44
+if (isset($_COOKIE['Airlines']) && $_COOKIE['Airlines'] != '') {
45
+	$filter['airlines'] = explode(',',$_COOKIE['Airlines']);
46
+}
47
+if (isset($_COOKIE['Sources']) && $_COOKIE['Sources'] != '') {
48
+	$filter['source_aprs'] = explode(',',$_COOKIE['Sources']);
49
+}
50
+if (isset($_COOKIE['airlinestype']) && $_COOKIE['airlinestype'] != 'all') {
51
+	$filter['airlinestype'] = $_COOKIE['airlinestype'];
52
+}
34 53
 
35 54
 if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) {
36 55
 	$min = true;
@@ -60,8 +79,12 @@  discard block
 block discarded – undo
60 79
 
61 80
 if (!empty($spotter_array)) {
62 81
 	$flightcnt = $SpotterArchive->getLiveSpotterCount($begindate,$enddate,$filter);
63
-	if ($flightcnt == '') $flightcnt = 0;
64
-} else $flightcnt = 0;
82
+	if ($flightcnt == '') {
83
+		$flightcnt = 0;
84
+	}
85
+	} else {
86
+	$flightcnt = 0;
87
+}
65 88
 
66 89
 $sqltime = round(microtime(true)-$begintime,2);
67 90
 
@@ -70,8 +93,11 @@  discard block
 block discarded – undo
70 93
 
71 94
 $output = '{';
72 95
 	$output .= '"type": "FeatureCollection",';
73
-		if ($min) $output .= '"minimal": "true",';
74
-		else $output .= '"minimal": "false",';
96
+		if ($min) {
97
+			$output .= '"minimal": "true",';
98
+		} else {
99
+			$output .= '"minimal": "false",';
100
+		}
75 101
 		$output .= '"fc": "'.$flightcnt.'",';
76 102
 		$output .= '"sqt": "'.$sqltime.'",';
77 103
 
@@ -140,11 +166,16 @@  discard block
 block discarded – undo
140 166
 						//$output .= '"fc": "'.$flightcnt.'",';
141 167
 						//$output .= '"sqt": "'.$sqltime.'",';
142 168
 						$output .= '"properties": {';
143
-							if ($compress) $output .= '"fi": "'.$spotter_item['flightaware_id'].'",';
144
-							else $output .= '"flightaware_id": "'.$spotter_item['flightaware_id'].'",';
169
+							if ($compress) {
170
+								$output .= '"fi": "'.$spotter_item['flightaware_id'].'",';
171
+							} else {
172
+								$output .= '"flightaware_id": "'.$spotter_item['flightaware_id'].'",';
173
+							}
145 174
 							$output .= '"fc": "'.$flightcnt.'",';
146 175
 							$output .= '"sqt": "'.$sqltime.'",';
147
-							if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",';
176
+							if (isset($begindate)) {
177
+								$output .= '"archive_date": "'.$begindate.'",';
178
+							}
148 179
 
149 180
 /*
150 181
 							if ($min) $output .= '"minimal": "true",';
@@ -152,13 +183,21 @@  discard block
 block discarded – undo
152 183
 */
153 184
 							//$output .= '"fc": "'.$spotter_item['nb'].'",';
154 185
 						if (isset($spotter_item['ident']) && $spotter_item['ident'] != '') {
155
-							if ($compress) $output .= '"c": "'.$spotter_item['ident'].'",';
156
-							else $output .= '"callsign": "'.$spotter_item['ident'].'",';
186
+							if ($compress) {
187
+								$output .= '"c": "'.$spotter_item['ident'].'",';
188
+							} else {
189
+								$output .= '"callsign": "'.$spotter_item['ident'].'",';
190
+							}
157 191
 						} else {
158
-							if ($compress) $output .= '"c": "NA",';
159
-							else $output .= '"callsign": "NA",';
192
+							if ($compress) {
193
+								$output .= '"c": "NA",';
194
+							} else {
195
+								$output .= '"callsign": "NA",';
196
+							}
197
+						}
198
+						if (isset($spotter_item['registration'])) {
199
+							$output .= '"registration": "'.$spotter_item['registration'].'",';
160 200
 						}
161
-						if (isset($spotter_item['registration'])) $output .= '"registration": "'.$spotter_item['registration'].'",';
162 201
 						if (isset($spotter_item['aircraft_name']) && isset($spotter_item['aircraft_type'])) {
163 202
 							$output .= '"aircraft_name": "'.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')",';
164 203
 							$output .= '"aircraft_wiki": "http://'.strtolower($globalLanguage).'.wikipedia.org/wiki/'.urlencode(str_replace(' ','_',$spotter_item['aircraft_name'])).'",';
@@ -171,19 +210,29 @@  discard block
 block discarded – undo
171 210
 							$output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",';
172 211
 						}
173 212
 						if (!isset($spotter_item['aircraft_shadow'])) {
174
-							if (!isset($spotter_item['aircraft_icao']) || $spotter_item['aircraft_icao'] == '') $spotter_item['aircraft_shadow'] = '';
175
-							else {
213
+							if (!isset($spotter_item['aircraft_icao']) || $spotter_item['aircraft_icao'] == '') {
214
+								$spotter_item['aircraft_shadow'] = '';
215
+							} else {
176 216
 								$aircraft_info = $Spotter->getAllAircraftInfo($spotter_item['aircraft_icao']);
177
-								if (count($aircraft_info) > 0) $spotter_item['aircraft_shadow'] = $aircraft_info[0]['aircraft_shadow'];
178
-								else $spotter_item['aircraft_shadow'] = '';
217
+								if (count($aircraft_info) > 0) {
218
+									$spotter_item['aircraft_shadow'] = $aircraft_info[0]['aircraft_shadow'];
219
+								} else {
220
+									$spotter_item['aircraft_shadow'] = '';
221
+								}
179 222
 							}
180 223
 						}
181 224
 						if ($spotter_item['aircraft_shadow'] == '') {
182
-							if ($compress) $output .= '"as": "default.png",';
183
-							else $output .= '"aircraft_shadow": "default.png",';
225
+							if ($compress) {
226
+								$output .= '"as": "default.png",';
227
+							} else {
228
+								$output .= '"aircraft_shadow": "default.png",';
229
+							}
184 230
 						} else {
185
-							if ($compress) $output .= '"as": "'.$spotter_item['aircraft_shadow'].'",';
186
-							else $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",';
231
+							if ($compress) {
232
+								$output .= '"as": "'.$spotter_item['aircraft_shadow'].'",';
233
+							} else {
234
+								$output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",';
235
+							}
187 236
 						}
188 237
 						if (isset($spotter_item['airline_name'])) {
189 238
 							$output .= '"airline_name": "'.$spotter_item['airline_name'].'",';
@@ -191,8 +240,11 @@  discard block
 block discarded – undo
191 240
 							$output .= '"airline_name": "NA",';
192 241
 						}
193 242
 						if (isset($spotter_item['departure_airport'])) {
194
-							if ($compress) $output .= '"dac": "'.$spotter_item['departure_airport'].'",';
195
-							else $output .= '"departure_airport_code": "'.$spotter_item['departure_airport'].'",';
243
+							if ($compress) {
244
+								$output .= '"dac": "'.$spotter_item['departure_airport'].'",';
245
+							} else {
246
+								$output .= '"departure_airport_code": "'.$spotter_item['departure_airport'].'",';
247
+							}
196 248
 						}
197 249
 						if (isset($spotter_item['departure_airport_city'])) {
198 250
 							$output .= '"departure_airport": "'.$spotter_item['departure_airport_city'].', '.$spotter_item['departure_airport_country'].'",';
@@ -204,8 +256,11 @@  discard block
 block discarded – undo
204 256
 							$output .= '"arrival_airport_time": "'.$spotter_item['arrival_airport_time'].'",';
205 257
 						}
206 258
 						if (isset($spotter_item['arrival_airport'])) {
207
-							if ($compress) $output .= '"aac": "'.$spotter_item['arrival_airport'].'",';
208
-							else $output .= '"arrival_airport_code": "'.$spotter_item['arrival_airport'].'",';
259
+							if ($compress) {
260
+								$output .= '"aac": "'.$spotter_item['arrival_airport'].'",';
261
+							} else {
262
+								$output .= '"arrival_airport_code": "'.$spotter_item['arrival_airport'].'",';
263
+							}
209 264
 						}
210 265
 						if (isset($spotter_item['arrival_airport_city'])) {
211 266
 							$output .= '"arrival_airport": "'.$spotter_item['arrival_airport_city'].', '.$spotter_item['arrival_airport_country'].'",';
@@ -223,18 +278,29 @@  discard block
 block discarded – undo
223 278
 							$output .= '"ground_speed": "'.$spotter_item['ground_speed'].'",';
224 279
 						}
225 280
 						
226
-						if ($compress) $output .= '"a": "'.$spotter_item['altitude'].'",';
227
-						else $output .= '"altitude": "'.$spotter_item['altitude'].'",';
228
-						if ($compress)$output .= '"h": "'.$spotter_item['heading'].'",';
229
-						else $output .= '"heading": "'.$spotter_item['heading'].'",';
281
+						if ($compress) {
282
+							$output .= '"a": "'.$spotter_item['altitude'].'",';
283
+						} else {
284
+							$output .= '"altitude": "'.$spotter_item['altitude'].'",';
285
+						}
286
+						if ($compress) {
287
+							$output .= '"h": "'.$spotter_item['heading'].'",';
288
+						} else {
289
+							$output .= '"heading": "'.$spotter_item['heading'].'",';
290
+						}
230 291
 						
231
-						if (isset($archivespeed)) $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$spotter_item['heading'],$archivespeed);
232
-						else $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$spotter_item['heading']);
292
+						if (isset($archivespeed)) {
293
+							$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$spotter_item['heading'],$archivespeed);
294
+						} else {
295
+							$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$spotter_item['heading']);
296
+						}
233 297
 						//$output .= '"nextlatitude": "'.$nextcoord['latitude'].'",';
234 298
 						//$output .= '"nextlongitude": "'.$nextcoord['longitude'].'",';
235 299
 						$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
236 300
 
237
-						if (!$min) $output .= '"image": "'.$image.'",';
301
+						if (!$min) {
302
+							$output .= '"image": "'.$image.'",';
303
+						}
238 304
 						if (isset($spotter_item['image_copyright']) && $spotter_item['image_copyright'] != '') {
239 305
 							$output .= '"image_copyright": "'.str_replace('"',"'",trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$spotter_item['image_copyright']))).'",';
240 306
 						}
@@ -242,8 +308,11 @@  discard block
 block discarded – undo
242 308
 							$output .= '"image_source_website": "'.urlencode($spotter_item['image_source_website']).'",';
243 309
 						}
244 310
 						if (isset($spotter_item['squawk'])) {
245
-							if ($compress) $output .= '"sq": "'.$spotter_item['squawk'].'",';
246
-							else $output .= '"squawk": "'.$spotter_item['squawk'].'",';
311
+							if ($compress) {
312
+								$output .= '"sq": "'.$spotter_item['squawk'].'",';
313
+							} else {
314
+								$output .= '"squawk": "'.$spotter_item['squawk'].'",';
315
+							}
247 316
 						}
248 317
 						if (isset($spotter_item['squawk_usage'])) {
249 318
 							$output .= '"squawk_usage": "'.$spotter_item['squawk_usage'].'",';
@@ -277,8 +346,11 @@  discard block
 block discarded – undo
277 346
 
278 347
 
279 348
 							// FIXME : type when not aircraft ?
280
-						if ($compress) $output .= '"t": "aircraft"';
281
-						else $output .= '"type": "aircraft"';
349
+						if ($compress) {
350
+							$output .= '"t": "aircraft"';
351
+						} else {
352
+							$output .= '"type": "aircraft"';
353
+						}
282 354
 						$output .= '},';
283 355
 						$output .= '"geometry": {';
284 356
 						$output .= '"type": "MultiPoint",';
@@ -298,7 +370,9 @@  discard block
 block discarded – undo
298 370
 			$output .= ']';
299 371
 			$output .= ',"initial_sqltime": "'.$sqltime.'",';
300 372
 			$output .= '"totaltime": "'.round(microtime(true)-$begintime,2).'",';
301
-			if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",';
373
+			if (isset($begindate)) {
374
+				$output .= '"archive_date": "'.$begindate.'",';
375
+			}
302 376
 			$output .= '"fc": "'.$flightcnt.'"';
303 377
 		} else {
304 378
 			$output .= '"features": ';
Please login to merge, or discard this patch.
getImages.php 3 patches
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -4,9 +4,9 @@  discard block
 block discarded – undo
4 4
 	$hex = str_replace("#", "", $hex);
5 5
 	$color = array();
6 6
 	if (strlen($hex) == 3) {
7
-	    $color['r'] = hexdec(substr($hex, 0, 1) . substr($hex,0,1));
8
-	    $color['g'] = hexdec(substr($hex, 1, 1) . substr($hex,1,1));
9
-	    $color['b'] = hexdec(substr($hex, 2, 1) . substr($hex,2,1));
7
+	    $color['r'] = hexdec(substr($hex, 0, 1).substr($hex, 0, 1));
8
+	    $color['g'] = hexdec(substr($hex, 1, 1).substr($hex, 1, 1));
9
+	    $color['b'] = hexdec(substr($hex, 2, 1).substr($hex, 2, 1));
10 10
 	} else if (strlen($hex) == 6) {
11 11
 	    $color['r'] = hexdec(substr($hex, 0, 2));
12 12
 	    $color['g'] = hexdec(substr($hex, 2, 2));
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
 }
17 17
 
18 18
 
19
-if (!isset($_GET['color']) || $_GET['color'] == '' || !preg_match('/^([a-fA-F0-9]){3}(([a-fA-F0-9]){3})?\b/',$_GET['color'])) { 
19
+if (!isset($_GET['color']) || $_GET['color'] == '' || !preg_match('/^([a-fA-F0-9]){3}(([a-fA-F0-9]){3})?\b/', $_GET['color'])) { 
20 20
     exit(0);
21 21
 }
22 22
 $color = $_GET['color'];
@@ -37,15 +37,15 @@  discard block
 block discarded – undo
37 37
 
38 38
 if (extension_loaded('gd') && function_exists('gd_info')) {
39 39
     $image = imagecreatefrompng($original);
40
-    $index = imagecolorexact($image,26,49,81);
40
+    $index = imagecolorexact($image, 26, 49, 81);
41 41
     if ($index < 0) {
42
-	$index = imagecolorexact($image,25,49,79);
42
+	$index = imagecolorexact($image, 25, 49, 79);
43 43
     }
44 44
     if ($index < 0) {
45
-	$index = imagecolorexact($image,0,0,0);
45
+	$index = imagecolorexact($image, 0, 0, 0);
46 46
     }
47 47
     $c = hexToRGB($color);
48
-    imagecolorset($image,$index,$c['r'],$c['g'],$c['b']);
48
+    imagecolorset($image, $index, $c['r'], $c['g'], $c['b']);
49 49
  /*
50 50
     $ig = imagecolorat($image, 0, 0);
51 51
     imagecolortransparent($image, $ig);
@@ -53,14 +53,14 @@  discard block
 block discarded – undo
53 53
 
54 54
     header('Content-type: image/png');
55 55
     if (isset($_GET['resize']) && function_exists('imagecopyresampled')) {
56
-	$resize = filter_input(INPUT_GET,'resize',FILTER_SANITIZE_NUMBER_INT);
57
-	$newimg = imagecreatetruecolor($resize,$resize);
56
+	$resize = filter_input(INPUT_GET, 'resize', FILTER_SANITIZE_NUMBER_INT);
57
+	$newimg = imagecreatetruecolor($resize, $resize);
58 58
         imagealphablending($newimg, false);
59 59
 	imagesavealpha($newimg, true);
60
-	imagecopyresampled($newimg,$image,0,0,0,0,15,15,imagesx($image),imagesy($image));
60
+	imagecopyresampled($newimg, $image, 0, 0, 0, 0, 15, 15, imagesx($image), imagesy($image));
61 61
 	if (isset($_GET['heading'])) {
62
-    	    $heading = filter_input(INPUT_GET,'heading',FILTER_SANITIZE_NUMBER_INT);
63
-    	    $rotation = imagerotate($newimg,$heading,imageColorAllocateAlpha($newimg,0,0,0,127));
62
+    	    $heading = filter_input(INPUT_GET, 'heading', FILTER_SANITIZE_NUMBER_INT);
63
+    	    $rotation = imagerotate($newimg, $heading, imageColorAllocateAlpha($newimg, 0, 0, 0, 127));
64 64
     	    imagealphablending($rotation, false);
65 65
 	    imagesavealpha($rotation, true);
66 66
     	    imagepng($rotation);
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 	imagepng($image);
80 80
 	imagepng($image);
81 81
 	if (is_writable('cache')) {
82
-    	    imagepng($image,dirname(__FILE__).DIRECTORY_SEPARATOR.'cache/'.$color.'-'.$filename);
82
+    	    imagepng($image, dirname(__FILE__).DIRECTORY_SEPARATOR.'cache/'.$color.'-'.$filename);
83 83
 	}
84 84
         imagedestroy($image);
85 85
     }
Please login to merge, or discard this patch.
Indentation   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -4,31 +4,31 @@  discard block
 block discarded – undo
4 4
 	$hex = str_replace("#", "", $hex);
5 5
 	$color = array();
6 6
 	if (strlen($hex) == 3) {
7
-	    $color['r'] = hexdec(substr($hex, 0, 1) . substr($hex,0,1));
8
-	    $color['g'] = hexdec(substr($hex, 1, 1) . substr($hex,1,1));
9
-	    $color['b'] = hexdec(substr($hex, 2, 1) . substr($hex,2,1));
7
+		$color['r'] = hexdec(substr($hex, 0, 1) . substr($hex,0,1));
8
+		$color['g'] = hexdec(substr($hex, 1, 1) . substr($hex,1,1));
9
+		$color['b'] = hexdec(substr($hex, 2, 1) . substr($hex,2,1));
10 10
 	} else if (strlen($hex) == 6) {
11
-	    $color['r'] = hexdec(substr($hex, 0, 2));
12
-	    $color['g'] = hexdec(substr($hex, 2, 2));
13
-	    $color['b'] = hexdec(substr($hex, 4, 2));
11
+		$color['r'] = hexdec(substr($hex, 0, 2));
12
+		$color['g'] = hexdec(substr($hex, 2, 2));
13
+		$color['b'] = hexdec(substr($hex, 4, 2));
14 14
 	}
15 15
 	return $color;
16 16
 }
17 17
 
18 18
 
19 19
 if (!isset($_GET['color']) || $_GET['color'] == '' || !preg_match('/^([a-fA-F0-9]){3}(([a-fA-F0-9]){3})?\b/',$_GET['color'])) { 
20
-    exit(0);
20
+	exit(0);
21 21
 }
22 22
 $color = $_GET['color'];
23 23
 if (!isset($_GET['filename']) || !preg_match('/^[a-z0-9-_]+\.png$/', strtolower($_GET['filename']))) {
24
-    echo "Incorrect filename";
25
-    exit(0);
24
+	echo "Incorrect filename";
25
+	exit(0);
26 26
 }
27 27
 $filename = $_GET['filename'];
28 28
 if (file_exists(dirname(__FILE__).DIRECTORY_SEPARATOR.'cache'.DIRECTORY_SEPARATOR.$color.'-'.$filename)) {
29
-    header('Content-type: image/png');
30
-    readfile(dirname(__FILE__).DIRECTORY_SEPARATOR.'cache'.DIRECTORY_SEPARATOR.$color.'-'.$filename);
31
-    exit(0);
29
+	header('Content-type: image/png');
30
+	readfile(dirname(__FILE__).DIRECTORY_SEPARATOR.'cache'.DIRECTORY_SEPARATOR.$color.'-'.$filename);
31
+	exit(0);
32 32
 }
33 33
 if (isset($_GET['tracker'])) {
34 34
 	$original = dirname(__FILE__).DIRECTORY_SEPARATOR.'images'.DIRECTORY_SEPARATOR.'vehicules'.DIRECTORY_SEPARATOR.$filename;
@@ -38,66 +38,66 @@  discard block
 block discarded – undo
38 38
 	$original = dirname(__FILE__).DIRECTORY_SEPARATOR.'images'.DIRECTORY_SEPARATOR.'aircrafts'.DIRECTORY_SEPARATOR.'new'.DIRECTORY_SEPARATOR.$filename;
39 39
 }
40 40
 if (!file_exists($original)) {
41
-    echo "File not found";
41
+	echo "File not found";
42 42
 }
43 43
 
44 44
 if (extension_loaded('gd') && function_exists('gd_info')) {
45
-    $image = imagecreatefrompng($original);
46
-    $index = imagecolorexact($image,26,49,81);
47
-    if ($index < 0) {
45
+	$image = imagecreatefrompng($original);
46
+	$index = imagecolorexact($image,26,49,81);
47
+	if ($index < 0) {
48 48
 	$index = imagecolorexact($image,25,49,79);
49
-    }
50
-    if ($index < 0) {
49
+	}
50
+	if ($index < 0) {
51 51
 	$index = imagecolorexact($image,0,0,0);
52
-    }
53
-    $c = hexToRGB($color);
54
-    imagecolorset($image,$index,$c['r'],$c['g'],$c['b']);
52
+	}
53
+	$c = hexToRGB($color);
54
+	imagecolorset($image,$index,$c['r'],$c['g'],$c['b']);
55 55
  /*
56 56
     $ig = imagecolorat($image, 0, 0);
57 57
     imagecolortransparent($image, $ig);
58 58
    */
59 59
 
60
-    header('Content-type: image/png');
61
-    if (isset($_GET['resize']) && function_exists('imagecopyresampled')) {
60
+	header('Content-type: image/png');
61
+	if (isset($_GET['resize']) && function_exists('imagecopyresampled')) {
62 62
 	$resize = filter_input(INPUT_GET,'resize',FILTER_SANITIZE_NUMBER_INT);
63 63
 	$newimg = imagecreatetruecolor($resize,$resize);
64
-        imagealphablending($newimg, false);
64
+		imagealphablending($newimg, false);
65 65
 	imagesavealpha($newimg, true);
66 66
 	imagecopyresampled($newimg,$image,0,0,0,0,15,15,imagesx($image),imagesy($image));
67 67
 	if (isset($_GET['heading'])) {
68
-    	    $heading = filter_input(INPUT_GET,'heading',FILTER_SANITIZE_NUMBER_INT);
69
-    	    $rotation = imagerotate($newimg,$heading,imageColorAllocateAlpha($newimg,0,0,0,127));
70
-    	    imagealphablending($rotation, false);
71
-	    imagesavealpha($rotation, true);
72
-    	    imagepng($rotation);
73
-    	    imagedestroy($newimg);
74
-    	    imagedestroy($image);
75
-    	    imagedestroy($rotation);
68
+			$heading = filter_input(INPUT_GET,'heading',FILTER_SANITIZE_NUMBER_INT);
69
+			$rotation = imagerotate($newimg,$heading,imageColorAllocateAlpha($newimg,0,0,0,127));
70
+			imagealphablending($rotation, false);
71
+		imagesavealpha($rotation, true);
72
+			imagepng($rotation);
73
+			imagedestroy($newimg);
74
+			imagedestroy($image);
75
+			imagedestroy($rotation);
76 76
 	
77 77
 	} else {
78
-    	    imagepng($newimg);
79
-    	    imagedestroy($newimg);
80
-    	    imagedestroy($image);
81
-        }
82
-    } else {
78
+			imagepng($newimg);
79
+			imagedestroy($newimg);
80
+			imagedestroy($image);
81
+		}
82
+	} else {
83 83
 	imagealphablending($image, false);
84
-        imagesavealpha($image, true);
84
+		imagesavealpha($image, true);
85 85
 	imagepng($image);
86 86
 	imagepng($image);
87 87
 	if (is_writable('cache')) {
88
-    	    imagepng($image,dirname(__FILE__).DIRECTORY_SEPARATOR.'cache/'.$color.'-'.$filename);
88
+			imagepng($image,dirname(__FILE__).DIRECTORY_SEPARATOR.'cache/'.$color.'-'.$filename);
89
+	}
90
+		imagedestroy($image);
89 91
 	}
90
-        imagedestroy($image);
91
-    }
92 92
 } else {
93
-    header('Content-type: image/png');
94
-    if (isset($_GET['tracker'])) {
95
-        readfile(dirname(__FILE__).DIRECTORY_SEPARATOR.'images/vehicules/'.$filename);
96
-    } elseif (isset($_GET['marine'])) {
97
-        readfile(dirname(__FILE__).DIRECTORY_SEPARATOR.'images/vehicules/'.$filename);
98
-    } else {
99
-        if ($color == 'FF0000') readfile(dirname(__FILE__).DIRECTORY_SEPARATOR.'images/aircrafts/selected/'.$filename);
93
+	header('Content-type: image/png');
94
+	if (isset($_GET['tracker'])) {
95
+		readfile(dirname(__FILE__).DIRECTORY_SEPARATOR.'images/vehicules/'.$filename);
96
+	} elseif (isset($_GET['marine'])) {
97
+		readfile(dirname(__FILE__).DIRECTORY_SEPARATOR.'images/vehicules/'.$filename);
98
+	} else {
99
+		if ($color == 'FF0000') readfile(dirname(__FILE__).DIRECTORY_SEPARATOR.'images/aircrafts/selected/'.$filename);
100 100
 	else readfile(dirname(__FILE__).DIRECTORY_SEPARATOR.'images/aircrafts/'.$filename);
101
-    }
101
+	}
102 102
 }
103 103
 ?>
104 104
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -96,8 +96,11 @@
 block discarded – undo
96 96
     } elseif (isset($_GET['marine'])) {
97 97
         readfile(dirname(__FILE__).DIRECTORY_SEPARATOR.'images/vehicules/'.$filename);
98 98
     } else {
99
-        if ($color == 'FF0000') readfile(dirname(__FILE__).DIRECTORY_SEPARATOR.'images/aircrafts/selected/'.$filename);
100
-	else readfile(dirname(__FILE__).DIRECTORY_SEPARATOR.'images/aircrafts/'.$filename);
99
+        if ($color == 'FF0000') {
100
+        	readfile(dirname(__FILE__).DIRECTORY_SEPARATOR.'images/aircrafts/selected/'.$filename);
101
+        } else {
102
+		readfile(dirname(__FILE__).DIRECTORY_SEPARATOR.'images/aircrafts/'.$filename);
103
+	}
101 104
     }
102 105
 }
103 106
 ?>
104 107
\ No newline at end of file
Please login to merge, or discard this patch.
require/class.ACARS.php 3 patches
Indentation   +72 added lines, -72 removed lines patch added patch discarded remove patch
@@ -16,11 +16,11 @@  discard block
 block discarded – undo
16 16
 		$this->SI = new SpotterImport($this->db);
17 17
 	}
18 18
 	/**
19
-	* Change IATA to ICAO value for ident
20
-	*
21
-	* @param String $ident ident
22
-	* @return String the icao
23
-	*/
19
+	 * Change IATA to ICAO value for ident
20
+	 *
21
+	 * @param String $ident ident
22
+	 * @return String the icao
23
+	 */
24 24
 	public function ident2icao($ident) {
25 25
 		if (substr($ident,0,2) == 'AF') {
26 26
 			if (filter_var(substr($ident,2),FILTER_VALIDATE_INT,array("flags"=>FILTER_FLAG_ALLOW_OCTAL))) $icao = $ident;
@@ -36,11 +36,11 @@  discard block
 block discarded – undo
36 36
 	}
37 37
 
38 38
 	/**
39
-	* Deletes all info in the live table
40
-	*
41
-	* @return String success or false
42
-	*
43
-	*/
39
+	 * Deletes all info in the live table
40
+	 *
41
+	 * @return String success or false
42
+	 *
43
+	 */
44 44
 	public function deleteLiveAcarsData()
45 45
 	{
46 46
 		global $globalDBdriver;
@@ -60,11 +60,11 @@  discard block
 block discarded – undo
60 60
 	}
61 61
 
62 62
 	/**
63
-	* Deletes all info in the archive table
64
-	*
65
-	* @return String success or false
66
-	*
67
-	*/
63
+	 * Deletes all info in the archive table
64
+	 *
65
+	 * @return String success or false
66
+	 *
67
+	 */
68 68
 	public function deleteArchiveAcarsData()
69 69
 	{
70 70
 		global $globalACARSArchiveKeepMonths, $globalDBdriver;
@@ -85,11 +85,11 @@  discard block
 block discarded – undo
85 85
 
86 86
 
87 87
 	/**
88
-	* Parse ACARS data
89
-	*
90
-	* @param String ACARS data in acarsdec data
91
-	*
92
-	*/
88
+	 * Parse ACARS data
89
+	 *
90
+	 * @param String ACARS data in acarsdec data
91
+	 *
92
+	 */
93 93
 	public function parse($data) {
94 94
 		global $globalDebug, $globalACARSArchive;
95 95
 		//$Image = new Image($this->db);
@@ -666,11 +666,11 @@  discard block
 block discarded – undo
666 666
 
667 667
 
668 668
 	/**
669
-	* Add ACARS data
670
-	*
671
-	* @param String ACARS data in acarsdec data
672
-	*
673
-	*/
669
+	 * Add ACARS data
670
+	 *
671
+	 * @param String ACARS data in acarsdec data
672
+	 *
673
+	 */
674 674
 	function add($data) {
675 675
 		global $globalDebug, $globalACARSArchive;
676 676
 		$Image = new Image($this->db);
@@ -725,15 +725,15 @@  discard block
 block discarded – undo
725 725
 	}
726 726
 
727 727
 	/**
728
-	* Add Live ACARS data in DB
729
-	*
730
-	* @param String $ident ident
731
-	* @param String $registration Registration of the aircraft
732
-	* @param String $label Label of the ACARS message
733
-	* @param String $block_id Block id of the ACARS message
734
-	* @param String $msg_no Number of the ACARS message
735
-	* @param String $message ACARS message
736
-	*/
728
+	 * Add Live ACARS data in DB
729
+	 *
730
+	 * @param String $ident ident
731
+	 * @param String $registration Registration of the aircraft
732
+	 * @param String $label Label of the ACARS message
733
+	 * @param String $block_id Block id of the ACARS message
734
+	 * @param String $msg_no Number of the ACARS message
735
+	 * @param String $message ACARS message
736
+	 */
737 737
 	public function addLiveAcarsData($ident,$registration,$label,$block_id,$msg_no,$message,$decode = '') {
738 738
 		global $globalDebug;
739 739
 		date_default_timezone_set('UTC');
@@ -771,15 +771,15 @@  discard block
 block discarded – undo
771 771
 	}
772 772
 
773 773
 	/**
774
-	* Add Archive ACARS data in DB
775
-	*
776
-	* @param String $ident ident
777
-	* @param String $registration Registration of the aircraft
778
-	* @param String $label Label of the ACARS message
779
-	* @param String $block_id Block id of the ACARS message
780
-	* @param String $msg_no Number of the ACARS message
781
-	* @param String $message ACARS message
782
-	*/
774
+	 * Add Archive ACARS data in DB
775
+	 *
776
+	 * @param String $ident ident
777
+	 * @param String $registration Registration of the aircraft
778
+	 * @param String $label Label of the ACARS message
779
+	 * @param String $block_id Block id of the ACARS message
780
+	 * @param String $msg_no Number of the ACARS message
781
+	 * @param String $message ACARS message
782
+	 */
783 783
 	public function addArchiveAcarsData($ident,$registration,$label,$block_id,$msg_no,$message,$decode = '') {
784 784
 		global $globalDebug;
785 785
 		date_default_timezone_set('UTC');
@@ -813,11 +813,11 @@  discard block
 block discarded – undo
813 813
 	}
814 814
 
815 815
 	/**
816
-	* Get Message title from label from DB
817
-	*
818
-	* @param String $label
819
-	* @return String Return ACARS title
820
-	*/
816
+	 * Get Message title from label from DB
817
+	 *
818
+	 * @param String $label
819
+	 * @return String Return ACARS title
820
+	 */
821 821
 	public function getTitlefromLabel($label) {
822 822
 		$Connection = new Connection($this->db);
823 823
 		$this->db = $Connection->db;
@@ -837,10 +837,10 @@  discard block
 block discarded – undo
837 837
 	}
838 838
 
839 839
 	/**
840
-	* List all Message title & label from DB
841
-	*
842
-	* @return Array Return ACARS data in array
843
-	*/
840
+	 * List all Message title & label from DB
841
+	 *
842
+	 * @return Array Return ACARS data in array
843
+	 */
844 844
 	public function getAllTitleLabel() {
845 845
 		$query = "SELECT * FROM acars_label ORDER BY title";
846 846
 		$query_values = array();
@@ -858,11 +858,11 @@  discard block
 block discarded – undo
858 858
 	}
859 859
 
860 860
 	/**
861
-	* Get Live ACARS data from DB
862
-	*
863
-	* @param String $ident
864
-	* @return Array Return ACARS data in array
865
-	*/
861
+	 * Get Live ACARS data from DB
862
+	 *
863
+	 * @param String $ident
864
+	 * @return Array Return ACARS data in array
865
+	 */
866 866
 	public function getLiveAcarsData($ident) {
867 867
 		$query = "SELECT * FROM acars_live WHERE ident = :ident ORDER BY acars_live_id DESC";
868 868
 		$query_values = array(':ident' => $ident);
@@ -880,10 +880,10 @@  discard block
 block discarded – undo
880 880
 	}
881 881
 
882 882
 	/**
883
-	* Get Latest ACARS data from DB
884
-	*
885
-	* @return Array Return ACARS data in array
886
-	*/
883
+	 * Get Latest ACARS data from DB
884
+	 *
885
+	 * @return Array Return ACARS data in array
886
+	 */
887 887
 	public function getLatestAcarsData($limit = '',$label = '') {
888 888
 		global $globalURL, $globalDBdriver;
889 889
 		$Image = new Image($this->db);
@@ -980,10 +980,10 @@  discard block
 block discarded – undo
980 980
 	}
981 981
 
982 982
 	/**
983
-	* Get Archive ACARS data from DB
984
-	*
985
-	* @return Array Return ACARS data in array
986
-	*/
983
+	 * Get Archive ACARS data from DB
984
+	 *
985
+	 * @return Array Return ACARS data in array
986
+	 */
987 987
 	public function getArchiveAcarsData($limit = '',$label = '') {
988 988
 		global $globalURL, $globalDBdriver;
989 989
 		$Image = new Image($this->db);
@@ -1085,13 +1085,13 @@  discard block
 block discarded – undo
1085 1085
 	}
1086 1086
 
1087 1087
 	/**
1088
-	* Add ModeS data to DB
1089
-	*
1090
-	* @param String $ident ident
1091
-	* @param String $registration Registration of the aircraft
1092
-	* @param String $icao
1093
-	* @param String $ICAOTypeCode
1094
-	*/
1088
+	 * Add ModeS data to DB
1089
+	 *
1090
+	 * @param String $ident ident
1091
+	 * @param String $registration Registration of the aircraft
1092
+	 * @param String $icao
1093
+	 * @param String $ICAOTypeCode
1094
+	 */
1095 1095
 	public function addModeSData($ident,$registration,$icao = '',$ICAOTypeCode = '',$latitude = '', $longitude = '') {
1096 1096
 		global $globalDebug, $globalDBdriver;
1097 1097
 		$ident = trim($ident);
Please login to merge, or discard this patch.
Spacing   +255 added lines, -255 removed lines patch added patch discarded remove patch
@@ -22,14 +22,14 @@  discard block
 block discarded – undo
22 22
 	* @return String the icao
23 23
 	*/
24 24
 	public function ident2icao($ident) {
25
-		if (substr($ident,0,2) == 'AF') {
26
-			if (filter_var(substr($ident,2),FILTER_VALIDATE_INT,array("flags"=>FILTER_FLAG_ALLOW_OCTAL))) $icao = $ident;
27
-			else $icao = 'AFR'.ltrim(substr($ident,2),'0');
25
+		if (substr($ident, 0, 2) == 'AF') {
26
+			if (filter_var(substr($ident, 2), FILTER_VALIDATE_INT, array("flags"=>FILTER_FLAG_ALLOW_OCTAL))) $icao = $ident;
27
+			else $icao = 'AFR'.ltrim(substr($ident, 2), '0');
28 28
 		} else {
29 29
 			$Spotter = new Spotter($this->db);
30
-			$identicao = $Spotter->getAllAirlineInfo(substr($ident,0,2));
30
+			$identicao = $Spotter->getAllAirlineInfo(substr($ident, 0, 2));
31 31
 			if (isset($identicao[0])) {
32
-				$icao = $identicao[0]['icao'].ltrim(substr($ident,2),'0');
32
+				$icao = $identicao[0]['icao'].ltrim(substr($ident, 2), '0');
33 33
 			} else $icao = $ident;
34 34
 		}
35 35
 		return $icao;
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 
54 54
 			$sth = $this->db->prepare($query);
55 55
 			$sth->execute();
56
-		} catch(PDOException $e) {
56
+		} catch (PDOException $e) {
57 57
 			return "error";
58 58
 		}
59 59
 		return "success";
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 
78 78
 			$sth = $this->db->prepare($query);
79 79
 			$sth->execute();
80
-		} catch(PDOException $e) {
80
+		} catch (PDOException $e) {
81 81
 			return "error";
82 82
 		}
83 83
 		return "success";
@@ -102,13 +102,13 @@  discard block
 block discarded – undo
102 102
 		$ident = '';
103 103
 		$message = '';
104 104
 		$result = array();
105
-		$n = sscanf($data,'(null) %*d %*02d/%*02d/%*04d %*02d:%*02d:%*02d %*d %*[0-9-] %*[A-Z0-9] %7s %*c %2[0-9a-zA-Z_] %d %4[0-9A-Z] %6[0-9A-Z] %[^\r\n]',$registration,$label,$block_id,$msg_no,$ident,$message);
106
-		if ($n == 0) $n = sscanf($data,'AC%*c %7s %*c %2[0-9a-zA-Z_] %d %4[0-9A-Z] %6[0-9A-Z] %[^\r\n]',$registration,$label,$block_id,$msg_no,$ident,$message);
107
-		if ($n == 0) $n = sscanf($data,'%*04d-%*02d-%*02d,%*02d:%*02d:%*02d,%*7s,%*c,%6[0-9A-Z-],%*c,%2[0-9a-zA-Z_],%d,%4[0-9A-Z],%6[0-9A-Z],%[^\r\n]',$registration,$label,$block_id,$msg_no,$ident,$message);
108
-		if ($n == 0) $n = sscanf($data,'%*04d-%*02d-%*02d,%*02d:%*02d:%*02d,%*7s,%*c,%5[0-9A-Z],%*c,%2[0-9a-zA-Z_],%d,%4[0-9A-Z],%6[0-9A-Z],%[^\r\n]',$registration,$label,$block_id,$msg_no,$ident,$message);
105
+		$n = sscanf($data, '(null) %*d %*02d/%*02d/%*04d %*02d:%*02d:%*02d %*d %*[0-9-] %*[A-Z0-9] %7s %*c %2[0-9a-zA-Z_] %d %4[0-9A-Z] %6[0-9A-Z] %[^\r\n]', $registration, $label, $block_id, $msg_no, $ident, $message);
106
+		if ($n == 0) $n = sscanf($data, 'AC%*c %7s %*c %2[0-9a-zA-Z_] %d %4[0-9A-Z] %6[0-9A-Z] %[^\r\n]', $registration, $label, $block_id, $msg_no, $ident, $message);
107
+		if ($n == 0) $n = sscanf($data, '%*04d-%*02d-%*02d,%*02d:%*02d:%*02d,%*7s,%*c,%6[0-9A-Z-],%*c,%2[0-9a-zA-Z_],%d,%4[0-9A-Z],%6[0-9A-Z],%[^\r\n]', $registration, $label, $block_id, $msg_no, $ident, $message);
108
+		if ($n == 0) $n = sscanf($data, '%*04d-%*02d-%*02d,%*02d:%*02d:%*02d,%*7s,%*c,%5[0-9A-Z],%*c,%2[0-9a-zA-Z_],%d,%4[0-9A-Z],%6[0-9A-Z],%[^\r\n]', $registration, $label, $block_id, $msg_no, $ident, $message);
109 109
 		if ($n != 0) {
110
-			$registration = str_replace('.','',$registration);
111
-			$result = array('registration' => $registration, 'ident' => $ident,'label' => $label, 'block_id' => $block_id,'msg_no' => $msg_no,'message' => $message);
110
+			$registration = str_replace('.', '', $registration);
111
+			$result = array('registration' => $registration, 'ident' => $ident, 'label' => $label, 'block_id' => $block_id, 'msg_no' => $msg_no, 'message' => $message);
112 112
 			if ($globalDebug) echo "Reg. : ".$registration." - Ident : ".$ident." - Label : ".$label." - Message : ".$message."\n";
113 113
 		} else $message = $data;
114 114
 		$decode = array();
@@ -128,14 +128,14 @@  discard block
 block discarded – undo
128 128
 				$temp = '';
129 129
 				$n = sscanf($message, "FST01%4c%4c%c%06d%c%07d%03d%*8[0-9a-zA-Z ]-%02dC", $dair, $darr, $lac, $la, $lnc, $ln, $alt, $temp);
130 130
 				if ($n > 5 && ($lac == 'N' || $lac == 'S') && ($lnc == 'E' || $lnc == 'W')) {
131
-					$latitude = $la / 10000.0;
132
-					$longitude = $ln / 10000.0;
131
+					$latitude = $la/10000.0;
132
+					$longitude = $ln/10000.0;
133 133
 					if ($lac == 'S') $latitude = '-'.$latitude;
134 134
 					if ($lnc == 'W') $longitude = '-'.$longitude;
135 135
 					// Temp not always available
136 136
 					if ($globalDebug) echo 'latitude : '.$latitude.' - longitude : '.$longitude.' - airport depart : '.$dair.' - airport arrival : '.$darr.' - température : '.$temp."°C\n";
137
-					if ($temp == '') $decode = array('Latitude' => $latitude, 'Longitude' =>  $longitude, 'Departure airport' => $dair, 'Arrival airport' => $darr,'Altitude' => $alt);
138
-					else $decode = array('Latitude' => $latitude, 'Longitude' =>  $longitude, 'Departure airport' => $dair, 'Arrival airport' => $darr, 'Altitude' => 'FL'.$alt,'Temperature' => $temp.'°C');
137
+					if ($temp == '') $decode = array('Latitude' => $latitude, 'Longitude' =>  $longitude, 'Departure airport' => $dair, 'Arrival airport' => $darr, 'Altitude' => $alt);
138
+					else $decode = array('Latitude' => $latitude, 'Longitude' =>  $longitude, 'Departure airport' => $dair, 'Arrival airport' => $darr, 'Altitude' => 'FL'.$alt, 'Temperature' => $temp.'°C');
139 139
 
140 140
 					//$icao = $Translation->checkTranslation($ident);
141 141
 					//$Schedule->addSchedule($icao,$dair,'',$darr,'','ACARS');
@@ -147,19 +147,19 @@  discard block
 block discarded – undo
147 147
 				$dhour = '';
148 148
 				$darr = '';
149 149
 				$ahour = '';
150
-				$n = sscanf($message, "ARR01 %4[A-Z]%4d %4[A-Z]%4d", $dair, $dhour, $darr,$ahour);
150
+				$n = sscanf($message, "ARR01 %4[A-Z]%4d %4[A-Z]%4d", $dair, $dhour, $darr, $ahour);
151 151
 				if ($n == 4 && strlen($darr) == 4) {
152
-					if ($dhour != '') $dhour = substr(sprintf('%04d',$dhour),0,2).':'.substr(sprintf('%04d',$dhour),2);
153
-					if ($ahour != '') $ahour = substr(sprintf('%04d',$ahour),0,2).':'.substr(sprintf('%04d',$ahour),2);
154
-					if ($globalDebug) echo 'departure airport : '.$dair.' - arrival airport : '. $darr.' - departure hour : '. $dhour.' - arrival hour : '.$ahour."\n";
152
+					if ($dhour != '') $dhour = substr(sprintf('%04d', $dhour), 0, 2).':'.substr(sprintf('%04d', $dhour), 2);
153
+					if ($ahour != '') $ahour = substr(sprintf('%04d', $ahour), 0, 2).':'.substr(sprintf('%04d', $ahour), 2);
154
+					if ($globalDebug) echo 'departure airport : '.$dair.' - arrival airport : '.$darr.' - departure hour : '.$dhour.' - arrival hour : '.$ahour."\n";
155 155
 					//$icao = ACARS->ident2icao($ident);
156 156
 					//$icao = $Translation->checkTranslation($ident);
157 157
 					//$Schedule->addSchedule($icao,$dair,$dhour,$darr,$ahour,'ACARS');
158 158
 					$decode = array('Departure airport' => $dair, 'Departure hour' => $dhour, 'Arrival airport' => $darr, 'Arrival hour' => $ahour);
159 159
 					$found = true;
160 160
 				}
161
-				elseif ($n == 2 || $n  == 4) {
162
-					if ($dhour != '') $dhour = substr(sprintf('%04d',$dhour),0,2).':'.substr(sprintf('%04d',$dhour),2);
161
+				elseif ($n == 2 || $n == 4) {
162
+					if ($dhour != '') $dhour = substr(sprintf('%04d', $dhour), 0, 2).':'.substr(sprintf('%04d', $dhour), 2);
163 163
 					if ($globalDebug) echo 'airport arrival : '.$dair.' - arrival hour : '.$dhour."\n";
164 164
 					//$icao = ACARS->ident2icao($ident);
165 165
 					//$icao = $Translation->checkTranslation($ident);
@@ -217,11 +217,11 @@  discard block
 block discarded – undo
217 217
 				$ahour = '';
218 218
 				$aair = '';
219 219
 				$apiste = '';
220
-				$n = sscanf(str_replace(array("\r\n", "\n", "\r"),'',$message), "%*[0-9A-Z]/%*3d/%4s/%*cSCH/%6[0-9A-Z ]/%4c/%4c/%5s/%4d%*3c/%4d/%4c/%[0-9A-Z ]/", $airicao,$aident,$dair, $darr, $ddate, $dhour,$ahour, $aair, $apiste);
220
+				$n = sscanf(str_replace(array("\r\n", "\n", "\r"), '', $message), "%*[0-9A-Z]/%*3d/%4s/%*cSCH/%6[0-9A-Z ]/%4c/%4c/%5s/%4d%*3c/%4d/%4c/%[0-9A-Z ]/", $airicao, $aident, $dair, $darr, $ddate, $dhour, $ahour, $aair, $apiste);
221 221
 				if ($n > 8) {
222
-					if ($globalDebug) echo 'airicao : '. $airicao.' - ident : '.$aident.' - departure airport : '.$dair.' - arrival airport : '. $darr.' - date depart : '.$ddate.' - departure hour : '. $dhour.' - arrival hour : '.$ahour.' - arrival airport : '.$aair.' - arrival piste : '.$apiste."\n";
223
-					if ($dhour != '') $dhour = substr(sprintf('%04d',$dhour),0,2).':'.substr(sprintf('%04d',$dhour),2);
224
-					if ($ahour != '') $ahour = substr(sprintf('%04d',$ahour),0,2).':'.substr(sprintf('%04d',$ahour),2);
222
+					if ($globalDebug) echo 'airicao : '.$airicao.' - ident : '.$aident.' - departure airport : '.$dair.' - arrival airport : '.$darr.' - date depart : '.$ddate.' - departure hour : '.$dhour.' - arrival hour : '.$ahour.' - arrival airport : '.$aair.' - arrival piste : '.$apiste."\n";
223
+					if ($dhour != '') $dhour = substr(sprintf('%04d', $dhour), 0, 2).':'.substr(sprintf('%04d', $dhour), 2);
224
+					if ($ahour != '') $ahour = substr(sprintf('%04d', $ahour), 0, 2).':'.substr(sprintf('%04d', $ahour), 2);
225 225
 					$icao = trim($aident);
226 226
 
227 227
 					//$decode = 'Departure airport : '.$dair.' ('.$ddate.' at '.$dhour.') - Arrival Airport : '.$aair.' (at '.$ahour.') way '.$apiste;
@@ -246,8 +246,8 @@  discard block
 block discarded – undo
246 246
 				if ($n == 10 && ($lac == 'N' || $lac == 'S') && ($lnc == 'E' || $lnc == 'W')) {
247 247
 					$las = $las.'.'.$lass;
248 248
 					$lns = $lns.'.'.$lns;
249
-					$latitude = $las / 1000.0;
250
-					$longitude = $lns / 1000.0;
249
+					$latitude = $las/1000.0;
250
+					$longitude = $lns/1000.0;
251 251
 					if ($lac == 'S') $latitude = '-'.$latitude;
252 252
 					if ($lnc == 'W') $longitude = '-'.$longitude;
253 253
 					if ($globalDebug) echo 'latitude : '.$latitude.' - longitude : '.$longitude."\n";
@@ -342,17 +342,17 @@  discard block
 block discarded – undo
342 342
 				$alt = '';
343 343
 				$fuel = '';
344 344
 				$speed = '';
345
-				$n = sscanf(str_replace(array("\r\n", "\n", "\r"),'',$message), "#DFB(POS-%s -%4d%c%5d%c/%*d F%dRMK/FUEL %f M%f", $aident, $las, $lac, $lns, $lnc, $alt, $fuel, $speed);
345
+				$n = sscanf(str_replace(array("\r\n", "\n", "\r"), '', $message), "#DFB(POS-%s -%4d%c%5d%c/%*d F%dRMK/FUEL %f M%f", $aident, $las, $lac, $lns, $lnc, $alt, $fuel, $speed);
346 346
 				if ($n == 9) {
347 347
 					//if (self->$debug) echo 'airport depart : '.$dair.' - airport arrival : '.$darr."\n";
348 348
 					$icao = trim($aident);
349 349
 					$decode['icao'] = $icao;
350
-					$latitude = $las / 100.0;
351
-					$longitude = $lns / 100.0;
350
+					$latitude = $las/100.0;
351
+					$longitude = $lns/100.0;
352 352
 					if ($lac == 'S') $latitude = '-'.$latitude;
353 353
 					if ($lnc == 'W') $longitude = '-'.$longitude;
354 354
 
355
-					$decode = array('Latitude' => $latitude,'Longitude' => $longitude,'Altitude' => 'FL'.$alt,'Fuel' => $fuel,'speed' => $speed);
355
+					$decode = array('Latitude' => $latitude, 'Longitude' => $longitude, 'Altitude' => 'FL'.$alt, 'Fuel' => $fuel, 'speed' => $speed);
356 356
 					$found = true;
357 357
 				}
358 358
 			}
@@ -371,7 +371,7 @@  discard block
 block discarded – undo
371 371
 					if ($lac == 'S') $latitude = '-'.$latitude;
372 372
 					if ($lnc == 'W') $longitude = '-'.$longitude;
373 373
 
374
-					$decode = array('Latitude' => $latitude,'Longitude' => $longitude);
374
+					$decode = array('Latitude' => $latitude, 'Longitude' => $longitude);
375 375
 					$found = true;
376 376
 				}
377 377
 			}
@@ -404,7 +404,7 @@  discard block
 block discarded – undo
404 404
 				$dair = '';
405 405
 				$darr = '';
406 406
 				$aident = '';
407
-				$n = sscanf(str_replace(array("\r\n", "\n", "\r"),'',$message), "%*[0-9A-Z],,%*[0-9A-Z],%*[0-9A-Z],%4s,%4s,.%*6s,%*4[A-Z],%[0-9A-Z],", $dair, $darr, $aident);
407
+				$n = sscanf(str_replace(array("\r\n", "\n", "\r"), '', $message), "%*[0-9A-Z],,%*[0-9A-Z],%*[0-9A-Z],%4s,%4s,.%*6s,%*4[A-Z],%[0-9A-Z],", $dair, $darr, $aident);
408 408
 				if ($n == 8) {
409 409
 					if ($globalDebug) echo 'airport depart : '.$dair.' - airport arrival : '.$darr."\n";
410 410
 					$icao = trim($aident);
@@ -437,7 +437,7 @@  discard block
 block discarded – undo
437 437
 				*/
438 438
 				$dair = '';
439 439
 				$darr = '';
440
-				$n = sscanf($message,'%4[A-Z]%4[A-Z]%*4d',$dair,$darr);
440
+				$n = sscanf($message, '%4[A-Z]%4[A-Z]%*4d', $dair, $darr);
441 441
 				if ($n == 3) {
442 442
 					if ($globalDebug) echo 'airport depart : '.$dair.' - airport arrival : '.$darr."\n";
443 443
 					//$icao = $Translation->checkTranslation($ident);
@@ -453,7 +453,7 @@  discard block
 block discarded – undo
453 453
 				*/
454 454
 				$dair = '';
455 455
 				$darr = '';
456
-				$n = sscanf($message,'3J01 DSPTCH %*d/%*d %4s/%4s .%*6s',$dair,$darr);
456
+				$n = sscanf($message, '3J01 DSPTCH %*d/%*d %4s/%4s .%*6s', $dair, $darr);
457 457
 				if ($n == 3) {
458 458
 					if ($globalDebug) echo 'airport depart : '.$dair.' - airport arrival : '.$darr."\n";
459 459
 					//$icao = $Translation->checkTranslation($ident);
@@ -464,7 +464,7 @@  discard block
 block discarded – undo
464 464
 				}
465 465
 			}
466 466
 			if (!$found) {
467
-				$n = sscanf($message,'MET01%4c',$airport);
467
+				$n = sscanf($message, 'MET01%4c', $airport);
468 468
 				if ($n == 1) {
469 469
 					if ($globalDebug) echo 'airport name : '.$airport;
470 470
 					$decode = array('Airport/Waypoint name' => $airport);
@@ -473,241 +473,241 @@  discard block
 block discarded – undo
473 473
 			}
474 474
 
475 475
 			if ($label == 'H1') {
476
-				if (preg_match('/^#CFBFLR/',$message) || preg_match('/^#CFBWRN/',$message)) {
477
-					$decode = array_merge(array('Message nature' => 'Equipment failure'),$decode);
476
+				if (preg_match('/^#CFBFLR/', $message) || preg_match('/^#CFBWRN/', $message)) {
477
+					$decode = array_merge(array('Message nature' => 'Equipment failure'), $decode);
478 478
 				}
479
-				elseif (preg_match('/^#DFB\*TKO/',$message) || preg_match('/^#DFBTKO/',$message)) {
480
-					$decode = array_merge(array('Message nature' => 'Take off performance data'),$decode);
479
+				elseif (preg_match('/^#DFB\*TKO/', $message) || preg_match('/^#DFBTKO/', $message)) {
480
+					$decode = array_merge(array('Message nature' => 'Take off performance data'), $decode);
481 481
 				}
482
-				elseif (preg_match('/^#DFB\*CRZ/',$message) || preg_match('/^#DFBCRZ/',$message)) {
483
-					$decode = array_merge(array('Message nature' => 'Cruise performance data'),$decode);
482
+				elseif (preg_match('/^#DFB\*CRZ/', $message) || preg_match('/^#DFBCRZ/', $message)) {
483
+					$decode = array_merge(array('Message nature' => 'Cruise performance data'), $decode);
484 484
 				}
485
-				elseif (preg_match('/^#DFB\*WOB/',$message) || preg_match('/^#DFBWOB/',$message)) {
486
-					$decode = array_merge(array('Message nature' => 'Weather observation'),$decode);
485
+				elseif (preg_match('/^#DFB\*WOB/', $message) || preg_match('/^#DFBWOB/', $message)) {
486
+					$decode = array_merge(array('Message nature' => 'Weather observation'), $decode);
487 487
 				}
488
-				elseif (preg_match(':^#DFB/PIREP:',$message)) {
489
-					$decode = array_merge(array('Message nature' => 'Pilot Report'),$decode);
488
+				elseif (preg_match(':^#DFB/PIREP:', $message)) {
489
+					$decode = array_merge(array('Message nature' => 'Pilot Report'), $decode);
490 490
 				}
491
-				elseif (preg_match('/^#DFBEDA/',$message) || preg_match('/^#DFBENG/',$message)) {
492
-					$decode = array_merge(array('Message nature' => 'Engine Data'),$decode);
491
+				elseif (preg_match('/^#DFBEDA/', $message) || preg_match('/^#DFBENG/', $message)) {
492
+					$decode = array_merge(array('Message nature' => 'Engine Data'), $decode);
493 493
 				}
494
-				elseif (preg_match(':^#M1AAEP:',$message)) {
495
-					$decode = array_merge(array('Message nature' => 'Position/Weather Report'),$decode);
494
+				elseif (preg_match(':^#M1AAEP:', $message)) {
495
+					$decode = array_merge(array('Message nature' => 'Position/Weather Report'), $decode);
496 496
 				}
497
-				elseif (preg_match(':^#M2APWD:',$message)) {
498
-					$decode = array_merge(array('Message nature' => 'Flight plan predicted wind data'),$decode);
497
+				elseif (preg_match(':^#M2APWD:', $message)) {
498
+					$decode = array_merge(array('Message nature' => 'Flight plan predicted wind data'), $decode);
499 499
 				}
500
-				elseif (preg_match(':^#M1BREQPWI:',$message)) {
501
-					$decode = array_merge(array('Message nature' => 'Predicted wind info request'),$decode);
500
+				elseif (preg_match(':^#M1BREQPWI:', $message)) {
501
+					$decode = array_merge(array('Message nature' => 'Predicted wind info request'), $decode);
502 502
 				}
503
-				elseif (preg_match(':^#CF:',$message)) {
504
-					$decode = array_merge(array('Message nature' => 'Central Fault Display'),$decode);
503
+				elseif (preg_match(':^#CF:', $message)) {
504
+					$decode = array_merge(array('Message nature' => 'Central Fault Display'), $decode);
505 505
 				}
506
-				elseif (preg_match(':^#DF:',$message)) {
507
-					$decode = array_merge(array('Message nature' => 'Digital Flight Data Acquisition Unit'),$decode);
506
+				elseif (preg_match(':^#DF:', $message)) {
507
+					$decode = array_merge(array('Message nature' => 'Digital Flight Data Acquisition Unit'), $decode);
508 508
 				}
509
-				elseif (preg_match(':^#EC:',$message)) {
510
-					$decode = array_merge(array('Message nature' => 'Engine Display System'),$decode);
509
+				elseif (preg_match(':^#EC:', $message)) {
510
+					$decode = array_merge(array('Message nature' => 'Engine Display System'), $decode);
511 511
 				}
512
-				elseif (preg_match(':^#EI:',$message)) {
513
-					$decode = array_merge(array('Message nature' => 'Engine Report'),$decode);
512
+				elseif (preg_match(':^#EI:', $message)) {
513
+					$decode = array_merge(array('Message nature' => 'Engine Report'), $decode);
514 514
 				}
515
-				elseif (preg_match(':^#H1:',$message)) {
516
-					$decode = array_merge(array('Message nature' => 'HF Data Radio - Left'),$decode);
515
+				elseif (preg_match(':^#H1:', $message)) {
516
+					$decode = array_merge(array('Message nature' => 'HF Data Radio - Left'), $decode);
517 517
 				}
518
-				elseif (preg_match(':^#H2:',$message)) {
519
-					$decode = array_merge(array('Message nature' => 'HF Data Radio - Right'),$decode);
518
+				elseif (preg_match(':^#H2:', $message)) {
519
+					$decode = array_merge(array('Message nature' => 'HF Data Radio - Right'), $decode);
520 520
 				}
521
-				elseif (preg_match(':^#HD:',$message)) {
522
-					$decode = array_merge(array('Message nature' => 'HF Data Radio - Selected'),$decode);
521
+				elseif (preg_match(':^#HD:', $message)) {
522
+					$decode = array_merge(array('Message nature' => 'HF Data Radio - Selected'), $decode);
523 523
 				}
524
-				elseif (preg_match(':^#M1:',$message)) {
525
-					$decode = array_merge(array('Message nature' => 'Flight Management Computer - Left'),$decode);
524
+				elseif (preg_match(':^#M1:', $message)) {
525
+					$decode = array_merge(array('Message nature' => 'Flight Management Computer - Left'), $decode);
526 526
 				}
527
-				elseif (preg_match(':^#M2:',$message)) {
528
-					$decode = array_merge(array('Message nature' => 'Flight Management Computer - Right'),$decode);
527
+				elseif (preg_match(':^#M2:', $message)) {
528
+					$decode = array_merge(array('Message nature' => 'Flight Management Computer - Right'), $decode);
529 529
 				}
530
-				elseif (preg_match(':^#M3:',$message)) {
531
-					$decode = array_merge(array('Message nature' => 'Flight Management Computer - Center'),$decode);
530
+				elseif (preg_match(':^#M3:', $message)) {
531
+					$decode = array_merge(array('Message nature' => 'Flight Management Computer - Center'), $decode);
532 532
 				}
533
-				elseif (preg_match(':^#MD:',$message)) {
534
-					$decode = array_merge(array('Message nature' => 'Flight Management Computer - Selected'),$decode);
533
+				elseif (preg_match(':^#MD:', $message)) {
534
+					$decode = array_merge(array('Message nature' => 'Flight Management Computer - Selected'), $decode);
535 535
 				}
536
-				elseif (preg_match(':^#PS:',$message)) {
537
-					$decode = array_merge(array('Message nature' => 'Keyboard/Display Unit'),$decode);
536
+				elseif (preg_match(':^#PS:', $message)) {
537
+					$decode = array_merge(array('Message nature' => 'Keyboard/Display Unit'), $decode);
538 538
 				}
539
-				elseif (preg_match(':^#S1:',$message)) {
540
-					$decode = array_merge(array('Message nature' => 'SDU - Left'),$decode);
539
+				elseif (preg_match(':^#S1:', $message)) {
540
+					$decode = array_merge(array('Message nature' => 'SDU - Left'), $decode);
541 541
 				}
542
-				elseif (preg_match(':^#S2:',$message)) {
543
-					$decode = array_merge(array('Message nature' => 'SDU - Right'),$decode);
542
+				elseif (preg_match(':^#S2:', $message)) {
543
+					$decode = array_merge(array('Message nature' => 'SDU - Right'), $decode);
544 544
 				}
545
-				elseif (preg_match(':^#SD:',$message)) {
546
-					$decode = array_merge(array('Message nature' => 'SDU - Selected'),$decode);
545
+				elseif (preg_match(':^#SD:', $message)) {
546
+					$decode = array_merge(array('Message nature' => 'SDU - Selected'), $decode);
547 547
 				}
548
-				elseif (preg_match(':^#T[0-8]:',$message)) {
549
-					$decode = array_merge(array('Message nature' => 'Cabin Terminal Messages'),$decode);
548
+				elseif (preg_match(':^#T[0-8]:', $message)) {
549
+					$decode = array_merge(array('Message nature' => 'Cabin Terminal Messages'), $decode);
550 550
 				}
551
-				elseif (preg_match(':^#WO:',$message)) {
552
-					$decode = array_merge(array('Message nature' => 'Weather Observation Report'),$decode);
551
+				elseif (preg_match(':^#WO:', $message)) {
552
+					$decode = array_merge(array('Message nature' => 'Weather Observation Report'), $decode);
553 553
 				}
554
-				elseif (preg_match(':^#A1:',$message)) {
555
-					$decode = array_merge(array('Message nature' => 'Oceanic Clearance'),$decode);
554
+				elseif (preg_match(':^#A1:', $message)) {
555
+					$decode = array_merge(array('Message nature' => 'Oceanic Clearance'), $decode);
556 556
 				}
557
-				elseif (preg_match(':^#A3:',$message)) {
558
-					$decode = array_merge(array('Message nature' => 'Departure Clearance Response'),$decode);
557
+				elseif (preg_match(':^#A3:', $message)) {
558
+					$decode = array_merge(array('Message nature' => 'Departure Clearance Response'), $decode);
559 559
 				}
560
-				elseif (preg_match(':^#A4:',$message)) {
561
-					$decode = array_merge(array('Message nature' => 'Flight Systems Message'),$decode);
560
+				elseif (preg_match(':^#A4:', $message)) {
561
+					$decode = array_merge(array('Message nature' => 'Flight Systems Message'), $decode);
562 562
 				}
563
-				elseif (preg_match(':^#A6:',$message)) {
564
-					$decode = array_merge(array('Message nature' => 'Request ADS Reports'),$decode);
563
+				elseif (preg_match(':^#A6:', $message)) {
564
+					$decode = array_merge(array('Message nature' => 'Request ADS Reports'), $decode);
565 565
 				}
566
-				elseif (preg_match(':^#A8:',$message)) {
567
-					$decode = array_merge(array('Message nature' => 'Deliver Departure Slot'),$decode);
566
+				elseif (preg_match(':^#A8:', $message)) {
567
+					$decode = array_merge(array('Message nature' => 'Deliver Departure Slot'), $decode);
568 568
 				}
569
-				elseif (preg_match(':^#A9:',$message)) {
570
-					$decode = array_merge(array('Message nature' => 'ATIS report'),$decode);
569
+				elseif (preg_match(':^#A9:', $message)) {
570
+					$decode = array_merge(array('Message nature' => 'ATIS report'), $decode);
571 571
 				}
572
-				elseif (preg_match(':^#A0:',$message)) {
573
-					$decode = array_merge(array('Message nature' => 'ATIS Facility Notification (AFN)'),$decode);
572
+				elseif (preg_match(':^#A0:', $message)) {
573
+					$decode = array_merge(array('Message nature' => 'ATIS Facility Notification (AFN)'), $decode);
574 574
 				}
575
-				elseif (preg_match(':^#AA:',$message)) {
576
-					$decode = array_merge(array('Message nature' => 'ATCComm'),$decode);
575
+				elseif (preg_match(':^#AA:', $message)) {
576
+					$decode = array_merge(array('Message nature' => 'ATCComm'), $decode);
577 577
 				}
578
-				elseif (preg_match(':^#AB:',$message)) {
579
-					$decode = array_merge(array('Message nature' => 'TWIP Report'),$decode);
578
+				elseif (preg_match(':^#AB:', $message)) {
579
+					$decode = array_merge(array('Message nature' => 'TWIP Report'), $decode);
580 580
 				}
581
-				elseif (preg_match(':^#AC:',$message)) {
582
-					$decode = array_merge(array('Message nature' => 'Pushback Clearance'),$decode);
581
+				elseif (preg_match(':^#AC:', $message)) {
582
+					$decode = array_merge(array('Message nature' => 'Pushback Clearance'), $decode);
583 583
 				}
584
-				elseif (preg_match(':^#AD:',$message)) {
585
-					$decode = array_merge(array('Message nature' => 'Expected Taxi Clearance'),$decode);
584
+				elseif (preg_match(':^#AD:', $message)) {
585
+					$decode = array_merge(array('Message nature' => 'Expected Taxi Clearance'), $decode);
586 586
 				}
587
-				elseif (preg_match(':^#AF:',$message)) {
588
-					$decode = array_merge(array('Message nature' => 'CPC Command/Response'),$decode);
587
+				elseif (preg_match(':^#AF:', $message)) {
588
+					$decode = array_merge(array('Message nature' => 'CPC Command/Response'), $decode);
589 589
 				}
590
-				elseif (preg_match(':^#B1:',$message)) {
591
-					$decode = array_merge(array('Message nature' => 'Request Oceanic Clearance'),$decode);
590
+				elseif (preg_match(':^#B1:', $message)) {
591
+					$decode = array_merge(array('Message nature' => 'Request Oceanic Clearance'), $decode);
592 592
 				}
593
-				elseif (preg_match(':^#B2:',$message)) {
594
-					$decode = array_merge(array('Message nature' => 'Oceanic Clearance Readback'),$decode);
593
+				elseif (preg_match(':^#B2:', $message)) {
594
+					$decode = array_merge(array('Message nature' => 'Oceanic Clearance Readback'), $decode);
595 595
 				}
596
-				elseif (preg_match(':^#B3:',$message)) {
597
-					$decode = array_merge(array('Message nature' => 'Request Departure Clearance'),$decode);
596
+				elseif (preg_match(':^#B3:', $message)) {
597
+					$decode = array_merge(array('Message nature' => 'Request Departure Clearance'), $decode);
598 598
 				}
599
-				elseif (preg_match(':^#B4:',$message)) {
600
-					$decode = array_merge(array('Message nature' => 'Departure Clearance Readback'),$decode);
599
+				elseif (preg_match(':^#B4:', $message)) {
600
+					$decode = array_merge(array('Message nature' => 'Departure Clearance Readback'), $decode);
601 601
 				}
602
-				elseif (preg_match(':^#B6:',$message)) {
603
-					$decode = array_merge(array('Message nature' => 'Provide ADS Report'),$decode);
602
+				elseif (preg_match(':^#B6:', $message)) {
603
+					$decode = array_merge(array('Message nature' => 'Provide ADS Report'), $decode);
604 604
 				}
605
-				elseif (preg_match(':^#B8:',$message)) {
606
-					$decode = array_merge(array('Message nature' => 'Request Departure Slot'),$decode);
605
+				elseif (preg_match(':^#B8:', $message)) {
606
+					$decode = array_merge(array('Message nature' => 'Request Departure Slot'), $decode);
607 607
 				}
608
-				elseif (preg_match(':^#B9:',$message)) {
609
-					$decode = array_merge(array('Message nature' => 'Request ATIS Report'),$decode);
608
+				elseif (preg_match(':^#B9:', $message)) {
609
+					$decode = array_merge(array('Message nature' => 'Request ATIS Report'), $decode);
610 610
 				}
611
-				elseif (preg_match(':^#B0:',$message)) {
612
-					$decode = array_merge(array('Message nature' => 'ATS Facility Notification'),$decode);
611
+				elseif (preg_match(':^#B0:', $message)) {
612
+					$decode = array_merge(array('Message nature' => 'ATS Facility Notification'), $decode);
613 613
 				}
614
-				elseif (preg_match(':^#BA:',$message)) {
615
-					$decode = array_merge(array('Message nature' => 'ATCComm'),$decode);
614
+				elseif (preg_match(':^#BA:', $message)) {
615
+					$decode = array_merge(array('Message nature' => 'ATCComm'), $decode);
616 616
 				}
617
-				elseif (preg_match(':^#BB:',$message)) {
618
-					$decode = array_merge(array('Message nature' => 'Request TWIP Report'),$decode);
617
+				elseif (preg_match(':^#BB:', $message)) {
618
+					$decode = array_merge(array('Message nature' => 'Request TWIP Report'), $decode);
619 619
 				}
620
-				elseif (preg_match(':^#BC:',$message)) {
621
-					$decode = array_merge(array('Message nature' => 'Pushback Clearance Request'),$decode);
620
+				elseif (preg_match(':^#BC:', $message)) {
621
+					$decode = array_merge(array('Message nature' => 'Pushback Clearance Request'), $decode);
622 622
 				}
623
-				elseif (preg_match(':^#BD:',$message)) {
624
-					$decode = array_merge(array('Message nature' => 'Expected Taxi Clearance Request'),$decode);
623
+				elseif (preg_match(':^#BD:', $message)) {
624
+					$decode = array_merge(array('Message nature' => 'Expected Taxi Clearance Request'), $decode);
625 625
 				}
626
-				elseif (preg_match(':^#BE:',$message)) {
627
-					$decode = array_merge(array('Message nature' => 'CPC Aircraft Log-On/Off Request'),$decode);
626
+				elseif (preg_match(':^#BE:', $message)) {
627
+					$decode = array_merge(array('Message nature' => 'CPC Aircraft Log-On/Off Request'), $decode);
628 628
 				}
629
-				elseif (preg_match(':^#BF:',$message)) {
630
-					$decode = array_merge(array('Message nature' => 'CPC WILCO/UNABLE Response'),$decode);
629
+				elseif (preg_match(':^#BF:', $message)) {
630
+					$decode = array_merge(array('Message nature' => 'CPC WILCO/UNABLE Response'), $decode);
631 631
 				}
632
-				elseif (preg_match(':^#H3:',$message)) {
633
-					$decode = array_merge(array('Message nature' => 'Icing Report'),$decode);
632
+				elseif (preg_match(':^#H3:', $message)) {
633
+					$decode = array_merge(array('Message nature' => 'Icing Report'), $decode);
634 634
 				}
635 635
 			}
636 636
 			if ($label == '10') {
637
-				if (preg_match(':^DTO01:',$message)) {
638
-					$decode = array_merge(array('Message nature' => 'Delayed Takeoff Report'),$decode);
637
+				if (preg_match(':^DTO01:', $message)) {
638
+					$decode = array_merge(array('Message nature' => 'Delayed Takeoff Report'), $decode);
639 639
 				}
640
-				elseif (preg_match(':^AIS01:',$message)) {
641
-					$decode = array_merge(array('Message nature' => 'AIS Request'),$decode);
640
+				elseif (preg_match(':^AIS01:', $message)) {
641
+					$decode = array_merge(array('Message nature' => 'AIS Request'), $decode);
642 642
 				}
643
-				elseif (preg_match(':^FTX01:',$message)) {
644
-					$decode = array_merge(array('Message nature' => 'Free Text Downlink'),$decode);
643
+				elseif (preg_match(':^FTX01:', $message)) {
644
+					$decode = array_merge(array('Message nature' => 'Free Text Downlink'), $decode);
645 645
 				}
646
-				elseif (preg_match(':^FPL01:',$message)) {
647
-					$decode = array_merge(array('Message nature' => 'Flight Plan Request'),$decode);
646
+				elseif (preg_match(':^FPL01:', $message)) {
647
+					$decode = array_merge(array('Message nature' => 'Flight Plan Request'), $decode);
648 648
 				}
649
-				elseif (preg_match(':^WAB01:',$message)) {
650
-					$decode = array_merge(array('Message nature' => 'Weight & Balance Request'),$decode);
649
+				elseif (preg_match(':^WAB01:', $message)) {
650
+					$decode = array_merge(array('Message nature' => 'Weight & Balance Request'), $decode);
651 651
 				}
652
-				elseif (preg_match(':^MET01:',$message)) {
653
-					$decode = array_merge(array('Message nature' => 'Weather Data Request'),$decode);
652
+				elseif (preg_match(':^MET01:', $message)) {
653
+					$decode = array_merge(array('Message nature' => 'Weather Data Request'), $decode);
654 654
 				}
655
-				elseif (preg_match(':^WAB02:',$message)) {
656
-					$decode = array_merge(array('Message nature' => 'Weight and Balance Acknowledgement'),$decode);
655
+				elseif (preg_match(':^WAB02:', $message)) {
656
+					$decode = array_merge(array('Message nature' => 'Weight and Balance Acknowledgement'), $decode);
657 657
 				}
658 658
 			}
659 659
 			if ($label == '15') {
660
-				if (preg_match(':^FST01:',$message)) {
661
-					$decode = array_merge(array('Message nature' => 'Flight Status Report'),$decode);
660
+				if (preg_match(':^FST01:', $message)) {
661
+					$decode = array_merge(array('Message nature' => 'Flight Status Report'), $decode);
662 662
 				}
663 663
 			}
664 664
 			if (!$found && $label == 'SA') {
665
-				$n = sscanf($message, "%d%c%c%6[0-9]", $version,$state,$type,$at);
665
+				$n = sscanf($message, "%d%c%c%6[0-9]", $version, $state, $type, $at);
666 666
 				if ($n == 4) {
667 667
 					$vsta = array('Version' => $version);
668 668
 					if ($state == 'E') {
669
-						$vsta = array_merge($vsta,array('Link state' => 'Established'));
669
+						$vsta = array_merge($vsta, array('Link state' => 'Established'));
670 670
 					}
671 671
 					elseif ($state == 'L') {
672
-						$vsta = array_merge($vsta,array('Link state' => 'Lost'));
672
+						$vsta = array_merge($vsta, array('Link state' => 'Lost'));
673 673
 					}
674 674
 					else {
675
-						$vsta = array_merge($vsta,array('Link state' => 'Unknown'));
675
+						$vsta = array_merge($vsta, array('Link state' => 'Unknown'));
676 676
 					}
677 677
 					if ($type == 'V') {
678
-						$vsta = array_merge($vsta,array('Link type' => 'VHF ACARS'));
678
+						$vsta = array_merge($vsta, array('Link type' => 'VHF ACARS'));
679 679
 					}
680 680
 					elseif ($type == 'S') {
681
-						$vsta = array_merge($vsta,array('Link type' => 'Generic SATCOM'));
681
+						$vsta = array_merge($vsta, array('Link type' => 'Generic SATCOM'));
682 682
 					}
683 683
 					elseif ($type == 'H') {
684
-						$vsta = array_merge($vsta,array('Link type' => 'HF'));
684
+						$vsta = array_merge($vsta, array('Link type' => 'HF'));
685 685
 					}
686 686
 					elseif ($type == 'G') {
687
-						$vsta = array_merge($vsta,array('Link type' => 'GlobalStar SATCOM'));
687
+						$vsta = array_merge($vsta, array('Link type' => 'GlobalStar SATCOM'));
688 688
 					}
689 689
 					elseif ($type == 'C') {
690
-						$vsta = array_merge($vsta,array('Link type' => 'ICO SATCOM'));
690
+						$vsta = array_merge($vsta, array('Link type' => 'ICO SATCOM'));
691 691
 					}
692 692
 					elseif ($type == '2') {
693
-						$vsta = array_merge($vsta,array('Link type' => 'VDL Mode 2'));
693
+						$vsta = array_merge($vsta, array('Link type' => 'VDL Mode 2'));
694 694
 					}
695 695
 					elseif ($type == 'X') {
696
-						$vsta = array_merge($vsta,array('Link type' => 'Inmarsat Aero'));
696
+						$vsta = array_merge($vsta, array('Link type' => 'Inmarsat Aero'));
697 697
 					}
698 698
 					elseif ($type == 'I') {
699
-						$vsta = array_merge($vsta,array('Link type' => 'Irridium SATCOM'));
699
+						$vsta = array_merge($vsta, array('Link type' => 'Irridium SATCOM'));
700 700
 					}
701 701
 					else {
702
-						$vsta = array_merge($vsta,array('Link type' => 'Unknown'));
702
+						$vsta = array_merge($vsta, array('Link type' => 'Unknown'));
703 703
 					}
704
-					$vsta = array_merge($vsta,array('Event occured at' => implode(':',str_split($at,2))));
705
-					$decode = array_merge($vsta,$decode);
704
+					$vsta = array_merge($vsta, array('Event occured at' => implode(':', str_split($at, 2))));
705
+					$decode = array_merge($vsta, $decode);
706 706
 				}
707 707
 			}
708 708
 
709 709
 			$title = $this->getTitlefromLabel($label);
710
-			if ($title != '') $decode = array_merge(array('Message title' => $title),$decode);
710
+			if ($title != '') $decode = array_merge(array('Message title' => $title), $decode);
711 711
 
712 712
 			/*
713 713
 			// Business jets always use GS0001
@@ -740,13 +740,13 @@  discard block
 block discarded – undo
740 740
 		$message = $this->parse($data);
741 741
 		if (isset($message['registration']) && $message['registration'] != '' && $message['ident'] != '' && $message['registration'] != '!') {
742 742
 		
743
-			$ident = (string)$message['ident'];
743
+			$ident = (string) $message['ident'];
744 744
 			$label = $message['label'];
745 745
 			$block_id = $message['block_id'];
746 746
 			$msg_no = $message['msg_no'];
747 747
 			$msg = $message['message'];
748 748
 			$decode = $message['decode'];
749
-			$registration = (string)$message['registration'];
749
+			$registration = (string) $message['registration'];
750 750
 		
751 751
 			if (isset($decode['latitude'])) $latitude = $decode['latitude'];
752 752
 			else $latitude = '';
@@ -763,23 +763,23 @@  discard block
 block discarded – undo
763 763
 			}
764 764
 		
765 765
 			// Business jets always use GS0001
766
-			if ($ident != 'GS0001') $info = $this->addModeSData($ident,$registration,$icao,$airicao,$latitude,$longitude);
766
+			if ($ident != 'GS0001') $info = $this->addModeSData($ident, $registration, $icao, $airicao, $latitude, $longitude);
767 767
 			if ($globalDebug && isset($info) && $info != '') echo $info;
768 768
 
769 769
 			if (count($decode) > 0) $decode_json = json_encode($decode);
770 770
 			else $decode_json = '';
771 771
 			if (isset($decode['Departure airport']) && isset($decode['Departure hour']) && isset($decode['Arrival airport']) && isset($decode['Arrival hour'])) {
772
-				$Schedule->addSchedule($icao,$decode['Departure airport'],$decode['Departure hour'],$decode['Arrival airport'],$decode['Arrival hour'],'ACARS');
772
+				$Schedule->addSchedule($icao, $decode['Departure airport'], $decode['Departure hour'], $decode['Arrival airport'], $decode['Arrival hour'], 'ACARS');
773 773
 			} elseif (isset($decode['Departure airport']) && isset($decode['Arrival airport'])) {
774
-				$Schedule->addSchedule($icao,$decode['Departure airport'],'',$decode['Arrival airport'],'','ACARS');
774
+				$Schedule->addSchedule($icao, $decode['Departure airport'], '', $decode['Arrival airport'], '', 'ACARS');
775 775
 			}
776 776
 
777
-			$result = $this->addLiveAcarsData($ident,$registration,$label,$block_id,$msg_no,$msg,$decode_json);
778
-			if (!isset($globalACARSArchive)) $globalACARSArchive = array('10','80','81','82','3F');
779
-			if ($result && in_array($label,$globalACARSArchive)) $this->addArchiveAcarsData($ident,$registration,$label,$block_id,$msg_no,$msg,$decode_json);
777
+			$result = $this->addLiveAcarsData($ident, $registration, $label, $block_id, $msg_no, $msg, $decode_json);
778
+			if (!isset($globalACARSArchive)) $globalACARSArchive = array('10', '80', '81', '82', '3F');
779
+			if ($result && in_array($label, $globalACARSArchive)) $this->addArchiveAcarsData($ident, $registration, $label, $block_id, $msg_no, $msg, $decode_json);
780 780
 
781 781
 			if ($globalDebug && count($decode) > 0) {
782
-				echo "Human readable data : ".implode(' - ',$decode)."\n";
782
+				echo "Human readable data : ".implode(' - ', $decode)."\n";
783 783
 			}
784 784
 		}
785 785
 	}
@@ -794,7 +794,7 @@  discard block
 block discarded – undo
794 794
 	* @param String $msg_no Number of the ACARS message
795 795
 	* @param String $message ACARS message
796 796
 	*/
797
-	public function addLiveAcarsData($ident,$registration,$label,$block_id,$msg_no,$message,$decode = '') {
797
+	public function addLiveAcarsData($ident, $registration, $label, $block_id, $msg_no, $message, $decode = '') {
798 798
 		global $globalDebug;
799 799
 		date_default_timezone_set('UTC');
800 800
 		if ($label != 'SQ' && $label != 'Q0' && $label != '_d' && $message != '') {
@@ -803,22 +803,22 @@  discard block
 block discarded – undo
803 803
 
804 804
 			if ($globalDebug) echo "Test if not already in Live ACARS table...";
805 805
 			$query_test = "SELECT COUNT(*) as nb FROM acars_live WHERE ident = :ident AND registration = :registration AND message = :message";
806
-			$query_test_values = array(':ident' => $ident,':registration' => $registration, ':message' => $message);
806
+			$query_test_values = array(':ident' => $ident, ':registration' => $registration, ':message' => $message);
807 807
 			try {
808 808
 				$stht = $this->db->prepare($query_test);
809 809
 				$stht->execute($query_test_values);
810
-			} catch(PDOException $e) {
810
+			} catch (PDOException $e) {
811 811
 				return "error : ".$e->getMessage();
812 812
 			}
813 813
 			if ($stht->fetchColumn() == 0) {
814 814
 				if ($globalDebug) echo "Add Live ACARS data...";
815 815
 				$query = "INSERT INTO acars_live (ident,registration,label,block_id,msg_no,message,decode,date) VALUES (:ident,:registration,:label,:block_id,:msg_no,:message,:decode,:date)";
816
-				$query_values = array(':ident' => $ident,':registration' => $registration, ':label' => $label,':block_id' => $block_id, ':msg_no' => $msg_no, ':message' => $message, ':decode' => $decode,':date' => date("Y-m-d H:i:s"));
816
+				$query_values = array(':ident' => $ident, ':registration' => $registration, ':label' => $label, ':block_id' => $block_id, ':msg_no' => $msg_no, ':message' => $message, ':decode' => $decode, ':date' => date("Y-m-d H:i:s"));
817 817
 				try {
818 818
 
819 819
 					$sth = $this->db->prepare($query);
820 820
 					$sth->execute($query_values);
821
-				} catch(PDOException $e) {
821
+				} catch (PDOException $e) {
822 822
 					return "error : ".$e->getMessage();
823 823
 				}
824 824
 			} else {
@@ -840,10 +840,10 @@  discard block
 block discarded – undo
840 840
 	* @param String $msg_no Number of the ACARS message
841 841
 	* @param String $message ACARS message
842 842
 	*/
843
-	public function addArchiveAcarsData($ident,$registration,$label,$block_id,$msg_no,$message,$decode = '') {
843
+	public function addArchiveAcarsData($ident, $registration, $label, $block_id, $msg_no, $message, $decode = '') {
844 844
 		global $globalDebug;
845 845
 		date_default_timezone_set('UTC');
846
-		if ($label != 'SQ' && $label != 'Q0' && $label != '_d' && $message != '' && preg_match('/^MET0/',$message) === 0 && preg_match('/^ARR0/',$message) === 0 && preg_match('/^ETA/',$message) === 0 && preg_match('/^WXR/',$message) === 0 && preg_match('/^FTX01.FIC/',$message) === 0) {
846
+		if ($label != 'SQ' && $label != 'Q0' && $label != '_d' && $message != '' && preg_match('/^MET0/', $message) === 0 && preg_match('/^ARR0/', $message) === 0 && preg_match('/^ETA/', $message) === 0 && preg_match('/^WXR/', $message) === 0 && preg_match('/^FTX01.FIC/', $message) === 0) {
847 847
 			/*
848 848
 				    if ($globalDebug) echo "Test if not already in Archive ACARS table...";
849 849
 			    	    $query_test = "SELECT COUNT(*) as nb FROM acars_archive WHERE ident = :ident AND registration = :registration AND message = :message";
@@ -859,12 +859,12 @@  discard block
 block discarded – undo
859 859
 			*/
860 860
 			if ($globalDebug) echo "Add Live ACARS data...";
861 861
 			$query = "INSERT INTO acars_archive (ident,registration,label,block_id,msg_no,message,decode) VALUES (:ident,:registration,:label,:block_id,:msg_no,:message,:decode)";
862
-			$query_values = array(':ident' => $ident,':registration' => $registration, ':label' => $label,':block_id' => $block_id, ':msg_no' => $msg_no, ':message' => $message, ':decode' => $decode);
862
+			$query_values = array(':ident' => $ident, ':registration' => $registration, ':label' => $label, ':block_id' => $block_id, ':msg_no' => $msg_no, ':message' => $message, ':decode' => $decode);
863 863
 			try {
864 864
 
865 865
 				$sth = $this->db->prepare($query);
866 866
 				$sth->execute($query_values);
867
-			} catch(PDOException $e) {
867
+			} catch (PDOException $e) {
868 868
 				return "error : ".$e->getMessage();
869 869
 			}
870 870
 //    	    }
@@ -887,7 +887,7 @@  discard block
 block discarded – undo
887 887
 
888 888
 			$sth = $this->db->prepare($query);
889 889
 			$sth->execute($query_values);
890
-		} catch(PDOException $e) {
890
+		} catch (PDOException $e) {
891 891
 			echo "error : ".$e->getMessage();
892 892
 			die;
893 893
 		}
@@ -908,7 +908,7 @@  discard block
 block discarded – undo
908 908
 
909 909
 			$sth = $this->db->prepare($query);
910 910
 			$sth->execute($query_values);
911
-		} catch(PDOException $e) {
911
+		} catch (PDOException $e) {
912 912
 			echo "error : ".$e->getMessage();
913 913
 			die;
914 914
 		}
@@ -930,7 +930,7 @@  discard block
 block discarded – undo
930 930
 
931 931
 			$sth = $this->db->prepare($query);
932 932
 			$sth->execute($query_values);
933
-		} catch(PDOException $e) {
933
+		} catch (PDOException $e) {
934 934
 			echo "error : ".$e->getMessage();
935 935
 			die;
936 936
 		}
@@ -944,7 +944,7 @@  discard block
 block discarded – undo
944 944
 	*
945 945
 	* @return Array Return ACARS data in array
946 946
 	*/
947
-	public function getLatestAcarsData($limit = '',$label = '') {
947
+	public function getLatestAcarsData($limit = '', $label = '') {
948 948
 		global $globalURL, $globalDBdriver;
949 949
 		$Image = new Image($this->db);
950 950
 		$Spotter = new Spotter($this->db);
@@ -956,8 +956,8 @@  discard block
 block discarded – undo
956 956
 		{
957 957
 			$limit_array = explode(",", $limit);
958 958
 
959
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
960
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
959
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
960
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
961 961
 
962 962
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
963 963
 			{
@@ -979,48 +979,48 @@  discard block
 block discarded – undo
979 979
 
980 980
 			$sth = $this->db->prepare($query);
981 981
 			$sth->execute($query_values);
982
-		} catch(PDOException $e) {
982
+		} catch (PDOException $e) {
983 983
 			return "error : ".$e->getMessage();
984 984
 		}
985 985
 		$i = 0;
986 986
 		while ($row = $sth->fetch(PDO::FETCH_ASSOC)) {
987 987
 			$data = array();
988 988
 			if ($row['registration'] != '') {
989
-				$row['registration'] = str_replace('.','',$row['registration']);
989
+				$row['registration'] = str_replace('.', '', $row['registration']);
990 990
 				$image_array = $Image->getSpotterImage($row['registration']);
991
-				if (count($image_array) > 0) $data = array_merge($data,array('image' => $image_array[0]['image'],'image_thumbnail' => $image_array[0]['image_thumbnail'],'image_copyright' => $image_array[0]['image_copyright'],'image_source' => $image_array[0]['image_source'],'image_source_website' => $image_array[0]['image_source_website']));
992
-				else $data = array_merge($data,array('image' => '','image_thumbnail' => '','image_copyright' => '','image_source' => '','image_source_website' => ''));
993
-			} else $data = array_merge($data,array('image' => '','image_thumbnail' => '','image_copyright' => '','image_source' => '','image_source_website' => ''));
991
+				if (count($image_array) > 0) $data = array_merge($data, array('image' => $image_array[0]['image'], 'image_thumbnail' => $image_array[0]['image_thumbnail'], 'image_copyright' => $image_array[0]['image_copyright'], 'image_source' => $image_array[0]['image_source'], 'image_source_website' => $image_array[0]['image_source_website']));
992
+				else $data = array_merge($data, array('image' => '', 'image_thumbnail' => '', 'image_copyright' => '', 'image_source' => '', 'image_source_website' => ''));
993
+			} else $data = array_merge($data, array('image' => '', 'image_thumbnail' => '', 'image_copyright' => '', 'image_source' => '', 'image_source_website' => ''));
994 994
 			if ($row['registration'] == '') $row['registration'] = 'NA';
995 995
 			if ($row['ident'] == '') $row['ident'] = 'NA';
996
-			$identicao = $Spotter->getAllAirlineInfo(substr($row['ident'],0,2));
996
+			$identicao = $Spotter->getAllAirlineInfo(substr($row['ident'], 0, 2));
997 997
 			if (isset($identicao[0])) {
998
-				if (substr($row['ident'],0,2) == 'AF') {
999
-					if (filter_var(substr($row['ident'],2),FILTER_VALIDATE_INT,array("flags"=>FILTER_FLAG_ALLOW_OCTAL))) $icao = $row['ident'];
1000
-					else $icao = 'AFR'.ltrim(substr($row['ident'],2),'0');
1001
-				} else $icao = $identicao[0]['icao'].ltrim(substr($row['ident'],2),'0');
998
+				if (substr($row['ident'], 0, 2) == 'AF') {
999
+					if (filter_var(substr($row['ident'], 2), FILTER_VALIDATE_INT, array("flags"=>FILTER_FLAG_ALLOW_OCTAL))) $icao = $row['ident'];
1000
+					else $icao = 'AFR'.ltrim(substr($row['ident'], 2), '0');
1001
+				} else $icao = $identicao[0]['icao'].ltrim(substr($row['ident'], 2), '0');
1002 1002
 
1003
-				$data = array_merge($data,array('airline_icao' => $identicao[0]['icao'],'airline_name' => $identicao[0]['name']));
1003
+				$data = array_merge($data, array('airline_icao' => $identicao[0]['icao'], 'airline_name' => $identicao[0]['name']));
1004 1004
 			} else $icao = $row['ident'];
1005
-			$icao = $Translation->checkTranslation($icao,false);
1005
+			$icao = $Translation->checkTranslation($icao, false);
1006 1006
 
1007
-			$decode = json_decode($row['decode'],true);
1007
+			$decode = json_decode($row['decode'], true);
1008 1008
 			$found = false;
1009
-			if ($decode != '' && array_key_exists('Departure airport',$decode)) {
1009
+			if ($decode != '' && array_key_exists('Departure airport', $decode)) {
1010 1010
 				$airport_info = $Spotter->getAllAirportInfo($decode['Departure airport']);
1011 1011
 				if (isset($airport_info[0]['icao'])) {
1012 1012
 					$decode['Departure airport'] = '<a href="'.$globalURL.'/airport/'.$airport_info[0]['icao'].'">'.$airport_info[0]['city'].','.$airport_info[0]['country'].' ('.$airport_info[0]['icao'].')</a>';
1013 1013
 					$found = true;
1014 1014
 				}
1015 1015
 			}
1016
-			if ($decode != '' && array_key_exists('Arrival airport',$decode)) {
1016
+			if ($decode != '' && array_key_exists('Arrival airport', $decode)) {
1017 1017
 				$airport_info = $Spotter->getAllAirportInfo($decode['Arrival airport']);
1018 1018
 				if (isset($airport_info[0]['icao'])) {
1019 1019
 					$decode['Arrival airport'] = '<a href="'.$globalURL.'/airport/'.$airport_info[0]['icao'].'">'.$airport_info[0]['city'].','.$airport_info[0]['country'].' ('.$airport_info[0]['icao'].')</a>';
1020 1020
 					$found = true;
1021 1021
 				}
1022 1022
 			}
1023
-			if ($decode != '' && array_key_exists('Airport/Waypoint name',$decode)) {
1023
+			if ($decode != '' && array_key_exists('Airport/Waypoint name', $decode)) {
1024 1024
 				$airport_info = $Spotter->getAllAirportInfo($decode['Airport/Waypoint name']);
1025 1025
 				if (isset($airport_info[0]['icao'])) {
1026 1026
 					$decode['Airport/Waypoint name'] = '<a href="'.$globalURL.'/airport/'.$airport_info[0]['icao'].'">'.$airport_info[0]['city'].','.$airport_info[0]['country'].' ('.$airport_info[0]['icao'].')</a>';
@@ -1028,7 +1028,7 @@  discard block
 block discarded – undo
1028 1028
 				}
1029 1029
 			}
1030 1030
 			if ($found) $row['decode'] = json_encode($decode);
1031
-			$data = array_merge($data,array('registration' => $row['registration'],'message' => $row['message'], 'date' => $row['date'], 'ident' => $icao, 'decode' => $row['decode']));
1031
+			$data = array_merge($data, array('registration' => $row['registration'], 'message' => $row['message'], 'date' => $row['date'], 'ident' => $icao, 'decode' => $row['decode']));
1032 1032
 			$result[] = $data;
1033 1033
 			$i++;
1034 1034
 		}
@@ -1044,7 +1044,7 @@  discard block
 block discarded – undo
1044 1044
 	*
1045 1045
 	* @return Array Return ACARS data in array
1046 1046
 	*/
1047
-	public function getArchiveAcarsData($limit = '',$label = '') {
1047
+	public function getArchiveAcarsData($limit = '', $label = '') {
1048 1048
 		global $globalURL, $globalDBdriver;
1049 1049
 		$Image = new Image($this->db);
1050 1050
 		$Spotter = new Spotter($this->db);
@@ -1056,8 +1056,8 @@  discard block
 block discarded – undo
1056 1056
 		{
1057 1057
 			$limit_array = explode(",", $limit);
1058 1058
 
1059
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1060
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1059
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1060
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1061 1061
 
1062 1062
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1063 1063
 			{
@@ -1087,45 +1087,45 @@  discard block
 block discarded – undo
1087 1087
 
1088 1088
 			$sth = $this->db->prepare($query);
1089 1089
 			$sth->execute($query_values);
1090
-		} catch(PDOException $e) {
1090
+		} catch (PDOException $e) {
1091 1091
 			return "error : ".$e->getMessage();
1092 1092
 		}
1093
-		$i=0;
1093
+		$i = 0;
1094 1094
 		while ($row = $sth->fetch(PDO::FETCH_ASSOC)) {
1095 1095
 			$data = array();
1096 1096
 			if ($row['registration'] != '') {
1097
-				$row['registration'] = str_replace('.','',$row['registration']);
1097
+				$row['registration'] = str_replace('.', '', $row['registration']);
1098 1098
 				$image_array = $Image->getSpotterImage($row['registration']);
1099
-				if (count($image_array) > 0) $data = array_merge($data,array('image_thumbnail' => $image_array[0]['image_thumbnail'],'image_copyright' => $image_array[0]['image_copyright'],'image_source' => $image_array[0]['image_source'],'image_source_website' => $image_array[0]['image_source_website']));
1100
-				else $data = array_merge($data,array('image_thumbnail' => '','image_copyright' => '','image_source' => '','image_source_website' => ''));
1101
-			} else $data = array_merge($data,array('image_thumbnail' => '','image_copyright' => '','image_source' => '','image_source_website' => ''));
1099
+				if (count($image_array) > 0) $data = array_merge($data, array('image_thumbnail' => $image_array[0]['image_thumbnail'], 'image_copyright' => $image_array[0]['image_copyright'], 'image_source' => $image_array[0]['image_source'], 'image_source_website' => $image_array[0]['image_source_website']));
1100
+				else $data = array_merge($data, array('image_thumbnail' => '', 'image_copyright' => '', 'image_source' => '', 'image_source_website' => ''));
1101
+			} else $data = array_merge($data, array('image_thumbnail' => '', 'image_copyright' => '', 'image_source' => '', 'image_source_website' => ''));
1102 1102
 			$icao = '';
1103 1103
 			if ($row['registration'] == '') $row['registration'] = 'NA';
1104 1104
 			if ($row['ident'] == '') $row['ident'] = 'NA';
1105
-			$identicao = $Spotter->getAllAirlineInfo(substr($row['ident'],0,2));
1105
+			$identicao = $Spotter->getAllAirlineInfo(substr($row['ident'], 0, 2));
1106 1106
 			if (isset($identicao[0])) {
1107
-				if (substr($row['ident'],0,2) == 'AF') {
1108
-					if (filter_var(substr($row['ident'],2),FILTER_VALIDATE_INT,array("flags"=>FILTER_FLAG_ALLOW_OCTAL))) $icao = $row['ident'];
1109
-					else $icao = 'AFR'.ltrim(substr($row['ident'],2),'0');
1110
-				} else $icao = $identicao[0]['icao'].ltrim(substr($row['ident'],2),'0');
1111
-				$data = array_merge($data,array('airline_icao' => $identicao[0]['icao'],'airline_name' => $identicao[0]['name']));
1107
+				if (substr($row['ident'], 0, 2) == 'AF') {
1108
+					if (filter_var(substr($row['ident'], 2), FILTER_VALIDATE_INT, array("flags"=>FILTER_FLAG_ALLOW_OCTAL))) $icao = $row['ident'];
1109
+					else $icao = 'AFR'.ltrim(substr($row['ident'], 2), '0');
1110
+				} else $icao = $identicao[0]['icao'].ltrim(substr($row['ident'], 2), '0');
1111
+				$data = array_merge($data, array('airline_icao' => $identicao[0]['icao'], 'airline_name' => $identicao[0]['name']));
1112 1112
 			} else $icao = $row['ident'];
1113 1113
 			$icao = $Translation->checkTranslation($icao);
1114 1114
 
1115 1115
 
1116
-			$decode = json_decode($row['decode'],true);
1116
+			$decode = json_decode($row['decode'], true);
1117 1117
 			$found = false;
1118
-			if ($decode != '' && array_key_exists('Departure airport',$decode)) {
1118
+			if ($decode != '' && array_key_exists('Departure airport', $decode)) {
1119 1119
 				$airport_info = $Spotter->getAllAirportInfo($decode['Departure airport']);
1120 1120
 				if (isset($airport_info[0]['icao'])) $decode['Departure airport'] = '<a href="'.$globalURL.'/airport/'.$airport_info[0]['icao'].'">'.$airport_info[0]['city'].','.$airport_info[0]['country'].' ('.$airport_info[0]['icao'].')</a>';
1121 1121
 				$found = true;
1122 1122
 			}
1123
-			if ($decode != '' && array_key_exists('Arrival airport',$decode)) {
1123
+			if ($decode != '' && array_key_exists('Arrival airport', $decode)) {
1124 1124
 				$airport_info = $Spotter->getAllAirportInfo($decode['Arrival airport']);
1125 1125
 				if (isset($airport_info[0]['icao'])) $decode['Arrival airport'] = '<a href="'.$globalURL.'/airport/'.$airport_info[0]['icao'].'">'.$airport_info[0]['city'].','.$airport_info[0]['country'].' ('.$airport_info[0]['icao'].')</a>';
1126 1126
 				$found = true;
1127 1127
 			}
1128
-			if ($decode != '' && array_key_exists('Airport/Waypoint name',$decode)) {
1128
+			if ($decode != '' && array_key_exists('Airport/Waypoint name', $decode)) {
1129 1129
 				$airport_info = $Spotter->getAllAirportInfo($decode['Airport/Waypoint name']);
1130 1130
 				if (isset($airport_info[0]['icao'])) {
1131 1131
 					$decode['Airport/Waypoint name'] = '<a href="'.$globalURL.'/airport/'.$airport_info[0]['icao'].'">'.$airport_info[0]['city'].','.$airport_info[0]['country'].' ('.$airport_info[0]['icao'].')</a>';
@@ -1134,7 +1134,7 @@  discard block
 block discarded – undo
1134 1134
 			}
1135 1135
 			if ($found) $row['decode'] = json_encode($decode);
1136 1136
 
1137
-			$data = array_merge($data,array('registration' => $row['registration'],'message' => $row['message'], 'date' => $row['date'], 'ident' => $icao, 'decode' => $row['decode']));
1137
+			$data = array_merge($data, array('registration' => $row['registration'], 'message' => $row['message'], 'date' => $row['date'], 'ident' => $icao, 'decode' => $row['decode']));
1138 1138
 			$result[] = $data;
1139 1139
 			$i++;
1140 1140
 		}
@@ -1152,7 +1152,7 @@  discard block
 block discarded – undo
1152 1152
 	* @param String $icao
1153 1153
 	* @param String $ICAOTypeCode
1154 1154
 	*/
1155
-	public function addModeSData($ident,$registration,$icao = '',$ICAOTypeCode = '',$latitude = '', $longitude = '') {
1155
+	public function addModeSData($ident, $registration, $icao = '', $ICAOTypeCode = '', $latitude = '', $longitude = '') {
1156 1156
 		global $globalDebug, $globalDBdriver;
1157 1157
 		$ident = trim($ident);
1158 1158
 		$Translation = new Translation($this->db);
@@ -1166,7 +1166,7 @@  discard block
 block discarded – undo
1166 1166
 			return '';
1167 1167
 		}
1168 1168
 
1169
-		$registration = str_replace('.','',$registration);
1169
+		$registration = str_replace('.', '', $registration);
1170 1170
 		$ident = $Translation->ident2icao($ident);
1171 1171
 		// Check if a flight with same registration is flying now, if ok check if callsign = name in ACARS, else add it to translation
1172 1172
 		if ($globalDebug) echo "Check if needed to add translation ".$ident.'... ';
@@ -1176,7 +1176,7 @@  discard block
 block discarded – undo
1176 1176
 
1177 1177
 			$sthsi = $this->db->prepare($querysi);
1178 1178
 			$sthsi->execute($querysi_values);
1179
-		} catch(PDOException $e) {
1179
+		} catch (PDOException $e) {
1180 1180
 			if ($globalDebug) echo $e->getMessage();
1181 1181
 			return "error : ".$e->getMessage();
1182 1182
 		}
@@ -1187,8 +1187,8 @@  discard block
 block discarded – undo
1187 1187
 			$Translation = new Translation($this->db);
1188 1188
 			$trans_ident = $Translation->getOperator($resultsi['ident']);
1189 1189
 			if ($globalDebug) echo 'Add translation to table : '.$ident.' -> '.$resultsi['ident'].' ';
1190
-			if ($ident != $trans_ident) $Translation->addOperator($resultsi['ident'],$ident,'ACARS');
1191
-			elseif ($trans_ident == $ident) $Translation->updateOperator($resultsi['ident'],$ident,'ACARS');
1190
+			if ($ident != $trans_ident) $Translation->addOperator($resultsi['ident'], $ident, 'ACARS');
1191
+			elseif ($trans_ident == $ident) $Translation->updateOperator($resultsi['ident'], $ident, 'ACARS');
1192 1192
 		} else {
1193 1193
 			if ($registration != '' && $latitude != '' && $longitude != '') {
1194 1194
 				$query = "SELECT ModeS FROM aircraft_modes WHERE Registration = :registration LIMIT 1";
@@ -1196,7 +1196,7 @@  discard block
 block discarded – undo
1196 1196
 				try {
1197 1197
 					$sth = $this->db->prepare($query);
1198 1198
 					$sth->execute($query_values);
1199
-				} catch(PDOException $e) {
1199
+				} catch (PDOException $e) {
1200 1200
 					if ($globalDebug) echo $e->getMessage();
1201 1201
 					return "error : ".$e->getMessage();
1202 1202
 				}
@@ -1204,7 +1204,7 @@  discard block
 block discarded – undo
1204 1204
 				$sth->closeCursor();
1205 1205
 				if (isset($result['modes'])) $hex = $result['modes'];
1206 1206
 				else $hex = '';
1207
-				$SI_data = array('hex' => $hex,'ident' => $ident,'aircraft_icao' => $ICAOTypeCode,'registration' => $registration,'latitude' => $latitude,'$longitude' => $longitude,'format_source' => 'ACARS');
1207
+				$SI_data = array('hex' => $hex, 'ident' => $ident, 'aircraft_icao' => $ICAOTypeCode, 'registration' => $registration, 'latitude' => $latitude, '$longitude' => $longitude, 'format_source' => 'ACARS');
1208 1208
 				$this->SI->add($SI_data);
1209 1209
 			}
1210 1210
 		}
@@ -1216,7 +1216,7 @@  discard block
 block discarded – undo
1216 1216
 
1217 1217
 			$sth = $this->db->prepare($query);
1218 1218
 			$sth->execute($query_values);
1219
-		} catch(PDOException $e) {
1219
+		} catch (PDOException $e) {
1220 1220
 			if ($globalDebug) echo $e->getMessage();
1221 1221
 			return "error : ".$e->getMessage();
1222 1222
 		}
@@ -1227,7 +1227,7 @@  discard block
 block discarded – undo
1227 1227
 			if (isset($result['ModeS'])) $ModeS = $result['ModeS'];
1228 1228
 			else $ModeS = '';
1229 1229
 			if ($ModeS == '') {
1230
-				$id = explode('-',$result['flightaware_id']);
1230
+				$id = explode('-', $result['flightaware_id']);
1231 1231
 				$ModeS = $id[0];
1232 1232
 			}
1233 1233
 			if ($ModeS != '') {
@@ -1238,21 +1238,21 @@  discard block
 block discarded – undo
1238 1238
 
1239 1239
 					$sthc = $this->db->prepare($queryc);
1240 1240
 					$sthc->execute($queryc_values);
1241
-				} catch(PDOException $e) {
1241
+				} catch (PDOException $e) {
1242 1242
 					if ($globalDebug) echo $e->getMessage();
1243 1243
 					return "error : ".$e->getMessage();
1244 1244
 				}
1245 1245
 				$row = $sthc->fetch(PDO::FETCH_ASSOC);
1246 1246
 				$sthc->closeCursor();
1247
-				if (count($row) ==  0) {
1247
+				if (count($row) == 0) {
1248 1248
 					if ($globalDebug) echo " Add to ModeS table - ";
1249 1249
 					$queryi = "INSERT INTO aircraft_modes (ModeS,ModeSCountry,Registration,ICAOTypeCode,Source) VALUES (:ModeS,:ModeSCountry,:Registration, :ICAOTypeCode,'ACARS')";
1250
-					$queryi_values = array(':ModeS' => $ModeS,':ModeSCountry' => $country,':Registration' => $registration, ':ICAOTypeCode' => $ICAOTypeCode);
1250
+					$queryi_values = array(':ModeS' => $ModeS, ':ModeSCountry' => $country, ':Registration' => $registration, ':ICAOTypeCode' => $ICAOTypeCode);
1251 1251
 					try {
1252 1252
 
1253 1253
 						$sthi = $this->db->prepare($queryi);
1254 1254
 						$sthi->execute($queryi_values);
1255
-					} catch(PDOException $e) {
1255
+					} catch (PDOException $e) {
1256 1256
 						if ($globalDebug) echo $e->getMessage();
1257 1257
 						return "error : ".$e->getMessage();
1258 1258
 					}
@@ -1260,16 +1260,16 @@  discard block
 block discarded – undo
1260 1260
 					if ($globalDebug) echo " Update ModeS table - ";
1261 1261
 					if ($ICAOTypeCode != '') {
1262 1262
 						$queryi = "UPDATE aircraft_modes SET ModeSCountry = :ModeSCountry,Registration = :Registration,ICAOTypeCode = :ICAOTypeCode,Source = 'ACARS',LastModified = NOW() WHERE ModeS = :ModeS";
1263
-						$queryi_values = array(':ModeS' => $ModeS,':ModeSCountry' => $country,':Registration' => $registration, ':ICAOTypeCode' => $ICAOTypeCode);
1263
+						$queryi_values = array(':ModeS' => $ModeS, ':ModeSCountry' => $country, ':Registration' => $registration, ':ICAOTypeCode' => $ICAOTypeCode);
1264 1264
 					} else {
1265 1265
 						$queryi = "UPDATE aircraft_modes SET ModeSCountry = :ModeSCountry,Registration = :Registration,Source = 'ACARS',LastModified = NOW() WHERE ModeS = :ModeS";
1266
-						$queryi_values = array(':ModeS' => $ModeS,':ModeSCountry' => $country,':Registration' => $registration);
1266
+						$queryi_values = array(':ModeS' => $ModeS, ':ModeSCountry' => $country, ':Registration' => $registration);
1267 1267
 					}
1268 1268
 					try {
1269 1269
 
1270 1270
 						$sthi = $this->db->prepare($queryi);
1271 1271
 						$sthi->execute($queryi_values);
1272
-					} catch(PDOException $e) {
1272
+					} catch (PDOException $e) {
1273 1273
 						if ($globalDebug) echo $e->getMessage();
1274 1274
 						return "error : ".$e->getMessage();
1275 1275
 					}
@@ -1307,13 +1307,13 @@  discard block
 block discarded – undo
1307 1307
 					elseif ($globalDBdriver == 'pgsql') {
1308 1308
 						$queryi = "UPDATE spotter_output SET registration = :Registration WHERE ident = :ident AND date >= NOW() AT TIME ZONE 'UTC' - INTERVAL '1 HOUR'";
1309 1309
 					}
1310
-					$queryi_values = array(':Registration' => $registration,':ident' => $icao);
1310
+					$queryi_values = array(':Registration' => $registration, ':ident' => $icao);
1311 1311
 				}
1312 1312
 				try {
1313 1313
 
1314 1314
 					$sthi = $this->db->prepare($queryi);
1315 1315
 					$sthi->execute($queryi_values);
1316
-				} catch(PDOException $e) {
1316
+				} catch (PDOException $e) {
1317 1317
 					if ($globalDebug) echo $e->getMessage();
1318 1318
 					return "error : ".$e->getMessage();
1319 1319
 				}
Please login to merge, or discard this patch.
Braces   +409 added lines, -261 removed lines patch added patch discarded remove patch
@@ -23,14 +23,19 @@  discard block
 block discarded – undo
23 23
 	*/
24 24
 	public function ident2icao($ident) {
25 25
 		if (substr($ident,0,2) == 'AF') {
26
-			if (filter_var(substr($ident,2),FILTER_VALIDATE_INT,array("flags"=>FILTER_FLAG_ALLOW_OCTAL))) $icao = $ident;
27
-			else $icao = 'AFR'.ltrim(substr($ident,2),'0');
26
+			if (filter_var(substr($ident,2),FILTER_VALIDATE_INT,array("flags"=>FILTER_FLAG_ALLOW_OCTAL))) {
27
+				$icao = $ident;
28
+			} else {
29
+				$icao = 'AFR'.ltrim(substr($ident,2),'0');
30
+			}
28 31
 		} else {
29 32
 			$Spotter = new Spotter($this->db);
30 33
 			$identicao = $Spotter->getAllAirlineInfo(substr($ident,0,2));
31 34
 			if (isset($identicao[0])) {
32 35
 				$icao = $identicao[0]['icao'].ltrim(substr($ident,2),'0');
33
-			} else $icao = $ident;
36
+			} else {
37
+				$icao = $ident;
38
+			}
34 39
 		}
35 40
 		return $icao;
36 41
 	}
@@ -103,14 +108,24 @@  discard block
 block discarded – undo
103 108
 		$message = '';
104 109
 		$result = array();
105 110
 		$n = sscanf($data,'(null) %*d %*02d/%*02d/%*04d %*02d:%*02d:%*02d %*d %*[0-9-] %*[A-Z0-9] %7s %*c %2[0-9a-zA-Z_] %d %4[0-9A-Z] %6[0-9A-Z] %[^\r\n]',$registration,$label,$block_id,$msg_no,$ident,$message);
106
-		if ($n == 0) $n = sscanf($data,'AC%*c %7s %*c %2[0-9a-zA-Z_] %d %4[0-9A-Z] %6[0-9A-Z] %[^\r\n]',$registration,$label,$block_id,$msg_no,$ident,$message);
107
-		if ($n == 0) $n = sscanf($data,'%*04d-%*02d-%*02d,%*02d:%*02d:%*02d,%*7s,%*c,%6[0-9A-Z-],%*c,%2[0-9a-zA-Z_],%d,%4[0-9A-Z],%6[0-9A-Z],%[^\r\n]',$registration,$label,$block_id,$msg_no,$ident,$message);
108
-		if ($n == 0) $n = sscanf($data,'%*04d-%*02d-%*02d,%*02d:%*02d:%*02d,%*7s,%*c,%5[0-9A-Z],%*c,%2[0-9a-zA-Z_],%d,%4[0-9A-Z],%6[0-9A-Z],%[^\r\n]',$registration,$label,$block_id,$msg_no,$ident,$message);
111
+		if ($n == 0) {
112
+			$n = sscanf($data,'AC%*c %7s %*c %2[0-9a-zA-Z_] %d %4[0-9A-Z] %6[0-9A-Z] %[^\r\n]',$registration,$label,$block_id,$msg_no,$ident,$message);
113
+		}
114
+		if ($n == 0) {
115
+			$n = sscanf($data,'%*04d-%*02d-%*02d,%*02d:%*02d:%*02d,%*7s,%*c,%6[0-9A-Z-],%*c,%2[0-9a-zA-Z_],%d,%4[0-9A-Z],%6[0-9A-Z],%[^\r\n]',$registration,$label,$block_id,$msg_no,$ident,$message);
116
+		}
117
+		if ($n == 0) {
118
+			$n = sscanf($data,'%*04d-%*02d-%*02d,%*02d:%*02d:%*02d,%*7s,%*c,%5[0-9A-Z],%*c,%2[0-9a-zA-Z_],%d,%4[0-9A-Z],%6[0-9A-Z],%[^\r\n]',$registration,$label,$block_id,$msg_no,$ident,$message);
119
+		}
109 120
 		if ($n != 0) {
110 121
 			$registration = str_replace('.','',$registration);
111 122
 			$result = array('registration' => $registration, 'ident' => $ident,'label' => $label, 'block_id' => $block_id,'msg_no' => $msg_no,'message' => $message);
112
-			if ($globalDebug) echo "Reg. : ".$registration." - Ident : ".$ident." - Label : ".$label." - Message : ".$message."\n";
113
-		} else $message = $data;
123
+			if ($globalDebug) {
124
+				echo "Reg. : ".$registration." - Ident : ".$ident." - Label : ".$label." - Message : ".$message."\n";
125
+			}
126
+		} else {
127
+			$message = $data;
128
+		}
114 129
 		$decode = array();
115 130
 		$found = false;
116 131
 //		if ($registration != '' && $ident != '' && $registration != '!') {
@@ -130,12 +145,21 @@  discard block
 block discarded – undo
130 145
 				if ($n > 5 && ($lac == 'N' || $lac == 'S') && ($lnc == 'E' || $lnc == 'W')) {
131 146
 					$latitude = $la / 10000.0;
132 147
 					$longitude = $ln / 10000.0;
133
-					if ($lac == 'S') $latitude = '-'.$latitude;
134
-					if ($lnc == 'W') $longitude = '-'.$longitude;
148
+					if ($lac == 'S') {
149
+						$latitude = '-'.$latitude;
150
+					}
151
+					if ($lnc == 'W') {
152
+						$longitude = '-'.$longitude;
153
+					}
135 154
 					// Temp not always available
136
-					if ($globalDebug) echo 'latitude : '.$latitude.' - longitude : '.$longitude.' - airport depart : '.$dair.' - airport arrival : '.$darr.' - température : '.$temp."°C\n";
137
-					if ($temp == '') $decode = array('Latitude' => $latitude, 'Longitude' =>  $longitude, 'Departure airport' => $dair, 'Arrival airport' => $darr,'Altitude' => $alt);
138
-					else $decode = array('Latitude' => $latitude, 'Longitude' =>  $longitude, 'Departure airport' => $dair, 'Arrival airport' => $darr, 'Altitude' => 'FL'.$alt,'Temperature' => $temp.'°C');
155
+					if ($globalDebug) {
156
+						echo 'latitude : '.$latitude.' - longitude : '.$longitude.' - airport depart : '.$dair.' - airport arrival : '.$darr.' - température : '.$temp."°C\n";
157
+					}
158
+					if ($temp == '') {
159
+						$decode = array('Latitude' => $latitude, 'Longitude' =>  $longitude, 'Departure airport' => $dair, 'Arrival airport' => $darr,'Altitude' => $alt);
160
+					} else {
161
+						$decode = array('Latitude' => $latitude, 'Longitude' =>  $longitude, 'Departure airport' => $dair, 'Arrival airport' => $darr, 'Altitude' => 'FL'.$alt,'Temperature' => $temp.'°C');
162
+					}
139 163
 
140 164
 					//$icao = $Translation->checkTranslation($ident);
141 165
 					//$Schedule->addSchedule($icao,$dair,'',$darr,'','ACARS');
@@ -149,25 +173,35 @@  discard block
 block discarded – undo
149 173
 				$ahour = '';
150 174
 				$n = sscanf($message, "ARR01 %4[A-Z]%4d %4[A-Z]%4d", $dair, $dhour, $darr,$ahour);
151 175
 				if ($n == 4 && strlen($darr) == 4) {
152
-					if ($dhour != '') $dhour = substr(sprintf('%04d',$dhour),0,2).':'.substr(sprintf('%04d',$dhour),2);
153
-					if ($ahour != '') $ahour = substr(sprintf('%04d',$ahour),0,2).':'.substr(sprintf('%04d',$ahour),2);
154
-					if ($globalDebug) echo 'departure airport : '.$dair.' - arrival airport : '. $darr.' - departure hour : '. $dhour.' - arrival hour : '.$ahour."\n";
176
+					if ($dhour != '') {
177
+						$dhour = substr(sprintf('%04d',$dhour),0,2).':'.substr(sprintf('%04d',$dhour),2);
178
+					}
179
+					if ($ahour != '') {
180
+						$ahour = substr(sprintf('%04d',$ahour),0,2).':'.substr(sprintf('%04d',$ahour),2);
181
+					}
182
+					if ($globalDebug) {
183
+						echo 'departure airport : '.$dair.' - arrival airport : '. $darr.' - departure hour : '. $dhour.' - arrival hour : '.$ahour."\n";
184
+					}
155 185
 					//$icao = ACARS->ident2icao($ident);
156 186
 					//$icao = $Translation->checkTranslation($ident);
157 187
 					//$Schedule->addSchedule($icao,$dair,$dhour,$darr,$ahour,'ACARS');
158 188
 					$decode = array('Departure airport' => $dair, 'Departure hour' => $dhour, 'Arrival airport' => $darr, 'Arrival hour' => $ahour);
159 189
 					$found = true;
160
-				}
161
-				elseif ($n == 2 || $n  == 4) {
162
-					if ($dhour != '') $dhour = substr(sprintf('%04d',$dhour),0,2).':'.substr(sprintf('%04d',$dhour),2);
163
-					if ($globalDebug) echo 'airport arrival : '.$dair.' - arrival hour : '.$dhour."\n";
190
+				} elseif ($n == 2 || $n  == 4) {
191
+					if ($dhour != '') {
192
+						$dhour = substr(sprintf('%04d',$dhour),0,2).':'.substr(sprintf('%04d',$dhour),2);
193
+					}
194
+					if ($globalDebug) {
195
+						echo 'airport arrival : '.$dair.' - arrival hour : '.$dhour."\n";
196
+					}
164 197
 					//$icao = ACARS->ident2icao($ident);
165 198
 					//$icao = $Translation->checkTranslation($ident);
166 199
 					$decode = array('Arrival airport' => $dair, 'Arrival hour' => $dhour);
167 200
 					$found = true;
168
-				}
169
-				elseif ($n == 1) {
170
-					if ($globalDebug) echo 'airport arrival : '.$darr."\n";
201
+				} elseif ($n == 1) {
202
+					if ($globalDebug) {
203
+						echo 'airport arrival : '.$darr."\n";
204
+					}
171 205
 					//$icao = ACARS->ident2icao($ident);
172 206
 					//$icao = $Translation->checkTranslation($ident);
173 207
 					$decode = array('Arrival airport' => $darr);
@@ -185,7 +219,9 @@  discard block
 block discarded – undo
185 219
 				$darr = '';
186 220
 				$n = sscanf($message, "%4c,%4c,%*7s,%*d", $dair, $darr);
187 221
 				if ($n == 4) {
188
-					if ($globalDebug) echo 'airport depart : '.$dair.' - airport arrival : '.$darr."\n";
222
+					if ($globalDebug) {
223
+						echo 'airport depart : '.$dair.' - airport arrival : '.$darr."\n";
224
+					}
189 225
 					//$icao = ACARS->ident2icao($ident);
190 226
 					//$icao = $Translation->checkTranslation($ident);
191 227
 					//$Schedule->addSchedule($icao,$dair,'',$darr,'','ACARS');
@@ -219,14 +255,23 @@  discard block
 block discarded – undo
219 255
 				$apiste = '';
220 256
 				$n = sscanf(str_replace(array("\r\n", "\n", "\r"),'',$message), "%*[0-9A-Z]/%*3d/%4s/%*cSCH/%6[0-9A-Z ]/%4c/%4c/%5s/%4d%*3c/%4d/%4c/%[0-9A-Z ]/", $airicao,$aident,$dair, $darr, $ddate, $dhour,$ahour, $aair, $apiste);
221 257
 				if ($n > 8) {
222
-					if ($globalDebug) echo 'airicao : '. $airicao.' - ident : '.$aident.' - departure airport : '.$dair.' - arrival airport : '. $darr.' - date depart : '.$ddate.' - departure hour : '. $dhour.' - arrival hour : '.$ahour.' - arrival airport : '.$aair.' - arrival piste : '.$apiste."\n";
223
-					if ($dhour != '') $dhour = substr(sprintf('%04d',$dhour),0,2).':'.substr(sprintf('%04d',$dhour),2);
224
-					if ($ahour != '') $ahour = substr(sprintf('%04d',$ahour),0,2).':'.substr(sprintf('%04d',$ahour),2);
258
+					if ($globalDebug) {
259
+						echo 'airicao : '. $airicao.' - ident : '.$aident.' - departure airport : '.$dair.' - arrival airport : '. $darr.' - date depart : '.$ddate.' - departure hour : '. $dhour.' - arrival hour : '.$ahour.' - arrival airport : '.$aair.' - arrival piste : '.$apiste."\n";
260
+					}
261
+					if ($dhour != '') {
262
+						$dhour = substr(sprintf('%04d',$dhour),0,2).':'.substr(sprintf('%04d',$dhour),2);
263
+					}
264
+					if ($ahour != '') {
265
+						$ahour = substr(sprintf('%04d',$ahour),0,2).':'.substr(sprintf('%04d',$ahour),2);
266
+					}
225 267
 					$icao = trim($aident);
226 268
 
227 269
 					//$decode = 'Departure airport : '.$dair.' ('.$ddate.' at '.$dhour.') - Arrival Airport : '.$aair.' (at '.$ahour.') way '.$apiste;
228
-					if ($ahour == '') $decode = array('Departure airport' => $dair, 'Departure date' => $ddate, 'Departure hour' => $dhour, 'Arrival airport' => $darr);
229
-					else $decode = array('Departure airport' => $dair, 'Departure date' => $ddate, 'Departure hour' => $dhour, 'Arrival airport' => $darr, 'Arrival hour' => $ahour, 'Arrival way' => $apiste);
270
+					if ($ahour == '') {
271
+						$decode = array('Departure airport' => $dair, 'Departure date' => $ddate, 'Departure hour' => $dhour, 'Arrival airport' => $darr);
272
+					} else {
273
+						$decode = array('Departure airport' => $dair, 'Departure date' => $ddate, 'Departure hour' => $dhour, 'Arrival airport' => $darr, 'Arrival hour' => $ahour, 'Arrival way' => $apiste);
274
+					}
230 275
 					//$Schedule->addSchedule($icao,$dair,$dhour,$darr,$ahour,'ACARS');
231 276
 					$decode['icao'] = $icao;
232 277
 					$found = true;
@@ -248,9 +293,15 @@  discard block
 block discarded – undo
248 293
 					$lns = $lns.'.'.$lns;
249 294
 					$latitude = $las / 1000.0;
250 295
 					$longitude = $lns / 1000.0;
251
-					if ($lac == 'S') $latitude = '-'.$latitude;
252
-					if ($lnc == 'W') $longitude = '-'.$longitude;
253
-					if ($globalDebug) echo 'latitude : '.$latitude.' - longitude : '.$longitude."\n";
296
+					if ($lac == 'S') {
297
+						$latitude = '-'.$latitude;
298
+					}
299
+					if ($lnc == 'W') {
300
+						$longitude = '-'.$longitude;
301
+					}
302
+					if ($globalDebug) {
303
+						echo 'latitude : '.$latitude.' - longitude : '.$longitude."\n";
304
+					}
254 305
 					$decode = array('Latitude' => $latitude, 'Longitude' => $longitude);
255 306
 					$found = true;
256 307
 				}
@@ -268,7 +319,9 @@  discard block
 block discarded – undo
268 319
 				$darr = '';
269 320
 				$n = sscanf($message, "%*[0-9A-Z ]/%*s %4c/%4c .", $dair, $darr);
270 321
 				if ($n == 4) {
271
-					if ($globalDebug) echo 'airport depart : '.$dair.' - airport arrival : '.$darr."\n";
322
+					if ($globalDebug) {
323
+						echo 'airport depart : '.$dair.' - airport arrival : '.$darr."\n";
324
+					}
272 325
 					//$icao = $Translation->checkTranslation($ident);
273 326
 					//$Schedule->addSchedule($icao,$dair,'',$darr,'','ACARS');
274 327
 					$decode = array('Departure airport' => $dair, 'Arrival airport' => $darr);
@@ -281,7 +334,9 @@  discard block
 block discarded – undo
281 334
 				$darr = '';
282 335
 				$n = sscanf($message, "%*[0-9],%4c,%4c,", $dair, $darr);
283 336
 				if ($n == 4) {
284
-					if ($globalDebug) echo 'airport depart : '.$dair.' - airport arrival : '.$darr."\n";
337
+					if ($globalDebug) {
338
+						echo 'airport depart : '.$dair.' - airport arrival : '.$darr."\n";
339
+					}
285 340
 					//$icao = $Translation->checkTranslation($ident);
286 341
 					//$Schedule->addSchedule($icao,$dair,'',$darr,'','ACARS');
287 342
 					$decode = array('Departure airport' => $dair, 'Arrival airport' => $darr);
@@ -294,7 +349,9 @@  discard block
 block discarded – undo
294 349
 				$darr = '';
295 350
 				$n = sscanf($message, "002AF %4c %4c ", $dair, $darr);
296 351
 				if ($n == 2) {
297
-					if ($globalDebug) echo 'airport depart : '.$dair.' - airport arrival : '.$darr."\n";
352
+					if ($globalDebug) {
353
+						echo 'airport depart : '.$dair.' - airport arrival : '.$darr."\n";
354
+					}
298 355
 					//$icao = $Translation->checkTranslation($ident);
299 356
 					$decode = array('Departure airport' => $dair, 'Arrival airport' => $darr);
300 357
 					//$Schedule->addSchedule($icao,$dair,'',$darr,'','ACARS');
@@ -308,7 +365,9 @@  discard block
 block discarded – undo
308 365
 				$darr = '';
309 366
 				$n = sscanf($message, "#DFBA%*02d/%*[A-Z-],%*[0-9A-Z],%*d,%4c,%4c", $dair, $darr);
310 367
 				if ($n == 6) {
311
-					if ($globalDebug) echo 'airport depart : '.$dair.' - airport arrival : '.$darr."\n";
368
+					if ($globalDebug) {
369
+						echo 'airport depart : '.$dair.' - airport arrival : '.$darr."\n";
370
+					}
312 371
 					//$icao = $Translation->checkTranslation($ident);
313 372
 					//$Schedule->addSchedule($icao,$dair,'',$darr,'','ACARS');
314 373
 					$decode = array('Departure airport' => $dair, 'Arrival airport' => $darr);
@@ -321,7 +380,9 @@  discard block
 block discarded – undo
321 380
 				$darr = '';
322 381
 				$n = sscanf($message, "#DFBA%*02d/%*[0-9A-Z,]/%*[A-Z-],%*[0-9A-Z],%*d,%4c,%4c", $dair, $darr);
323 382
 				if ($n == 7) {
324
-					if ($globalDebug) echo 'airport depart : '.$dair.' - airport arrival : '.$darr."\n";
383
+					if ($globalDebug) {
384
+						echo 'airport depart : '.$dair.' - airport arrival : '.$darr."\n";
385
+					}
325 386
 					//$icao = $Translation->checkTranslation($ident);
326 387
 					//$Schedule->addSchedule($icao,$dair,'',$darr,'','ACARS');
327 388
 					$decode = array('Departure airport' => $dair, 'Arrival airport' => $darr);
@@ -349,8 +410,12 @@  discard block
 block discarded – undo
349 410
 					$decode['icao'] = $icao;
350 411
 					$latitude = $las / 100.0;
351 412
 					$longitude = $lns / 100.0;
352
-					if ($lac == 'S') $latitude = '-'.$latitude;
353
-					if ($lnc == 'W') $longitude = '-'.$longitude;
413
+					if ($lac == 'S') {
414
+						$latitude = '-'.$latitude;
415
+					}
416
+					if ($lnc == 'W') {
417
+						$longitude = '-'.$longitude;
418
+					}
354 419
 
355 420
 					$decode = array('Latitude' => $latitude,'Longitude' => $longitude,'Altitude' => 'FL'.$alt,'Fuel' => $fuel,'speed' => $speed);
356 421
 					$found = true;
@@ -368,8 +433,12 @@  discard block
 block discarded – undo
368 433
 				if ($n == 4) {
369 434
 					$latitude = $las;
370 435
 					$longitude = $lns;
371
-					if ($lac == 'S') $latitude = '-'.$latitude;
372
-					if ($lnc == 'W') $longitude = '-'.$longitude;
436
+					if ($lac == 'S') {
437
+						$latitude = '-'.$latitude;
438
+					}
439
+					if ($lnc == 'W') {
440
+						$longitude = '-'.$longitude;
441
+					}
373 442
 
374 443
 					$decode = array('Latitude' => $latitude,'Longitude' => $longitude);
375 444
 					$found = true;
@@ -385,7 +454,9 @@  discard block
 block discarded – undo
385 454
 				$darr = '';
386 455
 				$n = sscanf($message, "%*[0-9A-Z] NLINFO %*d/%*d %4c/%4c .", $dair, $darr);
387 456
 				if ($n == 5) {
388
-					if ($globalDebug) echo 'airport depart : '.$dair.' - airport arrival : '.$darr."\n";
457
+					if ($globalDebug) {
458
+						echo 'airport depart : '.$dair.' - airport arrival : '.$darr."\n";
459
+					}
389 460
 					//$icao = $Translation->checkTranslation($ident);
390 461
 					//$Schedule->addSchedule($icao,$dair,'',$darr,'','ACARS');
391 462
 					$decode = array('Departure airport' => $dair, 'Arrival airport' => $darr);
@@ -406,7 +477,9 @@  discard block
 block discarded – undo
406 477
 				$aident = '';
407 478
 				$n = sscanf(str_replace(array("\r\n", "\n", "\r"),'',$message), "%*[0-9A-Z],,%*[0-9A-Z],%*[0-9A-Z],%4s,%4s,.%*6s,%*4[A-Z],%[0-9A-Z],", $dair, $darr, $aident);
408 479
 				if ($n == 8) {
409
-					if ($globalDebug) echo 'airport depart : '.$dair.' - airport arrival : '.$darr."\n";
480
+					if ($globalDebug) {
481
+						echo 'airport depart : '.$dair.' - airport arrival : '.$darr."\n";
482
+					}
410 483
 					$icao = trim($aident);
411 484
 					//$Schedule->addSchedule($icao,$dair,'',$darr,'','ACARS');
412 485
 					$decode['icao'] = $icao;
@@ -423,7 +496,9 @@  discard block
 block discarded – undo
423 496
 				$darr = '';
424 497
 				$n = sscanf($message, "%*d/%*d %4s/%4s .%*6s", $dair, $darr);
425 498
 				if ($n == 5) {
426
-					if ($globalDebug) echo 'airport depart : '.$dair.' - airport arrival : '.$darr."\n";
499
+					if ($globalDebug) {
500
+						echo 'airport depart : '.$dair.' - airport arrival : '.$darr."\n";
501
+					}
427 502
 					//$icao = $Translation->checkTranslation($ident);
428 503
 
429 504
 					//$Schedule->addSchedule($icao,$dair,'',$darr,'','ACARS');
@@ -439,7 +514,9 @@  discard block
 block discarded – undo
439 514
 				$darr = '';
440 515
 				$n = sscanf($message,'%4[A-Z]%4[A-Z]%*4d',$dair,$darr);
441 516
 				if ($n == 3) {
442
-					if ($globalDebug) echo 'airport depart : '.$dair.' - airport arrival : '.$darr."\n";
517
+					if ($globalDebug) {
518
+						echo 'airport depart : '.$dair.' - airport arrival : '.$darr."\n";
519
+					}
443 520
 					//$icao = $Translation->checkTranslation($ident);
444 521
 
445 522
 					//$Schedule->addSchedule($icao,$dair,'',$darr,'','ACARS');
@@ -455,7 +532,9 @@  discard block
 block discarded – undo
455 532
 				$darr = '';
456 533
 				$n = sscanf($message,'3J01 DSPTCH %*d/%*d %4s/%4s .%*6s',$dair,$darr);
457 534
 				if ($n == 3) {
458
-					if ($globalDebug) echo 'airport depart : '.$dair.' - airport arrival : '.$darr."\n";
535
+					if ($globalDebug) {
536
+						echo 'airport depart : '.$dair.' - airport arrival : '.$darr."\n";
537
+					}
459 538
 					//$icao = $Translation->checkTranslation($ident);
460 539
 
461 540
 					//$Schedule->addSchedule($icao,$dair,'',$darr,'','ACARS');
@@ -466,7 +545,9 @@  discard block
 block discarded – undo
466 545
 			if (!$found) {
467 546
 				$n = sscanf($message,'MET01%4c',$airport);
468 547
 				if ($n == 1) {
469
-					if ($globalDebug) echo 'airport name : '.$airport;
548
+					if ($globalDebug) {
549
+						echo 'airport name : '.$airport;
550
+					}
470 551
 					$decode = array('Airport/Waypoint name' => $airport);
471 552
 					$found = true;
472 553
 				}
@@ -475,184 +556,126 @@  discard block
 block discarded – undo
475 556
 			if ($label == 'H1') {
476 557
 				if (preg_match('/^#CFBFLR/',$message) || preg_match('/^#CFBWRN/',$message)) {
477 558
 					$decode = array_merge(array('Message nature' => 'Equipment failure'),$decode);
478
-				}
479
-				elseif (preg_match('/^#DFB\*TKO/',$message) || preg_match('/^#DFBTKO/',$message)) {
559
+				} elseif (preg_match('/^#DFB\*TKO/',$message) || preg_match('/^#DFBTKO/',$message)) {
480 560
 					$decode = array_merge(array('Message nature' => 'Take off performance data'),$decode);
481
-				}
482
-				elseif (preg_match('/^#DFB\*CRZ/',$message) || preg_match('/^#DFBCRZ/',$message)) {
561
+				} elseif (preg_match('/^#DFB\*CRZ/',$message) || preg_match('/^#DFBCRZ/',$message)) {
483 562
 					$decode = array_merge(array('Message nature' => 'Cruise performance data'),$decode);
484
-				}
485
-				elseif (preg_match('/^#DFB\*WOB/',$message) || preg_match('/^#DFBWOB/',$message)) {
563
+				} elseif (preg_match('/^#DFB\*WOB/',$message) || preg_match('/^#DFBWOB/',$message)) {
486 564
 					$decode = array_merge(array('Message nature' => 'Weather observation'),$decode);
487
-				}
488
-				elseif (preg_match(':^#DFB/PIREP:',$message)) {
565
+				} elseif (preg_match(':^#DFB/PIREP:',$message)) {
489 566
 					$decode = array_merge(array('Message nature' => 'Pilot Report'),$decode);
490
-				}
491
-				elseif (preg_match('/^#DFBEDA/',$message) || preg_match('/^#DFBENG/',$message)) {
567
+				} elseif (preg_match('/^#DFBEDA/',$message) || preg_match('/^#DFBENG/',$message)) {
492 568
 					$decode = array_merge(array('Message nature' => 'Engine Data'),$decode);
493
-				}
494
-				elseif (preg_match(':^#M1AAEP:',$message)) {
569
+				} elseif (preg_match(':^#M1AAEP:',$message)) {
495 570
 					$decode = array_merge(array('Message nature' => 'Position/Weather Report'),$decode);
496
-				}
497
-				elseif (preg_match(':^#M2APWD:',$message)) {
571
+				} elseif (preg_match(':^#M2APWD:',$message)) {
498 572
 					$decode = array_merge(array('Message nature' => 'Flight plan predicted wind data'),$decode);
499
-				}
500
-				elseif (preg_match(':^#M1BREQPWI:',$message)) {
573
+				} elseif (preg_match(':^#M1BREQPWI:',$message)) {
501 574
 					$decode = array_merge(array('Message nature' => 'Predicted wind info request'),$decode);
502
-				}
503
-				elseif (preg_match(':^#CF:',$message)) {
575
+				} elseif (preg_match(':^#CF:',$message)) {
504 576
 					$decode = array_merge(array('Message nature' => 'Central Fault Display'),$decode);
505
-				}
506
-				elseif (preg_match(':^#DF:',$message)) {
577
+				} elseif (preg_match(':^#DF:',$message)) {
507 578
 					$decode = array_merge(array('Message nature' => 'Digital Flight Data Acquisition Unit'),$decode);
508
-				}
509
-				elseif (preg_match(':^#EC:',$message)) {
579
+				} elseif (preg_match(':^#EC:',$message)) {
510 580
 					$decode = array_merge(array('Message nature' => 'Engine Display System'),$decode);
511
-				}
512
-				elseif (preg_match(':^#EI:',$message)) {
581
+				} elseif (preg_match(':^#EI:',$message)) {
513 582
 					$decode = array_merge(array('Message nature' => 'Engine Report'),$decode);
514
-				}
515
-				elseif (preg_match(':^#H1:',$message)) {
583
+				} elseif (preg_match(':^#H1:',$message)) {
516 584
 					$decode = array_merge(array('Message nature' => 'HF Data Radio - Left'),$decode);
517
-				}
518
-				elseif (preg_match(':^#H2:',$message)) {
585
+				} elseif (preg_match(':^#H2:',$message)) {
519 586
 					$decode = array_merge(array('Message nature' => 'HF Data Radio - Right'),$decode);
520
-				}
521
-				elseif (preg_match(':^#HD:',$message)) {
587
+				} elseif (preg_match(':^#HD:',$message)) {
522 588
 					$decode = array_merge(array('Message nature' => 'HF Data Radio - Selected'),$decode);
523
-				}
524
-				elseif (preg_match(':^#M1:',$message)) {
589
+				} elseif (preg_match(':^#M1:',$message)) {
525 590
 					$decode = array_merge(array('Message nature' => 'Flight Management Computer - Left'),$decode);
526
-				}
527
-				elseif (preg_match(':^#M2:',$message)) {
591
+				} elseif (preg_match(':^#M2:',$message)) {
528 592
 					$decode = array_merge(array('Message nature' => 'Flight Management Computer - Right'),$decode);
529
-				}
530
-				elseif (preg_match(':^#M3:',$message)) {
593
+				} elseif (preg_match(':^#M3:',$message)) {
531 594
 					$decode = array_merge(array('Message nature' => 'Flight Management Computer - Center'),$decode);
532
-				}
533
-				elseif (preg_match(':^#MD:',$message)) {
595
+				} elseif (preg_match(':^#MD:',$message)) {
534 596
 					$decode = array_merge(array('Message nature' => 'Flight Management Computer - Selected'),$decode);
535
-				}
536
-				elseif (preg_match(':^#PS:',$message)) {
597
+				} elseif (preg_match(':^#PS:',$message)) {
537 598
 					$decode = array_merge(array('Message nature' => 'Keyboard/Display Unit'),$decode);
538
-				}
539
-				elseif (preg_match(':^#S1:',$message)) {
599
+				} elseif (preg_match(':^#S1:',$message)) {
540 600
 					$decode = array_merge(array('Message nature' => 'SDU - Left'),$decode);
541
-				}
542
-				elseif (preg_match(':^#S2:',$message)) {
601
+				} elseif (preg_match(':^#S2:',$message)) {
543 602
 					$decode = array_merge(array('Message nature' => 'SDU - Right'),$decode);
544
-				}
545
-				elseif (preg_match(':^#SD:',$message)) {
603
+				} elseif (preg_match(':^#SD:',$message)) {
546 604
 					$decode = array_merge(array('Message nature' => 'SDU - Selected'),$decode);
547
-				}
548
-				elseif (preg_match(':^#T[0-8]:',$message)) {
605
+				} elseif (preg_match(':^#T[0-8]:',$message)) {
549 606
 					$decode = array_merge(array('Message nature' => 'Cabin Terminal Messages'),$decode);
550
-				}
551
-				elseif (preg_match(':^#WO:',$message)) {
607
+				} elseif (preg_match(':^#WO:',$message)) {
552 608
 					$decode = array_merge(array('Message nature' => 'Weather Observation Report'),$decode);
553
-				}
554
-				elseif (preg_match(':^#A1:',$message)) {
609
+				} elseif (preg_match(':^#A1:',$message)) {
555 610
 					$decode = array_merge(array('Message nature' => 'Oceanic Clearance'),$decode);
556
-				}
557
-				elseif (preg_match(':^#A3:',$message)) {
611
+				} elseif (preg_match(':^#A3:',$message)) {
558 612
 					$decode = array_merge(array('Message nature' => 'Departure Clearance Response'),$decode);
559
-				}
560
-				elseif (preg_match(':^#A4:',$message)) {
613
+				} elseif (preg_match(':^#A4:',$message)) {
561 614
 					$decode = array_merge(array('Message nature' => 'Flight Systems Message'),$decode);
562
-				}
563
-				elseif (preg_match(':^#A6:',$message)) {
615
+				} elseif (preg_match(':^#A6:',$message)) {
564 616
 					$decode = array_merge(array('Message nature' => 'Request ADS Reports'),$decode);
565
-				}
566
-				elseif (preg_match(':^#A8:',$message)) {
617
+				} elseif (preg_match(':^#A8:',$message)) {
567 618
 					$decode = array_merge(array('Message nature' => 'Deliver Departure Slot'),$decode);
568
-				}
569
-				elseif (preg_match(':^#A9:',$message)) {
619
+				} elseif (preg_match(':^#A9:',$message)) {
570 620
 					$decode = array_merge(array('Message nature' => 'ATIS report'),$decode);
571
-				}
572
-				elseif (preg_match(':^#A0:',$message)) {
621
+				} elseif (preg_match(':^#A0:',$message)) {
573 622
 					$decode = array_merge(array('Message nature' => 'ATIS Facility Notification (AFN)'),$decode);
574
-				}
575
-				elseif (preg_match(':^#AA:',$message)) {
623
+				} elseif (preg_match(':^#AA:',$message)) {
576 624
 					$decode = array_merge(array('Message nature' => 'ATCComm'),$decode);
577
-				}
578
-				elseif (preg_match(':^#AB:',$message)) {
625
+				} elseif (preg_match(':^#AB:',$message)) {
579 626
 					$decode = array_merge(array('Message nature' => 'TWIP Report'),$decode);
580
-				}
581
-				elseif (preg_match(':^#AC:',$message)) {
627
+				} elseif (preg_match(':^#AC:',$message)) {
582 628
 					$decode = array_merge(array('Message nature' => 'Pushback Clearance'),$decode);
583
-				}
584
-				elseif (preg_match(':^#AD:',$message)) {
629
+				} elseif (preg_match(':^#AD:',$message)) {
585 630
 					$decode = array_merge(array('Message nature' => 'Expected Taxi Clearance'),$decode);
586
-				}
587
-				elseif (preg_match(':^#AF:',$message)) {
631
+				} elseif (preg_match(':^#AF:',$message)) {
588 632
 					$decode = array_merge(array('Message nature' => 'CPC Command/Response'),$decode);
589
-				}
590
-				elseif (preg_match(':^#B1:',$message)) {
633
+				} elseif (preg_match(':^#B1:',$message)) {
591 634
 					$decode = array_merge(array('Message nature' => 'Request Oceanic Clearance'),$decode);
592
-				}
593
-				elseif (preg_match(':^#B2:',$message)) {
635
+				} elseif (preg_match(':^#B2:',$message)) {
594 636
 					$decode = array_merge(array('Message nature' => 'Oceanic Clearance Readback'),$decode);
595
-				}
596
-				elseif (preg_match(':^#B3:',$message)) {
637
+				} elseif (preg_match(':^#B3:',$message)) {
597 638
 					$decode = array_merge(array('Message nature' => 'Request Departure Clearance'),$decode);
598
-				}
599
-				elseif (preg_match(':^#B4:',$message)) {
639
+				} elseif (preg_match(':^#B4:',$message)) {
600 640
 					$decode = array_merge(array('Message nature' => 'Departure Clearance Readback'),$decode);
601
-				}
602
-				elseif (preg_match(':^#B6:',$message)) {
641
+				} elseif (preg_match(':^#B6:',$message)) {
603 642
 					$decode = array_merge(array('Message nature' => 'Provide ADS Report'),$decode);
604
-				}
605
-				elseif (preg_match(':^#B8:',$message)) {
643
+				} elseif (preg_match(':^#B8:',$message)) {
606 644
 					$decode = array_merge(array('Message nature' => 'Request Departure Slot'),$decode);
607
-				}
608
-				elseif (preg_match(':^#B9:',$message)) {
645
+				} elseif (preg_match(':^#B9:',$message)) {
609 646
 					$decode = array_merge(array('Message nature' => 'Request ATIS Report'),$decode);
610
-				}
611
-				elseif (preg_match(':^#B0:',$message)) {
647
+				} elseif (preg_match(':^#B0:',$message)) {
612 648
 					$decode = array_merge(array('Message nature' => 'ATS Facility Notification'),$decode);
613
-				}
614
-				elseif (preg_match(':^#BA:',$message)) {
649
+				} elseif (preg_match(':^#BA:',$message)) {
615 650
 					$decode = array_merge(array('Message nature' => 'ATCComm'),$decode);
616
-				}
617
-				elseif (preg_match(':^#BB:',$message)) {
651
+				} elseif (preg_match(':^#BB:',$message)) {
618 652
 					$decode = array_merge(array('Message nature' => 'Request TWIP Report'),$decode);
619
-				}
620
-				elseif (preg_match(':^#BC:',$message)) {
653
+				} elseif (preg_match(':^#BC:',$message)) {
621 654
 					$decode = array_merge(array('Message nature' => 'Pushback Clearance Request'),$decode);
622
-				}
623
-				elseif (preg_match(':^#BD:',$message)) {
655
+				} elseif (preg_match(':^#BD:',$message)) {
624 656
 					$decode = array_merge(array('Message nature' => 'Expected Taxi Clearance Request'),$decode);
625
-				}
626
-				elseif (preg_match(':^#BE:',$message)) {
657
+				} elseif (preg_match(':^#BE:',$message)) {
627 658
 					$decode = array_merge(array('Message nature' => 'CPC Aircraft Log-On/Off Request'),$decode);
628
-				}
629
-				elseif (preg_match(':^#BF:',$message)) {
659
+				} elseif (preg_match(':^#BF:',$message)) {
630 660
 					$decode = array_merge(array('Message nature' => 'CPC WILCO/UNABLE Response'),$decode);
631
-				}
632
-				elseif (preg_match(':^#H3:',$message)) {
661
+				} elseif (preg_match(':^#H3:',$message)) {
633 662
 					$decode = array_merge(array('Message nature' => 'Icing Report'),$decode);
634 663
 				}
635 664
 			}
636 665
 			if ($label == '10') {
637 666
 				if (preg_match(':^DTO01:',$message)) {
638 667
 					$decode = array_merge(array('Message nature' => 'Delayed Takeoff Report'),$decode);
639
-				}
640
-				elseif (preg_match(':^AIS01:',$message)) {
668
+				} elseif (preg_match(':^AIS01:',$message)) {
641 669
 					$decode = array_merge(array('Message nature' => 'AIS Request'),$decode);
642
-				}
643
-				elseif (preg_match(':^FTX01:',$message)) {
670
+				} elseif (preg_match(':^FTX01:',$message)) {
644 671
 					$decode = array_merge(array('Message nature' => 'Free Text Downlink'),$decode);
645
-				}
646
-				elseif (preg_match(':^FPL01:',$message)) {
672
+				} elseif (preg_match(':^FPL01:',$message)) {
647 673
 					$decode = array_merge(array('Message nature' => 'Flight Plan Request'),$decode);
648
-				}
649
-				elseif (preg_match(':^WAB01:',$message)) {
674
+				} elseif (preg_match(':^WAB01:',$message)) {
650 675
 					$decode = array_merge(array('Message nature' => 'Weight & Balance Request'),$decode);
651
-				}
652
-				elseif (preg_match(':^MET01:',$message)) {
676
+				} elseif (preg_match(':^MET01:',$message)) {
653 677
 					$decode = array_merge(array('Message nature' => 'Weather Data Request'),$decode);
654
-				}
655
-				elseif (preg_match(':^WAB02:',$message)) {
678
+				} elseif (preg_match(':^WAB02:',$message)) {
656 679
 					$decode = array_merge(array('Message nature' => 'Weight and Balance Acknowledgement'),$decode);
657 680
 				}
658 681
 			}
@@ -667,38 +690,28 @@  discard block
 block discarded – undo
667 690
 					$vsta = array('Version' => $version);
668 691
 					if ($state == 'E') {
669 692
 						$vsta = array_merge($vsta,array('Link state' => 'Established'));
670
-					}
671
-					elseif ($state == 'L') {
693
+					} elseif ($state == 'L') {
672 694
 						$vsta = array_merge($vsta,array('Link state' => 'Lost'));
673
-					}
674
-					else {
695
+					} else {
675 696
 						$vsta = array_merge($vsta,array('Link state' => 'Unknown'));
676 697
 					}
677 698
 					if ($type == 'V') {
678 699
 						$vsta = array_merge($vsta,array('Link type' => 'VHF ACARS'));
679
-					}
680
-					elseif ($type == 'S') {
700
+					} elseif ($type == 'S') {
681 701
 						$vsta = array_merge($vsta,array('Link type' => 'Generic SATCOM'));
682
-					}
683
-					elseif ($type == 'H') {
702
+					} elseif ($type == 'H') {
684 703
 						$vsta = array_merge($vsta,array('Link type' => 'HF'));
685
-					}
686
-					elseif ($type == 'G') {
704
+					} elseif ($type == 'G') {
687 705
 						$vsta = array_merge($vsta,array('Link type' => 'GlobalStar SATCOM'));
688
-					}
689
-					elseif ($type == 'C') {
706
+					} elseif ($type == 'C') {
690 707
 						$vsta = array_merge($vsta,array('Link type' => 'ICO SATCOM'));
691
-					}
692
-					elseif ($type == '2') {
708
+					} elseif ($type == '2') {
693 709
 						$vsta = array_merge($vsta,array('Link type' => 'VDL Mode 2'));
694
-					}
695
-					elseif ($type == 'X') {
710
+					} elseif ($type == 'X') {
696 711
 						$vsta = array_merge($vsta,array('Link type' => 'Inmarsat Aero'));
697
-					}
698
-					elseif ($type == 'I') {
712
+					} elseif ($type == 'I') {
699 713
 						$vsta = array_merge($vsta,array('Link type' => 'Irridium SATCOM'));
700
-					}
701
-					else {
714
+					} else {
702 715
 						$vsta = array_merge($vsta,array('Link type' => 'Unknown'));
703 716
 					}
704 717
 					$vsta = array_merge($vsta,array('Event occured at' => implode(':',str_split($at,2))));
@@ -707,7 +720,9 @@  discard block
 block discarded – undo
707 720
 			}
708 721
 
709 722
 			$title = $this->getTitlefromLabel($label);
710
-			if ($title != '') $decode = array_merge(array('Message title' => $title),$decode);
723
+			if ($title != '') {
724
+				$decode = array_merge(array('Message title' => $title),$decode);
725
+			}
711 726
 
712 727
 			/*
713 728
 			// Business jets always use GS0001
@@ -748,14 +763,26 @@  discard block
 block discarded – undo
748 763
 			$decode = $message['decode'];
749 764
 			$registration = (string)$message['registration'];
750 765
 		
751
-			if (isset($decode['latitude'])) $latitude = $decode['latitude'];
752
-			else $latitude = '';
753
-			if (isset($decode['longitude'])) $longitude = $decode['longitude'];
754
-			else $longitude = '';
755
-			if (isset($decode['airicao'])) $airicao = $decode['airicao'];
756
-			else $airicao = '';
757
-			if (isset($decode['icao'])) $icao = $decode['icao'];
758
-			else $icao = $Translation->checkTranslation($ident);
766
+			if (isset($decode['latitude'])) {
767
+				$latitude = $decode['latitude'];
768
+			} else {
769
+				$latitude = '';
770
+			}
771
+			if (isset($decode['longitude'])) {
772
+				$longitude = $decode['longitude'];
773
+			} else {
774
+				$longitude = '';
775
+			}
776
+			if (isset($decode['airicao'])) {
777
+				$airicao = $decode['airicao'];
778
+			} else {
779
+				$airicao = '';
780
+			}
781
+			if (isset($decode['icao'])) {
782
+				$icao = $decode['icao'];
783
+			} else {
784
+				$icao = $Translation->checkTranslation($ident);
785
+			}
759 786
 		
760 787
 			$image_array = $Image->getSpotterImage($registration);
761 788
 			if (!isset($image_array[0]['registration'])) {
@@ -763,11 +790,18 @@  discard block
 block discarded – undo
763 790
 			}
764 791
 		
765 792
 			// Business jets always use GS0001
766
-			if ($ident != 'GS0001') $info = $this->addModeSData($ident,$registration,$icao,$airicao,$latitude,$longitude);
767
-			if ($globalDebug && isset($info) && $info != '') echo $info;
793
+			if ($ident != 'GS0001') {
794
+				$info = $this->addModeSData($ident,$registration,$icao,$airicao,$latitude,$longitude);
795
+			}
796
+			if ($globalDebug && isset($info) && $info != '') {
797
+				echo $info;
798
+			}
768 799
 
769
-			if (count($decode) > 0) $decode_json = json_encode($decode);
770
-			else $decode_json = '';
800
+			if (count($decode) > 0) {
801
+				$decode_json = json_encode($decode);
802
+			} else {
803
+				$decode_json = '';
804
+			}
771 805
 			if (isset($decode['Departure airport']) && isset($decode['Departure hour']) && isset($decode['Arrival airport']) && isset($decode['Arrival hour'])) {
772 806
 				$Schedule->addSchedule($icao,$decode['Departure airport'],$decode['Departure hour'],$decode['Arrival airport'],$decode['Arrival hour'],'ACARS');
773 807
 			} elseif (isset($decode['Departure airport']) && isset($decode['Arrival airport'])) {
@@ -775,8 +809,12 @@  discard block
 block discarded – undo
775 809
 			}
776 810
 
777 811
 			$result = $this->addLiveAcarsData($ident,$registration,$label,$block_id,$msg_no,$msg,$decode_json);
778
-			if (!isset($globalACARSArchive)) $globalACARSArchive = array('10','80','81','82','3F');
779
-			if ($result && in_array($label,$globalACARSArchive)) $this->addArchiveAcarsData($ident,$registration,$label,$block_id,$msg_no,$msg,$decode_json);
812
+			if (!isset($globalACARSArchive)) {
813
+				$globalACARSArchive = array('10','80','81','82','3F');
814
+			}
815
+			if ($result && in_array($label,$globalACARSArchive)) {
816
+				$this->addArchiveAcarsData($ident,$registration,$label,$block_id,$msg_no,$msg,$decode_json);
817
+			}
780 818
 
781 819
 			if ($globalDebug && count($decode) > 0) {
782 820
 				echo "Human readable data : ".implode(' - ',$decode)."\n";
@@ -801,7 +839,9 @@  discard block
 block discarded – undo
801 839
 			$Connection = new Connection($this->db);
802 840
 			$this->db = $Connection->db;
803 841
 
804
-			if ($globalDebug) echo "Test if not already in Live ACARS table...";
842
+			if ($globalDebug) {
843
+				echo "Test if not already in Live ACARS table...";
844
+			}
805 845
 			$query_test = "SELECT COUNT(*) as nb FROM acars_live WHERE ident = :ident AND registration = :registration AND message = :message";
806 846
 			$query_test_values = array(':ident' => $ident,':registration' => $registration, ':message' => $message);
807 847
 			try {
@@ -811,7 +851,9 @@  discard block
 block discarded – undo
811 851
 				return "error : ".$e->getMessage();
812 852
 			}
813 853
 			if ($stht->fetchColumn() == 0) {
814
-				if ($globalDebug) echo "Add Live ACARS data...";
854
+				if ($globalDebug) {
855
+					echo "Add Live ACARS data...";
856
+				}
815 857
 				$query = "INSERT INTO acars_live (ident,registration,label,block_id,msg_no,message,decode,date) VALUES (:ident,:registration,:label,:block_id,:msg_no,:message,:decode,:date)";
816 858
 				$query_values = array(':ident' => $ident,':registration' => $registration, ':label' => $label,':block_id' => $block_id, ':msg_no' => $msg_no, ':message' => $message, ':decode' => $decode,':date' => date("Y-m-d H:i:s"));
817 859
 				try {
@@ -822,10 +864,14 @@  discard block
 block discarded – undo
822 864
 					return "error : ".$e->getMessage();
823 865
 				}
824 866
 			} else {
825
-				if ($globalDebug) echo "Data already in DB...\n";
867
+				if ($globalDebug) {
868
+					echo "Data already in DB...\n";
869
+				}
826 870
 				return false;
827 871
 			}
828
-			if ($globalDebug) echo "Done\n";
872
+			if ($globalDebug) {
873
+				echo "Done\n";
874
+			}
829 875
 			return true;
830 876
 		}
831 877
 	}
@@ -857,7 +903,9 @@  discard block
 block discarded – undo
857 903
 			    	    }
858 904
 				    if ($stht->fetchColumn() == 0) {
859 905
 			*/
860
-			if ($globalDebug) echo "Add Live ACARS data...";
906
+			if ($globalDebug) {
907
+				echo "Add Live ACARS data...";
908
+			}
861 909
 			$query = "INSERT INTO acars_archive (ident,registration,label,block_id,msg_no,message,decode) VALUES (:ident,:registration,:label,:block_id,:msg_no,:message,:decode)";
862 910
 			$query_values = array(':ident' => $ident,':registration' => $registration, ':label' => $label,':block_id' => $block_id, ':msg_no' => $msg_no, ':message' => $message, ':decode' => $decode);
863 911
 			try {
@@ -868,7 +916,9 @@  discard block
 block discarded – undo
868 916
 				return "error : ".$e->getMessage();
869 917
 			}
870 918
 //    	    }
871
-			if ($globalDebug) echo "Done\n";
919
+			if ($globalDebug) {
920
+				echo "Done\n";
921
+			}
872 922
 		}
873 923
 	}
874 924
 
@@ -892,8 +942,11 @@  discard block
 block discarded – undo
892 942
 			die;
893 943
 		}
894 944
 		$row = $sth->fetchAll(PDO::FETCH_ASSOC);
895
-		if (count($row) > 0) return $row[0]['title'];
896
-		else return '';
945
+		if (count($row) > 0) {
946
+			return $row[0]['title'];
947
+		} else {
948
+			return '';
949
+		}
897 950
 	}
898 951
 
899 952
 	/**
@@ -913,8 +966,11 @@  discard block
 block discarded – undo
913 966
 			die;
914 967
 		}
915 968
 		$row = $sth->fetchAll(PDO::FETCH_ASSOC);
916
-		if (count($row) > 0) return $row;
917
-		else return array();
969
+		if (count($row) > 0) {
970
+			return $row;
971
+		} else {
972
+			return array();
973
+		}
918 974
 	}
919 975
 
920 976
 	/**
@@ -935,8 +991,11 @@  discard block
 block discarded – undo
935 991
 			die;
936 992
 		}
937 993
 		$row = $sth->fetchAll(PDO::FETCH_ASSOC);
938
-		if (count($row) > 0) return $row[0];
939
-		else return array();
994
+		if (count($row) > 0) {
995
+			return $row[0];
996
+		} else {
997
+			return array();
998
+		}
940 999
 	}
941 1000
 
942 1001
 	/**
@@ -988,20 +1047,36 @@  discard block
 block discarded – undo
988 1047
 			if ($row['registration'] != '') {
989 1048
 				$row['registration'] = str_replace('.','',$row['registration']);
990 1049
 				$image_array = $Image->getSpotterImage($row['registration']);
991
-				if (count($image_array) > 0) $data = array_merge($data,array('image' => $image_array[0]['image'],'image_thumbnail' => $image_array[0]['image_thumbnail'],'image_copyright' => $image_array[0]['image_copyright'],'image_source' => $image_array[0]['image_source'],'image_source_website' => $image_array[0]['image_source_website']));
992
-				else $data = array_merge($data,array('image' => '','image_thumbnail' => '','image_copyright' => '','image_source' => '','image_source_website' => ''));
993
-			} else $data = array_merge($data,array('image' => '','image_thumbnail' => '','image_copyright' => '','image_source' => '','image_source_website' => ''));
994
-			if ($row['registration'] == '') $row['registration'] = 'NA';
995
-			if ($row['ident'] == '') $row['ident'] = 'NA';
1050
+				if (count($image_array) > 0) {
1051
+					$data = array_merge($data,array('image' => $image_array[0]['image'],'image_thumbnail' => $image_array[0]['image_thumbnail'],'image_copyright' => $image_array[0]['image_copyright'],'image_source' => $image_array[0]['image_source'],'image_source_website' => $image_array[0]['image_source_website']));
1052
+				} else {
1053
+					$data = array_merge($data,array('image' => '','image_thumbnail' => '','image_copyright' => '','image_source' => '','image_source_website' => ''));
1054
+				}
1055
+			} else {
1056
+				$data = array_merge($data,array('image' => '','image_thumbnail' => '','image_copyright' => '','image_source' => '','image_source_website' => ''));
1057
+			}
1058
+			if ($row['registration'] == '') {
1059
+				$row['registration'] = 'NA';
1060
+			}
1061
+			if ($row['ident'] == '') {
1062
+				$row['ident'] = 'NA';
1063
+			}
996 1064
 			$identicao = $Spotter->getAllAirlineInfo(substr($row['ident'],0,2));
997 1065
 			if (isset($identicao[0])) {
998 1066
 				if (substr($row['ident'],0,2) == 'AF') {
999
-					if (filter_var(substr($row['ident'],2),FILTER_VALIDATE_INT,array("flags"=>FILTER_FLAG_ALLOW_OCTAL))) $icao = $row['ident'];
1000
-					else $icao = 'AFR'.ltrim(substr($row['ident'],2),'0');
1001
-				} else $icao = $identicao[0]['icao'].ltrim(substr($row['ident'],2),'0');
1067
+					if (filter_var(substr($row['ident'],2),FILTER_VALIDATE_INT,array("flags"=>FILTER_FLAG_ALLOW_OCTAL))) {
1068
+						$icao = $row['ident'];
1069
+					} else {
1070
+						$icao = 'AFR'.ltrim(substr($row['ident'],2),'0');
1071
+					}
1072
+				} else {
1073
+					$icao = $identicao[0]['icao'].ltrim(substr($row['ident'],2),'0');
1074
+				}
1002 1075
 
1003 1076
 				$data = array_merge($data,array('airline_icao' => $identicao[0]['icao'],'airline_name' => $identicao[0]['name']));
1004
-			} else $icao = $row['ident'];
1077
+			} else {
1078
+				$icao = $row['ident'];
1079
+			}
1005 1080
 			$icao = $Translation->checkTranslation($icao,false);
1006 1081
 
1007 1082
 			$decode = json_decode($row['decode'],true);
@@ -1027,7 +1102,9 @@  discard block
 block discarded – undo
1027 1102
 					$found = true;
1028 1103
 				}
1029 1104
 			}
1030
-			if ($found) $row['decode'] = json_encode($decode);
1105
+			if ($found) {
1106
+				$row['decode'] = json_encode($decode);
1107
+			}
1031 1108
 			$data = array_merge($data,array('registration' => $row['registration'],'message' => $row['message'], 'date' => $row['date'], 'ident' => $icao, 'decode' => $row['decode']));
1032 1109
 			$result[] = $data;
1033 1110
 			$i++;
@@ -1035,8 +1112,9 @@  discard block
 block discarded – undo
1035 1112
 		if (isset($result)) {
1036 1113
 			$result[0]['query_number_rows'] = $i;
1037 1114
 			return $result;
1115
+		} else {
1116
+			return array();
1038 1117
 		}
1039
-		else return array();
1040 1118
 	}
1041 1119
 
1042 1120
 	/**
@@ -1096,20 +1174,36 @@  discard block
 block discarded – undo
1096 1174
 			if ($row['registration'] != '') {
1097 1175
 				$row['registration'] = str_replace('.','',$row['registration']);
1098 1176
 				$image_array = $Image->getSpotterImage($row['registration']);
1099
-				if (count($image_array) > 0) $data = array_merge($data,array('image_thumbnail' => $image_array[0]['image_thumbnail'],'image_copyright' => $image_array[0]['image_copyright'],'image_source' => $image_array[0]['image_source'],'image_source_website' => $image_array[0]['image_source_website']));
1100
-				else $data = array_merge($data,array('image_thumbnail' => '','image_copyright' => '','image_source' => '','image_source_website' => ''));
1101
-			} else $data = array_merge($data,array('image_thumbnail' => '','image_copyright' => '','image_source' => '','image_source_website' => ''));
1177
+				if (count($image_array) > 0) {
1178
+					$data = array_merge($data,array('image_thumbnail' => $image_array[0]['image_thumbnail'],'image_copyright' => $image_array[0]['image_copyright'],'image_source' => $image_array[0]['image_source'],'image_source_website' => $image_array[0]['image_source_website']));
1179
+				} else {
1180
+					$data = array_merge($data,array('image_thumbnail' => '','image_copyright' => '','image_source' => '','image_source_website' => ''));
1181
+				}
1182
+			} else {
1183
+				$data = array_merge($data,array('image_thumbnail' => '','image_copyright' => '','image_source' => '','image_source_website' => ''));
1184
+			}
1102 1185
 			$icao = '';
1103
-			if ($row['registration'] == '') $row['registration'] = 'NA';
1104
-			if ($row['ident'] == '') $row['ident'] = 'NA';
1186
+			if ($row['registration'] == '') {
1187
+				$row['registration'] = 'NA';
1188
+			}
1189
+			if ($row['ident'] == '') {
1190
+				$row['ident'] = 'NA';
1191
+			}
1105 1192
 			$identicao = $Spotter->getAllAirlineInfo(substr($row['ident'],0,2));
1106 1193
 			if (isset($identicao[0])) {
1107 1194
 				if (substr($row['ident'],0,2) == 'AF') {
1108
-					if (filter_var(substr($row['ident'],2),FILTER_VALIDATE_INT,array("flags"=>FILTER_FLAG_ALLOW_OCTAL))) $icao = $row['ident'];
1109
-					else $icao = 'AFR'.ltrim(substr($row['ident'],2),'0');
1110
-				} else $icao = $identicao[0]['icao'].ltrim(substr($row['ident'],2),'0');
1195
+					if (filter_var(substr($row['ident'],2),FILTER_VALIDATE_INT,array("flags"=>FILTER_FLAG_ALLOW_OCTAL))) {
1196
+						$icao = $row['ident'];
1197
+					} else {
1198
+						$icao = 'AFR'.ltrim(substr($row['ident'],2),'0');
1199
+					}
1200
+				} else {
1201
+					$icao = $identicao[0]['icao'].ltrim(substr($row['ident'],2),'0');
1202
+				}
1111 1203
 				$data = array_merge($data,array('airline_icao' => $identicao[0]['icao'],'airline_name' => $identicao[0]['name']));
1112
-			} else $icao = $row['ident'];
1204
+			} else {
1205
+				$icao = $row['ident'];
1206
+			}
1113 1207
 			$icao = $Translation->checkTranslation($icao);
1114 1208
 
1115 1209
 
@@ -1117,12 +1211,16 @@  discard block
 block discarded – undo
1117 1211
 			$found = false;
1118 1212
 			if ($decode != '' && array_key_exists('Departure airport',$decode)) {
1119 1213
 				$airport_info = $Spotter->getAllAirportInfo($decode['Departure airport']);
1120
-				if (isset($airport_info[0]['icao'])) $decode['Departure airport'] = '<a href="'.$globalURL.'/airport/'.$airport_info[0]['icao'].'">'.$airport_info[0]['city'].','.$airport_info[0]['country'].' ('.$airport_info[0]['icao'].')</a>';
1214
+				if (isset($airport_info[0]['icao'])) {
1215
+					$decode['Departure airport'] = '<a href="'.$globalURL.'/airport/'.$airport_info[0]['icao'].'">'.$airport_info[0]['city'].','.$airport_info[0]['country'].' ('.$airport_info[0]['icao'].')</a>';
1216
+				}
1121 1217
 				$found = true;
1122 1218
 			}
1123 1219
 			if ($decode != '' && array_key_exists('Arrival airport',$decode)) {
1124 1220
 				$airport_info = $Spotter->getAllAirportInfo($decode['Arrival airport']);
1125
-				if (isset($airport_info[0]['icao'])) $decode['Arrival airport'] = '<a href="'.$globalURL.'/airport/'.$airport_info[0]['icao'].'">'.$airport_info[0]['city'].','.$airport_info[0]['country'].' ('.$airport_info[0]['icao'].')</a>';
1221
+				if (isset($airport_info[0]['icao'])) {
1222
+					$decode['Arrival airport'] = '<a href="'.$globalURL.'/airport/'.$airport_info[0]['icao'].'">'.$airport_info[0]['city'].','.$airport_info[0]['country'].' ('.$airport_info[0]['icao'].')</a>';
1223
+				}
1126 1224
 				$found = true;
1127 1225
 			}
1128 1226
 			if ($decode != '' && array_key_exists('Airport/Waypoint name',$decode)) {
@@ -1132,7 +1230,9 @@  discard block
 block discarded – undo
1132 1230
 					$found = true;
1133 1231
 				}
1134 1232
 			}
1135
-			if ($found) $row['decode'] = json_encode($decode);
1233
+			if ($found) {
1234
+				$row['decode'] = json_encode($decode);
1235
+			}
1136 1236
 
1137 1237
 			$data = array_merge($data,array('registration' => $row['registration'],'message' => $row['message'], 'date' => $row['date'], 'ident' => $icao, 'decode' => $row['decode']));
1138 1238
 			$result[] = $data;
@@ -1141,7 +1241,9 @@  discard block
 block discarded – undo
1141 1241
 		if (isset($result)) {
1142 1242
 			$result[0]['query_number_rows'] = $i;
1143 1243
 			return $result;
1144
-		} else return array();
1244
+		} else {
1245
+			return array();
1246
+		}
1145 1247
 	}
1146 1248
 
1147 1249
 	/**
@@ -1157,19 +1259,29 @@  discard block
 block discarded – undo
1157 1259
 		$ident = trim($ident);
1158 1260
 		$Translation = new Translation($this->db);
1159 1261
 		$Spotter = new Spotter($this->db);
1160
-		if ($globalDebug) echo "Test if we add ModeS data...";
1262
+		if ($globalDebug) {
1263
+			echo "Test if we add ModeS data...";
1264
+		}
1161 1265
 		//if ($icao == '') $icao = ACARS->ident2icao($ident);
1162
-		if ($icao == '') $icao = $Translation->checkTranslation($ident);
1163
-		if ($globalDebug) echo '- Ident : '.$icao.' - ';
1266
+		if ($icao == '') {
1267
+			$icao = $Translation->checkTranslation($ident);
1268
+		}
1269
+		if ($globalDebug) {
1270
+			echo '- Ident : '.$icao.' - ';
1271
+		}
1164 1272
 		if ($ident == '' || $registration == '') {
1165
-			if ($globalDebug) echo "Ident or registration null, exit\n";
1273
+			if ($globalDebug) {
1274
+				echo "Ident or registration null, exit\n";
1275
+			}
1166 1276
 			return '';
1167 1277
 		}
1168 1278
 
1169 1279
 		$registration = str_replace('.','',$registration);
1170 1280
 		$ident = $Translation->ident2icao($ident);
1171 1281
 		// Check if a flight with same registration is flying now, if ok check if callsign = name in ACARS, else add it to translation
1172
-		if ($globalDebug) echo "Check if needed to add translation ".$ident.'... ';
1282
+		if ($globalDebug) {
1283
+			echo "Check if needed to add translation ".$ident.'... ';
1284
+		}
1173 1285
 		$querysi = "SELECT ident FROM spotter_live s,aircraft_modes a WHERE a.ModeS = s.ModeS AND a.Registration = :registration AND s.format_source <> 'ACARS' LIMIT 1";
1174 1286
 		$querysi_values = array(':registration' => $registration);
1175 1287
 		try {
@@ -1177,7 +1289,9 @@  discard block
 block discarded – undo
1177 1289
 			$sthsi = $this->db->prepare($querysi);
1178 1290
 			$sthsi->execute($querysi_values);
1179 1291
 		} catch(PDOException $e) {
1180
-			if ($globalDebug) echo $e->getMessage();
1292
+			if ($globalDebug) {
1293
+				echo $e->getMessage();
1294
+			}
1181 1295
 			return "error : ".$e->getMessage();
1182 1296
 		}
1183 1297
 		$resultsi = $sthsi->fetch(PDO::FETCH_ASSOC);
@@ -1186,9 +1300,14 @@  discard block
 block discarded – undo
1186 1300
 		if (count($resultsi) > 0 && $resultsi['ident'] != $ident && $resultsi['ident'] != '') {
1187 1301
 			$Translation = new Translation($this->db);
1188 1302
 			$trans_ident = $Translation->getOperator($resultsi['ident']);
1189
-			if ($globalDebug) echo 'Add translation to table : '.$ident.' -> '.$resultsi['ident'].' ';
1190
-			if ($ident != $trans_ident) $Translation->addOperator($resultsi['ident'],$ident,'ACARS');
1191
-			elseif ($trans_ident == $ident) $Translation->updateOperator($resultsi['ident'],$ident,'ACARS');
1303
+			if ($globalDebug) {
1304
+				echo 'Add translation to table : '.$ident.' -> '.$resultsi['ident'].' ';
1305
+			}
1306
+			if ($ident != $trans_ident) {
1307
+				$Translation->addOperator($resultsi['ident'],$ident,'ACARS');
1308
+			} elseif ($trans_ident == $ident) {
1309
+				$Translation->updateOperator($resultsi['ident'],$ident,'ACARS');
1310
+			}
1192 1311
 		} else {
1193 1312
 			if ($registration != '' && $latitude != '' && $longitude != '') {
1194 1313
 				$query = "SELECT ModeS FROM aircraft_modes WHERE Registration = :registration LIMIT 1";
@@ -1197,18 +1316,25 @@  discard block
 block discarded – undo
1197 1316
 					$sth = $this->db->prepare($query);
1198 1317
 					$sth->execute($query_values);
1199 1318
 				} catch(PDOException $e) {
1200
-					if ($globalDebug) echo $e->getMessage();
1319
+					if ($globalDebug) {
1320
+						echo $e->getMessage();
1321
+					}
1201 1322
 					return "error : ".$e->getMessage();
1202 1323
 				}
1203 1324
 				$result = $sth->fetch(PDO::FETCH_ASSOC);
1204 1325
 				$sth->closeCursor();
1205
-				if (isset($result['modes'])) $hex = $result['modes'];
1206
-				else $hex = '';
1326
+				if (isset($result['modes'])) {
1327
+					$hex = $result['modes'];
1328
+				} else {
1329
+					$hex = '';
1330
+				}
1207 1331
 				$SI_data = array('hex' => $hex,'ident' => $ident,'aircraft_icao' => $ICAOTypeCode,'registration' => $registration,'latitude' => $latitude,'$longitude' => $longitude,'format_source' => 'ACARS');
1208 1332
 				$this->SI->add($SI_data);
1209 1333
 			}
1210 1334
 		}
1211
-		if ($globalDebug) echo 'Done'."\n";
1335
+		if ($globalDebug) {
1336
+			echo 'Done'."\n";
1337
+		}
1212 1338
 
1213 1339
 		$query = "SELECT flightaware_id, ModeS FROM spotter_output WHERE ident = :ident AND format_source <> 'ACARS' ORDER BY spotter_id DESC LIMIT 1";
1214 1340
 		$query_values = array(':ident' => $icao);
@@ -1217,15 +1343,20 @@  discard block
 block discarded – undo
1217 1343
 			$sth = $this->db->prepare($query);
1218 1344
 			$sth->execute($query_values);
1219 1345
 		} catch(PDOException $e) {
1220
-			if ($globalDebug) echo $e->getMessage();
1346
+			if ($globalDebug) {
1347
+				echo $e->getMessage();
1348
+			}
1221 1349
 			return "error : ".$e->getMessage();
1222 1350
 		}
1223 1351
 		$result = $sth->fetch(PDO::FETCH_ASSOC);
1224 1352
 		$sth->closeCursor();
1225 1353
 		//print_r($result);
1226 1354
 		if (isset($result['flightaware_id'])) {
1227
-			if (isset($result['ModeS'])) $ModeS = $result['ModeS'];
1228
-			else $ModeS = '';
1355
+			if (isset($result['ModeS'])) {
1356
+				$ModeS = $result['ModeS'];
1357
+			} else {
1358
+				$ModeS = '';
1359
+			}
1229 1360
 			if ($ModeS == '') {
1230 1361
 				$id = explode('-',$result['flightaware_id']);
1231 1362
 				$ModeS = $id[0];
@@ -1239,13 +1370,17 @@  discard block
 block discarded – undo
1239 1370
 					$sthc = $this->db->prepare($queryc);
1240 1371
 					$sthc->execute($queryc_values);
1241 1372
 				} catch(PDOException $e) {
1242
-					if ($globalDebug) echo $e->getMessage();
1373
+					if ($globalDebug) {
1374
+						echo $e->getMessage();
1375
+					}
1243 1376
 					return "error : ".$e->getMessage();
1244 1377
 				}
1245 1378
 				$row = $sthc->fetch(PDO::FETCH_ASSOC);
1246 1379
 				$sthc->closeCursor();
1247 1380
 				if (count($row) ==  0) {
1248
-					if ($globalDebug) echo " Add to ModeS table - ";
1381
+					if ($globalDebug) {
1382
+						echo " Add to ModeS table - ";
1383
+					}
1249 1384
 					$queryi = "INSERT INTO aircraft_modes (ModeS,ModeSCountry,Registration,ICAOTypeCode,Source) VALUES (:ModeS,:ModeSCountry,:Registration, :ICAOTypeCode,'ACARS')";
1250 1385
 					$queryi_values = array(':ModeS' => $ModeS,':ModeSCountry' => $country,':Registration' => $registration, ':ICAOTypeCode' => $ICAOTypeCode);
1251 1386
 					try {
@@ -1253,11 +1388,15 @@  discard block
 block discarded – undo
1253 1388
 						$sthi = $this->db->prepare($queryi);
1254 1389
 						$sthi->execute($queryi_values);
1255 1390
 					} catch(PDOException $e) {
1256
-						if ($globalDebug) echo $e->getMessage();
1391
+						if ($globalDebug) {
1392
+							echo $e->getMessage();
1393
+						}
1257 1394
 						return "error : ".$e->getMessage();
1258 1395
 					}
1259 1396
 				} else {
1260
-					if ($globalDebug) echo " Update ModeS table - ";
1397
+					if ($globalDebug) {
1398
+						echo " Update ModeS table - ";
1399
+					}
1261 1400
 					if ($ICAOTypeCode != '') {
1262 1401
 						$queryi = "UPDATE aircraft_modes SET ModeSCountry = :ModeSCountry,Registration = :Registration,ICAOTypeCode = :ICAOTypeCode,Source = 'ACARS',LastModified = NOW() WHERE ModeS = :ModeS";
1263 1402
 						$queryi_values = array(':ModeS' => $ModeS,':ModeSCountry' => $country,':Registration' => $registration, ':ICAOTypeCode' => $ICAOTypeCode);
@@ -1270,7 +1409,9 @@  discard block
 block discarded – undo
1270 1409
 						$sthi = $this->db->prepare($queryi);
1271 1410
 						$sthi->execute($queryi_values);
1272 1411
 					} catch(PDOException $e) {
1273
-						if ($globalDebug) echo $e->getMessage();
1412
+						if ($globalDebug) {
1413
+							echo $e->getMessage();
1414
+						}
1274 1415
 						return "error : ".$e->getMessage();
1275 1416
 					}
1276 1417
 				}
@@ -1292,7 +1433,9 @@  discard block
 block discarded – undo
1292 1433
 					    return "error : ".$e->getMessage();
1293 1434
 				}
1294 1435
 				*/
1295
-				if ($globalDebug) echo " Update Spotter_output table - ";
1436
+				if ($globalDebug) {
1437
+					echo " Update Spotter_output table - ";
1438
+				}
1296 1439
 				if ($ICAOTypeCode != '') {
1297 1440
 					if ($globalDBdriver == 'mysql') {
1298 1441
 						$queryi = "UPDATE spotter_output SET registration = :Registration,aircraft_icao = :ICAOTypeCode WHERE ident = :ident AND date >= date_sub(UTC_TIMESTAMP(), INTERVAL 1 HOUR)";
@@ -1303,8 +1446,7 @@  discard block
 block discarded – undo
1303 1446
 				} else {
1304 1447
 					if ($globalDBdriver == 'mysql') {
1305 1448
 						$queryi = "UPDATE spotter_output SET registration = :Registration WHERE ident = :ident AND date >= date_sub(UTC_TIMESTAMP(), INTERVAL 1 HOUR)";
1306
-					}
1307
-					elseif ($globalDBdriver == 'pgsql') {
1449
+					} elseif ($globalDBdriver == 'pgsql') {
1308 1450
 						$queryi = "UPDATE spotter_output SET registration = :Registration WHERE ident = :ident AND date >= NOW() AT TIME ZONE 'UTC' - INTERVAL '1 HOUR'";
1309 1451
 					}
1310 1452
 					$queryi_values = array(':Registration' => $registration,':ident' => $icao);
@@ -1314,15 +1456,21 @@  discard block
 block discarded – undo
1314 1456
 					$sthi = $this->db->prepare($queryi);
1315 1457
 					$sthi->execute($queryi_values);
1316 1458
 				} catch(PDOException $e) {
1317
-					if ($globalDebug) echo $e->getMessage();
1459
+					if ($globalDebug) {
1460
+						echo $e->getMessage();
1461
+					}
1318 1462
 					return "error : ".$e->getMessage();
1319 1463
 				}
1320 1464
 
1321 1465
 			}
1322 1466
 		} else {
1323
-			if ($globalDebug) echo " Can't find ModeS in spotter_output - ";
1467
+			if ($globalDebug) {
1468
+				echo " Can't find ModeS in spotter_output - ";
1469
+			}
1470
+		}
1471
+		if ($globalDebug) {
1472
+			echo "Done\n";
1324 1473
 		}
1325
-		if ($globalDebug) echo "Done\n";
1326 1474
 	}
1327 1475
 }
1328 1476
 ?>
Please login to merge, or discard this patch.