Completed
Push — master ( 73f088...7f17b6 )
by Yannick
07:13
created
aircraft-detailed.php 1 patch
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
 		$limit_start = 0;
14 14
 		$limit_end = 25;
15 15
 		$absolute_difference = 25;
16
-	}  else {
16
+	} else {
17 17
 		$limit_explode = explode(",", $_GET['limit']);
18 18
 		$limit_start = $limit_explode[0];
19 19
 		$limit_end = $limit_explode[1];
@@ -63,7 +63,9 @@  discard block
 block discarded – undo
63 63
 	      		print '<h1>'.$spotter_array[0]['aircraft_name'].' ('.$spotter_array[0]['aircraft_type'].')</h1>';
64 64
 	      		print '<div><span class="label">'._("Name").'</span>'.$spotter_array[0]['aircraft_name'].'</div>';
65 65
 	      		print '<div><span class="label">'._("ICAO").'</span>'.$spotter_array[0]['aircraft_type'].'</div>'; 
66
-	      		if (isset($spotter_array[0]['aircraft_manufacturer'])) print '<div><span class="label">'._("Manufacturer").'</span><a href="'.$globalURL.'/manufacturer/'.strtolower(str_replace(" ", "-", $spotter_array[0]['aircraft_manufacturer'])).'">'.$spotter_array[0]['aircraft_manufacturer'].'</a></div>';
66
+	      		if (isset($spotter_array[0]['aircraft_manufacturer'])) {
67
+	      			print '<div><span class="label">'._("Manufacturer").'</span><a href="'.$globalURL.'/manufacturer/'.strtolower(str_replace(" ", "-", $spotter_array[0]['aircraft_manufacturer'])).'">'.$spotter_array[0]['aircraft_manufacturer'].'</a></div>';
68
+	      		}
67 69
 	    		print '</div>';
68 70
 		} else {
69 71
 			print '<div class="alert alert-warning">'._("This special aircraft profile shows all flights in where the aircraft type is unknown.").'</div>';
Please login to merge, or discard this patch.
aircraft.php 1 patch
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -16,14 +16,18 @@  discard block
 block discarded – undo
16 16
 	print '<h1>'._("Aircrafts Types").'</h1>';
17 17
 
18 18
 	$aircraft_types = $Stats->getAllAircraftTypes();
19
-	if (empty($aircraft_types) || $aircraft_types[0]['aircraft_name'] == '') $aircraft_types = $Spotter->getAllAircraftTypes();
19
+	if (empty($aircraft_types) || $aircraft_types[0]['aircraft_name'] == '') {
20
+		$aircraft_types = $Spotter->getAllAircraftTypes();
21
+	}
20 22
 	$previous = null;
21 23
 	print '<div class="alphabet-legend">';
22 24
 	foreach($aircraft_types as $value) {
23 25
 		$firstLetter = substr($value['aircraft_name'], 0, 1);
24 26
 		if($previous !== $firstLetter)
25 27
 		{
26
-			if ($previous !== null) print ' | ';
28
+			if ($previous !== null) {
29
+				print ' | ';
30
+			}
27 31
 			print '<a href="#'.$firstLetter.'">'.$firstLetter.'</a>';
28 32
 		}
29 33
 		$previous = $firstLetter;
@@ -36,7 +40,9 @@  discard block
 block discarded – undo
36 40
 		{
37 41
 			if($previous !== $firstLetter)
38 42
 			{
39
-				if ($previous !== null) print '</div>';
43
+				if ($previous !== null) {
44
+					print '</div>';
45
+				}
40 46
 				print '<a name="'.$firstLetter.'"></a><h4 class="alphabet-header">'.$firstLetter.'</h4><div class="alphabet">';
41 47
 			}
42 48
 			$previous = $firstLetter;
Please login to merge, or discard this patch.
airline.php 1 patch
Braces   +21 added lines, -7 removed lines patch added patch discarded remove patch
@@ -23,13 +23,21 @@  discard block
 block discarded – undo
23 23
 
24 24
 	print '<div class="select-item"><form action="'.$globalURL.'/airline" method="post"><select name="airline_type" class="selectpicker" data-live-search="true">';
25 25
 	print '<option value="all"';
26
-	if ($airline_type == 'all') print 'selected="selected" ';
26
+	if ($airline_type == 'all') {
27
+		print 'selected="selected" ';
28
+	}
27 29
 	print '>'._("All").'</option><option value="passenger"';
28
-	if ($airline_type == 'passenger') print 'selected="selected" ';
30
+	if ($airline_type == 'passenger') {
31
+		print 'selected="selected" ';
32
+	}
29 33
 	print '>'._("Passenger").'</option><option value="cargo"';
30
-	if ($airline_type == 'cargo') print 'selected="selected" ';
34
+	if ($airline_type == 'cargo') {
35
+		print 'selected="selected" ';
36
+	}
31 37
 	print '>'._("Cargo").'</option><option value="military"';
32
-	if ($airline_type == 'military') print 'selected="selected" ';
38
+	if ($airline_type == 'military') {
39
+		print 'selected="selected" ';
40
+	}
33 41
 	print '>'._("Military").'</option></select>';
34 42
 	print '<button type="submit"><i class="fa fa-angle-double-right"></i></button></form></div>';
35 43
 
@@ -41,7 +49,9 @@  discard block
 block discarded – undo
41 49
 		$Stats = new Stats();
42 50
 		//$airline_names = $Spotter->getAllAirlineNames();
43 51
 		$airline_names = $Stats->getAllAirlineNames();
44
-		if (empty($airline_names)) $airline_names = $Spotter->getAllAirlineNames();
52
+		if (empty($airline_names)) {
53
+			$airline_names = $Spotter->getAllAirlineNames();
54
+		}
45 55
 	}
46 56
 	$previous = null;
47 57
 	print '<div class="alphabet-legend">';
@@ -52,7 +62,9 @@  discard block
 block discarded – undo
52 62
 		$firstLetter = mb_strtoupper(mb_substr($value['airline_name'], 0, 1),'UTF-8');
53 63
 		if($previous !== $firstLetter)
54 64
 		{
55
-			if ($previous !== null) print ' | ';
65
+			if ($previous !== null) {
66
+				print ' | ';
67
+			}
56 68
 			print '<a href="#'.$firstLetter.'">'.$firstLetter.'</a>';
57 69
 		}
58 70
 		$previous = $firstLetter;
@@ -65,7 +77,9 @@  discard block
 block discarded – undo
65 77
 		{
66 78
 			if($previous !== $firstLetter)
67 79
 			{
68
-				if ($previous !== null) print '</div>';
80
+				if ($previous !== null) {
81
+					print '</div>';
82
+				}
69 83
 				print '<a name="'.$firstLetter.'"></a><h4 class="alphabet-header">'.$firstLetter.'</h4><div class="alphabet">';
70 84
 			}
71 85
 			$previous = $firstLetter;
Please login to merge, or discard this patch.
scripts/update_db.php 1 patch
Braces   +16 added lines, -6 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 u", $output, $result);
11 11
 	$j = 0;
12
-	foreach ($output AS $line) if(strpos($line, "update_db.php")) $j++;
12
+	foreach ($output AS $line) {
13
+		if(strpos($line, "update_db.php")) $j++;
14
+	}
13 15
 	if ($j > 1) {
14 16
 		echo "Script is already runnning...";
15 17
 		die();
@@ -22,7 +24,9 @@  discard block
 block discarded – undo
22 24
 	echo "updating NOTAM...";
23 25
 	$update_db->update_notam();
24 26
 	$update_db->insert_last_notam_update();
25
-} elseif (isset($globalDebug) && $globalDebug && isset($globalNOTAM) && $globalNOTAM) echo "NOTAM are only updated once a day.\n";
27
+} elseif (isset($globalDebug) && $globalDebug && isset($globalNOTAM) && $globalNOTAM) {
28
+	echo "NOTAM are only updated once a day.\n";
29
+}
26 30
 
27 31
 if ($update_db->check_last_update() && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS)) {
28 32
 	$update_db->update_all();
@@ -30,7 +34,9 @@  discard block
 block discarded – undo
30 34
 //	$Spotter = new Spotter();
31 35
 //	$Spotter->updateFieldsFromOtherTables();
32 36
 	$update_db->insert_last_update();
33
-} elseif (isset($globalDebug) && $globalDebug && (!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";
37
+} elseif (isset($globalDebug) && $globalDebug && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM)) {
38
+	echo "DB are populated with external data only every 15 days ! Files are not updated more often.\n";
39
+}
34 40
 
35 41
 
36 42
 if (isset($globalMETAR) && isset($globalMETARcycle) && $globalMETAR && $globalMETARcycle) {
@@ -40,15 +46,19 @@  discard block
 block discarded – undo
40 46
 	if ($METAR->check_last_update()) {
41 47
 		$METAR->addMETARCycle();
42 48
 		$METAR->insert_last_update();
43
-	} else echo "METAR are only updated every hours.\n";
44
-}
49
+	} else {
50
+		echo "METAR are only updated every hours.\n";
51
+	}
52
+	}
45 53
 
