Completed
Push — master ( 210d86...07e4af )
by Yannick
05:25
created

index.php (1 issue)

Labels
Severity

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
require_once('require/class.Connection.php');
3
require_once('require/class.Spotter.php');
4
require_once('require/class.Language.php');
5
require_once('require/class.Satellite.php');
6
7
$trackident = filter_input(INPUT_GET,'trackid',FILTER_SANITIZE_STRING);
8
if ($trackident != '') {
9
	require_once('require/class.SpotterLive.php');
10
	$SpotterLive = new SpotterLive();
11
	$resulttrackident = $SpotterLive->getAllLiveSpotterDataById($trackident, true);
12
	if (empty($resulttrackident)) {
13
		$Spotter = new Spotter();
14
		$spotterid = $Spotter->getSpotterIDBasedOnFlightAwareID($trackident);
15
		header('Location: '.$globalURL.'/flightid/'.$spotterid);
16
	} else {
17
		setcookie('MapTrack',$resulttrackident[0]['flightaware_id']);
18
	}
19
} else {
20
	unset($_COOKIE['MapTrack']);
21
	setcookie('MapTrack', '', time() - 3600);
22
}
23
24
$title = _("Home");
25
require_once('header.php');
26
?>
27
<noscript><div class="alert alert-danger" role="alert"><?php echo _("JavaScript <b>MUST</b> be enabled"); ?></div></noscript>
28
<div id="live-map"></div>
29
<div id="loadingOverlay"><h1>Loading...</h1></div>
30
<div id="toolbar"></div>
31
<div id="aircraft_ident"></div>
32
<div id="airspace"></div>
33
<div id="notam"></div>
34
<div id="waypoints"></div>
35
<div id="archivebox" class="archivebox"></div>
36
<div id="showdetails" class="showdetails"></div>
37
<div id="infobox" class="infobox"><h4><?php echo _("Aircrafts detected"); ?></h4><br /><i class="fa fa-spinner fa-pulse fa-fw"></i></div>
38
<?php
39
    if ((!isset($_COOKIE['MapFormat']) && isset($globalMap3Ddefault) && $globalMap3Ddefault) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d')) {
40
41
?>
42
<script src="<?php echo $globalURL; ?>/js/map.3d.js.php"></script>
43
<?php
44
    }
45
?>
46
<div id="dialog" title="<?php echo _("Session has timed-out"); ?>">
47
  <p><?php echo _("In order to save data consumption web page times out after 30 minutes. Close this dialog to continue."); ?></p>
48
</div>
49
50
<div id="sidebar" class="sidebar collapsed">
51
    <!-- Nav tabs -->
52
    <ul class="sidebar-tabs" role="tablist">
53
	<li><a href="#" onclick="zoomInMap(); return false;" title="<?php echo _("Zoom in"); ?>"><i class="fa fa-plus"></i></a></li>
54
	<li><a href="#" onclick="zoomOutMap(); return false;" title="<?php echo _("Zoom out"); ?>"><i class="fa fa-minus"></i></a></li>
55
	<li><a href="#" onclick="getUserLocation(); return false;" title="<?php echo _("Plot your Location"); ?>"><i class="fa fa-map-marker"></i></a></li>
56
	<li><a href="#" onclick="getCompassDirection(); return false;" title="<?php echo _("Compass Mode"); ?>"><i class="fa fa-compass"></i></a></li>
57
<?php
58
    if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
59
	if (isset($globalArchive) && $globalArchive == TRUE) {
60
?>
61
	<li><a href="#archive" role="tab" title="<?php echo _("Archive"); ?>"><i class="fa fa-archive"></i></a></li>
62
<?php
63
	}
64
    }
65
?>
66
	<li><a href="#home" role="tab" title="<?php echo _("Layers"); ?>"><i class="fa fa-map"></i></a></li>
67
	<li><a href="#filters" role="tab" title="<?php echo _("Filters"); ?>"><i class="fa fa-filter"></i></a></li>
68
	<li><a href="#settings" role="tab" title="<?php echo _("Settings"); ?>"><i class="fa fa-gears"></i></a></li>
69
<?php
70
    if (isset($globalMap3D) && $globalMap3D) {
71
	if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) {
72
?>
73
	<li><a href="#" onclick="show3D(); return false;" role="tab" title="3D"><b>3D</b></a></li>
74
<?php
75
        } else {
76
    	    if (isset($globalMapSatellites) && $globalMapSatellites) {
77
?>
78
	<li><a href="#satellites" role="tab" title="<?php echo _("Satellites"); ?>"><i class="satellite"></i></a></li>
79
<?php
80
	    }
81
?>
82
	<li><a href="#" onclick="show2D(); return false;" role="tab" title="2D"><b>2D</b></a></li>
83
<?php
84
	}
