Completed
Push — master ( 5e8324...900e93 )
by Yannick
06:22
created
header.php 1 patch
Braces   +32 added lines, -7 removed lines patch added patch discarded remove patch
@@ -5,8 +5,11 @@  discard block
 block discarded – undo
5 5
 $file_path = pathinfo($_SERVER['SCRIPT_NAME']);
6 6
 $current_page = $file_path['filename'];
7 7
 date_default_timezone_set($globalTimezone);
8
-if (isset($_COOKIE['MapType']) && $_COOKIE['MapType'] != '') $MapType = $_COOKIE['MapType'];
9
-else $MapType = $globalMapProvider;
8
+if (isset($_COOKIE['MapType']) && $_COOKIE['MapType'] != '') {
9
+	$MapType = $_COOKIE['MapType'];
10
+} else {
11
+	$MapType = $globalMapProvider;
12
+}
10 13
 if (isset($_GET['3d'])) {
11 14
 	setcookie('MapFormat','3d');
12 15
 } else if (isset($_GET['2d'])) {
@@ -241,7 +244,13 @@  discard block
 block discarded – undo
241 244
 <script src="<?php print $globalURL; ?>/js/MovingMarker.js"></script>
242 245
 <script src="<?php print $globalURL; ?>/js/jquery.idle.min.js"></script>
243 246
 <script src="<?php print $globalURL; ?>/js/map.common.js"></script>
244
-<script src="<?php print $globalURL; ?>/js/map.js.php?ident=<?php print $ident; ?><?php if(isset($latitude)) print '&latitude='.$latitude; ?><?php if(isset($longitude)) print '&longitude='.$longitude; ?>&<?php print time(); ?>"></script>
247
+<script src="<?php print $globalURL; ?>/js/map.js.php?ident=<?php print $ident; ?><?php if(isset($latitude)) {
248
+	print '&latitude='.$latitude;
249
+}
250
+?><?php if(isset($longitude)) {
251
+	print '&longitude='.$longitude;
252
+}
253
+?>&<?php print time(); ?>"></script>
245 254
 <?php
246 255
 		if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '' && ($MapType == 'Google-Roadmap' || $MapType == 'Google-Satellite' || $MapType == 'Google-Hybrid' || $MapType == 'Google-Terrain')) {
247 256
 ?>
@@ -296,7 +305,13 @@  discard block
 block discarded – undo
296 305
 <script src="<?php print $globalURL; ?>/js/MovingMarker.js"></script>
297 306
 <script src="<?php print $globalURL; ?>/js/jquery.idle.min.js"></script>
298 307
 <script src="<?php print $globalURL; ?>/js/map.common.js"></script>
299
-<script src="<?php print $globalURL; ?>/js/map.js.php?flightaware_id=<?php print $flightaware_id; ?><?php if(isset($latitude)) print '&latitude='.$latitude; ?><?php if(isset($longitude)) print '&longitude='.$longitude; ?>&<?php print time(); ?>"></script>
308
+<script src="<?php print $globalURL; ?>/js/map.js.php?flightaware_id=<?php print $flightaware_id; ?><?php if(isset($latitude)) {
309
+	print '&latitude='.$latitude;
310
+}
311
+?><?php if(isset($longitude)) {
312
+	print '&longitude='.$longitude;
313
+}
314
+?>&<?php print time(); ?>"></script>
300 315
 <?php
301 316
 		if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '' && ($MapType == 'Google-Roadmap' || $MapType == 'Google-Satellite' || $MapType == 'Google-Hybrid' || $MapType == 'Google-Terrain')) {
302 317
 ?>
@@ -369,7 +384,12 @@  discard block
 block discarded – undo
369 384
         <span class="icon-bar"></span>
370 385
       </button>
371 386
       <a href="<?php print $globalURL; ?>/search" class="navbar-toggle navbar-toggle-search"><i class="fa fa-search"></i></a>
372
-      <a class="navbar-brand" href="<?php if ($globalURL == '') print '/'; else print $globalURL; ?>"><img src="<?php print $globalURL.$logoURL; ?>" height="30px" /></a>
387
+      <a class="navbar-brand" href="<?php if ($globalURL == '') {
388
+	print '/';
389
+} else {
390
+	print $globalURL;
391
+}
392
+?>"><img src="<?php print $globalURL.$logoURL; ?>" height="30px" /></a>
373 393
     </div>
374 394
     <div class="collapse navbar-collapse">
375 395
       <ul class="nav navbar-nav">
@@ -469,7 +489,9 @@  discard block
 block discarded – undo
469 489
   		        $alllang = $Language->getLanguages();
470 490
   		        foreach ($alllang as $key => $lang) {
471 491
   		            print '<option value="'.$key.'"';
472
-  		            if (isset($_COOKIE['language']) && $_COOKIE['language'] == $key) print ' selected ';
492
+  		            if (isset($_COOKIE['language']) && $_COOKIE['language'] == $key) {
493
+  		            	print ' selected ';
494
+  		            }
473 495
   		            print '>'.$lang[0].'</option>';
474 496
   		        }
475 497
   		    ?>
@@ -622,4 +644,7 @@  discard block
 block discarded – undo
622 644
 
623 645
 ?>
624 646
 
625
-<section class="container main-content <?php if (strtolower($current_page) == 'index') print 'index '; ?>clear">
647
+<section class="container main-content <?php if (strtolower($current_page) == 'index') {
648
+	print 'index ';
649
+}
650
+?>clear">
Please login to merge, or discard this patch.
getImages.php 1 patch
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -96,8 +96,11 @@
 block discarded – undo
96 96
     } elseif (isset($_GET['marine'])) {
97 97
         readfile(dirname(__FILE__).DIRECTORY_SEPARATOR.'images/vehicules/'.$filename);
98 98
     } else {
99
-        if ($color == 'FF0000') readfile(dirname(__FILE__).DIRECTORY_SEPARATOR.'images/aircrafts/selected/'.$filename);
100
-	else readfile(dirname(__FILE__).DIRECTORY_SEPARATOR.'images/aircrafts/'.$filename);
99
+        if ($color == 'FF0000') {
100
+        	readfile(dirname(__FILE__).DIRECTORY_SEPARATOR.'images/aircrafts/selected/'.$filename);
101
+        } else {
102
+		readfile(dirname(__FILE__).DIRECTORY_SEPARATOR.'images/aircrafts/'.$filename);
103
+	}
101 104
     }
102 105
 }
103 106
 ?>
104 107
\ No newline at end of file
Please login to merge, or discard this patch.
live-geojson.php 1 patch
Braces   +270 added lines, -106 removed lines patch added patch discarded remove patch
@@ -47,27 +47,52 @@  discard block
 block discarded – undo
47 47
 }
48 48
 header('Content-Type: text/javascript');
49 49
 
50
-if (!isset($globalJsonCompress)) $compress = true;
51
-else $compress = $globalJsonCompress;
50
+if (!isset($globalJsonCompress)) {
51
+	$compress = true;
52
+} else {
53
+	$compress = $globalJsonCompress;
54
+}
52 55
 
53 56
 $from_archive = false;
54 57
 $min = true;
55 58
 $allhistory = false;
56 59
 $filter['source'] = array();
57
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt'));
58
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup'));
59
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars'));
60
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs'));
61
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs'));
62
-if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING);
63
-if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING);
64
-if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING);
65
-if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING);
66
-if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING);
60
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') {
61
+	$filter['source'] = array_merge($filter['source'],array('vatsimtxt'));
62
+}
63
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') {
64
+	$filter['source'] = array_merge($filter['source'],array('whazzup'));
65
+}
66
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') {
67
+	$filter['source'] = array_merge($filter['source'],array('phpvmacars'));
68
+}
69
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') {
70
+	$filter['source'] = array_merge($filter['source'],array('sbs'));
71
+}
72
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') {
73
+	$filter['source'] = array_merge($filter['source'],array('aprs'));
74
+}
75
+if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') {
76
+	$filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING);
77
+}
78
+if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') {
79
+	$filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING);
80
+}
81
+if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') {
82
+	$filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING);
83
+}
84
+if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') {
85
+	$filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING);
86
+}
87
+if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') {
88
+	$filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING);
89
+}
67 90
 
68 91
 if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) {
69 92
 	$min = true;
70
-} else $min = false;
93
+} else {
94
+	$min = false;
95
+}
71 96
 
72 97
 if (isset($_GET['ident'])) {
73 98
 	$ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING);
@@ -149,20 +174,30 @@  discard block
 block discarded – undo
149 174
 	}
150 175
 */
151 176
 	$flightcnt = count($spotter_array);
152
-	if ($flightcnt == '') $flightcnt = 0;
153
-} else $flightcnt = 0;
177
+	if ($flightcnt == '') {
178
+		$flightcnt = 0;
179
+	}
180
+	} else {
181
+	$flightcnt = 0;
182
+}
154 183
 
155 184
 $sqltime = round(microtime(true)-$begintime,2);
156 185
 
157
-if ((!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation == FALSE) || (isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'false')) $usenextlatlon = false;
158
-else $usenextlatlon = true;
186
+if ((!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation == FALSE) || (isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'false')) {
187
+	$usenextlatlon = false;
188
+} else {
189
+	$usenextlatlon = true;
190
+}
159 191
 $j = 0;
160 192
 $prev_flightaware_id = '';
161 193
 $aircrafts_shadow = array();
162 194
 $output = '{';
163 195
 	$output .= '"type": "FeatureCollection",';
164
-		if ($min) $output .= '"minimal": "true",';
165
-		else $output .= '"minimal": "false",';
196
+		if ($min) {
197
+			$output .= '"minimal": "true",';
198
+		} else {
199
+			$output .= '"minimal": "false",';
200
+		}
166 201
 		$output .= '"fc": "'.$flightcnt.'",';
167 202
 		$output .= '"sqt": "'.$sqltime.'",';
168 203
 
@@ -206,18 +241,29 @@  discard block
 block discarded – undo
206 241
 						}
207 242
 						$output .= '"properties": {';
208 243
 						if (isset($spotter_item['flightaware_id'])) {
209
-							if ($compress) $output .= '"fi": "'.$spotter_item['flightaware_id'].'",';
210
-							else $output .= '"flightaware_id": "'.$spotter_item['flightaware_id'].'",';
244
+							if ($compress) {
245
+								$output .= '"fi": "'.$spotter_item['flightaware_id'].'",';
246
+							} else {
247
+								$output .= '"flightaware_id": "'.$spotter_item['flightaware_id'].'",';
248
+							}
211 249
 						} elseif (isset($spotter_item['famtrackid'])) {
212
-							if ($compress) $output .= '"fti": "'.$spotter_item['famtrackid'].'",';
213
-							else $output .= '"famtrackid": "'.$spotter_item['famtrackid'].'",';
250
+							if ($compress) {
251
+								$output .= '"fti": "'.$spotter_item['famtrackid'].'",';
252
+							} else {
253
+								$output .= '"famtrackid": "'.$spotter_item['famtrackid'].'",';
254
+							}
214 255
 						} elseif (isset($spotter_item['fammarine_id'])) {
215
-							if ($compress) $output .= '"fmi": "'.$spotter_item['fammarine_id'].'",';
216
-							else $output .= '"fammarineid": "'.$spotter_item['fammarine_id'].'",';
256
+							if ($compress) {
257
+								$output .= '"fmi": "'.$spotter_item['fammarine_id'].'",';
258
+							} else {
259
+								$output .= '"fammarineid": "'.$spotter_item['fammarine_id'].'",';
260
+							}
217 261
 						}
218 262
 							$output .= '"fc": "'.$flightcnt.'",';