46 54
 
47 55
 if (isset($globalOwner) && $globalOwner && $update_db->check_last_owner_update() && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS)) {
48 56
 	echo "Updating private aircraft's owners...";
49 57
 	$update_db->update_owner();
50 58
 	$update_db->insert_last_owner_update();
51
-} elseif (isset($globalDebug) && $globalDebug && isset($globalOwner) && $globalOwner && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS)) echo "Owner are only updated every 15 days.\n";
59
+} elseif (isset($globalDebug) && $globalDebug && isset($globalOwner) && $globalOwner && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS)) {
60
+	echo "Owner are only updated every 15 days.\n";
61
+}
52 62
 
53 63
 if (isset($globalArchiveMonths) && $globalArchiveMonths > 0) {
54 64
 	echo "Updating statistics and archive old data...";
Please login to merge, or discard this patch.
scripts/daemon-spotter.php 1 patch
Braces   +433 added lines, -151 removed lines patch added patch discarded remove patch
@@ -13,7 +13,9 @@  discard block
 block discarded – undo
13 13
 require_once(dirname(__FILE__).'/../require/class.Connection.php');
14 14
 require_once(dirname(__FILE__).'/../require/class.Common.php');
15 15
 
16
-if (!isset($globalDebug)) $globalDebug = FALSE;
16
+if (!isset($globalDebug)) {
17
+	$globalDebug = FALSE;
18
+}
17 19
 
18 20
 // Check if schema is at latest version
19 21
 $Connection = new Connection();
@@ -43,15 +45,27 @@  discard block
 block discarded – undo
43 45
 $options = getopt('s::',array('source::','server','idsource::'));
44 46
 //if (isset($options['s'])) $hosts = array($options['s']);
45 47
 //elseif (isset($options['source'])) $hosts = array($options['source']);
46
-if (isset($options['s'])) $globalSources[] = array('host' => $options['s']);
47
-elseif (isset($options['source'])) $globalSources[] = array('host' => $options['source']);
48
-if (isset($options['server'])) $globalServer = TRUE;
49
-if (isset($options['idsource'])) $id_source = $options['idsource'];
50
-else $id_source = 1;
48
+if (isset($options['s'])) {
49
+	$globalSources[] = array('host' => $options['s']);
50
+} elseif (isset($options['source'])) {
51
+	$globalSources[] = array('host' => $options['source']);
52
+}
53
+if (isset($options['server'])) {
54
+	$globalServer = TRUE;
55
+}
56
+if (isset($options['idsource'])) {
57
+	$id_source = $options['idsource'];
58
+} else {
59
+	$id_source = 1;
60
+}
51 61
 if (isset($globalServer) && $globalServer) {
52
-    if ($globalDebug) echo "Using Server Mode\n";
62
+    if ($globalDebug) {
63
+    	echo "Using Server Mode\n";
64
+    }
53 65
     $SI=new SpotterServer();
54
-} else $SI=new SpotterImport($Connection->db);
66
+} else {
67
+	$SI=new SpotterImport($Connection->db);
68
+}
55 69
 //$APRS=new APRS($Connection->db);
56 70
 $SBS=new SBS($Connection->db);
57 71
 $Common=new Common();
@@ -68,14 +82,18 @@  discard block
 block discarded – undo
68 82
 }
69 83
 
70 84
 // let's try and connect
71
-if ($globalDebug) echo "Connecting...\n";
85
+if ($globalDebug) {
86
+	echo "Connecting...\n";
87
+}
72 88
 $use_aprs = false;
73 89
 