85
    }
86
?>
87
    </ul>
88
89
    <!-- Tab panes -->
90
    <div class="sidebar-content active">
91
	<div class="sidebar-pane" id="home">
92
	    <h1 class="sidebar-header">Layers<span class="sidebar-close"><i class="fa fa-caret-left"></i></span></h1>
93
		<form>
94
<?php
95
	if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) {
96
?>
97
		<h1>Weather</h1>
98
			<ul>
99
				<li><div class="checkbox"><label><input type="checkbox" name="weatherprecipitation" value="1" onclick="showWeatherPrecipitation();" /><?php echo _("Weather Precipitation"); ?></label></div></li>
100
				<li><div class="checkbox"><label><input type="checkbox" name="weatherrain" value="1" onclick="showWeatherRain();"  /><?php echo _("Weather Rain"); ?></label></div></li>
101
				<li><div class="checkbox"><label><input type="checkbox" name="weatherclouds" value="1" onclick="showWeatherClouds();" /><?php echo _("Weather Clouds"); ?></label></div></li>
102
			</ul>
103
                </form>
104
                <br />
105
<?php
106
	}
107
?>
108
		<h1>Others Layers</h1>
109
<?php
110
	if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) {
111
?>
112
		<form>
113
			<ul>
114
				<li><div class="checkbox"><label><input type="checkbox" name="waypoints" value="1" onclick="showWaypoints();" /><?php echo _("Display waypoints"); ?></label></div></li>
115
				<li><div class="checkbox"><label><input type="checkbox" name="airspace" value="1" onclick="showAirspace();" /><?php echo _("Display airspace"); ?></label></div></li>
116
			</ul>
117
		</form>
118
<?php
119
	} else {
120
?>
121
		<form>
122
			<ul>
123
				<li><div class="checkbox"><label><input type="checkbox" name="waypoints" value="1" onclick="showWaypoints();" /><?php echo _("Display waypoints"); ?> Beta</label></div></li>
124
				<li><div class="checkbox"><label><input type="checkbox" name="airspace" value="1" onclick="showAirspace();" /><?php echo _("Display airspace"); ?> Beta</label></div></li>
125
			</ul>
126
			<p>This layers are in Beta, this can and will crash.</p>
127
		</form>
128
<?php
129
	}
130
	if (isset($globalNOTAM) && $globalNOTAM) {
131
?>
132
		<h1>NOTAM</h1>
133
		<form>
134
			<ul>
135
				<li><div class="checkbox"><label><input type="checkbox" name="notamcb" value="1" onclick="showNotam();" /><?php echo _("Display NOTAM"); ?></label></div></li>
136
				<li><?php echo _("NOTAM scope:"); ?>
137
					<select class="selectpicker" onchange="notamscope(this);">
138
						<option<?php if (!isset($_COOKIE['notamscope']) || $_COOKIE['notamscope'] == 'All') print ' selected'; ?>>All</option>
139
						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport/Enroute warning') print ' selected'; ?>>Airport/Enroute warning</option>
140
						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport warning') print ' selected'; ?>>Airport warning</option>
141
						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Navigation warning') print ' selected'; ?>>Navigation warning</option>
142
						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Enroute warning') print ' selected'; ?>>Enroute warning</option>
143
					</select
144
				</li>
145
			</ul>
146
<?php
147
		if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
148
?>
149
			<p class="help-block">When enabled, NOTAM will be displayed if you zoom enough on map</p>
150
<?php
151
		}
152
?>
153
		</form>
154
<?php
155
	}
156
?>
157
        </div>