219 263
 							$output .= '"sqt": "'.$sqltime.'",';
220
-							if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",';
264
+							if (isset($begindate)) {
265
+								$output .= '"archive_date": "'.$begindate.'",';
266
+							}
221 267
 
222 268
 /*
223 269
 							if ($min) $output .= '"minimal": "true",';
@@ -225,13 +271,21 @@  discard block
 block discarded – undo
225 271
 */
226 272
 							//$output .= '"fc": "'.$spotter_item['nb'].'",';
227 273
 						if (isset($spotter_item['ident']) && $spotter_item['ident'] != '') {
228
-							if ($compress) $output .= '"c": "'.$spotter_item['ident'].'",';
229
-							else $output .= '"callsign": "'.$spotter_item['ident'].'",';
274
+							if ($compress) {
275
+								$output .= '"c": "'.$spotter_item['ident'].'",';
276
+							} else {
277
+								$output .= '"callsign": "'.$spotter_item['ident'].'",';
278
+							}
230 279
 						} else {
231
-							if ($compress) $output .= '"c": "NA",';
232
-							else $output .= '"callsign": "NA",';
280
+							if ($compress) {
281
+								$output .= '"c": "NA",';
282
+							} else {
283
+								$output .= '"callsign": "NA",';
284
+							}
285
+						}
286
+						if (isset($spotter_item['registration'])) {
287
+							$output .= '"registration": "'.$spotter_item['registration'].'",';
233 288
 						}
234
-						if (isset($spotter_item['registration'])) $output .= '"registration": "'.$spotter_item['registration'].'",';
235 289
 						if (isset($spotter_item['aircraft_name']) && isset($spotter_item['aircraft_type'])) {
236 290
 							$output .= '"aircraft_name": "'.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')",';
237 291
 							$output .= '"aircraft_wiki": "http://'.strtolower($globalLanguage).'.wikipedia.org/wiki/'.urlencode(str_replace(' ','_',$spotter_item['aircraft_name'])).'",';
@@ -244,15 +298,21 @@  discard block
 block discarded – undo
244 298
 							$output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",';
245 299
 						}
246 300
 						if (!isset($spotter_item['aircraft_shadow']) && !$tracker) {
247
-							if (!isset($spotter_item['aircraft_icao']) || $spotter_item['aircraft_icao'] == '') $spotter_item['aircraft_shadow'] = '';
248
-							else {
301
+							if (!isset($spotter_item['aircraft_icao']) || $spotter_item['aircraft_icao'] == '') {
302
+								$spotter_item['aircraft_shadow'] = '';
303
+							} else {
249 304
 								$aircraft_icao = $spotter_item['aircraft_icao'];
250
-								if (isset($aircrafts_shadow[$aircraft_icao])) $spotter_item['aircraft_shadow'] = $aircrafts_shadow[$aircraft_icao];
251
-								else {
305
+								if (isset($aircrafts_shadow[$aircraft_icao])) {
306
+									$spotter_item['aircraft_shadow'] = $aircrafts_shadow[$aircraft_icao];
307
+								} else {
252 308
 									$aircraft_info = $Spotter->getAllAircraftInfo($spotter_item['aircraft_icao']);
253
-									if (count($aircraft_info) > 0) $spotter_item['aircraft_shadow'] = $aircraft_info[0]['aircraft_shadow'];
254
-									elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') $spotter_item['aircraft_shadow'] = 'PA18.png';
255
-									else $spotter_item['aircraft_shadow'] = '';
309
+									if (count($aircraft_info) > 0) {
310
+										$spotter_item['aircraft_shadow'] = $aircraft_info[0]['aircraft_shadow'];
311
+									} elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') {
312
+										$spotter_item['aircraft_shadow'] = 'PA18.png';
313
+									} else {
314
+										$spotter_item['aircraft_shadow'] = '';
315
+									}
256 316
 									$aircrafts_shadow[$aircraft_icao] = $spotter_item['aircraft_shadow'];
257 317
 								}
258 318
 							}
@@ -260,73 +320,139 @@  discard block
 block discarded – undo
260 320
 						if (!isset($spotter_item['aircraft_shadow']) || $spotter_item['aircraft_shadow'] == '') {
261 321
 							if ($tracker) {
262 322
 								if (isset($spotter_item['type']) && $spotter_item['type'] == 'Ambulance') {
263
-									if ($compress) $output .= '"as": "ambulance.png",';
264
-									else $output .= '"aircraft_shadow": "ambulance.png",';
323
+									if ($compress) {
324
+										$output .= '"as": "ambulance.png",';
325
+									} else {
326
+										$output .= '"aircraft_shadow": "ambulance.png",';
327
+									}
265 328
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Police') {
266
-									if ($compress) $output .= '"as": "police.png",';
267
-									else $output .= '"aircraft_shadow": "police.png",';
329
+									if ($compress) {
330
+										$output .= '"as": "police.png",';
331
+									} else {
332
+										$output .= '"aircraft_shadow": "police.png",';
333
+									}
268 334
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Yacht (Sail)') {
269
-									if ($compress) $output .= '"as": "ship.png",';
270
-									else $output .= '"aircraft_shadow": "ship.png",';
335
+									if ($compress) {
336
+										$output .= '"as": "ship.png",';
337
+									} else {
338
+										$output .= '"aircraft_shadow": "ship.png",';
339
+									}
271 340
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Ship (Power Boat)') {
272
-									if ($compress) $output .= '"as": "ship.png",';
273
-									else $output .= '"aircraft_shadow": "ship.png",';
341
+									if ($compress) {
342
+										$output .= '"as": "ship.png",';
343
+									} else {
344
+										$output .= '"aircraft_shadow": "ship.png",';
345
+									}
274 346
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Shuttle') {
275
-									if ($compress) $output .= '"as": "ship.png",';
276
-									else $output .= '"aircraft_shadow": "ship.png",';
347
+									if ($compress) {
348
+										$output .= '"as": "ship.png",';
349
+									} else {
350
+										$output .= '"aircraft_shadow": "ship.png",';
351
+									}
277 352
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck') {
278
-									if ($compress) $output .= '"as": "truck.png",';
279
-									else $output .= '"aircraft_shadow": "truck.png",';
353
+									if ($compress) {
354
+										$output .= '"as": "truck.png",';
355
+									} else {
356
+										$output .= '"aircraft_shadow": "truck.png",';
357
+									}
280 358
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck (18 Wheeler)') {
281
-									if ($compress) $output .= '"as": "truck.png",';
282
-									else $output .= '"aircraft_shadow": "truck.png",';
359
+									if ($compress) {
360
+										$output .= '"as": "truck.png",';
361
+									} else {
362
+										$output .= '"aircraft_shadow": "truck.png",';
363
+									}
283 364
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Aircraft (small)') {
284
-									if ($compress) $output .= '"as": "aircraft.png",';
285
-									else $output .= '"aircraft_shadow": "aircraft.png",';
365
+									if ($compress) {
366
+										$output .= '"as": "aircraft.png",';
367
+									} else {
368
+										$output .= '"aircraft_shadow": "aircraft.png",';
369
+									}
286 370
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Large Aircraft') {
287
-									if ($compress) $output .= '"as": "aircraft.png",';
288
-									else $output .= '"aircraft_shadow": "aircraft.png",';
371
+									if ($compress) {
372
+										$output .= '"as": "aircraft.png",';
373
+									} else {
374
+										$output .= '"aircraft_shadow": "aircraft.png",';
375
+									}
289 376
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Helicopter') {
290
-									if ($compress) $output .= '"as": "helico.png",';
291
-									else $output .= '"aircraft_shadow": "helico.png",';
377
+									if ($compress) {
378
+										$output .= '"as": "helico.png",';
379
+									} else {
380
+										$output .= '"aircraft_shadow": "helico.png",';
381
+									}
292 382
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Railroad Engine') {
293
-									if ($compress) $output .= '"as": "rail.png",';
294
-									else $output .= '"aircraft_shadow": "rail.png",';
383
+									if ($compress) {
384
+										$output .= '"as": "rail.png",';
385
+									} else {
386
+										$output .= '"aircraft_shadow": "rail.png",';
387
+									}
295 388
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Firetruck') {
296
-									if ($compress) $output .= '"as": "firetruck.png",';
297
-									else $output .= '"aircraft_shadow": "firetruck.png",';
389
+									if ($compress) {
390
+										$output .= '"as": "firetruck.png",';
391
+									} else {
392
+										$output .= '"aircraft_shadow": "firetruck.png",';
393
+									}
298 394
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bus') {
299
-									if ($compress) $output .= '"as": "bus.png",';
300
-									else $output .= '"aircraft_shadow": "bus.png",';
395
+									if ($compress) {
396
+										$output .= '"as": "bus.png",';
397
+									} else {
398
+										$output .= '"aircraft_shadow": "bus.png",';
399
+									}
301 400
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Phone') {
302
-									if ($compress) $output .= '"as": "phone.png",';
303
-									else $output .= '"aircraft_shadow": "phone.png",';
401
+									if ($compress) {
402
+										$output .= '"as": "phone.png",';
403
+									} else {
404
+										$output .= '"aircraft_shadow": "phone.png",';
405
+									}
304 406
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Jogger') {
305
-									if ($compress) $output .= '"as": "jogger.png",';
306
-									else $output .= '"aircraft_shadow": "jogger.png",';
407
+									if ($compress) {
408
+										$output .= '"as": "jogger.png",';
409
+									} else {
410
+										$output .= '"aircraft_shadow": "jogger.png",';
411
+									}
307 412
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bike') {
308
-									if ($compress) $output .= '"as": "bike.png",';
309
-									else $output .= '"aircraft_shadow": "bike.png",';
413
+									if ($compress) {
414
+										$output .= '"as": "bike.png",';
415
+									} else {
416
+										$output .= '"aircraft_shadow": "bike.png",';
417
+									}
310 418
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Motorcycle') {
311
-									if ($compress) $output .= '"as": "motorcycle.png",';
312
-									else $output .= '"aircraft_shadow": "motorcycle.png",';
419
+									if ($compress) {
420
+										$output .= '"as": "motorcycle.png",';
421
+									} else {
422
+										$output .= '"aircraft_shadow": "motorcycle.png",';
423
+									}
313 424
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Balloon') {
314
-									if ($compress) $output .= '"as": "balloon.png",';
315
-									else $output .= '"aircraft_shadow": "balloon.png",';
425
+									if ($compress) {
426
+										$output .= '"as": "balloon.png",';
427
+									} else {
428
+										$output .= '"aircraft_shadow": "balloon.png",';
429
+									}
316 430
 								} else {
317
-									if ($compress) $output .= '"as": "car.png",';
318
-									else $output .= '"aircraft_shadow": "car.png",';
431
+									if ($compress) {
432
+										$output .= '"as": "car.png",';
433
+									} else {
434
+										$output .= '"aircraft_shadow": "car.png",';
435
+									}
319 436
 								}
320 437
 							} elseif ($marine) {
321
-								if ($compress) $output .= '"as": "ship.png",';
322
-								else $output .= '"aircraft_shadow": "ship.png",';
438
+								if ($compress) {
439
+									$output .= '"as": "ship.png",';
440
+								} else {
441
+									$output .= '"aircraft_shadow": "ship.png",';
442
+								}
323 443
 							} else {
324
-								if ($compress) $output .= '"as": "default.png",';
325
-								else $output .= '"aircraft_shadow": "default.png",';
444
+								if ($compress) {
445
+									$output .= '"as": "default.png",';
446
+								} else {
447
+									$output .= '"aircraft_shadow": "default.png",';
448
+								}
326 449
 							}
327 450
 						} else {
328
-							if ($compress) $output .= '"as": "'.$spotter_item['aircraft_shadow'].'",';
329
-							else $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",';
451
+							if ($compress) {
452
+								$output .= '"as": "'.$spotter_item['aircraft_shadow'].'",';
453
+							} else {
454
+								$output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",';
455
+							}
330 456
 						}
331 457
 						if (isset($spotter_item['airline_name'])) {
332 458
 							$output .= '"airline_name": "'.$spotter_item['airline_name'].'",';
@@ -334,8 +460,11 @@  discard block
 block discarded – undo
334 460
 							$output .= '"airline_name": "NA",';
335 461
 						}
336 462
 						if (isset($spotter_item['departure_airport'])) {
337
-							if ($compress) $output .= '"dac": "'.$spotter_item['departure_airport'].'",';
338
-							else $output .= '"departure_airport_code": "'.$spotter_item['departure_airport'].'",';
463
+							if ($compress) {
464
+								$output .= '"dac": "'.$spotter_item['departure_airport'].'",';
465
+							} else {
466
+								$output .= '"departure_airport_code": "'.$spotter_item['departure_airport'].'",';
467
+							}
339 468
 						}
340 469
 						if (isset($spotter_item['departure_airport_city'])) {
341 470
 							$output .= '"departure_airport": "'.$spotter_item['departure_airport_city'].', '.$spotter_item['departure_airport_country'].'",';
@@ -347,8 +476,11 @@  discard block
 block discarded – undo
347 476
 							$output .= '"arrival_airport_time": "'.$spotter_item['arrival_airport_time'].'",';
348 477
 						}
349 478
 						if (isset($spotter_item['arrival_airport'])) {
350
-							if ($compress) $output .= '"aac": "'.$spotter_item['arrival_airport'].'",';
351
-							else $output .= '"arrival_airport_code": "'.$spotter_item['arrival_airport'].'",';
479
+							if ($compress) {
480
+								$output .= '"aac": "'.$spotter_item['arrival_airport'].'",';
481
+							} else {
482
+								$output .= '"arrival_airport_code": "'.$spotter_item['arrival_airport'].'",';
483
+							}
352 484
 						}
353 485
 						if (isset($spotter_item['arrival_airport_city'])) {
354 486
 							$output .= '"arrival_airport": "'.$spotter_item['arrival_airport_city'].', '.$spotter_item['arrival_airport_country'].'",';
@@ -367,11 +499,17 @@  discard block
 block discarded – undo
367 499
 						}
368 500
 						
369 501
 						if (isset($spotter_item['altitude'])) {
370
-							if ($compress) $output .= '"a": "'.$spotter_item['altitude'].'",';
371
-							else $output .= '"altitude": "'.$spotter_item['altitude'].'",';
502
+							if ($compress) {
503
+								$output .= '"a": "'.$spotter_item['altitude'].'",';
504
+							} else {
505
+								$output .= '"altitude": "'.$spotter_item['altitude'].'",';
506
+							}
507
+						}
508
+						if ($compress) {
509
+							$output .= '"h": "'.$spotter_item['heading'].'",';
510
+						} else {
511
+							$output .= '"heading": "'.$spotter_item['heading'].'",';
372 512
 						}
373
-						if ($compress)$output .= '"h": "'.$spotter_item['heading'].'",';
374
-						else $output .= '"heading": "'.$spotter_item['heading'].'",';
375 513
 						
376 514
 						if (isset($archivespeed)) {
377 515
 							$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$spotter_item['heading'],$archivespeed);
@@ -381,7 +519,9 @@  discard block
 block discarded – undo
381 519
 							$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
382 520
 						}
383 521
 
384
-						if (!$min) $output .= '"image": "'.$image.'",';
522
+						if (!$min) {
523
+							$output .= '"image": "'.$image.'",';
524
+						}
385 525
 						if (isset($spotter_item['image_copyright']) && $spotter_item['image_copyright'] != '') {
386 526
 							$output .= '"image_copyright": "'.str_replace('"',"'",trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$spotter_item['image_copyright']))).'",';