74 90
 function create_socket($host, $port, &$errno, &$errstr) {
75 91
     $ip = gethostbyname($host);
76 92
     $s = socket_create(AF_INET, SOCK_STREAM, 0);
77 93
     $r = @socket_connect($s, $ip, $port);
78
-    if (!socket_set_nonblock($s)) echo "Unable to set nonblock on socket\n";
94
+    if (!socket_set_nonblock($s)) {
95
+    	echo "Unable to set nonblock on socket\n";
96
+    }
79 97
     if ($r || socket_last_error() == 114 || socket_last_error() == 115) {
80 98
         return $s;
81 99
     }
@@ -97,22 +115,30 @@  discard block
 block discarded – undo
97 115
         	//$formats[$id] = 'deltadbtxt';
98 116
         	$globalSources[$id]['format'] = 'deltadbtxt';
99 117
         	//$last_exec['deltadbtxt'] = 0;
100
-        	if ($globalDebug) echo "Connect to deltadb source (".$host.")...\n";
118
+        	if ($globalDebug) {
119
+        		echo "Connect to deltadb source (".$host.")...\n";
120
+        	}
101 121
             } else if (preg_match('/vatsim-data.txt$/i',$host)) {
102 122
         	//$formats[$id] = 'vatsimtxt';
103 123
         	$globalSources[$id]['format'] = 'vatsimtxt';
104 124
         	//$last_exec['vatsimtxt'] = 0;
105
-        	if ($globalDebug) echo "Connect to vatsim source (".$host.")...\n";
125
+        	if ($globalDebug) {
126
+        		echo "Connect to vatsim source (".$host.")...\n";
127
+        	}
106 128
     	    } else if (preg_match('/aircraftlist.json$/i',$host)) {
107 129
         	//$formats[$id] = 'aircraftlistjson';
108 130
         	$$globalSources[$id]['format'] = 'aircraftlistjson';
109 131
         	//$last_exec['aircraftlistjson'] = 0;
110
-        	if ($globalDebug) echo "Connect to aircraftlist.json source (".$host.")...\n";
132
+        	if ($globalDebug) {
133
+        		echo "Connect to aircraftlist.json source (".$host.")...\n";
134
+        	}
111 135
     	    } else if (preg_match('/radarvirtuel.com\/file.json$/i',$host)) {
112 136
         	//$formats[$id] = 'radarvirtueljson';
113 137
         	$globalSources[$id]['format'] = 'radarvirtueljson';
114 138
         	//$last_exec['radarvirtueljson'] = 0;
115
-        	if ($globalDebug) echo "Connect to radarvirtuel.com/file.json source (".$host.")...\n";
139
+        	if ($globalDebug) {
140
+        		echo "Connect to radarvirtuel.com/file.json source (".$host.")...\n";
141
+        	}
116 142
         	if (!isset($globalSourcesRights) || (isset($globalSourcesRights) && !$globalSourcesRights)) {
117 143
         	    echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n";
118 144
         	    exit(0);
@@ -121,7 +147,9 @@  discard block
 block discarded – undo
121 147
         	//$formats[$id] = 'planeupdatefaa';
122 148
         	$globalSources[$id]['format'] = 'planeupdatefaa';
123 149
         	//$last_exec['planeupdatefaa'] = 0;
124
-        	if ($globalDebug) echo "Connect to planeUpdateFAA.php source (".$host.")...\n";
150
+        	if ($globalDebug) {
151
+        		echo "Connect to planeUpdateFAA.php source (".$host.")...\n";
152
+        	}
125 153
         	if (!isset($globalSourcesRights) || (isset($globalSourcesRights) && !$globalSourcesRights)) {
126 154
         	    echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n";
127 155
         	    exit(0);
@@ -130,22 +158,30 @@  discard block
 block discarded – undo
130 158
         	//$formats[$id] = 'phpvmacars';
131 159
         	$globalSources[$id]['format'] = 'phpvmacars';
132 160
         	//$last_exec['phpvmacars'] = 0;
133
-        	if ($globalDebug) echo "Connect to phpvmacars source (".$host.")...\n";
161
+        	if ($globalDebug) {
162
+        		echo "Connect to phpvmacars source (".$host.")...\n";
163
+        	}
134 164
             } else if (preg_match('/whazzup/i',$host)) {
135 165
         	//$formats[$id] = 'whazzup';
136 166
         	$globalSources[$id]['format'] = 'whazzup';
137 167
         	//$last_exec['whazzup'] = 0;
138
-        	if ($globalDebug) echo "Connect to whazzup source (".$host.")...\n";
168
+        	if ($globalDebug) {
169
+        		echo "Connect to whazzup source (".$host.")...\n";
170
+        	}
139 171
             } else if (preg_match('/recentpireps/i',$host)) {
140 172
         	//$formats[$id] = 'pirepsjson';
141 173
         	$globalSources[$id]['format'] = 'pirepsjson';
142 174
         	//$last_exec['pirepsjson'] = 0;
143
-        	if ($globalDebug) echo "Connect to pirepsjson source (".$host.")...\n";
175
+        	if ($globalDebug) {
176
+        		echo "Connect to pirepsjson source (".$host.")...\n";
177
+        	}
144 178
             } else if (preg_match(':data.fr24.com/zones/fcgi/feed.js:i',$host)) {
145 179
         	//$formats[$id] = 'fr24json';
146 180
         	$globalSources[$id]['format'] = 'fr24json';
147 181
         	//$last_exec['fr24json'] = 0;
148
-        	if ($globalDebug) echo "Connect to fr24 source (".$host.")...\n";
182
+        	if ($globalDebug) {
183
+        		echo "Connect to fr24 source (".$host.")...\n";
184
+        	}
149 185
         	if (!isset($globalSourcesRights) || (isset($globalSourcesRights) && !$globalSourcesRights)) {
150 186
         	    echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n";
151 187
         	    exit(0);
@@ -154,14 +190,21 @@  discard block
 block discarded – undo
154 190
             } else if (preg_match('/10001/',$host) || $globalSources[$id]['port'] == '10001') {
155 191
         	//$formats[$id] = 'tsv';
156 192
         	$globalSources[$id]['format'] = 'tsv';
157
-        	if ($globalDebug) echo "Connect to tsv source (".$host.")...\n";
193
+        	if ($globalDebug) {
194
+        		echo "Connect to tsv source (".$host.")...\n";
195
+        	}
158 196
             }
159 197
         } elseif (filter_var($host,FILTER_VALIDATE_URL)) {
160
-        	if ($globalDebug) echo "Connect to ".$globalSources[$id]['format']." source (".$host.")...\n";
198
+        	if ($globalDebug) {
199
+        		echo "Connect to ".$globalSources[$id]['format']." source (".$host.")...\n";
200
+        	}
161 201
         } elseif (!filter_var($host,FILTER_VALIDATE_URL)) {
162 202
 	    $hostport = explode(':',$host);
163
-	    if (isset($hostport[1])) $port = $hostport[1];
164
-	    else $port = $globalSources[$id]['port'];
203
+	    if (isset($hostport[1])) {
204
+	    	$port = $hostport[1];
205
+	    } else {
206
+	    	$port = $globalSources[$id]['port'];
207
+	    }
165 208
     	    $s = create_socket($host,$port, $errno, $errstr);
166 209
 	    if ($s) {
167 210
     	        $sockets[$id] = $s;
@@ -182,17 +225,25 @@  discard block
 block discarded – undo
182 225
         		//$formats[$id] = 'beast';
183 226
         		$globalSources[$id]['format'] = 'beast';
184 227
 		    //} else $formats[$id] = 'sbs';
185
-		    } else $globalSources[$id]['format'] = 'sbs';
228
+		    } else {
229
+		    	$globalSources[$id]['format'] = 'sbs';
230
+		    }
186 231
 		    //if ($globalDebug) echo 'Connection in progress to '.$host.'('.$formats[$id].')....'."\n";
187 232
 		}
188
-		if ($globalDebug) echo 'Connection in progress to '.$host.'('.$globalSources[$id]['format'].')....'."\n";
233
+		if ($globalDebug) {
234
+			echo 'Connection in progress to '.$host.'('.$globalSources[$id]['format'].')....'."\n";
235
+		}
189 236
             } else {
190
-		if ($globalDebug) echo 'Connection failed to '.$host.':'.$port.' : '.$errno.' '.$errstr."\n";
237
+		if ($globalDebug) {
238
+			echo 'Connection failed to '.$host.':'.$port.' : '.$errno.' '.$errstr."\n";
239
+		}
191 240
     	    }
192 241
         }
193 242
     }
194 243
 }
195
-if (!isset($globalMinFetch)) $globalMinFetch = 0;
244
+if (!isset($globalMinFetch)) {
245
+	$globalMinFetch = 0;
246
+}
196 247
 
197 248
 // Initialize all
198 249
 $status = array();
@@ -200,13 +251,19 @@  discard block
 block discarded – undo
200 251
 $formats = array();
201 252
 $last_exec = array();
202 253
 $time = time();
203
-if (isset($globalSourcesTimeout)) $timeout = $globalSourcesTimeOut;
204
-else if (isset($globalSBS1TimeOut)) $timeout = $globalSBS1TimeOut;
205
-else $timeout = 20;
254
+if (isset($globalSourcesTimeout)) {
255
+	$timeout = $globalSourcesTimeOut;
256
+} else if (isset($globalSBS1TimeOut)) {
257
+	$timeout = $globalSBS1TimeOut;
258
+} else {
259
+	$timeout = 20;
260
+}
206 261
 $errno = '';
207 262
 $errstr='';
208 263
 
209
-if (!isset($globalDaemon)) $globalDaemon = TRUE;
264
+if (!isset($globalDaemon)) {
265
+	$globalDaemon = TRUE;
266
+}
210 267
 /* Initiate connections to all the hosts simultaneously */
211 268
 //connect_all($hosts);
212 269
 connect_all($globalSources);
@@ -228,23 +285,41 @@  discard block
 block discarded – undo
228 285
 	$aprs_connect = 0;
229 286
 	$aprs_keep = 240;
230 287
 	$aprs_last_tx = time();
231
-	if (isset($globalAPRSversion)) $aprs_version = $globalAPRSversion;
232
-	else $aprs_version = $globalName.' using FlightAirMap';
288
+	if (isset($globalAPRSversion)) {
289
+		$aprs_version = $globalAPRSversion;
290
+	} else {
291
+		$aprs_version = $globalName.' using FlightAirMap';
292
+	}
233 293
 	//else $aprs_version = 'Perl Example App';
234
-	if (isset($globalAPRSssid)) $aprs_ssid = $globalAPRSssid;
235
-	else $aprs_ssid = 'FAM';
294
+	if (isset($globalAPRSssid)) {
295
+		$aprs_ssid = $globalAPRSssid;
296
+	} else {
297
+		$aprs_ssid = 'FAM';
298
+	}
236 299
 	//else $aprs_ssid = 'PerlEx';
237
-	if (isset($globalAPRSfilter)) $aprs_filter = $globalAPRSfilter;
238
-	else $aprs_filter =  'r/'.$globalCenterLatitude.'/'.$globalCenterLongitude.'/250.0';
239
-	if ($aprs_filter != '') $aprs_login = "user {$aprs_ssid} appid {$aprs_version} filter {$aprs_filter}\n";
240
-	else $aprs_login = "user {$aprs_ssid} appid {$aprs_version}\n";
241
-}
300
+	if (isset($globalAPRSfilter)) {
301
+		$aprs_filter = $globalAPRSfilter;
302
+	} else {
303
+		$aprs_filter =  'r/'.$globalCenterLatitude.'/'.$globalCenterLongitude.'/250.0';
304
+	}
305
+	if ($aprs_filter != '') {
306
+		$aprs_login = "user {$aprs_ssid} appid {$aprs_version} filter {$aprs_filter}\n";
307
+	} else {
308
+		$aprs_login = "user {$aprs_ssid} appid {$aprs_version}\n";
309
+	}
310
+	}
242 311
 
243 312
 // connected - lets do some work
244
-if ($globalDebug) echo "Connected!\n";
313
+if ($globalDebug) {
314
+	echo "Connected!\n";
315
+}
245 316
 sleep(1);
