Completed
Push — master ( 39cbd8...012813 )
by Yannick
08:07
created
install/index.php 1 patch
Braces   +446 added lines, -119 removed lines patch added patch discarded remove patch
@@ -131,45 +131,72 @@  discard block
 block discarded – undo
131 131
 			</div>
132 132
 			<p>
133 133
 				<label for="dbhost">Database hostname</label>
134
-				<input type="text" name="dbhost" id="dbhost" value="<?php if (isset($globalDBhost)) print $globalDBhost; ?>" />
134
+				<input type="text" name="dbhost" id="dbhost" value="<?php if (isset($globalDBhost)) {
135
+	print $globalDBhost;
136
+}
137
+?>" />
135 138
 			</p>
136 139
 			<p>
137 140
 				<label for="dbport">Database port</label>
138
-				<input type="text" name="dbport" id="dbport" value="<?php if (isset($globalDBport)) print $globalDBport; ?>" />
141
+				<input type="text" name="dbport" id="dbport" value="<?php if (isset($globalDBport)) {
142
+	print $globalDBport;
143
+}
144
+?>" />
139 145
 				<p class="help-block">Default is 3306 for MariaDB/MySQL, 5432 for PostgreSQL</p>
140 146
 			</p>
141 147
 			<p>
142 148
 				<label for="dbname">Database name</label>
143
-				<input type="text" name="dbname" id="dbname" value="<?php if (isset($globalDBname)) print $globalDBname; ?>" />
149
+				<input type="text" name="dbname" id="dbname" value="<?php if (isset($globalDBname)) {
150
+	print $globalDBname;
151
+}
152
+?>" />
144 153
 			</p>
145 154
 			<p>
146 155
 				<label for="dbuser">Database user</label>
147
-				<input type="text" name="dbuser" id="dbuser" value="<?php if (isset($globalDBuser)) print $globalDBuser; ?>" />
156
+				<input type="text" name="dbuser" id="dbuser" value="<?php if (isset($globalDBuser)) {
157
+	print $globalDBuser;
158
+}
159
+?>" />
148 160
 			</p>
149 161
 			<p>
150 162
 				<label for="dbuserpass">Database user password</label>
151
-				<input type="password" name="dbuserpass" id="dbuserpass" value="<?php if (isset($globalDBpass)) print $globalDBpass; ?>" />
163
+				<input type="password" name="dbuserpass" id="dbuserpass" value="<?php if (isset($globalDBpass)) {
164
+	print $globalDBpass;
165
+}
166
+?>" />
152 167
 			</p>
153 168
 		</fieldset>
154 169
 		<fieldset id="site">
155 170
 			<legend>Site configuration</legend>
156 171
 			<p>
157 172
 				<label for="sitename">Site name</label>
158
-				<input type="text" name="sitename" id="sitename" value="<?php if (isset($globalName)) print $globalName; ?>" />
173
+				<input type="text" name="sitename" id="sitename" value="<?php if (isset($globalName)) {
174
+	print $globalName;
175
+}
176
+?>" />
159 177
 			</p>
160 178
 			<p>
161 179
 				<label for="siteurl">Site directory</label>
162
-				<input type="text" name="siteurl" id="siteurl" value="<?php if (isset($globalURL)) print $globalURL; ?>" />
180
+				<input type="text" name="siteurl" id="siteurl" value="<?php if (isset($globalURL)) {
181
+	print $globalURL;
182
+}
183
+?>" />
163 184
 				<p class="help-block">Can be null. ex : <i>flightairmap</i> if complete URL is <i>http://toto.com/flightairmap</i></p>
164 185
 			</p>
165 186
 			<p>
166 187
 				<label for="timezone">Timezone</label>
167
-				<input type="text" name="timezone" id="timezone" value="<?php if (isset($globalTimezone)) print $globalTimezone; ?>" />
188
+				<input type="text" name="timezone" id="timezone" value="<?php if (isset($globalTimezone)) {
189
+	print $globalTimezone;
190
+}
191
+?>" />
168 192
 				<p class="help-block">ex : UTC, Europe/Paris,...</p>
169 193
 			</p>
170 194
 			<p>
171 195
 				<label for="language">Language</label>
172
-				<input type="text" name="language" id="language" value="<?php if (isset($globalLanguage)) print $globalLanguage; ?>" />
196
+				<input type="text" name="language" id="language" value="<?php if (isset($globalLanguage)) {
197
+	print $globalLanguage;
198
+}
199
+?>" />
173 200
 				<p class="help-block">Used only when link to wikipedia for now. Can be EN,DE,FR,...</p>
174 201
 			</p>
175 202
 		</fieldset>
@@ -190,11 +217,17 @@  discard block
 block discarded – undo
190 217
 			<div id="mapbox_data">
191 218
 				<p>
192 219
 					<label for="mapboxid">Mapbox id</label>
193
-					<input type="text" name="mapboxid" id="mapboxid" value="<?php if (isset($globalMapboxId)) print $globalMapboxId; ?>" />
220
+					<input type="text" name="mapboxid" id="mapboxid" value="<?php if (isset($globalMapboxId)) {
221
+	print $globalMapboxId;
222
+}
223
+?>" />
194 224
 				</p>
195 225
 				<p>
196 226
 					<label for="mapboxtoken">Mapbox token</label>
197
-					<input type="text" name="mapboxtoken" id="mapboxtoken" value="<?php if (isset($globalMapboxToken)) print $globalMapboxToken; ?>" />
227
+					<input type="text" name="mapboxtoken" id="mapboxtoken" value="<?php if (isset($globalMapboxToken)) {
228
+	print $globalMapboxToken;
229
+}
230
+?>" />
198 231
 				</p>
199 232
 				<p class="help-block">Get a key <a href="https://www.mapbox.com/developers/">here</a></p>
200 233
 			</div>
@@ -202,7 +235,10 @@  discard block
 block discarded – undo
202 235
 			<div id="google_data">
203 236
 				<p>
204 237
 					<label for="googlekey">Google API key</label>
205
-					<input type="text" name="googlekey" id="googlekey" value="<?php if (isset($globalGoogleAPIKey)) print $globalGoogleAPIKey; ?>" />
238
+					<input type="text" name="googlekey" id="googlekey" value="<?php if (isset($globalGoogleAPIKey)) {
239
+	print $globalGoogleAPIKey;
240
+}
241
+?>" />
206 242
 					<p class="help-block">Get a key <a href="https://developers.google.com/maps/documentation/javascript/get-api-key#get-an-api-key">here</a></p>
207 243
 				</p>
208 244
 			</div>
@@ -210,7 +246,10 @@  discard block
 block discarded – undo
210 246
 			<div id="bing_data">
211 247
 				<p>
212 248
 					<label for="bingkey">Bing Map key</label>
213
-					<input type="text" name="bingkey" id="bingkey" value="<?php if (isset($globalBingMapKey)) print $globalBingMapKey; ?>" />
249
+					<input type="text" name="bingkey" id="bingkey" value="<?php if (isset($globalBingMapKey)) {
250
+	print $globalBingMapKey;
251
+}
252
+?>" />
214 253
 					<p class="help-block">Get a key <a href="https://www.bingmapsportal.com/">here</a></p>
215 254
 				</p>
216 255
 			</div>
@@ -218,7 +257,10 @@  discard block
 block discarded – undo
218 257
 			<div id="mapquest_data">
219 258
 				<p>
220 259
 					<label for="mapquestkey">MapQuest key</label>
221
-					<input type="text" name="mapquestkey" id="mapquestkey" value="<?php if (isset($globalMapQuestKey)) print $globalMapQuestKey; ?>" />
260
+					<input type="text" name="mapquestkey" id="mapquestkey" value="<?php if (isset($globalMapQuestKey)) {
261
+	print $globalMapQuestKey;
262
+}
263
+?>" />
222 264
 					<p class="help-block">Get a key <a href="https://developer.mapquest.com/user/me/apps">here</a></p>
223 265
 				</p>
224 266
 			</div>
@@ -226,11 +268,17 @@  discard block
 block discarded – undo
226 268
 			<div id="here_data">
227 269
 				<p>
228 270
 					<label for="hereappid">Here App_Id</label>
229
-					<input type="text" name="hereappid" id="hereappid" value="<?php if (isset($globalHereappId)) print $globalHereappId; ?>" />
271
+					<input type="text" name="hereappid" id="hereappid" value="<?php if (isset($globalHereappId)) {
272
+	print $globalHereappId;
273
+}
274
+?>" />
230 275
 				</p>
231 276
 				<p>
232 277
 					<label for="hereappcode">Here App_Code</label>
233
-					<input type="text" name="hereappcode" id="hereappcode" value="<?php if (isset($globalHereappCode)) print $globalHereappCode; ?>" />
278
+					<input type="text" name="hereappcode" id="hereappcode" value="<?php if (isset($globalHereappCode)) {
279
+	print $globalHereappCode;
280
+}
281
+?>" />
234 282
 				</p>
235 283
 				<p class="help-block">Get a key <a href="https://developer.here.com/rest-apis/documentation/enterprise-map-tile/topics/quick-start.html">here</a></p>
236 284
 			</div>
@@ -239,42 +287,86 @@  discard block
 block discarded – undo
239 287
 			<legend>Coverage area</legend>
240 288
 			<p>
241 289
 				<label for="latitudemax">The maximum latitude (north)</label>
242
-				<input type="text" name="latitudemax" id="latitudemax" value="<?php if (isset($globalLatitudeMax)) print $globalLatitudeMax; ?>" />
290
+				<input type="text" name="latitudemax" id="latitudemax" value="<?php if (isset($globalLatitudeMax)) {
291
+	print $globalLatitudeMax;
292
+}
293
+?>" />
243 294
 			</p>
244 295
 			<p>
245 296
 				<label for="latitudemin">The minimum latitude (south)</label>
246
-				<input type="text" name="latitudemin" id="latitudemin" value="<?php if (isset($globalLatitudeMin)) print $globalLatitudeMin; ?>" />
297
+				<input type="text" name="latitudemin" id="latitudemin" value="<?php if (isset($globalLatitudeMin)) {
298
+	print $globalLatitudeMin;
299
+}
300
+?>" />
247 301
 			</p>
248 302
 			<p>
249 303
 				<label for="longitudemax">The maximum longitude (west)</label>