158
<?php
159
    if (isset($globalArchive) && $globalArchive == TRUE) {
160
?>
161
        <div class="sidebar-pane" id="archive">
162
	    <h1 class="sidebar-header"><?php echo _("Playback"); ?> <i>Bêta</i><span class="sidebar-close"><i class="fa fa-caret-left"></i></span></h1>
163
	    <p>This feature is not finished yet.</p>
164
	    <form method="post">
165
		<ul>
166
		    <li>
167
		        <div class="form-group">
168
			    <label>From (UTC):</label>
169
		            <div class='input-group date' id='datetimepicker1'>
170
            			<input type='text' name="start_date" class="form-control" value="<?php if (isset($_POST['start_date'])) print $_POST['start_date']; elseif (isset($_COOKIE['archive_begin'])) print date("m/d/Y h:i a",$_COOKIE['archive_begin']); ?>" required />
171
		                <span class="input-group-addon">
172
            			    <span class="glyphicon glyphicon-calendar"></span>
173
		                </span>
174
		            </div>
175
		        </div>
176
		        <div class="form-group">
177
			    <label>To (UTC):</label>
178
		            <div class='input-group date' id='datetimepicker2'>
179
		                <input type='text' name="end_date" class="form-control" value="<?php if (isset($_POST['end_date'])) print $_POST['end_date']; elseif (isset($_COOKIE['archive_end'])) print date("m/d/Y h:i a",$_COOKIE['archive_end']); ?>" />
180
            			<span class="input-group-addon">
181
		                    <span class="glyphicon glyphicon-calendar"></span>
182
            			</span>
183
		            </div>
184
		        </div>
185
			<script type="text/javascript">
186
			    $(function () {
187
			        $('#datetimepicker1').datetimepicker(
188
			    	    //format: 'LT'
189
			    	);
190
			        $('#datetimepicker2').datetimepicker({
191
			    	    //format: 'LT',
192
			            useCurrent: false
193
			        });
194
			        $("#datetimepicker1").on("dp.change", function (e) {
195
			            $('#datetimepicker2').data("DateTimePicker").minDate(e.date);
196
			        });
197
			        $("#datetimepicker2").on("dp.change", function (e) {
198
			            $('#datetimepicker1').data("DateTimePicker").maxDate(e.date);
199
			        });
200
			    });
201
			</script>
202
203
		    <li><?php echo _("Playback speed:"); ?>
204
			<div class="range">
205
			    <input type="range" min="0" max="50" step="1" name="archivespeed" onChange="archivespeedrange.value=value;" value="<?php  if (isset($_POST['archivespeed'])) print $_POST['archivespeed']; elseif (isset($_COOKIE['archive_speed'])) print $_COOKIE['archive_speed']; else print '1'; ?>">
206
			    <output id="archivespeedrange"><?php  if (isset($_COOKIE['archive_speed'])) print $_COOKIE['archive_speed']; else print '1'; ?></output>
207
			</div>
208
		    </li>
209
		    <li><input type="submit" name="archive" value="Show archive" class="btn btn-primary" /></li>
210
		</ul>
211
	    </form>
212
	    <form>
213
		<ul>
214
		    <li><input type="submit" name="noarchive" class="btn btn-primary" value="Back from archive view" /></li>
215
		</ul>
216
	    </form>
217
	</div>
218
<?php
219
    }
220
?>
221
        <div class="sidebar-pane" id="settings">
222
	    <h1 class="sidebar-header"><?php echo _("Settings"); ?><span class="sidebar-close"><i class="fa fa-caret-left"></i></span></h1>
223
	    <form>
224
		<ul>
225
		    <li><?php echo _("Type of Map:"); ?>
226
			<select  class="selectpicker" onchange="mapType(this);">
227
			    <?php
228
				if (!isset($_COOKIE['MapType']) || $_COOKIE['MapType'] == '') $MapType = $globalMapProvider;
229
				else $MapType = $_COOKIE['MapType'];
230
			    ?>
231
			    <?php
232
				if (isset($globalBingMapKey) && $globalBingMapKey != '') {
233
			    ?>
234
			    <option value="Bing-Aerial"<?php if ($MapType == 'Bing-Aerial') print ' selected'; ?>>Bing-Aerial</option>
235
			    <option value="Bing-Hybrid"<?php if ($MapType == 'Bing-Hybrid') print ' selected'; ?>>Bing-Hybrid</option>
236
			    <option value="Bing-Road"<?php if ($MapType == 'Bing-Road') print ' selected'; ?>>Bing-Road</option>
237
			    <?php
238
				}
239
			    ?>
240
			    <?php
241
			        if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) {
242
			    ?>
243
			    <?php
244
				    if (isset($globalHereappId) && $globalHereappId != '' && isset($globalHereappCode) && $globalHereappCode != '') {
245
			    ?>
246
			    <option value="Here-Aerial"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Aerial</option>
247
			    <option value="Here-Hybrid"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Hybrid</option>
248
			    <option value="Here-Road"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Road</option>
249
			    <?php
250
				    }
251
			    ?>
252
			    <?php
253
				    if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '') {
254
			    ?>
255
			    <option value="Google-Roadmap"<?php if ($MapType == 'Google-Roadmap') print ' selected'; ?>>Google Roadmap</option>
256
			    <option value="Google-Satellite"<?php if ($MapType == 'Google-Satellite') print ' selected'; ?>>Google Satellite</option>
257
			    <option value="Google-Hybrid"<?php if ($MapType == 'Google-Hybrid') print ' selected'; ?>>Google Hybrid</option>
258
			    <option value="Google-Terrain"<?php if ($MapType == 'Google-Terrain') print ' selected'; ?>>Google Terrain</option>
259
			    <?php
260
				    }
