Completed
Push — master ( 465dcf...e879ed )
by Yannick
05:41
created
live-geojson.php 1 patch
Braces   +133 added lines, -51 removed lines patch added patch discarded remove patch
@@ -18,22 +18,43 @@  discard block
 block discarded – undo
18 18
 }
19 19
 header('Content-Type: text/javascript');
20 20
 
21
-if (!isset($globalJsonCompress)) $compress = true;
22
-else $compress = $globalJsonCompress;
21
+if (!isset($globalJsonCompress)) {
22
+	$compress = true;
23
+} else {
24
+	$compress = $globalJsonCompress;
25
+}
23 26
 
24 27
 $from_archive = false;
25 28
 $min = false;
26 29
 $allhistory = false;
27 30
 $filter['source'] = array();
28
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt'));
29
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup'));
30
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars'));
31
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs'));
32
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs'));
33
-if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING);
34
-if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING);
35
-if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING);
36
-if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING);
31
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') {
32
+	$filter['source'] = array_merge($filter['source'],array('vatsimtxt'));
33
+}
34
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') {
35
+	$filter['source'] = array_merge($filter['source'],array('whazzup'));
36
+}
37
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') {
38
+	$filter['source'] = array_merge($filter['source'],array('phpvmacars'));
39
+}
40
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') {
41
+	$filter['source'] = array_merge($filter['source'],array('sbs'));
42
+}
43
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') {
44
+	$filter['source'] = array_merge($filter['source'],array('aprs'));
45
+}
46
+if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') {
47
+	$filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING);
48
+}
49
+if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') {
50
+	$filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING);
51
+}
52
+if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') {
53
+	$filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING);
54
+}
55
+if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') {
56
+	$filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING);
57
+}
37 58
 
38 59
 if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) {
39 60
 	$min = true;
@@ -84,8 +105,12 @@  discard block
 block discarded – undo
84 105
 	} else {
85 106
 		$flightcnt = $SpotterLive->getLiveSpotterCount($filter);
86 107
 	}
87
-	if ($flightcnt == '') $flightcnt = 0;
88
-} else $flightcnt = 0;
108
+	if ($flightcnt == '') {
109
+		$flightcnt = 0;
110
+	}
111
+	} else {
112
+	$flightcnt = 0;
113
+}
89 114
 
90 115
 $sqltime = round(microtime(true)-$begintime,2);
91 116
 
@@ -94,8 +119,11 @@  discard block
 block discarded – undo
94 119
 
95 120
 $output = '{';
96 121
 	$output .= '"type": "FeatureCollection",';
97
-		if ($min) $output .= '"minimal": "true",';
98
-		else $output .= '"minimal": "false",';
122
+		if ($min) {
123
+			$output .= '"minimal": "true",';
124
+		} else {
125
+			$output .= '"minimal": "false",';
126
+		}
99 127
 		$output .= '"fc": "'.$flightcnt.'",';
100 128
 		$output .= '"sqt": "'.$sqltime.'",';
101 129
 
@@ -132,11 +160,16 @@  discard block
 block discarded – undo
132 160
 						//$output .= '"sqt": "'.$sqltime.'",';
133 161
 						$output .= '"id": "'.$spotter_item['flightaware_id'].'",';
134 162
 						$output .= '"properties": {';
135
-							if ($compress) $output .= '"fi": "'.$spotter_item['flightaware_id'].'",';
136
-							else $output .= '"flightaware_id": "'.$spotter_item['flightaware_id'].'",';
163
+							if ($compress) {
164
+								$output .= '"fi": "'.$spotter_item['flightaware_id'].'",';
165
+							} else {
166
+								$output .= '"flightaware_id": "'.$spotter_item['flightaware_id'].'",';
167
+							}
137 168
 							$output .= '"fc": "'.$flightcnt.'",';
138 169
 							$output .= '"sqt": "'.$sqltime.'",';
139
-							if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",';
170
+							if (isset($begindate)) {
171
+								$output .= '"archive_date": "'.$begindate.'",';
172
+							}
140 173
 
141 174
 /*
142 175
 							if ($min) $output .= '"minimal": "true",';
@@ -144,13 +177,21 @@  discard block
 block discarded – undo
144 177
 */
145 178
 							//$output .= '"fc": "'.$spotter_item['nb'].'",';
146 179
 						if (isset($spotter_item['ident']) && $spotter_item['ident'] != '') {
147
-							if ($compress) $output .= '"c": "'.$spotter_item['ident'].'",';
148
-							else $output .= '"callsign": "'.$spotter_item['ident'].'",';
180
+							if ($compress) {
181
+								$output .= '"c": "'.$spotter_item['ident'].'",';
182
+							} else {
183
+								$output .= '"callsign": "'.$spotter_item['ident'].'",';
184
+							}
149 185
 						} else {
150
-							if ($compress) $output .= '"c": "NA",';
151
-							else $output .= '"callsign": "NA",';
186
+							if ($compress) {
187
+								$output .= '"c": "NA",';
188
+							} else {
189
+								$output .= '"callsign": "NA",';
190
+							}
191
+						}
192
+						if (isset($spotter_item['registration'])) {
193
+							$output .= '"registration": "'.$spotter_item['registration'].'",';
152 194
 						}
153
-						if (isset($spotter_item['registration'])) $output .= '"registration": "'.$spotter_item['registration'].'",';
154 195
 						if (isset($spotter_item['aircraft_name']) && isset($spotter_item['aircraft_type'])) {
155 196
 							$output .= '"aircraft_name": "'.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')",';
156 197
 							$output .= '"aircraft_wiki": "http://'.strtolower($globalLanguage).'.wikipedia.org/wiki/'.urlencode(str_replace(' ','_',$spotter_item['aircraft_name'])).'",';
@@ -163,20 +204,31 @@  discard block
 block discarded – undo
163 204
 							$output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",';
164 205
 						}
165 206
 						if (!isset($spotter_item['aircraft_shadow'])) {
166
-							if (!isset($spotter_item['aircraft_icao']) || $spotter_item['aircraft_icao'] == '') $spotter_item['aircraft_shadow'] = '';
167
-							else {
207
+							if (!isset($spotter_item['aircraft_icao']) || $spotter_item['aircraft_icao'] == '') {
208
+								$spotter_item['aircraft_shadow'] = '';
209
+							} else {
168 210
 								$aircraft_info = $Spotter->getAllAircraftInfo($spotter_item['aircraft_icao']);
169
-								if (count($aircraft_info) > 0) $spotter_item['aircraft_shadow'] = $aircraft_info[0]['aircraft_shadow'];
170
-								elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') $spotter_item['aircraft_shadow'] = 'PA18.png';
171
-								else $spotter_item['aircraft_shadow'] = '';
211
+								if (count($aircraft_info) > 0) {
212
+									$spotter_item['aircraft_shadow'] = $aircraft_info[0]['aircraft_shadow'];
213
+								} elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') {
214
+									$spotter_item['aircraft_shadow'] = 'PA18.png';
215
+								} else {
216
+									$spotter_item['aircraft_shadow'] = '';
217
+								}
172 218
 							}
173 219
 						}
174 220
 						if ($spotter_item['aircraft_shadow'] == '') {
175
-							if ($compress) $output .= '"as": "default.png",';
176
-							else $output .= '"aircraft_shadow": "default.png",';
221
+							if ($compress) {
222
+								$output .= '"as": "default.png",';
223
+							} else {
224
+								$output .= '"aircraft_shadow": "default.png",';
225
+							}
177 226
 						} else {
178
-							if ($compress) $output .= '"as": "'.$spotter_item['aircraft_shadow'].'",';
179
-							else $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",';
227
+							if ($compress) {
228
+								$output .= '"as": "'.$spotter_item['aircraft_shadow'].'",';
229
+							} else {
230
+								$output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",';
231
+							}
180 232
 						}
181 233
 						if (isset($spotter_item['airline_name'])) {
182 234
 							$output .= '"airline_name": "'.$spotter_item['airline_name'].'",';
@@ -184,8 +236,11 @@  discard block
 block discarded – undo
184 236
 							$output .= '"airline_name": "NA",';
185 237
 						}
186 238
 						if (isset($spotter_item['departure_airport'])) {
187
-							if ($compress) $output .= '"dac": "'.$spotter_item['departure_airport'].'",';
188
-							else $output .= '"departure_airport_code": "'.$spotter_item['departure_airport'].'",';
239
+							if ($compress) {
240
+								$output .= '"dac": "'.$spotter_item['departure_airport'].'",';
241
+							} else {
242
+								$output .= '"departure_airport_code": "'.$spotter_item['departure_airport'].'",';
243
+							}
189 244
 						}
190 245
 						if (isset($spotter_item['departure_airport_city'])) {
191 246
 							$output .= '"departure_airport": "'.$spotter_item['departure_airport_city'].', '.$spotter_item['departure_airport_country'].'",';
@@ -197,8 +252,11 @@  discard block
 block discarded – undo
197 252
 							$output .= '"arrival_airport_time": "'.$spotter_item['arrival_airport_time'].'",';
198 253
 						}
199 254
 						if (isset($spotter_item['arrival_airport'])) {
200
-							if ($compress) $output .= '"aac": "'.$spotter_item['arrival_airport'].'",';
201
-							else $output .= '"arrival_airport_code": "'.$spotter_item['arrival_airport'].'",';
255
+							if ($compress) {
256
+								$output .= '"aac": "'.$spotter_item['arrival_airport'].'",';
257
+							} else {
258
+								$output .= '"arrival_airport_code": "'.$spotter_item['arrival_airport'].'",';
259
+							}
202 260
 						}
203 261
 						if (isset($spotter_item['arrival_airport_city'])) {
204 262
 							$output .= '"arrival_airport": "'.$spotter_item['arrival_airport_city'].', '.$spotter_item['arrival_airport_country'].'",';
@@ -216,19 +274,30 @@  discard block
 block discarded – undo
216 274
 							$output .= '"ground_speed": "'.$spotter_item['ground_speed'].'",';
217 275
 						}
218 276
 						
219
-						if ($compress) $output .= '"a": "'.$spotter_item['altitude'].'",';
220
-						else $output .= '"altitude": "'.$spotter_item['altitude'].'",';
221
-						if ($compress)$output .= '"h": "'.$spotter_item['heading'].'",';
222
-						else $output .= '"heading": "'.$spotter_item['heading'].'",';
277
+						if ($compress) {
278
+							$output .= '"a": "'.$spotter_item['altitude'].'",';
279
+						} else {
280
+							$output .= '"altitude": "'.$spotter_item['altitude'].'",';
281
+						}
282
+						if ($compress) {
283
+							$output .= '"h": "'.$spotter_item['heading'].'",';
284
+						} else {
285
+							$output .= '"heading": "'.$spotter_item['heading'].'",';
286
+						}
223 287
 						
224
-						if (isset($archivespeed)) $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$spotter_item['heading'],$archivespeed);
225
-						else $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$spotter_item['heading']);
288
+						if (isset($archivespeed)) {
289
+							$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$spotter_item['heading'],$archivespeed);
290
+						} else {
291
+							$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$spotter_item['heading']);
292
+						}
226 293
 						//$output .= '"nextlatitude": "'.$nextcoord['latitude'].'",';
227 294
 						//$output .= '"nextlongitude": "'.$nextcoord['longitude'].'",';
228 295
 						$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
229 296
 						//$output .= '"nextlatlon": ['.$nextcoord['longitude'].','.$nextcoord['latitude'].'],';
230 297
 
231
-						if (!$min) $output .= '"image": "'.$image.'",';
298
+						if (!$min) {
299
+							$output .= '"image": "'.$image.'",';
300
+						}
232 301
 						if (isset($spotter_item['image_copyright']) && $spotter_item['image_copyright'] != '') {
233 302
 							$output .= '"image_copyright": "'.str_replace('"',"'",trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$spotter_item['image_copyright']))).'",';
234 303
 						}
@@ -236,8 +305,11 @@  discard block
 block discarded – undo
236 305
 							$output .= '"image_source_website": "'.urlencode($spotter_item['image_source_website']).'",';
237 306
 						}
238 307
 						if (isset($spotter_item['squawk'])) {
239
-							if ($compress) $output .= '"sq": "'.$spotter_item['squawk'].'",';
240
-							else $output .= '"squawk": "'.$spotter_item['squawk'].'",';
308
+							if ($compress) {
309
+								$output .= '"sq": "'.$spotter_item['squawk'].'",';
310
+							} else {
311
+								$output .= '"squawk": "'.$spotter_item['squawk'].'",';
312
+							}
241 313
 						}
242 314
 						if (isset($spotter_item['squawk_usage'])) {
243 315
 							$output .= '"squawk_usage": "'.$spotter_item['squawk_usage'].'",';
@@ -255,8 +327,11 @@  discard block
 block discarded – undo
255 327
 							$output .= '"acars": "'.trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"), '<br />',$spotter_item['acars']['message'])).'",';
256 328
 						}
257 329
 						// type when not aircraft ?
258
-						if ($compress) $output .= '"t": "aircraft"';
259
-						else $output .= '"type": "aircraft"';
330
+						if ($compress) {
331
+							$output .= '"t": "aircraft"';
332
+						} else {
333
+							$output .= '"type": "aircraft"';
334
+						}
260 335
 						$output .= '},';
261 336
 						$output .= '"geometry": {';
262 337
 							$output .= '"type": "Point",';
@@ -325,7 +400,9 @@  discard block
 block discarded – undo
325 400
 				//if ((isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true') || (!isset($_COOKIE['flightpath']) && (!isset($globalMapHistory) || $globalMapHistory || $allhistory) || (isset($_GET['history']) && $_GET['history'] != '' && $_GET['history'] != 'NA' && ($_GET['history'] == $spotter_item['ident'] || $_GET['history'] == $spotter_item['flightaware_id'])))) {
326 401
 				//if ((isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true') || (!isset($_COOKIE['flightpath']) && (!isset($globalMapHistory) || $globalMapHistory || $allhistory) || (isset($_GET['history']) && $_GET['history'] != '' && $_GET['history'] != 'NA' && ($_GET['history'] == $spotter_item['ident'] || $_GET['history'] == $spotter_item['flightaware_id']))) || (isset($_GET['history']) && $_GET['history'] == '' && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id'])) {
327 402
 				$history = filter_input(INPUT_GET,'history',FILTER_SANITIZE_STRING);
328
-				if ($history == '' && isset($_COOKIE['history'])) $history = $_COOKIE['history'];
403
+				if ($history == '' && isset($_COOKIE['history'])) {
404
+					$history = $_COOKIE['history'];
405
+				}
329 406
 				if ((isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true') || (!isset($_COOKIE['flightpath']) && (!isset($globalMapHistory) || $globalMapHistory || $allhistory) 
330 407
 				|| (isset($history) && $history != '' && $history != 'NA' && ($history == $spotter_item['ident'] || $history == $spotter_item['flightaware_id']))) 
331 408
 				|| (isset($history) && $history == '' && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id'])) {
@@ -350,8 +427,11 @@  discard block
 block discarded – undo
350 427
 						$output_history .= ']}},';
351 428
 						$output .= $output_history;
352 429
 					    }
353
-					    if ($compress) $output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history","a": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": [';
354
-					    else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": [';
430
+					    if ($compress) {
431
+					    	$output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history","a": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": [';
432
+					    } else {
433
+					    	$output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": [';
434
+					    }
355 435
 					}
356 436
 					$output_history .= '[';
357 437
 					$output_history .=  $spotter_history['longitude'].', ';
@@ -401,7 +481,9 @@  discard block
 block discarded – undo
401 481
 			$output .= ']';
402 482
 			$output .= ',"initial_sqltime": "'.$sqltime.'",';
403 483
 			$output .= '"totaltime": "'.round(microtime(true)-$begintime,2).'",';
404
-			if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",';
484
+			if (isset($begindate)) {
485
+				$output .= '"archive_date": "'.$begindate.'",';
486
+			}
405 487
 			$output .= '"fc": "'.$j.'"';
406 488
 		} else {
407 489
 			$output .= '"features": ';
Please login to merge, or discard this patch.
index.php 1 patch
Braces   +357 added lines, -95 removed lines patch added patch discarded remove patch
@@ -135,11 +135,26 @@  discard block
 block discarded – undo
135 135
 				<li><div class="checkbox"><label><input type="checkbox" name="notamcb" value="1" onclick="showNotam();" /><?php echo _("Display NOTAM"); ?></label></div></li>
136 136
 				<li><?php echo _("NOTAM scope:"); ?>
137 137
 					<select class="selectpicker" onchange="notamscope(this);">
138
-						<option<?php if (!isset($_COOKIE['notamscope']) || $_COOKIE['notamscope'] == 'All') print ' selected'; ?>>All</option>
139
-						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport/Enroute warning') print ' selected'; ?>>Airport/Enroute warning</option>
140
-						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport warning') print ' selected'; ?>>Airport warning</option>
141
-						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Navigation warning') print ' selected'; ?>>Navigation warning</option>
142
-						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Enroute warning') print ' selected'; ?>>Enroute warning</option>
138
+						<option<?php if (!isset($_COOKIE['notamscope']) || $_COOKIE['notamscope'] == 'All') {
139
+	print ' selected';
140
+}
141
+?>>All</option>
142
+						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport/Enroute warning') {
143
+	print ' selected';
144
+}
145
+?>>Airport/Enroute warning</option>
146
+						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport warning') {
147
+	print ' selected';
148
+}
149
+?>>Airport warning</option>
150
+						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Navigation warning') {
151
+	print ' selected';
152
+}
153
+?>>Navigation warning</option>
154
+						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Enroute warning') {
155
+	print ' selected';
156
+}
157
+?>>Enroute warning</option>
143 158
 					</select
144 159
 				</li>
145 160
 			</ul>
@@ -167,7 +182,12 @@  discard block
 block discarded – undo
167 182
 		        <div class="form-group">
168 183
 			    <label>From (UTC):</label>
169 184
 		            <div class='input-group date' id='datetimepicker1'>
170
-            			<input type='text' name="start_date" class="form-control" value="<?php if (isset($_POST['start_date'])) print $_POST['start_date']; elseif (isset($_COOKIE['archive_begin'])) print date("m/d/Y h:i a",$_COOKIE['archive_begin']); ?>" required />
185
+            			<input type='text' name="start_date" class="form-control" value="<?php if (isset($_POST['start_date'])) {
186
+	print $_POST['start_date'];
187
+} elseif (isset($_COOKIE['archive_begin'])) {
188
+	print date("m/d/Y h:i a",$_COOKIE['archive_begin']);
189
+}
190
+?>" required />
171 191
 		                <span class="input-group-addon">
172 192
             			    <span class="glyphicon glyphicon-calendar"></span>
173 193
 		                </span>
@@ -176,7 +196,12 @@  discard block
 block discarded – undo
176 196
 		        <div class="form-group">
177 197
 			    <label>To (UTC):</label>
178 198
 		            <div class='input-group date' id='datetimepicker2'>
179
-		                <input type='text' name="end_date" class="form-control" value="<?php if (isset($_POST['end_date'])) print $_POST['end_date']; elseif (isset($_COOKIE['archive_end'])) print date("m/d/Y h:i a",$_COOKIE['archive_end']); ?>" />
199
+		                <input type='text' name="end_date" class="form-control" value="<?php if (isset($_POST['end_date'])) {
200
+	print $_POST['end_date'];
201
+} elseif (isset($_COOKIE['archive_end'])) {
202
+	print date("m/d/Y h:i a",$_COOKIE['archive_end']);
203
+}
204
+?>" />
180 205
             			<span class="input-group-addon">
181 206
 		                    <span class="glyphicon glyphicon-calendar"></span>
182 207
             			</span>
@@ -202,8 +227,20 @@  discard block
 block discarded – undo
202 227
 
203 228
 		    <li><?php echo _("Playback speed:"); ?>
204 229
 			<div class="range">
205
-			    <input type="range" min="0" max="50" step="1" name="archivespeed" onChange="archivespeedrange.value=value;" value="<?php  if (isset($_POST['archivespeed'])) print $_POST['archivespeed']; elseif (isset($_COOKIE['archive_speed'])) print $_COOKIE['archive_speed']; else print '1'; ?>">
206
-			    <output id="archivespeedrange"><?php  if (isset($_COOKIE['archive_speed'])) print $_COOKIE['archive_speed']; else print '1'; ?></output>
230
+			    <input type="range" min="0" max="50" step="1" name="archivespeed" onChange="archivespeedrange.value=value;" value="<?php  if (isset($_POST['archivespeed'])) {
231
+	print $_POST['archivespeed'];
232
+} elseif (isset($_COOKIE['archive_speed'])) {
233
+	print $_COOKIE['archive_speed'];
234
+} else {
235
+	print '1';
236
+}
237
+?>">
238
+			    <output id="archivespeedrange"><?php  if (isset($_COOKIE['archive_speed'])) {
239
+	print $_COOKIE['archive_speed'];
240
+} else {
241
+	print '1';
242
+}
243
+?></output>
207 244
 			</div>
208 245
 		    </li>
209 246
 		    <li><input type="submit" name="archive" value="Show archive" class="btn btn-primary" /></li>
@@ -225,15 +262,27 @@  discard block
 block discarded – undo
225 262
 		    <li><?php echo _("Type of Map:"); ?>
226 263
 			<select  class="selectpicker" onchange="mapType(this);">
227 264
 			    <?php
228
-				if (!isset($_COOKIE['MapType']) || $_COOKIE['MapType'] == '') $MapType = $globalMapProvider;
229
-				else $MapType = $_COOKIE['MapType'];
265
+				if (!isset($_COOKIE['MapType']) || $_COOKIE['MapType'] == '') {
266
+					$MapType = $globalMapProvider;
267
+				} else {
268
+					$MapType = $_COOKIE['MapType'];
269
+				}
230 270
 			    ?>
231 271
 			    <?php
232 272
 				if (isset($globalBingMapKey) && $globalBingMapKey != '') {
233 273
 			    ?>
234
-			    <option value="Bing-Aerial"<?php if ($MapType == 'Bing-Aerial') print ' selected'; ?>>Bing-Aerial</option>
235
-			    <option value="Bing-Hybrid"<?php if ($MapType == 'Bing-Hybrid') print ' selected'; ?>>Bing-Hybrid</option>
236
-			    <option value="Bing-Road"<?php if ($MapType == 'Bing-Road') print ' selected'; ?>>Bing-Road</option>
274
+			    <option value="Bing-Aerial"<?php if ($MapType == 'Bing-Aerial') {
275
+	print ' selected';
276
+}
277
+?>>Bing-Aerial</option>
278
+			    <option value="Bing-Hybrid"<?php if ($MapType == 'Bing-Hybrid') {
279
+	print ' selected';
280
+}
281
+?>>Bing-Hybrid</option>
282
+			    <option value="Bing-Road"<?php if ($MapType == 'Bing-Road') {
283
+	print ' selected';
284
+}
285
+?>>Bing-Road</option>
237 286
 			    <?php
238 287
 				}
239 288
 			    ?>
@@ -243,56 +292,131 @@  discard block
 block discarded – undo
243 292
 			    <?php
244 293
 				    if (isset($globalHereappId) && $globalHereappId != '' && isset($globalHereappCode) && $globalHereappCode != '') {
245 294
 			    ?>
246
-			    <option value="Here-Aerial"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Aerial</option>
247
-			    <option value="Here-Hybrid"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Hybrid</option>
248
-			    <option value="Here-Road"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Road</option>
295
+			    <option value="Here-Aerial"<?php if ($MapType == 'Here') {
296
+	print ' selected';
297
+}
298
+?>>Here-Aerial</option>
299
+			    <option value="Here-Hybrid"<?php if ($MapType == 'Here') {
300
+	print ' selected';
301
+}
302
+?>>Here-Hybrid</option>
303
+			    <option value="Here-Road"<?php if ($MapType == 'Here') {
304
+	print ' selected';
305
+}
306
+?>>Here-Road</option>
249 307
 			    <?php
250 308
 				    }
251 309
 			    ?>
252 310
 			    <?php
253 311
 				    if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '') {
254 312
 			    ?>
255
-			    <option value="Google-Roadmap"<?php if ($MapType == 'Google-Roadmap') print ' selected'; ?>>Google Roadmap</option>
256
-			    <option value="Google-Satellite"<?php if ($MapType == 'Google-Satellite') print ' selected'; ?>>Google Satellite</option>
257
-			    <option value="Google-Hybrid"<?php if ($MapType == 'Google-Hybrid') print ' selected'; ?>>Google Hybrid</option>
258
-			    <option value="Google-Terrain"<?php if ($MapType == 'Google-Terrain') print ' selected'; ?>>Google Terrain</option>
313
+			    <option value="Google-Roadmap"<?php if ($MapType == 'Google-Roadmap') {
314
+	print ' selected';
315
+}
316
+?>>Google Roadmap</option>
317
+			    <option value="Google-Satellite"<?php if ($MapType == 'Google-Satellite') {
318
+	print ' selected';
319
+}
320
+?>>Google Satellite</option>
321
+			    <option value="Google-Hybrid"<?php if ($MapType == 'Google-Hybrid') {
322
+	print ' selected';
323
+}
324
+?>>Google Hybrid</option>
325
+			    <option value="Google-Terrain"<?php if ($MapType == 'Google-Terrain') {
326
+	print ' selected';
327
+}
328
+?>>Google Terrain</option>
259 329
 			    <?php
260 330
 				    }
261 331
 			    ?>
262 332
 			    <?php
263 333
 				    if (isset($globalMapQuestKey) && $globalMapQuestKey != '') {
264 334
 			    ?>
265
-			    <option value="MapQuest-OSM"<?php if ($MapType == 'MapQuest-OSM') print ' selected'; ?>>MapQuest-OSM</option>
266
-			    <option value="MapQuest-Aerial"<?php if ($MapType == 'MapQuest-Aerial') print ' selected'; ?>>MapQuest-Aerial</option>
267
-			    <option value="MapQuest-Hybrid"<?php if ($MapType == 'MapQuest-Hybrid') print ' selected'; ?>>MapQuest-Hybrid</option>
335
+			    <option value="MapQuest-OSM"<?php if ($MapType == 'MapQuest-OSM') {
336
+	print ' selected';
337
+}
338
+?>>MapQuest-OSM</option>
339
+			    <option value="MapQuest-Aerial"<?php if ($MapType == 'MapQuest-Aerial') {
340
+	print ' selected';
341
+}
342
+?>>MapQuest-Aerial</option>
343
+			    <option value="MapQuest-Hybrid"<?php if ($MapType == 'MapQuest-Hybrid') {
344
+	print ' selected';
345
+}
346
+?>>MapQuest-Hybrid</option>
268 347
 			    <?php
269 348
 				    }
270 349
 			    ?>