250
-				<input type="text" name="longitudemax" id="longitudemax" value="<?php if (isset($globalLongitudeMax)) print $globalLongitudeMax; ?>" />
304
+				<input type="text" name="longitudemax" id="longitudemax" value="<?php if (isset($globalLongitudeMax)) {
305
+	print $globalLongitudeMax;
306
+}
307
+?>" />
251 308
 			</p>
252 309
 			<p>
253 310
 				<label for="longitudemin">The minimum longitude (east)</label>
254
-				<input type="text" name="longitudemin" id="longitudemin" value="<?php if (isset($globalLongitudeMin)) print $globalLongitudeMin; ?>" />
311
+				<input type="text" name="longitudemin" id="longitudemin" value="<?php if (isset($globalLongitudeMin)) {
312
+	print $globalLongitudeMin;
313
+}
314
+?>" />
255 315
 			</p>
256 316
 			<p>
257 317
 				<label for="latitudecenter">The latitude center</label>
258
-				<input type="text" name="latitudecenter" id="latitudecenter" value="<?php if (isset($globalCenterLatitude)) print $globalCenterLatitude; ?>" />
318
+				<input type="text" name="latitudecenter" id="latitudecenter" value="<?php if (isset($globalCenterLatitude)) {
319
+	print $globalCenterLatitude;
320
+}
321
+?>" />
259 322
 			</p>
260 323
 			<p>
261 324
 				<label for="longitudecenter">The longitude center</label>
262
-				<input type="text" name="longitudecenter" id="longitudecenter" value="<?php if (isset($globalCenterLongitude)) print $globalCenterLongitude; ?>" />
325
+				<input type="text" name="longitudecenter" id="longitudecenter" value="<?php if (isset($globalCenterLongitude)) {
326
+	print $globalCenterLongitude;
327
+}
328
+?>" />
263 329
 			</p>
264 330
 			<p>
265 331
 				<label for="livezoom">Default Zoom on live map</label>
266
-				<input type="number" name="livezoom" id="livezoom" value="<?php if (isset($globalLiveZoom)) print $globalLiveZoom; else print '9'; ?>" />
332
+				<input type="number" name="livezoom" id="livezoom" value="<?php if (isset($globalLiveZoom)) {
333
+	print $globalLiveZoom;
334
+} else {
335
+	print '9';
336
+}
337
+?>" />
267 338
 			</p>
268 339
 			<p>
269 340
 				<label for="squawk_country">Country for squawk usage</label>
270 341
 				<select name="squawk_country" id="squawk_country">
271
-					<option value="UK"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'UK') print ' selected '; ?>>UK</option>
272
-					<option value="NZ"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'NZ') print ' selected '; ?>>NZ</option>
273
-					<option value="US"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'US') print ' selected '; ?>>US</option>
274
-					<option value="AU"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'AU') print ' selected '; ?>>AU</option>
275
-					<option value="NL"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'NL') print ' selected '; ?>>NL</option>
276
-					<option value="FR"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'FR') print ' selected '; ?>>FR</option>
277
-					<option value="TR"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'TR') print ' selected '; ?>>TR</option>
342
+					<option value="UK"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'UK') {
343
+	print ' selected ';
344
+}
345
+?>>UK</option>
346
+					<option value="NZ"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'NZ') {
347
+	print ' selected ';
348
+}
349
+?>>NZ</option>
350
+					<option value="US"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'US') {
351
+	print ' selected ';
352
+}
353
+?>>US</option>
354
+					<option value="AU"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'AU') {
355
+	print ' selected ';
356
+}
357
+?>>AU</option>
358
+					<option value="NL"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'NL') {
359
+	print ' selected ';
360
+}
361
+?>>NL</option>
362
+					<option value="FR"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'FR') {
363
+	print ' selected ';
364
+}
365
+?>>FR</option>
366
+					<option value="TR"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'TR') {
367
+	print ' selected ';
368
+}
369
+?>>TR</option>
278 370
 				</select>
279 371
 			</p>
280 372
 		</fieldset>
@@ -283,15 +375,24 @@  discard block
 block discarded – undo
283 375
 			<p><i>Only put in DB flights that are inside a circle</i></p>
284 376
 			<p>
285 377
 				<label for="latitude">Center latitude</label>
286
-				<input type="text" name="zoilatitude" id="latitude" value="<?php if (isset($globalDistanceIgnore['latitude'])) echo $globalDistanceIgnore['latitude']; ?>" />
378
+				<input type="text" name="zoilatitude" id="latitude" value="<?php if (isset($globalDistanceIgnore['latitude'])) {
379
+	echo $globalDistanceIgnore['latitude'];
380
+}
381
+?>" />
287 382
 			</p>
288 383
 			<p>
289 384
 				<label for="longitude">Center longitude</label>
290
-				<input type="text" name="zoilongitude" id="longitude" value="<?php if (isset($globalDistanceIgnore['longitude'])) echo $globalDistanceIgnore['longitude']; ?>" />
385
+				<input type="text" name="zoilongitude" id="longitude" value="<?php if (isset($globalDistanceIgnore['longitude'])) {
386
+	echo $globalDistanceIgnore['longitude'];
387
+}
388
+?>" />
291 389
 			</p>
292 390
 			<p>
293 391
 				<label for="Distance">Distance (in km)</label>
294
-				<input type="text" name="zoidistance" id="distance" value="<?php if (isset($globalDistanceIgnore['distance'])) echo $globalDistanceIgnore['distance']; ?>" />
392
+				<input type="text" name="zoidistance" id="distance" value="<?php if (isset($globalDistanceIgnore['distance'])) {
393
+	echo $globalDistanceIgnore['distance'];
394
+}
395
+?>" />
295 396
 			</p>
296 397
 		</fieldset>
297 398
 		<fieldset id="sourceloc">
@@ -397,11 +498,17 @@  discard block
 block discarded – undo
397 498
 			<div id="flightaware_data">
398 499
 				<p>
399 500
 					<label for="flightawareusername">FlightAware username</label>
400
-					<input type="text" name="flightawareusername" id="flightawareusername" value="<?php if (isset($globalFlightAwareUsername)) print $globalFlightAwareUsername; ?>" />
501
+					<input type="text" name="flightawareusername" id="flightawareusername" value="<?php if (isset($globalFlightAwareUsername)) {
502
+	print $globalFlightAwareUsername;
503
+}
504
+?>" />
401 505
 				</p>
402 506
 				<p>
403 507
 					<label for="flightawarepassword">FlightAware password/API key</label>
404
-					<input type="text" name="flightawarepassword" id="flightawarepassword" value="<?php if (isset($globalFlightAwarePassword)) print $globalFlightAwarePassword; ?>" />
508
+					<input type="text" name="flightawarepassword" id="flightawarepassword" value="<?php if (isset($globalFlightAwarePassword)) {
509
+	print $globalFlightAwarePassword;
510
+}
511
+?>" />
405 512
 				</p>
406 513
 			</div>
407 514
 -->
@@ -461,28 +568,88 @@  discard block
 block discarded – undo
461 568
 								?>
462 569
 								<td>
463 570
 									<select name="format[]" id="format">
464
-										<option value="auto" <?php if (!isset($source['format'])) print 'selected'; ?>>Auto</option>
465
-										<option value="sbs" <?php if (isset($source['format']) && $source['format'] == 'sbs') print 'selected'; ?>>SBS</option>
466
-										<option value="tsv" <?php if (isset($source['format']) && $source['format'] == 'tsv') print 'selected'; ?>>TSV</option>
467
-										<option value="raw" <?php if (isset($source['format']) && $source['format'] == 'raw') print 'selected'; ?>>Raw</option>
468
-										<option value="aprs" <?php if (isset($source['format']) && $source['format'] == 'aprs') print 'selected'; ?>>APRS</option>
469
-										<option value="deltadbtxt" <?php if (isset($source['format']) && $source['format'] == 'deltadbtxt') print 'selected'; ?>>Radarcape deltadb.txt</option>
470
-										<option value="vatsimtxt" <?php if (isset($source['format']) && $source['format'] == 'vatsimtxt') print 'selected'; ?>>Vatsim</option>
471
-										<option value="aircraftlistjson" <?php if (isset($source['format']) && $source['format'] == 'aircraftlistjson') print 'selected'; ?>>Virtual Radar Server AircraftList.json</option>
472
-										<option value="vrstcp" <?php if (isset($source['format']) && $source['format'] == 'vrstcp') print 'selected'; ?>>Virtual Radar Server TCP</option>
473
-										<option value="phpvmacars" <?php if (isset($source['format']) && $source['format'] == 'phpvmacars') print 'selected'; ?>>phpVMS</option>
474
-										<option value="vam" <?php if (isset($source['format']) && $source['format'] == 'vam') print 'selected'; ?>>Virtual Airlines Manager</option>
475
-										<option value="whazzup" <?php if (isset($source['format']) && $source['format'] == 'whazzup') print 'selected'; ?>>IVAO</option>
476
-										<option value="flightgearmp" <?php if (isset($source['format']) && $source['format'] == 'flightgearmp') print 'selected'; ?>>FlightGear Multiplayer</option>
477
-										<option value="flightgearsp" <?php if (isset($source['format']) && $source['format'] == 'flightgearsp') print 'selected'; ?>>FlightGear Singleplayer</option>
478
-										<option value="acars" <?php if (isset($source['format']) && $source['format'] == 'acars') print 'selected'; ?>>ACARS from acarsdec/acarsdeco2 over UDP</option>
479
-										<option value="acarssbs3" <?php if (isset($source['format']) && $source['format'] == 'acarssbs3') print 'selected'; ?>>ACARS SBS-3 over TCP</option>
480
-										<option value="ais" <?php if (isset($source['format']) && $source['format'] == 'ais') print 'selected'; ?>>NMEA AIS over TCP</option>
571
+										<option value="auto" <?php if (!isset($source['format'])) {
572
+	print 'selected';
573
+}
574
+?>>Auto</option>
575
+										<option value="sbs" <?php if (isset($source['format']) && $source['format'] == 'sbs') {
576
+	print 'selected';
577
+}
578
+?>>SBS</option>
579
+										<option value="tsv" <?php if (isset($source['format']) && $source['format'] == 'tsv') {
580
+	print 'selected';
581
+}
582
+?>>TSV</option>
583
+										<option value="raw" <?php if (isset($source['format']) && $source['format'] == 'raw') {
584
+	print 'selected';
585
+}
586
+?>>Raw</option>
587
+										<option value="aprs" <?php if (isset($source['format']) && $source['format'] == 'aprs') {
588
+	print 'selected';
589
+}
590
+?>>APRS</option>
591
+										<option value="deltadbtxt" <?php if (isset($source['format']) && $source['format'] == 'deltadbtxt') {
592
+	print 'selected';
593
+}
594
+?>>Radarcape deltadb.txt</option>
595
+										<option value="vatsimtxt" <?php if (isset($source['format']) && $source['format'] == 'vatsimtxt') {
596
+	print 'selected';
597
+}
598
+?>>Vatsim</option>
599
+										<option value="aircraftlistjson" <?php if (isset($source['format']) && $source['format'] == 'aircraftlistjson') {
600
+	print 'selected';
601
+}
602
+?>>Virtual Radar Server AircraftList.json</option>
603
+										<option value="vrstcp" <?php if (isset($source['format']) && $source['format'] == 'vrstcp') {
604
+	print 'selected';
605
+}
606
+?>>Virtual Radar Server TCP</option>
607
+										<option value="phpvmacars" <?php if (isset($source['format']) && $source['format'] == 'phpvmacars') {
608
+	print 'selected';
609
+}
610
+?>>phpVMS</option>
611
+										<option value="vam" <?php if (isset($source['format']) && $source['format'] == 'vam') {
612
+	print 'selected';
613
+}
614
+?>>Virtual Airlines Manager</option>
615
+										<option value="whazzup" <?php if (isset($source['format']) && $source['format'] == 'whazzup') {
616
+	print 'selected';
617
+}
618
+?>>IVAO</option>
619
+										<option value="flightgearmp" <?php if (isset($source['format']) && $source['format'] == 'flightgearmp') {
620
+	print 'selected';
621
+}
622
+?>>FlightGear Multiplayer</option>
623
+										<option value="flightgearsp" <?php if (isset($source['format']) && $source['format'] == 'flightgearsp') {
624
+	print 'selected';
625
+}
626
+?>>FlightGear Singleplayer</option>
627
+										<option value="acars" <?php if (isset($source['format']) && $source['format'] == 'acars') {
628
+	print 'selected';
629
+}
630
+?>>ACARS from acarsdec/acarsdeco2 over UDP</option>
631
+										<option value="acarssbs3" <?php if (isset($source['format']) && $source['format'] == 'acarssbs3') {
632
+	print 'selected';
633
+}
634
+?>>ACARS SBS-3 over TCP</option>
635
+										<option value="ais" <?php if (isset($source['format']) && $source['format'] == 'ais') {
636
+	print 'selected';
637
+}
638
+?>>NMEA AIS over TCP</option>
481 639
 									</select>