261
			    ?>
262
			    <?php
263
				    if (isset($globalMapQuestKey) && $globalMapQuestKey != '') {
264
			    ?>
265
			    <option value="MapQuest-OSM"<?php if ($MapType == 'MapQuest-OSM') print ' selected'; ?>>MapQuest-OSM</option>
266
			    <option value="MapQuest-Aerial"<?php if ($MapType == 'MapQuest-Aerial') print ' selected'; ?>>MapQuest-Aerial</option>
267
			    <option value="MapQuest-Hybrid"<?php if ($MapType == 'MapQuest-Hybrid') print ' selected'; ?>>MapQuest-Hybrid</option>
268
			    <?php
269
				    }
270
			    ?>
271
			    <option value="Yandex"<?php if ($MapType == 'Yandex') print ' selected'; ?>>Yandex</option>
272
			    <?php
273
				}
274
			    ?>
275
			    <?php
276
				    if (isset($globalMapboxToken) && $globalMapboxToken != '') {
277
					if (!isset($_COOKIE['MapTypeId'])) $MapBoxId = 'default';
278
					else $MapBoxId = $_COOKIE['MapTypeId'];
279
			    ?>
280
			    <option value="Mapbox-default"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'default') print ' selected'; ?>>Mapbox default</option>
281
			    <option value="Mapbox-mapbox.streets"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets') print ' selected'; ?>>Mapbox streets</option>
282
			    <option value="Mapbox-mapbox.light"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.light') print ' selected'; ?>>Mapbox light</option>
283
			    <option value="Mapbox-mapbox.dark"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.dark') print ' selected'; ?>>Mapbox dark</option>
284
			    <option value="Mapbox-mapbox.satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.satellite') print ' selected'; ?>>Mapbox satellite</option>
285
			    <option value="Mapbox-mapbox.streets-satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-satellite') print ' selected'; ?>>Mapbox streets-satellite</option>
286
			    <option value="Mapbox-mapbox.streets-basic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-basic') print ' selected'; ?>>Mapbox streets-basic</option>
287
			    <option value="Mapbox-mapbox.comic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.comic') print ' selected'; ?>>Mapbox comic</option>
288
			    <option value="Mapbox-mapbox.outdoors"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.outdoors') print ' selected'; ?>>Mapbox outdoors</option>
289
			    <option value="Mapbox-mapbox.pencil"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pencil') print ' selected'; ?>>Mapbox pencil</option>
290
			    <option value="Mapbox-mapbox.pirates"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pirates') print ' selected'; ?>>Mapbox pirates</option>
291
			    <option value="Mapbox-mapbox.emerald"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.emerald') print ' selected'; ?>>Mapbox emerald</option>
292
			    <?php
293
				    }
294
			    ?>
295
			    <option value="OpenStreetMap"<?php if ($MapType == 'OpenStreetMap') print ' selected'; ?>>OpenStreetMap</option>
296
			</select>
297
		    </li>
298
<?php
299
    if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
300
?>
301
		    <li><?php echo _("Type of Terrain:"); ?>
302
			<select  class="selectpicker" onchange="terrainType(this);">
303
			    <option value="stk"<?php if (!isset($_COOKIE['MapTerrain']) || $_COOKIE['MapTerrain'] == 'stk') print ' selected'; ?>>stk terrain</option>
304
			    <option value="ellipsoid"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'ellipsoid') print ' selected';?>>ellipsoid</option>
305
			    <option value="vrterrain"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'vrterrain') print ' selected';?>>vr terrain</option>
306
			</select>
307
		    </li>
308
<?php
309
    }
310
?>
311
<?php
312
    if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') {
313
?>
314
		    