246
-if ($globalDebug) echo "SCAN MODE \n\n";
247
-if (!isset($globalCronEnd)) $globalCronEnd = 60;
317
+if ($globalDebug) {
318
+	echo "SCAN MODE \n\n";
319
+}
320
+if (!isset($globalCronEnd)) {
321
+	$globalCronEnd = 60;
322
+}
248 323
 $endtime = time()+$globalCronEnd;
249 324
 $i = 1;
250 325
 $tt = 0;
@@ -259,7 +334,9 @@  discard block
 block discarded – undo
259 334
 
260 335
 // Infinite loop if daemon, else work for time defined in $globalCronEnd or only one time.
261 336
 while ($i > 0) {
262
-    if (!$globalDaemon) $i = $endtime-time();
337
+    if (!$globalDaemon) {
338
+    	$i = $endtime-time();
339
+    }
263 340
     // Delete old ATC
264 341
     if ($globalDaemon && ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM))) {
265 342
         $ATC->deleteOldATC();
@@ -289,8 +366,12 @@  discard block
 block discarded – undo
289 366
 		    $data['datetime'] = date('Y-m-d H:i:s');
290 367
 		    $data['format_source'] = 'deltadbtxt';
291 368
     		    $data['id_source'] = $id_source;
292
-		    if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name'];
293
-		    if (isset($value['sourcestats'])) $data['sourcestats'] = $value['sourcestats'];
369
+		    if (isset($value['name']) && $value['name'] != '') {
370
+		    	$data['source_name'] = $value['name'];
371
+		    }
372
+		    if (isset($value['sourcestats'])) {
373
+		    	$data['sourcestats'] = $value['sourcestats'];
374
+		    }
294 375
     		    $SI->add($data);
295 376
 		    unset($data);
296 377
     		}
@@ -312,10 +393,19 @@  discard block
 block discarded – undo
312 393
 			$data['pilot_name'] = $line[2];
313 394
 			$data['hex'] = str_pad(dechex($line[1]),6,'000000',STR_PAD_LEFT);
314 395
 			$data['ident'] = $line[0]; // ident
315
-			if ($line[7] != '' && $line[7] != 0) $data['altitude'] = $line[7]; // altitude
396
+			if ($line[7] != '' && $line[7] != 0) {
397
+				$data['altitude'] = $line[7];
398
+			}
399
+			// altitude
316 400
 			$data['speed'] = $line[8]; // speed
317
-			if (isset($line[45])) $data['heading'] = $line[45]; // heading
318
-			elseif (isset($line[38])) $data['heading'] = $line[38]; // heading
401
+			if (isset($line[45])) {
402
+				$data['heading'] = $line[45];
403
+			}
404
+			// heading
405
+			elseif (isset($line[38])) {
406
+				$data['heading'] = $line[38];
407
+			}
408
+			// heading
319 409
 			$data['latitude'] = $line[5]; // lat
320 410
 	        	$data['longitude'] = $line[6]; // long
321 411
 	        	$data['verticalrate'] = ''; // vertical rate
@@ -330,7 +420,9 @@  discard block
 block discarded – undo
330 420
 			$data['frequency'] = $line[4];
331 421
 			$data['type'] = $line[18];
332 422
 			$data['range'] = $line[19];
333
-			if (isset($line[35])) $data['info'] = $line[35];
423
+			if (isset($line[35])) {
424
+				$data['info'] = $line[35];
425
+			}
334 426
     			$data['id_source'] = $id_source;
335 427
 	    		//$data['arrival_airport_time'] = ;
336 428
 	    		if ($line[9] != '') {
@@ -344,22 +436,35 @@  discard block
 block discarded – undo
344 436
 	    		elseif ($value == 'vatsimtxt') $data['format_source'] = 'vatsimtxt';
345 437
 	    		*/
346 438
 	    		$data['format_source'] = $value['format'];
347
-			if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name'];
348
-    			if ($line[3] == 'PILOT') $SI->add($data);
349
-			elseif ($line[3] == 'ATC') {
439
+			if (isset($value['name']) && $value['name'] != '') {
440
+				$data['source_name'] = $value['name'];
441
+			}
442
+    			if ($line[3] == 'PILOT') {
443
+    				$SI->add($data);
444
+    			} elseif ($line[3] == 'ATC') {
350 445
 				//print_r($data);
351 446
 				$data['info'] = str_replace('^&sect;','<br />',$data['info']);
352 447
 				$data['info'] = str_replace('&amp;sect;','',$data['info']);
353 448
 				$typec = substr($data['ident'],-3);
354
-				if ($typec == 'APP') $data['type'] = 'Approach';
355
-				elseif ($typec == 'TWR') $data['type'] = 'Tower';
356
-				elseif ($typec == 'OBS') $data['type'] = 'Observer';
357
-				elseif ($typec == 'GND') $data['type'] = 'Ground';
358
-				elseif ($typec == 'DEL') $data['type'] = 'Delivery';
359
-				elseif ($typec == 'DEP') $data['type'] = 'Departure';
360
-				elseif ($typec == 'FSS') $data['type'] = 'Flight Service Station';
361
-				elseif ($typec == 'CTR') $data['type'] = 'Control Radar or Centre';
362
-				elseif ($data['type'] == '') $data['type'] = 'Observer';
449
+				if ($typec == 'APP') {
450
+					$data['type'] = 'Approach';
451
+				} elseif ($typec == 'TWR') {
452
+					$data['type'] = 'Tower';
453
+				} elseif ($typec == 'OBS') {
454
+					$data['type'] = 'Observer';
455
+				} elseif ($typec == 'GND') {
456
+					$data['type'] = 'Ground';
457
+				} elseif ($typec == 'DEL') {
458
+					$data['type'] = 'Delivery';
459
+				} elseif ($typec == 'DEP') {
460
+					$data['type'] = 'Departure';
461
+				} elseif ($typec == 'FSS') {
462
+					$data['type'] = 'Flight Service Station';
463
+				} elseif ($typec == 'CTR') {
464
+					$data['type'] = 'Control Radar or Centre';
465
+				} elseif ($data['type'] == '') {
466
+					$data['type'] = 'Observer';
467
+				}
363 468
 				
364 469
 				echo $ATC->add($data['ident'],$data['frequency'],$data['latitude'],$data['longitude'],$data['range'],$data['info'],$data['datetime'],$data['type'],$data['pilot_id'],$data['pilot_name']);
365 470
 			}
@@ -379,26 +484,55 @@  discard block
 block discarded – undo
379 484
 		foreach ($all_data['acList'] as $line) {
380 485
 		    $data = array();
381 486
 		    $data['hex'] = $line['Icao']; // hex
382
-		    if (isset($line['Call'])) $data['ident'] = $line['Call']; // ident
383
-		    if (isset($line['Alt'])) $data['altitude'] = $line['Alt']; // altitude
384
-		    if (isset($line['Spd'])) $data['speed'] = $line['Spd']; // speed
385
-		    if (isset($line['Trak'])) $data['heading'] = $line['Trak']; // heading
386
-		    if (isset($line['Lat'])) $data['latitude'] = $line['Lat']; // lat
387
-		    if (isset($line['Long'])) $data['longitude'] = $line['Long']; // long
487
+		    if (isset($line['Call'])) {
488
+		    	$data['ident'] = $line['Call'];
489
+		    }
490
+		    // ident
491
+		    if (isset($line['Alt'])) {
492
+		    	$data['altitude'] = $line['Alt'];
493
+		    }
494
+		    // altitude
495
+		    if (isset($line['Spd'])) {
496
+		    	$data['speed'] = $line['Spd'];
497
+		    }
498
+		    // speed
499
+		    if (isset($line['Trak'])) {
500
+		    	$data['heading'] = $line['Trak'];
501
+		    }
502
+		    // heading
503
+		    if (isset($line['Lat'])) {
504
+		    	$data['latitude'] = $line['Lat'];
505
+		    }
506
+		    // lat
507
+		    if (isset($line['Long'])) {
508
+		    	$data['longitude'] = $line['Long'];
509
+		    }
510
+		    // long
388 511
 		    //$data['verticalrate'] = $line['']; // verticale rate
389
-		    if (isset($line['Sqk'])) $data['squawk'] = $line['Sqk']; // squawk
512
+		    if (isset($line['Sqk'])) {
513
+		    	$data['squawk'] = $line['Sqk'];
514
+		    }
515
+		    // squawk
390 516
 		    $data['emergency'] = ''; // emergency
391
-		    if (isset($line['Reg'])) $data['registration'] = $line['Reg'];
517
+		    if (isset($line['Reg'])) {
518
+		    	$data['registration'] = $line['Reg'];
519
+		    }
392 520
 		    /*
393 521
 		    if (isset($line['PosTime'])) $data['datetime'] = date('Y-m-d H:i:s',$line['PosTime']/1000);
394 522
 		    else $data['datetime'] = date('Y-m-d H:i:s');
395 523
 		    */
396 524
 		    $data['datetime'] = date('Y-m-d H:i:s');
397
-		    if (isset($line['Type'])) $data['aircraft_icao'] = $line['Type'];
525
+		    if (isset($line['Type'])) {
526
+		    	$data['aircraft_icao'] = $line['Type'];
527
+		    }
398 528
 	    	    $data['format_source'] = 'aircraftlistjson';
399 529
 		    $data['id_source'] = $id_source;
400
-		    if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name'];
401
-		    if (isset($data['datetime'])) $SI->add($data);
530
+		    if (isset($value['name']) && $value['name'] != '') {
531
+		    	$data['source_name'] = $value['name'];
532
+		    }
533
+		    if (isset($data['datetime'])) {
534
+		    	$SI->add($data);
535
+		    }
402 536
 		    unset($data);
403 537
 		}
404 538
 	    } else {
@@ -417,7 +551,9 @@  discard block
 block discarded – undo
417 551
 		    $data['datetime'] = date('Y-m-d H:i:s');
418 552
 	    	    $data['format_source'] = 'aircraftlistjson';
419 553
     		    $data['id_source'] = $id_source;
420
-		    if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name'];
554
+		    if (isset($value['name']) && $value['name'] != '') {
555
+		    	$data['source_name'] = $value['name'];
556
+		    }
421 557
 		    $SI->add($data);
422 558
 		    unset($data);
423 559
 		}
@@ -452,7 +588,9 @@  discard block
 block discarded – undo
452 588
 		    $data['datetime'] = date('Y-m-d H:i:s',$line[9]);
453 589
 	    	    $data['format_source'] = 'planeupdatefaa';
454 590
     		    $data['id_source'] = $id_source;
455
-		    if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name'];
591
+		    if (isset($value['name']) && $value['name'] != '') {
592
+		    	$data['source_name'] = $value['name'];
593
+		    }
456 594
 		    $SI->add($data);
457 595
 		    unset($data);
458 596
 		}