482 640
 								</td>
483
-								<td><input type="text" name="name[]" id="name" value="<?php if (isset($source['name'])) print $source['name']; ?>" /></td>
484
-								<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>
485
-								<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>
641
+								<td><input type="text" name="name[]" id="name" value="<?php if (isset($source['name'])) {
642
+	print $source['name'];
643
+}
644
+?>" /></td>
645
+								<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']) {
646
+	print 'checked';
647
+}
648
+?> /></td>
649
+								<td><input type="checkbox" name="noarchive[]" id="noarchive" title="Don't archive this source" value="1" <?php if (isset($source['noarchive']) && $source['noarchive']) {
650
+	print 'checked';
651
+}
652
+?> /></td>
486 653
 								<td><input type="button" id="delhost" value="Delete" onclick="deleteRow(this)" /> <input type="button" id="addhost" value="Add" onclick="insRow()" /></td>
487 654
 							</tr>
488 655
 <?php
@@ -531,11 +698,17 @@  discard block
 block discarded – undo
531 698
 					<p>Listen UDP server for acarsdec/acarsdeco2/... with <i>daemon-acars.php</i> script</p>
532 699
 					<p>
533 700
 						<label for="acarshost">ACARS UDP host</label>
534
-						<input type="text" name="acarshost" id="acarshost" value="<?php if (isset($globalACARSHost)) print $globalACARSHost; ?>" />
701
+						<input type="text" name="acarshost" id="acarshost" value="<?php if (isset($globalACARSHost)) {
702
+	print $globalACARSHost;
703
+}
704
+?>" />
535 705
 					</p>
536 706
 					<p>
537 707
 						<label for="acarsport">ACARS UDP port</label>
538
-						<input type="number" name="acarsport" id="acarsport" value="<?php if (isset($globalACARSPort)) print $globalACARSPort; ?>" />
708
+						<input type="number" name="acarsport" id="acarsport" value="<?php if (isset($globalACARSPort)) {
709
+	print $globalACARSPort;
710
+}
711
+?>" />
539 712
 					</p>
540 713
 				</fieldset>
541 714
 			</div>
@@ -615,13 +788,19 @@  discard block
 block discarded – undo
615 788
 			<div id="schedules_options">
616 789
 				<p>
617 790
 					<label for="britishairways">British Airways API Key</label>
618
-					<input type="text" name="britishairways" id="britishairways" value="<?php if (isset($globalBritishAirwaysKey)) print $globalBritishAirwaysKey; ?>" />
791
+					<input type="text" name="britishairways" id="britishairways" value="<?php if (isset($globalBritishAirwaysKey)) {
792
+	print $globalBritishAirwaysKey;
793
+}
794
+?>" />
619 795
 					<p class="help-block">Register an account on <a href="https://developer.ba.com/">https://developer.ba.com/</a></p>
620 796
 				</p>
621 797
 				<!--
622 798
 				<p>
623 799
 					<label for="transavia">Transavia Test API Consumer Key</label>
624
-					<input type="text" name="transavia" id="transavia" value="<?php if (isset($globalTransaviaKey)) print $globalTransaviaKey; ?>" />
800
+					<input type="text" name="transavia" id="transavia" value="<?php if (isset($globalTransaviaKey)) {
801
+	print $globalTransaviaKey;
802
+}
803
+?>" />
625 804
 					<p class="help-block">Register an account on <a href="https://developer.transavia.com">https://developer.transavia.com</a></p>
626 805
 				</p>
627 806
 				-->
@@ -630,10 +809,16 @@  discard block
 block discarded – undo
630 809
 						<b>Lufthansa API Key</b>
631 810
 						<p>
632 811
 							<label for="lufthansakey">Key</label>
633
-							<input type="text" name="lufthansakey" id="lufthansakey" value="<?php if (isset($globalLufthansaKey['key'])) print $globalLufthansaKey['key']; ?>" />
812
+							<input type="text" name="lufthansakey" id="lufthansakey" value="<?php if (isset($globalLufthansaKey['key'])) {
813
+	print $globalLufthansaKey['key'];
814
+}
815
+?>" />
634 816
 						</p><p>
635 817
 							<label for="lufthansasecret">Secret</label>
636
-							<input type="text" name="lufthansasecret" id="lufthansasecret" value="<?php if (isset($globalLufthansaKey['secret'])) print $globalLufthansaKey['secret']; ?>" />
818
+							<input type="text" name="lufthansasecret" id="lufthansasecret" value="<?php if (isset($globalLufthansaKey['secret'])) {
819
+	print $globalLufthansaKey['secret'];
820
+}
821
+?>" />
637 822
 						</p>
638 823
 					</div>
639 824
 					<p class="help-block">Register an account on <a href="https://developer.lufthansa.com/page">https://developer.lufthansa.com/page</a></p>
@@ -653,7 +838,10 @@  discard block
 block discarded – undo
653 838
 			</p>
654 839
 			<p>
655 840
 				<label for="notamsource">URL of your feed from notaminfo.com</label>
656
-				<input type="text" name="notamsource" id="notamsource" value="<?php if (isset($globalNOTAMSource)) print $globalNOTAMSource; ?>" />
841
+				<input type="text" name="notamsource" id="notamsource" value="<?php if (isset($globalNOTAMSource)) {
842
+	print $globalNOTAMSource;
843
+}
844
+?>" />
657 845
 				<p class="help-block">If you want to use world NOTAM from FlightAirMap website, leave it blank</p>
658 846
 			</p>
659 847
 			<br />
@@ -669,14 +857,20 @@  discard block
 block discarded – undo
669 857
 			<div id="metarsrc">
670 858
 				<p>
671 859
 					<label for="metarsource">URL of your METAR source</label>
672
-					<input type="text" name="metarsource" id="metarsource" value="<?php if (isset($globalMETARurl)) print $globalMETARurl; ?>" />
860
+					<input type="text" name="metarsource" id="metarsource" value="<?php if (isset($globalMETARurl)) {
861
+	print $globalMETARurl;
862
+}
863
+?>" />
673 864
 					<p class="help-block">Use {icao} to specify where we replace by airport icao. ex : http://metar.vatsim.net/metar.php?id={icao}</p>
674 865
 				</p>
675 866
 			</div>
676 867
 			<br />
677 868
 			<p>
678 869
 				<label for="bitly">Bit.ly access token api (used in search page)</label>
679
-				<input type="text" name="bitly" id="bitly" value="<?php if (isset($globalBitlyAccessToken)) print $globalBitlyAccessToken; ?>" />
870
+				<input type="text" name="bitly" id="bitly" value="<?php if (isset($globalBitlyAccessToken)) {
871
+	print $globalBitlyAccessToken;
872
+}
873
+?>" />
680 874
 			</p>
681 875
 			<br />
682 876
 			<p>
@@ -696,7 +890,12 @@  discard block
 block discarded – undo
696 890
 			</p>
697 891
 			<p>
698 892
 				<label for="archivemonths">Generate statistics, delete or put in archive flights older than xx months</label>
699
-				<input type="number" name="archivemonths" id="archivemonths" value="<?php if (isset($globalArchiveMonths)) print $globalArchiveMonths; else echo '0'; ?>" />
893
+				<input type="number" name="archivemonths" id="archivemonths" value="<?php if (isset($globalArchiveMonths)) {
894
+	print $globalArchiveMonths;
895
+} else {
896
+	echo '0';
897
+}
898
+?>" />
700 899
 				<p class="help-block">0 to disable, delete old flight if <i>Archive all flights data</i> is disabled</p>
701 900
 			</p>
702 901
 			<p>
@@ -706,12 +905,22 @@  discard block
 block discarded – undo
