Completed
Push — master ( 30b860...f1043a )
by Yannick
32:05
created
install/install-action.php 3 patches
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -86,9 +86,9 @@  discard block
 block discarded – undo
86 86
 	if ($check_version == '0') {
87 87
 		
88 88
 		if ($globalDBdriver == 'mysql') {
89
-		    $error .= create_db::import_all_db('../db/');
89
+			$error .= create_db::import_all_db('../db/');
90 90
 		} elseif ($globalDBdriver == 'pgsql') {
91
-		    $error .= create_db::import_all_db('../db/pgsql/');
91
+			$error .= create_db::import_all_db('../db/pgsql/');
92 92
 		}
93 93
 		if ($error != '') {
94 94
 			$_SESSION['error'] = $error;
@@ -98,8 +98,8 @@  discard block
 block discarded – undo
98 98
 			$_SESSION['install'] = 'populate';
99 99
 			$_SESSION['next'] = 'Populate aircraft_modes table with externals data for ADS-B';
100 100
 		} else {
101
-		    $_SESSION['install'] = 'sources';
102
-		    $_SESSION['next'] = 'Insert data in source table';
101
+			$_SESSION['install'] = 'sources';
102
+			$_SESSION['next'] = 'Insert data in source table';
103 103
 		}
104 104
 		$result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']);
105 105
 		print json_encode($result);
@@ -156,10 +156,10 @@  discard block
 block discarded – undo
156 156
 		$_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate countries database'));
157 157
 	} else $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate countries database'));
158 158
 	if (isset($globalNOTAM) && $globalNOTAM && isset($globalNOTAMSource) && $globalNOTAMSource != '') {
159
-	    $_SESSION['install'] = 'notam';
160
-	    $_SESSION['next'] = 'Populate NOTAM table with externals data';
161
-	    $result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']);
162
-	    print json_encode($result);
159
+		$_SESSION['install'] = 'notam';
160
+		$_SESSION['next'] = 'Populate NOTAM table with externals data';
161
+		$result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']);
162
+		print json_encode($result);
163 163
 	/*
164 164
 	} elseif (isset($_SESSION['owner']) && $_SESSION['owner'] == 1) {
165 165
 	    $_SESSION['install'] = 'owner';
@@ -169,10 +169,10 @@  discard block
 block discarded – undo
169 169
 	    print json_encode($result);
170 170
 	*/
171 171
 	} else {
172
-	    $_SESSION['install'] = 'sources';
173
-	    $_SESSION['next'] = 'Insert data in source table';
174
-	    $result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']);
175
-	    print json_encode($result);
172
+		$_SESSION['install'] = 'sources';
173
+		$_SESSION['next'] = 'Insert data in source table';
174
+		$result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']);
175
+		print json_encode($result);
176 176
 	}
177 177
 } else if (isset($_SESSION['install']) && $_SESSION['install'] == 'populate') {
178 178
 	if (!is_writable('tmp')) {
Please login to merge, or discard this patch.
Spacing   +67 added lines, -67 removed lines patch added patch discarded remove patch
@@ -70,15 +70,15 @@  discard block
 block discarded – undo
70 70
 	$globalDebug = FALSE;
71 71
 	$dbroot = $_SESSION['database_root'];
72 72
 	$dbrootpass = $_SESSION['database_rootpass'];
73
-	$error .= create_db::create_database($dbroot,$dbrootpass,$globalDBuser,$globalDBpass,$globalDBname,$globalDBdriver,$globalDBhost);
73
+	$error .= create_db::create_database($dbroot, $dbrootpass, $globalDBuser, $globalDBpass, $globalDBname, $globalDBdriver, $globalDBhost);
74 74
 	sleep(5);
75 75
 	if ($error != '') {
76 76
 		$_SESSION['error'] = $error;
77
-		$_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Create database'));
78
-	} else $_SESSION['done'] = array_merge($_SESSION['done'],array('Create database'));
77
+		$_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Create database'));
78
+	} else $_SESSION['done'] = array_merge($_SESSION['done'], array('Create database'));
79 79
 	$_SESSION['install'] = 'database_import';
80 80
 	$_SESSION['next'] = 'Create and import tables';
81
-	$result = array('error' => $error,'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']);
81
+	$result = array('error' => $error, 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']);
82 82
 	print json_encode($result);
83 83
 } else if (isset($_SESSION['install']) && $_SESSION['install'] == 'database_import') {
84 84
 	$globalDebug = FALSE;
@@ -92,8 +92,8 @@  discard block
 block discarded – undo
92 92
 		}
93 93
 		if ($error != '') {
94 94
 			$_SESSION['error'] = $error;
95
-			$_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Create and import tables'));
96
-		} else $_SESSION['done'] = array_merge($_SESSION['done'],array('Create and import tables'));
95
+			$_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Create and import tables'));
96
+		} else $_SESSION['done'] = array_merge($_SESSION['done'], array('Create and import tables'));
97 97
 		if ($globalSBS1 && !$globalIVAO && !$globalVATSIM && !$globalphpVMS) {
98 98
 			$_SESSION['install'] = 'populate';
99 99
 			$_SESSION['next'] = 'Populate aircraft_modes table with externals data for ADS-B';
@@ -101,24 +101,24 @@  discard block
 block discarded – undo
101 101
 		    $_SESSION['install'] = 'sources';
102 102
 		    $_SESSION['next'] = 'Insert data in source table';
103 103
 		}
104
-		$result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']);
104
+		$result = array('error' => $error, 'errorlst' => $_SESSION['errorlst'], 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']);
105 105
 		print json_encode($result);
106 106
 	} elseif (!is_numeric($check_version)) {
107 107
 		$error .= $check_version;
108 108
 		$_SESSION['error'] = $error;
109
-		$_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Create and import tables'));
109
+		$_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Create and import tables'));
110 110
 		if (!isset($_SESSION['next'])) $_SESSION['next'] = '';
111
-		$result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']);
111
+		$result = array('error' => $error, 'errorlst' => $_SESSION['errorlst'], 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']);
112 112
 		print json_encode($result);
113 113
 	} else {
114 114
 		$error .= update_schema::check_version(true);
115 115
 		if ($error != '') {
116 116
 			$_SESSION['error'] = $error;
117
-			$_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Update schema if needed'));
118
-		} else $_SESSION['done'] = array_merge($_SESSION['done'],array('Update schema if needed'));
117
+			$_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Update schema if needed'));
118
+		} else $_SESSION['done'] = array_merge($_SESSION['done'], array('Update schema if needed'));
119 119
 		$_SESSION['install'] = 'sources';
120 120
 		$_SESSION['next'] = 'Insert data in source table';
121
-		$result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']);
121
+		$result = array('error' => $error, 'errorlst' => $_SESSION['errorlst'], 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']);
122 122
 		print json_encode($result);
123 123
 	}
124 124
 } else if (isset($_SESSION['install']) && $_SESSION['install'] == 'waypoints') {
@@ -127,8 +127,8 @@  discard block
 block discarded – undo
127 127
 	$error .= update_db::update_waypoints();
128 128
 	if ($error != '') {
129 129
 		$_SESSION['error'] = $error;
130
-		$_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate waypoints database'));
131
-	} else $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate waypoints database'));
130
+		$_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Populate waypoints database'));
131
+	} else $_SESSION['done'] = array_merge($_SESSION['done'], array('Populate waypoints database'));
132 132
 /*
133 133
 	$_SESSION['install'] = 'airspace';
134 134
 	$_SESSION['next'] = 'Populate airspace table';
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 */
146 146
 	$_SESSION['install'] = 'countries';
147 147
 	$_SESSION['next'] = 'Populate countries table';
148
-	$result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']);
148
+	$result = array('error' => $error, 'errorlst' => $_SESSION['errorlst'], 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']);
149 149
 	print json_encode($result);
150 150
 } else if (isset($_SESSION['install']) && $_SESSION['install'] == 'countries') {
151 151
 	include_once('class.update_db.php');
@@ -153,12 +153,12 @@  discard block
 block discarded – undo
153 153
 	$error .= update_db::update_countries();
154 154
 	if ($error != '') {
155 155
 		$_SESSION['error'] = $error;
156
-		$_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate countries database'));
157
-	} else $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate countries database'));
156
+		$_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Populate countries database'));
157
+	} else $_SESSION['done'] = array_merge($_SESSION['done'], array('Populate countries database'));
158 158
 	if (isset($globalNOTAM) && $globalNOTAM && isset($globalNOTAMSource) && $globalNOTAMSource != '') {
159 159
 	    $_SESSION['install'] = 'notam';
160 160
 	    $_SESSION['next'] = 'Populate NOTAM table with externals data';
161
-	    $result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']);
161
+	    $result = array('error' => $error, 'errorlst' => $_SESSION['errorlst'], 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']);
162 162
 	    print json_encode($result);
163 163
 	/*
164 164
 	} elseif (isset($_SESSION['owner']) && $_SESSION['owner'] == 1) {
@@ -171,15 +171,15 @@  discard block
 block discarded – undo
171 171
 	} else {
172 172
 	    $_SESSION['install'] = 'sources';
173 173
 	    $_SESSION['next'] = 'Insert data in source table';
174
-	    $result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']);
174
+	    $result = array('error' => $error, 'errorlst' => $_SESSION['errorlst'], 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']);
175 175
 	    print json_encode($result);
176 176
 	}
177 177
 } else if (isset($_SESSION['install']) && $_SESSION['install'] == 'populate') {
178 178
 	if (!is_writable('tmp')) {
179 179
 		$error = 'The directory <i>install/tmp</i> must be writable.';
180 180
 		$_SESSION['error'] = $error;
181
-		$_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate aircraft_modes table with externals data for ADS-B'));
182
-		$result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']);
181
+		$_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Populate aircraft_modes table with externals data for ADS-B'));
182
+		$result = array('error' => $error, 'errorlst' => $_SESSION['errorlst'], 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']);
183 183
 		print json_encode($result);
184 184
 	} else {
185 185
 		include_once('class.update_db.php');
@@ -187,19 +187,19 @@  discard block
 block discarded – undo
187 187
 		$error .= update_db::update_ModeS_fam();
188 188
 		if ($error != '') {
189 189
 			$_SESSION['error'] = $error;
190
-			$_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate aircraft_modes table with externals data for ADS-B'));
191
-		} else $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate aircraft_modes table with externals data for ADS-B'));
190
+			$_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Populate aircraft_modes table with externals data for ADS-B'));
191
+		} else $_SESSION['done'] = array_merge($_SESSION['done'], array('Populate aircraft_modes table with externals data for ADS-B'));
192 192
 		$_SESSION['install'] = 'populate_flarm';
193 193
 		$_SESSION['next'] = 'Populate aircraft_modes table with externals data for FLARM';
194
-		$result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']);
194
+		$result = array('error' => $error, 'errorlst' => $_SESSION['errorlst'], 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']);
195 195
 		print json_encode($result);
196 196
 	}
197 197
 } else if (isset($_SESSION['install']) && $_SESSION['install'] == 'populate_flarm') {
198 198
 	if (!is_writable('tmp')) {
199 199
 		$error = 'The directory <i>install/tmp</i> must be writable.';
200 200
 		$_SESSION['error'] = $error;
201
-		$_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate aircraft_modes table with externals data for FLARM'));
202
-		$result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']);
201
+		$_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Populate aircraft_modes table with externals data for FLARM'));
202
+		$result = array('error' => $error, 'errorlst' => $_SESSION['errorlst'], 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']);
203 203
 		print json_encode($result);
204 204
 	} else {
205 205
 		include_once('class.update_db.php');
@@ -208,8 +208,8 @@  discard block
 block discarded – undo
208 208
 		$error .= update_db::update_ModeS_ogn();
209 209
 		if ($error != '') {
210 210
 			$_SESSION['error'] = $error;
211
-			$_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate aircraft_modes table with externals data for FLARM'));
212
-		} else $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate aircraft_modes table with externals data for FLARM'));
211
+			$_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Populate aircraft_modes table with externals data for FLARM'));
212
+		} else $_SESSION['done'] = array_merge($_SESSION['done'], array('Populate aircraft_modes table with externals data for FLARM'));
213 213
 		if ((isset($globalVATSIM) && $globalVATSIM) && (isset($globalIVAO) && $globalIVAO)) {
214 214
 			$_SESSION['install'] = 'vatsim';
215 215
 			if (file_exists('tmp/ivae_feb2013.zip')) $_SESSION['next'] = 'Insert IVAO data';
@@ -228,15 +228,15 @@  discard block
 block discarded – undo
228 228
 			$_SESSION['install'] = 'routes';
229 229
 			$_SESSION['next'] = 'Populate routes table with externals data';
230 230
 		}
231
-		$result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']);
231
+		$result = array('error' => $error, 'errorlst' => $_SESSION['errorlst'], 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']);
232 232
 		print json_encode($result);
233 233
 	}
234 234
 } else if (isset($_SESSION['install']) && $_SESSION['install'] == 'routes') {
235 235
 	if (!is_writable('tmp')) {
236 236
 		$error = 'The directory <i>install/tmp</i> must be writable.';
237 237
 		$_SESSION['error'] = $error;
238
-		$_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate aircraft_modes table with externals data for ADS-B'));
239
-		$result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']);
238
+		$_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Populate aircraft_modes table with externals data for ADS-B'));
239
+		$result = array('error' => $error, 'errorlst' => $_SESSION['errorlst'], 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']);
240 240
 		print json_encode($result);
241 241
 	} else {
242 242
 		include_once('class.update_db.php');
@@ -244,19 +244,19 @@  discard block
 block discarded – undo
244 244
 		$error .= update_db::update_routes_fam();
245 245
 		if ($error != '') {
246 246
 			$_SESSION['error'] = $error;
247
-			$_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate routes table with externals data'));
248
-		} else 	$_SESSION['done'] = array_merge($_SESSION['done'],array('Populate routes table with externals data'));
247
+			$_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Populate routes table with externals data'));
248
+		} else 	$_SESSION['done'] = array_merge($_SESSION['done'], array('Populate routes table with externals data'));
249 249
 		$_SESSION['install'] = 'translation';
250 250
 		$_SESSION['next'] = 'Populate translation table with externals data';
251
-		$result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']);
251
+		$result = array('error' => $error, 'errorlst' => $_SESSION['errorlst'], 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']);
252 252
 		print json_encode($result);
253 253
 	}
254 254
 } else if (isset($_SESSION['install']) && $_SESSION['install'] == 'translation') {
255 255
 	if (!is_writable('tmp')) {
256 256
 		$error = 'The directory <i>install/tmp</i> must be writable.';
257 257
 		$_SESSION['error'] = $error;
258
-		$_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate translation table with externals data'));
259
-		$result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']);
258
+		$_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Populate translation table with externals data'));
259
+		$result = array('error' => $error, 'errorlst' => $_SESSION['errorlst'], 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']);
260 260
 		print json_encode($result);
261 261
 	} else {
262 262
 		include_once('class.update_db.php');
@@ -264,8 +264,8 @@  discard block
 block discarded – undo
264 264
 		$error .= update_db::update_translation_fam();
265 265
 		if ($error != '') {
266 266
 			$_SESSION['error'] = $error;
267
-			$_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate translation table with externals data'));
268
-		} else $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate translation table with externals data'));
267
+			$_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Populate translation table with externals data'));
268
+		} else $_SESSION['done'] = array_merge($_SESSION['done'], array('Populate translation table with externals data'));
269 269
 		if ($_SESSION['waypoints'] == 1) {
270 270
 			$_SESSION['install'] = 'waypoints';
271 271
 			$_SESSION['next'] = 'Populate waypoints table';
@@ -283,15 +283,15 @@  discard block
 block discarded – undo
283 283
 			$_SESSION['install'] = 'sources';
284 284
 			$_SESSION['next'] = 'Insert data in source table';
285 285
 		}
286
-		$result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']);
286
+		$result = array('error' => $error, 'errorlst' => $_SESSION['errorlst'], 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']);
287 287
 		print json_encode($result);
288 288
 	}
289 289
 } else if (isset($_SESSION['install']) && $_SESSION['install'] == 'owner') {
290 290
 	if (!is_writable('tmp')) {
291 291
 		$error = 'The directory <i>install/tmp</i> must be writable.';
292 292
 		$_SESSION['error'] = $error;
293
-		$_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate owner table with externals data'));
294
-		$result = array('error' => $error,'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']);
293
+		$_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Populate owner table with externals data'));
294
+		$result = array('error' => $error, 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']);
295 295
 		print json_encode($result);
296 296
 	} else {
297 297
 		include_once('class.update_db.php');
@@ -299,19 +299,19 @@  discard block
 block discarded – undo
299 299
 		$error = update_db::update_owner_fam();
300 300
 		if ($error != '') {
301 301
 			$_SESSION['error'] = $error;
302
-			$_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate owner table with externals data'));
303
-		} else $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate owner table with externals data'));
302
+			$_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Populate owner table with externals data'));
303
+		} else $_SESSION['done'] = array_merge($_SESSION['done'], array('Populate owner table with externals data'));
304 304
 		$_SESSION['install'] = 'sources';
305 305
 		$_SESSION['next'] = 'Insert data in source table';
306
-		$result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']);
306
+		$result = array('error' => $error, 'errorlst' => $_SESSION['errorlst'], 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']);
307 307
 		print json_encode($result);
308 308
 	}
309 309
 } else if (isset($_SESSION['install']) && $_SESSION['install'] == 'notam') {
310 310
 	if (!is_writable('tmp')) {
311 311
 		$error = 'The directory <i>install/tmp</i> must be writable.';
312 312
 		$_SESSION['error'] = $error;
313
-		$_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate notam table with externals data'));
314
-		$result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']);
313
+		$_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Populate notam table with externals data'));
314
+		$result = array('error' => $error, 'errorlst' => $_SESSION['errorlst'], 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']);
315 315
 		print json_encode($result);
316 316
 	} else {
317 317
 		include_once('class.update_db.php');
@@ -320,13 +320,13 @@  discard block
 block discarded – undo
320 320
 			$error .= update_db::update_notam();
321 321
 			if ($error != '') {
322 322
 				$_SESSION['error'] = $error;
323
-				$_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate notam table with externals data'));
324
-			} else $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate notam table with externals data'));
323
+				$_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Populate notam table with externals data'));
324
+			} else $_SESSION['done'] = array_merge($_SESSION['done'], array('Populate notam table with externals data'));
325 325
 		} else {
326 326
 			if ($error != '') {
327 327
 				$_SESSION['error'] = $error;
328
-				$_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate notam table with externals data (no source defined)'));
329
-			} else $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate notam table with externals data (no source defined)'));
328
+				$_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Populate notam table with externals data (no source defined)'));
329
+			} else $_SESSION['done'] = array_merge($_SESSION['done'], array('Populate notam table with externals data (no source defined)'));
330 330
 		}
331 331
 		/*
332 332
 		if (isset($_SESSION['owner']) && $_SESSION['owner'] == 1) {
@@ -339,7 +339,7 @@  discard block
 block discarded – undo
339 339
 		*/
340 340
 			$_SESSION['install'] = 'sources';
341 341
 			$_SESSION['next'] = 'Insert data in source table';
342
-			$result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']);
342
+			$result = array('error' => $error, 'errorlst' => $_SESSION['errorlst'], 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']);
343 343
 			print json_encode($result);
344 344
 		//}
345 345
 	}
@@ -376,9 +376,9 @@  discard block
 block discarded – undo
376 376
 		$Source = new Source();
377 377
 		$Source->deleteAllLocation();
378 378
 		foreach ($sources as $src) {
379
-			if (isset($src['latitude']) && $src['latitude'] != '') $Source->addLocation($src['name'],$src['latitude'],$src['longitude'],$src['altitude'],$src['city'],$src['country'],$src['source'],'antenna.png');
379
+			if (isset($src['latitude']) && $src['latitude'] != '') $Source->addLocation($src['name'], $src['latitude'], $src['longitude'], $src['altitude'], $src['city'], $src['country'], $src['source'], 'antenna.png');
380 380
 		}
381
-		$_SESSION['done'] = array_merge($_SESSION['done'],array('Insert data in source table'));
381
+		$_SESSION['done'] = array_merge($_SESSION['done'], array('Insert data in source table'));
382 382
 		unset($_SESSION['sources']);
383 383
 	}
384 384
 	/*
@@ -403,7 +403,7 @@  discard block
 block discarded – undo
403 403
 		$_SESSION['install'] = 'finish';
404 404
 		$_SESSION['next'] = 'finish';
405 405
 	}
406
-	$result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']);
406
+	$result = array('error' => $error, 'errorlst' => $_SESSION['errorlst'], 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']);
407 407
 	print json_encode($result);
408 408
 } else if (isset($_SESSION['install']) && $_SESSION['install'] == 'vatsim') {
409 409
 	include_once('../install/class.create_db.php');
@@ -415,48 +415,48 @@  discard block
 block discarded – undo
415 415
 			$error .= update_db::update_IVAO();
416 416
 			if ($error != '') {
417 417
 				$_SESSION['error'] = $error;
418
-				$_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Insert IVAO data'));
419
-			} else $_SESSION['done'] = array_merge($_SESSION['done'],array('Insert IVAO data'));
418
+				$_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Insert IVAO data'));
419
+			} else $_SESSION['done'] = array_merge($_SESSION['done'], array('Insert IVAO data'));
420 420
 		} else {
421 421
 			$error .= update_db::update_vatsim();
422 422
 			if ($error != '') {
423 423
 				$_SESSION['error'] = $error;
424
-				$_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Insert VATSIM data'));
425
-			} else $_SESSION['done'] = array_merge($_SESSION['done'],array('Insert VATSIM data'));
424
+				$_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Insert VATSIM data'));
425
+			} else $_SESSION['done'] = array_merge($_SESSION['done'], array('Insert VATSIM data'));
426 426
 		}
427 427
 	} elseif (isset($globalVATSIM) && $globalVATSIM) {
428 428
 		$error .= update_db::update_vatsim();
429 429
 		if ($error != '') {
430 430
 			$_SESSION['error'] = $error;
431
-			$_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Insert VATSIM data'));
432
-		} else $_SESSION['done'] = array_merge($_SESSION['done'],array('Insert VATSIM data'));
431
+			$_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Insert VATSIM data'));
432
+		} else $_SESSION['done'] = array_merge($_SESSION['done'], array('Insert VATSIM data'));
433 433
 	} elseif (isset($globalIVAO) && $globalIVAO) {
434 434
 		if (file_exists('tmp/ivae_feb2013.zip')) {
435 435
 			$error .= update_db::update_IVAO();
436 436
 			if ($error != '') {
437 437
 				$_SESSION['error'] = $error;
438
-				$_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Insert IVAO data'));
439
-			} else $_SESSION['done'] = array_merge($_SESSION['done'],array('Insert IVAO data'));
438
+				$_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Insert IVAO data'));
439
+			} else $_SESSION['done'] = array_merge($_SESSION['done'], array('Insert IVAO data'));
440 440
 		} else {
441 441
 			$error .= update_db::update_vatsim();
442 442
 			if ($error != '') {
443 443
 				$_SESSION['error'] = $error;
444
-				$_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Insert VATSIM data (IVAO not found)'));
445
-			} else $_SESSION['done'] = array_merge($_SESSION['done'],array('Insert VATSIM data (IVAO not found)'));
444
+				$_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Insert VATSIM data (IVAO not found)'));
445
+			} else $_SESSION['done'] = array_merge($_SESSION['done'], array('Insert VATSIM data (IVAO not found)'));
446 446
 		}
447 447
 	} elseif (isset($globalphpVMS) && $globalphpVMS) {
448
-		$_SESSION['done'] = array_merge($_SESSION['done'],array('Insert phpVMS data'));
448
+		$_SESSION['done'] = array_merge($_SESSION['done'], array('Insert phpVMS data'));
449 449
 	}
450 450
 	//$_SESSION['install'] = 'routes';
451 451
 	//$_SESSION['next'] = 'Populate routes table with externals data';
452 452
 	$_SESSION['install'] = 'finish';
453 453
 	$_SESSION['next'] = 'finish';
454
-	$result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']);
454
+	$result = array('error' => $error, 'errorlst' => $_SESSION['errorlst'], 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']);
455 455
 	print json_encode($result);
456 456
 } else {
457 457
 	//unset($_SESSION['install']);
458 458
 	$_SESSION['error'] = 'Unknwon task : '.$_SESSION['install'];
459
-	$result = array('error' => 'Unknwon task : '.$_SESSION['install'],'done' => $_SESSION['done'],'next' => 'finish','install' => 'finish');
459
+	$result = array('error' => 'Unknwon task : '.$_SESSION['install'], 'done' => $_SESSION['done'], 'next' => 'finish', 'install' => 'finish');
460 460
 	print json_encode($result);
461 461
 }
462 462
 ?>
463 463
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +78 added lines, -28 removed lines patch added patch discarded remove patch
@@ -75,7 +75,9 @@  discard block
 block discarded – undo
75 75
 	if ($error != '') {
76 76
 		$_SESSION['error'] = $error;
77 77
 		$_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Create database'));
78
-	} else $_SESSION['done'] = array_merge($_SESSION['done'],array('Create database'));
78
+	} else {
79
+		$_SESSION['done'] = array_merge($_SESSION['done'],array('Create database'));
80
+	}
79 81
 	$_SESSION['install'] = 'database_import';
80 82
 	$_SESSION['next'] = 'Create and import tables';
81 83
 	$result = array('error' => $error,'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']);
@@ -93,7 +95,9 @@  discard block
 block discarded – undo
93 95
 		if ($error != '') {
94 96
 			$_SESSION['error'] = $error;
95 97
 			$_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Create and import tables'));
96
-		} else $_SESSION['done'] = array_merge($_SESSION['done'],array('Create and import tables'));
98
+		} else {
99
+			$_SESSION['done'] = array_merge($_SESSION['done'],array('Create and import tables'));
100
+		}
97 101
 		if ($globalSBS1 && !$globalIVAO && !$globalVATSIM && !$globalphpVMS) {
98 102
 			$_SESSION['install'] = 'populate';
99 103
 			$_SESSION['next'] = 'Populate aircraft_modes table with externals data for ADS-B';
@@ -107,7 +111,9 @@  discard block
 block discarded – undo
107 111
 		$error .= $check_version;
108 112
 		$_SESSION['error'] = $error;
109 113
 		$_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Create and import tables'));
110
-		if (!isset($_SESSION['next'])) $_SESSION['next'] = '';
114
+		if (!isset($_SESSION['next'])) {
115
+			$_SESSION['next'] = '';
116
+		}
111 117
 		$result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']);
112 118
 		print json_encode($result);
113 119
 	} else {
@@ -115,7 +121,9 @@  discard block
 block discarded – undo
115 121
 		if ($error != '') {
116 122
 			$_SESSION['error'] = $error;
117 123
 			$_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Update schema if needed'));
118
-		} else $_SESSION['done'] = array_merge($_SESSION['done'],array('Update schema if needed'));
124
+		} else {
125
+			$_SESSION['done'] = array_merge($_SESSION['done'],array('Update schema if needed'));
126
+		}
119 127
 		$_SESSION['install'] = 'sources';
120 128
 		$_SESSION['next'] = 'Insert data in source table';
121 129
 		$result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']);
@@ -128,8 +136,10 @@  discard block
 block discarded – undo
128 136
 	if ($error != '') {
129 137
 		$_SESSION['error'] = $error;
130 138
 		$_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate waypoints database'));
131
-	} else $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate waypoints database'));
132
-/*
139
+	} else {
140
+		$_SESSION['done'] = array_merge($_SESSION['done'],array('Populate waypoints database'));
141
+	}
142
+	/*
133 143
 	$_SESSION['install'] = 'airspace';
134 144
 	$_SESSION['next'] = 'Populate airspace table';
135 145
 	$result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']);
@@ -154,7 +164,9 @@  discard block
 block discarded – undo
154 164
 	if ($error != '') {
155 165
 		$_SESSION['error'] = $error;
156 166
 		$_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate countries database'));
157
-	} else $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate countries database'));
167
+	} else {
168
+		$_SESSION['done'] = array_merge($_SESSION['done'],array('Populate countries database'));
169
+	}
158 170
 	if (isset($globalNOTAM) && $globalNOTAM && isset($globalNOTAMSource) && $globalNOTAMSource != '') {
159 171
 	    $_SESSION['install'] = 'notam';
160 172
 	    $_SESSION['next'] = 'Populate NOTAM table with externals data';
@@ -188,7 +200,9 @@  discard block
 block discarded – undo
188 200
 		if ($error != '') {
189 201
 			$_SESSION['error'] = $error;
190 202
 			$_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate aircraft_modes table with externals data for ADS-B'));
191
-		} else $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate aircraft_modes table with externals data for ADS-B'));
203
+		} else {
204
+			$_SESSION['done'] = array_merge($_SESSION['done'],array('Populate aircraft_modes table with externals data for ADS-B'));
205
+		}
192 206
 		$_SESSION['install'] = 'populate_flarm';
193 207
 		$_SESSION['next'] = 'Populate aircraft_modes table with externals data for FLARM';
194 208
 		$result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']);
@@ -209,18 +223,26 @@  discard block
 block discarded – undo
209 223
 		if ($error != '') {
210 224
 			$_SESSION['error'] = $error;
211 225
 			$_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate aircraft_modes table with externals data for FLARM'));
212
-		} else $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate aircraft_modes table with externals data for FLARM'));
226
+		} else {
227
+			$_SESSION['done'] = array_merge($_SESSION['done'],array('Populate aircraft_modes table with externals data for FLARM'));
228
+		}
213 229
 		if ((isset($globalVATSIM) && $globalVATSIM) && (isset($globalIVAO) && $globalIVAO)) {
214 230
 			$_SESSION['install'] = 'vatsim';
215
-			if (file_exists('tmp/ivae_feb2013.zip')) $_SESSION['next'] = 'Insert IVAO data';
216
-			else $_SESSION['next'] = 'Insert VATSIM data';
231
+			if (file_exists('tmp/ivae_feb2013.zip')) {
232
+				$_SESSION['next'] = 'Insert IVAO data';
233
+			} else {
234
+				$_SESSION['next'] = 'Insert VATSIM data';
235
+			}
217 236
 		} elseif (isset($globalVATSIM) && $globalVATSIM) {
218 237
 			$_SESSION['install'] = 'vatsim';
219 238
 			$_SESSION['next'] = 'Insert VATSIM data';
220 239
 		} elseif (isset($globalIVAO) && $globalIVAO) {
221 240
 			$_SESSION['install'] = 'vatsim';
222
-			if (file_exists('tmp/ivae_feb2013.zip')) $_SESSION['next'] = 'Insert IVAO data';
223
-			else $_SESSION['next'] = 'Insert VATSIM data (IVAO not found)';
241
+			if (file_exists('tmp/ivae_feb2013.zip')) {
242
+				$_SESSION['next'] = 'Insert IVAO data';
243
+			} else {
244
+				$_SESSION['next'] = 'Insert VATSIM data (IVAO not found)';
245
+			}
224 246
 		} elseif (isset($globalphpVMS) && $globalphpVMS) {
225 247
 			$_SESSION['install'] = 'vatsim';
226 248
 			$_SESSION['next'] = 'Insert phpVMS data';
@@ -245,7 +267,9 @@  discard block
 block discarded – undo
245 267
 		if ($error != '') {
246 268
 			$_SESSION['error'] = $error;
247 269
 			$_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate routes table with externals data'));
248
-		} else 	$_SESSION['done'] = array_merge($_SESSION['done'],array('Populate routes table with externals data'));
270
+		} else {
271
+			$_SESSION['done'] = array_merge($_SESSION['done'],array('Populate routes table with externals data'));
272
+		}
249 273
 		$_SESSION['install'] = 'translation';
250 274
 		$_SESSION['next'] = 'Populate translation table with externals data';
251 275
 		$result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']);
@@ -265,7 +289,9 @@  discard block
 block discarded – undo
265 289
 		if ($error != '') {
266 290
 			$_SESSION['error'] = $error;
267 291
 			$_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate translation table with externals data'));
268
-		} else $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate translation table with externals data'));
292
+		} else {
293
+			$_SESSION['done'] = array_merge($_SESSION['done'],array('Populate translation table with externals data'));
294
+		}
269 295
 		if ($_SESSION['waypoints'] == 1) {
270 296
 			$_SESSION['install'] = 'waypoints';
271 297
 			$_SESSION['next'] = 'Populate waypoints table';
@@ -300,7 +326,9 @@  discard block
 block discarded – undo
300 326
 		if ($error != '') {
301 327
 			$_SESSION['error'] = $error;
302 328
 			$_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate owner table with externals data'));
303
-		} else $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate owner table with externals data'));
329
+		} else {
330
+			$_SESSION['done'] = array_merge($_SESSION['done'],array('Populate owner table with externals data'));
331
+		}
304 332
 		$_SESSION['install'] = 'sources';
305 333
 		$_SESSION['next'] = 'Insert data in source table';
306 334
 		$result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']);
@@ -321,12 +349,16 @@  discard block
 block discarded – undo
321 349
 			if ($error != '') {
322 350
 				$_SESSION['error'] = $error;
323 351
 				$_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate notam table with externals data'));
324
-			} else $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate notam table with externals data'));
352
+			} else {
353
+				$_SESSION['done'] = array_merge($_SESSION['done'],array('Populate notam table with externals data'));
354
+			}
325 355
 		} else {
326 356
 			if ($error != '') {
327 357
 				$_SESSION['error'] = $error;
328 358
 				$_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate notam table with externals data (no source defined)'));
329
-			} else $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate notam table with externals data (no source defined)'));
359
+			} else {
360
+				$_SESSION['done'] = array_merge($_SESSION['done'],array('Populate notam table with externals data (no source defined)'));
361
+			}
330 362
 		}
331 363
 		/*
332 364
 		if (isset($_SESSION['owner']) && $_SESSION['owner'] == 1) {
@@ -376,7 +408,9 @@  discard block
 block discarded – undo
376 408
 		$Source = new Source();
377 409
 		$Source->deleteAllLocation();
378 410
 		foreach ($sources as $src) {
379
-			if (isset($src['latitude']) && $src['latitude'] != '') $Source->addLocation($src['name'],$src['latitude'],$src['longitude'],$src['altitude'],$src['city'],$src['country'],$src['source'],'antenna.png');
411
+			if (isset($src['latitude']) && $src['latitude'] != '') {
412
+				$Source->addLocation($src['name'],$src['latitude'],$src['longitude'],$src['altitude'],$src['city'],$src['country'],$src['source'],'antenna.png');
413
+			}
380 414
 		}
381 415
 		$_SESSION['done'] = array_merge($_SESSION['done'],array('Insert data in source table'));
382 416
 		unset($_SESSION['sources']);
@@ -387,15 +421,21 @@  discard block
 block discarded – undo
387 421
 	*/
388 422
 	if ((isset($globalVATSIM) && $globalVATSIM) && (isset($globalIVAO) && $globalIVAO)) {
389 423
 		$_SESSION['install'] = 'vatsim';
390
-		if (file_exists('tmp/ivae_feb2013.zip')) $_SESSION['next'] = 'Insert IVAO data';
391
-		else $_SESSION['next'] = 'Insert VATSIM data';
424
+		if (file_exists('tmp/ivae_feb2013.zip')) {
425
+			$_SESSION['next'] = 'Insert IVAO data';
426
+		} else {
427
+			$_SESSION['next'] = 'Insert VATSIM data';
428
+		}
392 429
 	} elseif (isset($globalVATSIM) && $globalVATSIM) {
393 430
 		$_SESSION['install'] = 'vatsim';
394 431
 		$_SESSION['next'] = 'Insert VATSIM data';
395 432
 	} elseif (isset($globalIVAO) && $globalIVAO) {
396 433
 		$_SESSION['install'] = 'vatsim';
397
-		if (file_exists('tmp/ivae_feb2013.zip')) $_SESSION['next'] = 'Insert IVAO data';
398
-		else $_SESSION['next'] = 'Insert VATSIM data (IVAO not found)';
434
+		if (file_exists('tmp/ivae_feb2013.zip')) {
435
+			$_SESSION['next'] = 'Insert IVAO data';
436
+		} else {
437
+			$_SESSION['next'] = 'Insert VATSIM data (IVAO not found)';
438
+		}
399 439
 	} elseif (isset($globalphpVMS) && $globalphpVMS) {
400 440
 		$_SESSION['install'] = 'vatsim';
401 441
 		$_SESSION['next'] = 'Insert phpVMS data';
@@ -416,33 +456,43 @@  discard block
 block discarded – undo
416 456
 			if ($error != '') {
417 457
 				$_SESSION['error'] = $error;
418 458
 				$_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Insert IVAO data'));
419
-			} else $_SESSION['done'] = array_merge($_SESSION['done'],array('Insert IVAO data'));
459
+			} else {
460
+				$_SESSION['done'] = array_merge($_SESSION['done'],array('Insert IVAO data'));
461
+			}
420 462
 		} else {
421 463
 			$error .= update_db::update_vatsim();
422 464
 			if ($error != '') {
423 465
 				$_SESSION['error'] = $error;
424 466
 				$_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Insert VATSIM data'));
425
-			} else $_SESSION['done'] = array_merge($_SESSION['done'],array('Insert VATSIM data'));
467
+			} else {
468
+				$_SESSION['done'] = array_merge($_SESSION['done'],array('Insert VATSIM data'));
469
+			}
426 470
 		}
427 471
 	} elseif (isset($globalVATSIM) && $globalVATSIM) {
428 472
 		$error .= update_db::update_vatsim();
429 473
 		if ($error != '') {
430 474
 			$_SESSION['error'] = $error;
431 475
 			$_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Insert VATSIM data'));
432
-		} else $_SESSION['done'] = array_merge($_SESSION['done'],array('Insert VATSIM data'));
476
+		} else {
477
+			$_SESSION['done'] = array_merge($_SESSION['done'],array('Insert VATSIM data'));
478
+		}
433 479
 	} elseif (isset($globalIVAO) && $globalIVAO) {
434 480
 		if (file_exists('tmp/ivae_feb2013.zip')) {
435 481
 			$error .= update_db::update_IVAO();
436 482
 			if ($error != '') {
437 483
 				$_SESSION['error'] = $error;
438 484
 				$_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Insert IVAO data'));
439
-			} else $_SESSION['done'] = array_merge($_SESSION['done'],array('Insert IVAO data'));
485
+			} else {
486
+				$_SESSION['done'] = array_merge($_SESSION['done'],array('Insert IVAO data'));
487
+			}
440 488
 		} else {
441 489
 			$error .= update_db::update_vatsim();
442 490
 			if ($error != '') {
443 491
 				$_SESSION['error'] = $error;
444 492
 				$_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Insert VATSIM data (IVAO not found)'));
445
-			} else $_SESSION['done'] = array_merge($_SESSION['done'],array('Insert VATSIM data (IVAO not found)'));
493
+			} else {
494
+				$_SESSION['done'] = array_merge($_SESSION['done'],array('Insert VATSIM data (IVAO not found)'));
495
+			}
446 496
 		}
447 497
 	} elseif (isset($globalphpVMS) && $globalphpVMS) {
448 498
 		$_SESSION['done'] = array_merge($_SESSION['done'],array('Insert phpVMS data'));
Please login to merge, or discard this patch.
install/index.php 3 patches
Indentation   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -188,13 +188,13 @@  discard block
 block discarded – undo
188 188
 			<p>
189 189
 				<label for="siteurl">Site directory</label>
190 190
 				<?php
191
-				    // Try to detect site directory
192
-				    if ((!isset($globalURL) || $globalURL == '') && (!isset($globalDBuser) || $globalDBuser == '')) {
191
+					// Try to detect site directory
192
+					if ((!isset($globalURL) || $globalURL == '') && (!isset($globalDBuser) || $globalDBuser == '')) {
193 193
 					if (isset($_SERVER['REQUEST_URI'])) {
194 194
 						$URL = $_SERVER['REQUEST_URI'];
195 195
 						$globalURL = str_replace('/install','',str_replace('/install/','',str_replace('/install/index.php','',$URL)));
196 196
 					}
197
-				    }
197
+					}
198 198
 				?>
199 199
 				<input type="text" name="siteurl" id="siteurl" value="<?php if (isset($globalURL)) print $globalURL; ?>" />
200 200
 				<p class="help-block">ex : <i>/flightairmap</i> if complete URL is <i>http://toto.com/flightairmap</i></p>
@@ -373,17 +373,17 @@  discard block
 block discarded – undo
373 373
 				</tr>
374 374
 				
375 375
 		<?php
376
-		    if (isset($globalDBuser) && isset($globalDBpass) && $globalDBuser != '' && $globalDBpass != '') {
376
+			if (isset($globalDBuser) && isset($globalDBpass) && $globalDBuser != '' && $globalDBpass != '') {
377 377
 		?>
378 378
 		<!--
379 379
 		<?php
380
-			    require_once(dirname(__FILE__).'/../require/class.Connection.php');
381
-			    $Connection = new Connection();
380
+				require_once(dirname(__FILE__).'/../require/class.Connection.php');
381
+				$Connection = new Connection();
382 382
 		?>
383 383
 		-->
384 384
 		<?php
385 385
 			if ($Connection->db != NULL) {
386
-			    if ($Connection->tableExists('source_location')) {
386
+				if ($Connection->tableExists('source_location')) {
387 387
 				require_once(dirname(__FILE__).'/../require/class.Source.php');
388 388
 				$Source = new Source();
389 389
 				//$alllocations = $Source->getAllLocationInfo();
@@ -403,9 +403,9 @@  discard block
 block discarded – undo
403 403
 		
404 404
 		<?php
405 405
 				}
406
-			    }
406
+				}
407
+			}
407 408
 			}
408
-		    }
409 409
 		?>
410 410
 
411 411
 				<tr>
@@ -515,12 +515,12 @@  discard block
 block discarded – undo
515 515
 ?>
516 516
 							<tr>
517 517
 								<?php
518
-								    if (filter_var($source['host'],FILTER_VALIDATE_URL)) {
518
+									if (filter_var($source['host'],FILTER_VALIDATE_URL)) {
519 519
 								?>
520 520
 								<td><input type="text" name="host[]" id="host" value="<?php print $source['host']; ?>" /></td>
521 521
 								<td><input type="text" name="port[]" class="col-xs-2" id="port" value="<?php if (isset($source['port'])) print $source['port']; ?>" /></td>
522 522
 								<?php
523
-								    } else {
523
+									} else {
524 524
 									$hostport = explode(':',$source['host']);
525 525
 									if (isset($hostport[1])) {
526 526
 										$host = $hostport[0];
@@ -533,7 +533,7 @@  discard block
 block discarded – undo
533 533
 								<td><input type="text" name="host[]" id="host" value="<?php print $host; ?>" /></td>
534 534
 								<td><input type="text" name="port[]" class="col-xs-2" id="port" value="<?php print $port; ?>" /></td>
535 535
 								<?php
536
-								    }
536
+									}
537 537
 								?>
538 538
 								<td>
539 539
 									<select name="format[]" id="format">
@@ -673,9 +673,9 @@  discard block
 block discarded – undo
673 673
 			    </thead>
674 674
 			    <tbody>
675 675
 				<?php
676
-				    if (isset($globalNewsFeeds) && !empty($globalNewsFeeds)) {
676
+					if (isset($globalNewsFeeds) && !empty($globalNewsFeeds)) {
677 677
 					foreach ($globalNewsFeeds as $type => $feedslng) {
678
-					    foreach ($feedslng as $lng => $feeds) {
678
+						foreach ($feedslng as $lng => $feeds) {
679 679
 						foreach ($feeds as $feed) {
680 680
 				?>
681 681
 				<tr>
@@ -700,9 +700,9 @@  discard block
 block discarded – undo
700 700
 				
701 701
 				<?php
702 702
 						}
703
-					    }
703
+						}
704
+					}
704 705
 					}
705
-				    }
706 706
 				?>
707 707
 				<tr>
708 708
 				    <td><input type="url" name="newsurl[]" /></td>
@@ -1092,7 +1092,7 @@  discard block
 block discarded – undo
1092 1092
 			<br />
1093 1093
 			<p>
1094 1094
 			<?php 
1095
-			    if (extension_loaded('gd') && function_exists('gd_info')) {
1095
+				if (extension_loaded('gd') && function_exists('gd_info')) {
1096 1096
 			?>
1097 1097
 				<label for="aircrafticoncolor">Color of aircraft icon on map</label>
1098 1098
 				<input type="color" name="aircrafticoncolor" id="aircrafticoncolor" value="#<?php if (isset($globalAircraftIconColor)) echo $globalAircraftIconColor; else echo '1a3151'; ?>" />
@@ -1102,11 +1102,11 @@  discard block
 block discarded – undo
1102 1102
 				<b>The directory cache is not writable, aircraft icon will not be cached</b>
1103 1103
 			<?php
1104 1104
 				}
1105
-			    } else {
1105
+				} else {
1106 1106
 			?>
1107 1107
 				<b>PHP GD is not installed, you can't change color of aircraft icon on map</b>
1108 1108
 			<?php
1109
-			    }
1109
+				}
1110 1110
 			?>
1111 1111
 			</p>
1112 1112
 			<br />
@@ -1130,7 +1130,7 @@  discard block
 block discarded – undo
1130 1130
 	</p>
1131 1131
 <?php
1132 1132
 	require('../footer.php');
1133
-        exit;
1133
+		exit;
1134 1134
 }
1135 1135
 // '	
1136 1136
 $settings = array();
@@ -1221,8 +1221,8 @@  discard block
 block discarded – undo
1221 1221
 	
1222 1222
 	$sources = array();
1223 1223
 	foreach ($source_name as $keys => $name) {
1224
-	    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]);
1225
-	    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]);
1224
+		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]);
1225
+		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]);
1226 1226
 	}
1227 1227
 	if (count($sources) > 0) $_SESSION['sources'] = $sources;
1228 1228
 
@@ -1232,13 +1232,13 @@  discard block
 block discarded – undo
1232 1232
 	
1233 1233
 	$newsfeeds = array();
1234 1234
 	foreach($newsurl as $newskey => $url) {
1235
-	    if ($url != '') {
1235
+		if ($url != '') {
1236 1236
 		$type = $newstype[$newskey];
1237 1237
 		$lng = $newslng[$newskey];
1238 1238
 		if (isset($newsfeeds[$type][$lng])) {
1239
-		    $newsfeeds[$type][$lng] = array_merge($newsfeeds[$type][$lng],array($url));
1239
+			$newsfeeds[$type][$lng] = array_merge($newsfeeds[$type][$lng],array($url));
1240 1240
 		} else $newsfeeds[$type][$lng] = array($url);
1241
-	    }
1241
+		}
1242 1242
 	}
1243 1243
 	$settings = array_merge($settings,array('globalNewsFeeds' => $newsfeeds));
1244 1244
 
@@ -1681,14 +1681,14 @@  discard block
 block discarded – undo
1681 1681
 
1682 1682
 	// Set some defaults values...
1683 1683
 	if (!isset($globalAircraftImageSources)) {
1684
-	    $globalAircraftImageSources = array('ivaomtl','wikimedia','airportdata','deviantart','flickr','bing','jetphotos','planepictures','planespotters');
1685
-	    $settings = array_merge($settings,array('globalAircraftImageSources' => $globalAircraftImageSources));
1684
+		$globalAircraftImageSources = array('ivaomtl','wikimedia','airportdata','deviantart','flickr','bing','jetphotos','planepictures','planespotters');
1685
+		$settings = array_merge($settings,array('globalAircraftImageSources' => $globalAircraftImageSources));
1686 1686
 	}
1687 1687
 
1688 1688
 	if (!isset($globalSchedulesSources)) {
1689
-	    $globalSchedulesSources = array('flightmapper','costtotravel','flightradar24','flightaware');
1690
-    	    $settings = array_merge($settings,array('globalSchedulesSources' => $globalSchedulesSources));
1691
-    	}
1689
+		$globalSchedulesSources = array('flightmapper','costtotravel','flightradar24','flightaware');
1690
+			$settings = array_merge($settings,array('globalSchedulesSources' => $globalSchedulesSources));
1691
+		}
1692 1692
 
1693 1693
 	$settings = array_merge($settings,array('globalInstalled' => 'TRUE'));
1694 1694
 
@@ -1736,21 +1736,21 @@  discard block
 block discarded – undo
1736 1736
 	$popi = false;
1737 1737
 	$popw = false;
1738 1738
 	foreach ($_SESSION['done'] as $done) {
1739
-	    print '<li>'.$done.'....<strong>SUCCESS</strong></li>';
1740
-	    if ($done == 'Create database') $pop = true;
1741
-	    if ($_SESSION['install'] == 'database_create') $pop = true;
1742
-	    if ($_SESSION['install'] == 'database_import') $popi = true;
1743
-	    if ($_SESSION['install'] == 'waypoints') $popw = true;
1739
+		print '<li>'.$done.'....<strong>SUCCESS</strong></li>';
1740
+		if ($done == 'Create database') $pop = true;
1741
+		if ($_SESSION['install'] == 'database_create') $pop = true;
1742
+		if ($_SESSION['install'] == 'database_import') $popi = true;
1743
+		if ($_SESSION['install'] == 'waypoints') $popw = true;
1744 1744
 	}
1745 1745
 	if ($pop) {
1746
-	    sleep(5);
1747
-	    print '<li>Create database....<img src="../images/loading.gif" /></li>';
1746
+		sleep(5);
1747
+		print '<li>Create database....<img src="../images/loading.gif" /></li>';
1748 1748
 	} else if ($popi) {
1749
-	    sleep(5);
1750
-	    print '<li>Create and import tables....<img src="../images/loading.gif" /></li>';
1749
+		sleep(5);
1750
+		print '<li>Create and import tables....<img src="../images/loading.gif" /></li>';
1751 1751
 	} else if ($popw) {
1752
-	    sleep(5);
1753
-	    print '<li>Populate waypoints database....<img src="../images/loading.gif" /></li>';
1752
+		sleep(5);
1753
+		print '<li>Populate waypoints database....<img src="../images/loading.gif" /></li>';
1754 1754
 	} else print '<li>Update schema if needed....<img src="../images/loading.gif" /></li>';
1755 1755
 	print '</div></ul>';
1756 1756
 	print '<div id="error"></div>';
@@ -1816,7 +1816,7 @@  discard block
 block discarded – undo
1816 1816
 	unset($_COOKIE['install']);
1817 1817
 	print '<div class="info column"><ul>';
1818 1818
 	foreach ($_SESSION['done'] as $done) {
1819
-	    print '<li>'.$done.'....<strong>SUCCESS</strong></li>';
1819
+		print '<li>'.$done.'....<strong>SUCCESS</strong></li>';
1820 1820
 	}
1821 1821
 	print '<li>Reloading page to check all is now ok....<strong>SUCCESS</strong></li>';
1822 1822
 	print '</ul></div>';
Please login to merge, or discard this patch.
Spacing   +292 added lines, -292 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 require_once(dirname(__FILE__).'/class.create_db.php');
23 23
 require_once(dirname(__FILE__).'/class.update_schema.php');
24 24
 require_once(dirname(__FILE__).'/class.settings.php');
25
-$title="Install";
25
+$title = "Install";
26 26
 require(dirname(__FILE__).'/../require/settings.php');
27 27
 require_once(dirname(__FILE__).'/../require/class.Common.php');
28 28
 require(dirname(__FILE__).'/header.php');
@@ -93,8 +93,8 @@  discard block
 block discarded – undo
93 93
 	if (!extension_loaded('curl')) {
94 94
 		$error[] = "Curl is not loaded.";
95 95
 	}
96
-	if(function_exists('apache_get_modules') ){
97
-		if(!in_array('mod_rewrite',apache_get_modules())) {
96
+	if (function_exists('apache_get_modules')) {
97
+		if (!in_array('mod_rewrite', apache_get_modules())) {
98 98
 			$error[] = "mod_rewrite is not available.";
99 99
 		}
100 100
 	/*
@@ -113,22 +113,22 @@  discard block
 block discarded – undo
113 113
 		$alllng = $Language->listLocaleDir();
114 114
 		if (count($alllng) != count($availablelng)) {
115 115
 			$notavailable = array();
116
-			foreach($alllng as $lng) {
116
+			foreach ($alllng as $lng) {
117 117
 				if (!isset($availablelng[$lng])) $notavailable[] = $lng;
118 118
 			}
119
-			print '<div class="alert alert-warning">The following translation can\'t be used on your system: '.implode(', ',$notavailable).'. You need to add the system locales: <a href="https://github.com/Ysurac/FlightAirMap/wiki/Translation">documentation</a>.</div>';
119
+			print '<div class="alert alert-warning">The following translation can\'t be used on your system: '.implode(', ', $notavailable).'. You need to add the system locales: <a href="https://github.com/Ysurac/FlightAirMap/wiki/Translation">documentation</a>.</div>';
120 120
 		}
121 121
 	}
122 122
 	print '<div class="alert alert-info">If you use MySQL or MariaDB, check that <i>max_allowed_packet</i> >= 8M, else import of some tables can fail.</div>';
123 123
 	if (isset($_SERVER['REQUEST_SCHEME']) && isset($_SERVER['SERVER_NAME']) && isset($_SERVER['SERVER_PORT']) && isset($_SERVER['REQUEST_URI'])) {
124 124
 		if (function_exists('get_headers')) {
125 125
 			//$check_header = @get_headers($_SERVER['REQUEST_SCHEME'].'://'.$_SERVER["SERVER_NAME"].':'.$_SERVER["SERVER_PORT"].str_replace(array('install/','install'),'search',str_replace('index.php','',$_SERVER["REQUEST_URI"])));
126
-			$check_header = @get_headers($_SERVER['REQUEST_SCHEME'].'://'.$_SERVER["SERVER_NAME"].':'.$_SERVER["SERVER_PORT"].str_replace(array('install/','install'),'live/geojson?test',str_replace('index.php','',$_SERVER["REQUEST_URI"])));
127
-			if (isset($check_header[0]) && !stripos($check_header[0],"200 OK")) {
126
+			$check_header = @get_headers($_SERVER['REQUEST_SCHEME'].'://'.$_SERVER["SERVER_NAME"].':'.$_SERVER["SERVER_PORT"].str_replace(array('install/', 'install'), 'live/geojson?test', str_replace('index.php', '', $_SERVER["REQUEST_URI"])));
127
+			if (isset($check_header[0]) && !stripos($check_header[0], "200 OK")) {
128 128
 				print '<div class="alert alert-danger"><strong>Error</strong> Check your configuration, rewrite don\'t seems to work well. If using Apache, you need to desactivate MultiViews <a href="https://github.com/Ysurac/FlightAirMap/wiki/Apache-configuration">https://github.com/Ysurac/FlightAirMap/wiki/Apache-configuration</a></div>';
129 129
 			} else {
130
-				$check_header = @get_headers($_SERVER['REQUEST_SCHEME'].'://'.$_SERVER["SERVER_NAME"].':'.$_SERVER["SERVER_PORT"].str_replace(array('install/','install'),'search',str_replace('index.php','',$_SERVER["REQUEST_URI"])));
131
-				if (isset($check_header[0]) && !stripos($check_header[0],"200 OK")) {
130
+				$check_header = @get_headers($_SERVER['REQUEST_SCHEME'].'://'.$_SERVER["SERVER_NAME"].':'.$_SERVER["SERVER_PORT"].str_replace(array('install/', 'install'), 'search', str_replace('index.php', '', $_SERVER["REQUEST_URI"])));
131
+				if (isset($check_header[0]) && !stripos($check_header[0], "200 OK")) {
132 132
 					print '<div class="alert alert-danger"><strong>Error</strong> Check your configuration, rewrite don\'t seems to work well. If using Apache, you need to desactivate MultiViews <a href="https://github.com/Ysurac/FlightAirMap/wiki/Apache-configuration">https://github.com/Ysurac/FlightAirMap/wiki/Apache-configuration</a></div>';
133 133
 				}
134 134
 			}
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
 				    if ((!isset($globalURL) || $globalURL == '') && (!isset($globalDBuser) || $globalDBuser == '')) {
209 209
 					if (isset($_SERVER['REQUEST_URI'])) {
210 210
 						$URL = $_SERVER['REQUEST_URI'];
211
-						$globalURL = str_replace('/install','',str_replace('/install/','',str_replace('/install/index.php','',$URL)));
211
+						$globalURL = str_replace('/install', '', str_replace('/install/', '', str_replace('/install/index.php', '', $URL)));
212 212
 					}
213 213
 				    }
214 214
 				?>
@@ -531,13 +531,13 @@  discard block
 block discarded – undo
531 531
 ?>
532 532
 							<tr>
533 533
 								<?php
534
-								    if (filter_var($source['host'],FILTER_VALIDATE_URL)) {
534
+								    if (filter_var($source['host'], FILTER_VALIDATE_URL)) {
535 535
 								?>
536 536
 								<td><input type="text" name="host[]" id="host" value="<?php print $source['host']; ?>" /></td>
537 537
 								<td><input type="text" name="port[]" class="col-xs-2" id="port" value="<?php if (isset($source['port'])) print $source['port']; ?>" /></td>
538 538
 								<?php
539 539
 								    } else {
540
-									$hostport = explode(':',$source['host']);
540
+									$hostport = explode(':', $source['host']);
541 541
 									if (isset($hostport[1])) {
542 542
 										$host = $hostport[0];
543 543
 										$port = $hostport[1];
@@ -587,7 +587,7 @@  discard block
 block discarded – undo
587 587
 									<select name="timezones[]" id="timezones">
588 588
 								<?php
589 589
 									$timezonelist = DateTimeZone::listIdentifiers(DateTimeZone::ALL);
590
-									foreach($timezonelist as $timezones){
590
+									foreach ($timezonelist as $timezones) {
591 591
 										if (isset($source['timezone']) && $source['timezone'] == $timezones) {
592 592
 											print '<option selected>'.$timezones.'</option>';
593 593
 										} elseif (!isset($source['timezone']) && $timezones == 'UTC') {
@@ -642,7 +642,7 @@  discard block
 block discarded – undo
642 642
 									<select name="timezones[]" id="timezones">
643 643
 								<?php
644 644
 									$timezonelist = DateTimeZone::listIdentifiers(DateTimeZone::ALL);
645
-									foreach($timezonelist as $timezones){
645
+									foreach ($timezonelist as $timezones) {
646 646
 										if ($timezones == 'UTC') {
647 647
 											print '<option selected>'.$timezones.'</option>';
648 648
 										} else print '<option>'.$timezones.'</option>';
@@ -1105,7 +1105,7 @@  discard block
 block discarded – undo
1105 1105
 			<br />
1106 1106
 			<p>
1107 1107
 				<label for="aircraftsize">Size of aircraft icon on map (default to 30px if zoom > 7 else 15px), empty to default</label>
1108
-				<input type="number" name="aircraftsize" id="aircraftsize" value="<?php if (isset($globalAircraftSize)) echo $globalAircraftSize;?>" />
1108
+				<input type="number" name="aircraftsize" id="aircraftsize" value="<?php if (isset($globalAircraftSize)) echo $globalAircraftSize; ?>" />
1109 1109
 			</p>
1110 1110
 			<br />
1111 1111
 			<p>
@@ -1167,14 +1167,14 @@  discard block
 block discarded – undo
1167 1167
 $error = '';
1168 1168
 
1169 1169
 if (isset($_POST['dbtype'])) {
1170
-	$dbtype = filter_input(INPUT_POST,'dbtype',FILTER_SANITIZE_STRING);
1171
-	$dbroot = filter_input(INPUT_POST,'dbroot',FILTER_SANITIZE_STRING);
1172
-	$dbrootpass = filter_input(INPUT_POST,'dbrootpass',FILTER_SANITIZE_STRING);
1173
-	$dbname = filter_input(INPUT_POST,'dbname',FILTER_SANITIZE_STRING);
1174
-	$dbuser = filter_input(INPUT_POST,'dbuser',FILTER_SANITIZE_STRING);
1175
-	$dbuserpass = filter_input(INPUT_POST,'dbuserpass',FILTER_SANITIZE_STRING);
1176
-	$dbhost = filter_input(INPUT_POST,'dbhost',FILTER_SANITIZE_STRING);
1177
-	$dbport = filter_input(INPUT_POST,'dbport',FILTER_SANITIZE_STRING);
1170
+	$dbtype = filter_input(INPUT_POST, 'dbtype', FILTER_SANITIZE_STRING);
1171
+	$dbroot = filter_input(INPUT_POST, 'dbroot', FILTER_SANITIZE_STRING);
1172
+	$dbrootpass = filter_input(INPUT_POST, 'dbrootpass', FILTER_SANITIZE_STRING);
1173
+	$dbname = filter_input(INPUT_POST, 'dbname', FILTER_SANITIZE_STRING);
1174
+	$dbuser = filter_input(INPUT_POST, 'dbuser', FILTER_SANITIZE_STRING);
1175
+	$dbuserpass = filter_input(INPUT_POST, 'dbuserpass', FILTER_SANITIZE_STRING);
1176
+	$dbhost = filter_input(INPUT_POST, 'dbhost', FILTER_SANITIZE_STRING);
1177
+	$dbport = filter_input(INPUT_POST, 'dbport', FILTER_SANITIZE_STRING);
1178 1178
 
1179 1179
 	if ($dbtype == 'mysql' && !extension_loaded('pdo_mysql')) $error .= 'Mysql driver for PDO must be loaded';
1180 1180
 	if ($dbtype == 'pgsql' && !extension_loaded('pdo_pgsql')) $error .= 'PosgreSQL driver for PDO must be loaded';
@@ -1194,49 +1194,49 @@  discard block
 block discarded – undo
1194 1194
 	} else $settings = array_merge($settings,array('globalDBdriver' => $dbtype,'globalDBhost' => $dbhost,'globalDBuser' => $dbuser,'globalDBport' => $dbport,'globalDBpass' => $dbuserpass,'globalDBname' => $dbname));
1195 1195
 	*/
1196 1196
 	
1197
-	$settings = array_merge($settings,array('globalDBdriver' => $dbtype,'globalDBhost' => $dbhost,'globalDBuser' => $dbuser,'globalDBport' => $dbport,'globalDBpass' => $dbuserpass,'globalDBname' => $dbname));
1197
+	$settings = array_merge($settings, array('globalDBdriver' => $dbtype, 'globalDBhost' => $dbhost, 'globalDBuser' => $dbuser, 'globalDBport' => $dbport, 'globalDBpass' => $dbuserpass, 'globalDBname' => $dbname));
1198 1198
 
1199
-	$sitename = filter_input(INPUT_POST,'sitename',FILTER_SANITIZE_STRING);
1200
-	$siteurl = filter_input(INPUT_POST,'siteurl',FILTER_SANITIZE_STRING);
1201
-	$timezone = filter_input(INPUT_POST,'timezone',FILTER_SANITIZE_STRING);
1202
-	$language = filter_input(INPUT_POST,'language',FILTER_SANITIZE_STRING);
1203
-	$settings = array_merge($settings,array('globalName' => $sitename,'globalURL' => $siteurl, 'globalTimezone' => $timezone,'globalLanguage' => $language));
1199
+	$sitename = filter_input(INPUT_POST, 'sitename', FILTER_SANITIZE_STRING);
1200
+	$siteurl = filter_input(INPUT_POST, 'siteurl', FILTER_SANITIZE_STRING);
1201
+	$timezone = filter_input(INPUT_POST, 'timezone', FILTER_SANITIZE_STRING);
1202
+	$language = filter_input(INPUT_POST, 'language', FILTER_SANITIZE_STRING);
1203
+	$settings = array_merge($settings, array('globalName' => $sitename, 'globalURL' => $siteurl, 'globalTimezone' => $timezone, 'globalLanguage' => $language));
1204 1204
 
1205
-	$mapprovider = filter_input(INPUT_POST,'mapprovider',FILTER_SANITIZE_STRING);
1206
-	$mapboxid = filter_input(INPUT_POST,'mapboxid',FILTER_SANITIZE_STRING);
1207
-	$mapboxtoken = filter_input(INPUT_POST,'mapboxtoken',FILTER_SANITIZE_STRING);
1208
-	$googlekey = filter_input(INPUT_POST,'googlekey',FILTER_SANITIZE_STRING);
1209
-	$bingkey = filter_input(INPUT_POST,'bingkey',FILTER_SANITIZE_STRING);
1210
-	$openweathermapkey = filter_input(INPUT_POST,'openweathermapkey',FILTER_SANITIZE_STRING);
1211
-	$mapquestkey = filter_input(INPUT_POST,'mapquestkey',FILTER_SANITIZE_STRING);
1212
-	$hereappid = filter_input(INPUT_POST,'hereappid',FILTER_SANITIZE_STRING);
1213
-	$hereappcode = filter_input(INPUT_POST,'hereappcode',FILTER_SANITIZE_STRING);
1214
-	$settings = array_merge($settings,array('globalMapProvider' => $mapprovider,'globalMapboxId' => $mapboxid,'globalMapboxToken' => $mapboxtoken,'globalGoogleAPIKey' => $googlekey,'globalBingMapKey' => $bingkey,'globalHereappID' => $hereappid,'globalHereappCode' => $hereappcode,'globalMapQuestKey' => $mapquestkey,'globalOpenWeatherMapKey' => $openweathermapkey));
1205
+	$mapprovider = filter_input(INPUT_POST, 'mapprovider', FILTER_SANITIZE_STRING);
1206
+	$mapboxid = filter_input(INPUT_POST, 'mapboxid', FILTER_SANITIZE_STRING);
1207
+	$mapboxtoken = filter_input(INPUT_POST, 'mapboxtoken', FILTER_SANITIZE_STRING);
1208
+	$googlekey = filter_input(INPUT_POST, 'googlekey', FILTER_SANITIZE_STRING);
1209
+	$bingkey = filter_input(INPUT_POST, 'bingkey', FILTER_SANITIZE_STRING);
1210
+	$openweathermapkey = filter_input(INPUT_POST, 'openweathermapkey', FILTER_SANITIZE_STRING);
1211
+	$mapquestkey = filter_input(INPUT_POST, 'mapquestkey', FILTER_SANITIZE_STRING);
1212
+	$hereappid = filter_input(INPUT_POST, 'hereappid', FILTER_SANITIZE_STRING);
1213
+	$hereappcode = filter_input(INPUT_POST, 'hereappcode', FILTER_SANITIZE_STRING);
1214
+	$settings = array_merge($settings, array('globalMapProvider' => $mapprovider, 'globalMapboxId' => $mapboxid, 'globalMapboxToken' => $mapboxtoken, 'globalGoogleAPIKey' => $googlekey, 'globalBingMapKey' => $bingkey, 'globalHereappID' => $hereappid, 'globalHereappCode' => $hereappcode, 'globalMapQuestKey' => $mapquestkey, 'globalOpenWeatherMapKey' => $openweathermapkey));
1215 1215
 	
1216
-	$latitudemax = filter_input(INPUT_POST,'latitudemax',FILTER_SANITIZE_STRING);
1217
-	$latitudemin = filter_input(INPUT_POST,'latitudemin',FILTER_SANITIZE_STRING);
1218
-	$longitudemax = filter_input(INPUT_POST,'longitudemax',FILTER_SANITIZE_STRING);
1219
-	$longitudemin = filter_input(INPUT_POST,'longitudemin',FILTER_SANITIZE_STRING);
1220
-	$livezoom = filter_input(INPUT_POST,'livezoom',FILTER_SANITIZE_NUMBER_INT);
1221
-	$settings = array_merge($settings,array('globalLatitudeMax' => $latitudemax,'globalLatitudeMin' => $latitudemin,'globalLongitudeMax' => $longitudemax,'globalLongitudeMin' => $longitudemin,'globalLiveZoom' => $livezoom));
1216
+	$latitudemax = filter_input(INPUT_POST, 'latitudemax', FILTER_SANITIZE_STRING);
1217
+	$latitudemin = filter_input(INPUT_POST, 'latitudemin', FILTER_SANITIZE_STRING);
1218
+	$longitudemax = filter_input(INPUT_POST, 'longitudemax', FILTER_SANITIZE_STRING);
1219
+	$longitudemin = filter_input(INPUT_POST, 'longitudemin', FILTER_SANITIZE_STRING);
1220
+	$livezoom = filter_input(INPUT_POST, 'livezoom', FILTER_SANITIZE_NUMBER_INT);
1221
+	$settings = array_merge($settings, array('globalLatitudeMax' => $latitudemax, 'globalLatitudeMin' => $latitudemin, 'globalLongitudeMax' => $longitudemax, 'globalLongitudeMin' => $longitudemin, 'globalLiveZoom' => $livezoom));
1222 1222
 
1223
-	$squawk_country = filter_input(INPUT_POST,'squawk_country',FILTER_SANITIZE_STRING);
1224
-	$settings = array_merge($settings,array('globalSquawkCountry' => $squawk_country));
1223
+	$squawk_country = filter_input(INPUT_POST, 'squawk_country', FILTER_SANITIZE_STRING);
1224
+	$settings = array_merge($settings, array('globalSquawkCountry' => $squawk_country));
1225 1225
 
1226
-	$latitudecenter = filter_input(INPUT_POST,'latitudecenter',FILTER_SANITIZE_STRING);
1227
-	$longitudecenter = filter_input(INPUT_POST,'longitudecenter',FILTER_SANITIZE_STRING);
1228
-	$settings = array_merge($settings,array('globalCenterLatitude' => $latitudecenter,'globalCenterLongitude' => $longitudecenter));
1226
+	$latitudecenter = filter_input(INPUT_POST, 'latitudecenter', FILTER_SANITIZE_STRING);
1227
+	$longitudecenter = filter_input(INPUT_POST, 'longitudecenter', FILTER_SANITIZE_STRING);
1228
+	$settings = array_merge($settings, array('globalCenterLatitude' => $latitudecenter, 'globalCenterLongitude' => $longitudecenter));
1229 1229
 
1230
-	$acars = filter_input(INPUT_POST,'acars',FILTER_SANITIZE_STRING);
1230
+	$acars = filter_input(INPUT_POST, 'acars', FILTER_SANITIZE_STRING);
1231 1231
 	if ($acars == 'acars') {
1232
-		$settings = array_merge($settings,array('globalACARS' => 'TRUE'));
1232
+		$settings = array_merge($settings, array('globalACARS' => 'TRUE'));
1233 1233
 	} else {
1234
-		$settings = array_merge($settings,array('globalACARS' => 'FALSE'));
1234
+		$settings = array_merge($settings, array('globalACARS' => 'FALSE'));
1235 1235
 	}
1236 1236
 
1237
-	$flightawareusername = filter_input(INPUT_POST,'flightawareusername',FILTER_SANITIZE_STRING);
1238
-	$flightawarepassword = filter_input(INPUT_POST,'flightawarepassword',FILTER_SANITIZE_STRING);
1239
-	$settings = array_merge($settings,array('globalFlightAwareUsername' => $flightawareusername,'globalFlightAwarePassword' => $flightawarepassword));
1237
+	$flightawareusername = filter_input(INPUT_POST, 'flightawareusername', FILTER_SANITIZE_STRING);
1238
+	$flightawarepassword = filter_input(INPUT_POST, 'flightawarepassword', FILTER_SANITIZE_STRING);
1239
+	$settings = array_merge($settings, array('globalFlightAwareUsername' => $flightawareusername, 'globalFlightAwarePassword' => $flightawarepassword));
1240 1240
 	
1241 1241
 	$source_name = $_POST['source_name'];
1242 1242
 	$source_latitude = $_POST['source_latitude'];
@@ -1250,8 +1250,8 @@  discard block
 block discarded – undo
1250 1250
 	
1251 1251
 	$sources = array();
1252 1252
 	foreach ($source_name as $keys => $name) {
1253
-	    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]);
1254
-	    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]);
1253
+	    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]);
1254
+	    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]);
1255 1255
 	}
1256 1256
 	if (count($sources) > 0) $_SESSION['sources'] = $sources;
1257 1257
 
@@ -1260,16 +1260,16 @@  discard block
 block discarded – undo
1260 1260
 	$newstype = $_POST['newstype'];
1261 1261
 	
1262 1262
 	$newsfeeds = array();
1263
-	foreach($newsurl as $newskey => $url) {
1263
+	foreach ($newsurl as $newskey => $url) {
1264 1264
 	    if ($url != '') {
1265 1265
 		$type = $newstype[$newskey];
1266 1266
 		$lng = $newslng[$newskey];
1267 1267
 		if (isset($newsfeeds[$type][$lng])) {
1268
-		    $newsfeeds[$type][$lng] = array_merge($newsfeeds[$type][$lng],array($url));
1268
+		    $newsfeeds[$type][$lng] = array_merge($newsfeeds[$type][$lng], array($url));
1269 1269
 		} else $newsfeeds[$type][$lng] = array($url);
1270 1270
 	    }
1271 1271
 	}
1272
-	$settings = array_merge($settings,array('globalNewsFeeds' => $newsfeeds));
1272
+	$settings = array_merge($settings, array('globalNewsFeeds' => $newsfeeds));
1273 1273
 
1274 1274
 	//$sbshost = filter_input(INPUT_POST,'sbshost',FILTER_SANITIZE_STRING);
1275 1275
 	//$sbsport = filter_input(INPUT_POST,'sbsport',FILTER_SANITIZE_NUMBER_INT);
@@ -1280,27 +1280,27 @@  discard block
 block discarded – undo
1280 1280
 	$sbsurl = $_POST['sbsurl'];
1281 1281
 	*/
1282 1282
 
1283
-	$globalvatsim = filter_input(INPUT_POST,'globalvatsim',FILTER_SANITIZE_STRING);
1284
-	$globalva = filter_input(INPUT_POST,'globalva',FILTER_SANITIZE_STRING);
1285
-	$globalivao = filter_input(INPUT_POST,'globalivao',FILTER_SANITIZE_STRING);
1286
-	$globalphpvms = filter_input(INPUT_POST,'globalphpvms',FILTER_SANITIZE_STRING);
1287
-	$globalvam = filter_input(INPUT_POST,'globalvam',FILTER_SANITIZE_STRING);
1288
-	$globalsbs = filter_input(INPUT_POST,'globalsbs',FILTER_SANITIZE_STRING);
1289
-	$globalaprs = filter_input(INPUT_POST,'globalaprs',FILTER_SANITIZE_STRING);
1290
-	$datasource = filter_input(INPUT_POST,'datasource',FILTER_SANITIZE_STRING);
1283
+	$globalvatsim = filter_input(INPUT_POST, 'globalvatsim', FILTER_SANITIZE_STRING);
1284
+	$globalva = filter_input(INPUT_POST, 'globalva', FILTER_SANITIZE_STRING);
1285
+	$globalivao = filter_input(INPUT_POST, 'globalivao', FILTER_SANITIZE_STRING);
1286
+	$globalphpvms = filter_input(INPUT_POST, 'globalphpvms', FILTER_SANITIZE_STRING);
1287
+	$globalvam = filter_input(INPUT_POST, 'globalvam', FILTER_SANITIZE_STRING);
1288
+	$globalsbs = filter_input(INPUT_POST, 'globalsbs', FILTER_SANITIZE_STRING);
1289
+	$globalaprs = filter_input(INPUT_POST, 'globalaprs', FILTER_SANITIZE_STRING);
1290
+	$datasource = filter_input(INPUT_POST, 'datasource', FILTER_SANITIZE_STRING);
1291 1291
 
1292
-	$globalaircraft = filter_input(INPUT_POST,'globalaircraft',FILTER_SANITIZE_STRING);
1293
-	if ($globalaircraft == 'aircraft') $settings = array_merge($settings,array('globalAircraft' => 'TRUE'));
1294
-	else $settings = array_merge($settings,array('globalAircraft' => 'FALSE'));
1295
-	$globaltracker = filter_input(INPUT_POST,'globaltracker',FILTER_SANITIZE_STRING);
1296
-	if ($globaltracker == 'tracker') $settings = array_merge($settings,array('globalTracker' => 'TRUE'));
1297
-	else $settings = array_merge($settings,array('globalTracker' => 'FALSE'));
1298
-	$globalmarine = filter_input(INPUT_POST,'globalmarine',FILTER_SANITIZE_STRING);
1299
-	if ($globalmarine == 'marine') $settings = array_merge($settings,array('globalMarine' => 'TRUE'));
1300
-	else $settings = array_merge($settings,array('globalMarine' => 'FALSE'));
1301
-	$globalsatellite = filter_input(INPUT_POST,'globalsatellite',FILTER_SANITIZE_STRING);
1302
-	if ($globalsatellite == 'satellite') $settings = array_merge($settings,array('globalSatellite' => 'TRUE'));
1303
-	else $settings = array_merge($settings,array('globalSatellite' => 'FALSE'));
1292
+	$globalaircraft = filter_input(INPUT_POST, 'globalaircraft', FILTER_SANITIZE_STRING);
1293
+	if ($globalaircraft == 'aircraft') $settings = array_merge($settings, array('globalAircraft' => 'TRUE'));
1294
+	else $settings = array_merge($settings, array('globalAircraft' => 'FALSE'));
1295
+	$globaltracker = filter_input(INPUT_POST, 'globaltracker', FILTER_SANITIZE_STRING);
1296
+	if ($globaltracker == 'tracker') $settings = array_merge($settings, array('globalTracker' => 'TRUE'));
1297
+	else $settings = array_merge($settings, array('globalTracker' => 'FALSE'));
1298
+	$globalmarine = filter_input(INPUT_POST, 'globalmarine', FILTER_SANITIZE_STRING);
1299
+	if ($globalmarine == 'marine') $settings = array_merge($settings, array('globalMarine' => 'TRUE'));
1300
+	else $settings = array_merge($settings, array('globalMarine' => 'FALSE'));
1301
+	$globalsatellite = filter_input(INPUT_POST, 'globalsatellite', FILTER_SANITIZE_STRING);
1302
+	if ($globalsatellite == 'satellite') $settings = array_merge($settings, array('globalSatellite' => 'TRUE'));
1303
+	else $settings = array_merge($settings, array('globalSatellite' => 'FALSE'));
1304 1304
 
1305 1305
 /*	
1306 1306
 	$globalSBS1Hosts = array();
@@ -1316,7 +1316,7 @@  discard block
 block discarded – undo
1316 1316
 	}
1317 1317
 	$settings = array_merge($settings,array('globalSBS1Hosts' => $globalSBS1Hosts));
1318 1318
 */
1319
-	$settings_comment = array_merge($settings_comment,array('globalSBS1Hosts'));
1319
+	$settings_comment = array_merge($settings_comment, array('globalSBS1Hosts'));
1320 1320
 	$host = $_POST['host'];
1321 1321
 	$port = $_POST['port'];
1322 1322
 	$name = $_POST['name'];
@@ -1333,115 +1333,115 @@  discard block
 block discarded – undo
1333 1333
 		else $cov = 'FALSE';
1334 1334
 		if (isset($noarchive[$key]) && $noarchive[$key] == 1) $arch = 'TRUE';
1335 1335
 		else $arch = 'FALSE';
1336
-		if (strpos($format[$key],'_callback')) {
1337
-			$gSources[] = array('host' => $h, 'pass' => $port[$key],'name' => $name[$key],'format' => $format[$key],'sourcestats' => $cov,'noarchive' => $arch,'timezone' => $timezones[$key],'callback' => 'TRUE');
1336
+		if (strpos($format[$key], '_callback')) {
1337
+			$gSources[] = array('host' => $h, 'pass' => $port[$key], 'name' => $name[$key], 'format' => $format[$key], 'sourcestats' => $cov, 'noarchive' => $arch, 'timezone' => $timezones[$key], 'callback' => 'TRUE');
1338 1338
 		} elseif ($h != '' || $name[$key] != '') {
1339
-			$gSources[] = array('host' => $h, 'port' => $port[$key],'name' => $name[$key],'format' => $format[$key],'sourcestats' => $cov,'noarchive' => $arch,'timezone' => $timezones[$key],'callback' => 'FALSE');
1339
+			$gSources[] = array('host' => $h, 'port' => $port[$key], 'name' => $name[$key], 'format' => $format[$key], 'sourcestats' => $cov, 'noarchive' => $arch, 'timezone' => $timezones[$key], 'callback' => 'FALSE');
1340 1340
 		}
1341 1341
 		if ($format[$key] == 'airwhere') $forcepilots = true;
1342 1342
 	}
1343
-	$settings = array_merge($settings,array('globalSources' => $gSources));
1343
+	$settings = array_merge($settings, array('globalSources' => $gSources));
1344 1344
 
1345 1345
 /*
1346 1346
 	$sbstimeout = filter_input(INPUT_POST,'sbstimeout',FILTER_SANITIZE_NUMBER_INT);
1347 1347
 	$settings = array_merge($settings,array('globalSourcesTimeOut' => $sbstimeout));
1348 1348
 */
1349
-	$acarshost = filter_input(INPUT_POST,'acarshost',FILTER_SANITIZE_STRING);
1350
-	$acarsport = filter_input(INPUT_POST,'acarsport',FILTER_SANITIZE_NUMBER_INT);
1351
-	$settings = array_merge($settings,array('globalACARSHost' => $acarshost,'globalACARSPort' => $acarsport));
1349
+	$acarshost = filter_input(INPUT_POST, 'acarshost', FILTER_SANITIZE_STRING);
1350
+	$acarsport = filter_input(INPUT_POST, 'acarsport', FILTER_SANITIZE_NUMBER_INT);
1351
+	$settings = array_merge($settings, array('globalACARSHost' => $acarshost, 'globalACARSPort' => $acarsport));
1352 1352
 
1353
-	$bitly = filter_input(INPUT_POST,'bitly',FILTER_SANITIZE_STRING);
1354
-	$settings = array_merge($settings,array('globalBitlyAccessToken' => $bitly));
1353
+	$bitly = filter_input(INPUT_POST, 'bitly', FILTER_SANITIZE_STRING);
1354
+	$settings = array_merge($settings, array('globalBitlyAccessToken' => $bitly));
1355 1355
 
1356
-	$customcss = filter_input(INPUT_POST,'customcss',FILTER_SANITIZE_STRING);
1357
-	$settings = array_merge($settings,array('globalCustomCSS' => $customcss));
1356
+	$customcss = filter_input(INPUT_POST, 'customcss', FILTER_SANITIZE_STRING);
1357
+	$settings = array_merge($settings, array('globalCustomCSS' => $customcss));
1358 1358
 
1359
-	$map3dtile = filter_input(INPUT_POST,'map3dtileset',FILTER_SANITIZE_STRING);
1360
-	$settings = array_merge($settings,array('globalMap3DTiles' => $map3dtile));
1359
+	$map3dtile = filter_input(INPUT_POST, 'map3dtileset', FILTER_SANITIZE_STRING);
1360
+	$settings = array_merge($settings, array('globalMap3DTiles' => $map3dtile));
1361 1361
 
1362
-	$notamsource = filter_input(INPUT_POST,'notamsource',FILTER_SANITIZE_STRING);
1363
-	$settings = array_merge($settings,array('globalNOTAMSource' => $notamsource));
1364
-	$metarsource = filter_input(INPUT_POST,'metarsource',FILTER_SANITIZE_STRING);
1365
-	$settings = array_merge($settings,array('globalMETARurl' => $metarsource));
1362
+	$notamsource = filter_input(INPUT_POST, 'notamsource', FILTER_SANITIZE_STRING);
1363
+	$settings = array_merge($settings, array('globalNOTAMSource' => $notamsource));
1364
+	$metarsource = filter_input(INPUT_POST, 'metarsource', FILTER_SANITIZE_STRING);
1365
+	$settings = array_merge($settings, array('globalMETARurl' => $metarsource));
1366 1366
 
1367
-	$zoilatitude = filter_input(INPUT_POST,'zoilatitude',FILTER_SANITIZE_STRING);
1368
-	$zoilongitude = filter_input(INPUT_POST,'zoilongitude',FILTER_SANITIZE_STRING);
1369
-	$zoidistance = filter_input(INPUT_POST,'zoidistance',FILTER_SANITIZE_NUMBER_INT);
1367
+	$zoilatitude = filter_input(INPUT_POST, 'zoilatitude', FILTER_SANITIZE_STRING);
1368
+	$zoilongitude = filter_input(INPUT_POST, 'zoilongitude', FILTER_SANITIZE_STRING);
1369
+	$zoidistance = filter_input(INPUT_POST, 'zoidistance', FILTER_SANITIZE_NUMBER_INT);
1370 1370
 	if ($zoilatitude != '' && $zoilongitude != '' && $zoidistance != '') {
1371
-		$settings = array_merge($settings,array('globalDistanceIgnore' => array('latitude' => $zoilatitude,'longitude' => $zoilongitude,'distance' => $zoidistance)));
1372
-	} else $settings = array_merge($settings,array('globalDistanceIgnore' => array()));
1371
+		$settings = array_merge($settings, array('globalDistanceIgnore' => array('latitude' => $zoilatitude, 'longitude' => $zoilongitude, 'distance' => $zoidistance)));
1372
+	} else $settings = array_merge($settings, array('globalDistanceIgnore' => array()));
1373 1373
 
1374
-	$refresh = filter_input(INPUT_POST,'refresh',FILTER_SANITIZE_NUMBER_INT);
1375
-	$settings = array_merge($settings,array('globalLiveInterval' => $refresh));
1376
-	$maprefresh = filter_input(INPUT_POST,'maprefresh',FILTER_SANITIZE_NUMBER_INT);
1377
-	$settings = array_merge($settings,array('globalMapRefresh' => $maprefresh));
1378
-	$mapidle = filter_input(INPUT_POST,'mapidle',FILTER_SANITIZE_NUMBER_INT);
1379
-	$settings = array_merge($settings,array('globalMapIdleTimeout' => $mapidle));
1380
-	$minfetch = filter_input(INPUT_POST,'minfetch',FILTER_SANITIZE_NUMBER_INT);
1381
-	$settings = array_merge($settings,array('globalMinFetch' => $minfetch));
1382
-	$closestmindist = filter_input(INPUT_POST,'closestmindist',FILTER_SANITIZE_NUMBER_INT);
1383
-	$settings = array_merge($settings,array('globalClosestMinDist' => $closestmindist));
1374
+	$refresh = filter_input(INPUT_POST, 'refresh', FILTER_SANITIZE_NUMBER_INT);
1375
+	$settings = array_merge($settings, array('globalLiveInterval' => $refresh));
1376
+	$maprefresh = filter_input(INPUT_POST, 'maprefresh', FILTER_SANITIZE_NUMBER_INT);
1377
+	$settings = array_merge($settings, array('globalMapRefresh' => $maprefresh));
1378
+	$mapidle = filter_input(INPUT_POST, 'mapidle', FILTER_SANITIZE_NUMBER_INT);
1379
+	$settings = array_merge($settings, array('globalMapIdleTimeout' => $mapidle));
1380
+	$minfetch = filter_input(INPUT_POST, 'minfetch', FILTER_SANITIZE_NUMBER_INT);
1381
+	$settings = array_merge($settings, array('globalMinFetch' => $minfetch));
1382
+	$closestmindist = filter_input(INPUT_POST, 'closestmindist', FILTER_SANITIZE_NUMBER_INT);
1383
+	$settings = array_merge($settings, array('globalClosestMinDist' => $closestmindist));
1384 1384
 
1385
-	$aircraftsize = filter_input(INPUT_POST,'aircraftsize',FILTER_SANITIZE_NUMBER_INT);
1386
-	$settings = array_merge($settings,array('globalAircraftSize' => $aircraftsize));
1385
+	$aircraftsize = filter_input(INPUT_POST, 'aircraftsize', FILTER_SANITIZE_NUMBER_INT);
1386
+	$settings = array_merge($settings, array('globalAircraftSize' => $aircraftsize));
1387 1387
 
1388
-	$archivemonths = filter_input(INPUT_POST,'archivemonths',FILTER_SANITIZE_NUMBER_INT);
1389
-	$settings = array_merge($settings,array('globalArchiveMonths' => $archivemonths));
1388
+	$archivemonths = filter_input(INPUT_POST, 'archivemonths', FILTER_SANITIZE_NUMBER_INT);
1389
+	$settings = array_merge($settings, array('globalArchiveMonths' => $archivemonths));
1390 1390
 	
1391
-	$archiveyear = filter_input(INPUT_POST,'archiveyear',FILTER_SANITIZE_STRING);
1391
+	$archiveyear = filter_input(INPUT_POST, 'archiveyear', FILTER_SANITIZE_STRING);
1392 1392
 	if ($archiveyear == "archiveyear") {
1393
-		$settings = array_merge($settings,array('globalArchiveYear' => 'TRUE'));
1393
+		$settings = array_merge($settings, array('globalArchiveYear' => 'TRUE'));
1394 1394
 	} else {
1395
-		$settings = array_merge($settings,array('globalArchiveYear' => 'FALSE'));
1395
+		$settings = array_merge($settings, array('globalArchiveYear' => 'FALSE'));
1396 1396
 	}
1397
-	$archivekeepmonths = filter_input(INPUT_POST,'archivekeepmonths',FILTER_SANITIZE_NUMBER_INT);
1398
-	$settings = array_merge($settings,array('globalArchiveKeepMonths' => $archivekeepmonths));
1399
-	$archivekeeptrackmonths = filter_input(INPUT_POST,'archivekeeptrackmonths',FILTER_SANITIZE_NUMBER_INT);
1400
-	$settings = array_merge($settings,array('globalArchiveKeepTrackMonths' => $archivekeeptrackmonths));
1397
+	$archivekeepmonths = filter_input(INPUT_POST, 'archivekeepmonths', FILTER_SANITIZE_NUMBER_INT);
1398
+	$settings = array_merge($settings, array('globalArchiveKeepMonths' => $archivekeepmonths));
1399
+	$archivekeeptrackmonths = filter_input(INPUT_POST, 'archivekeeptrackmonths', FILTER_SANITIZE_NUMBER_INT);
1400
+	$settings = array_merge($settings, array('globalArchiveKeepTrackMonths' => $archivekeeptrackmonths));
1401 1401
 
1402
-	$britishairways = filter_input(INPUT_POST,'britishairways',FILTER_SANITIZE_STRING);
1403
-	$settings = array_merge($settings,array('globalBritishAirwaysKey' => $britishairways));
1404
-	$transavia = filter_input(INPUT_POST,'transavia',FILTER_SANITIZE_STRING);
1405
-	$settings = array_merge($settings,array('globalTransaviaKey' => $transavia));
1402
+	$britishairways = filter_input(INPUT_POST, 'britishairways', FILTER_SANITIZE_STRING);
1403
+	$settings = array_merge($settings, array('globalBritishAirwaysKey' => $britishairways));
1404
+	$transavia = filter_input(INPUT_POST, 'transavia', FILTER_SANITIZE_STRING);
1405
+	$settings = array_merge($settings, array('globalTransaviaKey' => $transavia));
1406 1406
 
1407
-	$lufthansakey = filter_input(INPUT_POST,'lufthansakey',FILTER_SANITIZE_STRING);
1408
-	$lufthansasecret = filter_input(INPUT_POST,'lufthansasecret',FILTER_SANITIZE_STRING);
1409
-	$settings = array_merge($settings,array('globalLufthansaKey' => array('key' => $lufthansakey,'secret' => $lufthansasecret)));
1407
+	$lufthansakey = filter_input(INPUT_POST, 'lufthansakey', FILTER_SANITIZE_STRING);
1408
+	$lufthansasecret = filter_input(INPUT_POST, 'lufthansasecret', FILTER_SANITIZE_STRING);
1409
+	$settings = array_merge($settings, array('globalLufthansaKey' => array('key' => $lufthansakey, 'secret' => $lufthansasecret)));
1410 1410
 
1411 1411
 	// Create in settings.php keys not yet configurable if not already here
1412 1412
 	//if (!isset($globalImageBingKey)) $settings = array_merge($settings,array('globalImageBingKey' => ''));
1413
-	if (!isset($globalDebug)) $settings = array_merge($settings,array('globalDebug' => 'TRUE'));
1413
+	if (!isset($globalDebug)) $settings = array_merge($settings, array('globalDebug' => 'TRUE'));
1414 1414
 
1415
-	$resetyearstats = filter_input(INPUT_POST,'resetyearstats',FILTER_SANITIZE_STRING);
1415
+	$resetyearstats = filter_input(INPUT_POST, 'resetyearstats', FILTER_SANITIZE_STRING);
1416 1416
 	if ($resetyearstats == 'resetyearstats') {
1417
-		$settings = array_merge($settings,array('globalDeleteLastYearStats' => 'TRUE'));
1417
+		$settings = array_merge($settings, array('globalDeleteLastYearStats' => 'TRUE'));
1418 1418
 	} else {
1419
-		$settings = array_merge($settings,array('globalDeleteLastYearStats' => 'FALSE'));
1419
+		$settings = array_merge($settings, array('globalDeleteLastYearStats' => 'FALSE'));
1420 1420
 	}
1421 1421
 
1422
-	$archive = filter_input(INPUT_POST,'archive',FILTER_SANITIZE_STRING);
1422
+	$archive = filter_input(INPUT_POST, 'archive', FILTER_SANITIZE_STRING);
1423 1423
 	if ($archive == 'archive') {
1424
-		$settings = array_merge($settings,array('globalArchive' => 'TRUE'));
1424
+		$settings = array_merge($settings, array('globalArchive' => 'TRUE'));
1425 1425
 	} else {
1426
-		$settings = array_merge($settings,array('globalArchive' => 'FALSE'));
1426
+		$settings = array_merge($settings, array('globalArchive' => 'FALSE'));
1427 1427
 	}
1428
-	$archiveresults = filter_input(INPUT_POST,'archiveresults',FILTER_SANITIZE_STRING);
1428
+	$archiveresults = filter_input(INPUT_POST, 'archiveresults', FILTER_SANITIZE_STRING);
1429 1429
 	if ($archiveresults == 'archiveresults') {
1430
-		$settings = array_merge($settings,array('globalArchiveResults' => 'TRUE'));
1430
+		$settings = array_merge($settings, array('globalArchiveResults' => 'TRUE'));
1431 1431
 	} else {
1432
-		$settings = array_merge($settings,array('globalArchiveResults' => 'FALSE'));
1432
+		$settings = array_merge($settings, array('globalArchiveResults' => 'FALSE'));
1433 1433
 	}
1434
-	$daemon = filter_input(INPUT_POST,'daemon',FILTER_SANITIZE_STRING);
1434
+	$daemon = filter_input(INPUT_POST, 'daemon', FILTER_SANITIZE_STRING);
1435 1435
 	if ($daemon == 'daemon') {
1436
-		$settings = array_merge($settings,array('globalDaemon' => 'TRUE'));
1436
+		$settings = array_merge($settings, array('globalDaemon' => 'TRUE'));
1437 1437
 	} else {
1438
-		$settings = array_merge($settings,array('globalDaemon' => 'FALSE'));
1438
+		$settings = array_merge($settings, array('globalDaemon' => 'FALSE'));
1439 1439
 	}
1440
-	$schedules = filter_input(INPUT_POST,'schedules',FILTER_SANITIZE_STRING);
1440
+	$schedules = filter_input(INPUT_POST, 'schedules', FILTER_SANITIZE_STRING);
1441 1441
 	if ($schedules == 'schedules') {
1442
-		$settings = array_merge($settings,array('globalSchedulesFetch' => 'TRUE'));
1442
+		$settings = array_merge($settings, array('globalSchedulesFetch' => 'TRUE'));
1443 1443
 	} else {
1444
-		$settings = array_merge($settings,array('globalSchedulesFetch' => 'FALSE'));
1444
+		$settings = array_merge($settings, array('globalSchedulesFetch' => 'FALSE'));
1445 1445
 	}
1446 1446
 
1447 1447
 /*
@@ -1452,286 +1452,286 @@  discard block
 block discarded – undo
1452 1452
 		$settings = array_merge($settings,array('globalFlightAware' => 'FALSE','globalSBS1' => 'TRUE'));
1453 1453
 	}
1454 1454
 */
1455
-	$settings = array_merge($settings,array('globalFlightAware' => 'FALSE'));
1456
-	if ($globalsbs == 'sbs') $settings = array_merge($settings,array('globalSBS1' => 'TRUE'));
1457
-	else $settings = array_merge($settings,array('globalSBS1' => 'FALSE'));
1458
-	if ($globalaprs == 'aprs') $settings = array_merge($settings,array('globalAPRS' => 'TRUE'));
1459
-	else $settings = array_merge($settings,array('globalAPRS' => 'FALSE'));
1455
+	$settings = array_merge($settings, array('globalFlightAware' => 'FALSE'));
1456
+	if ($globalsbs == 'sbs') $settings = array_merge($settings, array('globalSBS1' => 'TRUE'));
1457
+	else $settings = array_merge($settings, array('globalSBS1' => 'FALSE'));
1458
+	if ($globalaprs == 'aprs') $settings = array_merge($settings, array('globalAPRS' => 'TRUE'));
1459
+	else $settings = array_merge($settings, array('globalAPRS' => 'FALSE'));
1460 1460
 	$va = false;
1461 1461
 	if ($globalivao == 'ivao') {
1462
-		$settings = array_merge($settings,array('globalIVAO' => 'TRUE'));
1462
+		$settings = array_merge($settings, array('globalIVAO' => 'TRUE'));
1463 1463
 		$va = true;
1464
-	} else $settings = array_merge($settings,array('globalIVAO' => 'FALSE'));
1464
+	} else $settings = array_merge($settings, array('globalIVAO' => 'FALSE'));
1465 1465
 	if ($globalvatsim == 'vatsim') {
1466
-		$settings = array_merge($settings,array('globalVATSIM' => 'TRUE'));
1466
+		$settings = array_merge($settings, array('globalVATSIM' => 'TRUE'));
1467 1467
 		$va = true;
1468
-	} else $settings = array_merge($settings,array('globalVATSIM' => 'FALSE'));
1468
+	} else $settings = array_merge($settings, array('globalVATSIM' => 'FALSE'));
1469 1469
 	if ($globalphpvms == 'phpvms') {
1470
-		$settings = array_merge($settings,array('globalphpVMS' => 'TRUE'));
1470
+		$settings = array_merge($settings, array('globalphpVMS' => 'TRUE'));
1471 1471
 		$va = true;
1472
-	} else $settings = array_merge($settings,array('globalphpVMS' => 'FALSE'));
1472
+	} else $settings = array_merge($settings, array('globalphpVMS' => 'FALSE'));
1473 1473
 	if ($globalvam == 'vam') {
1474
-		$settings = array_merge($settings,array('globalVAM' => 'TRUE'));
1474
+		$settings = array_merge($settings, array('globalVAM' => 'TRUE'));
1475 1475
 		$va = true;
1476
-	} else $settings = array_merge($settings,array('globalVAM' => 'FALSE'));
1476
+	} else $settings = array_merge($settings, array('globalVAM' => 'FALSE'));
1477 1477
 	if ($va) {
1478
-		$settings = array_merge($settings,array('globalSchedulesFetch' => 'FALSE','globalTranslationFetch' => 'FALSE'));
1479
-	} else $settings = array_merge($settings,array('globalSchedulesFetch' => 'TRUE','globalTranslationFetch' => 'TRUE'));
1478
+		$settings = array_merge($settings, array('globalSchedulesFetch' => 'FALSE', 'globalTranslationFetch' => 'FALSE'));
1479
+	} else $settings = array_merge($settings, array('globalSchedulesFetch' => 'TRUE', 'globalTranslationFetch' => 'TRUE'));
1480 1480
 	if ($globalva == 'va' || $va) {
1481
-		$settings = array_merge($settings,array('globalVA' => 'TRUE'));
1482
-		$settings = array_merge($settings,array('globalUsePilot' => 'TRUE','globalUseOwner' => 'FALSE'));
1481
+		$settings = array_merge($settings, array('globalVA' => 'TRUE'));
1482
+		$settings = array_merge($settings, array('globalUsePilot' => 'TRUE', 'globalUseOwner' => 'FALSE'));
1483 1483
 	} else {
1484
-		$settings = array_merge($settings,array('globalVA' => 'FALSE'));
1485
-		if ($forcepilots) $settings = array_merge($settings,array('globalUsePilot' => 'TRUE','globalUseOwner' => 'FALSE'));
1486
-		else $settings = array_merge($settings,array('globalUsePilot' => 'FALSE','globalUseOwner' => 'TRUE'));
1484
+		$settings = array_merge($settings, array('globalVA' => 'FALSE'));
1485
+		if ($forcepilots) $settings = array_merge($settings, array('globalUsePilot' => 'TRUE', 'globalUseOwner' => 'FALSE'));
1486
+		else $settings = array_merge($settings, array('globalUsePilot' => 'FALSE', 'globalUseOwner' => 'TRUE'));
1487 1487
 	}
1488 1488
 	
1489 1489
 	
1490
-	$mapoffline = filter_input(INPUT_POST,'mapoffline',FILTER_SANITIZE_STRING);
1490
+	$mapoffline = filter_input(INPUT_POST, 'mapoffline', FILTER_SANITIZE_STRING);
1491 1491
 	if ($mapoffline == 'mapoffline') {
1492
-		$settings = array_merge($settings,array('globalMapOffline' => 'TRUE'));
1492
+		$settings = array_merge($settings, array('globalMapOffline' => 'TRUE'));
1493 1493
 	} else {
1494
-		$settings = array_merge($settings,array('globalMapOffline' => 'FALSE'));
1494
+		$settings = array_merge($settings, array('globalMapOffline' => 'FALSE'));
1495 1495
 	}
1496
-	$globaloffline = filter_input(INPUT_POST,'globaloffline',FILTER_SANITIZE_STRING);
1496
+	$globaloffline = filter_input(INPUT_POST, 'globaloffline', FILTER_SANITIZE_STRING);
1497 1497
 	if ($globaloffline == 'globaloffline') {
1498
-		$settings = array_merge($settings,array('globalOffline' => 'TRUE'));
1498
+		$settings = array_merge($settings, array('globalOffline' => 'TRUE'));
1499 1499
 	} else {
1500
-		$settings = array_merge($settings,array('globalOffline' => 'FALSE'));
1500
+		$settings = array_merge($settings, array('globalOffline' => 'FALSE'));
1501 1501
 	}
1502 1502
 
1503
-	$notam = filter_input(INPUT_POST,'notam',FILTER_SANITIZE_STRING);
1503
+	$notam = filter_input(INPUT_POST, 'notam', FILTER_SANITIZE_STRING);
1504 1504
 	if ($notam == 'notam') {
1505
-		$settings = array_merge($settings,array('globalNOTAM' => 'TRUE'));
1505
+		$settings = array_merge($settings, array('globalNOTAM' => 'TRUE'));
1506 1506
 	} else {
1507
-		$settings = array_merge($settings,array('globalNOTAM' => 'FALSE'));
1507
+		$settings = array_merge($settings, array('globalNOTAM' => 'FALSE'));
1508 1508
 	}
1509
-	$owner = filter_input(INPUT_POST,'owner',FILTER_SANITIZE_STRING);
1509
+	$owner = filter_input(INPUT_POST, 'owner', FILTER_SANITIZE_STRING);
1510 1510
 	if ($owner == 'owner') {
1511
-		$settings = array_merge($settings,array('globalOwner' => 'TRUE'));
1511
+		$settings = array_merge($settings, array('globalOwner' => 'TRUE'));
1512 1512
 	} else {
1513
-		$settings = array_merge($settings,array('globalOwner' => 'FALSE'));
1513
+		$settings = array_merge($settings, array('globalOwner' => 'FALSE'));
1514 1514
 	}
1515
-	$map3d = filter_input(INPUT_POST,'map3d',FILTER_SANITIZE_STRING);
1515
+	$map3d = filter_input(INPUT_POST, 'map3d', FILTER_SANITIZE_STRING);
1516 1516
 	if ($map3d == 'map3d') {
1517
-		$settings = array_merge($settings,array('globalMap3D' => 'TRUE'));
1517
+		$settings = array_merge($settings, array('globalMap3D' => 'TRUE'));
1518 1518
 	} else {
1519
-		$settings = array_merge($settings,array('globalMap3D' => 'FALSE'));
1519
+		$settings = array_merge($settings, array('globalMap3D' => 'FALSE'));
1520 1520
 	}
1521
-	$crash = filter_input(INPUT_POST,'crash',FILTER_SANITIZE_STRING);
1521
+	$crash = filter_input(INPUT_POST, 'crash', FILTER_SANITIZE_STRING);
1522 1522
 	if ($crash == 'crash') {
1523
-		$settings = array_merge($settings,array('globalAccidents' => 'TRUE'));
1523
+		$settings = array_merge($settings, array('globalAccidents' => 'TRUE'));
1524 1524
 	} else {
1525
-		$settings = array_merge($settings,array('globalAccidents' => 'FALSE'));
1525
+		$settings = array_merge($settings, array('globalAccidents' => 'FALSE'));
1526 1526
 	}
1527
-	$fires = filter_input(INPUT_POST,'fires',FILTER_SANITIZE_STRING);
1527
+	$fires = filter_input(INPUT_POST, 'fires', FILTER_SANITIZE_STRING);
1528 1528
 	if ($fires == 'fires') {
1529
-		$settings = array_merge($settings,array('globalMapFires' => 'TRUE'));
1529
+		$settings = array_merge($settings, array('globalMapFires' => 'TRUE'));
1530 1530
 	} else {
1531
-		$settings = array_merge($settings,array('globalMapFires' => 'FALSE'));
1531
+		$settings = array_merge($settings, array('globalMapFires' => 'FALSE'));
1532 1532
 	}
1533
-	$firessupport = filter_input(INPUT_POST,'firessupport',FILTER_SANITIZE_STRING);
1533
+	$firessupport = filter_input(INPUT_POST, 'firessupport', FILTER_SANITIZE_STRING);
1534 1534
 	if ($firessupport == 'firessupport') {
1535
-		$settings = array_merge($settings,array('globalFires' => 'TRUE'));
1535
+		$settings = array_merge($settings, array('globalFires' => 'TRUE'));
1536 1536
 	} else {
1537
-		$settings = array_merge($settings,array('globalFires' => 'FALSE'));
1537
+		$settings = array_merge($settings, array('globalFires' => 'FALSE'));
1538 1538
 	}
1539
-	$mapsatellites = filter_input(INPUT_POST,'mapsatellites',FILTER_SANITIZE_STRING);
1539
+	$mapsatellites = filter_input(INPUT_POST, 'mapsatellites', FILTER_SANITIZE_STRING);
1540 1540
 	if ($mapsatellites == 'mapsatellites') {
1541
-		$settings = array_merge($settings,array('globalMapSatellites' => 'TRUE'));
1541
+		$settings = array_merge($settings, array('globalMapSatellites' => 'TRUE'));
1542 1542
 	} else {
1543
-		$settings = array_merge($settings,array('globalMapSatellites' => 'FALSE'));
1543
+		$settings = array_merge($settings, array('globalMapSatellites' => 'FALSE'));
1544 1544
 	}
1545
-	$map3ddefault = filter_input(INPUT_POST,'map3ddefault',FILTER_SANITIZE_STRING);
1545
+	$map3ddefault = filter_input(INPUT_POST, 'map3ddefault', FILTER_SANITIZE_STRING);
1546 1546
 	if ($map3ddefault == 'map3ddefault') {
1547
-		$settings = array_merge($settings,array('globalMap3Ddefault' => 'TRUE'));
1547
+		$settings = array_merge($settings, array('globalMap3Ddefault' => 'TRUE'));
1548 1548
 	} else {
1549
-		$settings = array_merge($settings,array('globalMap3Ddefault' => 'FALSE'));
1549
+		$settings = array_merge($settings, array('globalMap3Ddefault' => 'FALSE'));
1550 1550
 	}
1551
-	$one3dmodel = filter_input(INPUT_POST,'one3dmodel',FILTER_SANITIZE_STRING);
1551
+	$one3dmodel = filter_input(INPUT_POST, 'one3dmodel', FILTER_SANITIZE_STRING);
1552 1552
 	if ($one3dmodel == 'one3dmodel') {
1553
-		$settings = array_merge($settings,array('globalMap3DOneModel' => 'TRUE'));
1553
+		$settings = array_merge($settings, array('globalMap3DOneModel' => 'TRUE'));
1554 1554
 	} else {
1555
-		$settings = array_merge($settings,array('globalMap3DOneModel' => 'FALSE'));
1555
+		$settings = array_merge($settings, array('globalMap3DOneModel' => 'FALSE'));
1556 1556
 	}
1557
-	$map3dliveries = filter_input(INPUT_POST,'map3dliveries',FILTER_SANITIZE_STRING);
1557
+	$map3dliveries = filter_input(INPUT_POST, 'map3dliveries', FILTER_SANITIZE_STRING);
1558 1558
 	if ($map3dliveries == 'map3dliveries') {
1559
-		$settings = array_merge($settings,array('globalMap3DLiveries' => 'TRUE'));
1559
+		$settings = array_merge($settings, array('globalMap3DLiveries' => 'TRUE'));
1560 1560
 	} else {
1561
-		$settings = array_merge($settings,array('globalMap3DLiveries' => 'FALSE'));
1561
+		$settings = array_merge($settings, array('globalMap3DLiveries' => 'FALSE'));
1562 1562
 	}
1563
-	$map3dshadows = filter_input(INPUT_POST,'map3dshadows',FILTER_SANITIZE_STRING);
1563
+	$map3dshadows = filter_input(INPUT_POST, 'map3dshadows', FILTER_SANITIZE_STRING);
1564 1564
 	if ($map3dshadows == 'map3dshadows') {
1565
-		$settings = array_merge($settings,array('globalMap3DShadows' => 'TRUE'));
1565
+		$settings = array_merge($settings, array('globalMap3DShadows' => 'TRUE'));
1566 1566
 	} else {
1567
-		$settings = array_merge($settings,array('globalMap3DShadows' => 'FALSE'));
1567
+		$settings = array_merge($settings, array('globalMap3DShadows' => 'FALSE'));
1568 1568
 	}
1569
-	$translate = filter_input(INPUT_POST,'translate',FILTER_SANITIZE_STRING);
1569
+	$translate = filter_input(INPUT_POST, 'translate', FILTER_SANITIZE_STRING);
1570 1570
 	if ($translate == 'translate') {
1571
-		$settings = array_merge($settings,array('globalTranslate' => 'TRUE'));
1571
+		$settings = array_merge($settings, array('globalTranslate' => 'TRUE'));
1572 1572
 	} else {
1573
-		$settings = array_merge($settings,array('globalTranslate' => 'FALSE'));
1573
+		$settings = array_merge($settings, array('globalTranslate' => 'FALSE'));
1574 1574
 	}
1575
-	$realairlines = filter_input(INPUT_POST,'realairlines',FILTER_SANITIZE_STRING);
1575
+	$realairlines = filter_input(INPUT_POST, 'realairlines', FILTER_SANITIZE_STRING);
1576 1576
 	if ($realairlines == 'realairlines') {
1577
-		$settings = array_merge($settings,array('globalUseRealAirlines' => 'TRUE'));
1577
+		$settings = array_merge($settings, array('globalUseRealAirlines' => 'TRUE'));
1578 1578
 	} else {
1579
-		$settings = array_merge($settings,array('globalUseRealAirlines' => 'FALSE'));
1579
+		$settings = array_merge($settings, array('globalUseRealAirlines' => 'FALSE'));
1580 1580
 	}
1581
-	$estimation = filter_input(INPUT_POST,'estimation',FILTER_SANITIZE_STRING);
1581
+	$estimation = filter_input(INPUT_POST, 'estimation', FILTER_SANITIZE_STRING);
1582 1582
 	if ($estimation == 'estimation') {
1583
-		$settings = array_merge($settings,array('globalMapEstimation' => 'TRUE'));
1583
+		$settings = array_merge($settings, array('globalMapEstimation' => 'TRUE'));
1584 1584
 	} else {
1585
-		$settings = array_merge($settings,array('globalMapEstimation' => 'FALSE'));
1585
+		$settings = array_merge($settings, array('globalMapEstimation' => 'FALSE'));
1586 1586
 	}
1587
-	$metar = filter_input(INPUT_POST,'metar',FILTER_SANITIZE_STRING);
1587
+	$metar = filter_input(INPUT_POST, 'metar', FILTER_SANITIZE_STRING);
1588 1588
 	if ($metar == 'metar') {
1589
-		$settings = array_merge($settings,array('globalMETAR' => 'TRUE'));
1589
+		$settings = array_merge($settings, array('globalMETAR' => 'TRUE'));
1590 1590
 	} else {
1591
-		$settings = array_merge($settings,array('globalMETAR' => 'FALSE'));
1591
+		$settings = array_merge($settings, array('globalMETAR' => 'FALSE'));
1592 1592
 	}
1593
-	$metarcycle = filter_input(INPUT_POST,'metarcycle',FILTER_SANITIZE_STRING);
1593
+	$metarcycle = filter_input(INPUT_POST, 'metarcycle', FILTER_SANITIZE_STRING);
1594 1594
 	if ($metarcycle == 'metarcycle') {
1595
-		$settings = array_merge($settings,array('globalMETARcycle' => 'TRUE'));
1595
+		$settings = array_merge($settings, array('globalMETARcycle' => 'TRUE'));
1596 1596
 	} else {
1597
-		$settings = array_merge($settings,array('globalMETARcycle' => 'FALSE'));
1597
+		$settings = array_merge($settings, array('globalMETARcycle' => 'FALSE'));
1598 1598
 	}
1599
-	$fork = filter_input(INPUT_POST,'fork',FILTER_SANITIZE_STRING);
1599
+	$fork = filter_input(INPUT_POST, 'fork', FILTER_SANITIZE_STRING);
1600 1600
 	if ($fork == 'fork') {
1601
-		$settings = array_merge($settings,array('globalFork' => 'TRUE'));
1601
+		$settings = array_merge($settings, array('globalFork' => 'TRUE'));
1602 1602
 	} else {
1603
-		$settings = array_merge($settings,array('globalFork' => 'FALSE'));
1603
+		$settings = array_merge($settings, array('globalFork' => 'FALSE'));
1604 1604
 	}
1605 1605
 
1606
-	$colormap = filter_input(INPUT_POST,'colormap',FILTER_SANITIZE_STRING);
1606
+	$colormap = filter_input(INPUT_POST, 'colormap', FILTER_SANITIZE_STRING);
1607 1607
 	if ($colormap == 'colormap') {
1608
-		$settings = array_merge($settings,array('globalMapAltitudeColor' => 'TRUE'));
1608
+		$settings = array_merge($settings, array('globalMapAltitudeColor' => 'TRUE'));
1609 1609
 	} else {
1610
-		$settings = array_merge($settings,array('globalMapAltitudeColor' => 'FALSE'));
1610
+		$settings = array_merge($settings, array('globalMapAltitudeColor' => 'FALSE'));
1611 1611
 	}
1612 1612
 	
1613 1613
 	if (isset($_POST['aircrafticoncolor'])) {
1614
-		$aircrafticoncolor = filter_input(INPUT_POST,'aircrafticoncolor',FILTER_SANITIZE_STRING);
1615
-		$settings = array_merge($settings,array('globalAircraftIconColor' => substr($aircrafticoncolor,1)));
1614
+		$aircrafticoncolor = filter_input(INPUT_POST, 'aircrafticoncolor', FILTER_SANITIZE_STRING);
1615
+		$settings = array_merge($settings, array('globalAircraftIconColor' => substr($aircrafticoncolor, 1)));
1616 1616
 	}
1617 1617
 
1618
-	$airportzoom = filter_input(INPUT_POST,'airportzoom',FILTER_SANITIZE_NUMBER_INT);
1619
-	$settings = array_merge($settings,array('globalAirportZoom' => $airportzoom));
1618
+	$airportzoom = filter_input(INPUT_POST, 'airportzoom', FILTER_SANITIZE_NUMBER_INT);
1619
+	$settings = array_merge($settings, array('globalAirportZoom' => $airportzoom));
1620 1620
 
1621
-	$unitdistance = filter_input(INPUT_POST,'unitdistance',FILTER_SANITIZE_STRING);
1622
-	$settings = array_merge($settings,array('globalUnitDistance' => $unitdistance));
1623
-	$unitaltitude = filter_input(INPUT_POST,'unitaltitude',FILTER_SANITIZE_STRING);
1624
-	$settings = array_merge($settings,array('globalUnitAltitude' => $unitaltitude));
1625
-	$unitspeed = filter_input(INPUT_POST,'unitspeed',FILTER_SANITIZE_STRING);
1626
-	$settings = array_merge($settings,array('globalUnitSpeed' => $unitspeed));
1621
+	$unitdistance = filter_input(INPUT_POST, 'unitdistance', FILTER_SANITIZE_STRING);
1622
+	$settings = array_merge($settings, array('globalUnitDistance' => $unitdistance));
1623
+	$unitaltitude = filter_input(INPUT_POST, 'unitaltitude', FILTER_SANITIZE_STRING);
1624
+	$settings = array_merge($settings, array('globalUnitAltitude' => $unitaltitude));
1625
+	$unitspeed = filter_input(INPUT_POST, 'unitspeed', FILTER_SANITIZE_STRING);
1626
+	$settings = array_merge($settings, array('globalUnitSpeed' => $unitspeed));
1627 1627
 
1628
-	$mappopup = filter_input(INPUT_POST,'mappopup',FILTER_SANITIZE_STRING);
1628
+	$mappopup = filter_input(INPUT_POST, 'mappopup', FILTER_SANITIZE_STRING);
1629 1629
 	if ($mappopup == 'mappopup') {
1630
-		$settings = array_merge($settings,array('globalMapPopup' => 'TRUE'));
1630
+		$settings = array_merge($settings, array('globalMapPopup' => 'TRUE'));
1631 1631
 	} else {
1632
-		$settings = array_merge($settings,array('globalMapPopup' => 'FALSE'));
1632
+		$settings = array_merge($settings, array('globalMapPopup' => 'FALSE'));
1633 1633
 	}
1634
-	$airportpopup = filter_input(INPUT_POST,'airportpopup',FILTER_SANITIZE_STRING);
1634
+	$airportpopup = filter_input(INPUT_POST, 'airportpopup', FILTER_SANITIZE_STRING);
1635 1635
 	if ($airportpopup == 'airportpopup') {
1636
-		$settings = array_merge($settings,array('globalAirportPopup' => 'TRUE'));
1636
+		$settings = array_merge($settings, array('globalAirportPopup' => 'TRUE'));
1637 1637
 	} else {
1638
-		$settings = array_merge($settings,array('globalAirportPopup' => 'FALSE'));
1638
+		$settings = array_merge($settings, array('globalAirportPopup' => 'FALSE'));
1639 1639
 	}
1640
-	$maphistory = filter_input(INPUT_POST,'maphistory',FILTER_SANITIZE_STRING);
1640
+	$maphistory = filter_input(INPUT_POST, 'maphistory', FILTER_SANITIZE_STRING);
1641 1641
 	if ($maphistory == 'maphistory') {
1642
-		$settings = array_merge($settings,array('globalMapHistory' => 'TRUE'));
1642
+		$settings = array_merge($settings, array('globalMapHistory' => 'TRUE'));
1643 1643
 	} else {
1644
-		$settings = array_merge($settings,array('globalMapHistory' => 'FALSE'));
1644
+		$settings = array_merge($settings, array('globalMapHistory' => 'FALSE'));
1645 1645
 	}
1646
-	$maptooltip = filter_input(INPUT_POST,'maptooltip',FILTER_SANITIZE_STRING);
1646
+	$maptooltip = filter_input(INPUT_POST, 'maptooltip', FILTER_SANITIZE_STRING);
1647 1647
 	if ($maptooltip == 'maptooltip') {
1648
-		$settings = array_merge($settings,array('globalMapTooltip' => 'TRUE'));
1648
+		$settings = array_merge($settings, array('globalMapTooltip' => 'TRUE'));
1649 1649
 	} else {
1650
-		$settings = array_merge($settings,array('globalMapTooltip' => 'FALSE'));
1650
+		$settings = array_merge($settings, array('globalMapTooltip' => 'FALSE'));
1651 1651
 	}
1652
-	$flightroute = filter_input(INPUT_POST,'flightroute',FILTER_SANITIZE_STRING);
1652
+	$flightroute = filter_input(INPUT_POST, 'flightroute', FILTER_SANITIZE_STRING);
1653 1653
 	if ($flightroute == 'flightroute') {
1654
-		$settings = array_merge($settings,array('globalMapRoute' => 'TRUE'));
1654
+		$settings = array_merge($settings, array('globalMapRoute' => 'TRUE'));
1655 1655
 	} else {
1656
-		$settings = array_merge($settings,array('globalMapRoute' => 'FALSE'));
1656
+		$settings = array_merge($settings, array('globalMapRoute' => 'FALSE'));
1657 1657
 	}
1658
-	$flightremainingroute = filter_input(INPUT_POST,'flightremainingroute',FILTER_SANITIZE_STRING);
1658
+	$flightremainingroute = filter_input(INPUT_POST, 'flightremainingroute', FILTER_SANITIZE_STRING);
1659 1659
 	if ($flightremainingroute == 'flightremainingroute') {
1660
-		$settings = array_merge($settings,array('globalMapRemainingRoute' => 'TRUE'));
1660
+		$settings = array_merge($settings, array('globalMapRemainingRoute' => 'TRUE'));
1661 1661
 	} else {
1662
-		$settings = array_merge($settings,array('globalMapRemainingRoute' => 'FALSE'));
1662
+		$settings = array_merge($settings, array('globalMapRemainingRoute' => 'FALSE'));
1663 1663
 	}
1664
-	$allflights = filter_input(INPUT_POST,'allflights',FILTER_SANITIZE_STRING);
1664
+	$allflights = filter_input(INPUT_POST, 'allflights', FILTER_SANITIZE_STRING);
1665 1665
 	if ($allflights == 'allflights') {
1666
-		$settings = array_merge($settings,array('globalAllFlights' => 'TRUE'));
1666
+		$settings = array_merge($settings, array('globalAllFlights' => 'TRUE'));
1667 1667
 	} else {
1668
-		$settings = array_merge($settings,array('globalAllFlights' => 'FALSE'));
1668
+		$settings = array_merge($settings, array('globalAllFlights' => 'FALSE'));
1669 1669
 	}
1670
-	$bbox = filter_input(INPUT_POST,'bbox',FILTER_SANITIZE_STRING);
1670
+	$bbox = filter_input(INPUT_POST, 'bbox', FILTER_SANITIZE_STRING);
1671 1671
 	if ($bbox == 'bbox') {
1672
-		$settings = array_merge($settings,array('globalMapUseBbox' => 'TRUE'));
1672
+		$settings = array_merge($settings, array('globalMapUseBbox' => 'TRUE'));
1673 1673
 	} else {
1674
-		$settings = array_merge($settings,array('globalMapUseBbox' => 'FALSE'));
1674
+		$settings = array_merge($settings, array('globalMapUseBbox' => 'FALSE'));
1675 1675
 	}
1676
-	$groundaltitude = filter_input(INPUT_POST,'groundaltitude',FILTER_SANITIZE_STRING);
1676
+	$groundaltitude = filter_input(INPUT_POST, 'groundaltitude', FILTER_SANITIZE_STRING);
1677 1677
 	if ($groundaltitude == 'groundaltitude') {
1678
-		$settings = array_merge($settings,array('globalGroundAltitude' => 'TRUE'));
1678
+		$settings = array_merge($settings, array('globalGroundAltitude' => 'TRUE'));
1679 1679
 	} else {
1680
-		$settings = array_merge($settings,array('globalGroundAltitude' => 'FALSE'));
1680
+		$settings = array_merge($settings, array('globalGroundAltitude' => 'FALSE'));
1681 1681
 	}
1682
-	$waypoints = filter_input(INPUT_POST,'waypoints',FILTER_SANITIZE_STRING);
1682
+	$waypoints = filter_input(INPUT_POST, 'waypoints', FILTER_SANITIZE_STRING);
1683 1683
 	if ($waypoints == 'waypoints') {
1684
-		$settings = array_merge($settings,array('globalWaypoints' => 'TRUE'));
1684
+		$settings = array_merge($settings, array('globalWaypoints' => 'TRUE'));
1685 1685
 	} else {
1686
-		$settings = array_merge($settings,array('globalWaypoints' => 'FALSE'));
1686
+		$settings = array_merge($settings, array('globalWaypoints' => 'FALSE'));
1687 1687
 	}
1688
-	$geoid = filter_input(INPUT_POST,'geoid',FILTER_SANITIZE_STRING);
1688
+	$geoid = filter_input(INPUT_POST, 'geoid', FILTER_SANITIZE_STRING);
1689 1689
 	if ($geoid == 'geoid') {
1690
-		$settings = array_merge($settings,array('globalGeoid' => 'TRUE'));
1690
+		$settings = array_merge($settings, array('globalGeoid' => 'TRUE'));
1691 1691
 	} else {
1692
-		$settings = array_merge($settings,array('globalGeoid' => 'FALSE'));
1692
+		$settings = array_merge($settings, array('globalGeoid' => 'FALSE'));
1693 1693
 	}
1694
-	$geoid_source = filter_input(INPUT_POST,'geoid_source',FILTER_SANITIZE_STRING);
1695
-	$settings = array_merge($settings,array('globalGeoidSource' => $geoid_source));
1694
+	$geoid_source = filter_input(INPUT_POST, 'geoid_source', FILTER_SANITIZE_STRING);
1695
+	$settings = array_merge($settings, array('globalGeoidSource' => $geoid_source));
1696 1696
 
1697
-	$noairlines = filter_input(INPUT_POST,'noairlines',FILTER_SANITIZE_STRING);
1697
+	$noairlines = filter_input(INPUT_POST, 'noairlines', FILTER_SANITIZE_STRING);
1698 1698
 	if ($noairlines == 'noairlines') {
1699
-		$settings = array_merge($settings,array('globalNoAirlines' => 'TRUE'));
1699
+		$settings = array_merge($settings, array('globalNoAirlines' => 'TRUE'));
1700 1700
 	} else {
1701
-		$settings = array_merge($settings,array('globalNoAirlines' => 'FALSE'));
1701
+		$settings = array_merge($settings, array('globalNoAirlines' => 'FALSE'));
1702 1702
 	}
1703 1703
 
1704
-	$tsk = filter_input(INPUT_POST,'tsk',FILTER_SANITIZE_STRING);
1704
+	$tsk = filter_input(INPUT_POST, 'tsk', FILTER_SANITIZE_STRING);
1705 1705
 	if ($tsk == 'tsk') {
1706
-		$settings = array_merge($settings,array('globalTSK' => 'TRUE'));
1706
+		$settings = array_merge($settings, array('globalTSK' => 'TRUE'));
1707 1707
 	} else {
1708
-		$settings = array_merge($settings,array('globalTSK' => 'FALSE'));
1708
+		$settings = array_merge($settings, array('globalTSK' => 'FALSE'));
1709 1709
 	}
1710
-	$mapmatching = filter_input(INPUT_POST,'mapmatching',FILTER_SANITIZE_STRING);
1710
+	$mapmatching = filter_input(INPUT_POST, 'mapmatching', FILTER_SANITIZE_STRING);
1711 1711
 	if ($mapmatching == 'mapmatching') {
1712
-		$settings = array_merge($settings,array('globalMapMatching' => 'TRUE'));
1712
+		$settings = array_merge($settings, array('globalMapMatching' => 'TRUE'));
1713 1713
 	} else {
1714
-		$settings = array_merge($settings,array('globalMapMatching' => 'FALSE'));
1714
+		$settings = array_merge($settings, array('globalMapMatching' => 'FALSE'));
1715 1715
 	}
1716
-	$mapmatchingsource = filter_input(INPUT_POST,'mapmatchingsource',FILTER_SANITIZE_STRING);
1717
-	$settings = array_merge($settings,array('globalMapMatchingSource' => $mapmatchingsource));
1718
-	$graphhopper = filter_input(INPUT_POST,'graphhopper',FILTER_SANITIZE_STRING);
1719
-	$settings = array_merge($settings,array('globalGraphHopperKey' => $graphhopper));
1716
+	$mapmatchingsource = filter_input(INPUT_POST, 'mapmatchingsource', FILTER_SANITIZE_STRING);
1717
+	$settings = array_merge($settings, array('globalMapMatchingSource' => $mapmatchingsource));
1718
+	$graphhopper = filter_input(INPUT_POST, 'graphhopper', FILTER_SANITIZE_STRING);
1719
+	$settings = array_merge($settings, array('globalGraphHopperKey' => $graphhopper));
1720 1720
 
1721
-	if (!isset($globalTransaction)) $settings = array_merge($settings,array('globalTransaction' => 'TRUE'));
1721
+	if (!isset($globalTransaction)) $settings = array_merge($settings, array('globalTransaction' => 'TRUE'));
1722 1722
 
1723 1723
 	// Set some defaults values...
1724 1724
 	if (!isset($globalAircraftImageSources)) {
1725
-	    $globalAircraftImageSources = array('ivaomtl','wikimedia','airportdata','deviantart','flickr','bing','jetphotos','planepictures','planespotters');
1726
-	    $settings = array_merge($settings,array('globalAircraftImageSources' => $globalAircraftImageSources));
1725
+	    $globalAircraftImageSources = array('ivaomtl', 'wikimedia', 'airportdata', 'deviantart', 'flickr', 'bing', 'jetphotos', 'planepictures', 'planespotters');
1726
+	    $settings = array_merge($settings, array('globalAircraftImageSources' => $globalAircraftImageSources));
1727 1727
 	}
1728 1728
 
1729 1729
 	if (!isset($globalSchedulesSources)) {
1730
-	    $globalSchedulesSources = array('flightmapper','costtotravel','flightradar24','flightaware');
1731
-    	    $settings = array_merge($settings,array('globalSchedulesSources' => $globalSchedulesSources));
1730
+	    $globalSchedulesSources = array('flightmapper', 'costtotravel', 'flightradar24', 'flightaware');
1731
+    	    $settings = array_merge($settings, array('globalSchedulesSources' => $globalSchedulesSources));
1732 1732
     	}
1733 1733
 
1734
-	$settings = array_merge($settings,array('globalInstalled' => 'TRUE'));
1734
+	$settings = array_merge($settings, array('globalInstalled' => 'TRUE'));
1735 1735
 
1736 1736
 	if ($error == '') settings::modify_settings($settings);
1737 1737
 	if ($error == '') settings::comment_settings($settings_comment);
Please login to merge, or discard this patch.
Braces   +599 added lines, -161 removed lines patch added patch discarded remove patch
@@ -4,11 +4,19 @@  discard block
 block discarded – undo
4 4
 if (isset($_SESSION['error'])) {
5 5
 	header('Content-Encoding: none;');
6 6
 	echo 'Error : '.$_SESSION['error'].' - Resetting install... You need to fix the problem and run install again.';
7
-	if (isset($_SESSION['error'])) unset($_SESSION['error']);
8
-	if (isset($_SESSION['errorlst'])) unset($_SESSION['errorlst']);
9
-	if (isset($_SESSION['next'])) unset($_SESSION['next']);
10
-	if (isset($_SESSION['install'])) unset($_SESSION['install']);
11
-}
7
+	if (isset($_SESSION['error'])) {
8
+		unset($_SESSION['error']);
9
+	}
10
+	if (isset($_SESSION['errorlst'])) {
11
+		unset($_SESSION['errorlst']);
12
+	}
13
+	if (isset($_SESSION['next'])) {
14
+		unset($_SESSION['next']);
15
+	}
16
+	if (isset($_SESSION['install'])) {
17
+		unset($_SESSION['install']);
18
+	}
19
+	}
12 20
 /*
13 21
 if (isset($_SESSION['errorlst'])) {
14 22
 	header('Content-Encoding: none;');
@@ -114,7 +122,9 @@  discard block
 block discarded – undo
114 122
 		if (count($alllng) != count($availablelng)) {
115 123
 			$notavailable = array();
116 124
 			foreach($alllng as $lng) {
117
-				if (!isset($availablelng[$lng])) $notavailable[] = $lng;
125
+				if (!isset($availablelng[$lng])) {
126
+					$notavailable[] = $lng;
127
+				}
118 128
 			}
119 129
 			print '<div class="alert alert-warning">The following translation can\'t be used on your system: '.implode(', ',$notavailable).'. You need to add the system locales: <a href="https://github.com/Ysurac/FlightAirMap/wiki/Translation">documentation</a>.</div>';
120 130
 		}
@@ -175,31 +185,49 @@  discard block
 block discarded – undo
175 185
 			</div>
176 186
 			<p>
177 187
 				<label for="dbhost">Database hostname</label>
178
-				<input type="text" name="dbhost" id="dbhost" value="<?php if (isset($globalDBhost)) print $globalDBhost; ?>" />
188
+				<input type="text" name="dbhost" id="dbhost" value="<?php if (isset($globalDBhost)) {
189
+	print $globalDBhost;
190
+}
191
+?>" />
179 192
 			</p>
180 193
 			<p>
181 194
 				<label for="dbport">Database port</label>
182
-				<input type="text" name="dbport" id="dbport" value="<?php if (isset($globalDBport)) print $globalDBport; ?>" />
195
+				<input type="text" name="dbport" id="dbport" value="<?php if (isset($globalDBport)) {
196
+	print $globalDBport;
197
+}
198
+?>" />
183 199
 				<p class="help-block">Default is 3306 for MariaDB/MySQL, 5432 for PostgreSQL</p>
184 200
 			</p>
185 201
 			<p>
186 202
 				<label for="dbname">Database name</label>
187
-				<input type="text" name="dbname" id="dbname" value="<?php if (isset($globalDBname)) print $globalDBname; ?>" />
203
+				<input type="text" name="dbname" id="dbname" value="<?php if (isset($globalDBname)) {
204
+	print $globalDBname;
205
+}
206
+?>" />
188 207
 			</p>
189 208
 			<p>
190 209
 				<label for="dbuser">Database user</label>
191
-				<input type="text" name="dbuser" id="dbuser" value="<?php if (isset($globalDBuser)) print $globalDBuser; ?>" />
210
+				<input type="text" name="dbuser" id="dbuser" value="<?php if (isset($globalDBuser)) {
211
+	print $globalDBuser;
212
+}
213
+?>" />
192 214
 			</p>
193 215
 			<p>
194 216
 				<label for="dbuserpass">Database user password</label>
195
-				<input type="password" name="dbuserpass" id="dbuserpass" value="<?php if (isset($globalDBpass)) print $globalDBpass; ?>" />
217
+				<input type="password" name="dbuserpass" id="dbuserpass" value="<?php if (isset($globalDBpass)) {
218
+	print $globalDBpass;
219
+}
220
+?>" />
196 221
 			</p>
197 222
 		</fieldset>
198 223
 		<fieldset id="site">
199 224
 			<legend>Site configuration</legend>
200 225
 			<p>
201 226
 				<label for="sitename">Site name</label>
202
-				<input type="text" name="sitename" id="sitename" value="<?php if (isset($globalName)) print $globalName; ?>" />
227
+				<input type="text" name="sitename" id="sitename" value="<?php if (isset($globalName)) {
228
+	print $globalName;
229
+}
230
+?>" />
203 231
 			</p>
204 232
 			<p>
205 233
 				<label for="siteurl">Site directory</label>
@@ -212,18 +240,27 @@  discard block
 block discarded – undo
212 240
 					}
213 241
 				    }
214 242
 				?>
215
-				<input type="text" name="siteurl" id="siteurl" value="<?php if (isset($globalURL)) print $globalURL; ?>" />
243
+				<input type="text" name="siteurl" id="siteurl" value="<?php if (isset($globalURL)) {
244
+	print $globalURL;
245
+}
246
+?>" />
216 247
 				<p class="help-block">ex : <i>/flightairmap</i> if complete URL is <i>http://toto.com/flightairmap</i></p>
217 248
 				<p class="help-block">Can be empty</p>
218 249
 			</p>
219 250
 			<p>
220 251
 				<label for="timezone">Timezone</label>
221
-				<input type="text" name="timezone" id="timezone" value="<?php if (isset($globalTimezone)) print $globalTimezone; ?>" />
252
+				<input type="text" name="timezone" id="timezone" value="<?php if (isset($globalTimezone)) {
253
+	print $globalTimezone;
254
+}
255
+?>" />
222 256
 				<p class="help-block">ex : UTC, Europe/Paris,...</p>
223 257
 			</p>
224 258
 			<p>
225 259
 				<label for="language">Language</label>
226
-				<input type="text" name="language" id="language" value="<?php if (isset($globalLanguage)) print $globalLanguage; ?>" />
260
+				<input type="text" name="language" id="language" value="<?php if (isset($globalLanguage)) {
261
+	print $globalLanguage;
262
+}
263
+?>" />
227 264
 				<p class="help-block">Used only when link to wikipedia for now. Can be EN,DE,FR,...</p>
228 265
 			</p>
229 266
 		</fieldset>
@@ -243,11 +280,17 @@  discard block
 block discarded – undo
243 280
 			<div id="mapbox_data">
244 281
 				<p>
245 282
 					<label for="mapboxid">Mapbox id</label>
246
-					<input type="text" name="mapboxid" id="mapboxid" value="<?php if (isset($globalMapboxId)) print $globalMapboxId; ?>" />
283
+					<input type="text" name="mapboxid" id="mapboxid" value="<?php if (isset($globalMapboxId)) {
284
+	print $globalMapboxId;
285
+}
286
+?>" />
247 287
 				</p>
248 288
 				<p>
249 289
 					<label for="mapboxtoken">Mapbox token</label>
250
-					<input type="text" name="mapboxtoken" id="mapboxtoken" value="<?php if (isset($globalMapboxToken)) print $globalMapboxToken; ?>" />
290
+					<input type="text" name="mapboxtoken" id="mapboxtoken" value="<?php if (isset($globalMapboxToken)) {
291
+	print $globalMapboxToken;
292
+}
293
+?>" />
251 294
 				</p>
252 295
 				<p class="help-block">Get a key <a href="https://www.mapbox.com/developers/">here</a></p>
253 296
 			</div>
@@ -255,7 +298,10 @@  discard block
 block discarded – undo
255 298
 			<div id="google_data">
256 299
 				<p>
257 300
 					<label for="googlekey">Google API key</label>
258
-					<input type="text" name="googlekey" id="googlekey" value="<?php if (isset($globalGoogleAPIKey)) print $globalGoogleAPIKey; ?>" />
301
+					<input type="text" name="googlekey" id="googlekey" value="<?php if (isset($globalGoogleAPIKey)) {
302
+	print $globalGoogleAPIKey;
303
+}
304
+?>" />
259 305
 					<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>
260 306
 				</p>
261 307
 			</div>
@@ -263,7 +309,10 @@  discard block
 block discarded – undo
263 309
 			<div id="bing_data">
264 310
 				<p>
265 311
 					<label for="bingkey">Bing Map key</label>
266
-					<input type="text" name="bingkey" id="bingkey" value="<?php if (isset($globalBingMapKey)) print $globalBingMapKey; ?>" />
312
+					<input type="text" name="bingkey" id="bingkey" value="<?php if (isset($globalBingMapKey)) {
313
+	print $globalBingMapKey;
314
+}
315
+?>" />
267 316
 					<p class="help-block">Get a key <a href="https://www.bingmapsportal.com/">here</a></p>
268 317
 				</p>
269 318
 			</div>
@@ -271,7 +320,10 @@  discard block
 block discarded – undo
271 320
 			<div id="mapquest_data">
272 321
 				<p>
273 322
 					<label for="mapquestkey">MapQuest key</label>
274
-					<input type="text" name="mapquestkey" id="mapquestkey" value="<?php if (isset($globalMapQuestKey)) print $globalMapQuestKey; ?>" />
323
+					<input type="text" name="mapquestkey" id="mapquestkey" value="<?php if (isset($globalMapQuestKey)) {
324
+	print $globalMapQuestKey;
325
+}
326
+?>" />
275 327
 					<p class="help-block">Get a key <a href="https://developer.mapquest.com/user/me/apps">here</a></p>
276 328
 				</p>
277 329
 			</div>
@@ -279,11 +331,17 @@  discard block
 block discarded – undo
279 331
 			<div id="here_data">
280 332
 				<p>
281 333
 					<label for="hereappid">Here App_Id</label>
282
-					<input type="text" name="hereappid" id="hereappid" value="<?php if (isset($globalHereappId)) print $globalHereappId; ?>" />
334
+					<input type="text" name="hereappid" id="hereappid" value="<?php if (isset($globalHereappId)) {
335
+	print $globalHereappId;
336
+}
337
+?>" />
283 338
 				</p>
284 339
 				<p>
285 340
 					<label for="hereappcode">Here App_Code</label>
286
-					<input type="text" name="hereappcode" id="hereappcode" value="<?php if (isset($globalHereappCode)) print $globalHereappCode; ?>" />
341
+					<input type="text" name="hereappcode" id="hereappcode" value="<?php if (isset($globalHereappCode)) {
342
+	print $globalHereappCode;
343
+}
344
+?>" />
287 345
 				</p>
288 346
 				<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>
289 347
 			</div>
@@ -291,7 +349,10 @@  discard block
 block discarded – undo
291 349
 			<div id="openweathermap_data">
292 350
 				<p>
293 351
 					<label for="openweathermapkey">OpenWeatherMap key (weather layer)</label>
294
-					<input type="text" name="openweathermapkey" id="openweathermapkey" value="<?php if (isset($globalOpenWeatherMapKey)) print $globalOpenWeatherMapKey; ?>" />
352
+					<input type="text" name="openweathermapkey" id="openweathermapkey" value="<?php if (isset($globalOpenWeatherMapKey)) {
353
+	print $globalOpenWeatherMapKey;
354
+}
355
+?>" />
295 356
 					<p class="help-block">Get a key <a href="https://openweathermap.org/">here</a></p>
296 357
 				</p>
297 358
 			</div>
@@ -320,42 +381,86 @@  discard block
 block discarded – undo
320 381
 			<legend>Coverage area</legend>
321 382
 			<p>
322 383
 				<label for="latitudemax">The maximum latitude (north)</label>
323
-				<input type="text" name="latitudemax" id="latitudemax" value="<?php if (isset($globalLatitudeMax)) print $globalLatitudeMax; ?>" />
384
+				<input type="text" name="latitudemax" id="latitudemax" value="<?php if (isset($globalLatitudeMax)) {
385
+	print $globalLatitudeMax;
386
+}
387
+?>" />
324 388
 			</p>
325 389
 			<p>
326 390
 				<label for="latitudemin">The minimum latitude (south)</label>
327
-				<input type="text" name="latitudemin" id="latitudemin" value="<?php if (isset($globalLatitudeMin)) print $globalLatitudeMin; ?>" />
391
+				<input type="text" name="latitudemin" id="latitudemin" value="<?php if (isset($globalLatitudeMin)) {
392
+	print $globalLatitudeMin;
393
+}
394
+?>" />
328 395
 			</p>
329 396
 			<p>
330 397
 				<label for="longitudemax">The maximum longitude (west)</label>
331
-				<input type="text" name="longitudemax" id="longitudemax" value="<?php if (isset($globalLongitudeMax)) print $globalLongitudeMax; ?>" />
398
+				<input type="text" name="longitudemax" id="longitudemax" value="<?php if (isset($globalLongitudeMax)) {
399
+	print $globalLongitudeMax;
400
+}
401
+?>" />
332 402
 			</p>
333 403
 			<p>
334 404
 				<label for="longitudemin">The minimum longitude (east)</label>
335
-				<input type="text" name="longitudemin" id="longitudemin" value="<?php if (isset($globalLongitudeMin)) print $globalLongitudeMin; ?>" />
405
+				<input type="text" name="longitudemin" id="longitudemin" value="<?php if (isset($globalLongitudeMin)) {
406
+	print $globalLongitudeMin;
407
+}
408
+?>" />
336 409
 			</p>
337 410
 			<p>
338 411
 				<label for="latitudecenter">The latitude center</label>
339
-				<input type="text" name="latitudecenter" id="latitudecenter" value="<?php if (isset($globalCenterLatitude)) print $globalCenterLatitude; ?>" />
412
+				<input type="text" name="latitudecenter" id="latitudecenter" value="<?php if (isset($globalCenterLatitude)) {
413
+	print $globalCenterLatitude;
414
+}
415
+?>" />
340 416
 			</p>
341 417
 			<p>
342 418
 				<label for="longitudecenter">The longitude center</label>
343
-				<input type="text" name="longitudecenter" id="longitudecenter" value="<?php if (isset($globalCenterLongitude)) print $globalCenterLongitude; ?>" />
419
+				<input type="text" name="longitudecenter" id="longitudecenter" value="<?php if (isset($globalCenterLongitude)) {
420
+	print $globalCenterLongitude;
421
+}
422
+?>" />
344 423
 			</p>
345 424
 			<p>
346 425
 				<label for="livezoom">Default Zoom on live map</label>
347
-				<input type="number" name="livezoom" id="livezoom" value="<?php if (isset($globalLiveZoom)) print $globalLiveZoom; else print '9'; ?>" />
426
+				<input type="number" name="livezoom" id="livezoom" value="<?php if (isset($globalLiveZoom)) {
427
+	print $globalLiveZoom;
428
+} else {
429
+	print '9';
430
+}
431
+?>" />
348 432
 			</p>
349 433
 			<p>
350 434
 				<label for="squawk_country">Country for squawk usage</label>
351 435
 				<select name="squawk_country" id="squawk_country">
352
-					<option value="UK"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'UK') print ' selected '; ?>>UK</option>
353
-					<option value="NZ"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'NZ') print ' selected '; ?>>NZ</option>
354
-					<option value="US"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'US') print ' selected '; ?>>US</option>
355
-					<option value="AU"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'AU') print ' selected '; ?>>AU</option>
356
-					<option value="NL"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'NL') print ' selected '; ?>>NL</option>
357
-					<option value="FR"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'FR') print ' selected '; ?>>FR</option>
358
-					<option value="TR"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'TR') print ' selected '; ?>>TR</option>
436
+					<option value="UK"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'UK') {
437
+	print ' selected ';
438
+}
439
+?>>UK</option>
440
+					<option value="NZ"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'NZ') {
441
+	print ' selected ';
442
+}
443
+?>>NZ</option>
444
+					<option value="US"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'US') {
445
+	print ' selected ';
446
+}
447
+?>>US</option>
448
+					<option value="AU"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'AU') {
449
+	print ' selected ';
450
+}
451
+?>>AU</option>
452
+					<option value="NL"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'NL') {
453
+	print ' selected ';
454
+}
455
+?>>NL</option>
456
+					<option value="FR"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'FR') {
457
+	print ' selected ';
458
+}
459
+?>>FR</option>
460
+					<option value="TR"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'TR') {
461
+	print ' selected ';
462
+}
463
+?>>TR</option>
359 464
 				</select>
360 465
 			</p>
361 466
 		</fieldset>
@@ -364,15 +469,24 @@  discard block
 block discarded – undo
364 469
 			<p><i>Only put in DB flights that are inside a circle</i></p>
365 470
 			<p>
366 471
 				<label for="latitude">Center latitude</label>
367
-				<input type="text" name="zoilatitude" id="latitude" value="<?php if (isset($globalDistanceIgnore['latitude'])) echo $globalDistanceIgnore['latitude']; ?>" />
472
+				<input type="text" name="zoilatitude" id="latitude" value="<?php if (isset($globalDistanceIgnore['latitude'])) {
473
+	echo $globalDistanceIgnore['latitude'];
474
+}
475
+?>" />
368 476
 			</p>
369 477
 			<p>
370 478
 				<label for="longitude">Center longitude</label>
371
-				<input type="text" name="zoilongitude" id="longitude" value="<?php if (isset($globalDistanceIgnore['longitude'])) echo $globalDistanceIgnore['longitude']; ?>" />
479
+				<input type="text" name="zoilongitude" id="longitude" value="<?php if (isset($globalDistanceIgnore['longitude'])) {
480
+	echo $globalDistanceIgnore['longitude'];
481
+}
482
+?>" />
372 483
 			</p>
373 484
 			<p>
374 485
 				<label for="Distance">Distance (in km)</label>
375
-				<input type="text" name="zoidistance" id="distance" value="<?php if (isset($globalDistanceIgnore['distance'])) echo $globalDistanceIgnore['distance']; ?>" />
486
+				<input type="text" name="zoidistance" id="distance" value="<?php if (isset($globalDistanceIgnore['distance'])) {
487
+	echo $globalDistanceIgnore['distance'];
488
+}
489
+?>" />
376 490
 			</p>
377 491
 		</fieldset>
378 492
 		<fieldset id="sourceloc">
@@ -488,11 +602,17 @@  discard block
 block discarded – undo
488 602
 			<div id="flightaware_data">
489 603
 				<p>
490 604
 					<label for="flightawareusername">FlightAware username</label>
491
-					<input type="text" name="flightawareusername" id="flightawareusername" value="<?php if (isset($globalFlightAwareUsername)) print $globalFlightAwareUsername; ?>" />
605
+					<input type="text" name="flightawareusername" id="flightawareusername" value="<?php if (isset($globalFlightAwareUsername)) {
606
+	print $globalFlightAwareUsername;
607
+}
608
+?>" />
492 609
 				</p>
493 610
 				<p>
494 611
 					<label for="flightawarepassword">FlightAware password/API key</label>
495
-					<input type="text" name="flightawarepassword" id="flightawarepassword" value="<?php if (isset($globalFlightAwarePassword)) print $globalFlightAwarePassword; ?>" />
612
+					<input type="text" name="flightawarepassword" id="flightawarepassword" value="<?php if (isset($globalFlightAwarePassword)) {
613
+	print $globalFlightAwarePassword;
614
+}
615
+?>" />
496 616
 				</p>
497 617
 			</div>
498 618
 -->
@@ -534,7 +654,10 @@  discard block
 block discarded – undo
534 654
 								    if (filter_var($source['host'],FILTER_VALIDATE_URL)) {
535 655
 								?>
536 656
 								<td><input type="text" name="host[]" id="host" value="<?php print $source['host']; ?>" /></td>
537
-								<td><input type="text" name="port[]" class="col-xs-2" id="port" value="<?php if (isset($source['port'])) print $source['port']; ?>" /></td>
657
+								<td><input type="text" name="port[]" class="col-xs-2" id="port" value="<?php if (isset($source['port'])) {
658
+	print $source['port'];
659
+}
660
+?>" /></td>
538 661
 								<?php
539 662
 								    } else {
540 663
 									$hostport = explode(':',$source['host']);
@@ -553,36 +676,114 @@  discard block
 block discarded – undo
553 676
 								?>
554 677
 								<td>
555 678
 									<select name="format[]" id="format">
556
-										<option value="auto" <?php if (!isset($source['format'])) print 'selected'; ?>>Auto</option>
557
-										<option value="sbs" <?php if (isset($source['format']) && $source['format'] == 'sbs') print 'selected'; ?>>SBS</option>
558
-										<option value="tsv" <?php if (isset($source['format']) && $source['format'] == 'tsv') print 'selected'; ?>>TSV</option>
559
-										<option value="raw" <?php if (isset($source['format']) && $source['format'] == 'raw') print 'selected'; ?>>Raw</option>
560
-										<option value="aircraftjson" <?php if (isset($source['format']) && $source['format'] == 'aircraftjson') print 'selected'; ?>>Dump1090 aircraft.json</option>
561
-										<option value="planefinderclient" <?php if (isset($source['format']) && $source['format'] == 'planefinderclient') print 'selected'; ?>>Planefinder client</option>
562
-										<option value="aprs" <?php if (isset($source['format']) && $source['format'] == 'aprs') print 'selected'; ?>>APRS</option>
563
-										<option value="deltadbtxt" <?php if (isset($source['format']) && $source['format'] == 'deltadbtxt') print 'selected'; ?>>Radarcape deltadb.txt</option>
564
-										<option value="vatsimtxt" <?php if (isset($source['format']) && $source['format'] == 'vatsimtxt') print 'selected'; ?>>Vatsim</option>
565
-										<option value="aircraftlistjson" <?php if (isset($source['format']) && $source['format'] == 'aircraftlistjson') print 'selected'; ?>>Virtual Radar Server AircraftList.json</option>
566
-										<option value="vrstcp" <?php if (isset($source['format']) && $source['format'] == 'vrstcp') print 'selected'; ?>>Virtual Radar Server TCP</option>
567
-										<option value="phpvmacars" <?php if (isset($source['format']) && $source['format'] == 'phpvmacars') print 'selected'; ?>>phpVMS</option>
568
-										<option value="vaos" <?php if (isset($source['format']) && $source['format'] == 'phpvmacars') print 'selected'; ?>>Virtual Airline Operations System (VAOS)</option>
569
-										<option value="vam" <?php if (isset($source['format']) && $source['format'] == 'vam') print 'selected'; ?>>Virtual Airlines Manager</option>
570
-										<option value="whazzup" <?php if (isset($source['format']) && $source['format'] == 'whazzup') print 'selected'; ?>>IVAO</option>
571
-										<option value="flightgearmp" <?php if (isset($source['format']) && $source['format'] == 'flightgearmp') print 'selected'; ?>>FlightGear Multiplayer</option>
572
-										<option value="flightgearsp" <?php if (isset($source['format']) && $source['format'] == 'flightgearsp') print 'selected'; ?>>FlightGear Singleplayer</option>
573
-										<option value="acars" <?php if (isset($source['format']) && $source['format'] == 'acars') print 'selected'; ?>>ACARS from acarsdec/acarsdeco2 over UDP</option>
574
-										<option value="acarssbs3" <?php if (isset($source['format']) && $source['format'] == 'acarssbs3') print 'selected'; ?>>ACARS SBS-3 over TCP</option>
575
-										<option value="ais" <?php if (isset($source['format']) && $source['format'] == 'ais') print 'selected'; ?>>NMEA AIS over TCP</option>
576
-										<option value="airwhere" <?php if (isset($source['format']) && $source['format'] == 'airwhere') print 'selected'; ?>>AirWhere website</option>
577
-										<option value="hidnseek_callback" <?php if (isset($source['format']) && $source['format'] == 'hidnseek_callback') print 'selected'; ?>>HidnSeek Callback</option>
578
-										<option value="blitzortung" <?php if (isset($source['format']) && $source['format'] == 'blitzortung') print 'selected'; ?>>Blitzortung</option>
679
+										<option value="auto" <?php if (!isset($source['format'])) {
680
+	print 'selected';
681
+}
682
+?>>Auto</option>
683
+										<option value="sbs" <?php if (isset($source['format']) && $source['format'] == 'sbs') {
684
+	print 'selected';
685
+}
686
+?>>SBS</option>
687
+										<option value="tsv" <?php if (isset($source['format']) && $source['format'] == 'tsv') {
688
+	print 'selected';
689
+}
690
+?>>TSV</option>
691
+										<option value="raw" <?php if (isset($source['format']) && $source['format'] == 'raw') {
692
+	print 'selected';
693
+}
694
+?>>Raw</option>
695
+										<option value="aircraftjson" <?php if (isset($source['format']) && $source['format'] == 'aircraftjson') {
696
+	print 'selected';
697
+}
698
+?>>Dump1090 aircraft.json</option>
699
+										<option value="planefinderclient" <?php if (isset($source['format']) && $source['format'] == 'planefinderclient') {
700
+	print 'selected';
701
+}
702
+?>>Planefinder client</option>
703
+										<option value="aprs" <?php if (isset($source['format']) && $source['format'] == 'aprs') {
704
+	print 'selected';
705
+}
706
+?>>APRS</option>
707
+										<option value="deltadbtxt" <?php if (isset($source['format']) && $source['format'] == 'deltadbtxt') {
708
+	print 'selected';
709
+}
710
+?>>Radarcape deltadb.txt</option>
711
+										<option value="vatsimtxt" <?php if (isset($source['format']) && $source['format'] == 'vatsimtxt') {
712
+	print 'selected';
713
+}
714
+?>>Vatsim</option>
715
+										<option value="aircraftlistjson" <?php if (isset($source['format']) && $source['format'] == 'aircraftlistjson') {
716
+	print 'selected';
717
+}
718
+?>>Virtual Radar Server AircraftList.json</option>
719
+										<option value="vrstcp" <?php if (isset($source['format']) && $source['format'] == 'vrstcp') {
720
+	print 'selected';
721
+}
722
+?>>Virtual Radar Server TCP</option>
723
+										<option value="phpvmacars" <?php if (isset($source['format']) && $source['format'] == 'phpvmacars') {
724
+	print 'selected';
725
+}
726
+?>>phpVMS</option>
727
+										<option value="vaos" <?php if (isset($source['format']) && $source['format'] == 'phpvmacars') {
728
+	print 'selected';
729
+}
730
+?>>Virtual Airline Operations System (VAOS)</option>
731
+										<option value="vam" <?php if (isset($source['format']) && $source['format'] == 'vam') {
732
+	print 'selected';
733
+}
734
+?>>Virtual Airlines Manager</option>
735
+										<option value="whazzup" <?php if (isset($source['format']) && $source['format'] == 'whazzup') {
736
+	print 'selected';
737
+}
738
+?>>IVAO</option>
739
+										<option value="flightgearmp" <?php if (isset($source['format']) && $source['format'] == 'flightgearmp') {
740
+	print 'selected';
741
+}
742
+?>>FlightGear Multiplayer</option>
743
+										<option value="flightgearsp" <?php if (isset($source['format']) && $source['format'] == 'flightgearsp') {
744
+	print 'selected';
745
+}
746
+?>>FlightGear Singleplayer</option>
747
+										<option value="acars" <?php if (isset($source['format']) && $source['format'] == 'acars') {
748
+	print 'selected';
749
+}
750
+?>>ACARS from acarsdec/acarsdeco2 over UDP</option>
751
+										<option value="acarssbs3" <?php if (isset($source['format']) && $source['format'] == 'acarssbs3') {
752
+	print 'selected';
753
+}
754
+?>>ACARS SBS-3 over TCP</option>
755
+										<option value="ais" <?php if (isset($source['format']) && $source['format'] == 'ais') {
756
+	print 'selected';
757
+}
758
+?>>NMEA AIS over TCP</option>
759
+										<option value="airwhere" <?php if (isset($source['format']) && $source['format'] == 'airwhere') {
760
+	print 'selected';
761
+}
762
+?>>AirWhere website</option>
763
+										<option value="hidnseek_callback" <?php if (isset($source['format']) && $source['format'] == 'hidnseek_callback') {
764
+	print 'selected';
765
+}
766
+?>>HidnSeek Callback</option>
767
+										<option value="blitzortung" <?php if (isset($source['format']) && $source['format'] == 'blitzortung') {
768
+	print 'selected';
769
+}
770
+?>>Blitzortung</option>
579 771
 									</select>
580 772
 								</td>
581 773
 								<td>
582
-									<input type="text" name="name[]" id="name" value="<?php if (isset($source['name'])) print $source['name']; ?>" />
774
+									<input type="text" name="name[]" id="name" value="<?php if (isset($source['name'])) {
775
+	print $source['name'];
776
+}
777
+?>" />
583 778
 								</td>
584
-								<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>
585
-								<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>
779
+								<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']) {
780
+	print 'checked';
781
+}
782
+?> /></td>
783
+								<td><input type="checkbox" name="noarchive[]" id="noarchive" title="Don't archive this source" value="1" <?php if (isset($source['noarchive']) && $source['noarchive']) {
784
+	print 'checked';
785
+}
786
+?> /></td>
586 787
 								<td>
587 788
 									<select name="timezones[]" id="timezones">
588 789
 								<?php
@@ -592,7 +793,9 @@  discard block
 block discarded – undo
592 793
 											print '<option selected>'.$timezones.'</option>';
593 794
 										} elseif (!isset($source['timezone']) && $timezones == 'UTC') {
594 795
 											print '<option selected>'.$timezones.'</option>';
595
-										} else print '<option>'.$timezones.'</option>';
796
+										} else {
797
+											print '<option>'.$timezones.'</option>';
798
+										}
596 799
 									}
597 800
 								?>
598 801
 									</select>
@@ -645,7 +848,9 @@  discard block
 block discarded – undo
645 848
 									foreach($timezonelist as $timezones){
646 849
 										if ($timezones == 'UTC') {
647 850
 											print '<option selected>'.$timezones.'</option>';
648
-										} else print '<option>'.$timezones.'</option>';
851
+										} else {
852
+											print '<option>'.$timezones.'</option>';
853
+										}
649 854
 									}
650 855
 								?>
651 856
 									</select>
@@ -670,11 +875,17 @@  discard block
 block discarded – undo
670 875
 					<p>Listen UDP server for acarsdec/acarsdeco2/... with <i>daemon-acars.php</i> script</p>
671 876
 					<p>
672 877
 						<label for="acarshost">ACARS UDP host</label>
673
-						<input type="text" name="acarshost" id="acarshost" value="<?php if (isset($globalACARSHost)) print $globalACARSHost; ?>" />
878
+						<input type="text" name="acarshost" id="acarshost" value="<?php if (isset($globalACARSHost)) {
879
+	print $globalACARSHost;
880
+}
881
+?>" />
674 882
 					</p>
675 883
 					<p>
676 884
 						<label for="acarsport">ACARS UDP port</label>
677
-						<input type="number" name="acarsport" id="acarsport" value="<?php if (isset($globalACARSPort)) print $globalACARSPort; ?>" />
885
+						<input type="number" name="acarsport" id="acarsport" value="<?php if (isset($globalACARSPort)) {
886
+	print $globalACARSPort;
887
+}
888
+?>" />
678 889
 					</p>
679 890
 				</fieldset>
680 891
 			</div>
@@ -700,17 +911,38 @@  discard block
 block discarded – undo
700 911
 				    <td><input type="url" name="newsurl[]" value="<?php print $feed; ?>"/></td>
701 912
 				    <td>
702 913
 					<select name="newslang[]">
703
-					    <option value="en"<?php if ($lng == 'en') print ' selected'; ?>>English</option>
704
-					    <option value="fr"<?php if ($lng == 'fr') print ' selected'; ?>>French</option>
914
+					    <option value="en"<?php if ($lng == 'en') {
915
+	print ' selected';
916
+}
917
+?>>English</option>
918
+					    <option value="fr"<?php if ($lng == 'fr') {
919
+	print ' selected';
920
+}
921
+?>>French</option>
705 922
 					</select>
706 923
 				    </td>
707 924
 				    <td>
708 925
 					<select name="newstype[]">
709
-					    <option value="global"<?php if ($type == 'global') print ' selected'; ?>>Global</option>
710
-					    <option value="aircraft"<?php if ($type == 'aircraft') print ' selected'; ?>>Aircraft</option>
711
-					    <option value="marine"<?php if ($type == 'marine') print ' selected'; ?>>Marine</option>
712
-					    <option value="tracker"<?php if ($type == 'tracker') print ' selected'; ?>>Tracker</option>
713
-					    <option value="satellite"<?php if ($type == 'Satellite') print ' selected'; ?>>Satellite</option>
926
+					    <option value="global"<?php if ($type == 'global') {
927
+	print ' selected';
928
+}
929
+?>>Global</option>
930
+					    <option value="aircraft"<?php if ($type == 'aircraft') {
931
+	print ' selected';
932
+}
933
+?>>Aircraft</option>
934
+					    <option value="marine"<?php if ($type == 'marine') {
935
+	print ' selected';
936
+}
937
+?>>Marine</option>
938
+					    <option value="tracker"<?php if ($type == 'tracker') {
939
+	print ' selected';
940
+}
941
+?>>Tracker</option>
942
+					    <option value="satellite"<?php if ($type == 'Satellite') {
943
+	print ' selected';
944
+}
945
+?>>Satellite</option>
714 946
 					</select>
715 947
 				    </td>
716 948
 				    <td><input type="button" value="Delete" onclick="deleteRowNews(this)" /> <input type="button" value="Add" onclick="insRowNews()" /></td>
@@ -852,13 +1084,19 @@  discard block
 block discarded – undo
852 1084
 			<div id="schedules_options">
853 1085
 				<p>
854 1086
 					<label for="britishairways">British Airways API Key</label>
855
-					<input type="text" name="britishairways" id="britishairways" value="<?php if (isset($globalBritishAirwaysKey)) print $globalBritishAirwaysKey; ?>" />
1087
+					<input type="text" name="britishairways" id="britishairways" value="<?php if (isset($globalBritishAirwaysKey)) {
1088
+	print $globalBritishAirwaysKey;
1089
+}
1090
+?>" />
856 1091
 					<p class="help-block">Register an account on <a href="https://developer.ba.com/">https://developer.ba.com/</a></p>
857 1092
 				</p>
858 1093
 				<!--
859 1094
 				<p>
860 1095
 					<label for="transavia">Transavia Test API Consumer Key</label>
861
-					<input type="text" name="transavia" id="transavia" value="<?php if (isset($globalTransaviaKey)) print $globalTransaviaKey; ?>" />
1096
+					<input type="text" name="transavia" id="transavia" value="<?php if (isset($globalTransaviaKey)) {
1097
+	print $globalTransaviaKey;
1098
+}
1099
+?>" />
862 1100
 					<p class="help-block">Register an account on <a href="https://developer.transavia.com">https://developer.transavia.com</a></p>
863 1101
 				</p>
864 1102
 				-->
@@ -867,10 +1105,16 @@  discard block
 block discarded – undo
867 1105
 						<b>Lufthansa API Key</b>
868 1106
 						<p>
869 1107
 							<label for="lufthansakey">Key</label>
870
-							<input type="text" name="lufthansakey" id="lufthansakey" value="<?php if (isset($globalLufthansaKey['key'])) print $globalLufthansaKey['key']; ?>" />
1108
+							<input type="text" name="lufthansakey" id="lufthansakey" value="<?php if (isset($globalLufthansaKey['key'])) {
1109
+	print $globalLufthansaKey['key'];
1110
+}
1111
+?>" />
871 1112
 						</p><p>
872 1113
 							<label for="lufthansasecret">Secret</label>
873
-							<input type="text" name="lufthansasecret" id="lufthansasecret" value="<?php if (isset($globalLufthansaKey['secret'])) print $globalLufthansaKey['secret']; ?>" />
1114
+							<input type="text" name="lufthansasecret" id="lufthansasecret" value="<?php if (isset($globalLufthansaKey['secret'])) {
1115
+	print $globalLufthansaKey['secret'];
1116
+}
1117
+?>" />
874 1118
 						</p>
875 1119
 					</div>
876 1120
 					<p class="help-block">Register an account on <a href="https://developer.lufthansa.com/page">https://developer.lufthansa.com/page</a></p>
@@ -880,11 +1124,17 @@  discard block
 block discarded – undo
880 1124
 						<b>FlightAware API Key</b>
881 1125
 						<p>
882 1126
 							<label for="flightawareusername">Username</label>
883
-							<input type="text" name="flightawareusername" id="flightawareusername" value="<?php if (isset($globalFlightAwareUsername)) print $globalFlightAwareUsername; ?>" />
1127
+							<input type="text" name="flightawareusername" id="flightawareusername" value="<?php if (isset($globalFlightAwareUsername)) {
1128
+	print $globalFlightAwareUsername;
1129
+}
1130
+?>" />
884 1131
 						</p>
885 1132
 						<p>
886 1133
 							<label for="flightawarepassword">API key</label>
887
-							<input type="text" name="flightawarepassword" id="flightawarepassword" value="<?php if (isset($globalFlightAwarePassword)) print $globalFlightAwarePassword; ?>" />
1134
+							<input type="text" name="flightawarepassword" id="flightawarepassword" value="<?php if (isset($globalFlightAwarePassword)) {
1135
+	print $globalFlightAwarePassword;
1136
+}
1137
+?>" />
888 1138
 						</p>
889 1139
 					</div>
890 1140
 					<p class="help-block">Register an account on <a href="https://www.flightaware.com/">https://www.flightaware.com/</a></p>
@@ -901,10 +1151,22 @@  discard block
 block discarded – undo
901 1151
 				<p>
902 1152
 					<label for="mapmatchingsource">Map Matching source</label>
903 1153
 					<select name="mapmatchingsource" id="mapmatchingsource">
904
-						<option value="fam" <?php if ((isset($globalMapMatchingSource) && $globalMapMatchingSource == 'fam') || !isset($globalMatchingSource)) print 'selected="selected" '; ?>>FlightAirMap Map Matching</option>
905
-						<option value="graphhopper" <?php if (isset($globalMapMatchingSource) && $globalMapMatchingSource == 'graphhopper') print 'selected="selected" '; ?>>GraphHopper</option>
906
-						<option value="osmr" <?php if (isset($globalMapMatchingSource) && $globalMapMatchingSource == 'osmr') print 'selected="selected" '; ?>>OSMR</option>
907
-						<option value="mapbox" <?php if (isset($globalMapMatchingSource) && $globalMapMatchingSource == 'mapbox') print 'selected="selected" '; ?>>Mapbox</option>
1154
+						<option value="fam" <?php if ((isset($globalMapMatchingSource) && $globalMapMatchingSource == 'fam') || !isset($globalMatchingSource)) {
1155
+	print 'selected="selected" ';
1156
+}
1157
+?>>FlightAirMap Map Matching</option>
1158
+						<option value="graphhopper" <?php if (isset($globalMapMatchingSource) && $globalMapMatchingSource == 'graphhopper') {
1159
+	print 'selected="selected" ';
1160
+}
1161
+?>>GraphHopper</option>
1162
+						<option value="osmr" <?php if (isset($globalMapMatchingSource) && $globalMapMatchingSource == 'osmr') {
1163
+	print 'selected="selected" ';
1164
+}
1165
+?>>OSMR</option>
1166
+						<option value="mapbox" <?php if (isset($globalMapMatchingSource) && $globalMapMatchingSource == 'mapbox') {
1167
+	print 'selected="selected" ';
1168
+}
1169
+?>>Mapbox</option>
908 1170
 					</select>
909 1171
 					<p class="help-block">Mapbox need the API Key defined in map section.</p>
910 1172
 					<p class="help-block">FlightAirMap Map Matching is free, without API key but limited to about 100 input points to keep fast results.</p>
@@ -912,7 +1174,10 @@  discard block
 block discarded – undo
912 1174
 				<br />
913 1175
 				<p>
914 1176
 					<label for="graphhopper">GraphHopper API Key</label>
915
-					<input type="text" name="graphhopper" id="graphhopper" value="<?php if (isset($globalGraphHopperKey)) print $globalGraphHopperKey; ?>" />
1177
+					<input type="text" name="graphhopper" id="graphhopper" value="<?php if (isset($globalGraphHopperKey)) {
1178
+	print $globalGraphHopperKey;
1179
+}
1180
+?>" />
916 1181
 					<p class="help-block">Register an account on <a href="https://www.graphhopper.com/">https://www.graphhopper.com/</a></p>
917 1182
 				</p>
918 1183
 			</div>
@@ -930,7 +1195,10 @@  discard block
 block discarded – undo
930 1195
 			</p>
931 1196
 			<p>
932 1197
 				<label for="notamsource">URL of your feed from notaminfo.com</label>
933
-				<input type="text" name="notamsource" id="notamsource" value="<?php if (isset($globalNOTAMSource)) print $globalNOTAMSource; ?>" />
1198
+				<input type="text" name="notamsource" id="notamsource" value="<?php if (isset($globalNOTAMSource)) {
1199
+	print $globalNOTAMSource;
1200
+}
1201
+?>" />
934 1202
 				<p class="help-block">If you want to use world NOTAM from FlightAirMap website, leave it blank</p>
935 1203
 			</p>
936 1204
 			<br />
@@ -946,14 +1214,20 @@  discard block
 block discarded – undo
946 1214
 			<div id="metarsrc">
947 1215
 				<p>
948 1216
 					<label for="metarsource">URL of your METAR source</label>
949
-					<input type="text" name="metarsource" id="metarsource" value="<?php if (isset($globalMETARurl)) print $globalMETARurl; ?>" />
1217
+					<input type="text" name="metarsource" id="metarsource" value="<?php if (isset($globalMETARurl)) {
1218
+	print $globalMETARurl;
1219
+}
1220
+?>" />
950 1221
 					<p class="help-block">Use {icao} to specify where we replace by airport icao. ex : http://metar.vatsim.net/metar.php?id={icao}</p>
951 1222
 				</p>
952 1223
 			</div>
953 1224
 			<br />
954 1225
 			<p>
955 1226
 				<label for="bitly">Bit.ly access token api (used in search page)</label>
956
-				<input type="text" name="bitly" id="bitly" value="<?php if (isset($globalBitlyAccessToken)) print $globalBitlyAccessToken; ?>" />
1227
+				<input type="text" name="bitly" id="bitly" value="<?php if (isset($globalBitlyAccessToken)) {
1228
+	print $globalBitlyAccessToken;
1229
+}
1230
+?>" />
957 1231
 			</p>
958 1232
 			<br />
959 1233
 			<p>
@@ -969,11 +1243,26 @@  discard block
 block discarded – undo
969 1243
 			<p>
970 1244
 				<label for="geoid_source">Geoid Source</label>
971 1245
 				<select name="geoid_source" id="geoid_source">
972
-					<option value="egm96-15"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm96-15') print ' selected="selected"'; ?>>EGM96 15' (2.1MB)</option>
973
-					<option value="egm96-5"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm96-5') print ' selected="selected"'; ?>>EGM96 5' (19MB)</option>
974
-					<option value="egm2008-5"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm2008-5') print ' selected="selected"'; ?>>EGM2008 5' (19MB)</option>
975
-					<option value="egm2008-2_5"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm2008-2_5') print ' selected="selected"'; ?>>EGM2008 2.5' (75MB)</option>
976
-					<option value="egm2008-1"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm2008-1') print ' selected="selected"'; ?>>EGM2008 1' (470MB)</option>
1246
+					<option value="egm96-15"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm96-15') {
1247
+	print ' selected="selected"';
1248
+}
1249
+?>>EGM96 15' (2.1MB)</option>
1250
+					<option value="egm96-5"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm96-5') {
1251
+	print ' selected="selected"';
1252
+}
1253
+?>>EGM96 5' (19MB)</option>
1254
+					<option value="egm2008-5"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm2008-5') {
1255
+	print ' selected="selected"';
1256
+}
1257
+?>>EGM2008 5' (19MB)</option>
1258
+					<option value="egm2008-2_5"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm2008-2_5') {
1259
+	print ' selected="selected"';
1260
+}
1261
+?>>EGM2008 2.5' (75MB)</option>
1262
+					<option value="egm2008-1"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm2008-1') {
1263
+	print ' selected="selected"';
1264
+}
1265
+?>>EGM2008 1' (470MB)</option>
977 1266
 				</select>
978 1267
 				<p class="help-block">The geoid is approximated by an "earth gravity model" (EGM).</p>
979 1268
 			</p>
@@ -995,7 +1284,12 @@  discard block
 block discarded – undo
995 1284
 			</p>
996 1285
 			<p>
997 1286
 				<label for="archivemonths">Generate statistics, delete or put in archive flights older than xx months</label>
998
-				<input type="number" name="archivemonths" id="archivemonths" value="<?php if (isset($globalArchiveMonths)) print $globalArchiveMonths; else echo '1'; ?>" />
1287
+				<input type="number" name="archivemonths" id="archivemonths" value="<?php if (isset($globalArchiveMonths)) {
1288
+	print $globalArchiveMonths;
1289
+} else {
1290
+	echo '1';
1291
+}
1292
+?>" />
999 1293
 				<p class="help-block">0 to disable, delete old flight if <i>Archive all flights data</i> is disabled</p>
1000 1294
 			</p>
1001 1295
 			<p>
@@ -1005,12 +1299,22 @@  discard block
 block discarded – undo
1005 1299
 			</p>
1006 1300
 			<p>
1007 1301
 				<label for="archivekeepmonths">Keep flights data for xx months in archive</label>
1008
-				<input type="number" name="archivekeepmonths" id="archivekeepmonths" value="<?php if (isset($globalArchiveKeepMonths)) print $globalArchiveKeepMonths; else echo '1'; ?>" />
1302
+				<input type="number" name="archivekeepmonths" id="archivekeepmonths" value="<?php if (isset($globalArchiveKeepMonths)) {
1303
+	print $globalArchiveKeepMonths;
1304
+} else {
1305
+	echo '1';
1306
+}
1307
+?>" />
1009 1308
 				<p class="help-block">0 to disable</p>
1010 1309
 			</p>
1011 1310
 			<p>
1012 1311
 				<label for="archivekeeptrackmonths">Keep flights track data for xx months in archive</label>
1013
-				<input type="number" name="archivekeeptrackmonths" id="archivekeeptrackmonths" value="<?php if (isset($globalArchiveKeepTrackMonths)) print $globalArchiveKeepTrackMonths; else echo '1'; ?>" />
1312
+				<input type="number" name="archivekeeptrackmonths" id="archivekeeptrackmonths" value="<?php if (isset($globalArchiveKeepTrackMonths)) {
1313
+	print $globalArchiveKeepTrackMonths;
1314
+} else {
1315
+	echo '1';
1316
+}
1317
+?>" />
1014 1318
 				<p class="help-block">0 to disable, should be less or egal to <i>Keep flights data</i> value</p>
1015 1319
 			</p>
1016 1320
 			<br />
@@ -1020,7 +1324,12 @@  discard block
 block discarded – undo
1020 1324
 				<p class="help-block">Uncheck if the script is running as cron job. You should always run it as daemon when it's possible.</p>
1021 1325
 				<div id="cronends"> 
1022 1326
 					<label for="cronend">Run script for xx seconds</label>
1023
-					<input type="number" name="cronend" id="cronend" value="<?php if (isset($globalCronEnd)) print $globalCronEnd; else print '0'; ?>" />
1327
+					<input type="number" name="cronend" id="cronend" value="<?php if (isset($globalCronEnd)) {
1328
+	print $globalCronEnd;
1329
+} else {
1330
+	print '0';
1331
+}
1332
+?>" />
1024 1333
 					<p class="help-block">Set to 0 to disable. Should be disabled if source is URL.</p>
1025 1334
 				</div>
1026 1335
 			</p>
@@ -1073,20 +1382,40 @@  discard block
 block discarded – undo
1073 1382
 			<br />
1074 1383
 			<p>
1075 1384
 				<label for="refresh">Show flights detected since xxx seconds</label>
1076
-				<input type="number" name="refresh" id="refresh" value="<?php if (isset($globalLiveInterval)) echo $globalLiveInterval; else echo '200'; ?>" />
1385
+				<input type="number" name="refresh" id="refresh" value="<?php if (isset($globalLiveInterval)) {
1386
+	echo $globalLiveInterval;
1387
+} else {
1388
+	echo '200';
1389
+}
1390
+?>" />
1077 1391
 			</p>
1078 1392
 			<p>
1079 1393
 				<label for="maprefresh">Live map refresh (in seconds)</label>
1080
-				<input type="number" name="maprefresh" id="maprefresh" value="<?php if (isset($globalMapRefresh)) echo $globalMapRefresh; else echo '30'; ?>" />
1394
+				<input type="number" name="maprefresh" id="maprefresh" value="<?php if (isset($globalMapRefresh)) {
1395
+	echo $globalMapRefresh;
1396
+} else {
1397
+	echo '30';
1398
+}
1399
+?>" />
1081 1400
 			</p>
1082 1401
 			<p>
1083 1402
 				<label for="mapidle">Map idle timeout (in minutes)</label>
1084
-				<input type="number" name="mapidle" id="mapidle" value="<?php if (isset($globalMapIdleTimeout)) echo $globalMapIdleTimeout; else echo '30'; ?>" />
1403
+				<input type="number" name="mapidle" id="mapidle" value="<?php if (isset($globalMapIdleTimeout)) {
1404
+	echo $globalMapIdleTimeout;
1405
+} else {
1406
+	echo '30';
1407
+}
1408
+?>" />
1085 1409
 				<p class="help-block">0 to disable</p>
1086 1410
 			</p>
1087 1411
 			<p>
1088 1412
 				<label for="minfetch">HTTP/file source fetch every xxx seconds</label>
1089
-				<input type="number" name="minfetch" id="minfetch" value="<?php if (isset($globalMinFetch)) echo $globalMinFetch; else echo '20'; ?>" />
1413
+				<input type="number" name="minfetch" id="minfetch" value="<?php if (isset($globalMinFetch)) {
1414
+	echo $globalMinFetch;
1415
+} else {
1416
+	echo '20';
1417
+}
1418
+?>" />
1090 1419
 			</p>
1091 1420
 			<p>
1092 1421
 				<label for="bbox">Only display flights that we can see on screen (bounding box)</label>
@@ -1100,12 +1429,20 @@  discard block
 block discarded – undo
1100 1429
 			<br />
1101 1430
 			<p>
1102 1431
 				<label for="closestmindist">Distance to airport set as arrival (in km)</label>
1103
-				<input type="number" name="closestmindist" id="closestmindist" value="<?php if (isset($globalClosestMinDist)) echo $globalClosestMinDist; else echo '50'; ?>" />
1432
+				<input type="number" name="closestmindist" id="closestmindist" value="<?php if (isset($globalClosestMinDist)) {
1433
+	echo $globalClosestMinDist;
1434
+} else {
1435
+	echo '50';
1436
+}
1437
+?>" />
1104 1438
 			</p>
1105 1439
 			<br />
1106 1440
 			<p>
1107 1441
 				<label for="aircraftsize">Size of aircraft icon on map (default to 30px if zoom > 7 else 15px), empty to default</label>
1108
-				<input type="number" name="aircraftsize" id="aircraftsize" value="<?php if (isset($globalAircraftSize)) echo $globalAircraftSize;?>" />
1442
+				<input type="number" name="aircraftsize" id="aircraftsize" value="<?php if (isset($globalAircraftSize)) {
1443
+	echo $globalAircraftSize;
1444
+}
1445
+?>" />
1109 1446
 			</p>
1110 1447
 			<br />
1111 1448
 			<p>
@@ -1124,7 +1461,12 @@  discard block
 block discarded – undo
1124 1461
 			    if (extension_loaded('gd') && function_exists('gd_info')) {
1125 1462
 			?>
1126 1463
 				<label for="aircrafticoncolor">Color of aircraft icon on map</label>
1127
-				<input type="color" name="aircrafticoncolor" id="aircrafticoncolor" value="#<?php if (isset($globalAircraftIconColor)) echo $globalAircraftIconColor; else echo '1a3151'; ?>" />
1464
+				<input type="color" name="aircrafticoncolor" id="aircrafticoncolor" value="#<?php if (isset($globalAircraftIconColor)) {
1465
+	echo $globalAircraftIconColor;
1466
+} else {
1467
+	echo '1a3151';
1468
+}
1469
+?>" />
1128 1470
 			<?php
1129 1471
 				if (!is_writable('../cache')) {
1130 1472
 			?>
@@ -1142,14 +1484,27 @@  discard block
 block discarded – undo
1142 1484
 			<p>
1143 1485
 				<label for="airportzoom">Zoom level minimum to see airports icons</label>
1144 1486
 				<div class="range">
1145
-					<input type="range" name="airportzoom" id="airportzoom" value="<?php if (isset($globalAirportZoom)) echo $globalAirportZoom; else echo '7'; ?>" />
1146
-					<output id="range"><?php if (isset($globalAirportZoom)) echo $globalAirportZoom; else echo '7'; ?></output>
1487
+					<input type="range" name="airportzoom" id="airportzoom" value="<?php if (isset($globalAirportZoom)) {
1488
+	echo $globalAirportZoom;
1489
+} else {
1490
+	echo '7';
1491
+}
1492
+?>" />
1493
+					<output id="range"><?php if (isset($globalAirportZoom)) {
1494
+	echo $globalAirportZoom;
1495
+} else {
1496
+	echo '7';
1497
+}
1498
+?></output>
1147 1499
 				</div>
1148 1500
 			</p>
1149 1501
 			<br />
1150 1502
 			<p>
1151 1503
 				<label for="customcss">Custom CSS web path</label>
1152
-				<input type="text" name="customcss" id="customcss" value="<?php if (isset($globalCustomCSS)) echo $globalCustomCSS; ?>" />
1504
+				<input type="text" name="customcss" id="customcss" value="<?php if (isset($globalCustomCSS)) {
1505
+	echo $globalCustomCSS;
1506
+}
1507
+?>" />
1153 1508
 			</p>
1154 1509
 		</fieldset>
1155 1510
 		<input type="submit" name="submit" value="Create/Update database & write setup" />
@@ -1176,8 +1531,12 @@  discard block
 block discarded – undo
1176 1531
 	$dbhost = filter_input(INPUT_POST,'dbhost',FILTER_SANITIZE_STRING);
1177 1532
 	$dbport = filter_input(INPUT_POST,'dbport',FILTER_SANITIZE_STRING);
1178 1533
 
1179
-	if ($dbtype == 'mysql' && !extension_loaded('pdo_mysql')) $error .= 'Mysql driver for PDO must be loaded';
1180
-	if ($dbtype == 'pgsql' && !extension_loaded('pdo_pgsql')) $error .= 'PosgreSQL driver for PDO must be loaded';
1534
+	if ($dbtype == 'mysql' && !extension_loaded('pdo_mysql')) {
1535
+		$error .= 'Mysql driver for PDO must be loaded';
1536
+	}
1537
+	if ($dbtype == 'pgsql' && !extension_loaded('pdo_pgsql')) {
1538
+		$error .= 'PosgreSQL driver for PDO must be loaded';
1539
+	}
1181 1540
 	
1182 1541
 	$_SESSION['database_root'] = $dbroot;
1183 1542
 	$_SESSION['database_rootpass'] = $dbrootpass;
@@ -1245,15 +1604,23 @@  discard block
 block discarded – undo
1245 1604
 	$source_city = $_POST['source_city'];
1246 1605
 	$source_country = $_POST['source_country'];
1247 1606
 	$source_ref = $_POST['source_ref'];
1248
-	if (isset($source_id)) $source_id = $_POST['source_id'];
1249
-	else $source_id = array();
1607
+	if (isset($source_id)) {
1608
+		$source_id = $_POST['source_id'];
1609
+	} else {
1610
+		$source_id = array();
1611
+	}
1250 1612
 	
1251 1613
 	$sources = array();
1252 1614
 	foreach ($source_name as $keys => $name) {
1253
-	    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]);
1254
-	    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]);
1615
+	    if (isset($source_id[$keys])) {
1616
+	    	$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]);
1617
+	    } else {
1618
+	    	$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]);
1619
+	    }
1620
+	}
1621
+	if (count($sources) > 0) {
1622
+		$_SESSION['sources'] = $sources;
1255 1623
 	}
1256
-	if (count($sources) > 0) $_SESSION['sources'] = $sources;
1257 1624
 
1258 1625
 	$newsurl = $_POST['newsurl'];
1259 1626
 	$newslng = $_POST['newslang'];
@@ -1266,7 +1633,9 @@  discard block
 block discarded – undo
1266 1633
 		$lng = $newslng[$newskey];
1267 1634
 		if (isset($newsfeeds[$type][$lng])) {
1268 1635
 		    $newsfeeds[$type][$lng] = array_merge($newsfeeds[$type][$lng],array($url));
1269
-		} else $newsfeeds[$type][$lng] = array($url);
1636
+		} else {
1637
+			$newsfeeds[$type][$lng] = array($url);
1638
+		}
1270 1639
 	    }
1271 1640
 	}
1272 1641
 	$settings = array_merge($settings,array('globalNewsFeeds' => $newsfeeds));
@@ -1290,17 +1659,29 @@  discard block
 block discarded – undo
1290 1659
 	$datasource = filter_input(INPUT_POST,'datasource',FILTER_SANITIZE_STRING);
1291 1660
 
1292 1661
 	$globalaircraft = filter_input(INPUT_POST,'globalaircraft',FILTER_SANITIZE_STRING);
1293
-	if ($globalaircraft == 'aircraft') $settings = array_merge($settings,array('globalAircraft' => 'TRUE'));
1294
-	else $settings = array_merge($settings,array('globalAircraft' => 'FALSE'));
1662
+	if ($globalaircraft == 'aircraft') {
1663
+		$settings = array_merge($settings,array('globalAircraft' => 'TRUE'));
1664
+	} else {
1665
+		$settings = array_merge($settings,array('globalAircraft' => 'FALSE'));
1666
+	}
1295 1667
 	$globaltracker = filter_input(INPUT_POST,'globaltracker',FILTER_SANITIZE_STRING);
1296
-	if ($globaltracker == 'tracker') $settings = array_merge($settings,array('globalTracker' => 'TRUE'));
1297
-	else $settings = array_merge($settings,array('globalTracker' => 'FALSE'));
1668
+	if ($globaltracker == 'tracker') {
1669
+		$settings = array_merge($settings,array('globalTracker' => 'TRUE'));
1670
+	} else {
1671
+		$settings = array_merge($settings,array('globalTracker' => 'FALSE'));
1672
+	}
1298 1673
 	$globalmarine = filter_input(INPUT_POST,'globalmarine',FILTER_SANITIZE_STRING);
1299
-	if ($globalmarine == 'marine') $settings = array_merge($settings,array('globalMarine' => 'TRUE'));
1300
-	else $settings = array_merge($settings,array('globalMarine' => 'FALSE'));
1674
+	if ($globalmarine == 'marine') {
1675
+		$settings = array_merge($settings,array('globalMarine' => 'TRUE'));
1676
+	} else {
1677
+		$settings = array_merge($settings,array('globalMarine' => 'FALSE'));
1678
+	}
1301 1679
 	$globalsatellite = filter_input(INPUT_POST,'globalsatellite',FILTER_SANITIZE_STRING);
1302
-	if ($globalsatellite == 'satellite') $settings = array_merge($settings,array('globalSatellite' => 'TRUE'));
1303
-	else $settings = array_merge($settings,array('globalSatellite' => 'FALSE'));
1680
+	if ($globalsatellite == 'satellite') {
1681
+		$settings = array_merge($settings,array('globalSatellite' => 'TRUE'));
1682
+	} else {
1683
+		$settings = array_merge($settings,array('globalSatellite' => 'FALSE'));
1684
+	}
1304 1685
 
1305 1686
 /*	
1306 1687
 	$globalSBS1Hosts = array();
@@ -1322,23 +1703,37 @@  discard block
 block discarded – undo
1322 1703
 	$name = $_POST['name'];
1323 1704
 	$format = $_POST['format'];
1324 1705
 	$timezones = $_POST['timezones'];
1325
-	if (isset($_POST['sourcestats'])) $sourcestats = $_POST['sourcestats'];
1326
-	else $sourcestats = array();
1327
-	if (isset($_POST['noarchive'])) $noarchive = $_POST['noarchive'];
1328
-	else $noarchive = array();
1706
+	if (isset($_POST['sourcestats'])) {
1707
+		$sourcestats = $_POST['sourcestats'];
1708
+	} else {
1709
+		$sourcestats = array();
1710
+	}
1711
+	if (isset($_POST['noarchive'])) {
1712
+		$noarchive = $_POST['noarchive'];
1713
+	} else {
1714
+		$noarchive = array();
1715
+	}
1329 1716
 	$gSources = array();
1330 1717
 	$forcepilots = false;
1331 1718
 	foreach ($host as $key => $h) {
1332
-		if (isset($sourcestats[$key]) && $sourcestats[$key] == 1) $cov = 'TRUE';
1333
-		else $cov = 'FALSE';
1334
-		if (isset($noarchive[$key]) && $noarchive[$key] == 1) $arch = 'TRUE';
1335
-		else $arch = 'FALSE';
1719
+		if (isset($sourcestats[$key]) && $sourcestats[$key] == 1) {
1720
+			$cov = 'TRUE';
1721
+		} else {
1722
+			$cov = 'FALSE';
1723
+		}
1724
+		if (isset($noarchive[$key]) && $noarchive[$key] == 1) {
1725
+			$arch = 'TRUE';
1726
+		} else {
1727
+			$arch = 'FALSE';
1728
+		}
1336 1729
 		if (strpos($format[$key],'_callback')) {
1337 1730
 			$gSources[] = array('host' => $h, 'pass' => $port[$key],'name' => $name[$key],'format' => $format[$key],'sourcestats' => $cov,'noarchive' => $arch,'timezone' => $timezones[$key],'callback' => 'TRUE');
1338 1731
 		} elseif ($h != '' || $name[$key] != '') {
1339 1732
 			$gSources[] = array('host' => $h, 'port' => $port[$key],'name' => $name[$key],'format' => $format[$key],'sourcestats' => $cov,'noarchive' => $arch,'timezone' => $timezones[$key],'callback' => 'FALSE');
1340 1733
 		}
1341
-		if ($format[$key] == 'airwhere') $forcepilots = true;
1734
+		if ($format[$key] == 'airwhere') {
1735
+			$forcepilots = true;
1736
+		}
1342 1737
 	}
1343 1738
 	$settings = array_merge($settings,array('globalSources' => $gSources));
1344 1739
 
@@ -1369,7 +1764,9 @@  discard block
 block discarded – undo
1369 1764
 	$zoidistance = filter_input(INPUT_POST,'zoidistance',FILTER_SANITIZE_NUMBER_INT);
1370 1765
 	if ($zoilatitude != '' && $zoilongitude != '' && $zoidistance != '') {
1371 1766
 		$settings = array_merge($settings,array('globalDistanceIgnore' => array('latitude' => $zoilatitude,'longitude' => $zoilongitude,'distance' => $zoidistance)));
1372
-	} else $settings = array_merge($settings,array('globalDistanceIgnore' => array()));
1767
+	} else {
1768
+		$settings = array_merge($settings,array('globalDistanceIgnore' => array()));
1769
+	}
1373 1770
 
1374 1771
 	$refresh = filter_input(INPUT_POST,'refresh',FILTER_SANITIZE_NUMBER_INT);
1375 1772
 	$settings = array_merge($settings,array('globalLiveInterval' => $refresh));
@@ -1410,7 +1807,9 @@  discard block
 block discarded – undo
1410 1807
 
1411 1808
 	// Create in settings.php keys not yet configurable if not already here
1412 1809
 	//if (!isset($globalImageBingKey)) $settings = array_merge($settings,array('globalImageBingKey' => ''));
1413
-	if (!isset($globalDebug)) $settings = array_merge($settings,array('globalDebug' => 'TRUE'));
1810
+	if (!isset($globalDebug)) {
1811
+		$settings = array_merge($settings,array('globalDebug' => 'TRUE'));
1812
+	}
1414 1813
 
1415 1814
 	$resetyearstats = filter_input(INPUT_POST,'resetyearstats',FILTER_SANITIZE_STRING);
1416 1815
 	if ($resetyearstats == 'resetyearstats') {
@@ -1453,37 +1852,56 @@  discard block
 block discarded – undo
1453 1852
 	}
1454 1853
 */
1455 1854
 	$settings = array_merge($settings,array('globalFlightAware' => 'FALSE'));
1456
-	if ($globalsbs == 'sbs') $settings = array_merge($settings,array('globalSBS1' => 'TRUE'));
1457
-	else $settings = array_merge($settings,array('globalSBS1' => 'FALSE'));
1458
-	if ($globalaprs == 'aprs') $settings = array_merge($settings,array('globalAPRS' => 'TRUE'));
1459
-	else $settings = array_merge($settings,array('globalAPRS' => 'FALSE'));
1855
+	if ($globalsbs == 'sbs') {
1856
+		$settings = array_merge($settings,array('globalSBS1' => 'TRUE'));
1857
+	} else {
1858
+		$settings = array_merge($settings,array('globalSBS1' => 'FALSE'));
1859
+	}
1860
+	if ($globalaprs == 'aprs') {
1861
+		$settings = array_merge($settings,array('globalAPRS' => 'TRUE'));
1862
+	} else {
1863
+		$settings = array_merge($settings,array('globalAPRS' => 'FALSE'));
1864
+	}
1460 1865
 	$va = false;
1461 1866
 	if ($globalivao == 'ivao') {
1462 1867
 		$settings = array_merge($settings,array('globalIVAO' => 'TRUE'));
1463 1868
 		$va = true;
1464
-	} else $settings = array_merge($settings,array('globalIVAO' => 'FALSE'));
1869
+	} else {
1870
+		$settings = array_merge($settings,array('globalIVAO' => 'FALSE'));
1871
+	}
1465 1872
 	if ($globalvatsim == 'vatsim') {
1466 1873
 		$settings = array_merge($settings,array('globalVATSIM' => 'TRUE'));
1467 1874
 		$va = true;
1468
-	} else $settings = array_merge($settings,array('globalVATSIM' => 'FALSE'));
1875
+	} else {
1876
+		$settings = array_merge($settings,array('globalVATSIM' => 'FALSE'));
1877
+	}
1469 1878
 	if ($globalphpvms == 'phpvms') {
1470 1879
 		$settings = array_merge($settings,array('globalphpVMS' => 'TRUE'));
1471 1880
 		$va = true;
1472
-	} else $settings = array_merge($settings,array('globalphpVMS' => 'FALSE'));
1881
+	} else {
1882
+		$settings = array_merge($settings,array('globalphpVMS' => 'FALSE'));
1883
+	}
1473 1884
 	if ($globalvam == 'vam') {
1474 1885
 		$settings = array_merge($settings,array('globalVAM' => 'TRUE'));
1475 1886
 		$va = true;
1476
-	} else $settings = array_merge($settings,array('globalVAM' => 'FALSE'));
1887
+	} else {
1888
+		$settings = array_merge($settings,array('globalVAM' => 'FALSE'));
1889
+	}
1477 1890
 	if ($va) {
1478 1891
 		$settings = array_merge($settings,array('globalSchedulesFetch' => 'FALSE','globalTranslationFetch' => 'FALSE'));
1479
-	} else $settings = array_merge($settings,array('globalSchedulesFetch' => 'TRUE','globalTranslationFetch' => 'TRUE'));
1892
+	} else {
1893
+		$settings = array_merge($settings,array('globalSchedulesFetch' => 'TRUE','globalTranslationFetch' => 'TRUE'));
1894
+	}
1480 1895
 	if ($globalva == 'va' || $va) {
1481 1896
 		$settings = array_merge($settings,array('globalVA' => 'TRUE'));
1482 1897
 		$settings = array_merge($settings,array('globalUsePilot' => 'TRUE','globalUseOwner' => 'FALSE'));
1483 1898
 	} else {
1484 1899
 		$settings = array_merge($settings,array('globalVA' => 'FALSE'));
1485
-		if ($forcepilots) $settings = array_merge($settings,array('globalUsePilot' => 'TRUE','globalUseOwner' => 'FALSE'));
1486
-		else $settings = array_merge($settings,array('globalUsePilot' => 'FALSE','globalUseOwner' => 'TRUE'));
1900
+		if ($forcepilots) {
1901
+			$settings = array_merge($settings,array('globalUsePilot' => 'TRUE','globalUseOwner' => 'FALSE'));
1902
+		} else {
1903
+			$settings = array_merge($settings,array('globalUsePilot' => 'FALSE','globalUseOwner' => 'TRUE'));
1904
+		}
1487 1905
 	}
1488 1906
 	
1489 1907
 	
@@ -1718,7 +2136,9 @@  discard block
 block discarded – undo
1718 2136
 	$graphhopper = filter_input(INPUT_POST,'graphhopper',FILTER_SANITIZE_STRING);
1719 2137
 	$settings = array_merge($settings,array('globalGraphHopperKey' => $graphhopper));
1720 2138
 
1721
-	if (!isset($globalTransaction)) $settings = array_merge($settings,array('globalTransaction' => 'TRUE'));
2139
+	if (!isset($globalTransaction)) {
2140
+		$settings = array_merge($settings,array('globalTransaction' => 'TRUE'));
2141
+	}
1722 2142
 
1723 2143
 	// Set some defaults values...
1724 2144
 	if (!isset($globalAircraftImageSources)) {
@@ -1733,15 +2153,23 @@  discard block
 block discarded – undo
1733 2153
 
1734 2154
 	$settings = array_merge($settings,array('globalInstalled' => 'TRUE'));
1735 2155
 
1736
-	if ($error == '') settings::modify_settings($settings);
1737
-	if ($error == '') settings::comment_settings($settings_comment);
2156
+	if ($error == '') {
2157
+		settings::modify_settings($settings);
2158
+	}
2159
+	if ($error == '') {
2160
+		settings::comment_settings($settings_comment);
2161
+	}
1738 2162
 	if ($error != '') {
1739 2163
 		print '<div class="info column">'.$error.'</div>';
1740 2164
 		require('../footer.php');
1741 2165
 		exit;
1742 2166
 	} else {
1743
-		if (isset($_POST['waypoints']) && $_POST['waypoints'] == 'waypoints') $_SESSION['waypoints'] = 1;
1744
-		if (isset($_POST['owner']) && $_POST['owner'] == 'owner') $_SESSION['owner'] = 1;
2167
+		if (isset($_POST['waypoints']) && $_POST['waypoints'] == 'waypoints') {
2168
+			$_SESSION['waypoints'] = 1;
2169
+		}
2170
+		if (isset($_POST['owner']) && $_POST['owner'] == 'owner') {
2171
+			$_SESSION['owner'] = 1;
2172
+		}
1745 2173
 		if (isset($_POST['createdb'])) {
1746 2174
 			$_SESSION['install'] = 'database_create';
1747 2175
 		} else {
@@ -1778,10 +2206,18 @@  discard block
 block discarded – undo
1778 2206
 	$popw = false;
1779 2207
 	foreach ($_SESSION['done'] as $done) {
1780 2208
 	    print '<li>'.$done.'....<strong>SUCCESS</strong></li>';
1781
-	    if ($done == 'Create database') $pop = true;
1782
-	    if ($_SESSION['install'] == 'database_create') $pop = true;
1783
-	    if ($_SESSION['install'] == 'database_import') $popi = true;
1784
-	    if ($_SESSION['install'] == 'waypoints') $popw = true;
2209
+	    if ($done == 'Create database') {
2210
+	    	$pop = true;
2211
+	    }
2212
+	    if ($_SESSION['install'] == 'database_create') {
2213
+	    	$pop = true;
2214
+	    }
2215
+	    if ($_SESSION['install'] == 'database_import') {
2216
+	    	$popi = true;
2217
+	    }
2218
+	    if ($_SESSION['install'] == 'waypoints') {
2219
+	    	$popw = true;
2220
+	    }
1785 2221
 	}
1786 2222
 	if ($pop) {
1787 2223
 	    sleep(5);
@@ -1792,7 +2228,9 @@  discard block
 block discarded – undo
1792 2228
 	} else if ($popw) {
1793 2229
 	    sleep(5);
1794 2230
 	    print '<li>Populate waypoints database....<img src="../images/loading.gif" /></li>';
1795
-	} else print '<li>Update schema if needed....<img src="../images/loading.gif" /></li>';
2231
+	} else {
2232
+		print '<li>Update schema if needed....<img src="../images/loading.gif" /></li>';
2233
+	}
1796 2234
 	print '</div></ul>';
1797 2235
 	print '<div id="error"></div>';
1798 2236
 /*	foreach ($_SESSION['done'] as $done) {
Please login to merge, or discard this patch.
require/class.TrackerImport.php 3 patches
Indentation   +174 added lines, -174 removed lines patch added patch discarded remove patch
@@ -7,16 +7,16 @@  discard block
 block discarded – undo
7 7
 require_once(dirname(__FILE__).'/class.Source.php');
8 8
 
9 9
 class TrackerImport {
10
-    private $all_tracked = array();
11
-    private $last_delete_hourly = 0;
12
-    private $last_delete = 0;
13
-    private $stats = array();
14
-    private $tmd = 0;
15
-    private $source_location = array();
16
-    public $db = null;
17
-    public $nb = 0;
10
+	private $all_tracked = array();
11
+	private $last_delete_hourly = 0;
12
+	private $last_delete = 0;
13
+	private $stats = array();
14
+	private $tmd = 0;
15
+	private $source_location = array();
16
+	public $db = null;
17
+	public $nb = 0;
18 18
 
19
-    public function __construct($dbc = null) {
19
+	public function __construct($dbc = null) {
20 20
 	global $globalBeta;
21 21
 	$Connection = new Connection($dbc);
22 22
 	$this->db = $Connection->db();
@@ -38,50 +38,50 @@  discard block
 block discarded – undo
38 38
 	    }
39 39
 	}
40 40
 	*/
41
-    }
41
+	}
42 42
 
43
-    public function checkAll() {
43
+	public function checkAll() {
44 44
 	global $globalDebug;
45 45
 	if ($globalDebug) echo "Update last seen tracked data...\n";
46 46
 	foreach ($this->all_tracked as $key => $flight) {
47
-	    if (isset($this->all_tracked[$key]['id'])) {
47
+		if (isset($this->all_tracked[$key]['id'])) {
48 48
 		//echo $this->all_tracked[$key]['id'].' - '.$this->all_tracked[$key]['latitude'].'  '.$this->all_tracked[$key]['longitude']."\n";
49
-    		$Tracker = new Tracker($this->db);
50
-        	$Tracker->updateLatestTrackerData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['altitude'],$this->all_tracked[$key]['speed'],$this->all_tracked[$key]['datetime']);
51
-            }
49
+			$Tracker = new Tracker($this->db);
50
+			$Tracker->updateLatestTrackerData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['altitude'],$this->all_tracked[$key]['speed'],$this->all_tracked[$key]['datetime']);
51
+			}
52
+	}
52 53
 	}
53
-    }
54 54
 
55
-    public function del() {
55
+	public function del() {
56 56
 	global $globalDebug;
57 57
 	// Delete old infos
58 58
 	if ($globalDebug) echo 'Delete old values and update latest data...'."\n";
59 59
 	foreach ($this->all_tracked as $key => $flight) {
60
-    	    if (isset($flight['lastupdate'])) {
61
-        	if ($flight['lastupdate'] < (time()-3000)) {
62
-            	    if (isset($this->all_tracked[$key]['id'])) {
63
-            		if ($globalDebug) echo "--- Delete old values with id ".$this->all_tracked[$key]['id']."\n";
60
+			if (isset($flight['lastupdate'])) {
61
+			if ($flight['lastupdate'] < (time()-3000)) {
62
+					if (isset($this->all_tracked[$key]['id'])) {
63
+					if ($globalDebug) echo "--- Delete old values with id ".$this->all_tracked[$key]['id']."\n";
64 64
 			/*
65 65
 			$TrackerLive = new TrackerLive();
66 66
             		$TrackerLive->deleteLiveTrackerDataById($this->all_tracked[$key]['id']);
67 67
 			$TrackerLive->db = null;
68 68
 			*/
69
-            		//$real_arrival = $this->arrival($key);
70
-            		$Tracker = new Tracker($this->db);
71
-            		if ($this->all_tracked[$key]['latitude'] != '' && $this->all_tracked[$key]['longitude'] != '') {
69
+					//$real_arrival = $this->arrival($key);
70
+					$Tracker = new Tracker($this->db);
71
+					if ($this->all_tracked[$key]['latitude'] != '' && $this->all_tracked[$key]['longitude'] != '') {
72 72
 				$result = $Tracker->updateLatestTrackerData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['altitude'],$this->all_tracked[$key]['speed']);
73 73
 				if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n";
74 74
 			}
75 75
 			// Put in archive
76 76
 //			$Tracker->db = null;
77
-            	    }
78
-            	    unset($this->all_tracked[$key]);
79
-    	        }
80
-	    }
81
-        }
82
-    }
77
+					}
78
+					unset($this->all_tracked[$key]);
79
+				}
80
+		}
81
+		}
82
+	}
83 83
 
84
-    public function add($line) {
84
+	public function add($line) {
85 85
 	global $globalFork, $globalDistanceIgnore, $globalDaemon, $globalDebug, $globalCoordMinChangeTracker, $globalDebugTimeElapsed, $globalCenterLatitude, $globalCenterLongitude, $globalBeta, $globalSourcesupdate, $globalAllTracked;
86 86
 	if (!isset($globalCoordMinChangeTracker) || $globalCoordMinChangeTracker == '') $globalCoordMinChangeTracker = '0.015';
87 87
 	date_default_timezone_set('UTC');
@@ -90,47 +90,47 @@  discard block
 block discarded – undo
90 90
 	
91 91
 	// SBS format is CSV format
92 92
 	if(is_array($line) && isset($line['ident'])) {
93
-	    //print_r($line);
94
-  	    if (isset($line['ident'])) {
93
+		//print_r($line);
94
+  		if (isset($line['ident'])) {
95 95
 
96 96
 		
97 97
 		// Increment message number
98 98
 		if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE) {
99
-		    $current_date = date('Y-m-d');
100
-		    if (isset($line['source_name'])) $source = $line['source_name'];
101
-		    else $source = '';
102
-		    if ($source == '' || $line['format_source'] == 'aprs') $source = $line['format_source'];
103
-		    if (!isset($this->stats[$current_date][$source]['msg'])) {
104
-		    	$this->stats[$current_date][$source]['msg']['date'] = time();
105
-		    	$this->stats[$current_date][$source]['msg']['nb'] = 1;
106
-		    } else $this->stats[$current_date][$source]['msg']['nb'] += 1;
99
+			$current_date = date('Y-m-d');
100
+			if (isset($line['source_name'])) $source = $line['source_name'];
101
+			else $source = '';
102
+			if ($source == '' || $line['format_source'] == 'aprs') $source = $line['format_source'];
103
+			if (!isset($this->stats[$current_date][$source]['msg'])) {
104
+				$this->stats[$current_date][$source]['msg']['date'] = time();
105
+				$this->stats[$current_date][$source]['msg']['nb'] = 1;
106
+			} else $this->stats[$current_date][$source]['msg']['nb'] += 1;
107 107
 		}
108 108
 		
109 109
 		
110 110
 		$Common = new Common();
111
-	        if (!isset($line['id'])) $id = trim($line['ident']);
112
-	        else $id = trim($line['id']);
111
+			if (!isset($line['id'])) $id = trim($line['ident']);
112
+			else $id = trim($line['id']);
113 113
 		
114 114
 		if (!isset($this->all_tracked[$id])) {
115
-		    $this->all_tracked[$id] = array();
116
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('addedTracker' => 0));
117
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => '','latitude' => '', 'longitude' => '', 'speed' => '', 'altitude' => '', 'heading' => '', 'format_source' => '','source_name' => '','comment'=> '','type' => '','noarchive' => false,'putinarchive' => true,'over_country' => ''));
118
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('lastupdate' => time()));
119
-		    if (!isset($line['id'])) {
115
+			$this->all_tracked[$id] = array();
116
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('addedTracker' => 0));
117
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => '','latitude' => '', 'longitude' => '', 'speed' => '', 'altitude' => '', 'heading' => '', 'format_source' => '','source_name' => '','comment'=> '','type' => '','noarchive' => false,'putinarchive' => true,'over_country' => ''));
118
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('lastupdate' => time()));
119
+			if (!isset($line['id'])) {
120 120
 			if (!isset($globalDaemon)) $globalDaemon = TRUE;
121 121
 			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $id.'-'.date('YmdHi')));
122
-		     } else $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $line['id']));
123
-		    if ($globalAllTracked !== FALSE) $dataFound = true;
122
+			 } else $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $line['id']));
123
+			if ($globalAllTracked !== FALSE) $dataFound = true;
124 124
 		}
125 125
 		
126 126
 		if (isset($line['datetime']) && strtotime($line['datetime']) > time()-20*60 && strtotime($line['datetime']) < time()+20*60) {
127
-		    if (!isset($this->all_tracked[$id]['datetime']) || strtotime($line['datetime']) >= strtotime($this->all_tracked[$id]['datetime'])) {
127
+			if (!isset($this->all_tracked[$id]['datetime']) || strtotime($line['datetime']) >= strtotime($this->all_tracked[$id]['datetime'])) {
128 128
 			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('datetime' => $line['datetime']));
129
-		    } else {
129
+			} else {
130 130
 				if (strtotime($line['datetime']) == strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) echo "!!! Date is the same as previous data for ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."\n";
131 131
 				elseif (strtotime($line['datetime']) > strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) echo "!!! Date previous latest data (".$line['datetime']." > ".$this->all_tracked[$id]['datetime'].") !!! for ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."\n";
132 132
 				return '';
133
-		    }
133
+			}
134 134
 		} elseif (isset($line['datetime']) && strtotime($line['datetime']) < time()-20*60) {
135 135
 			if ($globalDebug) echo "!!! Date is too old ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."!!!\n";
136 136
 			return '';
@@ -147,38 +147,38 @@  discard block
 block discarded – undo
147 147
 		
148 148
 		//if (isset($line['ident']) && $line['ident'] != '' && $line['ident'] != '????????' && $line['ident'] != '00000000' && ($this->all_tracked[$id]['ident'] != trim($line['ident'])) && preg_match('/^[a-zA-Z0-9-]+$/', $line['ident'])) {
149 149
 		if (isset($line['ident']) && $line['ident'] != '' && $line['ident'] != '????????' && $line['ident'] != '00000000' && ($this->all_tracked[$id]['ident'] != trim($line['ident']))) {
150
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => trim($line['ident'])));
151
-		    if ($this->all_tracked[$id]['addedTracker'] == 1) {
150
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => trim($line['ident'])));
151
+			if ($this->all_tracked[$id]['addedTracker'] == 1) {
152 152
 			$timeelapsed = microtime(true);
153
-            		$Tracker = new Tracker($this->db);
154
-            		$fromsource = NULL;
155
-            		$result = $Tracker->updateIdentTrackerData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['ident'],$fromsource);
153
+					$Tracker = new Tracker($this->db);
154
+					$fromsource = NULL;
155
+					$result = $Tracker->updateIdentTrackerData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['ident'],$fromsource);
156 156
 			if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n";
157 157
 			$Tracker->db = null;
158 158
 			if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
159
-		    }
160
-		    if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident']));
159
+			}
160
+			if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident']));
161 161
 		}
162 162
 
163 163
 		if (isset($line['speed']) && $line['speed'] != '') {
164
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($line['speed'])));
165
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed_fromsrc' => true));
164
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($line['speed'])));
165
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed_fromsrc' => true));
166 166
 		} else if (!isset($this->all_tracked[$id]['speed_fromsrc']) && isset($this->all_tracked[$id]['time_last_coord']) && $this->all_tracked[$id]['time_last_coord'] != time() && isset($line['latitude']) && isset($line['longitude'])) {
167
-		    $distance = $Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m');
168
-		    if ($distance > 100 && $distance < 10000) {
167
+			$distance = $Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m');
168
+			if ($distance > 100 && $distance < 10000) {
169 169
 			$speed = $distance/(time() - $this->all_tracked[$id]['time_last_coord']);
170 170
 			$speed = $speed*3.6;
171 171
 			if ($speed < 1000) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($speed)));
172 172
   			if ($globalDebug) echo "ø Calculated Speed for ".$this->all_tracked[$id]['ident']." : ".$speed." - distance : ".$distance."\n";
173
-		    }
173
+			}
174 174
 		}
175 175
 
176
-	        if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) {
177
-	    	    if (isset($this->all_tracked[$id]['time_last_coord'])) $timediff = round(time()-$this->all_tracked[$id]['time_last_coord']);
178
-	    	    else unset($timediff);
179
-	    	    if ($this->tmd > 5 || !isset($timediff) || $timediff > 90 || ($timediff > 60 && isset($this->all_tracked[$id]['latitude']) && isset($this->all_tracked[$id]['longitude']) && $Common->withinThreshold($timediff,$Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')))) {
176
+			if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) {
177
+				if (isset($this->all_tracked[$id]['time_last_coord'])) $timediff = round(time()-$this->all_tracked[$id]['time_last_coord']);
178
+				else unset($timediff);
179
+				if ($this->tmd > 5 || !isset($timediff) || $timediff > 90 || ($timediff > 60 && isset($this->all_tracked[$id]['latitude']) && isset($this->all_tracked[$id]['longitude']) && $Common->withinThreshold($timediff,$Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')))) {
180 180
 			if (isset($this->all_tracked[$id]['archive_latitude']) && isset($this->all_tracked[$id]['archive_longitude']) && isset($this->all_tracked[$id]['livedb_latitude']) && isset($this->all_tracked[$id]['livedb_longitude'])) {
181
-			    if (!$Common->checkLine($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['livedb_latitude'],$this->all_tracked[$id]['livedb_longitude'],$line['latitude'],$line['longitude'],0.08)) {
181
+				if (!$Common->checkLine($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['livedb_latitude'],$this->all_tracked[$id]['livedb_longitude'],$line['latitude'],$line['longitude'],0.08)) {
182 182
 				$this->all_tracked[$id]['archive_latitude'] = $line['latitude'];
183 183
 				$this->all_tracked[$id]['archive_longitude'] = $line['longitude'];
184 184
 				$this->all_tracked[$id]['putinarchive'] = true;
@@ -192,30 +192,30 @@  discard block
 block discarded – undo
192 192
 				if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
193 193
 				$this->tmd = 0;
194 194
 				if ($globalDebug) echo 'FOUND : '.$this->all_tracked[$id]['over_country'].' ---------------'."\n";
195
-			    }
195
+				}
196 196
 			}
197 197
 
198 198
 			if (isset($line['latitude']) && $line['latitude'] != '' && $line['latitude'] != 0 && $line['latitude'] < 91 && $line['latitude'] > -90) {
199 199
 				if (!isset($this->all_tracked[$id]['archive_latitude'])) $this->all_tracked[$id]['archive_latitude'] = $line['latitude'];
200 200
 				if (!isset($this->all_tracked[$id]['livedb_latitude']) || abs($this->all_tracked[$id]['livedb_latitude']-$line['latitude']) > $globalCoordMinChangeTracker || $this->all_tracked[$id]['format_source'] == 'aprs') {
201
-				    $this->all_tracked[$id]['livedb_latitude'] = $line['latitude'];
202
-				    $dataFound = true;
203
-				    $this->all_tracked[$id]['time_last_coord'] = time();
201
+					$this->all_tracked[$id]['livedb_latitude'] = $line['latitude'];
202
+					$dataFound = true;
203
+					$this->all_tracked[$id]['time_last_coord'] = time();
204 204
 				}
205 205
 				$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('latitude' => $line['latitude']));
206 206
 			}
207 207
 			if (isset($line['longitude']) && $line['longitude'] != '' && $line['longitude'] != 0 && $line['longitude'] < 360 && $line['longitude'] > -180) {
208
-			    if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360;
208
+				if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360;
209 209
 				if (!isset($this->all_tracked[$id]['archive_longitude'])) $this->all_tracked[$id]['archive_longitude'] = $line['longitude'];
210 210
 				if (!isset($this->all_tracked[$id]['livedb_longitude']) || abs($this->all_tracked[$id]['livedb_longitude']-$line['longitude']) > $globalCoordMinChangeTracker || $this->all_tracked[$id]['format_source'] == 'aprs') {
211
-				    $this->all_tracked[$id]['livedb_longitude'] = $line['longitude'];
212
-				    $dataFound = true;
213
-				    $this->all_tracked[$id]['time_last_coord'] = time();
211
+					$this->all_tracked[$id]['livedb_longitude'] = $line['longitude'];
212
+					$dataFound = true;
213
+					$this->all_tracked[$id]['time_last_coord'] = time();
214 214
 				}
215 215
 				$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('longitude' => $line['longitude']));
216 216
 			}
217 217
 
218
-		    } else if ($globalDebug && $timediff > 20) {
218
+			} else if ($globalDebug && $timediff > 20) {
219 219
 			$this->tmd = $this->tmd + 1;
220 220
 			if ($line['latitude'] != $this->all_tracked[$id]['latitude'] && $line['longitude'] != $this->all_tracked[$id]['longitude']) {
221 221
 				echo '!!! Too much distance in short time... for '.$this->all_tracked[$id]['ident']."\n";
@@ -223,131 +223,131 @@  discard block
 block discarded – undo
223 223
 				echo 'Speed : '.(($Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')/$timediff)*3.6)." km/h - ";
224 224
 				echo 'Lat : '.$line['latitude'].' - long : '.$line['longitude'].' - prev lat : '.$this->all_tracked[$id]['latitude'].' - prev long : '.$this->all_tracked[$id]['longitude']." \n";
225 225
 			}
226
-		    }
226
+			}
227 227
 		}
228 228
 		if (isset($line['last_update']) && $line['last_update'] != '') {
229
-		    if (isset($this->all_tracked[$id]['last_update']) && $this->all_tracked[$id]['last_update'] != $line['last_update']) $dataFound = true;
230
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('last_update' => $line['last_update']));
229
+			if (isset($this->all_tracked[$id]['last_update']) && $this->all_tracked[$id]['last_update'] != $line['last_update']) $dataFound = true;
230
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('last_update' => $line['last_update']));
231 231
 		}
232 232
 		if (isset($line['format_source']) && $line['format_source'] != '') {
233
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('format_source' => $line['format_source']));
233
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('format_source' => $line['format_source']));
234 234
 		}
235 235
 		if (isset($line['source_name']) && $line['source_name'] != '') {
236
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('source_name' => $line['source_name']));
236
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('source_name' => $line['source_name']));
237 237
 		}
238 238
 		if (isset($line['comment']) && $line['comment'] != '') {
239
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('comment' => $line['comment']));
240
-		    //$dataFound = true;
239
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('comment' => $line['comment']));
240
+			//$dataFound = true;
241 241
 		}
242 242
 		if (isset($line['type']) && $line['type'] != '') {
243
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('type' => $line['type']));
244
-		    //$dataFound = true;
243
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('type' => $line['type']));
244
+			//$dataFound = true;
245 245
 		}
246 246
 
247 247
 		if (isset($line['altitude']) && $line['altitude'] != '') {
248
-		    //if (!isset($this->all_tracked[$id]['altitude']) || $this->all_tracked[$id]['altitude'] == '' || ($this->all_tracked[$id]['altitude'] > 0 && $line['altitude'] != 0)) {
248
+			//if (!isset($this->all_tracked[$id]['altitude']) || $this->all_tracked[$id]['altitude'] == '' || ($this->all_tracked[$id]['altitude'] > 0 && $line['altitude'] != 0)) {
249 249
 			if (is_int($this->all_tracked[$id]['altitude']) && abs(round($line['altitude']/100)-$this->all_tracked[$id]['altitude']) > 3) $this->all_tracked[$id]['putinarchive'] = true;
250 250
 			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('altitude' => $line['altitude']));
251 251
 			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('altitude_real' => $line['altitude']));
252 252
 			//$dataFound = true;
253
-		    //} elseif ($globalDebug) echo "!!! Strange altitude data... not added.\n";
253
+			//} elseif ($globalDebug) echo "!!! Strange altitude data... not added.\n";
254 254
   		}
255 255
 
256 256
 		if (isset($line['noarchive']) && $line['noarchive'] === true) {
257
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('noarchive' => true));
257
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('noarchive' => true));
258 258
 		}
259 259
 		
260 260
 		if (isset($line['heading']) && $line['heading'] != '') {
261
-		    if (is_int($this->all_tracked[$id]['heading']) && abs($this->all_tracked[$id]['heading']-round($line['heading'])) > 10) $this->all_tracked[$id]['putinarchive'] = true;
262
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($line['heading'])));
263
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading_fromsrc' => true));
264
-		    //$dataFound = true;
261
+			if (is_int($this->all_tracked[$id]['heading']) && abs($this->all_tracked[$id]['heading']-round($line['heading'])) > 10) $this->all_tracked[$id]['putinarchive'] = true;
262
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($line['heading'])));
263
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading_fromsrc' => true));
264
+			//$dataFound = true;
265 265
   		} elseif (!isset($this->all_tracked[$id]['heading_fromsrc']) && isset($this->all_tracked[$id]['archive_latitude']) && $this->all_tracked[$id]['archive_latitude'] != $this->all_tracked[$id]['latitude'] && isset($this->all_tracked[$id]['archive_longitude']) && $this->all_tracked[$id]['archive_longitude'] != $this->all_tracked[$id]['longitude']) {
266
-  		    $heading = $Common->getHeading($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude']);
267
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($heading)));
268
-		    if (abs($this->all_tracked[$id]['heading']-round($heading)) > 10) $this->all_tracked[$id]['putinarchive'] = true;
269
-  		    if ($globalDebug) echo "ø Calculated Heading for ".$this->all_tracked[$id]['ident']." : ".$heading."\n";
266
+  			$heading = $Common->getHeading($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude']);
267
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($heading)));
268
+			if (abs($this->all_tracked[$id]['heading']-round($heading)) > 10) $this->all_tracked[$id]['putinarchive'] = true;
269
+  			if ($globalDebug) echo "ø Calculated Heading for ".$this->all_tracked[$id]['ident']." : ".$heading."\n";
270 270
   		}
271 271
 		//if (isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_tracked[$id]['lastupdate']) && time()-$this->all_tracked[$id]['lastupdate'] < $globalSourcesupdate) $dataFound = false;
272 272
 
273 273
 		if ($dataFound === true && isset($this->all_tracked[$id]['ident'])) {
274
-		    $this->all_tracked[$id]['lastupdate'] = time();
275
-		    if ($this->all_tracked[$id]['addedTracker'] == 0) {
276
-		        if (!isset($globalDistanceIgnore['latitude']) || $this->all_tracked[$id]['longitude'] == ''  || $this->all_tracked[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) {
277
-			    if (!isset($this->all_tracked[$id]['forcenew']) || $this->all_tracked[$id]['forcenew'] == 0) {
274
+			$this->all_tracked[$id]['lastupdate'] = time();
275
+			if ($this->all_tracked[$id]['addedTracker'] == 0) {
276
+				if (!isset($globalDistanceIgnore['latitude']) || $this->all_tracked[$id]['longitude'] == ''  || $this->all_tracked[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) {
277
+				if (!isset($this->all_tracked[$id]['forcenew']) || $this->all_tracked[$id]['forcenew'] == 0) {
278 278
 				if ($globalDebug) echo "Check if aircraft is already in DB...";
279 279
 				$timeelapsed = microtime(true);
280 280
 				$TrackerLive = new TrackerLive($this->db);
281 281
 				if (isset($line['id'])) {
282
-				    $recent_ident = $TrackerLive->checkIdRecent($line['id']);
283
-				    if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
282
+					$recent_ident = $TrackerLive->checkIdRecent($line['id']);
283
+					if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
284 284
 				} elseif (isset($this->all_tracked[$id]['ident']) && $this->all_tracked[$id]['ident'] != '') {
285
-				    $recent_ident = $TrackerLive->checkIdentRecent($this->all_tracked[$id]['ident']);
286
-				    if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
285
+					$recent_ident = $TrackerLive->checkIdentRecent($this->all_tracked[$id]['ident']);
286
+					if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
287 287
 				} else $recent_ident = '';
288 288
 				$TrackerLive->db=null;
289 289
 
290 290
 				if ($globalDebug && $recent_ident == '') echo " Not in DB.\n";
291 291
 				elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n";
292
-			    } else {
292
+				} else {
293 293
 				$recent_ident = '';
294 294
 				$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('forcenew' => 0));
295
-			    }
296
-			    //if there was no aircraft with the same callsign within the last hour and go post it into the archive
297
-			    if($recent_ident == "")
298
-			    {
295
+				}
296
+				//if there was no aircraft with the same callsign within the last hour and go post it into the archive
297
+				if($recent_ident == "")
298
+				{
299 299
 				if ($globalDebug) echo "\o/ Add ".$this->all_tracked[$id]['ident']." in archive DB : ";
300 300
 				//adds the spotter data for the archive
301
-				    $highlight = '';
302
-				    if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident'].'-'.date('YmdHi')));
303
-				    $timeelapsed = microtime(true);
304
-				    $Tracker = new Tracker($this->db);
305
-				    $result = $Tracker->addTrackerData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['altitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['comment'],$this->all_tracked[$id]['type'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name']);
306
-				    $Tracker->db = null;
307
-				    if ($globalDebug && isset($result)) echo $result."\n";
308
-				    if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
301
+					$highlight = '';
302
+					if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident'].'-'.date('YmdHi')));
303
+					$timeelapsed = microtime(true);
304
+					$Tracker = new Tracker($this->db);
305
+					$result = $Tracker->addTrackerData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['altitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['comment'],$this->all_tracked[$id]['type'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name']);
306
+					$Tracker->db = null;
307
+					if ($globalDebug && isset($result)) echo $result."\n";
308
+					if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
309 309
 				    
310 310
 				    
311
-				    // Add source stat in DB
312
-				    $Stats = new Stats($this->db);
313
-				    if (!empty($this->stats)) {
311
+					// Add source stat in DB
312
+					$Stats = new Stats($this->db);
313
+					if (!empty($this->stats)) {
314 314
 					if ($globalDebug) echo 'Add source stats : ';
315
-				        foreach($this->stats as $date => $data) {
316
-					    foreach($data as $source => $sourced) {
317
-					        //print_r($sourced);
318
-				    	        if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar_tracker',$date);
319
-				    	        if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist_tracker',$date);
320
-				    		if (isset($sourced['msg'])) {
321
-				    		    if (time() - $sourced['msg']['date'] > 10) {
322
-				    		        $nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date']));
323
-				    		        echo $Stats->addStatSource($nbmsg,$source,'msg_tracker',$date);
324
-			    			        unset($this->stats[$date][$source]['msg']);
325
-			    			    }
326
-			    			}
327
-			    		    }
328
-			    		    if ($date != date('Y-m-d')) {
329
-			    			unset($this->stats[$date]);
330
-			    		    }
331
-				    	}
332
-				    	if ($globalDebug) echo 'Done'."\n";
315
+						foreach($this->stats as $date => $data) {
316
+						foreach($data as $source => $sourced) {
317
+							//print_r($sourced);
318
+								if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar_tracker',$date);
319
+								if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist_tracker',$date);
320
+							if (isset($sourced['msg'])) {
321
+								if (time() - $sourced['msg']['date'] > 10) {
322
+									$nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date']));
323
+									echo $Stats->addStatSource($nbmsg,$source,'msg_tracker',$date);
324
+									unset($this->stats[$date][$source]['msg']);
325
+								}
326
+							}
327
+							}
328
+							if ($date != date('Y-m-d')) {
329
+							unset($this->stats[$date]);
330
+							}
331
+						}
332
+						if ($globalDebug) echo 'Done'."\n";
333 333
 
334
-				    }
335
-				    $Stats->db = null;
334
+					}
335
+					$Stats->db = null;
336 336
 				    
337
-				    $this->del();
337
+					$this->del();
338 338
 				//$ignoreImport = false;
339 339
 				$this->all_tracked[$id]['addedTracker'] = 1;
340 340
 				//print_r($this->all_tracked[$id]);
341 341
 				if ($this->last_delete == 0 || time() - $this->last_delete > 1800) {
342
-				    if ($globalDebug) echo "---- Deleting Live Tracker data older than 9 hours...";
343
-				    //TrackerLive->deleteLiveTrackerDataNotUpdated();
344
-				    $TrackerLive = new TrackerLive($this->db);
345
-				    $TrackerLive->deleteLiveTrackerData();
346
-				    $TrackerLive->db=null;
347
-				    if ($globalDebug) echo " Done\n";
348
-				    $this->last_delete = time();
342
+					if ($globalDebug) echo "---- Deleting Live Tracker data older than 9 hours...";
343
+					//TrackerLive->deleteLiveTrackerDataNotUpdated();
344
+					$TrackerLive = new TrackerLive($this->db);
345
+					$TrackerLive->deleteLiveTrackerData();
346
+					$TrackerLive->db=null;
347
+					if ($globalDebug) echo " Done\n";
348
+					$this->last_delete = time();
349 349
 				}
350
-			    } else {
350
+				} else {
351 351
 				$this->all_tracked[$id]['id'] = $recent_ident;
352 352
 				$this->all_tracked[$id]['addedTracker'] = 1;
353 353
 				if (isset($globalDaemon) && !$globalDaemon) {
@@ -356,16 +356,16 @@  discard block
 block discarded – undo
356 356
 					$Tracker->db = null;
357 357
 				}
358 358
 				
359
-			    }
359
+				}
360 360
 			}
361
-		    }
362
-		    //adds the spotter LIVE data
363
-		    if ($globalDebug) {
361
+			}
362
+			//adds the spotter LIVE data
363
+			if ($globalDebug) {
364 364
 			echo 'DATA : ident : '.$this->all_tracked[$id]['ident'].' - type : '.$this->all_tracked[$id]['type'].' - Latitude : '.$this->all_tracked[$id]['latitude'].' - Longitude : '.$this->all_tracked[$id]['longitude'].' - Altitude : '.$this->all_tracked[$id]['altitude'].' - Heading : '.$this->all_tracked[$id]['heading'].' - Speed : '.$this->all_tracked[$id]['speed']."\n";
365
-		    }
366
-		    $ignoreImport = false;
365
+			}
366
+			$ignoreImport = false;
367 367
 
368
-		    if (!$ignoreImport) {
368
+			if (!$ignoreImport) {
369 369
 			if (!isset($globalDistanceIgnore['latitude']) || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) {
370 370
 				if ($globalDebug) echo "\o/ Add ".$this->all_tracked[$id]['ident']." from ".$this->all_tracked[$id]['format_source']." in Live DB : ";
371 371
 				$timeelapsed = microtime(true);
@@ -403,7 +403,7 @@  discard block
 block discarded – undo
403 403
 					if ($stats_heading == 16) $stats_heading = 0;
404 404
 					if (!isset($this->stats[$current_date][$source]['polar'][1])) {
405 405
 						for ($i=0;$i<=15;$i++) {
406
-						    $this->stats[$current_date][$source]['polar'][$i] = 0;
406
+							$this->stats[$current_date][$source]['polar'][$i] = 0;
407 407
 						}
408 408
 						$this->stats[$current_date][$source]['polar'][$stats_heading] = $stats_distance;
409 409
 					} else {
@@ -416,11 +416,11 @@  discard block
 block discarded – undo
416 416
 					//var_dump($this->stats);
417 417
 					if (!isset($this->stats[$current_date][$source]['hist'][$distance])) {
418 418
 						if (isset($this->stats[$current_date][$source]['hist'][0])) {
419
-						    end($this->stats[$current_date][$source]['hist']);
420
-						    $mini = key($this->stats[$current_date][$source]['hist'])+10;
419
+							end($this->stats[$current_date][$source]['hist']);
420
+							$mini = key($this->stats[$current_date][$source]['hist'])+10;
421 421
 						} else $mini = 0;
422 422
 						for ($i=$mini;$i<=$distance;$i+=10) {
423
-						    $this->stats[$current_date][$source]['hist'][$i] = 0;
423
+							$this->stats[$current_date][$source]['hist'][$i] = 0;
424 424
 						}
425 425
 						$this->stats[$current_date][$source]['hist'][$distance] = 1;
426 426
 					} else {
@@ -436,22 +436,22 @@  discard block
 block discarded – undo
436 436
 			
437 437
 			
438 438
 			if ($this->last_delete_hourly == 0 || time() - $this->last_delete_hourly > 900) {
439
-			    if ($globalDebug) echo "---- Deleting Live Tracker data Not updated since 2 hour...";
440
-			    $TrackerLive = new TrackerLive($this->db);
441
-			    $TrackerLive->deleteLiveTrackerDataNotUpdated();
442
-			    $TrackerLive->db = null;
443
-			    //TrackerLive->deleteLiveTrackerData();
444
-			    if ($globalDebug) echo " Done\n";
445
-			    $this->last_delete_hourly = time();
439
+				if ($globalDebug) echo "---- Deleting Live Tracker data Not updated since 2 hour...";
440
+				$TrackerLive = new TrackerLive($this->db);
441
+				$TrackerLive->deleteLiveTrackerDataNotUpdated();
442
+				$TrackerLive->db = null;
443
+				//TrackerLive->deleteLiveTrackerData();
444
+				if ($globalDebug) echo " Done\n";
445
+				$this->last_delete_hourly = time();
446 446
 			}
447 447
 			
448
-		    }
449
-		    //$ignoreImport = false;
448
+			}
449
+			//$ignoreImport = false;
450 450
 		}
451 451
 		//if (function_exists('pcntl_fork') && $globalFork) pcntl_signal(SIGCHLD, SIG_IGN);
452 452
 		if ($send) return $this->all_tracked[$id];
453
-	    }
453
+		}
454
+	}
454 455
 	}
455
-    }
456 456
 }
457 457
 ?>
Please login to merge, or discard this patch.
Spacing   +74 added lines, -74 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 	    if (isset($this->all_tracked[$key]['id'])) {
48 48
 		//echo $this->all_tracked[$key]['id'].' - '.$this->all_tracked[$key]['latitude'].'  '.$this->all_tracked[$key]['longitude']."\n";
49 49
     		$Tracker = new Tracker($this->db);
50
-        	$Tracker->updateLatestTrackerData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['altitude'],$this->all_tracked[$key]['speed'],$this->all_tracked[$key]['datetime']);
50
+        	$Tracker->updateLatestTrackerData($this->all_tracked[$key]['id'], $this->all_tracked[$key]['ident'], $this->all_tracked[$key]['latitude'], $this->all_tracked[$key]['longitude'], $this->all_tracked[$key]['altitude'], $this->all_tracked[$key]['speed'], $this->all_tracked[$key]['datetime']);
51 51
             }
52 52
 	}
53 53
     }
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 	if ($globalDebug) echo 'Delete old values and update latest data...'."\n";
59 59
 	foreach ($this->all_tracked as $key => $flight) {
60 60
     	    if (isset($flight['lastupdate'])) {
61
-        	if ($flight['lastupdate'] < (time()-3000)) {
61
+        	if ($flight['lastupdate'] < (time() - 3000)) {
62 62
             	    if (isset($this->all_tracked[$key]['id'])) {
63 63
             		if ($globalDebug) echo "--- Delete old values with id ".$this->all_tracked[$key]['id']."\n";
64 64
 			/*
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
             		//$real_arrival = $this->arrival($key);
70 70
             		$Tracker = new Tracker($this->db);
71 71
             		if ($this->all_tracked[$key]['latitude'] != '' && $this->all_tracked[$key]['longitude'] != '') {
72
-				$result = $Tracker->updateLatestTrackerData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['altitude'],$this->all_tracked[$key]['speed']);
72
+				$result = $Tracker->updateLatestTrackerData($this->all_tracked[$key]['id'], $this->all_tracked[$key]['ident'], $this->all_tracked[$key]['latitude'], $this->all_tracked[$key]['longitude'], $this->all_tracked[$key]['altitude'], $this->all_tracked[$key]['speed']);
73 73
 				if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n";
74 74
 			}
75 75
 			// Put in archive
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
 	$send = false;
90 90
 	
91 91
 	// SBS format is CSV format
92
-	if(is_array($line) && isset($line['ident'])) {
92
+	if (is_array($line) && isset($line['ident'])) {
93 93
 	    //print_r($line);
94 94
   	    if (isset($line['ident'])) {
95 95
 
@@ -113,33 +113,33 @@  discard block
 block discarded – undo
113 113
 		
114 114
 		if (!isset($this->all_tracked[$id])) {
115 115
 		    $this->all_tracked[$id] = array();
116
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('addedTracker' => 0));
117
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => '','latitude' => '', 'longitude' => '', 'speed' => '', 'altitude' => '', 'heading' => '', 'format_source' => '','source_name' => '','comment'=> '','type' => '','noarchive' => false,'putinarchive' => true,'over_country' => ''));
118
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('lastupdate' => time()));
116
+		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('addedTracker' => 0));
117
+		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('ident' => '', 'latitude' => '', 'longitude' => '', 'speed' => '', 'altitude' => '', 'heading' => '', 'format_source' => '', 'source_name' => '', 'comment'=> '', 'type' => '', 'noarchive' => false, 'putinarchive' => true, 'over_country' => ''));
118
+		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('lastupdate' => time()));
119 119
 		    if (!isset($line['id'])) {
120 120
 			if (!isset($globalDaemon)) $globalDaemon = TRUE;
121
-			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $id.'-'.date('YmdHi')));
122
-		     } else $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $line['id']));
121
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('id' => $id.'-'.date('YmdHi')));
122
+		     } else $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('id' => $line['id']));
123 123
 		    if ($globalAllTracked !== FALSE) $dataFound = true;
124 124
 		}
125 125
 		
126
-		if (isset($line['datetime']) && strtotime($line['datetime']) > time()-20*60 && strtotime($line['datetime']) < time()+20*60) {
126
+		if (isset($line['datetime']) && strtotime($line['datetime']) > time() - 20*60 && strtotime($line['datetime']) < time() + 20*60) {
127 127
 		    if (!isset($this->all_tracked[$id]['datetime']) || strtotime($line['datetime']) >= strtotime($this->all_tracked[$id]['datetime'])) {
128
-			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('datetime' => $line['datetime']));
128
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('datetime' => $line['datetime']));
129 129
 		    } else {
130 130
 				if (strtotime($line['datetime']) == strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) echo "!!! Date is the same as previous data for ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."\n";
131 131
 				elseif (strtotime($line['datetime']) > strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) echo "!!! Date previous latest data (".$line['datetime']." > ".$this->all_tracked[$id]['datetime'].") !!! for ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."\n";
132 132
 				return '';
133 133
 		    }
134
-		} elseif (isset($line['datetime']) && strtotime($line['datetime']) < time()-20*60) {
134
+		} elseif (isset($line['datetime']) && strtotime($line['datetime']) < time() - 20*60) {
135 135
 			if ($globalDebug) echo "!!! Date is too old ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."!!!\n";
136 136
 			return '';
137
-		} elseif (isset($line['datetime']) && strtotime($line['datetime']) > time()+20*60) {
137
+		} elseif (isset($line['datetime']) && strtotime($line['datetime']) > time() + 20*60) {
138 138
 			if ($globalDebug) echo "!!! Date is in the future ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."!!!\n";
139 139
 			return '';
140 140
 		} elseif (!isset($line['datetime'])) {
141 141
 			date_default_timezone_set('UTC');
142
-			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('datetime' => date('Y-m-d H:i:s')));
142
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('datetime' => date('Y-m-d H:i:s')));
143 143
 		} else {
144 144
 			if ($globalDebug) echo "!!! Unknow date error ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."!!!\n";
145 145
 			return '';
@@ -147,38 +147,38 @@  discard block
 block discarded – undo
147 147
 		
148 148
 		//if (isset($line['ident']) && $line['ident'] != '' && $line['ident'] != '????????' && $line['ident'] != '00000000' && ($this->all_tracked[$id]['ident'] != trim($line['ident'])) && preg_match('/^[a-zA-Z0-9-]+$/', $line['ident'])) {
149 149
 		if (isset($line['ident']) && $line['ident'] != '' && $line['ident'] != '????????' && $line['ident'] != '00000000' && ($this->all_tracked[$id]['ident'] != trim($line['ident']))) {
150
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => trim($line['ident'])));
150
+		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('ident' => trim($line['ident'])));
151 151
 		    if ($this->all_tracked[$id]['addedTracker'] == 1) {
152 152
 			$timeelapsed = microtime(true);
153 153
             		$Tracker = new Tracker($this->db);
154 154
             		$fromsource = NULL;
155
-            		$result = $Tracker->updateIdentTrackerData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['ident'],$fromsource);
155
+            		$result = $Tracker->updateIdentTrackerData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $fromsource);
156 156
 			if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n";
157 157
 			$Tracker->db = null;
158
-			if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
158
+			if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
159 159
 		    }
160
-		    if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident']));
160
+		    if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('id' => $this->all_tracked[$id]['ident']));
161 161
 		}
162 162
 
163 163
 		if (isset($line['speed']) && $line['speed'] != '') {
164
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($line['speed'])));
165
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed_fromsrc' => true));
164
+		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('speed' => round($line['speed'])));
165
+		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('speed_fromsrc' => true));
166 166
 		} else if (!isset($this->all_tracked[$id]['speed_fromsrc']) && isset($this->all_tracked[$id]['time_last_coord']) && $this->all_tracked[$id]['time_last_coord'] != time() && isset($line['latitude']) && isset($line['longitude'])) {
167
-		    $distance = $Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m');
167
+		    $distance = $Common->distance($line['latitude'], $line['longitude'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], 'm');
168 168
 		    if ($distance > 100 && $distance < 10000) {
169 169
 			$speed = $distance/(time() - $this->all_tracked[$id]['time_last_coord']);
170 170
 			$speed = $speed*3.6;
171
-			if ($speed < 1000) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($speed)));
171
+			if ($speed < 1000) $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('speed' => round($speed)));
172 172
   			if ($globalDebug) echo "ø Calculated Speed for ".$this->all_tracked[$id]['ident']." : ".$speed." - distance : ".$distance."\n";
173 173
 		    }
174 174
 		}
175 175
 
176 176
 	        if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) {
177
-	    	    if (isset($this->all_tracked[$id]['time_last_coord'])) $timediff = round(time()-$this->all_tracked[$id]['time_last_coord']);
177
+	    	    if (isset($this->all_tracked[$id]['time_last_coord'])) $timediff = round(time() - $this->all_tracked[$id]['time_last_coord']);
178 178
 	    	    else unset($timediff);
179
-	    	    if ($this->tmd > 5 || !isset($timediff) || $timediff > 90 || ($timediff > 60 && isset($this->all_tracked[$id]['latitude']) && isset($this->all_tracked[$id]['longitude']) && $Common->withinThreshold($timediff,$Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')))) {
179
+	    	    if ($this->tmd > 5 || !isset($timediff) || $timediff > 90 || ($timediff > 60 && isset($this->all_tracked[$id]['latitude']) && isset($this->all_tracked[$id]['longitude']) && $Common->withinThreshold($timediff, $Common->distance($line['latitude'], $line['longitude'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], 'm')))) {
180 180
 			if (isset($this->all_tracked[$id]['archive_latitude']) && isset($this->all_tracked[$id]['archive_longitude']) && isset($this->all_tracked[$id]['livedb_latitude']) && isset($this->all_tracked[$id]['livedb_longitude'])) {
181
-			    if (!$Common->checkLine($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['livedb_latitude'],$this->all_tracked[$id]['livedb_longitude'],$line['latitude'],$line['longitude'],0.08)) {
181
+			    if (!$Common->checkLine($this->all_tracked[$id]['archive_latitude'], $this->all_tracked[$id]['archive_longitude'], $this->all_tracked[$id]['livedb_latitude'], $this->all_tracked[$id]['livedb_longitude'], $line['latitude'], $line['longitude'], 0.08)) {
182 182
 				$this->all_tracked[$id]['archive_latitude'] = $line['latitude'];
183 183
 				$this->all_tracked[$id]['archive_longitude'] = $line['longitude'];
184 184
 				$this->all_tracked[$id]['putinarchive'] = true;
@@ -186,10 +186,10 @@  discard block
 block discarded – undo
186 186
 				if ($globalDebug) echo "\n".' ------- Check Country for '.$this->all_tracked[$id]['ident'].' with latitude : '.$line['latitude'].' and longitude : '.$line['longitude'].'.... ';
187 187
 				$timeelapsed = microtime(true);
188 188
 				$Tracker = new Tracker($this->db);
189
-				$all_country = $Tracker->getCountryFromLatitudeLongitude($line['latitude'],$line['longitude']);
189
+				$all_country = $Tracker->getCountryFromLatitudeLongitude($line['latitude'], $line['longitude']);
190 190
 				if (!empty($all_country)) $this->all_tracked[$id]['over_country'] = $all_country['iso2'];
191 191
 				$Tracker->db = null;
192
-				if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
192
+				if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
193 193
 				$this->tmd = 0;
194 194
 				if ($globalDebug) echo 'FOUND : '.$this->all_tracked[$id]['over_country'].' ---------------'."\n";
195 195
 			    }
@@ -197,75 +197,75 @@  discard block
 block discarded – undo
197 197
 
198 198
 			if (isset($line['latitude']) && $line['latitude'] != '' && $line['latitude'] != 0 && $line['latitude'] < 91 && $line['latitude'] > -90) {
199 199
 				if (!isset($this->all_tracked[$id]['archive_latitude'])) $this->all_tracked[$id]['archive_latitude'] = $line['latitude'];
200
-				if (!isset($this->all_tracked[$id]['livedb_latitude']) || abs($this->all_tracked[$id]['livedb_latitude']-$line['latitude']) > $globalCoordMinChangeTracker || $this->all_tracked[$id]['format_source'] == 'aprs') {
200
+				if (!isset($this->all_tracked[$id]['livedb_latitude']) || abs($this->all_tracked[$id]['livedb_latitude'] - $line['latitude']) > $globalCoordMinChangeTracker || $this->all_tracked[$id]['format_source'] == 'aprs') {
201 201
 				    $this->all_tracked[$id]['livedb_latitude'] = $line['latitude'];
202 202
 				    $dataFound = true;
203 203
 				    $this->all_tracked[$id]['time_last_coord'] = time();
204 204
 				}
205
-				$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('latitude' => $line['latitude']));
205
+				$this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('latitude' => $line['latitude']));
206 206
 			}
207 207
 			if (isset($line['longitude']) && $line['longitude'] != '' && $line['longitude'] != 0 && $line['longitude'] < 360 && $line['longitude'] > -180) {
208 208
 			    if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360;
209 209
 				if (!isset($this->all_tracked[$id]['archive_longitude'])) $this->all_tracked[$id]['archive_longitude'] = $line['longitude'];
210
-				if (!isset($this->all_tracked[$id]['livedb_longitude']) || abs($this->all_tracked[$id]['livedb_longitude']-$line['longitude']) > $globalCoordMinChangeTracker || $this->all_tracked[$id]['format_source'] == 'aprs') {
210
+				if (!isset($this->all_tracked[$id]['livedb_longitude']) || abs($this->all_tracked[$id]['livedb_longitude'] - $line['longitude']) > $globalCoordMinChangeTracker || $this->all_tracked[$id]['format_source'] == 'aprs') {
211 211
 				    $this->all_tracked[$id]['livedb_longitude'] = $line['longitude'];
212 212
 				    $dataFound = true;
213 213
 				    $this->all_tracked[$id]['time_last_coord'] = time();
214 214
 				}
215
-				$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('longitude' => $line['longitude']));
215
+				$this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('longitude' => $line['longitude']));
216 216
 			}
217 217
 
218 218
 		    } else if ($globalDebug && $timediff > 20) {
219 219
 			$this->tmd = $this->tmd + 1;
220 220
 			if ($line['latitude'] != $this->all_tracked[$id]['latitude'] && $line['longitude'] != $this->all_tracked[$id]['longitude']) {
221 221
 				echo '!!! Too much distance in short time... for '.$this->all_tracked[$id]['ident']."\n";
222
-				echo 'Time : '.$timediff.'s - Distance : '.$Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')."m -";
223
-				echo 'Speed : '.(($Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')/$timediff)*3.6)." km/h - ";
222
+				echo 'Time : '.$timediff.'s - Distance : '.$Common->distance($line['latitude'], $line['longitude'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], 'm')."m -";
223
+				echo 'Speed : '.(($Common->distance($line['latitude'], $line['longitude'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], 'm')/$timediff)*3.6)." km/h - ";
224 224
 				echo 'Lat : '.$line['latitude'].' - long : '.$line['longitude'].' - prev lat : '.$this->all_tracked[$id]['latitude'].' - prev long : '.$this->all_tracked[$id]['longitude']." \n";
225 225
 			}
226 226
 		    }
227 227
 		}
228 228
 		if (isset($line['last_update']) && $line['last_update'] != '') {
229 229
 		    if (isset($this->all_tracked[$id]['last_update']) && $this->all_tracked[$id]['last_update'] != $line['last_update']) $dataFound = true;
230
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('last_update' => $line['last_update']));
230
+		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('last_update' => $line['last_update']));
231 231
 		}
232 232
 		if (isset($line['format_source']) && $line['format_source'] != '') {
233
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('format_source' => $line['format_source']));
233
+		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('format_source' => $line['format_source']));
234 234
 		}
235 235
 		if (isset($line['source_name']) && $line['source_name'] != '') {
236
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('source_name' => $line['source_name']));
236
+		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('source_name' => $line['source_name']));
237 237
 		}
238 238
 		if (isset($line['comment']) && $line['comment'] != '') {
239
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('comment' => $line['comment']));
239
+		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('comment' => $line['comment']));
240 240
 		    //$dataFound = true;
241 241
 		}
242 242
 		if (isset($line['type']) && $line['type'] != '') {
243
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('type' => $line['type']));
243
+		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('type' => $line['type']));
244 244
 		    //$dataFound = true;
245 245
 		}
246 246
 
247 247
 		if (isset($line['altitude']) && $line['altitude'] != '') {
248 248
 		    //if (!isset($this->all_tracked[$id]['altitude']) || $this->all_tracked[$id]['altitude'] == '' || ($this->all_tracked[$id]['altitude'] > 0 && $line['altitude'] != 0)) {
249
-			if (is_int($this->all_tracked[$id]['altitude']) && abs(round($line['altitude']/100)-$this->all_tracked[$id]['altitude']) > 3) $this->all_tracked[$id]['putinarchive'] = true;
250
-			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('altitude' => $line['altitude']));
251
-			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('altitude_real' => $line['altitude']));
249
+			if (is_int($this->all_tracked[$id]['altitude']) && abs(round($line['altitude']/100) - $this->all_tracked[$id]['altitude']) > 3) $this->all_tracked[$id]['putinarchive'] = true;
250
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('altitude' => $line['altitude']));
251
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('altitude_real' => $line['altitude']));
252 252
 			//$dataFound = true;
253 253
 		    //} elseif ($globalDebug) echo "!!! Strange altitude data... not added.\n";
254 254
   		}
255 255
 
256 256
 		if (isset($line['noarchive']) && $line['noarchive'] === true) {
257
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('noarchive' => true));
257
+		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('noarchive' => true));
258 258
 		}
259 259
 		
260 260
 		if (isset($line['heading']) && $line['heading'] != '') {
261
-		    if (is_int($this->all_tracked[$id]['heading']) && abs($this->all_tracked[$id]['heading']-round($line['heading'])) > 10) $this->all_tracked[$id]['putinarchive'] = true;
262
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($line['heading'])));
263
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading_fromsrc' => true));
261
+		    if (is_int($this->all_tracked[$id]['heading']) && abs($this->all_tracked[$id]['heading'] - round($line['heading'])) > 10) $this->all_tracked[$id]['putinarchive'] = true;
262
+		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('heading' => round($line['heading'])));
263
+		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('heading_fromsrc' => true));
264 264
 		    //$dataFound = true;
265 265
   		} elseif (!isset($this->all_tracked[$id]['heading_fromsrc']) && isset($this->all_tracked[$id]['archive_latitude']) && $this->all_tracked[$id]['archive_latitude'] != $this->all_tracked[$id]['latitude'] && isset($this->all_tracked[$id]['archive_longitude']) && $this->all_tracked[$id]['archive_longitude'] != $this->all_tracked[$id]['longitude']) {
266
-  		    $heading = $Common->getHeading($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude']);
267
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($heading)));
268
-		    if (abs($this->all_tracked[$id]['heading']-round($heading)) > 10) $this->all_tracked[$id]['putinarchive'] = true;
266
+  		    $heading = $Common->getHeading($this->all_tracked[$id]['archive_latitude'], $this->all_tracked[$id]['archive_longitude'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude']);
267
+		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('heading' => round($heading)));
268
+		    if (abs($this->all_tracked[$id]['heading'] - round($heading)) > 10) $this->all_tracked[$id]['putinarchive'] = true;
269 269
   		    if ($globalDebug) echo "ø Calculated Heading for ".$this->all_tracked[$id]['ident']." : ".$heading."\n";
270 270
   		}
271 271
 		//if (isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_tracked[$id]['lastupdate']) && time()-$this->all_tracked[$id]['lastupdate'] < $globalSourcesupdate) $dataFound = false;
@@ -273,54 +273,54 @@  discard block
 block discarded – undo
273 273
 		if ($dataFound === true && isset($this->all_tracked[$id]['ident'])) {
274 274
 		    $this->all_tracked[$id]['lastupdate'] = time();
275 275
 		    if ($this->all_tracked[$id]['addedTracker'] == 0) {
276
-		        if (!isset($globalDistanceIgnore['latitude']) || $this->all_tracked[$id]['longitude'] == ''  || $this->all_tracked[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) {
276
+		        if (!isset($globalDistanceIgnore['latitude']) || $this->all_tracked[$id]['longitude'] == '' || $this->all_tracked[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $globalDistanceIgnore['latitude'], $globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) {
277 277
 			    if (!isset($this->all_tracked[$id]['forcenew']) || $this->all_tracked[$id]['forcenew'] == 0) {
278 278
 				if ($globalDebug) echo "Check if aircraft is already in DB...";
279 279
 				$timeelapsed = microtime(true);
280 280
 				$TrackerLive = new TrackerLive($this->db);
281 281
 				if (isset($line['id'])) {
282 282
 				    $recent_ident = $TrackerLive->checkIdRecent($line['id']);
283
-				    if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
283
+				    if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
284 284
 				} elseif (isset($this->all_tracked[$id]['ident']) && $this->all_tracked[$id]['ident'] != '') {
285 285
 				    $recent_ident = $TrackerLive->checkIdentRecent($this->all_tracked[$id]['ident']);
286
-				    if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
286
+				    if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
287 287
 				} else $recent_ident = '';
288
-				$TrackerLive->db=null;
288
+				$TrackerLive->db = null;
289 289
 
290 290
 				if ($globalDebug && $recent_ident == '') echo " Not in DB.\n";
291 291
 				elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n";
292 292
 			    } else {
293 293
 				$recent_ident = '';
294
-				$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('forcenew' => 0));
294
+				$this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('forcenew' => 0));
295 295
 			    }
296 296
 			    //if there was no aircraft with the same callsign within the last hour and go post it into the archive
297
-			    if($recent_ident == "")
297
+			    if ($recent_ident == "")
298 298
 			    {
299 299
 				if ($globalDebug) echo "\o/ Add ".$this->all_tracked[$id]['ident']." in archive DB : ";
300 300
 				//adds the spotter data for the archive
301 301
 				    $highlight = '';
302
-				    if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident'].'-'.date('YmdHi')));
302
+				    if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('id' => $this->all_tracked[$id]['ident'].'-'.date('YmdHi')));
303 303
 				    $timeelapsed = microtime(true);
304 304
 				    $Tracker = new Tracker($this->db);
305
-				    $result = $Tracker->addTrackerData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['altitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['comment'],$this->all_tracked[$id]['type'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name']);
305
+				    $result = $Tracker->addTrackerData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['altitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['comment'], $this->all_tracked[$id]['type'], $this->all_tracked[$id]['format_source'], $this->all_tracked[$id]['source_name']);
306 306
 				    $Tracker->db = null;
307 307
 				    if ($globalDebug && isset($result)) echo $result."\n";
308
-				    if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
308
+				    if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
309 309
 				    
310 310
 				    
311 311
 				    // Add source stat in DB
312 312
 				    $Stats = new Stats($this->db);
313 313
 				    if (!empty($this->stats)) {
314 314
 					if ($globalDebug) echo 'Add source stats : ';
315
-				        foreach($this->stats as $date => $data) {
316
-					    foreach($data as $source => $sourced) {
315
+				        foreach ($this->stats as $date => $data) {
316
+					    foreach ($data as $source => $sourced) {
317 317
 					        //print_r($sourced);
318
-				    	        if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar_tracker',$date);
319
-				    	        if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist_tracker',$date);
318
+				    	        if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']), $source, 'polar_tracker', $date);
319
+				    	        if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']), $source, 'hist_tracker', $date);
320 320
 				    		if (isset($sourced['msg'])) {
321 321
 				    		    if (time() - $sourced['msg']['date'] > 10) {
322 322
 				    		        $nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date']));
323
-				    		        echo $Stats->addStatSource($nbmsg,$source,'msg_tracker',$date);
323
+				    		        echo $Stats->addStatSource($nbmsg, $source, 'msg_tracker', $date);
324 324
 			    			        unset($this->stats[$date][$source]['msg']);
325 325
 			    			    }
326 326
 			    			}
@@ -343,7 +343,7 @@  discard block
 block discarded – undo
343 343
 				    //TrackerLive->deleteLiveTrackerDataNotUpdated();
344 344
 				    $TrackerLive = new TrackerLive($this->db);
345 345
 				    $TrackerLive->deleteLiveTrackerData();
346
-				    $TrackerLive->db=null;
346
+				    $TrackerLive->db = null;
347 347
 				    if ($globalDebug) echo " Done\n";
348 348
 				    $this->last_delete = time();
349 349
 				}
@@ -352,7 +352,7 @@  discard block
 block discarded – undo
352 352
 				$this->all_tracked[$id]['addedTracker'] = 1;
353 353
 				if (isset($globalDaemon) && !$globalDaemon) {
354 354
 					$Tracker = new Tracker($this->db);
355
-					$Tracker->updateLatestTrackerData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['ident'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$this->all_tracked[$id]['altitude'],$this->all_tracked[$id]['speed'],$this->all_tracked[$id]['datetime']);
355
+					$Tracker->updateLatestTrackerData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['altitude'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime']);
356 356
 					$Tracker->db = null;
357 357
 				}
358 358
 				
@@ -366,14 +366,14 @@  discard block
 block discarded – undo
366 366
 		    $ignoreImport = false;
367 367
 
368 368
 		    if (!$ignoreImport) {
369
-			if (!isset($globalDistanceIgnore['latitude']) || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) {
369
+			if (!isset($globalDistanceIgnore['latitude']) || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $globalDistanceIgnore['latitude'], $globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) {
370 370
 				if ($globalDebug) echo "\o/ Add ".$this->all_tracked[$id]['ident']." from ".$this->all_tracked[$id]['format_source']." in Live DB : ";
371 371
 				$timeelapsed = microtime(true);
372 372
 				$TrackerLive = new TrackerLive($this->db);
373
-				$result = $TrackerLive->addLiveTrackerData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['altitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'],$this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['putinarchive'],$this->all_tracked[$id]['comment'],$this->all_tracked[$id]['type'],$this->all_tracked[$id]['noarchive'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name'],$this->all_tracked[$id]['over_country']);
373
+				$result = $TrackerLive->addLiveTrackerData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['altitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['putinarchive'], $this->all_tracked[$id]['comment'], $this->all_tracked[$id]['type'], $this->all_tracked[$id]['noarchive'], $this->all_tracked[$id]['format_source'], $this->all_tracked[$id]['source_name'], $this->all_tracked[$id]['over_country']);
374 374
 				$TrackerLive->db = null;
375 375
 				$this->all_tracked[$id]['putinarchive'] = false;
376
-				if ($globalDebugTimeElapsed) echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
376
+				if ($globalDebugTimeElapsed) echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
377 377
 
378 378
 				// Put statistics in $this->stats variable
379 379
 				
@@ -390,19 +390,19 @@  discard block
 block discarded – undo
390 390
 							$latitude = $globalCenterLatitude;
391 391
 							$longitude = $globalCenterLongitude;
392 392
 						}
393
-						$this->source_location[$source] = array('latitude' => $latitude,'longitude' => $longitude);
393
+						$this->source_location[$source] = array('latitude' => $latitude, 'longitude' => $longitude);
394 394
 					} else {
395 395
 						$latitude = $this->source_location[$source]['latitude'];
396 396
 						$longitude = $this->source_location[$source]['longitude'];
397 397
 					}
398
-					$stats_heading = $Common->getHeading($latitude,$longitude,$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude']);
398
+					$stats_heading = $Common->getHeading($latitude, $longitude, $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude']);
399 399
 					//$stats_heading = $stats_heading%22.5;
400 400
 					$stats_heading = round($stats_heading/22.5);
401
-					$stats_distance = $Common->distance($latitude,$longitude,$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude']);
401
+					$stats_distance = $Common->distance($latitude, $longitude, $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude']);
402 402
 					$current_date = date('Y-m-d');
403 403
 					if ($stats_heading == 16) $stats_heading = 0;
404 404
 					if (!isset($this->stats[$current_date][$source]['polar'][1])) {
405
-						for ($i=0;$i<=15;$i++) {
405
+						for ($i = 0; $i <= 15; $i++) {
406 406
 						    $this->stats[$current_date][$source]['polar'][$i] = 0;
407 407
 						}
408 408
 						$this->stats[$current_date][$source]['polar'][$stats_heading] = $stats_distance;
@@ -417,9 +417,9 @@  discard block
 block discarded – undo
417 417
 					if (!isset($this->stats[$current_date][$source]['hist'][$distance])) {
418 418
 						if (isset($this->stats[$current_date][$source]['hist'][0])) {
419 419
 						    end($this->stats[$current_date][$source]['hist']);
420
-						    $mini = key($this->stats[$current_date][$source]['hist'])+10;
420
+						    $mini = key($this->stats[$current_date][$source]['hist']) + 10;
421 421
 						} else $mini = 0;
422
-						for ($i=$mini;$i<=$distance;$i+=10) {
422
+						for ($i = $mini; $i <= $distance; $i += 10) {
423 423
 						    $this->stats[$current_date][$source]['hist'][$i] = 0;
424 424
 						}
425 425
 						$this->stats[$current_date][$source]['hist'][$distance] = 1;
@@ -431,7 +431,7 @@  discard block
 block discarded – undo
431 431
 				$this->all_tracked[$id]['lastupdate'] = time();
432 432
 				if ($this->all_tracked[$id]['putinarchive']) $send = true;
433 433
 				if ($globalDebug) echo $result."\n";
434
-			} elseif (isset($this->all_tracked[$id]['latitude']) && isset($globalDistanceIgnore['latitude']) && $globalDebug) echo "!! Too far -> Distance : ".$Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude'])."\n";
434
+			} elseif (isset($this->all_tracked[$id]['latitude']) && isset($globalDistanceIgnore['latitude']) && $globalDebug) echo "!! Too far -> Distance : ".$Common->distance($this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $globalDistanceIgnore['latitude'], $globalDistanceIgnore['longitude'])."\n";
435 435
 			//$this->del();
436 436
 			
437 437
 			
Please login to merge, or discard this patch.
Braces   +190 added lines, -65 removed lines patch added patch discarded remove patch
@@ -42,7 +42,9 @@  discard block
 block discarded – undo
42 42
 
43 43
     public function checkAll() {
44 44
 	global $globalDebug;
45
-	if ($globalDebug) echo "Update last seen tracked data...\n";
45
+	if ($globalDebug) {
46
+		echo "Update last seen tracked data...\n";
47
+	}
46 48
 	foreach ($this->all_tracked as $key => $flight) {
47 49
 	    if (isset($this->all_tracked[$key]['id'])) {
48 50
 		//echo $this->all_tracked[$key]['id'].' - '.$this->all_tracked[$key]['latitude'].'  '.$this->all_tracked[$key]['longitude']."\n";
@@ -55,12 +57,16 @@  discard block
 block discarded – undo
55 57
     public function del() {
56 58
 	global $globalDebug;
57 59
 	// Delete old infos
58
-	if ($globalDebug) echo 'Delete old values and update latest data...'."\n";
60
+	if ($globalDebug) {
61
+		echo 'Delete old values and update latest data...'."\n";
62
+	}
59 63
 	foreach ($this->all_tracked as $key => $flight) {
60 64
     	    if (isset($flight['lastupdate'])) {
61 65
         	if ($flight['lastupdate'] < (time()-3000)) {
62 66
             	    if (isset($this->all_tracked[$key]['id'])) {
63
-            		if ($globalDebug) echo "--- Delete old values with id ".$this->all_tracked[$key]['id']."\n";
67
+            		if ($globalDebug) {
68
+            			echo "--- Delete old values with id ".$this->all_tracked[$key]['id']."\n";
69
+            		}
64 70
 			/*
65 71
 			$TrackerLive = new TrackerLive();
66 72
             		$TrackerLive->deleteLiveTrackerDataById($this->all_tracked[$key]['id']);
@@ -70,7 +76,9 @@  discard block
 block discarded – undo
70 76
             		$Tracker = new Tracker($this->db);
71 77
             		if ($this->all_tracked[$key]['latitude'] != '' && $this->all_tracked[$key]['longitude'] != '') {
72 78
 				$result = $Tracker->updateLatestTrackerData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['altitude'],$this->all_tracked[$key]['speed']);
73
-				if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n";
79
+				if ($globalDebug && $result != 'success') {
80
+					echo '!!! ERROR : '.$result."\n";
81
+				}
74 82
 			}
75 83
 			// Put in archive
76 84
 //			$Tracker->db = null;
@@ -83,7 +91,9 @@  discard block
 block discarded – undo
83 91
 
84 92
     public function add($line) {
85 93
 	global $globalFork, $globalDistanceIgnore, $globalDaemon, $globalDebug, $globalCoordMinChangeTracker, $globalDebugTimeElapsed, $globalCenterLatitude, $globalCenterLongitude, $globalBeta, $globalSourcesupdate, $globalAllTracked;
86
-	if (!isset($globalCoordMinChangeTracker) || $globalCoordMinChangeTracker == '') $globalCoordMinChangeTracker = '0.015';
94
+	if (!isset($globalCoordMinChangeTracker) || $globalCoordMinChangeTracker == '') {
95
+		$globalCoordMinChangeTracker = '0.015';
96
+	}
87 97
 	date_default_timezone_set('UTC');
88 98
 	$dataFound = false;
89 99
 	$send = false;
@@ -97,19 +107,29 @@  discard block
 block discarded – undo
97 107
 		// Increment message number
98 108
 		if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE) {
99 109
 		    $current_date = date('Y-m-d');
100
-		    if (isset($line['source_name'])) $source = $line['source_name'];
101
-		    else $source = '';
102
-		    if ($source == '' || $line['format_source'] == 'aprs') $source = $line['format_source'];
110
+		    if (isset($line['source_name'])) {
111
+		    	$source = $line['source_name'];
112
+		    } else {
113
+		    	$source = '';
114
+		    }
115
+		    if ($source == '' || $line['format_source'] == 'aprs') {
116
+		    	$source = $line['format_source'];
117
+		    }
103 118
 		    if (!isset($this->stats[$current_date][$source]['msg'])) {
104 119
 		    	$this->stats[$current_date][$source]['msg']['date'] = time();
105 120
 		    	$this->stats[$current_date][$source]['msg']['nb'] = 1;
106
-		    } else $this->stats[$current_date][$source]['msg']['nb'] += 1;
121
+		    } else {
122
+		    	$this->stats[$current_date][$source]['msg']['nb'] += 1;
123
+		    }
107 124
 		}
108 125
 		
109 126
 		
110 127
 		$Common = new Common();
111
-	        if (!isset($line['id'])) $id = trim($line['ident']);
112
-	        else $id = trim($line['id']);
128
+	        if (!isset($line['id'])) {
129
+	        	$id = trim($line['ident']);
130
+	        } else {
131
+	        	$id = trim($line['id']);
132
+	        }
113 133
 		
114 134
 		if (!isset($this->all_tracked[$id])) {
115 135
 		    $this->all_tracked[$id] = array();
@@ -117,31 +137,46 @@  discard block
 block discarded – undo
117 137
 		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => '','latitude' => '', 'longitude' => '', 'speed' => '', 'altitude' => '', 'heading' => '', 'format_source' => '','source_name' => '','comment'=> '','type' => '','noarchive' => false,'putinarchive' => true,'over_country' => ''));
118 138
 		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('lastupdate' => time()));
119 139
 		    if (!isset($line['id'])) {
120
-			if (!isset($globalDaemon)) $globalDaemon = TRUE;
140
+			if (!isset($globalDaemon)) {
141
+				$globalDaemon = TRUE;
142
+			}
121 143
 			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $id.'-'.date('YmdHi')));
122
-		     } else $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $line['id']));
123
-		    if ($globalAllTracked !== FALSE) $dataFound = true;
144
+		     } else {
145
+		     	$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $line['id']));
146
+		     }
147
+		    if ($globalAllTracked !== FALSE) {
148
+		    	$dataFound = true;
149
+		    }
124 150
 		}
125 151
 		
126 152
 		if (isset($line['datetime']) && strtotime($line['datetime']) > time()-20*60 && strtotime($line['datetime']) < time()+20*60) {
127 153
 		    if (!isset($this->all_tracked[$id]['datetime']) || strtotime($line['datetime']) >= strtotime($this->all_tracked[$id]['datetime'])) {
128 154
 			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('datetime' => $line['datetime']));
129 155
 		    } else {
130
-				if (strtotime($line['datetime']) == strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) echo "!!! Date is the same as previous data for ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."\n";
131
-				elseif (strtotime($line['datetime']) > strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) echo "!!! Date previous latest data (".$line['datetime']." > ".$this->all_tracked[$id]['datetime'].") !!! for ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."\n";
156
+				if (strtotime($line['datetime']) == strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) {
157
+					echo "!!! Date is the same as previous data for ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."\n";
158
+				} elseif (strtotime($line['datetime']) > strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) {
159
+					echo "!!! Date previous latest data (".$line['datetime']." > ".$this->all_tracked[$id]['datetime'].") !!! for ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."\n";
160
+				}
132 161
 				return '';
133 162
 		    }
134 163
 		} elseif (isset($line['datetime']) && strtotime($line['datetime']) < time()-20*60) {
135
-			if ($globalDebug) echo "!!! Date is too old ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."!!!\n";
164
+			if ($globalDebug) {
165
+				echo "!!! Date is too old ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."!!!\n";
166
+			}
136 167
 			return '';
137 168
 		} elseif (isset($line['datetime']) && strtotime($line['datetime']) > time()+20*60) {
138
-			if ($globalDebug) echo "!!! Date is in the future ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."!!!\n";
169
+			if ($globalDebug) {
170
+				echo "!!! Date is in the future ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."!!!\n";
171
+			}
139 172
 			return '';
140 173
 		} elseif (!isset($line['datetime'])) {
141 174
 			date_default_timezone_set('UTC');
142 175
 			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('datetime' => date('Y-m-d H:i:s')));
143 176
 		} else {
144
-			if ($globalDebug) echo "!!! Unknow date error ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."!!!\n";
177
+			if ($globalDebug) {
178
+				echo "!!! Unknow date error ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."!!!\n";
179
+			}
145 180
 			return '';
146 181
 		}
147 182
 		
@@ -153,11 +188,17 @@  discard block
 block discarded – undo
153 188
             		$Tracker = new Tracker($this->db);
154 189
             		$fromsource = NULL;
155 190
             		$result = $Tracker->updateIdentTrackerData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['ident'],$fromsource);
156
-			if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n";
191
+			if ($globalDebug && $result != 'success') {
192
+				echo '!!! ERROR : '.$result."\n";
193
+			}
157 194
 			$Tracker->db = null;
158
-			if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
195
+			if ($globalDebugTimeElapsed) {
196
+				echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
197
+			}
198
+		    }
199
+		    if (!isset($this->all_tracked[$id]['id'])) {
200
+		    	$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident']));
159 201
 		    }
160
-		    if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident']));
161 202
 		}
162 203
 
163 204
 		if (isset($line['speed']) && $line['speed'] != '') {
@@ -168,14 +209,21 @@  discard block
 block discarded – undo
168 209
 		    if ($distance > 100 && $distance < 10000) {
169 210
 			$speed = $distance/(time() - $this->all_tracked[$id]['time_last_coord']);
170 211
 			$speed = $speed*3.6;
171
-			if ($speed < 1000) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($speed)));
172
-  			if ($globalDebug) echo "ø Calculated Speed for ".$this->all_tracked[$id]['ident']." : ".$speed." - distance : ".$distance."\n";
212
+			if ($speed < 1000) {
213
+				$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($speed)));
214
+			}
215
+  			if ($globalDebug) {
216
+  				echo "ø Calculated Speed for ".$this->all_tracked[$id]['ident']." : ".$speed." - distance : ".$distance."\n";
217
+  			}
173 218
 		    }
174 219
 		}
175 220
 
176 221
 	        if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) {
177
-	    	    if (isset($this->all_tracked[$id]['time_last_coord'])) $timediff = round(time()-$this->all_tracked[$id]['time_last_coord']);
178
-	    	    else unset($timediff);
222
+	    	    if (isset($this->all_tracked[$id]['time_last_coord'])) {
223
+	    	    	$timediff = round(time()-$this->all_tracked[$id]['time_last_coord']);
224
+	    	    } else {
225
+	    	    	unset($timediff);
226
+	    	    }
179 227
 	    	    if ($this->tmd > 5 || !isset($timediff) || $timediff > 90 || ($timediff > 60 && isset($this->all_tracked[$id]['latitude']) && isset($this->all_tracked[$id]['longitude']) && $Common->withinThreshold($timediff,$Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')))) {
180 228
 			if (isset($this->all_tracked[$id]['archive_latitude']) && isset($this->all_tracked[$id]['archive_longitude']) && isset($this->all_tracked[$id]['livedb_latitude']) && isset($this->all_tracked[$id]['livedb_longitude'])) {
181 229
 			    if (!$Common->checkLine($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['livedb_latitude'],$this->all_tracked[$id]['livedb_longitude'],$line['latitude'],$line['longitude'],0.08)) {
@@ -183,20 +231,30 @@  discard block
 block discarded – undo
183 231
 				$this->all_tracked[$id]['archive_longitude'] = $line['longitude'];
184 232
 				$this->all_tracked[$id]['putinarchive'] = true;
185 233
 				
186
-				if ($globalDebug) echo "\n".' ------- Check Country for '.$this->all_tracked[$id]['ident'].' with latitude : '.$line['latitude'].' and longitude : '.$line['longitude'].'.... ';
234
+				if ($globalDebug) {
235
+					echo "\n".' ------- Check Country for '.$this->all_tracked[$id]['ident'].' with latitude : '.$line['latitude'].' and longitude : '.$line['longitude'].'.... ';
236
+				}
187 237
 				$timeelapsed = microtime(true);
188 238
 				$Tracker = new Tracker($this->db);
189 239
 				$all_country = $Tracker->getCountryFromLatitudeLongitude($line['latitude'],$line['longitude']);
190
-				if (!empty($all_country)) $this->all_tracked[$id]['over_country'] = $all_country['iso2'];
240
+				if (!empty($all_country)) {
241
+					$this->all_tracked[$id]['over_country'] = $all_country['iso2'];
242
+				}
191 243
 				$Tracker->db = null;
192
-				if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
244
+				if ($globalDebugTimeElapsed) {
245
+					echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
246
+				}
193 247
 				$this->tmd = 0;
194
-				if ($globalDebug) echo 'FOUND : '.$this->all_tracked[$id]['over_country'].' ---------------'."\n";
248
+				if ($globalDebug) {
249
+					echo 'FOUND : '.$this->all_tracked[$id]['over_country'].' ---------------'."\n";
250
+				}
195 251
 			    }
196 252
 			}
197 253
 
198 254
 			if (isset($line['latitude']) && $line['latitude'] != '' && $line['latitude'] != 0 && $line['latitude'] < 91 && $line['latitude'] > -90) {
199
-				if (!isset($this->all_tracked[$id]['archive_latitude'])) $this->all_tracked[$id]['archive_latitude'] = $line['latitude'];
255
+				if (!isset($this->all_tracked[$id]['archive_latitude'])) {
256
+					$this->all_tracked[$id]['archive_latitude'] = $line['latitude'];
257
+				}
200 258
 				if (!isset($this->all_tracked[$id]['livedb_latitude']) || abs($this->all_tracked[$id]['livedb_latitude']-$line['latitude']) > $globalCoordMinChangeTracker || $this->all_tracked[$id]['format_source'] == 'aprs') {
201 259
 				    $this->all_tracked[$id]['livedb_latitude'] = $line['latitude'];
202 260
 				    $dataFound = true;
@@ -205,8 +263,12 @@  discard block
 block discarded – undo
205 263
 				$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('latitude' => $line['latitude']));
206 264
 			}
207 265
 			if (isset($line['longitude']) && $line['longitude'] != '' && $line['longitude'] != 0 && $line['longitude'] < 360 && $line['longitude'] > -180) {
208
-			    if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360;
209
-				if (!isset($this->all_tracked[$id]['archive_longitude'])) $this->all_tracked[$id]['archive_longitude'] = $line['longitude'];
266
+			    if ($line['longitude'] > 180) {
267
+			    	$line['longitude'] = $line['longitude'] - 360;
268
+			    }
269
+				if (!isset($this->all_tracked[$id]['archive_longitude'])) {
270
+					$this->all_tracked[$id]['archive_longitude'] = $line['longitude'];
271
+				}
210 272
 				if (!isset($this->all_tracked[$id]['livedb_longitude']) || abs($this->all_tracked[$id]['livedb_longitude']-$line['longitude']) > $globalCoordMinChangeTracker || $this->all_tracked[$id]['format_source'] == 'aprs') {
211 273
 				    $this->all_tracked[$id]['livedb_longitude'] = $line['longitude'];
212 274
 				    $dataFound = true;
@@ -226,7 +288,9 @@  discard block
 block discarded – undo
226 288
 		    }
227 289
 		}
228 290
 		if (isset($line['last_update']) && $line['last_update'] != '') {
229
-		    if (isset($this->all_tracked[$id]['last_update']) && $this->all_tracked[$id]['last_update'] != $line['last_update']) $dataFound = true;
291
+		    if (isset($this->all_tracked[$id]['last_update']) && $this->all_tracked[$id]['last_update'] != $line['last_update']) {
292
+		    	$dataFound = true;
293
+		    }
230 294
 		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('last_update' => $line['last_update']));
231 295
 		}
232 296
 		if (isset($line['format_source']) && $line['format_source'] != '') {
@@ -246,7 +310,9 @@  discard block
 block discarded – undo
246 310
 
247 311
 		if (isset($line['altitude']) && $line['altitude'] != '') {
248 312
 		    //if (!isset($this->all_tracked[$id]['altitude']) || $this->all_tracked[$id]['altitude'] == '' || ($this->all_tracked[$id]['altitude'] > 0 && $line['altitude'] != 0)) {
249
-			if (is_int($this->all_tracked[$id]['altitude']) && abs(round($line['altitude']/100)-$this->all_tracked[$id]['altitude']) > 3) $this->all_tracked[$id]['putinarchive'] = true;
313
+			if (is_int($this->all_tracked[$id]['altitude']) && abs(round($line['altitude']/100)-$this->all_tracked[$id]['altitude']) > 3) {
314
+				$this->all_tracked[$id]['putinarchive'] = true;
315
+			}
250 316
 			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('altitude' => $line['altitude']));
251 317
 			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('altitude_real' => $line['altitude']));
252 318
 			//$dataFound = true;
@@ -258,15 +324,21 @@  discard block
 block discarded – undo
258 324
 		}
259 325
 		
260 326
 		if (isset($line['heading']) && $line['heading'] != '') {
261
-		    if (is_int($this->all_tracked[$id]['heading']) && abs($this->all_tracked[$id]['heading']-round($line['heading'])) > 10) $this->all_tracked[$id]['putinarchive'] = true;
327
+		    if (is_int($this->all_tracked[$id]['heading']) && abs($this->all_tracked[$id]['heading']-round($line['heading'])) > 10) {
328
+		    	$this->all_tracked[$id]['putinarchive'] = true;
329
+		    }
262 330
 		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($line['heading'])));
263 331
 		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading_fromsrc' => true));
264 332
 		    //$dataFound = true;
265 333
   		} elseif (!isset($this->all_tracked[$id]['heading_fromsrc']) && isset($this->all_tracked[$id]['archive_latitude']) && $this->all_tracked[$id]['archive_latitude'] != $this->all_tracked[$id]['latitude'] && isset($this->all_tracked[$id]['archive_longitude']) && $this->all_tracked[$id]['archive_longitude'] != $this->all_tracked[$id]['longitude']) {
266 334
   		    $heading = $Common->getHeading($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude']);
267 335
 		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($heading)));
268
-		    if (abs($this->all_tracked[$id]['heading']-round($heading)) > 10) $this->all_tracked[$id]['putinarchive'] = true;
269
-  		    if ($globalDebug) echo "ø Calculated Heading for ".$this->all_tracked[$id]['ident']." : ".$heading."\n";
336
+		    if (abs($this->all_tracked[$id]['heading']-round($heading)) > 10) {
337
+		    	$this->all_tracked[$id]['putinarchive'] = true;
338
+		    }
339
+  		    if ($globalDebug) {
340
+  		    	echo "ø Calculated Heading for ".$this->all_tracked[$id]['ident']." : ".$heading."\n";
341
+  		    }
270 342
   		}
271 343
 		//if (isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_tracked[$id]['lastupdate']) && time()-$this->all_tracked[$id]['lastupdate'] < $globalSourcesupdate) $dataFound = false;
272 344
 
@@ -275,20 +347,31 @@  discard block
 block discarded – undo
275 347
 		    if ($this->all_tracked[$id]['addedTracker'] == 0) {
276 348
 		        if (!isset($globalDistanceIgnore['latitude']) || $this->all_tracked[$id]['longitude'] == ''  || $this->all_tracked[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) {
277 349
 			    if (!isset($this->all_tracked[$id]['forcenew']) || $this->all_tracked[$id]['forcenew'] == 0) {
278
-				if ($globalDebug) echo "Check if aircraft is already in DB...";
350
+				if ($globalDebug) {
351
+					echo "Check if aircraft is already in DB...";
352
+				}
279 353
 				$timeelapsed = microtime(true);
280 354
 				$TrackerLive = new TrackerLive($this->db);
281 355
 				if (isset($line['id'])) {
282 356
 				    $recent_ident = $TrackerLive->checkIdRecent($line['id']);
283
-				    if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
357
+				    if ($globalDebugTimeElapsed) {
358
+				    	echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
359
+				    }
284 360
 				} elseif (isset($this->all_tracked[$id]['ident']) && $this->all_tracked[$id]['ident'] != '') {
285 361
 				    $recent_ident = $TrackerLive->checkIdentRecent($this->all_tracked[$id]['ident']);
286
-				    if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
287
-				} else $recent_ident = '';
362
+				    if ($globalDebugTimeElapsed) {
363
+				    	echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
364
+				    }
365
+				} else {
366
+					$recent_ident = '';
367
+				}
288 368
 				$TrackerLive->db=null;
289 369
 
290
-				if ($globalDebug && $recent_ident == '') echo " Not in DB.\n";
291
-				elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n";
370
+				if ($globalDebug && $recent_ident == '') {
371
+					echo " Not in DB.\n";
372
+				} elseif ($globalDebug && $recent_ident != '') {
373
+					echo " Already in DB.\n";
374
+				}
292 375
 			    } else {
293 376
 				$recent_ident = '';
294 377
 				$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('forcenew' => 0));
@@ -296,27 +379,41 @@  discard block
 block discarded – undo
296 379
 			    //if there was no aircraft with the same callsign within the last hour and go post it into the archive
297 380
 			    if($recent_ident == "")
298 381
 			    {
299
-				if ($globalDebug) echo "\o/ Add ".$this->all_tracked[$id]['ident']." in archive DB : ";
382
+				if ($globalDebug) {
383
+					echo "\o/ Add ".$this->all_tracked[$id]['ident']." in archive DB : ";
384
+				}
300 385
 				//adds the spotter data for the archive
301 386
 				    $highlight = '';
302
-				    if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident'].'-'.date('YmdHi')));
387
+				    if (!isset($this->all_tracked[$id]['id'])) {
388
+				    	$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident'].'-'.date('YmdHi')));
389
+				    }
303 390
 				    $timeelapsed = microtime(true);
304 391
 				    $Tracker = new Tracker($this->db);
305 392
 				    $result = $Tracker->addTrackerData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['altitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['comment'],$this->all_tracked[$id]['type'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name']);
306 393
 				    $Tracker->db = null;
307
-				    if ($globalDebug && isset($result)) echo $result."\n";
308
-				    if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
394
+				    if ($globalDebug && isset($result)) {
395
+				    	echo $result."\n";
396
+				    }
397
+				    if ($globalDebugTimeElapsed) {
398
+				    	echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
399
+				    }
309 400
 				    
310 401
 				    
311 402
 				    // Add source stat in DB
312 403
 				    $Stats = new Stats($this->db);
313 404
 				    if (!empty($this->stats)) {
314
-					if ($globalDebug) echo 'Add source stats : ';
405
+					if ($globalDebug) {
406
+						echo 'Add source stats : ';
407
+					}
315 408
 				        foreach($this->stats as $date => $data) {
316 409
 					    foreach($data as $source => $sourced) {
317 410
 					        //print_r($sourced);
318
-				    	        if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar_tracker',$date);
319
-				    	        if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist_tracker',$date);
411
+				    	        if (isset($sourced['polar'])) {
412
+				    	        	echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar_tracker',$date);
413
+				    	        }
414
+				    	        if (isset($sourced['hist'])) {
415
+				    	        	echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist_tracker',$date);
416
+				    	        }
320 417
 				    		if (isset($sourced['msg'])) {
321 418
 				    		    if (time() - $sourced['msg']['date'] > 10) {
322 419
 				    		        $nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date']));
@@ -329,7 +426,9 @@  discard block
 block discarded – undo
329 426
 			    			unset($this->stats[$date]);
330 427
 			    		    }
331 428
 				    	}
332
-				    	if ($globalDebug) echo 'Done'."\n";
429
+				    	if ($globalDebug) {
430
+				    		echo 'Done'."\n";
431
+				    	}
333 432
 
334 433
 				    }
335 434
 				    $Stats->db = null;
@@ -339,12 +438,16 @@  discard block
 block discarded – undo
339 438
 				$this->all_tracked[$id]['addedTracker'] = 1;
340 439
 				//print_r($this->all_tracked[$id]);
341 440
 				if ($this->last_delete == 0 || time() - $this->last_delete > 1800) {
342
-				    if ($globalDebug) echo "---- Deleting Live Tracker data older than 9 hours...";
441
+				    if ($globalDebug) {
442
+				    	echo "---- Deleting Live Tracker data older than 9 hours...";
443
+				    }
343 444
 				    //TrackerLive->deleteLiveTrackerDataNotUpdated();
344 445
 				    $TrackerLive = new TrackerLive($this->db);
345 446
 				    $TrackerLive->deleteLiveTrackerData();
346 447
 				    $TrackerLive->db=null;
347
-				    if ($globalDebug) echo " Done\n";
448
+				    if ($globalDebug) {
449
+				    	echo " Done\n";
450
+				    }
348 451
 				    $this->last_delete = time();
349 452
 				}
350 453
 			    } else {
@@ -367,19 +470,25 @@  discard block
 block discarded – undo
367 470
 
368 471
 		    if (!$ignoreImport) {
369 472
 			if (!isset($globalDistanceIgnore['latitude']) || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) {
370
-				if ($globalDebug) echo "\o/ Add ".$this->all_tracked[$id]['ident']." from ".$this->all_tracked[$id]['format_source']." in Live DB : ";
473
+				if ($globalDebug) {
474
+					echo "\o/ Add ".$this->all_tracked[$id]['ident']." from ".$this->all_tracked[$id]['format_source']." in Live DB : ";
475
+				}
371 476
 				$timeelapsed = microtime(true);
372 477
 				$TrackerLive = new TrackerLive($this->db);
373 478
 				$result = $TrackerLive->addLiveTrackerData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['altitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'],$this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['putinarchive'],$this->all_tracked[$id]['comment'],$this->all_tracked[$id]['type'],$this->all_tracked[$id]['noarchive'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name'],$this->all_tracked[$id]['over_country']);
374 479
 				$TrackerLive->db = null;
375 480
 				$this->all_tracked[$id]['putinarchive'] = false;
376
-				if ($globalDebugTimeElapsed) echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
481
+				if ($globalDebugTimeElapsed) {
482
+					echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
483
+				}
377 484
 
378 485
 				// Put statistics in $this->stats variable
379 486
 				
380 487
 				if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE && $this->all_tracked[$id]['latitude'] != '' && $this->all_tracked[$id]['longitude'] != '') {
381 488
 					$source = $this->all_tracked[$id]['source_name'];
382
-					if ($source == '') $source = $this->all_tracked[$id]['format_source'];
489
+					if ($source == '') {
490
+						$source = $this->all_tracked[$id]['format_source'];
491
+					}
383 492
 					if (!isset($this->source_location[$source])) {
384 493
 						$Location = new Source($this->db);
385 494
 						$coord = $Location->getLocationInfobySourceName($source);
@@ -400,7 +509,9 @@  discard block
 block discarded – undo
400 509
 					$stats_heading = round($stats_heading/22.5);
401 510
 					$stats_distance = $Common->distance($latitude,$longitude,$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude']);
402 511
 					$current_date = date('Y-m-d');
403
-					if ($stats_heading == 16) $stats_heading = 0;
512
+					if ($stats_heading == 16) {
513
+						$stats_heading = 0;
514
+					}
404 515
 					if (!isset($this->stats[$current_date][$source]['polar'][1])) {
405 516
 						for ($i=0;$i<=15;$i++) {
406 517
 						    $this->stats[$current_date][$source]['polar'][$i] = 0;
@@ -418,7 +529,9 @@  discard block
 block discarded – undo
418 529
 						if (isset($this->stats[$current_date][$source]['hist'][0])) {
419 530
 						    end($this->stats[$current_date][$source]['hist']);
420 531
 						    $mini = key($this->stats[$current_date][$source]['hist'])+10;
421
-						} else $mini = 0;
532
+						} else {
533
+							$mini = 0;
534
+						}
422 535
 						for ($i=$mini;$i<=$distance;$i+=10) {
423 536
 						    $this->stats[$current_date][$source]['hist'][$i] = 0;
424 537
 						}
@@ -429,19 +542,29 @@  discard block
 block discarded – undo
429 542
 				}
430 543
 
431 544
 				$this->all_tracked[$id]['lastupdate'] = time();
432
-				if ($this->all_tracked[$id]['putinarchive']) $send = true;
433
-				if ($globalDebug) echo $result."\n";
434
-			} elseif (isset($this->all_tracked[$id]['latitude']) && isset($globalDistanceIgnore['latitude']) && $globalDebug) echo "!! Too far -> Distance : ".$Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude'])."\n";
545
+				if ($this->all_tracked[$id]['putinarchive']) {
546
+					$send = true;
547
+				}
548
+				if ($globalDebug) {
549
+					echo $result."\n";
550
+				}
551
+			} elseif (isset($this->all_tracked[$id]['latitude']) && isset($globalDistanceIgnore['latitude']) && $globalDebug) {
552
+				echo "!! Too far -> Distance : ".$Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude'])."\n";
553
+			}
435 554
 			//$this->del();
436 555
 			
437 556
 			
438 557
 			if ($this->last_delete_hourly == 0 || time() - $this->last_delete_hourly > 900) {
439
-			    if ($globalDebug) echo "---- Deleting Live Tracker data Not updated since 2 hour...";
558
+			    if ($globalDebug) {
559
+			    	echo "---- Deleting Live Tracker data Not updated since 2 hour...";
560
+			    }
440 561
 			    $TrackerLive = new TrackerLive($this->db);
441 562
 			    $TrackerLive->deleteLiveTrackerDataNotUpdated();
442 563
 			    $TrackerLive->db = null;
443 564
 			    //TrackerLive->deleteLiveTrackerData();
444
-			    if ($globalDebug) echo " Done\n";
565
+			    if ($globalDebug) {
566
+			    	echo " Done\n";
567
+			    }
445 568
 			    $this->last_delete_hourly = time();
446 569
 			}
447 570
 			
@@ -449,7 +572,9 @@  discard block
 block discarded – undo
449 572
 		    //$ignoreImport = false;
450 573
 		}
451 574
 		//if (function_exists('pcntl_fork') && $globalFork) pcntl_signal(SIGCHLD, SIG_IGN);
452
-		if ($send) return $this->all_tracked[$id];
575
+		if ($send) {
576
+			return $this->all_tracked[$id];
577
+		}
453 578
 	    }
454 579
 	}
455 580
     }
Please login to merge, or discard this patch.
header.php 3 patches
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -14,35 +14,35 @@  discard block
 block discarded – undo
14 14
 if (isset($globalMapOffline) && $globalMapOffline) $MapType = 'offline';
15 15
 
16 16
 if (isset($_GET['3d'])) {
17
-	setcookie('MapFormat','3d');
17
+	setcookie('MapFormat', '3d');
18 18
 } else if (isset($_GET['2d'])) {
19
-	setcookie('MapFormat','2d');
19
+	setcookie('MapFormat', '2d');
20 20
 }
21 21
 
22 22
 if (isset($globalTSK) && $globalTSK && isset($_GET['tsk'])) {
23
-	$tsk = filter_input(INPUT_GET,'tsk',FILTER_SANITIZE_URL);
23
+	$tsk = filter_input(INPUT_GET, 'tsk', FILTER_SANITIZE_URL);
24 24
 }
25 25
 
26 26
 if (isset($_POST['archive'])) {
27
-	setcookie('archive','true');
28
-	setcookie('archive_begin',strtotime($_POST['start_date']));
29
-	setcookie('archive_end',strtotime($_POST['end_date']));
30
-	setcookie('archive_speed',$_POST['archivespeed']);
27
+	setcookie('archive', 'true');
28
+	setcookie('archive_begin', strtotime($_POST['start_date']));
29
+	setcookie('archive_end', strtotime($_POST['end_date']));
30
+	setcookie('archive_speed', $_POST['archivespeed']);
31 31
 }
32 32
 if (isset($_POST['noarchive'])) {
33
-	setcookie('archive','false',-1);
34
-	setcookie('archive_begin','',-1);
35
-	setcookie('archive_end','',-1);
36
-	setcookie('archive_speed','',-1);
33
+	setcookie('archive', 'false', -1);
34
+	setcookie('archive_begin', '', -1);
35
+	setcookie('archive_end', '', -1);
36
+	setcookie('archive_speed', '', -1);
37 37
 }
38 38
 // When button "Remove all filters" is clicked
39 39
 if (isset($_POST['removefilters'])) {
40
-	$allfilters = array_filter(array_keys($_COOKIE),function($key) {
41
-	    return strpos($key,'filter_') === 0;
40
+	$allfilters = array_filter(array_keys($_COOKIE), function($key) {
41
+	    return strpos($key, 'filter_') === 0;
42 42
 	});
43 43
 	foreach ($allfilters as $filt) {
44 44
 		unset($_COOKIE[$filt]);
45
-		setcookie($filt,null,-1);
45
+		setcookie($filt, null, -1);
46 46
 	}
47 47
 }
48 48
 ?>
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
 <script src="<?php print $globalURL; ?>/js/MovingMarker.js"></script>
265 265
 <script src="<?php print $globalURL; ?>/js/jquery.idle.min.js"></script>
266 266
 <script src="<?php print $globalURL; ?>/js/map.common.js"></script>
267
-<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>
267
+<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>
268 268
 <?php
269 269
 		if (!isset($type) || $type == 'aircraft') {
270 270
 ?>
@@ -337,7 +337,7 @@  discard block
 block discarded – undo
337 337
 <script src="<?php print $globalURL; ?>/js/MovingMarker.js"></script>
338 338
 <script src="<?php print $globalURL; ?>/js/jquery.idle.min.js"></script>
339 339
 <script src="<?php print $globalURL; ?>/js/map.common.js"></script>
340
-<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>
340
+<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>
341 341
 <script src="<?php print $globalURL; ?>/js/map-aircraft.2d.js.php?flightaware_id=<?php print $flightaware_id; ?>&<?php print time(); ?>"></script>
342 342
 <?php
343 343
 		if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '' && ($MapType == 'Google-Roadmap' || $MapType == 'Google-Satellite' || $MapType == 'Google-Hybrid' || $MapType == 'Google-Terrain')) {
@@ -742,8 +742,8 @@  discard block
 block discarded – undo
742 742
 ?>
743 743
       <div class="search">
744 744
 	<form action="<?php print $globalURL; ?>/search" method="get">
745
-		<!--<input type="text" name="q" value="<?php if (isset($GET['q'])) { if ($_GET['q'] != ""){ print $_GET['q']; } else { print _("Search"); } } else { print _("Search"); } ?>" onfocus="if (this.value=='search'){this.value='';}" /><button type="submit"><i class="fa fa-search"></i></button>-->
746
-		<input type="text" name="callsign" value="<?php if (isset($GET['callsign'])) { if ($_GET['callsign'] != ""){ print $_GET['callsign']; } else { print _("Search"); } } else { print _("Search"); } ?>" onfocus="if (this.value=='search'){this.value='';}" /><button type="submit"><i class="fa fa-search"></i></button>
745
+		<!--<input type="text" name="q" value="<?php if (isset($GET['q'])) { if ($_GET['q'] != "") { print $_GET['q']; } else { print _("Search"); } } else { print _("Search"); } ?>" onfocus="if (this.value=='search'){this.value='';}" /><button type="submit"><i class="fa fa-search"></i></button>-->
746
+		<input type="text" name="callsign" value="<?php if (isset($GET['callsign'])) { if ($_GET['callsign'] != "") { print $_GET['callsign']; } else { print _("Search"); } } else { print _("Search"); } ?>" onfocus="if (this.value=='search'){this.value='';}" /><button type="submit"><i class="fa fa-search"></i></button>
747 747
 	</form>
748 748
 	</div>
749 749
   	<div class="social">
@@ -761,7 +761,7 @@  discard block
 block discarded – undo
761 761
 	print '</div>';
762 762
 }
763 763
 
764
-if (strtolower($current_page) =='ident-detailed' || strtolower($current_page) == 'flightid-overview') {
764
+if (strtolower($current_page) == 'ident-detailed' || strtolower($current_page) == 'flightid-overview') {
765 765
 ?>
766 766
     <div class="top-header clear" role="main">
767 767
 <?php
@@ -774,7 +774,7 @@  discard block
 block discarded – undo
774 774
     </div>
775 775
 <?php
776 776
 }
777
-if ((strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false) || (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false))
777
+if ((strpos(strtolower($current_page), 'airport-') !== false && strpos(strtolower($current_page), 'statistics-') === false) || (strpos(strtolower($current_page), 'route-') !== false && strpos(strtolower($current_page), 'statistics-') === false))
778 778
 {
779 779
     ?>
780 780
     <div class="top-header clear" role="main">
@@ -787,15 +787,15 @@  discard block
 block discarded – undo
787 787
         var zoom = 13;
788 788
 //create the map
789 789
 <?php
790
-    if (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($airport_array[0]['latitude'])) {
790
+    if (strpos(strtolower($current_page), 'airport-') !== false && strpos(strtolower($current_page), 'statistics-') === false && isset($airport_array[0]['latitude'])) {
791 791
 ?>
792 792
   map = L.map('map', { zoomControl:true }).setView([<?php print $airport_array[0]['latitude']; ?>,<?php print $airport_array[0]['longitude']; ?>], zoom);
793 793
 <?php
794
-    } elseif (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false) {
794
+    } elseif (strpos(strtolower($current_page), 'airport-') !== false && strpos(strtolower($current_page), 'statistics-') === false) {
795 795
 ?>
796 796
   map = L.map('map', { zoomControl:true });
797 797
 <?php
798
-    } elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($spotter_array[0]['departure_airport_latitude'])) {
798
+    } elseif (strpos(strtolower($current_page), 'route-') !== false && strpos(strtolower($current_page), 'statistics-') === false && isset($spotter_array[0]['departure_airport_latitude'])) {
799 799
 ?>
800 800
   map = L.map('map', { zoomControl:true }).setView([<?php print $spotter_array[0]['departure_airport_latitude']; ?>,<?php print $spotter_array[0]['arrival_airport_longitude']; ?>]);
801 801
     var line = L.polyline([[<?php print $spotter_array[0]['departure_airport_latitude']; ?>, <?php print $spotter_array[0]['departure_airport_longitude']; ?>],[<?php print $spotter_array[0]['arrival_airport_latitude']; ?>, <?php print $spotter_array[0]['arrival_airport_longitude']; ?>]]).addTo(map);
@@ -803,7 +803,7 @@  discard block
 block discarded – undo
803 803
     var departure_airport = L.marker([<?php print $spotter_array[0]['departure_airport_latitude']; ?>, <?php print $spotter_array[0]['departure_airport_longitude']; ?>], {icon: L.icon({iconUrl: '<?php print $globalURL; ?>/images/departure_airport.png',iconSize: [16,18],iconAnchor: [8,16]})}).addTo(map);
804 804
     var arrival_airport = L.marker([<?php print $spotter_array[0]['arrival_airport_latitude']; ?>, <?php print $spotter_array[0]['arrival_airport_longitude']; ?>], {icon: L.icon({iconUrl: '<?php print $globalURL; ?>/images/arrival_airport.png',iconSize: [16,18],iconAnchor: [8,16]})}).addTo(map);
805 805
 <?php
806
-    } elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && !isset($spotter_array[0]['departure_airport_latitude']) && isset($spotter_array[0]['latitude'])) {
806
+    } elseif (strpos(strtolower($current_page), 'route-') !== false && strpos(strtolower($current_page), 'statistics-') === false && !isset($spotter_array[0]['departure_airport_latitude']) && isset($spotter_array[0]['latitude'])) {
807 807
 ?>
808 808
   map = L.map('map', { zoomControl:true }).setView([<?php print $spotter_array[0]['latitude']; ?>,<?php print $spotter_array[0]['longitude']; ?>]);
809 809
 <?php
Please login to merge, or discard this patch.
Indentation   +74 added lines, -74 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 // When button "Remove all filters" is clicked
39 39
 if (isset($_POST['removefilters'])) {
40 40
 	$allfilters = array_filter(array_keys($_COOKIE),function($key) {
41
-	    return strpos($key,'filter_') === 0;
41
+		return strpos($key,'filter_') === 0;
42 42
 	});
43 43
 	foreach ($allfilters as $filt) {
44 44
 		unset($_COOKIE[$filt]);
@@ -404,34 +404,34 @@  discard block
 block discarded – undo
404 404
 
405 405
       <ul class="nav navbar-nav">
406 406
 <?php
407
-    if (isset($globalNewsFeeds['global']) && !empty($globalNewsFeeds['global'])) {
407
+	if (isset($globalNewsFeeds['global']) && !empty($globalNewsFeeds['global'])) {
408 408
 ?>
409 409
     <li><a href="<?php print $globalURL; ?>/news"><?php echo _("News"); ?></a></li>
410 410
 <?php
411
-    }
411
+	}
412 412
 ?>
413 413
 
414 414
 <?php 
415
-    $sub = false;
416
-    if (
415
+	$sub = false;
416
+	if (
417 417
 	(
418
-	    (!isset($globalAircraft) || (isset($globalAircraft) && $globalAircraft === TRUE)) && ((isset($globalMarine) && $globalMarine === TRUE) || (isset($globalTracker) && $globalTracker === TRUE) || (isset($globalSatellite) && $globalSatellite === TRUE))
418
+		(!isset($globalAircraft) || (isset($globalAircraft) && $globalAircraft === TRUE)) && ((isset($globalMarine) && $globalMarine === TRUE) || (isset($globalTracker) && $globalTracker === TRUE) || (isset($globalSatellite) && $globalSatellite === TRUE))
419 419
 	) || 
420 420
 	(
421
-	    isset($globalMarine) && $globalMarine === TRUE && ((isset($globalTracker) && $globalTracker === TRUE) || (isset($globalSatellite) && $globalSatellite === TRUE))
421
+		isset($globalMarine) && $globalMarine === TRUE && ((isset($globalTracker) && $globalTracker === TRUE) || (isset($globalSatellite) && $globalSatellite === TRUE))
422 422
 	) || 
423 423
 	(
424
-	    isset($globalTracker) && $globalTracker === TRUE && ((isset($globalMarine) && $globalMarine === TRUE) || (isset($globalSatellite) && $globalSatellite === TRUE))
424
+		isset($globalTracker) && $globalTracker === TRUE && ((isset($globalMarine) && $globalMarine === TRUE) || (isset($globalSatellite) && $globalSatellite === TRUE))
425 425
 	) || 
426 426
 	(
427
-	    isset($globalSatellite) && $globalSatellite === TRUE && ((isset($globalMarine) && $globalMarine === TRUE) || (isset($globalTracker) && $globalTracker === TRUE))
427
+		isset($globalSatellite) && $globalSatellite === TRUE && ((isset($globalMarine) && $globalMarine === TRUE) || (isset($globalTracker) && $globalTracker === TRUE))
428 428
 	)
429
-    ) {
429
+	) {
430 430
 	$sub = true;
431
-    }
431
+	}
432 432
 ?>
433 433
 <?php
434
-    if (!isset($globalAircraft) || $globalAircraft === TRUE) {
434
+	if (!isset($globalAircraft) || $globalAircraft === TRUE) {
435 435
 ?>
436 436
     <li class="dropdown">
437 437
 <?php
@@ -442,7 +442,7 @@  discard block
 block discarded – undo
442 442
 	<ul class="dropdown-menu multi-level">
443 443
       	<li class="dropdown-submenu">
444 444
 <?php
445
-        }
445
+		}
446 446
 ?>
447 447
 <?php
448 448
 	if (isset($globalNewsFeeds['aircraft']) && !empty($globalNewsFeeds['aircraft'])) {
@@ -457,25 +457,25 @@  discard block
 block discarded – undo
457 457
           <ul class="dropdown-menu">
458 458
           	<li><a href="<?php print $globalURL; ?>/aircraft"><?php echo _("Aircraft Types"); ?></a></li>
459 459
 <?php
460
-    if (!isset($globalNoAirlines) || $globalNoAirlines === FALSE) {
460
+	if (!isset($globalNoAirlines) || $globalNoAirlines === FALSE) {
461 461
 ?>
462 462
 			<li><a href="<?php print $globalURL; ?>/airline"><?php echo _("Airlines"); ?></a></li>
463 463
 <?php
464
-    }
464
+	}
465 465
 ?>
466 466
 			<li><a href="<?php print $globalURL; ?>/airport"><?php echo _("Airports"); ?></a></li>
467 467
 <?php
468
-    if ((isset($globalUseOwner) && $globalUseOwner) || (!isset($globalUseOwner) && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalVAM) || !$globalVAM))) {
468
+	if ((isset($globalUseOwner) && $globalUseOwner) || (!isset($globalUseOwner) && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalVAM) || !$globalVAM))) {
469 469
 ?>
470 470
 			<li><a href="<?php print $globalURL; ?>/owner"><?php echo _("Owners"); ?></a></li>
471 471
 <?php
472
-    } 
473
-    if ((isset($globalUsePilot) && $globalUsePilot) || !isset($globalUsePilot) && ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || (isset($globalVAM) && $globalVAM))) {
472
+	} 
473
+	if ((isset($globalUsePilot) && $globalUsePilot) || !isset($globalUsePilot) && ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || (isset($globalVAM) && $globalVAM))) {
474 474
 
475 475
 ?>
476 476
 			<li><a href="<?php print $globalURL; ?>/pilot"><?php echo _("Pilots"); ?></a></li>
477 477
 <?php
478
-    }
478
+	}
479 479
 ?>
480 480
 			<li><hr /></li>
481 481
             <li><a href="<?php print $globalURL; ?>/currently"><?php echo _("Current Activity"); ?></a></li>
@@ -483,43 +483,43 @@  discard block
 block discarded – undo
483 483
             <li><a href="<?php print $globalURL; ?>/date/<?php print date("Y-m-d"); ?>"><?php echo _("Today's Activity"); ?></a></li>
484 484
             <li><a href="<?php print $globalURL; ?>/newest"><?php echo _("Newest by Category"); ?></a></li>
485 485
             <?php
486
-        	if ($globalACARS) {
487
-        	    if (isset($globalDemo) && $globalDemo) {
488
-    	    ?>
486
+			if ($globalACARS) {
487
+				if (isset($globalDemo) && $globalDemo) {
488
+			?>
489 489
             <li><hr /></li>
490 490
             <li><i><?php echo _('ACARS data not available publicly'); ?></i></li>
491 491
             <li><a href=""><?php echo _('Latest ACARS messages'); ?></a></li>
492 492
             <li><a href=""><?php echo _('Archive ACARS messages'); ?></a></li>
493 493
             <?php
494
-        	    } else {
495
-    	    ?>
494
+				} else {
495
+			?>
496 496
             <li><hr /></li>
497 497
             <li><a href="<?php print $globalURL; ?>/acars-latest"><?php echo _("Latest ACARS messages"); ?></a></li>
498 498
             <li><a href="<?php print $globalURL; ?>/acars-archive"><?php echo _("Archive ACARS messages"); ?></a></li>
499 499
             <?php
500
-        	    }
501
-        	}
502
-    	    ?>
500
+				}
501
+			}
502
+			?>
503 503
     	    <?php
504
-    	        if (isset($globalAccidents) && $globalAccidents) {
505
-    	    ?>
504
+				if (isset($globalAccidents) && $globalAccidents) {
505
+			?>
506 506
             <li><hr /></li>
507 507
             <li><a href="<?php print $globalURL; ?>/accident-latest"><?php echo _("Latest accident"); ?></a></li>
508 508
             <li><a href="<?php print $globalURL; ?>/accident/<?php print date("Y-m-d"); ?>"><?php echo _("Today's Accident"); ?></a></li>
509 509
             <li><a href="<?php print $globalURL; ?>/incident-latest"><?php echo _("Latest incident"); ?></a></li>
510 510
             <li><a href="<?php print $globalURL; ?>/incident/<?php print date("Y-m-d"); ?>"><?php echo _("Today's Incident"); ?></a></li>
511 511
             <?php
512
-        	}
513
-    	    ?>
512
+			}
513
+			?>
514 514
             <li><hr /></li>
515 515
             <li><a href="<?php print $globalURL; ?>/highlights/table"><?php echo _("Special Highlights"); ?></a></li>
516 516
             <?php
517 517
 		if (!isset($globalNoUpcoming) || $globalNoUpcoming === FALSE) {
518
-	    ?>
518
+		?>
519 519
             <li><a href="<?php print $globalURL; ?>/upcoming"><?php echo _("Upcoming Flights"); ?></a></li>
520 520
 	    <?php
521 521
 		}
522
-	    ?>
522
+		?>
523 523
           </ul>
524 524
         </li>
525 525
       	<li><a href="<?php print $globalURL; ?>/search"><?php echo _("Search"); ?></a></li>
@@ -546,14 +546,14 @@  discard block
 block discarded – undo
546 546
     </ul>
547 547
 <?php
548 548
 	}
549
-    }
549
+	}
550 550
 ?>
551 551
 <?php
552
-    if (isset($globalMarine) && $globalMarine) {
552
+	if (isset($globalMarine) && $globalMarine) {
553 553
 ?>
554 554
     <li class="dropdown">
555 555
 <?php
556
-        if ($sub) {
556
+		if ($sub) {
557 557
 ?>
558 558
     <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Marines"); ?> <b class="caret"></b></a>
559 559
 	<ul class="dropdown-menu multi-level">
@@ -587,14 +587,14 @@  discard block
 block discarded – undo
587 587
 	}
588 588
 ?>
589 589
 <?php
590
-    }
590
+	}
591 591
 ?>
592 592
 <?php
593
-    if (isset($globalTracker) && $globalTracker) {
593
+	if (isset($globalTracker) && $globalTracker) {
594 594
 ?>
595 595
     <li class="dropdown">
596 596
 <?php
597
-        if ($sub) {
597
+		if ($sub) {
598 598
 ?>
599 599
     <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Trackers"); ?> <b class="caret"></b></a>
600 600
 	<ul class="dropdown-menu multi-level">
@@ -628,14 +628,14 @@  discard block
 block discarded – undo
628 628
 	}
629 629
 ?>
630 630
 <?php
631
-    }
631
+	}
632 632
 ?>
633 633
 <?php
634
-    if (isset($globalSatellite) && $globalSatellite) {
634
+	if (isset($globalSatellite) && $globalSatellite) {
635 635
 ?>
636 636
     <li class="dropdown">
637 637
 <?php
638
-        if ($sub) {
638
+		if ($sub) {
639 639
 ?>
640 640
     <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Satellites"); ?> <b class="caret"></b></a>
641 641
 	<ul class="dropdown-menu multi-level">
@@ -671,7 +671,7 @@  discard block
 block discarded – undo
671 671
 	}
672 672
 ?>
673 673
 <?php
674
-    }
674
+	}
675 675
 ?>
676 676
 
677 677
         <li class="dropdown">
@@ -680,12 +680,12 @@  discard block
 block discarded – undo
680 680
           	<li><a href="<?php print $globalURL; ?>/about"><?php echo _("About The Project"); ?></a></li>
681 681
           	<li><a href="<?php print $globalURL; ?>/about/export"><?php echo _("Exporting Data"); ?></a></li>
682 682
 <?php
683
-    if (!isset($globalAircraft) || $globalAircraft === TRUE) {
683
+	if (!isset($globalAircraft) || $globalAircraft === TRUE) {
684 684
 ?>
685 685
 		<li><hr /></li>
686 686
 		<li><a href="<?php print $globalURL; ?>/about/tv"><?php echo _("Spotter TV"); ?></a></li>
687 687
 <?php
688
-    }
688
+	}
689 689
 ?>
690 690
 	    <?php if (isset($globalContribute) && $globalContribute) { ?>
691 691
                 <li><hr /></li>
@@ -709,13 +709,13 @@  discard block
 block discarded – undo
709 709
   	    <form>
710 710
   		<select class="selectpicker" data-width="120px" onchange="language(this);">
711 711
   		    <?php
712
-  		        foreach ($alllang as $key => $lang) {
713
-  		            print '<option value="'.$key.'"';
714
-  		            if (isset($_COOKIE['language']) && $_COOKIE['language'] == $key) print ' selected ';
715
-  		            if ($lang[0] == 'Deutsch') print '>'.$lang[0].' (&beta;eta)</option>';
716
-  		            else print '>'.$lang[0].'</option>';
717
-  		        }
718
-  		    ?>
712
+  				foreach ($alllang as $key => $lang) {
713
+  					print '<option value="'.$key.'"';
714
+  					if (isset($_COOKIE['language']) && $_COOKIE['language'] == $key) print ' selected ';
715
+  					if ($lang[0] == 'Deutsch') print '>'.$lang[0].' (&beta;eta)</option>';
716
+  					else print '>'.$lang[0].'</option>';
717
+  				}
718
+  			?>
719 719
   		</select>
720 720
   	    </form>
721 721
   	</div>
@@ -748,18 +748,18 @@  discard block
 block discarded – undo
748 748
 ?>
749 749
     <div class="top-header clear" role="main">
750 750
 <?php
751
-    if (isset($longitude) && isset($latitude) && $longitude != 0 && $latitude != 0) {
751
+	if (isset($longitude) && isset($latitude) && $longitude != 0 && $latitude != 0) {
752 752
 ?>
753 753
     <div id="archive-map"></div>
754 754
 <?php
755
-    }
755
+	}
756 756
 ?>
757 757
     </div>
758 758
 <?php
759 759
 }
760 760
 if ((strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false) || (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false))
761 761
 {
762
-    ?>
762
+	?>
763 763
     <div class="top-header clear" role="main">
764 764
         <div id="map"></div>
765 765
 	<link rel="stylesheet" href="<?php print $globalURL; ?>/css/leaflet.css" />
@@ -770,15 +770,15 @@  discard block
 block discarded – undo
770 770
         var zoom = 13;
771 771
 //create the map
772 772
 <?php
773
-    if (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($airport_array[0]['latitude'])) {
773
+	if (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($airport_array[0]['latitude'])) {
774 774
 ?>
775 775
   map = L.map('map', { zoomControl:true }).setView([<?php print $airport_array[0]['latitude']; ?>,<?php print $airport_array[0]['longitude']; ?>], zoom);
776 776
 <?php
777
-    } elseif (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false) {
777
+	} elseif (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false) {
778 778
 ?>
779 779
   map = L.map('map', { zoomControl:true });
780 780
 <?php
781
-    } elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($spotter_array[0]['departure_airport_latitude'])) {
781
+	} elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($spotter_array[0]['departure_airport_latitude'])) {
782 782
 ?>
783 783
   map = L.map('map', { zoomControl:true }).setView([<?php print $spotter_array[0]['departure_airport_latitude']; ?>,<?php print $spotter_array[0]['arrival_airport_longitude']; ?>]);
784 784
     var line = L.polyline([[<?php print $spotter_array[0]['departure_airport_latitude']; ?>, <?php print $spotter_array[0]['departure_airport_longitude']; ?>],[<?php print $spotter_array[0]['arrival_airport_latitude']; ?>, <?php print $spotter_array[0]['arrival_airport_longitude']; ?>]]).addTo(map);
@@ -786,22 +786,22 @@  discard block
 block discarded – undo
786 786
     var departure_airport = L.marker([<?php print $spotter_array[0]['departure_airport_latitude']; ?>, <?php print $spotter_array[0]['departure_airport_longitude']; ?>], {icon: L.icon({iconUrl: '<?php print $globalURL; ?>/images/departure_airport.png',iconSize: [16,18],iconAnchor: [8,16]})}).addTo(map);
787 787
     var arrival_airport = L.marker([<?php print $spotter_array[0]['arrival_airport_latitude']; ?>, <?php print $spotter_array[0]['arrival_airport_longitude']; ?>], {icon: L.icon({iconUrl: '<?php print $globalURL; ?>/images/arrival_airport.png',iconSize: [16,18],iconAnchor: [8,16]})}).addTo(map);
788 788
 <?php
789
-    } elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && !isset($spotter_array[0]['departure_airport_latitude']) && isset($spotter_array[0]['latitude'])) {
789
+	} elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && !isset($spotter_array[0]['departure_airport_latitude']) && isset($spotter_array[0]['latitude'])) {
790 790
 ?>
791 791
   map = L.map('map', { zoomControl:true }).setView([<?php print $spotter_array[0]['latitude']; ?>,<?php print $spotter_array[0]['longitude']; ?>]);
792 792
 <?php
793
-    } elseif (!isset($spotter_array[0]['latitude']) && !isset($spotter_array[0]['longitude'])) {
793
+	} elseif (!isset($spotter_array[0]['latitude']) && !isset($spotter_array[0]['longitude'])) {
794 794
 ?>
795 795
   map = L.map('map', { zoomControl:true });
796 796
 <?php
797
-    }
797
+	}
798 798
 ?>
799 799
   //initialize the layer group for the aircrft markers
800 800
   var layer_data = L.layerGroup();
801 801
 
802 802
   //a few title layers
803 803
 <?php
804
-    if ($globalMapProvider == 'Mapbox') {
804
+	if ($globalMapProvider == 'Mapbox') {
805 805
 ?>
806 806
   L.tileLayer('https://{s}.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token={token}', {
807 807
     maxZoom: 18,
@@ -812,14 +812,14 @@  discard block
 block discarded – undo
812 812
     token : '<?php print $globalMapboxToken; ?>'
813 813
   }).addTo(map);
814 814
 <?php
815
-    } elseif ($globalMapProvider == 'Mapbox-GL') {
815
+	} elseif ($globalMapProvider == 'Mapbox-GL') {
816 816
 ?>
817 817
     L.mapboxGL({
818 818
 	accessToken: '<?php print $globalMapboxToken; ?>',
819 819
 	style: 'mapbox://styles/mapbox/bright-v8'
820 820
   }).addTo(map);
821 821
 <?php
822
-    } elseif ($globalMapProvider == 'MapQuest-OSM') {
822
+	} elseif ($globalMapProvider == 'MapQuest-OSM') {
823 823
 ?>
824 824
   L.tileLayer('http://otile1.mqcdn.com/tiles/1.0.0/map/{z}/{x}/{y}.png', {
825 825
     maxZoom: 18,
@@ -828,7 +828,7 @@  discard block
 block discarded – undo
828 828
       'Tiles Courtesy of <a href="http://www.mapquest.com">MapQuest</a>'
829 829
   }).addTo(map);
830 830
 <?php
831
-    } elseif ($globalMapProvider == 'MapQuest-Aerial') {
831
+	} elseif ($globalMapProvider == 'MapQuest-Aerial') {
832 832
 ?>
833 833
   L.tileLayer('http://otile1.mqcdn.com/tiles/1.0.0/sat/{z}/{x}/{y}.png', {
834 834
     maxZoom: 18,
@@ -837,27 +837,27 @@  discard block
 block discarded – undo
837 837
       'Tiles Courtesy of <a href="http://www.mapquest.com">MapQuest</a>, Portions Courtesy NASA/JPL-Caltech and U.S. Depart. of Agriculture, Farm Service Agency"'
838 838
   }).addTo(map);
839 839
 <?php
840
-    } elseif ($globalMapProvider == 'Google-Roadmap') {
840
+	} elseif ($globalMapProvider == 'Google-Roadmap') {
841 841
 ?>
842 842
     var googleLayer = new L.Google('ROADMAP');
843 843
     map.addLayer(googleLayer);
844 844
 <?php
845
-    } elseif ($globalMapProvider == 'Google-Satellite') {
845
+	} elseif ($globalMapProvider == 'Google-Satellite') {
846 846
 ?>
847 847
     var googleLayer = new L.Google('SATELLITE');
848 848
     map.addLayer(googleLayer);
849 849
 <?php
850
-    } elseif ($globalMapProvider == 'Google-Hybrid') {
850
+	} elseif ($globalMapProvider == 'Google-Hybrid') {
851 851
 ?>
852 852
     var googleLayer = new L.Google('HYBRID');
853 853
     map.addLayer(googleLayer);
854 854
 <?php
855
-    } elseif ($globalMapProvider == 'Google-Terrain') {
855
+	} elseif ($globalMapProvider == 'Google-Terrain') {
856 856
 ?>
857 857
     var googleLayer = new L.Google('Terrain');
858 858
     map.addLayer(googleLayer);
859 859
 <?php
860
-    } elseif (isset($globalMapCustomLayer[$globalMapProvider])) {
860
+	} elseif (isset($globalMapCustomLayer[$globalMapProvider])) {
861 861
 	$customid = $globalMapProvider;
862 862
 ?>
863 863
     L.tileLayer('<?php print $globalMapCustomLayer[$customid]['url']; ?>/{z}/{x}/{y}.png', {
@@ -867,7 +867,7 @@  discard block
 block discarded – undo
867 867
         attribution: '<?php print $globalMapCustomLayer[$customid]['attribution']; ?>'
868 868
     }).addTo(map);
869 869
 <?php
870
-    } elseif ($globalMapProvider == 'offline' || (isset($globalMapOffline) && $globalMapOffline === TRUE)) {
870
+	} elseif ($globalMapProvider == 'offline' || (isset($globalMapOffline) && $globalMapOffline === TRUE)) {
871 871
 ?>
872 872
     var center = map.getCenter();
873 873
     map.options.crs = L.CRS.EPSG4326;
@@ -882,8 +882,8 @@  discard block
 block discarded – undo
882 882
         attribution: 'Natural Earth'
883 883
     }).addTo(map);
884 884
 <?php
885
-    //} elseif ($globalMapProvider == 'OpenStreetMap') {
886
-    } else {
885
+	//} elseif ($globalMapProvider == 'OpenStreetMap') {
886
+	} else {
887 887
 ?>
888 888
   L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
889 889
     maxZoom: 18,
@@ -892,7 +892,7 @@  discard block
 block discarded – undo
892 892
   }).addTo(map);
893 893
 
894 894
 <?php
895
-    }
895
+	}
896 896
 ?>
897 897
         </script>
898 898
     </div>
Please login to merge, or discard this patch.
Braces   +95 added lines, -22 removed lines patch added patch discarded remove patch
@@ -6,12 +6,19 @@  discard block
 block discarded – undo
6 6
 //gets the page file and stores it in a variable
7 7
 $file_path = pathinfo($_SERVER['SCRIPT_NAME']);
8 8
 $current_page = $file_path['filename'];
9
-if ($globalTimezone == '') $globalTimezone = 'UTC';
9
+if ($globalTimezone == '') {
10
+	$globalTimezone = 'UTC';
11
+}
10 12
 date_default_timezone_set($globalTimezone);
11
-if (isset($_COOKIE['MapType']) && $_COOKIE['MapType'] != '') $MapType = $_COOKIE['MapType'];
12
-else $MapType = $globalMapProvider;
13
+if (isset($_COOKIE['MapType']) && $_COOKIE['MapType'] != '') {
14
+	$MapType = $_COOKIE['MapType'];
15
+} else {
16
+	$MapType = $globalMapProvider;
17
+}
13 18
 
14
-if (isset($globalMapOffline) && $globalMapOffline) $MapType = 'offline';
19
+if (isset($globalMapOffline) && $globalMapOffline) {
20
+	$MapType = 'offline';
21
+}
15 22
 
16 23
 if (isset($_GET['3d'])) {
17 24
 	setcookie('MapFormat','3d');
@@ -204,7 +211,10 @@  discard block
 block discarded – undo
204 211
 <?php
205 212
 		} else {
206 213
 ?>
207
-<script src="<?php print $globalURL; ?>/js/map.2d.js.php?<?php print time(); ?><?php if (isset($tsk)) print '&tsk='.$tsk; ?>"></script>
214
+<script src="<?php print $globalURL; ?>/js/map.2d.js.php?<?php print time(); ?><?php if (isset($tsk)) {
215
+	print '&tsk='.$tsk;
216
+}
217
+?>"></script>
208 218
 <?php
209 219
 		}
210 220
 		if (!isset($globalAircraft) || $globalAircraft) {
@@ -244,7 +254,13 @@  discard block
 block discarded – undo
244 254
 <script src="<?php print $globalURL; ?>/js/MovingMarker.js"></script>
245 255
 <script src="<?php print $globalURL; ?>/js/jquery.idle.min.js"></script>
246 256
 <script src="<?php print $globalURL; ?>/js/map.common.js"></script>
247
-<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>
257
+<script src="<?php print $globalURL; ?>/js/map.2d.js.php?ident=<?php print $ident; ?><?php if(isset($latitude)) {
258
+	print '&latitude='.$latitude;
259
+}
260
+?><?php if(isset($longitude)) {
261
+	print '&longitude='.$longitude;
262
+}
263
+?>&<?php print time(); ?>"></script>
248 264
 <?php
249 265
 		if (!isset($type) || $type == 'aircraft') {
250 266
 ?>
@@ -317,7 +333,13 @@  discard block
 block discarded – undo
317 333
 <script src="<?php print $globalURL; ?>/js/MovingMarker.js"></script>
318 334
 <script src="<?php print $globalURL; ?>/js/jquery.idle.min.js"></script>
319 335
 <script src="<?php print $globalURL; ?>/js/map.common.js"></script>
320
-<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>
336
+<script src="<?php print $globalURL; ?>/js/map.2d.js.php?flightaware_id=<?php print $flightaware_id; ?><?php if(isset($latitude)) {
337
+	print '&latitude='.$latitude;
338
+}
339
+?><?php if(isset($longitude)) {
340
+	print '&longitude='.$longitude;
341
+}
342
+?>&<?php print time(); ?>"></script>
321 343
 <script src="<?php print $globalURL; ?>/js/map-aircraft.2d.js.php?flightaware_id=<?php print $flightaware_id; ?>&<?php print time(); ?>"></script>
322 344
 <?php
323 345
 		if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '' && ($MapType == 'Google-Roadmap' || $MapType == 'Google-Satellite' || $MapType == 'Google-Hybrid' || $MapType == 'Google-Terrain')) {
@@ -398,7 +420,12 @@  discard block
 block discarded – undo
398 420
         <span class="icon-bar"></span>
399 421
       </button>
400 422
       <a href="<?php print $globalURL; ?>/search" class="navbar-toggle search"><i class="fa fa-search"></i></a>
401
-      <a class="navbar-brand" href="<?php if ($globalURL == '') print '/'; else print $globalURL; ?>"><img src="<?php print $globalURL.$logoURL; ?>" height="30px" /></a>
423
+      <a class="navbar-brand" href="<?php if ($globalURL == '') {
424
+	print '/';
425
+} else {
426
+	print $globalURL;
427
+}
428
+?>"><img src="<?php print $globalURL.$logoURL; ?>" height="30px" /></a>
402 429
     </div>
403 430
     <div class="collapse navbar-collapse">
404 431
 
@@ -453,7 +480,10 @@  discard block
 block discarded – undo
453 480
 	}
454 481
 ?>
455 482
 
456
-          <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) echo 'right-'; ?>caret"></b></a>
483
+          <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) {
484
+	echo 'right-';
485
+}
486
+?>caret"></b></a>
457 487
           <ul class="dropdown-menu">
458 488
           	<li><a href="<?php print $globalURL; ?>/aircraft"><?php echo _("Aircraft Types"); ?></a></li>
459 489
 <?php
@@ -524,8 +554,14 @@  discard block
 block discarded – undo
524 554
         </li>
525 555
       	<li><a href="<?php print $globalURL; ?>/search"><?php echo _("Search"); ?></a></li>
526 556
       	<li><a href="<?php print $globalURL; ?>/statistics"><?php echo _("Statistics"); ?></a></li>
527
-        <li class="dropdown<?php if ($sub) echo '-submenu'; ?>">
528
-          <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Tools"); ?> <b class="<?php if ($sub) echo 'right-'; ?>caret"></b></a>
557
+        <li class="dropdown<?php if ($sub) {
558
+	echo '-submenu';
559
+}
560
+?>">
561
+          <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Tools"); ?> <b class="<?php if ($sub) {
562
+	echo 'right-';
563
+}
564
+?>caret"></b></a>
529 565
           <ul class="dropdown-menu">
530 566
           	<li><a href="<?php print $globalURL; ?>/tools/acars"><?php echo _("ACARS translator"); ?></a></li>
531 567
           	<li><a href="<?php print $globalURL; ?>/tools/metar"><?php echo _("METAR translator"); ?></a></li>
@@ -569,7 +605,10 @@  discard block
 block discarded – undo
569 605
 <?php
570 606
 	}
571 607
 ?>
572
-		<a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) echo 'right-'; ?>caret"></b></a>
608
+		<a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) {
609
+	echo 'right-';
610
+}
611
+?>caret"></b></a>
573 612
 		<ul class="dropdown-menu">
574 613
 		    <li><a href="<?php print $globalURL; ?>/marine/currently"><?php echo _("Current Activity"); ?></a></li>
575 614
 		    <li><a href="<?php print $globalURL; ?>/marine/latest"><?php echo _("Latest Activity"); ?></a></li>
@@ -610,7 +649,10 @@  discard block
 block discarded – undo
610 649
 <?php
611 650
 	}
612 651
 ?>
613
-		<a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) echo 'right-'; ?>caret"></b></a>
652
+		<a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) {
653
+	echo 'right-';
654
+}
655
+?>caret"></b></a>
614 656
 		<ul class="dropdown-menu">
615 657
 		    <li><a href="<?php print $globalURL; ?>/tracker/currently"><?php echo _("Current Activity"); ?></a></li>
616 658
 		    <li><a href="<?php print $globalURL; ?>/tracker/latest"><?php echo _("Latest Activity"); ?></a></li>
@@ -653,7 +695,10 @@  discard block
 block discarded – undo
653 695
 ?>
654 696
 
655 697
 <!--
656
-		<a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) echo 'right-'; ?>caret"></b></a>
698
+		<a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) {
699
+	echo 'right-';
700
+}
701
+?>caret"></b></a>
657 702
 		<ul class="dropdown-menu">
658 703
 		    <li><a href="<?php print $globalURL; ?>/satellite/currently"><?php echo _("Current Activity"); ?></a></li>
659 704
 		    <li><a href="<?php print $globalURL; ?>/satellite/latest"><?php echo _("Latest Activity"); ?></a></li>
@@ -711,9 +756,14 @@  discard block
 block discarded – undo
711 756
   		    <?php
712 757
   		        foreach ($alllang as $key => $lang) {
713 758
   		            print '<option value="'.$key.'"';
714
-  		            if (isset($_COOKIE['language']) && $_COOKIE['language'] == $key) print ' selected ';
715
-  		            if ($lang[0] == 'Deutsch') print '>'.$lang[0].' (&beta;eta)</option>';
716
-  		            else print '>'.$lang[0].'</option>';
759
+  		            if (isset($_COOKIE['language']) && $_COOKIE['language'] == $key) {
760
+  		            	print ' selected ';
761
+  		            }
762
+  		            if ($lang[0] == 'Deutsch') {
763
+  		            	print '>'.$lang[0].' (&beta;eta)</option>';
764
+  		            } else {
765
+  		            	print '>'.$lang[0].'</option>';
766
+  		            }
717 767
   		        }
718 768
   		    ?>
719 769
   		</select>
@@ -861,9 +911,24 @@  discard block
 block discarded – undo
861 911
 	$customid = $globalMapProvider;
862 912
 ?>
863 913
     L.tileLayer('<?php print $globalMapCustomLayer[$customid]['url']; ?>/{z}/{x}/{y}.png', {
864
-        maxZoom: <?php if (isset($globalMapCustomLayer[$customid]['maxZoom'])) print $globalMapCustomLayer[$customid]['maxZoom']; else print '18'; ?>,
865
-        minZoom: <?php if (isset($globalMapCustomLayer[$customid]['minZoom'])) print $globalMapCustomLayer[$customid]['minZoom']; else print '0'; ?>,
866
-        noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>,
914
+        maxZoom: <?php if (isset($globalMapCustomLayer[$customid]['maxZoom'])) {
915
+	print $globalMapCustomLayer[$customid]['maxZoom'];
916
+} else {
917
+	print '18';
918
+}
919
+?>,
920
+        minZoom: <?php if (isset($globalMapCustomLayer[$customid]['minZoom'])) {
921
+	print $globalMapCustomLayer[$customid]['minZoom'];
922
+} else {
923
+	print '0';
924
+}
925
+?>,
926
+        noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) {
927
+	print 'false';
928
+} else {
929
+	print 'true';
930
+}
931
+?>,
867 932
         attribution: '<?php print $globalMapCustomLayer[$customid]['attribution']; ?>'
868 933
     }).addTo(map);
869 934
 <?php
@@ -878,7 +943,12 @@  discard block
 block discarded – undo
878 943
         maxZoom: 5,
879 944
         tms : true,
880 945
         zindex : 3,
881
-        noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>,
946
+        noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) {
947
+	print 'false';
948
+} else {
949
+	print 'true';
950
+}
951
+?>,
882 952
         attribution: 'Natural Earth'
883 953
     }).addTo(map);
884 954
 <?php
@@ -901,4 +971,7 @@  discard block
 block discarded – undo
901 971
 
902 972
 ?>
903 973
 
904
-<section class="container main-content <?php if (strtolower($current_page) == 'index') print 'index '; ?>clear">
974
+<section class="container main-content <?php if (strtolower($current_page) == 'index') {
975
+	print 'index ';
976
+}
977
+?>clear">
Please login to merge, or discard this patch.
require/class.MapMatching.php 2 patches
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -44,10 +44,10 @@  discard block
 block discarded – undo
44 44
 		$gpx .= '<gpx xmlns="http://www.topografix.com/GPX/1/1" xmlns:gpsies="http://www.gpsies.com/GPX/1/0" creator="GPSies http://www.gpsies.com - Sendl.-O&amp;apos;sch-heim" version="1.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd http://www.gpsies.com/GPX/1/0 http://www.gpsies.com/gpsies.xsd">';
45 45
 		$gpx .= '<trk>';
46 46
 		$gpx .= '<trkseg>';
47
-		foreach($spotter_history_array as $spotter_data) {
48
-			$gpx .= '<trkpt lat="'.sprintf("%.8f",$spotter_data['latitude']).'" lon="'.sprintf("%.8f",$spotter_data['longitude']).'">';
49
-			if (isset($spotter_data['altitude'])) $gpx .= '<ele>'.sprintf("%.6f",$spotter_data['altitude']).'</ele>';
50
-			$gpx .= '<time>'.date("Y-m-d\TH:i:s\Z",strtotime($spotter_data['date'])).'</time>';
47
+		foreach ($spotter_history_array as $spotter_data) {
48
+			$gpx .= '<trkpt lat="'.sprintf("%.8f", $spotter_data['latitude']).'" lon="'.sprintf("%.8f", $spotter_data['longitude']).'">';
49
+			if (isset($spotter_data['altitude'])) $gpx .= '<ele>'.sprintf("%.6f", $spotter_data['altitude']).'</ele>';
50
+			$gpx .= '<time>'.date("Y-m-d\TH:i:s\Z", strtotime($spotter_data['date'])).'</time>';
51 51
 			$gpx .= '</trkpt>';
52 52
 		}
53 53
 		$gpx .= '</trkseg>';
@@ -84,18 +84,18 @@  discard block
 block discarded – undo
84 84
 		global $globalMapMatchingMaxPts, $globalTrackMatchingAppKey, $globalTrackMatchingAppId;
85 85
 		if (!isset($globalMapMatchingMaxPts)) $globalMapMatchingMaxPts = 100;
86 86
 		if (count($spotter_history_array) < 2) return $spotter_history_array;
87
-		if (count($spotter_history_array) > $globalMapMatchingMaxPts) $spotter_history_array = array_slice($spotter_history_array,-$globalMapMatchingMaxPts);
87
+		if (count($spotter_history_array) > $globalMapMatchingMaxPts) $spotter_history_array = array_slice($spotter_history_array, -$globalMapMatchingMaxPts);
88 88
 		$data = $this->create_gpx($spotter_history_array);
89 89
 		$url = 'https://test.roadmatching.com/rest/mapmatch/?app_id='.$globalTrackMatchingAppId.'&app_key='.$globalTrackMatchingAppKey.'&output.waypoints=true';
90 90
 		$Common = new Common();
91
-		$matching = $Common->getData($url,'post',$data,array('Content-Type: application/gpx+xml','Accept: application/json'));
92
-		$matching = json_decode($matching,true);
91
+		$matching = $Common->getData($url, 'post', $data, array('Content-Type: application/gpx+xml', 'Accept: application/json'));
92
+		$matching = json_decode($matching, true);
93 93
 		if (isset($matching['diary']['entries'][0]['route']['links'])) {
94 94
 			$spotter_history_array = array();
95 95
 			foreach ($matching['diary']['entries'][0]['route']['links'] as $match) {
96 96
 				if (isset($match['wpts'])) {
97 97
 					foreach ($match['wpts'] as $coord) {
98
-						$spotter_history_array[] = array('longitude' => $coord['x'],'latitude' => $coord['y']);
98
+						$spotter_history_array[] = array('longitude' => $coord['x'], 'latitude' => $coord['y']);
99 99
 					}
100 100
 				}
101 101
 			}
@@ -115,22 +115,22 @@  discard block
 block discarded – undo
115 115
 		if (count($spotter_history_array) < 2) return $spotter_history_array;
116 116
 		$spotter_history_initial_array = array();
117 117
 		if (count($spotter_history_array) > $globalMapMatchingMaxPts) {
118
-			$spotter_history_array = array_slice($spotter_history_array,-$globalMapMatchingMaxPts);
119
-			$spotter_history_initial_array = array_slice($spotter_history_array,0,count($spotter_history_array)-$globalMapMatchingMaxPts);
118
+			$spotter_history_array = array_slice($spotter_history_array, -$globalMapMatchingMaxPts);
119
+			$spotter_history_initial_array = array_slice($spotter_history_array, 0, count($spotter_history_array) - $globalMapMatchingMaxPts);
120 120
 		}
121 121
 		$data = $this->create_gpx($spotter_history_array);
122 122
 		$url = 'https://graphhopper.com/api/1/match?vehicle=car&points_encoded=0&instructions=false&key='.$globalGraphHopperKey;
123 123
 		$Common = new Common();
124
-		$matching = $Common->getData($url,'post',$data,array('Content-Type: application/gpx+xml'));
125
-		$matching = json_decode($matching,true);
124
+		$matching = $Common->getData($url, 'post', $data, array('Content-Type: application/gpx+xml'));
125
+		$matching = json_decode($matching, true);
126 126
 		if (isset($matching['paths'][0]['points']['coordinates'])) {
127 127
 			$spotter_history_array = array();
128 128
 			foreach ($matching['paths'][0]['points']['coordinates'] as $match) {
129 129
 				$coord = $match;
130
-				$spotter_history_array[] = array('longitude' => $coord[0],'latitude' => $coord[1]);
130
+				$spotter_history_array[] = array('longitude' => $coord[0], 'latitude' => $coord[1]);
131 131
 			}
132 132
 		}
133
-		$spotter_history_array = array_merge($spotter_history_initial_array,$spotter_history_array);
133
+		$spotter_history_array = array_merge($spotter_history_initial_array, $spotter_history_array);
134 134
 		$spotter_history_array[0]['mapmatching_engine'] = 'graphhopper';
135 135
 		return $spotter_history_array;
136 136
 	}
@@ -146,23 +146,23 @@  discard block
 block discarded – undo
146 146
 		if (count($spotter_history_array) < 2) return $spotter_history_array;
147 147
 		$spotter_history_initial_array = array();
148 148
 		if (count($spotter_history_array) > $globalMapMatchingMaxPts) {
149
-			$spotter_history_array = array_slice($spotter_history_array,-$globalMapMatchingMaxPts);
150
-			$spotter_history_initial_array = array_slice($spotter_history_array,0,count($spotter_history_array)-$globalMapMatchingMaxPts);
149
+			$spotter_history_array = array_slice($spotter_history_array, -$globalMapMatchingMaxPts);
150
+			$spotter_history_initial_array = array_slice($spotter_history_array, 0, count($spotter_history_array) - $globalMapMatchingMaxPts);
151 151
 		}
152 152
 		$data = $this->create_gpx($spotter_history_array);
153 153
 		$url = 'https://mapmatching.flightairmap.com/api/1/match?vehicle=car&points_encoded=0&instructions=false';
154 154
 		//$url = 'https://mapmatching.flightairmap.com/api/1/match?vehicle=car&points_encoded=0';
155 155
 		$Common = new Common();
156
-		$matching = $Common->getData($url,'post',$data,array('Content-Type: application/gpx+xml'));
157
-		$matching = json_decode($matching,true);
156
+		$matching = $Common->getData($url, 'post', $data, array('Content-Type: application/gpx+xml'));
157
+		$matching = json_decode($matching, true);
158 158
 		if (isset($matching['paths'][0]['points']['coordinates'])) {
159 159
 			$spotter_history_array = array();
160 160
 			foreach ($matching['paths'][0]['points']['coordinates'] as $match) {
161 161
 				$coord = $match;
162
-				$spotter_history_array[] = array('longitude' => $coord[0],'latitude' => $coord[1]);
162
+				$spotter_history_array[] = array('longitude' => $coord[0], 'latitude' => $coord[1]);
163 163
 			}
164 164
 		}
165
-		$spotter_history_array = array_merge($spotter_history_initial_array,$spotter_history_array);
165
+		$spotter_history_array = array_merge($spotter_history_initial_array, $spotter_history_array);
166 166
 		$spotter_history_array[0]['mapmatching_engine'] = 'fam';
167 167
 		return $spotter_history_array;
168 168
 	}
@@ -178,8 +178,8 @@  discard block
 block discarded – undo
178 178
 		if (count($spotter_history_array) < 2) return $spotter_history_array;
179 179
 		$spotter_history_initial_array = array();
180 180
 		if (count($spotter_history_array) > $globalMapMatchingMaxPts) {
181
-			$spotter_history_array = array_slice($spotter_history_array,-$globalMapMatchingMaxPts);
182
-			$spotter_history_initial_array = array_slice($spotter_history_array,0,count($spotter_history_array)-$globalMapMatchingMaxPts);
181
+			$spotter_history_array = array_slice($spotter_history_array, -$globalMapMatchingMaxPts);
182
+			$spotter_history_initial_array = array_slice($spotter_history_array, 0, count($spotter_history_array) - $globalMapMatchingMaxPts);
183 183
 		}
184 184
 		$coord = '';
185 185
 		$ts = '';
@@ -195,15 +195,15 @@  discard block
 block discarded – undo
195 195
 		$url = 'https://router.project-osrm.org/match/v1/driving/'.$coord.'?timestamps='.$ts.'&overview=full&geometries=geojson&tidy=true&gaps=ignore';
196 196
 		$Common = new Common();
197 197
 		$matching = $Common->getData($url);
198
-		$matching  = json_decode($matching,true);
198
+		$matching = json_decode($matching, true);
199 199
 		if (isset($matching['matchings'][0]['geometry']['coordinates'])) {
200 200
 			$spotter_history_array = array();
201 201
 			foreach ($matching['matchings'][0]['geometry']['coordinates'] as $match) {
202 202
 				$coord = $match;
203
-				$spotter_history_array[] = array('longitude' => $coord[0],'latitude' => $coord[1]);
203
+				$spotter_history_array[] = array('longitude' => $coord[0], 'latitude' => $coord[1]);
204 204
 			}
205 205
 		}
206
-		$spotter_history_array = array_merge($spotter_history_initial_array,$spotter_history_array);
206
+		$spotter_history_array = array_merge($spotter_history_initial_array, $spotter_history_array);
207 207
 		$spotter_history_array[0]['mapmatching_engine'] = 'osmr';
208 208
 		return $spotter_history_array;
209 209
 	}
@@ -219,8 +219,8 @@  discard block
 block discarded – undo
219 219
 		if (count($spotter_history_array) < 2) return $spotter_history_array;
220 220
 		$spotter_history_initial_array = array();
221 221
 		if (count($spotter_history_array) > $globalMapMatchingMaxPts) {
222
-			$spotter_history_array = array_slice($spotter_history_array,-$globalMapMatchingMaxPts);
223
-			$spotter_history_initial_array = array_slice($spotter_history_array,0,count($spotter_history_array)-$globalMapMatchingMaxPts);
222
+			$spotter_history_array = array_slice($spotter_history_array, -$globalMapMatchingMaxPts);
223
+			$spotter_history_initial_array = array_slice($spotter_history_array, 0, count($spotter_history_array) - $globalMapMatchingMaxPts);
224 224
 		}
225 225
 		$coord = '';
226 226
 		$ts = '';
@@ -237,15 +237,15 @@  discard block
 block discarded – undo
237 237
 		$url = 'https://api.mapbox.com/matching/v5/mapbox/driving/'.$coord.'?access_token='.$globalMapboxToken.'&timestamps='.$ts.'&overview=full&tidy=true&geometries=geojson';
238 238
 		$Common = new Common();
239 239
 		$matching = $Common->getData($url);
240
-		$matching  = json_decode($matching,true);
240
+		$matching = json_decode($matching, true);
241 241
 		if (isset($matching['matchings'][0]['geometry']['coordinates'])) {
242 242
 			$spotter_history_array = array();
243 243
 			foreach ($matching['matchings'][0]['geometry']['coordinates'] as $match) {
244 244
 				$coord = $match;
245
-				$spotter_history_array[] = array('longitude' => $coord[0],'latitude' => $coord[1]);
245
+				$spotter_history_array[] = array('longitude' => $coord[0], 'latitude' => $coord[1]);
246 246
 			}
247 247
 		}
248
-		$spotter_history_array = array_merge($spotter_history_initial_array,$spotter_history_array);
248
+		$spotter_history_array = array_merge($spotter_history_initial_array, $spotter_history_array);
249 249
 		$spotter_history_array[0]['mapmatching_engine'] = 'mapbox';
250 250
 		return $spotter_history_array;
251 251
 	}
Please login to merge, or discard this patch.
Braces   +54 added lines, -18 removed lines patch added patch discarded remove patch
@@ -46,7 +46,9 @@  discard block
 block discarded – undo
46 46
 		$gpx .= '<trkseg>';
47 47
 		foreach($spotter_history_array as $spotter_data) {
48 48
 			$gpx .= '<trkpt lat="'.sprintf("%.8f",$spotter_data['latitude']).'" lon="'.sprintf("%.8f",$spotter_data['longitude']).'">';
49
-			if (isset($spotter_data['altitude'])) $gpx .= '<ele>'.sprintf("%.6f",$spotter_data['altitude']).'</ele>';
49
+			if (isset($spotter_data['altitude'])) {
50
+				$gpx .= '<ele>'.sprintf("%.6f",$spotter_data['altitude']).'</ele>';
51
+			}
50 52
 			$gpx .= '<time>'.date("Y-m-d\TH:i:s\Z",strtotime($spotter_data['date'])).'</time>';
51 53
 			$gpx .= '</trkpt>';
52 54
 		}
@@ -82,9 +84,15 @@  discard block
 block discarded – undo
82 84
 
83 85
 	public function TrackMatching($spotter_history_array) {
84 86
 		global $globalMapMatchingMaxPts, $globalTrackMatchingAppKey, $globalTrackMatchingAppId;
85
-		if (!isset($globalMapMatchingMaxPts)) $globalMapMatchingMaxPts = 100;
86
-		if (count($spotter_history_array) < 2) return $spotter_history_array;
87
-		if (count($spotter_history_array) > $globalMapMatchingMaxPts) $spotter_history_array = array_slice($spotter_history_array,-$globalMapMatchingMaxPts);
87
+		if (!isset($globalMapMatchingMaxPts)) {
88
+			$globalMapMatchingMaxPts = 100;
89
+		}
90
+		if (count($spotter_history_array) < 2) {
91
+			return $spotter_history_array;
92
+		}
93
+		if (count($spotter_history_array) > $globalMapMatchingMaxPts) {
94
+			$spotter_history_array = array_slice($spotter_history_array,-$globalMapMatchingMaxPts);
95
+		}
88 96
 		$data = $this->create_gpx($spotter_history_array);
89 97
 		$url = 'https://test.roadmatching.com/rest/mapmatch/?app_id='.$globalTrackMatchingAppId.'&app_key='.$globalTrackMatchingAppKey.'&output.waypoints=true';
90 98
 		$Common = new Common();
@@ -111,8 +119,12 @@  discard block
 block discarded – undo
111 119
 	*/
112 120
 	public function GraphHopper($spotter_history_array) {
113 121
 		global $globalMapMatchingMaxPts, $globalGraphHopperKey;
114
-		if (!isset($globalMapMatchingMaxPts)) $globalMapMatchingMaxPts = 100;
115
-		if (count($spotter_history_array) < 2) return $spotter_history_array;
122
+		if (!isset($globalMapMatchingMaxPts)) {
123
+			$globalMapMatchingMaxPts = 100;
124
+		}
125
+		if (count($spotter_history_array) < 2) {
126
+			return $spotter_history_array;
127
+		}
116 128
 		$spotter_history_initial_array = array();
117 129
 		if (count($spotter_history_array) > $globalMapMatchingMaxPts) {
118 130
 			$spotter_history_array = array_slice($spotter_history_array,-$globalMapMatchingMaxPts);
@@ -142,8 +154,12 @@  discard block
 block discarded – undo
142 154
 	*/
143 155
 	public function FAMMapMatching($spotter_history_array) {
144 156
 		global $globalMapMatchingMaxPts, $globalGraphHopperKey;
145
-		if (!isset($globalMapMatchingMaxPts)) $globalMapMatchingMaxPts = 100;
146
-		if (count($spotter_history_array) < 2) return $spotter_history_array;
157
+		if (!isset($globalMapMatchingMaxPts)) {
158
+			$globalMapMatchingMaxPts = 100;
159
+		}
160
+		if (count($spotter_history_array) < 2) {
161
+			return $spotter_history_array;
162
+		}
147 163
 		$spotter_history_initial_array = array();
148 164
 		if (count($spotter_history_array) > $globalMapMatchingMaxPts) {
149 165
 			$spotter_history_array = array_slice($spotter_history_array,-$globalMapMatchingMaxPts);
@@ -174,8 +190,12 @@  discard block
 block discarded – undo
174 190
 	*/
175 191
 	public function osmr($spotter_history_array) {
176 192
 		global $globalMapMatchingMaxPts;
177
-		if (!isset($globalMapMatchingMaxPts)) $globalMapMatchingMaxPts = 50;
178
-		if (count($spotter_history_array) < 2) return $spotter_history_array;
193
+		if (!isset($globalMapMatchingMaxPts)) {
194
+			$globalMapMatchingMaxPts = 50;
195
+		}
196
+		if (count($spotter_history_array) < 2) {
197
+			return $spotter_history_array;
198
+		}
179 199
 		$spotter_history_initial_array = array();
180 200
 		if (count($spotter_history_array) > $globalMapMatchingMaxPts) {
181 201
 			$spotter_history_array = array_slice($spotter_history_array,-$globalMapMatchingMaxPts);
@@ -185,11 +205,17 @@  discard block
 block discarded – undo
185 205
 		$ts = '';
186 206
 		$rd = '';
187 207
 		foreach ($spotter_history_array as $spotter_data) {
188
-			if ($coord != '') $coord .= ';';
208
+			if ($coord != '') {
209
+				$coord .= ';';
210
+			}
189 211
 			$coord .= $spotter_data['longitude'].','.$spotter_data['latitude'];
190
-			if ($ts != '') $ts .= ';';
212
+			if ($ts != '') {
213
+				$ts .= ';';
214
+			}
191 215
 			$ts .= strtotime($spotter_data['date']);
192
-			if ($rd != '') $rd .= ';';
216
+			if ($rd != '') {
217
+				$rd .= ';';
218
+			}
193 219
 			$rd .= '20';
194 220
 		}
195 221
 		$url = 'https://router.project-osrm.org/match/v1/driving/'.$coord.'?timestamps='.$ts.'&overview=full&geometries=geojson&tidy=true&gaps=ignore';
@@ -215,8 +241,12 @@  discard block
 block discarded – undo
215 241
 	*/
216 242
 	public function mapbox($spotter_history_array) {
217 243
 		global $globalMapMatchingMaxPts, $globalMapboxToken;
218
-		if (!isset($globalMapMatchingMaxPts)) $globalMapMatchingMaxPts = 60;
219
-		if (count($spotter_history_array) < 2) return $spotter_history_array;
244
+		if (!isset($globalMapMatchingMaxPts)) {
245
+			$globalMapMatchingMaxPts = 60;
246
+		}
247
+		if (count($spotter_history_array) < 2) {
248
+			return $spotter_history_array;
249
+		}
220 250
 		$spotter_history_initial_array = array();
221 251
 		if (count($spotter_history_array) > $globalMapMatchingMaxPts) {
222 252
 			$spotter_history_array = array_slice($spotter_history_array,-$globalMapMatchingMaxPts);
@@ -226,11 +256,17 @@  discard block
 block discarded – undo
226 256
 		$ts = '';
227 257
 		$rd = '';
228 258
 		foreach ($spotter_history_array as $spotter_data) {
229
-			if ($coord != '') $coord .= ';';
259
+			if ($coord != '') {
260
+				$coord .= ';';
261
+			}
230 262
 			$coord .= $spotter_data['longitude'].','.$spotter_data['latitude'];
231
-			if ($ts != '') $ts .= ';';
263
+			if ($ts != '') {
264
+				$ts .= ';';
265
+			}
232 266
 			$ts .= strtotime($spotter_data['date']);
233
-			if ($rd != '') $rd .= ';';
267
+			if ($rd != '') {
268
+				$rd .= ';';
269
+			}
234 270
 			$rd .= '20';
235 271
 		}
236 272
 		//$url = 'https://api.mapbox.com/matching/v5/mapbox/driving/'.$coord.'?access_token='.$globalMapboxToken.'&timestamps='.$ts.'&overview=full&tidy=true&geometries=geojson&radiuses='.$rd;
Please login to merge, or discard this patch.
highlights-display.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -7,15 +7,15 @@  discard block
 block discarded – undo
7 7
 require_once('header.php');
8 8
 
9 9
 //calculuation for the pagination
10
-if(!isset($_GET['limit']))
10
+if (!isset($_GET['limit']))
11 11
 {
12 12
 	$limit_start = 0;
13 13
 	$limit_end = 28;
14 14
 	$absolute_difference = 28;
15 15
 } else {
16 16
 	$limit_explode = explode(",", $_GET['limit']);
17
-	$limit_start = filter_var($limit_explode[0],FILTER_SANITIZE_NUMBER_INT);
18
-	$limit_end = filter_var($limit_explode[1],FILTER_SANITIZE_NUMBER_INT);
17
+	$limit_start = filter_var($limit_explode[0], FILTER_SANITIZE_NUMBER_INT);
18
+	$limit_end = filter_var($limit_explode[1], FILTER_SANITIZE_NUMBER_INT);
19 19
 	if (!ctype_digit(strval($limit_start)) || !ctype_digit(strval($limit_end))) {
20 20
 		$limit_start = 0;
21 21
 		$limit_end = 25;
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 print '<div class="column">';	
40 40
 print '<p>'._("The view below shows all aircraft that have been selected to have some sort of special characteristic about them, such as unique liveries, destinations etc.").'</p>';
41 41
 
42
-$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING);
42
+$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING);
43 43
 if ($sort != '') {
44 44
 	$spotter_array = $Spotter->getSpotterDataByHighlight($limit_start.",".$absolute_difference, $sort);
45 45
 } else {
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 if (!empty($spotter_array))
49 49
 {
50 50
 	print '<div class="dispay-view">';
51
-	foreach($spotter_array as $spotter_item)
51
+	foreach ($spotter_array as $spotter_item)
52 52
 	{
53 53
 		if (isset($spotter_item['image']) && $spotter_item['image'] != "")
54 54
 		{
Please login to merge, or discard this patch.
pilot-detailed.php 2 patches
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -5,13 +5,13 @@  discard block
 block discarded – undo
5 5
 require_once('require/class.Language.php');
6 6
 require_once('require/class.SpotterArchive.php');
7 7
 
8
-if (!isset($_GET['pilot'])){
8
+if (!isset($_GET['pilot'])) {
9 9
 	header('Location: '.$globalURL.'/');
10 10
 } else {
11 11
 	$Spotter = new Spotter();
12 12
 	$SpotterArchive = new SpotterArchive();
13 13
 	//calculuation for the pagination
14
-	if(!isset($_GET['limit']))
14
+	if (!isset($_GET['limit']))
15 15
 	{
16 16
 		$limit_start = 0;
17 17
 		$limit_end = 25;
@@ -32,29 +32,29 @@  discard block
 block discarded – undo
32 32
 	
33 33
 	$page_url = $globalURL.'/pilot/'.$_GET['pilot'];
34 34
 	
35
-	$pilot = filter_input(INPUT_GET,'pilot',FILTER_SANITIZE_STRING);
36
-	$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING);
37
-	$year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT);
38
-	$month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT);
35
+	$pilot = filter_input(INPUT_GET, 'pilot', FILTER_SANITIZE_STRING);
36
+	$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING);
37
+	$year = filter_input(INPUT_GET, 'year', FILTER_SANITIZE_NUMBER_INT);
38
+	$month = filter_input(INPUT_GET, 'month', FILTER_SANITIZE_NUMBER_INT);
39 39
 	$filter = array();
40
-	if ($year != '') $filter = array_merge($filter,array('year' => $year));
41
-	if ($month != '') $filter = array_merge($filter,array('month' => $month));
40
+	if ($year != '') $filter = array_merge($filter, array('year' => $year));
41
+	if ($month != '') $filter = array_merge($filter, array('month' => $month));
42 42
 	if ($sort != '') 
43 43
 	{
44
-		$spotter_array = $Spotter->getSpotterDataByPilot($pilot,$limit_start.",".$absolute_difference, $sort,$filter);
44
+		$spotter_array = $Spotter->getSpotterDataByPilot($pilot, $limit_start.",".$absolute_difference, $sort, $filter);
45 45
 		if (empty($spotter_array) && isset($globalArchiveResults) && $globalArchiveResults) {
46
-			$spotter_array = $SpotterArchive->getSpotterDataByPilot($pilot,$limit_start.",".$absolute_difference, $sort,$filter);
46
+			$spotter_array = $SpotterArchive->getSpotterDataByPilot($pilot, $limit_start.",".$absolute_difference, $sort, $filter);
47 47
 		}
48 48
 	} else {
49
-		$spotter_array = $Spotter->getSpotterDataByPilot($pilot,$limit_start.",".$absolute_difference,'',$filter);
49
+		$spotter_array = $Spotter->getSpotterDataByPilot($pilot, $limit_start.",".$absolute_difference, '', $filter);
50 50
 		if (empty($spotter_array) && isset($globalArchiveResults) && $globalArchiveResults) {
51
-			$spotter_array = $SpotterArchive->getSpotterDataByPilot($pilot,$limit_start.",".$absolute_difference,'',$filter);
51
+			$spotter_array = $SpotterArchive->getSpotterDataByPilot($pilot, $limit_start.",".$absolute_difference, '', $filter);
52 52
 		}
53 53
 	}
54 54
 
55 55
 	if (!empty($spotter_array))
56 56
 	{
57
-		$title = sprintf(_("Detailed View for %s"),$spotter_array[0]['pilot_name']);
57
+		$title = sprintf(_("Detailed View for %s"), $spotter_array[0]['pilot_name']);
58 58
 		$ident = $spotter_array[0]['ident'];
59 59
 		if (isset($spotter_array[0]['latitude'])) $latitude = $spotter_array[0]['latitude'];
60 60
 		if (isset($spotter_array[0]['longitude'])) $longitude = $spotter_array[0]['longitude'];
@@ -115,23 +115,23 @@  discard block
 block discarded – undo
115 115
 			$Stats = new Stats();
116 116
 			$flights = $Stats->getStatsPilot($pilot);
117 117
 		} else $flights = 0;
118
-		if ($flights == 0) $flights = $Spotter->countFlightsByPilot($pilot,$filter);
118
+		if ($flights == 0) $flights = $Spotter->countFlightsByPilot($pilot, $filter);
119 119
 		print '<div><span class="label">'._("Flights").'</span>'.$flights.'</div>';
120
-		$aircraft_type = count($Spotter->countAllAircraftTypesByPilot($pilot,$filter));
120
+		$aircraft_type = count($Spotter->countAllAircraftTypesByPilot($pilot, $filter));
121 121
 		print '<div><span class="label">'._("Aircraft type").'</span>'.$aircraft_type.'</div>';
122
-		$aircraft_registration = count($Spotter->countAllAircraftRegistrationByPilot($pilot,$filter));
122
+		$aircraft_registration = count($Spotter->countAllAircraftRegistrationByPilot($pilot, $filter));
123 123
 		print '<div><span class="label">'._("Aircraft").'</span>'.$aircraft_registration.'</div>';
124
-		$aircraft_manufacturer = count($Spotter->countAllAircraftManufacturerByPilot($pilot,$filter));
124
+		$aircraft_manufacturer = count($Spotter->countAllAircraftManufacturerByPilot($pilot, $filter));
125 125
 		print '<div><span class="label">'._("Manufacturers").'</span>'.$aircraft_manufacturer.'</div>';
126
-		$airlines = count($Spotter->countAllAirlinesByPilot($pilot,$filter));
126
+		$airlines = count($Spotter->countAllAirlinesByPilot($pilot, $filter));
127 127
 		print '<div><span class="label">'._("Airlines").'</span>'.$airlines.'</div>';
128
-		$duration = $Spotter->getFlightDurationByPilot($pilot,$filter);
128
+		$duration = $Spotter->getFlightDurationByPilot($pilot, $filter);
129 129
 		if ($duration != '0') print '<div><span class="label">'._("Total flights spotted duration").'</span>'.$duration.'</div>';
130 130
 		print '</div>';
131 131
 	
132 132
 		include('pilot-sub-menu.php');
133 133
 		print '<div class="table column">';
134
-		print '<p>'.sprintf(_("The table below shows the detailed information of all flights with the pilot <strong>%s</strong>."),$spotter_array[0]['pilot_name']).'</p>';
134
+		print '<p>'.sprintf(_("The table below shows the detailed information of all flights with the pilot <strong>%s</strong>."), $spotter_array[0]['pilot_name']).'</p>';
135 135
 
136 136
 		include('table-output.php'); 
137 137
 		print '<div class="pagination">';
Please login to merge, or discard this patch.
Braces   +24 added lines, -8 removed lines patch added patch discarded remove patch
@@ -37,8 +37,12 @@  discard block
 block discarded – undo
37 37
 	$year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT);
38 38
 	$month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT);
39 39
 	$filter = array();
40
-	if ($year != '') $filter = array_merge($filter,array('year' => $year));
41
-	if ($month != '') $filter = array_merge($filter,array('month' => $month));
40
+	if ($year != '') {
41
+		$filter = array_merge($filter,array('year' => $year));
42
+	}
43
+	if ($month != '') {
44
+		$filter = array_merge($filter,array('month' => $month));
45
+	}
42 46
 	if ($sort != '') 
43 47
 	{
44 48
 		$spotter_array = $Spotter->getSpotterDataByPilot($pilot,$limit_start.",".$absolute_difference, $sort,$filter);
@@ -56,8 +60,12 @@  discard block
 block discarded – undo
56 60
 	{
57 61
 		$title = sprintf(_("Detailed View for %s"),$spotter_array[0]['pilot_name']);
58 62
 		$ident = $spotter_array[0]['ident'];
59
-		if (isset($spotter_array[0]['latitude'])) $latitude = $spotter_array[0]['latitude'];
60
-		if (isset($spotter_array[0]['longitude'])) $longitude = $spotter_array[0]['longitude'];
63
+		if (isset($spotter_array[0]['latitude'])) {
64
+			$latitude = $spotter_array[0]['latitude'];
65
+		}
66
+		if (isset($spotter_array[0]['longitude'])) {
67
+			$longitude = $spotter_array[0]['longitude'];
68
+		}
61 69
 		require_once('header.php');
62 70
 		/*
63 71
 		if (isset($globalArchive) && $globalArchive) {
@@ -110,12 +118,18 @@  discard block
 block discarded – undo
110 118
 		*/
111 119
 		print '<div class="info column">';
112 120
 		print '<h1>'.$spotter_array[0]['pilot_name'].'</h1>';
113
-		if (isset($spotter_array[0]['pilot_id']) && $spotter_array[0]['pilot_id'] != '') print '<div><span class="label">'._("Pilot ID").'</span>'.$spotter_array[0]['pilot_id'].'</div>';
121
+		if (isset($spotter_array[0]['pilot_id']) && $spotter_array[0]['pilot_id'] != '') {
122
+			print '<div><span class="label">'._("Pilot ID").'</span>'.$spotter_array[0]['pilot_id'].'</div>';
123
+		}
114 124
 		if ($year == '' && $month == '') {
115 125
 			$Stats = new Stats();
116 126
 			$flights = $Stats->getStatsPilot($pilot);
117
-		} else $flights = 0;
118
-		if ($flights == 0) $flights = $Spotter->countFlightsByPilot($pilot,$filter);
127
+		} else {
128
+			$flights = 0;
129
+		}
130
+		if ($flights == 0) {
131
+			$flights = $Spotter->countFlightsByPilot($pilot,$filter);
132
+		}
119 133
 		print '<div><span class="label">'._("Flights").'</span>'.$flights.'</div>';
120 134
 		$aircraft_type = count($Spotter->countAllAircraftTypesByPilot($pilot,$filter));
121 135
 		print '<div><span class="label">'._("Aircraft type").'</span>'.$aircraft_type.'</div>';
@@ -126,7 +140,9 @@  discard block
 block discarded – undo
126 140
 		$airlines = count($Spotter->countAllAirlinesByPilot($pilot,$filter));
127 141
 		print '<div><span class="label">'._("Airlines").'</span>'.$airlines.'</div>';
128 142
 		$duration = $Spotter->getFlightDurationByPilot($pilot,$filter);
129
-		if ($duration != '0') print '<div><span class="label">'._("Total flights spotted duration").'</span>'.$duration.'</div>';
143
+		if ($duration != '0') {
144
+			print '<div><span class="label">'._("Total flights spotted duration").'</span>'.$duration.'</div>';
145
+		}
130 146
 		print '</div>';
131 147
 	
132 148
 		include('pilot-sub-menu.php');
Please login to merge, or discard this patch.
route-statistics-aircraft.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -7,15 +7,15 @@  discard block
 block discarded – undo
7 7
 require_once('require/class.Connection.php');
8 8
 require_once('require/class.Spotter.php');
9 9
 require_once('require/class.Language.php');
10
-$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING);
11
-$departure_airport = filter_input(INPUT_GET,'departure_airport',FILTER_SANITIZE_STRING);
12
-$arrival_airport = filter_input(INPUT_GET,'arrival_airport',FILTER_SANITIZE_STRING);
10
+$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING);
11
+$departure_airport = filter_input(INPUT_GET, 'departure_airport', FILTER_SANITIZE_STRING);
12
+$arrival_airport = filter_input(INPUT_GET, 'arrival_airport', FILTER_SANITIZE_STRING);
13 13
 $Spotter = new Spotter();
14 14
 $spotter_array = $Spotter->getSpotterDataByRoute($departure_airport, $arrival_airport, "0,1", $sort);
15 15
   
16 16
 if (!empty($spotter_array))
17 17
 {
18
-	$title = sprintf(_("Most Common Aircraft between %s (%s), %s - %s (%s), %s"),$spotter_array[0]['departure_airport_name'],$spotter_array[0]['departure_airport_icao'],$spotter_array[0]['departure_airport_country'],$spotter_array[0]['arrival_airport_name'],$spotter_array[0]['arrival_airport_icao'],$spotter_array[0]['arrival_airport_country']);
18
+	$title = sprintf(_("Most Common Aircraft between %s (%s), %s - %s (%s), %s"), $spotter_array[0]['departure_airport_name'], $spotter_array[0]['departure_airport_icao'], $spotter_array[0]['departure_airport_country'], $spotter_array[0]['arrival_airport_name'], $spotter_array[0]['arrival_airport_icao'], $spotter_array[0]['arrival_airport_country']);
19 19
 	require_once('header.php');
20 20
 	print '<div class="info column">';
21 21
 	print '<h1>'._("Flights between").' '.$spotter_array[0]['departure_airport_name'].' ('.$spotter_array[0]['departure_airport_icao'].'), '.$spotter_array[0]['departure_airport_country'].' - '.$spotter_array[0]['arrival_airport_name'].' ('.$spotter_array[0]['arrival_airport_icao'].'), '.$spotter_array[0]['arrival_airport_country'].'</h1>';
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 	include('route-sub-menu.php');
27 27
 	print '<div class="column">';
28 28
 	print '<h2>'._("Most Common Aircraft").'</h2>';
29
-	print '<p>'.sprintf(_("The statistic below shows the most common aircraft of flights between <strong>%s (%s), %s</strong> and <strong>%s (%s), %s</strong>."),$spotter_array[0]['departure_airport_name'],$spotter_array[0]['departure_airport_icao'],$spotter_array[0]['departure_airport_country'],$spotter_array[0]['arrival_airport_name'],$spotter_array[0]['arrival_airport_icao'],$spotter_array[0]['arrival_airport_country']).'</p>';
29
+	print '<p>'.sprintf(_("The statistic below shows the most common aircraft of flights between <strong>%s (%s), %s</strong> and <strong>%s (%s), %s</strong>."), $spotter_array[0]['departure_airport_name'], $spotter_array[0]['departure_airport_icao'], $spotter_array[0]['departure_airport_country'], $spotter_array[0]['arrival_airport_name'], $spotter_array[0]['arrival_airport_icao'], $spotter_array[0]['arrival_airport_country']).'</p>';
30 30
 
31 31
 	$aircraft_array = $Spotter->countAllAircraftTypesByRoute($departure_airport, $arrival_airport);
32 32
 	if (!empty($aircraft_array))
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 		print '</thead>';
42 42
 		print '<tbody>';
43 43
 		$i = 1;
44
-		foreach($aircraft_array as $aircraft_item)
44
+		foreach ($aircraft_array as $aircraft_item)
45 45
 		{
46 46
 			print '<tr>';
47 47
 			print '<td><strong>'.$i.'</strong></td>';
Please login to merge, or discard this patch.
owner-detailed.php 2 patches
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -7,14 +7,14 @@  discard block
 block discarded – undo
7 7
 //require_once('require/class.SpotterLive.php');
8 8
 require_once('require/class.SpotterArchive.php');
9 9
 
10
-if (!isset($_GET['owner'])){
10
+if (!isset($_GET['owner'])) {
11 11
 	header('Location: '.$globalURL.'');
12 12
 } else {
13 13
 	$Spotter = new Spotter();
14 14
 	$SpotterArchive = new SpotterArchive();
15 15
 	//$Translation = new Translation();
16 16
 	//calculuation for the pagination
17
-	if(!isset($_GET['limit']))
17
+	if (!isset($_GET['limit']))
18 18
 	{
19 19
 		$limit_start = 0;
20 20
 		$limit_end = 25;
@@ -22,8 +22,8 @@  discard block
 block discarded – undo
22 22
 	} else {
23 23
 		$limit_explode = explode(",", $_GET['limit']);
24 24
 		if (isset($limit_explode[1])) {
25
-			$limit_start = filter_var($limit_explode[0],FILTER_SANITIZE_NUMBER_INT);
26
-			$limit_end = filter_var($limit_explode[1],FILTER_SANITIZE_NUMBER_INT);
25
+			$limit_start = filter_var($limit_explode[0], FILTER_SANITIZE_NUMBER_INT);
26
+			$limit_end = filter_var($limit_explode[1], FILTER_SANITIZE_NUMBER_INT);
27 27
 		} else {
28 28
 			$limit_start = 0;
29 29
 			$limit_end = 25;
@@ -40,29 +40,29 @@  discard block
 block discarded – undo
40 40
 	
41 41
 	$page_url = $globalURL.'/owner/'.$_GET['owner'];
42 42
 	
43
-	$owner = urldecode(filter_input(INPUT_GET,'owner',FILTER_SANITIZE_STRING));
44
-	$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING);
45
-	$year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT);
46
-	$month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT);
43
+	$owner = urldecode(filter_input(INPUT_GET, 'owner', FILTER_SANITIZE_STRING));
44
+	$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING);
45
+	$year = filter_input(INPUT_GET, 'year', FILTER_SANITIZE_NUMBER_INT);
46
+	$month = filter_input(INPUT_GET, 'month', FILTER_SANITIZE_NUMBER_INT);
47 47
 	$filter = array();
48
-	if ($year != '') $filter = array_merge($filter,array('year' => $year));
49
-	if ($month != '') $filter = array_merge($filter,array('month' => $month));
48
+	if ($year != '') $filter = array_merge($filter, array('year' => $year));
49
+	if ($month != '') $filter = array_merge($filter, array('month' => $month));
50 50
 	if ($sort != '') 
51 51
 	{
52
-		$spotter_array = $Spotter->getSpotterDataByOwner($owner,$limit_start.",".$absolute_difference, $sort,$filter);
52
+		$spotter_array = $Spotter->getSpotterDataByOwner($owner, $limit_start.",".$absolute_difference, $sort, $filter);
53 53
 		if (empty($spotter_array) && isset($globalArchiveResults) && $globalArchiveResults) {
54
-			$spotter_array = $SpotterArchive->getSpotterDataByOwner($owner,$limit_start.",".$absolute_difference, $sort,$filter);
54
+			$spotter_array = $SpotterArchive->getSpotterDataByOwner($owner, $limit_start.",".$absolute_difference, $sort, $filter);
55 55
 		}
56 56
 	} else {
57
-		$spotter_array = $Spotter->getSpotterDataByOwner($owner,$limit_start.",".$absolute_difference,'',$filter);
57
+		$spotter_array = $Spotter->getSpotterDataByOwner($owner, $limit_start.",".$absolute_difference, '', $filter);
58 58
 		if (empty($spotter_array) && isset($globalArchiveResults) && $globalArchiveResults) {
59
-			$spotter_array = $SpotterArchive->getSpotterDataByOwner($owner,$limit_start.",".$absolute_difference,'',$filter);
59
+			$spotter_array = $SpotterArchive->getSpotterDataByOwner($owner, $limit_start.",".$absolute_difference, '', $filter);
60 60
 		}
61 61
 	}
62 62
 
63 63
 	if (!empty($spotter_array))
64 64
 	{
65
-		$title = sprintf(_("Detailed View for %s"),$spotter_array[0]['aircraft_owner']);
65
+		$title = sprintf(_("Detailed View for %s"), $spotter_array[0]['aircraft_owner']);
66 66
 		//$ident = $spotter_array[0]['ident'];
67 67
 		if (isset($spotter_array[0]['latitude'])) $latitude = $spotter_array[0]['latitude'];
68 68
 		if (isset($spotter_array[0]['longitude'])) $longitude = $spotter_array[0]['longitude'];
@@ -122,23 +122,23 @@  discard block
 block discarded – undo
122 122
 		$Stats = new Stats();
123 123
 		if ($year == '' && $month == '') $flights = $Stats->getStatsOwner($owner);
124 124
 		else $flights = 0;
125
-		if ($flights == 0) $flights = $Spotter->countFlightsByOwner($owner,$filter);
125
+		if ($flights == 0) $flights = $Spotter->countFlightsByOwner($owner, $filter);
126 126
 		print '<div><span class="label">'._("Flights").'</span>'.$flights.'</div>';
127
-		$aircraft_type = count($Spotter->countAllAircraftTypesByOwner($owner,$filter));
127
+		$aircraft_type = count($Spotter->countAllAircraftTypesByOwner($owner, $filter));
128 128
 		print '<div><span class="label">'._("Aircraft type").'</span>'.$aircraft_type.'</div>';
129
-		$aircraft_registration = count($Spotter->countAllAircraftRegistrationByOwner($owner,$filter));
129
+		$aircraft_registration = count($Spotter->countAllAircraftRegistrationByOwner($owner, $filter));
130 130
 		print '<div><span class="label">'._("Aircraft").'</span>'.$aircraft_registration.'</div>';
131
-		$aircraft_manufacturer = count($Spotter->countAllAircraftManufacturerByOwner($owner,$filter));
131
+		$aircraft_manufacturer = count($Spotter->countAllAircraftManufacturerByOwner($owner, $filter));
132 132
 		print '<div><span class="label">'._("Manufacturers").'</span>'.$aircraft_manufacturer.'</div>';
133
-		$airlines = count($Spotter->countAllAirlinesByOwner($owner,$filter));
133
+		$airlines = count($Spotter->countAllAirlinesByOwner($owner, $filter));
134 134
 		print '<div><span class="label">'._("Airlines").'</span>'.$airlines.'</div>';
135
-		$duration = $Spotter->getFlightDurationByOwner($owner,$filter);
135
+		$duration = $Spotter->getFlightDurationByOwner($owner, $filter);
136 136
 		if ($duration != '0') print '<div><span class="label">'._("Total flights spotted duration").'</span>'.$duration.'</div>';
137 137
 		print '</div>';
138 138
 	
139 139
 		include('owner-sub-menu.php');
140 140
 		print '<div class="table column">';
141
-		print '<p>'.sprintf(_("The table below shows the detailed information of all flights with the owner <strong>%s</strong>."),$spotter_array[0]['aircraft_owner']).'</p>';
141
+		print '<p>'.sprintf(_("The table below shows the detailed information of all flights with the owner <strong>%s</strong>."), $spotter_array[0]['aircraft_owner']).'</p>';
142 142
 
143 143
 		include('table-output.php'); 
144 144
 		print '<div class="pagination">';
Please login to merge, or discard this patch.
Braces   +23 added lines, -8 removed lines patch added patch discarded remove patch
@@ -45,8 +45,12 @@  discard block
 block discarded – undo
45 45
 	$year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT);
46 46
 	$month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT);
47 47
 	$filter = array();
48
-	if ($year != '') $filter = array_merge($filter,array('year' => $year));
49
-	if ($month != '') $filter = array_merge($filter,array('month' => $month));
48
+	if ($year != '') {
49
+		$filter = array_merge($filter,array('year' => $year));
50
+	}
51
+	if ($month != '') {
52
+		$filter = array_merge($filter,array('month' => $month));
53
+	}
50 54
 	if ($sort != '') 
51 55
 	{
52 56
 		$spotter_array = $Spotter->getSpotterDataByOwner($owner,$limit_start.",".$absolute_difference, $sort,$filter);
@@ -64,8 +68,12 @@  discard block
 block discarded – undo
64 68
 	{
65 69
 		$title = sprintf(_("Detailed View for %s"),$spotter_array[0]['aircraft_owner']);
66 70
 		//$ident = $spotter_array[0]['ident'];
67
-		if (isset($spotter_array[0]['latitude'])) $latitude = $spotter_array[0]['latitude'];
68
-		if (isset($spotter_array[0]['longitude'])) $longitude = $spotter_array[0]['longitude'];
71
+		if (isset($spotter_array[0]['latitude'])) {
72
+			$latitude = $spotter_array[0]['latitude'];
73
+		}
74
+		if (isset($spotter_array[0]['longitude'])) {
75
+			$longitude = $spotter_array[0]['longitude'];
76
+		}
69 77
 		require_once('header.php');
70 78
 		/*
71 79
 		if (isset($globalArchive) && $globalArchive) {
@@ -120,9 +128,14 @@  discard block
 block discarded – undo
120 128
 		print '<h1>'.$spotter_array[0]['aircraft_owner'].'</h1>';
121 129
 		//print '<div><span class="label">'._("Owner").'</span>'.$spotter_array[0]['aircraft_owner'].'</div>';
122 130
 		$Stats = new Stats();
123
-		if ($year == '' && $month == '') $flights = $Stats->getStatsOwner($owner);
124
-		else $flights = 0;
125
-		if ($flights == 0) $flights = $Spotter->countFlightsByOwner($owner,$filter);
131
+		if ($year == '' && $month == '') {
132
+			$flights = $Stats->getStatsOwner($owner);
133
+		} else {
134
+			$flights = 0;
135
+		}
136
+		if ($flights == 0) {
137
+			$flights = $Spotter->countFlightsByOwner($owner,$filter);
138
+		}
126 139
 		print '<div><span class="label">'._("Flights").'</span>'.$flights.'</div>';
127 140
 		$aircraft_type = count($Spotter->countAllAircraftTypesByOwner($owner,$filter));
128 141
 		print '<div><span class="label">'._("Aircraft type").'</span>'.$aircraft_type.'</div>';
@@ -133,7 +146,9 @@  discard block
 block discarded – undo
133 146
 		$airlines = count($Spotter->countAllAirlinesByOwner($owner,$filter));
134 147
 		print '<div><span class="label">'._("Airlines").'</span>'.$airlines.'</div>';
135 148
 		$duration = $Spotter->getFlightDurationByOwner($owner,$filter);
136
-		if ($duration != '0') print '<div><span class="label">'._("Total flights spotted duration").'</span>'.$duration.'</div>';
149
+		if ($duration != '0') {
150
+			print '<div><span class="label">'._("Total flights spotted duration").'</span>'.$duration.'</div>';
151
+		}
137 152
 		print '</div>';
138 153
 	
139 154
 		include('owner-sub-menu.php');
Please login to merge, or discard this patch.