@@ -484,7 +622,9 @@  discard block
 block discarded – undo
484 622
 		    $data['datetime'] = date('Y-m-d H:i:s'); //$line[10]
485 623
 	    	    $data['format_source'] = 'fr24json';
486 624
     		    $data['id_source'] = $id_source;
487
-		    if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name'];
625
+		    if (isset($value['name']) && $value['name'] != '') {
626
+		    	$data['source_name'] = $value['name'];
627
+		    }
488 628
 		    $SI->add($data);
489 629
 		    unset($data);
490 630
 		}
@@ -507,23 +647,39 @@  discard block
 block discarded – undo
507 647
 		    if (isset($line['inf'])) {
508 648
 			$data = array();
509 649
 			$data['hex'] = $line['inf']['ia'];
510
-			if (isset($line['inf']['cs'])) $data['ident'] = $line['inf']['cs']; //$line[13]
650
+			if (isset($line['inf']['cs'])) {
651
+				$data['ident'] = $line['inf']['cs'];
652
+			}
653
+			//$line[13]
511 654
 	    		$data['altitude'] = round($line['inf']['al']*3.28084); // altitude
512
-	    		if (isset($line['inf']['gs'])) $data['speed'] = round($line['inf']['gs']*0.539957); // speed
513
-	    		if (isset($line['inf']['tr'])) $data['heading'] = $line['inf']['tr']; // heading
655
+	    		if (isset($line['inf']['gs'])) {
656
+	    			$data['speed'] = round($line['inf']['gs']*0.539957);
657
+	    		}
658
+	    		// speed
659
+	    		if (isset($line['inf']['tr'])) {
660
+	    			$data['heading'] = $line['inf']['tr'];
661
+	    		}
662
+	    		// heading
514 663
 	    		$data['latitude'] = $line['pt'][0]; // lat
515 664
 	    		$data['longitude'] = $line['pt'][1]; // long
516 665
 	    		//if (isset($line['inf']['vs'])) $data['verticalrate'] = $line['inf']['vs']; // verticale rate
517
-	    		if (isset($line['inf']['sq'])) $data['squawk'] = $line['inf']['sq']; // squawk
666
+	    		if (isset($line['inf']['sq'])) {
667
+	    			$data['squawk'] = $line['inf']['sq'];
668
+	    		}
669
+	    		// squawk
518 670
 	    		//$data['aircraft_icao'] = $line[8];
519
-	    		if (isset($line['inf']['rc'])) $data['registration'] = $line['inf']['rc'];
671
+	    		if (isset($line['inf']['rc'])) {
672
+	    			$data['registration'] = $line['inf']['rc'];
673
+	    		}
520 674
 			//$data['departure_airport_iata'] = $line[11];
521 675
 			//$data['arrival_airport_iata'] = $line[12];
522 676
 	    		//$data['emergency'] = ''; // emergency
523 677
 			$data['datetime'] = date('Y-m-d H:i:s',$line['inf']['dt']); //$line[10]
524 678
 	    		$data['format_source'] = 'radarvirtueljson';
525 679
     			$data['id_source'] = $id_source;
526
-			if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name'];
680
+			if (isset($value['name']) && $value['name'] != '') {
681
+				$data['source_name'] = $value['name'];
682
+			}
527 683
 			$SI->add($data);
528 684
 			unset($data);
529 685
 		    }
@@ -542,29 +698,62 @@  discard block
 block discarded – undo
542 698
 		    $data = array();
543 699
 		    $data['hex'] = str_pad(dechex($line['id']),6,'000000',STR_PAD_LEFT);
544 700
 		    $data['ident'] = $line['callsign']; // ident
545
-		    if (isset($line['pilotid'])) $data['pilot_id'] = $line['pilotid']; // pilot id
546
-		    if (isset($line['name'])) $data['pilot_name'] = $line['name']; // pilot name
547
-		    if (isset($line['alt'])) $data['altitude'] = $line['alt']; // altitude
548
-		    if (isset($line['gs'])) $data['speed'] = $line['gs']; // speed
549
-		    if (isset($line['heading'])) $data['heading'] = $line['heading']; // heading
550
-		    if (isset($line['route'])) $data['waypoints'] = $line['route']; // route
701
+		    if (isset($line['pilotid'])) {
702
+		    	$data['pilot_id'] = $line['pilotid'];
703
+		    }
704
+		    // pilot id
705
+		    if (isset($line['name'])) {
706
+		    	$data['pilot_name'] = $line['name'];
707
+		    }
708
+		    // pilot name
709
+		    if (isset($line['alt'])) {
710
+		    	$data['altitude'] = $line['alt'];
711
+		    }
712
+		    // altitude
713
+		    if (isset($line['gs'])) {
714
+		    	$data['speed'] = $line['gs'];
715
+		    }
716
+		    // speed
717
+		    if (isset($line['heading'])) {
718
+		    	$data['heading'] = $line['heading'];
719
+		    }
720
+		    // heading
721
+		    if (isset($line['route'])) {
722
+		    	$data['waypoints'] = $line['route'];
723
+		    }
724
+		    // route
551 725
 		    $data['latitude'] = $line['lat']; // lat
552 726
 		    $data['longitude'] = $line['lon']; // long
553 727
 		    //$data['verticalrate'] = $line['vrt']; // verticale rate
554 728
 		    //$data['squawk'] = $line['squawk']; // squawk
555 729
 		    //$data['emergency'] = ''; // emergency
