Completed
Push — master ( d6b14e...e982bb )
by Yannick
54:14 queued 25:57
created
pilot-statistics-arrival-airport-country.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -7,18 +7,18 @@  discard block
 block discarded – undo
7 7
         die();
8 8
 }
9 9
 $Spotter = new Spotter();
10
-$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING);
11
-$pilot = filter_input(INPUT_GET,'pilot',FILTER_SANITIZE_STRING);
12
-$year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT);
13
-$month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT);
10
+$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING);
11
+$pilot = filter_input(INPUT_GET, 'pilot', FILTER_SANITIZE_STRING);
12
+$year = filter_input(INPUT_GET, 'year', FILTER_SANITIZE_NUMBER_INT);
13
+$month = filter_input(INPUT_GET, 'month', FILTER_SANITIZE_NUMBER_INT);
14 14
 $filter = array();
15
-if ($year != '') $filter = array_merge($filter,array('year' => $year));
16
-if ($month != '') $filter = array_merge($filter,array('month' => $month));
17
-$spotter_array = $Spotter->getSpotterDataByPilot($pilot,"0,1", $sort,$filter);
15
+if ($year != '') $filter = array_merge($filter, array('year' => $year));
16
+if ($month != '') $filter = array_merge($filter, array('month' => $month));
17
+$spotter_array = $Spotter->getSpotterDataByPilot($pilot, "0,1", $sort, $filter);
18 18
 
19 19
 if (!empty($spotter_array))
20 20
 {
21
-	$title = sprintf(_("Most Common Arrival Airports by Country of %s"),$spotter_array[0]['pilot_name']);
21
+	$title = sprintf(_("Most Common Arrival Airports by Country of %s"), $spotter_array[0]['pilot_name']);
22 22
 	require_once('header.php');
23 23
 	print '<div class="info column">';
24 24
 	print '<h1>'.$spotter_array[0]['pilot_name'].'</h1>';
@@ -29,15 +29,15 @@  discard block
 block discarded – undo
29 29
 	include('pilot-sub-menu.php');
30 30
 	print '<div class="column">';
31 31
 	print '<h2>'._("Most Common Arrival Airports by Country").'</h2>';
32
-	print '<p>'.sprintf(_("The statistic below shows all arrival airports by Country of origin of flights piloted by <strong>%s</strong>."),$spotter_array[0]['pilot_name']).'</p>';
33
-	$airport_country_array = $Spotter->countAllArrivalAirportCountriesByPilot($pilot,$filter);
32
+	print '<p>'.sprintf(_("The statistic below shows all arrival airports by Country of origin of flights piloted by <strong>%s</strong>."), $spotter_array[0]['pilot_name']).'</p>';
33
+	$airport_country_array = $Spotter->countAllArrivalAirportCountriesByPilot($pilot, $filter);
34 34
 	print '<script type="text/javascript" src="'.$globalURL.'/js/d3.min.js"></script>';
35 35
 	print '<script type="text/javascript" src="'.$globalURL.'/js/topojson.v2.min.js"></script>';
36 36
 	print '<script type="text/javascript" src="'.$globalURL.'/js/datamaps.world.min.js"></script>';
37 37
 	print '<div id="chartCountry" class="chart" width="100%"></div><script>';
38 38
 	print 'var series = [';
39 39
 	$country_data = '';
40
-	foreach($airport_country_array as $airport_item)
40
+	foreach ($airport_country_array as $airport_item)
41 41
 	{
42 42
 		$country_data .= '[ "'.$airport_item['arrival_airport_country_iso3'].'",'.$airport_item['airport_arrival_country_count'].'],';
43 43
 	}
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 		print '</thead>';
85 85
 		print '<tbody>';
86 86
 		$i = 1;
87
-		foreach($airport_country_array as $airport_item)
87
+		foreach ($airport_country_array as $airport_item)
88 88
 		{
89 89
 			print '<tr>';
90 90
 			print '<td><strong>'.$i.'</strong></td>';
Please login to merge, or discard this patch.
date-statistics-arrival-airport.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -3,13 +3,13 @@  discard block
 block discarded – undo
3 3
 require_once('require/class.Spotter.php');
4 4
 require_once('require/class.Language.php');
5 5
 $Spotter = new Spotter();
6
-$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING);
7
-$date = filter_input(INPUT_GET,'date',FILTER_SANITIZE_STRING);
8
-$spotter_array = $Spotter->getSpotterDataByDate($date,"0,1", $sort);
6
+$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING);
7
+$date = filter_input(INPUT_GET, 'date', FILTER_SANITIZE_STRING);
8
+$spotter_array = $Spotter->getSpotterDataByDate($date, "0,1", $sort);
9 9
 
10 10
 if (!empty($spotter_array))
11 11
 {
12
-	$title = sprintf(_("Most Common Arrival Airports on %s"),date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601'])));
12
+	$title = sprintf(_("Most Common Arrival Airports on %s"), date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601'])));
13 13
 
14 14
 	require_once('header.php');
15 15
 	print '<div class="select-item">';
@@ -27,13 +27,13 @@  discard block
 block discarded – undo
27 27
 	print '<script type="text/javascript">$(function () { $("#datepicker").datetimepicker({ format: "YYYY-MM-DD", defaultDate: "'.$date.'" }); }); </script>';
28 28
 	print '<br />';  
29 29
 	print '<div class="info column">';
30
-	print '<h1>'.sprintf(_("Flights from %s"),date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</h1>';
30
+	print '<h1>'.sprintf(_("Flights from %s"), date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</h1>';
31 31
 	print '</div>';
32 32
 
33 33
 	include('date-sub-menu.php');
34 34
 	print '<div class="column">';
35 35
 	print '<h2>'._("Most Common Arrival Airports").'</h2>';
36
-	print '<p>'.sprintf(_("The statistic below shows all arrival airports of flights on <strong>%s</strong>."),date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</p>';
36
+	print '<p>'.sprintf(_("The statistic below shows all arrival airports of flights on <strong>%s</strong>."), date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</p>';
37 37
 	$airport_airport_array = $Spotter->countAllArrivalAirportsByDate($date);
38 38
 	print '<script type="text/javascript" src="'.$globalURL.'/js/d3.min.js"></script>';
39 39
 	print '<script type="text/javascript" src="'.$globalURL.'/js/topojson.v2.min.js"></script>';
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 	print '<script>';
43 43
 	print 'var series = [';
44 44
 	$airport_data = '';
45
-	foreach($airport_airport_array as $airport_item)
45
+	foreach ($airport_airport_array as $airport_item)
46 46
 	{
47 47
 		$airport_data .= '[ "'.$airport_item['airport_arrival_icao_count'].'", "'.$airport_item['airport_arrival_icao'].'",'.$airport_item['airport_arrival_latitude'].','.$airport_item['airport_arrival_longitude'].'],';
48 48
 	}
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 	print '</thead>';
98 98
 	print '<tbody>';
99 99
 	$i = 1;
100
-	foreach($airport_airport_array as $airport_item)
100
+	foreach ($airport_airport_array as $airport_item)
101 101
 	{
102 102
 		print '<tr>';
103 103
 		print '<td><strong>'.$i.'</strong></td>';
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 	$title = _("Unknown Date");
123 123
 	require_once('header.php');
124 124
 	print '<h1>'._("Error").'</h1>';
125
-	print '<p>'._("Sorry, this date does not exist in this database. :(");'</p>';
125
+	print '<p>'._("Sorry, this date does not exist in this database. :("); '</p>';
126 126
 }
127 127
 
128 128
 require_once('footer.php');
Please login to merge, or discard this patch.
ident-statistics-arrival-airport-country.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -7,13 +7,13 @@  discard block
 block discarded – undo
7 7
         die();
8 8
 }
9 9
 $Spotter = new Spotter();
10
-$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING);
11
-$ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING);
12
-$spotter_array = $Spotter->getSpotterDataByIdent($ident,"0,1", $sort);
10
+$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING);
11
+$ident = filter_input(INPUT_GET, 'ident', FILTER_SANITIZE_STRING);
12
+$spotter_array = $Spotter->getSpotterDataByIdent($ident, "0,1", $sort);
13 13
 
14 14
 if (!empty($spotter_array))
15 15
 {
16
-	$title = sprintf(_("Most Common Arrival Airports by Country of %s"),$spotter_array[0]['ident']);
16
+	$title = sprintf(_("Most Common Arrival Airports by Country of %s"), $spotter_array[0]['ident']);
17 17
 	require_once('header.php');
18 18
 	print '<div class="info column">';
19 19
 	print '<h1>'.$spotter_array[0]['ident'].'</h1>';
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 	include('ident-sub-menu.php');
25 25
 	print '<div class="column">';
26 26
 	print '<h2>'._("Most Common Arrival Airports by Country").'</h2>';
27
-	print '<p>'.sprintf(_("The statistic below shows all arrival airports by Country of origin of flights with the ident/callsign <strong>%s</strong>."),$spotter_array[0]['ident']).'</p>';
27
+	print '<p>'.sprintf(_("The statistic below shows all arrival airports by Country of origin of flights with the ident/callsign <strong>%s</strong>."), $spotter_array[0]['ident']).'</p>';
28 28
 	$airport_country_array = $Spotter->countAllArrivalAirportCountriesByIdent($ident);
29 29
 	print '<script type="text/javascript" src="'.$globalURL.'/js/d3.min.js"></script>';
30 30
 	print '<script type="text/javascript" src="'.$globalURL.'/js/topojson.v2.min.js"></script>';
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 	print '<div id="chartCountry" class="chart" width="100%"></div><script>'; 
33 33
 	print 'var series = [';
34 34
 	$country_data = '';
35
-	foreach($airport_country_array as $airport_item)
35
+	foreach ($airport_country_array as $airport_item)
36 36
 	{
37 37
 		$country_data .= '[ "'.$airport_item['arrival_airport_country_iso3'].'",'.$airport_item['airport_arrival_country_count'].'],';
38 38
 	}
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 		print '</thead>';
81 81
 		print '<tbody>';
82 82
 		$i = 1;
83
-		foreach($airport_country_array as $airport_item)
83
+		foreach ($airport_country_array as $airport_item)
84 84
 		{
85 85
 			print '<tr>';
86 86
 			print '<td><strong>'.$i.'</strong></td>';
Please login to merge, or discard this patch.
owner-statistics-time.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -7,18 +7,18 @@  discard block
 block discarded – undo
7 7
         die();
8 8
 }
9 9
 $Spotter = new Spotter();
10
-$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING);
11
-$owner = filter_input(INPUT_GET,'owner',FILTER_SANITIZE_STRING);
12
-$year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT);
13
-$month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT);
10
+$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING);
11
+$owner = filter_input(INPUT_GET, 'owner', FILTER_SANITIZE_STRING);
12
+$year = filter_input(INPUT_GET, 'year', FILTER_SANITIZE_NUMBER_INT);
13
+$month = filter_input(INPUT_GET, 'month', FILTER_SANITIZE_NUMBER_INT);
14 14
 $filter = array();
15
-if ($year != '') $filter = array_merge($filter,array('year' => $year));
16
-if ($month != '') $filter = array_merge($filter,array('month' => $month));
17
-$spotter_array = $Spotter->getSpotterDataByOwner($owner,"0,1", $sort,$filter);
15
+if ($year != '') $filter = array_merge($filter, array('year' => $year));
16
+if ($month != '') $filter = array_merge($filter, array('month' => $month));
17
+$spotter_array = $Spotter->getSpotterDataByOwner($owner, "0,1", $sort, $filter);
18 18
 
19 19
 if (!empty($spotter_array))
20 20
 {
21
-	$title = sprintf(_("Most Common Time of Day of %s"),$spotter_array[0]['aircraft_owner']);
21
+	$title = sprintf(_("Most Common Time of Day of %s"), $spotter_array[0]['aircraft_owner']);
22 22
 	require_once('header.php');
23 23
 	print '<div class="info column">';
24 24
 	print '<h1>'.$spotter_array[0]['aircraft_owner'].'</h1>';
@@ -29,9 +29,9 @@  discard block
 block discarded – undo
29 29
 	include('owner-sub-menu.php');
30 30
 	print '<div class="column">';
31 31
 	print '<h2>'._("Most Common Time of Day").'</h2>';
32
-	print '<p>'.sprintf(_("The statistic below shows the most common time of day of flights owned by <strong>%s</strong>."),$spotter_array[0]['aircraft_owner']).'</p>';
32
+	print '<p>'.sprintf(_("The statistic below shows the most common time of day of flights owned by <strong>%s</strong>."), $spotter_array[0]['aircraft_owner']).'</p>';
33 33
 
34
-	$hour_array = $Spotter->countAllHoursByOwner($owner,$filter);
34
+	$hour_array = $Spotter->countAllHoursByOwner($owner, $filter);
35 35
 	print '<link href="'.$globalURL.'/css/c3.min.css" rel="stylesheet" type="text/css">';
36 36
 	print '<script type="text/javascript" src="'.$globalURL.'/js/d3.min.js"></script>';
37 37
 	print '<script type="text/javascript" src="'.$globalURL.'/js/c3.min.js"></script>';
@@ -39,9 +39,9 @@  discard block
 block discarded – undo
39 39
 	$hour_data = '';
40 40
 	$hour_cnt = '';
41 41
 	$last = 0;
42
-	foreach($hour_array as $hour_item)
42
+	foreach ($hour_array as $hour_item)
43 43
 	{
44
-		while($last != $hour_item['hour_name']) {
44
+		while ($last != $hour_item['hour_name']) {
45 45
 			$hour_data .= '"'.$last.':00",';
46 46
 			$hour_cnt .= '0,';
47 47
 			$last++;
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 		$hour_cnt .= $hour_item['hour_count'].',';
52 52
 	}
53 53
 	$hour_data = "['x',".substr($hour_data, 0, -1)."]";
54
-	$hour_cnt = "['flights',".substr($hour_cnt,0,-1)."]";
54
+	$hour_cnt = "['flights',".substr($hour_cnt, 0, -1)."]";
55 55
 	print 'c3.generate({
56 56
 	    bindto: "#chartHour",
57 57
 	    data: {
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 		print '</thead>';
77 77
 		print '<tbody>';
78 78
 		$i = 1;
79
-		foreach($hour_array as $hour_item)
79
+		foreach ($hour_array as $hour_item)
80 80
 		{
81 81
 			print '<tr>';
82 82
 			print '<td>'.$hour_item['hour_name'].':00</td>';
Please login to merge, or discard this patch.
owner-statistics-arrival-airport-country.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -7,18 +7,18 @@  discard block
 block discarded – undo
7 7
         die();
8 8
 }
9 9
 $Spotter = new Spotter();
10
-$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING);
11
-$owner = filter_input(INPUT_GET,'owner',FILTER_SANITIZE_STRING);
12
-$year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT);
13
-$month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT);
10
+$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING);
11
+$owner = filter_input(INPUT_GET, 'owner', FILTER_SANITIZE_STRING);
12
+$year = filter_input(INPUT_GET, 'year', FILTER_SANITIZE_NUMBER_INT);
13
+$month = filter_input(INPUT_GET, 'month', FILTER_SANITIZE_NUMBER_INT);
14 14
 $filter = array();
15
-if ($year != '') $filter = array_merge($filter,array('year' => $year));
16
-if ($month != '') $filter = array_merge($filter,array('month' => $month));
17
-$spotter_array = $Spotter->getSpotterDataByOwner($owner,"0,1", $sort, $filter);
15
+if ($year != '') $filter = array_merge($filter, array('year' => $year));
16
+if ($month != '') $filter = array_merge($filter, array('month' => $month));
17
+$spotter_array = $Spotter->getSpotterDataByOwner($owner, "0,1", $sort, $filter);
18 18
 
19 19
 if (!empty($spotter_array))
