Completed
Push — master ( a80977...554d4d )
by Yannick
61:39 queued 35:08
created
header.php 1 patch
Braces   +77 added lines, -17 removed lines patch added patch discarded remove patch
@@ -3,10 +3,15 @@  discard block
 block discarded – undo
3 3
 //gets the page file and stores it in a variable
4 4
 $file_path = pathinfo($_SERVER['SCRIPT_NAME']);
5 5
 $current_page = $file_path['filename'];
6
-if ($globalTimezone == '') $globalTimezone = 'UTC';
6
+if ($globalTimezone == '') {
7
+	$globalTimezone = 'UTC';
8
+}
7 9
 date_default_timezone_set($globalTimezone);
8
-if (isset($_COOKIE['MapType']) && $_COOKIE['MapType'] != '') $MapType = $_COOKIE['MapType'];
9
-else $MapType = $globalMapProvider;
10
+if (isset($_COOKIE['MapType']) && $_COOKIE['MapType'] != '') {
11
+	$MapType = $_COOKIE['MapType'];
12
+} else {
13
+	$MapType = $globalMapProvider;
14
+}
10 15
 if (isset($_GET['3d'])) {
11 16
 	setcookie('MapFormat','3d');
12 17
 } else if (isset($_GET['2d'])) {
@@ -231,7 +236,13 @@  discard block
 block discarded – undo
231 236
 <script src="<?php print $globalURL; ?>/js/MovingMarker.js"></script>
232 237
 <script src="<?php print $globalURL; ?>/js/jquery.idle.min.js"></script>
233 238
 <script src="<?php print $globalURL; ?>/js/map.common.js"></script>
234
-<script src="<?php print $globalURL; ?>/js/map.2d.js.php?ident=<?php print $ident; ?><?php if(isset($latitude)) print '&latitude='.$latitude; ?><?php if(isset($longitude)) print '&longitude='.$longitude; ?>&<?php print time(); ?>"></script>
239
+<script src="<?php print $globalURL; ?>/js/map.2d.js.php?ident=<?php print $ident; ?><?php if(isset($latitude)) {
240
+	print '&latitude='.$latitude;
241
+}
242
+?><?php if(isset($longitude)) {
243
+	print '&longitude='.$longitude;
244
+}
245
+?>&<?php print time(); ?>"></script>
235 246
 <?php
236 247
 		if (!isset($type) || $type == 'aircraft') {
237 248
 ?>
@@ -300,7 +311,13 @@  discard block
 block discarded – undo
300 311
 <script src="<?php print $globalURL; ?>/js/MovingMarker.js"></script>
301 312
 <script src="<?php print $globalURL; ?>/js/jquery.idle.min.js"></script>
302 313
 <script src="<?php print $globalURL; ?>/js/map.common.js"></script>
303
-<script src="<?php print $globalURL; ?>/js/map.2d.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>
314
+<script src="<?php print $globalURL; ?>/js/map.2d.js.php?flightaware_id=<?php print $flightaware_id; ?><?php if(isset($latitude)) {
315
+	print '&latitude='.$latitude;
316
+}
317
+?><?php if(isset($longitude)) {
318
+	print '&longitude='.$longitude;
319
+}
320
+?>&<?php print time(); ?>"></script>
304 321
 <script src="<?php print $globalURL; ?>/js/map-aircraft.2d.js.php?flightaware_id=<?php print $flightaware_id; ?>&<?php print time(); ?>"></script>
305 322
 <?php
306 323
 		if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '' && ($MapType == 'Google-Roadmap' || $MapType == 'Google-Satellite' || $MapType == 'Google-Hybrid' || $MapType == 'Google-Terrain')) {
@@ -381,7 +398,12 @@  discard block
 block discarded – undo
381 398
         <span class="icon-bar"></span>
382 399
       </button>
383 400
       <a href="<?php print $globalURL; ?>/search" class="navbar-toggle navbar-toggle-search"><i class="fa fa-search"></i></a>
384
-      <a class="navbar-brand" href="<?php if ($globalURL == '') print '/'; else print $globalURL; ?>"><img src="<?php print $globalURL.$logoURL; ?>" height="30px" /></a>
401
+      <a class="navbar-brand" href="<?php if ($globalURL == '') {
402
+	print '/';
403
+} else {
404
+	print $globalURL;
405
+}
406
+?>"><img src="<?php print $globalURL.$logoURL; ?>" height="30px" /></a>
385 407
     </div>
386 408
     <div class="collapse navbar-collapse">
387 409
 
@@ -420,7 +442,10 @@  discard block
 block discarded – undo
420 442
 <?php
421 443
     }
422 444
 ?>
423
-          <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) echo 'right-'; ?>caret"></b></a>
445
+          <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) {
446
+	echo 'right-';
447
+}
448
+?>caret"></b></a>
424 449
           <ul class="dropdown-menu">
425 450
           	<li><a href="<?php print $globalURL; ?>/aircraft"><?php echo _("Aircrafts Types"); ?></a></li>
426 451
 <?php
@@ -491,8 +516,14 @@  discard block
 block discarded – undo
491 516
         </li>
492 517
       	<li><a href="<?php print $globalURL; ?>/search"><?php echo _("Search"); ?></a></li>
493 518
       	<li><a href="<?php print $globalURL; ?>/statistics"><?php echo _("Statistics"); ?></a></li>
494
-        <li class="dropdown<?php if ($sub) echo '-submenu'; ?>">
495
-          <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Tools"); ?> <b class="<?php if ($sub) echo 'right-'; ?>caret"></b></a>
519
+        <li class="dropdown<?php if ($sub) {
520
+	echo '-submenu';
521
+}
522
+?>">
523
+          <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Tools"); ?> <b class="<?php if ($sub) {
524
+	echo 'right-';
525
+}
526
+?>caret"></b></a>
496 527
           <ul class="dropdown-menu">
497 528
           	<li><a href="<?php print $globalURL; ?>/tools/acars"><?php echo _("ACARS translator"); ?></a></li>
498 529
           	<li><a href="<?php print $globalURL; ?>/tools/metar"><?php echo _("METAR translator"); ?></a></li>
@@ -528,7 +559,10 @@  discard block
 block discarded – undo
528 559
 <?php
529 560
 	}
530 561
 ?>
531
-		<a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) echo 'right-'; ?>caret"></b></a>
562
+		<a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) {
563
+	echo 'right-';
564
+}
565
+?>caret"></b></a>
532 566
 		<ul class="dropdown-menu">
533 567
 		    <li><a href="<?php print $globalURL; ?>/marine/currently"><?php echo _("Current Activity"); ?></a></li>
534 568
 		    <li><a href="<?php print $globalURL; ?>/marine/latest"><?php echo _("Latest Activity"); ?></a></li>
@@ -560,7 +594,10 @@  discard block
 block discarded – undo
560 594
 <?php
561 595
 	}
562 596
 ?>
563
-		<a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) echo 'right-'; ?>caret"></b></a>
597
+		<a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) {
598
+	echo 'right-';
599
+}
600
+?>caret"></b></a>
564 601
 		<ul class="dropdown-menu">
565 602
 		    <li><a href="<?php print $globalURL; ?>/tracker/currently"><?php echo _("Current Activity"); ?></a></li>
566 603
 		    <li><a href="<?php print $globalURL; ?>/tracker/latest"><?php echo _("Latest Activity"); ?></a></li>
@@ -593,7 +630,10 @@  discard block
 block discarded – undo
593 630
 	}
594 631
 ?>
595 632
 <!--
596
-		<a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) echo 'right-'; ?>caret"></b></a>
633
+		<a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) {
634
+	echo 'right-';
635
+}
636
+?>caret"></b></a>
597 637
 		<ul class="dropdown-menu">
598 638
 		    <li><a href="<?php print $globalURL; ?>/satellite/currently"><?php echo _("Current Activity"); ?></a></li>
599 639
 		    <li><a href="<?php print $globalURL; ?>/satellite/latest"><?php echo _("Latest Activity"); ?></a></li>
@@ -650,7 +690,9 @@  discard block
 block discarded – undo
650 690
   		        $alllang = $Language->getLanguages();
651 691
   		        foreach ($alllang as $key => $lang) {
652 692
   		            print '<option value="'.$key.'"';
653
-  		            if (isset($_COOKIE['language']) && $_COOKIE['language'] == $key) print ' selected ';
693
+  		            if (isset($_COOKIE['language']) && $_COOKIE['language'] == $key) {
694
+  		            	print ' selected ';
695
+  		            }
654 696
   		            print '>'.$lang[0].'</option>';
655 697
   		        }
656 698
   		    ?>
@@ -790,9 +832,24 @@  discard block
 block discarded – undo
790 832
 	$customid = $globalMapProvider;
791 833
 ?>
792 834
     L.tileLayer('<?php print $globalMapCustomLayer[$customid]['url']; ?>/{z}/{x}/{y}.png', {
793
-        maxZoom: <?php if (isset($globalMapCustomLayer[$customid]['maxZoom'])) print $globalMapCustomLayer[$customid]['maxZoom']; else print '18'; ?>,
794
-        minZoom: <?php if (isset($globalMapCustomLayer[$customid]['minZoom'])) print $globalMapCustomLayer[$customid]['minZoom']; else print '0'; ?>,
795
-        noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>,
835
+        maxZoom: <?php if (isset($globalMapCustomLayer[$customid]['maxZoom'])) {
836
+	print $globalMapCustomLayer[$customid]['maxZoom'];
837
+} else {
838
+	print '18';
839
+}
840
+?>,
841
+        minZoom: <?php if (isset($globalMapCustomLayer[$customid]['minZoom'])) {
842
+	print $globalMapCustomLayer[$customid]['minZoom'];
843
+} else {
844
+	print '0';
845
+}
846
+?>,
847
+        noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) {
848
+	print 'false';
849
+} else {
850
+	print 'true';
851
+}
852
+?>,
796 853
         attribution: '<?php print $globalMapCustomLayer[$customid]['attribution']; ?>'
797 854
     }).addTo(map);
798 855
 <?php
@@ -815,4 +872,7 @@  discard block
 block discarded – undo
815 872
 
816 873
 ?>
817 874
 
818
-<section class="container main-content <?php if (strtolower($current_page) == 'index') print 'index '; ?>clear">
875
+<section class="container main-content <?php if (strtolower($current_page) == 'index') {
876
+	print 'index ';
877
+}
878
+?>clear">
Please login to merge, or discard this patch.
statistics-sub-menu.php 1 patch
Braces   +110 added lines, -27 removed lines patch added patch discarded remove patch
@@ -6,7 +6,13 @@  discard block
 block discarded – undo
6 6
 	if (!isset($type) || $type != 'satellite') {
7 7
 ?>
8 8
 		<form id="changedate" method="post">
9
-			<input type="month" name="date" onchange="statsdatechange(this);" value="<?php if (isset($year) && $year != '') echo $year.'-'; ?><?php if (isset($month) && $month != '') echo $month; ?>" />
9
+			<input type="month" name="date" onchange="statsdatechange(this);" value="<?php if (isset($year) && $year != '') {
10
+	echo $year.'-';
11
+}
12
+?><?php if (isset($month) && $month != '') {
13
+	echo $month;
14
+}
15
+?>" />
10 16
 		</form>
11 17
 <?php
12 18
 	}
@@ -38,7 +44,9 @@  discard block
 block discarded – undo
38 44
 						print '<option disabled>──────────</option>';
39 45
 					}
40 46
 					$Stats = new Stats();
41
-					if (!isset($filter_name)) $filter_name = '';
47
+					if (!isset($filter_name)) {
48
+						$filter_name = '';
49
+					}
42 50
 					$airlines = $Stats->getAllAirlineNames($filter_name);
43 51
 					foreach($airlines as $airline) {
44 52
 						if (isset($airline_icao) && $airline_icao == $airline['airline_icao']) {
@@ -67,10 +75,22 @@  discard block
 block discarded – undo
67 75
 		      <?php echo _("Aircraft"); ?> <span class="caret"></span>
68 76
 		    </a>
69 77
 		    <ul class="dropdown-menu">
70
-			<li><a href="<?php print $globalURL; ?>/statistics/aircraft<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Aircraft"); ?></a></li>
71
-			<li><a href="<?php print $globalURL; ?>/statistics/registration<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Registration"); ?></a></li>
72
-			<li><a href="<?php print $globalURL; ?>/statistics/manufacturer<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Manufacturer"); ?></a></li>
73
-			<li><a href="<?php print $globalURL; ?>/statistics/country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Country"); ?></a></li>
78
+			<li><a href="<?php print $globalURL; ?>/statistics/aircraft<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
79
+	echo '/'.$airline_icao;
80
+}
81
+?>"><?php echo _("Aircraft"); ?></a></li>
82
+			<li><a href="<?php print $globalURL; ?>/statistics/registration<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
83
+	echo '/'.$airline_icao;
84
+}
85
+?>"><?php echo _("Registration"); ?></a></li>
86
+			<li><a href="<?php print $globalURL; ?>/statistics/manufacturer<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
87
+	echo '/'.$airline_icao;
88
+}
89
+?>"><?php echo _("Manufacturer"); ?></a></li>
90
+			<li><a href="<?php print $globalURL; ?>/statistics/country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
91
+	echo '/'.$airline_icao;
92
+}
93
+?>"><?php echo _("Country"); ?></a></li>
74 94
 		    </ul>
75 95
 		</li>
76 96
 		<li class="dropdown">
@@ -81,12 +101,21 @@  discard block
 block discarded – undo
81 101
 <?php
82 102
 		if (!isset($airline_icao) || $airline_icao == 'all') {
83 103
 ?>
84
-		      <li><a href="<?php print $globalURL; ?>/statistics/airline<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Airline"); ?></a></li>
85
-		      <li><a href="<?php print $globalURL; ?>/statistics/airline-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Airline by Country"); ?></a></li>
104
+		      <li><a href="<?php print $globalURL; ?>/statistics/airline<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
105
+	echo '/'.$airline_icao;
106
+}
107
+?>"><?php echo _("Airline"); ?></a></li>
108
+		      <li><a href="<?php print $globalURL; ?>/statistics/airline-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
109
+	echo '/'.$airline_icao;
110
+}
111
+?>"><?php echo _("Airline by Country"); ?></a></li>
86 112
 <?php
87 113
 		}
88 114
 ?>
89
-		      <li><a href="<?php print $globalURL; ?>/statistics/callsign<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Callsign"); ?></a></li>
115
+		      <li><a href="<?php print $globalURL; ?>/statistics/callsign<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
116
+	echo '/'.$airline_icao;
117
+}
118
+?>"><?php echo _("Callsign"); ?></a></li>
90 119
 		    </ul>
91 120
 		</li>
92 121
 		<li class="dropdown">
@@ -94,10 +123,22 @@  discard block
 block discarded – undo
94 123
 		      <?php echo _("Airport"); ?> <span class="caret"></span>
95 124
 		    </a>
96 125
 		    <ul class="dropdown-menu" role="menu">
97
-		      <li><a href="<?php print $globalURL; ?>/statistics/airport-departure<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Departure Airport"); ?></a></li>
98
-		      <li><a href="<?php print $globalURL; ?>/statistics/airport-departure-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Departure Airport by Country"); ?></a></li>
99
-		      <li><a href="<?php print $globalURL; ?>/statistics/airport-arrival<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Arrival Airport"); ?></a></li>
100
-		      <li><a href="<?php print $globalURL; ?>/statistics/airport-arrival-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Arrival Airport by Country"); ?></a></li>
126
+		      <li><a href="<?php print $globalURL; ?>/statistics/airport-departure<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
127
+	echo '/'.$airline_icao;
128
+}
129
+?>"><?php echo _("Departure Airport"); ?></a></li>
130
+		      <li><a href="<?php print $globalURL; ?>/statistics/airport-departure-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
131
+	echo '/'.$airline_icao;
132
+}
133
+?>"><?php echo _("Departure Airport by Country"); ?></a></li>
134
+		      <li><a href="<?php print $globalURL; ?>/statistics/airport-arrival<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
135
+	echo '/'.$airline_icao;
136
+}
137
+?>"><?php echo _("Arrival Airport"); ?></a></li>
138
+		      <li><a href="<?php print $globalURL; ?>/statistics/airport-arrival-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
139
+	echo '/'.$airline_icao;
140
+}
141
+?>"><?php echo _("Arrival Airport by Country"); ?></a></li>
101 142
 		    </ul>
102 143
 		</li>
103 144
 		<li class="dropdown">
@@ -105,8 +146,14 @@  discard block
 block discarded – undo
105 146
 		      <?php echo _("Route"); ?> <span class="caret"></span>
106 147
 		    </a>
107 148
 		    <ul class="dropdown-menu" role="menu">
108
-		      <li><a href="<?php print $globalURL; ?>/statistics/route-airport<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Route by Airport"); ?></a></li>
109
-		      <li><a href="<?php print $globalURL; ?>/statistics/route-waypoint<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Route by Waypoint"); ?></a></li>
149
+		      <li><a href="<?php print $globalURL; ?>/statistics/route-airport<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
150
+	echo '/'.$airline_icao;
151
+}
152
+?>"><?php echo _("Route by Airport"); ?></a></li>
153
+		      <li><a href="<?php print $globalURL; ?>/statistics/route-waypoint<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
154
+	echo '/'.$airline_icao;
155
+}
156
+?>"><?php echo _("Route by Waypoint"); ?></a></li>
110 157
 		    </ul>
111 158
 		</li>
112 159
 		<li class="dropdown">
@@ -114,8 +161,14 @@  discard block
 block discarded – undo
114 161
 		      <?php echo _("Date &amp; Time"); ?> <span class="caret"></span>
115 162
 		    </a>
116 163
 		    <ul class="dropdown-menu" role="menu">
117
-		      <li><a href="<?php print $globalURL; ?>/statistics/date<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Date"); ?></a></li>
118
-			  <li><a href="<?php print $globalURL; ?>/statistics/time<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Time"); ?></a></li>
164
+		      <li><a href="<?php print $globalURL; ?>/statistics/date<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
165
+	echo '/'.$airline_icao;
166
+}
167
+?>"><?php echo _("Date"); ?></a></li>
168
+			  <li><a href="<?php print $globalURL; ?>/statistics/time<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
169
+	echo '/'.$airline_icao;
170
+}
171
+?>"><?php echo _("Time"); ?></a></li>
119 172
 		    </ul>
120 173
 		</li>
121 174
 		<?php
@@ -163,9 +216,18 @@  discard block
 block discarded – undo
163 216
 		      <?php echo _("Aircraft"); ?> <span class="caret"></span>
164 217
 		    </a>
165 218
 		    <ul class="dropdown-menu">
166
-			<li><a href="<?php print $globalURL; ?>/statistics/aircraft<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Aircraft"); ?></a></li>
167
-			<li><a href="<?php print $globalURL; ?>/statistics/registration<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Registration"); ?></a></li>
168
-			<li><a href="<?php print $globalURL; ?>/statistics/manufacturer<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Manufacturer"); ?></a></li>
219
+			<li><a href="<?php print $globalURL; ?>/statistics/aircraft<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
220
+	echo '/'.$airline_icao;
221
+}
222
+?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Aircraft"); ?></a></li>
223
+			<li><a href="<?php print $globalURL; ?>/statistics/registration<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
224
+	echo '/'.$airline_icao;
225
+}
226
+?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Registration"); ?></a></li>
227
+			<li><a href="<?php print $globalURL; ?>/statistics/manufacturer<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
228
+	echo '/'.$airline_icao;
229
+}
230
+?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Manufacturer"); ?></a></li>
169 231
 			<!-- <li><a href="<?php print $globalURL; ?>/statistics/country"><?php echo _("Country"); ?></a></li> -->
170 232
 		    </ul>
171 233
 		</li>
@@ -177,12 +239,21 @@  discard block
 block discarded – undo
177 239
 <?php
178 240
 		if (!isset($airline_icao) || $airline_icao == 'all') {
179 241
 ?>
180
-		      <li><a href="<?php print $globalURL; ?>/statistics/airline<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Airline"); ?></a></li>
181
-		      <li><a href="<?php print $globalURL; ?>/statistics/airline-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Airline by Country"); ?></a></li>
242
+		      <li><a href="<?php print $globalURL; ?>/statistics/airline<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
243
+	echo '/'.$airline_icao;
244
+}
245
+?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Airline"); ?></a></li>
246
+		      <li><a href="<?php print $globalURL; ?>/statistics/airline-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
247
+	echo '/'.$airline_icao;
248
+}
249
+?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Airline by Country"); ?></a></li>
182 250
 <?php
183 251
 		}
184 252
 ?>
185
-		      <li><a href="<?php print $globalURL; ?>/statistics/callsign<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Callsign"); ?></a></li>
253
+		      <li><a href="<?php print $globalURL; ?>/statistics/callsign<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
254
+	echo '/'.$airline_icao;
255
+}
256
+?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Callsign"); ?></a></li>
186 257
 		    </ul>
187 258
 		</li>
188 259
 		<li class="dropdown">
@@ -190,10 +261,22 @@  discard block
 block discarded – undo
190 261
 		      <?php echo _("Airport"); ?> <span class="caret"></span>
191 262
 		    </a>
192 263
 		    <ul class="dropdown-menu" role="menu">
193
-		      <li><a href="<?php print $globalURL; ?>/statistics/airport-departure<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Departure Airport"); ?></a></li>
194
-		      <li><a href="<?php print $globalURL; ?>/statistics/airport-departure-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Departure Airport by Country"); ?></a></li>
195
-		      <li><a href="<?php print $globalURL; ?>/statistics/airport-arrival<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Arrival Airport"); ?></a></li>
196
-		      <li><a href="<?php print $globalURL; ?>/statistics/airport-arrival-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Arrival Airport by Country"); ?></a></li>
264
+		      <li><a href="<?php print $globalURL; ?>/statistics/airport-departure<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
265
+	echo '/'.$airline_icao;
266
+}
267
+?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Departure Airport"); ?></a></li>
268
+		      <li><a href="<?php print $globalURL; ?>/statistics/airport-departure-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
269
+	echo '/'.$airline_icao;
270
+}
271
+?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Departure Airport by Country"); ?></a></li>
272
+		      <li><a href="<?php print $globalURL; ?>/statistics/airport-arrival<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
273
+	echo '/'.$airline_icao;
274
+}
275
+?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Arrival Airport"); ?></a></li>
276
+		      <li><a href="<?php print $globalURL; ?>/statistics/airport-arrival-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
277
+	echo '/'.$airline_icao;
278
+}
279
+?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Arrival Airport by Country"); ?></a></li>
197 280
 		    </ul>
198 281
 		</li>
199 282
 		<!--
Please login to merge, or discard this patch.
js/map-aircraft.3d.js.php 1 patch
Braces   +24 added lines, -4 removed lines patch added patch discarded remove patch
@@ -257,7 +257,12 @@  discard block
 block discarded – undo
257 257
 //				viewer.dataSources.get(dsn).entities.remove(entity);
258 258
 //			}
259 259
 			//console.log(entity.lastupdate);
260
-			if (parseInt(entity.lastupdate) < Math.floor(Date.now()-<?php if (isset($globalMapRefresh)) print $globalMapRefresh*2000; else print '60000'; ?>)) {
260
+			if (parseInt(entity.lastupdate) < Math.floor(Date.now()-<?php if (isset($globalMapRefresh)) {
261
+	print $globalMapRefresh*2000;
262
+} else {
263
+	print '60000';
264
+}
265
+?>)) {
261 266
 //				console.log('Remove an entity date');
262 267
 				viewer.dataSources.get(dsn).entities.remove(entity);
263 268
 			} else {
@@ -544,7 +549,12 @@  discard block
 block discarded – undo
544 549
 		if (!((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) && (isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) {
545 550
 ?>
546 551
 update_polarLayer();
547
-setInterval(function(){update_polarLayer()},<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000*2; else print '60000'; ?>);
552
+setInterval(function(){update_polarLayer()},<?php if (isset($globalMapRefresh)) {
553
+	print $globalMapRefresh*1000*2;
554
+} else {
555
+	print '60000';
556
+}
557
+?>);
548 558
 <?php
549 559
 		}
550 560
 ?>
@@ -642,7 +652,12 @@  discard block
 block discarded – undo
642 652
 				}
643 653
 			}
644 654
 		}
645
-	,<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000; else print '30000'; ?>);
655
+	,<?php if (isset($globalMapRefresh)) {
656
+	print $globalMapRefresh*1000;
657
+} else {
658
+	print '30000';
659
+}
660
+?>);
646 661
 } else {
647 662
 	//var widget = new Cesium.CesiumWidget('archivebox');
648 663
 //	var timeline = new Cesium.Timeline(viewer);
@@ -661,7 +676,12 @@  discard block
 block discarded – undo
661 676
     if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM)) {
662 677
 ?>
663 678
 update_atcLayer();
664
-setInterval(function(){update_atcLayer()},<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000*2; else print '60000'; ?>);
679
+setInterval(function(){update_atcLayer()},<?php if (isset($globalMapRefresh)) {
680
+	print $globalMapRefresh*1000*2;
681
+} else {
682
+	print '60000';
683
+}
684
+?>);
665 685
 <?php
666 686
     }
667 687
 ?>
Please login to merge, or discard this patch.
js/map-satellite.3d.js.php 1 patch
Braces   +6 added lines, -1 removed lines patch added patch discarded remove patch
@@ -52,7 +52,12 @@
 block discarded – undo
52 52
 	} else {
53 53
 		for (var i = 0; i < viewer.dataSources.get(dsn).entities.values.length; i++) {
54 54
 			var entity = viewer.dataSources.get(dsn).entities.values[i];
55
-			if (parseInt(entity.lastupdatesat) < Math.floor(Date.now()-<?php if (isset($globalMapRefresh)) print $globalMapRefresh*2000; else print '60000'; ?>)) {
55
+			if (parseInt(entity.lastupdatesat) < Math.floor(Date.now()-<?php if (isset($globalMapRefresh)) {
56
+	print $globalMapRefresh*2000;
57
+} else {
58
+	print '60000';
59
+}
60
+?>)) {
56 61
 				viewer.dataSources.get(dsn).entities.remove(entity);
57 62
 			}
58 63
 		}
Please login to merge, or discard this patch.
install/index.php 1 patch
Braces   +506 added lines, -136 removed lines patch added patch discarded remove patch
@@ -131,45 +131,72 @@  discard block
 block discarded – undo
131 131
 			</div>
132 132
 			<p>
133 133
 				<label for="dbhost">Database hostname</label>
134
-				<input type="text" name="dbhost" id="dbhost" value="<?php if (isset($globalDBhost)) print $globalDBhost; ?>" />
134
+				<input type="text" name="dbhost" id="dbhost" value="<?php if (isset($globalDBhost)) {
135
+	print $globalDBhost;
136
+}
137
+?>" />
135 138
 			</p>
136 139
 			<p>
137 140
 				<label for="dbport">Database port</label>
138
-				<input type="text" name="dbport" id="dbport" value="<?php if (isset($globalDBport)) print $globalDBport; ?>" />
141
+				<input type="text" name="dbport" id="dbport" value="<?php if (isset($globalDBport)) {
142
+	print $globalDBport;
143
+}
144
+?>" />
139 145
 				<p class="help-block">Default is 3306 for MariaDB/MySQL, 5432 for PostgreSQL</p>
140 146
 			</p>
141 147
 			<p>
142 148
 				<label for="dbname">Database name</label>
143
-				<input type="text" name="dbname" id="dbname" value="<?php if (isset($globalDBname)) print $globalDBname; ?>" />
149
+				<input type="text" name="dbname" id="dbname" value="<?php if (isset($globalDBname)) {
150
+	print $globalDBname;
151
+}
152
+?>" />
144 153
 			</p>
145 154
 			<p>
146 155
 				<label for="dbuser">Database user</label>
147
-				<input type="text" name="dbuser" id="dbuser" value="<?php if (isset($globalDBuser)) print $globalDBuser; ?>" />
156
+				<input type="text" name="dbuser" id="dbuser" value="<?php if (isset($globalDBuser)) {
157
+	print $globalDBuser;
158
+}
159
+?>" />
148 160
 			</p>
149 161
 			<p>
150 162
 				<label for="dbuserpass">Database user password</label>
151
-				<input type="password" name="dbuserpass" id="dbuserpass" value="<?php if (isset($globalDBpass)) print $globalDBpass; ?>" />
163
+				<input type="password" name="dbuserpass" id="dbuserpass" value="<?php if (isset($globalDBpass)) {
164
+	print $globalDBpass;
165
+}
166
+?>" />
152 167
 			</p>
153 168
 		</fieldset>
154 169
 		<fieldset id="site">
155 170
 			<legend>Site configuration</legend>
156 171
 			<p>
157 172
 				<label for="sitename">Site name</label>
158
-				<input type="text" name="sitename" id="sitename" value="<?php if (isset($globalName)) print $globalName; ?>" />
173
+				<input type="text" name="sitename" id="sitename" value="<?php if (isset($globalName)) {
174
+	print $globalName;
175
+}
176
+?>" />
159 177
 			</p>
160 178
 			<p>
161 179
 				<label for="siteurl">Site directory</label>
162
-				<input type="text" name="siteurl" id="siteurl" value="<?php if (isset($globalURL)) print $globalURL; ?>" />
180
+				<input type="text" name="siteurl" id="siteurl" value="<?php if (isset($globalURL)) {
181
+	print $globalURL;
182
+}
183
+?>" />
163 184
 				<p class="help-block">Can be null. ex : <i>flightairmap</i> if complete URL is <i>http://toto.com/flightairmap</i></p>
164 185
 			</p>
165 186
 			<p>
166 187
 				<label for="timezone">Timezone</label>
167
-				<input type="text" name="timezone" id="timezone" value="<?php if (isset($globalTimezone)) print $globalTimezone; ?>" />
188
+				<input type="text" name="timezone" id="timezone" value="<?php if (isset($globalTimezone)) {
189
+	print $globalTimezone;
190
+}
191
+?>" />
168 192
 				<p class="help-block">ex : UTC, Europe/Paris,...</p>
169 193
 			</p>
170 194
 			<p>
171 195
 				<label for="language">Language</label>
172
-				<input type="text" name="language" id="language" value="<?php if (isset($globalLanguage)) print $globalLanguage; ?>" />
196
+				<input type="text" name="language" id="language" value="<?php if (isset($globalLanguage)) {
197
+	print $globalLanguage;
198
+}
199
+?>" />
173 200
 				<p class="help-block">Used only when link to wikipedia for now. Can be EN,DE,FR,...</p>
174 201
 			</p>
175 202
 		</fieldset>
@@ -190,11 +217,17 @@  discard block
 block discarded – undo
190 217
 			<div id="mapbox_data">
191 218
 				<p>
192 219
 					<label for="mapboxid">Mapbox id</label>
193
-					<input type="text" name="mapboxid" id="mapboxid" value="<?php if (isset($globalMapboxId)) print $globalMapboxId; ?>" />
220
+					<input type="text" name="mapboxid" id="mapboxid" value="<?php if (isset($globalMapboxId)) {
221
+	print $globalMapboxId;
222
+}
223
+?>" />
194 224
 				</p>
195 225
 				<p>
196 226
 					<label for="mapboxtoken">Mapbox token</label>
197
-					<input type="text" name="mapboxtoken" id="mapboxtoken" value="<?php if (isset($globalMapboxToken)) print $globalMapboxToken; ?>" />
227
+					<input type="text" name="mapboxtoken" id="mapboxtoken" value="<?php if (isset($globalMapboxToken)) {
228
+	print $globalMapboxToken;
229
+}
230
+?>" />
198 231
 				</p>
199 232
 				<p class="help-block">Get a key <a href="https://www.mapbox.com/developers/">here</a></p>
200 233
 			</div>
@@ -202,7 +235,10 @@  discard block
 block discarded – undo
202 235
 			<div id="google_data">
203 236
 				<p>
204 237
 					<label for="googlekey">Google API key</label>
205
-					<input type="text" name="googlekey" id="googlekey" value="<?php if (isset($globalGoogleAPIKey)) print $globalGoogleAPIKey; ?>" />
238
+					<input type="text" name="googlekey" id="googlekey" value="<?php if (isset($globalGoogleAPIKey)) {
239
+	print $globalGoogleAPIKey;
240
+}
241
+?>" />
206 242
 					<p class="help-block">Get a key <a href="https://developers.google.com/maps/documentation/javascript/get-api-key#get-an-api-key">here</a></p>
207 243
 				</p>
208 244
 			</div>
@@ -210,7 +246,10 @@  discard block
 block discarded – undo
210 246
 			<div id="bing_data">
211 247
 				<p>
212 248
 					<label for="bingkey">Bing Map key</label>
213
-					<input type="text" name="bingkey" id="bingkey" value="<?php if (isset($globalBingMapKey)) print $globalBingMapKey; ?>" />
249
+					<input type="text" name="bingkey" id="bingkey" value="<?php if (isset($globalBingMapKey)) {
250
+	print $globalBingMapKey;
251
+}
252
+?>" />
214 253
 					<p class="help-block">Get a key <a href="https://www.bingmapsportal.com/">here</a></p>
215 254
 				</p>
216 255
 			</div>
@@ -218,7 +257,10 @@  discard block
 block discarded – undo
218 257
 			<div id="mapquest_data">
219 258
 				<p>
220 259
 					<label for="mapquestkey">MapQuest key</label>
221
-					<input type="text" name="mapquestkey" id="mapquestkey" value="<?php if (isset($globalMapQuestKey)) print $globalMapQuestKey; ?>" />
260
+					<input type="text" name="mapquestkey" id="mapquestkey" value="<?php if (isset($globalMapQuestKey)) {
261
+	print $globalMapQuestKey;
262
+}
263
+?>" />
222 264
 					<p class="help-block">Get a key <a href="https://developer.mapquest.com/user/me/apps">here</a></p>
223 265
 				</p>
224 266
 			</div>
@@ -226,11 +268,17 @@  discard block
 block discarded – undo
226 268
 			<div id="here_data">
227 269
 				<p>
228 270
 					<label for="hereappid">Here App_Id</label>
229
-					<input type="text" name="hereappid" id="hereappid" value="<?php if (isset($globalHereappId)) print $globalHereappId; ?>" />
271
+					<input type="text" name="hereappid" id="hereappid" value="<?php if (isset($globalHereappId)) {
272
+	print $globalHereappId;
273
+}
274
+?>" />
230 275
 				</p>
231 276
 				<p>
232 277
 					<label for="hereappcode">Here App_Code</label>
233
-					<input type="text" name="hereappcode" id="hereappcode" value="<?php if (isset($globalHereappCode)) print $globalHereappCode; ?>" />
278
+					<input type="text" name="hereappcode" id="hereappcode" value="<?php if (isset($globalHereappCode)) {
279
+	print $globalHereappCode;
280
+}
281
+?>" />
234 282
 				</p>
235 283
 				<p class="help-block">Get a key <a href="https://developer.here.com/rest-apis/documentation/enterprise-map-tile/topics/quick-start.html">here</a></p>
236 284
 			</div>
@@ -238,7 +286,10 @@  discard block
 block discarded – undo
238 286
 			<div id="openweathermap_data">
239 287
 				<p>
240 288
 					<label for="openweathermapkey">OpenWeatherMap key (weather layer)</label>
241
-					<input type="text" name="openweathermapkey" id="openweathermapkey" value="<?php if (isset($globalOpenWeatherMapKey)) print $globalOpenWeatherMapKey; ?>" />
289
+					<input type="text" name="openweathermapkey" id="openweathermapkey" value="<?php if (isset($globalOpenWeatherMapKey)) {
290
+	print $globalOpenWeatherMapKey;
291
+}
292
+?>" />
242 293
 					<p class="help-block">Get a key <a href="https://openweathermap.org/">here</a></p>
243 294
 				</p>
244 295
 			</div>
@@ -248,42 +299,86 @@  discard block
 block discarded – undo
248 299
 			<legend>Coverage area</legend>
249 300
 			<p>
250 301
 				<label for="latitudemax">The maximum latitude (north)</label>
251
-				<input type="text" name="latitudemax" id="latitudemax" value="<?php if (isset($globalLatitudeMax)) print $globalLatitudeMax; ?>" />
302
+				<input type="text" name="latitudemax" id="latitudemax" value="<?php if (isset($globalLatitudeMax)) {
303
+	print $globalLatitudeMax;
304
+}
305
+?>" />
252 306
 			</p>
253 307
 			<p>
254 308
 				<label for="latitudemin">The minimum latitude (south)</label>
255
-				<input type="text" name="latitudemin" id="latitudemin" value="<?php if (isset($globalLatitudeMin)) print $globalLatitudeMin; ?>" />
309
+				<input type="text" name="latitudemin" id="latitudemin" value="<?php if (isset($globalLatitudeMin)) {
310
+	print $globalLatitudeMin;
311
+}
312
+?>" />
256 313
 			</p>
257 314
 			<p>
258 315
 				<label for="longitudemax">The maximum longitude (west)</label>
259
-				<input type="text" name="longitudemax" id="longitudemax" value="<?php if (isset($globalLongitudeMax)) print $globalLongitudeMax; ?>" />
316
+				<input type="text" name="longitudemax" id="longitudemax" value="<?php if (isset($globalLongitudeMax)) {
317
+	print $globalLongitudeMax;
318
+}
319
+?>" />
260 320
 			</p>
261 321
 			<p>
262 322
 				<label for="longitudemin">The minimum longitude (east)</label>
263
-				<input type="text" name="longitudemin" id="longitudemin" value="<?php if (isset($globalLongitudeMin)) print $globalLongitudeMin; ?>" />
323
+				<input type="text" name="longitudemin" id="longitudemin" value="<?php if (isset($globalLongitudeMin)) {
324
+	print $globalLongitudeMin;
325
+}
326
+?>" />
264 327
 			</p>
265 328
 			<p>
266 329
 				<label for="latitudecenter">The latitude center</label>
267
-				<input type="text" name="latitudecenter" id="latitudecenter" value="<?php if (isset($globalCenterLatitude)) print $globalCenterLatitude; ?>" />
330
+				<input type="text" name="latitudecenter" id="latitudecenter" value="<?php if (isset($globalCenterLatitude)) {
331
+	print $globalCenterLatitude;
332
+}
333
+?>" />
268 334
 			</p>
269 335
 			<p>
270 336
 				<label for="longitudecenter">The longitude center</label>
271
-				<input type="text" name="longitudecenter" id="longitudecenter" value="<?php if (isset($globalCenterLongitude)) print $globalCenterLongitude; ?>" />
337
+				<input type="text" name="longitudecenter" id="longitudecenter" value="<?php if (isset($globalCenterLongitude)) {
338
+	print $globalCenterLongitude;
339
+}
340
+?>" />
272 341
 			</p>
273 342
 			<p>
274 343
 				<label for="livezoom">Default Zoom on live map</label>
275
-				<input type="number" name="livezoom" id="livezoom" value="<?php if (isset($globalLiveZoom)) print $globalLiveZoom; else print '9'; ?>" />
344
+				<input type="number" name="livezoom" id="livezoom" value="<?php if (isset($globalLiveZoom)) {
345
+	print $globalLiveZoom;
346
+} else {
347
+	print '9';
348
+}
349
+?>" />
276 350
 			</p>
277 351
 			<p>
278 352
 				<label for="squawk_country">Country for squawk usage</label>
279 353
 				<select name="squawk_country" id="squawk_country">
280
-					<option value="UK"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'UK') print ' selected '; ?>>UK</option>
281
-					<option value="NZ"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'NZ') print ' selected '; ?>>NZ</option>
282
-					<option value="US"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'US') print ' selected '; ?>>US</option>
283
-					<option value="AU"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'AU') print ' selected '; ?>>AU</option>
284
-					<option value="NL"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'NL') print ' selected '; ?>>NL</option>
285
-					<option value="FR"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'FR') print ' selected '; ?>>FR</option>
286
-					<option value="TR"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'TR') print ' selected '; ?>>TR</option>
354
+					<option value="UK"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'UK') {
355
+	print ' selected ';
356
+}
357
+?>>UK</option>
358
+					<option value="NZ"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'NZ') {
359
+	print ' selected ';
360
+}
361
+?>>NZ</option>
362
+					<option value="US"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'US') {
363
+	print ' selected ';
364
+}
365
+?>>US</option>
366
+					<option value="AU"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'AU') {
367
+	print ' selected ';
368
+}
369
+?>>AU</option>
370
+					<option value="NL"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'NL') {
371
+	print ' selected ';
372
+}
373
+?>>NL</option>
374
+					<option value="FR"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'FR') {
375
+	print ' selected ';
376
+}
377
+?>>FR</option>
378
+					<option value="TR"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'TR') {
379
+	print ' selected ';
380
+}
381
+?>>TR</option>
287 382
 				</select>
288 383
 			</p>
289 384
 		</fieldset>
@@ -292,15 +387,24 @@  discard block
 block discarded – undo
292 387
 			<p><i>Only put in DB flights that are inside a circle</i></p>
293 388
 			<p>
294 389
 				<label for="latitude">Center latitude</label>
295
-				<input type="text" name="zoilatitude" id="latitude" value="<?php if (isset($globalDistanceIgnore['latitude'])) echo $globalDistanceIgnore['latitude']; ?>" />
390
+				<input type="text" name="zoilatitude" id="latitude" value="<?php if (isset($globalDistanceIgnore['latitude'])) {
391
+	echo $globalDistanceIgnore['latitude'];
392
+}
393
+?>" />
296 394
 			</p>
297 395
 			<p>
298 396
 				<label for="longitude">Center longitude</label>
299
-				<input type="text" name="zoilongitude" id="longitude" value="<?php if (isset($globalDistanceIgnore['longitude'])) echo $globalDistanceIgnore['longitude']; ?>" />
397
+				<input type="text" name="zoilongitude" id="longitude" value="<?php if (isset($globalDistanceIgnore['longitude'])) {
398
+	echo $globalDistanceIgnore['longitude'];
399
+}
400
+?>" />
300 401
 			</p>
301 402
 			<p>
302 403
 				<label for="Distance">Distance (in km)</label>
303
-				<input type="text" name="zoidistance" id="distance" value="<?php if (isset($globalDistanceIgnore['distance'])) echo $globalDistanceIgnore['distance']; ?>" />
404
+				<input type="text" name="zoidistance" id="distance" value="<?php if (isset($globalDistanceIgnore['distance'])) {
405
+	echo $globalDistanceIgnore['distance'];
406
+}
407
+?>" />
304 408
 			</p>
305 409
 		</fieldset>
306 410
 		<fieldset id="sourceloc">
@@ -411,11 +515,17 @@  discard block
 block discarded – undo
411 515
 			<div id="flightaware_data">
412 516
 				<p>
413 517
 					<label for="flightawareusername">FlightAware username</label>
414
-					<input type="text" name="flightawareusername" id="flightawareusername" value="<?php if (isset($globalFlightAwareUsername)) print $globalFlightAwareUsername; ?>" />
518
+					<input type="text" name="flightawareusername" id="flightawareusername" value="<?php if (isset($globalFlightAwareUsername)) {
519
+	print $globalFlightAwareUsername;
520
+}
521
+?>" />
415 522
 				</p>
416 523
 				<p>
417 524
 					<label for="flightawarepassword">FlightAware password/API key</label>
418
-					<input type="text" name="flightawarepassword" id="flightawarepassword" value="<?php if (isset($globalFlightAwarePassword)) print $globalFlightAwarePassword; ?>" />
525
+					<input type="text" name="flightawarepassword" id="flightawarepassword" value="<?php if (isset($globalFlightAwarePassword)) {
526
+	print $globalFlightAwarePassword;
527
+}
528
+?>" />
419 529
 				</p>
420 530
 			</div>
421 531
 -->
@@ -457,7 +567,10 @@  discard block
 block discarded – undo
457 567
 								    if (filter_var($source['host'],FILTER_VALIDATE_URL)) {
458 568
 								?>
459 569
 								<td><input type="text" name="host[]" id="host" value="<?php print $source['host']; ?>" /></td>
460
-								<td><input type="text" name="port[]" class="col-xs-2" id="port" value="<?php if (isset($source['port'])) print $source['port']; ?>" /></td>
570
+								<td><input type="text" name="port[]" class="col-xs-2" id="port" value="<?php if (isset($source['port'])) {
571
+	print $source['port'];
572
+}
573
+?>" /></td>
461 574
 								<?php
462 575
 								    } else {
463 576
 									$hostport = explode(':',$source['host']);
@@ -476,33 +589,102 @@  discard block
 block discarded – undo
476 589
 								?>
477 590
 								<td>
478 591
 									<select name="format[]" id="format">
479
-										<option value="auto" <?php if (!isset($source['format'])) print 'selected'; ?>>Auto</option>
480
-										<option value="sbs" <?php if (isset($source['format']) && $source['format'] == 'sbs') print 'selected'; ?>>SBS</option>
481
-										<option value="tsv" <?php if (isset($source['format']) && $source['format'] == 'tsv') print 'selected'; ?>>TSV</option>
482
-										<option value="raw" <?php if (isset($source['format']) && $source['format'] == 'raw') print 'selected'; ?>>Raw</option>
483
-										<option value="aprs" <?php if (isset($source['format']) && $source['format'] == 'aprs') print 'selected'; ?>>APRS</option>
484
-										<option value="deltadbtxt" <?php if (isset($source['format']) && $source['format'] == 'deltadbtxt') print 'selected'; ?>>Radarcape deltadb.txt</option>
485
-										<option value="vatsimtxt" <?php if (isset($source['format']) && $source['format'] == 'vatsimtxt') print 'selected'; ?>>Vatsim</option>
486
-										<option value="aircraftlistjson" <?php if (isset($source['format']) && $source['format'] == 'aircraftlistjson') print 'selected'; ?>>Virtual Radar Server AircraftList.json</option>
487
-										<option value="vrstcp" <?php if (isset($source['format']) && $source['format'] == 'vrstcp') print 'selected'; ?>>Virtual Radar Server TCP</option>
488
-										<option value="phpvmacars" <?php if (isset($source['format']) && $source['format'] == 'phpvmacars') print 'selected'; ?>>phpVMS</option>
489
-										<option value="vam" <?php if (isset($source['format']) && $source['format'] == 'vam') print 'selected'; ?>>Virtual Airlines Manager</option>
490
-										<option value="whazzup" <?php if (isset($source['format']) && $source['format'] == 'whazzup') print 'selected'; ?>>IVAO</option>
491
-										<option value="flightgearmp" <?php if (isset($source['format']) && $source['format'] == 'flightgearmp') print 'selected'; ?>>FlightGear Multiplayer</option>
492
-										<option value="flightgearsp" <?php if (isset($source['format']) && $source['format'] == 'flightgearsp') print 'selected'; ?>>FlightGear Singleplayer</option>
493
-										<option value="acars" <?php if (isset($source['format']) && $source['format'] == 'acars') print 'selected'; ?>>ACARS from acarsdec/acarsdeco2 over UDP</option>
494
-										<option value="acarssbs3" <?php if (isset($source['format']) && $source['format'] == 'acarssbs3') print 'selected'; ?>>ACARS SBS-3 over TCP</option>
495
-										<option value="ais" <?php if (isset($source['format']) && $source['format'] == 'ais') print 'selected'; ?>>NMEA AIS over TCP</option>
496
-										<option value="airwhere" <?php if (isset($source['format']) && $source['format'] == 'airwhere') print 'selected'; ?>>AirWhere website</option>
497
-										<option value="hidnseek_callback" <?php if (isset($source['format']) && $source['format'] == 'hidnseek_callback') print 'selected'; ?>>HidnSeek Callback</option>
498
-										<option value="blitzortung" <?php if (isset($source['format']) && $source['format'] == 'blitzortung') print 'selected'; ?>>Blitzortung</option>
592
+										<option value="auto" <?php if (!isset($source['format'])) {
593
+	print 'selected';
594
+}
595
+?>>Auto</option>
596
+										<option value="sbs" <?php if (isset($source['format']) && $source['format'] == 'sbs') {
597
+	print 'selected';
598
+}
599
+?>>SBS</option>
600
+										<option value="tsv" <?php if (isset($source['format']) && $source['format'] == 'tsv') {
601
+	print 'selected';
602
+}
603
+?>>TSV</option>
604
+										<option value="raw" <?php if (isset($source['format']) && $source['format'] == 'raw') {
605
+	print 'selected';
606
+}
607
+?>>Raw</option>
608
+										<option value="aprs" <?php if (isset($source['format']) && $source['format'] == 'aprs') {
609
+	print 'selected';
610
+}
611
+?>>APRS</option>
612
+										<option value="deltadbtxt" <?php if (isset($source['format']) && $source['format'] == 'deltadbtxt') {
613
+	print 'selected';
614
+}
615
+?>>Radarcape deltadb.txt</option>
616
+										<option value="vatsimtxt" <?php if (isset($source['format']) && $source['format'] == 'vatsimtxt') {
617
+	print 'selected';
618
+}
619
+?>>Vatsim</option>
620
+										<option value="aircraftlistjson" <?php if (isset($source['format']) && $source['format'] == 'aircraftlistjson') {
621
+	print 'selected';
622
+}
623
+?>>Virtual Radar Server AircraftList.json</option>
624
+										<option value="vrstcp" <?php if (isset($source['format']) && $source['format'] == 'vrstcp') {
625
+	print 'selected';
626
+}
627
+?>>Virtual Radar Server TCP</option>
628
+										<option value="phpvmacars" <?php if (isset($source['format']) && $source['format'] == 'phpvmacars') {
629
+	print 'selected';
630
+}
631
+?>>phpVMS</option>
632
+										<option value="vam" <?php if (isset($source['format']) && $source['format'] == 'vam') {
633
+	print 'selected';
634
+}
635
+?>>Virtual Airlines Manager</option>
636
+										<option value="whazzup" <?php if (isset($source['format']) && $source['format'] == 'whazzup') {
637
+	print 'selected';
638
+}
639
+?>>IVAO</option>
640
+										<option value="flightgearmp" <?php if (isset($source['format']) && $source['format'] == 'flightgearmp') {
641
+	print 'selected';
642
+}
643
+?>>FlightGear Multiplayer</option>
644
+										<option value="flightgearsp" <?php if (isset($source['format']) && $source['format'] == 'flightgearsp') {
645
+	print 'selected';
646
+}
647
+?>>FlightGear Singleplayer</option>
648
+										<option value="acars" <?php if (isset($source['format']) && $source['format'] == 'acars') {
649
+	print 'selected';
650
+}
651
+?>>ACARS from acarsdec/acarsdeco2 over UDP</option>
652
+										<option value="acarssbs3" <?php if (isset($source['format']) && $source['format'] == 'acarssbs3') {
653
+	print 'selected';
654
+}
655
+?>>ACARS SBS-3 over TCP</option>
656
+										<option value="ais" <?php if (isset($source['format']) && $source['format'] == 'ais') {
657
+	print 'selected';
658
+}
659
+?>>NMEA AIS over TCP</option>
660
+										<option value="airwhere" <?php if (isset($source['format']) && $source['format'] == 'airwhere') {
661
+	print 'selected';
662
+}
663
+?>>AirWhere website</option>
664
+										<option value="hidnseek_callback" <?php if (isset($source['format']) && $source['format'] == 'hidnseek_callback') {
665
+	print 'selected';
666
+}
667
+?>>HidnSeek Callback</option>
668
+										<option value="blitzortung" <?php if (isset($source['format']) && $source['format'] == 'blitzortung') {
669
+	print 'selected';
670
+}
671
+?>>Blitzortung</option>
499 672
 									</select>
500 673
 								</td>
501 674
 								<td>
502
-									<input type="text" name="name[]" id="name" value="<?php if (isset($source['name'])) print $source['name']; ?>" />
675
+									<input type="text" name="name[]" id="name" value="<?php if (isset($source['name'])) {
676
+	print $source['name'];
677
+}
678
+?>" />
503 679
 								</td>
504
-								<td><input type="checkbox" name="sourcestats[]" id="sourcestats" title="Create statistics for the source like number of messages, distance,..." value="1" <?php if (isset($source['sourcestats']) && $source['sourcestats']) print 'checked'; ?> /></td>
505
-								<td><input type="checkbox" name="noarchive[]" id="noarchive" title="Don't archive this source" value="1" <?php if (isset($source['noarchive']) && $source['noarchive']) print 'checked'; ?> /></td>
680
+								<td><input type="checkbox" name="sourcestats[]" id="sourcestats" title="Create statistics for the source like number of messages, distance,..." value="1" <?php if (isset($source['sourcestats']) && $source['sourcestats']) {
681
+	print 'checked';
682
+}
683
+?> /></td>
684
+								<td><input type="checkbox" name="noarchive[]" id="noarchive" title="Don't archive this source" value="1" <?php if (isset($source['noarchive']) && $source['noarchive']) {
685
+	print 'checked';
686
+}
687
+?> /></td>
506 688
 								<td>
507 689
 									<select name="timezones[]" id="timezones">
508 690
 								<?php
@@ -512,7 +694,9 @@  discard block
 block discarded – undo
512 694
 											print '<option selected>'.$timezones.'</option>';
513 695
 										} elseif (!isset($source['timezone']) && $timezones == 'UTC') {
514 696
 											print '<option selected>'.$timezones.'</option>';
515
-										} else print '<option>'.$timezones.'</option>';
697
+										} else {
698
+											print '<option>'.$timezones.'</option>';
699
+										}
516 700
 									}
517 701
 								?>
518 702
 									</select>
@@ -562,7 +746,9 @@  discard block
 block discarded – undo
562 746
 									foreach($timezonelist as $timezones){
563 747
 										if ($timezones == 'UTC') {
564 748
 											print '<option selected>'.$timezones.'</option>';
565
-										} else print '<option>'.$timezones.'</option>';
749
+										} else {
750
+											print '<option>'.$timezones.'</option>';
751
+										}
566 752
 									}
567 753
 								?>
568 754
 									</select>
@@ -585,11 +771,17 @@  discard block
 block discarded – undo
585 771
 					<p>Listen UDP server for acarsdec/acarsdeco2/... with <i>daemon-acars.php</i> script</p>
586 772
 					<p>
587 773
 						<label for="acarshost">ACARS UDP host</label>
588
-						<input type="text" name="acarshost" id="acarshost" value="<?php if (isset($globalACARSHost)) print $globalACARSHost; ?>" />
774
+						<input type="text" name="acarshost" id="acarshost" value="<?php if (isset($globalACARSHost)) {
775
+	print $globalACARSHost;
776
+}
777
+?>" />
589 778
 					</p>
590 779
 					<p>
591 780
 						<label for="acarsport">ACARS UDP port</label>
592
-						<input type="number" name="acarsport" id="acarsport" value="<?php if (isset($globalACARSPort)) print $globalACARSPort; ?>" />
781
+						<input type="number" name="acarsport" id="acarsport" value="<?php if (isset($globalACARSPort)) {
782
+	print $globalACARSPort;
783
+}
784
+?>" />
593 785
 					</p>
594 786
 				</fieldset>
595 787
 			</div>
@@ -671,13 +863,19 @@  discard block
 block discarded – undo
671 863
 			<div id="schedules_options">
672 864
 				<p>
673 865
 					<label for="britishairways">British Airways API Key</label>
674
-					<input type="text" name="britishairways" id="britishairways" value="<?php if (isset($globalBritishAirwaysKey)) print $globalBritishAirwaysKey; ?>" />
866
+					<input type="text" name="britishairways" id="britishairways" value="<?php if (isset($globalBritishAirwaysKey)) {
867
+	print $globalBritishAirwaysKey;
868
+}
869
+?>" />
675 870
 					<p class="help-block">Register an account on <a href="https://developer.ba.com/">https://developer.ba.com/</a></p>
676 871
 				</p>
677 872
 				<!--
678 873
 				<p>
679 874
 					<label for="transavia">Transavia Test API Consumer Key</label>
680
-					<input type="text" name="transavia" id="transavia" value="<?php if (isset($globalTransaviaKey)) print $globalTransaviaKey; ?>" />
875
+					<input type="text" name="transavia" id="transavia" value="<?php if (isset($globalTransaviaKey)) {
876
+	print $globalTransaviaKey;
877
+}
878
+?>" />
681 879
 					<p class="help-block">Register an account on <a href="https://developer.transavia.com">https://developer.transavia.com</a></p>
682 880
 				</p>
683 881
 				-->
@@ -686,10 +884,16 @@  discard block
 block discarded – undo
686 884
 						<b>Lufthansa API Key</b>
687 885
 						<p>
688 886
 							<label for="lufthansakey">Key</label>
689
-							<input type="text" name="lufthansakey" id="lufthansakey" value="<?php if (isset($globalLufthansaKey['key'])) print $globalLufthansaKey['key']; ?>" />
887
+							<input type="text" name="lufthansakey" id="lufthansakey" value="<?php if (isset($globalLufthansaKey['key'])) {
888
+	print $globalLufthansaKey['key'];
889
+}
890
+?>" />
690 891
 						</p><p>
691 892
 							<label for="lufthansasecret">Secret</label>
692
-							<input type="text" name="lufthansasecret" id="lufthansasecret" value="<?php if (isset($globalLufthansaKey['secret'])) print $globalLufthansaKey['secret']; ?>" />
893
+							<input type="text" name="lufthansasecret" id="lufthansasecret" value="<?php if (isset($globalLufthansaKey['secret'])) {
894
+	print $globalLufthansaKey['secret'];
895
+}
896
+?>" />
693 897
 						</p>
694 898
 					</div>
695 899
 					<p class="help-block">Register an account on <a href="https://developer.lufthansa.com/page">https://developer.lufthansa.com/page</a></p>
@@ -709,7 +913,10 @@  discard block
 block discarded – undo
709 913
 			</p>
710 914
 			<p>
711 915
 				<label for="notamsource">URL of your feed from notaminfo.com</label>
712
-				<input type="text" name="notamsource" id="notamsource" value="<?php if (isset($globalNOTAMSource)) print $globalNOTAMSource; ?>" />
916
+				<input type="text" name="notamsource" id="notamsource" value="<?php if (isset($globalNOTAMSource)) {
917
+	print $globalNOTAMSource;
918
+}
919
+?>" />
713 920
 				<p class="help-block">If you want to use world NOTAM from FlightAirMap website, leave it blank</p>
714 921
 			</p>
715 922
 			<br />
@@ -725,14 +932,20 @@  discard block
 block discarded – undo
725 932
 			<div id="metarsrc">
726 933
 				<p>
727 934
 					<label for="metarsource">URL of your METAR source</label>
728
-					<input type="text" name="metarsource" id="metarsource" value="<?php if (isset($globalMETARurl)) print $globalMETARurl; ?>" />
935
+					<input type="text" name="metarsource" id="metarsource" value="<?php if (isset($globalMETARurl)) {
936
+	print $globalMETARurl;
937
+}
938
+?>" />
729 939
 					<p class="help-block">Use {icao} to specify where we replace by airport icao. ex : http://metar.vatsim.net/metar.php?id={icao}</p>
730 940
 				</p>
731 941
 			</div>
732 942
 			<br />
733 943
 			<p>
734 944
 				<label for="bitly">Bit.ly access token api (used in search page)</label>
735
-				<input type="text" name="bitly" id="bitly" value="<?php if (isset($globalBitlyAccessToken)) print $globalBitlyAccessToken; ?>" />
945
+				<input type="text" name="bitly" id="bitly" value="<?php if (isset($globalBitlyAccessToken)) {
946
+	print $globalBitlyAccessToken;
947
+}
948
+?>" />
736 949
 			</p>
737 950
 			<br />
738 951
 			<p>
@@ -748,11 +961,26 @@  discard block
 block discarded – undo
748 961
 			<p>
749 962
 				<label for="geoid_source">Geoid Source</label>
750 963
 				<select name="geoid_source" id="geoid_source">
751
-					<option value="egm96-15"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm96-15') print ' selected="selected"'; ?>>EGM96 15' (2.1MB)</option>
752
-					<option value="egm96-5"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm96-5') print ' selected="selected"'; ?>>EGM96 5' (19MB)</option>
753
-					<option value="egm2008-5"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm2008-5') print ' selected="selected"'; ?>>EGM2008 5' (19MB)</option>
754
-					<option value="egm2008-2_5"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm2008-2_5') print ' selected="selected"'; ?>>EGM2008 2.5' (75MB)</option>
755
-					<option value="egm2008-1"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm2008-1') print ' selected="selected"'; ?>>EGM2008 1' (470MB)</option>
964
+					<option value="egm96-15"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm96-15') {
965
+	print ' selected="selected"';
966
+}
967
+?>>EGM96 15' (2.1MB)</option>
968
+					<option value="egm96-5"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm96-5') {
969
+	print ' selected="selected"';
970
+}
971
+?>>EGM96 5' (19MB)</option>
972
+					<option value="egm2008-5"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm2008-5') {
973
+	print ' selected="selected"';
974
+}
975
+?>>EGM2008 5' (19MB)</option>
976
+					<option value="egm2008-2_5"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm2008-2_5') {
977
+	print ' selected="selected"';
978
+}
979
+?>>EGM2008 2.5' (75MB)</option>
980
+					<option value="egm2008-1"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm2008-1') {
981
+	print ' selected="selected"';
982
+}
983
+?>>EGM2008 1' (470MB)</option>
756 984
 				</select>
757 985
 				<p class="help-block">The geoid is approximated by an "earth gravity model" (EGM).</p>
758 986
 			</p>
@@ -770,7 +998,12 @@  discard block
 block discarded – undo
770 998
 			</p>
771 999
 			<p>
772 1000
 				<label for="archivemonths">Generate statistics, delete or put in archive flights older than xx months</label>
773
-				<input type="number" name="archivemonths" id="archivemonths" value="<?php if (isset($globalArchiveMonths)) print $globalArchiveMonths; else echo '1'; ?>" />
1001
+				<input type="number" name="archivemonths" id="archivemonths" value="<?php if (isset($globalArchiveMonths)) {
1002
+	print $globalArchiveMonths;
1003
+} else {
1004
+	echo '1';
1005
+}
1006
+?>" />
774 1007
 				<p class="help-block">0 to disable, delete old flight if <i>Archive all flights data</i> is disabled</p>
775 1008
 			</p>
776 1009
 			<p>
@@ -780,12 +1013,22 @@  discard block
 block discarded – undo
780 1013
 			</p>
781 1014
 			<p>
782 1015
 				<label for="archivekeepmonths">Keep flights data for xx months in archive</label>
783
-				<input type="number" name="archivekeepmonths" id="archivekeepmonths" value="<?php if (isset($globalArchiveKeepMonths)) print $globalArchiveKeepMonths; else echo '1'; ?>" />
1016
+				<input type="number" name="archivekeepmonths" id="archivekeepmonths" value="<?php if (isset($globalArchiveKeepMonths)) {
1017
+	print $globalArchiveKeepMonths;
1018
+} else {
1019
+	echo '1';
1020
+}
1021
+?>" />
784 1022
 				<p class="help-block">0 to disable</p>
785 1023
 			</p>
786 1024
 			<p>
787 1025
 				<label for="archivekeeptrackmonths">Keep flights track data for xx months in archive</label>
788
-				<input type="number" name="archivekeeptrackmonths" id="archivekeeptrackmonths" value="<?php if (isset($globalArchiveKeepTrackMonths)) print $globalArchiveKeepTrackMonths; else echo '1'; ?>" />
1026
+				<input type="number" name="archivekeeptrackmonths" id="archivekeeptrackmonths" value="<?php if (isset($globalArchiveKeepTrackMonths)) {
1027
+	print $globalArchiveKeepTrackMonths;
1028
+} else {
1029
+	echo '1';
1030
+}
1031
+?>" />
789 1032
 				<p class="help-block">0 to disable, should be less or egal to <i>Keep flights data</i> value</p>
790 1033
 			</p>
791 1034
 			<br />
@@ -795,7 +1038,12 @@  discard block
 block discarded – undo
795 1038
 				<p class="help-block">Uncheck if the script is running as cron job</p>
796 1039
 				<div id="cronends"> 
797 1040
 					<label for="cronend">Run script for xx seconds</label>
798
-					<input type="number" name="cronend" id="cronend" value="<?php if (isset($globalCronEnd)) print $globalCronEnd; else print '0'; ?>" />
1041
+					<input type="number" name="cronend" id="cronend" value="<?php if (isset($globalCronEnd)) {
1042
+	print $globalCronEnd;
1043
+} else {
1044
+	print '0';
1045
+}
1046
+?>" />
799 1047
 					<p class="help-block">Set to 0 to disable. Should be disabled if source is URL.</p>
800 1048
 				</div>
801 1049
 			</p>
@@ -848,15 +1096,30 @@  discard block
 block discarded – undo
848 1096
 			<br />
849 1097
 			<p>
850 1098
 				<label for="refresh">Show flights detected since xxx seconds</label>
851
-				<input type="number" name="refresh" id="refresh" value="<?php if (isset($globalLiveInterval)) echo $globalLiveInterval; else echo '200'; ?>" />
1099
+				<input type="number" name="refresh" id="refresh" value="<?php if (isset($globalLiveInterval)) {
1100
+	echo $globalLiveInterval;
1101
+} else {
1102
+	echo '200';
1103
+}
1104
+?>" />
852 1105
 			</p>
853 1106
 			<p>
854 1107
 				<label for="maprefresh">Live map refresh (in seconds)</label>
855
-				<input type="number" name="maprefresh" id="maprefresh" value="<?php if (isset($globalMapRefresh)) echo $globalMapRefresh; else echo '30'; ?>" />
1108
+				<input type="number" name="maprefresh" id="maprefresh" value="<?php if (isset($globalMapRefresh)) {
1109
+	echo $globalMapRefresh;
1110
+} else {
1111
+	echo '30';
1112
+}
1113
+?>" />
856 1114
 			</p>
857 1115
 			<p>
858 1116
 				<label for="mapidle">Map idle timeout (in minutes)</label>
859
-				<input type="number" name="mapidle" id="mapidle" value="<?php if (isset($globalMapIdleTimeout)) echo $globalMapIdleTimeout; else echo '30'; ?>" />
1117
+				<input type="number" name="mapidle" id="mapidle" value="<?php if (isset($globalMapIdleTimeout)) {
1118
+	echo $globalMapIdleTimeout;
1119
+} else {
1120
+	echo '30';
1121
+}
1122
+?>" />
860 1123
 				<p class="help-block">0 to disable</p>
861 1124
 			</p>
862 1125
 			<p>
@@ -871,12 +1134,20 @@  discard block
 block discarded – undo
871 1134
 			<br />
872 1135
 			<p>
873 1136
 				<label for="closestmindist">Distance to airport set as arrival (in km)</label>
874
-				<input type="number" name="closestmindist" id="closestmindist" value="<?php if (isset($globalClosestMinDist)) echo $globalClosestMinDist; else echo '50'; ?>" />
1137
+				<input type="number" name="closestmindist" id="closestmindist" value="<?php if (isset($globalClosestMinDist)) {
1138
+	echo $globalClosestMinDist;
1139
+} else {
1140
+	echo '50';
1141
+}
1142
+?>" />
875 1143
 			</p>
876 1144
 			<br />
877 1145
 			<p>
878 1146
 				<label for="aircraftsize">Size of aircraft icon on map (default to 30px if zoom > 7 else 15px), empty to default</label>
879
-				<input type="number" name="aircraftsize" id="aircraftsize" value="<?php if (isset($globalAircraftSize)) echo $globalAircraftSize;?>" />
1147
+				<input type="number" name="aircraftsize" id="aircraftsize" value="<?php if (isset($globalAircraftSize)) {
1148
+	echo $globalAircraftSize;
1149
+}
1150
+?>" />
880 1151
 			</p>
881 1152
 			<br />
882 1153
 			<p>
@@ -889,7 +1160,12 @@  discard block
 block discarded – undo
889 1160
 			    if (extension_loaded('gd') && function_exists('gd_info')) {
890 1161
 			?>
891 1162
 				<label for="aircrafticoncolor">Color of aircraft icon on map</label>
892
-				<input type="color" name="aircrafticoncolor" id="aircrafticoncolor" value="#<?php if (isset($globalAircraftIconColor)) echo $globalAircraftIconColor; else echo '1a3151'; ?>" />
1163
+				<input type="color" name="aircrafticoncolor" id="aircrafticoncolor" value="#<?php if (isset($globalAircraftIconColor)) {
1164
+	echo $globalAircraftIconColor;
1165
+} else {
1166
+	echo '1a3151';
1167
+}
1168
+?>" />
893 1169
 			<?php
894 1170
 				if (!is_writable('../cache')) {
895 1171
 			?>
@@ -907,14 +1183,27 @@  discard block
 block discarded – undo
907 1183
 			<p>
908 1184
 				<label for="airportzoom">Zoom level minimum to see airports icons</label>
909 1185
 				<div class="range">
910
-					<input type="range" name="airportzoom" id="airportzoom" value="<?php if (isset($globalAirportZoom)) echo $globalAirportZoom; else echo '7'; ?>" />
911
-					<output id="range"><?php if (isset($globalAirportZoom)) echo $globalAirportZoom; else echo '7'; ?></output>
1186
+					<input type="range" name="airportzoom" id="airportzoom" value="<?php if (isset($globalAirportZoom)) {
1187
+	echo $globalAirportZoom;
1188
+} else {
1189
+	echo '7';
1190
+}
1191
+?>" />
1192
+					<output id="range"><?php if (isset($globalAirportZoom)) {
1193
+	echo $globalAirportZoom;
1194
+} else {
1195
+	echo '7';
1196
+}
1197
+?></output>
912 1198
 				</div>
913 1199
 			</p>
914 1200
 			<br />
915 1201
 			<p>
916 1202
 				<label for="customcss">Custom CSS web path</label>
917
-				<input type="text" name="customcss" id="customcss" value="<?php if (isset($globalCustomCSS)) echo $globalCustomCSS; ?>" />
1203
+				<input type="text" name="customcss" id="customcss" value="<?php if (isset($globalCustomCSS)) {
1204
+	echo $globalCustomCSS;
1205
+}
1206
+?>" />
918 1207
 			</p>
919 1208
 		</fieldset>
920 1209
 		<input type="submit" name="submit" value="Create/Update database & write setup" />
@@ -941,8 +1230,12 @@  discard block
 block discarded – undo
941 1230
 	$dbhost = filter_input(INPUT_POST,'dbhost',FILTER_SANITIZE_STRING);
942 1231
 	$dbport = filter_input(INPUT_POST,'dbport',FILTER_SANITIZE_STRING);
943 1232
 
944
-	if ($dbtype == 'mysql' && !extension_loaded('pdo_mysql')) $error .= 'Mysql driver for PDO must be loaded';
945
-	if ($dbtype == 'pgsql' && !extension_loaded('pdo_pgsql')) $error .= 'PosgreSQL driver for PDO must be loaded';
1233
+	if ($dbtype == 'mysql' && !extension_loaded('pdo_mysql')) {
1234
+		$error .= 'Mysql driver for PDO must be loaded';
1235
+	}
1236
+	if ($dbtype == 'pgsql' && !extension_loaded('pdo_pgsql')) {
1237
+		$error .= 'PosgreSQL driver for PDO must be loaded';
1238
+	}
946 1239
 	
947 1240
 	$_SESSION['database_root'] = $dbroot;
948 1241
 	$_SESSION['database_rootpass'] = $dbrootpass;
@@ -1010,15 +1303,23 @@  discard block
 block discarded – undo
1010 1303
 	$source_city = $_POST['source_city'];
1011 1304
 	$source_country = $_POST['source_country'];
1012 1305
 	$source_ref = $_POST['source_ref'];
1013
-	if (isset($source_id)) $source_id = $_POST['source_id'];
1014
-	else $source_id = array();
1306
+	if (isset($source_id)) {
1307
+		$source_id = $_POST['source_id'];
1308
+	} else {
1309
+		$source_id = array();
1310
+	}
1015 1311
 	
1016 1312
 	$sources = array();
1017 1313
 	foreach ($source_name as $keys => $name) {
1018
-	    if (isset($source_id[$keys])) $sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'id' => $source_id[$keys],'source' => $source_ref[$keys]);
1019
-	    else $sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'source' => $source_ref[$keys]);
1314
+	    if (isset($source_id[$keys])) {
1315
+	    	$sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'id' => $source_id[$keys],'source' => $source_ref[$keys]);
1316
+	    } else {
1317
+	    	$sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'source' => $source_ref[$keys]);
1318
+	    }
1319
+	}
1320
+	if (count($sources) > 0) {
1321
+		$_SESSION['sources'] = $sources;
1020 1322
 	}
1021
-	if (count($sources) > 0) $_SESSION['sources'] = $sources;
1022 1323
 
1023 1324
 	//$sbshost = filter_input(INPUT_POST,'sbshost',FILTER_SANITIZE_STRING);
1024 1325
 	//$sbsport = filter_input(INPUT_POST,'sbsport',FILTER_SANITIZE_NUMBER_INT);
@@ -1039,17 +1340,29 @@  discard block
 block discarded – undo
1039 1340
 	$datasource = filter_input(INPUT_POST,'datasource',FILTER_SANITIZE_STRING);
1040 1341
 
1041 1342
 	$globalaircraft = filter_input(INPUT_POST,'globalaircraft',FILTER_SANITIZE_STRING);
1042
-	if ($globalaircraft == 'aircraft') $settings = array_merge($settings,array('globalAircraft' => 'TRUE'));
1043
-	else $settings = array_merge($settings,array('globalAircraft' => 'FALSE'));
1343
+	if ($globalaircraft == 'aircraft') {
1344
+		$settings = array_merge($settings,array('globalAircraft' => 'TRUE'));
1345
+	} else {
1346
+		$settings = array_merge($settings,array('globalAircraft' => 'FALSE'));
1347
+	}
1044 1348
 	$globaltracker = filter_input(INPUT_POST,'globaltracker',FILTER_SANITIZE_STRING);
1045
-	if ($globaltracker == 'tracker') $settings = array_merge($settings,array('globalTracker' => 'TRUE'));
1046
-	else $settings = array_merge($settings,array('globalTracker' => 'FALSE'));
1349
+	if ($globaltracker == 'tracker') {
1350
+		$settings = array_merge($settings,array('globalTracker' => 'TRUE'));
1351
+	} else {
1352
+		$settings = array_merge($settings,array('globalTracker' => 'FALSE'));
1353
+	}
1047 1354
 	$globalmarine = filter_input(INPUT_POST,'globalmarine',FILTER_SANITIZE_STRING);
1048
-	if ($globalmarine == 'marine') $settings = array_merge($settings,array('globalMarine' => 'TRUE'));
1049
-	else $settings = array_merge($settings,array('globalMarine' => 'FALSE'));
1355
+	if ($globalmarine == 'marine') {
1356
+		$settings = array_merge($settings,array('globalMarine' => 'TRUE'));
1357
+	} else {
1358
+		$settings = array_merge($settings,array('globalMarine' => 'FALSE'));
1359
+	}
1050 1360
 	$globalsatellite = filter_input(INPUT_POST,'globalsatellite',FILTER_SANITIZE_STRING);
1051
-	if ($globalsatellite == 'satellite') $settings = array_merge($settings,array('globalSatellite' => 'TRUE'));
1052
-	else $settings = array_merge($settings,array('globalSatellite' => 'FALSE'));
1361
+	if ($globalsatellite == 'satellite') {
1362
+		$settings = array_merge($settings,array('globalSatellite' => 'TRUE'));
1363
+	} else {
1364
+		$settings = array_merge($settings,array('globalSatellite' => 'FALSE'));
1365
+	}
1053 1366
 
1054 1367
 /*	
1055 1368
 	$globalSBS1Hosts = array();
@@ -1071,23 +1384,37 @@  discard block
 block discarded – undo
1071 1384
 	$name = $_POST['name'];
1072 1385
 	$format = $_POST['format'];
1073 1386
 	$timezones = $_POST['timezones'];
1074
-	if (isset($_POST['sourcestats'])) $sourcestats = $_POST['sourcestats'];
1075
-	else $sourcestats = array();
1076
-	if (isset($_POST['noarchive'])) $noarchive = $_POST['noarchive'];
1077
-	else $noarchive = array();
1387
+	if (isset($_POST['sourcestats'])) {
1388
+		$sourcestats = $_POST['sourcestats'];
1389
+	} else {
1390
+		$sourcestats = array();
1391
+	}
1392
+	if (isset($_POST['noarchive'])) {
1393
+		$noarchive = $_POST['noarchive'];
1394
+	} else {
1395
+		$noarchive = array();
1396
+	}
1078 1397
 	$gSources = array();
1079 1398
 	$forcepilots = false;
1080 1399
 	foreach ($host as $key => $h) {
1081
-		if (isset($sourcestats[$key]) && $sourcestats[$key] == 1) $cov = 'TRUE';
1082
-		else $cov = 'FALSE';
1083
-		if (isset($noarchive[$key]) && $noarchive[$key] == 1) $arch = 'TRUE';
1084
-		else $arch = 'FALSE';
1400
+		if (isset($sourcestats[$key]) && $sourcestats[$key] == 1) {
1401
+			$cov = 'TRUE';
1402
+		} else {
1403
+			$cov = 'FALSE';
1404
+		}
1405
+		if (isset($noarchive[$key]) && $noarchive[$key] == 1) {
1406
+			$arch = 'TRUE';
1407
+		} else {
1408
+			$arch = 'FALSE';
1409
+		}
1085 1410
 		if (strpos($format[$key],'_callback')) {
1086 1411
 			$gSources[] = array('host' => $h, 'pass' => $port[$key],'name' => $name[$key],'format' => $format[$key],'sourcestats' => $cov,'noarchive' => $arch,'timezone' => $timezones[$key],'callback' => 'TRUE');
1087 1412
 		} elseif ($h != '' || $name[$key] != '') {
1088 1413
 			$gSources[] = array('host' => $h, 'port' => $port[$key],'name' => $name[$key],'format' => $format[$key],'sourcestats' => $cov,'noarchive' => $arch,'timezone' => $timezones[$key],'callback' => 'FALSE');
1089 1414
 		}
1090
-		if ($format[$key] == 'airwhere') $forcepilots = true;
1415
+		if ($format[$key] == 'airwhere') {
1416
+			$forcepilots = true;
1417
+		}
1091 1418
 	}
1092 1419
 	$settings = array_merge($settings,array('globalSources' => $gSources));
1093 1420
 
@@ -1115,7 +1442,9 @@  discard block
 block discarded – undo
1115 1442
 	$zoidistance = filter_input(INPUT_POST,'zoidistance',FILTER_SANITIZE_NUMBER_INT);
1116 1443
 	if ($zoilatitude != '' && $zoilongitude != '' && $zoidistance != '') {
1117 1444
 		$settings = array_merge($settings,array('globalDistanceIgnore' => array('latitude' => $zoilatitude,'longitude' => $zoilongitude,'distance' => $zoidistance)));
1118
-	} else $settings = array_merge($settings,array('globalDistanceIgnore' => array()));
1445
+	} else {
1446
+		$settings = array_merge($settings,array('globalDistanceIgnore' => array()));
1447
+	}
1119 1448
 
1120 1449
 	$refresh = filter_input(INPUT_POST,'refresh',FILTER_SANITIZE_NUMBER_INT);
1121 1450
 	$settings = array_merge($settings,array('globalLiveInterval' => $refresh));
@@ -1154,7 +1483,9 @@  discard block
 block discarded – undo
1154 1483
 
1155 1484
 	// Create in settings.php keys not yet configurable if not already here
1156 1485
 	//if (!isset($globalImageBingKey)) $settings = array_merge($settings,array('globalImageBingKey' => ''));
1157
-	if (!isset($globalDebug)) $settings = array_merge($settings,array('globalDebug' => 'TRUE'));
1486
+	if (!isset($globalDebug)) {
1487
+		$settings = array_merge($settings,array('globalDebug' => 'TRUE'));
1488
+	}
1158 1489
 
1159 1490
 	$resetyearstats = filter_input(INPUT_POST,'resetyearstats',FILTER_SANITIZE_STRING);
1160 1491
 	if ($resetyearstats == 'resetyearstats') {
@@ -1191,37 +1522,56 @@  discard block
 block discarded – undo
1191 1522
 	}
1192 1523
 */
1193 1524
 	$settings = array_merge($settings,array('globalFlightAware' => 'FALSE'));
1194
-	if ($globalsbs == 'sbs') $settings = array_merge($settings,array('globalSBS1' => 'TRUE'));
1195
-	else $settings = array_merge($settings,array('globalSBS1' => 'FALSE'));
1196
-	if ($globalaprs == 'aprs') $settings = array_merge($settings,array('globalAPRS' => 'TRUE'));
1197
-	else $settings = array_merge($settings,array('globalAPRS' => 'FALSE'));
1525
+	if ($globalsbs == 'sbs') {
1526
+		$settings = array_merge($settings,array('globalSBS1' => 'TRUE'));
1527
+	} else {
1528
+		$settings = array_merge($settings,array('globalSBS1' => 'FALSE'));
1529
+	}
1530
+	if ($globalaprs == 'aprs') {
1531
+		$settings = array_merge($settings,array('globalAPRS' => 'TRUE'));
1532
+	} else {
1533
+		$settings = array_merge($settings,array('globalAPRS' => 'FALSE'));
1534
+	}
1198 1535
 	$va = false;
1199 1536
 	if ($globalivao == 'ivao') {
1200 1537
 		$settings = array_merge($settings,array('globalIVAO' => 'TRUE'));
1201 1538
 		$va = true;
1202
-	} else $settings = array_merge($settings,array('globalIVAO' => 'FALSE'));
1539
+	} else {
1540
+		$settings = array_merge($settings,array('globalIVAO' => 'FALSE'));
1541
+	}
1203 1542
 	if ($globalvatsim == 'vatsim') {
1204 1543
 		$settings = array_merge($settings,array('globalVATSIM' => 'TRUE'));
1205 1544
 		$va = true;
1206
-	} else $settings = array_merge($settings,array('globalVATSIM' => 'FALSE'));
1545
+	} else {
1546
+		$settings = array_merge($settings,array('globalVATSIM' => 'FALSE'));
1547
+	}
1207 1548
 	if ($globalphpvms == 'phpvms') {
1208 1549
 		$settings = array_merge($settings,array('globalphpVMS' => 'TRUE'));
1209 1550
 		$va = true;
1210
-	} else $settings = array_merge($settings,array('globalphpVMS' => 'FALSE'));
1551
+	} else {
1552
+		$settings = array_merge($settings,array('globalphpVMS' => 'FALSE'));
1553
+	}
1211 1554
 	if ($globalvam == 'vam') {
1212 1555
 		$settings = array_merge($settings,array('globalVAM' => 'TRUE'));
1213 1556
 		$va = true;
1214
-	} else $settings = array_merge($settings,array('globalVAM' => 'FALSE'));
1557
+	} else {
1558
+		$settings = array_merge($settings,array('globalVAM' => 'FALSE'));
1559
+	}
1215 1560
 	if ($va) {
1216 1561
 		$settings = array_merge($settings,array('globalSchedulesFetch' => 'FALSE','globalTranslationFetch' => 'FALSE'));
1217
-	} else $settings = array_merge($settings,array('globalSchedulesFetch' => 'TRUE','globalTranslationFetch' => 'TRUE'));
1562
+	} else {
1563
+		$settings = array_merge($settings,array('globalSchedulesFetch' => 'TRUE','globalTranslationFetch' => 'TRUE'));
1564
+	}
1218 1565
 	if ($globalva == 'va' || $va) {
1219 1566
 		$settings = array_merge($settings,array('globalVA' => 'TRUE'));
1220 1567
 		$settings = array_merge($settings,array('globalUsePilot' => 'TRUE','globalUseOwner' => 'FALSE'));
1221 1568
 	} else {
1222 1569
 		$settings = array_merge($settings,array('globalVA' => 'FALSE'));
1223
-		if ($forcepilots) $settings = array_merge($settings,array('globalUsePilot' => 'TRUE','globalUseOwner' => 'FALSE'));
1224
-		else $settings = array_merge($settings,array('globalUsePilot' => 'FALSE','globalUseOwner' => 'TRUE'));
1570
+		if ($forcepilots) {
1571
+			$settings = array_merge($settings,array('globalUsePilot' => 'TRUE','globalUseOwner' => 'FALSE'));
1572
+		} else {
1573
+			$settings = array_merge($settings,array('globalUsePilot' => 'FALSE','globalUseOwner' => 'TRUE'));
1574
+		}
1225 1575
 	}
1226 1576
 	
1227 1577
 	
@@ -1397,7 +1747,9 @@  discard block
 block discarded – undo
1397 1747
 		$settings = array_merge($settings,array('globalNoAirlines' => 'FALSE'));
1398 1748
 	}
1399 1749
 
1400
-	if (!isset($globalTransaction)) $settings = array_merge($settings,array('globalTransaction' => 'TRUE'));
1750
+	if (!isset($globalTransaction)) {
1751
+		$settings = array_merge($settings,array('globalTransaction' => 'TRUE'));
1752
+	}
1401 1753
 
1402 1754
 	// Set some defaults values...
1403 1755
 	if (!isset($globalAircraftImageSources)) {
@@ -1412,15 +1764,23 @@  discard block
 block discarded – undo
1412 1764
 
1413 1765
 	$settings = array_merge($settings,array('globalInstalled' => 'TRUE'));
1414 1766
 
1415
-	if ($error == '') settings::modify_settings($settings);
1416
-	if ($error == '') settings::comment_settings($settings_comment);
1767
+	if ($error == '') {
1768
+		settings::modify_settings($settings);
1769
+	}
1770
+	if ($error == '') {
1771
+		settings::comment_settings($settings_comment);
1772
+	}
1417 1773
 	if ($error != '') {
1418 1774
 		print '<div class="info column">'.$error.'</div>';
1419 1775
 		require('../footer.php');
1420 1776
 		exit;
1421 1777
 	} else {
1422
-		if (isset($_POST['waypoints']) && $_POST['waypoints'] == 'waypoints') $_SESSION['waypoints'] = 1;
1423
-		if (isset($_POST['owner']) && $_POST['owner'] == 'owner') $_SESSION['owner'] = 1;
1778
+		if (isset($_POST['waypoints']) && $_POST['waypoints'] == 'waypoints') {
1779
+			$_SESSION['waypoints'] = 1;
1780
+		}
1781
+		if (isset($_POST['owner']) && $_POST['owner'] == 'owner') {
1782
+			$_SESSION['owner'] = 1;
1783
+		}
1424 1784
 		if (isset($_POST['createdb'])) {
1425 1785
 			$_SESSION['install'] = 'database_create';
1426 1786
 		} else {
@@ -1456,10 +1816,18 @@  discard block
 block discarded – undo
1456 1816
 	$popw = false;
1457 1817
 	foreach ($_SESSION['done'] as $done) {
1458 1818
 	    print '<li>'.$done.'....<strong>SUCCESS</strong></li>';
1459
-	    if ($done == 'Create database') $pop = true;
1460
-	    if ($_SESSION['install'] == 'database_create') $pop = true;
1461
-	    if ($_SESSION['install'] == 'database_import') $popi = true;
1462
-	    if ($_SESSION['install'] == 'waypoints') $popw = true;
1819
+	    if ($done == 'Create database') {
1820
+	    	$pop = true;
1821
+	    }
1822
+	    if ($_SESSION['install'] == 'database_create') {
1823
+	    	$pop = true;
1824
+	    }
1825
+	    if ($_SESSION['install'] == 'database_import') {
1826
+	    	$popi = true;
1827
+	    }
1828
+	    if ($_SESSION['install'] == 'waypoints') {
1829
+	    	$popw = true;
1830
+	    }
1463 1831
 	}
1464 1832
 	if ($pop) {
1465 1833
 	    sleep(5);
@@ -1470,7 +1838,9 @@  discard block
 block discarded – undo
1470 1838
 	} else if ($popw) {
1471 1839
 	    sleep(5);
1472 1840
 	    print '<li>Populate waypoints database....<img src="../images/loading.gif" /></li>';
1473
-	} else print '<li>Update schema if needed....<img src="../images/loading.gif" /></li>';
1841
+	} else {
1842
+		print '<li>Update schema if needed....<img src="../images/loading.gif" /></li>';
1843
+	}
1474 1844
 	print '</div></ul>';
1475 1845
 	print '<div id="error"></div>';
1476 1846
 /*	foreach ($_SESSION['done'] as $done) {
Please login to merge, or discard this patch.
scripts/update_db.php 1 patch
Braces   +27 added lines, -10 removed lines patch added patch discarded remove patch
@@ -9,7 +9,9 @@  discard block
 block discarded – undo
9 9
 if (strtoupper(substr(PHP_OS, 0, 3)) != 'WIN') {
10 10
 	exec("ps ux", $output, $result);
11 11
 	$j = 0;
12
-	foreach ($output as $line) if(strpos($line, dirname(__FILE__)."/update_db.php") && !strpos($line, "sh ")) $j++;
12
+	foreach ($output as $line) {
13
+		if(strpos($line, dirname(__FILE__)."/update_db.php") && !strpos($line, "sh ")) $j++;
14
+	}
13 15
 	if ($j > 1) {
14 16
 		echo "Script is already runnning...";
15 17
 		die();
@@ -29,14 +31,18 @@  discard block
 block discarded – undo
29 31
 			$update_db->update_notam();
30 32
 		}
31 33
 		$update_db->insert_last_notam_update();
32
-	} elseif (isset($globalDebug) && $globalDebug && isset($globalNOTAM) && $globalNOTAM) echo "NOTAM are only updated once a day.\n";
34
+	} elseif (isset($globalDebug) && $globalDebug && isset($globalNOTAM) && $globalNOTAM) {
35
+		echo "NOTAM are only updated once a day.\n";
36
+	}
33 37
 	if ($update_db->check_last_update() && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS)) {
34 38
 		$update_db->update_all();
35 39
 	//	require_once(dirname(__FILE__).'/../require/class.Spotter.php');
36 40
 	//	$Spotter = new Spotter();
37 41
 	//	$Spotter->updateFieldsFromOtherTables();
38 42
 		$update_db->insert_last_update();
39
-	} elseif (isset($globalDebug) && $globalDebug && (!isset($globalVA) || !$globalVA) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM)) echo "DB are populated with external data only every 15 days ! Files are not updated more often.\n";
43
+	} elseif (isset($globalDebug) && $globalDebug && (!isset($globalVA) || !$globalVA) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM)) {
44
+		echo "DB are populated with external data only every 15 days ! Files are not updated more often.\n";
45
+	}
40 46
 	if (isset($globalWaypoints) && $globalWaypoints && $update_db->check_last_airspace_update()) {
41 47
 		echo "Check if new airspace version exist...";
42 48
 		echo $update_db->update_airspace_fam();
@@ -45,8 +51,11 @@  discard block
 block discarded – undo
45 51
 	if (isset($globalGeoid) && $globalGeoid && $update_db->check_last_geoid_update()) {
46 52
 		echo "Check if new geoid version exist...";
47 53
 		$error = $update_db->update_geoid_fam();
48
-		if ($error == '') $update_db->insert_last_geoid_update();
49
-		else echo $error;
54
+		if ($error == '') {
55
+			$update_db->insert_last_geoid_update();
56
+		} else {
57
+			echo $error;
58
+		}
50 59
 	}
51 60
 	if (isset($globalMarine) && $globalMarine && $update_db->check_last_marine_identity_update()) {
52 61
 		echo "Check if new marine identity version exist...";
@@ -64,7 +73,9 @@  discard block
 block discarded – undo
64 73
 			//echo "Done";
65 74
 		}
66 75
 		$update_db->insert_last_owner_update();
67
-	} elseif (isset($globalDebug) && $globalDebug && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS)) echo "Owner are only updated every 15 days.\n";
76
+	} elseif (isset($globalDebug) && $globalDebug && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS)) {
77
+		echo "Owner are only updated every 15 days.\n";
78
+	}
68 79
 
69 80
 	if (isset($globalAccidents) && $globalAccidents && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS)) {
70 81
 		require_once(dirname(__FILE__).'/../require/class.Accident.php');
@@ -73,7 +84,9 @@  discard block
 block discarded – undo
73 84
 		if ($Accident->check_last_accidents_update()) {
74 85
 			$Accident->download_update();
75 86
 			$Accident->insert_last_accidents_update();
76
-		} else echo "Accidents are updated once a day.\n";
87
+		} else {
88
+			echo "Accidents are updated once a day.\n";
89
+		}
77 90
 	}
78 91
   
79 92
 }
@@ -86,15 +99,19 @@  discard block
 block discarded – undo
86 99
 	if ($METAR->check_last_update()) {
87 100
 		$METAR->addMETARCycle();
88 101
 		$METAR->insert_last_update();
89
-	} else echo "METAR are only updated every 30 minutes.\n";
90
-}
102
+	} else {
103
+		echo "METAR are only updated every 30 minutes.\n";
104
+	}
105
+	}
91 106
 
92 107
 if (isset($globalSchedules) && $globalSchedules && $update_db->check_last_schedules_update() && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS)) {
93 108
 	echo "Updating schedules...";
94 109
 	//$update_db->update_oneworld();
95 110
 	$update_db->update_skyteam();
96 111
 	$update_db->insert_last_schedules_update();
97
-} elseif (isset($globalDebug) && $globalDebug && isset($globalOwner) && $globalOwner && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS)) echo "Schedules are only updated every 15 days.\n";
112
+} elseif (isset($globalDebug) && $globalDebug && isset($globalOwner) && $globalOwner && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS)) {
113
+	echo "Schedules are only updated every 15 days.\n";
114
+}
98 115
 
99 116
 if (isset($globalArchiveMonths) && $globalArchiveMonths > 0) {
100 117
 	echo "Updating statistics and archive old data...";
Please login to merge, or discard this patch.
install/class.update_schema.php 1 patch
Braces   +428 added lines, -158 removed lines patch added patch discarded remove patch
@@ -258,7 +258,9 @@  discard block
 block discarded – undo
258 258
     		// Update table countries
259 259
     		if ($Connection->tableExists('airspace')) {
260 260
     		    $error .= update_db::update_countries();
261
-		    if ($error != '') return $error;
261
+		    if ($error != '') {
262
+		    	return $error;
263
+		    }
262 264
 		}
263 265
 		// Update schema_version to 7
264 266
 		$query = "UPDATE `config` SET `value` = '7' WHERE `name` = 'schema_version'";
@@ -314,7 +316,9 @@  discard block
 block discarded – undo
314 316
     		$error = '';
315 317
     		// Update table aircraft
316 318
 		$error .= create_db::import_file('../db/source_location.sql');
317
-		if ($error != '') return $error;
319
+		if ($error != '') {
320
+			return $error;
321
+		}
318 322
 		// Update schema_version to 6
319 323
 		$query = "UPDATE `config` SET `value` = '8' WHERE `name` = 'schema_version'";
320 324
         	try {
@@ -331,7 +335,9 @@  discard block
 block discarded – undo
331 335
     		$error = '';
332 336
     		// Update table aircraft
333 337
 		$error .= create_db::import_file('../db/notam.sql');
334
-		if ($error != '') return $error;
338
+		if ($error != '') {
339
+			return $error;
340
+		}
335 341
 		$query = "DELETE FROM config WHERE name = 'last_update_db';
336 342
                         INSERT INTO config (name,value) VALUES ('last_update_db',NOW());
337 343
                         DELETE FROM config WHERE name = 'last_update_notam_db';
@@ -365,7 +371,9 @@  discard block
 block discarded – undo
365 371
 		$error = '';
366 372
     		// Update table atc
367 373
 		$error .= create_db::import_file('../db/atc.sql');
368
-		if ($error != '') return $error;
374
+		if ($error != '') {
375
+			return $error;
376
+		}
369 377
 		
370 378
 		$query = "UPDATE `config` SET `value` = '10' WHERE `name` = 'schema_version'";
371 379
         	try {
@@ -389,13 +397,21 @@  discard block
 block discarded – undo
389 397
 		$error = '';
390 398
     		// Add tables
391 399
 		$error .= create_db::import_file('../db/aircraft_owner.sql');
392
-		if ($error != '') return $error;
400
+		if ($error != '') {
401
+			return $error;
402
+		}
393 403
 		$error .= create_db::import_file('../db/metar.sql');
394
-		if ($error != '') return $error;
404
+		if ($error != '') {
405
+			return $error;
406
+		}
395 407
 		$error .= create_db::import_file('../db/taf.sql');
396
-		if ($error != '') return $error;
408
+		if ($error != '') {
409
+			return $error;
410
+		}
397 411
 		$error .= create_db::import_file('../db/airport.sql');
398
-		if ($error != '') return $error;
412
+		if ($error != '') {
413
+			return $error;
414
+		}
399 415
 		
400 416
 		$query = "UPDATE `config` SET `value` = '11' WHERE `name` = 'schema_version'";
401 417
         	try {
@@ -469,19 +485,33 @@  discard block
 block discarded – undo
469 485
 		$error = '';
470 486
     		// Add tables
471 487
 		$error .= create_db::import_file('../db/stats.sql');
472
-		if ($error != '') return $error;
488
+		if ($error != '') {
489
+			return $error;
490
+		}
473 491
 		$error .= create_db::import_file('../db/stats_aircraft.sql');
474
-		if ($error != '') return $error;
492
+		if ($error != '') {
493
+			return $error;
494
+		}
475 495
 		$error .= create_db::import_file('../db/stats_airline.sql');
476
-		if ($error != '') return $error;
496
+		if ($error != '') {
497
+			return $error;
498
+		}
477 499
 		$error .= create_db::import_file('../db/stats_airport.sql');
478
-		if ($error != '') return $error;
500
+		if ($error != '') {
501
+			return $error;
502
+		}
479 503
 		$error .= create_db::import_file('../db/stats_owner.sql');
480
-		if ($error != '') return $error;
504
+		if ($error != '') {
505
+			return $error;
506
+		}
481 507
 		$error .= create_db::import_file('../db/stats_pilot.sql');
482
-		if ($error != '') return $error;
508
+		if ($error != '') {
509
+			return $error;
510
+		}
483 511
 		$error .= create_db::import_file('../db/spotter_archive_output.sql');
484
-		if ($error != '') return $error;
512
+		if ($error != '') {
513
+			return $error;
514
+		}
485 515
 		
486 516
 		$query = "UPDATE `config` SET `value` = '13' WHERE `name` = 'schema_version'";
487 517
         	try {
@@ -521,7 +551,9 @@  discard block
 block discarded – undo
521 551
     		// Add tables
522 552
     		if (!$Connection->tableExists('stats_flight')) {
523 553
 			$error .= create_db::import_file('../db/stats_flight.sql');
524
-			if ($error != '') return $error;
554
+			if ($error != '') {
555
+				return $error;
556
+			}
525 557
 		}
526 558
 		$query = "UPDATE `config` SET `value` = '15' WHERE `name` = 'schema_version'";
527 559
         	try {
@@ -545,7 +577,9 @@  discard block
 block discarded – undo
545 577
     		} catch(PDOException $e) {
546 578
 		    return "error (update stats) : ".$e->getMessage()."\n";
547 579
     		}
548
-		if ($error != '') return $error;
580
+		if ($error != '') {
581
+			return $error;
582
+		}
549 583
 		$query = "UPDATE `config` SET `value` = '16' WHERE `name` = 'schema_version'";
550 584
         	try {
551 585
             	    $sth = $Connection->db->prepare($query);
@@ -566,7 +600,9 @@  discard block
 block discarded – undo
566 600
     		if (!$Connection->tableExists('stats_callsign')) {
567 601
 			$error .= create_db::import_file('../db/stats_callsign.sql');
568 602
 		}
569
-		if ($error != '') return $error;
603
+		if ($error != '') {
604
+			return $error;
605
+		}
570 606
 		$query = "UPDATE `config` SET `value` = '17' WHERE `name` = 'schema_version'";
571 607
         	try {
572 608
             	    $sth = $Connection->db->prepare($query);
@@ -584,7 +620,9 @@  discard block
 block discarded – undo
584 620
     		if (!$Connection->tableExists('stats_country')) {
585 621
 			$error .= create_db::import_file('../db/stats_country.sql');
586 622
 		}
587
-		if ($error != '') return $error;
623
+		if ($error != '') {
624
+			return $error;
625
+		}
588 626
 		$query = "UPDATE `config` SET `value` = '18' WHERE `name` = 'schema_version'";
589 627
         	try {
590 628
             	    $sth = $Connection->db->prepare($query);
@@ -607,7 +645,9 @@  discard block
 block discarded – undo
607 645
 			    return "error (update stats) : ".$e->getMessage()."\n";
608 646
     			}
609 647
     		}
610
-		if ($error != '') return $error;
648
+		if ($error != '') {
649
+			return $error;
650
+		}
611 651
 		$query = "UPDATE `config` SET `value` = '19' WHERE `name` = 'schema_version'";
612 652
         	try {
613 653
             	    $sth = $Connection->db->prepare($query);
@@ -623,7 +663,9 @@  discard block
 block discarded – undo
623 663
 		$error = '';
624 664
     		// Update airport table
625 665
 		$error .= create_db::import_file('../db/airport.sql');
626
-		if ($error != '') return 'Import airport.sql : '.$error;
666
+		if ($error != '') {
667
+			return 'Import airport.sql : '.$error;
668
+		}
627 669
 		// Remove primary key on Spotter_Archive
628 670
 		$query = "alter table spotter_archive drop spotter_archive_id";
629 671
         	try {
@@ -699,7 +741,9 @@  discard block
 block discarded – undo
699 741
 				return "error (add source_name column) : ".$e->getMessage()."\n";
700 742
     			}
701 743
     		}
702
-		if ($error != '') return $error;
744
+		if ($error != '') {
745
+			return $error;
746
+		}
703 747
 		$query = "UPDATE `config` SET `value` = '20' WHERE `name` = 'schema_version'";
704 748
         	try {
705 749
             	    $sth = $Connection->db->prepare($query);
@@ -717,7 +761,9 @@  discard block
 block discarded – undo
717 761
     		// Update airline table
718 762
     		if (!$globalIVAO && !$globalVATSIM && !$globalphpVMS) {
719 763
 			$error .= create_db::import_file('../db/airlines.sql');
720
-			if ($error != '') return 'Import airlines.sql : '.$error;
764
+			if ($error != '') {
765
+				return 'Import airlines.sql : '.$error;
766
+			}
721 767
 		}
722 768
 		if (!$Connection->checkColumnName('aircraft_modes','type_flight')) {
723 769
 			// Add column over_country
@@ -729,7 +775,9 @@  discard block
 block discarded – undo
729 775
 				return "error (add over_country) : ".$e->getMessage()."\n";
730 776
     			}
731 777
     		}
732
-		if ($error != '') return $error;
778
+		if ($error != '') {
779
+			return $error;
780
+		}
733 781
 		/*
734 782
     		if (!$globalIVAO && !$globalVATSIM && !$globalphpVMS) {
735 783
 			// Force update ModeS (this will put type_flight data
@@ -759,7 +807,9 @@  discard block
 block discarded – undo
759 807
 			} catch(PDOException $e) {
760 808
 				return "error (rename type to stats_type on stats*) : ".$e->getMessage()."\n";
761 809
 			}
762
-			if ($error != '') return $error;
810
+			if ($error != '') {
811
+				return $error;
812
+			}
763 813
 		}
764 814
 		$query = "UPDATE `config` SET `value` = '22' WHERE `name` = 'schema_version'";
765 815
         	try {
@@ -782,7 +832,9 @@  discard block
 block discarded – undo
782 832
 			} else {
783 833
 				$error .= create_db::import_file('../db/pgsql/stats_source.sql');
784 834
 			}
785
-			if ($error != '') return $error;
835
+			if ($error != '') {
836
+				return $error;
837
+			}
786 838
 		}
787 839
 		$query = "UPDATE config SET value = '23' WHERE name = 'schema_version'";
788 840
         	try {
@@ -804,12 +856,16 @@  discard block
 block discarded – undo
804 856
 		if ($globalDBdriver == 'mysql') {
805 857
 			if (!$Connection->tableExists('tle')) {
806 858
 				$error .= create_db::import_file('../db/tle.sql');
807
-				if ($error != '') return $error;
859
+				if ($error != '') {
860
+					return $error;
861
+				}
808 862
 			}
809 863
 		} else {
810 864
 			if (!$Connection->tableExists('tle')) {
811 865
 				$error .= create_db::import_file('../db/pgsql/tle.sql');
812
-				if ($error != '') return $error;
866
+				if ($error != '') {
867
+					return $error;
868
+				}
813 869
 			}
814 870
 			$query = "create index flightaware_id_idx ON spotter_archive USING btree(flightaware_id)";
815 871
 			try {
@@ -849,7 +905,9 @@  discard block
 block discarded – undo
849 905
 		} else {
850 906
 			$error .= create_db::import_file('../db/pgsql/airlines.sql');
851 907
 		}
852
-		if ($error != '') return 'Import airlines.sql : '.$error;
908
+		if ($error != '') {
909
+			return 'Import airlines.sql : '.$error;
910
+		}
853 911
 		if (!$Connection->checkColumnName('airlines','forsource')) {
854 912
 			// Add forsource to airlines
855 913
 			$query = "ALTER TABLE airlines ADD forsource VARCHAR(255) NULL DEFAULT NULL";
@@ -1332,20 +1390,28 @@  discard block
 block discarded – undo
1332 1390
 		}
1333 1391
 		if ($globalDBdriver == 'mysql') {
1334 1392
 			$error .= create_db::import_file('../db/airlines.sql');
1335
-			if ($error != '') return $error;
1393
+			if ($error != '') {
1394
+				return $error;
1395
+			}
1336 1396
 		} else {
1337 1397
 			$error .= create_db::import_file('../db/pgsql/airlines.sql');
1338
-			if ($error != '') return $error;
1398
+			if ($error != '') {
1399
+				return $error;
1400
+			}
1339 1401
 		}
1340 1402
 		if ((isset($globalVATSIM) && $globalVATSIM) || (isset($globalIVAO) && $globalIVAO)) {
1341 1403
 			include_once(dirname(__FILE__).'/class.update_db.php');
1342 1404
 			if (isset($globalVATSIM) && $globalVATSIM) {
1343 1405
 				$error .= update_db::update_vatsim();
1344
-				if ($error != '') return $error;
1406
+				if ($error != '') {
1407
+					return $error;
1408
+				}
1345 1409
 			}
1346 1410
 			if (isset($globalIVAO) && $globalIVAO && file_exists('tmp/ivae_feb2013.zip')) {
1347 1411
 				$error .= update_db::update_IVAO();
1348
-				if ($error != '') return $error;
1412
+				if ($error != '') {
1413
+					return $error;
1414
+				}
1349 1415
 			}
1350 1416
 		}
1351 1417
 
@@ -1608,41 +1674,65 @@  discard block
 block discarded – undo
1608 1674
 		if ($globalDBdriver == 'mysql') {
1609 1675
 			if (!$Connection->tableExists('tracker_output')) {
1610 1676
 				$error .= create_db::import_file('../db/tracker_output.sql');
1611
-				if ($error != '') return $error;
1677
+				if ($error != '') {
1678
+					return $error;
1679
+				}
1612 1680
 			}
1613 1681
 			if (!$Connection->tableExists('tracker_live')) {
1614 1682
 				$error .= create_db::import_file('../db/tracker_live.sql');
1615
-				if ($error != '') return $error;
1683
+				if ($error != '') {
1684
+					return $error;
1685
+				}
1616 1686
 			}
1617 1687
 			if (!$Connection->tableExists('marine_output')) {
1618 1688
 				$error .= create_db::import_file('../db/marine_output.sql');
1619
-				if ($error != '') return $error;
1689
+				if ($error != '') {
1690
+					return $error;
1691
+				}
1620 1692
 			}
1621 1693
 			if (!$Connection->tableExists('marine_live')) {
1622 1694
 				$error .= create_db::import_file('../db/marine_live.sql');
1623
-				if ($error != '') return $error;
1695
+				if ($error != '') {
1696
+					return $error;
1697
+				}
1624 1698
 			}
1625 1699
 			if (!$Connection->tableExists('marine_identity')) {
1626 1700
 				$error .= create_db::import_file('../db/marine_identity.sql');
1627
-				if ($error != '') return $error;
1701
+				if ($error != '') {
1702
+					return $error;
1703
+				}
1628 1704
 			}
1629 1705
 			if (!$Connection->tableExists('marine_mid')) {
1630 1706
 				$error .= create_db::import_file('../db/marine_mid.sql');
1631
-				if ($error != '') return $error;
1707
+				if ($error != '') {
1708
+					return $error;
1709
+				}
1632 1710
 			}
1633 1711
 		} else {
1634 1712
 			$error .= create_db::import_file('../db/pgsql/tracker_output.sql');
1635
-			if ($error != '') return $error;
1713
+			if ($error != '') {
1714
+				return $error;
1715
+			}
1636 1716
 			$error .= create_db::import_file('../db/pgsql/tracker_live.sql');
1637
-			if ($error != '') return $error;
1717
+			if ($error != '') {
1718
+				return $error;
1719
+			}
1638 1720
 			$error .= create_db::import_file('../db/pgsql/marine_output.sql');
1639
-			if ($error != '') return $error;
1721
+			if ($error != '') {
1722
+				return $error;
1723
+			}
1640 1724
 			$error .= create_db::import_file('../db/pgsql/marine_live.sql');
1641
-			if ($error != '') return $error;
1725
+			if ($error != '') {
1726
+				return $error;
1727
+			}
1642 1728
 			$error .= create_db::import_file('../db/pgsql/marine_identity.sql');
1643
-			if ($error != '') return $error;
1729
+			if ($error != '') {
1730
+				return $error;
1731
+			}
1644 1732
 			$error .= create_db::import_file('../db/pgsql/marine_mid.sql');
1645
-			if ($error != '') return $error;
1733
+			if ($error != '') {
1734
+				return $error;
1735
+			}
1646 1736
 		}
1647 1737
 		$query = "UPDATE config SET value = '37' WHERE name = 'schema_version'";
1648 1738
 		try {
@@ -1661,39 +1751,61 @@  discard block
 block discarded – undo
1661 1751
 		if ($globalDBdriver == 'mysql') {
1662 1752
 			if (!$Connection->tableExists('marine_image')) {
1663 1753
 				$error .= create_db::import_file('../db/marine_image.sql');
1664
-				if ($error != '') return $error;
1754
+				if ($error != '') {
1755
+					return $error;
1756
+				}
1665 1757
 			}
1666 1758
 			if (!$Connection->tableExists('marine_archive')) {
1667 1759
 				$error .= create_db::import_file('../db/marine_archive.sql');
1668
-				if ($error != '') return $error;
1760
+				if ($error != '') {
1761
+					return $error;
1762
+				}
1669 1763
 			}
1670 1764
 			if (!$Connection->tableExists('marine_archive_output')) {
1671 1765
 				$error .= create_db::import_file('../db/marine_archive_output.sql');
1672
-				if ($error != '') return $error;
1766
+				if ($error != '') {
1767
+					return $error;
1768
+				}
1673 1769
 			}
1674 1770
 			if (!$Connection->tableExists('tracker_archive')) {
1675 1771
 				$error .= create_db::import_file('../db/tracker_archive.sql');
1676
-				if ($error != '') return $error;
1772
+				if ($error != '') {
1773
+					return $error;
1774
+				}
1677 1775
 			}
1678 1776
 			if (!$Connection->tableExists('tracker_archive_output')) {
1679 1777
 				$error .= create_db::import_file('../db/tracker_archive_output.sql');
1680
-				if ($error != '') return $error;
1778
+				if ($error != '') {
1779
+					return $error;
1780
+				}
1681 1781
 			}
1682 1782
 			if (!$Connection->tableExists('marine_archive_output')) {
1683 1783
 				$error .= create_db::import_file('../db/tracker_archive_output.sql');
1684
-				if ($error != '') return $error;
1784
+				if ($error != '') {
1785
+					return $error;
1786
+				}
1685 1787
 			}
1686 1788
 		} else {
1687 1789
 			$error .= create_db::import_file('../db/pgsql/marine_image.sql');
1688
-			if ($error != '') return $error;
1790
+			if ($error != '') {
1791
+				return $error;
1792
+			}
1689 1793
 			$error .= create_db::import_file('../db/pgsql/marine_archive.sql');
1690
-			if ($error != '') return $error;
1794
+			if ($error != '') {
1795
+				return $error;
1796
+			}
1691 1797
 			$error .= create_db::import_file('../db/pgsql/marine_archive_output.sql');
1692
-			if ($error != '') return $error;
1798
+			if ($error != '') {
1799
+				return $error;
1800
+			}
1693 1801
 			$error .= create_db::import_file('../db/pgsql/tracker_archive.sql');
1694
-			if ($error != '') return $error;
1802
+			if ($error != '') {
1803
+				return $error;
1804
+			}
1695 1805
 			$error .= create_db::import_file('../db/pgsql/tracker_archive_output.sql');
1696
-			if ($error != '') return $error;
1806
+			if ($error != '') {
1807
+				return $error;
1808
+			}
1697 1809
 		}
1698 1810
 		if ($globalDBdriver == 'mysql') {
1699 1811
 			$query = "SELECT ENGINE FROM information_schema.TABLES where TABLE_SCHEMA = '".$globalDBname."' AND TABLE_NAME = 'spotter_archive'";
@@ -2064,7 +2176,9 @@  discard block
 block discarded – undo
2064 2176
 		if ($globalDBdriver == 'mysql') {
2065 2177
 			if (!$Connection->tableExists('tracker_archive_output')) {
2066 2178
 				$error .= create_db::import_file('../db/tracker_archive_output.sql');
2067
-				if ($error != '') return $error;
2179
+				if ($error != '') {
2180
+					return $error;
2181
+				}
2068 2182
 			}
2069 2183
 			$query = "ALTER TABLE tracker_live MODIFY COLUMN altitude float DEFAULT NULL;ALTER TABLE tracker_output MODIFY COLUMN last_altitude float DEFAULT NULL;ALTER TABLE tracker_output MODIFY COLUMN altitude float DEFAULT NULL;ALTER TABLE tracker_archive MODIFY COLUMN altitude float DEFAULT NULL;ALTER TABLE tracker_archive_output MODIFY COLUMN last_altitude float DEFAULT NULL;ALTER TABLE tracker_output MODIFY COLUMN altitude float DEFAULT NULL;";
2070 2184
 		} else {
@@ -2092,14 +2206,22 @@  discard block
 block discarded – undo
2092 2206
 		$error = '';
2093 2207
 		if ($globalDBdriver == 'mysql') {
2094 2208
 			$error .= create_db::import_file('../db/airport.sql');
2095
-			if ($error != '') return $error;
2209
+			if ($error != '') {
2210
+				return $error;
2211
+			}
2096 2212
 			$error .= create_db::import_file('../db/airlines.sql');
2097
-			if ($error != '') return $error;
2213
+			if ($error != '') {
2214
+				return $error;
2215
+			}
2098 2216
 		} else {
2099 2217
 			$error .= create_db::import_file('../db/pgsql/airport.sql');
2100
-			if ($error != '') return $error;
2218
+			if ($error != '') {
2219
+				return $error;
2220
+			}
2101 2221
 			$error .= create_db::import_file('../db/pgsql/airlines.sql');
2102
-			if ($error != '') return $error;
2222
+			if ($error != '') {
2223
+				return $error;
2224
+			}
2103 2225
 		}
2104 2226
 		if ((isset($globalVATSIM) && $globalVATSIM) && (isset($globalIVAO) && $globalIVAO)) {
2105 2227
 			if (file_exists('tmp/ivae_feb2013.zip')) {
@@ -2116,7 +2238,9 @@  discard block
 block discarded – undo
2116 2238
 				$error .= update_db::update_vatsim();
2117 2239
 			}
2118 2240
 		}
2119
-		if ($error != '') return $error;
2241
+		if ($error != '') {
2242
+			return $error;
2243
+		}
2120 2244
 		$query = "UPDATE config SET value = '45' WHERE name = 'schema_version'";
2121 2245
 		try {
2122 2246
 			$sth = $Connection->db->prepare($query);
@@ -2134,10 +2258,14 @@  discard block
 block discarded – undo
2134 2258
 		if (!$Connection->tableExists('satellite')) {
2135 2259
 			if ($globalDBdriver == 'mysql') {
2136 2260
 				$error .= create_db::import_file('../db/satellite.sql');
2137
-				if ($error != '') return $error;
2261
+				if ($error != '') {
2262
+					return $error;
2263
+				}
2138 2264
 			} else {
2139 2265
 				$error .= create_db::import_file('../db/pgsql/satellite.sql');
2140
-				if ($error != '') return $error;
2266
+				if ($error != '') {
2267
+					return $error;
2268
+				}
2141 2269
 			}
2142 2270
 		}
2143 2271
 		$query = "UPDATE config SET value = '46' WHERE name = 'schema_version'";
@@ -2159,8 +2287,11 @@  discard block
 block discarded – undo
2159 2287
     	    if ($Connection->tableExists('aircraft')) {
2160 2288
     		if (!$Connection->tableExists('config')) {
2161 2289
     		    $version = '1';
2162
-    		    if ($update) return self::update_from_1();
2163
-    		    else return $version;
2290
+    		    if ($update) {
2291
+    		    	return self::update_from_1();
2292
+    		    } else {
2293
+    		    	return $version;
2294
+    		    }
2164 2295
 		} else {
2165 2296
     		    $Connection = new Connection();
2166 2297
 		    $query = "SELECT value FROM config WHERE name = 'schema_version' LIMIT 1";
@@ -2174,188 +2305,327 @@  discard block
 block discarded – undo
2174 2305
     		    if ($update) {
2175 2306
     			if ($result['value'] == '2') {
2176 2307
     			    $error = self::update_from_2();
2177
-    			    if ($error != '') return $error;
2178
-    			    else return self::check_version(true);
2308
+    			    if ($error != '') {
2309
+    			    	return $error;
2310
+    			    } else {
2311
+    			    	return self::check_version(true);
2312
+    			    }
2179 2313
     			} elseif ($result['value'] == '3') {
2180 2314
     			    $error = self::update_from_3();
2181
-    			    if ($error != '') return $error;
2182
-    			    else return self::check_version(true);
2315
+    			    if ($error != '') {
2316
+    			    	return $error;
2317
+    			    } else {
2318
+    			    	return self::check_version(true);
2319
+    			    }
2183 2320
     			} elseif ($result['value'] == '4') {
2184 2321
     			    $error = self::update_from_4();
2185
-    			    if ($error != '') return $error;
2186
-    			    else return self::check_version(true);
2322
+    			    if ($error != '') {
2323
+    			    	return $error;
2324
+    			    } else {
2325
+    			    	return self::check_version(true);
2326
+    			    }
2187 2327
     			} elseif ($result['value'] == '5') {
2188 2328
     			    $error = self::update_from_5();
2189
-    			    if ($error != '') return $error;
2190
-    			    else return self::check_version(true);
2329
+    			    if ($error != '') {
2330
+    			    	return $error;
2331
+    			    } else {
2332
+    			    	return self::check_version(true);
2333
+    			    }
2191 2334
     			} elseif ($result['value'] == '6') {
2192 2335
     			    $error = self::update_from_6();
2193
-    			    if ($error != '') return $error;
2194
-    			    else return self::check_version(true);
2336
+    			    if ($error != '') {
2337
+    			    	return $error;
2338
+    			    } else {
2339
+    			    	return self::check_version(true);
2340
+    			    }
2195 2341
     			} elseif ($result['value'] == '7') {
2196 2342
     			    $error = self::update_from_7();
2197
-    			    if ($error != '') return $error;
2198
-    			    else return self::check_version(true);
2343
+    			    if ($error != '') {
2344
+    			    	return $error;
2345
+    			    } else {
2346
+    			    	return self::check_version(true);
2347
+    			    }
2199 2348
     			} elseif ($result['value'] == '8') {
2200 2349
     			    $error = self::update_from_8();
2201
-    			    if ($error != '') return $error;
2202
-    			    else return self::check_version(true);
2350
+    			    if ($error != '') {
2351
+    			    	return $error;
2352
+    			    } else {
2353
+    			    	return self::check_version(true);
2354
+    			    }
2203 2355
     			} elseif ($result['value'] == '9') {
2204 2356
     			    $error = self::update_from_9();
2205
-    			    if ($error != '') return $error;
2206
-    			    else return self::check_version(true);
2357
+    			    if ($error != '') {
2358
+    			    	return $error;
2359
+    			    } else {
2360
+    			    	return self::check_version(true);
2361
+    			    }
2207 2362
     			} elseif ($result['value'] == '10') {
2208 2363
     			    $error = self::update_from_10();
2209
-    			    if ($error != '') return $error;
2210
-    			    else return self::check_version(true);
2364
+    			    if ($error != '') {
2365
+    			    	return $error;
2366
+    			    } else {
2367
+    			    	return self::check_version(true);
2368
+    			    }
2211 2369
     			} elseif ($result['value'] == '11') {
2212 2370
     			    $error = self::update_from_11();
2213
-    			    if ($error != '') return $error;
2214
-    			    else return self::check_version(true);
2371
+    			    if ($error != '') {
2372
+    			    	return $error;
2373
+    			    } else {
2374
+    			    	return self::check_version(true);
2375
+    			    }
2215 2376
     			} elseif ($result['value'] == '12') {
2216 2377
     			    $error = self::update_from_12();
2217
-    			    if ($error != '') return $error;
2218
-    			    else return self::check_version(true);
2378
+    			    if ($error != '') {
2379
+    			    	return $error;
2380
+    			    } else {
2381
+    			    	return self::check_version(true);
2382
+    			    }
2219 2383
     			} elseif ($result['value'] == '13') {
2220 2384
     			    $error = self::update_from_13();
2221
-    			    if ($error != '') return $error;
2222
-    			    else return self::check_version(true);
2385
+    			    if ($error != '') {
2386
+    			    	return $error;
2387
+    			    } else {
2388
+    			    	return self::check_version(true);
2389
+    			    }
2223 2390
     			} elseif ($result['value'] == '14') {
2224 2391
     			    $error = self::update_from_14();
2225
-    			    if ($error != '') return $error;
2226
-    			    else return self::check_version(true);
2392
+    			    if ($error != '') {
2393
+    			    	return $error;
2394
+    			    } else {
2395
+    			    	return self::check_version(true);
2396
+    			    }
2227 2397
     			} elseif ($result['value'] == '15') {
2228 2398
     			    $error = self::update_from_15();
2229
-    			    if ($error != '') return $error;
2230
-    			    else return self::check_version(true);
2399
+    			    if ($error != '') {
2400
+    			    	return $error;
2401
+    			    } else {
2402
+    			    	return self::check_version(true);
2403
+    			    }
2231 2404
     			} elseif ($result['value'] == '16') {
2232 2405
     			    $error = self::update_from_16();
2233
-    			    if ($error != '') return $error;
2234
-    			    else return self::check_version(true);
2406
+    			    if ($error != '') {
2407
+    			    	return $error;
2408
+    			    } else {
2409
+    			    	return self::check_version(true);
2410
+    			    }
2235 2411
     			} elseif ($result['value'] == '17') {
2236 2412
     			    $error = self::update_from_17();
2237
-    			    if ($error != '') return $error;
2238
-    			    else return self::check_version(true);
2413
+    			    if ($error != '') {
2414
+    			    	return $error;
2415
+    			    } else {
2416
+    			    	return self::check_version(true);
2417
+    			    }
2239 2418
     			} elseif ($result['value'] == '18') {
2240 2419
     			    $error = self::update_from_18();
2241
-    			    if ($error != '') return $error;
2242
-    			    else return self::check_version(true);
2420
+    			    if ($error != '') {
2421
+    			    	return $error;
2422
+    			    } else {
2423
+    			    	return self::check_version(true);
2424
+    			    }
2243 2425
     			} elseif ($result['value'] == '19') {
2244 2426
     			    $error = self::update_from_19();
2245
-    			    if ($error != '') return $error;
2246
-    			    else return self::check_version(true);
2427
+    			    if ($error != '') {
2428
+    			    	return $error;
2429
+    			    } else {
2430
+    			    	return self::check_version(true);
2431
+    			    }
2247 2432
     			} elseif ($result['value'] == '20') {
2248 2433
     			    $error = self::update_from_20();
2249
-    			    if ($error != '') return $error;
2250
-    			    else return self::check_version(true);
2434
+    			    if ($error != '') {
2435
+    			    	return $error;
2436
+    			    } else {
2437
+    			    	return self::check_version(true);
2438
+    			    }
2251 2439
     			} elseif ($result['value'] == '21') {
2252 2440
     			    $error = self::update_from_21();
2253
-    			    if ($error != '') return $error;
2254
-    			    else return self::check_version(true);
2441
+    			    if ($error != '') {
2442
+    			    	return $error;
2443
+    			    } else {
2444
+    			    	return self::check_version(true);
2445
+    			    }
2255 2446
     			} elseif ($result['value'] == '22') {
2256 2447
     			    $error = self::update_from_22();
2257
-    			    if ($error != '') return $error;
2258
-    			    else return self::check_version(true);
2448
+    			    if ($error != '') {
2449
+    			    	return $error;
2450
+    			    } else {
2451
+    			    	return self::check_version(true);
2452
+    			    }
2259 2453
     			} elseif ($result['value'] == '23') {
2260 2454
     			    $error = self::update_from_23();
2261
-    			    if ($error != '') return $error;
2262
-    			    else return self::check_version(true);
2455
+    			    if ($error != '') {
2456
+    			    	return $error;
2457
+    			    } else {
2458
+    			    	return self::check_version(true);
2459
+    			    }
2263 2460
     			} elseif ($result['value'] == '24') {
2264 2461
     			    $error = self::update_from_24();
2265
-    			    if ($error != '') return $error;
2266
-    			    else return self::check_version(true);
2462
+    			    if ($error != '') {
2463
+    			    	return $error;
2464
+    			    } else {
2465
+    			    	return self::check_version(true);
2466
+    			    }
2267 2467
     			} elseif ($result['value'] == '25') {
2268 2468
     			    $error = self::update_from_25();
2269
-    			    if ($error != '') return $error;
2270
-    			    else return self::check_version(true);
2469
+    			    if ($error != '') {
2470
+    			    	return $error;
2471
+    			    } else {
2472
+    			    	return self::check_version(true);
2473
+    			    }
2271 2474
     			} elseif ($result['value'] == '26') {
2272 2475
     			    $error = self::update_from_26();
2273
-    			    if ($error != '') return $error;
2274
-    			    else return self::check_version(true);
2476
+    			    if ($error != '') {
2477
+    			    	return $error;
2478
+    			    } else {
2479
+    			    	return self::check_version(true);
2480
+    			    }
2275 2481
     			} elseif ($result['value'] == '27') {
2276 2482
     			    $error = self::update_from_27();
2277
-    			    if ($error != '') return $error;
2278
-    			    else return self::check_version(true);
2483
+    			    if ($error != '') {
2484
+    			    	return $error;
2485
+    			    } else {
2486
+    			    	return self::check_version(true);
2487
+    			    }
2279 2488
     			} elseif ($result['value'] == '28') {
2280 2489
     			    $error = self::update_from_28();
2281
-    			    if ($error != '') return $error;
2282
-    			    else return self::check_version(true);
2490
+    			    if ($error != '') {
2491
+    			    	return $error;
2492
+    			    } else {
2493
+    			    	return self::check_version(true);
2494
+    			    }
2283 2495
     			} elseif ($result['value'] == '29') {
2284 2496
     			    $error = self::update_from_29();
2285
-    			    if ($error != '') return $error;
2286
-    			    else return self::check_version(true);
2497
+    			    if ($error != '') {
2498
+    			    	return $error;
2499
+    			    } else {
2500
+    			    	return self::check_version(true);
2501
+    			    }
2287 2502
     			} elseif ($result['value'] == '30') {
2288 2503
     			    $error = self::update_from_30();
2289
-    			    if ($error != '') return $error;
2290
-    			    else return self::check_version(true);
2504
+    			    if ($error != '') {
2505
+    			    	return $error;
2506
+    			    } else {
2507
+    			    	return self::check_version(true);
2508
+    			    }
2291 2509
     			} elseif ($result['value'] == '31') {
2292 2510
     			    $error = self::update_from_31();
2293
-    			    if ($error != '') return $error;
2294
-    			    else return self::check_version(true);
2511
+    			    if ($error != '') {
2512
+    			    	return $error;
2513
+    			    } else {
2514
+    			    	return self::check_version(true);
2515
+    			    }
2295 2516
     			} elseif ($result['value'] == '32') {
2296 2517
     			    $error = self::update_from_32();
2297
-    			    if ($error != '') return $error;
2298
-    			    else return self::check_version(true);
2518
+    			    if ($error != '') {
2519
+    			    	return $error;
2520
+    			    } else {
2521
+    			    	return self::check_version(true);
2522
+    			    }
2299 2523
     			} elseif ($result['value'] == '33') {
2300 2524
     			    $error = self::update_from_33();
2301
-    			    if ($error != '') return $error;
2302
-    			    else return self::check_version(true);
2525
+    			    if ($error != '') {
2526
+    			    	return $error;
2527
+    			    } else {
2528
+    			    	return self::check_version(true);
2529
+    			    }
2303 2530
     			} elseif ($result['value'] == '34') {
2304 2531
     			    $error = self::update_from_34();
2305
-    			    if ($error != '') return $error;
2306
-    			    else return self::check_version(true);
2532
+    			    if ($error != '') {
2533
+    			    	return $error;
2534
+    			    } else {
2535
+    			    	return self::check_version(true);
2536
+    			    }
2307 2537
     			} elseif ($result['value'] == '35') {
2308 2538
     			    $error = self::update_from_35();
2309
-    			    if ($error != '') return $error;
2310
-    			    else return self::check_version(true);
2539
+    			    if ($error != '') {
2540
+    			    	return $error;
2541
+    			    } else {
2542
+    			    	return self::check_version(true);
2543
+    			    }
2311 2544
     			} elseif ($result['value'] == '36') {
2312 2545
     			    $error = self::update_from_36();
2313
-    			    if ($error != '') return $error;
2314
-    			    else return self::check_version(true);
2546
+    			    if ($error != '') {
2547
+    			    	return $error;
2548
+    			    } else {
2549
+    			    	return self::check_version(true);
2550
+    			    }
2315 2551
     			} elseif ($result['value'] == '37') {
2316 2552
     			    $error = self::update_from_37();
2317
-    			    if ($error != '') return $error;
2318
-    			    else return self::check_version(true);
2553
+    			    if ($error != '') {
2554
+    			    	return $error;
2555
+    			    } else {
2556
+    			    	return self::check_version(true);
2557
+    			    }
2319 2558
     			} elseif ($result['value'] == '38') {
2320 2559
     			    $error = self::update_from_38();
2321
-    			    if ($error != '') return $error;
2322
-    			    else return self::check_version(true);
2560
+    			    if ($error != '') {
2561
+    			    	return $error;
2562
+    			    } else {
2563
+    			    	return self::check_version(true);
2564
+    			    }
2323 2565
     			} elseif ($result['value'] == '39') {
2324 2566
     			    $error = self::update_from_39();
2325
-    			    if ($error != '') return $error;
2326
-    			    else return self::check_version(true);
2567
+    			    if ($error != '') {
2568
+    			    	return $error;
2569
+    			    } else {
2570
+    			    	return self::check_version(true);
2571
+    			    }
2327 2572
     			} elseif ($result['value'] == '40') {
2328 2573
     			    $error = self::update_from_40();
2329
-    			    if ($error != '') return $error;
2330
-    			    else return self::check_version(true);
2574
+    			    if ($error != '') {
2575
+    			    	return $error;
2576
+    			    } else {
2577
+    			    	return self::check_version(true);
2578
+    			    }
2331 2579
     			} elseif ($result['value'] == '41') {
2332 2580
     			    $error = self::update_from_41();
2333
-    			    if ($error != '') return $error;
2334
-    			    else return self::check_version(true);
2581
+    			    if ($error != '') {
2582
+    			    	return $error;
2583
+    			    } else {
2584
+    			    	return self::check_version(true);
2585
+    			    }
2335 2586
     			} elseif ($result['value'] == '42') {
2336 2587
     			    $error = self::update_from_42();
2337
-    			    if ($error != '') return $error;
2338
-    			    else return self::check_version(true);
2588
+    			    if ($error != '') {
2589
+    			    	return $error;
2590
+    			    } else {
2591
+    			    	return self::check_version(true);
2592
+    			    }
2339 2593
     			} elseif ($result['value'] == '43') {
2340 2594
     			    $error = self::update_from_43();
2341
-    			    if ($error != '') return $error;
2342
-    			    else return self::check_version(true);
2595
+    			    if ($error != '') {
2596
+    			    	return $error;
2597
+    			    } else {
2598
+    			    	return self::check_version(true);
2599
+    			    }
2343 2600
     			} elseif ($result['value'] == '44') {
2344 2601
     			    $error = self::update_from_44();
2345
-    			    if ($error != '') return $error;
2346
-    			    else return self::check_version(true);
2602
+    			    if ($error != '') {
2603
+    			    	return $error;
2604
+    			    } else {
2605
+    			    	return self::check_version(true);
2606
+    			    }
2347 2607
     			} elseif ($result['value'] == '45') {
2348 2608
     			    $error = self::update_from_45();
2349
-    			    if ($error != '') return $error;
2350
-    			    else return self::check_version(true);
2351
-    			} else return '';
2609
+    			    if ($error != '') {
2610
+    			    	return $error;
2611
+    			    } else {
2612
+    			    	return self::check_version(true);
2613
+    			    }
2614
+    			} else {
2615
+    				return '';
2616
+    			}
2352 2617
     		    } else {
2353
-    			if (isset($result['value']) && $result['value'] != '') return $result['value'];
2354
-    			else return 0;
2618
+    			if (isset($result['value']) && $result['value'] != '') {
2619
+    				return $result['value'];
2620
+    			} else {
2621
+    				return 0;
2622
+    			}
2355 2623
     		    }
2356 2624
 		}
2357 2625
 		
2358
-	    } else return $version;
2626
+	    } else {
2627
+	    	return $version;
2628
+	    }
2359 2629
     	}
2360 2630
     	
2361 2631
 }
Please login to merge, or discard this patch.
require/class.SpotterImport.php 1 patch
Braces   +401 added lines, -143 removed lines patch added patch discarded remove patch
@@ -52,7 +52,9 @@  discard block
 block discarded – undo
52 52
 		try {
53 53
 			$GeoidClass = new GeoidHeight();
54 54
 		} catch(Exception $e) {
55
-			if ($globalDebug) echo "Can't calculate geoid, check that you downloaded it via update_db.php \n";
55
+			if ($globalDebug) {
56
+				echo "Can't calculate geoid, check that you downloaded it via update_db.php \n";
57
+			}
56 58
 			$GeoidClass = FALSE;
57 59
 		}
58 60
 	}
@@ -71,7 +73,9 @@  discard block
 block discarded – undo
71 73
 	$dbc = $this->db;
72 74
 	$this->all_flights[$id]['schedule_check'] = true;
73 75
 	if ($globalSchedulesFetch) {
74
-	if ($globalDebug) echo 'Getting schedule info...'."\n";
76
+	if ($globalDebug) {
77
+		echo 'Getting schedule info...'."\n";
78
+	}
75 79
 	$Spotter = new Spotter($dbc);
76 80
 	$Schedule = new Schedule($dbc);
77 81
 	$Translation = new Translation($dbc);
@@ -82,7 +86,9 @@  discard block
 block discarded – undo
82 86
 	    if ($Schedule->checkSchedule($operator) == 0) {
83 87
 		$schedule = $Schedule->fetchSchedule($operator);
84 88
 		if (count($schedule) > 0 && isset($schedule['DepartureTime']) && isset($schedule['ArrivalTime'])) {
85
-		    if ($globalDebug) echo "-> Schedule info for ".$operator." (".$ident.")\n";
89
+		    if ($globalDebug) {
90
+		    	echo "-> Schedule info for ".$operator." (".$ident.")\n";
91
+		    }
86 92
 		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport_time' => $schedule['DepartureTime']));
87 93
 		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('arrival_airport_time' => $schedule['ArrivalTime']));
88 94
 		    // Should also check if route schedule = route from DB
@@ -91,7 +97,9 @@  discard block
 block discarded – undo
91 97
 			    $airport_icao = $Spotter->getAirportIcao($schedule['DepartureAirportIATA']);
92 98
 			    if (trim($airport_icao) != '') {
93 99
 				$this->all_flights[$id]['departure_airport'] = $airport_icao;
94
-				if ($globalDebug) echo "-> Change departure airport to ".$airport_icao." for ".$ident."\n";
100
+				if ($globalDebug) {
101
+					echo "-> Change departure airport to ".$airport_icao." for ".$ident."\n";
102
+				}
95 103
 			    }
96 104
 			}
97 105
 		    }
@@ -100,17 +108,25 @@  discard block
 block discarded – undo
100 108
 			    $airport_icao = $Spotter->getAirportIcao($schedule['ArrivalAirportIATA']);
101 109
 			    if (trim($airport_icao) != '') {
102 110
 				$this->all_flights[$id]['arrival_airport'] = $airport_icao;
103
-				if ($globalDebug) echo "-> Change arrival airport to ".$airport_icao." for ".$ident."\n";
111
+				if ($globalDebug) {
112
+					echo "-> Change arrival airport to ".$airport_icao." for ".$ident."\n";
113
+				}
104 114
 			    }
105 115
 			}
106 116
 		    }
107 117
 		    $Schedule->addSchedule($operator,$this->all_flights[$id]['departure_airport'],$this->all_flights[$id]['departure_airport_time'],$this->all_flights[$id]['arrival_airport'],$this->all_flights[$id]['arrival_airport_time'],$schedule['Source']);
108 118
 		}
109
-	    } else $scheduleexist = true;
110
-	} else $scheduleexist = true;
119
+	    } else {
120
+	    	$scheduleexist = true;
121
+	    }
122
+	} else {
123
+		$scheduleexist = true;
124
+	}
111 125
 	// close connection, at least one way will work ?
112 126
        if ($scheduleexist) {
113
-		if ($globalDebug) echo "-> get arrival/departure airport info for ".$ident."\n";
127
+		if ($globalDebug) {
128
+			echo "-> get arrival/departure airport info for ".$ident."\n";
129
+		}
114 130
     		$sch = $Schedule->getSchedule($operator);
115 131
 		$this->all_flights[$id] = array_merge($this->all_flights[$id],array('arrival_airport' => $sch['arrival_airport_icao'],'departure_airport' => $sch['departure_airport_icao'],'departure_airport_time' => $sch['departure_airport_time'],'arrival_airport_time' => $sch['arrival_airport_time']));
116 132
        }
@@ -132,14 +148,18 @@  discard block
 block discarded – undo
132 148
 
133 149
     public function checkAll() {
134 150
 	global $globalDebug, $globalNoImport;
135
-	if ($globalDebug) echo "Update last seen flights data...\n";
151
+	if ($globalDebug) {
152
+		echo "Update last seen flights data...\n";
153
+	}
136 154
 	if (!isset($globalNoImport) || $globalNoImport === FALSE) {
137 155
 	    foreach ($this->all_flights as $key => $flight) {
138 156
 		if (isset($this->all_flights[$key]['id'])) {
139 157
 		    //echo $this->all_flights[$key]['id'].' - '.$this->all_flights[$key]['latitude'].'  '.$this->all_flights[$key]['longitude']."\n";
140 158
     		    $Spotter = new Spotter($this->db);
141 159
         	    $real_arrival = $this->arrival($key);
142
-        	    if (isset($this->all_flights[$key]['altitude']) && isset($this->all_flights[$key]['datetime'])) $Spotter->updateLatestSpotterData($this->all_flights[$key]['id'],$this->all_flights[$key]['ident'],$this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$this->all_flights[$key]['altitude'],$this->all_flights[$key]['ground'],$this->all_flights[$key]['speed'],$this->all_flights[$key]['datetime'],$real_arrival['airport_icao'],$real_arrival['airport_time']);
160
+        	    if (isset($this->all_flights[$key]['altitude']) && isset($this->all_flights[$key]['datetime'])) {
161
+        	    	$Spotter->updateLatestSpotterData($this->all_flights[$key]['id'],$this->all_flights[$key]['ident'],$this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$this->all_flights[$key]['altitude'],$this->all_flights[$key]['ground'],$this->all_flights[$key]['speed'],$this->all_flights[$key]['datetime'],$real_arrival['airport_icao'],$real_arrival['airport_time']);
162
+        	    }
143 163
         	}
144 164
 	    }
145 165
 	}
@@ -147,24 +167,32 @@  discard block
 block discarded – undo
147 167
 
148 168
     public function arrival($key) {
149 169
 	global $globalClosestMinDist, $globalDebug;
150
-	if ($globalDebug) echo 'Update arrival...'."\n";
170
+	if ($globalDebug) {
171
+		echo 'Update arrival...'."\n";
172
+	}
151 173
 	$Spotter = new Spotter($this->db);
152 174
         $airport_icao = '';
153 175
         $airport_time = '';
154
-        if (!isset($globalClosestMinDist) || $globalClosestMinDist == '') $globalClosestMinDist = 50;
176
+        if (!isset($globalClosestMinDist) || $globalClosestMinDist == '') {
177
+        	$globalClosestMinDist = 50;
178
+        }
155 179
 	if ($this->all_flights[$key]['latitude'] != '' && $this->all_flights[$key]['longitude'] != '') {
156 180
 	    $closestAirports = $Spotter->closestAirports($this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$globalClosestMinDist);
157 181
     	    if (isset($closestAirports[0])) {
158 182
         	if (isset($this->all_flights[$key]['arrival_airport']) && $this->all_flights[$key]['arrival_airport'] == $closestAirports[0]['icao']) {
159 183
         	    $airport_icao = $closestAirports[0]['icao'];
160 184
         	    $airport_time = $this->all_flights[$key]['datetime'];
161
-        	    if ($globalDebug) echo "---++ Find arrival airport. airport_icao : ".$airport_icao."\n";
185
+        	    if ($globalDebug) {
186
+        	    	echo "---++ Find arrival airport. airport_icao : ".$airport_icao."\n";
187
+        	    }
162 188
         	} elseif (count($closestAirports > 1) && isset($this->all_flights[$key]['arrival_airport']) && $this->all_flights[$key]['arrival_airport'] != '') {
163 189
         	    foreach ($closestAirports as $airport) {
164 190
         		if ($this->all_flights[$key]['arrival_airport'] == $airport['icao']) {
165 191
         		    $airport_icao = $airport['icao'];
166 192
         		    $airport_time = $this->all_flights[$key]['datetime'];
167
-        		    if ($globalDebug) echo "---++ Find arrival airport. airport_icao : ".$airport_icao."\n";
193
+        		    if ($globalDebug) {
194
+        		    	echo "---++ Find arrival airport. airport_icao : ".$airport_icao."\n";
195
+        		    }
168 196
         		    break;
169 197
         		}
170 198
         	    }
@@ -172,14 +200,20 @@  discard block
 block discarded – undo
172 200
         		$airport_icao = $closestAirports[0]['icao'];
173 201
         		$airport_time = $this->all_flights[$key]['datetime'];
174 202
         	} else {
175
-        		if ($globalDebug) echo "----- Can't find arrival airport. Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.$this->all_flights[$key]['altitude_real']."\n";
203
+        		if ($globalDebug) {
204
+        			echo "----- Can't find arrival airport. Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.$this->all_flights[$key]['altitude_real']."\n";
205
+        		}
176 206
         	}
177 207
     	    } else {
178
-    		    if ($globalDebug) echo "----- No Airport near last coord. Latitude : ".$this->all_flights[$key]['latitude'].' - Longitude : '.$this->all_flights[$key]['longitude'].' - MinDist : '.$globalClosestMinDist."\n";
208
+    		    if ($globalDebug) {
209
+    		    	echo "----- No Airport near last coord. Latitude : ".$this->all_flights[$key]['latitude'].' - Longitude : '.$this->all_flights[$key]['longitude'].' - MinDist : '.$globalClosestMinDist."\n";
210
+    		    }
179 211
     	    }
180 212
 
181 213
         } else {
182
-        	if ($globalDebug) echo "---- No latitude or longitude. Ident : ".$this->all_flights[$key]['ident']."\n";
214
+        	if ($globalDebug) {
215
+        		echo "---- No latitude or longitude. Ident : ".$this->all_flights[$key]['ident']."\n";
216
+        	}
183 217
         }
184 218
         return array('airport_icao' => $airport_icao,'airport_time' => $airport_time);
185 219
     }
@@ -189,7 +223,9 @@  discard block
 block discarded – undo
189 223
     public function del() {
190 224
 	global $globalDebug, $globalNoImport, $globalNoDB;
191 225
 	// Delete old infos
192
-	if ($globalDebug) echo 'Delete old values and update latest data...'."\n";
226
+	if ($globalDebug) {
227
+		echo 'Delete old values and update latest data...'."\n";
228
+	}
193 229
 	foreach ($this->all_flights as $key => $flight) {
194 230
 	    if (isset($flight['lastupdate'])) {
195 231
 		if ($flight['lastupdate'] < (time()-5900)) {
@@ -203,13 +239,17 @@  discard block
 block discarded – undo
203 239
 	global $globalDebug, $globalNoImport, $globalNoDB;
204 240
 	// Delete old infos
205 241
 	if (isset($this->all_flights[$key]['id'])) {
206
-		if ($globalDebug) echo "--- Delete old values with id ".$this->all_flights[$key]['id']."\n";
242
+		if ($globalDebug) {
243
+			echo "--- Delete old values with id ".$this->all_flights[$key]['id']."\n";
244
+		}
207 245
 		if ((!isset($globalNoImport) || $globalNoImport === FALSE) && (!isset($globalNoDB) || $globalNoDB !== TRUE)) {
208 246
 			$real_arrival = $this->arrival($key);
209 247
 			$Spotter = new Spotter($this->db);
210 248
 			if ($this->all_flights[$key]['latitude'] != '' && $this->all_flights[$key]['longitude'] != '') {
211 249
 				$result = $Spotter->updateLatestSpotterData($this->all_flights[$key]['id'],$this->all_flights[$key]['ident'],$this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$this->all_flights[$key]['altitude'],$this->all_flights[$key]['ground'],$this->all_flights[$key]['speed'],$this->all_flights[$key]['datetime'],$real_arrival['airport_icao'],$real_arrival['airport_time']);
212
-				if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n";
250
+				if ($globalDebug && $result != 'success') {
251
+					echo '!!! ERROR : '.$result."\n";
252
+				}
213 253
 			}
214 254
 		}
215 255
 	}
@@ -219,9 +259,13 @@  discard block
 block discarded – undo
219 259
     public function add($line) {
220 260
 	global $globalPilotIdAccept, $globalAirportAccept, $globalAirlineAccept, $globalAirlineIgnore, $globalAirportIgnore, $globalFork, $globalDistanceIgnore, $globalDaemon, $globalSBS1update, $globalDebug, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalCoordMinChange, $globalDebugTimeElapsed, $globalCenterLatitude, $globalCenterLongitude, $globalBeta, $globalSourcesupdate, $globalAirlinesSource, $globalVAM, $globalAllFlights, $globalServerAPRS, $APRSSpotter, $globalNoImport, $globalNoDB, $globalVA, $globalAircraftMaxUpdate, $globalAircraftMinUpdate, $globalLiveInterval, $GeoidClass;
221 261
 	//if (!isset($globalDebugTimeElapsed) || $globalDebugTimeElapsed == '') $globalDebugTimeElapsed = FALSE;
222
-	if (!isset($globalCoordMinChange) || $globalCoordMinChange == '') $globalCoordMinChange = '0.02';
223
-	if (!isset($globalAircraftMaxUpdate) || $globalAircraftMaxUpdate == '') $globalAircraftMaxUpdate = 3000;
224
-/*
262
+	if (!isset($globalCoordMinChange) || $globalCoordMinChange == '') {
263
+		$globalCoordMinChange = '0.02';
264
+	}
265
+	if (!isset($globalAircraftMaxUpdate) || $globalAircraftMaxUpdate == '') {
266
+		$globalAircraftMaxUpdate = 3000;
267
+	}
268
+	/*
225 269
 	$Spotter = new Spotter();
226 270
 	$dbc = $Spotter->db;
227 271
 	$SpotterLive = new SpotterLive($dbc);
@@ -243,19 +287,28 @@  discard block
 block discarded – undo
243 287
 	// SBS format is CSV format
244 288
 	if(is_array($line) && (isset($line['hex']) || isset($line['id']))) {
245 289
 	    //print_r($line);
246
-	    if (isset($line['hex'])) $line['hex'] = strtoupper($line['hex']);
290
+	    if (isset($line['hex'])) {
291
+	    	$line['hex'] = strtoupper($line['hex']);
292
+	    }
247 293
   	    if (isset($line['id']) || (isset($line['hex']) && $line['hex'] != '' && $line['hex'] != '00000' && $line['hex'] != '000000' && $line['hex'] != '111111' && ctype_xdigit($line['hex']) && strlen($line['hex']) === 6)) {
248 294
 
249 295
 		// Increment message number
250 296
 		if (isset($line['sourcestats']) && $line['sourcestats'] === TRUE) {
251 297
 		    $current_date = date('Y-m-d');
252
-		    if (isset($line['source_name'])) $source = $line['source_name'];
253
-		    else $source = '';
254
-		    if ($source == '' || $line['format_source'] == 'aprs') $source = $line['format_source'];
298
+		    if (isset($line['source_name'])) {
299
+		    	$source = $line['source_name'];
300
+		    } else {
301
+		    	$source = '';
302
+		    }
303
+		    if ($source == '' || $line['format_source'] == 'aprs') {
304
+		    	$source = $line['format_source'];
305
+		    }
255 306
 		    if (!isset($this->stats[$current_date][$source]['msg'])) {
256 307
 		    	$this->stats[$current_date][$source]['msg']['date'] = time();
257 308
 		    	$this->stats[$current_date][$source]['msg']['nb'] = 1;
258
-		    } else $this->stats[$current_date][$source]['msg']['nb'] += 1;
309
+		    } else {
310
+		    	$this->stats[$current_date][$source]['msg']['nb'] += 1;
311
+		    }
259 312
 		}
260 313
 		
261 314
 		/*
@@ -271,23 +324,38 @@  discard block
 block discarded – undo
271 324
 		//$this->db = $dbc;
272 325
 
273 326
 		//$hex = trim($line['hex']);
274
-	        if (!isset($line['id'])) $id = trim($line['hex']);
275
-	        else $id = trim($line['id']);
327
+	        if (!isset($line['id'])) {
328
+	        	$id = trim($line['hex']);
329
+	        } else {
330
+	        	$id = trim($line['id']);
331
+	        }
276 332
 		
277 333
 		if (!isset($this->all_flights[$id])) {
278
-		    if ($globalDebug) echo 'New flight...'."\n";
334
+		    if ($globalDebug) {
335
+		    	echo 'New flight...'."\n";
336
+		    }
279 337
 		    $this->all_flights[$id] = array();
280 338
 		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0));
281 339
 		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => '','departure_airport' => '', 'arrival_airport' => '','latitude' => '', 'longitude' => '', 'speed' => '', 'altitude' => '','altitude_real' => '','altitude_previous' => '', 'heading' => '','departure_airport_time' => '','arrival_airport_time' => '','squawk' => '','route_stop' => '','registration' => '','pilot_id' => '','pilot_name' => '','waypoints' => '','ground' => '0', 'format_source' => '','source_name' => '','over_country' => '','verticalrate' => '','noarchive' => false,'putinarchive' => true,'source_type' => ''));
282
-		    if (isset($globalDaemon) && $globalDaemon === FALSE) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('lastupdate' => time()));
340
+		    if (isset($globalDaemon) && $globalDaemon === FALSE) {
341
+		    	$this->all_flights[$id] = array_merge($this->all_flights[$id],array('lastupdate' => time()));
342
+		    }
283 343
 		    if (!isset($line['id'])) {
284
-			if (!isset($globalDaemon)) $globalDaemon = TRUE;
285
-//			if (isset($line['format_source']) && ($line['format_source'] == 'sbs' || $line['format_source'] == 'tsv' || $line['format_source'] == 'raw') && $globalDaemon) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'].'-'.date('YmdGi')));
344
+			if (!isset($globalDaemon)) {
345
+				$globalDaemon = TRUE;
346
+			}
347
+			//			if (isset($line['format_source']) && ($line['format_source'] == 'sbs' || $line['format_source'] == 'tsv' || $line['format_source'] == 'raw') && $globalDaemon) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'].'-'.date('YmdGi')));
286 348
 //			if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs') && $globalDaemon) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi')));
287
-			if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $id.'-'.date('YmdHi')));
349
+			if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) {
350
+				$this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $id.'-'.date('YmdHi')));
351
+			}
288 352
 		        //else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident']));
289
-		     } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id']));
290
-		    if ($globalAllFlights !== FALSE) $dataFound = true;
353
+		     } else {
354
+		     	$this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id']));
355
+		     }
356
+		    if ($globalAllFlights !== FALSE) {
357
+		    	$dataFound = true;
358
+		    }
291 359
 		}
292 360
 		if (isset($line['source_type']) && $line['source_type'] != '') {
293 361
 		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('source_type' => $line['source_type']));
@@ -309,12 +377,20 @@  discard block
 block discarded – undo
309 377
 				$aircraft_icao = $Spotter->getAllAircraftType(trim($line['hex']));
310 378
 			    }
311 379
 			    $Spotter->db = null;
312
-			    if ($globalDebugTimeElapsed) echo 'Time elapsed for update getallaircrattype : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
313
-			    if ($aircraft_icao != '') $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $aircraft_icao));
380
+			    if ($globalDebugTimeElapsed) {
381
+			    	echo 'Time elapsed for update getallaircrattype : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
382
+			    }
383
+			    if ($aircraft_icao != '') {
384
+			    	$this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $aircraft_icao));
385
+			    }
314 386
 			}
315 387
 		    }
316
-		    if ($globalAllFlights !== FALSE) $dataFound = true;
317
-		    if ($globalDebug) echo "*********** New aircraft hex : ".$line['hex']." ***********\n";
388
+		    if ($globalAllFlights !== FALSE) {
389
+		    	$dataFound = true;
390
+		    }
391
+		    if ($globalDebug) {
392
+		    	echo "*********** New aircraft hex : ".$line['hex']." ***********\n";
393
+		    }
318 394
 		}
319 395
 	        if (isset($line['id']) && !isset($line['hex'])) {
320 396
 		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('hex' => ''));
@@ -322,7 +398,9 @@  discard block
 block discarded – undo
322 398
 		if (isset($line['aircraft_icao']) && $line['aircraft_icao'] != '') {
323 399
 			$icao = $line['aircraft_icao'];
324 400
 			$Spotter = new Spotter($this->db);
325
-			if (isset($Spotter->aircraft_correct_icaotype[$icao])) $icao = $Spotter->aircraft_correct_icaotype[$icao];
401
+			if (isset($Spotter->aircraft_correct_icaotype[$icao])) {
402
+				$icao = $Spotter->aircraft_correct_icaotype[$icao];
403
+			}
326 404
 			$Spotter->db = null;
327 405
 			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $icao));
328 406
 		}
@@ -332,15 +410,24 @@  discard block
 block discarded – undo
332 410
 				$Spotter = new Spotter($this->db);
333 411
 				$aircraft_icao = $Spotter->getAircraftIcao($line['aircraft_name']);
334 412
 				$Spotter->db = null;
335
-				if ($aircraft_icao != '') $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $aircraft_icao));
413
+				if ($aircraft_icao != '') {
414
+					$this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $aircraft_icao));
415
+				}
336 416
 			}
337 417
 		}
338 418
 		if (!isset($this->all_flights[$id]['aircraft_icao']) && isset($line['aircraft_type'])) {
339
-			if ($line['aircraft_type'] == 'PARA_GLIDER') $aircraft_icao = 'GLID';
340
-			elseif ($line['aircraft_type'] == 'HELICOPTER_ROTORCRAFT') $aircraft_icao = 'UHEL';
341
-			elseif ($line['aircraft_type'] == 'TOW_PLANE') $aircraft_icao = 'TOWPLANE';
342
-			elseif ($line['aircraft_type'] == 'POWERED_AIRCRAFT') $aircraft_icao = 'POWAIRC';
343
-			if (isset($aircraft_icao)) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $aircraft_icao));
419
+			if ($line['aircraft_type'] == 'PARA_GLIDER') {
420
+				$aircraft_icao = 'GLID';
421
+			} elseif ($line['aircraft_type'] == 'HELICOPTER_ROTORCRAFT') {
422
+				$aircraft_icao = 'UHEL';
423
+			} elseif ($line['aircraft_type'] == 'TOW_PLANE') {
424
+				$aircraft_icao = 'TOWPLANE';
425
+			} elseif ($line['aircraft_type'] == 'POWERED_AIRCRAFT') {
426
+				$aircraft_icao = 'POWAIRC';
427
+			}
428
+			if (isset($aircraft_icao)) {
429
+				$this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $aircraft_icao));
430
+			}
344 431
 		}
345 432
 		if (!isset($this->all_flights[$id]['aircraft_icao'])) {
346 433
 			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => 'NA'));
@@ -350,8 +437,11 @@  discard block
 block discarded – undo
350 437
 		    if (!isset($this->all_flights[$id]['datetime']) || strtotime($line['datetime']) >= strtotime($this->all_flights[$id]['datetime'])) {
351 438
 			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => $line['datetime']));
352 439
 		    } else {
353
-				if (strtotime($line['datetime']) == strtotime($this->all_flights[$id]['datetime']) && $globalDebug) echo "!!! Date is the same as previous data for ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."\n";
354
-				elseif (strtotime($line['datetime']) > strtotime($this->all_flights[$id]['datetime']) && $globalDebug) echo "!!! Date previous latest data (".$line['datetime']." > ".$this->all_flights[$id]['datetime'].") !!! for ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."\n";
440
+				if (strtotime($line['datetime']) == strtotime($this->all_flights[$id]['datetime']) && $globalDebug) {
441
+					echo "!!! Date is the same as previous data for ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."\n";
442
+				} elseif (strtotime($line['datetime']) > strtotime($this->all_flights[$id]['datetime']) && $globalDebug) {
443
+					echo "!!! Date previous latest data (".$line['datetime']." > ".$this->all_flights[$id]['datetime'].") !!! for ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."\n";
444
+				}
355 445
 				/*
356 446
 				echo strtotime($line['datetime']).' > '.strtotime($this->all_flights[$id]['datetime']);
357 447
 				print_r($this->all_flights[$id]);
@@ -360,16 +450,22 @@  discard block
 block discarded – undo
360 450
 				return '';
361 451
 		    }
362 452
 		} elseif (isset($line['datetime']) && strtotime($line['datetime']) < time()-20*60) {
363
-			if ($globalDebug) echo "!!! Date is too old ".$line['datetime']." for ".$this->all_flights[$id]['id']." - format : ".$line['format_source']."!!!\n";
453
+			if ($globalDebug) {
454
+				echo "!!! Date is too old ".$line['datetime']." for ".$this->all_flights[$id]['id']." - format : ".$line['format_source']."!!!\n";
455
+			}
364 456
 			return '';
365 457
 		} elseif (isset($line['datetime']) && strtotime($line['datetime']) > time()+20*60) {
366
-			if ($globalDebug) echo "!!! Date is in the future ".$line['datetime']." for ".$this->all_flights[$id]['id']." - format : ".$line['format_source']."!!!\n";
458
+			if ($globalDebug) {
459
+				echo "!!! Date is in the future ".$line['datetime']." for ".$this->all_flights[$id]['id']." - format : ".$line['format_source']."!!!\n";
460
+			}
367 461
 			return '';
368 462
 		} elseif (!isset($line['datetime'])) {
369 463
 			date_default_timezone_set('UTC');
370 464
 			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => date('Y-m-d H:i:s')));
371 465
 		} else {
372
-			if ($globalDebug) echo "!!! Unknow date error ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."!!!";
466
+			if ($globalDebug) {
467
+				echo "!!! Unknow date error ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."!!!";
468
+			}
373 469
 			return '';
374 470
 		}
375 471
 
@@ -390,30 +486,48 @@  discard block
 block discarded – undo
390 486
 
391 487
 		    if ($this->all_flights[$id]['addedSpotter'] == 1) {
392 488
 			if ($globalVA !== TRUE && $globalIVAO !== TRUE && $globalVATSIM !== TRUE && $globalphpVMS !== TRUE && $globalVAM !== TRUE && $this->all_flights[$id]['lastupdate'] < time() - 1600) {
393
-				if ($globalDebug) echo '---!!!! New ident, reset aircraft data...'."\n";
489
+				if ($globalDebug) {
490
+					echo '---!!!! New ident, reset aircraft data...'."\n";
491
+				}
394 492
 				$this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0));
395 493
 				$this->all_flights[$id] = array_merge($this->all_flights[$id],array('forcenew' => 1));
396
-				if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $id.'-'.date('YmdHi')));
397
-				elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id']));
398
-				elseif (isset($this->all_flights[$id]['ident'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident']));
494
+				if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) {
495
+					$this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $id.'-'.date('YmdHi')));
496
+				} elseif (isset($line['id'])) {
497
+					$this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id']));
498
+				} elseif (isset($this->all_flights[$id]['ident'])) {
499
+					$this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident']));
500
+				}
399 501
 			} else {
400 502
 			    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => trim($line['ident'])));
401 503
 			    if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
402 504
 				$timeelapsed = microtime(true);
403 505
             			$Spotter = new Spotter($this->db);
404 506
             			$fromsource = NULL;
405
-            			if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource;
406
-            			elseif (isset($line['format_source']) && $line['format_source'] == 'vatsimtxt') $fromsource = 'vatsim';
407
-				elseif (isset($line['format_source']) && $line['format_source'] == 'whazzup') $fromsource = 'ivao';
408
-				elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim';
409
-				elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao';
507
+            			if (isset($globalAirlinesSource) && $globalAirlinesSource != '') {
508
+            				$fromsource = $globalAirlinesSource;
509
+            			} elseif (isset($line['format_source']) && $line['format_source'] == 'vatsimtxt') {
510
+            				$fromsource = 'vatsim';
511
+            			} elseif (isset($line['format_source']) && $line['format_source'] == 'whazzup') {
512
+					$fromsource = 'ivao';
513
+				} elseif (isset($globalVATSIM) && $globalVATSIM) {
514
+					$fromsource = 'vatsim';
515
+				} elseif (isset($globalIVAO) && $globalIVAO) {
516
+					$fromsource = 'ivao';
517
+				}
410 518
             			$result = $Spotter->updateIdentSpotterData($this->all_flights[$id]['id'],$this->all_flights[$id]['ident'],$fromsource);
411
-				if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n";
519
+				if ($globalDebug && $result != 'success') {
520
+					echo '!!! ERROR : '.$result."\n";
521
+				}
412 522
 				$Spotter->db = null;
413
-				if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
523
+				if ($globalDebugTimeElapsed) {
524
+					echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
525
+				}
414 526
 			    }
415 527
 			}
416
-		    } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => trim($line['ident'])));
528
+		    } else {
529
+		    	$this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => trim($line['ident'])));
530
+		    }
417 531
 		    
418 532
 /*
419 533
 		    if (!isset($line['id'])) {
@@ -423,7 +537,9 @@  discard block
 block discarded – undo
423 537
 		        else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident']));
424 538
 		     } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id']));
425 539
   */
426
-		    if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident']));
540
+		    if (!isset($this->all_flights[$id]['id'])) {
541
+		    	$this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident']));
542
+		    }
427 543
 
428 544
 		    //$putinarchive = true;
429 545
 		    if (isset($line['departure_airport_time']) && $line['departure_airport_time'] != 0) {
@@ -441,7 +557,9 @@  discard block
 block discarded – undo
441 557
 				$line['departure_airport_icao'] = $Spotter->getAirportIcao($line['departure_airport_iata']);
442 558
 				$line['arrival_airport_icao'] = $Spotter->getAirportIcao($line['arrival_airport_iata']);
443 559
 		    		$this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $line['departure_airport_icao'],'arrival_airport' => $line['arrival_airport_icao'],'route_stop' => ''));
444
-				if ($globalDebugTimeElapsed) echo 'Time elapsed for update getAirportICAO : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
560
+				if ($globalDebugTimeElapsed) {
561
+					echo 'Time elapsed for update getAirportICAO : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
562
+				}
445 563
                         }
446 564
 		    } elseif (!isset($line['format_source']) || $line['format_source'] != 'aprs') {
447 565
 			$timeelapsed = microtime(true);
@@ -455,7 +573,9 @@  discard block
 block discarded – undo
455 573
 				$Translation->db = null;
456 574
 			    }
457 575
 			    $Spotter->db = null;
458
-			    if ($globalDebugTimeElapsed) echo 'Time elapsed for update getrouteinfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
576
+			    if ($globalDebugTimeElapsed) {
577
+			    	echo 'Time elapsed for update getrouteinfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
578
+			    }
459 579
                     	}
460 580
 			if (isset($route['fromairport_icao']) && isset($route['toairport_icao'])) {
461 581
 			    //if ($route['FromAirport_ICAO'] != $route['ToAirport_ICAO']) {
@@ -464,9 +584,13 @@  discard block
 block discarded – undo
464 584
 		    		$this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $route['fromairport_icao'],'arrival_airport' => $route['toairport_icao'],'route_stop' => $route['routestop']));
465 585
 		    	    }
466 586
 			}
467
-			if (!isset($globalFork)) $globalFork = TRUE;
587
+			if (!isset($globalFork)) {
588
+				$globalFork = TRUE;
589
+			}
468 590
 			if (!$globalVA && !$globalIVAO && !$globalVATSIM && !$globalphpVMS && !$globalVAM && (!isset($line['format_source']) || $line['format_source'] != 'aprs')) {
469
-				if (!isset($this->all_flights[$id]['schedule_check']) || $this->all_flights[$id]['schedule_check'] === false) $this->get_Schedule($id,trim($line['ident']));
591
+				if (!isset($this->all_flights[$id]['schedule_check']) || $this->all_flights[$id]['schedule_check'] === false) {
592
+					$this->get_Schedule($id,trim($line['ident']));
593
+				}
470 594
 			}
471 595
 		    }
472 596
 		}
@@ -484,9 +608,13 @@  discard block
 block discarded – undo
484 608
 			$speed = $speed*3.6;
485 609
 			if ($speed < 1000) {
486 610
 				$this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed' => round($speed)));
487
-	  			if ($globalDebug) echo "ø Calculated Speed for ".$this->all_flights[$id]['hex']." : ".round($speed)." - distance : ".$distance."\n";
611
+	  			if ($globalDebug) {
612
+	  				echo "ø Calculated Speed for ".$this->all_flights[$id]['hex']." : ".round($speed)." - distance : ".$distance."\n";
613
+	  			}
488 614
 	  		} else {
489
-	  			if ($globalDebug) echo "ø IGNORED : Calculated Speed for ".$this->all_flights[$id]['hex']." : ".round($speed)." - distance : ".$distance."\n";
615
+	  			if ($globalDebug) {
616
+	  				echo "ø IGNORED : Calculated Speed for ".$this->all_flights[$id]['hex']." : ".round($speed)." - distance : ".$distance."\n";
617
+	  			}
490 618
 	  		}
491 619
 		    }
492 620
 		}
@@ -495,13 +623,21 @@  discard block
 block discarded – undo
495 623
 
496 624
 	        if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) {
497 625
 	    	    if (ctype_digit(strval($line['latitude'])) || ctype_digit(strval($line['longitude']))) {
498
-	    	    	if ($globalDebug) echo "/!\ Invalid latitude or/and longitude data : lat: ".$line['latitude']." - lng: ".$line['longitude']."\n";
626
+	    	    	if ($globalDebug) {
627
+	    	    		echo "/!\ Invalid latitude or/and longitude data : lat: ".$line['latitude']." - lng: ".$line['longitude']."\n";
628
+	    	    	}
499 629
 	    	    	return false;
500 630
 	    	    }
501
-	    	    if (isset($this->all_flights[$id]['time_last_coord'])) $timediff = round(time()-$this->all_flights[$id]['time_last_coord']);
502
-	    	    else unset($timediff);
503
-	    	    if (isset($this->all_flights[$id]['time_last_archive_coord'])) $timediff_archive = round(time()-$this->all_flights[$id]['time_last_archive_coord']);
504
-	    	    else unset($timediff_archive);
631
+	    	    if (isset($this->all_flights[$id]['time_last_coord'])) {
632
+	    	    	$timediff = round(time()-$this->all_flights[$id]['time_last_coord']);
633
+	    	    } else {
634
+	    	    	unset($timediff);
635
+	    	    }
636
+	    	    if (isset($this->all_flights[$id]['time_last_archive_coord'])) {
637
+	    	    	$timediff_archive = round(time()-$this->all_flights[$id]['time_last_archive_coord']);
638
+	    	    } else {
639
+	    	    	unset($timediff_archive);
640
+	    	    }
505 641
 	    	    if ($this->tmd > 5
506 642
 	    	        || (isset($line['format_source']) 
507 643
 	    	    	    && $line['format_source'] == 'airwhere' 
@@ -537,16 +673,25 @@  discard block
 block discarded – undo
537 673
 				$this->all_flights[$id]['putinarchive'] = true;
538 674
 				$this->tmd = 0;
539 675
 				if (!isset($globalNoImport) || $globalNoImport === FALSE) {
540
-				    if ($globalDebug) echo "\n".' ------- Check Country for '.$this->all_flights[$id]['ident'].' with latitude : '.$line['latitude'].' and longitude : '.$line['longitude'].'.... ';
676
+				    if ($globalDebug) {
677
+				    	echo "\n".' ------- Check Country for '.$this->all_flights[$id]['ident'].' with latitude : '.$line['latitude'].' and longitude : '.$line['longitude'].'.... ';
678
+				    }
541 679
 				    $timeelapsed = microtime(true);
542 680
 				    if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
543 681
 					$Spotter = new Spotter($this->db);
544 682
 					$all_country = $Spotter->getCountryFromLatitudeLongitude($line['latitude'],$line['longitude']);
545
-					if (!empty($all_country)) $this->all_flights[$id]['over_country'] = $all_country['iso2'];
546
-					else $this->all_flights[$id]['over_country'] = '';
683
+					if (!empty($all_country)) {
684
+						$this->all_flights[$id]['over_country'] = $all_country['iso2'];
685
+					} else {
686
+						$this->all_flights[$id]['over_country'] = '';
687
+					}
547 688
 					$Spotter->db = null;
548
-					if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
549
-					if ($globalDebug) echo 'FOUND : '.$this->all_flights[$id]['over_country'].' ---------------'."\n";
689
+					if ($globalDebugTimeElapsed) {
690
+						echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
691
+					}
692
+					if ($globalDebug) {
693
+						echo 'FOUND : '.$this->all_flights[$id]['over_country'].' ---------------'."\n";
694
+					}
550 695
 				    }
551 696
 				}
552 697
 				$this->all_flights[$id]['time_last_archive_coord'] = time();
@@ -592,7 +737,9 @@  discard block
 block discarded – undo
592 737
 			    */
593 738
 			}
594 739
 			if (isset($line['longitude']) && $line['longitude'] != '' && $line['longitude'] != 0 && $line['longitude'] < 360 && $line['longitude'] > -180) {
595
-			    if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360;
740
+			    if ($line['longitude'] > 180) {
741
+			    	$line['longitude'] = $line['longitude'] - 360;
742
+			    }
596 743
 			    //if (!isset($this->all_flights[$id]['longitude']) || $this->all_flights[$id]['longitude'] == ''  || abs($this->all_flights[$id]['longitude']-$line['longitude']) < 2 || $line['format_source'] != 'sbs' || time() - $this->all_flights[$id]['lastupdate'] > 30) {
597 744
 				if (!isset($this->all_flights[$id]['archive_longitude'])) {
598 745
 					$this->all_flights[$id]['archive_longitude'] = $line['longitude'];
@@ -629,7 +776,9 @@  discard block
 block discarded – undo
629 776
 		    }
630 777
 		}
631 778
 		if (isset($line['last_update']) && $line['last_update'] != '') {
632
-		    if (isset($this->all_flights[$id]['last_update']) && $this->all_flights[$id]['last_update'] != $line['last_update']) $dataFound = true;
779
+		    if (isset($this->all_flights[$id]['last_update']) && $this->all_flights[$id]['last_update'] != $line['last_update']) {
780
+		    	$dataFound = true;
781
+		    }
633 782
 		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('last_update' => $line['last_update']));
634 783
 		}
635 784
 		if (isset($line['verticalrate']) && $line['verticalrate'] != '') {
@@ -651,35 +800,53 @@  discard block
 block discarded – undo
651 800
 			// Here we force archive of flight because after ground it's a new one (or should be)
652 801
 			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0));
653 802
 			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('forcenew' => 1));
654
-			if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $id.'-'.date('YmdHi')));
655
-		        elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id']));
656
-			elseif (isset($this->all_flights[$id]['ident'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident']));
803
+			if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) {
804
+				$this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $id.'-'.date('YmdHi')));
805
+			} elseif (isset($line['id'])) {
806
+		        	$this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id']));
807
+		        } elseif (isset($this->all_flights[$id]['ident'])) {
808
+				$this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident']));
809
+			}
810
+		    }
811
+		    if ($line['ground'] != 1) {
812
+		    	$line['ground'] = 0;
657 813
 		    }
658
-		    if ($line['ground'] != 1) $line['ground'] = 0;
659 814
 		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ground' => $line['ground']));
660 815
 		    //$dataFound = true;
661 816
 		}
662 817
 		if (isset($line['squawk']) && $line['squawk'] != '') {
663 818
 		    if (isset($this->all_flights[$id]['squawk']) && $this->all_flights[$id]['squawk'] != '7500' && $this->all_flights[$id]['squawk'] != '7600' && $this->all_flights[$id]['squawk'] != '7700' && isset($this->all_flights[$id]['id'])) {
664
-			    if ($this->all_flights[$id]['squawk'] != $line['squawk']) $this->all_flights[$id]['putinarchive'] = true;
819
+			    if ($this->all_flights[$id]['squawk'] != $line['squawk']) {
820
+			    	$this->all_flights[$id]['putinarchive'] = true;
821
+			    }
665 822
 			    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk']));
666 823
 			    $highlight = '';
667
-			    if ($this->all_flights[$id]['squawk'] == '7500') $highlight = 'Squawk 7500 : Hijack at '.date('Y-m-d G:i').' UTC';
668
-			    if ($this->all_flights[$id]['squawk'] == '7600') $highlight = 'Squawk 7600 : Lost Comm (radio failure) at '.date('Y-m-d G:i').' UTC';
669
-			    if ($this->all_flights[$id]['squawk'] == '7700') $highlight = 'Squawk 7700 : Emergency at '.date('Y-m-d G:i').' UTC';
824
+			    if ($this->all_flights[$id]['squawk'] == '7500') {
825
+			    	$highlight = 'Squawk 7500 : Hijack at '.date('Y-m-d G:i').' UTC';
826
+			    }
827
+			    if ($this->all_flights[$id]['squawk'] == '7600') {
828
+			    	$highlight = 'Squawk 7600 : Lost Comm (radio failure) at '.date('Y-m-d G:i').' UTC';
829
+			    }
830
+			    if ($this->all_flights[$id]['squawk'] == '7700') {
831
+			    	$highlight = 'Squawk 7700 : Emergency at '.date('Y-m-d G:i').' UTC';
832
+			    }
670 833
 			    if ($highlight != '') {
671 834
 				$timeelapsed = microtime(true);
672 835
 				if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
673 836
 				    $Spotter = new Spotter($this->db);
674 837
 				    $Spotter->setHighlightFlight($this->all_flights[$id]['id'],$highlight);
675 838
 				    $Spotter->db = null;
676
-				    if ($globalDebugTimeElapsed) echo 'Time elapsed for update sethighlightflight : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
839
+				    if ($globalDebugTimeElapsed) {
840
+				    	echo 'Time elapsed for update sethighlightflight : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
841
+				    }
677 842
 				}
678 843
 				//$putinarchive = true;
679 844
 				//$highlight = '';
680 845
 			    }
681 846
 			    
682
-		    } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk']));
847
+		    } else {
848
+		    	$this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk']));
849
+		    }
683 850
 		    //$dataFound = true;
684 851
 		}
685 852
 
@@ -692,19 +859,27 @@  discard block
 block discarded – undo
692 859
 				}
693 860
 			}
694 861
 		    //if (!isset($this->all_flights[$id]['altitude']) || $this->all_flights[$id]['altitude'] == '' || ($this->all_flights[$id]['altitude'] > 0 && $line['altitude'] != 0)) {
695
-			if (is_int($this->all_flights[$id]['altitude']) && abs(round($line['altitude']/100)-$this->all_flights[$id]['altitude']) > 3) $this->all_flights[$id]['putinarchive'] = true;
862
+			if (is_int($this->all_flights[$id]['altitude']) && abs(round($line['altitude']/100)-$this->all_flights[$id]['altitude']) > 3) {
863
+				$this->all_flights[$id]['putinarchive'] = true;
864
+			}
696 865
 			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('altitude' => round($line['altitude']/100)));
697 866
 			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('altitude_real' => $line['altitude']));
698 867
 			//$dataFound = true;
699 868
 		    //} elseif ($globalDebug) echo "!!! Strange altitude data... not added.\n";
700 869
 		    if ($globalVA !== TRUE && $globalIVAO !== TRUE && $globalVATSIM !== TRUE && $globalphpVMS !== TRUE && $globalVAM !== TRUE) {
701 870
 			if (isset($this->all_flights[$id]['over_country']) && $this->all_flights[$id]['over_country'] != '' && isset($this->all_flights[$id]['altitude_previous']) && $this->all_flights[$id]['altitude_previous'] != '' && $this->all_flights[$id]['altitude_previous'] < $this->all_flights[$id]['altitude_real'] && isset($this->all_flights[$id]['lastupdate']) && $this->all_flights[$id]['lastupdate'] < time() - 1600) {
702
-				if ($globalDebug) echo '--- Reset because of altitude'."\n";
871
+				if ($globalDebug) {
872
+					echo '--- Reset because of altitude'."\n";
873
+				}
703 874
 				$this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0));
704 875
 				$this->all_flights[$id] = array_merge($this->all_flights[$id],array('forcenew' => 1));
705
-				if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $id.'-'.date('YmdHi')));
706
-				elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id']));
707
-				elseif (isset($this->all_flights[$id]['ident'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident']));
876
+				if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) {
877
+					$this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $id.'-'.date('YmdHi')));
878
+				} elseif (isset($line['id'])) {
879
+					$this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id']));
880
+				} elseif (isset($this->all_flights[$id]['ident'])) {
881
+					$this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident']));
882
+				}
708 883
 			}
709 884
 		    }
710 885
 		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('altitude_previous' => $line['altitude']));
@@ -715,22 +890,32 @@  discard block
 block discarded – undo
715 890
 		}
716 891
 		
717 892
 		if (isset($line['heading']) && $line['heading'] != '') {
718
-		    if (is_int($this->all_flights[$id]['heading']) && abs($this->all_flights[$id]['heading']-round($line['heading'])) > 10) $this->all_flights[$id]['putinarchive'] = true;
893
+		    if (is_int($this->all_flights[$id]['heading']) && abs($this->all_flights[$id]['heading']-round($line['heading'])) > 10) {
894
+		    	$this->all_flights[$id]['putinarchive'] = true;
895
+		    }
719 896
 		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => round($line['heading'])));
720 897
 		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading_fromsrc' => true));
721 898
 		    //$dataFound = true;
722 899
   		} elseif (!isset($this->all_flights[$id]['heading_fromsrc']) && isset($this->all_flights[$id]['archive_latitude']) && $this->all_flights[$id]['archive_latitude'] != $this->all_flights[$id]['latitude'] && isset($this->all_flights[$id]['archive_longitude']) && $this->all_flights[$id]['archive_longitude'] != $this->all_flights[$id]['longitude']) {
723 900
   		    $heading = $Common->getHeading($this->all_flights[$id]['archive_latitude'],$this->all_flights[$id]['archive_longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude']);
724 901
 		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => round($heading)));
725
-		    if (abs($this->all_flights[$id]['heading']-round($heading)) > 10) $this->all_flights[$id]['putinarchive'] = true;
726
-  		    if ($globalDebug) echo "ø Calculated Heading for ".$this->all_flights[$id]['id']." : ".$heading."\n";
902
+		    if (abs($this->all_flights[$id]['heading']-round($heading)) > 10) {
903
+		    	$this->all_flights[$id]['putinarchive'] = true;
904
+		    }
905
+  		    if ($globalDebug) {
906
+  		    	echo "ø Calculated Heading for ".$this->all_flights[$id]['id']." : ".$heading."\n";
907
+  		    }
727 908
   		} elseif (isset($this->all_flights[$id]['format_source']) && $this->all_flights[$id]['format_source'] == 'ACARS') {
728 909
   		    // If not enough messages and ACARS set heading to 0
729 910
   		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => 0));
730 911
   		}
731
-		if ($globalDaemon === TRUE && isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalSourcesupdate) $dataFound = false;
732
-		elseif ($globalDaemon === TRUE && isset($globalSBS1update) && $globalSBS1update != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalSBS1update) $dataFound = false;
733
-		elseif ($globalDaemon === TRUE && isset($globalAircraftMinUpdate) && $globalAircraftMinUpdate != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalAircraftMinupdate) $dataFound = false;
912
+		if ($globalDaemon === TRUE && isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalSourcesupdate) {
913
+			$dataFound = false;
914
+		} elseif ($globalDaemon === TRUE && isset($globalSBS1update) && $globalSBS1update != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalSBS1update) {
915
+			$dataFound = false;
916
+		} elseif ($globalDaemon === TRUE && isset($globalAircraftMinUpdate) && $globalAircraftMinUpdate != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalAircraftMinupdate) {
917
+			$dataFound = false;
918
+		}
734 919
 
735 920
 //		print_r($this->all_flights[$id]);
736 921
 		//gets the callsign from the last hour
@@ -747,23 +932,38 @@  discard block
 block discarded – undo
747 932
 			    //$last_hour_ident = Spotter->getIdentFromLastHour($this->all_flights[$id]['ident']);
748 933
 			    if (!isset($this->all_flights[$id]['forcenew']) || $this->all_flights[$id]['forcenew'] == 0) {
749 934
 				if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
750
-				    if ($globalDebug) echo "Check if aircraft is already in DB...";
935
+				    if ($globalDebug) {
936
+				    	echo "Check if aircraft is already in DB...";
937
+				    }
751 938
 				    $timeelapsed = microtime(true);
752 939
 				    $SpotterLive = new SpotterLive($this->db);
753 940
 				    if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) {
754 941
 					$recent_ident = $SpotterLive->checkModeSRecent($this->all_flights[$id]['hex']);
755
-					if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkModeSRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
942
+					if ($globalDebugTimeElapsed) {
943
+						echo 'Time elapsed for update checkModeSRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
944
+					}
756 945
 				    } elseif (isset($line['id'])) {
757 946
 					$recent_ident = $SpotterLive->checkIdRecent($line['id']);
758
-					if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
947
+					if ($globalDebugTimeElapsed) {
948
+						echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
949
+					}
759 950
 				    } elseif (isset($this->all_flights[$id]['ident']) && $this->all_flights[$id]['ident'] != '') {
760 951
 					$recent_ident = $SpotterLive->checkIdentRecent($this->all_flights[$id]['ident']);
761
-					if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
762
-				    } else $recent_ident = '';
952
+					if ($globalDebugTimeElapsed) {
953
+						echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
954
+					}
955
+				    } else {
956
+				    	$recent_ident = '';
957
+				    }
763 958
 				    $SpotterLive->db=null;
764
-				    if ($globalDebug && $recent_ident == '') echo " Not in DB.\n";
765
-				    elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n";
766
-				} else $recent_ident = '';
959
+				    if ($globalDebug && $recent_ident == '') {
960
+				    	echo " Not in DB.\n";
961
+				    } elseif ($globalDebug && $recent_ident != '') {
962
+				    	echo " Already in DB.\n";
963
+				    }
964
+				} else {
965
+					$recent_ident = '';
966
+				}
767 967
 			    } else {
768 968
 				$recent_ident = '';
769 969
 				$this->all_flights[$id] = array_merge($this->all_flights[$id],array('forcenew' => 0));
@@ -771,7 +971,9 @@  discard block
 block discarded – undo
771 971
 			    //if there was no aircraft with the same callsign within the last hour and go post it into the archive
772 972
 			    if($recent_ident == "")
773 973
 			    {
774
-				if ($globalDebug) echo "\o/ Add ".$this->all_flights[$id]['ident']." in archive DB : ";
974
+				if ($globalDebug) {
975
+					echo "\o/ Add ".$this->all_flights[$id]['ident']." in archive DB : ";
976
+				}
775 977
 				if ($this->all_flights[$id]['departure_airport'] == "") { $this->all_flights[$id]['departure_airport'] = "NA"; }
776 978
 				if ($this->all_flights[$id]['arrival_airport'] == "") { $this->all_flights[$id]['arrival_airport'] = "NA"; }
777 979
 				//adds the spotter data for the archive
@@ -815,31 +1017,49 @@  discard block
 block discarded – undo
815 1017
 				
816 1018
 				if (!$ignoreImport) {
817 1019
 				    $highlight = '';
818
-				    if ($this->all_flights[$id]['squawk'] == '7500') $highlight = 'Squawk 7500 : Hijack';
819
-				    if ($this->all_flights[$id]['squawk'] == '7600') $highlight = 'Squawk 7600 : Lost Comm (radio failure)';
820
-				    if ($this->all_flights[$id]['squawk'] == '7700') $highlight = 'Squawk 7700 : Emergency';
821
-				    if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi')));
1020
+				    if ($this->all_flights[$id]['squawk'] == '7500') {
1021
+				    	$highlight = 'Squawk 7500 : Hijack';
1022
+				    }
1023
+				    if ($this->all_flights[$id]['squawk'] == '7600') {
1024
+				    	$highlight = 'Squawk 7600 : Lost Comm (radio failure)';
1025
+				    }
1026
+				    if ($this->all_flights[$id]['squawk'] == '7700') {
1027
+				    	$highlight = 'Squawk 7700 : Emergency';
1028
+				    }
1029
+				    if (!isset($this->all_flights[$id]['id'])) {
1030
+				    	$this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi')));
1031
+				    }
822 1032
 				    $timeelapsed = microtime(true);
823 1033
 				    if (!isset($globalNoImport) || $globalNoImport === FALSE) {
824 1034
 					if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
825 1035
 					    $Spotter = new Spotter($this->db);
826 1036
 					    $result = $Spotter->addSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['aircraft_icao'], $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['waypoints'], $this->all_flights[$id]['altitude'],$this->all_flights[$id]['altitude_real'], $this->all_flights[$id]['heading'], $this->all_flights[$id]['speed'], $this->all_flights[$id]['datetime'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport_time'],$this->all_flights[$id]['squawk'],$this->all_flights[$id]['route_stop'],$highlight,$this->all_flights[$id]['hex'],$this->all_flights[$id]['registration'],$this->all_flights[$id]['pilot_id'],$this->all_flights[$id]['pilot_name'],$this->all_flights[$id]['verticalrate'],$this->all_flights[$id]['ground'],$this->all_flights[$id]['format_source'],$this->all_flights[$id]['source_name'],$this->all_flights[$id]['source_type']);
827 1037
 					    $Spotter->db = null;
828
-					    if ($globalDebug && isset($result)) echo $result."\n";
1038
+					    if ($globalDebug && isset($result)) {
1039
+					    	echo $result."\n";
1040
+					    }
829 1041
 					}
830 1042
 				    }
831
-				    if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
1043
+				    if ($globalDebugTimeElapsed) {
1044
+				    	echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
1045
+				    }
832 1046
 				    if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
833 1047
 
834 1048
 				    // Add source stat in DB
835 1049
 				    $Stats = new Stats($this->db);
836 1050
 				    if (!empty($this->stats)) {
837
-					if ($globalDebug) echo 'Add source stats : ';
1051
+					if ($globalDebug) {
1052
+						echo 'Add source stats : ';
1053
+					}
838 1054
 				        foreach($this->stats as $date => $data) {
839 1055
 					    foreach($data as $source => $sourced) {
840 1056
 					        //print_r($sourced);
841
-				    	        if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar',$date);
842
-				    	        if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist',$date);
1057
+				    	        if (isset($sourced['polar'])) {
1058
+				    	        	echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar',$date);
1059
+				    	        }
1060
+				    	        if (isset($sourced['hist'])) {
1061
+				    	        	echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist',$date);
1062
+				    	        }
843 1063
 				    		if (isset($sourced['msg'])) {
844 1064
 				    		    if (time() - $sourced['msg']['date'] > 10) {
845 1065
 				    		        $nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date']));
@@ -852,13 +1072,17 @@  discard block
 block discarded – undo
852 1072
 			    			unset($this->stats[$date]);
853 1073
 			    		    }
854 1074
 				    	}
855
-				    	if ($globalDebug) echo 'Done'."\n";
1075
+				    	if ($globalDebug) {
1076
+				    		echo 'Done'."\n";
1077
+				    	}
856 1078
 
857 1079
 				    }
858 1080
 				    $Stats->db = null;
859 1081
 				    }
860 1082
 				    $this->del();
861
-				} elseif ($globalDebug) echo 'Ignore data'."\n";
1083
+				} elseif ($globalDebug) {
1084
+					echo 'Ignore data'."\n";
1085
+				}
862 1086
 				//$ignoreImport = false;
863 1087
 				$this->all_flights[$id]['addedSpotter'] = 1;
864 1088
 				//print_r($this->all_flights[$id]);
@@ -875,7 +1099,9 @@  discard block
 block discarded – undo
875 1099
 			*/
876 1100
 			//SpotterLive->deleteLiveSpotterDataByIdent($this->all_flights[$id]['ident']);
877 1101
 				if ($this->last_delete == 0 || time() - $this->last_delete > 1800) {
878
-				    if ($globalDebug) echo "---- Deleting Live Spotter data older than 9 hours...";
1102
+				    if ($globalDebug) {
1103
+				    	echo "---- Deleting Live Spotter data older than 9 hours...";
1104
+				    }
879 1105
 				    //SpotterLive->deleteLiveSpotterDataNotUpdated();
880 1106
 				    if (!isset($globalNoImport) || $globalNoImport === FALSE) {
881 1107
 					if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
@@ -884,7 +1110,9 @@  discard block
 block discarded – undo
884 1110
 					    $SpotterLive->db=null;
885 1111
 					}
886 1112
 				    }
887
-				    if ($globalDebug) echo " Done\n";
1113
+				    if ($globalDebug) {
1114
+				    	echo " Done\n";
1115
+				    }
888 1116
 				    $this->last_delete = time();
889 1117
 				}
890 1118
 			    } else {
@@ -911,11 +1139,17 @@  discard block
 block discarded – undo
911 1139
 		    //echo "{$line[8]} {$line[7]} - MODES:{$line[4]}  CALLSIGN:{$line[10]}   ALT:{$line[11]}   VEL:{$line[12]}   HDG:{$line[13]}   LAT:{$line[14]}   LON:{$line[15]}   VR:{$line[16]}   SQUAWK:{$line[17]}\n";
912 1140
 		    if ($globalDebug) {
913 1141
 			if ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || (isset($globalVAM) && $globalVAM)) {
914
-				if (isset($this->all_flights[$id]['source_name'])) echo 'DATA : hex : '.$this->all_flights[$id]['hex'].' - ident : '.$this->all_flights[$id]['ident'].' - ICAO : '.$this->all_flights[$id]['aircraft_icao'].' - Departure Airport : '.$this->all_flights[$id]['departure_airport'].' - Arrival Airport : '.$this->all_flights[$id]['arrival_airport'].' - Latitude : '.$this->all_flights[$id]['latitude'].' - Longitude : '.$this->all_flights[$id]['longitude'].' - waypoints : '.$this->all_flights[$id]['waypoints'].' - Altitude : '.$this->all_flights[$id]['altitude'].' - Heading : '.$this->all_flights[$id]['heading'].' - Speed : '.$this->all_flights[$id]['speed'].' - Departure Airport Time : '.$this->all_flights[$id]['departure_airport_time'].' - Arrival Airport time : '.$this->all_flights[$id]['arrival_airport_time'].' - Pilot : '.$this->all_flights[$id]['pilot_name'].' - Source name : '.$this->all_flights[$id]['source_name']."\n";
915
-				else echo 'DATA : hex : '.$this->all_flights[$id]['hex'].' - ident : '.$this->all_flights[$id]['ident'].' - ICAO : '.$this->all_flights[$id]['aircraft_icao'].' - Departure Airport : '.$this->all_flights[$id]['departure_airport'].' - Arrival Airport : '.$this->all_flights[$id]['arrival_airport'].' - Latitude : '.$this->all_flights[$id]['latitude'].' - Longitude : '.$this->all_flights[$id]['longitude'].' - waypoints : '.$this->all_flights[$id]['waypoints'].' - Altitude : '.$this->all_flights[$id]['altitude'].' - Heading : '.$this->all_flights[$id]['heading'].' - Speed : '.$this->all_flights[$id]['speed'].' - Departure Airport Time : '.$this->all_flights[$id]['departure_airport_time'].' - Arrival Airport time : '.$this->all_flights[$id]['arrival_airport_time'].' - Pilot : '.$this->all_flights[$id]['pilot_name']."\n";
1142
+				if (isset($this->all_flights[$id]['source_name'])) {
1143
+					echo 'DATA : hex : '.$this->all_flights[$id]['hex'].' - ident : '.$this->all_flights[$id]['ident'].' - ICAO : '.$this->all_flights[$id]['aircraft_icao'].' - Departure Airport : '.$this->all_flights[$id]['departure_airport'].' - Arrival Airport : '.$this->all_flights[$id]['arrival_airport'].' - Latitude : '.$this->all_flights[$id]['latitude'].' - Longitude : '.$this->all_flights[$id]['longitude'].' - waypoints : '.$this->all_flights[$id]['waypoints'].' - Altitude : '.$this->all_flights[$id]['altitude'].' - Heading : '.$this->all_flights[$id]['heading'].' - Speed : '.$this->all_flights[$id]['speed'].' - Departure Airport Time : '.$this->all_flights[$id]['departure_airport_time'].' - Arrival Airport time : '.$this->all_flights[$id]['arrival_airport_time'].' - Pilot : '.$this->all_flights[$id]['pilot_name'].' - Source name : '.$this->all_flights[$id]['source_name']."\n";
1144
+				} else {
1145
+					echo 'DATA : hex : '.$this->all_flights[$id]['hex'].' - ident : '.$this->all_flights[$id]['ident'].' - ICAO : '.$this->all_flights[$id]['aircraft_icao'].' - Departure Airport : '.$this->all_flights[$id]['departure_airport'].' - Arrival Airport : '.$this->all_flights[$id]['arrival_airport'].' - Latitude : '.$this->all_flights[$id]['latitude'].' - Longitude : '.$this->all_flights[$id]['longitude'].' - waypoints : '.$this->all_flights[$id]['waypoints'].' - Altitude : '.$this->all_flights[$id]['altitude'].' - Heading : '.$this->all_flights[$id]['heading'].' - Speed : '.$this->all_flights[$id]['speed'].' - Departure Airport Time : '.$this->all_flights[$id]['departure_airport_time'].' - Arrival Airport time : '.$this->all_flights[$id]['arrival_airport_time'].' - Pilot : '.$this->all_flights[$id]['pilot_name']."\n";
1146
+				}
916 1147
 			} else {
917
-				if (isset($this->all_flights[$id]['source_name'])) echo 'DATA : hex : '.$this->all_flights[$id]['hex'].' - ident : '.$this->all_flights[$id]['ident'].' - ICAO : '.$this->all_flights[$id]['aircraft_icao'].' - Departure Airport : '.$this->all_flights[$id]['departure_airport'].' - Arrival Airport : '.$this->all_flights[$id]['arrival_airport'].' - Latitude : '.$this->all_flights[$id]['latitude'].' - Longitude : '.$this->all_flights[$id]['longitude'].' - waypoints : '.$this->all_flights[$id]['waypoints'].' - Altitude : '.$this->all_flights[$id]['altitude'].' - Heading : '.$this->all_flights[$id]['heading'].' - Speed : '.$this->all_flights[$id]['speed'].' - Departure Airport Time : '.$this->all_flights[$id]['departure_airport_time'].' - Arrival Airport time : '.$this->all_flights[$id]['arrival_airport_time'].' - Source Name : '.$this->all_flights[$id]['source_name']."\n";
918
-				else echo 'DATA : hex : '.$this->all_flights[$id]['hex'].' - ident : '.$this->all_flights[$id]['ident'].' - ICAO : '.$this->all_flights[$id]['aircraft_icao'].' - Departure Airport : '.$this->all_flights[$id]['departure_airport'].' - Arrival Airport : '.$this->all_flights[$id]['arrival_airport'].' - Latitude : '.$this->all_flights[$id]['latitude'].' - Longitude : '.$this->all_flights[$id]['longitude'].' - waypoints : '.$this->all_flights[$id]['waypoints'].' - Altitude : '.$this->all_flights[$id]['altitude'].' - Heading : '.$this->all_flights[$id]['heading'].' - Speed : '.$this->all_flights[$id]['speed'].' - Departure Airport Time : '.$this->all_flights[$id]['departure_airport_time'].' - Arrival Airport time : '.$this->all_flights[$id]['arrival_airport_time']."\n";
1148
+				if (isset($this->all_flights[$id]['source_name'])) {
1149
+					echo 'DATA : hex : '.$this->all_flights[$id]['hex'].' - ident : '.$this->all_flights[$id]['ident'].' - ICAO : '.$this->all_flights[$id]['aircraft_icao'].' - Departure Airport : '.$this->all_flights[$id]['departure_airport'].' - Arrival Airport : '.$this->all_flights[$id]['arrival_airport'].' - Latitude : '.$this->all_flights[$id]['latitude'].' - Longitude : '.$this->all_flights[$id]['longitude'].' - waypoints : '.$this->all_flights[$id]['waypoints'].' - Altitude : '.$this->all_flights[$id]['altitude'].' - Heading : '.$this->all_flights[$id]['heading'].' - Speed : '.$this->all_flights[$id]['speed'].' - Departure Airport Time : '.$this->all_flights[$id]['departure_airport_time'].' - Arrival Airport time : '.$this->all_flights[$id]['arrival_airport_time'].' - Source Name : '.$this->all_flights[$id]['source_name']."\n";
1150
+				} else {
1151
+					echo 'DATA : hex : '.$this->all_flights[$id]['hex'].' - ident : '.$this->all_flights[$id]['ident'].' - ICAO : '.$this->all_flights[$id]['aircraft_icao'].' - Departure Airport : '.$this->all_flights[$id]['departure_airport'].' - Arrival Airport : '.$this->all_flights[$id]['arrival_airport'].' - Latitude : '.$this->all_flights[$id]['latitude'].' - Longitude : '.$this->all_flights[$id]['longitude'].' - waypoints : '.$this->all_flights[$id]['waypoints'].' - Altitude : '.$this->all_flights[$id]['altitude'].' - Heading : '.$this->all_flights[$id]['heading'].' - Speed : '.$this->all_flights[$id]['speed'].' - Departure Airport Time : '.$this->all_flights[$id]['departure_airport_time'].' - Arrival Airport time : '.$this->all_flights[$id]['arrival_airport_time']."\n";
1152
+				}
919 1153
 			}
920 1154
 		    }
921 1155
 		    $ignoreImport = false;
@@ -961,22 +1195,30 @@  discard block
 block discarded – undo
961 1195
 
962 1196
 		    if (!$ignoreImport) {
963 1197
 			if (!isset($globalDistanceIgnore['latitude']) || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) {
964
-				if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi')));
1198
+				if (!isset($this->all_flights[$id]['id'])) {
1199
+					$this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi')));
1200
+				}
965 1201
 				$timeelapsed = microtime(true);
966 1202
 				if (!isset($globalNoImport) || $globalNoImport === FALSE) {
967 1203
 				    if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
968
-					if ($globalDebug) echo "\o/ Add ".$this->all_flights[$id]['ident']." from ".$this->all_flights[$id]['format_source']." in Live DB : ";
1204
+					if ($globalDebug) {
1205
+						echo "\o/ Add ".$this->all_flights[$id]['ident']." from ".$this->all_flights[$id]['format_source']." in Live DB : ";
1206
+					}
969 1207
 					$SpotterLive = new SpotterLive($this->db);
970 1208
 					$result = $SpotterLive->addLiveSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['aircraft_icao'], $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['waypoints'], $this->all_flights[$id]['altitude'],$this->all_flights[$id]['altitude_real'], $this->all_flights[$id]['heading'], $this->all_flights[$id]['speed'],$this->all_flights[$id]['datetime'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport_time'], $this->all_flights[$id]['squawk'],$this->all_flights[$id]['route_stop'],$this->all_flights[$id]['hex'],$this->all_flights[$id]['putinarchive'],$this->all_flights[$id]['registration'],$this->all_flights[$id]['pilot_id'],$this->all_flights[$id]['pilot_name'], $this->all_flights[$id]['verticalrate'], $this->all_flights[$id]['noarchive'], $this->all_flights[$id]['ground'],$this->all_flights[$id]['format_source'],$this->all_flights[$id]['source_name'],$this->all_flights[$id]['over_country']);
971 1209
 					$SpotterLive->db = null;
972
-					if ($globalDebug) echo $result."\n";
1210
+					if ($globalDebug) {
1211
+						echo $result."\n";
1212
+					}
973 1213
 				    }
974 1214
 				}
975 1215
 				if (isset($globalServerAPRS) && $globalServerAPRS && $this->all_flights[$id]['putinarchive']) {
976 1216
 					$APRSSpotter->addLiveSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['aircraft_icao'], $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['waypoints'], $this->all_flights[$id]['altitude'], $this->all_flights[$id]['altitude_real'], $this->all_flights[$id]['heading'], $this->all_flights[$id]['speed'],$this->all_flights[$id]['datetime'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport_time'], $this->all_flights[$id]['squawk'],$this->all_flights[$id]['route_stop'],$this->all_flights[$id]['hex'],$this->all_flights[$id]['putinarchive'],$this->all_flights[$id]['registration'],$this->all_flights[$id]['pilot_id'],$this->all_flights[$id]['pilot_name'], $this->all_flights[$id]['verticalrate'], $this->all_flights[$id]['noarchive'], $this->all_flights[$id]['ground'],$this->all_flights[$id]['format_source'],$this->all_flights[$id]['source_name'],$this->all_flights[$id]['over_country']);
977 1217
 				}
978 1218
 				$this->all_flights[$id]['putinarchive'] = false;
979
-				if ($globalDebugTimeElapsed) echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
1219
+				if ($globalDebugTimeElapsed) {
1220
+					echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
1221
+				}
980 1222
 
981 1223
 				// Put statistics in $this->stats variable
982 1224
 				//if ($line['format_source'] != 'aprs') {
@@ -984,7 +1226,9 @@  discard block
 block discarded – undo
984 1226
 				if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
985 1227
 				    if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE && $this->all_flights[$id]['latitude'] != '' && $this->all_flights[$id]['longitude'] != '') {
986 1228
 					$source = $this->all_flights[$id]['source_name'];
987
-					if ($source == '') $source = $this->all_flights[$id]['format_source'];
1229
+					if ($source == '') {
1230
+						$source = $this->all_flights[$id]['format_source'];
1231
+					}
988 1232
 					if (!isset($this->source_location[$source])) {
989 1233
 						$Location = new Source($this->db);
990 1234
 						$coord = $Location->getLocationInfobySourceName($source);
@@ -1005,7 +1249,9 @@  discard block
 block discarded – undo
1005 1249
 					$stats_heading = round($stats_heading/22.5);
1006 1250
 					$stats_distance = $Common->distance($latitude,$longitude,$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude']);
1007 1251
 					$current_date = date('Y-m-d');
1008
-					if ($stats_heading == 16) $stats_heading = 0;
1252
+					if ($stats_heading == 16) {
1253
+						$stats_heading = 0;
1254
+					}
1009 1255
 					if (!isset($this->stats[$current_date][$source]['polar'][1])) {
1010 1256
 						for ($i=0;$i<=15;$i++) {
1011 1257
 						    $this->stats[$current_date][$source]['polar'][$i] = 0;
@@ -1023,7 +1269,9 @@  discard block
 block discarded – undo
1023 1269
 						if (isset($this->stats[$current_date][$source]['hist'][0])) {
1024 1270
 						    end($this->stats[$current_date][$source]['hist']);
1025 1271
 						    $mini = key($this->stats[$current_date][$source]['hist'])+10;
1026
-						} else $mini = 0;
1272
+						} else {
1273
+							$mini = 0;
1274
+						}
1027 1275
 						for ($i=$mini;$i<=$distance;$i+=10) {
1028 1276
 						    $this->stats[$current_date][$source]['hist'][$i] = 0;
1029 1277
 						}
@@ -1035,19 +1283,27 @@  discard block
 block discarded – undo
1035 1283
 				}
1036 1284
 
1037 1285
 				$this->all_flights[$id]['lastupdate'] = time();
1038
-				if ($this->all_flights[$id]['putinarchive']) $send = true;
1286
+				if ($this->all_flights[$id]['putinarchive']) {
1287
+					$send = true;
1288
+				}
1039 1289
 				//if ($globalDebug) echo "Distance : ".Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude'])."\n";
1040
-			} elseif (isset($this->all_flights[$id]['latitude']) && isset($globalDistanceIgnore['latitude']) && $globalDebug) echo "!! Too far -> Distance : ".$Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude'])."\n";
1290
+			} elseif (isset($this->all_flights[$id]['latitude']) && isset($globalDistanceIgnore['latitude']) && $globalDebug) {
1291
+				echo "!! Too far -> Distance : ".$Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude'])."\n";
1292
+			}
1041 1293
 			//$this->del();
1042 1294
 			
1043 1295
 			if ($this->last_delete_hourly == 0 || time() - $this->last_delete_hourly > 900) {
1044 1296
 			    if ((!isset($globalNoImport) || $globalNoImport === FALSE) && (!isset($globalNoDB) || $globalNoDB !== TRUE)) {
1045
-				if ($globalDebug) echo "---- Deleting Live Spotter data Not updated since 2 hour...";
1297
+				if ($globalDebug) {
1298
+					echo "---- Deleting Live Spotter data Not updated since 2 hour...";
1299
+				}
1046 1300
 				$SpotterLive = new SpotterLive($this->db);
1047 1301
 				$SpotterLive->deleteLiveSpotterDataNotUpdated();
1048 1302
 				$SpotterLive->db = null;
1049 1303
 				//SpotterLive->deleteLiveSpotterData();
1050
-				if ($globalDebug) echo " Done\n";
1304
+				if ($globalDebug) {
1305
+					echo " Done\n";
1306
+				}
1051 1307
 				$this->last_delete_hourly = time();
1052 1308
 			    } else {
1053 1309
 				$this->del();
@@ -1059,7 +1315,9 @@  discard block
 block discarded – undo
1059 1315
 		    //$ignoreImport = false;
1060 1316
 		}
1061 1317
 		//if (function_exists('pcntl_fork') && $globalFork) pcntl_signal(SIGCHLD, SIG_IGN);
1062
-		if ($send) return $this->all_flights[$id];
1318
+		if ($send) {
1319
+			return $this->all_flights[$id];
1320
+		}
1063 1321
 	    }
1064 1322
 	}
1065 1323
     }
Please login to merge, or discard this patch.
install/class.update_db.php 1 patch
Braces   +1026 added lines, -356 removed lines patch added patch discarded remove patch
@@ -17,7 +17,9 @@  discard block
 block discarded – undo
17 17
 		curl_setopt($ch, CURLOPT_URL, $url);
18 18
 		curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
19 19
 		curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
20
-		if ($referer != '') curl_setopt($ch, CURLOPT_REFERER, $referer);
20
+		if ($referer != '') {
21
+			curl_setopt($ch, CURLOPT_REFERER, $referer);
22
+		}
21 23
 		curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.2) Gecko/20090729 Firefox/3.5.2 GTB5');
22 24
 		curl_setopt($ch, CURLOPT_FILE, $fp);
23 25
 		curl_exec($ch);
@@ -28,12 +30,16 @@  discard block
 block discarded – undo
28 30
 	public static function gunzip($in_file,$out_file_name = '') {
29 31
 		//echo $in_file.' -> '.$out_file_name."\n";
30 32
 		$buffer_size = 4096; // read 4kb at a time
31
-		if ($out_file_name == '') $out_file_name = str_replace('.gz', '', $in_file); 
33
+		if ($out_file_name == '') {
34
+			$out_file_name = str_replace('.gz', '', $in_file);
35
+		}
32 36
 		if ($in_file != '' && file_exists($in_file)) {
33 37
 			// PHP version of Ubuntu use gzopen64 instead of gzopen
34
-			if (function_exists('gzopen')) $file = gzopen($in_file,'rb');
35
-			elseif (function_exists('gzopen64')) $file = gzopen64($in_file,'rb');
36
-			else {
38
+			if (function_exists('gzopen')) {
39
+				$file = gzopen($in_file,'rb');
40
+			} elseif (function_exists('gzopen64')) {
41
+				$file = gzopen64($in_file,'rb');
42
+			} else {
37 43
 				echo 'gzopen not available';
38 44
 				die;
39 45
 			}
@@ -54,8 +60,12 @@  discard block
 block discarded – undo
54 60
 			if ($res === TRUE) {
55 61
 				$zip->extractTo($path);
56 62
 				$zip->close();
57
-			} else return false;
58
-		} else return false;
63
+			} else {
64
+				return false;
65
+			}
66
+		} else {
67
+			return false;
68
+		}
59 69
 	}
60 70
 	
61 71
 	public static function connect_sqlite($database) {
@@ -70,7 +80,9 @@  discard block
 block discarded – undo
70 80
 	public static function retrieve_route_sqlite_to_dest($database_file) {
71 81
 		global $globalDebug, $globalTransaction;
72 82
 		//$query = 'TRUNCATE TABLE routes';
73
-		if ($globalDebug) echo " - Delete previous routes from DB -";
83
+		if ($globalDebug) {
84
+			echo " - Delete previous routes from DB -";
85
+		}
74 86
 		$query = "DELETE FROM routes WHERE Source = '' OR Source = :source";
75 87
 		$Connection = new Connection();
76 88
 		try {
@@ -81,7 +93,9 @@  discard block
 block discarded – undo
81 93
                         return "error : ".$e->getMessage();
82 94
                 }
83 95
 
84
-    		if ($globalDebug) echo " - Add routes to DB -";
96
+    		if ($globalDebug) {
97
+    			echo " - Add routes to DB -";
98
+    		}
85 99
     		update_db::connect_sqlite($database_file);
86 100
 		//$query = 'select Route.RouteID, Route.callsign, operator.Icao AS operator_icao, FromAir.Icao AS FromAirportIcao, ToAir.Icao AS ToAirportIcao from Route inner join operator ON Route.operatorId = operator.operatorId LEFT JOIN Airport AS FromAir ON route.FromAirportId = FromAir.AirportId LEFT JOIN Airport AS ToAir ON ToAir.AirportID = route.ToAirportID';
87 101
 		$query = "select Route.RouteID, Route.callsign, operator.Icao AS operator_icao, FromAir.Icao AS FromAirportIcao, ToAir.Icao AS ToAirportIcao, rstp.allstop AS AllStop from Route inner join operator ON Route.operatorId = operator.operatorId LEFT JOIN Airport AS FromAir ON route.FromAirportId = FromAir.AirportId LEFT JOIN Airport AS ToAir ON ToAir.AirportID = route.ToAirportID LEFT JOIN (select RouteId,GROUP_CONCAT(icao,' ') as allstop from routestop left join Airport as air ON routestop.AirportId = air.AirportID group by RouteID) AS rstp ON Route.RouteID = rstp.RouteID";
@@ -96,15 +110,21 @@  discard block
 block discarded – undo
96 110
 		$Connection = new Connection();
97 111
 		$sth_dest = $Connection->db->prepare($query_dest);
98 112
 		try {
99
-			if ($globalTransaction) $Connection->db->beginTransaction();
113
+			if ($globalTransaction) {
114
+				$Connection->db->beginTransaction();
115
+			}
100 116
             		while ($values = $sth->fetch(PDO::FETCH_ASSOC)) {
101 117
 				//$query_dest_values = array(':RouteID' => $values['RouteId'],':CallSign' => $values['Callsign'],':Operator_ICAO' => $values['operator_icao'],':FromAirport_ICAO' => $values['FromAirportIcao'],':ToAirport_ICAO' => $values['ToAirportIcao'],':routestop' => $values['AllStop'],':source' => $database_file);
102 118
 				$query_dest_values = array(':CallSign' => $values['Callsign'],':Operator_ICAO' => $values['operator_icao'],':FromAirport_ICAO' => $values['FromAirportIcao'],':ToAirport_ICAO' => $values['ToAirportIcao'],':routestop' => $values['AllStop'],':source' => $database_file);
103 119
 				$sth_dest->execute($query_dest_values);
104 120
             		}
105
-			if ($globalTransaction) $Connection->db->commit();
121
+			if ($globalTransaction) {
122
+				$Connection->db->commit();
123
+			}
106 124
 		} catch(PDOException $e) {
107
-			if ($globalTransaction) $Connection->db->rollBack(); 
125
+			if ($globalTransaction) {
126
+				$Connection->db->rollBack();
127
+			}
108 128
 			return "error : ".$e->getMessage();
109 129
 		}
110 130
                 return '';
@@ -112,7 +132,9 @@  discard block
 block discarded – undo
112 132
 	public static function retrieve_route_oneworld($database_file) {
113 133
 		global $globalDebug, $globalTransaction;
114 134
 		//$query = 'TRUNCATE TABLE routes';
115
-		if ($globalDebug) echo " - Delete previous routes from DB -";
135
+		if ($globalDebug) {
136
+			echo " - Delete previous routes from DB -";
137
+		}
116 138
 		$query = "DELETE FROM routes WHERE Source = '' OR Source = :source";
117 139
 		$Connection = new Connection();
118 140
 		try {
@@ -123,14 +145,18 @@  discard block
 block discarded – undo
123 145
                         return "error : ".$e->getMessage();
124 146
                 }
125 147
 
126
-    		if ($globalDebug) echo " - Add routes to DB -";
148
+    		if ($globalDebug) {
149
+    			echo " - Add routes to DB -";
150
+    		}
127 151
 		require_once(dirname(__FILE__).'/../require/class.Spotter.php');
128 152
 		$Spotter = new Spotter();
129 153
 		if ($fh = fopen($database_file,"r")) {
130 154
 			$query_dest = 'INSERT INTO routes (CallSign,Operator_ICAO,FromAirport_ICAO,FromAirport_Time,ToAirport_ICAO,ToAirport_Time,RouteStop,Source) VALUES (:CallSign, :Operator_ICAO, :FromAirport_ICAO,:FromAirport_Time, :ToAirport_ICAO, :ToAirport_Time,:routestop, :source)';
131 155
 			$Connection = new Connection();
132 156
 			$sth_dest = $Connection->db->prepare($query_dest);
133
-			if ($globalTransaction) $Connection->db->beginTransaction();
157
+			if ($globalTransaction) {
158
+				$Connection->db->beginTransaction();
159
+			}
134 160
 			while (!feof($fh)) {
135 161
 				$line = fgetcsv($fh,9999,',');
136 162
 				if ($line[0] != '') {
@@ -139,13 +165,17 @@  discard block
 block discarded – undo
139 165
 							$query_dest_values = array(':CallSign' => str_replace('*','',$line[7]),':Operator_ICAO' => '',':FromAirport_ICAO' => $Spotter->getAirportICAO($line[0]),':FromAirport_Time' => $line[5],':ToAirport_ICAO' => $Spotter->getAirportICAO($line[1]),':ToAirport_Time' => $line[6],':routestop' => '',':source' => 'oneworld');
140 166
 							$sth_dest->execute($query_dest_values);
141 167
 						} catch(PDOException $e) {
142
-							if ($globalTransaction) $Connection->db->rollBack(); 
168
+							if ($globalTransaction) {
169
+								$Connection->db->rollBack();
170
+							}
143 171
 							return "error : ".$e->getMessage();
144 172
 						}
145 173
 					}
146 174
 				}
147 175
 			}
148
-			if ($globalTransaction) $Connection->db->commit();
176
+			if ($globalTransaction) {
177
+				$Connection->db->commit();
178
+			}
149 179
 		}
150 180
                 return '';
151 181
 	}
@@ -153,7 +183,9 @@  discard block
 block discarded – undo
153 183
 	public static function retrieve_route_skyteam($database_file) {
154 184
 		global $globalDebug, $globalTransaction;
155 185
 		//$query = 'TRUNCATE TABLE routes';
156
-		if ($globalDebug) echo " - Delete previous routes from DB -";
186
+		if ($globalDebug) {
187
+			echo " - Delete previous routes from DB -";
188
+		}
157 189
 		$query = "DELETE FROM routes WHERE Source = '' OR Source = :source";
158 190
 		$Connection = new Connection();
159 191
 		try {
@@ -164,7 +196,9 @@  discard block
 block discarded – undo
164 196
                         return "error : ".$e->getMessage();
165 197
                 }
166 198
 
167
-    		if ($globalDebug) echo " - Add routes to DB -";
199
+    		if ($globalDebug) {
200
+    			echo " - Add routes to DB -";
201
+    		}
168 202
 
169 203
 		require_once(dirname(__FILE__).'/../require/class.Spotter.php');
170 204
 		$Spotter = new Spotter();
@@ -173,7 +207,9 @@  discard block
 block discarded – undo
173 207
 			$Connection = new Connection();
174 208
 			$sth_dest = $Connection->db->prepare($query_dest);
175 209
 			try {
176
-				if ($globalTransaction) $Connection->db->beginTransaction();
210
+				if ($globalTransaction) {
211
+					$Connection->db->beginTransaction();
212
+				}
177 213
 				while (!feof($fh)) {
178 214
 					$line = fgetcsv($fh,9999,',');
179 215
 					if ($line[0] != '') {
@@ -184,9 +220,13 @@  discard block
 block discarded – undo
184 220
 						}
185 221
 					}
186 222
 				}
187
-				if ($globalTransaction) $Connection->db->commit();
223
+				if ($globalTransaction) {
224
+					$Connection->db->commit();
225
+				}
188 226
 			} catch(PDOException $e) {
189
-				if ($globalTransaction) $Connection->db->rollBack(); 
227
+				if ($globalTransaction) {
228
+					$Connection->db->rollBack();
229
+				}
190 230
 				return "error : ".$e->getMessage();
191 231
 			}
192 232
 		}
@@ -229,11 +269,16 @@  discard block
 block discarded – undo
229 269
 		$sth_dest = $Connection->db->prepare($query_dest);
230 270
 		$sth_dest_owner = $Connection->db->prepare($query_dest_owner);
231 271
 		try {
232
-			if ($globalTransaction) $Connection->db->beginTransaction();
272
+			if ($globalTransaction) {
273
+				$Connection->db->beginTransaction();
274
+			}
233 275
             		while ($values = $sth->fetch(PDO::FETCH_ASSOC)) {
234 276
 			//$query_dest_values = array(':AircraftID' => $values['AircraftID'],':FirstCreated' => $values['FirstCreated'],':LastModified' => $values['LastModified'],':ModeS' => $values['ModeS'],':ModeSCountry' => $values['ModeSCountry'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':SerialNo' => $values['SerialNo'], ':OperatorFlagCode' => $values['OperatorFlagCode'], ':Manufacturer' => $values['Manufacturer'], ':Type' => $values['Type'], ':FirstRegDate' => $values['FirstRegDate'], ':CurrentRegDate' => $values['CurrentRegDate'], ':Country' => $values['Country'], ':PreviousID' => $values['PreviousID'], ':DeRegDate' => $values['DeRegDate'], ':Status' => $values['Status'], ':PopularName' => $values['PopularName'],':GenericName' => $values['GenericName'],':AircraftClass' => $values['AircraftClass'], ':Engines' => $values['Engines'], ':OwnershipStatus' => $values['OwnershipStatus'],':RegisteredOwners' => $values['RegisteredOwners'],':MTOW' => $values['MTOW'], ':TotalHours' => $values['TotalHours'],':YearBuilt' => $values['YearBuilt'], ':CofACategory' => $values['CofACategory'], ':CofAExpiry' => $values['CofAExpiry'], ':UserNotes' => $values['UserNotes'], ':Interested' => $values['Interested'], ':UserTag' => $values['UserTag'], ':InfoUrl' => $values['InfoURL'], ':PictureUrl1' => $values['PictureURL1'], ':PictureUrl2' => $values['PictureURL2'], ':PictureUrl3' => $values['PictureURL3'], ':UserBool1' => $values['UserBool1'], ':UserBool2' => $values['UserBool2'], ':UserBool3' => $values['UserBool3'], ':UserBool4' => $values['UserBool4'], ':UserBool5' => $values['UserBool5'], ':UserString1' => $values['UserString1'], ':UserString2' => $values['UserString2'], ':UserString3' => $values['UserString3'], ':UserString4' => $values['UserString4'], ':UserString5' => $values['UserString5'], ':UserInt1' => $values['UserInt1'], ':UserInt2' => $values['UserInt2'], ':UserInt3' => $values['UserInt3'], ':UserInt4' => $values['UserInt4'], ':UserInt5' => $values['UserInt5']);
235
-				if ($values['UserString4'] == 'M') $type = 'military';
236
-				else $type = null;
277
+				if ($values['UserString4'] == 'M') {
278
+					$type = 'military';
279
+				} else {
280
+					$type = null;
281
+				}
237 282
 				$query_dest_values = array(':LastModified' => $values['LastModified'],':ModeS' => $values['ModeS'],':ModeSCountry' => $values['ModeSCountry'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':source' => $database_file,':type' => $type);
238 283
 				$sth_dest->execute($query_dest_values);
239 284
 				if ($values['RegisteredOwners'] != '' && $values['RegisteredOwners'] != NULL && $values['RegisteredOwners'] != 'Private') {
@@ -241,7 +286,9 @@  discard block
 block discarded – undo
241 286
 				    $sth_dest_owner->execute($query_dest_owner_values);
242 287
 				}
243 288
             		}
244
-			if ($globalTransaction) $Connection->db->commit();
289
+			if ($globalTransaction) {
290
+				$Connection->db->commit();
291
+			}
245 292
 		} catch(PDOException $e) {
246 293
 			return "error : ".$e->getMessage();
247 294
 		}
@@ -278,7 +325,9 @@  discard block
 block discarded – undo
278 325
 			$Connection = new Connection();
279 326
 			$sth_dest = $Connection->db->prepare($query_dest);
280 327
 			try {
281
-				if ($globalTransaction) $Connection->db->beginTransaction();
328
+				if ($globalTransaction) {
329
+					$Connection->db->beginTransaction();
330
+				}
282 331
             			while (!feof($fh)) {
283 332
             				$values = array();
284 333
             				$line = $Common->hex2str(fgets($fh,9999));
@@ -289,7 +338,9 @@  discard block
 block discarded – undo
289 338
             				// Check if we can find ICAO, else set it to GLID
290 339
             				$aircraft_name_split = explode(' ',$aircraft_name);
291 340
             				$search_more = '';
292
-            				if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'";
341
+            				if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) {
342
+            					$search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'";
343
+            				}
293 344
             				$query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more;
294 345
             				$sth_search = $Connection->db->prepare($query_search);
295 346
 					try {
@@ -302,7 +353,9 @@  discard block
 block discarded – undo
302 353
 					} catch(PDOException $e) {
303 354
 						return "error : ".$e->getMessage();
304 355
 					}
305
-					if (!isset($values['ICAOTypeCode'])) $values['ICAOTypeCode'] = 'GLID';
356
+					if (!isset($values['ICAOTypeCode'])) {
357
+						$values['ICAOTypeCode'] = 'GLID';
358
+					}
306 359
 					// Add data to db
307 360
 					if ($values['Registration'] != '' && $values['Registration'] != '0000') {
308 361
 						//$query_dest_values = array(':AircraftID' => $values['AircraftID'],':FirstCreated' => $values['FirstCreated'],':LastModified' => $values['LastModified'],':ModeS' => $values['ModeS'],':ModeSCountry' => $values['ModeSCountry'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':SerialNo' => $values['SerialNo'], ':OperatorFlagCode' => $values['OperatorFlagCode'], ':Manufacturer' => $values['Manufacturer'], ':Type' => $values['Type'], ':FirstRegDate' => $values['FirstRegDate'], ':CurrentRegDate' => $values['CurrentRegDate'], ':Country' => $values['Country'], ':PreviousID' => $values['PreviousID'], ':DeRegDate' => $values['DeRegDate'], ':Status' => $values['Status'], ':PopularName' => $values['PopularName'],':GenericName' => $values['GenericName'],':AircraftClass' => $values['AircraftClass'], ':Engines' => $values['Engines'], ':OwnershipStatus' => $values['OwnershipStatus'],':RegisteredOwners' => $values['RegisteredOwners'],':MTOW' => $values['MTOW'], ':TotalHours' => $values['TotalHours'],':YearBuilt' => $values['YearBuilt'], ':CofACategory' => $values['CofACategory'], ':CofAExpiry' => $values['CofAExpiry'], ':UserNotes' => $values['UserNotes'], ':Interested' => $values['Interested'], ':UserTag' => $values['UserTag'], ':InfoUrl' => $values['InfoURL'], ':PictureUrl1' => $values['PictureURL1'], ':PictureUrl2' => $values['PictureURL2'], ':PictureUrl3' => $values['PictureURL3'], ':UserBool1' => $values['UserBool1'], ':UserBool2' => $values['UserBool2'], ':UserBool3' => $values['UserBool3'], ':UserBool4' => $values['UserBool4'], ':UserBool5' => $values['UserBool5'], ':UserString1' => $values['UserString1'], ':UserString2' => $values['UserString2'], ':UserString3' => $values['UserString3'], ':UserString4' => $values['UserString4'], ':UserString5' => $values['UserString5'], ':UserInt1' => $values['UserInt1'], ':UserInt2' => $values['UserInt2'], ':UserInt3' => $values['UserInt3'], ':UserInt4' => $values['UserInt4'], ':UserInt5' => $values['UserInt5']);
@@ -311,7 +364,9 @@  discard block
 block discarded – undo
311 364
 						$sth_dest->execute($query_dest_values);
312 365
 					}
313 366
 				}
314
-				if ($globalTransaction) $Connection->db->commit();
367
+				if ($globalTransaction) {
368
+					$Connection->db->commit();
369
+				}
315 370
 			} catch(PDOException $e) {
316 371
 				return "error : ".$e->getMessage();
317 372
 			}
@@ -347,7 +402,9 @@  discard block
 block discarded – undo
347 402
 			$Connection = new Connection();
348 403
 			$sth_dest = $Connection->db->prepare($query_dest);
349 404
 			try {
350
-				if ($globalTransaction) $Connection->db->beginTransaction();
405
+				if ($globalTransaction) {
406
+					$Connection->db->beginTransaction();
407
+				}
351 408
 				$tmp = fgetcsv($fh,9999,',',"'");
352 409
             			while (!feof($fh)) {
353 410
             				$line = fgetcsv($fh,9999,',',"'");
@@ -361,13 +418,17 @@  discard block
 block discarded – undo
361 418
             				// Check if we can find ICAO, else set it to GLID
362 419
             				$aircraft_name_split = explode(' ',$aircraft_name);
363 420
             				$search_more = '';
364
-            				if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'";
421
+            				if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) {
422
+            					$search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'";
423
+            				}
365 424
             				$query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more;
366 425
             				$sth_search = $Connection->db->prepare($query_search);
367 426
 					try {
368 427
                                     		$sth_search->execute();
369 428
 	            				$result = $sth_search->fetch(PDO::FETCH_ASSOC);
370
-	            				if (isset($result['icao']) && $result['icao'] != '') $values['ICAOTypeCode'] = $result['icao'];
429
+	            				if (isset($result['icao']) && $result['icao'] != '') {
430
+	            					$values['ICAOTypeCode'] = $result['icao'];
431
+	            				}
371 432
 					} catch(PDOException $e) {
372 433
 						return "error : ".$e->getMessage();
373 434
 					}
@@ -380,7 +441,9 @@  discard block
 block discarded – undo
380 441
 						$sth_dest->execute($query_dest_values);
381 442
 					}
382 443
 				}
383
-				if ($globalTransaction) $Connection->db->commit();
444
+				if ($globalTransaction) {
445
+					$Connection->db->commit();
446
+				}
384 447
 			} catch(PDOException $e) {
385 448
 				return "error : ".$e->getMessage();
386 449
 			}
@@ -419,7 +482,9 @@  discard block
 block discarded – undo
419 482
 			$sth_dest = $Connection->db->prepare($query_dest);
420 483
 			$sth_modes = $Connection->db->prepare($query_modes);
421 484
 			try {
422
-				if ($globalTransaction) $Connection->db->beginTransaction();
485
+				if ($globalTransaction) {
486
+					$Connection->db->beginTransaction();
487
+				}
423 488
 				$tmp = fgetcsv($fh,9999,',','"');
424 489
             			while (!feof($fh)) {
425 490
             				$line = fgetcsv($fh,9999,',','"');
@@ -429,16 +494,22 @@  discard block
 block discarded – undo
429 494
             				    $values['registration'] = $line[0];
430 495
             				    $values['base'] = $line[4];
431 496
             				    $values['owner'] = $line[5];
432
-            				    if ($line[6] == '') $values['date_first_reg'] = null;
433
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6]));
497
+            				    if ($line[6] == '') {
498
+            				    	$values['date_first_reg'] = null;
499
+            				    } else {
500
+					    	$values['date_first_reg'] = date("Y-m-d",strtotime($line[6]));
501
+					    }
434 502
 					    $values['cancel'] = $line[7];
435 503
 					} elseif ($country == 'EI') {
436 504
 					    // TODO : add modeS & reg to aircraft_modes
437 505
             				    $values['registration'] = $line[0];
438 506
             				    $values['base'] = $line[3];
439 507
             				    $values['owner'] = $line[2];
440
-            				    if ($line[1] == '') $values['date_first_reg'] = null;
441
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[1]));
508
+            				    if ($line[1] == '') {
509
+            				    	$values['date_first_reg'] = null;
510
+            				    } else {
511
+					    	$values['date_first_reg'] = date("Y-m-d",strtotime($line[1]));
512
+					    }
442 513
 					    $values['cancel'] = '';
443 514
 					    $values['modes'] = $line[7];
444 515
 					    $values['icao'] = $line[8];
@@ -457,16 +528,22 @@  discard block
 block discarded – undo
457 528
             				    $values['registration'] = $line[3];
458 529
             				    $values['base'] = null;
459 530
             				    $values['owner'] = $line[5];
460
-            				    if ($line[18] == '') $values['date_first_reg'] = null;
461
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[18]));
531
+            				    if ($line[18] == '') {
532
+            				    	$values['date_first_reg'] = null;
533
+            				    } else {
534
+					    	$values['date_first_reg'] = date("Y-m-d",strtotime($line[18]));
535
+					    }
462 536
 					    $values['cancel'] = '';
463 537
 					} elseif ($country == 'VH') {
464 538
 					    // TODO : add modeS & reg to aircraft_modes
465 539
             				    $values['registration'] = $line[0];
466 540
             				    $values['base'] = null;
467 541
             				    $values['owner'] = $line[12];
468
-            				    if ($line[28] == '') $values['date_first_reg'] = null;
469
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[28]));
542
+            				    if ($line[28] == '') {
543
+            				    	$values['date_first_reg'] = null;
544
+            				    } else {
545
+					    	$values['date_first_reg'] = date("Y-m-d",strtotime($line[28]));
546
+					    }
470 547
 
471 548
 					    $values['cancel'] = $line[39];
472 549
 					} elseif ($country == 'OE' || $country == '9A' || $country == 'VP' || $country == 'LX' || $country == 'P2' || $country == 'HC') {
@@ -485,29 +562,41 @@  discard block
 block discarded – undo
485 562
             				    $values['registration'] = $line[0];
486 563
             				    $values['base'] = null;
487 564
             				    $values['owner'] = $line[8];
488
-            				    if ($line[7] == '') $values['date_first_reg'] = null;
489
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7]));
565
+            				    if ($line[7] == '') {
566
+            				    	$values['date_first_reg'] = null;
567
+            				    } else {
568
+					    	$values['date_first_reg'] = date("Y-m-d",strtotime($line[7]));
569
+					    }
490 570
 					    $values['cancel'] = '';
491 571
 					} elseif ($country == 'PP') {
492 572
             				    $values['registration'] = $line[0];
493 573
             				    $values['base'] = null;
494 574
             				    $values['owner'] = $line[4];
495
-            				    if ($line[6] == '') $values['date_first_reg'] = null;
496
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6]));
575
+            				    if ($line[6] == '') {
576
+            				    	$values['date_first_reg'] = null;
577
+            				    } else {
578
+					    	$values['date_first_reg'] = date("Y-m-d",strtotime($line[6]));
579
+					    }
497 580
 					    $values['cancel'] = $line[7];
498 581
 					} elseif ($country == 'E7') {
499 582
             				    $values['registration'] = $line[0];
500 583
             				    $values['base'] = null;
501 584
             				    $values['owner'] = $line[4];
502
-            				    if ($line[5] == '') $values['date_first_reg'] = null;
503
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[5]));
585
+            				    if ($line[5] == '') {
586
+            				    	$values['date_first_reg'] = null;
587
+            				    } else {
588
+					    	$values['date_first_reg'] = date("Y-m-d",strtotime($line[5]));
589
+					    }
504 590
 					    $values['cancel'] = '';
505 591
 					} elseif ($country == '8Q') {
506 592
             				    $values['registration'] = $line[0];
507 593
             				    $values['base'] = null;
508 594
             				    $values['owner'] = $line[3];
509
-            				    if ($line[7] == '') $values['date_first_reg'] = null;
510
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7]));
595
+            				    if ($line[7] == '') {
596
+            				    	$values['date_first_reg'] = null;
597
+            				    } else {
598
+					    	$values['date_first_reg'] = date("Y-m-d",strtotime($line[7]));
599
+					    }
511 600
 					    $values['cancel'] = '';
512 601
 					} elseif ($country == 'ZK') {
513 602
             				    $values['registration'] = $line[0];
@@ -552,7 +641,9 @@  discard block
 block discarded – undo
552 641
 						$sth_modes->execute($query_modes_values);
553 642
 					}
554 643
 				}
555
-				if ($globalTransaction) $Connection->db->commit();
644
+				if ($globalTransaction) {
645
+					$Connection->db->commit();
646
+				}
556 647
 			} catch(PDOException $e) {
557 648
 				return "error : ".$e->getMessage();
558 649
 			}
@@ -688,25 +779,45 @@  discard block
 block discarded – undo
688 779
 		    VALUES (:name, :city, :country, :iata, :icao, :latitude, :longitude, :altitude, :type, :home_link, :wikipedia_link, :image_thumb, :image)";
689 780
 		$Connection = new Connection();
690 781
 		$sth_dest = $Connection->db->prepare($query_dest);
691
-		if ($globalTransaction) $Connection->db->beginTransaction();
782
+		if ($globalTransaction) {
783
+			$Connection->db->beginTransaction();
784
+		}
692 785
   
693 786
 		$i = 0;
694 787
 		while($row = sparql_fetch_array($result))
695 788
 		{
696 789
 			if ($i >= 1) {
697 790
 			//print_r($row);
698
-			if (!isset($row['iata'])) $row['iata'] = '';
699
-			if (!isset($row['icao'])) $row['icao'] = '';
700
-			if (!isset($row['type'])) $row['type'] = '';
701
-			if (!isset($row['altitude'])) $row['altitude'] = '';
791
+			if (!isset($row['iata'])) {
792
+				$row['iata'] = '';
793
+			}
794
+			if (!isset($row['icao'])) {
795
+				$row['icao'] = '';
796
+			}
797
+			if (!isset($row['type'])) {
798
+				$row['type'] = '';
799
+			}
800
+			if (!isset($row['altitude'])) {
801
+				$row['altitude'] = '';
802
+			}
702 803
 			if (isset($row['city_bis'])) {
703 804
 				$row['city'] = $row['city_bis'];
704 805
 			}
705
-			if (!isset($row['city'])) $row['city'] = '';
706
-			if (!isset($row['country'])) $row['country'] = '';
707
-			if (!isset($row['homepage'])) $row['homepage'] = '';
708
-			if (!isset($row['wikipedia_page'])) $row['wikipedia_page'] = '';
709
-			if (!isset($row['name'])) continue;
806
+			if (!isset($row['city'])) {
807
+				$row['city'] = '';
808
+			}
809
+			if (!isset($row['country'])) {
810
+				$row['country'] = '';
811
+			}
812
+			if (!isset($row['homepage'])) {
813
+				$row['homepage'] = '';
814
+			}
815
+			if (!isset($row['wikipedia_page'])) {
816
+				$row['wikipedia_page'] = '';
817
+			}
818
+			if (!isset($row['name'])) {
819
+				continue;
820
+			}
710 821
 			if (!isset($row['image'])) {
711 822
 				$row['image'] = '';
712 823
 				$row['image_thumb'] = '';
@@ -762,7 +873,9 @@  discard block
 block discarded – undo
762 873
 
763 874
 			$i++;
764 875
 		}
765
-		if ($globalTransaction) $Connection->db->commit();
876
+		if ($globalTransaction) {
877
+			$Connection->db->commit();
878
+		}
766 879
 		/*
767 880
 		echo "Delete duplicate rows...\n";
768 881
 		$query = 'ALTER IGNORE TABLE airport ADD UNIQUE INDEX icaoidx (icao)';
@@ -805,7 +918,9 @@  discard block
 block discarded – undo
805 918
 		$delimiter = ',';
806 919
 		$out_file = $tmp_dir.'airports.csv';
807 920
 		update_db::download('http://ourairports.com/data/airports.csv',$out_file);
808
-		if (!file_exists($out_file) || !is_readable($out_file)) return FALSE;
921
+		if (!file_exists($out_file) || !is_readable($out_file)) {
922
+			return FALSE;
923
+		}
809 924
 		echo "Add data from ourairports.com...\n";
810 925
 
811 926
 		$header = NULL;
@@ -815,8 +930,9 @@  discard block
 block discarded – undo
815 930
 			//$Connection->db->beginTransaction();
816 931
 			while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE)
817 932
 			{
818
-				if(!$header) $header = $row;
819
-				else {
933
+				if(!$header) {
934
+					$header = $row;
935
+				} else {
820 936
 					$data = array();
821 937
 					$data = array_combine($header, $row);
822 938
 					try {
@@ -857,7 +973,9 @@  discard block
 block discarded – undo
857 973
 		echo "Download data from another free database...\n";
858 974
 		$out_file = $tmp_dir.'GlobalAirportDatabase.zip';
859 975
 		update_db::download('http://www.partow.net/downloads/GlobalAirportDatabase.zip',$out_file);
860
-		if (!file_exists($out_file) || !is_readable($out_file)) return FALSE;
976
+		if (!file_exists($out_file) || !is_readable($out_file)) {
977
+			return FALSE;
978
+		}
861 979
 		update_db::unzip($out_file);
862 980
 		$header = NULL;
863 981
 		echo "Add data from another free database...\n";
@@ -868,8 +986,9 @@  discard block
 block discarded – undo
868 986
 			//$Connection->db->beginTransaction();
869 987
 			while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE)
870 988
 			{
871
-				if(!$header) $header = $row;
872
-				else {
989
+				if(!$header) {
990
+					$header = $row;
991
+				} else {
873 992
 					$data = $row;
874 993
 
875 994
 					$query = 'UPDATE airport SET city = :city, country = :country WHERE icao = :icao';
@@ -1038,7 +1157,9 @@  discard block
 block discarded – undo
1038 1157
 		if (($handle = fopen($tmp_dir.'MASTER.txt', 'r')) !== FALSE)
1039 1158
 		{
1040 1159
 			$i = 0;
1041
-			if ($globalTransaction) $Connection->db->beginTransaction();
1160
+			if ($globalTransaction) {
1161
+				$Connection->db->beginTransaction();
1162
+			}
1042 1163
 			while (($data = fgetcsv($handle, 1000, $delimiter)) !== FALSE)
1043 1164
 			{
1044 1165
 				if ($i > 0) {
@@ -1051,7 +1172,9 @@  discard block
 block discarded – undo
1051 1172
 					}
1052 1173
 					$result_search = $sths->fetchAll(PDO::FETCH_ASSOC);
1053 1174
 					if (!empty($result_search)) {
1054
-						if ($globalDebug) echo '.';
1175
+						if ($globalDebug) {
1176
+							echo '.';
1177
+						}
1055 1178
 							//if ($globalDBdriver == 'mysql') {
1056 1179
 							//	$queryi = 'INSERT INTO faamfr (mfr,icao) VALUES (:mfr,:icao) ON DUPLICATE KEY UPDATE icao = :icao';
1057 1180
 							//} else {
@@ -1073,8 +1196,12 @@  discard block
 block discarded – undo
1073 1196
 						}
1074 1197
 						$result_search_mfr = $sthsm->fetchAll(PDO::FETCH_ASSOC);
1075 1198
 						if (!empty($result_search_mfr)) {
1076
-							if (trim($data[16]) == '' && trim($data[23]) != '') $data[16] = $data[23];
1077
-							if (trim($data[16]) == '' && trim($data[15]) != '') $data[16] = $data[15];
1199
+							if (trim($data[16]) == '' && trim($data[23]) != '') {
1200
+								$data[16] = $data[23];
1201
+							}
1202
+							if (trim($data[16]) == '' && trim($data[15]) != '') {
1203
+								$data[16] = $data[15];
1204
+							}
1078 1205
 							$queryf = 'INSERT INTO aircraft_modes (FirstCreated,LastModified,ModeS,ModeSCountry,Registration,ICAOTypeCode,Source) VALUES (:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:source)';
1079 1206
 							try {
1080 1207
 								$sthf = $Connection->db->prepare($queryf);
@@ -1085,7 +1212,9 @@  discard block
 block discarded – undo
1085 1212
 						}
1086 1213
 					}
1087 1214
 					if (strtotime($data[29]) > time()) {
1088
-						if ($globalDebug) echo 'i';
1215
+						if ($globalDebug) {
1216
+							echo 'i';
1217
+						}
1089 1218
 						$query = 'INSERT INTO aircraft_owner (registration,base,owner,date_first_reg,Source) VALUES (:registration,:base,:owner,:date_first_reg,:source)';
1090 1219
 						try {
1091 1220
 							$sth = $Connection->db->prepare($query);
@@ -1096,13 +1225,19 @@  discard block
 block discarded – undo
1096 1225
 					}
1097 1226
 				}
1098 1227
 				if ($i % 90 == 0) {
1099
-					if ($globalTransaction) $Connection->db->commit();
1100
-					if ($globalTransaction) $Connection->db->beginTransaction();
1228
+					if ($globalTransaction) {
1229
+						$Connection->db->commit();
1230
+					}
1231
+					if ($globalTransaction) {
1232
+						$Connection->db->beginTransaction();
1233
+					}
1101 1234
 				}
1102 1235
 				$i++;
1103 1236
 			}
1104 1237
 			fclose($handle);
1105
-			if ($globalTransaction) $Connection->db->commit();
1238
+			if ($globalTransaction) {
1239
+				$Connection->db->commit();
1240
+			}
1106 1241
 		}
1107 1242
 		//print_r($mfr);
1108 1243
 		return '';
@@ -1127,11 +1262,15 @@  discard block
 block discarded – undo
1127 1262
 			$i = 0;
1128 1263
 			//$Connection->db->setAttribute(PDO::ATTR_AUTOCOMMIT, FALSE);
1129 1264
 			//$Connection->db->beginTransaction();
1130
-			if ($globalTransaction) $Connection->db->beginTransaction();
1265
+			if ($globalTransaction) {
1266
+				$Connection->db->beginTransaction();
1267
+			}
1131 1268
 			while (($data = fgetcsv($handle, 1000, $delimiter)) !== FALSE)
1132 1269
 			{
1133 1270
 				if ($i > 0) {
1134
-					if ($data[1] == 'NULL') $data[1] = $data[0];
1271
+					if ($data[1] == 'NULL') {
1272
+						$data[1] = $data[0];
1273
+					}
1135 1274
 					$query = 'INSERT INTO aircraft_modes (FirstCreated,LastModified,ModeS,ModeSCountry,Registration,ICAOTypeCode,type_flight,Source) VALUES (:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:type_flight,:source)';
1136 1275
 					try {
1137 1276
 						$sth = $Connection->db->prepare($query);
@@ -1143,7 +1282,9 @@  discard block
 block discarded – undo
1143 1282
 				$i++;
1144 1283
 			}
1145 1284
 			fclose($handle);
1146
-			if ($globalTransaction) $Connection->db->commit();
1285
+			if ($globalTransaction) {
1286
+				$Connection->db->commit();
1287
+			}
1147 1288
 		}
1148 1289
 		return '';
1149 1290
         }
@@ -1164,7 +1305,9 @@  discard block
 block discarded – undo
1164 1305
 		if (($handle = fopen($tmp_dir.'owners.tsv', 'r')) !== FALSE)
1165 1306
 		{
1166 1307
 			$i = 0;
1167
-			if ($globalTransaction) $Connection->db->beginTransaction();
1308
+			if ($globalTransaction) {
1309
+				$Connection->db->beginTransaction();
1310
+			}
1168 1311
 			while (($data = fgetcsv($handle, 1000, $delimiter)) !== FALSE)
1169 1312
 			{
1170 1313
 				if ($i > 0) {
@@ -1180,7 +1323,9 @@  discard block
 block discarded – undo
1180 1323
 				$i++;
1181 1324
 			}
1182 1325
 			fclose($handle);
1183
-			if ($globalTransaction) $Connection->db->commit();
1326
+			if ($globalTransaction) {
1327
+				$Connection->db->commit();
1328
+			}
1184 1329
 		}
1185 1330
 		return '';
1186 1331
         }
@@ -1200,7 +1345,9 @@  discard block
 block discarded – undo
1200 1345
 		if (($handle = fopen($tmp_dir.'routes.tsv', 'r')) !== FALSE)
1201 1346
 		{
1202 1347
 			$i = 0;
1203
-			if ($globalTransaction) $Connection->db->beginTransaction();
1348
+			if ($globalTransaction) {
1349
+				$Connection->db->beginTransaction();
1350
+			}
1204 1351
 			while (($data = fgetcsv($handle, 1000, $delimiter)) !== FALSE)
1205 1352
 			{
1206 1353
 				if ($i > 0) {
@@ -1209,13 +1356,17 @@  discard block
 block discarded – undo
1209 1356
 						$sth = $Connection->db->prepare($query);
1210 1357
 						$sth->execute(array(':CallSign' => $data[0],':Operator_ICAO' => $data[1],':FromAirport_ICAO' => $data[2],':FromAirport_Time' => $data[3], ':ToAirport_ICAO' => $data[4],':ToAirport_Time' => $data[5],':RouteStop' => $data[6],':source' => 'website_fam'));
1211 1358
 					} catch(PDOException $e) {
1212
-						if ($globalDebug) echo "error: ".$e->getMessage()." - data: ".implode(',',$data);
1359
+						if ($globalDebug) {
1360
+							echo "error: ".$e->getMessage()." - data: ".implode(',',$data);
1361
+						}
1213 1362
 					}
1214 1363
 				}
1215 1364
 				$i++;
1216 1365
 			}
1217 1366
 			fclose($handle);
1218
-			if ($globalTransaction) $Connection->db->commit();
1367
+			if ($globalTransaction) {
1368
+				$Connection->db->commit();
1369
+			}
1219 1370
 		}
1220 1371
 		return '';
1221 1372
         }
@@ -1240,7 +1391,9 @@  discard block
 block discarded – undo
1240 1391
 			$i = 0;
1241 1392
 			//$Connection->db->setAttribute(PDO::ATTR_AUTOCOMMIT, FALSE);
1242 1393
 			//$Connection->db->beginTransaction();
1243
-			if ($globalTransaction) $Connection->db->beginTransaction();
1394
+			if ($globalTransaction) {
1395
+				$Connection->db->beginTransaction();
1396
+			}
1244 1397
 			while (($data = fgetcsv($handle, 1000, $delimiter)) !== FALSE)
1245 1398
 			{
1246 1399
 				if ($i > 0) {
@@ -1256,7 +1409,9 @@  discard block
 block discarded – undo
1256 1409
 				$i++;
1257 1410
 			}
1258 1411
 			fclose($handle);
1259
-			if ($globalTransaction) $Connection->db->commit();
1412
+			if ($globalTransaction) {
1413
+				$Connection->db->commit();
1414
+			}
1260 1415
 		}
1261 1416
 		return '';
1262 1417
         }
@@ -1276,7 +1431,9 @@  discard block
 block discarded – undo
1276 1431
 		if (($handle = fopen($tmp_dir.'satellite.tsv', 'r')) !== FALSE)
1277 1432
 		{
1278 1433
 			$i = 0;
1279
-			if ($globalTransaction) $Connection->db->beginTransaction();
1434
+			if ($globalTransaction) {
1435
+				$Connection->db->beginTransaction();
1436
+			}
1280 1437
 			while (($data = fgetcsv($handle, 1000, $delimiter)) !== FALSE)
1281 1438
 			{
1282 1439
 				if ($i > 0) {
@@ -1293,7 +1450,9 @@  discard block
 block discarded – undo
1293 1450
 				$i++;
1294 1451
 			}
1295 1452
 			fclose($handle);
1296
-			if ($globalTransaction) $Connection->db->commit();
1453
+			if ($globalTransaction) {
1454
+				$Connection->db->commit();
1455
+			}
1297 1456
 		}
1298 1457
 		return '';
1299 1458
 	}
@@ -1312,7 +1471,9 @@  discard block
 block discarded – undo
1312 1471
 		$Connection = new Connection();
1313 1472
 		if (($handle = fopen($tmp_dir.'ban_eu.csv', 'r')) !== FALSE)
1314 1473
 		{
1315
-			if ($globalTransaction) $Connection->db->beginTransaction();
1474
+			if ($globalTransaction) {
1475
+				$Connection->db->beginTransaction();
1476
+			}
1316 1477
 			while (($data = fgetcsv($handle, 1000)) !== FALSE)
1317 1478
 			{
1318 1479
 				$query = 'UPDATE airlines SET ban_eu = 1 WHERE icao = :icao AND forsource IS NULL';
@@ -1327,7 +1488,9 @@  discard block
 block discarded – undo
1327 1488
 				}
1328 1489
 			}
1329 1490
 			fclose($handle);
1330
-			if ($globalTransaction) $Connection->db->commit();
1491
+			if ($globalTransaction) {
1492
+				$Connection->db->commit();
1493
+			}
1331 1494
 		}
1332 1495
 		return '';
1333 1496
         }
@@ -1403,9 +1566,14 @@  discard block
 block discarded – undo
1403 1566
 				if ($i > 0 && $data[0] != '') {
1404 1567
 					$sources = trim($data[28].' '.$data[29].' '.$data[30].' '.$data[31].' '.$data[32].' '.$data[33]);
1405 1568
 					$period = str_replace(',','',$data[14]);
1406
-					if (!empty($period) && strpos($period,'days')) $period = str_replace(' days','',$period)*24*60;
1407
-					if ($data[18] != '') $launch_date = date('Y-m-d',strtotime($data[18]));
1408
-					else $launch_date = NULL;
1569
+					if (!empty($period) && strpos($period,'days')) {
1570
+						$period = str_replace(' days','',$period)*24*60;
1571
+					}
1572
+					if ($data[18] != '') {
1573
+						$launch_date = date('Y-m-d',strtotime($data[18]));
1574
+					} else {
1575
+						$launch_date = NULL;
1576
+					}
1409 1577
 					$data = array_map(function($value) {
1410 1578
 						return trim($value) === '' ? null : $value;
1411 1579
 					}, $data);
@@ -1755,7 +1923,9 @@  discard block
 block discarded – undo
1755 1923
 		if (($handle = fopen($filename, 'r')) !== FALSE)
1756 1924
 		{
1757 1925
 			$i = 0;
1758
-			if ($globalTransaction) $Connection->db->beginTransaction();
1926
+			if ($globalTransaction) {
1927
+				$Connection->db->beginTransaction();
1928
+			}
1759 1929
 			while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE)
1760 1930
 			{
1761 1931
 				$i++;
@@ -1783,7 +1953,9 @@  discard block
 block discarded – undo
1783 1953
 				}
1784 1954
 			}
1785 1955
 			fclose($handle);
1786
-			if ($globalTransaction) $Connection->db->commit();
1956
+			if ($globalTransaction) {
1957
+				$Connection->db->commit();
1958
+			}
1787 1959
 		}
1788 1960
 		return '';
1789 1961
         }
@@ -1806,7 +1978,9 @@  discard block
 block discarded – undo
1806 1978
 		$Connection = new Connection();
1807 1979
 		if (($handle = fopen($filename, 'r')) !== FALSE)
1808 1980
 		{
1809
-			if ($globalTransaction) $Connection->db->beginTransaction();
1981
+			if ($globalTransaction) {
1982
+				$Connection->db->beginTransaction();
1983
+			}
1810 1984
 			while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE)
1811 1985
 			{
1812 1986
 				if(count($row) > 1) {
@@ -1820,7 +1994,9 @@  discard block
 block discarded – undo
1820 1994
 				}
1821 1995
 			}
1822 1996
 			fclose($handle);
1823
-			if ($globalTransaction) $Connection->db->commit();
1997
+			if ($globalTransaction) {
1998
+				$Connection->db->commit();
1999
+			}
1824 2000
 		}
1825 2001
 		return '';
1826 2002
         }
@@ -1840,8 +2016,9 @@  discard block
 block discarded – undo
1840 2016
 	        }
1841 2017
 
1842 2018
 
1843
-		if ($globalDBdriver == 'mysql') update_db::gunzip('../db/airspace.sql.gz',$tmp_dir.'airspace.sql');
1844
-		else {
2019
+		if ($globalDBdriver == 'mysql') {
2020
+			update_db::gunzip('../db/airspace.sql.gz',$tmp_dir.'airspace.sql');
2021
+		} else {
1845 2022
 			update_db::gunzip('../db/pgsql/airspace.sql.gz',$tmp_dir.'airspace.sql');
1846 2023
 			$query = "CREATE EXTENSION postgis";
1847 2024
 			$Connection = new Connection(null,null,$_SESSION['database_root'],$_SESSION['database_rootpass']);
@@ -1860,20 +2037,30 @@  discard block
 block discarded – undo
1860 2037
 		global $tmp_dir, $globalDebug;
1861 2038
 		include_once('class.create_db.php');
1862 2039
 		require_once(dirname(__FILE__).'/../require/class.NOTAM.php');
1863
-		if ($globalDebug) echo "NOTAM from FlightAirMap website : Download...";
2040
+		if ($globalDebug) {
2041
+			echo "NOTAM from FlightAirMap website : Download...";
2042
+		}
1864 2043
 		update_db::download('http://data.flightairmap.fr/data/notam.txt.gz',$tmp_dir.'notam.txt.gz');
1865 2044
 		$error = '';
1866 2045
 		if (file_exists($tmp_dir.'notam.txt.gz')) {
1867
-			if ($globalDebug) echo "Gunzip...";
2046
+			if ($globalDebug) {
2047
+				echo "Gunzip...";
2048
+			}
1868 2049
 			update_db::gunzip($tmp_dir.'notam.txt.gz');
1869
-			if ($globalDebug) echo "Add to DB...";
2050
+			if ($globalDebug) {
2051
+				echo "Add to DB...";
2052
+			}
1870 2053
 			//$error = create_db::import_file($tmp_dir.'notam.sql');
1871 2054
 			$NOTAM = new NOTAM();
1872 2055
 			$NOTAM->updateNOTAMfromTextFile($tmp_dir.'notam.txt');
1873
-		} else $error = "File ".$tmp_dir.'notam.txt.gz'." doesn't exist. Download failed.";
2056
+		} else {
2057
+			$error = "File ".$tmp_dir.'notam.txt.gz'." doesn't exist. Download failed.";
2058
+		}
1874 2059
 		if ($error != '') {
1875 2060
 			return $error;
1876
-		} elseif ($globalDebug) echo "Done\n";
2061
+		} elseif ($globalDebug) {
2062
+			echo "Done\n";
2063
+		}
1877 2064
 		return '';
1878 2065
 	}
1879 2066
 
@@ -1927,67 +2114,111 @@  discard block
 block discarded – undo
1927 2114
 		//if ($globalDebug) echo "IVAO : Download...";
1928 2115
 		//update_db::download('http://fr.mirror.ivao.aero/software/ivae_feb2013.zip',$tmp_dir.'ivae_feb2013.zip');
1929 2116
 		if (file_exists($tmp_dir.'ivae_feb2013.zip')) {
1930
-			if ($globalDebug) echo "Unzip...";
2117
+			if ($globalDebug) {
2118
+				echo "Unzip...";
2119
+			}
1931 2120
 			update_db::unzip($tmp_dir.'ivae_feb2013.zip');
1932
-			if ($globalDebug) echo "Add to DB...";
2121
+			if ($globalDebug) {
2122
+				echo "Add to DB...";
2123
+			}
1933 2124
 			update_db::ivao_airlines($tmp_dir.'data/airlines.dat');
1934
-			if ($globalDebug) echo "Copy airlines logos to airlines images directory...";
2125
+			if ($globalDebug) {
2126
+				echo "Copy airlines logos to airlines images directory...";
2127
+			}
1935 2128
 			if (is_writable(dirname(__FILE__).'/../images/airlines')) {
1936
-				if (!$Common->xcopy($tmp_dir.'logos/',dirname(__FILE__).'/../images/airlines/')) $error = "Failed to copy airlines logo.";
1937
-			} else $error = "The directory ".dirname(__FILE__).'/../images/airlines'." must be writable";
1938
-		} else $error = "File ".$tmp_dir.'ivao.zip'." doesn't exist. Download failed.";
2129
+				if (!$Common->xcopy($tmp_dir.'logos/',dirname(__FILE__).'/../images/airlines/')) {
2130
+					$error = "Failed to copy airlines logo.";
2131
+				}
2132
+			} else {
2133
+				$error = "The directory ".dirname(__FILE__).'/../images/airlines'." must be writable";
2134
+			}
2135
+		} else {
2136
+			$error = "File ".$tmp_dir.'ivao.zip'." doesn't exist. Download failed.";
2137
+		}
1939 2138
 		if ($error != '') {
1940 2139
 			return $error;
1941
-		} elseif ($globalDebug) echo "Done\n";
2140
+		} elseif ($globalDebug) {
2141
+			echo "Done\n";
2142
+		}
1942 2143
 		return '';
1943 2144
 	}
1944 2145
 
1945 2146
 	public static function update_routes() {
1946 2147
 		global $tmp_dir, $globalDebug;
1947 2148
 		$error = '';
1948
-		if ($globalDebug) echo "Routes : Download...";
2149
+		if ($globalDebug) {
2150
+			echo "Routes : Download...";
2151
+		}
1949 2152
 		update_db::download('http://www.virtualradarserver.co.uk/Files/StandingData.sqb.gz',$tmp_dir.'StandingData.sqb.gz');
1950 2153
 		if (file_exists($tmp_dir.'StandingData.sqb.gz')) {
1951
-			if ($globalDebug) echo "Gunzip...";
2154
+			if ($globalDebug) {
2155
+				echo "Gunzip...";
2156
+			}
1952 2157
 			update_db::gunzip($tmp_dir.'StandingData.sqb.gz');
1953
-			if ($globalDebug) echo "Add to DB...";
2158
+			if ($globalDebug) {
2159
+				echo "Add to DB...";
2160
+			}
1954 2161
 			$error = update_db::retrieve_route_sqlite_to_dest($tmp_dir.'StandingData.sqb');
1955
-		} else $error = "File ".$tmp_dir.'StandingData.sqb.gz'." doesn't exist. Download failed.";
2162
+		} else {
2163
+			$error = "File ".$tmp_dir.'StandingData.sqb.gz'." doesn't exist. Download failed.";
2164
+		}
1956 2165
 		if ($error != '') {
1957 2166
 			return $error;
1958
-		} elseif ($globalDebug) echo "Done\n";
2167
+		} elseif ($globalDebug) {
2168
+			echo "Done\n";
2169
+		}
1959 2170
 		return '';
1960 2171
 	}
1961 2172
 	public static function update_oneworld() {
1962 2173
 		global $tmp_dir, $globalDebug;
1963 2174
 		$error = '';
1964
-		if ($globalDebug) echo "Schedules Oneworld : Download...";
2175
+		if ($globalDebug) {
2176
+			echo "Schedules Oneworld : Download...";
2177
+		}
1965 2178
 		update_db::download('http://data.flightairmap.fr/data/schedules/oneworld.csv.gz',$tmp_dir.'oneworld.csv.gz');
1966 2179
 		if (file_exists($tmp_dir.'oneworld.csv.gz')) {
1967
-			if ($globalDebug) echo "Gunzip...";
2180
+			if ($globalDebug) {
2181
+				echo "Gunzip...";
2182
+			}
1968 2183
 			update_db::gunzip($tmp_dir.'oneworld.csv.gz');
1969
-			if ($globalDebug) echo "Add to DB...";
2184
+			if ($globalDebug) {
2185
+				echo "Add to DB...";
2186
+			}
1970 2187
 			$error = update_db::retrieve_route_oneworld($tmp_dir.'oneworld.csv');
1971
-		} else $error = "File ".$tmp_dir.'oneworld.csv.gz'." doesn't exist. Download failed.";
2188
+		} else {
2189
+			$error = "File ".$tmp_dir.'oneworld.csv.gz'." doesn't exist. Download failed.";
2190
+		}
1972 2191
 		if ($error != '') {
1973 2192
 			return $error;
1974
-		} elseif ($globalDebug) echo "Done\n";
2193
+		} elseif ($globalDebug) {
2194
+			echo "Done\n";
2195
+		}
1975 2196
 		return '';
1976 2197
 	}
1977 2198
 	public static function update_skyteam() {
1978 2199
 		global $tmp_dir, $globalDebug;
1979 2200
 		$error = '';
1980
-		if ($globalDebug) echo "Schedules Skyteam : Download...";
2201
+		if ($globalDebug) {
2202
+			echo "Schedules Skyteam : Download...";
2203
+		}
1981 2204
 		update_db::download('http://data.flightairmap.fr/data/schedules/skyteam.csv.gz',$tmp_dir.'skyteam.csv.gz');
1982 2205
 		if (file_exists($tmp_dir.'skyteam.csv.gz')) {
1983
-			if ($globalDebug) echo "Gunzip...";
2206
+			if ($globalDebug) {
2207
+				echo "Gunzip...";
2208
+			}
1984 2209
 			update_db::gunzip($tmp_dir.'skyteam.csv.gz');
1985
-			if ($globalDebug) echo "Add to DB...";
2210
+			if ($globalDebug) {
2211
+				echo "Add to DB...";
2212
+			}
1986 2213
 			$error = update_db::retrieve_route_skyteam($tmp_dir.'skyteam.csv');
1987
-		} else $error = "File ".$tmp_dir.'skyteam.csv.gz'." doesn't exist. Download failed.";
2214
+		} else {
2215
+			$error = "File ".$tmp_dir.'skyteam.csv.gz'." doesn't exist. Download failed.";
2216
+		}
1988 2217
 		if ($error != '') {
1989 2218
 			return $error;
1990
-		} elseif ($globalDebug) echo "Done\n";
2219
+		} elseif ($globalDebug) {
2220
+			echo "Done\n";
2221
+		}
1991 2222
 		return '';
1992 2223
 	}
1993 2224
 	public static function update_ModeS() {
@@ -2004,355 +2235,619 @@  discard block
 block discarded – undo
2004 2235
 			exit;
2005 2236
 		} elseif ($globalDebug) echo "Done\n";
2006 2237
 */
2007
-		if ($globalDebug) echo "Modes : Download...";
2008
-//		update_db::download('http://planebase.biz/sqb.php?f=basestationall.zip',$tmp_dir.'basestation_latest.zip','http://planebase.biz/bstnsqb');
2238
+		if ($globalDebug) {
2239
+			echo "Modes : Download...";
2240
+		}
2241
+		//		update_db::download('http://planebase.biz/sqb.php?f=basestationall.zip',$tmp_dir.'basestation_latest.zip','http://planebase.biz/bstnsqb');
2009 2242
 		update_db::download('http://data.flightairmap.fr/data/BaseStation.sqb.gz',$tmp_dir.'BaseStation.sqb.gz');
2010 2243
 
2011 2244
 //		if (file_exists($tmp_dir.'basestation_latest.zip')) {
2012 2245
 		if (file_exists($tmp_dir.'BaseStation.sqb.gz')) {
2013
-			if ($globalDebug) echo "Unzip...";
2014
-//			update_db::unzip($tmp_dir.'basestation_latest.zip');
2246
+			if ($globalDebug) {
2247
+				echo "Unzip...";
2248
+			}
2249
+			//			update_db::unzip($tmp_dir.'basestation_latest.zip');
2015 2250
 			update_db::gunzip($tmp_dir.'BaseStation.sqb.gz');
2016
-			if ($globalDebug) echo "Add to DB...";
2251
+			if ($globalDebug) {
2252
+				echo "Add to DB...";
2253
+			}
2017 2254
 			$error = update_db::retrieve_modes_sqlite_to_dest($tmp_dir.'BaseStation.sqb');
2018 2255
 //			$error = update_db::retrieve_modes_sqlite_to_dest($tmp_dir.'basestation.sqb');
2019
-		} else $error = "File ".$tmp_dir.'basestation_latest.zip'." doesn't exist. Download failed.";
2256
+		} else {
2257
+			$error = "File ".$tmp_dir.'basestation_latest.zip'." doesn't exist. Download failed.";
2258
+		}
2020 2259
 		if ($error != '') {
2021 2260
 			return $error;
2022
-		} elseif ($globalDebug) echo "Done\n";
2261
+		} elseif ($globalDebug) {
2262
+			echo "Done\n";
2263
+		}
2023 2264
 		return '';
2024 2265
 	}
2025 2266
 
2026 2267
 	public static function update_ModeS_faa() {
2027 2268
 		global $tmp_dir, $globalDebug;
2028
-		if ($globalDebug) echo "Modes FAA: Download...";
2269
+		if ($globalDebug) {
2270
+			echo "Modes FAA: Download...";
2271
+		}
2029 2272
 		update_db::download('http://registry.faa.gov/database/ReleasableAircraft.zip',$tmp_dir.'ReleasableAircraft.zip');
2030 2273
 		if (file_exists($tmp_dir.'ReleasableAircraft.zip')) {
2031
-			if ($globalDebug) echo "Unzip...";
2274
+			if ($globalDebug) {
2275
+				echo "Unzip...";
2276
+			}
2032 2277
 			update_db::unzip($tmp_dir.'ReleasableAircraft.zip');
2033
-			if ($globalDebug) echo "Add to DB...";
2278
+			if ($globalDebug) {
2279
+				echo "Add to DB...";
2280
+			}
2034 2281
 			$error = update_db::modes_faa();
2035
-		} else $error = "File ".$tmp_dir.'ReleasableAircraft.zip'." doesn't exist. Download failed.";
2282
+		} else {
2283
+			$error = "File ".$tmp_dir.'ReleasableAircraft.zip'." doesn't exist. Download failed.";
2284
+		}
2036 2285
 		if ($error != '') {
2037 2286
 			return $error;
2038
-		} elseif ($globalDebug) echo "Done\n";
2287
+		} elseif ($globalDebug) {
2288
+			echo "Done\n";
2289
+		}
2039 2290
 		return '';
2040 2291
 	}
2041 2292
 
2042 2293
 	public static function update_ModeS_flarm() {
2043 2294
 		global $tmp_dir, $globalDebug;
2044
-		if ($globalDebug) echo "Modes Flarmnet: Download...";
2295
+		if ($globalDebug) {
2296
+			echo "Modes Flarmnet: Download...";
2297
+		}
2045 2298
 		update_db::download('http://flarmnet.org/files/data.fln',$tmp_dir.'data.fln');
2046 2299
 		if (file_exists($tmp_dir.'data.fln')) {
2047
-			if ($globalDebug) echo "Add to DB...";
2300
+			if ($globalDebug) {
2301
+				echo "Add to DB...";
2302
+			}
2048 2303
 			$error = update_db::retrieve_modes_flarmnet($tmp_dir.'data.fln');
2049
-		} else $error = "File ".$tmp_dir.'data.fln'." doesn't exist. Download failed.";
2304
+		} else {
2305
+			$error = "File ".$tmp_dir.'data.fln'." doesn't exist. Download failed.";
2306
+		}
2050 2307
 		if ($error != '') {
2051 2308
 			return $error;
2052
-		} elseif ($globalDebug) echo "Done\n";
2309
+		} elseif ($globalDebug) {
2310
+			echo "Done\n";
2311
+		}
2053 2312
 		return '';
2054 2313
 	}
2055 2314
 
2056 2315
 	public static function update_ModeS_ogn() {
2057 2316
 		global $tmp_dir, $globalDebug;
2058
-		if ($globalDebug) echo "Modes OGN: Download...";
2317
+		if ($globalDebug) {
2318
+			echo "Modes OGN: Download...";
2319
+		}
2059 2320
 		update_db::download('http://ddb.glidernet.org/download/',$tmp_dir.'ogn.csv');
2060 2321
 		if (file_exists($tmp_dir.'ogn.csv')) {
2061
-			if ($globalDebug) echo "Add to DB...";
2322
+			if ($globalDebug) {
2323
+				echo "Add to DB...";
2324
+			}
2062 2325
 			$error = update_db::retrieve_modes_ogn($tmp_dir.'ogn.csv');
2063
-		} else $error = "File ".$tmp_dir.'ogn.csv'." doesn't exist. Download failed.";
2326
+		} else {
2327
+			$error = "File ".$tmp_dir.'ogn.csv'." doesn't exist. Download failed.";
2328
+		}
2064 2329
 		if ($error != '') {
2065 2330
 			return $error;
2066
-		} elseif ($globalDebug) echo "Done\n";
2331
+		} elseif ($globalDebug) {
2332
+			echo "Done\n";
2333
+		}
2067 2334
 		return '';
2068 2335
 	}
2069 2336
 
2070 2337
 	public static function update_owner() {
2071 2338
 		global $tmp_dir, $globalDebug, $globalMasterSource;
2072 2339
 		
2073
-		if ($globalDebug) echo "Owner France: Download...";
2340
+		if ($globalDebug) {
2341
+			echo "Owner France: Download...";
2342
+		}
2074 2343
 		update_db::download('http://antonakis.co.uk/registers/France.txt',$tmp_dir.'owner_f.csv');
2075 2344
 		if (file_exists($tmp_dir.'owner_f.csv')) {
2076
-			if ($globalDebug) echo "Add to DB...";
2345
+			if ($globalDebug) {
2346
+				echo "Add to DB...";
2347
+			}
2077 2348
 			$error = update_db::retrieve_owner($tmp_dir.'owner_f.csv','F');
2078
-		} else $error = "File ".$tmp_dir.'owner_f.csv'." doesn't exist. Download failed.";
2349
+		} else {
2350
+			$error = "File ".$tmp_dir.'owner_f.csv'." doesn't exist. Download failed.";
2351
+		}
2079 2352
 		if ($error != '') {
2080 2353
 			return $error;
2081
-		} elseif ($globalDebug) echo "Done\n";
2354
+		} elseif ($globalDebug) {
2355
+			echo "Done\n";
2356
+		}
2082 2357
 		
2083
-		if ($globalDebug) echo "Owner Ireland: Download...";
2358
+		if ($globalDebug) {
2359
+			echo "Owner Ireland: Download...";
2360
+		}
2084 2361
 		update_db::download('http://antonakis.co.uk/registers/Ireland.txt',$tmp_dir.'owner_ei.csv');
2085 2362
 		if (file_exists($tmp_dir.'owner_ei.csv')) {
2086
-			if ($globalDebug) echo "Add to DB...";
2363
+			if ($globalDebug) {
2364
+				echo "Add to DB...";
2365
+			}
2087 2366
 			$error = update_db::retrieve_owner($tmp_dir.'owner_ei.csv','EI');
2088
-		} else $error = "File ".$tmp_dir.'owner_ei.csv'." doesn't exist. Download failed.";
2367
+		} else {
2368
+			$error = "File ".$tmp_dir.'owner_ei.csv'." doesn't exist. Download failed.";
2369
+		}
2089 2370
 		if ($error != '') {
2090 2371
 			return $error;
2091
-		} elseif ($globalDebug) echo "Done\n";
2092
-		if ($globalDebug) echo "Owner Switzerland: Download...";
2372
+		} elseif ($globalDebug) {
2373
+			echo "Done\n";
2374
+		}
2375
+		if ($globalDebug) {
2376
+			echo "Owner Switzerland: Download...";
2377
+		}
2093 2378
 		update_db::download('http://antonakis.co.uk/registers/Switzerland.txt',$tmp_dir.'owner_hb.csv');
2094 2379
 		if (file_exists($tmp_dir.'owner_hb.csv')) {
2095
-			if ($globalDebug) echo "Add to DB...";
2380
+			if ($globalDebug) {
2381
+				echo "Add to DB...";
2382
+			}
2096 2383
 			$error = update_db::retrieve_owner($tmp_dir.'owner_hb.csv','HB');
2097
-		} else $error = "File ".$tmp_dir.'owner_hb.csv'." doesn't exist. Download failed.";
2384
+		} else {
2385
+			$error = "File ".$tmp_dir.'owner_hb.csv'." doesn't exist. Download failed.";
2386
+		}
2098 2387
 		if ($error != '') {
2099 2388
 			return $error;
2100
-		} elseif ($globalDebug) echo "Done\n";
2101
-		if ($globalDebug) echo "Owner Czech Republic: Download...";
2389
+		} elseif ($globalDebug) {
2390
+			echo "Done\n";
2391
+		}
2392
+		if ($globalDebug) {
2393
+			echo "Owner Czech Republic: Download...";
2394
+		}
2102 2395
 		update_db::download('http://antonakis.co.uk/registers/CzechRepublic.txt',$tmp_dir.'owner_ok.csv');
2103 2396
 		if (file_exists($tmp_dir.'owner_ok.csv')) {
2104
-			if ($globalDebug) echo "Add to DB...";
2397
+			if ($globalDebug) {
2398
+				echo "Add to DB...";
2399
+			}
2105 2400
 			$error = update_db::retrieve_owner($tmp_dir.'owner_ok.csv','OK');
2106
-		} else $error = "File ".$tmp_dir.'owner_ok.csv'." doesn't exist. Download failed.";
2401
+		} else {
2402
+			$error = "File ".$tmp_dir.'owner_ok.csv'." doesn't exist. Download failed.";
2403
+		}
2107 2404
 		if ($error != '') {
2108 2405
 			return $error;
2109
-		} elseif ($globalDebug) echo "Done\n";
2110
-		if ($globalDebug) echo "Owner Australia: Download...";
2406
+		} elseif ($globalDebug) {
2407
+			echo "Done\n";
2408
+		}
2409
+		if ($globalDebug) {
2410
+			echo "Owner Australia: Download...";
2411
+		}
2111 2412
 		update_db::download('http://antonakis.co.uk/registers/Australia.txt',$tmp_dir.'owner_vh.csv');
2112 2413
 		if (file_exists($tmp_dir.'owner_vh.csv')) {
2113
-			if ($globalDebug) echo "Add to DB...";
2414
+			if ($globalDebug) {
2415
+				echo "Add to DB...";
2416
+			}
2114 2417
 			$error = update_db::retrieve_owner($tmp_dir.'owner_vh.csv','VH');
2115
-		} else $error = "File ".$tmp_dir.'owner_vh.csv'." doesn't exist. Download failed.";
2418
+		} else {
2419
+			$error = "File ".$tmp_dir.'owner_vh.csv'." doesn't exist. Download failed.";
2420
+		}
2116 2421
 		if ($error != '') {
2117 2422
 			return $error;
2118
-		} elseif ($globalDebug) echo "Done\n";
2119
-		if ($globalDebug) echo "Owner Austria: Download...";
2423
+		} elseif ($globalDebug) {
2424
+			echo "Done\n";
2425
+		}
2426
+		if ($globalDebug) {
2427
+			echo "Owner Austria: Download...";
2428
+		}
2120 2429
 		update_db::download('http://antonakis.co.uk/registers/Austria.txt',$tmp_dir.'owner_oe.csv');
2121 2430
 		if (file_exists($tmp_dir.'owner_oe.csv')) {
2122
-			if ($globalDebug) echo "Add to DB...";
2431
+			if ($globalDebug) {
2432
+				echo "Add to DB...";
2433
+			}
2123 2434
 			$error = update_db::retrieve_owner($tmp_dir.'owner_oe.csv','OE');
2124
-		} else $error = "File ".$tmp_dir.'owner_oe.csv'." doesn't exist. Download failed.";
2435
+		} else {
2436
+			$error = "File ".$tmp_dir.'owner_oe.csv'." doesn't exist. Download failed.";
2437
+		}
2125 2438
 		if ($error != '') {
2126 2439
 			return $error;
2127
-		} elseif ($globalDebug) echo "Done\n";
2128
-		if ($globalDebug) echo "Owner Chile: Download...";
2440
+		} elseif ($globalDebug) {
2441
+			echo "Done\n";
2442
+		}
2443
+		if ($globalDebug) {
2444
+			echo "Owner Chile: Download...";
2445
+		}
2129 2446
 		update_db::download('http://antonakis.co.uk/registers/Chile.txt',$tmp_dir.'owner_cc.csv');
2130 2447
 		if (file_exists($tmp_dir.'owner_cc.csv')) {
2131
-			if ($globalDebug) echo "Add to DB...";
2448
+			if ($globalDebug) {
2449
+				echo "Add to DB...";
2450
+			}
2132 2451
 			$error = update_db::retrieve_owner($tmp_dir.'owner_cc.csv','CC');
2133
-		} else $error = "File ".$tmp_dir.'owner_cc.csv'." doesn't exist. Download failed.";
2452
+		} else {
2453
+			$error = "File ".$tmp_dir.'owner_cc.csv'." doesn't exist. Download failed.";
2454
+		}
2134 2455
 		if ($error != '') {
2135 2456
 			return $error;
2136
-		} elseif ($globalDebug) echo "Done\n";
2137
-		if ($globalDebug) echo "Owner Colombia: Download...";
2457
+		} elseif ($globalDebug) {
2458
+			echo "Done\n";
2459
+		}
2460
+		if ($globalDebug) {
2461
+			echo "Owner Colombia: Download...";
2462
+		}
2138 2463
 		update_db::download('http://antonakis.co.uk/registers/Colombia.txt',$tmp_dir.'owner_hj.csv');
2139 2464
 		if (file_exists($tmp_dir.'owner_hj.csv')) {
2140
-			if ($globalDebug) echo "Add to DB...";
2465
+			if ($globalDebug) {
2466
+				echo "Add to DB...";
2467
+			}
2141 2468
 			$error = update_db::retrieve_owner($tmp_dir.'owner_hj.csv','HJ');
2142
-		} else $error = "File ".$tmp_dir.'owner_hj.csv'." doesn't exist. Download failed.";
2469
+		} else {
2470
+			$error = "File ".$tmp_dir.'owner_hj.csv'." doesn't exist. Download failed.";
2471
+		}
2143 2472
 		if ($error != '') {
2144 2473
 			return $error;
2145
-		} elseif ($globalDebug) echo "Done\n";
2146
-		if ($globalDebug) echo "Owner Bosnia Herzegobina: Download...";
2474
+		} elseif ($globalDebug) {
2475
+			echo "Done\n";
2476
+		}
2477
+		if ($globalDebug) {
2478
+			echo "Owner Bosnia Herzegobina: Download...";
2479
+		}
2147 2480
 		update_db::download('http://antonakis.co.uk/registers/BosniaHerzegovina.txt',$tmp_dir.'owner_e7.csv');
2148 2481
 		if (file_exists($tmp_dir.'owner_e7.csv')) {
2149
-			if ($globalDebug) echo "Add to DB...";
2482
+			if ($globalDebug) {
2483
+				echo "Add to DB...";
2484
+			}
2150 2485
 			$error = update_db::retrieve_owner($tmp_dir.'owner_e7.csv','E7');
2151
-		} else $error = "File ".$tmp_dir.'owner_e7.csv'." doesn't exist. Download failed.";
2486
+		} else {
2487
+			$error = "File ".$tmp_dir.'owner_e7.csv'." doesn't exist. Download failed.";
2488
+		}
2152 2489
 		if ($error != '') {
2153 2490
 			return $error;
2154
-		} elseif ($globalDebug) echo "Done\n";
2155
-		if ($globalDebug) echo "Owner Brazil: Download...";
2491
+		} elseif ($globalDebug) {
2492
+			echo "Done\n";
2493
+		}
2494
+		if ($globalDebug) {
2495
+			echo "Owner Brazil: Download...";
2496
+		}
2156 2497
 		update_db::download('http://antonakis.co.uk/registers/Brazil.txt',$tmp_dir.'owner_pp.csv');
2157 2498
 		if (file_exists($tmp_dir.'owner_pp.csv')) {
2158
-			if ($globalDebug) echo "Add to DB...";
2499
+			if ($globalDebug) {
2500
+				echo "Add to DB...";
2501
+			}
2159 2502
 			$error = update_db::retrieve_owner($tmp_dir.'owner_pp.csv','PP');
2160
-		} else $error = "File ".$tmp_dir.'owner_pp.csv'." doesn't exist. Download failed.";
2503
+		} else {
2504
+			$error = "File ".$tmp_dir.'owner_pp.csv'." doesn't exist. Download failed.";
2505
+		}
2161 2506
 		if ($error != '') {
2162 2507
 			return $error;
2163
-		} elseif ($globalDebug) echo "Done\n";
2164
-		if ($globalDebug) echo "Owner Cayman Islands: Download...";
2508
+		} elseif ($globalDebug) {
2509
+			echo "Done\n";
2510
+		}
2511
+		if ($globalDebug) {
2512
+			echo "Owner Cayman Islands: Download...";
2513
+		}
2165 2514
 		update_db::download('http://antonakis.co.uk/registers/CaymanIslands.txt',$tmp_dir.'owner_vp.csv');
2166 2515
 		if (file_exists($tmp_dir.'owner_vp.csv')) {
2167
-			if ($globalDebug) echo "Add to DB...";
2516
+			if ($globalDebug) {
2517
+				echo "Add to DB...";
2518
+			}
2168 2519
 			$error = update_db::retrieve_owner($tmp_dir.'owner_vp.csv','VP');
2169
-		} else $error = "File ".$tmp_dir.'owner_vp.csv'." doesn't exist. Download failed.";
2520
+		} else {
2521
+			$error = "File ".$tmp_dir.'owner_vp.csv'." doesn't exist. Download failed.";
2522
+		}
2170 2523
 		if ($error != '') {
2171 2524
 			return $error;
2172
-		} elseif ($globalDebug) echo "Done\n";
2173
-		if ($globalDebug) echo "Owner Croatia: Download...";
2525
+		} elseif ($globalDebug) {
2526
+			echo "Done\n";
2527
+		}
2528
+		if ($globalDebug) {
2529
+			echo "Owner Croatia: Download...";
2530
+		}
2174 2531
 		update_db::download('http://antonakis.co.uk/registers/Croatia.txt',$tmp_dir.'owner_9a.csv');
2175 2532
 		if (file_exists($tmp_dir.'owner_9a.csv')) {
2176
-			if ($globalDebug) echo "Add to DB...";
2533
+			if ($globalDebug) {
2534
+				echo "Add to DB...";
2535
+			}
2177 2536
 			$error = update_db::retrieve_owner($tmp_dir.'owner_9a.csv','9A');
2178
-		} else $error = "File ".$tmp_dir.'owner_9a.csv'." doesn't exist. Download failed.";
2537
+		} else {
2538
+			$error = "File ".$tmp_dir.'owner_9a.csv'." doesn't exist. Download failed.";
2539
+		}
2179 2540
 		if ($error != '') {
2180 2541
 			return $error;
2181
-		} elseif ($globalDebug) echo "Done\n";
2182
-		if ($globalDebug) echo "Owner Luxembourg: Download...";
2542
+		} elseif ($globalDebug) {
2543
+			echo "Done\n";
2544
+		}
2545
+		if ($globalDebug) {
2546
+			echo "Owner Luxembourg: Download...";
2547
+		}
2183 2548
 		update_db::download('http://antonakis.co.uk/registers/Luxembourg.txt',$tmp_dir.'owner_lx.csv');
2184 2549
 		if (file_exists($tmp_dir.'owner_lx.csv')) {
2185
-			if ($globalDebug) echo "Add to DB...";
2550
+			if ($globalDebug) {
2551
+				echo "Add to DB...";
2552
+			}
2186 2553
 			$error = update_db::retrieve_owner($tmp_dir.'owner_lx.csv','LX');
2187
-		} else $error = "File ".$tmp_dir.'owner_lx.csv'." doesn't exist. Download failed.";
2554
+		} else {
2555
+			$error = "File ".$tmp_dir.'owner_lx.csv'." doesn't exist. Download failed.";
2556
+		}
2188 2557
 		if ($error != '') {
2189 2558
 			return $error;
2190
-		} elseif ($globalDebug) echo "Done\n";
2191
-		if ($globalDebug) echo "Owner Maldives: Download...";
2559
+		} elseif ($globalDebug) {
2560
+			echo "Done\n";
2561
+		}
2562
+		if ($globalDebug) {
2563
+			echo "Owner Maldives: Download...";
2564
+		}
2192 2565
 		update_db::download('http://antonakis.co.uk/registers/Maldives.txt',$tmp_dir.'owner_8q.csv');
2193 2566
 		if (file_exists($tmp_dir.'owner_8q.csv')) {
2194
-			if ($globalDebug) echo "Add to DB...";
2567
+			if ($globalDebug) {
2568
+				echo "Add to DB...";
2569
+			}
2195 2570
 			$error = update_db::retrieve_owner($tmp_dir.'owner_8q.csv','8Q');
2196
-		} else $error = "File ".$tmp_dir.'owner_8q.csv'." doesn't exist. Download failed.";
2571
+		} else {
2572
+			$error = "File ".$tmp_dir.'owner_8q.csv'." doesn't exist. Download failed.";
2573
+		}
2197 2574
 		if ($error != '') {
2198 2575
 			return $error;
2199
-		} elseif ($globalDebug) echo "Done\n";
2200
-		if ($globalDebug) echo "Owner New Zealand: Download...";
2576
+		} elseif ($globalDebug) {
2577
+			echo "Done\n";
2578
+		}
2579
+		if ($globalDebug) {
2580
+			echo "Owner New Zealand: Download...";
2581
+		}
2201 2582
 		update_db::download('http://antonakis.co.uk/registers/NewZealand.txt',$tmp_dir.'owner_zk.csv');
2202 2583
 		if (file_exists($tmp_dir.'owner_zk.csv')) {
2203
-			if ($globalDebug) echo "Add to DB...";
2584
+			if ($globalDebug) {
2585
+				echo "Add to DB...";
2586
+			}
2204 2587
 			$error = update_db::retrieve_owner($tmp_dir.'owner_zk.csv','ZK');
2205
-		} else $error = "File ".$tmp_dir.'owner_zk.csv'." doesn't exist. Download failed.";
2588
+		} else {
2589
+			$error = "File ".$tmp_dir.'owner_zk.csv'." doesn't exist. Download failed.";
2590
+		}
2206 2591
 		if ($error != '') {
2207 2592
 			return $error;
2208
-		} elseif ($globalDebug) echo "Done\n";
2209
-		if ($globalDebug) echo "Owner Papua New Guinea: Download...";
2593
+		} elseif ($globalDebug) {
2594
+			echo "Done\n";
2595
+		}
2596
+		if ($globalDebug) {
2597
+			echo "Owner Papua New Guinea: Download...";
2598
+		}
2210 2599
 		update_db::download('http://antonakis.co.uk/registers/PapuaNewGuinea.txt',$tmp_dir.'owner_p2.csv');
2211 2600
 		if (file_exists($tmp_dir.'owner_p2.csv')) {
2212
-			if ($globalDebug) echo "Add to DB...";
2601
+			if ($globalDebug) {
2602
+				echo "Add to DB...";
2603
+			}
2213 2604
 			$error = update_db::retrieve_owner($tmp_dir.'owner_p2.csv','P2');
2214
-		} else $error = "File ".$tmp_dir.'owner_p2.csv'." doesn't exist. Download failed.";
2605
+		} else {
2606
+			$error = "File ".$tmp_dir.'owner_p2.csv'." doesn't exist. Download failed.";
2607
+		}
2215 2608
 		if ($error != '') {
2216 2609
 			return $error;
2217
-		} elseif ($globalDebug) echo "Done\n";
2218
-		if ($globalDebug) echo "Owner Slovakia: Download...";
2610
+		} elseif ($globalDebug) {
2611
+			echo "Done\n";
2612
+		}
2613
+		if ($globalDebug) {
2614
+			echo "Owner Slovakia: Download...";
2615
+		}
2219 2616
 		update_db::download('http://antonakis.co.uk/registers/Slovakia.txt',$tmp_dir.'owner_om.csv');
2220 2617
 		if (file_exists($tmp_dir.'owner_om.csv')) {
2221
-			if ($globalDebug) echo "Add to DB...";
2618
+			if ($globalDebug) {
2619
+				echo "Add to DB...";
2620
+			}
2222 2621
 			$error = update_db::retrieve_owner($tmp_dir.'owner_om.csv','OM');
2223
-		} else $error = "File ".$tmp_dir.'owner_om.csv'." doesn't exist. Download failed.";
2622
+		} else {
2623
+			$error = "File ".$tmp_dir.'owner_om.csv'." doesn't exist. Download failed.";
2624
+		}
2224 2625
 		if ($error != '') {
2225 2626
 			return $error;
2226
-		} elseif ($globalDebug) echo "Done\n";
2227
-		if ($globalDebug) echo "Owner Ecuador: Download...";
2627
+		} elseif ($globalDebug) {
2628
+			echo "Done\n";
2629
+		}
2630
+		if ($globalDebug) {
2631
+			echo "Owner Ecuador: Download...";
2632
+		}
2228 2633
 		update_db::download('http://antonakis.co.uk/registers/Ecuador.txt',$tmp_dir.'owner_hc.csv');
2229 2634
 		if (file_exists($tmp_dir.'owner_hc.csv')) {
2230
-			if ($globalDebug) echo "Add to DB...";
2635
+			if ($globalDebug) {
2636
+				echo "Add to DB...";
2637
+			}
2231 2638
 			$error = update_db::retrieve_owner($tmp_dir.'owner_hc.csv','HC');
2232
-		} else $error = "File ".$tmp_dir.'owner_hc.csv'." doesn't exist. Download failed.";
2639
+		} else {
2640
+			$error = "File ".$tmp_dir.'owner_hc.csv'." doesn't exist. Download failed.";
2641
+		}
2233 2642
 		if ($error != '') {
2234 2643
 			return $error;
2235
-		} elseif ($globalDebug) echo "Done\n";
2236
-		if ($globalDebug) echo "Owner Iceland: Download...";
2644
+		} elseif ($globalDebug) {
2645
+			echo "Done\n";
2646
+		}
2647
+		if ($globalDebug) {
2648
+			echo "Owner Iceland: Download...";
2649
+		}
2237 2650
 		update_db::download('http://antonakis.co.uk/registers/Iceland.txt',$tmp_dir.'owner_tf.csv');
2238 2651
 		if (file_exists($tmp_dir.'owner_tf.csv')) {
2239
-			if ($globalDebug) echo "Add to DB...";
2652
+			if ($globalDebug) {
2653
+				echo "Add to DB...";
2654
+			}
2240 2655
 			$error = update_db::retrieve_owner($tmp_dir.'owner_tf.csv','TF');
2241
-		} else $error = "File ".$tmp_dir.'owner_tf.csv'." doesn't exist. Download failed.";
2656
+		} else {
2657
+			$error = "File ".$tmp_dir.'owner_tf.csv'." doesn't exist. Download failed.";
2658
+		}
2242 2659
 		if ($error != '') {
2243 2660
 			return $error;
2244
-		} elseif ($globalDebug) echo "Done\n";
2245
-		if ($globalDebug) echo "Owner Isle of Man: Download...";
2661
+		} elseif ($globalDebug) {
2662
+			echo "Done\n";
2663
+		}
2664
+		if ($globalDebug) {
2665
+			echo "Owner Isle of Man: Download...";
2666
+		}
2246 2667
 		update_db::download('http://antonakis.co.uk/registers/IsleOfMan.txt',$tmp_dir.'owner_m.csv');
2247 2668
 		if (file_exists($tmp_dir.'owner_m.csv')) {
2248
-			if ($globalDebug) echo "Add to DB...";
2669
+			if ($globalDebug) {
2670
+				echo "Add to DB...";
2671
+			}
2249 2672
 			$error = update_db::retrieve_owner($tmp_dir.'owner_m.csv','M');
2250
-		} else $error = "File ".$tmp_dir.'owner_m.csv'." doesn't exist. Download failed.";
2673
+		} else {
2674
+			$error = "File ".$tmp_dir.'owner_m.csv'." doesn't exist. Download failed.";
2675
+		}
2251 2676
 		if ($error != '') {
2252 2677
 			return $error;
2253
-		} elseif ($globalDebug) echo "Done\n";
2678
+		} elseif ($globalDebug) {
2679
+			echo "Done\n";
2680
+		}
2254 2681
 		if ($globalMasterSource) {
2255
-			if ($globalDebug) echo "ModeS Netherlands: Download...";
2682
+			if ($globalDebug) {
2683
+				echo "ModeS Netherlands: Download...";
2684
+			}
2256 2685
 			update_db::download('http://antonakis.co.uk/registers/Netherlands.txt',$tmp_dir.'owner_ph.csv');
2257 2686
 			if (file_exists($tmp_dir.'owner_ph.csv')) {
2258
-				if ($globalDebug) echo "Add to DB...";
2687
+				if ($globalDebug) {
2688
+					echo "Add to DB...";
2689
+				}
2259 2690
 				$error = update_db::retrieve_owner($tmp_dir.'owner_ph.csv','PH');
2260
-			} else $error = "File ".$tmp_dir.'owner_ph.csv'." doesn't exist. Download failed.";
2691
+			} else {
2692
+				$error = "File ".$tmp_dir.'owner_ph.csv'." doesn't exist. Download failed.";
2693
+			}
2261 2694
 			if ($error != '') {
2262 2695
 				return $error;
2263
-			} elseif ($globalDebug) echo "Done\n";
2264
-			if ($globalDebug) echo "ModeS Denmark: Download...";
2696
+			} elseif ($globalDebug) {
2697
+				echo "Done\n";
2698
+			}
2699
+			if ($globalDebug) {
2700
+				echo "ModeS Denmark: Download...";
2701
+			}
2265 2702
 			update_db::download('http://antonakis.co.uk/registers/Denmark.txt',$tmp_dir.'owner_oy.csv');
2266 2703
 			if (file_exists($tmp_dir.'owner_oy.csv')) {
2267
-				if ($globalDebug) echo "Add to DB...";
2704
+				if ($globalDebug) {
2705
+					echo "Add to DB...";
2706
+				}
2268 2707
 				$error = update_db::retrieve_owner($tmp_dir.'owner_oy.csv','OY');
2269
-			} else $error = "File ".$tmp_dir.'owner_oy.csv'." doesn't exist. Download failed.";
2708
+			} else {
2709
+				$error = "File ".$tmp_dir.'owner_oy.csv'." doesn't exist. Download failed.";
2710
+			}
2270 2711
 			if ($error != '') {
2271 2712
 				return $error;
2272
-			} elseif ($globalDebug) echo "Done\n";
2273
-		} elseif ($globalDebug) echo "Done\n";
2713
+			} elseif ($globalDebug) {
2714
+				echo "Done\n";
2715
+			}
2716
+		} elseif ($globalDebug) {
2717
+			echo "Done\n";
2718
+		}
2274 2719
 		return '';
2275 2720
 	}
2276 2721
 
2277 2722
 	public static function update_translation() {
2278 2723
 		global $tmp_dir, $globalDebug;
2279 2724
 		$error = '';
2280
-		if ($globalDebug) echo "Translation : Download...";
2725
+		if ($globalDebug) {
2726
+			echo "Translation : Download...";
2727
+		}
2281 2728
 		update_db::download('http://www.acarsd.org/download/translation.php',$tmp_dir.'translation.zip');
2282 2729
 		if (file_exists($tmp_dir.'translation.zip')) {
2283
-			if ($globalDebug) echo "Unzip...";
2730
+			if ($globalDebug) {
2731
+				echo "Unzip...";
2732
+			}
2284 2733
 			update_db::unzip($tmp_dir.'translation.zip');
2285
-			if ($globalDebug) echo "Add to DB...";
2734
+			if ($globalDebug) {
2735
+				echo "Add to DB...";
2736
+			}
2286 2737
 			$error = update_db::translation();
2287
-		} else $error = "File ".$tmp_dir.'translation.zip'." doesn't exist. Download failed.";
2738
+		} else {
2739
+			$error = "File ".$tmp_dir.'translation.zip'." doesn't exist. Download failed.";
2740
+		}
2288 2741
 		if ($error != '') {
2289 2742
 			return $error;
2290
-		} elseif ($globalDebug) echo "Done\n";
2743
+		} elseif ($globalDebug) {
2744
+			echo "Done\n";
2745
+		}
2291 2746
 		return '';
2292 2747
 	}
2293 2748
 
2294 2749
 	public static function update_translation_fam() {
2295 2750
 		global $tmp_dir, $globalDebug;
2296
-		if ($globalDebug) echo "Translation from FlightAirMap website : Download...";
2751
+		if ($globalDebug) {
2752
+			echo "Translation from FlightAirMap website : Download...";
2753
+		}
2297 2754
 		update_db::download('http://data.flightairmap.fr/data/translation.tsv.gz',$tmp_dir.'translation.tsv.gz');
2298 2755
 		if (file_exists($tmp_dir.'translation.tsv.gz')) {
2299
-			if ($globalDebug) echo "Gunzip...";
2756
+			if ($globalDebug) {
2757
+				echo "Gunzip...";
2758
+			}
2300 2759
 			update_db::gunzip($tmp_dir.'translation.tsv.gz');
2301
-			if ($globalDebug) echo "Add to DB...";
2760
+			if ($globalDebug) {
2761
+				echo "Add to DB...";
2762
+			}
2302 2763
 			$error = update_db::translation_fam();
2303
-		} else $error = "File ".$tmp_dir.'translation.tsv.gz'." doesn't exist. Download failed.";
2764
+		} else {
2765
+			$error = "File ".$tmp_dir.'translation.tsv.gz'." doesn't exist. Download failed.";
2766
+		}
2304 2767
 		if ($error != '') {
2305 2768
 			return $error;
2306
-		} elseif ($globalDebug) echo "Done\n";
2769
+		} elseif ($globalDebug) {
2770
+			echo "Done\n";
2771
+		}
2307 2772
 		return '';
2308 2773
 	}
2309 2774
 	public static function update_ModeS_fam() {
2310 2775
 		global $tmp_dir, $globalDebug;
2311
-		if ($globalDebug) echo "ModeS from FlightAirMap website : Download...";
2776
+		if ($globalDebug) {
2777
+			echo "ModeS from FlightAirMap website : Download...";
2778
+		}
2312 2779
 		update_db::download('http://data.flightairmap.fr/data/modes.tsv.gz',$tmp_dir.'modes.tsv.gz');
2313 2780
 		if (file_exists($tmp_dir.'modes.tsv.gz')) {
2314
-			if ($globalDebug) echo "Gunzip...";
2781
+			if ($globalDebug) {
2782
+				echo "Gunzip...";
2783
+			}
2315 2784
 			update_db::gunzip($tmp_dir.'modes.tsv.gz');
2316
-			if ($globalDebug) echo "Add to DB...";
2785
+			if ($globalDebug) {
2786
+				echo "Add to DB...";
2787
+			}
2317 2788
 			$error = update_db::modes_fam();
2318
-		} else $error = "File ".$tmp_dir.'modes.tsv.gz'." doesn't exist. Download failed.";
2789
+		} else {
2790
+			$error = "File ".$tmp_dir.'modes.tsv.gz'." doesn't exist. Download failed.";
2791
+		}
2319 2792
 		if ($error != '') {
2320 2793
 			return $error;
2321
-		} elseif ($globalDebug) echo "Done\n";
2794
+		} elseif ($globalDebug) {
2795
+			echo "Done\n";
2796
+		}
2322 2797
 		return '';
2323 2798
 	}
2324 2799
 	public static function update_owner_fam() {
2325 2800
 		global $tmp_dir, $globalDebug, $globalOwner;
2326
-		if ($globalDebug) echo "owner from FlightAirMap website : Download...";
2801
+		if ($globalDebug) {
2802
+			echo "owner from FlightAirMap website : Download...";
2803
+		}
2327 2804
 		if ($globalOwner === TRUE) {
2328 2805
 			update_db::download('http://data.flightairmap.fr/data/owners_all.tsv.gz',$tmp_dir.'owners.tsv.gz');
2329 2806
 		} else {
2330 2807
 			update_db::download('http://data.flightairmap.fr/data/owners.tsv.gz',$tmp_dir.'owners.tsv.gz');
2331 2808
 		}
2332 2809
 		if (file_exists($tmp_dir.'owners.tsv.gz')) {
2333
-			if ($globalDebug) echo "Gunzip...";
2810
+			if ($globalDebug) {
2811
+				echo "Gunzip...";
2812
+			}
2334 2813
 			update_db::gunzip($tmp_dir.'owners.tsv.gz');
2335
-			if ($globalDebug) echo "Add to DB...";
2814
+			if ($globalDebug) {
2815
+				echo "Add to DB...";
2816
+			}
2336 2817
 			$error = update_db::owner_fam();
2337
-		} else $error = "File ".$tmp_dir.'owners.tsv.gz'." doesn't exist. Download failed.";
2818
+		} else {
2819
+			$error = "File ".$tmp_dir.'owners.tsv.gz'." doesn't exist. Download failed.";
2820
+		}
2338 2821
 		if ($error != '') {
2339 2822
 			return $error;
2340
-		} elseif ($globalDebug) echo "Done\n";
2823
+		} elseif ($globalDebug) {
2824
+			echo "Done\n";
2825
+		}
2341 2826
 		return '';
2342 2827
 	}
2343 2828
 	public static function update_routes_fam() {
2344 2829
 		global $tmp_dir, $globalDebug;
2345
-		if ($globalDebug) echo "Routes from FlightAirMap website : Download...";
2830
+		if ($globalDebug) {
2831
+			echo "Routes from FlightAirMap website : Download...";
2832
+		}
2346 2833
 		update_db::download('http://data.flightairmap.fr/data/routes.tsv.gz',$tmp_dir.'routes.tsv.gz');
2347 2834
 		if (file_exists($tmp_dir.'routes.tsv.gz')) {
2348
-			if ($globalDebug) echo "Gunzip...";
2835
+			if ($globalDebug) {
2836
+				echo "Gunzip...";
2837
+			}
2349 2838
 			update_db::gunzip($tmp_dir.'routes.tsv.gz');
2350
-			if ($globalDebug) echo "Add to DB...";
2839
+			if ($globalDebug) {
2840
+				echo "Add to DB...";
2841
+			}
2351 2842
 			$error = update_db::routes_fam();
2352
-		} else $error = "File ".$tmp_dir.'routes.tsv.gz'." doesn't exist. Download failed.";
2843
+		} else {
2844
+			$error = "File ".$tmp_dir.'routes.tsv.gz'." doesn't exist. Download failed.";
2845
+		}
2353 2846
 		if ($error != '') {
2354 2847
 			return $error;
2355
-		} elseif ($globalDebug) echo "Done\n";
2848
+		} elseif ($globalDebug) {
2849
+			echo "Done\n";
2850
+		}
2356 2851
 		return '';
2357 2852
 	}
2358 2853
 	public static function update_marine_identity_fam() {
@@ -2362,14 +2857,22 @@  discard block
 block discarded – undo
2362 2857
 			$marine_identity_md5_file = explode(' ',file_get_contents($tmp_dir.'marine_identity.tsv.gz.md5'));
2363 2858
 			$marine_identity_md5 = $marine_identity_md5_file[0];
2364 2859
 			if (!update_db::check_marine_identity_version($marine_identity_md5)) {
2365
-				if ($globalDebug) echo "Marine identity from FlightAirMap website : Download...";
2860
+				if ($globalDebug) {
2861
+					echo "Marine identity from FlightAirMap website : Download...";
2862
+				}
2366 2863
 				update_db::download('http://data.flightairmap.fr/data/marine_identity.tsv.gz',$tmp_dir.'marine_identity.tsv.gz');
2367 2864
 				if (file_exists($tmp_dir.'marine_identity.tsv.gz')) {
2368
-					if ($globalDebug) echo "Gunzip...";
2865
+					if ($globalDebug) {
2866
+						echo "Gunzip...";
2867
+					}
2369 2868
 					update_db::gunzip($tmp_dir.'marine_identity.tsv.gz');
2370
-					if ($globalDebug) echo "Add to DB...";
2869
+					if ($globalDebug) {
2870
+						echo "Add to DB...";
2871
+					}
2371 2872
 					$error = update_db::marine_identity_fam();
2372
-				} else $error = "File ".$tmp_dir.'marine_identity.tsv.gz'." doesn't exist. Download failed.";
2873
+				} else {
2874
+					$error = "File ".$tmp_dir.'marine_identity.tsv.gz'." doesn't exist. Download failed.";
2875
+				}
2373 2876
 				if ($error != '') {
2374 2877
 					return $error;
2375 2878
 				} elseif ($globalDebug) {
@@ -2388,14 +2891,22 @@  discard block
 block discarded – undo
2388 2891
 			$satellite_md5_file = explode(' ',file_get_contents($tmp_dir.'satellite.tsv.gz.md5'));
2389 2892
 			$satellite_md5 = $satellite_md5_file[0];
2390 2893
 			if (!update_db::check_satellite_version($satellite_md5)) {
2391
-				if ($globalDebug) echo "Satellite from FlightAirMap website : Download...";
2894
+				if ($globalDebug) {
2895
+					echo "Satellite from FlightAirMap website : Download...";
2896
+				}
2392 2897
 				update_db::download('http://data.flightairmap.fr/data/satellite.tsv.gz',$tmp_dir.'satellite.tsv.gz');
2393 2898
 				if (file_exists($tmp_dir.'satellite.tsv.gz')) {
2394
-					if ($globalDebug) echo "Gunzip...";
2899
+					if ($globalDebug) {
2900
+						echo "Gunzip...";
2901
+					}
2395 2902
 					update_db::gunzip($tmp_dir.'satellite.tsv.gz');
2396
-					if ($globalDebug) echo "Add to DB...";
2903
+					if ($globalDebug) {
2904
+						echo "Add to DB...";
2905
+					}
2397 2906
 					$error = update_db::satellite_fam();
2398
-				} else $error = "File ".$tmp_dir.'satellite.tsv.gz'." doesn't exist. Download failed.";
2907
+				} else {
2908
+					$error = "File ".$tmp_dir.'satellite.tsv.gz'." doesn't exist. Download failed.";
2909
+				}
2399 2910
 				if ($error != '') {
2400 2911
 					return $error;
2401 2912
 				} elseif ($globalDebug) {
@@ -2408,17 +2919,25 @@  discard block
 block discarded – undo
2408 2919
 	}
2409 2920
 	public static function update_banned_fam() {
2410 2921
 		global $tmp_dir, $globalDebug;
2411
-		if ($globalDebug) echo "Banned airlines in Europe from FlightAirMap website : Download...";
2922
+		if ($globalDebug) {
2923
+			echo "Banned airlines in Europe from FlightAirMap website : Download...";
2924
+		}
2412 2925
 		update_db::download('http://data.flightairmap.fr/data/ban-eu.csv',$tmp_dir.'ban_eu.csv');
2413 2926
 		if (file_exists($tmp_dir.'ban_eu.csv')) {
2414 2927
 			//if ($globalDebug) echo "Gunzip...";
2415 2928
 			//update_db::gunzip($tmp_dir.'ban_ue.csv');
2416
-			if ($globalDebug) echo "Add to DB...";
2929
+			if ($globalDebug) {
2930
+				echo "Add to DB...";
2931
+			}
2417 2932
 			$error = update_db::banned_fam();
2418
-		} else $error = "File ".$tmp_dir.'ban_eu.csv'." doesn't exist. Download failed.";
2933
+		} else {
2934
+			$error = "File ".$tmp_dir.'ban_eu.csv'." doesn't exist. Download failed.";
2935
+		}
2419 2936
 		if ($error != '') {
2420 2937
 			return $error;
2421
-		} elseif ($globalDebug) echo "Done\n";
2938
+		} elseif ($globalDebug) {
2939
+			echo "Done\n";
2940
+		}
2422 2941
 		return '';
2423 2942
 	}
2424 2943
 
@@ -2426,7 +2945,9 @@  discard block
 block discarded – undo
2426 2945
 		global $tmp_dir, $globalDebug, $globalDBdriver;
2427 2946
 		include_once('class.create_db.php');
2428 2947
 		$error = '';
2429
-		if ($globalDebug) echo "Airspace from FlightAirMap website : Download...";
2948
+		if ($globalDebug) {
2949
+			echo "Airspace from FlightAirMap website : Download...";
2950
+		}
2430 2951
 		if ($globalDBdriver == 'mysql') {
2431 2952
 			update_db::download('http://data.flightairmap.fr/data/airspace_mysql.sql.gz.md5',$tmp_dir.'airspace.sql.gz.md5');
2432 2953
 		} else {
@@ -2442,9 +2963,13 @@  discard block
 block discarded – undo
2442 2963
 					update_db::download('http://data.flightairmap.fr/data/airspace_pgsql.sql.gz',$tmp_dir.'airspace.sql.gz');
2443 2964
 				}
2444 2965
 				if (file_exists($tmp_dir.'airspace.sql.gz')) {
2445
-					if ($globalDebug) echo "Gunzip...";
2966
+					if ($globalDebug) {
2967
+						echo "Gunzip...";
2968
+					}
2446 2969
 					update_db::gunzip($tmp_dir.'airspace.sql.gz');
2447
-					if ($globalDebug) echo "Add to DB...";
2970
+					if ($globalDebug) {
2971
+						echo "Add to DB...";
2972
+					}
2448 2973
 					$Connection = new Connection();
2449 2974
 					if ($Connection->tableExists('airspace')) {
2450 2975
 						$query = 'DROP TABLE airspace';
@@ -2457,19 +2982,27 @@  discard block
 block discarded – undo
2457 2982
 		    			}
2458 2983
 					$error = create_db::import_file($tmp_dir.'airspace.sql');
2459 2984
 					update_db::insert_airspace_version($airspace_md5);
2460
-				} else $error = "File ".$tmp_dir.'airpsace.sql.gz'." doesn't exist. Download failed.";
2985
+				} else {
2986
+					$error = "File ".$tmp_dir.'airpsace.sql.gz'." doesn't exist. Download failed.";
2987
+				}
2461 2988
 			}
2462
-		} else $error = "File ".$tmp_dir.'airpsace.sql.gz.md5'." doesn't exist. Download failed.";
2989
+		} else {
2990
+			$error = "File ".$tmp_dir.'airpsace.sql.gz.md5'." doesn't exist. Download failed.";
2991
+		}
2463 2992
 		if ($error != '') {
2464 2993
 			return $error;
2465
-		} elseif ($globalDebug) echo "Done\n";
2994
+		} elseif ($globalDebug) {
2995
+			echo "Done\n";
2996
+		}
2466 2997
 		return '';
2467 2998
 	}
2468 2999
 
2469 3000
 	public static function update_geoid_fam() {
2470 3001
 		global $tmp_dir, $globalDebug, $globalGeoidSource;
2471 3002
 		$error = '';
2472
-		if ($globalDebug) echo "Geoid from FlightAirMap website : Download...";
3003
+		if ($globalDebug) {
3004
+			echo "Geoid from FlightAirMap website : Download...";
3005
+		}
2473 3006
 		update_db::download('http://data.flightairmap.fr/data/geoid/'.$globalGeoidSource.'.pgm.gz.md5',$tmp_dir.$globalGeoidSource.'.pgm.gz.md5');
2474 3007
 		if (file_exists($tmp_dir.$globalGeoidSource.'.pgm.gz.md5')) {
2475 3008
 			$geoid_md5_file = explode(' ',file_get_contents($tmp_dir.$globalGeoidSource.'.pgm.gz.md5'));
@@ -2477,75 +3010,113 @@  discard block
 block discarded – undo
2477 3010
 			if (!update_db::check_geoid_version($geoid_md5)) {
2478 3011
 				update_db::download('http://data.flightairmap.fr/data/geoid/'.$globalGeoidSource.'.pgm.gz',$tmp_dir.$globalGeoidSource.'.pgm.gz');
2479 3012
 				if (file_exists($tmp_dir.$globalGeoidSource.'.pgm.gz')) {
2480
-					if ($globalDebug) echo "Gunzip...";
3013
+					if ($globalDebug) {
3014
+						echo "Gunzip...";
3015
+					}
2481 3016
 					update_db::gunzip($tmp_dir.$globalGeoidSource.'.pgm.gz',dirname(__FILE__).'/../data/'.$globalGeoidSource.'.pgm');
2482 3017
 					if (file_exists(dirname(__FILE__).'/../data/'.$globalGeoidSource.'.pgm')) {
2483 3018
 						update_db::insert_geoid_version($geoid_md5);
2484 3019
 					}
2485
-				} else $error = "File ".$tmp_dir.$globalGeoidSource.'.pgm.gz'." doesn't exist. Download failed.";
3020
+				} else {
3021
+					$error = "File ".$tmp_dir.$globalGeoidSource.'.pgm.gz'." doesn't exist. Download failed.";
3022
+				}
2486 3023
 			}
2487
-		} else $error = "File ".$tmp_dir.$globalGeoidSource.'.pgm.gz.md5'." doesn't exist. Download failed.";
3024
+		} else {
3025
+			$error = "File ".$tmp_dir.$globalGeoidSource.'.pgm.gz.md5'." doesn't exist. Download failed.";
3026
+		}
2488 3027
 		if ($error != '') {
2489 3028
 			return $error;
2490
-		} elseif ($globalDebug) echo "Done\n";
3029
+		} elseif ($globalDebug) {
3030
+			echo "Done\n";
3031
+		}
2491 3032
 		return '';
2492 3033
 	}
2493 3034
 
2494 3035
 	public static function update_tle() {
2495 3036
 		global $tmp_dir, $globalDebug;
2496
-		if ($globalDebug) echo "Download TLE : Download...";
3037
+		if ($globalDebug) {
3038
+			echo "Download TLE : Download...";
3039
+		}
2497 3040
 		$alltle = array('stations.txt','gps-ops.txt','glo-ops.txt','galileo.txt','weather.txt','noaa.txt','goes.txt','resource.txt','dmc.txt','tdrss.txt','geo.txt','intelsat.txt','gorizont.txt',
2498 3041
 		'raduga.txt','molniya.txt','iridium.txt','orbcomm.txt','globalstar.txt','amateur.txt','x-comm.txt','other-comm.txt','sbas.txt','nnss.txt','musson.txt','science.txt','geodetic.txt',
2499 3042
 		'engineering.txt','education.txt','military.txt','radar.txt','cubesat.txt','other.txt','tle-new.txt','visual.txt','sarsat.txt','argos.txt','ses.txt','iridium-NEXT.txt','beidou.txt');
2500 3043
 		foreach ($alltle as $filename) {
2501
-			if ($globalDebug) echo "downloading ".$filename.'...';
3044
+			if ($globalDebug) {
3045
+				echo "downloading ".$filename.'...';
3046
+			}
2502 3047
 			update_db::download('http://celestrak.com/NORAD/elements/'.$filename,$tmp_dir.$filename);
2503 3048
 			if (file_exists($tmp_dir.$filename)) {
2504
-				if ($globalDebug) echo "Add to DB ".$filename."...";
3049
+				if ($globalDebug) {
3050
+					echo "Add to DB ".$filename."...";
3051
+				}
2505 3052
 				$error = update_db::tle($tmp_dir.$filename,str_replace('.txt','',$filename));
2506
-			} else $error = "File ".$tmp_dir.$filename." doesn't exist. Download failed.";
3053
+			} else {
3054
+				$error = "File ".$tmp_dir.$filename." doesn't exist. Download failed.";
3055
+			}
2507 3056
 			if ($error != '') {
2508 3057
 				echo $error."\n";
2509
-			} elseif ($globalDebug) echo "Done\n";
3058
+			} elseif ($globalDebug) {
3059
+				echo "Done\n";
3060
+			}
2510 3061
 		}
2511 3062
 		return '';
2512 3063
 	}
2513 3064
 
2514 3065
 	public static function update_ucsdb() {
2515 3066
 		global $tmp_dir, $globalDebug;
2516
-		if ($globalDebug) echo "Download UCS DB : Download...";
3067
+		if ($globalDebug) {
3068
+			echo "Download UCS DB : Download...";
3069
+		}
2517 3070
 		update_db::download('https://s3.amazonaws.com/ucs-documents/nuclear-weapons/sat-database/4-11-17-update/UCS_Satellite_Database_officialname_1-1-17.txt',$tmp_dir.'UCS_Satellite_Database_officialname_1-1-17.txt');
2518 3071
 		if (file_exists($tmp_dir.'UCS_Satellite_Database_officialname_1-1-17.txt')) {
2519
-			if ($globalDebug) echo "Add to DB...";
3072
+			if ($globalDebug) {
3073
+				echo "Add to DB...";
3074
+			}
2520 3075
 			$error = update_db::satellite_ucsdb($tmp_dir.'UCS_Satellite_Database_officialname_1-1-17.txt');
2521
-		} else $error = "File ".$tmp_dir.'UCS_Satellite_Database_officialname_1-1-17.txt'." doesn't exist. Download failed.";
3076
+		} else {
3077
+			$error = "File ".$tmp_dir.'UCS_Satellite_Database_officialname_1-1-17.txt'." doesn't exist. Download failed.";
3078
+		}
2522 3079
 		if ($error != '') {
2523 3080
 			echo $error."\n";
2524
-		} elseif ($globalDebug) echo "Done\n";
3081
+		} elseif ($globalDebug) {
3082
+			echo "Done\n";
3083
+		}
2525 3084
 		return '';
2526 3085
 	}
2527 3086
 
2528 3087
 	public static function update_celestrak() {
2529 3088
 		global $tmp_dir, $globalDebug;
2530
-		if ($globalDebug) echo "Download Celestrak DB : Download...";
3089
+		if ($globalDebug) {
3090
+			echo "Download Celestrak DB : Download...";
3091
+		}
2531 3092
 		update_db::download('http://celestrak.com/pub/satcat.txt',$tmp_dir.'satcat.txt');
2532 3093
 		if (file_exists($tmp_dir.'satcat.txt')) {
2533
-			if ($globalDebug) echo "Add to DB...";
3094
+			if ($globalDebug) {
3095
+				echo "Add to DB...";
3096
+			}
2534 3097
 			$error = update_db::satellite_celestrak($tmp_dir.'satcat.txt');
2535
-		} else $error = "File ".$tmp_dir.'satcat.txt'." doesn't exist. Download failed.";
3098
+		} else {
3099
+			$error = "File ".$tmp_dir.'satcat.txt'." doesn't exist. Download failed.";
3100
+		}
2536 3101
 		if ($error != '') {
2537 3102
 			echo $error."\n";
2538
-		} elseif ($globalDebug) echo "Done\n";
3103
+		} elseif ($globalDebug) {
3104
+			echo "Done\n";
3105
+		}
2539 3106
 		return '';
2540 3107
 	}
2541 3108
 
2542 3109
 	public static function update_models() {
2543 3110
 		global $tmp_dir, $globalDebug;
2544 3111
 		$error = '';
2545
-		if ($globalDebug) echo "Models from FlightAirMap website : Download...";
3112
+		if ($globalDebug) {
3113
+			echo "Models from FlightAirMap website : Download...";
3114
+		}
2546 3115
 		update_db::download('http://data.flightairmap.fr/data/models/models.md5sum',$tmp_dir.'models.md5sum');
2547 3116
 		if (file_exists($tmp_dir.'models.md5sum')) {
2548
-			if ($globalDebug) echo "Check files...\n";
3117
+			if ($globalDebug) {
3118
+				echo "Check files...\n";
3119
+			}
2549 3120
 			$newmodelsdb = array();
2550 3121
 			if (($handle = fopen($tmp_dir.'models.md5sum','r')) !== FALSE) {
2551 3122
 				while (($row = fgetcsv($handle,1000," ")) !== FALSE) {
@@ -2564,25 +3135,35 @@  discard block
 block discarded – undo
2564 3135
 			}
2565 3136
 			$diff = array_diff($newmodelsdb,$modelsdb);
2566 3137
 			foreach ($diff as $key => $value) {
2567
-				if ($globalDebug) echo 'Downloading model '.$key.' ...'."\n";
3138
+				if ($globalDebug) {
3139
+					echo 'Downloading model '.$key.' ...'."\n";
3140
+				}
2568 3141
 				update_db::download('http://data.flightairmap.fr/data/models/'.$key,dirname(__FILE__).'/../models/'.$key);
2569 3142
 				
2570 3143
 			}
2571 3144
 			update_db::download('http://data.flightairmap.fr/data/models/models.md5sum',dirname(__FILE__).'/../models/models.md5sum');
2572
-		} else $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed.";
3145
+		} else {
3146
+			$error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed.";
3147
+		}
2573 3148
 		if ($error != '') {
2574 3149
 			return $error;
2575
-		} elseif ($globalDebug) echo "Done\n";
3150
+		} elseif ($globalDebug) {
3151
+			echo "Done\n";
3152
+		}
2576 3153
 		return '';
2577 3154
 	}
2578 3155
 
2579 3156
 	public static function update_space_models() {
2580 3157
 		global $tmp_dir, $globalDebug;
2581 3158
 		$error = '';
2582
-		if ($globalDebug) echo "Space models from FlightAirMap website : Download...";
3159
+		if ($globalDebug) {
3160
+			echo "Space models from FlightAirMap website : Download...";
3161
+		}
2583 3162
 		update_db::download('http://data.flightairmap.fr/data/models/space/space_models.md5sum',$tmp_dir.'space_models.md5sum');
2584 3163
 		if (file_exists($tmp_dir.'space_models.md5sum')) {
2585
-			if ($globalDebug) echo "Check files...\n";
3164
+			if ($globalDebug) {
3165
+				echo "Check files...\n";
3166
+			}
2586 3167
 			$newmodelsdb = array();
2587 3168
 			if (($handle = fopen($tmp_dir.'space_models.md5sum','r')) !== FALSE) {
2588 3169
 				while (($row = fgetcsv($handle,1000," ")) !== FALSE) {
@@ -2601,25 +3182,35 @@  discard block
 block discarded – undo
2601 3182
 			}
2602 3183
 			$diff = array_diff($newmodelsdb,$modelsdb);
2603 3184
 			foreach ($diff as $key => $value) {
2604
-				if ($globalDebug) echo 'Downloading space model '.$key.' ...'."\n";
3185
+				if ($globalDebug) {
3186
+					echo 'Downloading space model '.$key.' ...'."\n";
3187
+				}
2605 3188
 				update_db::download('http://data.flightairmap.fr/data/models/space/'.$key,dirname(__FILE__).'/../models/space/'.$key);
2606 3189
 				
2607 3190
 			}
2608 3191
 			update_db::download('http://data.flightairmap.fr/data/models/space/space_models.md5sum',dirname(__FILE__).'/../models/space/space_models.md5sum');
2609
-		} else $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed.";
3192
+		} else {
3193
+			$error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed.";
3194
+		}
2610 3195
 		if ($error != '') {
2611 3196
 			return $error;
2612
-		} elseif ($globalDebug) echo "Done\n";
3197
+		} elseif ($globalDebug) {
3198
+			echo "Done\n";
3199
+		}
2613 3200
 		return '';
2614 3201
 	}
2615 3202
 
2616 3203
 	public static function update_vehicules_models() {
2617 3204
 		global $tmp_dir, $globalDebug;
2618 3205
 		$error = '';
2619
-		if ($globalDebug) echo "Vehicules models from FlightAirMap website : Download...";
3206
+		if ($globalDebug) {
3207
+			echo "Vehicules models from FlightAirMap website : Download...";
3208
+		}
2620 3209
 		update_db::download('http://data.flightairmap.fr/data/models/vehicules/vehicules_models.md5sum',$tmp_dir.'vehicules_models.md5sum');
2621 3210
 		if (file_exists($tmp_dir.'vehicules_models.md5sum')) {
2622
-			if ($globalDebug) echo "Check files...\n";
3211
+			if ($globalDebug) {
3212
+				echo "Check files...\n";
3213
+			}
2623 3214
 			$newmodelsdb = array();
2624 3215
 			if (($handle = fopen($tmp_dir.'vehicules_models.md5sum','r')) !== FALSE) {
2625 3216
 				while (($row = fgetcsv($handle,1000," ")) !== FALSE) {
@@ -2638,15 +3229,21 @@  discard block
 block discarded – undo
2638 3229
 			}
2639 3230
 			$diff = array_diff($newmodelsdb,$modelsdb);
2640 3231
 			foreach ($diff as $key => $value) {
2641
-				if ($globalDebug) echo 'Downloading vehicules model '.$key.' ...'."\n";
3232
+				if ($globalDebug) {
3233
+					echo 'Downloading vehicules model '.$key.' ...'."\n";
3234
+				}
2642 3235
 				update_db::download('http://data.flightairmap.fr/data/models/vehicules/'.$key,dirname(__FILE__).'/../models/vehicules/'.$key);
2643 3236
 				
2644 3237
 			}
2645 3238
 			update_db::download('http://data.flightairmap.fr/data/models/vehicules/vehicules_models.md5sum',dirname(__FILE__).'/../models/vehicules/vehicules_models.md5sum');
2646
-		} else $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed.";
3239
+		} else {
3240
+			$error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed.";
3241
+		}
2647 3242
 		if ($error != '') {
2648 3243
 			return $error;
2649
-		} elseif ($globalDebug) echo "Done\n";
3244
+		} elseif ($globalDebug) {
3245
+			echo "Done\n";
3246
+		}
2650 3247
 		return '';
2651 3248
 	}
2652 3249
 
@@ -2689,7 +3286,9 @@  discard block
 block discarded – undo
2689 3286
                 }
2690 3287
 
2691 3288
 		$error = '';
2692
-		if ($globalDebug) echo "Notam : Download...";
3289
+		if ($globalDebug) {
3290
+			echo "Notam : Download...";
3291
+		}
2693 3292
 		update_db::download($globalNOTAMSource,$tmp_dir.'notam.rss');
2694 3293
 		if (file_exists($tmp_dir.'notam.rss')) {
2695 3294
 			$notams = json_decode(json_encode(simplexml_load_file($tmp_dir.'notam.rss')),true);
@@ -2704,14 +3303,30 @@  discard block
 block discarded – undo
2704 3303
 				$data['fir'] = $q[0];
2705 3304
 				$data['code'] = $q[1];
2706 3305
 				$ifrvfr = $q[2];
2707
-				if ($ifrvfr == 'IV') $data['rules'] = 'IFR/VFR';
2708
-				if ($ifrvfr == 'I') $data['rules'] = 'IFR';
2709
-				if ($ifrvfr == 'V') $data['rules'] = 'VFR';
2710
-				if ($q[4] == 'A') $data['scope'] = 'Airport warning';
2711
-				if ($q[4] == 'E') $data['scope'] = 'Enroute warning';
2712
-				if ($q[4] == 'W') $data['scope'] = 'Navigation warning';
2713
-				if ($q[4] == 'AE') $data['scope'] = 'Airport/Enroute warning';
2714
-				if ($q[4] == 'AW') $data['scope'] = 'Airport/Navigation warning';
3306
+				if ($ifrvfr == 'IV') {
3307
+					$data['rules'] = 'IFR/VFR';
3308
+				}
3309
+				if ($ifrvfr == 'I') {
3310
+					$data['rules'] = 'IFR';
3311
+				}
3312
+				if ($ifrvfr == 'V') {
3313
+					$data['rules'] = 'VFR';
3314
+				}
3315
+				if ($q[4] == 'A') {
3316
+					$data['scope'] = 'Airport warning';
3317
+				}
3318
+				if ($q[4] == 'E') {
3319
+					$data['scope'] = 'Enroute warning';
3320
+				}
3321
+				if ($q[4] == 'W') {
3322
+					$data['scope'] = 'Navigation warning';
3323
+				}
3324
+				if ($q[4] == 'AE') {
3325
+					$data['scope'] = 'Airport/Enroute warning';
3326
+				}
3327
+				if ($q[4] == 'AW') {
3328
+					$data['scope'] = 'Airport/Navigation warning';
3329
+				}
2715 3330
 				//$data['scope'] = $q[4];
2716 3331
 				$data['lower_limit'] = $q[5];
2717 3332
 				$data['upper_limit'] = $q[6];
@@ -2719,8 +3334,12 @@  discard block
 block discarded – undo
2719 3334
 				sscanf($latlonrad,'%4c%c%5c%c%3d',$las,$lac,$lns,$lnc,$radius);
2720 3335
 				$latitude = $Common->convertDec($las,'latitude');
2721 3336
 				$longitude = $Common->convertDec($lns,'longitude');
2722
-				if ($lac == 'S') $latitude = '-'.$latitude;
2723
-				if ($lnc == 'W') $longitude = '-'.$longitude;
3337
+				if ($lac == 'S') {
3338
+					$latitude = '-'.$latitude;
3339
+				}
3340
+				if ($lnc == 'W') {
3341
+					$longitude = '-'.$longitude;
3342
+				}
2724 3343
 				$data['center_latitude'] = $latitude;
2725 3344
 				$data['center_longitude'] = $longitude;
2726 3345
 				$data['radius'] = intval($radius);
@@ -2750,10 +3369,14 @@  discard block
 block discarded – undo
2750 3369
 				$NOTAM->addNOTAM($data['ref'],$data['title'],'',$data['fir'],$data['code'],'',$data['scope'],$data['lower_limit'],$data['upper_limit'],$data['center_latitude'],$data['center_longitude'],$data['radius'],$data['date_begin'],$data['date_end'],$data['permanent'],$data['text'],$data['full_notam']);
2751 3370
 				unset($data);
2752 3371
 			} 
2753
-		} else $error = "File ".$tmp_dir.'notam.rss'." doesn't exist. Download failed.";
3372
+		} else {
3373
+			$error = "File ".$tmp_dir.'notam.rss'." doesn't exist. Download failed.";
3374
+		}
2754 3375
 		if ($error != '') {
2755 3376
 			return $error;
2756
-		} elseif ($globalDebug) echo "Done\n";
3377
+		} elseif ($globalDebug) {
3378
+			echo "Done\n";
3379
+		}
2757 3380
 		return '';
2758 3381
 	}
2759 3382
 	
@@ -2778,7 +3401,9 @@  discard block
 block discarded – undo
2778 3401
 		$airspace_lst = $Common->getData('https://raw.githubusercontent.com/XCSoar/xcsoar-data-repository/master/data/airspace.json');
2779 3402
 		$airspace_json = json_decode($airspace_lst,true);
2780 3403
 		foreach ($airspace_json['records'] as $airspace) {
2781
-			if ($globalDebug) echo $airspace['name']."...\n";
3404
+			if ($globalDebug) {
3405
+				echo $airspace['name']."...\n";
3406
+			}
2782 3407
 			update_db::download($airspace['uri'],$tmp_dir.$airspace['name']);
2783 3408
 			if (file_exists($tmp_dir.$airspace['name'])) {
2784 3409
 				file_put_contents($tmp_dir.$airspace['name'], utf8_encode(file_get_contents($tmp_dir.$airspace['name'])));
@@ -2822,8 +3447,11 @@  discard block
 block discarded – undo
2822 3447
                         return "error : ".$e->getMessage();
2823 3448
                 }
2824 3449
                 $row = $sth->fetch(PDO::FETCH_ASSOC);
2825
-                if ($row['nb'] > 0) return false;
2826
-                else return true;
3450
+                if ($row['nb'] > 0) {
3451
+                	return false;
3452
+                } else {
3453
+                	return true;
3454
+                }
2827 3455
 	}
2828 3456
 
2829 3457
 	public static function insert_last_update() {
@@ -2848,8 +3476,11 @@  discard block
 block discarded – undo
2848 3476
                         return "error : ".$e->getMessage();
2849 3477
                 }
2850 3478
                 $row = $sth->fetch(PDO::FETCH_ASSOC);
2851
-                if ($row['nb'] > 0) return true;
2852
-                else return false;
3479
+                if ($row['nb'] > 0) {
3480
+                	return true;
3481
+                } else {
3482
+                	return false;
3483
+                }
2853 3484
 	}
2854 3485
 
2855 3486
 	public static function check_geoid_version($version) {
@@ -2862,8 +3493,11 @@  discard block
 block discarded – undo
2862 3493
                         return "error : ".$e->getMessage();
2863 3494
                 }
2864 3495
                 $row = $sth->fetch(PDO::FETCH_ASSOC);
2865
-                if ($row['nb'] > 0) return true;
2866
-                else return false;
3496
+                if ($row['nb'] > 0) {
3497
+                	return true;
3498
+                } else {
3499
+                	return false;
3500
+                }
2867 3501
 	}
2868 3502
 
2869 3503
 	public static function check_marine_identity_version($version) {
@@ -2876,8 +3510,11 @@  discard block
 block discarded – undo
2876 3510
 			return "error : ".$e->getMessage();
2877 3511
 		}
2878 3512
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
2879
-		if ($row['nb'] > 0) return true;
2880
-		else return false;
3513
+		if ($row['nb'] > 0) {
3514
+			return true;
3515
+		} else {
3516
+			return false;
3517
+		}
2881 3518
 	}
2882 3519
 
2883 3520
 	public static function check_satellite_version($version) {
@@ -2890,8 +3527,11 @@  discard block
 block discarded – undo
2890 3527
 			return "error : ".$e->getMessage();
2891 3528
 		}
2892 3529
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
2893
-		if ($row['nb'] > 0) return true;
2894
-		else return false;
3530
+		if ($row['nb'] > 0) {
3531
+			return true;
3532
+		} else {
3533
+			return false;
3534
+		}
2895 3535
 	}
2896 3536
 
2897 3537
 
@@ -2958,8 +3598,11 @@  discard block
 block discarded – undo
2958 3598
                         return "error : ".$e->getMessage();
2959 3599
                 }
2960 3600
                 $row = $sth->fetch(PDO::FETCH_ASSOC);
2961
-                if ($row['nb'] > 0) return false;
2962
-                else return true;
3601
+                if ($row['nb'] > 0) {
3602
+                	return false;
3603
+                } else {
3604
+                	return true;
3605
+                }
2963 3606
 	}
2964 3607
 
2965 3608
 	public static function insert_last_notam_update() {
@@ -2989,8 +3632,11 @@  discard block
 block discarded – undo
2989 3632
                         return "error : ".$e->getMessage();
2990 3633
                 }
2991 3634
                 $row = $sth->fetch(PDO::FETCH_ASSOC);
2992
-                if ($row['nb'] > 0) return false;
2993
-                else return true;
3635
+                if ($row['nb'] > 0) {
3636
+                	return false;
3637
+                } else {
3638
+                	return true;
3639
+                }
2994 3640
 	}
2995 3641
 
2996 3642
 	public static function insert_last_airspace_update() {
@@ -3020,8 +3666,11 @@  discard block
 block discarded – undo
3020 3666
                         return "error : ".$e->getMessage();
3021 3667
                 }
3022 3668
                 $row = $sth->fetch(PDO::FETCH_ASSOC);
3023
-                if ($row['nb'] > 0) return false;
3024
-                else return true;
3669
+                if ($row['nb'] > 0) {
3670
+                	return false;
3671
+                } else {
3672
+                	return true;
3673
+                }
3025 3674
 	}
3026 3675
 
3027 3676
 	public static function insert_last_geoid_update() {
@@ -3051,8 +3700,11 @@  discard block
 block discarded – undo
3051 3700
                         return "error : ".$e->getMessage();
3052 3701
                 }
3053 3702
                 $row = $sth->fetch(PDO::FETCH_ASSOC);
3054
-                if ($row['nb'] > 0) return false;
3055
-                else return true;
3703
+                if ($row['nb'] > 0) {
3704
+                	return false;
3705
+                } else {
3706
+                	return true;
3707
+                }
3056 3708
 	}
3057 3709
 
3058 3710
 	public static function insert_last_owner_update() {
@@ -3081,8 +3733,11 @@  discard block
 block discarded – undo
3081 3733
                         return "error : ".$e->getMessage();
3082 3734
                 }
3083 3735
                 $row = $sth->fetch(PDO::FETCH_ASSOC);
3084
-                if ($row['nb'] > 0) return false;
3085
-                else return true;
3736
+                if ($row['nb'] > 0) {
3737
+                	return false;
3738
+                } else {
3739
+                	return true;
3740
+                }
3086 3741
 	}
3087 3742
 
3088 3743
 	public static function insert_last_schedules_update() {
@@ -3112,8 +3767,11 @@  discard block
 block discarded – undo
3112 3767
 			return "error : ".$e->getMessage();
3113 3768
 		}
3114 3769
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
3115
-		if ($row['nb'] > 0) return false;
3116
-		else return true;
3770
+		if ($row['nb'] > 0) {
3771
+			return false;
3772
+		} else {
3773
+			return true;
3774
+		}
3117 3775
 	}
3118 3776
 
3119 3777
 	public static function insert_last_tle_update() {
@@ -3143,8 +3801,11 @@  discard block
 block discarded – undo
3143 3801
 			return "error : ".$e->getMessage();
3144 3802
 		}
3145 3803
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
3146
-		if ($row['nb'] > 0) return false;
3147
-		else return true;
3804
+		if ($row['nb'] > 0) {
3805
+			return false;
3806
+		} else {
3807
+			return true;
3808
+		}
3148 3809
 	}
3149 3810
 
3150 3811
 	public static function insert_last_ucsdb_update() {
@@ -3174,8 +3835,11 @@  discard block
 block discarded – undo
3174 3835
 			return "error : ".$e->getMessage();
3175 3836
 		}
3176 3837
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
3177
-		if ($row['nb'] > 0) return false;
3178
-		else return true;
3838
+		if ($row['nb'] > 0) {
3839
+			return false;
3840
+		} else {
3841
+			return true;
3842
+		}
3179 3843
 	}
3180 3844
 
3181 3845
 	public static function insert_last_celestrak_update() {
@@ -3205,8 +3869,11 @@  discard block
 block discarded – undo
3205 3869
 			return "error : ".$e->getMessage();
3206 3870
 		}
3207 3871
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
3208
-		if ($row['nb'] > 0) return false;
3209
-		else return true;
3872
+		if ($row['nb'] > 0) {
3873
+			return false;
3874
+		} else {
3875
+			return true;
3876
+		}
3210 3877
 	}
3211 3878
 
3212 3879
 	public static function check_last_satellite_update() {
@@ -3224,8 +3891,11 @@  discard block
 block discarded – undo
3224 3891
 			return "error : ".$e->getMessage();
3225 3892
 		}
3226 3893
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
3227
-		if ($row['nb'] > 0) return false;
3228
-		else return true;
3894
+		if ($row['nb'] > 0) {
3895
+			return false;
3896
+		} else {
3897
+			return true;
3898
+		}
3229 3899
 	}
3230 3900
 
3231 3901
 	public static function insert_last_marine_identity_update() {
Please login to merge, or discard this patch.