271
-			    <option value="Yandex"<?php if ($MapType == 'Yandex') print ' selected'; ?>>Yandex</option>
350
+			    <option value="Yandex"<?php if ($MapType == 'Yandex') {
351
+	print ' selected';
352
+}
353
+?>>Yandex</option>
272 354
 			    <?php
273 355
 				}
274 356
 			    ?>
275 357
 			    <?php
276 358
 				    if (isset($globalMapboxToken) && $globalMapboxToken != '') {
277
-					if (!isset($_COOKIE['MapTypeId'])) $MapBoxId = 'default';
278
-					else $MapBoxId = $_COOKIE['MapTypeId'];
359
+					if (!isset($_COOKIE['MapTypeId'])) {
360
+						$MapBoxId = 'default';
361
+					} else {
362
+						$MapBoxId = $_COOKIE['MapTypeId'];
363
+					}
279 364
 			    ?>
280
-			    <option value="Mapbox-default"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'default') print ' selected'; ?>>Mapbox default</option>
281
-			    <option value="Mapbox-mapbox.streets"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets') print ' selected'; ?>>Mapbox streets</option>
282
-			    <option value="Mapbox-mapbox.light"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.light') print ' selected'; ?>>Mapbox light</option>
283
-			    <option value="Mapbox-mapbox.dark"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.dark') print ' selected'; ?>>Mapbox dark</option>
284
-			    <option value="Mapbox-mapbox.satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.satellite') print ' selected'; ?>>Mapbox satellite</option>
285
-			    <option value="Mapbox-mapbox.streets-satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-satellite') print ' selected'; ?>>Mapbox streets-satellite</option>
286
-			    <option value="Mapbox-mapbox.streets-basic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-basic') print ' selected'; ?>>Mapbox streets-basic</option>
287
-			    <option value="Mapbox-mapbox.comic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.comic') print ' selected'; ?>>Mapbox comic</option>
288
-			    <option value="Mapbox-mapbox.outdoors"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.outdoors') print ' selected'; ?>>Mapbox outdoors</option>
289
-			    <option value="Mapbox-mapbox.pencil"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pencil') print ' selected'; ?>>Mapbox pencil</option>
290
-			    <option value="Mapbox-mapbox.pirates"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pirates') print ' selected'; ?>>Mapbox pirates</option>
291
-			    <option value="Mapbox-mapbox.emerald"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.emerald') print ' selected'; ?>>Mapbox emerald</option>
365
+			    <option value="Mapbox-default"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'default') {
366
+	print ' selected';
367
+}
368
+?>>Mapbox default</option>
369
+			    <option value="Mapbox-mapbox.streets"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets') {
370
+	print ' selected';
371
+}
372
+?>>Mapbox streets</option>
373
+			    <option value="Mapbox-mapbox.light"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.light') {
374
+	print ' selected';
375
+}
376
+?>>Mapbox light</option>
377
+			    <option value="Mapbox-mapbox.dark"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.dark') {
378
+	print ' selected';
379
+}
380
+?>>Mapbox dark</option>
381
+			    <option value="Mapbox-mapbox.satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.satellite') {
382
+	print ' selected';
383
+}
384
+?>>Mapbox satellite</option>
385
+			    <option value="Mapbox-mapbox.streets-satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-satellite') {
386
+	print ' selected';
387
+}
388
+?>>Mapbox streets-satellite</option>
389
+			    <option value="Mapbox-mapbox.streets-basic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-basic') {
390
+	print ' selected';
391
+}
392
+?>>Mapbox streets-basic</option>
393
+			    <option value="Mapbox-mapbox.comic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.comic') {
394
+	print ' selected';
395
+}
396
+?>>Mapbox comic</option>
397
+			    <option value="Mapbox-mapbox.outdoors"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.outdoors') {
398
+	print ' selected';
399
+}
400
+?>>Mapbox outdoors</option>
401
+			    <option value="Mapbox-mapbox.pencil"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pencil') {
402
+	print ' selected';
403
+}
404
+?>>Mapbox pencil</option>
405
+			    <option value="Mapbox-mapbox.pirates"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pirates') {
406
+	print ' selected';
407
+}
408
+?>>Mapbox pirates</option>
409
+			    <option value="Mapbox-mapbox.emerald"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.emerald') {
410
+	print ' selected';
411
+}
412
+?>>Mapbox emerald</option>
292 413
 			    <?php
293 414
 				    }
294 415
 			    ?>
295
-			    <option value="OpenStreetMap"<?php if ($MapType == 'OpenStreetMap') print ' selected'; ?>>OpenStreetMap</option>
416
+			    <option value="OpenStreetMap"<?php if ($MapType == 'OpenStreetMap') {
417
+	print ' selected';
418
+}
419
+?>>OpenStreetMap</option>
296 420
 			</select>
297 421
 		    </li>
298 422
 <?php
@@ -300,9 +424,18 @@  discard block
 block discarded – undo
300 424
 ?>
301 425
 		    <li><?php echo _("Type of Terrain:"); ?>
302 426
 			<select  class="selectpicker" onchange="terrainType(this);">
303
-			    <option value="stk"<?php if (!isset($_COOKIE['MapTerrain']) || $_COOKIE['MapTerrain'] == 'stk') print ' selected'; ?>>stk terrain</option>
304
-			    <option value="ellipsoid"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'ellipsoid') print ' selected';?>>ellipsoid</option>
305
-			    <option value="vrterrain"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'vrterrain') print ' selected';?>>vr terrain</option>
427
+			    <option value="stk"<?php if (!isset($_COOKIE['MapTerrain']) || $_COOKIE['MapTerrain'] == 'stk') {
428
+	print ' selected';
429
+}
430
+?>>stk terrain</option>
431
+			    <option value="ellipsoid"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'ellipsoid') {
432
+	print ' selected';
433
+}
434
+?>>ellipsoid</option>
435
+			    <option value="vrterrain"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'vrterrain') {
436
+	print ' selected';
437
+}
438
+?>>vr terrain</option>
306 439
 			</select>
307 440
 		    </li>
308 441
 <?php
@@ -312,18 +445,36 @@  discard block
 block discarded – undo
312 445
     if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') {
313 446
 ?>
314 447
 		    
315
-		    <li><div class="checkbox"><label><input type="checkbox" name="flightpopup" value="1" onclick="clickFlightPopup(this)" <?php if (isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true') print 'checked'; ?> ><?php echo _("Display flight info as popup"); ?></label></div></li>
316
-		    <li><div class="checkbox"><label><input type="checkbox" name="flightpath" value="1" onclick="clickFlightPath(this)" <?php if ((isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true') || !isset($_COOKIE['flightpath'])) print 'checked'; ?> ><?php echo _("Display flight path"); ?></label></div></li>
317
-		    <li><div class="checkbox"><label><input type="checkbox" name="flightroute" value="1" onclick="clickFlightRoute(this)" <?php if ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == 'true') || !isset($_COOKIE['MapRoute'])) print 'checked'; ?> ><?php echo _("Display flight route on click"); ?></label></div></li>
318
-		    <li><div class="checkbox"><label><input type="checkbox" name="flightestimation" value="1" onclick="clickFlightEstimation(this)" <?php if ((isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'true') || (!isset($_COOKIE['flightestimation']) && !isset($globalMapEstimation)) || (!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation)) print 'checked'; ?> ><?php echo _("Planes animate between updates"); ?></label></div></li>
448
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightpopup" value="1" onclick="clickFlightPopup(this)" <?php if (isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true') {
449
+	print 'checked';
450
+}
451
+?> ><?php echo _("Display flight info as popup"); ?></label></div></li>
452
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightpath" value="1" onclick="clickFlightPath(this)" <?php if ((isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true') || !isset($_COOKIE['flightpath'])) {
453
+	print 'checked';
454
+}
455
+?> ><?php echo _("Display flight path"); ?></label></div></li>
456
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightroute" value="1" onclick="clickFlightRoute(this)" <?php if ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == 'true') || !isset($_COOKIE['MapRoute'])) {
457
+	print 'checked';
458
+}
459
+?> ><?php echo _("Display flight route on click"); ?></label></div></li>
460
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightestimation" value="1" onclick="clickFlightEstimation(this)" <?php if ((isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'true') || (!isset($_COOKIE['flightestimation']) && !isset($globalMapEstimation)) || (!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation)) {
461
+	print 'checked';
462
+}
463
+?> ><?php echo _("Planes animate between updates"); ?></label></div></li>
319 464
 <?php
320 465
     }
321 466
 ?>
322
-		    <li><div class="checkbox"><label><input type="checkbox" name="displayairports" value="1" onclick="clickDisplayAirports(this)" <?php if (isset($_COOKIE['displayairports']) && $_COOKIE['displayairports'] == 'true') print 'checked'; ?> ><?php echo _("Display airports on map"); ?></label></div></li>
467
+		    <li><div class="checkbox"><label><input type="checkbox" name="displayairports" value="1" onclick="clickDisplayAirports(this)" <?php if (isset($_COOKIE['displayairports']) && $_COOKIE['displayairports'] == 'true') {
468
+	print 'checked';
469
+}
470
+?> ><?php echo _("Display airports on map"); ?></label></div></li>
323 471
 <?php
324 472
     if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
325 473
 ?>
326
-		    <li><div class="checkbox"><label><input type="checkbox" name="displayminimap" value="1" onclick="clickDisplayMinimap(this)" <?php if (!isset($_COOKIE['displayminimap']) || (isset($_COOKIE['displayminimap']) && $_COOKIE['displayminimap'] == 'true')) print 'checked'; ?> ><?php echo _("Show mini-map"); ?></label></div></li>
474
+		    <li><div class="checkbox"><label><input type="checkbox" name="displayminimap" value="1" onclick="clickDisplayMinimap(this)" <?php if (!isset($_COOKIE['displayminimap']) || (isset($_COOKIE['displayminimap']) && $_COOKIE['displayminimap'] == 'true')) {
475
+	print 'checked';
476
+}
477
+?> ><?php echo _("Show mini-map"); ?></label></div></li>
327 478
 <?php
328 479
     }
329 480
 ?>
@@ -332,17 +483,25 @@  discard block
 block discarded – undo
332 483
 			if (function_exists('array_column')) {
333 484
 			    if (array_search(TRUE, array_column($globalSources, 'sourcestats')) !== FALSE) {
334 485
 		    ?>
335
-		    <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) print 'checked'; ?> ><?php echo _("Display polar on map"); ?></label></div></li>
486
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) {
487
+	print 'checked';
488
+}
489
+?> ><?php echo _("Display polar on map"); ?></label></div></li>
336 490
 		    <?php
337 491
 			    }
338 492
 			} elseif (isset($globalSources)) {
339 493
 			    $dispolar = false;
340 494
 			    foreach ($globalSources as $testsource) {
341
-			        if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) $dispolar = true;
495
+			        if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) {
496
+			        	$dispolar = true;
497
+			        }
342 498
 			    }
343 499
 			    if ($dispolar) {
344 500
 		    ?>
345
-		    <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) print 'checked'; ?> ><?php echo _("Display polar on map"); ?></label></div></li>
501
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) {
502
+	print 'checked';
503
+}
504
+?> ><?php echo _("Display polar on map"); ?></label></div></li>
346 505
 		    <?php
347 506
 			    }
348 507
 		        }
@@ -354,12 +513,22 @@  discard block
 block discarded – undo
354 513
 		    <?php
355 514
 		        if (extension_loaded('gd') && function_exists('gd_info')) {
356 515
 		    ?>
357
-		    <li><input type="checkbox" name="aircraftcoloraltitude" value="1" onclick="iconColorAltitude(this)" <?php if (isset($_COOKIE['IconColorAltitude']) && $_COOKIE['IconColorAltitude'] == 'true') print 'checked'; ?> ><?php echo _("Aircraft icon color based on altitude"); ?></li>
516
+		    <li><input type="checkbox" name="aircraftcoloraltitude" value="1" onclick="iconColorAltitude(this)" <?php if (isset($_COOKIE['IconColorAltitude']) && $_COOKIE['IconColorAltitude'] == 'true') {
517
+	print 'checked';
518
+}
519
+?> ><?php echo _("Aircraft icon color based on altitude"); ?></li>
358 520
 		    <?php 
359 521
 			if (!isset($_COOKIE['IconColorAltitude']) || $_COOKIE['IconColorAltitude'] == 'false') {
360 522
 		    ?>
361 523
 		    <li><?php echo _("Aircraft icon color:"); ?>
362
-			<input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(aircraftcolor.value);" value="#<?php if (isset($_COOKIE['IconColor'])) print $_COOKIE['IconColor']; elseif (isset($globalAircraftIconColor)) print $globalAircraftIconColor; else print '1a3151'; ?>">
524
+			<input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(aircraftcolor.value);" value="#<?php if (isset($_COOKIE['IconColor'])) {
525
+	print $_COOKIE['IconColor'];
526
+} elseif (isset($globalAircraftIconColor)) {
527
+	print $globalAircraftIconColor;
528
+} else {
529
+	print '1a3151';
530
+}
531
+?>">
363 532
 		    </li>
364 533
 		    <?php
365 534
 			    }
@@ -367,8 +536,22 @@  discard block
 block discarded – undo
367 536
 		    ?>
368 537
 		    <li><?php echo _("Show airport icon at zoom level:"); ?>
369 538
 			<div class="range">
370
-			    <input type="range" min="0" max="19" step="1" name="airportzoom" onchange="range.value=value;airportDisplayZoom(airportzoom.value);" value="<?php if (isset($_COOKIE['AirportZoom'])) print $_COOKIE['AirportZoom']; elseif (isset($globalAirportZoom)) print $globalAirportZoom; else print '7'; ?>">
371
-			    <output id="range"><?php if (isset($_COOKIE['AirportZoom'])) print $_COOKIE['AirportZoom']; elseif (isset($globalAirportZoom)) print $globalAirportZoom; else print '7'; ?></output>
539
+			    <input type="range" min="0" max="19" step="1" name="airportzoom" onchange="range.value=value;airportDisplayZoom(airportzoom.value);" value="<?php if (isset($_COOKIE['AirportZoom'])) {
540
+	print $_COOKIE['AirportZoom'];
541
+} elseif (isset($globalAirportZoom)) {
542
+	print $globalAirportZoom;
543
+} else {
544
+	print '7';
545
+}
546
+?>">
547
+			    <output id="range"><?php if (isset($_COOKIE['AirportZoom'])) {
548
+	print $_COOKIE['AirportZoom'];
549
+} elseif (isset($globalAirportZoom)) {
550
+	print $globalAirportZoom;
551
+} else {
552
+	print '7';
553
+}
554
+?></output>
372 555
 			</div>
373 556
 		    </li>
374 557
 <?php
@@ -376,22 +559,46 @@  discard block
 block discarded – undo
376 559
 ?>
377 560
 		    <li><?php echo _("Distance unit:"); ?>
378 561
 			<select class="selectpicker" onchange="unitdistance(this);">
379
-			    <option value="km"<?php if ((!isset($_COOKIE['unitdistance']) && (!isset($globalUnitDistance) || (isset($globalUnitDistance) && $globalUnitDistance == 'km'))) || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'km')) echo ' selected'; ?>>km</option>
380
-			    <option value="nm"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) echo ' selected'; ?>>nm</option>
381
-			    <option value="mi"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) echo ' selected'; ?>>mi</option>
562
+			    <option value="km"<?php if ((!isset($_COOKIE['unitdistance']) && (!isset($globalUnitDistance) || (isset($globalUnitDistance) && $globalUnitDistance == 'km'))) || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'km')) {
563
+	echo ' selected';
564
+}
565
+?>>km</option>
566
+			    <option value="nm"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) {
567
+	echo ' selected';
568
+}
569
+?>>nm</option>
570
+			    <option value="mi"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) {
571
+	echo ' selected';
572
+}
573
+?>>mi</option>
382 574
 		        </select>
383 575
 		    </li>
384 576
 		    <li><?php echo _("Altitude unit:"); ?>
385 577
 			<select class="selectpicker" onchange="unitaltitude(this);">
386
-			    <option value="m"<?php if ((!isset($_COOKIE['unitaltitude']) && (!isset($globalUnitAltitude) || (isset($globalUnitAltitude) && $globalUnitAltitude == 'm'))) || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'm')) echo ' selected'; ?>>m</option>
387
-			    <option value="feet"<?php if ((!isset($_COOKIE['unitaltitude']) && isset($globalUnitAltitude) && $globalUnitAltitude == 'feet') || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'feet')) echo ' selected'; ?>>feet</option>
578
+			    <option value="m"<?php if ((!isset($_COOKIE['unitaltitude']) && (!isset($globalUnitAltitude) || (isset($globalUnitAltitude) && $globalUnitAltitude == 'm'))) || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'm')) {
579
+	echo ' selected';
580
+}
581
+?>>m</option>
582
+			    <option value="feet"<?php if ((!isset($_COOKIE['unitaltitude']) && isset($globalUnitAltitude) && $globalUnitAltitude == 'feet') || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'feet')) {
583
+	echo ' selected';
584
+}
585
+?>>feet</option>
388 586
 		        </select>
389 587
 		    </li>
390 588
 		    <li><?php echo _("Speed unit:"); ?>
391 589
 			<select class="selectpicker" onchange="unitspeed(this);">
392
-			    <option value="kmh"<?php if ((!isset($_COOKIE['unitspeed']) && (!isset($globalUnitSpeed) || (isset($globalUnitSpeed) && $globalUnitSpeed == 'kmh'))) || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'kmh')) echo ' selected'; ?>>km/h</option>
393
-			    <option value="mph"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'mph') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'mph')) echo ' selected'; ?>>mph</option>
394
-			    <option value="knots"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'knots') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'knots')) echo ' selected'; ?>>knots</option>
590
+			    <option value="kmh"<?php if ((!isset($_COOKIE['unitspeed']) && (!isset($globalUnitSpeed) || (isset($globalUnitSpeed) && $globalUnitSpeed == 'kmh'))) || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'kmh')) {
591
+	echo ' selected';
592
+}
593
+?>>km/h</option>
594
+			    <option value="mph"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'mph') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'mph')) {
595
+	echo ' selected';
596
+}
597
+?>>mph</option>
598
+			    <option value="knots"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'knots') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'knots')) {
599
+	echo ' selected';
600
+}
601
+?>>knots</option>
395 602
 		        </select>
396 603
 		    </li>
397 604
 
@@ -406,9 +613,18 @@  discard block
 block discarded – undo
406 613
 		    <?php
407 614
 			if (((isset($globalVATSIM) && $globalVATSIM) || isset($globalIVAO) && $globalIVAO || isset($globalphpVMS) && $globalphpVMS) && (!isset($globalMapVAchoose) || $globalMapVAchoose)) {
408 615
 		    ?>
409
-			<?php if (isset($globalVATSIM) && $globalVATSIM) { ?><li><input type="checkbox" name="vatsim" value="1" onclick="clickVATSIM(this)" <?php if ((isset($_COOKIE['ShowVATSIM']) && $_COOKIE['ShowVATSIM'] == 'true') || !isset($_COOKIE['ShowVATSIM'])) print 'checked'; ?> ><?php echo _("Display VATSIM data"); ?></li><?php } ?>
410
-			<?php if (isset($globalIVAO) && $globalIVAO) { ?><li><input type="checkbox" name="ivao" value="1" onclick="clickIVAO(this)" <?php if ((isset($_COOKIE['ShowIVAO']) && $_COOKIE['ShowIVAO'] == 'true') || !isset($_COOKIE['ShowIVAO'])) print 'checked'; ?> ><?php echo _("Display IVAO data"); ?></li><?php } ?>
411
-			<?php if (isset($globalphpVMS) && $globalphpVMS) { ?><li><input type="checkbox" name="phpvms" value="1" onclick="clickphpVMS(this)" <?php if ((isset($_COOKIE['ShowVMS']) && $_COOKIE['ShowVMS'] == 'true') || !isset($_COOKIE['ShowVMS'])) print 'checked'; ?> ><?php echo _("Display phpVMS data"); ?></li><?php } ?>
616
+			<?php if (isset($globalVATSIM) && $globalVATSIM) { ?><li><input type="checkbox" name="vatsim" value="1" onclick="clickVATSIM(this)" <?php if ((isset($_COOKIE['ShowVATSIM']) && $_COOKIE['ShowVATSIM'] == 'true') || !isset($_COOKIE['ShowVATSIM'])) {
617
+	print 'checked';
618
+}
619
+?> ><?php echo _("Display VATSIM data"); ?></li><?php } ?>
620
+			<?php if (isset($globalIVAO) && $globalIVAO) { ?><li><input type="checkbox" name="ivao" value="1" onclick="clickIVAO(this)" <?php if ((isset($_COOKIE['ShowIVAO']) && $_COOKIE['ShowIVAO'] == 'true') || !isset($_COOKIE['ShowIVAO'])) {
621
+	print 'checked';
622
+}
623
+?> ><?php echo _("Display IVAO data"); ?></li><?php } ?>
624
+			<?php if (isset($globalphpVMS) && $globalphpVMS) { ?><li><input type="checkbox" name="phpvms" value="1" onclick="clickphpVMS(this)" <?php if ((isset($_COOKIE['ShowVMS']) && $_COOKIE['ShowVMS'] == 'true') || !isset($_COOKIE['ShowVMS'])) {
625
+	print 'checked';
626
+}
627
+?> ><?php echo _("Display phpVMS data"); ?></li><?php } ?>
412 628
 		    <?php
413 629
 			}
414 630
 		    ?>
@@ -416,10 +632,16 @@  discard block
 block discarded – undo
416 632
 			if (!(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalphpVMS) && $globalphpVMS) && isset($globalSBS1) && $globalSBS1 && isset($globalAPRS) && $globalAPRS && (!isset($globalMapchoose) || $globalMapchoose)) {
417 633
 		    ?>
418 634
 			<?php if (isset($globalSBS1) && $globalSBS1) { ?>
419
-			    <li><div class="checkbox"><label><input type="checkbox" name="sbs" value="1" onclick="clickSBS1(this)" <?php if ((isset($_COOKIE['ShowSBS1']) && $_COOKIE['ShowSBS1'] == 'true') || !isset($_COOKIE['ShowSBS1'])) print 'checked'; ?> ><?php echo _("Display ADS-B data"); ?></label></div></li>
635
+			    <li><div class="checkbox"><label><input type="checkbox" name="sbs" value="1" onclick="clickSBS1(this)" <?php if ((isset($_COOKIE['ShowSBS1']) && $_COOKIE['ShowSBS1'] == 'true') || !isset($_COOKIE['ShowSBS1'])) {
636
+	print 'checked';
637
+}
638
+?> ><?php echo _("Display ADS-B data"); ?></label></div></li>
420 639
 			<?php } ?>
421 640
 			<?php if (isset($globalAPRS) && $globalAPRS) { ?>
422
-			    <li><div class="checkbox"><label><input type="checkbox" name="aprs" value="1" onclick="clickAPRS(this)" <?php if ((isset($_COOKIE['ShowAPRS']) && $_COOKIE['ShowAPRS'] == 'true') || !isset($_COOKIE['ShowAPRS'])) print 'checked'; ?> ><?php echo _("Display APRS data"); ?></label></div></li>
641
+			    <li><div class="checkbox"><label><input type="checkbox" name="aprs" value="1" onclick="clickAPRS(this)" <?php if ((isset($_COOKIE['ShowAPRS']) && $_COOKIE['ShowAPRS'] == 'true') || !isset($_COOKIE['ShowAPRS'])) {
642
+	print 'checked';
643
+}
644
+?> ><?php echo _("Display APRS data"); ?></label></div></li>
423 645
 			<?php } ?>
424 646
 		    <?php
425 647
 			}
@@ -431,7 +653,9 @@  discard block
 block discarded – undo
431 653
 				$Spotter = new Spotter();