20 20
 {
21
-	$title = sprintf(_("Most Common Arrival Airports by Country of %s"),$spotter_array[0]['aircraft_owner']);
21
+	$title = sprintf(_("Most Common Arrival Airports by Country of %s"), $spotter_array[0]['aircraft_owner']);
22 22
 	require_once('header.php');
23 23
 	print '<div class="info column">';
24 24
 	print '<h1>'.$spotter_array[0]['aircraft_owner'].'</h1>';
@@ -29,15 +29,15 @@  discard block
 block discarded – undo
29 29
 	include('owner-sub-menu.php');
30 30
 	print '<div class="column">';
31 31
 	print '<h2>'._("Most Common Arrival Airports by Country").'</h2>';
32
-	print '<p>'.sprintf(_("The statistic below shows all arrival airports by Country of origin of flights owned by <strong>%s</strong>."),$spotter_array[0]['aircraft_owner']).'</p>';
33
-	$airport_country_array = $Spotter->countAllArrivalAirportCountriesByOwner($owner,$filter);
32
+	print '<p>'.sprintf(_("The statistic below shows all arrival airports by Country of origin of flights owned by <strong>%s</strong>."), $spotter_array[0]['aircraft_owner']).'</p>';
33
+	$airport_country_array = $Spotter->countAllArrivalAirportCountriesByOwner($owner, $filter);
34 34
 	print '<script type="text/javascript" src="'.$globalURL.'/js/d3.min.js"></script>';
35 35
 	print '<script type="text/javascript" src="'.$globalURL.'/js/topojson.v2.min.js"></script>';
36 36
 	print '<script type="text/javascript" src="'.$globalURL.'/js/datamaps.world.min.js"></script>';
37 37
 	print '<div id="chartCountry" class="chart" width="100%"></div><script>';
38 38
 	print 'var series = [';
39 39
 	$country_data = '';
40
-	foreach($airport_country_array as $airport_item)
40
+	foreach ($airport_country_array as $airport_item)
41 41
 	{
42 42
 		$country_data .= '[ "'.$airport_item['airport_arrival_country_iso3'].'",'.$airport_item['airport_arrival_country_count'].'],';
43 43
 	}
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 		print '</thead>';
85 85
 		print '<tbody>';
86 86
 		$i = 1;
87
-		foreach($airport_country_array as $airport_item)
87
+		foreach ($airport_country_array as $airport_item)
88 88
 		{
89 89
 			print '<tr>';
90 90
 			print '<td><strong>'.$i.'</strong></td>';
Please login to merge, or discard this patch.
install/index.php 1 patch
Spacing   +243 added lines, -243 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
 require_once(dirname(__FILE__).'/class.create_db.php');
11 11
 require_once(dirname(__FILE__).'/class.update_schema.php');
12 12
 require_once(dirname(__FILE__).'/class.settings.php');
13
-$title="Install";
13
+$title = "Install";
14 14
 require(dirname(__FILE__).'/../require/settings.php');
15 15
 require(dirname(__FILE__).'/header.php');
16 16
 
@@ -69,8 +69,8 @@  discard block
 block discarded – undo
69 69
 if (!extension_loaded('curl')) {
70 70
 	$error[] = "Curl is not loaded.";
71 71
 }
72
-if(function_exists('apache_get_modules') ){
73
-	if(!in_array('mod_rewrite',apache_get_modules())) {
72
+if (function_exists('apache_get_modules')) {
73
+	if (!in_array('mod_rewrite', apache_get_modules())) {
74 74
 		$error[] = "mod_rewrite is not available.";
75 75
 	}
76 76
 /*
@@ -86,8 +86,8 @@  discard block
 block discarded – undo
86 86
 print '<div class="info column"><p><strong>If you use MySQL or MariaDB, check that <i>max_allowed_packet</i> >= 8M, else import of some table can fail.</strong></p></div>';
87 87
 if (isset($_SERVER['REQUEST_SCHEME']) && isset($_SERVER['SERVER_NAME']) && isset($_SERVER['SERVER_PORT']) && isset($_SERVER['REQUEST_URI'])) {
88 88
 	if (function_exists('get_headers')) {
89
-		$check_header = @get_headers($_SERVER['REQUEST_SCHEME'].'://'.$_SERVER["SERVER_NAME"].':'.$_SERVER["SERVER_PORT"].str_replace('install/','search',str_replace('index.php',$_SERVER["REQUEST_URI"])));
90
-		if (isset($check_header[0]) && !stripos($check_header[0],"200 OK")) {
89
+		$check_header = @get_headers($_SERVER['REQUEST_SCHEME'].'://'.$_SERVER["SERVER_NAME"].':'.$_SERVER["SERVER_PORT"].str_replace('install/', 'search', str_replace('index.php', $_SERVER["REQUEST_URI"])));
90
+		if (isset($check_header[0]) && !stripos($check_header[0], "200 OK")) {
91 91
 			print '<div class="info column"><p><strong>Check your configuration, rewrite don\'t seems to work.</strong></p></div>';
92 92
 		}
93 93
 	}
@@ -452,13 +452,13 @@  discard block
 block discarded – undo
452 452
 ?>
453 453
 							<tr>
454 454
 								<?php
455
-								    if (filter_var($source['host'],FILTER_VALIDATE_URL)) {
455
+								    if (filter_var($source['host'], FILTER_VALIDATE_URL)) {
456 456
 								?>
457 457
 								<td><input type="text" name="host[]" id="host" value="<?php print $source['host']; ?>" /></td>
458 458
 								<td><input type="text" name="port[]" class="col-xs-2" id="port" value="<?php if (isset($source['port'])) print $source['port']; ?>" /></td>
459 459
 								<?php
460 460
 								    } else {
461
-									$hostport = explode(':',$source['host']);
461
+									$hostport = explode(':', $source['host']);
462 462
 									if (isset($hostport[1])) {
463 463
 										$host = $hostport[0];
464 464
 										$port = $hostport[1];
@@ -504,7 +504,7 @@  discard block
 block discarded – undo
504 504
 									<select name="timezones[]" id="timezones">
505 505
 								<?php
506 506
 									$timezonelist = DateTimeZone::listIdentifiers(DateTimeZone::ALL);
507
-									foreach($timezonelist as $timezones){
507
+									foreach ($timezonelist as $timezones) {
508 508
 										if (isset($source['timezone']) && $source['timezone'] == $timezones) {
509 509
 											print '<option selected>'.$timezones.'</option>';
510 510
 										} elseif (!isset($source['timezone']) && $timezones == 'UTC') {
@@ -555,7 +555,7 @@  discard block
 block discarded – undo
555 555
 									<select name="timezones[]" id="timezones">
556 556
 								<?php
557 557
 									$timezonelist = DateTimeZone::listIdentifiers(DateTimeZone::ALL);
558
-									foreach($timezonelist as $timezones){
558
+									foreach ($timezonelist as $timezones) {
559 559
 										if ($timezones == 'UTC') {
560 560
 											print '<option selected>'.$timezones.'</option>';
561 561
 										} else print '<option>'.$timezones.'</option>';
@@ -870,7 +870,7 @@  discard block
 block discarded – undo
870 870
 			<br />
871 871
 			<p>
872 872
 				<label for="aircraftsize">Size of aircraft icon on map (default to 30px if zoom > 7 else 15px), empty to default</label>
873
-				<input type="number" name="aircraftsize" id="aircraftsize" value="<?php if (isset($globalAircraftSize)) echo $globalAircraftSize;?>" />
873
+				<input type="number" name="aircraftsize" id="aircraftsize" value="<?php if (isset($globalAircraftSize)) echo $globalAircraftSize; ?>" />
874 874
 			</p>
875 875
 			<br />
876 876
 			<p>
@@ -926,14 +926,14 @@  discard block
 block discarded – undo
926 926
 $error = '';
927 927
 
928 928
 if (isset($_POST['dbtype'])) {
929
-	$dbtype = filter_input(INPUT_POST,'dbtype',FILTER_SANITIZE_STRING);
930
-	$dbroot = filter_input(INPUT_POST,'dbroot',FILTER_SANITIZE_STRING);
931
-	$dbrootpass = filter_input(INPUT_POST,'dbrootpass',FILTER_SANITIZE_STRING);
932
-	$dbname = filter_input(INPUT_POST,'dbname',FILTER_SANITIZE_STRING);
933
-	$dbuser = filter_input(INPUT_POST,'dbuser',FILTER_SANITIZE_STRING);
934
-	$dbuserpass = filter_input(INPUT_POST,'dbuserpass',FILTER_SANITIZE_STRING);
935
-	$dbhost = filter_input(INPUT_POST,'dbhost',FILTER_SANITIZE_STRING);
936
-	$dbport = filter_input(INPUT_POST,'dbport',FILTER_SANITIZE_STRING);
929
+	$dbtype = filter_input(INPUT_POST, 'dbtype', FILTER_SANITIZE_STRING);
930
+	$dbroot = filter_input(INPUT_POST, 'dbroot', FILTER_SANITIZE_STRING);
931
+	$dbrootpass = filter_input(INPUT_POST, 'dbrootpass', FILTER_SANITIZE_STRING);
932
+	$dbname = filter_input(INPUT_POST, 'dbname', FILTER_SANITIZE_STRING);
933
+	$dbuser = filter_input(INPUT_POST, 'dbuser', FILTER_SANITIZE_STRING);
934
+	$dbuserpass = filter_input(INPUT_POST, 'dbuserpass', FILTER_SANITIZE_STRING);
935
+	$dbhost = filter_input(INPUT_POST, 'dbhost', FILTER_SANITIZE_STRING);
936
+	$dbport = filter_input(INPUT_POST, 'dbport', FILTER_SANITIZE_STRING);
937 937
 
938 938
 	if ($dbtype == 'mysql' && !extension_loaded('pdo_mysql')) $error .= 'Mysql driver for PDO must be loaded';
939 939
 	if ($dbtype == 'pgsql' && !extension_loaded('pdo_pgsql')) $error .= 'PosgreSQL driver for PDO must be loaded';
@@ -953,49 +953,49 @@  discard block
 block discarded – undo
953 953
 	} else $settings = array_merge($settings,array('globalDBdriver' => $dbtype,'globalDBhost' => $dbhost,'globalDBuser' => $dbuser,'globalDBport' => $dbport,'globalDBpass' => $dbuserpass,'globalDBname' => $dbname));
954 954
 	*/
955 955
 	
956
-	$settings = array_merge($settings,array('globalDBdriver' => $dbtype,'globalDBhost' => $dbhost,'globalDBuser' => $dbuser,'globalDBport' => $dbport,'globalDBpass' => $dbuserpass,'globalDBname' => $dbname));
956
+	$settings = array_merge($settings, array('globalDBdriver' => $dbtype, 'globalDBhost' => $dbhost, 'globalDBuser' => $dbuser, 'globalDBport' => $dbport, 'globalDBpass' => $dbuserpass, 'globalDBname' => $dbname));
957 957
 
958
-	$sitename = filter_input(INPUT_POST,'sitename',FILTER_SANITIZE_STRING);
959
-	$siteurl = filter_input(INPUT_POST,'siteurl',FILTER_SANITIZE_STRING);
960
-	$timezone = filter_input(INPUT_POST,'timezone',FILTER_SANITIZE_STRING);
961
-	$language = filter_input(INPUT_POST,'language',FILTER_SANITIZE_STRING);
962
-	$settings = array_merge($settings,array('globalName' => $sitename,'globalURL' => $siteurl, 'globalTimezone' => $timezone,'globalLanguage' => $language));
958
+	$sitename = filter_input(INPUT_POST, 'sitename', FILTER_SANITIZE_STRING);
959
+	$siteurl = filter_input(INPUT_POST, 'siteurl', FILTER_SANITIZE_STRING);
960
+	$timezone = filter_input(INPUT_POST, 'timezone', FILTER_SANITIZE_STRING);
961
+	$language = filter_input(INPUT_POST, 'language', FILTER_SANITIZE_STRING);
962
+	$settings = array_merge($settings, array('globalName' => $sitename, 'globalURL' => $siteurl, 'globalTimezone' => $timezone, 'globalLanguage' => $language));
963 963
 
964
-	$mapprovider = filter_input(INPUT_POST,'mapprovider',FILTER_SANITIZE_STRING);
965
-	$mapboxid = filter_input(INPUT_POST,'mapboxid',FILTER_SANITIZE_STRING);
966
-	$mapboxtoken = filter_input(INPUT_POST,'mapboxtoken',FILTER_SANITIZE_STRING);
967
-	$googlekey = filter_input(INPUT_POST,'googlekey',FILTER_SANITIZE_STRING);
968
-	$bingkey = filter_input(INPUT_POST,'bingkey',FILTER_SANITIZE_STRING);
969
-	$openweathermapkey = filter_input(INPUT_POST,'openweathermapkey',FILTER_SANITIZE_STRING);
970
-	$mapquestkey = filter_input(INPUT_POST,'mapquestkey',FILTER_SANITIZE_STRING);
971
-	$hereappid = filter_input(INPUT_POST,'hereappid',FILTER_SANITIZE_STRING);
972
-	$hereappcode = filter_input(INPUT_POST,'hereappcode',FILTER_SANITIZE_STRING);
973
-	$settings = array_merge($settings,array('globalMapProvider' => $mapprovider,'globalMapboxId' => $mapboxid,'globalMapboxToken' => $mapboxtoken,'globalGoogleAPIKey' => $googlekey,'globalBingMapKey' => $bingkey,'globalHereappID' => $hereappid,'globalHereappCode' => $hereappcode,'globalMapQuestKey' => $mapquestkey,'globalOpenWeatherMapKey' => $openweathermapkey));
964
+	$mapprovider = filter_input(INPUT_POST, 'mapprovider', FILTER_SANITIZE_STRING);
965
+	$mapboxid = filter_input(INPUT_POST, 'mapboxid', FILTER_SANITIZE_STRING);
966
+	$mapboxtoken = filter_input(INPUT_POST, 'mapboxtoken', FILTER_SANITIZE_STRING);
967
+	$googlekey = filter_input(INPUT_POST, 'googlekey', FILTER_SANITIZE_STRING);
968
+	$bingkey = filter_input(INPUT_POST, 'bingkey', FILTER_SANITIZE_STRING);
969
+	$openweathermapkey = filter_input(INPUT_POST, 'openweathermapkey', FILTER_SANITIZE_STRING);
970
+	$mapquestkey = filter_input(INPUT_POST, 'mapquestkey', FILTER_SANITIZE_STRING);
971
+	$hereappid = filter_input(INPUT_POST, 'hereappid', FILTER_SANITIZE_STRING);
972
+	$hereappcode = filter_input(INPUT_POST, 'hereappcode', FILTER_SANITIZE_STRING);
973
+	$settings = array_merge($settings, array('globalMapProvider' => $mapprovider, 'globalMapboxId' => $mapboxid, 'globalMapboxToken' => $mapboxtoken, 'globalGoogleAPIKey' => $googlekey, 'globalBingMapKey' => $bingkey, 'globalHereappID' => $hereappid, 'globalHereappCode' => $hereappcode, 'globalMapQuestKey' => $mapquestkey, 'globalOpenWeatherMapKey' => $openweathermapkey));
974 974
 	
975
-	$latitudemax = filter_input(INPUT_POST,'latitudemax',FILTER_SANITIZE_STRING);
976
-	$latitudemin = filter_input(INPUT_POST,'latitudemin',FILTER_SANITIZE_STRING);
977
-	$longitudemax = filter_input(INPUT_POST,'longitudemax',FILTER_SANITIZE_STRING);
978
-	$longitudemin = filter_input(INPUT_POST,'longitudemin',FILTER_SANITIZE_STRING);
979
-	$livezoom = filter_input(INPUT_POST,'livezoom',FILTER_SANITIZE_NUMBER_INT);
980
-	$settings = array_merge($settings,array('globalLatitudeMax' => $latitudemax,'globalLatitudeMin' => $latitudemin,'globalLongitudeMax' => $longitudemax,'globalLongitudeMin' => $longitudemin,'globalLiveZoom' => $livezoom));
975
+	$latitudemax = filter_input(INPUT_POST, 'latitudemax', FILTER_SANITIZE_STRING);
976
+	$latitudemin = filter_input(INPUT_POST, 'latitudemin', FILTER_SANITIZE_STRING);
977
+	$longitudemax = filter_input(INPUT_POST, 'longitudemax', FILTER_SANITIZE_STRING);
978
+	$longitudemin = filter_input(INPUT_POST, 'longitudemin', FILTER_SANITIZE_STRING);
979
+	$livezoom = filter_input(INPUT_POST, 'livezoom', FILTER_SANITIZE_NUMBER_INT);
980
+	$settings = array_merge($settings, array('globalLatitudeMax' => $latitudemax, 'globalLatitudeMin' => $latitudemin, 'globalLongitudeMax' => $longitudemax, 'globalLongitudeMin' => $longitudemin, 'globalLiveZoom' => $livezoom));
981 981
 
982
-	$squawk_country = filter_input(INPUT_POST,'squawk_country',FILTER_SANITIZE_STRING);
983
-	$settings = array_merge($settings,array('globalSquawkCountry' => $squawk_country));
982
+	$squawk_country = filter_input(INPUT_POST, 'squawk_country', FILTER_SANITIZE_STRING);
983
+	$settings = array_merge($settings, array('globalSquawkCountry' => $squawk_country));
984 984
 
985
-	$latitudecenter = filter_input(INPUT_POST,'latitudecenter',FILTER_SANITIZE_STRING);
986
-	$longitudecenter = filter_input(INPUT_POST,'longitudecenter',FILTER_SANITIZE_STRING);
987
-	$settings = array_merge($settings,array('globalCenterLatitude' => $latitudecenter,'globalCenterLongitude' => $longitudecenter));
985
+	$latitudecenter = filter_input(INPUT_POST, 'latitudecenter', FILTER_SANITIZE_STRING);
986
+	$longitudecenter = filter_input(INPUT_POST, 'longitudecenter', FILTER_SANITIZE_STRING);
987
+	$settings = array_merge($settings, array('globalCenterLatitude' => $latitudecenter, 'globalCenterLongitude' => $longitudecenter));
988 988
 
989
-	$acars = filter_input(INPUT_POST,'acars',FILTER_SANITIZE_STRING);
989
+	$acars = filter_input(INPUT_POST, 'acars', FILTER_SANITIZE_STRING);
990 990
 	if ($acars == 'acars') {
991
-		$settings = array_merge($settings,array('globalACARS' => 'TRUE'));
991
+		$settings = array_merge($settings, array('globalACARS' => 'TRUE'));
992 992
 	} else {
993
-		$settings = array_merge($settings,array('globalACARS' => 'FALSE'));
993
+		$settings = array_merge($settings, array('globalACARS' => 'FALSE'));
994 994
 	}
995 995
 
996
-	$flightawareusername = filter_input(INPUT_POST,'flightawareusername',FILTER_SANITIZE_STRING);
997
-	$flightawarepassword = filter_input(INPUT_POST,'flightawarepassword',FILTER_SANITIZE_STRING);
998
-	$settings = array_merge($settings,array('globalFlightAwareUsername' => $flightawareusername,'globalFlightAwarePassword' => $flightawarepassword));
996
+	$flightawareusername = filter_input(INPUT_POST, 'flightawareusername', FILTER_SANITIZE_STRING);
997
+	$flightawarepassword = filter_input(INPUT_POST, 'flightawarepassword', FILTER_SANITIZE_STRING);
998
+	$settings = array_merge($settings, array('globalFlightAwareUsername' => $flightawareusername, 'globalFlightAwarePassword' => $flightawarepassword));
999 999
 	
1000 1000
 	$source_name = $_POST['source_name'];
1001 1001
 	$source_latitude = $_POST['source_latitude'];
@@ -1009,8 +1009,8 @@  discard block
 block discarded – undo
1009 1009
 	
1010 1010
 	$sources = array();
1011 1011
 	foreach ($source_name as $keys => $name) {
1012
-	    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]);
1013
-	    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]);
1012
+	    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]);
1013
+	    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]);
1014 1014
 	}
1015 1015
 	if (count($sources) > 0) $_SESSION['sources'] = $sources;
1016 1016
 
@@ -1023,24 +1023,24 @@  discard block
 block discarded – undo
1023 1023
 	$sbsurl = $_POST['sbsurl'];
1024 1024
 	*/
1025 1025
 
1026
-	$globalvatsim = filter_input(INPUT_POST,'globalvatsim',FILTER_SANITIZE_STRING);
1027
-	$globalva = filter_input(INPUT_POST,'globalva',FILTER_SANITIZE_STRING);
1028
-	$globalivao = filter_input(INPUT_POST,'globalivao',FILTER_SANITIZE_STRING);
1029
-	$globalphpvms = filter_input(INPUT_POST,'globalphpvms',FILTER_SANITIZE_STRING);
1030
-	$globalvam = filter_input(INPUT_POST,'globalvam',FILTER_SANITIZE_STRING);
1031
-	$globalsbs = filter_input(INPUT_POST,'globalsbs',FILTER_SANITIZE_STRING);
1032
-	$globalaprs = filter_input(INPUT_POST,'globalaprs',FILTER_SANITIZE_STRING);
1033
-	$datasource = filter_input(INPUT_POST,'datasource',FILTER_SANITIZE_STRING);
1026
+	$globalvatsim = filter_input(INPUT_POST, 'globalvatsim', FILTER_SANITIZE_STRING);
1027
+	$globalva = filter_input(INPUT_POST, 'globalva', FILTER_SANITIZE_STRING);
1028
+	$globalivao = filter_input(INPUT_POST, 'globalivao', FILTER_SANITIZE_STRING);
1029
+	$globalphpvms = filter_input(INPUT_POST, 'globalphpvms', FILTER_SANITIZE_STRING);
1030
+	$globalvam = filter_input(INPUT_POST, 'globalvam', FILTER_SANITIZE_STRING);
1031
+	$globalsbs = filter_input(INPUT_POST, 'globalsbs', FILTER_SANITIZE_STRING);
1032
+	$globalaprs = filter_input(INPUT_POST, 'globalaprs', FILTER_SANITIZE_STRING);
1033
+	$datasource = filter_input(INPUT_POST, 'datasource', FILTER_SANITIZE_STRING);
1034 1034
 
1035
-	$globalaircraft = filter_input(INPUT_POST,'globalaircraft',FILTER_SANITIZE_STRING);
1036
-	if ($globalaircraft == 'aircraft') $settings = array_merge($settings,array('globalAircraft' => 'TRUE'));
1037
-	else $settings = array_merge($settings,array('globalAircraft' => 'FALSE'));
1038
-	$globaltracker = filter_input(INPUT_POST,'globaltracker',FILTER_SANITIZE_STRING);
1039
-	if ($globaltracker == 'tracker') $settings = array_merge($settings,array('globalTracker' => 'TRUE'));
1040
-	else $settings = array_merge($settings,array('globalTracker' => 'FALSE'));
1041
-	$globalmarine = filter_input(INPUT_POST,'globalmarine',FILTER_SANITIZE_STRING);
1042
-	if ($globalmarine == 'marine') $settings = array_merge($settings,array('globalMarine' => 'TRUE'));
1043
-	else $settings = array_merge($settings,array('globalMarine' => 'FALSE'));
1035
+	$globalaircraft = filter_input(INPUT_POST, 'globalaircraft', FILTER_SANITIZE_STRING);
1036
+	if ($globalaircraft == 'aircraft') $settings = array_merge($settings, array('globalAircraft' => 'TRUE'));
1037
+	else $settings = array_merge($settings, array('globalAircraft' => 'FALSE'));
1038
+	$globaltracker = filter_input(INPUT_POST, 'globaltracker', FILTER_SANITIZE_STRING);
1039
+	if ($globaltracker == 'tracker') $settings = array_merge($settings, array('globalTracker' => 'TRUE'));
1040
+	else $settings = array_merge($settings, array('globalTracker' => 'FALSE'));
1041
+	$globalmarine = filter_input(INPUT_POST, 'globalmarine', FILTER_SANITIZE_STRING);
1042
+	if ($globalmarine == 'marine') $settings = array_merge($settings, array('globalMarine' => 'TRUE'));
1043
+	else $settings = array_merge($settings, array('globalMarine' => 'FALSE'));
1044 1044
 