315
		    <li><div class="checkbox"><label><input type="checkbox" name="flightpopup" value="1" onclick="clickFlightPopup(this)" <?php if (isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true') print 'checked'; ?> ><?php echo _("Display flight info as popup"); ?></label></div></li>
316
		    <li><div class="checkbox"><label><input type="checkbox" name="flightpath" value="1" onclick="clickFlightPath(this)" <?php if ((isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true') || !isset($_COOKIE['flightpath'])) print 'checked'; ?> ><?php echo _("Display flight path"); ?></label></div></li>
317
		    <li><div class="checkbox"><label><input type="checkbox" name="flightroute" value="1" onclick="clickFlightRoute(this)" <?php if ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == 'true') || !isset($_COOKIE['MapRoute'])) print 'checked'; ?> ><?php echo _("Display flight route on click"); ?></label></div></li>
318
		    <li><div class="checkbox"><label><input type="checkbox" name="flightestimation" value="1" onclick="clickFlightEstimation(this)" <?php if ((isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'true') || (!isset($_COOKIE['flightestimation']) && !isset($globalMapEstimation)) || (!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation)) print 'checked'; ?> ><?php echo _("Planes animate between updates"); ?></label></div></li>
319
<?php
320
    }
321
?>
322
		    <li><div class="checkbox"><label><input type="checkbox" name="displayairports" value="1" onclick="clickDisplayAirports(this)" <?php if (isset($_COOKIE['displayairports']) && $_COOKIE['displayairports'] == 'true') print 'checked'; ?> ><?php echo _("Display airports on map"); ?></label></div></li>
323
<?php
324
    if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
325
?>
326
		    <li><div class="checkbox"><label><input type="checkbox" name="displayminimap" value="1" onclick="clickDisplayMinimap(this)" <?php if (!isset($_COOKIE['displayminimap']) || (isset($_COOKIE['displayminimap']) && $_COOKIE['displayminimap'] == 'true')) print 'checked'; ?> ><?php echo _("Show mini-map"); ?></label></div></li>
327
<?php
328
    }
329
?>
330
331
		    <?php
332
			if (function_exists('array_column')) {
333
			    if (array_search(TRUE, array_column($globalSources, 'sourcestats')) !== FALSE) {
334
		    ?>
335
		    <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) print 'checked'; ?> ><?php echo _("Display polar on map"); ?></label></div></li>
336
		    <?php
337
			    }
338
			} elseif (isset($globalSources)) {
339
			    $dispolar = false;
340
			    foreach ($globalSources as $testsource) {
341
			        if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) $dispolar = true;
342
			    }
343
			    if ($dispolar) {
344
		    ?>
345
		    <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) print 'checked'; ?> ><?php echo _("Display polar on map"); ?></label></div></li>
346
		    <?php
347
			    }
348
		        }
349
		    ?>
350
<?php
351
    if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') {
352
?>
353
354
		    <?php
355
		        if (extension_loaded('gd') && function_exists('gd_info')) {
356
		    ?>
357
		    <li><input type="checkbox" name="aircraftcoloraltitude" value="1" onclick="iconColorAltitude(this)" <?php if (isset($_COOKIE['IconColorAltitude']) && $_COOKIE['IconColorAltitude'] == 'true') print 'checked'; ?> ><?php echo _("Aircraft icon color based on altitude"); ?></li>
358
		    <?php 
359
			if (!isset($_COOKIE['IconColorAltitude']) || $_COOKIE['IconColorAltitude'] == 'false') {
360
		    ?>
361
		    <li><?php echo _("Aircraft icon color:"); ?>
362
			<input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(aircraftcolor.value);" value="#<?php if (isset($_COOKIE['IconColor'])) print $_COOKIE['IconColor']; elseif (isset($globalAircraftIconColor)) print $globalAircraftIconColor; else print '1a3151'; ?>">
363
		    </li>
364
		    <?php
365
			    }
366
		        }
367
		    ?>
368
		    <li><?php echo _("Show airport icon at zoom level:"); ?>
369
			<div class="range">
370
			    <input type="range" min="0" max="19" step="1" name="airportzoom" onchange="range.value=value;airportDisplayZoom(airportzoom.value);" value="<?php if (isset($_COOKIE['AirportZoom'])) print $_COOKIE['AirportZoom']; elseif (isset($globalAirportZoom)) print $globalAirportZoom; else print '7'; ?>">
371
			    <output id="range"><?php if (isset($_COOKIE['AirportZoom'])) print $_COOKIE['AirportZoom']; elseif (isset($globalAirportZoom)) print $globalAirportZoom; else print '7'; ?></output>
372
			</div>
373
		    </li>
374
<?php
375
    }
376
?>
377
		    <li><?php echo _("Distance unit:"); ?>
378
			<select class="selectpicker" onchange="unitdistance(this);">