432 654
 				foreach($Spotter->getAllAirlineNames() as $airline) {
433 655
 					$airline_name = $airline['airline_name'];
434
-					if (strlen($airline_name) > 30) $airline_name = substr($airline_name,0,30).'...';
656
+					if (strlen($airline_name) > 30) {
657
+						$airline_name = substr($airline_name,0,30).'...';
658
+					}
435 659
 					if (isset($_COOKIE['Airlines']) && in_array($airline['airline_icao'],explode(',',$_COOKIE['Airlines']))) {
436 660
 						echo '<option value="'.$airline['airline_icao'].'" selected>'.$airline_name.'</option>';
437 661
 					} else {
@@ -466,10 +690,22 @@  discard block
 block discarded – undo
466 690
 		    ?>
467 691
 		    <li><?php echo _("Display airlines of type:"); ?><br/>
468 692
 			<select class="selectpicker" onchange="airlinestype(this);">
469
-			    <option value="all"<?php if (!isset($_COOKIE['airlinestype']) || $_COOKIE['airlinestype'] == 'all' || $_COOKIE['airlinestype'] == '') echo ' selected'; ?>><?php echo _("All"); ?></option>
470
-			    <option value="passenger"<?php if (isset($_COOKIE['airlinestype']) && $_COOKIE['airlinestype'] == 'passenger') echo ' selected'; ?>><?php echo _("Passenger"); ?></option>
471
-			    <option value="cargo"<?php if (isset($_COOKIE['airlinestype']) && $_COOKIE['airlinestype'] == 'cargo') echo ' selected'; ?>><?php echo _("Cargo"); ?></option>
472
-			    <option value="military"<?php if (isset($_COOKIE['airlinestype']) && $_COOKIE['airlinestype'] == 'military') echo ' selected'; ?>><?php echo _("Military"); ?></option>
693
+			    <option value="all"<?php if (!isset($_COOKIE['airlinestype']) || $_COOKIE['airlinestype'] == 'all' || $_COOKIE['airlinestype'] == '') {
694
+	echo ' selected';
695
+}
696
+?>><?php echo _("All"); ?></option>
697
+			    <option value="passenger"<?php if (isset($_COOKIE['airlinestype']) && $_COOKIE['airlinestype'] == 'passenger') {
698
+	echo ' selected';
699
+}
700
+?>><?php echo _("Passenger"); ?></option>
701
+			    <option value="cargo"<?php if (isset($_COOKIE['airlinestype']) && $_COOKIE['airlinestype'] == 'cargo') {
702
+	echo ' selected';
703
+}
704
+?>><?php echo _("Cargo"); ?></option>
705
+			    <option value="military"<?php if (isset($_COOKIE['airlinestype']) && $_COOKIE['airlinestype'] == 'military') {
706
+	echo ' selected';
707
+}
708
+?>><?php echo _("Military"); ?></option>
473 709
 			</select>
474 710
 		    </li>
475 711
 		    <?php
@@ -477,7 +713,10 @@  discard block
 block discarded – undo
477 713
 		    ?>
478 714
 		    <li>
479 715
 			<?php echo _("Display flight with ident:"); ?>
480
-			<input type="text" name="identfilter" id="identfilter" value="<?php if (isset($_COOKIE['identfilter'])) print $_COOKIE['identfilter']; ?>" />
716
+			<input type="text" name="identfilter" id="identfilter" value="<?php if (isset($_COOKIE['identfilter'])) {
717
+	print $_COOKIE['identfilter'];
718
+}
719
+?>" />
481 720
 		    </li>
482 721
 		</ul>
483 722
 	    </form>
@@ -493,7 +732,10 @@  discard block
 block discarded – undo
493 732
 	    <h1 class="sidebar-header"><?php echo _("Satellites"); ?><span class="sidebar-close"><i class="fa fa-caret-left"></i></span></h1>
494 733
 	    <form>
495 734
 		<ul>
496
-		    <li><div class="checkbox"><label><input type="checkbox" name="displayiss" value="1" onclick="clickDisplayISS(this)" <?php if (isset($_COOKIE['displayiss']) && $_COOKIE['displayiss'] == 'true') print 'checked'; ?> ><?php echo _("Show ISS, Tiangong-1 and Tiangong-2 on map"); ?></label></div></li>
735
+		    <li><div class="checkbox"><label><input type="checkbox" name="displayiss" value="1" onclick="clickDisplayISS(this)" <?php if (isset($_COOKIE['displayiss']) && $_COOKIE['displayiss'] == 'true') {
736
+	print 'checked';
737
+}
738
+?> ><?php echo _("Show ISS, Tiangong-1 and Tiangong-2 on map"); ?></label></div></li>
497 739
 		    <li><?php echo _("Type:"); ?>
498 740
 			<select class="selectpicker" multiple onchange="sattypes(this);">
499 741
 			    <?php
@@ -501,25 +743,45 @@  discard block
 block discarded – undo
501 743
 				$types = $Satellite->get_tle_types();
502 744
 				foreach ($types as $type) {
503 745
 					$type_name = $type['tle_type'];
504
-					if ($type_name == 'musson') $type_name = 'Russian LEO Navigation';
505
-					else if ($type_name == 'nnss') $type_name = 'Navi Navigation Satellite System';
506
-					else if ($type_name == 'sbas') $type_name = 'Satellite-Based Augmentation System';
507
-					else if ($type_name == 'glo-ops') $type_name = 'Glonass Operational';
508
-					else if ($type_name == 'gps-ops') $type_name = 'GPS Operational';
509
-					else if ($type_name == 'argos') $type_name = 'ARGOS Data Collection System';
510
-					else if ($type_name == 'tdrss') $type_name = 'Tracking and Data Relay Satellite System';
511
-					else if ($type_name == 'sarsat') $type_name = 'Search & Rescue';
512
-					else if ($type_name == 'dmc') $type_name = 'Disaster Monitoring';
513
-					else if ($type_name == 'resource') $type_name = 'Earth Resources';
514
-					else if ($type_name == 'stations') $type_name = 'Space Stations';
515
-					else if ($type_name == 'geo') $type_name = 'Geostationary';
516
-					else if ($type_name == 'amateur') $type_name = 'Amateur Radio';
517
-					else if ($type_name == 'x-comm') $type_name = 'Experimental';
518
-					else if ($type_name == 'other-comm') $type_name = 'Other Comm';
519
-					else if ($type_name == 'science') $type_name = 'Space & Earth Science';
520
-					else if ($type_name == 'military') $type_name = 'Miscellaneous Military';
521
-					else if ($type_name == 'radar') $type_name = 'Radar Calibration';
522
-					else if ($type_name == 'tle-new') $type_name = 'Last 30 days launches';
746
+					if ($type_name == 'musson') {
747
+						$type_name = 'Russian LEO Navigation';
748
+					} else if ($type_name == 'nnss') {
749
+						$type_name = 'Navi Navigation Satellite System';
750
+					} else if ($type_name == 'sbas') {
751
+						$type_name = 'Satellite-Based Augmentation System';
752
+					} else if ($type_name == 'glo-ops') {
753
+						$type_name = 'Glonass Operational';
754
+					} else if ($type_name == 'gps-ops') {
755
+						$type_name = 'GPS Operational';
756
+					} else if ($type_name == 'argos') {
757
+						$type_name = 'ARGOS Data Collection System';
758
+					} else if ($type_name == 'tdrss') {
759
+						$type_name = 'Tracking and Data Relay Satellite System';
760
+					} else if ($type_name == 'sarsat') {
761
+						$type_name = 'Search & Rescue';
762
+					} else if ($type_name == 'dmc') {
763
+						$type_name = 'Disaster Monitoring';
764
+					} else if ($type_name == 'resource') {
765
+						$type_name = 'Earth Resources';
766
+					} else if ($type_name == 'stations') {
767
+						$type_name = 'Space Stations';
768
+					} else if ($type_name == 'geo') {
769
+						$type_name = 'Geostationary';
770
+					} else if ($type_name == 'amateur') {
771
+						$type_name = 'Amateur Radio';
772
+					} else if ($type_name == 'x-comm') {
773
+						$type_name = 'Experimental';
774
+					} else if ($type_name == 'other-comm') {
775
+						$type_name = 'Other Comm';
776
+					} else if ($type_name == 'science') {
777
+						$type_name = 'Space & Earth Science';
778
+					} else if ($type_name == 'military') {
779
+						$type_name = 'Miscellaneous Military';
780
+					} else if ($type_name == 'radar') {
781
+						$type_name = 'Radar Calibration';
782
+					} else if ($type_name == 'tle-new') {
783
+						$type_name = 'Last 30 days launches';
784
+					}
523 785
 					
524 786
 					if (isset($_COOKIE['sattypes']) && in_array($type['tle_type'],explode(',',$_COOKIE['sattypes']))) {
525 787
 						print '<option value="'.$type['tle_type'].'" selected>'.$type_name.'</option>';
Please login to merge, or discard this patch.
require/class.SpotterLive.php 1 patch
Braces   +68 added lines, -23 removed lines patch added patch discarded remove patch
@@ -18,8 +18,12 @@  discard block
 block discarded – undo
18 18
 	*/
19 19
 	public function getFilter($filter = array(),$where = false,$and = false) {
20 20
 		global $globalFilter, $globalStatsFilters, $globalFilterName;
21
-		if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) $filter = array_merge($globalStatsFilters[$globalFilterName],$filter);
22
-		if (is_array($globalFilter)) $filter = array_merge($globalFilter,$filter);
21
+		if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) {
22
+			$filter = array_merge($globalStatsFilters[$globalFilterName],$filter);
23
+		}
24
+		if (is_array($globalFilter)) {
25
+			$filter = array_merge($globalFilter,$filter);
26
+		}
23 27
 		$filter_query_join = '';
24 28
 		$filter_query_where = '';
25 29
 		if (isset($filter['airlines']) && !empty($filter['airlines'])) {
@@ -47,8 +51,11 @@  discard block
 block discarded – undo
47 51
 				$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
48 52
 			}
49 53
 		}
50
-		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
51
-		elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND';
54
+		if ($filter_query_where == '' && $where) {
55
+			$filter_query_where = ' WHERE';
56
+		} elseif ($filter_query_where != '' && $and) {
57
+			$filter_query_where .= ' AND';
58
+		}
52 59
 		$filter_query = $filter_query_join.$filter_query_where;
53 60
 		return $filter_query;
54 61
 	}
@@ -84,7 +91,9 @@  discard block
 block discarded – undo
84 91
 			$orderby_query = ' '.$search_orderby_array[$sort]['sql'];
85 92
 		}
86 93
 
87
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
94
+		if (!isset($globalLiveInterval)) {
95
+			$globalLiveInterval = '200';
96
+		}
88 97
 		if ($globalDBdriver == 'mysql') {
89 98
 			//$query  = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate";
90 99
 			$query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate'.$filter_query.$orderby_query;
@@ -109,7 +118,9 @@  discard block
 block discarded – undo
109 118
 
110 119
 		$filter_query = $this->getFilter($filter);
111 120
 
112
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
121
+		if (!isset($globalLiveInterval)) {
122
+			$globalLiveInterval = '200';
123
+		}
113 124
 		if ($globalDBdriver == 'mysql') {
114 125
 //			$query  = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL ".$globalLiveInterval." SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate$orderby_query";
115 126
 //			$query  = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, a.aircraft_shadow FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate INNER JOIN (SELECT * FROM aircraft) a on spotter_live.aircraft_icao = a.icao';
@@ -156,7 +167,9 @@  discard block
 block discarded – undo
156 167
 
157 168
 		$filter_query = $this->getFilter($filter,true,true);
158 169
 
159
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
170
+		if (!isset($globalLiveInterval)) {
171
+			$globalLiveInterval = '200';
172
+		}
160 173
 		if ($globalDBdriver == 'mysql') {
161 174
 
162 175
 			$query  = 'SELECT a.aircraft_shadow, a.engine_type, a.engine_count, a.wake_category, spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
@@ -196,7 +209,9 @@  discard block
 block discarded – undo
196 209
 		global $globalDBdriver, $globalLiveInterval;
197 210
 		$filter_query = $this->getFilter($filter,true,true);
198 211
 
199
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
212
+		if (!isset($globalLiveInterval)) {
213
+			$globalLiveInterval = '200';
214
+		}
200 215
 		if ($globalDBdriver == 'mysql') {
201 216
 			//$query  = 'SELECT COUNT(*) as nb FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate'.$filter_query;
202 217
 			$query = 'SELECT COUNT(DISTINCT spotter_live.flightaware_id) as nb FROM spotter_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date';
@@ -226,7 +241,9 @@  discard block
 block discarded – undo
226 241
 	{
227 242
 		global $globalDBdriver, $globalLiveInterval;
228 243
 		$Spotter = new Spotter($this->db);
229
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
244
+		if (!isset($globalLiveInterval)) {
245
+			$globalLiveInterval = '200';
246
+		}
230 247
 		$filter_query = $this->getFilter($filter);
231 248
 
232 249
 		if (is_array($coord)) {
@@ -234,7 +251,9 @@  discard block
 block discarded – undo
234 251
 			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
235 252
 			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
236 253
 			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
237
-		} else return array();
254
+		} else {
255
+			return array();
256
+		}
238 257
 		if ($globalDBdriver == 'mysql') {
239 258
 			//$query  = "SELECT spotter_output.* FROM spotter_output WHERE spotter_output.flightaware_id IN (SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL ".$globalLiveInterval." SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate AND spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong.")";
240 259
 			$query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate AND spotter_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND spotter_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.' GROUP BY spotter_live.flightaware_id'.$filter_query;
@@ -425,11 +444,15 @@  discard block
 block discarded – undo
425 444
 		//$query  = self::$global_query.' WHERE spotter_live.flightaware_id = :id ORDER BY date';
426 445
 		if ($globalDBdriver == 'mysql') {
427 446
 			$query = 'SELECT spotter_live.* FROM spotter_live WHERE spotter_live.flightaware_id = :id';
428
-			if ($liveinterval) $query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date';
447
+			if ($liveinterval) {
448
+				$query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date';
449
+			}
429 450
 			$query .= ' ORDER BY date';
430 451
 		} else {
431 452
 			$query = 'SELECT spotter_live.* FROM spotter_live WHERE spotter_live.flightaware_id = :id';
432
-			if ($liveinterval) $query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date";
453
+			if ($liveinterval) {
454
+				$query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date";
455
+			}
433 456
 			$query .= ' ORDER BY date';
434 457
 		}
435 458
 
@@ -524,7 +547,9 @@  discard block
 block discarded – undo
524 547
 				$i++;
525 548
 				$j++;
526 549
 				if ($j == 30) {
527
-					if ($globalDebug) echo ".";
550
+					if ($globalDebug) {
551
+						echo ".";
552
+					}
528 553
 				    	try {
529 554
 						
530 555
 						$sth = $this->db->prepare(substr($query_delete,0,-1).")");
@@ -856,7 +881,9 @@  discard block
 block discarded – undo
856 881
 			{
857 882
 				return false;
858 883
 			}
859
-		} else $altitude = 0;
884
+		} else {
885
+			$altitude = 0;
886
+		}
860 887
 
861 888
 		if ($heading != '')
862 889
 		{
@@ -864,7 +891,9 @@  discard block
 block discarded – undo
864 891
 			{
865 892
 				return false;
866 893
 			}
867
-		} else $heading = 0;
894
+		} else {
895
+			$heading = 0;
896
+		}
868 897
 
869 898
 		if ($groundspeed != '')
870 899
 		{
@@ -872,9 +901,13 @@  discard block
 block discarded – undo
872 901
 			{
873 902
 				return false;
874 903
 			}
875
-		} else $groundspeed = 0;
904
+		} else {
905
+			$groundspeed = 0;
906
+		}
876 907
 		date_default_timezone_set('UTC');
877
-		if ($date == '') $date = date("Y-m-d H:i:s", time());
908
+		if ($date == '') {
909
+			$date = date("Y-m-d H:i:s", time());
910
+		}
878 911
 
879 912
         
880 913
 		$flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING);
@@ -918,10 +951,18 @@  discard block
 block discarded – undo
918 951
 		$arrival_airport_country = '';
919 952
 		
920 953
             	
921
-            	if ($squawk == '' || $Common->isInteger($squawk) === false ) $squawk = NULL;
922
-            	if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) $verticalrate = NULL;
923
-            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
924
-            	if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
954
+            	if ($squawk == '' || $Common->isInteger($squawk) === false ) {
955
+            		$squawk = NULL;
956
+            	}
957
+            	if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) {
958
+            		$verticalrate = NULL;
959
+            	}
960
+            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) {
961
+            		$groundspeed = 0;
962
+            	}
963
+            	if ($heading == '' || $Common->isInteger($heading) === false ) {
964
+            		$heading = 0;
965
+            	}
925 966
             	
926 967
 		$query  = 'INSERT INTO spotter_live (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_shadow, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, latitude, longitude, waypoints, altitude, heading, ground_speed, date, departure_airport_time, arrival_airport_time, squawk, route_stop, ModeS, pilot_id, pilot_name, verticalrate, ground, format_source, source_name, over_country) 
927 968
 		VALUES (:flightaware_id,:ident,:registration,:airline_name,:airline_icao,:airline_country,:airline_type,:aircraft_icao,:aircraft_shadow,:aircraft_type,:aircraft_manufacturer,:departure_airport_icao,:departure_airport_name, :departure_airport_city, :departure_airport_country, :arrival_airport_icao, :arrival_airport_name, :arrival_airport_city, :arrival_airport_country, :latitude,:longitude,:waypoints,:altitude,:heading,:groundspeed,:date,:departure_airport_time,:arrival_airport_time,:squawk,:route_stop,:ModeS, :pilot_id, :pilot_name, :verticalrate, :ground, :format_source, :source_name, :over_country)';
@@ -936,9 +977,13 @@  discard block
 block discarded – undo
936 977
                 	return "error : ".$e->getMessage();
937 978
                 }
938 979
 		if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) {
939
-		    if ($globalDebug) echo '(Add to SBS archive : ';
980
+		    if ($globalDebug) {
981
+		    	echo '(Add to SBS archive : ';
982
+		    }
940 983
 		    $result =  $SpotterArchive->addSpotterArchiveData($flightaware_id, $ident, $registration, $airline_name, $airline_icao, $airline_country, $airline_type, $aircraft_icao, $aircraft_shadow, $aircraft_name, $aircraft_manufacturer, $departure_airport_icao, $departure_airport_name, $departure_airport_city, $departure_airport_country, $departure_airport_time,$arrival_airport_icao, $arrival_airport_name, $arrival_airport_city, $arrival_airport_country, $arrival_airport_time, $route_stop, $date,$latitude, $longitude, $waypoints, $altitude, $heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name,$verticalrate,$format_source,$source_name, $over_country);
941
-		    if ($globalDebug) echo $result.')';
984
+		    if ($globalDebug) {
985
+		    	echo $result.')';
986
+		    }
942 987
 		}
943 988
 		return "success";
944 989
 
Please login to merge, or discard this patch.
require/class.Stats.php 1 patch
Braces   +242 added lines, -86 removed lines patch added patch discarded remove patch
@@ -12,7 +12,9 @@  discard block
 block discarded – undo
12 12
 	
13 13
 	public function __construct($dbc = null) {
14 14
 		global $globalFilterName;
15
-		if (isset($globalFilterName)) $this->filter_name = $globalFilterName;
15
+		if (isset($globalFilterName)) {
16
+			$this->filter_name = $globalFilterName;
17
+		}
16 18
 		$Connection = new Connection($dbc);
17 19
 		$this->db = $Connection->db();
18 20
         }
@@ -41,7 +43,9 @@  discard block
 block discarded – undo
41 43
                 return $all;
42 44
         }