1045 1045
 /*	
1046 1046
 	$globalSBS1Hosts = array();
@@ -1056,7 +1056,7 @@  discard block
 block discarded – undo
1056 1056
 	}
1057 1057
 	$settings = array_merge($settings,array('globalSBS1Hosts' => $globalSBS1Hosts));
1058 1058
 */
1059
-	$settings_comment = array_merge($settings_comment,array('globalSBS1Hosts'));
1059
+	$settings_comment = array_merge($settings_comment, array('globalSBS1Hosts'));
1060 1060
 	$host = $_POST['host'];
1061 1061
 	$port = $_POST['port'];
1062 1062
 	$name = $_POST['name'];
@@ -1073,104 +1073,104 @@  discard block
 block discarded – undo
1073 1073
 		else $cov = 'FALSE';
1074 1074
 		if (isset($noarchive[$key]) && $noarchive[$key] == 1) $arch = 'TRUE';
1075 1075
 		else $arch = 'FALSE';
1076
-		if (strpos($format[$key],'_callback')) {
1077
-			$gSources[] = array('host' => $h, 'pass' => $port[$key],'name' => $name[$key],'format' => $format[$key],'sourcestats' => $cov,'noarchive' => $arch,'timezone' => $timezones[$key],'callback' => 'TRUE');
1076
+		if (strpos($format[$key], '_callback')) {
1077
+			$gSources[] = array('host' => $h, 'pass' => $port[$key], 'name' => $name[$key], 'format' => $format[$key], 'sourcestats' => $cov, 'noarchive' => $arch, 'timezone' => $timezones[$key], 'callback' => 'TRUE');
1078 1078
 		} elseif ($h != '' || $name[$key] != '') {
1079
-			$gSources[] = array('host' => $h, 'port' => $port[$key],'name' => $name[$key],'format' => $format[$key],'sourcestats' => $cov,'noarchive' => $arch,'timezone' => $timezones[$key],'callback' => 'FALSE');
1079
+			$gSources[] = array('host' => $h, 'port' => $port[$key], 'name' => $name[$key], 'format' => $format[$key], 'sourcestats' => $cov, 'noarchive' => $arch, 'timezone' => $timezones[$key], 'callback' => 'FALSE');
1080 1080
 		}
1081 1081
 		if ($format[$key] == 'airwhere') $forcepilots = true;
1082 1082
 	}
1083
-	$settings = array_merge($settings,array('globalSources' => $gSources));
1083
+	$settings = array_merge($settings, array('globalSources' => $gSources));
1084 1084
 
1085 1085
 /*
1086 1086
 	$sbstimeout = filter_input(INPUT_POST,'sbstimeout',FILTER_SANITIZE_NUMBER_INT);
1087 1087
 	$settings = array_merge($settings,array('globalSourcesTimeOut' => $sbstimeout));
1088 1088
 */
1089
-	$acarshost = filter_input(INPUT_POST,'acarshost',FILTER_SANITIZE_STRING);
1090
-	$acarsport = filter_input(INPUT_POST,'acarsport',FILTER_SANITIZE_NUMBER_INT);
1091
-	$settings = array_merge($settings,array('globalACARSHost' => $acarshost,'globalACARSPort' => $acarsport));
1089
+	$acarshost = filter_input(INPUT_POST, 'acarshost', FILTER_SANITIZE_STRING);
1090
+	$acarsport = filter_input(INPUT_POST, 'acarsport', FILTER_SANITIZE_NUMBER_INT);
1091
+	$settings = array_merge($settings, array('globalACARSHost' => $acarshost, 'globalACARSPort' => $acarsport));
1092 1092
 
1093
-	$bitly = filter_input(INPUT_POST,'bitly',FILTER_SANITIZE_STRING);
1094
-	$settings = array_merge($settings,array('globalBitlyAccessToken' => $bitly));
1093
+	$bitly = filter_input(INPUT_POST, 'bitly', FILTER_SANITIZE_STRING);
1094
+	$settings = array_merge($settings, array('globalBitlyAccessToken' => $bitly));
1095 1095
 
1096
-	$customcss = filter_input(INPUT_POST,'customcss',FILTER_SANITIZE_STRING);
1097
-	$settings = array_merge($settings,array('globalCustomCSS' => $customcss));
1096
+	$customcss = filter_input(INPUT_POST, 'customcss', FILTER_SANITIZE_STRING);
1097
+	$settings = array_merge($settings, array('globalCustomCSS' => $customcss));
1098 1098
 
1099
-	$notamsource = filter_input(INPUT_POST,'notamsource',FILTER_SANITIZE_STRING);
1100
-	$settings = array_merge($settings,array('globalNOTAMSource' => $notamsource));
1101
-	$metarsource = filter_input(INPUT_POST,'metarsource',FILTER_SANITIZE_STRING);
1102
-	$settings = array_merge($settings,array('globalMETARurl' => $metarsource));
1099
+	$notamsource = filter_input(INPUT_POST, 'notamsource', FILTER_SANITIZE_STRING);
1100
+	$settings = array_merge($settings, array('globalNOTAMSource' => $notamsource));
1101
+	$metarsource = filter_input(INPUT_POST, 'metarsource', FILTER_SANITIZE_STRING);
1102
+	$settings = array_merge($settings, array('globalMETARurl' => $metarsource));
1103 1103
 
1104
-	$zoilatitude = filter_input(INPUT_POST,'zoilatitude',FILTER_SANITIZE_STRING);
1105
-	$zoilongitude = filter_input(INPUT_POST,'zoilongitude',FILTER_SANITIZE_STRING);
1106
-	$zoidistance = filter_input(INPUT_POST,'zoidistance',FILTER_SANITIZE_NUMBER_INT);
1104
+	$zoilatitude = filter_input(INPUT_POST, 'zoilatitude', FILTER_SANITIZE_STRING);
1105
+	$zoilongitude = filter_input(INPUT_POST, 'zoilongitude', FILTER_SANITIZE_STRING);
1106
+	$zoidistance = filter_input(INPUT_POST, 'zoidistance', FILTER_SANITIZE_NUMBER_INT);
1107 1107
 	if ($zoilatitude != '' && $zoilongitude != '' && $zoidistance != '') {
1108
-		$settings = array_merge($settings,array('globalDistanceIgnore' => array('latitude' => $zoilatitude,'longitude' => $zoilongitude,'distance' => $zoidistance)));
1109
-	} else $settings = array_merge($settings,array('globalDistanceIgnore' => array()));
1108
+		$settings = array_merge($settings, array('globalDistanceIgnore' => array('latitude' => $zoilatitude, 'longitude' => $zoilongitude, 'distance' => $zoidistance)));
1109
+	} else $settings = array_merge($settings, array('globalDistanceIgnore' => array()));
1110 1110
 
1111
-	$refresh = filter_input(INPUT_POST,'refresh',FILTER_SANITIZE_NUMBER_INT);
1112
-	$settings = array_merge($settings,array('globalLiveInterval' => $refresh));
1113
-	$maprefresh = filter_input(INPUT_POST,'maprefresh',FILTER_SANITIZE_NUMBER_INT);
1114
-	$settings = array_merge($settings,array('globalMapRefresh' => $maprefresh));
1115
-	$mapidle = filter_input(INPUT_POST,'mapidle',FILTER_SANITIZE_NUMBER_INT);
1116
-	$settings = array_merge($settings,array('globalMapIdleTimeout' => $mapidle));
1117
-	$closestmindist = filter_input(INPUT_POST,'closestmindist',FILTER_SANITIZE_NUMBER_INT);
1118
-	$settings = array_merge($settings,array('globalClosestMinDist' => $closestmindist));
1111
+	$refresh = filter_input(INPUT_POST, 'refresh', FILTER_SANITIZE_NUMBER_INT);
1112
+	$settings = array_merge($settings, array('globalLiveInterval' => $refresh));
1113
+	$maprefresh = filter_input(INPUT_POST, 'maprefresh', FILTER_SANITIZE_NUMBER_INT);
1114
+	$settings = array_merge($settings, array('globalMapRefresh' => $maprefresh));
1115
+	$mapidle = filter_input(INPUT_POST, 'mapidle', FILTER_SANITIZE_NUMBER_INT);
1116
+	$settings = array_merge($settings, array('globalMapIdleTimeout' => $mapidle));
1117
+	$closestmindist = filter_input(INPUT_POST, 'closestmindist', FILTER_SANITIZE_NUMBER_INT);
1118
+	$settings = array_merge($settings, array('globalClosestMinDist' => $closestmindist));
1119 1119
 
1120
-	$aircraftsize = filter_input(INPUT_POST,'aircraftsize',FILTER_SANITIZE_NUMBER_INT);
1121
-	$settings = array_merge($settings,array('globalAircraftSize' => $aircraftsize));
1120
+	$aircraftsize = filter_input(INPUT_POST, 'aircraftsize', FILTER_SANITIZE_NUMBER_INT);
1121
+	$settings = array_merge($settings, array('globalAircraftSize' => $aircraftsize));
1122 1122
 
1123
-	$archivemonths = filter_input(INPUT_POST,'archivemonths',FILTER_SANITIZE_NUMBER_INT);
1124
-	$settings = array_merge($settings,array('globalArchiveMonths' => $archivemonths));
1123
+	$archivemonths = filter_input(INPUT_POST, 'archivemonths', FILTER_SANITIZE_NUMBER_INT);
1124
+	$settings = array_merge($settings, array('globalArchiveMonths' => $archivemonths));
1125 1125
 	
1126
-	$archiveyear = filter_input(INPUT_POST,'archiveyear',FILTER_SANITIZE_STRING);
1126
+	$archiveyear = filter_input(INPUT_POST, 'archiveyear', FILTER_SANITIZE_STRING);
1127 1127
 	if ($archiveyear == "archiveyear") {
1128
-		$settings = array_merge($settings,array('globalArchiveYear' => 'TRUE'));
1128
+		$settings = array_merge($settings, array('globalArchiveYear' => 'TRUE'));
1129 1129
 	} else {
1130
-		$settings = array_merge($settings,array('globalArchiveYear' => 'FALSE'));
1130
+		$settings = array_merge($settings, array('globalArchiveYear' => 'FALSE'));
1131 1131
 	}
1132
-	$archivekeepmonths = filter_input(INPUT_POST,'archivekeepmonths',FILTER_SANITIZE_NUMBER_INT);
1133
-	$settings = array_merge($settings,array('globalArchiveKeepMonths' => $archivekeepmonths));
1134
-	$archivekeeptrackmonths = filter_input(INPUT_POST,'archivekeeptrackmonths',FILTER_SANITIZE_NUMBER_INT);
1135
-	$settings = array_merge($settings,array('globalArchiveKeepTrackMonths' => $archivekeeptrackmonths));
1132
+	$archivekeepmonths = filter_input(INPUT_POST, 'archivekeepmonths', FILTER_SANITIZE_NUMBER_INT);
1133
+	$settings = array_merge($settings, array('globalArchiveKeepMonths' => $archivekeepmonths));
1134
+	$archivekeeptrackmonths = filter_input(INPUT_POST, 'archivekeeptrackmonths', FILTER_SANITIZE_NUMBER_INT);
1135
+	$settings = array_merge($settings, array('globalArchiveKeepTrackMonths' => $archivekeeptrackmonths));
1136 1136
 
1137
-	$britishairways = filter_input(INPUT_POST,'britishairways',FILTER_SANITIZE_STRING);
1138
-	$settings = array_merge($settings,array('globalBritishAirwaysKey' => $britishairways));
1139
-	$transavia = filter_input(INPUT_POST,'transavia',FILTER_SANITIZE_STRING);
1140
-	$settings = array_merge($settings,array('globalTransaviaKey' => $transavia));
1137
+	$britishairways = filter_input(INPUT_POST, 'britishairways', FILTER_SANITIZE_STRING);
1138
+	$settings = array_merge($settings, array('globalBritishAirwaysKey' => $britishairways));
1139
+	$transavia = filter_input(INPUT_POST, 'transavia', FILTER_SANITIZE_STRING);
1140
+	$settings = array_merge($settings, array('globalTransaviaKey' => $transavia));
1141 1141
 
1142
-	$lufthansakey = filter_input(INPUT_POST,'lufthansakey',FILTER_SANITIZE_STRING);
1143
-	$lufthansasecret = filter_input(INPUT_POST,'lufthansasecret',FILTER_SANITIZE_STRING);
1144
-	$settings = array_merge($settings,array('globalLufthansaKey' => array('key' => $lufthansakey,'secret' => $lufthansasecret)));
1142
+	$lufthansakey = filter_input(INPUT_POST, 'lufthansakey', FILTER_SANITIZE_STRING);
1143
+	$lufthansasecret = filter_input(INPUT_POST, 'lufthansasecret', FILTER_SANITIZE_STRING);
1144
+	$settings = array_merge($settings, array('globalLufthansaKey' => array('key' => $lufthansakey, 'secret' => $lufthansasecret)));
1145 1145
 
1146 1146
 	// Create in settings.php keys not yet configurable if not already here
1147 1147
 	//if (!isset($globalImageBingKey)) $settings = array_merge($settings,array('globalImageBingKey' => ''));
1148
-	if (!isset($globalDebug)) $settings = array_merge($settings,array('globalDebug' => 'TRUE'));
1148
+	if (!isset($globalDebug)) $settings = array_merge($settings, array('globalDebug' => 'TRUE'));
1149 1149
 
1150
-	$resetyearstats = filter_input(INPUT_POST,'resetyearstats',FILTER_SANITIZE_STRING);
1150
+	$resetyearstats = filter_input(INPUT_POST, 'resetyearstats', FILTER_SANITIZE_STRING);
1151 1151
 	if ($resetyearstats == 'resetyearstats') {
1152
-		$settings = array_merge($settings,array('globalDeleteLastYearStats' => 'TRUE'));
1152
+		$settings = array_merge($settings, array('globalDeleteLastYearStats' => 'TRUE'));
1153 1153
 	} else {
1154
-		$settings = array_merge($settings,array('globalDeleteLastYearStats' => 'FALSE'));
1154
+		$settings = array_merge($settings, array('globalDeleteLastYearStats' => 'FALSE'));
1155 1155
 	}
1156 1156
 
1157
-	$archive = filter_input(INPUT_POST,'archive',FILTER_SANITIZE_STRING);
1157
+	$archive = filter_input(INPUT_POST, 'archive', FILTER_SANITIZE_STRING);
1158 1158
 	if ($archive == 'archive') {
1159
-		$settings = array_merge($settings,array('globalArchive' => 'TRUE'));
1159
+		$settings = array_merge($settings, array('globalArchive' => 'TRUE'));
1160 1160
 	} else {
1161
-		$settings = array_merge($settings,array('globalArchive' => 'FALSE'));
1161
+		$settings = array_merge($settings, array('globalArchive' => 'FALSE'));
1162 1162
 	}
1163
-	$daemon = filter_input(INPUT_POST,'daemon',FILTER_SANITIZE_STRING);
1163
+	$daemon = filter_input(INPUT_POST, 'daemon', FILTER_SANITIZE_STRING);
1164 1164
 	if ($daemon == 'daemon') {
1165
-		$settings = array_merge($settings,array('globalDaemon' => 'TRUE'));
1165
+		$settings = array_merge($settings, array('globalDaemon' => 'TRUE'));
1166 1166
 	} else {
1167
-		$settings = array_merge($settings,array('globalDaemon' => 'FALSE'));
1167
+		$settings = array_merge($settings, array('globalDaemon' => 'FALSE'));
1168 1168
 	}
1169
-	$schedules = filter_input(INPUT_POST,'schedules',FILTER_SANITIZE_STRING);
1169
+	$schedules = filter_input(INPUT_POST, 'schedules', FILTER_SANITIZE_STRING);
1170 1170
 	if ($schedules == 'schedules') {
1171
-		$settings = array_merge($settings,array('globalSchedulesFetch' => 'TRUE'));
1171
+		$settings = array_merge($settings, array('globalSchedulesFetch' => 'TRUE'));
1172 1172
 	} else {
1173
-		$settings = array_merge($settings,array('globalSchedulesFetch' => 'FALSE'));
1173
+		$settings = array_merge($settings, array('globalSchedulesFetch' => 'FALSE'));
1174 1174
 	}
1175 1175
 
1176 1176
 /*
@@ -1181,227 +1181,227 @@  discard block
 block discarded – undo
1181 1181
 		$settings = array_merge($settings,array('globalFlightAware' => 'FALSE','globalSBS1' => 'TRUE'));
1182 1182
 	}
1183 1183
 */
1184
-	$settings = array_merge($settings,array('globalFlightAware' => 'FALSE'));
1185
-	if ($globalsbs == 'sbs') $settings = array_merge($settings,array('globalSBS1' => 'TRUE'));
1186
-	else $settings = array_merge($settings,array('globalSBS1' => 'FALSE'));
1187
-	if ($globalaprs == 'aprs') $settings = array_merge($settings,array('globalAPRS' => 'TRUE'));
1188
-	else $settings = array_merge($settings,array('globalAPRS' => 'FALSE'));
1184
+	$settings = array_merge($settings, array('globalFlightAware' => 'FALSE'));
1185
+	if ($globalsbs == 'sbs') $settings = array_merge($settings, array('globalSBS1' => 'TRUE'));
1186
+	else $settings = array_merge($settings, array('globalSBS1' => 'FALSE'));
1187
+	if ($globalaprs == 'aprs') $settings = array_merge($settings, array('globalAPRS' => 'TRUE'));
1188
+	else $settings = array_merge($settings, array('globalAPRS' => 'FALSE'));
1189 1189
 	$va = false;