387 527
 						}
@@ -389,8 +529,11 @@  discard block
 block discarded – undo
389 529
 							$output .= '"image_source_website": "'.urlencode($spotter_item['image_source_website']).'",';
390 530
 						}
391 531
 						if (isset($spotter_item['squawk'])) {
392
-							if ($compress) $output .= '"sq": "'.$spotter_item['squawk'].'",';
393
-							else $output .= '"squawk": "'.$spotter_item['squawk'].'",';
532
+							if ($compress) {
533
+								$output .= '"sq": "'.$spotter_item['squawk'].'",';
534
+							} else {
535
+								$output .= '"squawk": "'.$spotter_item['squawk'].'",';
536
+							}
394 537
 						}
395 538
 						if (isset($spotter_item['squawk_usage'])) {
396 539
 							$output .= '"squawk_usage": "'.$spotter_item['squawk_usage'].'",';
@@ -409,14 +552,23 @@  discard block
 block discarded – undo
409 552
 						}
410 553
 						// type when not aircraft ?
411 554
 						if (isset($spotter_item['type'])) {
412
-							if ($compress) $output .= '"t": "'.$spotter_item['type'].'"';
413
-							else $output .= '"type": "'.$spotter_item['type'].'"';
555
+							if ($compress) {
556
+								$output .= '"t": "'.$spotter_item['type'].'"';
557
+							} else {
558
+								$output .= '"type": "'.$spotter_item['type'].'"';
559
+							}
414 560
 						} elseif ($marine) {
415
-							if ($compress) $output .= '"t": "ship"';
416
-							else $output .= '"type": "ship"';
561
+							if ($compress) {
562
+								$output .= '"t": "ship"';
563
+							} else {
564
+								$output .= '"type": "ship"';
565
+							}
417 566
 						} else {
418
-							if ($compress) $output .= '"t": "aircraft"';
419
-							else $output .= '"type": "aircraft"';
567
+							if ($compress) {
568
+								$output .= '"t": "aircraft"';
569
+							} else {
570
+								$output .= '"type": "aircraft"';
571
+							}
420 572
 						}
421 573
 						$output .= '},';
422 574
 						$output .= '"geometry": {';
@@ -484,7 +636,9 @@  discard block
 block discarded – undo
484 636
 			}
485 637
 */
486 638
 				$history = filter_input(INPUT_GET,'history',FILTER_SANITIZE_STRING);
487
-				if ($history == '' && isset($_COOKIE['history'])) $history = $_COOKIE['history'];
639
+				if ($history == '' && isset($_COOKIE['history'])) {
640
+					$history = $_COOKIE['history'];
641
+				}
488 642
 				