706 905
 			</p>
707 906
 			<p>
708 907
 				<label for="archivekeepmonths">Keep flights data for xx months in archive</label>
709
-				<input type="number" name="archivekeepmonths" id="archivekeepmonths" value="<?php if (isset($globalArchiveKeepMonths)) print $globalArchiveKeepMonths; else echo '0'; ?>" />
908
+				<input type="number" name="archivekeepmonths" id="archivekeepmonths" value="<?php if (isset($globalArchiveKeepMonths)) {
909
+	print $globalArchiveKeepMonths;
910
+} else {
911
+	echo '0';
912
+}
913
+?>" />
710 914
 				<p class="help-block">0 to disable</p>
711 915
 			</p>
712 916
 			<p>
713 917
 				<label for="archivekeeptrackmonths">Keep flights track data for xx months in archive</label>
714
-				<input type="number" name="archivekeeptrackmonths" id="archivekeeptrackmonths" value="<?php if (isset($globalArchiveKeepTrackMonths)) print $globalArchiveKeepTrackMonths; else echo '0'; ?>" />
918
+				<input type="number" name="archivekeeptrackmonths" id="archivekeeptrackmonths" value="<?php if (isset($globalArchiveKeepTrackMonths)) {
919
+	print $globalArchiveKeepTrackMonths;
920
+} else {
921
+	echo '0';
922
+}
923
+?>" />
715 924
 				<p class="help-block">0 to disable, should be less or egal to <i>Keep flights data</i> value</p>
716 925
 			</p>
717 926
 			<br />
@@ -721,7 +930,12 @@  discard block
 block discarded – undo
721 930
 				<p class="help-block">Uncheck if the script is running as cron job</p>
722 931
 				<div id="cronends"> 
723 932
 					<label for="cronend">Run script for xx seconds</label>
724
-					<input type="number" name="cronend" id="cronend" value="<?php if (isset($globalCronEnd)) print $globalCronEnd; else print '0'; ?>" />
933
+					<input type="number" name="cronend" id="cronend" value="<?php if (isset($globalCronEnd)) {
934
+	print $globalCronEnd;
935
+} else {
936
+	print '0';
937
+}
938
+?>" />
725 939
 					<p class="help-block">Set to 0 to disable. Should be disabled if source is URL.</p>
726 940
 				</div>
727 941
 			</p>
@@ -766,15 +980,30 @@  discard block
 block discarded – undo
766 980
 			<br />
767 981
 			<p>
768 982
 				<label for="refresh">Show flights detected since xxx seconds</label>
769
-				<input type="number" name="refresh" id="refresh" value="<?php if (isset($globalLiveInterval)) echo $globalLiveInterval; else echo '200'; ?>" />
983
+				<input type="number" name="refresh" id="refresh" value="<?php if (isset($globalLiveInterval)) {
984
+	echo $globalLiveInterval;
985
+} else {
986
+	echo '200';
987
+}
988
+?>" />
770 989
 			</p>
771 990
 			<p>
772 991
 				<label for="maprefresh">Live map refresh (in seconds)</label>
773
-				<input type="number" name="maprefresh" id="maprefresh" value="<?php if (isset($globalMapRefresh)) echo $globalMapRefresh; else echo '30'; ?>" />
992
+				<input type="number" name="maprefresh" id="maprefresh" value="<?php if (isset($globalMapRefresh)) {
993
+	echo $globalMapRefresh;
994
+} else {
995
+	echo '30';
996
+}
997
+?>" />
774 998
 			</p>
775 999
 			<p>
776 1000
 				<label for="mapidle">Map idle timeout (in minutes)</label>
777
-				<input type="number" name="mapidle" id="mapidle" value="<?php if (isset($globalMapIdleTimeout)) echo $globalMapIdleTimeout; else echo '30'; ?>" />
1001
+				<input type="number" name="mapidle" id="mapidle" value="<?php if (isset($globalMapIdleTimeout)) {
1002
+	echo $globalMapIdleTimeout;
1003
+} else {
1004
+	echo '30';
1005
+}
1006
+?>" />
778 1007
 				<p class="help-block">0 to disable</p>
779 1008
 			</p>
780 1009
 			<p>
@@ -784,12 +1013,20 @@  discard block
 block discarded – undo
784 1013
 			<br />
785 1014
 			<p>
786 1015
 				<label for="closestmindist">Distance to airport set as arrival (in km)</label>
787
-				<input type="number" name="closestmindist" id="closestmindist" value="<?php if (isset($globalClosestMinDist)) echo $globalClosestMinDist; else echo '50'; ?>" />
1016
+				<input type="number" name="closestmindist" id="closestmindist" value="<?php if (isset($globalClosestMinDist)) {
1017
+	echo $globalClosestMinDist;
1018
+} else {
1019
+	echo '50';
1020
+}
1021
+?>" />
788 1022
 			</p>
789 1023
 			<br />
790 1024
 			<p>
791 1025
 				<label for="aircraftsize">Size of aircraft icon on map (default to 30px if zoom > 7 else 15px), empty to default</label>
792
-				<input type="number" name="aircraftsize" id="aircraftsize" value="<?php if (isset($globalAircraftSize)) echo $globalAircraftSize;?>" />
1026
+				<input type="number" name="aircraftsize" id="aircraftsize" value="<?php if (isset($globalAircraftSize)) {
1027
+	echo $globalAircraftSize;
1028
+}
1029
+?>" />
793 1030
 			</p>
794 1031
 			<br />
795 1032
 			<p>
@@ -797,7 +1034,12 @@  discard block
 block discarded – undo
797 1034
 			    if (extension_loaded('gd') && function_exists('gd_info')) {
798 1035
 			?>
799 1036
 				<label for="aircrafticoncolor">Color of aircraft icon on map</label>
800
-				<input type="color" name="aircrafticoncolor" id="aircrafticoncolor" value="#<?php if (isset($globalAircraftIconColor)) echo $globalAircraftIconColor; else echo '1a3151'; ?>" />
1037
+				<input type="color" name="aircrafticoncolor" id="aircrafticoncolor" value="#<?php if (isset($globalAircraftIconColor)) {
1038
+	echo $globalAircraftIconColor;
1039
+} else {
1040
+	echo '1a3151';
1041
+}
1042
+?>" />
801 1043
 			<?php
802 1044
 				if (!is_writable('../cache')) {
803 1045
 			?>
@@ -815,8 +1057,18 @@  discard block
 block discarded – undo
815 1057
 			<p>
816 1058
 				<label for="airportzoom">Zoom level minimum to see airports icons</label>
817 1059
 				<div class="range">
818
-					<input type="range" name="airportzoom" id="airportzoom" value="<?php if (isset($globalAirportZoom)) echo $globalAirportZoom; else echo '7'; ?>" />
819
-					<output id="range"><?php if (isset($globalAirportZoom)) echo $globalAirportZoom; else echo '7'; ?></output>
1060
+					<input type="range" name="airportzoom" id="airportzoom" value="<?php if (isset($globalAirportZoom)) {
1061
+	echo $globalAirportZoom;
1062
+} else {
1063
+	echo '7';
1064
+}
1065
+?>" />
1066
+					<output id="range"><?php if (isset($globalAirportZoom)) {
1067
+	echo $globalAirportZoom;
1068
+} else {
1069
+	echo '7';
1070
+}
1071
+?></output>
820 1072
 				</div>
821 1073
 			</p>
822 1074
 		</fieldset>
@@ -844,8 +1096,12 @@  discard block
 block discarded – undo
844 1096
 	$dbhost = filter_input(INPUT_POST,'dbhost',FILTER_SANITIZE_STRING);
845 1097
 	$dbport = filter_input(INPUT_POST,'dbport',FILTER_SANITIZE_STRING);
846 1098
 
847
-	if ($dbtype == 'mysql' && !extension_loaded('pdo_mysql')) $error .= 'Mysql driver for PDO must be loaded';
848
-	if ($dbtype == 'pgsql' && !extension_loaded('pdo_pgsql')) $error .= 'PosgreSQL driver for PDO must be loaded';
1099
+	if ($dbtype == 'mysql' && !extension_loaded('pdo_mysql')) {
1100
+		$error .= 'Mysql driver for PDO must be loaded';
1101
+	}
1102
+	if ($dbtype == 'pgsql' && !extension_loaded('pdo_pgsql')) {
1103
+		$error .= 'PosgreSQL driver for PDO must be loaded';
1104
+	}
849 1105
 	
850 1106
 	$_SESSION['database_root'] = $dbroot;
851 1107
 	$_SESSION['database_rootpass'] = $dbrootpass;
@@ -912,15 +1168,23 @@  discard block
 block discarded – undo
912 1168
 	$source_city = $_POST['source_city'];
913 1169
 	$source_country = $_POST['source_country'];
914 1170
 	$source_ref = $_POST['source_ref'];
915
-	if (isset($source_id)) $source_id = $_POST['source_id'];
916
-	else $source_id = array();
1171
+	if (isset($source_id)) {
1172
+		$source_id = $_POST['source_id'];
1173
+	} else {
1174
+		$source_id = array();
1175
+	}
917 1176
 	
918 1177
 	$sources = array();
919 1178
 	foreach ($source_name as $keys => $name) {
920
-	    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]);
921
-	    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]);
1179
+	    if (isset($source_id[$keys])) {
1180
+	    	$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]);
1181
+	    } else {
1182
+	    	$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]);
1183
+	    }
1184
+	}
1185
+	if (count($sources) > 0) {
1186
+		$_SESSION['sources'] = $sources;
922 1187
 	}
923
-	if (count($sources) > 0) $_SESSION['sources'] = $sources;
924 1188
 
925 1189
 	//$sbshost = filter_input(INPUT_POST,'sbshost',FILTER_SANITIZE_STRING);
926 1190
 	//$sbsport = filter_input(INPUT_POST,'sbsport',FILTER_SANITIZE_NUMBER_INT);
@@ -940,14 +1204,23 @@  discard block
 block discarded – undo
940 1204
 	$datasource = filter_input(INPUT_POST,'datasource',FILTER_SANITIZE_STRING);
941 1205
 
942 1206
 	$globalaircraft = filter_input(INPUT_POST,'globalaircraft',FILTER_SANITIZE_STRING);