1190 1190
 	if ($globalivao == 'ivao') {
1191
-		$settings = array_merge($settings,array('globalIVAO' => 'TRUE'));
1191
+		$settings = array_merge($settings, array('globalIVAO' => 'TRUE'));
1192 1192
 		$va = true;
1193
-	} else $settings = array_merge($settings,array('globalIVAO' => 'FALSE'));
1193
+	} else $settings = array_merge($settings, array('globalIVAO' => 'FALSE'));
1194 1194
 	if ($globalvatsim == 'vatsim') {
1195
-		$settings = array_merge($settings,array('globalVATSIM' => 'TRUE'));
1195
+		$settings = array_merge($settings, array('globalVATSIM' => 'TRUE'));
1196 1196
 		$va = true;
1197
-	} else $settings = array_merge($settings,array('globalVATSIM' => 'FALSE'));
1197
+	} else $settings = array_merge($settings, array('globalVATSIM' => 'FALSE'));
1198 1198
 	if ($globalphpvms == 'phpvms') {
1199
-		$settings = array_merge($settings,array('globalphpVMS' => 'TRUE'));
1199
+		$settings = array_merge($settings, array('globalphpVMS' => 'TRUE'));
1200 1200
 		$va = true;
1201
-	} else $settings = array_merge($settings,array('globalphpVMS' => 'FALSE'));
1201
+	} else $settings = array_merge($settings, array('globalphpVMS' => 'FALSE'));
1202 1202
 	if ($globalvam == 'vam') {
1203
-		$settings = array_merge($settings,array('globalVAM' => 'TRUE'));
1203
+		$settings = array_merge($settings, array('globalVAM' => 'TRUE'));
1204 1204
 		$va = true;
1205
-	} else $settings = array_merge($settings,array('globalVAM' => 'FALSE'));
1205
+	} else $settings = array_merge($settings, array('globalVAM' => 'FALSE'));
1206 1206
 	if ($va) {
1207
-		$settings = array_merge($settings,array('globalSchedulesFetch' => 'FALSE','globalTranslationFetch' => 'FALSE'));
1208
-	} else $settings = array_merge($settings,array('globalSchedulesFetch' => 'TRUE','globalTranslationFetch' => 'TRUE'));
1207
+		$settings = array_merge($settings, array('globalSchedulesFetch' => 'FALSE', 'globalTranslationFetch' => 'FALSE'));
1208
+	} else $settings = array_merge($settings, array('globalSchedulesFetch' => 'TRUE', 'globalTranslationFetch' => 'TRUE'));
1209 1209
 	if ($globalva == 'va' || $va) {
1210
-		$settings = array_merge($settings,array('globalVA' => 'TRUE'));
1211
-		$settings = array_merge($settings,array('globalUsePilot' => 'TRUE','globalUseOwner' => 'FALSE'));
1210
+		$settings = array_merge($settings, array('globalVA' => 'TRUE'));
1211
+		$settings = array_merge($settings, array('globalUsePilot' => 'TRUE', 'globalUseOwner' => 'FALSE'));
1212 1212
 	} else {
1213
-		$settings = array_merge($settings,array('globalVA' => 'FALSE'));
1214
-		if ($forcepilots) $settings = array_merge($settings,array('globalUsePilot' => 'TRUE','globalUseOwner' => 'FALSE'));
1215
-		else $settings = array_merge($settings,array('globalUsePilot' => 'FALSE','globalUseOwner' => 'TRUE'));
1213
+		$settings = array_merge($settings, array('globalVA' => 'FALSE'));
1214
+		if ($forcepilots) $settings = array_merge($settings, array('globalUsePilot' => 'TRUE', 'globalUseOwner' => 'FALSE'));
1215
+		else $settings = array_merge($settings, array('globalUsePilot' => 'FALSE', 'globalUseOwner' => 'TRUE'));
1216 1216
 	}
1217 1217
 	
1218 1218
 	
1219 1219
 
1220
-	$notam = filter_input(INPUT_POST,'notam',FILTER_SANITIZE_STRING);
1220
+	$notam = filter_input(INPUT_POST, 'notam', FILTER_SANITIZE_STRING);
1221 1221
 	if ($notam == 'notam') {
1222
-		$settings = array_merge($settings,array('globalNOTAM' => 'TRUE'));
1222
+		$settings = array_merge($settings, array('globalNOTAM' => 'TRUE'));
1223 1223
 	} else {
1224
-		$settings = array_merge($settings,array('globalNOTAM' => 'FALSE'));
1224
+		$settings = array_merge($settings, array('globalNOTAM' => 'FALSE'));
1225 1225
 	}
1226
-	$owner = filter_input(INPUT_POST,'owner',FILTER_SANITIZE_STRING);
1226
+	$owner = filter_input(INPUT_POST, 'owner', FILTER_SANITIZE_STRING);
1227 1227
 	if ($owner == 'owner') {
1228
-		$settings = array_merge($settings,array('globalOwner' => 'TRUE'));
1228
+		$settings = array_merge($settings, array('globalOwner' => 'TRUE'));
1229 1229
 	} else {
1230
-		$settings = array_merge($settings,array('globalOwner' => 'FALSE'));
1230
+		$settings = array_merge($settings, array('globalOwner' => 'FALSE'));
1231 1231
 	}
1232
-	$map3d = filter_input(INPUT_POST,'map3d',FILTER_SANITIZE_STRING);
1232
+	$map3d = filter_input(INPUT_POST, 'map3d', FILTER_SANITIZE_STRING);
1233 1233
 	if ($map3d == 'map3d') {
1234
-		$settings = array_merge($settings,array('globalMap3D' => 'TRUE'));
1234
+		$settings = array_merge($settings, array('globalMap3D' => 'TRUE'));
1235 1235
 	} else {
1236
-		$settings = array_merge($settings,array('globalMap3D' => 'FALSE'));
1236
+		$settings = array_merge($settings, array('globalMap3D' => 'FALSE'));
1237 1237
 	}
1238
-	$crash = filter_input(INPUT_POST,'crash',FILTER_SANITIZE_STRING);
1238
+	$crash = filter_input(INPUT_POST, 'crash', FILTER_SANITIZE_STRING);
1239 1239
 	if ($crash == 'crash') {
1240
-		$settings = array_merge($settings,array('globalAccidents' => 'TRUE'));
1240
+		$settings = array_merge($settings, array('globalAccidents' => 'TRUE'));
1241 1241
 	} else {
1242
-		$settings = array_merge($settings,array('globalAccidents' => 'FALSE'));
1242
+		$settings = array_merge($settings, array('globalAccidents' => 'FALSE'));
1243 1243
 	}
1244
-	$mapsatellites = filter_input(INPUT_POST,'mapsatellites',FILTER_SANITIZE_STRING);
1244
+	$mapsatellites = filter_input(INPUT_POST, 'mapsatellites', FILTER_SANITIZE_STRING);
1245 1245
 	if ($mapsatellites == 'mapsatellites') {
1246
-		$settings = array_merge($settings,array('globalMapSatellites' => 'TRUE'));
1246
+		$settings = array_merge($settings, array('globalMapSatellites' => 'TRUE'));
1247 1247
 	} else {
1248
-		$settings = array_merge($settings,array('globalMapSatellites' => 'FALSE'));
1248
+		$settings = array_merge($settings, array('globalMapSatellites' => 'FALSE'));
1249 1249
 	}
1250
-	$map3ddefault = filter_input(INPUT_POST,'map3ddefault',FILTER_SANITIZE_STRING);
1250
+	$map3ddefault = filter_input(INPUT_POST, 'map3ddefault', FILTER_SANITIZE_STRING);
1251 1251
 	if ($map3ddefault == 'map3ddefault') {
1252
-		$settings = array_merge($settings,array('globalMap3Ddefault' => 'TRUE'));
1252
+		$settings = array_merge($settings, array('globalMap3Ddefault' => 'TRUE'));
1253 1253
 	} else {
1254
-		$settings = array_merge($settings,array('globalMap3Ddefault' => 'FALSE'));
1254
+		$settings = array_merge($settings, array('globalMap3Ddefault' => 'FALSE'));
1255 1255
 	}
1256
-	$translate = filter_input(INPUT_POST,'translate',FILTER_SANITIZE_STRING);
1256
+	$translate = filter_input(INPUT_POST, 'translate', FILTER_SANITIZE_STRING);
1257 1257
 	if ($translate == 'translate') {
1258
-		$settings = array_merge($settings,array('globalTranslate' => 'TRUE'));
1258
+		$settings = array_merge($settings, array('globalTranslate' => 'TRUE'));
1259 1259
 	} else {
1260
-		$settings = array_merge($settings,array('globalTranslate' => 'FALSE'));
1260
+		$settings = array_merge($settings, array('globalTranslate' => 'FALSE'));
1261 1261
 	}
1262
-	$realairlines = filter_input(INPUT_POST,'realairlines',FILTER_SANITIZE_STRING);
1262
+	$realairlines = filter_input(INPUT_POST, 'realairlines', FILTER_SANITIZE_STRING);
1263 1263
 	if ($realairlines == 'realairlines') {
1264
-		$settings = array_merge($settings,array('globalUseRealAirlines' => 'TRUE'));
1264
+		$settings = array_merge($settings, array('globalUseRealAirlines' => 'TRUE'));
1265 1265
 	} else {
1266
-		$settings = array_merge($settings,array('globalUseRealAirlines' => 'FALSE'));
1266
+		$settings = array_merge($settings, array('globalUseRealAirlines' => 'FALSE'));
1267 1267
 	}
1268
-	$estimation = filter_input(INPUT_POST,'estimation',FILTER_SANITIZE_STRING);
1268
+	$estimation = filter_input(INPUT_POST, 'estimation', FILTER_SANITIZE_STRING);
1269 1269
 	if ($estimation == 'estimation') {
1270
-		$settings = array_merge($settings,array('globalMapEstimation' => 'TRUE'));
1270
+		$settings = array_merge($settings, array('globalMapEstimation' => 'TRUE'));
1271 1271
 	} else {
1272
-		$settings = array_merge($settings,array('globalMapEstimation' => 'FALSE'));
1272
+		$settings = array_merge($settings, array('globalMapEstimation' => 'FALSE'));
1273 1273
 	}
1274
-	$metar = filter_input(INPUT_POST,'metar',FILTER_SANITIZE_STRING);
1274
+	$metar = filter_input(INPUT_POST, 'metar', FILTER_SANITIZE_STRING);
1275 1275
 	if ($metar == 'metar') {
1276
-		$settings = array_merge($settings,array('globalMETAR' => 'TRUE'));
1276
+		$settings = array_merge($settings, array('globalMETAR' => 'TRUE'));
1277 1277
 	} else {
1278
-		$settings = array_merge($settings,array('globalMETAR' => 'FALSE'));
1278
+		$settings = array_merge($settings, array('globalMETAR' => 'FALSE'));
1279 1279
 	}
1280
-	$metarcycle = filter_input(INPUT_POST,'metarcycle',FILTER_SANITIZE_STRING);
1280
+	$metarcycle = filter_input(INPUT_POST, 'metarcycle', FILTER_SANITIZE_STRING);
1281 1281
 	if ($metarcycle == 'metarcycle') {
1282
-		$settings = array_merge($settings,array('globalMETARcycle' => 'TRUE'));
1282
+		$settings = array_merge($settings, array('globalMETARcycle' => 'TRUE'));
1283 1283
 	} else {
1284
-		$settings = array_merge($settings,array('globalMETARcycle' => 'FALSE'));
1284
+		$settings = array_merge($settings, array('globalMETARcycle' => 'FALSE'));
1285 1285
 	}
1286
-	$fork = filter_input(INPUT_POST,'fork',FILTER_SANITIZE_STRING);
1286
+	$fork = filter_input(INPUT_POST, 'fork', FILTER_SANITIZE_STRING);
1287 1287
 	if ($fork == 'fork') {
1288
-		$settings = array_merge($settings,array('globalFork' => 'TRUE'));
1288
+		$settings = array_merge($settings, array('globalFork' => 'TRUE'));
1289 1289
 	} else {
1290
-		$settings = array_merge($settings,array('globalFork' => 'FALSE'));
1290
+		$settings = array_merge($settings, array('globalFork' => 'FALSE'));
1291 1291
 	}
1292 1292
 
1293
-	$colormap = filter_input(INPUT_POST,'colormap',FILTER_SANITIZE_STRING);
1293
+	$colormap = filter_input(INPUT_POST, 'colormap', FILTER_SANITIZE_STRING);
1294 1294
 	if ($colormap == 'colormap') {
1295
-		$settings = array_merge($settings,array('globalMapAltitudeColor' => 'TRUE'));
1295
+		$settings = array_merge($settings, array('globalMapAltitudeColor' => 'TRUE'));
1296 1296
 	} else {
1297
-		$settings = array_merge($settings,array('globalMapAltitudeColor' => 'FALSE'));
1297
+		$settings = array_merge($settings, array('globalMapAltitudeColor' => 'FALSE'));
1298 1298
 	}
1299 1299
 	
1300 1300
 	if (isset($_POST['aircrafticoncolor'])) {
1301
-		$aircrafticoncolor = filter_input(INPUT_POST,'aircrafticoncolor',FILTER_SANITIZE_STRING);
1302
-		$settings = array_merge($settings,array('globalAircraftIconColor' => substr($aircrafticoncolor,1)));
1301
+		$aircrafticoncolor = filter_input(INPUT_POST, 'aircrafticoncolor', FILTER_SANITIZE_STRING);
1302
+		$settings = array_merge($settings, array('globalAircraftIconColor' => substr($aircrafticoncolor, 1)));
1303 1303
 	}
1304 1304
 
1305
-	$airportzoom = filter_input(INPUT_POST,'airportzoom',FILTER_SANITIZE_NUMBER_INT);
1306
-	$settings = array_merge($settings,array('globalAirportZoom' => $airportzoom));
1305
+	$airportzoom = filter_input(INPUT_POST, 'airportzoom', FILTER_SANITIZE_NUMBER_INT);
1306
+	$settings = array_merge($settings, array('globalAirportZoom' => $airportzoom));
1307 1307
 
1308
-	$unitdistance = filter_input(INPUT_POST,'unitdistance',FILTER_SANITIZE_STRING);
1309
-	$settings = array_merge($settings,array('globalUnitDistance' => $unitdistance));
1310
-	$unitaltitude = filter_input(INPUT_POST,'unitaltitude',FILTER_SANITIZE_STRING);
1311
-	$settings = array_merge($settings,array('globalUnitAltitude' => $unitaltitude));
1312
-	$unitspeed = filter_input(INPUT_POST,'unitspeed',FILTER_SANITIZE_STRING);
1313
-	$settings = array_merge($settings,array('globalUnitSpeed' => $unitspeed));
1308
+	$unitdistance = filter_input(INPUT_POST, 'unitdistance', FILTER_SANITIZE_STRING);
1309
+	$settings = array_merge($settings, array('globalUnitDistance' => $unitdistance));
1310
+	$unitaltitude = filter_input(INPUT_POST, 'unitaltitude', FILTER_SANITIZE_STRING);
1311
+	$settings = array_merge($settings, array('globalUnitAltitude' => $unitaltitude));
1312
+	$unitspeed = filter_input(INPUT_POST, 'unitspeed', FILTER_SANITIZE_STRING);
1313
+	$settings = array_merge($settings, array('globalUnitSpeed' => $unitspeed));
1314 1314
 
1315
-	$mappopup = filter_input(INPUT_POST,'mappopup',FILTER_SANITIZE_STRING);
1315
+	$mappopup = filter_input(INPUT_POST, 'mappopup', FILTER_SANITIZE_STRING);
1316 1316
 	if ($mappopup == 'mappopup') {
1317
-		$settings = array_merge($settings,array('globalMapPopup' => 'TRUE'));
1317
+		$settings = array_merge($settings, array('globalMapPopup' => 'TRUE'));
1318 1318
 	} else {
1319
-		$settings = array_merge($settings,array('globalMapPopup' => 'FALSE'));
1319
+		$settings = array_merge($settings, array('globalMapPopup' => 'FALSE'));
1320 1320
 	}
1321
-	$airportpopup = filter_input(INPUT_POST,'airportpopup',FILTER_SANITIZE_STRING);
1321
+	$airportpopup = filter_input(INPUT_POST, 'airportpopup', FILTER_SANITIZE_STRING);
1322 1322
 	if ($airportpopup == 'airportpopup') {
1323
-		$settings = array_merge($settings,array('globalAirportPopup' => 'TRUE'));
1323
+		$settings = array_merge($settings, array('globalAirportPopup' => 'TRUE'));
1324 1324
 	} else {
1325
-		$settings = array_merge($settings,array('globalAirportPopup' => 'FALSE'));
1325
+		$settings = array_merge($settings, array('globalAirportPopup' => 'FALSE'));
1326 1326
 	}
1327
-	$maphistory = filter_input(INPUT_POST,'maphistory',FILTER_SANITIZE_STRING);
1327
+	$maphistory = filter_input(INPUT_POST, 'maphistory', FILTER_SANITIZE_STRING);
1328 1328
 	if ($maphistory == 'maphistory') {
1329
-		$settings = array_merge($settings,array('globalMapHistory' => 'TRUE'));
1329
+		$settings = array_merge($settings, array('globalMapHistory' => 'TRUE'));
1330 1330
 	} else {
1331
-		$settings = array_merge($settings,array('globalMapHistory' => 'FALSE'));
1331
+		$settings = array_merge($settings, array('globalMapHistory' => 'FALSE'));
1332 1332
 	}
1333
-	$maptooltip = filter_input(INPUT_POST,'maptooltip',FILTER_SANITIZE_STRING);
1333
+	$maptooltip = filter_input(INPUT_POST, 'maptooltip', FILTER_SANITIZE_STRING);
1334 1334
 	if ($maptooltip == 'maptooltip') {
1335
-		$settings = array_merge($settings,array('globalMapTooltip' => 'TRUE'));
1335
+		$settings = array_merge($settings, array('globalMapTooltip' => 'TRUE'));
1336 1336
 	} else {
1337
-		$settings = array_merge($settings,array('globalMapTooltip' => 'FALSE'));
1337
+		$settings = array_merge($settings, array('globalMapTooltip' => 'FALSE'));
1338 1338
 	}
1339
-	$flightroute = filter_input(INPUT_POST,'flightroute',FILTER_SANITIZE_STRING);
1339
+	$flightroute = filter_input(INPUT_POST, 'flightroute', FILTER_SANITIZE_STRING);
1340 1340
 	if ($flightroute == 'flightroute') {
1341
-		$settings = array_merge($settings,array('globalMapRoute' => 'TRUE'));
1341
+		$settings = array_merge($settings, array('globalMapRoute' => 'TRUE'));
1342 1342
 	} else {
1343
-		$settings = array_merge($settings,array('globalMapRoute' => 'FALSE'));
1343
+		$settings = array_merge($settings, array('globalMapRoute' => 'FALSE'));
1344 1344
 	}
1345
-	$flightremainingroute = filter_input(INPUT_POST,'flightremainingroute',FILTER_SANITIZE_STRING);
1345
+	$flightremainingroute = filter_input(INPUT_POST, 'flightremainingroute', FILTER_SANITIZE_STRING);
1346 1346
 	if ($flightremainingroute == 'flightremainingroute') {
1347
-		$settings = array_merge($settings,array('globalMapRemainingRoute' => 'TRUE'));
1347
+		$settings = array_merge($settings, array('globalMapRemainingRoute' => 'TRUE'));
1348 1348
 	} else {
1349
-		$settings = array_merge($settings,array('globalMapRemainingRoute' => 'FALSE'));
1349
+		$settings = array_merge($settings, array('globalMapRemainingRoute' => 'FALSE'));
1350 1350
 	}
1351
-	$allflights = filter_input(INPUT_POST,'allflights',FILTER_SANITIZE_STRING);
1351
+	$allflights = filter_input(INPUT_POST, 'allflights', FILTER_SANITIZE_STRING);
1352 1352
 	if ($allflights == 'allflights') {
1353
-		$settings = array_merge($settings,array('globalAllFlights' => 'TRUE'));
1353
+		$settings = array_merge($settings, array('globalAllFlights' => 'TRUE'));
1354 1354
 	} else {
1355
-		$settings = array_merge($settings,array('globalAllFlights' => 'FALSE'));
1355
+		$settings = array_merge($settings, array('globalAllFlights' => 'FALSE'));
1356 1356
 	}