489 643
 				if ((isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true') 
490 644
 				|| (!isset($_COOKIE['flightpath']) 
@@ -513,8 +667,11 @@  discard block
 block discarded – undo
513 667
 							$output_history .= ']}},';
514 668
 							$output .= $output_history;
515 669
 						    }
516
-						    if ($compress) $output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history","a": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": [';
517
-						    else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": [';
670
+						    if ($compress) {
671
+						    	$output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history","a": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": [';
672
+						    } else {
673
+						    	$output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": [';
674
+						    }
518 675
 						}
519 676
 						$output_history .= '[';
520 677
 						$output_history .=  $spotter_history['longitude'].', ';
@@ -524,9 +681,14 @@  discard block
 block discarded – undo
524 681
 						$prev_alt = $alt;
525 682
 					} else {
526 683
 						if ($d == false) {
527
-							if ($compress) $output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history"},"geometry": {"type": "LineString","coordinates": [';
528
-							else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history"},"geometry": {"type": "LineString","coordinates": [';
529
-						} else $d = true;
684
+							if ($compress) {
685
+								$output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history"},"geometry": {"type": "LineString","coordinates": [';
686
+							} else {
687
+								$output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history"},"geometry": {"type": "LineString","coordinates": [';
688
+							}
689
+						} else {
690
+							$d = true;
691
+						}
530 692
 						$output_history .= '[';
531 693
 						$output_history .=  $spotter_history['longitude'].', ';
532 694
 						$output_history .=  $spotter_history['latitude'];
@@ -570,7 +732,9 @@  discard block
 block discarded – undo
570 732
 			$output .= ']';
571 733
 			$output .= ',"initial_sqltime": "'.$sqltime.'",';
572 734
 			$output .= '"totaltime": "'.round(microtime(true)-$begintime,2).'",';
573
-			if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",';
735
+			if (isset($begindate)) {
736
+				$output .= '"archive_date": "'.$begindate.'",';
737
+			}
574 738
 			$output .= '"fc": "'.$j.'"';
575 739
 		} else {
576 740
 			$output .= '"features": ';
Please login to merge, or discard this patch.
aircraft-data.php 1 patch
Braces   +34 added lines, -12 removed lines patch added patch discarded remove patch
@@ -55,7 +55,9 @@  discard block
 block discarded – undo
55 55
 {
56 56
 	if ($spotter_item['image_source'] == 'flickr' || $spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart') {
57 57
 		$image = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']);
58
-	} else $image = $spotter_item['image_thumbnail'];
58
+	} else {
59
+		$image = $spotter_item['image_thumbnail'];
60
+	}
59 61
 
60 62
 }
61 63
 /* else {
@@ -67,7 +69,9 @@  discard block
 block discarded – undo
67 69
 	print '<div class="left"><img src="'.$image.'" alt="'.$spotter_item['registration'].' '.$spotter_item['aircraft_name'].'" title="'.$spotter_item['registration'].' '.$spotter_item['aircraft_name'].' Image &copy; '.$spotter_item['image_copyright'].'"/><br />Image &copy; '.$spotter_item['image_copyright'].'</div>';
68 70
 }
69 71
 print '<div class="right"><div class="callsign-details"><div class="callsign"><a href="'.$globalURL.'/redirect/'.$spotter_item['flightaware_id'].'" target="_blank">'.$spotter_item['ident'].'</a></div>';
70
-if (isset($spotter_item['airline_name'])) print '<div class="airline">'.$spotter_item['airline_name'].'</div>';
72
+if (isset($spotter_item['airline_name'])) {
73
+	print '<div class="airline">'.$spotter_item['airline_name'].'</div>';
74
+}
71 75
 print '</div>';
72 76
 print '<div class="nomobile airports"><div class="airport"><span class="code"><a href="'.$globalURL.'/airport/'.$spotter_item['departure_airport'].'" target="_blank">'.$spotter_item['departure_airport'].'</a></span>'.$spotter_item['departure_airport_city'].' '.$spotter_item['departure_airport_country'];
73 77
 if (isset($spotter_item['departure_airport_time'])) {
@@ -95,9 +99,14 @@  discard block
 block discarded – undo
95 99
 print '<span class="code"><a href="'.$globalURL.'/airport/'.$spotter_item['arrival_airport'].'" target="_blank">'.$spotter_item['arrival_airport'].'</a></span>'.$spotter_item['arrival_airport_city'].' '.$spotter_item['arrival_airport_country'];
96 100
 print '</div></div><div>';
97 101
 print '<span>'._("Aircraft").'</span>';
98
-if (isset($spotter_item['aircraft_wiki'])) print '<a href="'.$spotter_item['aircraft_wiki'].'">'.$spotter_item['aircraft_name'].'</a>';
99
-if (isset($spotter_item['aircraft_type'])) print '<a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'">'.$spotter_item['aircraft_manufacturer'].' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')</a>';
100
-else print $spotter_item['aircraft_manufacturer'].' '.$spotter_item['aircraft_name'];
102
+if (isset($spotter_item['aircraft_wiki'])) {
103
+	print '<a href="'.$spotter_item['aircraft_wiki'].'">'.$spotter_item['aircraft_name'].'</a>';
104
+}
105
+if (isset($spotter_item['aircraft_type'])) {
106
+	print '<a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'">'.$spotter_item['aircraft_manufacturer'].' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')</a>';
107
+} else {
108
+	print $spotter_item['aircraft_manufacturer'].' '.$spotter_item['aircraft_name'];
109
+}
101 110
 print '</div>';
102 111
 print '<div><span>'._("Altitude").'</span>';
103 112
 if ((!isset($_COOKIE['unitaltitude']) && isset($globalUnitAltitude) && $globalUnitAltitude == 'feet') || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'feet')) {
@@ -106,7 +115,9 @@  discard block
 block discarded – undo
106 115
 	print round($spotter_item['altitude']*30.48).' m (FL'.$spotter_item['altitude'].')';
107 116
 }
108 117
 print '</div>';
109
-if (isset($spotter_item['registration']) && $spotter_item['registration'] != '') print '<div><span>'._("Registration").'</span><a href="'.$globalURL.'/registration/'.$spotter_item['registration'].'" target="_blank">'.$spotter_item['registration'].'</a></div>';
118
+if (isset($spotter_item['registration']) && $spotter_item['registration'] != '') {
119
+	print '<div><span>'._("Registration").'</span><a href="'.$globalURL.'/registration/'.$spotter_item['registration'].'" target="_blank">'.$spotter_item['registration'].'</a></div>';
120
+}
110 121
 print '<div><span>'._("Speed").'</span>';
111 122
 if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'mph') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'mph')) {
112 123
 	print round($spotter_item['ground_speed']*1.15078).' mph';
@@ -120,8 +131,11 @@  discard block
 block discarded – undo
120 131
 print '<div><span>'._("Heading").'</span>'.$spotter_item['heading'].'°</div>';
121 132
 if (isset($spotter_item['pilot_name']) && $spotter_item['pilot_name'] != '') {
122 133
 	print '<div><span>'._("Pilot").'</span>';
123
-	if (isset($spotter_item['pilot_id'])) print $spotter_item['pilot_name'].' ('.$spotter_item['pilot_id'].')';
124
-	else print $spotter_item['pilot_name'];
134
+	if (isset($spotter_item['pilot_id'])) {
135
+		print $spotter_item['pilot_name'].' ('.$spotter_item['pilot_id'].')';
136
+	} else {
137
+		print $spotter_item['pilot_name'];
138
+	}
125 139
 	print '</div>';
126 140
 }
127 141
 
@@ -147,10 +161,18 @@  discard block
 block discarded – undo
147 161
 }
148 162
 print '</div>';
149 163
 
150
-if (isset($globalphpVMS) && $globalphpVMS && isset($globalVATSIM) && $globalVATSIM && isset($globalIVAO) && $globalIVAO && isset($spotter_item['format_source']) && $spotter_item['format_source'] != '' && $spotter_item['format_source'] != 'pireps') print '<div class="waypoints"><span>'._("Source").'</span>'.$spotter_item['format_source'].'</div>';
151
-if (isset($spotter_item['waypoints']) && $spotter_item['waypoints'] != '') print '<div class="waypoints"><span>'._("Route").'</span>'.$spotter_item['waypoints'].'</div>';
152
-if (isset($spotter_item['acars']['message'])) print '<div class="acars"><span>'._("Latest ACARS message").'</span>'.trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'<br/>',$spotter_item['acars']['message'])).'</div>';
153
-if (isset($spotter_item['squawk']) && $spotter_item['squawk'] != '' && $spotter_item['squawk'] != 0) print '<div class="bottom">'._("Squawk:").' '.$spotter_item['squawk'].' - '.$spotter_item['squawk_usage'].'</div>';
164
+if (isset($globalphpVMS) && $globalphpVMS && isset($globalVATSIM) && $globalVATSIM && isset($globalIVAO) && $globalIVAO && isset($spotter_item['format_source']) && $spotter_item['format_source'] != '' && $spotter_item['format_source'] != 'pireps') {
165
+	print '<div class="waypoints"><span>'._("Source").'</span>'.$spotter_item['format_source'].'</div>';
166
+}
167
+if (isset($spotter_item['waypoints']) && $spotter_item['waypoints'] != '') {
168
+	print '<div class="waypoints"><span>'._("Route").'</span>'.$spotter_item['waypoints'].'</div>';
169
+}
170
+if (isset($spotter_item['acars']['message'])) {
171
+	print '<div class="acars"><span>'._("Latest ACARS message").'</span>'.trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'<br/>',$spotter_item['acars']['message'])).'</div>';
172
+}
173
+if (isset($spotter_item['squawk']) && $spotter_item['squawk'] != '' && $spotter_item['squawk'] != 0) {
174
+	print '<div class="bottom">'._("Squawk:").' '.$spotter_item['squawk'].' - '.$spotter_item['squawk_usage'].'</div>';
175
+}
154 176
 print '</div>';
155 177
 ?>
156 178
 </div>
157 179
\ No newline at end of file
Please login to merge, or discard this patch.
marine-data.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -63,7 +63,9 @@
 block discarded – undo
63 63
 {
64 64
 	if ($spotter_item['image_source'] == 'flickr' || $spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart') {
65 65
 		$image = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']);
66
-	} else $image = $spotter_item['image_thumbnail'];
66
+	} else {
67
+		$image = $spotter_item['image_thumbnail'];
68
+	}
67 69
 
68 70
 }
69 71
 /* else {
Please login to merge, or discard this patch.
require/class.Tracker.php 1 patch
Braces   +143 added lines, -51 removed lines patch added patch discarded remove patch
@@ -31,7 +31,9 @@  discard block
 block discarded – undo
31 31
 		if (isset($filter[0]['source'])) {
32 32
 			$filters = array_merge($filters,$filter);
33 33
 		}
34
-		if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter);
34
+		if (is_array($globalFilter)) {
35
+			$filter = array_merge($filter,$globalFilter);
36
+		}
35 37
 		$filter_query_join = '';
36 38
 		$filter_query_where = '';
37 39
 		foreach($filters as $flt) {
@@ -70,8 +72,11 @@  discard block
 block discarded – undo
70 72
 				$filter_query_where .= " AND EXTRACT(DAY FROM tracker_output.date) = '".$filter['day']."'";
71 73
 			}
72 74
 		}
73
-		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
74
-		elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND';
75
+		if ($filter_query_where == '' && $where) {
76
+			$filter_query_where = ' WHERE';
77
+		} elseif ($filter_query_where != '' && $and) {
78
+			$filter_query_where .= ' AND';
79
+		}
75 80
 		if ($filter_query_where != '') {
76 81
 			$filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where);
77 82
 		}
@@ -125,26 +130,43 @@  discard block
 block discarded – undo
125 130
 				$temp_array['spotter_id'] = $row['spotter_archive_id'];
126 131
 			} elseif (isset($row['spotter_archive_output_id'])) {
127 132
 				$temp_array['spotter_id'] = $row['spotter_archive_output_id'];
128
-			*/} 
129
-			elseif (isset($row['trackerid'])) {
133
+			*/} elseif (isset($row['trackerid'])) {
130 134
 				$temp_array['trackerid'] = $row['trackerid'];
131 135
 			} else {
132 136
 				$temp_array['trackerid'] = '';
133 137
 			}
134
-			if (isset($row['famtrackid'])) $temp_array['famtrackid'] = $row['famtrackid'];
135
-			if (isset($row['type'])) $temp_array['type'] = $row['type'];
136
-			if (isset($row['comment'])) $temp_array['comment'] = $row['comment'];
138
+			if (isset($row['famtrackid'])) {
139
+				$temp_array['famtrackid'] = $row['famtrackid'];
140
+			}
141
+			if (isset($row['type'])) {
142
+				$temp_array['type'] = $row['type'];
143
+			}
144
+			if (isset($row['comment'])) {
145
+				$temp_array['comment'] = $row['comment'];
146
+			}
137 147
 			$temp_array['ident'] = $row['ident'];
138
-			if (isset($row['latitude'])) $temp_array['latitude'] = $row['latitude'];
139
-			if (isset($row['longitude'])) $temp_array['longitude'] = $row['longitude'];
140
-			if (isset($row['format_source'])) $temp_array['format_source'] = $row['format_source'];
141
-			if (isset($row['altitude'])) $temp_array['altitude'] = $row['altitude'];
148
+			if (isset($row['latitude'])) {
149
+				$temp_array['latitude'] = $row['latitude'];
150
+			}
151
+			if (isset($row['longitude'])) {
152
+				$temp_array['longitude'] = $row['longitude'];
153
+			}
154
+			if (isset($row['format_source'])) {
155
+				$temp_array['format_source'] = $row['format_source'];
156
+			}
157
+			if (isset($row['altitude'])) {
158
+				$temp_array['altitude'] = $row['altitude'];
159
+			}
142 160
 			if (isset($row['heading'])) {
143 161
 				$temp_array['heading'] = $row['heading'];
144 162
 				$heading_direction = $this->parseDirection($row['heading']);
145
-				if (isset($heading_direction[0]['direction_fullname'])) $temp_array['heading_name'] = $heading_direction[0]['direction_fullname'];
163
+				if (isset($heading_direction[0]['direction_fullname'])) {
164
+					$temp_array['heading_name'] = $heading_direction[0]['direction_fullname'];
165
+				}
166
+			}
167
+			if (isset($row['ground_speed'])) {
168
+				$temp_array['ground_speed'] = $row['ground_speed'];
146 169
 			}
147
-			if (isset($row['ground_speed'])) $temp_array['ground_speed'] = $row['ground_speed'];
148 170
 			
149 171
 			if (isset($row['date'])) {
150 172
 				$dateArray = $this->parseDateString($row['date']);
@@ -187,13 +209,21 @@  discard block
 block discarded – undo
187 209
 			}
188 210
 			
189 211
 			$fromsource = NULL;
190
-			if (isset($row['source_name']) && $row['source_name'] != '') $temp_array['source_name'] = $row['source_name'];
191
-			if (isset($row['over_country']) && $row['over_country'] != '') $temp_array['over_country'] = $row['over_country'];
192
-			if (isset($row['distance']) && $row['distance'] != '') $temp_array['distance'] = $row['distance'];
212
+			if (isset($row['source_name']) && $row['source_name'] != '') {
213
+				$temp_array['source_name'] = $row['source_name'];
214
+			}
215
+			if (isset($row['over_country']) && $row['over_country'] != '') {
216
+				$temp_array['over_country'] = $row['over_country'];
217
+			}
218
+			if (isset($row['distance']) && $row['distance'] != '') {
219
+				$temp_array['distance'] = $row['distance'];
220
+			}
193 221
 			$temp_array['query_number_rows'] = $num_rows;
194 222
 			$spotter_array[] = $temp_array;
195 223
 		}
196
-		if ($num_rows == 0) return array();
224
+		if ($num_rows == 0) {
225
+			return array();
226
+		}
197 227
 		$spotter_array[0]['query_number_rows'] = $num_rows;
198 228
 		return $spotter_array;
199 229
 	}	
@@ -224,8 +254,12 @@  discard block
 block discarded – undo
224 254
 			{
225 255
 				//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
226 256
 				$limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0];
227
-			} else $limit_query = "";
228
-		} else $limit_query = "";
257
+			} else {
258
+				$limit_query = "";
259
+			}
260
+		} else {
261
+			$limit_query = "";
262
+		}
229 263
 		
230 264
 		if ($sort != "")