556
-		    if (isset($line['depicao'])) $data['departure_airport_icao'] = $line['depicao'];
557
-		    if (isset($line['deptime'])) $data['departure_airport_time'] = $line['deptime'];
558
-		    if (isset($line['arricao'])) $data['arrival_airport_icao'] = $line['arricao'];
730
+		    if (isset($line['depicao'])) {
731
+		    	$data['departure_airport_icao'] = $line['depicao'];
732
+		    }
733
+		    if (isset($line['deptime'])) {
734
+		    	$data['departure_airport_time'] = $line['deptime'];
735
+		    }
736
+		    if (isset($line['arricao'])) {
737
+		    	$data['arrival_airport_icao'] = $line['arricao'];
738
+		    }
559 739
 		    //$data['arrival_airport_time'] = $line['arrtime'];
560
-		    if (isset($line['aircraft'])) $data['aircraft_icao'] = $line['aircraft'];
561
-		    if (isset($line['transponder'])) $data['squawk'] = $line['transponder'];
562
-		    if (isset($line['atis'])) $data['info'] = $line['atis'];
563
-		    else $data['info'] = '';
740
+		    if (isset($line['aircraft'])) {
741
+		    	$data['aircraft_icao'] = $line['aircraft'];
742
+		    }
743
+		    if (isset($line['transponder'])) {
744
+		    	$data['squawk'] = $line['transponder'];
745
+		    }
746
+		    if (isset($line['atis'])) {
747
+		    	$data['info'] = $line['atis'];
748
+		    } else {
749
+		    	$data['info'] = '';
750
+		    }
564 751
 		    $data['format_source'] = 'pireps';
565 752
     		    $data['id_source'] = $id_source;
566 753
 		    $data['datetime'] = date('Y-m-d H:i:s');
567
-		    if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name'];
754
+		    if (isset($value['name']) && $value['name'] != '') {
755
+		    	$data['source_name'] = $value['name'];
756
+		    }
568 757
 		    if ($line['icon'] == 'plane') {
569 758
 			$SI->add($data);
570 759
 		    //    print_r($data);
@@ -573,15 +762,25 @@  discard block
 block discarded – undo
573 762
 			$data['info'] = str_replace('&amp;sect;','',$data['info']);
574 763
 			$typec = substr($data['ident'],-3);
575 764
 			$data['type'] = '';
576
-			if ($typec == 'APP') $data['type'] = 'Approach';
577
-			elseif ($typec == 'TWR') $data['type'] = 'Tower';
578
-			elseif ($typec == 'OBS') $data['type'] = 'Observer';
579
-			elseif ($typec == 'GND') $data['type'] = 'Ground';
580
-			elseif ($typec == 'DEL') $data['type'] = 'Delivery';
581
-			elseif ($typec == 'DEP') $data['type'] = 'Departure';
582
-			elseif ($typec == 'FSS') $data['type'] = 'Flight Service Station';
583
-			elseif ($typec == 'CTR') $data['type'] = 'Control Radar or Centre';
584
-			else $data['type'] = 'Observer';
765
+			if ($typec == 'APP') {
766
+				$data['type'] = 'Approach';
767
+			} elseif ($typec == 'TWR') {
768
+				$data['type'] = 'Tower';
769
+			} elseif ($typec == 'OBS') {
770
+				$data['type'] = 'Observer';
771
+			} elseif ($typec == 'GND') {
772
+				$data['type'] = 'Ground';
773
+			} elseif ($typec == 'DEL') {
774
+				$data['type'] = 'Delivery';
775
+			} elseif ($typec == 'DEP') {
776
+				$data['type'] = 'Departure';
777
+			} elseif ($typec == 'FSS') {
778
+				$data['type'] = 'Flight Service Station';
779
+			} elseif ($typec == 'CTR') {
780
+				$data['type'] = 'Control Radar or Centre';
781
+			} else {
782
+				$data['type'] = 'Observer';
783
+			}
585 784
 			echo $ATC->add($data['ident'],'',$data['latitude'],$data['longitude'],'0',$data['info'],$data['datetime'],$data['type'],$data['pilot_id'],$data['pilot_name']);
586 785
 		    }
587 786
 		    unset($data);
@@ -599,8 +798,12 @@  discard block
 block discarded – undo
599 798
 	    	    $data = array();
600 799
 	    	    //$data['id'] = $line['id']; // id not usable
601 800
 	    	    $data['hex'] = substr(str_pad(bin2hex($line['flightnum']),6,'000000',STR_PAD_LEFT),-6); // hex
602
-	    	    if (isset($line['pilotname'])) $data['pilot_name'] = $line['pilotname'];
603
-	    	    if (isset($line['pilotid'])) $data['pilot_id'] = $line['pilotid'];
801
+	    	    if (isset($line['pilotname'])) {
802
+	    	    	$data['pilot_name'] = $line['pilotname'];
803
+	    	    }
804
+	    	    if (isset($line['pilotid'])) {
805
+	    	    	$data['pilot_id'] = $line['pilotid'];
806
+	    	    }
604 807
 	    	    $data['ident'] = $line['flightnum']; // ident
605 808
 	    	    $data['altitude'] = $line['alt']; // altitude
606 809
 	    	    $data['speed'] = $line['gs']; // speed
@@ -617,23 +820,35 @@  discard block
 block discarded – undo
617 820
 	    	    $data['arrival_airport_icao'] = $line['arricao'];
618 821
     		    $data['arrival_airport_time'] = $line['arrtime'];
619 822
     		    $data['registration'] = $line['aircraft'];
620
-		    if (isset($line['route'])) $data['waypoints'] = $line['route']; // route
823
+		    if (isset($line['route'])) {
824
+		    	$data['waypoints'] = $line['route'];
825
+		    }
826
+		    // route
621 827
 		    if (isset($line['aircraftname'])) {
622 828
 			$line['aircraftname'] = strtoupper($line['aircraftname']);
623 829
 			$line['aircraftname'] = str_replace('BOEING ','B',$line['aircraftname']);
624 830
 	    		$aircraft_data = explode('-',$line['aircraftname']);
625
-	    		if (isset($aircraft_data[1]) && strlen($aircraft_data[0]) < 5) $data['aircraft_icao'] = $aircraft_data[0];
626
-	    		elseif (isset($aircraft_data[1]) && strlen($aircraft_data[1]) < 5) $data['aircraft_icao'] = $aircraft_data[1];
627
-	    		else {
831
+	    		if (isset($aircraft_data[1]) && strlen($aircraft_data[0]) < 5) {
832
+	    			$data['aircraft_icao'] = $aircraft_data[0];
833
+	    		} elseif (isset($aircraft_data[1]) && strlen($aircraft_data[1]) < 5) {
834
+	    			$data['aircraft_icao'] = $aircraft_data[1];
835
+	    		} else {
628 836
 	    		    $aircraft_data = explode(' ',$line['aircraftname']);
629
-	    		    if (isset($aircraft_data[1])) $data['aircraft_icao'] = $aircraft_data[1];
630
-	    		    else $data['aircraft_icao'] = $line['aircraftname'];
837
+	    		    if (isset($aircraft_data[1])) {
838
+	    		    	$data['aircraft_icao'] = $aircraft_data[1];
839
+	    		    } else {
840
+	    		    	$data['aircraft_icao'] = $line['aircraftname'];
841
+	    		    }
631 842
 	    		}
632 843
 	    	    }
633
-    		    if (isset($line['route'])) $data['waypoints'] = $line['route'];
844
+    		    if (isset($line['route'])) {
845
+    		    	$data['waypoints'] = $line['route'];
846
+    		    }
634 847
     		    $data['id_source'] = $id_source;
635 848
 	    	    $data['format_source'] = 'phpvmacars';
636
-		    if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name'];
849
+		    if (isset($value['name']) && $value['name'] != '') {
850
+		    	$data['source_name'] = $value['name'];
851
+		    }
637 852
 		    $SI->add($data);
638 853
 		    unset($data);
639 854
 		}
@@ -642,14 +857,18 @@  discard block
 block discarded – undo
642 857
     	    $value['last_exec'] = time();
643 858
 	//} elseif ($value == 'sbs' || $value == 'tsv' || $value == 'raw' || $value == 'aprs' || $value == 'beast') {