1357
-	$bbox = filter_input(INPUT_POST,'bbox',FILTER_SANITIZE_STRING);
1357
+	$bbox = filter_input(INPUT_POST, 'bbox', FILTER_SANITIZE_STRING);
1358 1358
 	if ($bbox == 'bbox') {
1359
-		$settings = array_merge($settings,array('globalMapUseBbox' => 'TRUE'));
1359
+		$settings = array_merge($settings, array('globalMapUseBbox' => 'TRUE'));
1360 1360
 	} else {
1361
-		$settings = array_merge($settings,array('globalMapUseBbox' => 'FALSE'));
1361
+		$settings = array_merge($settings, array('globalMapUseBbox' => 'FALSE'));
1362 1362
 	}
1363
-	$groundaltitude = filter_input(INPUT_POST,'groundaltitude',FILTER_SANITIZE_STRING);
1363
+	$groundaltitude = filter_input(INPUT_POST, 'groundaltitude', FILTER_SANITIZE_STRING);
1364 1364
 	if ($groundaltitude == 'groundaltitude') {
1365
-		$settings = array_merge($settings,array('globalGroundAltitude' => 'TRUE'));
1365
+		$settings = array_merge($settings, array('globalGroundAltitude' => 'TRUE'));
1366 1366
 	} else {
1367
-		$settings = array_merge($settings,array('globalGroundAltitude' => 'FALSE'));
1367
+		$settings = array_merge($settings, array('globalGroundAltitude' => 'FALSE'));
1368 1368
 	}
1369
-	$waypoints = filter_input(INPUT_POST,'waypoints',FILTER_SANITIZE_STRING);
1369
+	$waypoints = filter_input(INPUT_POST, 'waypoints', FILTER_SANITIZE_STRING);
1370 1370
 	if ($waypoints == 'waypoints') {
1371
-		$settings = array_merge($settings,array('globalWaypoints' => 'TRUE'));
1371
+		$settings = array_merge($settings, array('globalWaypoints' => 'TRUE'));
1372 1372
 	} else {
1373
-		$settings = array_merge($settings,array('globalWaypoints' => 'FALSE'));
1373
+		$settings = array_merge($settings, array('globalWaypoints' => 'FALSE'));
1374 1374
 	}
1375
-	$geoid = filter_input(INPUT_POST,'geoid',FILTER_SANITIZE_STRING);
1375
+	$geoid = filter_input(INPUT_POST, 'geoid', FILTER_SANITIZE_STRING);
1376 1376
 	if ($geoid == 'geoid') {
1377
-		$settings = array_merge($settings,array('globalGeoid' => 'TRUE'));
1377
+		$settings = array_merge($settings, array('globalGeoid' => 'TRUE'));
1378 1378
 	} else {
1379
-		$settings = array_merge($settings,array('globalGeoid' => 'FALSE'));
1379
+		$settings = array_merge($settings, array('globalGeoid' => 'FALSE'));
1380 1380
 	}
1381
-	$geoid_source = filter_input(INPUT_POST,'geoid_source',FILTER_SANITIZE_STRING);
1382
-	$settings = array_merge($settings,array('globalGeoidSource' => $geoid_source));
1381
+	$geoid_source = filter_input(INPUT_POST, 'geoid_source', FILTER_SANITIZE_STRING);
1382
+	$settings = array_merge($settings, array('globalGeoidSource' => $geoid_source));
1383 1383
 
1384
-	$noairlines = filter_input(INPUT_POST,'noairlines',FILTER_SANITIZE_STRING);
1384
+	$noairlines = filter_input(INPUT_POST, 'noairlines', FILTER_SANITIZE_STRING);
1385 1385
 	if ($noairlines == 'noairlines') {
1386
-		$settings = array_merge($settings,array('globalNoAirlines' => 'TRUE'));
1386
+		$settings = array_merge($settings, array('globalNoAirlines' => 'TRUE'));
1387 1387
 	} else {
1388
-		$settings = array_merge($settings,array('globalNoAirlines' => 'FALSE'));
1388
+		$settings = array_merge($settings, array('globalNoAirlines' => 'FALSE'));
1389 1389
 	}
1390 1390
 
1391
-	if (!isset($globalTransaction)) $settings = array_merge($settings,array('globalTransaction' => 'TRUE'));
1391
+	if (!isset($globalTransaction)) $settings = array_merge($settings, array('globalTransaction' => 'TRUE'));
1392 1392
 
1393 1393
 	// Set some defaults values...
1394 1394
 	if (!isset($globalAircraftImageSources)) {
1395
-	    $globalAircraftImageSources = array('ivaomtl','wikimedia','airportdata','deviantart','flickr','bing','jetphotos','planepictures','planespotters');
1396
-	    $settings = array_merge($settings,array('globalAircraftImageSources' => $globalAircraftImageSources));
1395
+	    $globalAircraftImageSources = array('ivaomtl', 'wikimedia', 'airportdata', 'deviantart', 'flickr', 'bing', 'jetphotos', 'planepictures', 'planespotters');
1396
+	    $settings = array_merge($settings, array('globalAircraftImageSources' => $globalAircraftImageSources));
1397 1397
 	}
1398 1398
 
1399 1399
 	if (!isset($globalSchedulesSources)) {
1400
-	    $globalSchedulesSources = array('flightmapper','costtotravel','flightradar24','flightaware');
1401
-    	    $settings = array_merge($settings,array('globalSchedulesSources' => $globalSchedulesSources));
1400
+	    $globalSchedulesSources = array('flightmapper', 'costtotravel', 'flightradar24', 'flightaware');
1401
+    	    $settings = array_merge($settings, array('globalSchedulesSources' => $globalSchedulesSources));
1402 1402
     	}
1403 1403
 
1404
-	$settings = array_merge($settings,array('globalInstalled' => 'TRUE'));
1404
+	$settings = array_merge($settings, array('globalInstalled' => 'TRUE'));
1405 1405
 
1406 1406
 	if ($error == '') settings::modify_settings($settings);
1407 1407
 	if ($error == '') settings::comment_settings($settings_comment);
Please login to merge, or discard this patch.
live-czml.php 1 patch
Spacing   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -48,11 +48,11 @@  discard block
 block discarded – undo
48 48
     $s3 = sin($bank/2);
49 49
     $c1c2 = $c1*$c2;
50 50
     $s1s2 = $s1*$s2;
51
-    $w =$c1c2*$c3 - $s1s2*$s3;
52
-    $x =$c1c2*$s3 + $s1s2*$c3;
53
-    $y =$s1*$c2*$c3 + $c1*$s2*$s3;
54
-    $z =$c1*$s2*$c3 - $s1*$c2*$s3;
55
-    return array('x' => $x,'y' => $y,'z' => $z,'w' => $w);
51
+    $w = $c1c2*$c3 - $s1s2*$s3;
52
+    $x = $c1c2*$s3 + $s1s2*$c3;
53
+    $y = $s1*$c2*$c3 + $c1*$s2*$s3;
54
+    $z = $c1*$s2*$c3 - $s1*$c2*$s3;
55
+    return array('x' => $x, 'y' => $y, 'z' => $z, 'w' => $w);
56 56
 //    return array('x' => '0.0','y' => '-0.931','z' => '0.0','w' => '0.365');
57 57
 
58 58
 }
@@ -73,16 +73,16 @@  discard block
 block discarded – undo
73 73
 $min = false;
74 74
 $allhistory = false;
75 75
 $filter['source'] = array();
76
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt'));
77
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup'));
78
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars'));
79
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs','famaprs'));
80
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs'));
81
-if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING);
82
-if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING);
83
-if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING);
84
-if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING);
85
-if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING);
76
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'], array('vatsimtxt'));
77
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'], array('whazzup'));
78
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'], array('phpvmacars'));
79
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'], array('sbs', 'famaprs'));
80
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'], array('aprs'));
81
+if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'], FILTER_SANITIZE_STRING);
82
+if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',', $_COOKIE['filter_Airlines']), FILTER_SANITIZE_STRING);
83
+if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',', $_COOKIE['filter_Sources']), FILTER_SANITIZE_STRING);
84
+if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'], FILTER_SANITIZE_STRING);
85
+if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'], FILTER_SANITIZE_STRING);
86 86
 /*
87 87
 if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) {
88 88
 	$min = true;
@@ -129,12 +129,12 @@  discard block
 block discarded – undo
129 129
 	$from_archive = true;
130 130
 //	$begindate = filter_input(INPUT_GET,'begindate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~')));
131 131
 //	$enddate = filter_input(INPUT_GET,'enddate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~')));
132
-	$begindate = filter_input(INPUT_GET,'begindate',FILTER_SANITIZE_NUMBER_INT);
133
-	$enddate = filter_input(INPUT_GET,'enddate',FILTER_SANITIZE_NUMBER_INT);
134
-	$archivespeed = filter_input(INPUT_GET,'speed',FILTER_SANITIZE_NUMBER_INT);
135
-	$begindate = date('Y-m-d H:i:s',$begindate);
136
-	$enddate = date('Y-m-d H:i:s',$enddate);
137
-	$spotter_array = $SpotterArchive->getMinLiveSpotterDataPlayback($begindate,$enddate,$filter);
132
+	$begindate = filter_input(INPUT_GET, 'begindate', FILTER_SANITIZE_NUMBER_INT);
133
+	$enddate = filter_input(INPUT_GET, 'enddate', FILTER_SANITIZE_NUMBER_INT);
134
+	$archivespeed = filter_input(INPUT_GET, 'speed', FILTER_SANITIZE_NUMBER_INT);
135
+	$begindate = date('Y-m-d H:i:s', $begindate);
136
+	$enddate = date('Y-m-d H:i:s', $enddate);
137
+	$spotter_array = $SpotterArchive->getMinLiveSpotterDataPlayback($begindate, $enddate, $filter);
138 138
 } elseif (isset($_COOKIE['archive']) && isset($_COOKIE['archive_begin']) && isset($_COOKIE['archive_end']) && isset($_COOKIE['archive_speed'])) {
139 139
 	$from_archive = true;
140 140
 //	$begindate = filter_input(INPUT_GET,'begindate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~')));
@@ -144,11 +144,11 @@  discard block
 block discarded – undo
144 144
 	$begindate = $_COOKIE['archive_begin'];
145 145
 	$enddate = $_COOKIE['archive_end'];
146 146
 
147
-	$archivespeed = filter_var($_COOKIE['archive_speed'],FILTER_SANITIZE_NUMBER_INT);
148
-	$begindate = date('Y-m-d H:i:s',$begindate);
149
-	$enddate = date('Y-m-d H:i:s',$enddate);
147
+	$archivespeed = filter_var($_COOKIE['archive_speed'], FILTER_SANITIZE_NUMBER_INT);
148
+	$begindate = date('Y-m-d H:i:s', $begindate);
149
+	$enddate = date('Y-m-d H:i:s', $enddate);
150 150
 //	echo 'Begin : '.$begindate.' - End : '.$enddate."\n";
151
-	$spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate,$enddate,$filter);
151
+	$spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate, $enddate, $filter);
152 152
 } elseif ($tracker) {
153 153
 	$spotter_array = $TrackerLive->getMinLastLiveTrackerData($filter);
154 154
 } elseif ($marine) {
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
 //print_r($spotter_array);
160 160
 if (!empty($spotter_array)) {
161 161
 	if (isset($_GET['archive'])) {
162
-		$flightcnt = $SpotterArchive->getLiveSpotterCount($begindate,$enddate,$filter);
162
+		$flightcnt = $SpotterArchive->getLiveSpotterCount($begindate, $enddate, $filter);
163 163
 	} elseif ($tracker) {
164 164
 		$flightcnt = $TrackerLive->getLiveTrackerCount($filter);
165 165
 	} elseif ($marine) {
@@ -170,15 +170,15 @@  discard block
 block discarded – undo
170 170
 	if ($flightcnt == '') $flightcnt = 0;
171 171
 } else $flightcnt = 0;
172 172
 
173
-$sqltime = round(microtime(true)-$begintime,2);
173
+$sqltime = round(microtime(true) - $begintime, 2);
174 174
 $minitime = time();
175 175
 $maxitime = 0;
176 176
 
177 177
 $modelsdb = array();
178 178
 if (file_exists(dirname(__FILE__).'/models/modelsdb')) {
179
-	if (($handle = fopen(dirname(__FILE__).'/models/modelsdb','r')) !== FALSE) {
180
-		while (($row = fgetcsv($handle,1000)) !== FALSE) {
181
-			if (isset($row[1]) ){
179
+	if (($handle = fopen(dirname(__FILE__).'/models/modelsdb', 'r')) !== FALSE) {
180
+		while (($row = fgetcsv($handle, 1000)) !== FALSE) {
181
+			if (isset($row[1])) {
182 182
 				$model = $row[0];
183 183
 				$modelsdb[$model] = $row[1];
184 184
 			}
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
 $output .= '},';
215 215
 if (!empty($spotter_array) && is_array($spotter_array))
216 216
 {
217
-	foreach($spotter_array as $spotter_item)
217
+	foreach ($spotter_array as $spotter_item)
218 218
 	{
219 219
 		$j++;
220 220
 		//if (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'airwhere') $heightrelative = 'RELATIVE_TO_GROUND';
@@ -585,8 +585,8 @@  discard block
 block discarded – undo
585 585
 					$output .= '},';
586 586
 				}
587 587
 			}
588
-			if ($onground) $output = str_replace('%onground%','true',$output);
589
-			else $output = str_replace('%onground%','false',$output);
588
+			if ($onground) $output = str_replace('%onground%', 'true', $output);
589
+			else $output = str_replace('%onground%', 'false', $output);
590 590
 
591 591
 	//		$output .= '"heightReference": "CLAMP_TO_GROUND",';
592 592
 			//$output .= '"heightReference": "'.$heightrelative.'",';
@@ -601,7 +601,7 @@  discard block
 block discarded – undo
601 601
 			$output .= '"cartographicDegrees": [';
602 602
 			if ($minitime > strtotime($spotter_item['date'])) $minitime = strtotime($spotter_item['date']);
603 603
 			if ($maxitime < strtotime($spotter_item['date'])) $maxitime = strtotime($spotter_item['date']);
604
-			$output .= '"'.date("c",strtotime($spotter_item['date'])).'", ';
604
+			$output .= '"'.date("c", strtotime($spotter_item['date'])).'", ';
605 605
 			$output .= $spotter_item['longitude'].', ';
606 606
 			$output .= $spotter_item['latitude'];
607 607
 			$prevlong = $spotter_item['longitude'];
@@ -629,7 +629,7 @@  discard block
 block discarded – undo
629 629
 			//$quat = quaternionrotate(deg2rad($spotter_item['heading']),deg2rad(0),deg2rad(0));
630 630
 			//$orientation .= '"'.date("c",strtotime($spotter_item['date'])).'",'.$quat['x'].','.$quat['y'].','.$quat['z'].','.$quat['w'];
631 631
 		} else {
632
-			$output .= ',"'.date("c",strtotime($spotter_item['date'])).'", ';
632
+			$output .= ',"'.date("c", strtotime($spotter_item['date'])).'", ';
633 633
 			if ($maxitime < strtotime($spotter_item['date'])) $maxitime = strtotime($spotter_item['date']);
634 634
 			if ($spotter_item['ground_speed'] == 0) {
635 635
 				$output .= $prevlong.', ';
@@ -669,15 +669,15 @@  discard block
 block discarded – undo
669 669
 }
670 670
 $output .= ']';
671 671
 if (isset($globalArchive) && $globalArchive === TRUE) {
672
-	if ((time()-$globalLiveInterval) > $minitime) {
673
-		if (time()-$globalLiveInterval > $maxitime) {
674
-			$output = str_replace('%minitime%',date("c",$maxitime),$output);
672
+	if ((time() - $globalLiveInterval) > $minitime) {
673
+		if (time() - $globalLiveInterval > $maxitime) {
674
+			$output = str_replace('%minitime%', date("c", $maxitime), $output);
675 675
 		} else {
676
-			$output = str_replace('%minitime%',date("c",time()-$globalLiveInterval),$output);
676
+			$output = str_replace('%minitime%', date("c", time() - $globalLiveInterval), $output);
677 677
 		}
678 678
 	}
679
-	else $output = str_replace('%minitime%',date("c",$minitime),$output);
680
-} else $output = str_replace('%minitime%',date("c",$minitime),$output);
681
-$output = str_replace('%maxitime%',date("c",$maxitime),$output);
679
+	else $output = str_replace('%minitime%', date("c", $minitime), $output);
680
+} else $output = str_replace('%minitime%', date("c", $minitime), $output);
681
+$output = str_replace('%maxitime%', date("c", $maxitime), $output);
682 682
 print $output;
683 683
 ?>
Please login to merge, or discard this patch.
require/class.TrackerLive.php 1 patch
Spacing   +99 added lines, -99 removed lines patch added patch discarded remove patch
@@ -16,33 +16,33 @@  discard block
 block discarded – undo
16 16
 	* @param Array $filter the filter
17 17
 	* @return Array the SQL part
18 18
 	*/
19
-	public function getFilter($filter = array(),$where = false,$and = false) {
19
+	public function getFilter($filter = array(), $where = false, $and = false) {
20 20
 		global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver;
21 21
 		$filters = array();
22 22
 		if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) {
23 23
 			if (isset($globalStatsFilters[$globalFilterName][0]['source'])) {
24 24
 				$filters = $globalStatsFilters[$globalFilterName];
25 25
 			} else {
26
-				$filter = array_merge($filter,$globalStatsFilters[$globalFilterName]);
26
+				$filter = array_merge($filter, $globalStatsFilters[$globalFilterName]);
27 27
 			}
28 28
 		}
29 29
 		if (isset($filter[0]['source'])) {
30
-			$filters = array_merge($filters,$filter);
30
+			$filters = array_merge($filters, $filter);
31 31
 		}
32
-		if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter);
32
+		if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter);
33 33
 		$filter_query_join = '';
34 34
 		$filter_query_where = '';
35
-		foreach($filters as $flt) {
35
+		foreach ($filters as $flt) {
36 36
 			if (isset($flt['idents']) && !empty($flt['idents'])) {
37 37
 				if (isset($flt['source'])) {
38
-					$filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_output WHERE tracker_output.ident IN ('".implode("','",$flt['idents'])."') AND tracker_output.format_source IN ('".implode("','",$flt['source'])."')) spid ON spid.famtrackid = tracker_live.famtrackid";
38
+					$filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_output WHERE tracker_output.ident IN ('".implode("','", $flt['idents'])."') AND tracker_output.format_source IN ('".implode("','", $flt['source'])."')) spid ON spid.famtrackid = tracker_live.famtrackid";
39 39
 				} else {
40
-					$filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_output WHERE tracker_output.ident IN ('".implode("','",$flt['idents'])."')) spid ON spid.famtrackid = tracker_live.famtrackid";
40
+					$filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_output WHERE tracker_output.ident IN ('".implode("','", $flt['idents'])."')) spid ON spid.famtrackid = tracker_live.famtrackid";
41 41
 				}
42 42
 			}
43 43
 		}
44 44
 		if (isset($filter['source']) && !empty($filter['source'])) {
45
-			$filter_query_where .= " AND format_source IN ('".implode("','",$filter['source'])."')";
45
+			$filter_query_where .= " AND format_source IN ('".implode("','", $filter['source'])."')";
46 46
 		}
47 47
 		if (isset($filter['ident']) && !empty($filter['ident'])) {
48 48
 			$filter_query_where .= " AND ident = '".$filter['ident']."'";
@@ -71,15 +71,15 @@  discard block
 block discarded – undo
71 71
 					$filter_query_date .= " AND EXTRACT(DAY FROM tracker_output.date) = '".$filter['day']."'";
72 72
 				}