231 265
 		{
@@ -253,7 +287,9 @@  discard block
 block discarded – undo
253 287
 		global $global_query;
254 288
 		
255 289
 		date_default_timezone_set('UTC');
256
-		if ($id == '') return array();
290
+		if ($id == '') {
291
+			return array();
292
+		}
257 293
 		$additional_query = "tracker_output.famtrackid = :id";
258 294
 		$query_values = array(':id' => $id);
259 295
 		$query  = $global_query." WHERE ".$additional_query." ";
@@ -396,8 +432,11 @@  discard block
 block discarded – undo
396 432
 		$query .= " ORDER BY tracker_output.source_name ASC";
397 433
 
398 434
 		$sth = $this->db->prepare($query);
399
-		if (!empty($query_values)) $sth->execute($query_values);
400
-		else $sth->execute();
435
+		if (!empty($query_values)) {
436
+			$sth->execute($query_values);
437
+		} else {
438
+			$sth->execute();
439
+		}
401 440
 
402 441
 		$source_array = array();
403 442
 		$temp_array = array();
@@ -452,7 +491,9 @@  discard block
 block discarded – undo
452 491
 			date_default_timezone_set($globalTimezone);
453 492
 			$datetime = new DateTime();
454 493
 			$offset = $datetime->format('P');
455
-		} else $offset = '+00:00';
494
+		} else {
495
+			$offset = '+00:00';
496
+		}
456 497
 
457 498
 		if ($globalDBdriver == 'mysql') {
458 499
 			$query  = "SELECT DISTINCT DATE(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) as date
@@ -608,7 +649,9 @@  discard block
 block discarded – undo
608 649
 			{
609 650
 				return false;
610 651
 			}
611
-		} else $altitude = 0;
652
+		} else {
653
+			$altitude = 0;
654
+		}
612 655
 		
613 656
 		if ($heading != "")
614 657
 		{
@@ -647,8 +690,12 @@  discard block
 block discarded – undo
647 690
             		$latitude = 0;
648 691
             		$longitude = 0;
649 692
             	}
650
-                if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
651
-                if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
693
+                if ($heading == '' || $Common->isInteger($heading) === false) {
694
+                	$heading = 0;
695
+                }
696
+                if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) {
697
+                	$groundspeed = 0;
698
+                }
652 699
                 $query  = "INSERT INTO tracker_output (famtrackid, ident, latitude, longitude, altitude, heading, ground_speed, date, format_source, source_name, comment, type) 
653 700
                 VALUES (:famtrackid,:ident,:latitude,:longitude,:altitude,:heading,:speed,:date,:format_source, :source_name,:comment,:type)";
654 701
 
@@ -813,12 +860,18 @@  discard block
 block discarded – undo
813 860
 		$query  = "SELECT DISTINCT tracker_output.ident, COUNT(tracker_output.ident) AS callsign_icao_count 
814 861
                     FROM tracker_output".$filter_query." tracker_output.ident <> ''";
815 862
 		 if ($olderthanmonths > 0) {
816
-			if ($globalDBdriver == 'mysql') $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)';
817
-			else $query .= " AND tracker_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
863
+			if ($globalDBdriver == 'mysql') {
864
+				$query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)';
865
+			} else {
866
+				$query .= " AND tracker_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
867
+			}
818 868
 		}
819 869
 		if ($sincedate != '') {
820
-			if ($globalDBdriver == 'mysql') $query .= " AND tracker_output.date > '".$sincedate."'";
821
-			else $query .= " AND tracker_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
870
+			if ($globalDBdriver == 'mysql') {
871
+				$query .= " AND tracker_output.date > '".$sincedate."'";
872
+			} else {
873
+				$query .= " AND tracker_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
874
+			}
822 875
 		}
823 876
 		$query_values = array();
824 877
 		if ($year != '') {
@@ -849,7 +902,9 @@  discard block
 block discarded – undo
849 902
 			}
850 903
 		}
851 904
 		$query .= " GROUP BY tracker_output.ident ORDER BY callsign_icao_count DESC";
852
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
905
+		if ($limit) {
906
+			$query .= " LIMIT 10 OFFSET 0";
907
+		}
853 908
       		
854 909
 		$sth = $this->db->prepare($query);
855 910
 		$sth->execute($query_values);
@@ -884,7 +939,9 @@  discard block
 block discarded – undo
884 939
 			date_default_timezone_set($globalTimezone);
885 940
 			$datetime = new DateTime();
886 941
 			$offset = $datetime->format('P');
887
-		} else $offset = '+00:00';
942
+		} else {
943
+			$offset = '+00:00';
944
+		}
888 945
 
889 946
 		if ($globalDBdriver == 'mysql') {
890 947
 			$query  = "SELECT DATE(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -934,7 +991,9 @@  discard block
 block discarded – undo
934 991
 			date_default_timezone_set($globalTimezone);
935 992
 			$datetime = new DateTime();
936 993
 			$offset = $datetime->format('P');
937
-		} else $offset = '+00:00';
994
+		} else {
995
+			$offset = '+00:00';
996
+		}
938 997
 		$filter_query = $this->getFilter($filters,true,true);
939 998
 		if ($globalDBdriver == 'mysql') {
940 999
 			$query  = "SELECT DATE(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -980,7 +1039,9 @@  discard block
 block discarded – undo
980 1039
 			date_default_timezone_set($globalTimezone);
981 1040
 			$datetime = new DateTime();
982 1041
 			$offset = $datetime->format('P');
983
-		} else $offset = '+00:00';
1042
+		} else {
1043
+			$offset = '+00:00';
1044
+		}
984 1045
 		$filter_query = $this->getFilter($filters,true,true);
985 1046
 		if ($globalDBdriver == 'mysql') {
986 1047
 			$query  = "SELECT DATE(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -1028,7 +1089,9 @@  discard block
 block discarded – undo
1028 1089
 			date_default_timezone_set($globalTimezone);
1029 1090
 			$datetime = new DateTime();
1030 1091
 			$offset = $datetime->format('P');
1031
-		} else $offset = '+00:00';
1092
+		} else {
1093
+			$offset = '+00:00';
1094
+		}
1032 1095
 
1033 1096
 		if ($globalDBdriver == 'mysql') {
1034 1097
 			$query  = "SELECT YEAR(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS month_name, count(*) as date_count
@@ -1077,7 +1140,9 @@  discard block
 block discarded – undo
1077 1140
 			date_default_timezone_set($globalTimezone);
1078 1141
 			$datetime = new DateTime();
1079 1142
 			$offset = $datetime->format('P');
1080
-		} else $offset = '+00:00';
1143
+		} else {
1144
+			$offset = '+00:00';
1145
+		}
1081 1146
 		$filter_query = $this->getFilter($filters,true,true);
1082 1147
 		if ($globalDBdriver == 'mysql') {
1083 1148
 			$query  = "SELECT MONTH(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS month_name, YEAR(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS year_name, count(*) as date_count
@@ -1126,7 +1191,9 @@  discard block
 block discarded – undo
1126 1191
 			date_default_timezone_set($globalTimezone);
1127 1192
 			$datetime = new DateTime();
1128 1193
 			$offset = $datetime->format('P');
1129
-		} else $offset = '+00:00';
1194
+		} else {
1195
+			$offset = '+00:00';
1196
+		}
1130 1197
 
1131 1198
 		$orderby_sql = '';
1132 1199
 		if ($orderby == "hour")
@@ -1195,7 +1262,9 @@  discard block
 block discarded – undo
1195 1262
 			date_default_timezone_set($globalTimezone);
1196 1263
 			$datetime = new DateTime($date);
1197 1264
 			$offset = $datetime->format('P');
1198
-		} else $offset = '+00:00';
1265
+		} else {
1266
+			$offset = '+00:00';
1267
+		}
1199 1268
 
1200 1269
 		if ($globalDBdriver == 'mysql') {
1201 1270
 			$query  = "SELECT HOUR(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -1243,7 +1312,9 @@  discard block
 block discarded – undo
1243 1312
 			date_default_timezone_set($globalTimezone);
1244 1313
 			$datetime = new DateTime();
1245 1314
 			$offset = $datetime->format('P');
1246
-		} else $offset = '+00:00';
1315
+		} else {
1316
+			$offset = '+00:00';
1317
+		}
1247 1318
 
1248 1319
 		if ($globalDBdriver == 'mysql') {
1249 1320
 			$query  = "SELECT HOUR(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -1307,8 +1378,11 @@  discard block
 block discarded – undo
1307 1378
 				$query_values = array_merge($query_values,array(':month' => $month));
1308 1379
 			}
1309 1380
 		}
1310
-		if (empty($query_values)) $queryi .= $this->getFilter($filters);
1311
-		else $queryi .= $this->getFilter($filters,true,true).substr($query,4);
1381
+		if (empty($query_values)) {
1382
+			$queryi .= $this->getFilter($filters);
1383
+		} else {
1384
+			$queryi .= $this->getFilter($filters,true,true).substr($query,4);
1385
+		}
1312 1386
 		
1313 1387
 		$sth = $this->db->prepare($queryi);
1314 1388
 		$sth->execute($query_values);
@@ -1330,7 +1404,9 @@  discard block
 block discarded – undo
1330 1404
 			date_default_timezone_set($globalTimezone);
1331 1405
 			$datetime = new DateTime();
1332 1406
 			$offset = $datetime->format('P');
1333
-		} else $offset = '+00:00';
1407
+		} else {
1408
+			$offset = '+00:00';
1409
+		}
1334 1410
 