943
-	if ($globalaircraft == 'aircraft') $settings = array_merge($settings,array('globalAircraft' => 'TRUE'));
944
-	else $settings = array_merge($settings,array('globalAircraft' => 'FALSE'));
1207
+	if ($globalaircraft == 'aircraft') {
1208
+		$settings = array_merge($settings,array('globalAircraft' => 'TRUE'));
1209
+	} else {
1210
+		$settings = array_merge($settings,array('globalAircraft' => 'FALSE'));
1211
+	}
945 1212
 	$globaltracker = filter_input(INPUT_POST,'globaltracker',FILTER_SANITIZE_STRING);
946
-	if ($globaltracker == 'tracker') $settings = array_merge($settings,array('globalTracker' => 'TRUE'));
947
-	else $settings = array_merge($settings,array('globalTracker' => 'FALSE'));
1213
+	if ($globaltracker == 'tracker') {
1214
+		$settings = array_merge($settings,array('globalTracker' => 'TRUE'));
1215
+	} else {
1216
+		$settings = array_merge($settings,array('globalTracker' => 'FALSE'));
1217
+	}
948 1218
 	$globalmarine = filter_input(INPUT_POST,'globalmarine',FILTER_SANITIZE_STRING);
949
-	if ($globalmarine == 'marine') $settings = array_merge($settings,array('globalMarine' => 'TRUE'));
950
-	else $settings = array_merge($settings,array('globalMarine' => 'FALSE'));
1219
+	if ($globalmarine == 'marine') {
1220
+		$settings = array_merge($settings,array('globalMarine' => 'TRUE'));
1221
+	} else {
1222
+		$settings = array_merge($settings,array('globalMarine' => 'FALSE'));
1223
+	}
951 1224
 
952 1225
 /*	
953 1226
 	$globalSBS1Hosts = array();
@@ -968,17 +1241,31 @@  discard block
 block discarded – undo
968 1241
 	$port = $_POST['port'];
969 1242
 	$name = $_POST['name'];
970 1243
 	$format = $_POST['format'];
971
-	if (isset($_POST['sourcestats'])) $sourcestats = $_POST['sourcestats'];
972
-	else $sourcestats = array();
973
-	if (isset($_POST['noarchive'])) $noarchive = $_POST['noarchive'];
974
-	else $noarchive = array();
1244
+	if (isset($_POST['sourcestats'])) {
1245
+		$sourcestats = $_POST['sourcestats'];
1246
+	} else {
1247
+		$sourcestats = array();
1248
+	}
1249
+	if (isset($_POST['noarchive'])) {
1250
+		$noarchive = $_POST['noarchive'];
1251
+	} else {
1252
+		$noarchive = array();
1253
+	}
975 1254
 	$gSources = array();
976 1255
 	foreach ($host as $key => $h) {
977
-		if (isset($sourcestats[$key]) && $sourcestats[$key] == 1) $cov = 'TRUE';
978
-		else $cov = 'FALSE';
979
-		if (isset($noarchive[$key]) && $noarchive[$key] == 1) $arch = 'TRUE';
980
-		else $arch = 'FALSE';
981
-		if ($h != '') $gSources[] = array('host' => $h, 'port' => $port[$key],'name' => $name[$key],'format' => $format[$key],'sourcestats' => $cov,'noarchive' => $arch);
1256
+		if (isset($sourcestats[$key]) && $sourcestats[$key] == 1) {
1257
+			$cov = 'TRUE';
1258
+		} else {
1259
+			$cov = 'FALSE';
1260
+		}
1261
+		if (isset($noarchive[$key]) && $noarchive[$key] == 1) {
1262
+			$arch = 'TRUE';
1263
+		} else {
1264
+			$arch = 'FALSE';
1265
+		}
1266
+		if ($h != '') {
1267
+			$gSources[] = array('host' => $h, 'port' => $port[$key],'name' => $name[$key],'format' => $format[$key],'sourcestats' => $cov,'noarchive' => $arch);
1268
+		}
982 1269
 	}
983 1270
 	$settings = array_merge($settings,array('globalSources' => $gSources));
984 1271
 
@@ -1003,7 +1290,9 @@  discard block
 block discarded – undo
1003 1290
 	$zoidistance = filter_input(INPUT_POST,'zoidistance',FILTER_SANITIZE_NUMBER_INT);
1004 1291
 	if ($zoilatitude != '' && $zoilongitude != '' && $zoidistance != '') {
1005 1292
 		$settings = array_merge($settings,array('globalDistanceIgnore' => array('latitude' => $zoilatitude,'longitude' => $zoilongitude,'distance' => $zoidistance)));
1006
-	} else $settings = array_merge($settings,array('globalDistanceIgnore' => array()));
1293
+	} else {
1294
+		$settings = array_merge($settings,array('globalDistanceIgnore' => array()));
1295
+	}
1007 1296
 
1008 1297
 	$refresh = filter_input(INPUT_POST,'refresh',FILTER_SANITIZE_NUMBER_INT);
1009 1298
 	$settings = array_merge($settings,array('globalLiveInterval' => $refresh));
@@ -1042,7 +1331,9 @@  discard block
 block discarded – undo
1042 1331
 
1043 1332
 	// Create in settings.php keys not yet configurable if not already here
1044 1333
 	//if (!isset($globalImageBingKey)) $settings = array_merge($settings,array('globalImageBingKey' => ''));
1045
-	if (!isset($globalDebug)) $settings = array_merge($settings,array('globalDebug' => 'TRUE'));
1334
+	if (!isset($globalDebug)) {
1335
+		$settings = array_merge($settings,array('globalDebug' => 'TRUE'));
1336
+	}
1046 1337
 
1047 1338
 	$resetyearstats = filter_input(INPUT_POST,'resetyearstats',FILTER_SANITIZE_STRING);
1048 1339
 	if ($resetyearstats == 'resetyearstats') {
@@ -1079,27 +1370,43 @@  discard block
 block discarded – undo
1079 1370
 	}
1080 1371
 */
1081 1372
 	$settings = array_merge($settings,array('globalFlightAware' => 'FALSE'));
1082
-	if ($globalsbs == 'sbs') $settings = array_merge($settings,array('globalSBS1' => 'TRUE'));
1083
-	else $settings = array_merge($settings,array('globalSBS1' => 'FALSE'));
1084
-	if ($globalaprs == 'aprs') $settings = array_merge($settings,array('globalAPRS' => 'TRUE'));
1085
-	else $settings = array_merge($settings,array('globalAPRS' => 'FALSE'));
1373
+	if ($globalsbs == 'sbs') {
1374
+		$settings = array_merge($settings,array('globalSBS1' => 'TRUE'));
1375
+	} else {
1376
+		$settings = array_merge($settings,array('globalSBS1' => 'FALSE'));
1377
+	}
1378
+	if ($globalaprs == 'aprs') {
1379
+		$settings = array_merge($settings,array('globalAPRS' => 'TRUE'));
1380
+	} else {
1381
+		$settings = array_merge($settings,array('globalAPRS' => 'FALSE'));
1382
+	}
1086 1383
 	if ($globalivao == 'ivao') {
1087 1384
 		//$settings = array_merge($settings,array('globalIVAO' => 'TRUE','globalVATSIM' => 'FALSE'));
1088 1385
 		$settings = array_merge($settings,array('globalIVAO' => 'TRUE'));
1089
-	} else $settings = array_merge($settings,array('globalIVAO' => 'FALSE'));
1386
+	} else {
1387
+		$settings = array_merge($settings,array('globalIVAO' => 'FALSE'));
1388
+	}
1090 1389
 	if ($globalvatsim == 'vatsim') {
1091 1390
 		//$settings = array_merge($settings,array('globalVATSIM' => 'TRUE','globalIVAO' => 'FALSE'));
1092 1391
 		$settings = array_merge($settings,array('globalVATSIM' => 'TRUE'));
1093
-	} else $settings = array_merge($settings,array('globalVATSIM' => 'FALSE'));
1392
+	} else {
1393
+		$settings = array_merge($settings,array('globalVATSIM' => 'FALSE'));
1394
+	}
1094 1395
 	if ($globalphpvms == 'phpvms') {
1095 1396
 		$settings = array_merge($settings,array('globalphpVMS' => 'TRUE'));
1096
-	} else $settings = array_merge($settings,array('globalphpVMS' => 'FALSE'));
1397
+	} else {
1398
+		$settings = array_merge($settings,array('globalphpVMS' => 'FALSE'));
1399
+	}
1097 1400
 	if ($globalvam == 'vam') {
1098 1401
 		$settings = array_merge($settings,array('globalVAM' => 'TRUE'));
1099
-	} else $settings = array_merge($settings,array('globalVAM' => 'FALSE'));
1402
+	} else {
1403
+		$settings = array_merge($settings,array('globalVAM' => 'FALSE'));
1404
+	}
1100 1405
 	if ($globalvatsim == 'vatsim' || $globalivao == 'ivao' || $globalphpvms == 'phpvms') {
1101 1406
 		$settings = array_merge($settings,array('globalSchedulesFetch' => 'FALSE','globalTranslationFetch' => 'FALSE'));
1102
-	} else $settings = array_merge($settings,array('globalSchedulesFetch' => 'TRUE','globalTranslationFetch' => 'TRUE'));
1407
+	} else {
1408
+		$settings = array_merge($settings,array('globalSchedulesFetch' => 'TRUE','globalTranslationFetch' => 'TRUE'));
1409
+	}
1103 1410
 	
1104 1411
 
1105 1412
 
@@ -1241,7 +1548,9 @@  discard block
 block discarded – undo
1241 1548
 		$settings = array_merge($settings,array('globalWaypoints' => 'FALSE'));
1242 1549
 	}
1243 1550
 
1244
-	if (!isset($globalTransaction)) $settings = array_merge($settings,array('globalTransaction' => 'TRUE'));
1551
+	if (!isset($globalTransaction)) {
1552
+		$settings = array_merge($settings,array('globalTransaction' => 'TRUE'));
1553
+	}
1245 1554
 
1246 1555
 	// Set some defaults values...