379
			    <option value="km"<?php if ((!isset($_COOKIE['unitdistance']) && (!isset($globalUnitDistance) || (isset($globalUnitDistance) && $globalUnitDistance == 'km'))) || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'km')) echo ' selected'; ?>>km</option>
380
			    <option value="nm"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) echo ' selected'; ?>>nm</option>
381
			    <option value="mi"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) echo ' selected'; ?>>mi</option>
382
		        </select>
383
		    </li>
384
		    <li><?php echo _("Altitude unit:"); ?>
385
			<select class="selectpicker" onchange="unitaltitude(this);">
386
			    <option value="m"<?php if ((!isset($_COOKIE['unitaltitude']) && (!isset($globalUnitAltitude) || (isset($globalUnitAltitude) && $globalUnitAltitude == 'm'))) || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'm')) echo ' selected'; ?>>m</option>
387
			    <option value="feet"<?php if ((!isset($_COOKIE['unitaltitude']) && isset($globalUnitAltitude) && $globalUnitAltitude == 'feet') || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'feet')) echo ' selected'; ?>>feet</option>
388
		        </select>
389
		    </li>
390
		    <li><?php echo _("Speed unit:"); ?>
391
			<select class="selectpicker" onchange="unitspeed(this);">
392
			    <option value="kmh"<?php if ((!isset($_COOKIE['unitspeed']) && (!isset($globalUnitSpeed) || (isset($globalUnitSpeed) && $globalUnitSpeed == 'kmh'))) || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'kmh')) echo ' selected'; ?>>km/h</option>
393
			    <option value="mph"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'mph') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'mph')) echo ' selected'; ?>>mph</option>
394
			    <option value="knots"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'knots') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'knots')) echo ' selected'; ?>>knots</option>
395
		        </select>
396
		    </li>
397
398
		</ul>
399
	    </form>
400
	    <p><?php echo _("Any change in settings reload page"); ?></p>
401
	</div>
402
        <div class="sidebar-pane" id="filters">
403
	    <h1 class="sidebar-header"><?php echo _("Filters"); ?><span class="sidebar-close"><i class="fa fa-caret-left"></i></span></h1>
404
		<form>
405
		    <ul>
406
		    <?php
407
			if (((isset($globalVATSIM) && $globalVATSIM) || isset($globalIVAO) && $globalIVAO || isset($globalphpVMS) && $globalphpVMS) && (!isset($globalMapVAchoose) || $globalMapVAchoose)) {
408
		    ?>
409
			<?php if (isset($globalVATSIM) && $globalVATSIM) { ?><li><input type="checkbox" name="vatsim" value="1" onclick="clickVATSIM(this)" <?php if ((isset($_COOKIE['ShowVATSIM']) && $_COOKIE['ShowVATSIM'] == 'true') || !isset($_COOKIE['ShowVATSIM'])) print 'checked'; ?> ><?php echo _("Display VATSIM data"); ?></li><?php } ?>
410
			<?php if (isset($globalIVAO) && $globalIVAO) { ?><li><input type="checkbox" name="ivao" value="1" onclick="clickIVAO(this)" <?php if ((isset($_COOKIE['ShowIVAO']) && $_COOKIE['ShowIVAO'] == 'true') || !isset($_COOKIE['ShowIVAO'])) print 'checked'; ?> ><?php echo _("Display IVAO data"); ?></li><?php } ?>
411
			<?php if (isset($globalphpVMS) && $globalphpVMS) { ?><li><input type="checkbox" name="phpvms" value="1" onclick="clickphpVMS(this)" <?php if ((isset($_COOKIE['ShowVMS']) && $_COOKIE['ShowVMS'] == 'true') || !isset($_COOKIE['ShowVMS'])) print 'checked'; ?> ><?php echo _("Display phpVMS data"); ?></li><?php } ?>
412
		    <?php
413
			}
414
		    ?>
415
		    <?php
416
			if (!(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalphpVMS) && $globalphpVMS) && isset($globalSBS1) && $globalSBS1 && isset($globalAPRS) && $globalAPRS && (!isset($globalMapchoose) || $globalMapchoose)) {
417
		    ?>
418
			<?php if (isset($globalSBS1) && $globalSBS1) { ?>
419
			    <li><div class="checkbox"><label><input type="checkbox" name="sbs" value="1" onclick="clickSBS1(this)" <?php if ((isset($_COOKIE['ShowSBS1']) && $_COOKIE['ShowSBS1'] == 'true') || !isset($_COOKIE['ShowSBS1'])) print 'checked'; ?> ><?php echo _("Display ADS-B data"); ?></label></div></li>
420
			<?php } ?>
421
			<?php if (isset($globalAPRS) && $globalAPRS) { ?>
422
			    <li><div class="checkbox"><label><input type="checkbox" name="aprs" value="1" onclick="clickAPRS(this)" <?php if ((isset($_COOKIE['ShowAPRS']) && $_COOKIE['ShowAPRS'] == 'true') || !isset($_COOKIE['ShowAPRS'])) print 'checked'; ?> ><?php echo _("Display APRS data"); ?></label></div></li>
423
			<?php } ?>
424
		    <?php
425
			}