1335 1411
 		if ($globalDBdriver == 'mysql') {
1336 1412
 			$query  = "SELECT HOUR(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -1434,7 +1510,9 @@  discard block
 block discarded – undo
1434 1510
 	*/
1435 1511
 	public function parseDirection($direction = 0)
1436 1512
 	{
1437
-		if ($direction == '') $direction = 0;
1513
+		if ($direction == '') {
1514
+			$direction = 0;
1515
+		}
1438 1516
 		$direction_array = array();
1439 1517
 		$temp_array = array();
1440 1518
 
@@ -1523,7 +1601,9 @@  discard block
 block discarded – undo
1523 1601
 		$longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1524 1602
 	
1525 1603
 		$Connection = new Connection($this->db);
1526
-		if (!$Connection->tableExists('countries')) return '';
1604
+		if (!$Connection->tableExists('countries')) {
1605
+			return '';
1606
+		}
1527 1607
 	
1528 1608
 		try {
1529 1609
 			/*
@@ -1543,9 +1623,13 @@  discard block
 block discarded – undo
1543 1623
 			$sth->closeCursor();
1544 1624
 			if (count($row) > 0) {
1545 1625
 				return $row;
1546
-			} else return '';
1626
+			} else {
1627
+				return '';
1628
+			}
1547 1629
 		} catch (PDOException $e) {
1548
-			if (isset($globalDebug) && $globalDebug) echo 'Error : '.$e->getMessage()."\n";
1630
+			if (isset($globalDebug) && $globalDebug) {
1631
+				echo 'Error : '.$e->getMessage()."\n";
1632
+			}
1549 1633
 			return '';
1550 1634
 		}
1551 1635
 	
@@ -1563,7 +1647,9 @@  discard block
 block discarded – undo
1563 1647
 		$iso2 = filter_var($iso2,FILTER_SANITIZE_STRING);
1564 1648
 	
1565 1649
 		$Connection = new Connection($this->db);
1566
-		if (!$Connection->tableExists('countries')) return '';
1650
+		if (!$Connection->tableExists('countries')) {
1651
+			return '';
1652
+		}
1567 1653
 	
1568 1654
 		try {
1569 1655
 			$query = "SELECT name,iso2,iso3 FROM countries WHERE iso2 = :iso2 LIMIT 1";
@@ -1575,9 +1661,13 @@  discard block
 block discarded – undo
1575 1661
 			$sth->closeCursor();
1576 1662
 			if (count($row) > 0) {
1577 1663
 				return $row;
1578
-			} else return '';
1664
+			} else {
1665
+				return '';
1666
+			}
1579 1667
 		} catch (PDOException $e) {
1580
-			if (isset($globalDebug) && $globalDebug) echo 'Error : '.$e->getMessage()."\n";
1668
+			if (isset($globalDebug) && $globalDebug) {
1669
+				echo 'Error : '.$e->getMessage()."\n";
1670
+			}
1581 1671
 			return '';
1582 1672
 		}
1583 1673
 	
@@ -1595,7 +1685,9 @@  discard block
 block discarded – undo
1595 1685
 	{
1596 1686
 		global $globalBitlyAccessToken;
1597 1687
 		
1598
-		if ($globalBitlyAccessToken == '') return $url;
1688
+		if ($globalBitlyAccessToken == '') {
1689
+			return $url;
1690
+		}
1599 1691
         
1600 1692
 		$google_url = 'https://api-ssl.bitly.com/v3/shorten?access_token='.$globalBitlyAccessToken.'&longUrl='.$url;
1601 1693
 		
Please login to merge, or discard this patch.
require/class.TrackerLive.php 1 patch
Braces   +59 added lines, -20 removed lines patch added patch discarded remove patch
@@ -29,7 +29,9 @@  discard block
 block discarded – undo
29 29
 		if (isset($filter[0]['source'])) {
30 30
 			$filters = array_merge($filters,$filter);
31 31
 		}
32
-		if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter);
32
+		if (is_array($globalFilter)) {
33
+			$filter = array_merge($filter,$globalFilter);
34
+		}
33 35
 		$filter_query_join = '';
34 36
 		$filter_query_where = '';
35 37
 		foreach($filters as $flt) {
@@ -76,8 +78,11 @@  discard block
 block discarded – undo
76 78
 		if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
77 79
 			$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
78 80
 		}
79
-		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
80
-		elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND';
81
+		if ($filter_query_where == '' && $where) {
82
+			$filter_query_where = ' WHERE';
83
+		} elseif ($filter_query_where != '' && $and) {
84
+			$filter_query_where .= ' AND';
85
+		}
81 86
 		if ($filter_query_where != '') {
82 87
 			$filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where);
83 88
 		}
@@ -119,7 +124,9 @@  discard block
 block discarded – undo
119 124
 			}
120 125
 		}
121 126
 
122
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
127
+		if (!isset($globalLiveInterval)) {
128
+			$globalLiveInterval = '200';
129
+		}
123 130
 		if ($globalDBdriver == 'mysql') {
124 131
 			//$query  = "SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 SECOND) <= l.date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate";
125 132
 			$query  = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate'.$filter_query.$orderby_query;
@@ -144,7 +151,9 @@  discard block
 block discarded – undo
144 151
 
145 152
 		$filter_query = $this->getFilter($filter,true,true);
146 153
 
147
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
154
+		if (!isset($globalLiveInterval)) {
155
+			$globalLiveInterval = '200';
156
+		}
148 157
 		if ($globalDBdriver == 'mysql') {
149 158
 			$query  = 'SELECT tracker_live.ident, tracker_live.type,tracker_live.famtrackid, tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source 
150 159
 			FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate'.$filter_query." tracker_live.latitude <> 0 AND tracker_live.longitude <> 0";
@@ -182,7 +191,9 @@  discard block
 block discarded – undo
182 191
 
183 192
 		$filter_query = $this->getFilter($filter,true,true);
184 193
 
185
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
194
+		if (!isset($globalLiveInterval)) {
195
+			$globalLiveInterval = '200';
196
+		}
186 197
 		if ($globalDBdriver == 'mysql') {
187 198
 			$query  = 'SELECT tracker_live.ident, tracker_live.famtrackid,tracker_live.type, tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source 
188 199
 			FROM tracker_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= tracker_live.date AND tracker_live.latitude <> '0' AND tracker_live.longitude <> '0' 
@@ -215,7 +226,9 @@  discard block
 block discarded – undo
215 226
 		global $globalDBdriver, $globalLiveInterval;
216 227
 		$filter_query = $this->getFilter($filter,true,true);
217 228
 
218
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
229
+		if (!isset($globalLiveInterval)) {
230
+			$globalLiveInterval = '200';
231
+		}
219 232
 		if ($globalDBdriver == 'mysql') {
220 233
 			$query = 'SELECT COUNT(DISTINCT tracker_live.famtrackid) as nb FROM tracker_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date';
221 234
 		} else {
@@ -243,7 +256,9 @@  discard block
 block discarded – undo
243 256
 	{
244 257
 		global $globalDBdriver, $globalLiveInterval;
245 258
 		$Spotter = new Spotter($this->db);
246
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
259
+		if (!isset($globalLiveInterval)) {
260
+			$globalLiveInterval = '200';
261
+		}
247 262
 		$filter_query = $this->getFilter($filter);
248 263
 
249 264
 		if (is_array($coord)) {
@@ -251,7 +266,9 @@  discard block
 block discarded – undo
251 266
 			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
252 267
 			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
253 268
 			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
254
-		} else return array();
269
+		} else {
270
+			return array();
271
+		}
255 272
 		if ($globalDBdriver == 'mysql') {
256 273
 			$query  = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate AND tracker_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND tracker_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.' GROUP BY tracker_live.famtrackid'.$filter_query;
257 274
 		} else {
@@ -441,11 +458,15 @@  discard block
 block discarded – undo
441 458
 		//$query  = self::$global_query.' WHERE tracker_live.famtrackid = :id ORDER BY date';
442 459
 		if ($globalDBdriver == 'mysql') {
443 460
 			$query = 'SELECT tracker_live.* FROM tracker_live WHERE tracker_live.famtrackid = :id';
444
-			if ($liveinterval) $query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date';
461
+			if ($liveinterval) {
462
+				$query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date';
463
+			}
445 464
 			$query .= ' ORDER BY date';
446 465
 		} else {
447 466
 			$query = 'SELECT tracker_live.* FROM tracker_live WHERE tracker_live.famtrackid = :id';
448
-			if ($liveinterval) $query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date";
467
+			if ($liveinterval) {
468
+				$query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date";
469
+			}
449 470
 			$query .= ' ORDER BY date';
450 471
 		}
451 472
 
@@ -540,7 +561,9 @@  discard block
 block discarded – undo
540 561
 				$i++;
541 562
 				$j++;
542 563
 				if ($j == 30) {
543
-					if ($globalDebug) echo ".";
564
+					if ($globalDebug) {
565
+						echo ".";
566
+					}
544 567
 				    	try {
545 568
 						
546 569
 						$sth = $this->db->prepare(substr($query_delete,0,-1).")");
@@ -787,7 +810,9 @@  discard block
 block discarded – undo
787 810
 			{
788 811
 				return false;
789 812
 			}
790
-		} else return '';
813
+		} else {
814
+			return '';
815
+		}
791 816
 
792 817
 		if ($longitude != '')
793 818
 		{
@@ -795,7 +820,9 @@  discard block
 block discarded – undo
795 820
 			{
796 821
 				return false;
797 822
 			}
798
-		} else return '';
823
+		} else {
824
+			return '';
825
+		}
799 826
 
800 827
 		if ($altitude != '')
801 828
 		{
@@ -803,7 +830,9 @@  discard block
 block discarded – undo
803 830
 			{
804 831
 				return false;
805 832
 			}
806
-		} else $altitude = 0;
833
+		} else {
834
+			$altitude = 0;
835
+		}
807 836
 
808 837
 		if ($heading != '')
809 838
 		{
@@ -811,7 +840,9 @@  discard block
 block discarded – undo
811 840
 			{
812 841
 				return false;
813 842
 			}
814
-		} else $heading = 0;
843
+		} else {
844
+			$heading = 0;
845
+		}
815 846
 
816 847
 		if ($groundspeed != '')
817 848
 		{
@@ -819,9 +850,13 @@  discard block
 block discarded – undo
819 850
 			{
820 851
 				return false;
821 852
 			}
822
-		} else $groundspeed = 0;
853
+		} else {
854
+			$groundspeed = 0;
855
+		}
823 856
 		date_default_timezone_set('UTC');
824
-		if ($date == '') $date = date("Y-m-d H:i:s", time());
857
+		if ($date == '') {
858
+			$date = date("Y-m-d H:i:s", time());
859
+		}
825 860
 
826 861
         
827 862
 		$famtrackid = filter_var($famtrackid,FILTER_SANITIZE_STRING);
@@ -837,8 +872,12 @@  discard block
 block discarded – undo
837 872
 		$comment = filter_var($comment,FILTER_SANITIZE_STRING);
838 873
 		$type = filter_var($type,FILTER_SANITIZE_STRING);
839 874
 
840
-            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
841
-            	if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
875
+            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) {
876
+            		$groundspeed = 0;
877
+            	}
878
+            	if ($heading == '' || $Common->isInteger($heading) === false ) {
879
+            		$heading = 0;
880
+            	}
842 881
             	
843 882
 		$query  = 'INSERT INTO tracker_live (famtrackid, ident, latitude, longitude, altitude, heading, ground_speed, date, format_source, source_name, over_country, comment, type) 
844 883
 		VALUES (:famtrackid,:ident,:latitude,:longitude,:altitude,:heading,:groundspeed,:date,:format_source, :source_name, :over_country,:comment,:type)';
Please login to merge, or discard this patch.
require/class.TrackerImport.php 1 patch
Braces   +149 added lines, -51 removed lines patch added patch discarded remove patch
@@ -44,7 +44,9 @@  discard block
 block discarded – undo
44 44
 
45 45
     public function checkAll() {
46 46
 	global $globalDebug;
47
-	if ($globalDebug) echo "Update last seen tracked data...\n";
47
+	if ($globalDebug) {
48
+		echo "Update last seen tracked data...\n";
49
+	}
48 50
 	foreach ($this->all_tracked as $key => $flight) {
49 51
 	    if (isset($this->all_tracked[$key]['id'])) {
50 52
 		//echo $this->all_tracked[$key]['id'].' - '.$this->all_tracked[$key]['latitude'].'  '.$this->all_tracked[$key]['longitude']."\n";
@@ -57,12 +59,16 @@  discard block
 block discarded – undo
57 59
     public function del() {
58 60
 	global $globalDebug;
59 61
 	// Delete old infos
60
-	if ($globalDebug) echo 'Delete old values and update latest data...'."\n";
62
+	if ($globalDebug) {
63
+		echo 'Delete old values and update latest data...'."\n";
64
+	}
61 65
 	foreach ($this->all_tracked as $key => $flight) {
62 66
     	    if (isset($flight['lastupdate'])) {
63 67
         	if ($flight['lastupdate'] < (time()-3000)) {
64 68
             	    if (isset($this->all_tracked[$key]['id'])) {
65
-            		if ($globalDebug) echo "--- Delete old values with id ".$this->all_tracked[$key]['id']."\n";
69
+            		if ($globalDebug) {
70
+            			echo "--- Delete old values with id ".$this->all_tracked[$key]['id']."\n";
71
+            		}
66 72
 			/*
67 73
 			$TrackerLive = new TrackerLive();
68 74
             		$TrackerLive->deleteLiveTrackerDataById($this->all_tracked[$key]['id']);
@@ -72,7 +78,9 @@  discard block
 block discarded – undo
72 78
             		$Tracker = new Tracker($this->db);
73 79
             		if ($this->all_tracked[$key]['latitude'] != '' && $this->all_tracked[$key]['longitude'] != '') {
74 80
 				$result = $Tracker->updateLatestTrackerData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['altitude'],$this->all_tracked[$key]['speed']);
75
-				if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n";
81
+				if ($globalDebug && $result != 'success') {
82
+					echo '!!! ERROR : '.$result."\n";
83
+				}
76 84
 			}
77 85
 			// Put in archive
78 86
 //			$Tracker->db = null;
@@ -85,7 +93,9 @@  discard block
 block discarded – undo
85 93
 
86 94
     public function add($line) {
87 95
 	global $globalFork, $globalDistanceIgnore, $globalDaemon, $globalDebug, $globalCoordMinChange, $globalDebugTimeElapsed, $globalCenterLatitude, $globalCenterLongitude, $globalBeta, $globalSourcesupdate, $globalAllTracked;
88
-	if (!isset($globalCoordMinChange) || $globalCoordMinChange == '') $globalCoordMinChange = '0.02';
96
+	if (!isset($globalCoordMinChange) || $globalCoordMinChange == '') {
97
+		$globalCoordMinChange = '0.02';
98
+	}
89 99
 	date_default_timezone_set('UTC');
90 100
 	$dataFound = false;
91 101
 	$send = false;
@@ -109,8 +119,11 @@  discard block
 block discarded – undo
109 119
 		*/
110 120
 		
111 121
 		$Common = new Common();
112
-	        if (!isset($line['id'])) $id = trim($line['ident']);
113
-	        else $id = trim($line['id']);
122
+	        if (!isset($line['id'])) {
123
+	        	$id = trim($line['ident']);
124
+	        } else {
125
+	        	$id = trim($line['id']);
126
+	        }
114 127
 		
115 128
 		if (!isset($this->all_tracked[$id])) {
116 129
 		    $this->all_tracked[$id] = array();
@@ -118,18 +131,27 @@  discard block
 block discarded – undo
118 131
 		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => '','latitude' => '', 'longitude' => '', 'speed' => '', 'altitude' => '', 'heading' => '', 'format_source' => '','source_name' => '','comment'=> '','type' => '','noarchive' => false,'putinarchive' => true,'over_country' => ''));
119 132
 		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('lastupdate' => time()));
120 133
 		    if (!isset($line['id'])) {
121
-			if (!isset($globalDaemon)) $globalDaemon = TRUE;
134
+			if (!isset($globalDaemon)) {
135
+				$globalDaemon = TRUE;
136
+			}
122 137
 			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $id.'-'.date('YmdHi')));