73 73
 			}
74
-			$filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_output".preg_replace('/^ AND/',' WHERE',$filter_query_date).") sd ON sd.famtrackid = tracker_live.famtrackid";
74
+			$filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_output".preg_replace('/^ AND/', ' WHERE', $filter_query_date).") sd ON sd.famtrackid = tracker_live.famtrackid";
75 75
 		}
76 76
 		if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
77
-			$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
77
+			$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')";
78 78
 		}
79 79
 		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
80 80
 		elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND';
81 81
 		if ($filter_query_where != '') {
82
-			$filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where);
82
+			$filter_query_where = preg_replace('/^ AND/', ' WHERE', $filter_query_where);
83 83
 		}
84 84
 		$filter_query = $filter_query_join.$filter_query_where;
85 85
 		return $filter_query;
@@ -102,8 +102,8 @@  discard block
 block discarded – undo
102 102
 		if ($limit != '')
103 103
 		{
104 104
 			$limit_array = explode(',', $limit);
105
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
106
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
105
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
106
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
107 107
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
108 108
 			{
109 109
 				$limit_query = ' LIMIT '.$limit_array[1].' OFFSET '.$limit_array[0];
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 		} else {
127 127
 			$query  = "SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= l.date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate".$filter_query.$orderby_query;
128 128
 		}
129
-		$spotter_array = $Tracker->getDataFromDB($query.$limit_query,array(),'',true);
129
+		$spotter_array = $Tracker->getDataFromDB($query.$limit_query, array(), '', true);
130 130
 
131 131
 		return $spotter_array;
132 132
 	}
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
 		global $globalDBdriver, $globalLiveInterval;
143 143
 		date_default_timezone_set('UTC');
144 144
 
145
-		$filter_query = $this->getFilter($filter,true,true);
145
+		$filter_query = $this->getFilter($filter, true, true);
146 146
 
147 147
 		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
148 148
 		if ($globalDBdriver == 'mysql') {
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
 		try {
161 161
 			$sth = $this->db->prepare($query);
162 162
 			$sth->execute();
163
-		} catch(PDOException $e) {
163
+		} catch (PDOException $e) {
164 164
 			echo $e->getMessage();
165 165
 			die;
166 166
 		}
@@ -180,12 +180,12 @@  discard block
 block discarded – undo
180 180
 		global $globalDBdriver, $globalLiveInterval, $globalArchive;
181 181
 		date_default_timezone_set('UTC');
182 182
 
183
-		$filter_query = $this->getFilter($filter,true,true);
183
+		$filter_query = $this->getFilter($filter, true, true);
184 184
 
185 185
 		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
186 186
 		if ($globalDBdriver == 'mysql') {
187 187
 			if (isset($globalArchive) && $globalArchive) {
188
-				$query  = "SELECT * FROM (
188
+				$query = "SELECT * FROM (
189 189
 					SELECT tracker_archive.ident, tracker_archive.famtrackid,tracker_archive.type,tracker_archive.latitude, tracker_archive.longitude, tracker_archive.altitude, tracker_archive.heading, tracker_archive.ground_speed, tracker_archive.date, tracker_archive.format_source 
190 190
 					FROM tracker_archive INNER JOIN (SELECT famtrackid FROM tracker_live".$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= tracker_live.date) l ON l.famtrackid = tracker_archive.famtrackid 
191 191
 				    UNION
@@ -195,14 +195,14 @@  discard block
 block discarded – undo
195 195
 				    WHERE latitude <> '0' AND longitude <> '0' 
196 196
 				    ORDER BY famtrackid, date";
197 197
 			} else {
198
-				$query  = 'SELECT tracker_live.ident, tracker_live.famtrackid,tracker_live.type, tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source 
198
+				$query = 'SELECT tracker_live.ident, tracker_live.famtrackid,tracker_live.type, tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source 
199 199
 				    FROM tracker_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= tracker_live.date 
200 200
 				    AND tracker_live.latitude <> '0' AND tracker_live.longitude <> '0' 
201 201
 				    ORDER BY tracker_live.famtrackid, tracker_live.date";
202 202
 			}
203 203
 		} else {
204 204
 			if (isset($globalArchive) && $globalArchive) {
205
-				$query  = "SELECT * FROM (
205
+				$query = "SELECT * FROM (
206 206
 					SELECT tracker_archive.ident, tracker_archive.famtrackid,tracker_archive.type,tracker_archive.latitude, tracker_archive.longitude, tracker_archive.altitude, tracker_archive.heading, tracker_archive.ground_speed, tracker_archive.date, tracker_archive.format_source 
207 207
 					FROM tracker_archive INNER JOIN (SELECT famtrackid FROM tracker_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= tracker_live.date) l ON l.famtrackid = tracker_archive.famtrackid 
208 208
 				    UNION
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
 				    WHERE latitude <> '0' AND longitude <> '0' 
213 213
 				    ORDER BY famtrackid, date";
214 214
 			} else {
215
-				$query  = "SELECT tracker_live.ident, tracker_live.famtrackid, tracker_live.type,tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source 
215
+				$query = "SELECT tracker_live.ident, tracker_live.famtrackid, tracker_live.type,tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source 
216 216
 				    FROM tracker_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= tracker_live.date AND tracker_live.latitude <> '0' AND tracker_live.longitude <> '0' 
217 217
 				    ORDER BY tracker_live.famtrackid, tracker_live.date";
218 218
 			}
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
 		try {
222 222
 			$sth = $this->db->prepare($query);
223 223
 			$sth->execute();
224
-		} catch(PDOException $e) {
224
+		} catch (PDOException $e) {
225 225
 			echo $e->getMessage();
226 226
 			die;
227 227
 		}
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
 	public function getLiveTrackerCount($filter = array())
239 239
 	{
240 240
 		global $globalDBdriver, $globalLiveInterval;
241
-		$filter_query = $this->getFilter($filter,true,true);
241
+		$filter_query = $this->getFilter($filter, true, true);
242 242
 
243 243
 		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
244 244
 		if ($globalDBdriver == 'mysql') {
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
 		try {
250 250
 			$sth = $this->db->prepare($query);
251 251
 			$sth->execute();
252
-		} catch(PDOException $e) {
252
+		} catch (PDOException $e) {
253 253
 			echo $e->getMessage();
254 254
 			die;
255 255
 		}
@@ -272,10 +272,10 @@  discard block
 block discarded – undo
272 272
 		$filter_query = $this->getFilter($filter);
273 273
 
274 274
 		if (is_array($coord)) {
275
-			$minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
276
-			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
277
-			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
278
-			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
275
+			$minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
276
+			$minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
277
+			$maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
278
+			$maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
279 279
 		} else return array();
280 280
 		if ($globalDBdriver == 'mysql') {
281 281
 			$query  = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate AND tracker_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND tracker_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.' GROUP BY tracker_live.famtrackid'.$filter_query;
@@ -300,17 +300,17 @@  discard block
 block discarded – undo
300 300
 		$filter_query = $this->getFilter($filter);
301 301
 
302 302
 		if (is_array($coord)) {
303
-			$minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
304
-			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
305
-			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
306
-			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
303
+			$minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
304
+			$minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
305
+			$maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
306
+			$maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
307 307
 		} else return array();
308 308
 		if ($globalDBdriver == 'mysql') {
309 309
 			$query  = 'SELECT tracker_live.ident, tracker_live.famtrackid,tracker_live.type, tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source 
310 310
 			FROM tracker_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= tracker_live.date AND tracker_live.latitude <> '0' AND tracker_live.longitude <> '0' AND tracker_live.latitude BETWEEN ".$minlat.' AND '.$maxlat.' AND tracker_live.longitude BETWEEN '.$minlong.' AND '.$maxlong."
311 311
 			ORDER BY tracker_live.famtrackid, tracker_live.date";
312 312
 		} else {
313
-			$query  = "SELECT tracker_live.ident, tracker_live.type,tracker_live.famtrackid, tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source 
313
+			$query = "SELECT tracker_live.ident, tracker_live.type,tracker_live.famtrackid, tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source 
314 314
 			FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= l.date l.latitude BETWEEN ".$minlat." AND ".$maxlat." AND l.longitude BETWEEN ".$minlong." AND ".$maxlong." GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate".$filter_query." tracker_live.latitude <> '0' AND tracker_live.longitude <> '0'";
315 315
 		}
316 316
 		$spotter_array = $Spotter->getDataFromDB($query);
@@ -358,7 +358,7 @@  discard block
 block discarded – undo
358 358
                 if ($interval == '1m')
359 359
                 {
360 360
                     $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= tracker_live.date ';
361
-                } else if ($interval == '15m'){
361
+                } else if ($interval == '15m') {
362 362
                     $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= tracker_live.date ';
363 363
                 } 
364 364
             }
@@ -366,14 +366,14 @@  discard block
 block discarded – undo
366 366
          $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= tracker_live.date ';   
367 367
         }
368 368
 
369
-                $query  = "SELECT tracker_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM tracker_live 
369
+                $query = "SELECT tracker_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM tracker_live 
370 370
                    WHERE tracker_live.latitude <> '' 
371 371
                                    AND tracker_live.longitude <> '' 
372 372
                    ".$additional_query."
373 373
                    HAVING distance < :radius  
374 374
                                    ORDER BY distance";
375 375
 
376
-                $spotter_array = $Tracker->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius));
376
+                $spotter_array = $Tracker->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng, ':radius' => $radius));
377 377
 
378 378
                 return $spotter_array;
379 379
         }
@@ -391,9 +391,9 @@  discard block
 block discarded – undo
391 391
 		date_default_timezone_set('UTC');
392 392
 
393 393
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
394
-                $query  = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.ident = :ident GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC';
394
+                $query = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.ident = :ident GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC';
395 395
 
396
-		$spotter_array = $Tracker->getDataFromDB($query,array(':ident' => $ident),'',true);
396
+		$spotter_array = $Tracker->getDataFromDB($query, array(':ident' => $ident), '', true);
397 397
 
398 398
 		return $spotter_array;
399 399
 	}
@@ -404,16 +404,16 @@  discard block
 block discarded – undo
404 404
 	* @return Array the spotter information
405 405
 	*
406 406
 	*/
407
-	public function getDateLiveTrackerDataByIdent($ident,$date)
407
+	public function getDateLiveTrackerDataByIdent($ident, $date)
408 408
 	{
409 409
 		$Tracker = new Tracker($this->db);
410 410
 		date_default_timezone_set('UTC');
411 411
 
412 412
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
413
-                $query  = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC';
413
+                $query = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC';
414 414
 
415
-                $date = date('c',$date);
416
-		$spotter_array = $Tracker->getDataFromDB($query,array(':ident' => $ident,':date' => $date));
415
+                $date = date('c', $date);
416
+		$spotter_array = $Tracker->getDataFromDB($query, array(':ident' => $ident, ':date' => $date));
417 417
 
418 418
 		return $spotter_array;
419 419
 	}
@@ -430,9 +430,9 @@  discard block
 block discarded – undo
430 430
 		date_default_timezone_set('UTC');
431 431
 
432 432
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
433
-                $query  = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.famtrackid = :id GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC';
433
+                $query = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.famtrackid = :id GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC';
434 434
 
435
-		$spotter_array = $Tracker->getDataFromDB($query,array(':id' => $id),'',true);
435
+		$spotter_array = $Tracker->getDataFromDB($query, array(':id' => $id), '', true);
436 436
 
437 437
 		return $spotter_array;
438 438
 	}
@@ -443,15 +443,15 @@  discard block
 block discarded – undo
443 443
 	* @return Array the spotter information
444 444
 	*
445 445
 	*/
446
-	public function getDateLiveTrackerDataById($id,$date)
446
+	public function getDateLiveTrackerDataById($id, $date)
447 447
 	{
448 448
 		$Tracker = new Tracker($this->db);
449 449
 		date_default_timezone_set('UTC');
450 450
 
451 451
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
452
-                $query  = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.famtrackid = :id AND l.date <= :date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC';
453
-                $date = date('c',$date);
454
-		$spotter_array = $Tracker->getDataFromDB($query,array(':id' => $id,':date' => $date),'',true);
452
+                $query = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.famtrackid = :id AND l.date <= :date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC';
453
+                $date = date('c', $date);
454
+		$spotter_array = $Tracker->getDataFromDB($query, array(':id' => $id, ':date' => $date), '', true);
455 455
 
456 456
 		return $spotter_array;
457 457
 	}
@@ -468,13 +468,13 @@  discard block
 block discarded – undo
468 468
 		date_default_timezone_set('UTC');
469 469
 
470 470
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
471
-                $query  = 'SELECT tracker_live.altitude, tracker_live.date FROM tracker_live WHERE tracker_live.ident = :ident';
471
+                $query = 'SELECT tracker_live.altitude, tracker_live.date FROM tracker_live WHERE tracker_live.ident = :ident';
472 472
 
473 473
     		try {
474 474
 			
475 475
 			$sth = $this->db->prepare($query);
476 476
 			$sth->execute(array(':ident' => $ident));
477
-		} catch(PDOException $e) {
477
+		} catch (PDOException $e) {
478 478
 			echo $e->getMessage();
479 479
 			die;
480 480
 		}
@@ -489,7 +489,7 @@  discard block
 block discarded – undo
489 489
 	* @return Array the spotter information
490 490
 	*
491 491
 	*/
492
-	public function getAllLiveTrackerDataById($id,$liveinterval = false)
492
+	public function getAllLiveTrackerDataById($id, $liveinterval = false)
493 493
 	{
494 494
 		global $globalDBdriver, $globalLiveInterval;
495 495
 		date_default_timezone_set('UTC');
@@ -508,7 +508,7 @@  discard block
 block discarded – undo
508 508
 		try {
509 509
 			$sth = $this->db->prepare($query);
510 510
 			$sth->execute(array(':id' => $id));
511
-		} catch(PDOException $e) {
511
+		} catch (PDOException $e) {
512 512
 			echo $e->getMessage();
513 513
 			die;
514 514
 		}
@@ -526,12 +526,12 @@  discard block
 block discarded – undo
526 526
 	{
527 527
 		date_default_timezone_set('UTC');
528 528
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
529
-		$query  = self::$global_query.' WHERE tracker_live.ident = :ident';
529
+		$query = self::$global_query.' WHERE tracker_live.ident = :ident';
530 530
     		try {
531 531
 			
532 532
 			$sth = $this->db->prepare($query);
533 533
 			$sth->execute(array(':ident' => $ident));
534
-		} catch(PDOException $e) {
534
+		} catch (PDOException $e) {
535 535
 			echo $e->getMessage();
536 536
 			die;
537 537
 		}
@@ -561,7 +561,7 @@  discard block
 block discarded – undo
561 561
 			
562 562
 			$sth = $this->db->prepare($query);
563 563
 			$sth->execute();
564
-		} catch(PDOException $e) {
564
+		} catch (PDOException $e) {
565 565
 			return "error";
566 566
 		}
567 567
 
@@ -584,14 +584,14 @@  discard block
 block discarded – undo
584 584
 				
585 585
 				$sth = $this->db->prepare($query);
586 586
 				$sth->execute();
587
-			} catch(PDOException $e) {
587
+			} catch (PDOException $e) {
588 588
 				return "error";
589 589
 			}
590 590
 			$query_delete = 'DELETE FROM tracker_live WHERE famtrackid IN (';
591 591
                         $i = 0;
592
-                        $j =0;
592
+                        $j = 0;
593 593
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
594
-			foreach($all as $row)
594
+			foreach ($all as $row)
595 595
 			{
596 596
 				$i++;
597 597
 				$j++;
@@ -599,9 +599,9 @@  discard block
 block discarded – undo
599 599
 					if ($globalDebug) echo ".";
600 600
 				    	try {
601 601
 						
602
-						$sth = $this->db->prepare(substr($query_delete,0,-1).")");
602
+						$sth = $this->db->prepare(substr($query_delete, 0, -1).")");
603 603
 						$sth->execute();
604
-					} catch(PDOException $e) {
604
+					} catch (PDOException $e) {
605 605
 						return "error";
606 606
 					}
607 607
                                 	$query_delete = 'DELETE FROM tracker_live WHERE famtrackid IN (';
@@ -612,9 +612,9 @@  discard block
 block discarded – undo
612 612
 			if ($i > 0) {
613 613
     				try {
614 614
 					
615
-					$sth = $this->db->prepare(substr($query_delete,0,-1).")");
615
+					$sth = $this->db->prepare(substr($query_delete, 0, -1).")");
616 616
 					$sth->execute();
617
-				} catch(PDOException $e) {
617
+				} catch (PDOException $e) {
618 618
 					return "error";
619 619
 				}
620 620
 			}
@@ -627,7 +627,7 @@  discard block
 block discarded – undo
627 627
 				
628 628
 				$sth = $this->db->prepare($query);
629 629
 				$sth->execute();
630
-			} catch(PDOException $e) {
630
+			} catch (PDOException $e) {
631 631
 				return "error";
632 632
 			}