426
		    ?>
427
		    <li><?php echo _("Display airlines:"); ?>
428
		    <br/>
429
			<select class="selectpicker" multiple onchange="airlines(this);" id="display_airlines">
430
			    <?php
431
				$Stats = new Stats();
432
				$allairlinenames = $Stats->getAllAirlineNames()
433
				if (empty($allairlinenames)) {
0 ignored issues
show
This code did not parse for me. Apparently, there is an error somewhere around this line:

Syntax error, unexpected T_IF
Loading history...
434
					$Spotter = new Spotter();
435
					$allairlinenames = $Spotter->getAllAirlineNames();
436
				}
437
				foreach($allairlinenames as $airline) {
438
					$airline_name = $airline['airline_name'];
439
					if (strlen($airline_name) > 30) $airline_name = substr($airline_name,0,30).'...';
440
					if (isset($_COOKIE['Airlines']) && in_array($airline['airline_icao'],explode(',',$_COOKIE['Airlines']))) {
441
						echo '<option value="'.$airline['airline_icao'].'" selected>'.$airline_name.'</option>';
442
					} else {
443
						echo '<option value="'.$airline['airline_icao'].'">'.$airline_name.'</option>';
444
					}
445
				}
446
			    ?>
447
			</select>
448
		    </li>
449
		    <?php
450
			if (isset($globalAPRS) && $globalAPRS) {
451
		    ?>
452
		    <li><?php echo _("Display APRS sources name:"); ?>
453
			<select class="selectpicker" multiple onchange="sources(this);">
454
			    <?php
455
				$Spotter = new Spotter();
456
				foreach($Spotter->getAllSourceName('aprs') as $source) {
457
					if (isset($_COOKIE['Sources']) && in_array($source['source_name'],explode(',',$_COOKIE['Sources']))) {
458
						echo '<option value="'.$source['source_name'].'" selected>'.$source['source_name'].'</option>';
459
					} else {
460
						echo '<option value="'.$source['source_name'].'">'.$source['source_name'].'</option>';
461
					}
462
				}
463
			    ?>
464
			</select>
465
		    </li>
466
		    <?php
467
			}
468
		    ?>
469
		    <?php
470
			if (!(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalphpVMS) && $globalphpVMS)) {
471
		    ?>
472
		    <li><?php echo _("Display airlines of type:"); ?><br/>
473
			<select class="selectpicker" onchange="airlinestype(this);">
474
			    <option value="all"<?php if (!isset($_COOKIE['airlinestype']) || $_COOKIE['airlinestype'] == 'all' || $_COOKIE['airlinestype'] == '') echo ' selected'; ?>><?php echo _("All"); ?></option>
475
			    <option value="passenger"<?php if (isset($_COOKIE['airlinestype']) && $_COOKIE['airlinestype'] == 'passenger') echo ' selected'; ?>><?php echo _("Passenger"); ?></option>
476
			    <option value="cargo"<?php if (isset($_COOKIE['airlinestype']) && $_COOKIE['airlinestype'] == 'cargo') echo ' selected'; ?>><?php echo _("Cargo"); ?></option>
477
			    <option value="military"<?php if (isset($_COOKIE['airlinestype']) && $_COOKIE['airlinestype'] == 'military') echo ' selected'; ?>><?php echo _("Military"); ?></option>
478
			</select>
479
		    </li>
480
		    <?php
481
			}
482
		    ?>
483
		    <li>
484
			<?php echo _("Display flight with ident:"); ?>
485
			<input type="text" name="identfilter" onchange="identfilter();" id="identfilter" value="<?php if (isset($_COOKIE['identfilter'])) print $_COOKIE['identfilter']; ?>" />
486
		    </li>
487
		</ul>
488
	    </form>
489
	    <form method="post">
490
		<!-- <center><input type="submit" name="removefilters" value="<?php echo _("Remove all filters"); ?>" class="btn btn-primary" /></center> -->
491
		<center><button type="button" class="btn btn-primary" onclick="removefilters();"><?php echo _("Remove all filters"); ?></button></center>