43 45
 	public function getAllAirlineNames($filter_name = '') {
44
-		if ($filter_name == '') $filter_name = $this->filter_name;
46
+		if ($filter_name == '') {
47
+			$filter_name = $this->filter_name;
48
+		}
45 49
                 $query = "SELECT * FROM stats_airline WHERE filter_name = :filter_name ORDER BY airline_name ASC";
46 50
                  try {
47 51
                         $sth = $this->db->prepare($query);
@@ -53,7 +57,9 @@  discard block
 block discarded – undo
53 57
                 return $all;
54 58
         }
55 59
 	public function getAllAircraftTypes($stats_airline = '',$filter_name = '') {
56
-		if ($filter_name == '') $filter_name = $this->filter_name;
60
+		if ($filter_name == '') {
61
+			$filter_name = $this->filter_name;
62
+		}
57 63
                 $query = "SELECT * FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_manufacturer ASC";
58 64
                  try {
59 65
                         $sth = $this->db->prepare($query);
@@ -65,7 +71,9 @@  discard block
 block discarded – undo
65 71
                 return $all;
66 72
         }
67 73
 	public function getAllAirportNames($stats_airline = '',$filter_name = '') {
68
-		if ($filter_name == '') $filter_name = $this->filter_name;
74
+		if ($filter_name == '') {
75
+			$filter_name = $this->filter_name;
76
+		}
69 77
                 $query = "SELECT airport_icao, airport_name,airport_city,airport_country FROM stats_airport WHERE stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_icao,airport_name,airport_city,airport_country ORDER BY airport_city ASC";
70 78
                  try {
71 79
                         $sth = $this->db->prepare($query);
@@ -80,9 +88,14 @@  discard block
 block discarded – undo
80 88
 
81 89
 	public function countAllAircraftTypes($limit = true, $stats_airline = '', $filter_name = '') {
82 90
 		global $globalStatsFilters;
83
-		if ($filter_name == '') $filter_name = $this->filter_name;
84
-		if ($limit) $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC LIMIT 10 OFFSET 0";
85
-		else $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC";
91
+		if ($filter_name == '') {
92
+			$filter_name = $this->filter_name;
93
+		}
94
+		if ($limit) {
95
+			$query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC LIMIT 10 OFFSET 0";
96
+		} else {
97
+			$query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC";
98
+		}
86 99
                  try {
87 100
                         $sth = $this->db->prepare($query);
88 101
                         $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -102,9 +115,14 @@  discard block
 block discarded – undo
102 115
 	}
103 116
 	public function countAllAirlineCountries($limit = true,$filter_name = '') {
104 117
 		global $globalStatsFilters;
105
-		if ($filter_name == '') $filter_name = $this->filter_name;
106
-		if ($limit) $query = "SELECT airlines.country AS airline_country, SUM(stats_airline.cnt) as airline_country_count FROM stats_airline,airlines WHERE stats_airline.airline_icao=airlines.icao AND filter_name = :filter_name GROUP BY airline_country ORDER BY airline_country_count DESC LIMIT 10 OFFSET 0";
107
-		else $query = "SELECT airlines.country AS airline_country, SUM(stats_airline.cnt) as airline_country_count FROM stats_airline,airlines WHERE stats_airline.airline_icao=airlines.icao AND filter_name = :filter_name GROUP BY airline_country ORDER BY airline_country_count DESC";
118
+		if ($filter_name == '') {
119
+			$filter_name = $this->filter_name;
120
+		}
121
+		if ($limit) {
122
+			$query = "SELECT airlines.country AS airline_country, SUM(stats_airline.cnt) as airline_country_count FROM stats_airline,airlines WHERE stats_airline.airline_icao=airlines.icao AND filter_name = :filter_name GROUP BY airline_country ORDER BY airline_country_count DESC LIMIT 10 OFFSET 0";
123
+		} else {
124
+			$query = "SELECT airlines.country AS airline_country, SUM(stats_airline.cnt) as airline_country_count FROM stats_airline,airlines WHERE stats_airline.airline_icao=airlines.icao AND filter_name = :filter_name GROUP BY airline_country ORDER BY airline_country_count DESC";
125
+		}
108 126
                  try {
109 127
                         $sth = $this->db->prepare($query);
110 128
                         $sth->execute(array(':filter_name' => $filter_name));
@@ -124,9 +142,14 @@  discard block
 block discarded – undo
124 142
 	}
125 143
 	public function countAllAircraftManufacturers($limit = true,$stats_airline = '', $filter_name = '') {
126 144
 		global $globalStatsFilters;
127
-		if ($filter_name == '') $filter_name = $this->filter_name;
128
-		if ($limit) $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC LIMIT 10 OFFSET 0";
129
-		else $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC";
145
+		if ($filter_name == '') {
146
+			$filter_name = $this->filter_name;
147
+		}
148
+		if ($limit) {
149
+			$query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC LIMIT 10 OFFSET 0";
150
+		} else {
151
+			$query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC";
152
+		}
130 153
                  try {
131 154
                         $sth = $this->db->prepare($query);
132 155
                         $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -147,9 +170,14 @@  discard block
 block discarded – undo
147 170
 
148 171
 	public function countAllArrivalCountries($limit = true, $stats_airline = '', $filter_name = '') {
149 172
 		global $globalStatsFilters;
150
-		if ($filter_name == '') $filter_name = $this->filter_name;
151
-		if ($limit) $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_arrival_country ORDER BY airport_arrival_country_count DESC LIMIT 10 OFFSET 0";
152
-		else $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_arrival_country ORDER BY airport_arrival_country_count DESC";
173
+		if ($filter_name == '') {
174
+			$filter_name = $this->filter_name;
175
+		}
176
+		if ($limit) {
177
+			$query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_arrival_country ORDER BY airport_arrival_country_count DESC LIMIT 10 OFFSET 0";
178
+		} else {
179
+			$query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_arrival_country ORDER BY airport_arrival_country_count DESC";
180
+		}
153 181
                  try {
154 182
                         $sth = $this->db->prepare($query);
155 183
                         $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -169,9 +197,14 @@  discard block
 block discarded – undo
169 197
 	}
170 198
 	public function countAllDepartureCountries($limit = true, $stats_airline = '', $filter_name = '') {
171 199
 		global $globalStatsFilters;
172
-		if ($filter_name == '') $filter_name = $this->filter_name;
173
-		if ($limit) $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_departure_country ORDER BY airport_departure_country_count DESC LIMIT 10 OFFSET 0";
174
-		else $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_departure_country ORDER BY airport_departure_country_count DESC";
200
+		if ($filter_name == '') {
201
+			$filter_name = $this->filter_name;
202
+		}
203
+		if ($limit) {
204
+			$query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_departure_country ORDER BY airport_departure_country_count DESC LIMIT 10 OFFSET 0";
205
+		} else {
206
+			$query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_departure_country ORDER BY airport_departure_country_count DESC";
207
+		}
175 208
                  try {
176 209
                         $sth = $this->db->prepare($query);
177 210
                         $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -192,9 +225,14 @@  discard block
 block discarded – undo
192 225
 
193 226
 	public function countAllAirlines($limit = true,$filter_name = '') {
194 227
 		global $globalStatsFilters;
195
-		if ($filter_name == '') $filter_name = $this->filter_name;
196
-		if ($limit) $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name ORDER BY airline_count DESC LIMIT 10 OFFSET 0";
197
-		else $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name ORDER BY airline_count DESC";
228
+		if ($filter_name == '') {
229
+			$filter_name = $this->filter_name;
230
+		}
231
+		if ($limit) {
232
+			$query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name ORDER BY airline_count DESC LIMIT 10 OFFSET 0";
233
+		} else {
234
+			$query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name ORDER BY airline_count DESC";
235
+		}
198 236
                  try {
199 237
                         $sth = $this->db->prepare($query);
200 238
                         $sth->execute(array(':filter_name' => $filter_name));
@@ -215,9 +253,14 @@  discard block
 block discarded – undo
215 253
 	}
216 254
 	public function countAllAircraftRegistrations($limit = true,$stats_airline = '',$filter_name = '') {
217 255
 		global $globalStatsFilters;
218
-		if ($filter_name == '') $filter_name = $this->filter_name;
219
-		if ($limit) $query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name, s.registration FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC LIMIT 10 OFFSET 0";
220
-		else $query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC";
256
+		if ($filter_name == '') {
257
+			$filter_name = $this->filter_name;
258
+		}
259
+		if ($limit) {
260
+			$query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name, s.registration FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC LIMIT 10 OFFSET 0";
261
+		} else {
262
+			$query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC";
263
+		}
221 264
                  try {
222 265
                         $sth = $this->db->prepare($query);
223 266
                         $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -237,9 +280,14 @@  discard block
 block discarded – undo
237 280
 	}
238 281
 	public function countAllCallsigns($limit = true,$stats_airline = '',$filter_name = '') {
239 282
 		global $globalStatsFilters;
240
-		if ($filter_name == '') $filter_name = $this->filter_name;
241
-		if ($limit) $query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao = :stats_airline AND filter_name = :filter_name ORDER BY callsign_icao_count DESC LIMIT 10 OFFSET 0";
242
-		else $query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao = :stats_airline AND filter_name = :filter_name ORDER BY callsign_icao_count DESC";
283
+		if ($filter_name == '') {
284
+			$filter_name = $this->filter_name;
285
+		}
286
+		if ($limit) {
287
+			$query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao = :stats_airline AND filter_name = :filter_name ORDER BY callsign_icao_count DESC LIMIT 10 OFFSET 0";
288
+		} else {
289
+			$query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao = :stats_airline AND filter_name = :filter_name ORDER BY callsign_icao_count DESC";
290
+		}
243 291
 		 try {
244 292
 			$sth = $this->db->prepare($query);
245 293
 			$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -259,10 +307,15 @@  discard block
 block discarded – undo
259 307
 	}
260 308
 	public function countAllFlightOverCountries($limit = true, $stats_airline = '',$filter_name = '') {
261 309
 		$Connection = new Connection();
262
-		if ($filter_name == '') $filter_name = $this->filter_name;
310
+		if ($filter_name == '') {
311
+			$filter_name = $this->filter_name;
312
+		}
263 313
 		if ($Connection->tableExists('countries')) {
264
-			if ($limit) $query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 AND stats_country.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY flight_count DESC LIMIT 20 OFFSET 0";
265
-			else $query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 AND stats_country.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY flight_count DESC";
314
+			if ($limit) {
315
+				$query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 AND stats_country.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY flight_count DESC LIMIT 20 OFFSET 0";
316
+			} else {
317
+				$query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 AND stats_country.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY flight_count DESC";
318
+			}
266 319
 			 try {
267 320
 				$sth = $this->db->prepare($query);
268 321
 				$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -283,9 +336,14 @@  discard block
 block discarded – undo
283 336
 	}
284 337
 	public function countAllPilots($limit = true,$stats_airline = '',$filter_name = '') {
285 338
 		global $globalStatsFilters;
286
-		if ($filter_name == '') $filter_name = $this->filter_name;
287
-		if ($limit) $query = "SELECT pilot_id, cnt AS pilot_count, pilot_name FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_count DESC LIMIT 10 OFFSET 0";
288
-		else $query = "SELECT pilot_id, cnt AS pilot_count, pilot_name FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_count DESC";
339
+		if ($filter_name == '') {
340
+			$filter_name = $this->filter_name;
341
+		}
342
+		if ($limit) {
343
+			$query = "SELECT pilot_id, cnt AS pilot_count, pilot_name FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_count DESC LIMIT 10 OFFSET 0";
344
+		} else {
345
+			$query = "SELECT pilot_id, cnt AS pilot_count, pilot_name FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_count DESC";
346
+		}
289 347
                  try {
290 348
                         $sth = $this->db->prepare($query);
291 349
                         $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -305,9 +363,14 @@  discard block
 block discarded – undo
305 363
 	}
306 364
 	public function countAllOwners($limit = true,$stats_airline = '', $filter_name = '') {
307 365
 		global $globalStatsFilters;
308
-		if ($filter_name == '') $filter_name = $this->filter_name;
309
-		if ($limit) $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY owner_count DESC LIMIT 10 OFFSET 0";
310
-		else $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY owner_count DESC";
366
+		if ($filter_name == '') {
367
+			$filter_name = $this->filter_name;
368
+		}
369
+		if ($limit) {
370
+			$query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY owner_count DESC LIMIT 10 OFFSET 0";
371
+		} else {
372
+			$query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY owner_count DESC";
373
+		}
311 374
                  try {
312 375
                         $sth = $this->db->prepare($query);
313 376
                         $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -327,9 +390,14 @@  discard block
 block discarded – undo
327 390
 	}
328 391
 	public function countAllDepartureAirports($limit = true,$stats_airline = '',$filter_name = '') {
329 392
 		global $globalStatsFilters;
330
-		if ($filter_name == '') $filter_name = $this->filter_name;
331
-		if ($limit) $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count FROM stats_airport WHERE departure > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC LIMIT 10 OFFSET 0";
332
-		else $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count FROM stats_airport WHERE departure > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC";
393
+		if ($filter_name == '') {
394
+			$filter_name = $this->filter_name;
395
+		}
396
+		if ($limit) {
397
+			$query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count FROM stats_airport WHERE departure > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC LIMIT 10 OFFSET 0";
398
+		} else {
399
+			$query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count FROM stats_airport WHERE departure > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC";
400
+		}
333 401
                  try {
334 402
                         $sth = $this->db->prepare($query);
335 403
                         $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -355,7 +423,9 @@  discard block
 block discarded – undo
355 423
         			$icao = $value['airport_departure_icao'];
356 424
         			if (isset($all[$icao])) {
357 425
         				$all[$icao]['airport_departure_icao_count'] = $all[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count'];
358
-        			} else $all[$icao] = $value;
426
+        			} else {
427
+        				$all[$icao] = $value;
428
+        			}
359 429
         		}
360 430
         		$count = array();
361 431
         		foreach ($all as $key => $row) {
@@ -367,9 +437,14 @@  discard block
 block discarded – undo
367 437
 	}
368 438
 	public function countAllArrivalAirports($limit = true,$stats_airline = '',$filter_name = '') {
369 439
 		global $globalStatsFilters;
370
-		if ($filter_name == '') $filter_name = $this->filter_name;
371
-		if ($limit) $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count FROM stats_airport WHERE arrival > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC LIMIT 10 OFFSET 0";
372
-		else $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count FROM stats_airport WHERE arrival > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC";
440
+		if ($filter_name == '') {
441
+			$filter_name = $this->filter_name;
442
+		}
443
+		if ($limit) {
444
+			$query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count FROM stats_airport WHERE arrival > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC LIMIT 10 OFFSET 0";
445
+		} else {
446
+			$query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count FROM stats_airport WHERE arrival > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC";
447
+		}
373 448
 		try {
374 449
 			$sth = $this->db->prepare($query);
375 450
 			$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -395,7 +470,9 @@  discard block
 block discarded – undo
395 470
         			$icao = $value['airport_arrival_icao'];
396 471
         			if (isset($all[$icao])) {
397 472
         				$all[$icao]['airport_arrival_icao_count'] = $all[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count'];
398
-        			} else $all[$icao] = $value;
473
+        			} else {
474
+        				$all[$icao] = $value;
475
+        			}
399 476
         		}
400 477
         		$count = array();
401 478
         		foreach ($all as $key => $row) {
@@ -408,13 +485,21 @@  discard block
 block discarded – undo
408 485
 	}
409 486
 	public function countAllMonthsLastYear($limit = true,$stats_airline = '',$filter_name = '') {
410 487
 		global $globalDBdriver, $globalStatsFilters;
411
-		if ($filter_name == '') $filter_name = $this->filter_name;
488
+		if ($filter_name == '') {
489
+			$filter_name = $this->filter_name;
490
+		}
412 491
 		if ($globalDBdriver == 'mysql') {
413
-			if ($limit) $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 12 MONTH) AND stats_airline = :stats_airline AND filter_name = :filter_name";
414
-			else $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline = :stats_airline AND filter_name = :filter_name";
492
+			if ($limit) {
493
+				$query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 12 MONTH) AND stats_airline = :stats_airline AND filter_name = :filter_name";
494
+			} else {
495
+				$query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline = :stats_airline AND filter_name = :filter_name";
496
+			}
415 497
 		} else {
416
-			if ($limit) $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '12 MONTHS' AND stats_airline = :stats_airline AND filter_name = :filter_name";
417
-			else $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline = :stats_airline AND filter_name = :filter_name";
498
+			if ($limit) {
499
+				$query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '12 MONTHS' AND stats_airline = :stats_airline AND filter_name = :filter_name";
500
+			} else {
501
+				$query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline = :stats_airline AND filter_name = :filter_name";
502
+			}
418 503
 		}
419 504
 		$query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name);
420 505
                  try {
@@ -438,7 +523,9 @@  discard block
 block discarded – undo
438 523
 	
439 524
 	public function countAllDatesLastMonth($stats_airline = '',$filter_name = '') {
440 525
 		global $globalStatsFilters;
441
-		if ($filter_name == '') $filter_name = $this->filter_name;
526
+		if ($filter_name == '') {
527
+			$filter_name = $this->filter_name;
528
+		}
442 529
 		$query = "SELECT flight_date as date_name, cnt as date_count FROM stats_flight WHERE stats_type = 'month' AND stats_airline = :stats_airline AND filter_name = :filter_name";
443 530
 		$query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name);
444 531
                  try {
@@ -460,7 +547,9 @@  discard block
 block discarded – undo
460 547
 	}
461 548
 	public function countAllDatesLast7Days($stats_airline = '',$filter_name = '') {
462 549
 		global $globalDBdriver, $globalStatsFilters;
463
-		if ($filter_name == '') $filter_name = $this->filter_name;
550
+		if ($filter_name == '') {
551
+			$filter_name = $this->filter_name;
552
+		}
464 553
 		if ($globalDBdriver == 'mysql') {
465 554
 			$query = "SELECT flight_date as date_name, cnt as date_count FROM stats_flight WHERE stats_type = 'month' AND flight_date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY) AND stats_airline = :stats_airline AND filter_name = :filter_name";
466 555
 		} else {
@@ -486,7 +575,9 @@  discard block
 block discarded – undo
486 575
 	}
487 576
 	public function countAllDates($stats_airline = '',$filter_name = '') {
488 577
 		global $globalStatsFilters;
489
-		if ($filter_name == '') $filter_name = $this->filter_name;
578
+		if ($filter_name == '') {
579
+			$filter_name = $this->filter_name;
580
+		}
490 581
 		$query = "SELECT flight_date as date_name, cnt as date_count FROM stats_flight WHERE stats_type = 'date' AND stats_airline = :stats_airline AND filter_name = :filter_name";
491 582
 		$query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name);
492 583
                  try {
@@ -508,7 +599,9 @@  discard block
 block discarded – undo
508 599
 	}
509 600
 	public function countAllDatesByAirlines($filter_name = '') {
510 601
 		global $globalStatsFilters;
511
-		if ($filter_name == '') $filter_name = $this->filter_name;
602
+		if ($filter_name == '') {
603
+			$filter_name = $this->filter_name;
604
+		}
512 605
 		$query = "SELECT stats_airline as airline_icao, flight_date as date_name, cnt as date_count FROM stats_flight WHERE stats_type = 'date' AND filter_name = :filter_name";
513 606
 		$query_data = array('filter_name' => $filter_name);
514 607
                  try {
@@ -530,7 +623,9 @@  discard block
 block discarded – undo
530 623
 	}
531 624
 	public function countAllMonths($stats_airline = '',$filter_name = '') {
532 625
 		global $globalStatsFilters;
533
-		if ($filter_name == '') $filter_name = $this->filter_name;
626
+		if ($filter_name == '') {
627
+			$filter_name = $this->filter_name;
628
+		}
534 629
 	    	$query = "SELECT YEAR(stats_date) AS year_name,MONTH(stats_date) AS month_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline = :stats_airline AND filter_name = :filter_name";
535 630
                  try {
536 631
                         $sth = $this->db->prepare($query);
@@ -551,7 +646,9 @@  discard block
 block discarded – undo
551 646
 	}
552 647
 	public function countAllMilitaryMonths($filter_name = '') {
553 648
 		global $globalStatsFilters;
554
-		if ($filter_name == '') $filter_name = $this->filter_name;
649
+		if ($filter_name == '') {
650
+			$filter_name = $this->filter_name;
651
+		}
555 652
 	    	$query = "SELECT YEAR(stats_date) AS year_name,MONTH(stats_date) AS month_name, cnt as date_count FROM stats WHERE stats_type = 'military_flights_bymonth' AND filter_name = :filter_name";
556 653
                  try {
557 654
                         $sth = $this->db->prepare($query);
@@ -572,9 +669,14 @@  discard block
 block discarded – undo
572 669
 	}
573 670
 	public function countAllHours($orderby = 'hour',$limit = true,$stats_airline = '',$filter_name = '') {
574 671
 		global $globalTimezone, $globalDBdriver, $globalStatsFilters;
575
-		if ($filter_name == '') $filter_name = $this->filter_name;
576
-		if ($limit) $query = "SELECT flight_date as hour_name, cnt as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline = :stats_airline AND filter_name = :filter_name";
577
-		else $query = "SELECT flight_date as hour_name, cnt as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline = :stats_airline AND filter_name = :filter_name";
672
+		if ($filter_name == '') {
673
+			$filter_name = $this->filter_name;
674
+		}
675
+		if ($limit) {
676
+			$query = "SELECT flight_date as hour_name, cnt as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline = :stats_airline AND filter_name = :filter_name";
677
+		} else {
678
+			$query = "SELECT flight_date as hour_name, cnt as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline = :stats_airline AND filter_name = :filter_name";
679
+		}
578 680
 		if ($orderby == 'hour') {
579 681
 			/*
580 682
 			if ($globalDBdriver == 'mysql') {
@@ -583,7 +685,9 @@  discard block
 block discarded – undo
583 685
 			*/
584 686
 			$query .= " ORDER BY CAST(flight_date AS integer) ASC";
585 687
 		}
586
-		if ($orderby == 'count') $query .= " ORDER BY hour_count DESC";
688
+		if ($orderby == 'count') {
689
+			$query .= " ORDER BY hour_count DESC";
690
+		}
587 691
                  try {
588 692
                         $sth = $this->db->prepare($query);
589 693
                         $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
@@ -604,7 +708,9 @@  discard block
 block discarded – undo
604 708
 	
605 709
 	public function countOverallFlights($stats_airline = '', $filter_name = '') {
606 710
 		global $globalStatsFilters;
607
-		if ($filter_name == '') $filter_name = $this->filter_name;
711
+		if ($filter_name == '') {
712
+			$filter_name = $this->filter_name;
713
+		}
608 714
 		$all = $this->getSumStats('flights_bymonth',date('Y'),$stats_airline,$filter_name);
609 715
 		if (empty($all)) {
610 716
 			$filters = array('airlines' => array($stats_airline));
@@ -618,7 +724,9 @@  discard block
 block discarded – undo
618 724
 	}
619 725
 	public function countOverallMilitaryFlights($filter_name = '') {
620 726
 		global $globalStatsFilters;
621
-		if ($filter_name == '') $filter_name = $this->filter_name;
727
+		if ($filter_name == '') {
728
+			$filter_name = $this->filter_name;
729
+		}
622 730
 		$all = $this->getSumStats('military_flights_bymonth',date('Y'),'',$filter_name);
623 731
 		if (empty($all)) {
624 732
 		        $filters = array();
@@ -632,7 +740,9 @@  discard block
 block discarded – undo
632 740
 	}
633 741
 	public function countOverallArrival($stats_airline = '',$filter_name = '') {
634 742
 		global $globalStatsFilters;
635
-		if ($filter_name == '') $filter_name = $this->filter_name;
743
+		if ($filter_name == '') {
744
+			$filter_name = $this->filter_name;
745
+		}
636 746
 		$all = $this->getSumStats('realarrivals_bymonth',date('Y'),$stats_airline,$filter_name);
637 747
 		if (empty($all)) {
638 748
 			$filters = array('airlines' => array($stats_airline));
@@ -646,7 +756,9 @@  discard block
 block discarded – undo
646 756
 	}
647 757
 	public function countOverallAircrafts($stats_airline = '',$filter_name = '') {
648 758
 		global $globalStatsFilters;
649
-		if ($filter_name == '') $filter_name = $this->filter_name;
759
+		if ($filter_name == '') {
760
+			$filter_name = $this->filter_name;
761
+		}
650 762
 		$all = $this->getSumStats('aircrafts_bymonth',date('Y'),$stats_airline,$filter_name);
651 763
 		if (empty($all)) {
652 764
 			$filters = array('airlines' => array($stats_airline));
@@ -660,7 +772,9 @@  discard block
 block discarded – undo
660 772
 	}
661 773
 	public function countOverallAirlines($filter_name = '') {
662 774
 		global $globalStatsFilters;
663
-		if ($filter_name == '') $filter_name = $this->filter_name;
775
+		if ($filter_name == '') {
776
+			$filter_name = $this->filter_name;
777
+		}
664 778
 		$query = "SELECT COUNT(*) AS nb_airline FROM stats_airline WHERE filter_name = :filter_name";
665 779
                  try {
666 780
                         $sth = $this->db->prepare($query);
@@ -683,7 +797,9 @@  discard block
 block discarded – undo
683 797
 	}
684 798
 	public function countOverallOwners($stats_airline = '',$filter_name = '') {
685 799
 		global $globalStatsFilters;
686
-		if ($filter_name == '') $filter_name = $this->filter_name;
800
+		if ($filter_name == '') {
801
+			$filter_name = $this->filter_name;
802
+		}
687 803
 		/*
688 804
 		$query = "SELECT COUNT(*) AS nb_owner FROM stats_owner";
689 805
                  try {
@@ -708,7 +824,9 @@  discard block
 block discarded – undo
708 824
 	}
709 825
 	public function countOverallPilots($stats_airline = '',$filter_name = '') {
710 826
 		global $globalStatsFilters;
711
-		if ($filter_name == '') $filter_name = $this->filter_name;
827
+		if ($filter_name == '') {
828
+			$filter_name = $this->filter_name;
829
+		}
712 830
 		$all = $this->getSumStats('pilots_bymonth',date('Y'),$stats_airline,$filter_name);
713 831
 		if (empty($all)) {
714 832
 			$filters = array('airlines' => array($stats_airline));
@@ -722,7 +840,9 @@  discard block
 block discarded – undo
722 840
 	}
723 841
 
724 842
 	public function getLast7DaysAirports($airport_icao = '', $stats_airline = '',$filter_name = '') {
725
-		if ($filter_name == '') $filter_name = $this->filter_name;
843
+		if ($filter_name == '') {
844
+			$filter_name = $this->filter_name;
845
+		}
726 846
 		$query = "SELECT * FROM stats_airport WHERE stats_type = 'daily' AND airport_icao = :airport_icao AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY date";
727 847
 		$query_values = array(':airport_icao' => $airport_icao,':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
728 848
                  try {
@@ -735,7 +855,9 @@  discard block
 block discarded – undo
735 855
                 return $all;
736 856
 	}
737 857
 	public function getStats($type,$stats_airline = '', $filter_name = '') {
738
-		if ($filter_name == '') $filter_name = $this->filter_name;
858
+		if ($filter_name == '') {
859
+			$filter_name = $this->filter_name;
860
+		}
739 861
                 $query = "SELECT * FROM stats WHERE stats_type = :type AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY stats_date";
740 862
                 $query_values = array(':type' => $type,':stats_airline' => $stats_airline,':filter_name' => $filter_name);
741 863
                  try {
@@ -748,7 +870,9 @@  discard block
 block discarded – undo
748 870
                 return $all;
749 871
         }
750 872
 	public function getSumStats($type,$year,$stats_airline = '',$filter_name = '') {
751
-		if ($filter_name == '') $filter_name = $this->filter_name;
873
+		if ($filter_name == '') {
874
+			$filter_name = $this->filter_name;
875
+		}
752 876
     		global $globalArchiveMonths, $globalDBdriver;
753 877
     		if ($globalDBdriver == 'mysql') {
754 878
 	                $query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND YEAR(stats_date) = :year AND stats_airline = :stats_airline AND filter_name = :filter_name";
@@ -767,7 +891,9 @@  discard block
 block discarded – undo
767 891
         }
768 892
 	public function getStatsTotal($type, $stats_airline = '', $filter_name = '') {
769 893
     		global $globalArchiveMonths, $globalDBdriver;
770
-		if ($filter_name == '') $filter_name = $this->filter_name;
894
+		if ($filter_name == '') {
895
+			$filter_name = $this->filter_name;
896
+		}
771 897
     		if ($globalDBdriver == 'mysql') {
772 898
 			$query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND stats_date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL ".$globalArchiveMonths." MONTH) AND stats_airline = :stats_airline AND filter_name = :filter_name";
773 899
 		} else {
@@ -785,7 +911,9 @@  discard block
 block discarded – undo
785 911
         }
786 912
 	public function getStatsAircraftTotal($stats_airline = '', $filter_name = '') {
787 913
     		global $globalArchiveMonths, $globalDBdriver;
788
-		if ($filter_name == '') $filter_name = $this->filter_name;
914
+		if ($filter_name == '') {
915
+			$filter_name = $this->filter_name;
916
+		}
789 917
     		if ($globalDBdriver == 'mysql') {
790 918
 			$query = "SELECT SUM(cnt) as total FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name";
791 919
                 } else {
@@ -802,7 +930,9 @@  discard block
 block discarded – undo
802 930
         }
803 931
 	public function getStatsAirlineTotal($filter_name = '') {
804 932
     		global $globalArchiveMonths, $globalDBdriver;
805
-		if ($filter_name == '') $filter_name = $this->filter_name;
933
+		if ($filter_name == '') {
934
+			$filter_name = $this->filter_name;
935
+		}
806 936
     		if ($globalDBdriver == 'mysql') {
807 937
 			$query = "SELECT SUM(cnt) as total FROM stats_airline WHERE filter_name = :filter_name";
808 938
                 } else {
@@ -819,7 +949,9 @@  discard block
 block discarded – undo
819 949
         }
820 950
 	public function getStatsOwnerTotal($filter_name = '') {
821 951
     		global $globalArchiveMonths, $globalDBdriver;
822
-		if ($filter_name == '') $filter_name = $this->filter_name;
952
+		if ($filter_name == '') {
953
+			$filter_name = $this->filter_name;
954
+		}
823 955
     		if ($globalDBdriver == 'mysql') {
824 956
 			$query = "SELECT SUM(cnt) as total FROM stats_owner WHERE filter_name = :filter_name";
825 957
 		} else {
@@ -836,7 +968,9 @@  discard block
 block discarded – undo
836 968
         }
837 969
 	public function getStatsPilotTotal($filter_name = '') {
838 970
     		global $globalArchiveMonths, $globalDBdriver;
839
-		if ($filter_name == '') $filter_name = $this->filter_name;
971
+		if ($filter_name == '') {
972
+			$filter_name = $this->filter_name;
973
+		}
840 974
     		if ($globalDBdriver == 'mysql') {
841 975
             		$query = "SELECT SUM(cnt) as total FROM stats_pilot WHERE filter_name = :filter_name";
842 976
             	} else {
@@ -854,7 +988,9 @@  discard block
 block discarded – undo
854 988
 
855 989
 	public function addStat($type,$cnt,$stats_date,$stats_airline = '',$filter_name = '') {
856 990
 		global $globalDBdriver;
857
-		if ($filter_name == '') $filter_name = $this->filter_name;
991
+		if ($filter_name == '') {
992
+			$filter_name = $this->filter_name;
993
+		}
858 994
 		if ($globalDBdriver == 'mysql') {
859 995
 			$query = "INSERT INTO stats (stats_type,cnt,stats_date,stats_airline,filter_name) VALUES (:type,:cnt,:stats_date,:stats_airline,:filter_name) ON DUPLICATE KEY UPDATE cnt = :cnt";
860 996
                 } else {
@@ -870,7 +1006,9 @@  discard block
 block discarded – undo
870 1006
         }
871 1007
 	public function updateStat($type,$cnt,$stats_date,$stats_airline = '',$filter_name = '') {
872 1008
 		global $globalDBdriver;
873
-		if ($filter_name == '') $filter_name = $this->filter_name;
1009
+		if ($filter_name == '') {
1010
+			$filter_name = $this->filter_name;
1011
+		}
874 1012
 		if ($globalDBdriver == 'mysql') {
875 1013
 			$query = "INSERT INTO stats (stats_type,cnt,stats_date,stats_airline,filter_name) VALUES (:type,:cnt,:stats_date,:stats_airline,:filter_name) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt, stats_date = :date";
876 1014
 		} else {
@@ -1356,7 +1494,9 @@  discard block
 block discarded – undo
1356 1494
 			echo 'Update stats !'."\n";
1357 1495
 			if (isset($last_update[0]['value'])) {
1358 1496
 				$last_update_day = $last_update[0]['value'];
1359
-			} else $last_update_day = '2012-12-12 12:12:12';
1497
+			} else {
1498
+				$last_update_day = '2012-12-12 12:12:12';
1499
+			}
1360 1500
 			$Spotter = new Spotter($this->db);
1361 1501
 			$alldata = $Spotter->countAllAircraftTypes(false,0,$last_update_day);
1362 1502
 			foreach ($alldata as $number) {
@@ -1395,7 +1535,9 @@  discard block
 block discarded – undo
1395 1535
     				$icao = $value['airport_departure_icao'];
1396 1536
         			if (isset($alldata[$icao])) {
1397 1537
     					$alldata[$icao]['airport_departure_icao_count'] = $alldata[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count'];
1398
-        			} else $alldata[$icao] = $value;
1538
+        			} else {
1539
+        				$alldata[$icao] = $value;
1540
+        			}
1399 1541
 			}
1400 1542
     			$count = array();
1401 1543
     			foreach ($alldata as $key => $row) {
@@ -1416,7 +1558,9 @@  discard block
 block discarded – undo
1416 1558
     				$icao = $value['airport_arrival_icao'];
1417 1559
         			if (isset($alldata[$icao])) {
1418 1560
         				$alldata[$icao]['airport_arrival_icao_count'] = $alldata[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count'];
1419
-	        		} else $alldata[$icao] = $value;
1561
+	        		} else {
1562
+	        			$alldata[$icao] = $value;
1563
+	        		}
1420 1564
     			}
1421 1565
         		$count = array();
1422 1566
         		foreach ($alldata as $key => $row) {
@@ -1442,7 +1586,9 @@  discard block
 block discarded – undo
1442 1586
 			$alldata = $Spotter->countAllMonths();
1443 1587
 			$lastyear = false;
1444 1588
 			foreach ($alldata as $number) {
1445
-				if ($number['year_name'] != date('Y')) $lastyear = true;
1589
+				if ($number['year_name'] != date('Y')) {
1590
+					$lastyear = true;
1591
+				}
1446 1592
 				$this->addStat('flights_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])));
1447 1593
 			}
1448 1594
 			$alldata = $Spotter->countAllMilitaryMonths();
@@ -1660,7 +1806,9 @@  discard block
 block discarded – undo
1660 1806
 			$alldata = $Spotter->countAllMonthsByAirlines();
1661 1807
 			$lastyear = false;
1662 1808
 			foreach ($alldata as $number) {
1663
-				if ($number['year_name'] != date('Y')) $lastyear = true;
1809
+				if ($number['year_name'] != date('Y')) {
1810
+					$lastyear = true;
1811
+				}
1664 1812
 				$this->addStat('flights_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']);
1665 1813
 			}
1666 1814
 			$alldata = $Spotter->countAllMonthsOwnersByAirlines();
@@ -1752,7 +1900,9 @@  discard block
 block discarded – undo
1752 1900
 			}
1753 1901
 			
1754 1902
 
1755
-			if (!isset($globalStatsFilters) || $globalStatsFilters == '') $globalStatsFilters = array();
1903
+			if (!isset($globalStatsFilters) || $globalStatsFilters == '') {
1904
+				$globalStatsFilters = array();
1905
+			}
1756 1906
 			foreach ($globalStatsFilters as $name => $filter) {
1757 1907
 				//$filter_name = $filter['name'];
1758 1908
 				$filter_name = $name;
@@ -1795,7 +1945,9 @@  discard block
 block discarded – undo
1795 1945
 	    				$icao = $value['airport_departure_icao'];
1796 1946
         				if (isset($alldata[$icao])) {
1797 1947
     						$alldata[$icao]['airport_departure_icao_count'] = $alldata[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count'];
1798
-        				} else $alldata[$icao] = $value;
1948
+        				} else {
1949
+        					$alldata[$icao] = $value;
1950
+        				}
1799 1951
 				}
1800 1952
 	    			$count = array();
1801 1953
     				foreach ($alldata as $key => $row) {
@@ -1816,7 +1968,9 @@  discard block
 block discarded – undo
1816 1968
 	    				$icao = $value['airport_arrival_icao'];
1817 1969
         				if (isset($alldata[$icao])) {
1818 1970
         					$alldata[$icao]['airport_arrival_icao_count'] = $alldata[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count'];
1819
-		        		} else $alldata[$icao] = $value;
1971
+		        		} else {
1972
+		        			$alldata[$icao] = $value;
1973
+		        		}
1820 1974
 	    			}
1821 1975
         			$count = array();
1822 1976
         			foreach ($alldata as $key => $row) {
@@ -1830,7 +1984,9 @@  discard block
 block discarded – undo
1830 1984
 				$alldata = $Spotter->countAllMonths($filter);
1831 1985
 				$lastyear = false;
1832 1986
 				foreach ($alldata as $number) {
1833
-					if ($number['year_name'] != date('Y')) $lastyear = true;
1987
+					if ($number['year_name'] != date('Y')) {
1988
+						$lastyear = true;
1989
+					}
1834 1990
 					$this->addStat('flights_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),'',$filter_name);
1835 1991
 				}
1836 1992
 				$alldata = $Spotter->countAllMonthsOwners($filter);
Please login to merge, or discard this patch.
airline.php 1 patch
Braces   +18 added lines, -6 removed lines patch added patch discarded remove patch
@@ -24,13 +24,21 @@  discard block
 block discarded – undo
24 24
 
25 25
 	print '<div class="select-item"><form action="'.$globalURL.'/airline" method="post"><select name="airline_type" class="selectpicker" data-live-search="true">';
26 26
 	print '<option value="all"';
27
-	if ($airline_type == 'all') print 'selected="selected" ';
27
+	if ($airline_type == 'all') {
28
+		print 'selected="selected" ';
29
+	}
28 30
 	print '>'._("All").'</option><option value="passenger"';
29
-	if ($airline_type == 'passenger') print 'selected="selected" ';
31
+	if ($airline_type == 'passenger') {
32
+		print 'selected="selected" ';
33
+	}
30 34
 	print '>'._("Passenger").'</option><option value="cargo"';
31
-	if ($airline_type == 'cargo') print 'selected="selected" ';
35
+	if ($airline_type == 'cargo') {
36
+		print 'selected="selected" ';
37
+	}
32 38
 	print '>'._("Cargo").'</option><option value="military"';
33
-	if ($airline_type == 'military') print 'selected="selected" ';
39
+	if ($airline_type == 'military') {
40
+		print 'selected="selected" ';
41
+	}
34 42
 	print '>'._("Military").'</option></select>';
35 43
 	print '<button type="submit"><i class="fa fa-angle-double-right"></i></button></form></div>';
36 44
 
@@ -57,7 +65,9 @@  discard block
 block discarded – undo
57 65
 		$firstLetter = mb_strtoupper(mb_substr($value['airline_name'], 0, 1),'UTF-8');
58 66
 		if($previous !== $firstLetter)
59 67
 		{
60
-			if ($previous !== null) print ' | ';
68
+			if ($previous !== null) {
69
+				print ' | ';
70
+			}
61 71
 			print '<a href="#'.$firstLetter.'">'.$firstLetter.'</a>';
62 72
 		}
63 73
 		$previous = $firstLetter;
@@ -70,7 +80,9 @@  discard block
 block discarded – undo
70 80
 		{
71 81
 			if($previous !== $firstLetter)
72 82
 			{
73
-				if ($previous !== null) print '</div>';
83
+				if ($previous !== null) {
84
+					print '</div>';
85
+				}
74 86
 				print '<a name="'.$firstLetter.'"></a><h4 class="alphabet-header">'.$firstLetter.'</h4><div class="alphabet">';
75 87
 			}
76 88
 			$previous = $firstLetter;
Please login to merge, or discard this patch.
require/class.Spotter.php 1 patch
Braces   +667 added lines, -231 removed lines patch added patch discarded remove patch
@@ -19,8 +19,12 @@  discard block
 block discarded – undo
19 19
 	*/
20 20
 	public function getFilter($filter = array(),$where = false,$and = false) {
21 21
 		global $globalFilter, $globalStatsFilters, $globalFilterName;
22
-		if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) $filter = array_merge($globalStatsFilters[$globalFilterName],$filter);
23
-		if (is_array($globalFilter)) $filter = array_merge($globalFilter,$filter);
22
+		if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) {
23
+			$filter = array_merge($globalStatsFilters[$globalFilterName],$filter);
24
+		}
25
+		if (is_array($globalFilter)) {
26
+			$filter = array_merge($globalFilter,$filter);
27
+		}
24 28
 		$filter_query_join = '';
25 29
 		$filter_query_where = '';
26 30
 		if (isset($filter['airlines']) && !empty($filter['airlines'])) {
@@ -48,8 +52,11 @@  discard block
 block discarded – undo
48 52
 				$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
49 53
 			}
50 54
 		}
51
-		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
52
-		elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND';
55
+		if ($filter_query_where == '' && $where) {
56
+			$filter_query_where = ' WHERE';
57
+		} elseif ($filter_query_where != '' && $and) {
58
+			$filter_query_where .= ' AND';
59
+		}
53 60
 		$filter_query = $filter_query_join.$filter_query_where;
54 61
 		return $filter_query;
55 62
 	}
@@ -69,10 +76,18 @@  discard block
 block discarded – undo
69 76
 		$Image = new Image($this->db);
70 77
 		$Schedule = new Schedule($this->db);
71 78
 		$ACARS = new ACARS($this->db);
72
-		if (!isset($globalIVAO)) $globalIVAO = FALSE;
73
-		if (!isset($globalVATSIM)) $globalVATSIM = FALSE;
74
-		if (!isset($globalphpVMS)) $globalphpVMS = FALSE;
75
-		if (!isset($globalVAM)) $globalVAM = FALSE;
79
+		if (!isset($globalIVAO)) {
80
+			$globalIVAO = FALSE;
81
+		}
82
+		if (!isset($globalVATSIM)) {
83
+			$globalVATSIM = FALSE;
84
+		}
85
+		if (!isset($globalphpVMS)) {
86
+			$globalphpVMS = FALSE;
87
+		}
88
+		if (!isset($globalVAM)) {
89
+			$globalVAM = FALSE;
90
+		}
76 91
 		date_default_timezone_set('UTC');
77 92
 		
78 93
 		if (!is_string($query))
@@ -119,21 +134,35 @@  discard block
 block discarded – undo
119 134
 			} else {
120 135
 				$temp_array['spotter_id'] = '';
121 136
 			}
122
-			if (isset($row['flightaware_id'])) $temp_array['flightaware_id'] = $row['flightaware_id'];
123
-			if (isset($row['modes'])) $temp_array['modes'] = $row['modes'];
137
+			if (isset($row['flightaware_id'])) {
138
+				$temp_array['flightaware_id'] = $row['flightaware_id'];
139
+			}
140
+			if (isset($row['modes'])) {
141
+				$temp_array['modes'] = $row['modes'];
142
+			}
124 143
 			$temp_array['ident'] = $row['ident'];
125 144
 			if (isset($row['registration']) && $row['registration'] != '') {
126 145
 				$temp_array['registration'] = $row['registration'];
127 146
 			} elseif (isset($temp_array['modes'])) {
128 147
 				$temp_array['registration'] = $this->getAircraftRegistrationBymodeS($temp_array['modes']);
129
-			} else $temp_array['registration'] = '';
130
-			if (isset($row['aircraft_icao'])) $temp_array['aircraft_type'] = $row['aircraft_icao'];
148
+			} else {
149
+				$temp_array['registration'] = '';
150
+			}
151
+			if (isset($row['aircraft_icao'])) {
152
+				$temp_array['aircraft_type'] = $row['aircraft_icao'];
153
+			}
131 154
 			
132 155
 			$temp_array['departure_airport'] = $row['departure_airport_icao'];
133 156
 			$temp_array['arrival_airport'] = $row['arrival_airport_icao'];
134
-			if (isset($row['real_arrival_airport_icao']) && $row['real_arrival_airport_icao'] != NULL) $temp_array['real_arrival_airport'] = $row['real_arrival_airport_icao'];
135
-			if (isset($row['latitude'])) $temp_array['latitude'] = $row['latitude'];
136
-			if (isset($row['longitude'])) $temp_array['longitude'] = $row['longitude'];
157
+			if (isset($row['real_arrival_airport_icao']) && $row['real_arrival_airport_icao'] != NULL) {
158
+				$temp_array['real_arrival_airport'] = $row['real_arrival_airport_icao'];
159
+			}
160
+			if (isset($row['latitude'])) {
161
+				$temp_array['latitude'] = $row['latitude'];
162
+			}
163
+			if (isset($row['longitude'])) {
164
+				$temp_array['longitude'] = $row['longitude'];
165
+			}
137 166
 			/*
138 167
 			if (Connection->tableExists('countries')) {
139 168
 				$country_info = $this->getCountryFromLatitudeLongitude($temp_array['latitude'],$temp_array['longitude']);
@@ -143,8 +172,12 @@  discard block
 block discarded – undo
143 172
 				}
144 173
 			}
145 174
 			*/
146
-			if (isset($row['waypoints'])) $temp_array['waypoints'] = $row['waypoints'];
147
-			if (isset($row['format_source'])) $temp_array['format_source'] = $row['format_source'];
175
+			if (isset($row['waypoints'])) {
176
+				$temp_array['waypoints'] = $row['waypoints'];
177
+			}
178
+			if (isset($row['format_source'])) {
179
+				$temp_array['format_source'] = $row['format_source'];
180
+			}
148 181
 			if (isset($row['route_stop'])) {
149 182
 				$temp_array['route_stop'] = $row['route_stop'];
150 183
 				if ($row['route_stop'] != '') {
@@ -163,13 +196,19 @@  discard block
 block discarded – undo
163 196
 					}
164 197
 				}
165 198
 			}
166
-			if (isset($row['altitude'])) $temp_array['altitude'] = $row['altitude'];
199
+			if (isset($row['altitude'])) {
200
+				$temp_array['altitude'] = $row['altitude'];
201
+			}
167 202
 			if (isset($row['heading'])) {
168 203
 				$temp_array['heading'] = $row['heading'];
169 204
 				$heading_direction = $this->parseDirection($row['heading']);
170
-				if (isset($heading_direction[0]['direction_fullname'])) $temp_array['heading_name'] = $heading_direction[0]['direction_fullname'];
205
+				if (isset($heading_direction[0]['direction_fullname'])) {
206
+					$temp_array['heading_name'] = $heading_direction[0]['direction_fullname'];
207
+				}
208
+			}
209
+			if (isset($row['ground_speed'])) {
210
+				$temp_array['ground_speed'] = $row['ground_speed'];
171 211
 			}
172
-			if (isset($row['ground_speed'])) $temp_array['ground_speed'] = $row['ground_speed'];
173 212
 			$temp_array['image'] = "";
174 213
 			$temp_array['image_thumbnail'] = "";
175 214
 			$temp_array['image_source'] = "";
@@ -177,7 +216,9 @@  discard block
 block discarded – undo
177 216
  
178 217
 			if (isset($row['highlight'])) {
179 218
 				$temp_array['highlight'] = $row['highlight'];
180
-			} else $temp_array['highlight'] = '';
219
+			} else {
220
+				$temp_array['highlight'] = '';
221
+			}
181 222
 			
182 223
 			if (isset($row['date'])) {
183 224
 				$dateArray = $this->parseDateString($row['date']);
@@ -225,7 +266,9 @@  discard block
 block discarded – undo
225 266
 				
226 267
 					if ($aircraft_array[0]['aircraft_shadow'] != NULL) {
227 268
 						$temp_array['aircraft_shadow'] = $aircraft_array[0]['aircraft_shadow'];
228
-					} else $temp_array['aircraft_shadow'] = 'default.png';
269
+					} else {
270
+						$temp_array['aircraft_shadow'] = 'default.png';
271
+					}
229 272
                                 } else {
230 273
                             		$temp_array['aircraft_shadow'] = 'default.png';
231 274
 					$temp_array['aircraft_name'] = 'N/A';
@@ -233,11 +276,17 @@  discard block
 block discarded – undo
233 276
                             	}
234 277
 			}
235 278
 			$fromsource = NULL;
236
-			if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource;
237
-			elseif (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') $fromsource = 'vatsim';
238
-			elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') $fromsource = 'ivao';
239
-			elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim';
240
-			elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao';
279
+			if (isset($globalAirlinesSource) && $globalAirlinesSource != '') {
280
+				$fromsource = $globalAirlinesSource;
281
+			} elseif (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') {
282
+				$fromsource = 'vatsim';
283
+			} elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') {
284
+				$fromsource = 'ivao';
285
+			} elseif (isset($globalVATSIM) && $globalVATSIM) {
286
+				$fromsource = 'vatsim';
287
+			} elseif (isset($globalIVAO) && $globalIVAO) {
288
+				$fromsource = 'ivao';
289
+			}
241 290
 			if (!isset($row['airline_name']) || $row['airline_name'] == '') {
242 291
 				if (!is_numeric(substr($row['ident'], 0, 3))) {
243 292
 					if (is_numeric(substr($row['ident'], 2, 1))) {
@@ -260,12 +309,18 @@  discard block
 block discarded – undo
260 309
 				}
261 310
 			} else {
262 311
 				$temp_array['airline_icao'] = $row['airline_icao'];
263
-				if (isset($row['airline_iata'])) $temp_array['airline_iata'] = $row['airline_iata'];
264
-				else $temp_array['airline_iata'] = '';
312
+				if (isset($row['airline_iata'])) {
313
+					$temp_array['airline_iata'] = $row['airline_iata'];
314
+				} else {
315
+					$temp_array['airline_iata'] = '';
316
+				}
265 317
 				$temp_array['airline_name'] = $row['airline_name'];
266 318
 				$temp_array['airline_country'] = $row['airline_country'];
267
-				if (isset($row['airline_callsign'])) $temp_array['airline_callsign'] = $row['airline_callsign'];
268
-				else $temp_array['airline_callsign'] = 'N/A';
319
+				if (isset($row['airline_callsign'])) {
320
+					$temp_array['airline_callsign'] = $row['airline_callsign'];
321
+				} else {
322
+					$temp_array['airline_callsign'] = 'N/A';
323
+				}
269 324
 				$temp_array['airline_type'] = $row['airline_type'];
270 325
 			}
271 326
 			if (isset($temp_array['airline_iata']) && $temp_array['airline_iata'] != '') {
@@ -281,7 +336,9 @@  discard block
 block discarded – undo
281 336
 			}
282 337
 			if ($temp_array['registration'] != "" && !$globalIVAO && !$globalVATSIM && !$globalphpVMS && !$globalVAM && !isset($temp_array['aircraft_owner'])) {
283 338
 				$owner_info = $this->getAircraftOwnerByRegistration($temp_array['registration']);
284
-				if ($owner_info['owner'] != '') $temp_array['aircraft_owner'] = ucwords(strtolower($owner_info['owner']));
339
+				if ($owner_info['owner'] != '') {
340
+					$temp_array['aircraft_owner'] = ucwords(strtolower($owner_info['owner']));
341
+				}
285 342
 				$temp_array['aircraft_base'] = $owner_info['base'];
286 343
 				$temp_array['aircraft_date_first_reg'] = $owner_info['date_first_reg'];
287 344
 			}
@@ -289,9 +346,14 @@  discard block
 block discarded – undo
289 346
 			if($temp_array['registration'] != "" || ($globalIVAO && isset($temp_array['aircraft_type']) && $temp_array['aircraft_type'] != ''))
290 347
 			{
291 348
 				if ($globalIVAO) {
292
-					if (isset($temp_array['airline_icao']))	$image_array = $Image->getSpotterImage('',$temp_array['aircraft_type'],$temp_array['airline_icao']);
293
-					else $image_array = $Image->getSpotterImage('',$temp_array['aircraft_type']);
294
-				} else $image_array = $Image->getSpotterImage($temp_array['registration']);
349
+					if (isset($temp_array['airline_icao'])) {
350
+						$image_array = $Image->getSpotterImage('',$temp_array['aircraft_type'],$temp_array['airline_icao']);
351
+					} else {
352
+						$image_array = $Image->getSpotterImage('',$temp_array['aircraft_type']);
353
+					}
354
+				} else {
355
+					$image_array = $Image->getSpotterImage($temp_array['registration']);
356
+				}
295 357
 				if (count($image_array) > 0) {
296 358
 					$temp_array['image'] = $image_array[0]['image'];
297 359
 					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -341,7 +403,9 @@  discard block
 block discarded – undo
341 403
 			//if ($row['departure_airport_icao'] != '' && $row['departure_airport_name'] == '') {
342 404
 			if ($row['departure_airport_icao'] != '') {
343 405
 				$departure_airport_array = $this->getAllAirportInfo($row['departure_airport_icao']);
344
-				if (!isset($departure_airport_array[0]['name'])) $departure_airport_array = $this->getAllAirportInfo('NA');
406
+				if (!isset($departure_airport_array[0]['name'])) {
407
+					$departure_airport_array = $this->getAllAirportInfo('NA');
408
+				}
345 409
 			/*
346 410
 			} elseif ($row['departure_airport_name'] != '') {
347 411
 				$temp_array['departure_airport_name'] = $row['departure_airport_name'];
@@ -349,7 +413,9 @@  discard block
 block discarded – undo
349 413
 				$temp_array['departure_airport_country'] = $row['departure_airport_country'];
350 414
 				$temp_array['departure_airport_icao'] = $row['departure_airport_icao'];
351 415
 			*/
352
-			} else $departure_airport_array = $this->getAllAirportInfo('NA');
416
+			} else {
417
+				$departure_airport_array = $this->getAllAirportInfo('NA');
418
+			}
353 419
 			if (isset($departure_airport_array[0]['name'])) {
354 420
 				$temp_array['departure_airport_name'] = $departure_airport_array[0]['name'];
355 421
 				$temp_array['departure_airport_city'] = $departure_airport_array[0]['city'];
@@ -369,8 +435,12 @@  discard block
 block discarded – undo
369 435
 			
370 436
 			if ($row['arrival_airport_icao'] != '') {
371 437
 				$arrival_airport_array = $this->getAllAirportInfo($row['arrival_airport_icao']);
372
-				if (count($arrival_airport_array) == 0) $arrival_airport_array = $this->getAllAirportInfo('NA');
373
-			} else $arrival_airport_array = $this->getAllAirportInfo('NA');
438
+				if (count($arrival_airport_array) == 0) {
439
+					$arrival_airport_array = $this->getAllAirportInfo('NA');
440
+				}
441
+			} else {
442
+				$arrival_airport_array = $this->getAllAirportInfo('NA');
443
+			}
374 444
 			if (isset($arrival_airport_array[0]['name'])) {
375 445
 				$temp_array['arrival_airport_name'] = $arrival_airport_array[0]['name'];
376 446
 				$temp_array['arrival_airport_city'] = $arrival_airport_array[0]['city'];
@@ -386,27 +456,45 @@  discard block
 block discarded – undo
386 456
 				$temp_array['arrival_airport_time'] = $row['arrival_airport_time'];
387 457
 			}
388 458
 			*/
389
-			if (isset($row['pilot_id']) && $row['pilot_id'] != '') $temp_array['pilot_id'] = $row['pilot_id'];
390
-			if (isset($row['pilot_name']) && $row['pilot_name'] != '') $temp_array['pilot_name'] = $row['pilot_name'];
391
-			if (isset($row['source_name']) && $row['source_name'] != '') $temp_array['source_name'] = $row['source_name'];
392
-			if (isset($row['over_country']) && $row['over_country'] != '') $temp_array['over_country'] = $row['over_country'];
393
-			if (isset($row['distance']) && $row['distance'] != '') $temp_array['distance'] = $row['distance'];
459
+			if (isset($row['pilot_id']) && $row['pilot_id'] != '') {
460
+				$temp_array['pilot_id'] = $row['pilot_id'];
461
+			}
462
+			if (isset($row['pilot_name']) && $row['pilot_name'] != '') {
463
+				$temp_array['pilot_name'] = $row['pilot_name'];
464
+			}
465
+			if (isset($row['source_name']) && $row['source_name'] != '') {
466
+				$temp_array['source_name'] = $row['source_name'];
467
+			}
468
+			if (isset($row['over_country']) && $row['over_country'] != '') {
469
+				$temp_array['over_country'] = $row['over_country'];
470
+			}
471
+			if (isset($row['distance']) && $row['distance'] != '') {
472
+				$temp_array['distance'] = $row['distance'];
473
+			}
394 474
 			if (isset($row['squawk'])) {
395 475
 				$temp_array['squawk'] = $row['squawk'];
396 476
 				if ($row['squawk'] != '' && isset($temp_array['country_iso2'])) {
397 477
 					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$temp_array['country_iso2']);
398
-					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
478
+					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) {
479
+						$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
480
+					}
399 481
 				} elseif ($row['squawk'] != '' && isset($temp_array['over_country'])) {
400 482
 					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$temp_array['over_country']);
401
-					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
402
-				} elseif ($row['squawk'] != '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
483
+					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) {
484
+						$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
485
+					}
486
+				} elseif ($row['squawk'] != '' && isset($globalSquawkCountry)) {
487
+					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
488
+				}
403 489
 			}
404 490
     			
405 491
 			$temp_array['query_number_rows'] = $num_rows;
406 492
 			
407 493
 			$spotter_array[] = $temp_array;
408 494
 		}
409
-		if ($num_rows == 0) return array();
495
+		if ($num_rows == 0) {
496
+			return array();
497
+		}
410 498
 		$spotter_array[0]['query_number_rows'] = $num_rows;
411 499
 		return $spotter_array;
412 500
 	}	
@@ -439,7 +527,9 @@  discard block
 block discarded – undo
439 527
 				foreach ($q_array as $q_item){
440 528
 					$q_item = filter_var($q_item,FILTER_SANITIZE_STRING);
441 529
 					$additional_query .= " AND (";
442
-					if (is_int($q_item)) $additional_query .= "(spotter_output.spotter_id like '%".$q_item."%') OR ";
530
+					if (is_int($q_item)) {
531
+						$additional_query .= "(spotter_output.spotter_id like '%".$q_item."%') OR ";
532
+					}
443 533
 					$additional_query .= "(spotter_output.aircraft_icao like '%".$q_item."%') OR ";
444 534
 					$additional_query .= "(spotter_output.aircraft_name like '%".$q_item."%') OR ";
445 535
 					$additional_query .= "(spotter_output.aircraft_manufacturer like '%".$q_item."%') OR ";
@@ -460,7 +550,9 @@  discard block
 block discarded – undo
460 550
 					$additional_query .= "(spotter_output.pilot_name like '%".$q_item."%') OR ";
461 551
 					$additional_query .= "(spotter_output.ident like '%".$q_item."%') OR ";
462 552
 					$translate = $Translation->ident2icao($q_item);
463
-					if ($translate != $q_item) $additional_query .= "(spotter_output.ident like '%".$translate."%') OR ";
553
+					if ($translate != $q_item) {
554
+						$additional_query .= "(spotter_output.ident like '%".$translate."%') OR ";
555
+					}
464 556
 					$additional_query .= "(spotter_output.highlight like '%".$q_item."%')";
465 557
 					$additional_query .= ")";
466 558
 				}
@@ -687,7 +779,9 @@  discard block
 block discarded – undo
687 779
 				date_default_timezone_set($globalTimezone);
688 780
 				$datetime = new DateTime();
689 781
 				$offset = $datetime->format('P');
690
-			} else $offset = '+00:00';
782
+			} else {
783
+				$offset = '+00:00';
784
+			}
691 785
 
692 786
 			if ($date_array[1] != "")
693 787
 			{
@@ -719,8 +813,12 @@  discard block
 block discarded – undo
719 813
 			{
720 814
 				//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
721 815
 				$limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0];
722
-			} else $limit_query = "";
723
-		} else $limit_query = "";
816
+			} else {
817
+				$limit_query = "";
818
+			}
819
+		} else {
820
+			$limit_query = "";
821
+		}
724 822
 
725 823
 
726 824
 		if ($sort != "")
@@ -788,8 +886,12 @@  discard block
 block discarded – undo
788 886
 			{
789 887
 				//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
790 888
 				$limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0];
791
-			} else $limit_query = "";
792
-		} else $limit_query = "";
889
+			} else {
890
+				$limit_query = "";
891
+			}
892
+		} else {
893
+			$limit_query = "";
894
+		}
793 895
 		
794 896
 		if ($sort != "")
795 897
 		{
@@ -1113,7 +1215,9 @@  discard block
 block discarded – undo
1113 1215
 		global $global_query;
1114 1216
 		
1115 1217
 		date_default_timezone_set('UTC');
1116
-		if ($id == '') return array();
1218
+		if ($id == '') {
1219
+			return array();
1220
+		}
1117 1221
 		$additional_query = "spotter_output.spotter_id = :id";
1118 1222
 		$query_values = array(':id' => $id);
1119 1223
 
@@ -1739,7 +1843,9 @@  discard block
 block discarded – undo
1739 1843
 		{
1740 1844
 			$highlight = $row['highlight'];
1741 1845
 		}
1742
-		if (isset($highlight)) return $highlight;
1846
+		if (isset($highlight)) {
1847
+			return $highlight;
1848
+		}
1743 1849
 	}
1744 1850
 
1745 1851
 	
@@ -1767,7 +1873,9 @@  discard block
 block discarded – undo
1767 1873
 		$sth->closeCursor();
1768 1874
 		if (count($row) > 0) {
1769 1875
 			return $row['usage'];
1770
-		} else return '';
1876
+		} else {
1877
+			return '';
1878
+		}
1771 1879
 	}
1772 1880
 
1773 1881
 	/**
@@ -1792,7 +1900,9 @@  discard block
 block discarded – undo
1792 1900
 		$sth->closeCursor();
1793 1901
 		if (count($row) > 0) {
1794 1902
 			return $row['icao'];
1795
-		} else return '';
1903
+		} else {
1904
+			return '';
1905
+		}
1796 1906
 	}
1797 1907
 
1798 1908
 	/**
@@ -1820,7 +1930,9 @@  discard block
 block discarded – undo
1820 1930
 			$airport_longitude = $row['longitude'];
1821 1931
 			$Common = new Common();
1822 1932
 			return $Common->distance($latitude,$longitude,$airport_latitude,$airport_longitude);
1823
-		} else return '';
1933
+		} else {
1934
+			return '';
1935
+		}
1824 1936
 	}
1825 1937
 	
1826 1938
 	/**
@@ -1932,7 +2044,9 @@  discard block
 block discarded – undo
1932 2044
 			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1933 2045
 			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1934 2046
 			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1935
-		} else return array();
2047
+		} else {
2048
+			return array();
2049
+		}
1936 2050
 		if ($globalDBdriver == 'mysql') {
1937 2051
 			$query  = "SELECT airport.* FROM airport WHERE airport.latitude BETWEEN ".$minlat." AND ".$maxlat." AND airport.longitude BETWEEN ".$minlong." AND ".$maxlong." AND airport.type != 'closed'";
1938 2052
 		} else {
@@ -1967,7 +2081,9 @@  discard block
 block discarded – undo
1967 2081
 			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1968 2082
 			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1969 2083
 			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1970
-		} else return array();
2084
+		} else {
2085
+			return array();
2086
+		}
1971 2087
 		//$query  = "SELECT waypoints.* FROM waypoints WHERE waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong;
1972 2088
 		$query  = "SELECT waypoints.* FROM waypoints WHERE (waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong.") OR (waypoints.latitude_end BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_end BETWEEN ".$minlong." AND ".$maxlong.")";
1973 2089
 		//$query  = "SELECT waypoints.* FROM waypoints";
@@ -2002,7 +2118,9 @@  discard block
 block discarded – undo
2002 2118
 	public function getAllAirlineInfo($airline_icao, $fromsource = NULL)
2003 2119
 	{
2004 2120
 		global $globalUseRealAirlines;
2005
-		if (isset($globalUseRealAirlines) && $globalUseRealAirlines) $fromsource = NULL;
2121
+		if (isset($globalUseRealAirlines) && $globalUseRealAirlines) {
2122
+			$fromsource = NULL;
2123
+		}
2006 2124
 		$airline_icao = strtoupper(filter_var($airline_icao,FILTER_SANITIZE_STRING));
2007 2125
 		if ($airline_icao == 'NA') {
2008 2126
 			$airline_array = array();
@@ -2052,7 +2170,9 @@  discard block
 block discarded – undo
2052 2170
 				$sth->execute(array(':fromsource' => $fromsource));
2053 2171
 				$row = $sth->fetch(PDO::FETCH_ASSOC);
2054 2172
 				$sth->closeCursor();
2055
-				if ($row['nb'] == 0) $result = $this->getAllAirlineInfo($airline_icao);
2173
+				if ($row['nb'] == 0) {
2174
+					$result = $this->getAllAirlineInfo($airline_icao);
2175
+				}
2056 2176
 			}
2057 2177
 			return $result;
2058 2178
 		}
@@ -2116,15 +2236,20 @@  discard block
 block discarded – undo
2116 2236
 				'A320-211' => 'A320',
2117 2237
 				'747-8i' => 'B748',
2118 2238
 				'A380' => 'A388');
2119
-		if (isset($all_aircraft[$aircraft_type])) return $all_aircraft[$aircraft_type];
2239
+		if (isset($all_aircraft[$aircraft_type])) {
2240
+			return $all_aircraft[$aircraft_type];
2241
+		}
2120 2242
 
2121 2243
 		$query  = "SELECT aircraft.icao FROM aircraft WHERE aircraft.type LIKE :saircraft_type OR aircraft.type = :aircraft_type OR aircraft.icao = :aircraft_type LIMIT 1";
2122 2244
 		$aircraft_type = strtoupper($aircraft_type);
2123 2245
 		$sth = $this->db->prepare($query);
2124 2246
 		$sth->execute(array(':saircraft_type' => '%'.$aircraft_type.'%',':aircraft_type' => $aircraft_type,));
2125 2247
 		$result = $sth->fetchAll(PDO::FETCH_ASSOC);
2126
-		if (isset($result[0]['icao'])) return $result[0]['icao'];
2127
-		else return '';
2248
+		if (isset($result[0]['icao'])) {
2249
+			return $result[0]['icao'];
2250
+		} else {
2251
+			return '';
2252
+		}
2128 2253
 	}
2129 2254
 	
2130 2255
 	/**
@@ -2147,7 +2272,9 @@  discard block
 block discarded – undo
2147 2272
 		$sth->closeCursor();
2148 2273
 		if (isset($row['icaotypecode'])) {
2149 2274
 			return $row['icaotypecode'];
2150
-		} else return '';
2275
+		} else {
2276
+			return '';
2277
+		}
2151 2278
 	}
2152 2279
 
2153 2280
 	/**
@@ -2169,7 +2296,9 @@  discard block
 block discarded – undo
2169 2296
 		$sth->closeCursor();
2170 2297
 		if (isset($row['operator_correct'])) {
2171 2298
 			return $row['operator_correct'];
2172
-		} else return $operator;
2299
+		} else {
2300
+			return $operator;
2301
+		}
2173 2302
 	}
2174 2303
 
2175 2304
 	/**
@@ -2182,7 +2311,9 @@  discard block
 block discarded – undo
2182 2311
 	public function getRouteInfo($callsign)
2183 2312
 	{
2184 2313
 		$callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
2185
-                if ($callsign == '') return array();
2314
+                if ($callsign == '') {
2315
+                	return array();
2316
+                }
2186 2317
 		$query  = "SELECT routes.Operator_ICAO, routes.FromAirport_ICAO, routes.ToAirport_ICAO, routes.RouteStop, routes.FromAirport_Time, routes.ToAirport_Time FROM routes WHERE CallSign = :callsign LIMIT 1";
2187 2318
 		
2188 2319
 		$sth = $this->db->prepare($query);
@@ -2192,7 +2323,9 @@  discard block
 block discarded – undo
2192 2323
 		$sth->closeCursor();
2193 2324
 		if (count($row) > 0) {
2194 2325
 			return $row;
2195
-		} else return array();
2326
+		} else {
2327
+			return array();
2328
+		}
2196 2329
 	}
2197 2330
 	
2198 2331
 	/**
@@ -2245,7 +2378,9 @@  discard block
 block discarded – undo
2245 2378
 			$result = $sth->fetch(PDO::FETCH_ASSOC);
2246 2379
 			$sth->closeCursor();
2247 2380
 			return $result;
2248
-		} else return array();
2381
+		} else {
2382
+			return array();
2383
+		}
2249 2384
 	}
2250 2385
 	
2251 2386
   
@@ -2402,8 +2537,11 @@  discard block
 block discarded – undo
2402 2537
 		$query .= " ORDER BY spotter_output.source_name ASC";
2403 2538
 
2404 2539
 		$sth = $this->db->prepare($query);
2405
-		if (!empty($query_values)) $sth->execute($query_values);
2406
-		else $sth->execute();
2540
+		if (!empty($query_values)) {
2541
+			$sth->execute($query_values);
2542
+		} else {
2543
+			$sth->execute();
2544
+		}
2407 2545
 
2408 2546
 		$source_array = array();
2409 2547
 		$temp_array = array();
@@ -2436,9 +2574,13 @@  discard block
 block discarded – undo
2436 2574
 								WHERE spotter_output.airline_icao <> '' 
2437 2575
 								ORDER BY spotter_output.airline_name ASC";
2438 2576
 			*/
2439
-			if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $forsource = $globalAirlinesSource;
2440
-			elseif (isset($globalVATSIM) && $globalVATSIM) $forsource = 'vatsim';
2441
-			elseif (isset($globalIVAO) && $globalIVAO) $forsource = 'ivao';
2577
+			if (isset($globalAirlinesSource) && $globalAirlinesSource != '') {
2578
+				$forsource = $globalAirlinesSource;
2579
+			} elseif (isset($globalVATSIM) && $globalVATSIM) {
2580
+				$forsource = 'vatsim';
2581
+			} elseif (isset($globalIVAO) && $globalIVAO) {
2582
+				$forsource = 'ivao';
2583
+			}
2442 2584
 			if ($forsource === NULL) {
2443 2585
 				$query = "SELECT DISTINCT icao AS airline_icao, name AS airline_name, type AS airline_type FROM airlines WHERE forsource IS NULL ORDER BY name ASC";
2444 2586
 				$query_data = array();
@@ -2730,7 +2872,9 @@  discard block
 block discarded – undo
2730 2872
 			date_default_timezone_set($globalTimezone);
2731 2873
 			$datetime = new DateTime();
2732 2874
 			$offset = $datetime->format('P');
2733
-		} else $offset = '+00:00';
2875
+		} else {
2876
+			$offset = '+00:00';
2877
+		}
2734 2878
 		if ($airport_icao == '') {
2735 2879
 			if ($globalDBdriver == 'mysql') {
2736 2880
 				$query = "SELECT COUNT(departure_airport_icao) AS departure_airport_count, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date FROM `spotter_output`".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 7 DAY) AND departure_airport_icao <> 'NA' GROUP BY departure_airport_icao, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d'), departure_airport_name, departure_airport_city, departure_airport_country ORDER BY departure_airport_count DESC";
@@ -2762,7 +2906,9 @@  discard block
 block discarded – undo
2762 2906
 			date_default_timezone_set($globalTimezone);
2763 2907
 			$datetime = new DateTime();
2764 2908
 			$offset = $datetime->format('P');
2765
-		} else $offset = '+00:00';
2909
+		} else {
2910
+			$offset = '+00:00';
2911
+		}
2766 2912
 		if ($airport_icao == '') {
2767 2913
 			if ($globalDBdriver == 'mysql') {
2768 2914
 				$query = "SELECT spotter_output.airline_icao, COUNT(departure_airport_icao) AS departure_airport_count, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date FROM `spotter_output` WHERE spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 7 DAY) AND departure_airport_icao <> 'NA' AND spotter_output.airline_icao <> '' GROUP BY spotter_output.airline_icao, departure_airport_icao, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d'), departure_airport_name, departure_airport_city, departure_airport_country ORDER BY departure_airport_count DESC";
@@ -2795,7 +2941,9 @@  discard block
 block discarded – undo
2795 2941
 			date_default_timezone_set($globalTimezone);
2796 2942
 			$datetime = new DateTime();
2797 2943
 			$offset = $datetime->format('P');
2798
-		} else $offset = '+00:00';
2944
+		} else {
2945
+			$offset = '+00:00';
2946
+		}
2799 2947
 		if ($airport_icao == '') {
2800 2948
 			if ($globalDBdriver == 'mysql') {
2801 2949
 				$query = "SELECT COUNT(real_departure_airport_icao) AS departure_airport_count, real_departure_airport_icao AS departure_airport_icao, airport.name AS departure_airport_name, airport.city AS departure_airport_city, airport.country AS departure_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date 
@@ -2834,7 +2982,9 @@  discard block
 block discarded – undo
2834 2982
 			date_default_timezone_set($globalTimezone);
2835 2983
 			$datetime = new DateTime();
2836 2984
 			$offset = $datetime->format('P');
2837
-		} else $offset = '+00:00';
2985
+		} else {
2986
+			$offset = '+00:00';
2987
+		}
2838 2988
 		if ($airport_icao == '') {
2839 2989
 			if ($globalDBdriver == 'mysql') {
2840 2990
 				$query = "SELECT spotter_output.airline_icao, COUNT(real_departure_airport_icao) AS departure_airport_count, real_departure_airport_icao AS departure_airport_icao, airport.name AS departure_airport_name, airport.city AS departure_airport_city, airport.country AS departure_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date 
@@ -2879,7 +3029,9 @@  discard block
 block discarded – undo
2879 3029
 			date_default_timezone_set($globalTimezone);
2880 3030
 			$datetime = new DateTime();
2881 3031
 			$offset = $datetime->format('P');
2882
-		} else $offset = '+00:00';
3032
+		} else {
3033
+			$offset = '+00:00';
3034
+		}
2883 3035
 		if ($airport_icao == '') {
2884 3036
 			if ($globalDBdriver == 'mysql') {
2885 3037
 				$query = "SELECT COUNT(arrival_airport_icao) AS arrival_airport_count, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date FROM `spotter_output`".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 7 DAY) AND arrival_airport_icao <> 'NA' GROUP BY arrival_airport_icao, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d'), arrival_airport_name, arrival_airport_city, arrival_airport_country ORDER BY arrival_airport_count DESC";
@@ -2914,7 +3066,9 @@  discard block
 block discarded – undo
2914 3066
 			date_default_timezone_set($globalTimezone);
2915 3067
 			$datetime = new DateTime();
2916 3068
 			$offset = $datetime->format('P');
2917
-		} else $offset = '+00:00';
3069
+		} else {
3070
+			$offset = '+00:00';
3071
+		}
2918 3072
 		if ($airport_icao == '') {
2919 3073
 			if ($globalDBdriver == 'mysql') {
2920 3074
 				$query = "SELECT COUNT(real_arrival_airport_icao) AS arrival_airport_count, real_arrival_airport_icao AS arrival_airport_icao, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date 
@@ -2956,7 +3110,9 @@  discard block
 block discarded – undo
2956 3110
 			date_default_timezone_set($globalTimezone);
2957 3111
 			$datetime = new DateTime();
2958 3112
 			$offset = $datetime->format('P');
2959
-		} else $offset = '+00:00';
3113
+		} else {
3114
+			$offset = '+00:00';
3115
+		}
2960 3116
 		if ($airport_icao == '') {
2961 3117
 			if ($globalDBdriver == 'mysql') {
2962 3118
 				$query = "SELECT spotter_output.airline_icao, COUNT(arrival_airport_icao) AS arrival_airport_count, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date FROM `spotter_output` WHERE spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 7 DAY) AND arrival_airport_icao <> 'NA' AND spotter_output.airline_icao <> '' GROUP BY spotter_output.airline_icao, arrival_airport_icao, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d'), arrival_airport_name, arrival_airport_city, arrival_airport_country ORDER BY arrival_airport_count DESC";
@@ -2990,7 +3146,9 @@  discard block
 block discarded – undo
2990 3146
 			date_default_timezone_set($globalTimezone);
2991 3147
 			$datetime = new DateTime();
2992 3148
 			$offset = $datetime->format('P');
2993
-		} else $offset = '+00:00';
3149
+		} else {
3150
+			$offset = '+00:00';
3151
+		}
2994 3152
 		if ($airport_icao == '') {
2995 3153
 			if ($globalDBdriver == 'mysql') {
2996 3154
 				$query = "SELECT spotter_output.airline_icao, COUNT(real_arrival_airport_icao) AS arrival_airport_count, real_arrival_airport_icao AS arrival_airport_icao, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date 
@@ -3038,7 +3196,9 @@  discard block
 block discarded – undo
3038 3196
 			date_default_timezone_set($globalTimezone);
3039 3197
 			$datetime = new DateTime();
3040 3198
 			$offset = $datetime->format('P');
3041
-		} else $offset = '+00:00';
3199
+		} else {
3200
+			$offset = '+00:00';
3201
+		}
3042 3202
 
3043 3203
 		if ($globalDBdriver == 'mysql') {
3044 3204
 			$query  = "SELECT DISTINCT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) as date
@@ -3158,7 +3318,9 @@  discard block
 block discarded – undo
3158 3318
 	*/	
3159 3319
 	public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '',$arrival_airport_time = '')
3160 3320
 	{
3161
-		if ($groundspeed == '') $groundspeed = NULL;
3321
+		if ($groundspeed == '') {
3322
+			$groundspeed = NULL;
3323
+		}
3162 3324
 		$query = 'UPDATE spotter_output SET ident = :ident, last_latitude = :last_latitude, last_longitude = :last_longitude, last_altitude = :last_altitude, last_ground = :last_ground, last_seen = :last_seen, real_arrival_airport_icao = :real_arrival_airport_icao, real_arrival_airport_time = :real_arrival_airport_time, last_ground_speed = :last_ground_speed WHERE flightaware_id = :flightaware_id';
3163 3325
                 $query_values = array(':flightaware_id' => $flightaware_id,':real_arrival_airport_icao' => $arrival_airport_icao,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_altitude' => $altitude,':last_ground_speed' => $groundspeed,':last_seen' => $date,':real_arrival_airport_time' => $arrival_airport_time, ':last_ground' => $ground, ':ident' => $ident);
3164 3326
 
@@ -3208,10 +3370,18 @@  discard block
 block discarded – undo
3208 3370
 		$Image = new Image($this->db);
3209 3371
 		$Common = new Common();
3210 3372
 		
3211
-		if (!isset($globalIVAO)) $globalIVAO = FALSE;
3212
-		if (!isset($globalVATSIM)) $globalVATSIM = FALSE;
3213
-		if (!isset($globalphpVMS)) $globalphpVMS = FALSE;
3214
-		if (!isset($globalVAM)) $globalVAM = FALSE;
3373
+		if (!isset($globalIVAO)) {
3374
+			$globalIVAO = FALSE;
3375
+		}
3376
+		if (!isset($globalVATSIM)) {
3377
+			$globalVATSIM = FALSE;
3378
+		}
3379
+		if (!isset($globalphpVMS)) {
3380
+			$globalphpVMS = FALSE;
3381
+		}
3382
+		if (!isset($globalVAM)) {
3383
+			$globalVAM = FALSE;
3384
+		}
3215 3385
 		date_default_timezone_set('UTC');
3216 3386
 		
3217 3387
 		//getting the registration
@@ -3224,23 +3394,33 @@  discard block
 block discarded – undo
3224 3394
 				if ($ModeS != '') {
3225 3395
 					$timeelapsed = microtime(true);
3226 3396
 					$registration = $this->getAircraftRegistrationBymodeS($ModeS);
3227
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3397
+					if ($globalDebugTimeElapsed) {
3398
+						echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3399
+					}
3228 3400
 				} else {
3229 3401
 					$myhex = explode('-',$flightaware_id);
3230 3402
 					if (count($myhex) > 0) {
3231 3403
 						$timeelapsed = microtime(true);
3232 3404
 						$registration = $this->getAircraftRegistrationBymodeS($myhex[0]);
3233
-						if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3405
+						if ($globalDebugTimeElapsed) {
3406
+							echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3407
+						}
3234 3408
 					}
3235 3409
 				}
3236 3410
 			}
3237 3411
 		}
3238 3412
 		$fromsource = NULL;
3239
-		if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource;
3240
-		elseif ($format_source == 'vatsimtxt') $fromsource = 'vatsim';
3241
-		elseif ($format_source == 'whazzup') $fromsource = 'ivao';
3242
-		elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim';
3243
-		elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao';
3413
+		if (isset($globalAirlinesSource) && $globalAirlinesSource != '') {
3414
+			$fromsource = $globalAirlinesSource;
3415
+		} elseif ($format_source == 'vatsimtxt') {
3416
+			$fromsource = 'vatsim';
3417
+		} elseif ($format_source == 'whazzup') {
3418
+			$fromsource = 'ivao';
3419
+		} elseif (isset($globalVATSIM) && $globalVATSIM) {
3420
+			$fromsource = 'vatsim';
3421
+		} elseif (isset($globalIVAO) && $globalIVAO) {
3422
+			$fromsource = 'ivao';
3423
+		}
3244 3424
 		//getting the airline information
3245 3425
 		if ($ident != "")
3246 3426
 		{
@@ -3264,15 +3444,21 @@  discard block
 block discarded – undo
3264 3444
 					if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == ""){
3265 3445
 						$airline_array = $this->getAllAirlineInfo("NA");
3266 3446
 					}
3267
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3447
+					if ($globalDebugTimeElapsed) {
3448
+						echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3449
+					}
3268 3450
 
3269 3451
 				} else {
3270 3452
 					$timeelapsed = microtime(true);
3271 3453
 					$airline_array = $this->getAllAirlineInfo("NA");
3272
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3454
+					if ($globalDebugTimeElapsed) {
3455
+						echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3456
+					}
3273 3457
 				}
3274 3458
 			}
3275
-		} else $airline_array = array();
3459
+		} else {
3460
+			$airline_array = array();
3461
+		}
3276 3462
 		