633 633
 /*			$query_delete = "DELETE FROM tracker_live WHERE famtrackid IN (";
@@ -675,13 +675,13 @@  discard block
 block discarded – undo
675 675
 	public function deleteLiveTrackerDataByIdent($ident)
676 676
 	{
677 677
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
678
-		$query  = 'DELETE FROM tracker_live WHERE ident = :ident';
678
+		$query = 'DELETE FROM tracker_live WHERE ident = :ident';
679 679
         
680 680
     		try {
681 681
 			
682 682
 			$sth = $this->db->prepare($query);
683 683
 			$sth->execute(array(':ident' => $ident));
684
-		} catch(PDOException $e) {
684
+		} catch (PDOException $e) {
685 685
 			return "error";
686 686
 		}
687 687
 
@@ -697,13 +697,13 @@  discard block
 block discarded – undo
697 697
 	public function deleteLiveTrackerDataById($id)
698 698
 	{
699 699
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
700
-		$query  = 'DELETE FROM tracker_live WHERE famtrackid = :id';
700
+		$query = 'DELETE FROM tracker_live WHERE famtrackid = :id';
701 701
         
702 702
     		try {
703 703
 			
704 704
 			$sth = $this->db->prepare($query);
705 705
 			$sth->execute(array(':id' => $id));
706
-		} catch(PDOException $e) {
706
+		} catch (PDOException $e) {
707 707
 			return "error";
708 708
 		}
709 709
 
@@ -721,13 +721,13 @@  discard block
 block discarded – undo
721 721
 	{
722 722
 		global $globalDBdriver, $globalTimezone;
723 723
 		if ($globalDBdriver == 'mysql') {
724
-			$query  = 'SELECT tracker_live.ident FROM tracker_live 
724
+			$query = 'SELECT tracker_live.ident FROM tracker_live 
725 725
 				WHERE tracker_live.ident = :ident 
726 726
 				AND tracker_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) 
727 727
 				AND tracker_live.date < UTC_TIMESTAMP()';
728 728
 			$query_data = array(':ident' => $ident);
729 729
 		} else {
730
-			$query  = "SELECT tracker_live.ident FROM tracker_live 
730
+			$query = "SELECT tracker_live.ident FROM tracker_live 
731 731
 				WHERE tracker_live.ident = :ident 
732 732
 				AND tracker_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS'
733 733
 				AND tracker_live.date < now() AT TIME ZONE 'UTC'";
@@ -736,8 +736,8 @@  discard block
 block discarded – undo
736 736
 		
737 737
 		$sth = $this->db->prepare($query);
738 738
 		$sth->execute($query_data);
739
-		$ident_result='';
740
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
739
+		$ident_result = '';
740
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
741 741
 		{
742 742
 			$ident_result = $row['ident'];
743 743
 		}
@@ -754,13 +754,13 @@  discard block
 block discarded – undo
754 754
 	{
755 755
 		global $globalDBdriver, $globalTimezone;
756 756
 		if ($globalDBdriver == 'mysql') {
757
-			$query  = 'SELECT tracker_live.ident, tracker_live.famtrackid FROM tracker_live 
757
+			$query = 'SELECT tracker_live.ident, tracker_live.famtrackid FROM tracker_live 
758 758
 				WHERE tracker_live.ident = :ident 
759 759
 				AND tracker_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE)'; 
760 760
 //				AND tracker_live.date < UTC_TIMESTAMP()";
761 761
 			$query_data = array(':ident' => $ident);
762 762
 		} else {
763
-			$query  = "SELECT tracker_live.ident, tracker_live.famtrackid FROM tracker_live 
763
+			$query = "SELECT tracker_live.ident, tracker_live.famtrackid FROM tracker_live 
764 764
 				WHERE tracker_live.ident = :ident 
765 765
 				AND tracker_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '30 MINUTES'";
766 766
 //				AND tracker_live.date < now() AT TIME ZONE 'UTC'";
@@ -769,8 +769,8 @@  discard block
 block discarded – undo
769 769
 		
770 770
 		$sth = $this->db->prepare($query);
771 771
 		$sth->execute($query_data);
772
-		$ident_result='';
773
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
772
+		$ident_result = '';
773
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
774 774
 		{
775 775
 			$ident_result = $row['famtrackid'];
776 776
 		}
@@ -787,13 +787,13 @@  discard block
 block discarded – undo
787 787
 	{
788 788
 		global $globalDBdriver, $globalTimezone;
789 789
 		if ($globalDBdriver == 'mysql') {
790
-			$query  = 'SELECT tracker_live.ident, tracker_live.famtrackid FROM tracker_live 
790
+			$query = 'SELECT tracker_live.ident, tracker_live.famtrackid FROM tracker_live 
791 791
 				WHERE tracker_live.famtrackid = :id 
792 792
 				AND tracker_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 10 HOUR)'; 
793 793
 //				AND tracker_live.date < UTC_TIMESTAMP()";
794 794
 			$query_data = array(':id' => $id);
795 795
 		} else {
796
-			$query  = "SELECT tracker_live.ident, tracker_live.famtrackid FROM tracker_live 
796
+			$query = "SELECT tracker_live.ident, tracker_live.famtrackid FROM tracker_live 
797 797
 				WHERE tracker_live.famtrackid = :id 
798 798
 				AND tracker_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '10 HOUR'";
799 799
 //				AND tracker_live.date < now() AT TIME ZONE 'UTC'";
@@ -802,8 +802,8 @@  discard block
 block discarded – undo
802 802
 		
803 803
 		$sth = $this->db->prepare($query);
804 804
 		$sth->execute($query_data);
805
-		$ident_result='';
806
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
805
+		$ident_result = '';
806
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
807 807
 		{
808 808
 			$ident_result = $row['famtrackid'];
809 809
 		}
@@ -821,7 +821,7 @@  discard block
 block discarded – undo
821 821
 	* @return String success or false
822 822
 	*
823 823
 	*/