492
	    </form>
493
    	</div>
494
<?php
495
    if (isset($globalMapSatellites) && $globalMapSatellites && isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
496
?>
497
        <div class="sidebar-pane" id="satellites">
498
	    <h1 class="sidebar-header"><?php echo _("Satellites"); ?><span class="sidebar-close"><i class="fa fa-caret-left"></i></span></h1>
499
	    <form>
500
		<ul>
501
		    <li><div class="checkbox"><label><input type="checkbox" name="displayiss" value="1" onclick="clickDisplayISS(this)" <?php if (isset($_COOKIE['displayiss']) && $_COOKIE['displayiss'] == 'true') print 'checked'; ?> ><?php echo _("Show ISS, Tiangong-1 and Tiangong-2 on map"); ?></label></div></li>
502
		    <li><?php echo _("Type:"); ?>
503
			<select class="selectpicker" multiple onchange="sattypes(this);">
504
			    <?php
505
				$Satellite = new Satellite();
506
				$types = $Satellite->get_tle_types();
507
				foreach ($types as $type) {
508
					$type_name = $type['tle_type'];
509
					if ($type_name == 'musson') $type_name = 'Russian LEO Navigation';
510
					else if ($type_name == 'nnss') $type_name = 'Navi Navigation Satellite System';
511
					else if ($type_name == 'sbas') $type_name = 'Satellite-Based Augmentation System';
512
					else if ($type_name == 'glo-ops') $type_name = 'Glonass Operational';
513
					else if ($type_name == 'gps-ops') $type_name = 'GPS Operational';
514
					else if ($type_name == 'argos') $type_name = 'ARGOS Data Collection System';
515
					else if ($type_name == 'tdrss') $type_name = 'Tracking and Data Relay Satellite System';
516
					else if ($type_name == 'sarsat') $type_name = 'Search & Rescue';
517
					else if ($type_name == 'dmc') $type_name = 'Disaster Monitoring';
518
					else if ($type_name == 'resource') $type_name = 'Earth Resources';
519
					else if ($type_name == 'stations') $type_name = 'Space Stations';
520
					else if ($type_name == 'geo') $type_name = 'Geostationary';
521
					else if ($type_name == 'amateur') $type_name = 'Amateur Radio';
522
					else if ($type_name == 'x-comm') $type_name = 'Experimental';
523
					else if ($type_name == 'other-comm') $type_name = 'Other Comm';
524
					else if ($type_name == 'science') $type_name = 'Space & Earth Science';
525
					else if ($type_name == 'military') $type_name = 'Miscellaneous Military';
526
					else if ($type_name == 'radar') $type_name = 'Radar Calibration';
527
					else if ($type_name == 'tle-new') $type_name = 'Last 30 days launches';
528
					
529
					if (isset($_COOKIE['sattypes']) && in_array($type['tle_type'],explode(',',$_COOKIE['sattypes']))) {
530
						print '<option value="'.$type['tle_type'].'" selected>'.$type_name.'</option>';
531
					} else {
532
						print '<option value="'.$type['tle_type'].'">'.$type_name.'</option>';
533
					}
534
				}
535
			    ?>
536
			</select>
537
		    </li>
538
		</ul>
539
	    </form>
540
	</div>
541
<?php
542
    }
543
?>
544
    </div>
545
</div>
546
<!--
547
<a class="button weatherradar" href="#" onclick="showWeatherRadar(); return false;" title="Weather Radar"><i class="fa fa-bullseye"></i></a>
548
<a class="button weathersatellite" href="#" onclick="showWeatherSatellite(); return false;" title="Weather Satellite"><i class="fa fa-globe"></i></a>
549
-->
550
<script>
551
    if (getCookie('flightpath') == 'true') $(".flightpath").addClass("active");
552
    if (getCookie('flightpopup') == 'true') $(".flightpopup").addClass("active");
553
    if (getCookie('maproute') == 'true') $(".flightroute").addClass("active");
554
    var sidebar = $('#sidebar').sidebar();
555
//    $(document).ready(function(){
556
//    	populate($("#display_airlines"),'airlinenames',getCookie('airline'));
557
//    });
558
    var typingTimer;
559
    var doneTypingInterval = 4000;
560
    $("#identfilter").on('input', function() {
561
	clearTimeout(typingTimer);
562
	if (this.value) {
563
	    typingTimer = setTimeout(identfilter,doneTypingInterval);
564
	}
565
    });
566
</script>
567
<?php
568
require_once('footer.php');
569
?>