123
-		     } else $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $line['id']));
124
-		    if ($globalAllTracked !== FALSE) $dataFound = true;
138
+		     } else {
139
+		     	$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $line['id']));
140
+		     }
141
+		    if ($globalAllTracked !== FALSE) {
142
+		    	$dataFound = true;
143
+		    }
125 144
 		}
126 145
 		
127 146
 		if (isset($line['datetime']) && strtotime($line['datetime']) > time()-20*60) {
128 147
 		    if (!isset($this->all_tracked[$id]['datetime']) || strtotime($line['datetime']) >= strtotime($this->all_tracked[$id]['datetime'])) {
129 148
 			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('datetime' => $line['datetime']));
130 149
 		    } else {
131
-				if (strtotime($line['datetime']) == strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) echo "!!! Date is the same as previous data for ".$this->all_tracked[$id]['hex']." - format : ".$line['format_source']."\n";
132
-				elseif (strtotime($line['datetime']) > strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) echo "!!! Date previous latest data (".$line['datetime']." > ".$this->all_tracked[$id]['datetime'].") !!! for ".$this->all_tracked[$id]['hex']." - format : ".$line['format_source']."\n";
150
+				if (strtotime($line['datetime']) == strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) {
151
+					echo "!!! Date is the same as previous data for ".$this->all_tracked[$id]['hex']." - format : ".$line['format_source']."\n";
152
+				} elseif (strtotime($line['datetime']) > strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) {
153
+					echo "!!! Date previous latest data (".$line['datetime']." > ".$this->all_tracked[$id]['datetime'].") !!! for ".$this->all_tracked[$id]['hex']." - format : ".$line['format_source']."\n";
154
+				}
133 155
 				return '';
134 156
 		    }
135 157
 		} else {
@@ -145,11 +167,17 @@  discard block
 block discarded – undo
145 167
             		$Tracker = new Tracker($this->db);
146 168
             		$fromsource = NULL;
147 169
             		$result = $Tracker->updateIdentTrackerData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['ident'],$fromsource);
148
-			if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n";
170
+			if ($globalDebug && $result != 'success') {
171
+				echo '!!! ERROR : '.$result."\n";
172
+			}
149 173
 			$Tracker->db = null;
150
-			if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
174
+			if ($globalDebugTimeElapsed) {
175
+				echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
176
+			}
177
+		    }
178
+		    if (!isset($this->all_tracked[$id]['id'])) {
179
+		    	$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident']));
151 180
 		    }
152
-		    if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident']));
153 181
 		}
154 182
 
155 183
 		if (isset($line['speed']) && $line['speed'] != '') {
@@ -160,14 +188,21 @@  discard block
 block discarded – undo
160 188
 		    if ($distance > 1000 && $distance < 10000) {
161 189
 			$speed = $distance/(time() - $this->all_tracked[$id]['time_last_coord']);
162 190
 			$speed = $speed*3.6;
163
-			if ($speed < 1000) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($speed)));
164
-  			if ($globalDebug) echo "ø Calculated Speed for ".$this->all_tracked[$id]['hex']." : ".$speed." - distance : ".$distance."\n";
191
+			if ($speed < 1000) {
192
+				$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($speed)));
193
+			}
194
+  			if ($globalDebug) {
195
+  				echo "ø Calculated Speed for ".$this->all_tracked[$id]['hex']." : ".$speed." - distance : ".$distance."\n";
196
+  			}
165 197
 		    }
166 198
 		}
167 199
 
168 200
 	        if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) {
169
-	    	    if (isset($this->all_tracked[$id]['time_last_coord'])) $timediff = round(time()-$this->all_tracked[$id]['time_last_coord']);
170
-	    	    else unset($timediff);
201
+	    	    if (isset($this->all_tracked[$id]['time_last_coord'])) {
202
+	    	    	$timediff = round(time()-$this->all_tracked[$id]['time_last_coord']);
203
+	    	    } else {
204
+	    	    	unset($timediff);
205
+	    	    }
171 206
 	    	    if ($this->tmd > 5 || !isset($timediff) || $timediff > 2000 || ($timediff > 30 && isset($this->all_tracked[$id]['latitude']) && isset($this->all_tracked[$id]['longitude']) && $Common->withinThreshold($timediff,$Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')))) {
172 207
 			if (isset($this->all_tracked[$id]['archive_latitude']) && isset($this->all_tracked[$id]['archive_longitude']) && isset($this->all_tracked[$id]['livedb_latitude']) && isset($this->all_tracked[$id]['livedb_longitude'])) {
173 208
 			    if (!$Common->checkLine($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['livedb_latitude'],$this->all_tracked[$id]['livedb_longitude'],$line['latitude'],$line['longitude'])) {
@@ -175,20 +210,30 @@  discard block
 block discarded – undo
175 210
 				$this->all_tracked[$id]['archive_longitude'] = $line['longitude'];
176 211
 				$this->all_tracked[$id]['putinarchive'] = true;
177 212
 				
178
-				if ($globalDebug) echo "\n".' ------- Check Country for '.$this->all_tracked[$id]['ident'].' with latitude : '.$line['latitude'].' and longitude : '.$line['longitude'].'.... ';
213
+				if ($globalDebug) {
214
+					echo "\n".' ------- Check Country for '.$this->all_tracked[$id]['ident'].' with latitude : '.$line['latitude'].' and longitude : '.$line['longitude'].'.... ';
215
+				}
179 216
 				$timeelapsed = microtime(true);
180 217
 				$Tracker = new Tracker($this->db);
181 218
 				$all_country = $Tracker->getCountryFromLatitudeLongitude($line['latitude'],$line['longitude']);
182
-				if (!empty($all_country)) $this->all_tracked[$id]['over_country'] = $all_country['iso2'];
219
+				if (!empty($all_country)) {
220
+					$this->all_tracked[$id]['over_country'] = $all_country['iso2'];
221
+				}
183 222
 				$Tracker->db = null;
184
-				if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
223
+				if ($globalDebugTimeElapsed) {
224
+					echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
225
+				}
185 226
 				$this->tmd = 0;
186
-				if ($globalDebug) echo 'FOUND : '.$this->all_tracked[$id]['over_country'].' ---------------'."\n";
227
+				if ($globalDebug) {
228
+					echo 'FOUND : '.$this->all_tracked[$id]['over_country'].' ---------------'."\n";
229
+				}
187 230
 			    }
188 231
 			}
189 232
 
190 233
 			if (isset($line['latitude']) && $line['latitude'] != '' && $line['latitude'] != 0 && $line['latitude'] < 91 && $line['latitude'] > -90) {
191
-				if (!isset($this->all_tracked[$id]['archive_latitude'])) $this->all_tracked[$id]['archive_latitude'] = $line['latitude'];
234
+				if (!isset($this->all_tracked[$id]['archive_latitude'])) {
235
+					$this->all_tracked[$id]['archive_latitude'] = $line['latitude'];
236
+				}
192 237
 				if (!isset($this->all_tracked[$id]['livedb_latitude']) || abs($this->all_tracked[$id]['livedb_latitude']-$line['latitude']) > $globalCoordMinChange || $this->all_tracked[$id]['format_source'] == 'aprs') {
193 238
 				    $this->all_tracked[$id]['livedb_latitude'] = $line['latitude'];
194 239
 				    $dataFound = true;
@@ -197,8 +242,12 @@  discard block
 block discarded – undo
197 242
 				$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('latitude' => $line['latitude']));
198 243
 			}
199 244
 			if (isset($line['longitude']) && $line['longitude'] != '' && $line['longitude'] != 0 && $line['longitude'] < 360 && $line['longitude'] > -180) {
200
-			    if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360;
201
-				if (!isset($this->all_tracked[$id]['archive_longitude'])) $this->all_tracked[$id]['archive_longitude'] = $line['longitude'];
245
+			    if ($line['longitude'] > 180) {
246
+			    	$line['longitude'] = $line['longitude'] - 360;
247
+			    }
248
+				if (!isset($this->all_tracked[$id]['archive_longitude'])) {
249
+					$this->all_tracked[$id]['archive_longitude'] = $line['longitude'];
250
+				}
202 251
 				if (!isset($this->all_tracked[$id]['livedb_longitude']) || abs($this->all_tracked[$id]['livedb_longitude']-$line['longitude']) > $globalCoordMinChange || $this->all_tracked[$id]['format_source'] == 'aprs') {
203 252
 				    $this->all_tracked[$id]['livedb_longitude'] = $line['longitude'];
204 253
 				    $dataFound = true;
@@ -216,7 +265,9 @@  discard block
 block discarded – undo
216 265
 		    }
217 266
 		}
218 267
 		if (isset($line['last_update']) && $line['last_update'] != '') {
219
-		    if (isset($this->all_tracked[$id]['last_update']) && $this->all_tracked[$id]['last_update'] != $line['last_update']) $dataFound = true;
268
+		    if (isset($this->all_tracked[$id]['last_update']) && $this->all_tracked[$id]['last_update'] != $line['last_update']) {
269
+		    	$dataFound = true;
270
+		    }
220 271
 		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('last_update' => $line['last_update']));
221 272
 		}
222 273
 		if (isset($line['format_source']) && $line['format_source'] != '') {
@@ -236,7 +287,9 @@  discard block
 block discarded – undo
236 287
 
237 288
 		if (isset($line['altitude']) && $line['altitude'] != '') {
238 289
 		    //if (!isset($this->all_tracked[$id]['altitude']) || $this->all_tracked[$id]['altitude'] == '' || ($this->all_tracked[$id]['altitude'] > 0 && $line['altitude'] != 0)) {
239
-			if (is_int($this->all_tracked[$id]['altitude']) && abs(round($line['altitude']/100)-$this->all_tracked[$id]['altitude']) > 3) $this->all_tracked[$id]['putinarchive'] = true;
290
+			if (is_int($this->all_tracked[$id]['altitude']) && abs(round($line['altitude']/100)-$this->all_tracked[$id]['altitude']) > 3) {
291
+				$this->all_tracked[$id]['putinarchive'] = true;
292
+			}
240 293
 			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('altitude' => round($line['altitude']/100)));
241 294
 			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('altitude_real' => $line['altitude']));
242 295
 			//$dataFound = true;
@@ -248,15 +301,21 @@  discard block
 block discarded – undo
248 301
 		}
249 302
 		
250 303
 		if (isset($line['heading']) && $line['heading'] != '') {
251
-		    if (is_int($this->all_tracked[$id]['heading']) && abs($this->all_tracked[$id]['heading']-round($line['heading'])) > 10) $this->all_tracked[$id]['putinarchive'] = true;
304
+		    if (is_int($this->all_tracked[$id]['heading']) && abs($this->all_tracked[$id]['heading']-round($line['heading'])) > 10) {
305
+		    	$this->all_tracked[$id]['putinarchive'] = true;
306
+		    }
252 307
 		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($line['heading'])));
253 308
 		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading_fromsrc' => true));
254 309
 		    //$dataFound = true;
255 310
   		} elseif (!isset($this->all_tracked[$id]['heading_fromsrc']) && isset($this->all_tracked[$id]['archive_latitude']) && $this->all_tracked[$id]['archive_latitude'] != $this->all_tracked[$id]['latitude'] && isset($this->all_tracked[$id]['archive_longitude']) && $this->all_tracked[$id]['archive_longitude'] != $this->all_tracked[$id]['longitude']) {
256 311
   		    $heading = $Common->getHeading($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude']);
257 312
 		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($heading)));