644 859
 	} elseif ($value['format'] == 'sbs' || $value['format'] == 'tsv' || $value['format'] == 'raw' || $value['format'] == 'aprs' || $value['format'] == 'beast') {
645
-	    if (function_exists('pcntl_fork')) pcntl_signal_dispatch();
860
+	    if (function_exists('pcntl_fork')) {
861
+	    	pcntl_signal_dispatch();
862
+	    }
646 863
 
647 864
 	    //$read = array( $sockets[$id] );
648 865
 	    $read = $sockets;
649 866
 	    $write = NULL;
650 867
 	    $e = NULL;
651 868
 	    $n = socket_select($read, $write, $e, $timeout);
652
-	    if ($e != NULL) var_dump($e);
869
+	    if ($e != NULL) {
870
+	    	var_dump($e);
871
+	    }
653 872
 	    if ($n > 0) {
654 873
 		foreach ($read as $nb => $r) {
655 874
 		    //$value = $formats[$nb];
@@ -671,8 +890,12 @@  discard block
 block discarded – undo
671 890
 			    if (is_array($data)) {
672 891
 				$data['datetime'] = date('Y-m-d H:i:s');
673 892
 				$data['format_source'] = 'raw';
674
-				if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') $data['source_name'] = $globalSources[$nb]['name'];
675
-    				if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats'];
893
+				if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') {
894
+					$data['source_name'] = $globalSources[$nb]['name'];
895
+				}
896
+    				if (isset($globalSources[$nb]['sourcestats'])) {
897
+    					$data['sourcestats'] = $globalSources[$nb]['sourcestats'];
898
+    				}
676 899
                                 $SI->add($data);
677 900
                             }
678 901
 			} elseif ($format == 'beast') {
@@ -688,21 +911,41 @@  discard block
 block discarded – undo
688 911
     				$data['hex'] = $lined['hexid'];
689 912
     				//$data['datetime'] = date('Y-m-d H:i:s',strtotime($lined['clock']));;
690 913
     				$data['datetime'] = date('Y-m-d H:i:s');;
691
-    				if (isset($lined['ident'])) $data['ident'] = $lined['ident'];
692
-    				if (isset($lined['lat'])) $data['latitude'] = $lined['lat'];
693
-    				if (isset($lined['lon'])) $data['longitude'] = $lined['lon'];
694
-    				if (isset($lined['speed'])) $data['speed'] = $lined['speed'];
695
-    				if (isset($lined['squawk'])) $data['squawk'] = $lined['squawk'];
696
-    				if (isset($lined['alt'])) $data['altitude'] = $lined['alt'];
697
-    				if (isset($lined['heading'])) $data['heading'] = $lined['heading'];
914
+    				if (isset($lined['ident'])) {
915
+    					$data['ident'] = $lined['ident'];
916
+    				}
917
+    				if (isset($lined['lat'])) {
918
+    					$data['latitude'] = $lined['lat'];
919
+    				}
920
+    				if (isset($lined['lon'])) {
921
+    					$data['longitude'] = $lined['lon'];
922
+    				}
923
+    				if (isset($lined['speed'])) {
924
+    					$data['speed'] = $lined['speed'];
925
+    				}
926
+    				if (isset($lined['squawk'])) {
927
+    					$data['squawk'] = $lined['squawk'];
928
+    				}
929
+    				if (isset($lined['alt'])) {
930
+    					$data['altitude'] = $lined['alt'];
931
+    				}
932
+    				if (isset($lined['heading'])) {
933
+    					$data['heading'] = $lined['heading'];
934
+    				}
698 935
     				$data['id_source'] = $id_source;
699 936
     				$data['format_source'] = 'tsv';
700
-    				if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') $data['source_name'] = $globalSources[$nb]['name'];
701
-    				if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats'];
937
+    				if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') {
938
+    					$data['source_name'] = $globalSources[$nb]['name'];
939
+    				}
940
+    				if (isset($globalSources[$nb]['sourcestats'])) {
941
+    					$data['sourcestats'] = $globalSources[$nb]['sourcestats'];
942
+    				}
702 943
     				$SI->add($data);
703 944
     				unset($lined);
704 945
     				unset($data);
705
-    			    } else $error = true;
946
+    			    } else {
947
+    			    	$error = true;
948
+    			    }
706 949
 			} elseif ($format == 'aprs' && $use_aprs) {
707 950
 			    if ($aprs_connect == 0) {
708 951
 				$send = @ socket_send( $r  , $aprs_login , strlen($aprs_login) , 0 );
@@ -726,29 +969,44 @@  discard block
 block discarded – undo
726 969
 				    $data['latitude'] = $line['latitude'];
727 970
 				    $data['longitude'] = $line['longitude'];
728 971
 				    //$data['verticalrate'] = $line[16];
729
-				    if (isset($line['speed'])) $data['speed'] = $line['speed'];
730
-				    else $data['speed'] = 0;
972
+				    if (isset($line['speed'])) {
973
+				    	$data['speed'] = $line['speed'];
974
+				    } else {
975
+				    	$data['speed'] = 0;
976
+				    }
731 977
 				    $data['altitude'] = $line['altitude'];
732
-				    if (isset($line['course'])) $data['heading'] = $line['course'];
978
+				    if (isset($line['course'])) {
979
+				    	$data['heading'] = $line['course'];
980
+				    }
733 981
 				    //else $data['heading'] = 0;
734 982
 				    $data['aircraft_type'] = $line['stealth'];
735
-				    if (!isset($globalAPRSarchive) || (isset($globalAPRSarchive) && $globalAPRSarchive == FALSE)) $data['noarchive'] = true;
983
+				    if (!isset($globalAPRSarchive) || (isset($globalAPRSarchive) && $globalAPRSarchive == FALSE)) {
984
+				    	$data['noarchive'] = true;
985
+				    }
736 986
     				    $data['id_source'] = $id_source;
737 987
 				    $data['format_source'] = 'aprs';
738 988
 				    $data['source_name'] = $line['source'];
739
-    				    if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats'];
989
+    				    if (isset($globalSources[$nb]['sourcestats'])) {
990
+    				    	$data['sourcestats'] = $globalSources[$nb]['sourcestats'];
991
+    				    }
740 992
 				    $currentdate = date('Y-m-d H:i:s');
741 993
 				    $aprsdate = strtotime($data['datetime']);
742 994
 				    // Accept data if time <= system time + 20s
743
-				    if ($line['stealth'] == 0 && (strtotime($data['datetime']) <= strtotime($currentdate)+20)) $send = $SI->add($data);
744
-				    else {
745
-					if ($line['stealth'] != 0) echo '-------- '.$data['ident'].' : APRS stealth ON => not adding'."\n";
746
-					else echo '--------- '.$data['ident'].' : Date APRS : '.$data['datetime'].' - Current date : '.$currentdate.' => not adding future event'."\n";
995
+				    if ($line['stealth'] == 0 && (strtotime($data['datetime']) <= strtotime($currentdate)+20)) {
996
+				    	$send = $SI->add($data);
997
+				    } else {
998
+					if ($line['stealth'] != 0) {
999
+						echo '-------- '.$data['ident'].' : APRS stealth ON => not adding'."\n";
1000
+					} else {
1001
+						echo '--------- '.$data['ident'].' : Date APRS : '.$data['datetime'].' - Current date : '.$currentdate.' => not adding future event'."\n";
1002
+					}
747 1003
 				    }
748 1004
 				    unset($data);
749 1005
 				} 
750 1006
 				//elseif ($line == false && $globalDebug) echo 'Ignored ('.$buffer.")\n";
751
-				elseif ($line == true && $globalDebug) echo '!! Failed : '.$buffer."!!\n";
1007
+				elseif ($line == true && $globalDebug) {
1008
+					echo '!! Failed : '.$buffer."!!\n";
1009
+				}
752 1010
 			    }
753 1011
 			} else {
754 1012
 			    $line = explode(',', $buffer);
@@ -776,33 +1034,49 @@  discard block
 block discarded – undo
776 1034
     				$data['ground'] = $line[21];
777 1035
     				$data['emergency'] = $line[19];
778 1036
     				$data['format_source'] = 'sbs';
779
-				if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') $data['source_name'] = $globalSources[$nb]['name'];
780
-    				if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats'];
1037
+				if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') {
1038
+					$data['source_name'] = $globalSources[$nb]['name'];
1039
+				}
1040
+    				if (isset($globalSources[$nb]['sourcestats'])) {
1041
+    					$data['sourcestats'] = $globalSources[$nb]['sourcestats'];
1042
+    				}
781 1043
     				$data['id_source'] = $id_source;