3277 3463
 		//getting the aircraft information
3278 3464
 		$aircraft_array = array();
@@ -3286,27 +3472,37 @@  discard block
 block discarded – undo
3286 3472
 				{
3287 3473
 					$timeelapsed = microtime(true);
3288 3474
 					$aircraft_array = $this->getAllAircraftInfo("NA");
3289
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3475
+					if ($globalDebugTimeElapsed) {
3476
+						echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3477
+					}
3290 3478
 				} else {
3291 3479
 					$timeelapsed = microtime(true);
3292 3480
 					$aircraft_array = $this->getAllAircraftInfo($aircraft_icao);
3293
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3481
+					if ($globalDebugTimeElapsed) {
3482
+						echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3483
+					}
3294 3484
 				}
3295 3485
 			}
3296 3486
 		} else {
3297 3487
 			if ($ModeS != '') {
3298 3488
 				$timeelapsed = microtime(true);
3299 3489
 				$aircraft_icao = $this->getAllAircraftType($ModeS);
3300
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3490
+				if ($globalDebugTimeElapsed) {
3491
+					echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3492
+				}
3301 3493
 				if ($aircraft_icao == "" || $aircraft_icao == "XXXX")
3302 3494
 				{
3303 3495
 					$timeelapsed = microtime(true);
3304 3496
 					$aircraft_array = $this->getAllAircraftInfo("NA");
3305
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3497
+					if ($globalDebugTimeElapsed) {
3498
+						echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3499
+					}
3306 3500
 				} else {
3307 3501
 					$timeelapsed = microtime(true);
3308 3502
 					$aircraft_array = $this->getAllAircraftInfo($aircraft_icao);
3309
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3503
+					if ($globalDebugTimeElapsed) {
3504
+						echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3505
+					}
3310 3506
 				}
3311 3507
 			}
3312 3508
 		}