258
-		    if (abs($this->all_tracked[$id]['heading']-round($heading)) > 10) $this->all_tracked[$id]['putinarchive'] = true;
259
-  		    if ($globalDebug) echo "ø Calculated Heading for ".$this->all_tracked[$id]['ident']." : ".$heading."\n";
313
+		    if (abs($this->all_tracked[$id]['heading']-round($heading)) > 10) {
314
+		    	$this->all_tracked[$id]['putinarchive'] = true;
315
+		    }
316
+  		    if ($globalDebug) {
317
+  		    	echo "ø Calculated Heading for ".$this->all_tracked[$id]['ident']." : ".$heading."\n";
318
+  		    }
260 319
   		}
261 320
 		//if (isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_tracked[$id]['lastupdate']) && time()-$this->all_tracked[$id]['lastupdate'] < $globalSourcesupdate) $dataFound = false;
262 321
 
@@ -265,20 +324,31 @@  discard block
 block discarded – undo
265 324
 		    if ($this->all_tracked[$id]['addedTracker'] == 0) {
266 325
 		        if (!isset($globalDistanceIgnore['latitude']) || $this->all_tracked[$id]['longitude'] == ''  || $this->all_tracked[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) {
267 326
 			    if (!isset($this->all_tracked[$id]['forcenew']) || $this->all_tracked[$id]['forcenew'] == 0) {
268
-				if ($globalDebug) echo "Check if aircraft is already in DB...";
327
+				if ($globalDebug) {
328
+					echo "Check if aircraft is already in DB...";
329
+				}
269 330
 				$timeelapsed = microtime(true);
270 331
 				$TrackerLive = new TrackerLive($this->db);
271 332
 				if (isset($line['id'])) {
272 333
 				    $recent_ident = $TrackerLive->checkIdRecent($line['id']);
273
-				    if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
334
+				    if ($globalDebugTimeElapsed) {
335
+				    	echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
336
+				    }
274 337
 				} elseif (isset($this->all_tracked[$id]['ident']) && $this->all_tracked[$id]['ident'] != '') {
275 338
 				    $recent_ident = $TrackerLive->checkIdentRecent($this->all_tracked[$id]['ident']);
276
-				    if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
277
-				} else $recent_ident = '';
339
+				    if ($globalDebugTimeElapsed) {
340
+				    	echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
341
+				    }
342
+				} else {
343
+					$recent_ident = '';
344
+				}
278 345
 				$TrackerLive->db=null;
279 346
 
280
-				if ($globalDebug && $recent_ident == '') echo " Not in DB.\n";
281
-				elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n";
347
+				if ($globalDebug && $recent_ident == '') {
348
+					echo " Not in DB.\n";
349
+				} elseif ($globalDebug && $recent_ident != '') {
350
+					echo " Already in DB.\n";
351
+				}
282 352
 			    } else {
283 353
 				$recent_ident = '';
284 354
 				$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('forcenew' => 0));
@@ -286,16 +356,24 @@  discard block
 block discarded – undo
286 356
 			    //if there was no aircraft with the same callsign within the last hour and go post it into the archive
287 357
 			    if($recent_ident == "")
288 358
 			    {
289
-				if ($globalDebug) echo "\o/ Add ".$this->all_tracked[$id]['ident']." in archive DB : ";
359
+				if ($globalDebug) {
360
+					echo "\o/ Add ".$this->all_tracked[$id]['ident']." in archive DB : ";
361
+				}
290 362
 				//adds the spotter data for the archive
291 363
 				    $highlight = '';
292
-				    if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident'].'-'.date('YmdHi')));
364
+				    if (!isset($this->all_tracked[$id]['id'])) {
365
+				    	$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident'].'-'.date('YmdHi')));
366
+				    }
293 367
 				    $timeelapsed = microtime(true);
294 368
 				    $Tracker = new Tracker($this->db);
295 369
 				    $result = $Tracker->addTrackerData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['altitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['comment'],$this->all_tracked[$id]['type'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name']);
296 370
 				    $Tracker->db = null;
297
-				    if ($globalDebug && isset($result)) echo $result."\n";
298
-				    if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
371
+				    if ($globalDebug && isset($result)) {
372
+				    	echo $result."\n";
373
+				    }
374
+				    if ($globalDebugTimeElapsed) {
375
+				    	echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
376
+				    }
299 377
 				    
300 378
 				    /*
301 379
 				    // Add source stat in DB
@@ -329,12 +407,16 @@  discard block
 block discarded – undo
329 407
 				$this->all_tracked[$id]['addedTracker'] = 1;
330 408
 				//print_r($this->all_tracked[$id]);
331 409
 				if ($this->last_delete == 0 || time() - $this->last_delete > 1800) {
332
-				    if ($globalDebug) echo "---- Deleting Live Tracker data older than 9 hours...";
410
+				    if ($globalDebug) {
411
+				    	echo "---- Deleting Live Tracker data older than 9 hours...";
412
+				    }
333 413
 				    //TrackerLive->deleteLiveTrackerDataNotUpdated();
334 414
 				    $TrackerLive = new TrackerLive($this->db);
335 415
 				    $TrackerLive->deleteLiveTrackerData();
336 416
 				    $TrackerLive->db=null;
337
-				    if ($globalDebug) echo " Done\n";
417
+				    if ($globalDebug) {
418
+				    	echo " Done\n";
419
+				    }
338 420
 				    $this->last_delete = time();
339 421
 				}
340 422
 			    } else {
@@ -357,13 +439,17 @@  discard block
 block discarded – undo
357 439
 
358 440
 		    if (!$ignoreImport) {
359 441
 			if (!isset($globalDistanceIgnore['latitude']) || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) {
360
-				if ($globalDebug) echo "\o/ Add ".$this->all_tracked[$id]['ident']." from ".$this->all_tracked[$id]['format_source']." in Live DB : ";
442
+				if ($globalDebug) {
443
+					echo "\o/ Add ".$this->all_tracked[$id]['ident']." from ".$this->all_tracked[$id]['format_source']." in Live DB : ";
444
+				}
361 445
 				$timeelapsed = microtime(true);
362 446
 				$TrackerLive = new TrackerLive($this->db);
363 447
 				$result = $TrackerLive->addLiveTrackerData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['altitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'],$this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['putinarchive'],$this->all_tracked[$id]['comment'],$this->all_tracked[$id]['type'],$this->all_tracked[$id]['noarchive'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name'],$this->all_tracked[$id]['over_country']);
364 448
 				$TrackerLive->db = null;
365 449
 				$this->all_tracked[$id]['putinarchive'] = false;
366
-				if ($globalDebugTimeElapsed) echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
450
+				if ($globalDebugTimeElapsed) {
451
+					echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
452
+				}
367 453
 
368 454
 				// Put statistics in $this->stats variable
369 455
 				/*
@@ -420,19 +506,29 @@  discard block
 block discarded – undo
420 506
 				*/
421 507
 
422 508
 				$this->all_tracked[$id]['lastupdate'] = time();
423
-				if ($this->all_tracked[$id]['putinarchive']) $send = true;
424
-				if ($globalDebug) echo $result."\n";
425
-			} elseif (isset($this->all_tracked[$id]['latitude']) && isset($globalDistanceIgnore['latitude']) && $globalDebug) echo "!! Too far -> Distance : ".$Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude'])."\n";
509
+				if ($this->all_tracked[$id]['putinarchive']) {
510
+					$send = true;
511
+				}
512
+				if ($globalDebug) {
513
+					echo $result."\n";
514
+				}
515
+			} elseif (isset($this->all_tracked[$id]['latitude']) && isset($globalDistanceIgnore['latitude']) && $globalDebug) {
516
+				echo "!! Too far -> Distance : ".$Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude'])."\n";
517
+			}
426 518
 			//$this->del();
427 519
 			
428 520
 			
429 521
 			if ($this->last_delete_hourly == 0 || time() - $this->last_delete_hourly > 900) {
430
-			    if ($globalDebug) echo "---- Deleting Live Tracker data Not updated since 2 hour...";
522
+			    if ($globalDebug) {
523
+			    	echo "---- Deleting Live Tracker data Not updated since 2 hour...";
524
+			    }
431 525
 			    $TrackerLive = new TrackerLive($this->db);
432 526
 			    $TrackerLive->deleteLiveTrackerDataNotUpdated();
433 527
 			    $TrackerLive->db = null;
434 528
 			    //TrackerLive->deleteLiveTrackerData();
435
-			    if ($globalDebug) echo " Done\n";
529
+			    if ($globalDebug) {
530
+			    	echo " Done\n";
531
+			    }
436 532
 			    $this->last_delete_hourly = time();
437 533
 			}
438 534
 			
@@ -440,7 +536,9 @@  discard block
 block discarded – undo
440 536
 		    //$ignoreImport = false;
441 537
 		}
442 538
 		//if (function_exists('pcntl_fork') && $globalFork) pcntl_signal(SIGCHLD, SIG_IGN);
443
-		if ($send) return $this->all_tracked[$id];
539
+		if ($send) {
540
+			return $this->all_tracked[$id];
541
+		}
444 542
 	    }
445 543
 	}
446 544
     }
Please login to merge, or discard this patch.
tracker-data.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -63,7 +63,9 @@
 block discarded – undo
63 63
 {
64 64
 	if ($spotter_item['image_source'] == 'flickr' || $spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart') {
65 65
 		$image = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']);
66
-	} else $image = $spotter_item['image_thumbnail'];
66
+	} else {
67
+		$image = $spotter_item['image_thumbnail'];
68
+	}
67 69
 
68 70
 }
69 71
 /* else {
Please login to merge, or discard this patch.