782 1044
     				$send = $SI->add($data);
783 1045
     				unset($data);
784
-    			    } else $error = true;
1046
+    			    } else {
1047
+    			    	$error = true;
1048
+    			    }
785 1049
 			    if ($error) {
786 1050
 				if (count($line) > 1 && ($line[0] == 'STA' || $line[0] == 'AIR' || $line[0] == 'SEL' || $line[0] == 'ID' || $line[0] == 'CLK')) { 
787
-					if ($globalDebug) echo "Not a message. Ignoring... \n";
1051
+					if ($globalDebug) {
1052
+						echo "Not a message. Ignoring... \n";
1053
+					}
788 1054
 				} else {
789
-					if ($globalDebug) echo "Wrong line format. Ignoring... \n";
1055
+					if ($globalDebug) {
1056
+						echo "Wrong line format. Ignoring... \n";
1057
+					}
790 1058
 					if ($globalDebug) {
791 1059
 						echo $buffer;
792 1060
 						print_r($line);
793 1061
 					}
794 1062
 					//socket_close($r);
795
-					if ($globalDebug) echo "Reconnect after an error...\n";
1063
+					if ($globalDebug) {
1064
+						echo "Reconnect after an error...\n";
1065
+					}
796 1066
 					connect_all($globalSources);
797 1067
 				}
798 1068
 			    }
799 1069
 			}
800 1070
 			// Sleep for xxx microseconds
801
-			if (isset($globalSBSSleep)) usleep($globalSBSSleep);
1071
+			if (isset($globalSBSSleep)) {
1072
+				usleep($globalSBSSleep);
1073
+			}
802 1074
 		    } else {
803 1075
 			$tt++;
804 1076
 			if ($tt > 30) {
805
-			    if ($globalDebug)echo "ERROR : Reconnect...";
1077
+			    if ($globalDebug) {
1078
+			    	echo "ERROR : Reconnect...";
1079
+			    }
806 1080
 			    //@socket_close($r);
807 1081
 			    sleep(2);
808 1082
 			    connect_all($globalSources);
@@ -813,12 +1087,18 @@  discard block
 block discarded – undo
813 1087
 		}
814 1088
 	    } else {
815 1089
 		$error = socket_strerror(socket_last_error());
816
-		if ($globalDebug) echo "ERROR : socket_select give this error ".$error . "\n";
1090
+		if ($globalDebug) {
1091
+			echo "ERROR : socket_select give this error ".$error . "\n";
1092
+		}
817 1093
 		if (($error != SOCKET_EINPROGRESS && $error != SOCKET_EALREADY) || time() - $time >= $timeout) {
818
-			if (isset($globalDebug)) echo "Restarting...\n";
1094
+			if (isset($globalDebug)) {
1095
+				echo "Restarting...\n";
1096
+			}
819 1097
 			// Restart the script if possible
820 1098
 			if (is_array($sockets)) {
821
-			    if ($globalDebug) echo "Shutdown all sockets...";
1099
+			    if ($globalDebug) {
1100
+			    	echo "Shutdown all sockets...";
1101
+			    }
822 1102
 			    
823 1103
 			    foreach ($sockets as $sock) {
824 1104
 				@socket_shutdown($sock,2);
@@ -826,7 +1106,9 @@  discard block
 block discarded – undo
826 1106
 			    }
827 1107
 			    
828 1108
 			}
829
-			    if ($globalDebug) echo "Restart all connections...";
1109
+			    if ($globalDebug) {
1110
+			    	echo "Restart all connections...";
1111
+			    }
830 1112
 			    sleep(2);
831 1113
 			    $time = time();
832 1114
 			    //connect_all($hosts);
Please login to merge, or discard this patch.
acars-archive.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -36,8 +36,12 @@
 block discarded – undo
36 36
 if (!empty($spotter_array)) {
37 37
 	include('table-output.php');
38 38
 	print '<div class="pagination">';
39
-	if ($limit_previous_1 >= 0) print '<a href="'.$page_url.'/'.$limit_previous_1.','.$limit_previous_2.'/'.$_GET['sort'].'">&laquo;'._("Previous Page").'</a>';
40
-	if ($spotter_array[0]['query_number_rows'] == $absolute_difference) print '<a href="'.$page_url.'/'.$limit_end.','.$limit_next.'/'.$_GET['sort'].'">'._("Next Page").'&raquo;</a>';
39
+	if ($limit_previous_1 >= 0) {
40
+		print '<a href="'.$page_url.'/'.$limit_previous_1.','.$limit_previous_2.'/'.$_GET['sort'].'">&laquo;'._("Previous Page").'</a>';
41
+	}
42
+	if ($spotter_array[0]['query_number_rows'] == $absolute_difference) {
43
+		print '<a href="'.$page_url.'/'.$limit_end.','.$limit_next.'/'.$_GET['sort'].'">'._("Next Page").'&raquo;</a>';
44
+	}
41 45
 	print '</div>';
42 46
 }
43 47
 print '</div>';
Please login to merge, or discard this patch.
airport-data.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,7 +12,9 @@
 block discarded – undo
12 12
 		$METAR = new METAR();
13 13
 		$metar_info = $METAR->getMETAR($icao);
14 14
 		//print_r($metar_info);
15
-		if (isset($metar_info[0]['metar'])) $metar_parse = $METAR->parse($metar_info[0]['metar']);
15
+		if (isset($metar_info[0]['metar'])) {
16
+			$metar_parse = $METAR->parse($metar_info[0]['metar']);
17
+		}
16 18
 		//print_r($metar_parse);
17 19
 	}
18 20
 }
Please login to merge, or discard this patch.
airline-statistics-arrival-airport.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -40,8 +40,7 @@
 block discarded – undo
40 40
 		if ($globalIVAO && @getimagesize($globalURL.'/images/airlines/'.$spotter_array[0]['airline_icao'].'.gif'))
41 41
 		{
42 42
 			print '<img src="'.$globalURL.'/images/airlines/'.$spotter_array[0]['airline_icao'].'.gif" alt="'.$spotter_array[0]['airline_name'].' ('.$spotter_array[0]['airline_icao'].')" title="'.$spotter_array[0]['airline_name'].' ('.$spotter_array[0]['airline_icao'].')" class="logo" />';
43
-		}
44
-		elseif (@getimagesize($globalURL.'/images/airlines/'.$spotter_array[0]['airline_icao'].'.png'))
43
+		} elseif (@getimagesize($globalURL.'/images/airlines/'.$spotter_array[0]['airline_icao'].'.png'))
45 44
 		{
46 45
 			print '<img src="'.$globalURL.'/images/airlines/'.$spotter_array[0]['airline_icao'].'.png" alt="'.$spotter_array[0]['airline_name'].' ('.$spotter_array[0]['airline_icao'].')" title="'.$spotter_array[0]['airline_name'].' ('.$spotter_array[0]['airline_icao'].')" class="logo" />';
47 46
 		}
Please login to merge, or discard this patch.
airline-statistics-departure-airport.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -40,8 +40,7 @@
 block discarded – undo
40 40
 			if ($globalIVAO && @getimagesize($globalURL.'/images/airlines/'.$spotter_array[0]['airline_icao'].'.gif'))
41 41
 			{
42 42
 				print '<img src="'.$globalURL.'/images/airlines/'.$spotter_array[0]['airline_icao'].'.gif" alt="'.$spotter_array[0]['airline_name'].' ('.$spotter_array[0]['airline_icao'].')" title="'.$spotter_array[0]['airline_name'].' ('.$spotter_array[0]['airline_icao'].')" class="logo" />';
43
-			}
44
-			elseif (@getimagesize($globalURL.'/images/airlines/'.$spotter_array[0]['airline_icao'].'.png'))
43
+			} elseif (@getimagesize($globalURL.'/images/airlines/'.$spotter_array[0]['airline_icao'].'.png'))
45 44
 			{
46 45
 				print '<img src="'.$globalURL.'/images/airlines/'.$spotter_array[0]['airline_icao'].'.png" alt="'.$spotter_array[0]['airline_name'].' ('.$spotter_array[0]['airline_icao'].')" title="'.$spotter_array[0]['airline_name'].' ('.$spotter_array[0]['airline_icao'].')" class="logo" />';
47 46
 			}
Please login to merge, or discard this patch.