@@ -3321,7 +3517,9 @@  discard block
 block discarded – undo
3321 3517
 			} else {
3322 3518
 				$timeelapsed = microtime(true);
3323 3519
 				$departure_airport_array = $this->getAllAirportInfo($departure_airport_icao);
3324
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3520
+				if ($globalDebugTimeElapsed) {
3521
+					echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3522
+				}
3325 3523
 			}
3326 3524
 		}
3327 3525
 		
@@ -3335,7 +3533,9 @@  discard block
 block discarded – undo
3335 3533
 			} else {
3336 3534
 				$timeelapsed = microtime(true);
3337 3535
 				$arrival_airport_array = $this->getAllAirportInfo($arrival_airport_icao);
3338
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3536
+				if ($globalDebugTimeElapsed) {
3537
+					echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3538
+				}
3339 3539
 			}
3340 3540
 		}
3341 3541
 
@@ -3370,7 +3570,9 @@  discard block
 block discarded – undo
3370 3570
 			{
3371 3571
 				return false;
3372 3572
 			}
3373
-		} else $altitude = 0;
3573
+		} else {
3574
+			$altitude = 0;
3575
+		}
3374 3576
 		
3375 3577
 		if ($heading != "")
3376 3578
 		{
@@ -3399,7 +3601,9 @@  discard block
 block discarded – undo
3399 3601
 		{
3400 3602
 			$timeelapsed = microtime(true);
3401 3603
 			$image_array = $Image->getSpotterImage($registration);
3402
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3604
+			if ($globalDebugTimeElapsed) {
3605
+				echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3606
+			}
3403 3607
 			if (!isset($image_array[0]['registration']))
3404 3608
 			{
3405 3609
 				//echo "Add image !!!! \n";
@@ -3407,14 +3611,21 @@  discard block
 block discarded – undo
3407 3611
 			}
3408 3612
 			$timeelapsed = microtime(true);
3409 3613
 			$owner_info = $this->getAircraftOwnerByRegistration($registration);
3410
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3411
-			if ($owner_info['owner'] != '') $aircraft_owner = ucwords(strtolower($owner_info['owner']));
3614
+			if ($globalDebugTimeElapsed) {
3615
+				echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3616
+			}
3617
+			if ($owner_info['owner'] != '') {
3618
+				$aircraft_owner = ucwords(strtolower($owner_info['owner']));
3619
+			}
3412 3620
 		}
3413 3621
     
3414 3622
 		if ($globalIVAO && $aircraft_icao != '')
3415 3623
 		{
3416
-            		if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao'];
3417
-            		else $airline_icao = '';
3624
+            		if (isset($airline_array[0]['icao'])) {
3625
+            			$airline_icao = $airline_array[0]['icao'];
3626
+            		} else {
3627
+            			$airline_icao = '';
3628
+            		}
3418 3629
 			$image_array = $Image->getSpotterImage('',$aircraft_icao,$airline_icao);
3419 3630
 			if (!isset($image_array[0]['registration']))
3420 3631
 			{
@@ -3459,12 +3670,24 @@  discard block
 block discarded – undo
3459 3670
                 {
3460 3671
                         $arrival_airport_array = $this->getAllAirportInfo('NA');
3461 3672
                 }
3462
-                if ($registration == '') $registration = 'NA';
3463
-                if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL;
3464
-                if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL;
3465
-                if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
3466
-                if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
3467
-                if (!isset($aircraft_owner)) $aircraft_owner = NULL;
3673
+                if ($registration == '') {
3674
+                	$registration = 'NA';
3675
+                }
3676
+                if ($squawk == '' || $Common->isInteger($squawk) === false) {
3677
+                	$squawk = NULL;
3678
+                }
3679
+                if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) {
3680
+                	$verticalrate = NULL;
3681
+                }
3682
+                if ($heading == '' || $Common->isInteger($heading) === false) {
3683
+                	$heading = 0;
3684
+                }
3685
+                if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) {
3686
+                	$groundspeed = 0;
3687
+                }
3688
+                if (!isset($aircraft_owner)) {
3689
+                	$aircraft_owner = NULL;
3690
+                }
3468 3691
                 $query  = "INSERT INTO spotter_output (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, latitude, longitude, waypoints, altitude, heading, ground_speed, date, departure_airport_time, arrival_airport_time, squawk, route_stop,highlight,ModeS, pilot_id, pilot_name, verticalrate, owner_name, ground, format_source, source_name) 
3469 3692
                 VALUES (:flightaware_id,:ident,:registration,:airline_name,:airline_icao,:airline_country,:airline_type,:aircraft_icao,:aircraft_type,:aircraft_manufacturer,:departure_airport_icao,:departure_airport_name,:departure_airport_city,:departure_airport_country, :arrival_airport_icao, :arrival_airport_name, :arrival_airport_city, :arrival_airport_country, :latitude,:longitude,:waypoints,:altitude,:heading,:groundspeed,:date, :departure_airport_time, :arrival_airport_time, :squawk, :route_stop, :highlight, :ModeS, :pilot_id, :pilot_name, :verticalrate, :owner_name,:ground, :format_source, :source_name)";
3470 3693
 
@@ -3475,9 +3698,13 @@  discard block
 block discarded – undo
3475 3698
 		if ($airline_type == '') {
3476 3699
 			$timeelapsed = microtime(true);
3477 3700
 			$airline_type = $this->getAircraftTypeBymodeS($ModeS);
3478
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3701
+			if ($globalDebugTimeElapsed) {
3702
+				echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3703
+			}
3704
+		}
3705
+		if ($airline_type == null) {
3706
+			$airline_type = '';
3479 3707
 		}
3480
-		if ($airline_type == null) $airline_type = '';
3481 3708
                 $aircraft_type = $aircraft_array[0]['type'];
3482 3709
                 $aircraft_manufacturer = $aircraft_array[0]['manufacturer'];
3483 3710
                 $departure_airport_name = $departure_airport_array[0]['name'];
@@ -3612,7 +3839,9 @@  discard block
 block discarded – undo
3612 3839
 			}
3613 3840
 		}
3614 3841
 		$query .= "GROUP BY spotter_output.airline_name,spotter_output.airline_icao, spotter_output.airline_country ORDER BY airline_count DESC";