1247 1556
 	if (!isset($globalAircraftImageSources)) {
@@ -1256,15 +1565,23 @@  discard block
 block discarded – undo
1256 1565
 
1257 1566
 	$settings = array_merge($settings,array('globalInstalled' => 'TRUE'));
1258 1567
 
1259
-	if ($error == '') settings::modify_settings($settings);
1260
-	if ($error == '') settings::comment_settings($settings_comment);
1568
+	if ($error == '') {
1569
+		settings::modify_settings($settings);
1570
+	}
1571
+	if ($error == '') {
1572
+		settings::comment_settings($settings_comment);
1573
+	}
1261 1574
 	if ($error != '') {
1262 1575
 		print '<div class="info column">'.$error.'</div>';
1263 1576
 		require('../footer.php');
1264 1577
 		exit;
1265 1578
 	} else {
1266
-		if (isset($_POST['waypoints']) && $_POST['waypoints'] == 'waypoints') $_SESSION['waypoints'] = 1;
1267
-		if (isset($_POST['owner']) && $_POST['owner'] == 'owner') $_SESSION['owner'] = 1;
1579
+		if (isset($_POST['waypoints']) && $_POST['waypoints'] == 'waypoints') {
1580
+			$_SESSION['waypoints'] = 1;
1581
+		}
1582
+		if (isset($_POST['owner']) && $_POST['owner'] == 'owner') {
1583
+			$_SESSION['owner'] = 1;
1584
+		}
1268 1585
 		if (isset($_POST['createdb'])) {
1269 1586
 			$_SESSION['install'] = 'database_create';
1270 1587
 		} else {
@@ -1305,10 +1622,18 @@  discard block
 block discarded – undo
1305 1622
 	$popw = false;
1306 1623
 	foreach ($_SESSION['done'] as $done) {
1307 1624
 	    print '<li>'.$done.'....<strong>SUCCESS</strong></li>';
1308
-	    if ($done == 'Create database') $pop = true;
1309
-	    if ($_SESSION['install'] == 'database_create') $pop = true;
1310
-	    if ($_SESSION['install'] == 'database_import') $popi = true;
1311
-	    if ($_SESSION['install'] == 'waypoints') $popw = true;
1625
+	    if ($done == 'Create database') {
1626
+	    	$pop = true;
1627
+	    }
1628
+	    if ($_SESSION['install'] == 'database_create') {
1629
+	    	$pop = true;
1630
+	    }
1631
+	    if ($_SESSION['install'] == 'database_import') {
1632
+	    	$popi = true;
1633
+	    }
1634
+	    if ($_SESSION['install'] == 'waypoints') {
1635
+	    	$popw = true;
1636
+	    }
1312 1637
 	}
1313 1638
 	if ($pop) {
1314 1639
 	    sleep(5);
@@ -1319,7 +1644,9 @@  discard block
 block discarded – undo
1319 1644
 	} else if ($popw) {
1320 1645
 	    sleep(5);
1321 1646
 	    print '<li>Populate waypoints database....<img src="../images/loading.gif" /></li>';
1322
-	} else print '<li>Update schema if needed....<img src="../images/loading.gif" /></li>';
1647
+	} else {
1648
+		print '<li>Update schema if needed....<img src="../images/loading.gif" /></li>';
1649
+	}
1323 1650
 	print '</div></ul>';
1324 1651
 	print '<div id="error"></div>';
1325 1652
 /*	foreach ($_SESSION['done'] as $done) {
Please login to merge, or discard this patch.
require/class.Image.php 1 patch
Braces   +203 added lines, -75 removed lines patch added patch discarded remove patch
@@ -23,7 +23,9 @@  discard block
 block discarded – undo
23 23
 		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
24 24
 		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
25 25
 		$reg = $registration;
26
-		if ($reg == '' && $aircraft_icao != '') $reg = $aircraft_icao.$airline_icao;
26
+		if ($reg == '' && $aircraft_icao != '') {
27
+			$reg = $aircraft_icao.$airline_icao;
28
+		}
27 29
 		$reg = trim($reg);
28 30
 		$query  = "SELECT spotter_image.image, spotter_image.image_thumbnail, spotter_image.image_source, spotter_image.image_source_website,spotter_image.image_copyright, spotter_image.registration 
29 31
 			FROM spotter_image 
@@ -31,9 +33,13 @@  discard block
 block discarded – undo
31 33
 		$sth = $this->db->prepare($query);
32 34
 		$sth->execute(array(':registration' => $reg));
33 35
 		$result = $sth->fetchAll(PDO::FETCH_ASSOC);
34
-		if (!empty($result)) return $result;
35
-		elseif ($registration != '') return $this->getSpotterImage('',$aircraft_icao,$airline_icao);
36
-		else return array();
36
+		if (!empty($result)) {
37
+			return $result;
38
+		} elseif ($registration != '') {
39
+			return $this->getSpotterImage('',$aircraft_icao,$airline_icao);
40
+		} else {
41
+			return array();
42
+		}
37 43
 	}
38 44
 
39 45
 	/**
@@ -76,8 +82,11 @@  discard block
 block discarded – undo
76 82
 	public function getExifCopyright($url) {
77 83
 		$exif = exif_read_data($url);
78 84
 		$copyright = '';
79
-		if (isset($exif['COMPUTED']['copyright'])) $copyright = $exif['COMPUTED']['copyright'];
80
-		elseif (isset($exif['copyright'])) $copyright = $exif['copyright'];
85
+		if (isset($exif['COMPUTED']['copyright'])) {
86
+			$copyright = $exif['COMPUTED']['copyright'];
87
+		} elseif (isset($exif['copyright'])) {
88
+			$copyright = $exif['copyright'];
89
+		}
81 90
 		if ($copyright != '') {
82 91
 			$copyright = str_replace('Copyright ','',$copyright);
83 92
 			$copyright = str_replace('© ','',$copyright);
@@ -95,17 +104,27 @@  discard block
 block discarded – undo
95 104
 	public function addSpotterImage($registration,$aircraft_icao = '', $airline_icao = '')
96 105
 	{
97 106
 		global $globalDebug,$globalAircraftImageFetch;
98
-		if (isset($globalAircraftImageFetch) && !$globalAircraftImageFetch) return '';
107
+		if (isset($globalAircraftImageFetch) && !$globalAircraftImageFetch) {
108
+			return '';
109
+		}
99 110
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
100 111
 		$registration = trim($registration);
101 112
 		//getting the aircraft image
102
-		if ($globalDebug && $registration != '') echo 'Try to find an aircraft image for '.$registration.'...';
103
-		elseif ($globalDebug && $aircraft_icao != '') echo 'Try to find an aircraft image for '.$aircraft_icao.'...';
104
-		elseif ($globalDebug && $airline_icao != '') echo 'Try to find an aircraft image for '.$airline_icao.'...';
113
+		if ($globalDebug && $registration != '') {
114
+			echo 'Try to find an aircraft image for '.$registration.'...';
115
+		} elseif ($globalDebug && $aircraft_icao != '') {
116
+			echo 'Try to find an aircraft image for '.$aircraft_icao.'...';
117
+		} elseif ($globalDebug && $airline_icao != '') {
118
+			echo 'Try to find an aircraft image for '.$airline_icao.'...';
119
+		}
105 120
 		$image_url = $this->findAircraftImage($registration,$aircraft_icao,$airline_icao);
106
-		if ($registration == '' && $aircraft_icao != '') $registration = $aircraft_icao.$airline_icao;
121
+		if ($registration == '' && $aircraft_icao != '') {
122
+			$registration = $aircraft_icao.$airline_icao;
123
+		}
107 124
 		if ($image_url['original'] != '') {
108
-			if ($globalDebug) echo 'Found !'."\n";
125
+			if ($globalDebug) {
126
+				echo 'Found !'."\n";
127
+			}
109 128
 			$query  = "INSERT INTO spotter_image (registration, image, image_thumbnail, image_copyright, image_source,image_source_website) VALUES (:registration,:image,:image_thumbnail,:copyright,:source,:source_website)";
110 129
 			try {
111 130
 				$sth = $this->db->prepare($query);
@@ -114,7 +133,9 @@  discard block
 block discarded – undo
114 133
 				echo $e->getMessage()."\n";
115 134
 				return "error";
116 135
 			}
117
-		} elseif ($globalDebug) echo "Not found :'(\n";
136
+		} elseif ($globalDebug) {
137
+			echo "Not found :'(\n";
138
+		}
118 139
 		return "success";
119 140
 	}
120 141
 
@@ -127,7 +148,9 @@  discard block
 block discarded – undo
127 148
 	public function addMarineImage($mmsi,$imo = '',$name = '')
128 149
 	{
129 150
 		global $globalDebug,$globalMarineImageFetch;
130
-		if (isset($globalMarineImageFetch) && !$globalMarineImageFetch) return '';
151
+		if (isset($globalMarineImageFetch) && !$globalMarineImageFetch) {
152
+			return '';
153
+		}
131 154
 		$mmsi = filter_var($mmsi,FILTER_SANITIZE_STRING);
132 155
 		$imo = filter_var($imo,FILTER_SANITIZE_STRING);
133 156
 		$name = filter_var($name,FILTER_SANITIZE_STRING);
@@ -137,16 +160,22 @@  discard block
 block discarded – undo
137 160
 			$identity = $Marine->getIdentity($mmsi);
138 161
 			if (isset($identity[0]['mmsi'])) {
139 162
 				$imo = $identity[0]['imo'];
140
-				if ($identity[0]['ship_name'] != '') $name = $identity[0]['ship_name'];
163
+				if ($identity[0]['ship_name'] != '') {
164
+					$name = $identity[0]['ship_name'];
165
+				}
141 166
 			}
142 167
 		}
143 168
 		unset($Marine);
144 169
 
145 170
 		//getting the aircraft image
146
-		if ($globalDebug && $name != '') echo 'Try to find an vessel image for '.$name.'...';
171
+		if ($globalDebug && $name != '') {
172
+			echo 'Try to find an vessel image for '.$name.'...';
173
+		}
147 174
 		$image_url = $this->findMarineImage($mmsi,$imo,$name);
148 175
 		if ($image_url['original'] != '') {
149
-			if ($globalDebug) echo 'Found !'."\n";
176
+			if ($globalDebug) {
177
+				echo 'Found !'."\n";
178
+			}
150 179
 			$query  = "INSERT INTO marine_image (mmsi,imo,name, image, image_thumbnail, image_copyright, image_source,image_source_website) VALUES (:mmsi,:imo,:name,:image,:image_thumbnail,:copyright,:source,:source_website)";
151 180
 			try {
152 181
 				$sth = $this->db->prepare($query);
@@ -155,7 +184,9 @@  discard block
 block discarded – undo
155 184
 				echo $e->getMessage()."\n";
156 185
 				return "error";
157 186
 			}
158
-		} elseif ($globalDebug) echo "Not found :'(\n";
187
+		} elseif ($globalDebug) {
188
+			echo "Not found :'(\n";
189
+		}
159 190
 		return "success";
160 191
 	}
161 192
 
@@ -170,41 +201,85 @@  discard block
 block discarded – undo
170 201
 	{
171 202
 		global $globalAircraftImageSources, $globalIVAO, $globalAircraftImageCheckICAO;
172 203
 		$Spotter = new Spotter($this->db);
173
-		if (!isset($globalIVAO)) $globalIVAO = FALSE;
204
+		if (!isset($globalIVAO)) {
205
+			$globalIVAO = FALSE;
206
+		}
174 207
 		$aircraft_registration = filter_var($aircraft_registration,FILTER_SANITIZE_STRING);
175 208
 		if ($aircraft_registration != '') {
176
-			if (strpos($aircraft_registration,'/') !== false) return array('thumbnail' => '','original' => '', 'copyright' => '','source' => '','source_website' => '');
209
+			if (strpos($aircraft_registration,'/') !== false) {
210
+				return array('thumbnail' => '','original' => '', 'copyright' => '','source' => '','source_website' => '');
211
+			}
177 212
 			$aircraft_registration = urlencode(trim($aircraft_registration));
178 213
 			$aircraft_info = $Spotter->getAircraftInfoByRegistration($aircraft_registration);
179
-			if (isset($aircraft_info[0]['aircraft_name'])) $aircraft_name = $aircraft_info[0]['aircraft_name'];
180
-			else $aircraft_name = '';
181
-			if (isset($aircraft_info[0]['aircraft_icao'])) $aircraft_name = $aircraft_info[0]['aircraft_icao'];
182
-			else $aircraft_icao = '';
183
-			if (isset($aircraft_info[0]['airline_icao'])) $airline_icao = $aircraft_info[0]['airline_icao'];
184
-			else $airline_icao = '';
214
+			if (isset($aircraft_info[0]['aircraft_name'])) {
215
+				$aircraft_name = $aircraft_info[0]['aircraft_name'];
216
+			} else {
217
+				$aircraft_name = '';
218
+			}
219
+			if (isset($aircraft_info[0]['aircraft_icao'])) {
220
+				$aircraft_name = $aircraft_info[0]['aircraft_icao'];
221
+			} else {
222
+				$aircraft_icao = '';
223
+			}
224
+			if (isset($aircraft_info[0]['airline_icao'])) {
225
+				$airline_icao = $aircraft_info[0]['airline_icao'];
226
+			} else {
227
+				$airline_icao = '';
228
+			}
185 229
 		} elseif ($aircraft_icao != '') {
186 230
 			$aircraft_info = $Spotter->getAllAircraftInfo($aircraft_icao);
187
-			if (isset($aircraft_info[0]['type'])) $aircraft_name = $aircraft_info[0]['type'];
188
-			else $aircraft_name = '';
231
+			if (isset($aircraft_info[0]['type'])) {
232
+				$aircraft_name = $aircraft_info[0]['type'];
233
+			} else {
234
+				$aircraft_name = '';
235
+			}
189 236
 			$aircraft_registration = $aircraft_icao;
190
-		} else return array('thumbnail' => '','original' => '', 'copyright' => '', 'source' => '','source_website' => '');
237
+		} else {
238
+			return array('thumbnail' => '','original' => '', 'copyright' => '', 'source' => '','source_website' => '');
239
+		}
191 240
 		unset($Spotter);
192
-		if (!isset($globalAircraftImageSources)) $globalAircraftImageSources = array('ivaomtl','wikimedia','airportdata','deviantart','flickr','bing','jetphotos','planepictures','planespotters');
241
+		if (!isset($globalAircraftImageSources)) {
242
+			$globalAircraftImageSources = array('ivaomtl','wikimedia','airportdata','deviantart','flickr','bing','jetphotos','planepictures','planespotters');
243
+		}
193 244
 		foreach ($globalAircraftImageSources as $source) {
194 245
 			$source = strtolower($source);
195
-			if ($source == 'ivaomtl' && $globalIVAO && $aircraft_icao != '' && $airline_icao != '') $images_array = $this->fromIvaoMtl('aircraft',$aircraft_icao,$airline_icao);
196
-			if ($source == 'planespotters' && !$globalIVAO) $images_array = $this->fromPlanespotters('aircraft',$aircraft_registration,$aircraft_name);
197
-			if ($source == 'flickr') $images_array = $this->fromFlickr('aircraft',$aircraft_registration,$aircraft_name);
198
-			if ($source == 'bing') $images_array = $this->fromBing('aircraft',$aircraft_registration,$aircraft_name);
199
-			if ($source == 'deviantart') $images_array = $this->fromDeviantart('aircraft',$aircraft_registration,$aircraft_name);
200
-			if ($source == 'wikimedia') $images_array = $this->fromWikimedia('aircraft',$aircraft_registration,$aircraft_name);
201
-			if ($source == 'jetphotos' && !$globalIVAO) $images_array = $this->fromJetPhotos('aircraft',$aircraft_registration,$aircraft_name);
202
-			if ($source == 'planepictures' && !$globalIVAO) $images_array = $this->fromPlanePictures('aircraft',$aircraft_registration,$aircraft_name);
203
-			if ($source == 'airportdata' && !$globalIVAO) $images_array = $this->fromAirportData('aircraft',$aircraft_registration,$aircraft_name);
204
-			if ($source == 'customsources') $images_array = $this->fromCustomSource('aircraft',$aircraft_registration,$aircraft_name);
205
-			if (isset($images_array) && $images_array['original'] != '') return $images_array;
206
-		}
207
-		if ((!isset($globalAircraftImageCheckICAO) || $globalAircraftImageCheckICAO === TRUE) && isset($aircraft_icao)) return $this->findAircraftImage($aircraft_icao);
246
+			if ($source == 'ivaomtl' && $globalIVAO && $aircraft_icao != '' && $airline_icao != '') {
247
+				$images_array = $this->fromIvaoMtl('aircraft',$aircraft_icao,$airline_icao);
248
+			}
249
+			if ($source == 'planespotters' && !$globalIVAO) {
250
+				$images_array = $this->fromPlanespotters('aircraft',$aircraft_registration,$aircraft_name);
251
+			}
252
+			if ($source == 'flickr') {
253
+				$images_array = $this->fromFlickr('aircraft',$aircraft_registration,$aircraft_name);
254
+			}
255
+			if ($source == 'bing') {
256
+				$images_array = $this->fromBing('aircraft',$aircraft_registration,$aircraft_name);
257
+			}
258
+			if ($source == 'deviantart') {
259
+				$images_array = $this->fromDeviantart('aircraft',$aircraft_registration,$aircraft_name);
260
+			}
261
+			if ($source == 'wikimedia') {
262
+				$images_array = $this->fromWikimedia('aircraft',$aircraft_registration,$aircraft_name);
263
+			}
264
+			if ($source == 'jetphotos' && !$globalIVAO) {
265
+				$images_array = $this->fromJetPhotos('aircraft',$aircraft_registration,$aircraft_name);
266
+			}
267
+			if ($source == 'planepictures' && !$globalIVAO) {
268
+				$images_array = $this->fromPlanePictures('aircraft',$aircraft_registration,$aircraft_name);
269
+			}
270
+			if ($source == 'airportdata' && !$globalIVAO) {
271
+				$images_array = $this->fromAirportData('aircraft',$aircraft_registration,$aircraft_name);
272
+			}
273
+			if ($source == 'customsources') {
274
+				$images_array = $this->fromCustomSource('aircraft',$aircraft_registration,$aircraft_name);
275
+			}
276
+			if (isset($images_array) && $images_array['original'] != '') {
277
+				return $images_array;
278
+			}
279
+		}
280
+		if ((!isset($globalAircraftImageCheckICAO) || $globalAircraftImageCheckICAO === TRUE) && isset($aircraft_icao)) {
281
+			return $this->findAircraftImage($aircraft_icao);
282
+		}
208 283
 		return array('thumbnail' => '','original' => '', 'copyright' => '','source' => '','source_website' => '');
209 284
 	}
210 285
 
@@ -224,7 +299,9 @@  discard block
 block discarded – undo
224 299
 		//$imo = filter_var($imo,FILTER_SANITIZE_STRING);
225 300
 		$name = filter_var($name,FILTER_SANITIZE_STRING);
226 301
 		$name = trim($name);
227
-		if (strlen($name) < 4) return array('thumbnail' => '','original' => '', 'copyright' => '', 'source' => '','source_website' => '');
302
+		if (strlen($name) < 4) {
303
+			return array('thumbnail' => '','original' => '', 'copyright' => '', 'source' => '','source_website' => '');
304
+		}
228 305
 		/*
229 306
 		$Marine = new Marine($this->db);
230 307
 		if ($imo == '' || $name == '') {
@@ -236,15 +313,29 @@  discard block
 block discarded – undo
236 313
 		}
237 314
 		unset($Marine);
238 315
 		*/
239
-		if (!isset($globalMarineImageSources)) $globalMarineImageSources = array('wikimedia','deviantart','flickr','bing');
316
+		if (!isset($globalMarineImageSources)) {
317
+			$globalMarineImageSources = array('wikimedia','deviantart','flickr','bing');
318
+		}
240 319
 		foreach ($globalMarineImageSources as $source) {
241 320
 			$source = strtolower($source);
242
-			if ($source == 'flickr') $images_array = $this->fromFlickr('marine',$mmsi,$name);
243
-			if ($source == 'bing') $images_array = $this->fromBing('marine',$mmsi,$name);
244
-			if ($source == 'deviantart') $images_array = $this->fromDeviantart('marine',$mmsi,$name);
245
-			if ($source == 'wikimedia') $images_array = $this->fromWikimedia('marine',$mmsi,$name);
246
-			if ($source == 'customsources') $images_array = $this->fromCustomSource('marine',$mmsi,$name);
247
-			if (isset($images_array) && $images_array['original'] != '') return $images_array;
321
+			if ($source == 'flickr') {
322
+				$images_array = $this->fromFlickr('marine',$mmsi,$name);
323
+			}
324
+			if ($source == 'bing') {
325
+				$images_array = $this->fromBing('marine',$mmsi,$name);
326
+			}
327
+			if ($source == 'deviantart') {
328
+				$images_array = $this->fromDeviantart('marine',$mmsi,$name);
329
+			}
330
+			if ($source == 'wikimedia') {
331
+				$images_array = $this->fromWikimedia('marine',$mmsi,$name);
332
+			}
333
+			if ($source == 'customsources') {
334
+				$images_array = $this->fromCustomSource('marine',$mmsi,$name);
335
+			}
336
+			if (isset($images_array) && $images_array['original'] != '') {
337
+				return $images_array;
338
+			}
248 339
 		}
249 340
 		return array('thumbnail' => '','original' => '', 'copyright' => '','source' => '','source_website' => '');
250 341
 	}
@@ -407,11 +498,17 @@  discard block
 block discarded – undo
407 498
 	public function fromFlickr($type,$registration,$name='') {
408 499
 		$Common = new Common();
409 500
 		if ($type == 'aircraft') {
410
-			if ($name != '') $url = 'https://api.flickr.com/services/feeds/photos_public.gne?format=rss2&license=1,2,3,4,5,6,7&per_page=1&tags='.$registration.','.urlencode($name);
411
-			else $url = 'https://api.flickr.com/services/feeds/photos_public.gne?format=rss2&license=1,2,3,4,5,6,7&per_page=1&tags='.$registration.',aircraft';
501
+			if ($name != '') {
502
+				$url = 'https://api.flickr.com/services/feeds/photos_public.gne?format=rss2&license=1,2,3,4,5,6,7&per_page=1&tags='.$registration.','.urlencode($name);
503
+			} else {
504
+				$url = 'https://api.flickr.com/services/feeds/photos_public.gne?format=rss2&license=1,2,3,4,5,6,7&per_page=1&tags='.$registration.',aircraft';
505
+			}
412 506
 		} elseif ($type == 'marine') {
413
-			if ($name != '') $url = 'https://api.flickr.com/services/feeds/photos_public.gne?format=rss2&license=1,2,3,4,5,6,7&per_page=1&tags='.urlencode($name);
414
-			else $url = 'https://api.flickr.com/services/feeds/photos_public.gne?format=rss2&license=1,2,3,4,5,6,7&per_page=1&tags='.$registration.',vessel';
507
+			if ($name != '') {
508
+				$url = 'https://api.flickr.com/services/feeds/photos_public.gne?format=rss2&license=1,2,3,4,5,6,7&per_page=1&tags='.urlencode($name);
509
+			} else {
510
+				$url = 'https://api.flickr.com/services/feeds/photos_public.gne?format=rss2&license=1,2,3,4,5,6,7&per_page=1&tags='.$registration.',vessel';
511
+			}
415 512
 		}
416 513
 		$data = $Common->getData($url);
417 514
 		if ($xml = simplexml_load_string($data)) {
@@ -456,9 +553,14 @@  discard block
 block discarded – undo
456 553
 	public function fromBing($type,$aircraft_registration,$aircraft_name='') {
457 554
 		global $globalImageBingKey;
458 555
 		$Common = new Common();
459
-		if (!isset($globalImageBingKey) || $globalImageBingKey == '') return false;
460
-		if ($aircraft_name != '') $url = 'https://api.datamarket.azure.com/Bing/Search/v1/Image?$format=json&$top=1&Query=%27'.$aircraft_registration.'%20'.urlencode($aircraft_name).'%20-site:planespotters.com%20-site:flickr.com%27';
461
-		else $url = 'https://api.datamarket.azure.com/Bing/Search/v1/Image?$format=json&$top=1&Query=%27%2B'.$aircraft_registration.'%20%2Baircraft%20-site:planespotters.com%20-site:flickr.com%27';
556
+		if (!isset($globalImageBingKey) || $globalImageBingKey == '') {
557
+			return false;
558
+		}
559
+		if ($aircraft_name != '') {
560
+			$url = 'https://api.datamarket.azure.com/Bing/Search/v1/Image?$format=json&$top=1&Query=%27'.$aircraft_registration.'%20'.urlencode($aircraft_name).'%20-site:planespotters.com%20-site:flickr.com%27';
561
+		} else {
562
+			$url = 'https://api.datamarket.azure.com/Bing/Search/v1/Image?$format=json&$top=1&Query=%27%2B'.$aircraft_registration.'%20%2Baircraft%20-site:planespotters.com%20-site:flickr.com%27';
563
+		}
462 564
 		$headers = array("Authorization: Basic " . base64_encode("ignored:".$globalImageBingKey));
463 565
 		$data = $Common->getData($url,'get','',$headers);
464 566
 		$result = json_decode($data);
@@ -513,17 +615,25 @@  discard block
 block discarded – undo
513 615
 	public function fromWikimedia($type,$registration,$name='') {
514 616
 		$Common = new Common();
515 617
 		if ($type == 'aircraft') {
516
-			if ($name != '') $url = 'https://commons.wikimedia.org/w/api.php?action=query&list=search&format=json&srlimit=1&srnamespace=6&continue&srsearch="'.$registration.'"%20'.urlencode($name);
517
-			else $url = 'https://commons.wikimedia.org/w/api.php?action=query&list=search&format=json&srlimit=1&srnamespace=6&continue&srsearch="'.$registration.'"%20aircraft';
618
+			if ($name != '') {
619
+				$url = 'https://commons.wikimedia.org/w/api.php?action=query&list=search&format=json&srlimit=1&srnamespace=6&continue&srsearch="'.$registration.'"%20'.urlencode($name);
620
+			} else {
621
+				$url = 'https://commons.wikimedia.org/w/api.php?action=query&list=search&format=json&srlimit=1&srnamespace=6&continue&srsearch="'.$registration.'"%20aircraft';
622
+			}
518 623
 		} elseif ($type == 'marine') {
519
-			if ($name != '') $url = 'https://commons.wikimedia.org/w/api.php?action=query&list=search&format=json&srlimit=1&srnamespace=6&continue&srsearch="'.urlencode($name).'"';
520
-			else return false;
624
+			if ($name != '') {
625
+				$url = 'https://commons.wikimedia.org/w/api.php?action=query&list=search&format=json&srlimit=1&srnamespace=6&continue&srsearch="'.urlencode($name).'"';
626
+			} else {
627
+				return false;
628
+			}
521 629
 		}
522 630
 		$data = $Common->getData($url);
523 631
 		$result = json_decode($data);
524 632
 		if (isset($result->query->search[0]->title)) {
525 633
 			$fileo = $result->query->search[0]->title;
526
-			if (substr($fileo,-3) == 'pdf') return false;
634
+			if (substr($fileo,-3) == 'pdf') {
635
+				return false;
636
+			}
527 637
 			$file = urlencode($fileo);
528 638
 			$url2 = 'https://commons.wikimedia.org/w/api.php?action=query&format=json&continue&iilimit=500&prop=imageinfo&iiprop=user|url|size|mime|sha1|timestamp&iiurlwidth=200%27&titles='.$file;
529 639
 			$data2 = $Common->getData($url2);
@@ -594,18 +704,27 @@  discard block
 block discarded – undo
594 704
 					$image_url = array();
595 705
 					$image_url['thumbnail'] = $url_thumbnail;
596 706
 					$image_url['original'] = $url;
597
-					if ($source['exif'] && exif_imagetype($url) == IMAGETYPE_JPEG) $exifCopyright = $this->getExifCopyright($url);
598
-					else $exifCopyright = '';
599
-					if ($exifCopyright  != '') $image_url['copyright'] = $exifCopyright;
600
-					elseif (isset($source['copyright'])) $image_url['copyright'] = $source['copyright'];
601
-					else $image_url['copyright'] = $source['source_website'];
707
+					if ($source['exif'] && exif_imagetype($url) == IMAGETYPE_JPEG) {
708
+						$exifCopyright = $this->getExifCopyright($url);
709
+					} else {
710
+						$exifCopyright = '';
711
+					}
712
+					if ($exifCopyright  != '') {
713
+						$image_url['copyright'] = $exifCopyright;
714
+					} elseif (isset($source['copyright'])) {
715
+						$image_url['copyright'] = $source['copyright'];
716
+					} else {
717
+						$image_url['copyright'] = $source['source_website'];
718
+					}
602 719
 					$image_url['source_website'] = $source['source_website'];
603 720
 					$image_url['source'] = $source['source'];
604 721
 					return $image_url;
605 722
 				}
606 723
 			}
607 724
 			return false;
608
-		} else return false;
725
+		} else {
726
+			return false;
727
+		}
609 728
 		if (!empty($globalMarineImageCustomSources) && $type == 'marine') {
610 729
 			$customsources = array();
611 730
 			if (!isset($globalMarineImageCustomSources[0])) {
@@ -630,18 +749,27 @@  discard block
 block discarded – undo
630 749
 					$image_url = array();
631 750
 					$image_url['thumbnail'] = $url_thumbnail;
632 751
 					$image_url['original'] = $url;
633
-					if ($source['exif'] && exif_imagetype($url) == IMAGETYPE_JPEG) $exifCopyright = $this->getExifCopyright($url);
634
-					else $exifCopyright = '';
635
-					if ($exifCopyright  != '') $image_url['copyright'] = $exifCopyright;
636
-					elseif (isset($source['copyright'])) $image_url['copyright'] = $source['copyright'];
637
-					else $image_url['copyright'] = $source['source_website'];
752
+					if ($source['exif'] && exif_imagetype($url) == IMAGETYPE_JPEG) {
753
+						$exifCopyright = $this->getExifCopyright($url);
754
+					} else {
755
+						$exifCopyright = '';
756
+					}
757
+					if ($exifCopyright  != '') {
758
+						$image_url['copyright'] = $exifCopyright;
759
+					} elseif (isset($source['copyright'])) {
760
+						$image_url['copyright'] = $source['copyright'];
761
+					} else {
762
+						$image_url['copyright'] = $source['source_website'];
763
+					}
638 764
 					$image_url['source_website'] = $source['source_website'];
639 765
 					$image_url['source'] = $source['source'];
640 766
 					return $image_url;
641 767
 				}
642 768
 			}
643 769
 			return false;
644
-		} else return false;
770
+		} else {
771
+			return false;
772
+		}
645 773
 	}
646 774
 }
647 775
 
Please login to merge, or discard this patch.