824
-	public function addLiveTrackerData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $putinarchive = false, $comment = '', $type = '',$noarchive = false,$format_source = '', $source_name = '', $over_country = '')
824
+	public function addLiveTrackerData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $putinarchive = false, $comment = '', $type = '', $noarchive = false, $format_source = '', $source_name = '', $over_country = '')
825 825
 	{
826 826
 		global $globalURL, $globalArchive, $globalDebug;
827 827
 		$Common = new Common();
@@ -880,21 +880,21 @@  discard block
 block discarded – undo
880 880
 		if ($date == '') $date = date("Y-m-d H:i:s", time());
881 881
 
882 882
         
883
-		$famtrackid = filter_var($famtrackid,FILTER_SANITIZE_STRING);
884
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
885
-		$latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
886
-		$longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
887
-		$altitude = filter_var($altitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
888
-		$heading = filter_var($heading,FILTER_SANITIZE_NUMBER_INT);
889
-		$groundspeed = filter_var($groundspeed,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
890
-		$format_source = filter_var($format_source,FILTER_SANITIZE_STRING);
891
-		$source_name = filter_var($source_name,FILTER_SANITIZE_STRING);
892
-		$over_country = filter_var($over_country,FILTER_SANITIZE_STRING);
893
-		$comment = filter_var($comment,FILTER_SANITIZE_STRING);
894
-		$type = filter_var($type,FILTER_SANITIZE_STRING);
895
-
896
-            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
897
-            	if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
883
+		$famtrackid = filter_var($famtrackid, FILTER_SANITIZE_STRING);
884
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
885
+		$latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
886
+		$longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
887
+		$altitude = filter_var($altitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
888
+		$heading = filter_var($heading, FILTER_SANITIZE_NUMBER_INT);
889
+		$groundspeed = filter_var($groundspeed, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
890
+		$format_source = filter_var($format_source, FILTER_SANITIZE_STRING);
891
+		$source_name = filter_var($source_name, FILTER_SANITIZE_STRING);
892
+		$over_country = filter_var($over_country, FILTER_SANITIZE_STRING);
893
+		$comment = filter_var($comment, FILTER_SANITIZE_STRING);
894
+		$type = filter_var($type, FILTER_SANITIZE_STRING);
895
+
896
+            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
897
+            	if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
898 898
             	
899 899
 		$query = '';
900 900
 		if ($globalArchive) {
@@ -904,12 +904,12 @@  discard block
 block discarded – undo
904 904
 		$query  .= 'INSERT INTO tracker_live (famtrackid, ident, latitude, longitude, altitude, heading, ground_speed, date, format_source, source_name, over_country, comment, type) 
905 905
 		VALUES (:famtrackid,:ident,:latitude,:longitude,:altitude,:heading,:groundspeed,:date,:format_source, :source_name, :over_country,:comment,:type)';
906 906
 
907
-		$query_values = array(':famtrackid' => $famtrackid,':ident' => $ident,':latitude' => $latitude,':longitude' => $longitude,':altitude' => $altitude,':heading' => $heading,':groundspeed' => $groundspeed,':date' => $date, ':format_source' => $format_source, ':source_name' => $source_name, ':over_country' => $over_country,':comment' => $comment,':type' => $type);
907
+		$query_values = array(':famtrackid' => $famtrackid, ':ident' => $ident, ':latitude' => $latitude, ':longitude' => $longitude, ':altitude' => $altitude, ':heading' => $heading, ':groundspeed' => $groundspeed, ':date' => $date, ':format_source' => $format_source, ':source_name' => $source_name, ':over_country' => $over_country, ':comment' => $comment, ':type' => $type);
908 908
 		try {
909 909
 			
910 910
 			$sth = $this->db->prepare($query);
911 911
 			$sth->execute($query_values);
912
-                } catch(PDOException $e) {
912
+                } catch (PDOException $e) {
913 913
                 	return "error : ".$e->getMessage();
914 914
                 }
915 915
                 /*
@@ -919,7 +919,7 @@  discard block
 block discarded – undo
919 919
 		if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) {
920 920
 		    if ($globalDebug) echo '(Add to Tracker archive '.$famtrackid.' : ';
921 921
 		    $TrackerArchive = new TrackerArchive($this->db);
922
-		    $result =  $TrackerArchive->addTrackerArchiveData($famtrackid, $ident,$latitude, $longitude, $altitude, $heading, $groundspeed, $date, $putinarchive, $comment, $type,$noarchive,$format_source, $source_name, $over_country);
922
+		    $result = $TrackerArchive->addTrackerArchiveData($famtrackid, $ident, $latitude, $longitude, $altitude, $heading, $groundspeed, $date, $putinarchive, $comment, $type, $noarchive, $format_source, $source_name, $over_country);
923 923
 		    if ($globalDebug) echo $result.')';
924 924
 		}
925 925
 
@@ -929,7 +929,7 @@  discard block
 block discarded – undo
929 929
 
930 930
 	public function getOrderBy()
931 931
 	{
932
-		$orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY tracker_live.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY tracker_live.aircraft_icao DESC"),"manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY tracker_live.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY tracker_live.aircraft_manufacturer DESC"),"airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY tracker_live.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY tracker_live.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY tracker_live.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY tracker_live.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY tracker_live.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY tracker_live.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY tracker_live.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY tracker_live.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY tracker_live.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY tracker_live.date DESC"));
932
+		$orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY tracker_live.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY tracker_live.aircraft_icao DESC"), "manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY tracker_live.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY tracker_live.aircraft_manufacturer DESC"), "airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY tracker_live.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY tracker_live.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY tracker_live.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY tracker_live.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY tracker_live.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY tracker_live.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY tracker_live.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY tracker_live.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY tracker_live.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY tracker_live.date DESC"));
933 933
 		return $orderby;
934 934
 	}
935 935
 
Please login to merge, or discard this patch.
require/class.TrackerImport.php 1 patch
Spacing   +74 added lines, -74 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 	    if (isset($this->all_tracked[$key]['id'])) {
48 48
 		//echo $this->all_tracked[$key]['id'].' - '.$this->all_tracked[$key]['latitude'].'  '.$this->all_tracked[$key]['longitude']."\n";
49 49
     		$Tracker = new Tracker($this->db);
50
-        	$Tracker->updateLatestTrackerData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['altitude'],$this->all_tracked[$key]['speed'],$this->all_tracked[$key]['datetime']);
50
+        	$Tracker->updateLatestTrackerData($this->all_tracked[$key]['id'], $this->all_tracked[$key]['ident'], $this->all_tracked[$key]['latitude'], $this->all_tracked[$key]['longitude'], $this->all_tracked[$key]['altitude'], $this->all_tracked[$key]['speed'], $this->all_tracked[$key]['datetime']);
51 51
             }
52 52
 	}
53 53
     }
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 	if ($globalDebug) echo 'Delete old values and update latest data...'."\n";
59 59
 	foreach ($this->all_tracked as $key => $flight) {
60 60
     	    if (isset($flight['lastupdate'])) {
61
-        	if ($flight['lastupdate'] < (time()-3000)) {
61
+        	if ($flight['lastupdate'] < (time() - 3000)) {
62 62
             	    if (isset($this->all_tracked[$key]['id'])) {
63 63
             		if ($globalDebug) echo "--- Delete old values with id ".$this->all_tracked[$key]['id']."\n";
64 64
 			/*
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
             		//$real_arrival = $this->arrival($key);
70 70
             		$Tracker = new Tracker($this->db);
71 71
             		if ($this->all_tracked[$key]['latitude'] != '' && $this->all_tracked[$key]['longitude'] != '') {
72
-				$result = $Tracker->updateLatestTrackerData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['altitude'],$this->all_tracked[$key]['speed']);
72
+				$result = $Tracker->updateLatestTrackerData($this->all_tracked[$key]['id'], $this->all_tracked[$key]['ident'], $this->all_tracked[$key]['latitude'], $this->all_tracked[$key]['longitude'], $this->all_tracked[$key]['altitude'], $this->all_tracked[$key]['speed']);
73 73
 				if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n";
74 74
 			}
75 75
 			// Put in archive
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
 	$send = false;
90 90
 	
91 91
 	// SBS format is CSV format
92
-	if(is_array($line) && isset($line['ident'])) {
92
+	if (is_array($line) && isset($line['ident'])) {
93 93
 	    //print_r($line);
94 94
   	    if (isset($line['ident'])) {
95 95
 
@@ -113,33 +113,33 @@  discard block
 block discarded – undo
113 113
 		
114 114
 		if (!isset($this->all_tracked[$id])) {
115 115
 		    $this->all_tracked[$id] = array();
116
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('addedTracker' => 0));
117
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => '','latitude' => '', 'longitude' => '', 'speed' => '', 'altitude' => '', 'heading' => '', 'format_source' => '','source_name' => '','comment'=> '','type' => '','noarchive' => false,'putinarchive' => true,'over_country' => ''));
118
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('lastupdate' => time()));
116
+		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('addedTracker' => 0));
117
+		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('ident' => '', 'latitude' => '', 'longitude' => '', 'speed' => '', 'altitude' => '', 'heading' => '', 'format_source' => '', 'source_name' => '', 'comment'=> '', 'type' => '', 'noarchive' => false, 'putinarchive' => true, 'over_country' => ''));
118
+		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('lastupdate' => time()));
119 119
 		    if (!isset($line['id'])) {
120 120
 			if (!isset($globalDaemon)) $globalDaemon = TRUE;
121
-			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $id.'-'.date('YmdHi')));
122
-		     } else $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $line['id']));
121
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('id' => $id.'-'.date('YmdHi')));
122
+		     } else $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('id' => $line['id']));
123 123
 		    if ($globalAllTracked !== FALSE) $dataFound = true;
124 124
 		}
125 125
 		
126
-		if (isset($line['datetime']) && strtotime($line['datetime']) > time()-20*60 && strtotime($line['datetime']) < time()+20*60) {
126
+		if (isset($line['datetime']) && strtotime($line['datetime']) > time() - 20*60 && strtotime($line['datetime']) < time() + 20*60) {
127 127
 		    if (!isset($this->all_tracked[$id]['datetime']) || strtotime($line['datetime']) >= strtotime($this->all_tracked[$id]['datetime'])) {
128
-			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('datetime' => $line['datetime']));
128
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('datetime' => $line['datetime']));
129 129
 		    } else {
130 130
 				if (strtotime($line['datetime']) == strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) echo "!!! Date is the same as previous data for ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."\n";
131 131
 				elseif (strtotime($line['datetime']) > strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) echo "!!! Date previous latest data (".$line['datetime']." > ".$this->all_tracked[$id]['datetime'].") !!! for ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."\n";
132 132
 				return '';
133 133
 		    }
134
-		} elseif (isset($line['datetime']) && strtotime($line['datetime']) < time()-20*60) {
134
+		} elseif (isset($line['datetime']) && strtotime($line['datetime']) < time() - 20*60) {
135 135
 			if ($globalDebug) echo "!!! Date is too old ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."!!!\n";
136 136
 			return '';
137
-		} elseif (isset($line['datetime']) && strtotime($line['datetime']) > time()+20*60) {
137
+		} elseif (isset($line['datetime']) && strtotime($line['datetime']) > time() + 20*60) {
138 138
 			if ($globalDebug) echo "!!! Date is in the future ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."!!!\n";
139 139
 			return '';
140 140
 		} elseif (!isset($line['datetime'])) {
141 141
 			date_default_timezone_set('UTC');
142
-			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('datetime' => date('Y-m-d H:i:s')));
142
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('datetime' => date('Y-m-d H:i:s')));
143 143
 		} else {
144 144
 			if ($globalDebug) echo "!!! Unknow date error ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."!!!\n";
145 145
 			return '';
@@ -147,38 +147,38 @@  discard block
 block discarded – undo
147 147
 		
148 148
 		//if (isset($line['ident']) && $line['ident'] != '' && $line['ident'] != '????????' && $line['ident'] != '00000000' && ($this->all_tracked[$id]['ident'] != trim($line['ident'])) && preg_match('/^[a-zA-Z0-9-]+$/', $line['ident'])) {
149 149
 		if (isset($line['ident']) && $line['ident'] != '' && $line['ident'] != '????????' && $line['ident'] != '00000000' && ($this->all_tracked[$id]['ident'] != trim($line['ident']))) {
150
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => trim($line['ident'])));
150
+		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('ident' => trim($line['ident'])));
151 151
 		    if ($this->all_tracked[$id]['addedTracker'] == 1) {
152 152
 			$timeelapsed = microtime(true);
153 153
             		$Tracker = new Tracker($this->db);
154 154
             		$fromsource = NULL;
155
-            		$result = $Tracker->updateIdentTrackerData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['ident'],$fromsource);
155
+            		$result = $Tracker->updateIdentTrackerData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $fromsource);
156 156
 			if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n";
157 157
 			$Tracker->db = null;
158
-			if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
158
+			if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
159 159
 		    }
160
-		    if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident']));
160
+		    if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('id' => $this->all_tracked[$id]['ident']));
161 161
 		}
162 162
 
163 163
 		if (isset($line['speed']) && $line['speed'] != '') {
164
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($line['speed'])));
165
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed_fromsrc' => true));
164
+		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('speed' => round($line['speed'])));
165
+		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('speed_fromsrc' => true));
166 166
 		} else if (!isset($this->all_tracked[$id]['speed_fromsrc']) && isset($this->all_tracked[$id]['time_last_coord']) && $this->all_tracked[$id]['time_last_coord'] != time() && isset($line['latitude']) && isset($line['longitude'])) {
167
-		    $distance = $Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m');
167
+		    $distance = $Common->distance($line['latitude'], $line['longitude'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], 'm');
168 168
 		    if ($distance > 100 && $distance < 10000) {
169 169
 			$speed = $distance/(time() - $this->all_tracked[$id]['time_last_coord']);
170 170
 			$speed = $speed*3.6;
171
-			if ($speed < 1000) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($speed)));
171
+			if ($speed < 1000) $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('speed' => round($speed)));
172 172
   			if ($globalDebug) echo "ø Calculated Speed for ".$this->all_tracked[$id]['ident']." : ".$speed." - distance : ".$distance."\n";
173 173
 		    }
174 174
 		}
175 175
 
176 176
 	        if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) {
177
-	    	    if (isset($this->all_tracked[$id]['time_last_coord'])) $timediff = round(time()-$this->all_tracked[$id]['time_last_coord']);
177
+	    	    if (isset($this->all_tracked[$id]['time_last_coord'])) $timediff = round(time() - $this->all_tracked[$id]['time_last_coord']);
178 178
 	    	    else unset($timediff);
179
-	    	    if ($this->tmd > 5 || !isset($timediff) || $timediff > 100 || ($timediff > 30 && isset($this->all_tracked[$id]['latitude']) && isset($this->all_tracked[$id]['longitude']) && $Common->withinThreshold($timediff,$Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')))) {
179
+	    	    if ($this->tmd > 5 || !isset($timediff) || $timediff > 100 || ($timediff > 30 && isset($this->all_tracked[$id]['latitude']) && isset($this->all_tracked[$id]['longitude']) && $Common->withinThreshold($timediff, $Common->distance($line['latitude'], $line['longitude'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], 'm')))) {
180 180
 			if (isset($this->all_tracked[$id]['archive_latitude']) && isset($this->all_tracked[$id]['archive_longitude']) && isset($this->all_tracked[$id]['livedb_latitude']) && isset($this->all_tracked[$id]['livedb_longitude'])) {
181
-			    if (!$Common->checkLine($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['livedb_latitude'],$this->all_tracked[$id]['livedb_longitude'],$line['latitude'],$line['longitude'],0.1)) {
181
+			    if (!$Common->checkLine($this->all_tracked[$id]['archive_latitude'], $this->all_tracked[$id]['archive_longitude'], $this->all_tracked[$id]['livedb_latitude'], $this->all_tracked[$id]['livedb_longitude'], $line['latitude'], $line['longitude'], 0.1)) {
182 182
 				$this->all_tracked[$id]['archive_latitude'] = $line['latitude'];
183 183
 				$this->all_tracked[$id]['archive_longitude'] = $line['longitude'];
184 184
 				$this->all_tracked[$id]['putinarchive'] = true;
@@ -186,10 +186,10 @@  discard block
 block discarded – undo
186 186
 				if ($globalDebug) echo "\n".' ------- Check Country for '.$this->all_tracked[$id]['ident'].' with latitude : '.$line['latitude'].' and longitude : '.$line['longitude'].'.... ';
187 187
 				$timeelapsed = microtime(true);
188 188
 				$Tracker = new Tracker($this->db);
189
-				$all_country = $Tracker->getCountryFromLatitudeLongitude($line['latitude'],$line['longitude']);
189
+				$all_country = $Tracker->getCountryFromLatitudeLongitude($line['latitude'], $line['longitude']);
190 190
 				if (!empty($all_country)) $this->all_tracked[$id]['over_country'] = $all_country['iso2'];
191 191
 				$Tracker->db = null;
192
-				if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
192
+				if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
193 193
 				$this->tmd = 0;
194 194
 				if ($globalDebug) echo 'FOUND : '.$this->all_tracked[$id]['over_country'].' ---------------'."\n";
195 195
 			    }
@@ -197,75 +197,75 @@  discard block
 block discarded – undo
197 197
 
198 198
 			if (isset($line['latitude']) && $line['latitude'] != '' && $line['latitude'] != 0 && $line['latitude'] < 91 && $line['latitude'] > -90) {
199 199
 				if (!isset($this->all_tracked[$id]['archive_latitude'])) $this->all_tracked[$id]['archive_latitude'] = $line['latitude'];
200
-				if (!isset($this->all_tracked[$id]['livedb_latitude']) || abs($this->all_tracked[$id]['livedb_latitude']-$line['latitude']) > $globalCoordMinChangeTracker || $this->all_tracked[$id]['format_source'] == 'aprs') {
200
+				if (!isset($this->all_tracked[$id]['livedb_latitude']) || abs($this->all_tracked[$id]['livedb_latitude'] - $line['latitude']) > $globalCoordMinChangeTracker || $this->all_tracked[$id]['format_source'] == 'aprs') {
201 201
 				    $this->all_tracked[$id]['livedb_latitude'] = $line['latitude'];
202 202
 				    $dataFound = true;
203 203
 				    $this->all_tracked[$id]['time_last_coord'] = time();
204 204
 				}
205
-				$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('latitude' => $line['latitude']));
205
+				$this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('latitude' => $line['latitude']));
206 206
 			}
207 207
 			if (isset($line['longitude']) && $line['longitude'] != '' && $line['longitude'] != 0 && $line['longitude'] < 360 && $line['longitude'] > -180) {
208 208
 			    if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360;
209 209
 				if (!isset($this->all_tracked[$id]['archive_longitude'])) $this->all_tracked[$id]['archive_longitude'] = $line['longitude'];
210
-				if (!isset($this->all_tracked[$id]['livedb_longitude']) || abs($this->all_tracked[$id]['livedb_longitude']-$line['longitude']) > $globalCoordMinChangeTracker || $this->all_tracked[$id]['format_source'] == 'aprs') {
210
+				if (!isset($this->all_tracked[$id]['livedb_longitude']) || abs($this->all_tracked[$id]['livedb_longitude'] - $line['longitude']) > $globalCoordMinChangeTracker || $this->all_tracked[$id]['format_source'] == 'aprs') {
211 211
 				    $this->all_tracked[$id]['livedb_longitude'] = $line['longitude'];
212 212
 				    $dataFound = true;
213 213
 				    $this->all_tracked[$id]['time_last_coord'] = time();
214 214
 				}
215
-				$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('longitude' => $line['longitude']));
215
+				$this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('longitude' => $line['longitude']));
216 216
 			}
217 217
 
218 218
 		    } else if ($globalDebug && $timediff > 20) {
219 219
 			$this->tmd = $this->tmd + 1;
220 220
 			if ($line['latitude'] != $this->all_tracked[$id]['latitude'] && $line['longitude'] != $this->all_tracked[$id]['longitude']) {
221 221
 				echo '!!! Too much distance in short time... for '.$this->all_tracked[$id]['ident']."\n";
222
-				echo 'Time : '.$timediff.'s - Distance : '.$Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')."m -";
223
-				echo 'Speed : '.(($Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')/$timediff)*3.6)." km/h - ";
222
+				echo 'Time : '.$timediff.'s - Distance : '.$Common->distance($line['latitude'], $line['longitude'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], 'm')."m -";
223
+				echo 'Speed : '.(($Common->distance($line['latitude'], $line['longitude'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], 'm')/$timediff)*3.6)." km/h - ";
224 224
 				echo 'Lat : '.$line['latitude'].' - long : '.$line['longitude'].' - prev lat : '.$this->all_tracked[$id]['latitude'].' - prev long : '.$this->all_tracked[$id]['longitude']." \n";
225 225
 			}
226 226
 		    }
227 227
 		}
228 228
 		if (isset($line['last_update']) && $line['last_update'] != '') {
229 229
 		    if (isset($this->all_tracked[$id]['last_update']) && $this->all_tracked[$id]['last_update'] != $line['last_update']) $dataFound = true;
230
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('last_update' => $line['last_update']));
230
+		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('last_update' => $line['last_update']));
231 231
 		}
232 232
 		if (isset($line['format_source']) && $line['format_source'] != '') {
233
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('format_source' => $line['format_source']));
233
+		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('format_source' => $line['format_source']));
234 234
 		}
235 235
 		if (isset($line['source_name']) && $line['source_name'] != '') {
236
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('source_name' => $line['source_name']));
236
+		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('source_name' => $line['source_name']));
237 237
 		}
238 238
 		if (isset($line['comment']) && $line['comment'] != '') {
239
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('comment' => $line['comment']));
239
+		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('comment' => $line['comment']));
240 240
 		    //$dataFound = true;
241 241
 		}
242 242
 		if (isset($line['type']) && $line['type'] != '') {
243
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('type' => $line['type']));
243
+		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('type' => $line['type']));
244 244
 		    //$dataFound = true;
245 245
 		}
246 246
 
247 247
 		if (isset($line['altitude']) && $line['altitude'] != '') {
248 248
 		    //if (!isset($this->all_tracked[$id]['altitude']) || $this->all_tracked[$id]['altitude'] == '' || ($this->all_tracked[$id]['altitude'] > 0 && $line['altitude'] != 0)) {
249
-			if (is_int($this->all_tracked[$id]['altitude']) && abs(round($line['altitude']/100)-$this->all_tracked[$id]['altitude']) > 3) $this->all_tracked[$id]['putinarchive'] = true;
250
-			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('altitude' => $line['altitude']));
251
-			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('altitude_real' => $line['altitude']));
249
+			if (is_int($this->all_tracked[$id]['altitude']) && abs(round($line['altitude']/100) - $this->all_tracked[$id]['altitude']) > 3) $this->all_tracked[$id]['putinarchive'] = true;
250
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('altitude' => $line['altitude']));
251
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('altitude_real' => $line['altitude']));
252 252
 			//$dataFound = true;
253 253
 		    //} elseif ($globalDebug) echo "!!! Strange altitude data... not added.\n";
254 254
   		}
255 255
 
256 256
 		if (isset($line['noarchive']) && $line['noarchive'] === true) {
257
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('noarchive' => true));
257
+		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('noarchive' => true));
258 258
 		}
259 259
 		
260 260
 		if (isset($line['heading']) && $line['heading'] != '') {
261
-		    if (is_int($this->all_tracked[$id]['heading']) && abs($this->all_tracked[$id]['heading']-round($line['heading'])) > 10) $this->all_tracked[$id]['putinarchive'] = true;
262
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($line['heading'])));
263
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading_fromsrc' => true));
261
+		    if (is_int($this->all_tracked[$id]['heading']) && abs($this->all_tracked[$id]['heading'] - round($line['heading'])) > 10) $this->all_tracked[$id]['putinarchive'] = true;
262
+		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('heading' => round($line['heading'])));
263
+		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('heading_fromsrc' => true));
264 264
 		    //$dataFound = true;
265 265
   		} elseif (!isset($this->all_tracked[$id]['heading_fromsrc']) && isset($this->all_tracked[$id]['archive_latitude']) && $this->all_tracked[$id]['archive_latitude'] != $this->all_tracked[$id]['latitude'] && isset($this->all_tracked[$id]['archive_longitude']) && $this->all_tracked[$id]['archive_longitude'] != $this->all_tracked[$id]['longitude']) {
266
-  		    $heading = $Common->getHeading($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude']);
267
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($heading)));
268
-		    if (abs($this->all_tracked[$id]['heading']-round($heading)) > 10) $this->all_tracked[$id]['putinarchive'] = true;
266
+  		    $heading = $Common->getHeading($this->all_tracked[$id]['archive_latitude'], $this->all_tracked[$id]['archive_longitude'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude']);
267
+		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('heading' => round($heading)));
268
+		    if (abs($this->all_tracked[$id]['heading'] - round($heading)) > 10) $this->all_tracked[$id]['putinarchive'] = true;
269 269
   		    if ($globalDebug) echo "ø Calculated Heading for ".$this->all_tracked[$id]['ident']." : ".$heading."\n";
270 270
   		}
271 271
 		//if (isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_tracked[$id]['lastupdate']) && time()-$this->all_tracked[$id]['lastupdate'] < $globalSourcesupdate) $dataFound = false;
@@ -273,54 +273,54 @@  discard block
 block discarded – undo
273 273
 		if ($dataFound === true && isset($this->all_tracked[$id]['ident'])) {
274 274
 		    $this->all_tracked[$id]['lastupdate'] = time();
275 275
 		    if ($this->all_tracked[$id]['addedTracker'] == 0) {
276
-		        if (!isset($globalDistanceIgnore['latitude']) || $this->all_tracked[$id]['longitude'] == ''  || $this->all_tracked[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) {
276
+		        if (!isset($globalDistanceIgnore['latitude']) || $this->all_tracked[$id]['longitude'] == '' || $this->all_tracked[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $globalDistanceIgnore['latitude'], $globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) {
277 277
 			    if (!isset($this->all_tracked[$id]['forcenew']) || $this->all_tracked[$id]['forcenew'] == 0) {
278 278
 				if ($globalDebug) echo "Check if aircraft is already in DB...";
279 279
 				$timeelapsed = microtime(true);
280 280
 				$TrackerLive = new TrackerLive($this->db);
281 281
 				if (isset($line['id'])) {
282 282
 				    $recent_ident = $TrackerLive->checkIdRecent($line['id']);
283
-				    if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
283
+				    if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
284 284
 				} elseif (isset($this->all_tracked[$id]['ident']) && $this->all_tracked[$id]['ident'] != '') {
285 285
 				    $recent_ident = $TrackerLive->checkIdentRecent($this->all_tracked[$id]['ident']);
286
-				    if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
286
+				    if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
287 287
 				} else $recent_ident = '';
288
-				$TrackerLive->db=null;
288
+				$TrackerLive->db = null;
289 289
 
290 290
 				if ($globalDebug && $recent_ident == '') echo " Not in DB.\n";
291 291
 				elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n";
292 292
 			    } else {
293 293
 				$recent_ident = '';
294
-				$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('forcenew' => 0));
294
+				$this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('forcenew' => 0));
295 295
 			    }
296 296
 			    //if there was no aircraft with the same callsign within the last hour and go post it into the archive
297
-			    if($recent_ident == "")
297
+			    if ($recent_ident == "")
298 298
 			    {
299 299
 				if ($globalDebug) echo "\o/ Add ".$this->all_tracked[$id]['ident']." in archive DB : ";
300 300
 				//adds the spotter data for the archive
301 301
 				    $highlight = '';
302
-				    if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident'].'-'.date('YmdHi')));
302
+				    if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('id' => $this->all_tracked[$id]['ident'].'-'.date('YmdHi')));
303 303
 				    $timeelapsed = microtime(true);
304 304
 				    $Tracker = new Tracker($this->db);
305
-				    $result = $Tracker->addTrackerData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['altitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['comment'],$this->all_tracked[$id]['type'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name']);
305
+				    $result = $Tracker->addTrackerData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['altitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['comment'], $this->all_tracked[$id]['type'], $this->all_tracked[$id]['format_source'], $this->all_tracked[$id]['source_name']);
306 306
 				    $Tracker->db = null;
307 307
 				    if ($globalDebug && isset($result)) echo $result."\n";
308
-				    if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
308
+				    if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
309 309
 				    
310 310
 				    
311 311
 				    // Add source stat in DB
312 312
 				    $Stats = new Stats($this->db);
313 313
 				    if (!empty($this->stats)) {
314 314
 					if ($globalDebug) echo 'Add source stats : ';
315
-				        foreach($this->stats as $date => $data) {
316
-					    foreach($data as $source => $sourced) {
315
+				        foreach ($this->stats as $date => $data) {
316
+					    foreach ($data as $source => $sourced) {
317 317
 					        //print_r($sourced);
318
-				    	        if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar_tracker',$date);
319
-				    	        if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist_tracker',$date);
318
+				    	        if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']), $source, 'polar_tracker', $date);
319
+				    	        if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']), $source, 'hist_tracker', $date);
320 320
 				    		if (isset($sourced['msg'])) {
321 321
 				    		    if (time() - $sourced['msg']['date'] > 10) {
322 322
 				    		        $nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date']));
323
-				    		        echo $Stats->addStatSource($nbmsg,$source,'msg_tracker',$date);
323
+				    		        echo $Stats->addStatSource($nbmsg, $source, 'msg_tracker', $date);
324 324
 			    			        unset($this->stats[$date][$source]['msg']);
325 325
 			    			    }
326 326
 			    			}
@@ -343,7 +343,7 @@  discard block
 block discarded – undo
343 343
 				    //TrackerLive->deleteLiveTrackerDataNotUpdated();
344 344
 				    $TrackerLive = new TrackerLive($this->db);
345 345
 				    $TrackerLive->deleteLiveTrackerData();
346
-				    $TrackerLive->db=null;
346
+				    $TrackerLive->db = null;
347 347
 				    if ($globalDebug) echo " Done\n";
348 348
 				    $this->last_delete = time();
349 349
 				}
@@ -352,7 +352,7 @@  discard block
 block discarded – undo
352 352
 				$this->all_tracked[$id]['addedTracker'] = 1;
353 353
 				if (isset($globalDaemon) && !$globalDaemon) {
354 354
 					$Tracker = new Tracker($this->db);
355
-					$Tracker->updateLatestTrackerData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['ident'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$this->all_tracked[$id]['altitude'],$this->all_tracked[$id]['speed'],$this->all_tracked[$id]['datetime']);
355
+					$Tracker->updateLatestTrackerData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['altitude'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime']);
356 356
 					$Tracker->db = null;
357 357
 				}
358 358
 				
@@ -366,14 +366,14 @@  discard block
 block discarded – undo
366 366
 		    $ignoreImport = false;
367 367
 
368 368
 		    if (!$ignoreImport) {
369
-			if (!isset($globalDistanceIgnore['latitude']) || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) {
369
+			if (!isset($globalDistanceIgnore['latitude']) || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $globalDistanceIgnore['latitude'], $globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) {
370 370
 				if ($globalDebug) echo "\o/ Add ".$this->all_tracked[$id]['ident']." from ".$this->all_tracked[$id]['format_source']." in Live DB : ";
371 371
 				$timeelapsed = microtime(true);
372 372
 				$TrackerLive = new TrackerLive($this->db);
373
-				$result = $TrackerLive->addLiveTrackerData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['altitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'],$this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['putinarchive'],$this->all_tracked[$id]['comment'],$this->all_tracked[$id]['type'],$this->all_tracked[$id]['noarchive'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name'],$this->all_tracked[$id]['over_country']);
373
+				$result = $TrackerLive->addLiveTrackerData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['altitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['putinarchive'], $this->all_tracked[$id]['comment'], $this->all_tracked[$id]['type'], $this->all_tracked[$id]['noarchive'], $this->all_tracked[$id]['format_source'], $this->all_tracked[$id]['source_name'], $this->all_tracked[$id]['over_country']);
374 374
 				$TrackerLive->db = null;
375 375
 				$this->all_tracked[$id]['putinarchive'] = false;
376
-				if ($globalDebugTimeElapsed) echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
376
+				if ($globalDebugTimeElapsed) echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
377 377
 
378 378
 				// Put statistics in $this->stats variable
379 379
 				
@@ -390,19 +390,19 @@  discard block
 block discarded – undo
390 390
 							$latitude = $globalCenterLatitude;
391 391
 							$longitude = $globalCenterLongitude;
392 392
 						}
393
-						$this->source_location[$source] = array('latitude' => $latitude,'longitude' => $longitude);
393
+						$this->source_location[$source] = array('latitude' => $latitude, 'longitude' => $longitude);
394 394
 					} else {
395 395
 						$latitude = $this->source_location[$source]['latitude'];
396 396
 						$longitude = $this->source_location[$source]['longitude'];
397 397
 					}
398
-					$stats_heading = $Common->getHeading($latitude,$longitude,$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude']);
398
+					$stats_heading = $Common->getHeading($latitude, $longitude, $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude']);
399 399
 					//$stats_heading = $stats_heading%22.5;
400 400
 					$stats_heading = round($stats_heading/22.5);
401
-					$stats_distance = $Common->distance($latitude,$longitude,$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude']);
401
+					$stats_distance = $Common->distance($latitude, $longitude, $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude']);
402 402
 					$current_date = date('Y-m-d');
403 403
 					if ($stats_heading == 16) $stats_heading = 0;
404 404
 					if (!isset($this->stats[$current_date][$source]['polar'][1])) {
405
-						for ($i=0;$i<=15;$i++) {
405
+						for ($i = 0; $i <= 15; $i++) {
406 406
 						    $this->stats[$current_date][$source]['polar'][$i] = 0;
407 407
 						}
408 408
 						$this->stats[$current_date][$source]['polar'][$stats_heading] = $stats_distance;
@@ -417,9 +417,9 @@  discard block
 block discarded – undo
417 417
 					if (!isset($this->stats[$current_date][$source]['hist'][$distance])) {
418 418
 						if (isset($this->stats[$current_date][$source]['hist'][0])) {
419 419
 						    end($this->stats[$current_date][$source]['hist']);
420
-						    $mini = key($this->stats[$current_date][$source]['hist'])+10;
420
+						    $mini = key($this->stats[$current_date][$source]['hist']) + 10;
421 421
 						} else $mini = 0;
422
-						for ($i=$mini;$i<=$distance;$i+=10) {
422
+						for ($i = $mini; $i <= $distance; $i += 10) {
423 423
 						    $this->stats[$current_date][$source]['hist'][$i] = 0;
424 424
 						}
425 425
 						$this->stats[$current_date][$source]['hist'][$distance] = 1;
@@ -431,7 +431,7 @@  discard block
 block discarded – undo
431 431
 				$this->all_tracked[$id]['lastupdate'] = time();
432 432
 				if ($this->all_tracked[$id]['putinarchive']) $send = true;
433 433
 				if ($globalDebug) echo $result."\n";
434
-			} elseif (isset($this->all_tracked[$id]['latitude']) && isset($globalDistanceIgnore['latitude']) && $globalDebug) echo "!! Too far -> Distance : ".$Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude'])."\n";
434
+			} elseif (isset($this->all_tracked[$id]['latitude']) && isset($globalDistanceIgnore['latitude']) && $globalDebug) echo "!! Too far -> Distance : ".$Common->distance($this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $globalDistanceIgnore['latitude'], $globalDistanceIgnore['longitude'])."\n";
435 435
 			//$this->del();
436 436
 			
437 437
 			
Please login to merge, or discard this patch.