3615
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
3842
+		if ($limit) {
3843
+			$query .= " LIMIT 10 OFFSET 0";
3844
+		}
3616 3845
 		
3617 3846
 		$sth = $this->db->prepare($query);
3618 3847
 		$sth->execute();
@@ -3657,7 +3886,9 @@  discard block
 block discarded – undo
3657 3886
 			}
3658 3887
 		}
3659 3888
 		$query .= "GROUP BY spotter_output.pilot_id,spotter_output.pilot_name ORDER BY pilot_count DESC";
3660
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
3889
+		if ($limit) {
3890
+			$query .= " LIMIT 10 OFFSET 0";
3891
+		}
3661 3892
       
3662 3893
 		
3663 3894
 		$sth = $this->db->prepare($query);
@@ -3702,7 +3933,9 @@  discard block
 block discarded – undo
3702 3933
 			}
3703 3934
 		}
3704 3935
 		$query .= "GROUP BY spotter_output.airline_icao, spotter_output.pilot_id,spotter_output.pilot_name ORDER BY pilot_count DESC";
3705
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
3936
+		if ($limit) {
3937
+			$query .= " LIMIT 10 OFFSET 0";
3938
+		}
3706 3939
       
3707 3940
 		
3708 3941
 		$sth = $this->db->prepare($query);
@@ -3749,7 +3982,9 @@  discard block
 block discarded – undo
3749 3982
 			}
3750 3983
 		}
3751 3984
 		$query .= "GROUP BY spotter_output.owner_name ORDER BY owner_count DESC";
3752
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
3985
+		if ($limit) {
3986
+			$query .= " LIMIT 10 OFFSET 0";
3987
+		}
3753 3988
       
3754 3989
 		
3755 3990
 		$sth = $this->db->prepare($query);
@@ -3794,7 +4029,9 @@  discard block
 block discarded – undo
3794 4029
 			}
3795 4030
 		}
3796 4031
 		$query .= "GROUP BY spotter_output.airline_icao, spotter_output.owner_name ORDER BY owner_count DESC";
3797
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4032
+		if ($limit) {
4033
+			$query .= " LIMIT 10 OFFSET 0";
4034
+		}
3798 4035
       
3799 4036
 		
3800 4037
 		$sth = $this->db->prepare($query);
@@ -4037,7 +4274,9 @@  discard block
 block discarded – undo
4037 4274
 			date_default_timezone_set($globalTimezone);
4038 4275
 			$datetime = new DateTime($date);
4039 4276
 			$offset = $datetime->format('P');
4040
-		} else $offset = '+00:00';
4277
+		} else {
4278
+			$offset = '+00:00';
4279
+		}
4041 4280
 
4042 4281
 		if ($globalDBdriver == 'mysql') {
4043 4282
 			$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
@@ -4085,7 +4324,9 @@  discard block
 block discarded – undo
4085 4324
 			date_default_timezone_set($globalTimezone);
4086 4325
 			$datetime = new DateTime($date);
4087 4326
 			$offset = $datetime->format('P');
4088
-		} else $offset = '+00:00';
4327
+		} else {
4328
+			$offset = '+00:00';
4329
+		}
4089 4330
 		
4090 4331
 		if ($globalDBdriver == 'mysql') {
4091 4332
 			$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
@@ -4303,7 +4544,9 @@  discard block
 block discarded – undo
4303 4544
 		 			FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND spotter_output.airline_country <> 'NA' 
4304 4545
 					GROUP BY spotter_output.airline_country
4305 4546
 					ORDER BY airline_country_count DESC";
4306
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4547
+		if ($limit) {
4548
+			$query .= " LIMIT 10 OFFSET 0";
4549
+		}
4307 4550
       
4308 4551
 		$sth = $this->db->prepare($query);
4309 4552
 		$sth->execute();
@@ -4331,7 +4574,9 @@  discard block
 block discarded – undo
4331 4574
 		global $globalDBdriver;
4332 4575
 		//$filter_query = $this->getFilter($filters,true,true);
4333 4576
 		$Connection= new Connection($this->db);
4334
-		if (!$Connection->tableExists('countries')) return array();
4577
+		if (!$Connection->tableExists('countries')) {
4578
+			return array();
4579
+		}
4335 4580
 		/*
4336 4581
 		$query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb 
4337 4582
 					FROM countries c, spotter_output s
@@ -4356,7 +4601,9 @@  discard block
 block discarded – undo
4356 4601
 		}
4357 4602
 
4358 4603
 		$query .= "GROUP BY c.name ORDER BY nb DESC";
4359
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4604
+		if ($limit) {
4605
+			$query .= " LIMIT 10 OFFSET 0";
4606
+		}
4360 4607
       
4361 4608
 		
4362 4609
 		$sth = $this->db->prepare($query);
@@ -4406,7 +4653,9 @@  discard block
 block discarded – undo
4406 4653
 		}
4407 4654
 
4408 4655
 		$query .= " GROUP BY spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer ORDER BY aircraft_icao_count DESC";
4409
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4656
+		if ($limit) {
4657
+			$query .= " LIMIT 10 OFFSET 0";
4658
+		}
4410 4659
  
4411 4660
 		$sth = $this->db->prepare($query);
4412 4661
 		$sth->execute();
@@ -4452,7 +4701,9 @@  discard block
 block discarded – undo
4452 4701
 		}
4453 4702
 
4454 4703
 		$query .= "GROUP BY spotter_output.airline_icao, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer ORDER BY aircraft_icao_count DESC";
4455
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4704
+		if ($limit) {
4705
+			$query .= " LIMIT 10 OFFSET 0";
4706
+		}
4456 4707
  
4457 4708
 		$sth = $this->db->prepare($query);
4458 4709
 		$sth->execute();
@@ -4505,7 +4756,9 @@  discard block
 block discarded – undo
4505 4756
 			if($row['registration'] != "")
4506 4757
 			{
4507 4758
 				$image_array = $Image->getSpotterImage($row['registration']);
4508
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
4759
+				if (isset($image_array[0]['image_thumbnail'])) {
4760
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
4761
+				}
4509 4762
 			}
4510 4763
 			$temp_array['registration_count'] = $row['registration_count'];
4511 4764
 
@@ -4580,7 +4833,9 @@  discard block
 block discarded – undo
4580 4833
 			if($row['registration'] != "")
4581 4834
 			{
4582 4835
 				$image_array = $Image->getSpotterImage($row['registration']);
4583
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
4836
+				if (isset($image_array[0]['image_thumbnail'])) {
4837
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
4838
+				}
4584 4839
 			}
4585 4840
 			$temp_array['registration_count'] = $row['registration_count'];
4586 4841
 
@@ -4687,7 +4942,9 @@  discard block
 block discarded – undo
4687 4942
 			if($row['registration'] != "")
4688 4943
 			{
4689 4944
 				$image_array = $Image->getSpotterImage($row['registration']);
4690
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
4945
+				if (isset($image_array[0]['image_thumbnail'])) {
4946
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
4947
+				}
4691 4948
 			}
4692 4949
 			$temp_array['registration_count'] = $row['registration_count'];
4693 4950
 			$aircraft_array[] = $temp_array;
@@ -4812,7 +5069,9 @@  discard block
 block discarded – undo
4812 5069
 			date_default_timezone_set($globalTimezone);
4813 5070
 			$datetime = new DateTime($date);
4814 5071
 			$offset = $datetime->format('P');
4815
-		} else $offset = '+00:00';
5072
+		} else {
5073
+			$offset = '+00:00';
5074
+		}
4816 5075
 
4817 5076
 		if ($globalDBdriver == 'mysql') {
4818 5077
 			$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
@@ -4859,7 +5118,9 @@  discard block
 block discarded – undo
4859 5118
 			date_default_timezone_set($globalTimezone);
4860 5119
 			$datetime = new DateTime($date);
4861 5120
 			$offset = $datetime->format('P');
4862
-		} else $offset = '+00:00';
5121
+		} else {
5122
+			$offset = '+00:00';
5123
+		}
4863 5124
 
4864 5125
 		if ($globalDBdriver == 'mysql') {
4865 5126
 			$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name 
@@ -4888,7 +5149,9 @@  discard block
 block discarded – undo
4888 5149
 			if($row['registration'] != "")
4889 5150
 			{
4890 5151
 				$image_array = $Image->getSpotterImage($row['registration']);
4891
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5152
+				if (isset($image_array[0]['image_thumbnail'])) {
5153
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5154
+				}
4892 5155
 			}
4893 5156
 			$temp_array['registration_count'] = $row['registration_count'];
4894 5157
  
@@ -4913,7 +5176,9 @@  discard block
 block discarded – undo
4913 5176
 			date_default_timezone_set($globalTimezone);
4914 5177
 			$datetime = new DateTime($date);
4915 5178
 			$offset = $datetime->format('P');
4916
-		} else $offset = '+00:00';
5179
+		} else {
5180
+			$offset = '+00:00';
5181
+		}
4917 5182
 
4918 5183
 		if ($globalDBdriver == 'mysql') {
4919 5184
 			$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
@@ -5011,8 +5276,11 @@  discard block
 block discarded – undo
5011 5276
 			if($row['registration'] != "")
5012 5277
 			{
5013 5278
 				$image_array = $Image->getSpotterImage($row['registration']);
5014
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5015
-				else $temp_array['image_thumbnail'] = '';
5279
+				if (isset($image_array[0]['image_thumbnail'])) {
5280
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5281
+				} else {
5282
+					$temp_array['image_thumbnail'] = '';
5283
+				}
5016 5284
 			}
5017 5285
 			$temp_array['registration_count'] = $row['registration_count'];
5018 5286
 			$aircraft_array[] = $temp_array;
@@ -5119,7 +5387,9 @@  discard block
 block discarded – undo
5119 5387
 			if($row['registration'] != "")
5120 5388
 			{
5121 5389
 				$image_array = $Image->getSpotterImage($row['registration']);
5122
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5390
+				if (isset($image_array[0]['image_thumbnail'])) {
5391
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5392
+				}
5123 5393
 			}
5124 5394
 			$temp_array['registration_count'] = $row['registration_count'];
5125 5395
           
@@ -5236,7 +5506,9 @@  discard block
 block discarded – undo
5236 5506
 			if($row['registration'] != "")
5237 5507
 			{
5238 5508
 				$image_array = $Image->getSpotterImage($row['registration']);
5239
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5509
+				if (isset($image_array[0]['image_thumbnail'])) {
5510
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5511
+				}
5240 5512
 			}
5241 5513
 			$temp_array['registration_count'] = $row['registration_count'];
5242 5514
           
@@ -5348,7 +5620,9 @@  discard block
 block discarded – undo
5348 5620
 		// if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5349 5621
 		//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5350 5622
                 $query .= " GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC";
5351
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5623
+		if ($limit) {
5624
+			$query .= " LIMIT 10 OFFSET 0";
5625
+		}
5352 5626
 		
5353 5627
 		$sth = $this->db->prepare($query);
5354 5628
 		$sth->execute();
@@ -5367,7 +5641,9 @@  discard block
 block discarded – undo
5367 5641
 			if($row['registration'] != "")
5368 5642
 			{
5369 5643
 				$image_array = $Image->getSpotterImage($row['registration']);
5370
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5644
+				if (isset($image_array[0]['image_thumbnail'])) {
5645
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5646
+				}
5371 5647
 			}
5372 5648
           
5373 5649
 			$aircraft_array[] = $temp_array;
@@ -5408,7 +5684,9 @@  discard block
 block discarded – undo
5408 5684
 		// if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5409 5685
 		//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5410 5686
                 $query .= "GROUP BY spotter_output.airline_icao, spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC";
5411
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5687
+		if ($limit) {
5688
+			$query .= " LIMIT 10 OFFSET 0";
5689
+		}
5412 5690
 		
5413 5691
 		$sth = $this->db->prepare($query);
5414 5692
 		$sth->execute();
@@ -5428,7 +5706,9 @@  discard block
 block discarded – undo
5428 5706
 			if($row['registration'] != "")
5429 5707
 			{
5430 5708
 				$image_array = $Image->getSpotterImage($row['registration']);
5431
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5709
+				if (isset($image_array[0]['image_thumbnail'])) {
5710
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5711
+				}
5432 5712
 			}
5433 5713
           
5434 5714
 			$aircraft_array[] = $temp_array;
@@ -5469,7 +5749,9 @@  discard block
 block discarded – undo
5469 5749
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5470 5750
                 $query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
5471 5751
 				ORDER BY airport_departure_icao_count DESC";
5472
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5752
+		if ($limit) {
5753
+			$query .= " LIMIT 10 OFFSET 0";
5754
+		}
5473 5755
       
5474 5756
 		$sth = $this->db->prepare($query);
5475 5757
 		$sth->execute();
@@ -5521,7 +5803,9 @@  discard block
 block discarded – undo
5521 5803
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5522 5804
                 $query .= "GROUP BY spotter_output.airline_icao, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
5523 5805
 				ORDER BY airport_departure_icao_count DESC";
5524
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5806
+		if ($limit) {
5807
+			$query .= " LIMIT 10 OFFSET 0";
5808
+		}
5525 5809
       
5526 5810
 		$sth = $this->db->prepare($query);
5527 5811
 		$sth->execute();
@@ -5573,7 +5857,9 @@  discard block
 block discarded – undo
5573 5857
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5574 5858
                 $query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
5575 5859
 				ORDER BY airport_departure_icao_count DESC";
5576
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5860
+		if ($limit) {
5861
+			$query .= " LIMIT 10 OFFSET 0";
5862
+		}
5577 5863
     		//echo $query;
5578 5864
 		$sth = $this->db->prepare($query);
5579 5865
 		$sth->execute();
@@ -5625,7 +5911,9 @@  discard block
 block discarded – undo
5625 5911
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5626 5912
                 $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
5627 5913
 				ORDER BY airport_departure_icao_count DESC";
5628
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5914
+		if ($limit) {
5915
+			$query .= " LIMIT 10 OFFSET 0";
5916
+		}
5629 5917
       
5630 5918
 		$sth = $this->db->prepare($query);
5631 5919
 		$sth->execute();
@@ -6020,7 +6308,9 @@  discard block
 block discarded – undo
6020 6308
 			date_default_timezone_set($globalTimezone);
6021 6309
 			$datetime = new DateTime($date);
6022 6310
 			$offset = $datetime->format('P');
6023
-		} else $offset = '+00:00';
6311
+		} else {
6312
+			$offset = '+00:00';
6313
+		}
6024 6314
 
6025 6315
 		if ($globalDBdriver == 'mysql') {
6026 6316
 			$query  = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
@@ -6070,7 +6360,9 @@  discard block
 block discarded – undo
6070 6360
 			date_default_timezone_set($globalTimezone);
6071 6361
 			$datetime = new DateTime($date);
6072 6362
 			$offset = $datetime->format('P');
6073
-		} else $offset = '+00:00';
6363
+		} else {
6364
+			$offset = '+00:00';
6365
+		}
6074 6366
 
6075 6367
 		if ($globalDBdriver == 'mysql') {
6076 6368
 			$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
@@ -6283,7 +6575,9 @@  discard block
 block discarded – undo
6283 6575
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6284 6576
                 $query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
6285 6577
 					ORDER BY airport_arrival_icao_count DESC";
6286
-		if ($limit) $query .= " LIMIT 10";
6578
+		if ($limit) {
6579
+			$query .= " LIMIT 10";
6580
+		}
6287 6581
       
6288 6582
 		
6289 6583
 		$sth = $this->db->prepare($query);
@@ -6303,7 +6597,9 @@  discard block
 block discarded – undo
6303 6597
 			if ($icaoaskey) {
6304 6598
 				$icao = $row['arrival_airport_icao'];
6305 6599
 				$airport_array[$icao] = $temp_array;
6306
-			} else $airport_array[] = $temp_array;
6600
+			} else {
6601
+				$airport_array[] = $temp_array;
6602
+			}
6307 6603
 		}
6308 6604
 
6309 6605
 		return $airport_array;
@@ -6345,7 +6641,9 @@  discard block
 block discarded – undo
6345 6641
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6346 6642
                 $query .= "GROUP BY spotter_output.airline_icao,spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
6347 6643
 					ORDER BY airport_arrival_icao_count DESC";
6348
-		if ($limit) $query .= " LIMIT 10";
6644
+		if ($limit) {
6645
+			$query .= " LIMIT 10";
6646
+		}
6349 6647
       
6350 6648
 		
6351 6649
 		$sth = $this->db->prepare($query);
@@ -6366,7 +6664,9 @@  discard block
 block discarded – undo
6366 6664
 			if ($icaoaskey) {
6367 6665
 				$icao = $row['arrival_airport_icao'];
6368 6666
 				$airport_array[$icao] = $temp_array;
6369
-			} else $airport_array[] = $temp_array;
6667
+			} else {
6668
+				$airport_array[] = $temp_array;
6669
+			}
6370 6670
 		}
6371 6671
 
6372 6672
 		return $airport_array;
@@ -6408,7 +6708,9 @@  discard block
 block discarded – undo
6408 6708
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6409 6709
                 $query .= " GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
6410 6710
 					ORDER BY airport_arrival_icao_count DESC";
6411
-		if ($limit) $query .= " LIMIT 10";
6711
+		if ($limit) {
6712
+			$query .= " LIMIT 10";
6713
+		}
6412 6714
       
6413 6715
 		
6414 6716
 		$sth = $this->db->prepare($query);
@@ -6428,7 +6730,9 @@  discard block
 block discarded – undo
6428 6730
 			if ($icaoaskey) {
6429 6731
 				$icao = $row['arrival_airport_icao'];
6430 6732
 				$airport_array[$icao] = $temp_array;
6431
-			} else $airport_array[] = $temp_array;
6733
+			} else {
6734
+				$airport_array[] = $temp_array;
6735
+			}
6432 6736
 		}
6433 6737
 
6434 6738
 		return $airport_array;
@@ -6470,7 +6774,9 @@  discard block
 block discarded – undo
6470 6774
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6471 6775
                 $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
6472 6776
 					ORDER BY airport_arrival_icao_count DESC";
6473
-		if ($limit) $query .= " LIMIT 10";
6777
+		if ($limit) {
6778
+			$query .= " LIMIT 10";
6779
+		}
6474 6780
       
6475 6781
 		
6476 6782
 		$sth = $this->db->prepare($query);
@@ -6491,7 +6797,9 @@  discard block
 block discarded – undo
6491 6797
 			if ($icaoaskey) {
6492 6798
 				$icao = $row['arrival_airport_icao'];
6493 6799
 				$airport_array[$icao] = $temp_array;
6494
-			} else $airport_array[] = $temp_array;
6800
+			} else {
6801
+				$airport_array[] = $temp_array;
6802
+			}
6495 6803
 		}
6496 6804
 
6497 6805
 		return $airport_array;
@@ -6872,7 +7180,9 @@  discard block
 block discarded – undo
6872 7180
 			date_default_timezone_set($globalTimezone);
6873 7181
 			$datetime = new DateTime($date);
6874 7182
 			$offset = $datetime->format('P');
6875
-		} else $offset = '+00:00';
7183
+		} else {
7184
+			$offset = '+00:00';
7185
+		}
6876 7186
 
6877 7187
 		if ($globalDBdriver == 'mysql') {
6878 7188
 			$query  = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
@@ -6922,7 +7232,9 @@  discard block
 block discarded – undo
6922 7232
 			date_default_timezone_set($globalTimezone);
6923 7233
 			$datetime = new DateTime($date);
6924 7234
 			$offset = $datetime->format('P');
6925
-		} else $offset = '+00:00';
7235
+		} else {
7236
+			$offset = '+00:00';
7237
+		}
6926 7238
 
6927 7239
 		if ($globalDBdriver == 'mysql') {
6928 7240
 			$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
@@ -7145,7 +7457,9 @@  discard block
 block discarded – undo
7145 7457
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.arrival_airport_icao <> 'NA'";
7146 7458
 		$query .= " GROUP BY spotter_output.arrival_airport_country
7147 7459
 					ORDER BY airport_arrival_country_count DESC";
7148
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
7460
+		if ($limit) {
7461
+			$query .= " LIMIT 10 OFFSET 0";
7462
+		}
7149 7463
       
7150 7464
 		
7151 7465
 		$sth = $this->db->prepare($query);
@@ -7432,7 +7746,9 @@  discard block
 block discarded – undo
7432 7746
 			date_default_timezone_set($globalTimezone);
7433 7747
 			$datetime = new DateTime($date);
7434 7748
 			$offset = $datetime->format('P');
7435
-		} else $offset = '+00:00';
7749
+		} else {
7750
+			$offset = '+00:00';
7751
+		}
7436 7752
 		
7437 7753
 		if ($globalDBdriver == 'mysql') {
7438 7754
 			$query  = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
@@ -7608,15 +7924,23 @@  discard block
 block discarded – undo
7608 7924
 		$query  = "SELECT DISTINCT spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name, spotter_output.airline_icao  
7609 7925
                     FROM spotter_output".$filter_query." spotter_output.ident <> '' ";
7610 7926
 		 if ($olderthanmonths > 0) {
7611
-			if ($globalDBdriver == 'mysql') $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)';
7612
-			else $query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
7927
+			if ($globalDBdriver == 'mysql') {
7928
+				$query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)';
7929
+			} else {
7930
+				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
7931
+			}
7613 7932
 		}
7614 7933
 		if ($sincedate != '') {
7615
-			if ($globalDBdriver == 'mysql') $query .= " AND spotter_output.date > '".$sincedate."'";
7616
-			else $query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
7934
+			if ($globalDBdriver == 'mysql') {
7935
+				$query .= " AND spotter_output.date > '".$sincedate."'";
7936
+			} else {
7937
+				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
7938
+			}
7617 7939
 		}
7618 7940
 		$query .= " GROUP BY spotter_output.ident, spotter_output.airline_name, spotter_output.airline_icao ORDER BY callsign_icao_count DESC";
7619
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
7941
+		if ($limit) {
7942
+			$query .= " LIMIT 10 OFFSET 0";
7943
+		}
7620 7944
       		
7621 7945
 		$sth = $this->db->prepare($query);
7622 7946
 		$sth->execute();
@@ -7650,15 +7974,23 @@  discard block
 block discarded – undo
7650 7974
 		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name  
7651 7975
                     FROM spotter_output".$filter_query." spotter_output.ident <> ''  AND spotter_output.airline_icao <> '' ";
7652 7976
 		 if ($olderthanmonths > 0) {
7653
-			if ($globalDBdriver == 'mysql') $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
7654
-			else $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
7977
+			if ($globalDBdriver == 'mysql') {
7978
+				$query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
7979
+			} else {
7980
+				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
7981
+			}
7655 7982
 		}
7656 7983
 		if ($sincedate != '') {
7657
-			if ($globalDBdriver == 'mysql') $query .= "AND spotter_output.date > '".$sincedate."' ";
7658
-			else $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP) ";
7984
+			if ($globalDBdriver == 'mysql') {
7985
+				$query .= "AND spotter_output.date > '".$sincedate."' ";
7986
+			} else {
7987
+				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP) ";
7988
+			}
7659 7989
 		}
7660 7990
 		$query .= "GROUP BY spotter_output.airline_icao, spotter_output.ident, spotter_output.airline_name, spotter_output.airline_icao ORDER BY callsign_icao_count DESC";
7661
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
7991
+		if ($limit) {
7992
+			$query .= " LIMIT 10 OFFSET 0";
7993
+		}
7662 7994
       		
7663 7995
 		$sth = $this->db->prepare($query);
7664 7996
 		$sth->execute();
@@ -7695,7 +8027,9 @@  discard block
 block discarded – undo
7695 8027
 			date_default_timezone_set($globalTimezone);
7696 8028
 			$datetime = new DateTime();
7697 8029
 			$offset = $datetime->format('P');
7698
-		} else $offset = '+00:00';
8030
+		} else {
8031
+			$offset = '+00:00';
8032
+		}
7699 8033
 
7700 8034
 		if ($globalDBdriver == 'mysql') {
7701 8035
 			$query  = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -7744,7 +8078,9 @@  discard block
 block discarded – undo
7744 8078
 			date_default_timezone_set($globalTimezone);
7745 8079
 			$datetime = new DateTime();
7746 8080
 			$offset = $datetime->format('P');
7747
-		} else $offset = '+00:00';
8081
+		} else {
8082
+			$offset = '+00:00';
8083
+		}
7748 8084
 		$filter_query = $this->getFilter($filters,true,true);
7749 8085
 		if ($globalDBdriver == 'mysql') {
7750 8086
 			$query  = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -7793,7 +8129,9 @@  discard block
 block discarded – undo
7793 8129
 			date_default_timezone_set($globalTimezone);
7794 8130
 			$datetime = new DateTime();
7795 8131
 			$offset = $datetime->format('P');
7796
-		} else $offset = '+00:00';
8132
+		} else {
8133
+			$offset = '+00:00';
8134
+		}
7797 8135
 		$filter_query = $this->getFilter($filters,true,true);
7798 8136
 		if ($globalDBdriver == 'mysql') {
7799 8137
 			$query  = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -7839,7 +8177,9 @@  discard block
 block discarded – undo
7839 8177
 			date_default_timezone_set($globalTimezone);
7840 8178
 			$datetime = new DateTime();
7841 8179
 			$offset = $datetime->format('P');
7842
-		} else $offset = '+00:00';
8180
+		} else {
8181
+			$offset = '+00:00';
8182
+		}
7843 8183
 		$filter_query = $this->getFilter($filters,true,true);
7844 8184
 		if ($globalDBdriver == 'mysql') {
7845 8185
 			$query  = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -7887,7 +8227,9 @@  discard block
 block discarded – undo
7887 8227
 			date_default_timezone_set($globalTimezone);
7888 8228
 			$datetime = new DateTime();
7889 8229
 			$offset = $datetime->format('P');
7890
-		} else $offset = '+00:00';
8230
+		} else {
8231
+			$offset = '+00:00';
8232
+		}
7891 8233
 		
7892 8234
 		if ($globalDBdriver == 'mysql') {
7893 8235
 			$query  = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -7935,7 +8277,9 @@  discard block
 block discarded – undo
7935 8277
 			date_default_timezone_set($globalTimezone);
7936 8278
 			$datetime = new DateTime();
7937 8279
 			$offset = $datetime->format('P');
7938
-		} else $offset = '+00:00';
8280
+		} else {
8281
+			$offset = '+00:00';
8282
+		}
7939 8283
 
7940 8284
 		if ($globalDBdriver == 'mysql') {
7941 8285
 			$query  = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(*) as date_count
@@ -7982,7 +8326,9 @@  discard block
 block discarded – undo
7982 8326
 			date_default_timezone_set($globalTimezone);
7983 8327
 			$datetime = new DateTime();
7984 8328
 			$offset = $datetime->format('P');
7985
-		} else $offset = '+00:00';
8329
+		} else {
8330
+			$offset = '+00:00';
8331
+		}
7986 8332
 
7987 8333
 		if ($globalDBdriver == 'mysql') {
7988 8334
 			$query  = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(*) as date_count
@@ -8030,7 +8376,9 @@  discard block
 block discarded – undo
8030 8376
 			date_default_timezone_set($globalTimezone);
8031 8377
 			$datetime = new DateTime();
8032 8378
 			$offset = $datetime->format('P');
8033
-		} else $offset = '+00:00';
8379
+		} else {
8380
+			$offset = '+00:00';
8381
+		}
8034 8382
 		$filter_query = $this->getFilter($filters,true,true);
8035 8383
 		if ($globalDBdriver == 'mysql') {
8036 8384
 			$query  = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(*) as date_count
@@ -8075,7 +8423,9 @@  discard block
 block discarded – undo
8075 8423
 			date_default_timezone_set($globalTimezone);
8076 8424
 			$datetime = new DateTime();
8077 8425
 			$offset = $datetime->format('P');
8078
-		} else $offset = '+00:00';
8426
+		} else {
8427
+			$offset = '+00:00';
8428
+		}
8079 8429
 		$filter_query = $this->getFilter($filters,true,true);
8080 8430
 
8081 8431
 		if ($globalDBdriver == 'mysql') {
@@ -8122,7 +8472,9 @@  discard block
 block discarded – undo
8122 8472
 			date_default_timezone_set($globalTimezone);
8123 8473
 			$datetime = new DateTime();
8124 8474
 			$offset = $datetime->format('P');
8125
-		} else $offset = '+00:00';
8475
+		} else {
8476
+			$offset = '+00:00';
8477
+		}
8126 8478
 
8127 8479
 		if ($globalDBdriver == 'mysql') {
8128 8480
 			$query  = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct owner_name) as date_count
@@ -8168,7 +8520,9 @@  discard block
 block discarded – undo
8168 8520
 			date_default_timezone_set($globalTimezone);
8169 8521
 			$datetime = new DateTime();
8170 8522
 			$offset = $datetime->format('P');
8171
-		} else $offset = '+00:00';
8523
+		} else {
8524
+			$offset = '+00:00';
8525
+		}
8172 8526
 		$filter_query = $this->getFilter($filters,true,true);
8173 8527
 
8174 8528
 		if ($globalDBdriver == 'mysql') {
@@ -8215,7 +8569,9 @@  discard block
 block discarded – undo
8215 8569
 			date_default_timezone_set($globalTimezone);
8216 8570
 			$datetime = new DateTime();
8217 8571
 			$offset = $datetime->format('P');
8218
-		} else $offset = '+00:00';
8572
+		} else {
8573
+			$offset = '+00:00';
8574
+		}
8219 8575
 
8220 8576
 		if ($globalDBdriver == 'mysql') {
8221 8577
 			$query  = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct pilot_id) as date_count
@@ -8262,7 +8618,9 @@  discard block
 block discarded – undo
8262 8618
 			date_default_timezone_set($globalTimezone);
8263 8619
 			$datetime = new DateTime();
8264 8620
 			$offset = $datetime->format('P');
8265
-		} else $offset = '+00:00';
8621
+		} else {
8622
+			$offset = '+00:00';
8623
+		}
8266 8624
 
8267 8625
 		if ($globalDBdriver == 'mysql') {
8268 8626
 			$query  = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct airline_icao) as date_count
@@ -8307,7 +8665,9 @@  discard block
 block discarded – undo
8307 8665
 			date_default_timezone_set($globalTimezone);
8308 8666
 			$datetime = new DateTime();
8309 8667
 			$offset = $datetime->format('P');
8310
-		} else $offset = '+00:00';
8668
+		} else {
8669
+			$offset = '+00:00';
8670
+		}
8311 8671
 		$filter_query = $this->getFilter($filters,true,true);
8312 8672
 
8313 8673
 		if ($globalDBdriver == 'mysql') {
@@ -8355,7 +8715,9 @@  discard block
 block discarded – undo
8355 8715
 			date_default_timezone_set($globalTimezone);
8356 8716
 			$datetime = new DateTime();
8357 8717
 			$offset = $datetime->format('P');
8358
-		} else $offset = '+00:00';
8718
+		} else {
8719
+			$offset = '+00:00';
8720
+		}
8359 8721
 
8360 8722
 		if ($globalDBdriver == 'mysql') {
8361 8723
 			$query  = "SELECT spotter_output.airline_icao,YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct aircraft_icao) as date_count
@@ -8401,7 +8763,9 @@  discard block
 block discarded – undo
8401 8763
 			date_default_timezone_set($globalTimezone);
8402 8764
 			$datetime = new DateTime();
8403 8765
 			$offset = $datetime->format('P');
8404
-		} else $offset = '+00:00';
8766
+		} else {
8767
+			$offset = '+00:00';
8768
+		}
8405 8769
 		$filter_query = $this->getFilter($filters,true,true);
8406 8770
 
8407 8771
 		if ($globalDBdriver == 'mysql') {
@@ -8449,7 +8813,9 @@  discard block
 block discarded – undo
8449 8813
 			date_default_timezone_set($globalTimezone);
8450 8814
 			$datetime = new DateTime();
8451 8815
 			$offset = $datetime->format('P');
8452
-		} else $offset = '+00:00';
8816
+		} else {
8817
+			$offset = '+00:00';
8818
+		}
8453 8819
 
8454 8820
 		if ($globalDBdriver == 'mysql') {
8455 8821
 			$query  = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(real_arrival_airport_icao) as date_count
@@ -8496,7 +8862,9 @@  discard block
 block discarded – undo
8496 8862
 			date_default_timezone_set($globalTimezone);
8497 8863
 			$datetime = new DateTime();
8498 8864
 			$offset = $datetime->format('P');
8499
-		} else $offset = '+00:00';
8865
+		} else {
8866
+			$offset = '+00:00';
8867
+		}
8500 8868
 		$filter_query = $this->getFilter($filters,true,true);
8501 8869
 		if ($globalDBdriver == 'mysql') {
8502 8870
 			$query  = "SELECT MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name, count(*) as date_count
@@ -8545,7 +8913,9 @@  discard block
 block discarded – undo
8545 8913
 			date_default_timezone_set($globalTimezone);
8546 8914
 			$datetime = new DateTime();
8547 8915
 			$offset = $datetime->format('P');
8548
-		} else $offset = '+00:00';
8916
+		} else {
8917
+			$offset = '+00:00';
8918
+		}
8549 8919
 
8550 8920
 		$orderby_sql = '';
8551 8921
 		if ($orderby == "hour")
@@ -8611,7 +8981,9 @@  discard block
 block discarded – undo
8611 8981
 			date_default_timezone_set($globalTimezone);
8612 8982
 			$datetime = new DateTime();
8613 8983
 			$offset = $datetime->format('P');
8614
-		} else $offset = '+00:00';
8984
+		} else {
8985
+			$offset = '+00:00';
8986
+		}
8615 8987
 
8616 8988
 		$orderby_sql = '';
8617 8989
 		if ($orderby == "hour")
@@ -8678,7 +9050,9 @@  discard block
 block discarded – undo
8678 9050
 			date_default_timezone_set($globalTimezone);
8679 9051
 			$datetime = new DateTime();
8680 9052
 			$offset = $datetime->format('P');
8681
-		} else $offset = '+00:00';
9053
+		} else {
9054
+			$offset = '+00:00';
9055
+		}
8682 9056
 
8683 9057
 		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
8684 9058
 
@@ -8729,7 +9103,9 @@  discard block
 block discarded – undo
8729 9103
 			date_default_timezone_set($globalTimezone);
8730 9104
 			$datetime = new DateTime();
8731 9105
 			$offset = $datetime->format('P');
8732
-		} else $offset = '+00:00';
9106
+		} else {
9107
+			$offset = '+00:00';
9108
+		}
8733 9109
 
8734 9110
 		if ($globalDBdriver == 'mysql') {
8735 9111
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -8776,7 +9152,9 @@  discard block
 block discarded – undo
8776 9152
 			date_default_timezone_set($globalTimezone);
8777 9153
 			$datetime = new DateTime();
8778 9154
 			$offset = $datetime->format('P');
8779
-		} else $offset = '+00:00';
9155
+		} else {
9156
+			$offset = '+00:00';
9157
+		}
8780 9158
 
8781 9159
 		if ($globalDBdriver == 'mysql') {
8782 9160
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -8823,7 +9201,9 @@  discard block
 block discarded – undo
8823 9201
 			date_default_timezone_set($globalTimezone);
8824 9202
 			$datetime = new DateTime();
8825 9203
 			$offset = $datetime->format('P');
8826
-		} else $offset = '+00:00';
9204
+		} else {
9205
+			$offset = '+00:00';
9206
+		}
8827 9207
 
8828 9208
 		if ($globalDBdriver == 'mysql') {
8829 9209
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -8871,7 +9251,9 @@  discard block
 block discarded – undo
8871 9251
 			date_default_timezone_set($globalTimezone);
8872 9252
 			$datetime = new DateTime();
8873 9253
 			$offset = $datetime->format('P');
8874
-		} else $offset = '+00:00';
9254
+		} else {
9255
+			$offset = '+00:00';
9256
+		}
8875 9257
 
8876 9258
 		if ($globalDBdriver == 'mysql') {
8877 9259
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -8919,7 +9301,9 @@  discard block
 block discarded – undo
8919 9301
 			date_default_timezone_set($globalTimezone);
8920 9302
 			$datetime = new DateTime($date);
8921 9303
 			$offset = $datetime->format('P');
8922
-		} else $offset = '+00:00';
9304
+		} else {
9305
+			$offset = '+00:00';
9306
+		}
8923 9307
 
8924 9308
 		if ($globalDBdriver == 'mysql') {
8925 9309
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -8967,7 +9351,9 @@  discard block
 block discarded – undo
8967 9351
 			date_default_timezone_set($globalTimezone);
8968 9352
 			$datetime = new DateTime();
8969 9353
 			$offset = $datetime->format('P');
8970
-		} else $offset = '+00:00';
9354
+		} else {
9355
+			$offset = '+00:00';
9356
+		}
8971 9357
 
8972 9358
 		if ($globalDBdriver == 'mysql') {
8973 9359
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -9017,7 +9403,9 @@  discard block
 block discarded – undo
9017 9403
 			date_default_timezone_set($globalTimezone);
9018 9404
 			$datetime = new DateTime();
9019 9405
 			$offset = $datetime->format('P');
9020
-		} else $offset = '+00:00';
9406
+		} else {
9407
+			$offset = '+00:00';
9408
+		}
9021 9409
 
9022 9410
 		if ($globalDBdriver == 'mysql') {
9023 9411
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -9064,7 +9452,9 @@  discard block
 block discarded – undo
9064 9452
 			date_default_timezone_set($globalTimezone);
9065 9453
 			$datetime = new DateTime();
9066 9454
 			$offset = $datetime->format('P');
9067
-		} else $offset = '+00:00';
9455
+		} else {
9456
+			$offset = '+00:00';
9457
+		}
9068 9458
 
9069 9459
 		if ($globalDBdriver == 'mysql') {
9070 9460
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -9232,7 +9622,9 @@  discard block
 block discarded – undo
9232 9622
 			date_default_timezone_set($globalTimezone);
9233 9623
 			$datetime = new DateTime();
9234 9624
 			$offset = $datetime->format('P');
9235
-		} else $offset = '+00:00';
9625
+		} else {
9626
+			$offset = '+00:00';
9627
+		}
9236 9628
 
9237 9629
 		if ($globalDBdriver == 'mysql') {
9238 9630
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -9418,7 +9810,9 @@  discard block
 block discarded – undo
9418 9810
 	*/
9419 9811
 	public function parseDirection($direction = 0)
9420 9812
 	{
9421
-		if ($direction == '') $direction = 0;
9813
+		if ($direction == '') {
9814
+			$direction = 0;
9815
+		}
9422 9816
 		$direction_array = array();
9423 9817
 		$temp_array = array();
9424 9818
 
@@ -9519,7 +9913,9 @@  discard block
 block discarded – undo
9519 9913
 		if (isset($result->AirlineFlightInfoResult))
9520 9914
 		{
9521 9915
 			$registration = $result->AirlineFlightInfoResult->tailnumber;
9522
-		} else return '';
9916
+		} else {
9917
+			return '';
9918
+		}
9523 9919
 		
9524 9920
 		$registration = $this->convertAircraftRegistration($registration);
9525 9921
 		
@@ -9548,7 +9944,9 @@  discard block
 block discarded – undo
9548 9944
 		if (count($row) > 0) {
9549 9945
 		    //return $row['Registration'];
9550 9946
 		    return $row['registration'];
9551
-		} else return '';
9947
+		} else {
9948
+			return '';
9949
+		}
9552 9950
 	
9553 9951
 	}
9554 9952
 
@@ -9571,9 +9969,14 @@  discard block
 block discarded – undo
9571 9969
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
9572 9970
 		$sth->closeCursor();
9573 9971
 		if (count($row) > 0) {
9574
-		    if ($row['type_flight'] == null) return '';
9575
-		    else return $row['type_flight'];
9576
-		} else return '';
9972
+		    if ($row['type_flight'] == null) {
9973
+		    	return '';
9974
+		    } else {
9975
+		    	return $row['type_flight'];
9976
+		    }
9977
+		} else {
9978
+			return '';
9979
+		}
9577 9980
 	
9578 9981
 	}
9579 9982
 
@@ -9591,7 +9994,9 @@  discard block
 block discarded – undo
9591 9994
 		$longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
9592 9995
 	
9593 9996
 		$Connection = new Connection($this->db);
9594
-		if (!$Connection->tableExists('countries')) return '';
9997
+		if (!$Connection->tableExists('countries')) {
9998
+			return '';
9999
+		}
9595 10000
 	
9596 10001
 		try {
9597 10002
 			/*
@@ -9611,9 +10016,13 @@  discard block
 block discarded – undo
9611 10016
 			$sth->closeCursor();
9612 10017
 			if (count($row) > 0) {
9613 10018
 				return $row;
9614
-			} else return '';
10019
+			} else {
10020
+				return '';
10021
+			}
9615 10022
 		} catch (PDOException $e) {
9616
-			if (isset($globalDebug) && $globalDebug) echo 'Error : '.$e->getMessage()."\n";
10023
+			if (isset($globalDebug) && $globalDebug) {
10024
+				echo 'Error : '.$e->getMessage()."\n";
10025
+			}
9617 10026
 			return '';
9618 10027
 		}
9619 10028
 	
@@ -9761,7 +10170,9 @@  discard block
 block discarded – undo
9761 10170
 	{
9762 10171
 		global $globalBitlyAccessToken;
9763 10172
 		
9764
-		if ($globalBitlyAccessToken == '') return $url;
10173
+		if ($globalBitlyAccessToken == '') {
10174
+			return $url;
10175
+		}
9765 10176
         
9766 10177
 		$google_url = 'https://api-ssl.bitly.com/v3/shorten?access_token='.$globalBitlyAccessToken.'&longUrl='.$url;
9767 10178
 		
@@ -9910,7 +10321,9 @@  discard block
 block discarded – undo
9910 10321
 		
9911 10322
 
9912 10323
 		// routes
9913
-		if ($globalDebug) print "Routes...\n";
10324
+		if ($globalDebug) {
10325
+			print "Routes...\n";
10326
+		}
9914 10327
 		if ($globalDBdriver == 'mysql') {
9915 10328
 			$query = "SELECT spotter_output.spotter_id, routes.FromAirport_ICAO, routes.ToAirport_ICAO FROM spotter_output, routes WHERE spotter_output.ident = routes.CallSign AND ( spotter_output.departure_airport_icao != routes.FromAirport_ICAO OR spotter_output.arrival_airport_icao != routes.ToAirport_ICAO) AND routes.FromAirport_ICAO != '' AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 DAY)";
9916 10329
 		} else {
@@ -9929,7 +10342,9 @@  discard block
 block discarded – undo
9929 10342
 			}
9930 10343
 		}
9931 10344
 		
9932
-		if ($globalDebug) print "Airlines...\n";
10345
+		if ($globalDebug) {
10346
+			print "Airlines...\n";
10347
+		}
9933 10348
 		//airlines
9934 10349
 		if ($globalDBdriver == 'mysql') {
9935 10350
 			$query  = "SELECT spotter_output.spotter_id, spotter_output.ident FROM spotter_output WHERE (spotter_output.airline_name = '' OR spotter_output.airline_name = 'Not Available') AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 DAY)";
@@ -9943,10 +10358,15 @@  discard block
 block discarded – undo
9943 10358
 			if (is_numeric(substr($row['ident'], -1, 1)))
9944 10359
 			{
9945 10360
 				$fromsource = NULL;
9946
-				if (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') $fromsource = 'vatsim';
9947
-				elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') $fromsource = 'ivao';
9948
-				elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim';
9949
-				elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao';
10361
+				if (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') {
10362
+					$fromsource = 'vatsim';
10363
+				} elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') {
10364
+					$fromsource = 'ivao';
10365
+				} elseif (isset($globalVATSIM) && $globalVATSIM) {
10366
+					$fromsource = 'vatsim';
10367
+				} elseif (isset($globalIVAO) && $globalIVAO) {
10368
+					$fromsource = 'ivao';
10369
+				}
9950 10370
 				$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3),$fromsource);
9951 10371
 				if (isset($airline_array[0]['name'])) {
9952 10372
 					$update_query  = "UPDATE spotter_output SET spotter_output.airline_name = :airline_name, spotter_output.airline_icao = :airline_icao, spotter_output.airline_country = :airline_country, spotter_output.airline_type = :airline_type WHERE spotter_output.spotter_id = :spotter_id";
@@ -9956,13 +10376,17 @@  discard block
 block discarded – undo
9956 10376
 			}
9957 10377
 		}
9958 10378
 
9959
-		if ($globalDebug) print "Remove Duplicate in aircraft_modes...\n";
10379
+		if ($globalDebug) {
10380
+			print "Remove Duplicate in aircraft_modes...\n";
10381
+		}
9960 10382
 		//duplicate modes
9961 10383
 		$query = "DELETE aircraft_modes FROM aircraft_modes LEFT OUTER JOIN (SELECT max(`AircraftID`) as `AircraftID`,`ModeS` FROM `aircraft_modes` group by ModeS) as KeepRows ON aircraft_modes.AircraftID = KeepRows.AircraftID WHERE KeepRows.AircraftID IS NULL";
9962 10384
 		$sth = $this->db->prepare($query);
9963 10385
 		$sth->execute();
9964 10386
 		
9965
-		if ($globalDebug) print "Aircraft...\n";
10387
+		if ($globalDebug) {
10388
+			print "Aircraft...\n";
10389
+		}
9966 10390
 		//aircraft
9967 10391
 		if ($globalDBdriver == 'mysql') {
9968 10392
 			$query  = "SELECT spotter_output.spotter_id, spotter_output.aircraft_icao, spotter_output.registration FROM spotter_output WHERE (spotter_output.aircraft_name = '' OR spotter_output.aircraft_name = 'Not Available') AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY)";
@@ -10005,26 +10429,38 @@  discard block
 block discarded – undo
10005 10429
 				 if (isset($closestAirports[0])) {
10006 10430
 					if ($row['arrival_airport_icao'] == $closestAirports[0]['icao']) {
10007 10431
 						$airport_icao = $closestAirports[0]['icao'];
10008
-						if ($globalDebug) echo "\o/ 1st ---++ Find arrival airport. airport_icao : ".$airport_icao."\n";
10432
+						if ($globalDebug) {
10433
+							echo "\o/ 1st ---++ Find arrival airport. airport_icao : ".$airport_icao."\n";
10434
+						}
10009 10435
 					} elseif (count($closestAirports > 1) && $row['arrival_airport_icao'] != '' && $row['arrival_airport_icao'] != 'NA') {
10010 10436
 						foreach ($closestAirports as $airport) {
10011 10437
 							if ($row['arrival_airport_icao'] == $airport['icao']) {
10012 10438
 								$airport_icao = $airport['icao'];
10013
-								if ($globalDebug) echo "\o/ try --++ Find arrival airport. airport_icao : ".$airport_icao."\n";
10439
+								if ($globalDebug) {
10440
+									echo "\o/ try --++ Find arrival airport. airport_icao : ".$airport_icao."\n";
10441
+								}
10014 10442
 								break;
10015 10443
 							}
10016 10444
 						}
10017 10445
 					} elseif ($row['last_altitude'] == 0 || ($row['last_altitude'] != '' && ($closestAirports[0]['altitude'] <= $row['last_altitude']*100+1000 && $row['last_altitude']*100 < $closestAirports[0]['altitude']+5000))) {
10018 10446
 						$airport_icao = $closestAirports[0]['icao'];
10019
-						if ($globalDebug) echo "\o/ NP --++ Find arrival airport. Airport ICAO : ".$airport_icao." !  Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist." - Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.($row['last_altitude']*100)."\n";
10447
+						if ($globalDebug) {
10448
+							echo "\o/ NP --++ Find arrival airport. Airport ICAO : ".$airport_icao." !  Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist." - Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.($row['last_altitude']*100)."\n";
10449
+						}
10020 10450
 					} else {
10021
-						if ($globalDebug) echo "----- Can't find arrival airport. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist." - Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.($row['last_altitude']*100)."\n";
10451
+						if ($globalDebug) {
10452
+							echo "----- Can't find arrival airport. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist." - Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.($row['last_altitude']*100)."\n";
10453
+						}
10022 10454
 					}
10023 10455
 				} else {
10024
-					if ($globalDebug) echo "----- No Airport near last coord. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist."\n";
10456
+					if ($globalDebug) {
10457
+						echo "----- No Airport near last coord. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist."\n";
10458
+					}
10025 10459
 				}
10026 10460
 				if ($row['real_arrival_airport_icao'] != $airport_icao) {
10027
-					if ($globalDebug) echo "Updating airport to ".$airport_icao."...\n";
10461
+					if ($globalDebug) {
10462
+						echo "Updating airport to ".$airport_icao."...\n";
10463
+					}
10028 10464
 					$update_query="UPDATE spotter_output SET real_arrival_airport_icao = :airport_icao WHERE spotter_id = :spotter_id";
10029 10465
 					$sthu = $this->db->prepare($update_query);
10030 10466
 					$sthu->execute(array(':airport_icao' => $airport_icao,':spotter_id' => $row['spotter_id']));
Please login to merge, or discard this patch.
require/class.SpotterArchive.php 1 patch
Braces   +34 added lines, -12 removed lines patch added patch discarded remove patch
@@ -15,8 +15,12 @@  discard block
 block discarded – undo
15 15
     */
16 16
     public function getFilter($filter = array(),$where = false,$and = false) {
17 17
 	global $globalFilter, $globalStatsFilters, $globalFilterName;
18
-	if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) $filter = array_merge($globalStatsFilters[$globalFilterName],$filter);
19
-	if (is_array($globalFilter)) $filter = array_merge($globalFilter,$filter);
18
+	if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) {
19
+		$filter = array_merge($globalStatsFilters[$globalFilterName],$filter);
20
+	}
21
+	if (is_array($globalFilter)) {
22
+		$filter = array_merge($globalFilter,$filter);
23
+	}
20 24
 	$filter_query_join = '';
21 25
 	$filter_query_where = '';
22 26
 	if (isset($filter['airlines']) && !empty($filter['airlines'])) {
@@ -44,8 +48,11 @@  discard block
 block discarded – undo
44 48
 		$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
45 49
 	    }
46 50
 	}
47
-	if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
48
-	elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND';
51
+	if ($filter_query_where == '' && $where) {
52
+		$filter_query_where = ' WHERE';
53
+	} elseif ($filter_query_where != '' && $and) {
54
+		$filter_query_where .= ' AND';
55
+	}
49 56
 	$filter_query = $filter_query_join.$filter_query_where;
50 57
 	return $filter_query;
51 58
     }
@@ -56,10 +63,17 @@  discard block
 block discarded – undo
56 63
 		if ($over_country == '') {
57 64
 			$Spotter = new Spotter($this->db);
58 65
 			$data_country = $Spotter->getCountryFromLatitudeLongitude($latitude,$longitude);
59
-			if (!empty($data_country)) $country = $data_country['iso2'];
60
-			else $country = '';
61
-		} else $country = $over_country;
62
-		if ($airline_type === NULL) $airline_type ='';
66
+			if (!empty($data_country)) {
67
+				$country = $data_country['iso2'];
68
+			} else {
69
+				$country = '';
70
+			}
71
+		} else {
72
+			$country = $over_country;
73
+		}
74
+		if ($airline_type === NULL) {
75
+			$airline_type ='';
76
+		}
63 77
 	
64 78
 		//if ($country == '') echo "\n".'************ UNKNOW COUNTRY ****************'."\n";
65 79
 		//else echo "\n".'*/*/*/*/*/*/*/ Country : '.$country.' */*/*/*/*/*/*/*/*/'."\n";
@@ -562,7 +576,9 @@  discard block
 block discarded – undo
562 576
 		    $additional_query .= "(spotter_archive_output.pilot_name like '%".$q_item."%') OR ";
563 577
 		    $additional_query .= "(spotter_archive_output.ident like '%".$q_item."%') OR ";
564 578
 		    $translate = $Translation->ident2icao($q_item);
565
-		    if ($translate != $q_item) $additional_query .= "(spotter_archive_output.ident like '%".$translate."%') OR ";
579
+		    if ($translate != $q_item) {
580
+		    	$additional_query .= "(spotter_archive_output.ident like '%".$translate."%') OR ";
581
+		    }
566 582
 		    $additional_query .= "(spotter_archive_output.highlight like '%".$q_item."%')";
567 583
 		    $additional_query .= ")";
568 584
 		}
@@ -780,7 +796,9 @@  discard block
 block discarded – undo
780 796
 		date_default_timezone_set($globalTimezone);
781 797
 		$datetime = new DateTime();
782 798
 		$offset = $datetime->format('P');
783
-	    } else $offset = '+00:00';
799
+	    } else {
800
+	    	$offset = '+00:00';
801
+	    }
784 802
 
785 803
 
786 804
 	    if ($date_array[1] != "")
@@ -944,9 +962,13 @@  discard block
 block discarded – undo
944 962
 				$query .= "AND date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
945 963
 			}
946 964
 		}
947
-                if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
965
+                if ($sincedate != '') {
966
+                	$query .= "AND date > '".$sincedate."' ";
967
+                }
948 968
 	$query .= "GROUP BY c.name, c.iso3, c.iso2 ORDER BY nb DESC";
949
-	if ($limit) $query .= " LIMIT 0,10";
969
+	if ($limit) {
970
+		$query .= " LIMIT 0,10";
971
+	}
950 972
       
951 973
 	
952 974
 	$sth = $this->db->prepare($query);
Please login to merge, or discard this patch.