Completed
Push — master ( d2633e...078d82 )
by Yannick
06:44
created
airport-statistics-time.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -7,14 +7,14 @@  discard block
 block discarded – undo
7 7
         header('Location: '.$globalURL.'/airport');
8 8
         die();
9 9
 }
10
-$airport = filter_input(INPUT_GET,'airport',FILTER_SANITIZE_STRING);
10
+$airport = filter_input(INPUT_GET, 'airport', FILTER_SANITIZE_STRING);
11 11
 $Spotter = new Spotter();
12
-$spotter_array = $Spotter->getSpotterDataByAirport($airport,"0,1","");
12
+$spotter_array = $Spotter->getSpotterDataByAirport($airport, "0,1", "");
13 13
 $airport_array = $Spotter->getAllAirportInfo($airport);
14 14
 
15 15
 if (!empty($airport_array))
16 16
 {
17
-	$title = sprintf(_("Most Common Time of Day to/from %s, %s (%s)"),$airport_array[0]['city'],$airport_array[0]['name'],$airport_array[0]['icao']);
17
+	$title = sprintf(_("Most Common Time of Day to/from %s, %s (%s)"), $airport_array[0]['city'], $airport_array[0]['name'], $airport_array[0]['icao']);
18 18
 
19 19
 	require_once('header.php');
20 20
 	print '<div class="select-item">';
@@ -25,9 +25,9 @@  discard block
 block discarded – undo
25 25
 	$airport_names = $Stats->getAllAirportNames();
26 26
 	if (empty($airport_names)) $airport_names = $Spotter->getAllAirportNames();
27 27
 	ksort($airport_names);
28
-	foreach($airport_names as $airport_name)
28
+	foreach ($airport_names as $airport_name)
29 29
 	{
30
-		if($airport == $airport_name['airport_icao'])
30
+		if ($airport == $airport_name['airport_icao'])
31 31
 		{
32 32
 			print '<option value="'.$airport_name['airport_icao'].'" selected="selected">'.$airport_name['airport_city'].', '.$airport_name['airport_name'].', '.$airport_name['airport_country'].' ('.$airport_name['airport_icao'].')</option>';
33 33
 		} else {
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 	include('airport-sub-menu.php');
59 59
 	print '<div class="column">';
60 60
 	print '<h2>'._("Most Common Time of Day").'</h2>';
61
-	print '<p>'.sprintf(_("The statistic below shows the most common time of day to/from <strong>%s, %s (%s)</strong>."),$airport_array[0]['city'],$airport_array[0]['name'],$airport_array[0]['icao']).'</p>';
61
+	print '<p>'.sprintf(_("The statistic below shows the most common time of day to/from <strong>%s, %s (%s)</strong>."), $airport_array[0]['city'], $airport_array[0]['name'], $airport_array[0]['icao']).'</p>';
62 62
 
63 63
 	$hour_array = $Spotter->countAllHoursByAirport($airport);
64 64
 	print '<script type="text/javascript" src="https://www.google.com/jsapi"></script>';
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
             var data = google.visualization.arrayToDataTable([
71 71
             	["'._("Hour").'", "'._("# of Flights").'"], ';
72 72
             $hour_data = '';
73
-	foreach($hour_array as $hour_item)
73
+	foreach ($hour_array as $hour_item)
74 74
 	{
75 75
 		$hour_data .= '[ "'.date("ga", strtotime($hour_item['hour_name'].":00")).'",'.$hour_item['hour_count'].'],';
76 76
 	}
Please login to merge, or discard this patch.
aircraft-statistics-arrival-airport-country.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -8,14 +8,14 @@  discard block
 block discarded – undo
8 8
         die();
9 9
 }
10 10
 
11
-$aircraft_type = filter_input(INPUT_GET,'aircraft_type',FILTER_SANITIZE_STRING);
11
+$aircraft_type = filter_input(INPUT_GET, 'aircraft_type', FILTER_SANITIZE_STRING);
12 12
 $Spotter = new Spotter();
13
-$spotter_array = $Spotter->getSpotterDataByAircraft($aircraft_type,"0,1","");
13
+$spotter_array = $Spotter->getSpotterDataByAircraft($aircraft_type, "0,1", "");
14 14
 
15 15
 
16 16
 if (!empty($spotter_array))
17 17
 {
18
-	$title = sprintf(_("Most Common Arrival Airports by Country for %s (%s)"),$spotter_array[0]['aircraft_name'],$spotter_array[0]['aircraft_type']);
18
+	$title = sprintf(_("Most Common Arrival Airports by Country for %s (%s)"), $spotter_array[0]['aircraft_name'], $spotter_array[0]['aircraft_type']);
19 19
 	require_once('header.php');
20 20
 	print '<div class="select-item">';
21 21
 	print '<form action="'.$globalURL.'/aircraft" method="post">';
@@ -24,9 +24,9 @@  discard block
 block discarded – undo
24 24
 	$Stats = new Stats();
25 25
 	$aircraft_types = $Stats->getAllAircraftTypes();
26 26
 	if (empty($aircraft_types)) $aircraft_types = $Spotter->getAllAircraftTypes();
27
-	foreach($aircraft_types as $aircrafttype)
27
+	foreach ($aircraft_types as $aircrafttype)
28 28
 	{
29
-		if($aircraft_type == $aircrafttype['aircraft_icao'])
29
+		if ($aircraft_type == $aircrafttype['aircraft_icao'])
30 30
 		{
31 31
 			print '<option value="'.$aircrafttype['aircraft_icao'].'" selected="selected">'.$aircrafttype['aircraft_name'].' ('.$aircrafttype['aircraft_icao'].')</option>';
32 32
 		} else {
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 	include('aircraft-sub-menu.php');
54 54
 	print '<div class="column">';
55 55
 	print '<h2>'._("Most Common Arrival Airports by Country").'</h2>';
56
-  	print '<p>'.sprintf(_("The statistic below shows all arrival airports by Country of origin of flights from <strong>%s (%s)</strong>."),$spotter_array[0]['aircraft_name'],$spotter_array[0]['aircraft_type']).'</p>';
56
+  	print '<p>'.sprintf(_("The statistic below shows all arrival airports by Country of origin of flights from <strong>%s (%s)</strong>."), $spotter_array[0]['aircraft_name'], $spotter_array[0]['aircraft_type']).'</p>';
57 57
 	$airport_country_array = $Spotter->countAllArrivalAirportCountriesByAircraft($aircraft_type);
58 58
 	print '<script type="text/javascript" src="https://www.google.com/jsapi"></script>';
59 59
 	print '<div id="chartCountry" class="chart" width="100%"></div>
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
             var data = google.visualization.arrayToDataTable([
65 65
             	["'._("Country").'", "'._("# of times").'"], ';
66 66
         $country_data = '';
67
-	foreach($airport_country_array as $airport_item)
67
+	foreach ($airport_country_array as $airport_item)
68 68
 	{
69 69
 		$country_data .= '[ "'.$airport_item['arrival_airport_country'].'",'.$airport_item['airport_arrival_country_count'].'],';
70 70
 	}
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 		print '</thead>';
98 98
 		print '<tbody>';
99 99
 		$i = 1;
100
-		foreach($airport_country_array as $airport_item)
100
+		foreach ($airport_country_array as $airport_item)
101 101
 		{
102 102
 			print '<tr>';
103 103
 			print '<td><strong>'.$i.'</strong></td>';
Please login to merge, or discard this patch.
aircraft-statistics-arrival-airport.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -9,15 +9,15 @@  discard block
 block discarded – undo
9 9
         die();
10 10
 }
11 11
 
12
-$aircraft_type = filter_input(INPUT_GET,'aircraft_type',FILTER_SANITIZE_STRING);
12
+$aircraft_type = filter_input(INPUT_GET, 'aircraft_type', FILTER_SANITIZE_STRING);
13 13
 
14 14
 $Spotter = new Spotter();
15
-$spotter_array = $Spotter->getSpotterDataByAircraft($aircraft_type,"0,1","");
15
+$spotter_array = $Spotter->getSpotterDataByAircraft($aircraft_type, "0,1", "");
16 16
 
17 17
 
18 18
 if (!empty($spotter_array))
19 19
 {
20
-	$title = sprintf(_("Most Common Arrival Airports for %s (%s)"),$spotter_array[0]['aircraft_name'],$spotter_array[0]['aircraft_type']);
20
+	$title = sprintf(_("Most Common Arrival Airports for %s (%s)"), $spotter_array[0]['aircraft_name'], $spotter_array[0]['aircraft_type']);
21 21
 	require_once('header.php');
22 22
 	print '<div class="select-item">';
23 23
 	print '<form action="'.$globalURL.'/aircraft" method="post">';
@@ -26,9 +26,9 @@  discard block
 block discarded – undo
26 26
 	$Stats = new Stats();
27 27
 	$aircraft_types = $Stats->getAllAircraftTypes();
28 28
 	if (empty($aircraft_types)) $aircraft_types = $Spotter->getAllAircraftTypes();
29
-	foreach($aircraft_types as $aircrafttype)
29
+	foreach ($aircraft_types as $aircrafttype)
30 30
 	{
31
-		if($aircraft_type == $aircrafttype['aircraft_icao'])
31
+		if ($aircraft_type == $aircrafttype['aircraft_icao'])
32 32
 		{
33 33
 			print '<option value="'.$aircrafttype['aircraft_icao'].'" selected="selected">'.$aircrafttype['aircraft_name'].' ('.$aircrafttype['aircraft_icao'].')</option>';
34 34
 		} else {
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 	include('aircraft-sub-menu.php');
56 56
 	print '<div class="column">';
57 57
 	print '<h2>'._("Most Common Arrival Airports").'</h2>';
58
-	print '<p>'.sprintf(_("The statistic below shows all arrival airports of flights from <strong>%s (%s)</strong>."),$spotter_array[0]['aircraft_name'],$spotter_array[0]['aircraft_type']).'</p>';
58
+	print '<p>'.sprintf(_("The statistic below shows all arrival airports of flights from <strong>%s (%s)</strong>."), $spotter_array[0]['aircraft_name'], $spotter_array[0]['aircraft_type']).'</p>';
59 59
 	 $airport_airport_array = $Spotter->countAllArrivalAirportsByAircraft($aircraft_type);
60 60
     	?>
61 61
     	<script type="text/javascript" src="https://www.google.com/jsapi"></script>
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
         	["<?php echo _("Airport"); ?>", "<?php echo _("# of times"); ?>"],
72 72
 	<?php
73 73
 	$airport_data = '';
74
-	foreach($airport_airport_array as $airport_item)
74
+	foreach ($airport_airport_array as $airport_item)
75 75
 	{
76 76
 		$name = $airport_item['airport_arrival_city'].', '.$airport_item['airport_arrival_country'].' ('.$airport_item['airport_arrival_icao'].')';
77 77
 		$name = str_replace("'", "", $name);
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 	print '</thead>';
111 111
 	print '<tbody>';
112 112
 	$i = 1;
113
-	foreach($airport_airport_array as $airport_item)
113
+	foreach ($airport_airport_array as $airport_item)
114 114
 	{
115 115
 		print '<tr>';
116 116
 		print '<td><strong>'.$i.'</strong></td>';
Please login to merge, or discard this patch.
date-statistics-registration.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -3,8 +3,8 @@  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
-$spotter_array = $Spotter->getSpotterDataByDate($_GET['date'],"0,1", $sort);
6
+$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING);
7
+$spotter_array = $Spotter->getSpotterDataByDate($_GET['date'], "0,1", $sort);
8 8
 
9 9
 if (!empty($spotter_array))
10 10
 {
@@ -20,13 +20,13 @@  discard block
 block discarded – undo
20 20
 	print '</div>';
21 21
 
22 22
 	print '<div class="info column">';
23
-	print '<h1>'.sprintf(_("Flights from %s"),date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</h1>';
23
+	print '<h1>'.sprintf(_("Flights from %s"), date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</h1>';
24 24
 	print '</div>';
25 25
 
26 26
 	include('date-sub-menu.php');
27 27
 	print '<div class="column">';
28 28
 	print '<h2>'._("Most Common Aircraft by Registration").'</h2>';
29
-	print '<p>'.sprintf(_("The statistic below shows the most common aircraft by registration of flights on <strong>%s</strong>."),date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</p>';
29
+	print '<p>'.sprintf(_("The statistic below shows the most common aircraft by registration of flights on <strong>%s</strong>."), date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</p>';
30 30
 
31 31
 	$aircraft_array = $Spotter->countAllAircraftRegistrationByDate($_GET['date']);
32 32
 	if (!empty($aircraft_array))
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 		print '</thead>';
44 44
 		print '<tbody>';
45 45
 		$i = 1;
46
-		foreach($aircraft_array as $aircraft_item)
46
+		foreach ($aircraft_array as $aircraft_item)
47 47
 		{
48 48
 			print '<tr>';
49 49
 			print '<td><strong>'.$i.'</strong></td>';
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 				if (isset($aircraft_item['aircraft_type'])) {
54 54
 					print '<a href="'.$globalURL.'/registration/'.$aircraft_item['registration'].'"><img src="'.$aircraft_item['image_thumbnail'].'" class="img-rounded" data-toggle="popover" title="'.$aircraft_item['registration'].' - '.$aircraft_item['aircraft_icao'].' - '.$aircraft_item['airline_name'].'" alt="'.$aircraft_item['registration'].' - '.$aircraft_item['aircraft_type'].' - '.$aircraft_item['airline_name'].'" data-content="'._("Registration:").' '.$aircraft_item['registration'].'<br />'._("Aircraft:").' '.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')<br />'._("Airline:").' '.$aircraft_item['airline_name'].'" data-html="true" width="100px" /></a>';
55 55
 				} else {
56
-					print '<a href="'.$globalURL.'/registration/'.$aircraft_item['registration'].'"><img src="'.$aircraft_item['image_thumbnail'].'" class="img-rounded" data-toggle="popover" title="'.$aircraft_item['registration'].' - '.$aircraft_item['aircraft_icao'].' - '.$aircraft_item['airline_name'].'" alt="'.$aircraft_item['registration'].' - '.$aircraft_item['airline_name'].'" data-content="'._("Registration:").' '.$aircraft_item['registration'].'<br />'._("Aircraft:").' '.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')<br />'._("Airline:");' '.$aircraft_item['airline_name'].'" data-html="true" width="100px" /></a>';
56
+					print '<a href="'.$globalURL.'/registration/'.$aircraft_item['registration'].'"><img src="'.$aircraft_item['image_thumbnail'].'" class="img-rounded" data-toggle="popover" title="'.$aircraft_item['registration'].' - '.$aircraft_item['aircraft_icao'].' - '.$aircraft_item['airline_name'].'" alt="'.$aircraft_item['registration'].' - '.$aircraft_item['airline_name'].'" data-content="'._("Registration:").' '.$aircraft_item['registration'].'<br />'._("Aircraft:").' '.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')<br />'._("Airline:"); ' '.$aircraft_item['airline_name'].'" data-html="true" width="100px" /></a>';
57 57
 				}
58 58
 				print '</td>';
59 59
 			} else {
Please login to merge, or discard this patch.
require/class.Image.php 1 patch
Spacing   +77 added lines, -77 removed lines patch added patch discarded remove patch
@@ -17,14 +17,14 @@  discard block
 block discarded – undo
17 17
 	* @return Array the images list
18 18
 	*
19 19
 	*/
20
-	public function getSpotterImage($registration,$aircraft_icao = '', $airline_icao = '')
20
+	public function getSpotterImage($registration, $aircraft_icao = '', $airline_icao = '')
21 21
 	{
22
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
23
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
24
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
22
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
23
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
24
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
25 25
 		if ($registration == '' && $aircraft_icao != '') $registration = $aircraft_icao.$airline_icao;
26 26
 		$registration = trim($registration);
27
-		$query  = "SELECT spotter_image.image, spotter_image.image_thumbnail, spotter_image.image_source, spotter_image.image_source_website,spotter_image.image_copyright, spotter_image.registration 
27
+		$query = "SELECT spotter_image.image, spotter_image.image_thumbnail, spotter_image.image_source, spotter_image.image_source_website,spotter_image.image_copyright, spotter_image.registration 
28 28
 			FROM spotter_image 
29 29
 			WHERE spotter_image.registration = :registration";
30 30
 		$sth = $this->db->prepare($query);
@@ -63,9 +63,9 @@  discard block
 block discarded – undo
63 63
 		if (isset($exif['COMPUTED']['copyright'])) $copyright = $exif['COMPUTED']['copyright'];
64 64
 		elseif (isset($exif['copyright'])) $copyright = $exif['copyright'];
65 65
 		if ($copyright != '') {
66
-			$copyright = str_replace('Copyright ','',$copyright);
67
-			$copyright = str_replace('© ','',$copyright);
68
-			$copyright = str_replace('(c) ','',$copyright);
66
+			$copyright = str_replace('Copyright ', '', $copyright);
67
+			$copyright = str_replace('© ', '', $copyright);
68
+			$copyright = str_replace('(c) ', '', $copyright);
69 69
 		}
70 70
 		return $copyright;
71 71
 	}
@@ -76,26 +76,26 @@  discard block
 block discarded – undo
76 76
 	* @return String either success or error
77 77
 	*
78 78
 	*/
79
-	public function addSpotterImage($registration,$aircraft_icao = '', $airline_icao = '')
79
+	public function addSpotterImage($registration, $aircraft_icao = '', $airline_icao = '')
80 80
 	{
81
-		global $globalDebug,$globalAircraftImageFetch;
81
+		global $globalDebug, $globalAircraftImageFetch;
82 82
 		if (isset($globalAircraftImageFetch) && !$globalAircraftImageFetch) return '';
83
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
83
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
84 84
 		$registration = trim($registration);
85 85
 		//getting the aircraft image
86 86
 		if ($globalDebug && $registration != '') echo 'Try to find an aircraft image for '.$registration.'...';
87 87
 		elseif ($globalDebug && $aircraft_icao != '') echo 'Try to find an aircraft image for '.$aircraft_icao.'...';
88 88
 		elseif ($globalDebug && $airline_icao != '') echo 'Try to find an aircraft image for '.$airline_icao.'...';
89 89
 		else return "success";
90
-		$image_url = $this->findAircraftImage($registration,$aircraft_icao,$airline_icao);
90
+		$image_url = $this->findAircraftImage($registration, $aircraft_icao, $airline_icao);
91 91
 		if ($registration == '' && $aircraft_icao != '') $registration = $aircraft_icao.$airline_icao;
92 92
 		if ($image_url['original'] != '') {
93 93
 			if ($globalDebug) echo 'Found !'."\n";
94
-			$query  = "INSERT INTO spotter_image (registration, image, image_thumbnail, image_copyright, image_source,image_source_website) VALUES (:registration,:image,:image_thumbnail,:copyright,:source,:source_website)";
94
+			$query = "INSERT INTO spotter_image (registration, image, image_thumbnail, image_copyright, image_source,image_source_website) VALUES (:registration,:image,:image_thumbnail,:copyright,:source,:source_website)";
95 95
 			try {
96 96
 				$sth = $this->db->prepare($query);
97
-				$sth->execute(array(':registration' => $registration,':image' => $image_url['original'],':image_thumbnail' => $image_url['thumbnail'], ':copyright' => $image_url['copyright'],':source' => $image_url['source'],':source_website' => $image_url['source_website']));
98
-			} catch(PDOException $e) {
97
+				$sth->execute(array(':registration' => $registration, ':image' => $image_url['original'], ':image_thumbnail' => $image_url['thumbnail'], ':copyright' => $image_url['copyright'], ':source' => $image_url['source'], ':source_website' => $image_url['source_website']));
98
+			} catch (PDOException $e) {
99 99
 				echo $e->getMessage()."\n";
100 100
 				return "error";
101 101
 			}
@@ -115,9 +115,9 @@  discard block
 block discarded – undo
115 115
 		global $globalAircraftImageSources, $globalIVAO;
116 116
 		$Spotter = new Spotter($this->db);
117 117
 		if (!isset($globalIVAO)) $globalIVAO = FALSE;
118
-		$aircraft_registration = filter_var($aircraft_registration,FILTER_SANITIZE_STRING);
118
+		$aircraft_registration = filter_var($aircraft_registration, FILTER_SANITIZE_STRING);
119 119
 		if ($aircraft_registration != '') {
120
-			if (strpos($aircraft_registration,'/') !== false) return array('thumbnail' => '','original' => '', 'copyright' => '','source' => '','source_website' => '');
120
+			if (strpos($aircraft_registration, '/') !== false) return array('thumbnail' => '', 'original' => '', 'copyright' => '', 'source' => '', 'source_website' => '');
121 121
 			$aircraft_registration = urlencode(trim($aircraft_registration));
122 122
 			$aircraft_info = $Spotter->getAircraftInfoByRegistration($aircraft_registration);
123 123
 			if (isset($aircraft_info[0]['aircraft_name'])) $aircraft_name = $aircraft_info[0]['aircraft_name'];
@@ -129,23 +129,23 @@  discard block
 block discarded – undo
129 129
 		} elseif ($aircraft_icao != '') {
130 130
 			$aircraft_registration = $aircraft_icao;
131 131
 			$aircraft_name = '';
132
-		} else return array('thumbnail' => '','original' => '', 'copyright' => '', 'source' => '','source_website' => '');
133
-		if (!isset($globalAircraftImageSources)) $globalAircraftImageSources = array('ivaomtl','wikimedia','airportdata','deviantart','flickr','bing','jetphotos','planepictures','planespotters');
132
+		} else return array('thumbnail' => '', 'original' => '', 'copyright' => '', 'source' => '', 'source_website' => '');
133
+		if (!isset($globalAircraftImageSources)) $globalAircraftImageSources = array('ivaomtl', 'wikimedia', 'airportdata', 'deviantart', 'flickr', 'bing', 'jetphotos', 'planepictures', 'planespotters');
134 134
 		foreach ($globalAircraftImageSources as $source) {
135 135
 			$source = strtolower($source);
136
-			if ($source == 'ivaomtl' && $globalIVAO && $aircraft_icao != '' && $airline_icao != '') $images_array = $this->fromIvaoMtl($aircraft_icao,$airline_icao);
137
-			if ($source == 'planespotters' && !$globalIVAO) $images_array = $this->fromPlanespotters($aircraft_registration,$aircraft_name);
138
-			if ($source == 'flickr') $images_array = $this->fromFlickr($aircraft_registration,$aircraft_name);
139
-			if ($source == 'bing') $images_array = $this->fromBing($aircraft_registration,$aircraft_name);
140
-			if ($source == 'deviantart') $images_array = $this->fromDeviantart($aircraft_registration,$aircraft_name);
141
-			if ($source == 'wikimedia') $images_array = $this->fromWikimedia($aircraft_registration,$aircraft_name);
142
-			if ($source == 'jetphotos' && !$globalIVAO) $images_array = $this->fromJetPhotos($aircraft_registration,$aircraft_name);
143
-			if ($source == 'planepictures' && !$globalIVAO) $images_array = $this->fromPlanePictures($aircraft_registration,$aircraft_name);
144
-			if ($source == 'airportdata' && !$globalIVAO) $images_array = $this->fromAirportData($aircraft_registration,$aircraft_name);
145
-			if ($source == 'customsources') $images_array = $this->fromCustomSource($aircraft_registration,$aircraft_name);
136
+			if ($source == 'ivaomtl' && $globalIVAO && $aircraft_icao != '' && $airline_icao != '') $images_array = $this->fromIvaoMtl($aircraft_icao, $airline_icao);
137
+			if ($source == 'planespotters' && !$globalIVAO) $images_array = $this->fromPlanespotters($aircraft_registration, $aircraft_name);
138
+			if ($source == 'flickr') $images_array = $this->fromFlickr($aircraft_registration, $aircraft_name);
139
+			if ($source == 'bing') $images_array = $this->fromBing($aircraft_registration, $aircraft_name);
140
+			if ($source == 'deviantart') $images_array = $this->fromDeviantart($aircraft_registration, $aircraft_name);
141
+			if ($source == 'wikimedia') $images_array = $this->fromWikimedia($aircraft_registration, $aircraft_name);
142
+			if ($source == 'jetphotos' && !$globalIVAO) $images_array = $this->fromJetPhotos($aircraft_registration, $aircraft_name);
143
+			if ($source == 'planepictures' && !$globalIVAO) $images_array = $this->fromPlanePictures($aircraft_registration, $aircraft_name);
144
+			if ($source == 'airportdata' && !$globalIVAO) $images_array = $this->fromAirportData($aircraft_registration, $aircraft_name);
145
+			if ($source == 'customsources') $images_array = $this->fromCustomSource($aircraft_registration, $aircraft_name);
146 146
 			if (isset($images_array) && $images_array['original'] != '') return $images_array;
147 147
 		}
148
-		return array('thumbnail' => '','original' => '', 'copyright' => '','source' => '','source_website' => '');
148
+		return array('thumbnail' => '', 'original' => '', 'copyright' => '', 'source' => '', 'source_website' => '');
149 149
 	}
150 150
 
151 151
 	/**
@@ -156,24 +156,24 @@  discard block
 block discarded – undo
156 156
 	* @return Array the aircraft thumbnail, orignal url and copyright
157 157
 	*
158 158
 	*/
159
-	public function fromPlanespotters($aircraft_registration, $aircraft_name='') {
159
+	public function fromPlanespotters($aircraft_registration, $aircraft_name = '') {
160 160
 		$Common = new Common();
161 161
 		// If aircraft registration is only number, also check with aircraft model
162
-		if (preg_match('/^[[:digit]]+$/',$aircraft_registration) && $aircraft_name != '') {
163
-			$url= 'http://www.planespotters.net/Aviation_Photos/search.php?tag='.$aircraft_registration.'&actype=s_'.urlencode($aircraft_name).'&output=rss';
162
+		if (preg_match('/^[[:digit]]+$/', $aircraft_registration) && $aircraft_name != '') {
163
+			$url = 'http://www.planespotters.net/Aviation_Photos/search.php?tag='.$aircraft_registration.'&actype=s_'.urlencode($aircraft_name).'&output=rss';
164 164
 		} else {
165 165
 			//$url= 'http://www.planespotters.net/Aviation_Photos/search.php?tag='.$airline_aircraft_type.'&output=rss';
166
-			$url= 'http://www.planespotters.net/Aviation_Photos/search.php?reg='.$aircraft_registration.'&output=rss';
166
+			$url = 'http://www.planespotters.net/Aviation_Photos/search.php?reg='.$aircraft_registration.'&output=rss';
167 167
 		}
168 168
 		$data = $Common->getData($url);
169 169
 		if ($xml = simplexml_load_string($data)) {
170 170
 			if (isset($xml->channel->item)) {
171 171
 				$image_url = array();
172
-				$thumbnail_url = trim((string)$xml->channel->item->children('http://search.yahoo.com/mrss/')->thumbnail->attributes()->url);
172
+				$thumbnail_url = trim((string) $xml->channel->item->children('http://search.yahoo.com/mrss/')->thumbnail->attributes()->url);
173 173
 				$image_url['thumbnail'] = $thumbnail_url;
174
-				$image_url['original'] = str_replace('thumbnail','original',$thumbnail_url);
175
-				$image_url['copyright'] = trim((string)$xml->channel->item->children('http://search.yahoo.com/mrss/')->copyright);
176
-				$image_url['source_website'] = trim((string)$xml->channel->item->link);
174
+				$image_url['original'] = str_replace('thumbnail', 'original', $thumbnail_url);
175
+				$image_url['copyright'] = trim((string) $xml->channel->item->children('http://search.yahoo.com/mrss/')->copyright);
176
+				$image_url['source_website'] = trim((string) $xml->channel->item->link);
177 177
 				$image_url['source'] = 'planespotters';
178 178
 				return $image_url;
179 179
 			}
@@ -189,25 +189,25 @@  discard block
 block discarded – undo
189 189
 	* @return Array the aircraft thumbnail, orignal url and copyright
190 190
 	*
191 191
 	*/
192
-	public function fromDeviantart($aircraft_registration, $aircraft_name='') {
192
+	public function fromDeviantart($aircraft_registration, $aircraft_name = '') {
193 193
 		$Common = new Common();
194 194
 		// If aircraft registration is only number, also check with aircraft model
195
-		if (preg_match('/^[[:digit]]+$/',$aircraft_registration) && $aircraft_name != '') {
196
-			$url= 'http://backend.deviantart.com/rss.xml?type=deviation&q='.$aircraft_registration.'%20'.urlencode($aircraft_name);
195
+		if (preg_match('/^[[:digit]]+$/', $aircraft_registration) && $aircraft_name != '') {
196
+			$url = 'http://backend.deviantart.com/rss.xml?type=deviation&q='.$aircraft_registration.'%20'.urlencode($aircraft_name);
197 197
 		} else {
198
-			$url= 'http://backend.deviantart.com/rss.xml?type=deviation&q=aircraft%20'.$aircraft_registration;
198
+			$url = 'http://backend.deviantart.com/rss.xml?type=deviation&q=aircraft%20'.$aircraft_registration;
199 199
 		}
200 200
 
201 201
 		$data = $Common->getData($url);
202 202
 		if ($xml = simplexml_load_string($data)) {
203 203
 			if (isset($xml->channel->item->link)) {
204 204
 				$image_url = array();
205
-				$thumbnail_url = trim((string)$xml->channel->item->children('http://search.yahoo.com/mrss/')->thumbnail->attributes()->url);
205
+				$thumbnail_url = trim((string) $xml->channel->item->children('http://search.yahoo.com/mrss/')->thumbnail->attributes()->url);
206 206
 				$image_url['thumbnail'] = $thumbnail_url;
207
-				$original_url = trim((string)$xml->channel->item->children('http://search.yahoo.com/mrss/')->content->attributes()->url);
207
+				$original_url = trim((string) $xml->channel->item->children('http://search.yahoo.com/mrss/')->content->attributes()->url);
208 208
 				$image_url['original'] = $original_url;
209
-				$image_url['copyright'] = str_replace('Copyright ','',trim((string)$xml->channel->item->children('http://search.yahoo.com/mrss/')->copyright));
210
-				$image_url['source_website'] = trim((string)$xml->channel->item->link);
209
+				$image_url['copyright'] = str_replace('Copyright ', '', trim((string) $xml->channel->item->children('http://search.yahoo.com/mrss/')->copyright));
210
+				$image_url['source_website'] = trim((string) $xml->channel->item->link);
211 211
 				$image_url['source'] = 'deviantart';
212 212
 				return $image_url;
213 213
 			}
@@ -223,32 +223,32 @@  discard block
 block discarded – undo
223 223
 	* @return Array the aircraft thumbnail, orignal url and copyright
224 224
 	*
225 225
 	*/
226
-	public function fromJetPhotos($aircraft_registration, $aircraft_name='') {
226
+	public function fromJetPhotos($aircraft_registration, $aircraft_name = '') {
227 227
 		$Common = new Common();
228
-		$url= 'http://jetphotos.net/showphotos.php?displaymode=2&regsearch='.$aircraft_registration;
228
+		$url = 'http://jetphotos.net/showphotos.php?displaymode=2&regsearch='.$aircraft_registration;
229 229
 		$data = $Common->getData($url);
230 230
 		$dom = new DOMDocument();
231 231
 		@$dom->loadHTML($data);
232 232
 		$all_pics = array();
233
-		foreach($dom->getElementsByTagName('img') as $image) {
233
+		foreach ($dom->getElementsByTagName('img') as $image) {
234 234
 			if ($image->getAttribute('itemprop') == "http://schema.org/image") {
235 235
 				$all_pics[] = $image->getAttribute('src');
236 236
 			}
237 237
 		}
238 238
 		$all_authors = array();
239
-		foreach($dom->getElementsByTagName('meta') as $author) {
239
+		foreach ($dom->getElementsByTagName('meta') as $author) {
240 240
 			if ($author->getAttribute('itemprop') == "http://schema.org/author") {
241 241
 				$all_authors[] = $author->getAttribute('content');
242 242
 			}
243 243
 		}
244 244
 		$all_ref = array();
245
-		foreach($dom->getElementsByTagName('a') as $link) {
245
+		foreach ($dom->getElementsByTagName('a') as $link) {
246 246
 			$all_ref[] = $link->getAttribute('href');
247 247
 		}
248 248
 		if (isset($all_pics[0])) {
249 249
 			$image_url = array();
250 250
 			$image_url['thumbnail'] = $all_pics[0];
251
-			$image_url['original'] = str_replace('_tb','',$all_pics[0]);
251
+			$image_url['original'] = str_replace('_tb', '', $all_pics[0]);
252 252
 			$image_url['copyright'] = $all_authors[0];
253 253
 			$image_url['source_website'] = 'http://jetphotos.net'.$all_ref[8];
254 254
 			$image_url['source'] = 'JetPhotos';
@@ -265,24 +265,24 @@  discard block
 block discarded – undo
265 265
 	* @return Array the aircraft thumbnail, orignal url and copyright
266 266
 	*
267 267
 	*/
268
-	public function fromPlanePictures($aircraft_registration, $aircraft_name='') {
268
+	public function fromPlanePictures($aircraft_registration, $aircraft_name = '') {
269 269
 		$Common = new Common();
270
-		$url= 'http://www.planepictures.net/netsearch4.cgi?srch='.$aircraft_registration.'&stype=reg&srng=2';
270
+		$url = 'http://www.planepictures.net/netsearch4.cgi?srch='.$aircraft_registration.'&stype=reg&srng=2';
271 271
 		$data = $Common->getData($url);
272 272
 		$dom = new DOMDocument();
273 273
 		@$dom->loadHTML($data);
274 274
 		$all_pics = array();
275
-		foreach($dom->getElementsByTagName('img') as $image) {
275
+		foreach ($dom->getElementsByTagName('img') as $image) {
276 276
 			$all_pics[] = $image->getAttribute('src');
277 277
 		}
278 278
 		$all_links = array();
279
-		foreach($dom->getElementsByTagName('a') as $link) {
280
-			$all_links[] = array('text' => $link->textContent,'href' => $link->getAttribute('href'));
279
+		foreach ($dom->getElementsByTagName('a') as $link) {
280
+			$all_links[] = array('text' => $link->textContent, 'href' => $link->getAttribute('href'));
281 281
 		}
282
-		if (isset($all_pics[1]) && !preg_match('/bit.ly/',$all_pics[1])) {
282
+		if (isset($all_pics[1]) && !preg_match('/bit.ly/', $all_pics[1])) {
283 283
 			$image_url = array();
284 284
 			$image_url['thumbnail'] = 'http://www.planepictures.net'.$all_pics[1];
285
-			$image_url['original'] = 'http://www.planepictures.net'.str_replace('_TN','',$all_pics[1]);
285
+			$image_url['original'] = 'http://www.planepictures.net'.str_replace('_TN', '', $all_pics[1]);
286 286
 			$image_url['copyright'] = $all_links[6]['text'];
287 287
 			$image_url['source_website'] = 'http://www.planepictures.net/'.$all_links[2]['href'];
288 288
 			$image_url['source'] = 'PlanePictures';
@@ -299,19 +299,19 @@  discard block
 block discarded – undo
299 299
 	* @return Array the aircraft thumbnail, orignal url and copyright
300 300
 	*
301 301
 	*/
302
-	public function fromFlickr($aircraft_registration,$aircraft_name='') {
302
+	public function fromFlickr($aircraft_registration, $aircraft_name = '') {
303 303
 		$Common = new Common();
304 304
 		if ($aircraft_name != '') $url = 'https://api.flickr.com/services/feeds/photos_public.gne?format=rss2&license=1,2,3,4,5,6,7&per_page=1&tags='.$aircraft_registration.','.urlencode($aircraft_name);
305 305
 		else $url = 'https://api.flickr.com/services/feeds/photos_public.gne?format=rss2&license=1,2,3,4,5,6,7&per_page=1&tags='.$aircraft_registration.',aircraft';
306 306
 		$data = $Common->getData($url);
307 307
 		if ($xml = simplexml_load_string($data)) {
308 308
 			if (isset($xml->channel->item)) {
309
-				$original_url = trim((string)$xml->channel->item->enclosure->attributes()->url);
309
+				$original_url = trim((string) $xml->channel->item->enclosure->attributes()->url);
310 310
 				$image_url = array();
311 311
 				$image_url['thumbnail'] = $original_url;
312 312
 				$image_url['original'] = $original_url;
313
-				$image_url['copyright'] = trim((string)$xml->channel->item->children('http://search.yahoo.com/mrss/')->credit);
314
-				$image_url['source_website'] = trim((string)$xml->channel->item->link);
313
+				$image_url['copyright'] = trim((string) $xml->channel->item->children('http://search.yahoo.com/mrss/')->credit);
314
+				$image_url['source_website'] = trim((string) $xml->channel->item->link);
315 315
 				$image_url['source'] = 'flickr';
316 316
 				return $image_url;
317 317
 			}
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
 		return false;
320 320
 	}
321 321
 
322
-	public function fromIvaoMtl($aircraft_icao,$airline_icao) {
322
+	public function fromIvaoMtl($aircraft_icao, $airline_icao) {
323 323
 		$Common = new Common();
324 324
 		//echo "\n".'SEARCH IMAGE : http://mtlcatalog.ivao.aero/images/aircraft/'.$aircraft_icao.$airline_icao.'.jpg';
325 325
 		if ($Common->urlexist('http://mtlcatalog.ivao.aero/images/aircraft/'.$aircraft_icao.$airline_icao.'.jpg')) {
@@ -343,14 +343,14 @@  discard block
 block discarded – undo
343 343
 	* @return Array the aircraft thumbnail, orignal url and copyright
344 344
 	*
345 345
 	*/
346
-	public function fromBing($aircraft_registration,$aircraft_name='') {
346
+	public function fromBing($aircraft_registration, $aircraft_name = '') {
347 347
 		global $globalImageBingKey;
348 348
 		$Common = new Common();
349 349
 		if (!isset($globalImageBingKey) || $globalImageBingKey == '') return false;
350 350
 		if ($aircraft_name != '') $url = 'https://api.datamarket.azure.com/Bing/Search/v1/Image?$format=json&$top=1&Query=%27'.$aircraft_registration.'%20'.urlencode($aircraft_name).'%20-site:planespotters.com%20-site:flickr.com%27';
351 351
 		else $url = 'https://api.datamarket.azure.com/Bing/Search/v1/Image?$format=json&$top=1&Query=%27%2B'.$aircraft_registration.'%20%2Baircraft%20-site:planespotters.com%20-site:flickr.com%27';
352
-		$headers = array("Authorization: Basic " . base64_encode("ignored:".$globalImageBingKey));
353
-		$data = $Common->getData($url,'get','',$headers);
352
+		$headers = array("Authorization: Basic ".base64_encode("ignored:".$globalImageBingKey));
353
+		$data = $Common->getData($url, 'get', '', $headers);
354 354
 		$result = json_decode($data);
355 355
 		if (isset($result->d->results[0]->MediaUrl)) {
356 356
 			$image_url = array();
@@ -375,14 +375,14 @@  discard block
 block discarded – undo
375 375
 	* @return Array the aircraft thumbnail, orignal url and copyright
376 376
 	*
377 377
 	*/
378
-	public function fromAirportData($aircraft_registration,$aircraft_name='') {
378
+	public function fromAirportData($aircraft_registration, $aircraft_name = '') {
379 379
 		$Common = new Common();
380 380
 		$url = 'http://www.airport-data.com/api/ac_thumb.json?&n=1&r='.$aircraft_registration;
381 381
 		$data = $Common->getData($url);
382 382
 		$result = json_decode($data);
383 383
 		if (isset($result->count) && $result->count > 0) {
384 384
 			$image_url = array();
385
-			$image_url['original'] = str_replace('thumbnails','large',$result->data[0]->image);
385
+			$image_url['original'] = str_replace('thumbnails', 'large', $result->data[0]->image);
386 386
 			$image_url['source_website'] = $result->data[0]->link;
387 387
 			$image_url['thumbnail'] = $result->data[0]->image;
388 388
 			$image_url['copyright'] = $result->data[0]->photographer;
@@ -400,7 +400,7 @@  discard block
 block discarded – undo
400 400
 	* @return Array the aircraft thumbnail, orignal url and copyright
401 401
 	*
402 402
 	*/
403
-	public function fromWikimedia($aircraft_registration,$aircraft_name='') {
403
+	public function fromWikimedia($aircraft_registration, $aircraft_name = '') {
404 404
 		$Common = new Common();
405 405
 		if ($aircraft_name != '') $url = 'https://commons.wikimedia.org/w/api.php?action=query&list=search&format=json&srlimit=1&srnamespace=6&continue&srsearch="'.$aircraft_registration.'"%20'.urlencode($aircraft_name);
406 406
 		else $url = 'https://commons.wikimedia.org/w/api.php?action=query&list=search&format=json&srlimit=1&srnamespace=6&continue&srsearch="'.$aircraft_registration.'"%20aircraft';
@@ -408,7 +408,7 @@  discard block
 block discarded – undo
408 408
 		$result = json_decode($data);
409 409
 		if (isset($result->query->search[0]->title)) {
410 410
 			$fileo = $result->query->search[0]->title;
411
-			if (substr($fileo,-3) == 'pdf') return false;
411
+			if (substr($fileo, -3) == 'pdf') return false;
412 412
 			$file = urlencode($fileo);
413 413
 			$url2 = 'https://commons.wikimedia.org/w/api.php?action=query&format=json&continue&iilimit=500&prop=imageinfo&iiprop=user|url|size|mime|sha1|timestamp&iiurlwidth=200%27&titles='.$file;
414 414
 			$data2 = $Common->getData($url2);
@@ -433,11 +433,11 @@  discard block
 block discarded – undo
433 433
 				if (isset($result2->query->pages)) {
434 434
 					foreach ($result2->query->pages as $page) {
435 435
 						if (isset($page->imageinfo[0]->extmetadata->Artist)) {
436
-							$image_url['copyright'] = preg_replace('/ from(.*)/','',strip_tags($page->imageinfo[0]->extmetadata->Artist->value));
436
+							$image_url['copyright'] = preg_replace('/ from(.*)/', '', strip_tags($page->imageinfo[0]->extmetadata->Artist->value));
437 437
 							if (isset($page->imageinfo[0]->extmetadata->License->value)) {
438 438
 								$image_url['copyright'] = $image_url['copyright'].' (under '.$page->imageinfo[0]->extmetadata->License->value.')';
439 439
 							}
440
-							$image_url['copyright'] = trim(str_replace('\n','',$image_url['copyright']));
440
+							$image_url['copyright'] = trim(str_replace('\n', '', $image_url['copyright']));
441 441
 							return $image_url;
442 442
 						}
443 443
 					}
@@ -456,22 +456,22 @@  discard block
 block discarded – undo
456 456
 	* @return Array the aircraft thumbnail, orignal url and copyright
457 457
 	*
458 458
 	*/
459
-	public function fromCustomSource($aircraft_registration,$aircraft_name='') {
459
+	public function fromCustomSource($aircraft_registration, $aircraft_name = '') {
460 460
 		global $globalAircraftImageCustomSources;
461 461
 		//$globalAircraftImageCustomSource[] = array('thumbnail' => '','original' => '', 'copyright' => '', 'source_website' => '', 'source' => '','exif' => true);
462 462
 		if (!empty($globalAircraftImageCustomSources)) {
463 463
 			if (!isset($globalAircraftImageCustomSources[0])) $globalAircraftImageCustomSources[] = $globalAircraftImageCustomSources;
464 464
 			foreach ($globalAircraftImageCustomSources as $source) {
465 465
 				$Common = new Common();
466
-				$url = str_replace('{registration}',$aircraft_registration,$source['original']);
467
-				$url_thumbnail = str_replace('{registration}',$aircraft_registration,$source['original']);
466
+				$url = str_replace('{registration}', $aircraft_registration, $source['original']);
467
+				$url_thumbnail = str_replace('{registration}', $aircraft_registration, $source['original']);
468 468
 				if ($Common->urlexist($url)) {
469 469
 					$image_url = array();
470 470
 					$image_url['thumbnail'] = $url_thumbnail;
471 471
 					$image_url['original'] = $url;
472 472
 					if ($source['exif'] && exif_imagetype($url) == IMAGETYPE_JPEG) $exifCopyright = $this->getExifCopyright($url);
473 473
 					else $exifCopyright = '';
474
-					if ($exifCopyright  != '') $image_url['copyright'] = $exifCopyright;
474
+					if ($exifCopyright != '') $image_url['copyright'] = $exifCopyright;
475 475
 					else $image_url['copyright'] = $source['copyright'];
476 476
 					$image_url['source_website'] = $source['source_website'];
477 477
 					$image_url['source'] = $source['source'];
Please login to merge, or discard this patch.
require/class.Connection.php 1 patch
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -1,19 +1,19 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 require_once(dirname(__FILE__).'/settings.php');
3 3
 
4
-class Connection{
4
+class Connection {
5 5
 	public $db = null;
6 6
 	public $dbs = array();
7 7
 	public $latest_schema = 26;
8 8
 	
9
-	public function __construct($dbc = null,$dbname = null,$user = null,$pass = null) {
9
+	public function __construct($dbc = null, $dbname = null, $user = null, $pass = null) {
10 10
 	    global $globalDBdriver;
11 11
 	    if ($dbc === null) {
12 12
 		if ($this->db === null && $dbname === null) {
13 13
 		    if ($user === null && $pass === null) {
14 14
 			$this->createDBConnection();
15 15
 		    } else {
16
-			$this->createDBConnection(null,$user,$pass);
16
+			$this->createDBConnection(null, $user, $pass);
17 17
 		    }
18 18
 		} else {
19 19
 		    $this->createDBConnection($dbname);
@@ -91,14 +91,14 @@  discard block
 block discarded – undo
91 91
 		while (true) {
92 92
 			try {
93 93
 				if ($globalDBSdriver == 'mysql') {
94
-					$this->dbs[$DBname] = new PDO("$globalDBSdriver:host=$globalDBShost;port=$globalDBSport;dbname=$globalDBSname;charset=utf8", $globalDBSuser,  $globalDBSpass);
94
+					$this->dbs[$DBname] = new PDO("$globalDBSdriver:host=$globalDBShost;port=$globalDBSport;dbname=$globalDBSname;charset=utf8", $globalDBSuser, $globalDBSpass);
95 95
 					$this->dbs[$DBname]->setAttribute(PDO::MYSQL_ATTR_INIT_COMMAND, "SET NAMES 'utf8'");
96 96
 					$this->dbs[$DBname]->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
97
-					$this->dbs[$DBname]->setAttribute(PDO::ATTR_CASE,PDO::CASE_LOWER);
98
-					if (!isset($globalDBTimeOut)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,500);
99
-					else $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,$globalDBTimeOut);
100
-					if (!isset($globalDBPersistent)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,true);
101
-					else $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,$globalDBPersistent);
97
+					$this->dbs[$DBname]->setAttribute(PDO::ATTR_CASE, PDO::CASE_LOWER);
98
+					if (!isset($globalDBTimeOut)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT, 500);
99
+					else $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT, $globalDBTimeOut);
100
+					if (!isset($globalDBPersistent)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT, true);
101
+					else $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT, $globalDBPersistent);
102 102
 					$this->dbs[$DBname]->setAttribute(PDO::ATTR_EMULATE_PREPARES, true);
103 103
 					$this->dbs[$DBname]->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true);
104 104
 					// Workaround against "ONLY_FULL_GROUP_BY" mode
@@ -108,18 +108,18 @@  discard block
 block discarded – undo
108 108
 					$this->dbs[$DBname]->exec('SET SESSION time_zone = "+00:00"');
109 109
 					//$this->dbs[$DBname]->exec('SET @@session.time_zone = "+00:00"');
110 110
 				} else {
111
-					$this->dbs[$DBname] = new PDO("$globalDBSdriver:host=$globalDBShost;port=$globalDBSport;dbname=$globalDBSname;options='--client_encoding=utf8'", $globalDBSuser,  $globalDBSpass);
111
+					$this->dbs[$DBname] = new PDO("$globalDBSdriver:host=$globalDBShost;port=$globalDBSport;dbname=$globalDBSname;options='--client_encoding=utf8'", $globalDBSuser, $globalDBSpass);
112 112
 					//$this->dbs[$DBname]->setAttribute(PDO::MYSQL_ATTR_INIT_COMMAND, "SET NAMES 'utf8'");
113 113
 					$this->dbs[$DBname]->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
114
-					$this->dbs[$DBname]->setAttribute(PDO::ATTR_CASE,PDO::CASE_LOWER);
115
-					if (!isset($globalDBTimeOut)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,200);
116
-					else $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,$globalDBTimeOut);
117
-					if (!isset($globalDBPersistent)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,true);
118
-					else $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,$globalDBPersistent);
114
+					$this->dbs[$DBname]->setAttribute(PDO::ATTR_CASE, PDO::CASE_LOWER);
115
+					if (!isset($globalDBTimeOut)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT, 200);
116
+					else $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT, $globalDBTimeOut);
117
+					if (!isset($globalDBPersistent)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT, true);
118
+					else $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT, $globalDBPersistent);
119 119
 					$this->dbs[$DBname]->setAttribute(PDO::ATTR_EMULATE_PREPARES, true);
120 120
 				}
121 121
 				break;
122
-			} catch(PDOException $e) {
122
+			} catch (PDOException $e) {
123 123
 				$i++;
124 124
 				if (isset($globalDebug) && $globalDebug) echo $e->getMessage()."\n";
125 125
 				//exit;
@@ -143,10 +143,10 @@  discard block
 block discarded – undo
143 143
 		try {
144 144
 			//$Connection = new Connection();
145 145
 			$results = $this->db->query($query);
146
-		} catch(PDOException $e) {
146
+		} catch (PDOException $e) {
147 147
 			return false;
148 148
 		}
149
-		if($results->rowCount()>0) {
149
+		if ($results->rowCount() > 0) {
150 150
 		    return true; 
151 151
 		}
152 152
 		else return false;
@@ -167,8 +167,8 @@  discard block
 block discarded – undo
167 167
 			     return false;
168 168
 			}
169 169
 			
170
-		} catch(PDOException $e) {
171
-			if($e->getCode() != 'HY000' || !stristr($e->getMessage(), 'server has gone away')) {
170
+		} catch (PDOException $e) {
171
+			if ($e->getCode() != 'HY000' || !stristr($e->getMessage(), 'server has gone away')) {
172 172
             			throw $e;
173 173
 	                }
174 174
 	                //echo 'error ! '.$e->getMessage();
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
 	/*
181 181
 	* Check if index exist
182 182
 	*/
183
-	public function indexExists($table,$index)
183
+	public function indexExists($table, $index)
184 184
 	{
185 185
 		global $globalDBdriver, $globalDBname;
186 186
 		if ($globalDBdriver == 'mysql') {
@@ -191,11 +191,11 @@  discard block
 block discarded – undo
191 191
 		try {
192 192
 			//$Connection = new Connection();
193 193
 			$results = $this->db->query($query);
194
-		} catch(PDOException $e) {
194
+		} catch (PDOException $e) {
195 195
 			return false;
196 196
 		}
197 197
 		$nb = $results->fetchAll(PDO::FETCH_ASSOC);
198
-		if($nb[0]['nb'] > 0) {
198
+		if ($nb[0]['nb'] > 0) {
199 199
 			return true; 
200 200
 		}
201 201
 		else return false;
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
 		$query = "SELECT * FROM ".$table." LIMIT 0";
211 211
 		try {
212 212
 			$results = $this->db->query($query);
213
-		} catch(PDOException $e) {
213
+		} catch (PDOException $e) {
214 214
 			return "error : ".$e->getMessage()."\n";
215 215
 		}
216 216
 		$columns = array();
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
 	* Check if a column name exist in a table
227 227
 	* @return Boolean column exist or not
228 228
 	*/
229
-	public function checkColumnName($table,$name)
229
+	public function checkColumnName($table, $name)
230 230
 	{
231 231
 		global $globalDBdriver, $globalDBname;
232 232
 		if ($globalDBdriver == 'mysql') {
@@ -236,8 +236,8 @@  discard block
 block discarded – undo
236 236
 		}
237 237
 			try {
238 238
 				$sth = $this->db()->prepare($query);
239
-				$sth->execute(array(':database' => $globalDBname,':table' => $table,':name' => $name));
240
-			} catch(PDOException $e) {
239
+				$sth->execute(array(':database' => $globalDBname, ':table' => $table, ':name' => $name));
240
+			} catch (PDOException $e) {
241 241
 				echo "error : ".$e->getMessage()."\n";
242 242
 			}
243 243
 			$result = $sth->fetch(PDO::FETCH_ASSOC);
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
 				try {
277 277
 					$sth = $this->db->prepare($query);
278 278
 					$sth->execute();
279
-				} catch(PDOException $e) {
279
+				} catch (PDOException $e) {
280 280
 					return "error : ".$e->getMessage()."\n";
281 281
 				}
282 282
 				$result = $sth->fetch(PDO::FETCH_ASSOC);
Please login to merge, or discard this patch.
require/class.SpotterImport.php 1 patch
Spacing   +127 added lines, -127 removed lines patch added patch discarded remove patch
@@ -29,18 +29,18 @@  discard block
 block discarded – undo
29 29
 	$currentdate = date('Y-m-d');
30 30
 	$sourcestat = $Stats->getStatsSource($currentdate);
31 31
 	if (!empty($sourcestat)) {
32
-	    foreach($sourcestat as $srcst) {
32
+	    foreach ($sourcestat as $srcst) {
33 33
 	    	$type = $srcst['stats_type'];
34 34
 		if ($type == 'polar' || $type == 'hist') {
35 35
 		    $source = $srcst['source_name'];
36 36
 		    $data = $srcst['source_data'];
37
-		    $this->stats[$currentdate][$source][$type] = json_decode($data,true);
37
+		    $this->stats[$currentdate][$source][$type] = json_decode($data, true);
38 38
 	        }
39 39
 	    }
40 40
 	}
41 41
     }
42 42
 
43
-    public function get_Schedule($id,$ident) {
43
+    public function get_Schedule($id, $ident) {
44 44
 	global $globalDebug, $globalFork, $globalSchedulesFetch;
45 45
 	// Get schedule here, so it's done only one time
46 46
 	
@@ -64,8 +64,8 @@  discard block
 block discarded – undo
64 64
 		$schedule = $Schedule->fetchSchedule($operator);
65 65
 		if (count($schedule) > 0 && isset($schedule['DepartureTime']) && isset($schedule['ArrivalTime'])) {
66 66
 		    if ($globalDebug) echo "-> Schedule info for ".$operator." (".$ident.")\n";
67
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport_time' => $schedule['DepartureTime']));
68
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('arrival_airport_time' => $schedule['ArrivalTime']));
67
+		    $this->all_flights[$id] = array_merge($this->all_flights[$id], array('departure_airport_time' => $schedule['DepartureTime']));
68
+		    $this->all_flights[$id] = array_merge($this->all_flights[$id], array('arrival_airport_time' => $schedule['ArrivalTime']));
69 69
 		    // Should also check if route schedule = route from DB
70 70
 		    if ($schedule['DepartureAirportIATA'] != '') {
71 71
 			if ($this->all_flights[$id]['departure_airport'] != $Spotter->getAirportIcao($schedule['DepartureAirportIATA'])) {
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 			    }
86 86
 			}
87 87
 		    }
88
-		    $Schedule->addSchedule($operator,$this->all_flights[$id]['departure_airport'],$this->all_flights[$id]['departure_airport_time'],$this->all_flights[$id]['arrival_airport'],$this->all_flights[$id]['arrival_airport_time'],$schedule['Source']);
88
+		    $Schedule->addSchedule($operator, $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['arrival_airport_time'], $schedule['Source']);
89 89
 		}
90 90
 	    }
91 91
 	}
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
 		//echo $this->all_flights[$key]['id'].' - '.$this->all_flights[$key]['latitude'].'  '.$this->all_flights[$key]['longitude']."\n";
116 116
     		$Spotter = new Spotter($this->db);
117 117
         	$real_arrival = $this->arrival($key);
118
-        	$Spotter->updateLatestSpotterData($this->all_flights[$key]['id'],$this->all_flights[$key]['ident'],$this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$this->all_flights[$key]['altitude'],$this->all_flights[$key]['ground'],$this->all_flights[$key]['speed'],$this->all_flights[$key]['datetime'],$real_arrival['airport_icao'],$real_arrival['airport_time']);
118
+        	$Spotter->updateLatestSpotterData($this->all_flights[$key]['id'], $this->all_flights[$key]['ident'], $this->all_flights[$key]['latitude'], $this->all_flights[$key]['longitude'], $this->all_flights[$key]['altitude'], $this->all_flights[$key]['ground'], $this->all_flights[$key]['speed'], $this->all_flights[$key]['datetime'], $real_arrival['airport_icao'], $real_arrival['airport_time']);
119 119
             }
120 120
 	}
121 121
     }
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
         $airport_time = '';
129 129
         if (!isset($globalClosestMinDist) || $globalClosestMinDist == '') $globalClosestMinDist = 50;
130 130
 	if ($this->all_flights[$key]['latitude'] != '' && $this->all_flights[$key]['longitude'] != '') {
131
-	    $closestAirports = $Spotter->closestAirports($this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$globalClosestMinDist);
131
+	    $closestAirports = $Spotter->closestAirports($this->all_flights[$key]['latitude'], $this->all_flights[$key]['longitude'], $globalClosestMinDist);
132 132
     	    if (isset($closestAirports[0])) {
133 133
         	if (isset($this->all_flights[$key]['arrival_airport']) && $this->all_flights[$key]['arrival_airport'] == $closestAirports[0]['icao']) {
134 134
         	    $airport_icao = $closestAirports[0]['icao'];
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
         		    break;
144 144
         		}
145 145
         	    }
146
-        	} elseif ($this->all_flights[$key]['altitude'] == 0 || ($this->all_flights[$key]['altitude_real'] != '' && ($closestAirports[0]['altitude'] < $this->all_flights[$key]['altitude_real'] && $this->all_flights[$key]['altitude_real'] < $closestAirports[0]['altitude']+5000))) {
146
+        	} elseif ($this->all_flights[$key]['altitude'] == 0 || ($this->all_flights[$key]['altitude_real'] != '' && ($closestAirports[0]['altitude'] < $this->all_flights[$key]['altitude_real'] && $this->all_flights[$key]['altitude_real'] < $closestAirports[0]['altitude'] + 5000))) {
147 147
         		$airport_icao = $closestAirports[0]['icao'];
148 148
         		$airport_time = $this->all_flights[$key]['datetime'];
149 149
         	} else {
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
         } else {
157 157
         	if ($globalDebug) echo "---- No latitude or longitude. Ident : ".$this->all_flights[$key]['ident']."\n";
158 158
         }
159
-        return array('airport_icao' => $airport_icao,'airport_time' => $airport_time);
159
+        return array('airport_icao' => $airport_icao, 'airport_time' => $airport_time);
160 160
     }
161 161
 
162 162
 
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
 	if ($globalDebug) echo 'Delete old values and update latest data...'."\n";
168 168
 	foreach ($this->all_flights as $key => $flight) {
169 169
     	    if (isset($flight['lastupdate'])) {
170
-        	if ($flight['lastupdate'] < (time()-3000)) {
170
+        	if ($flight['lastupdate'] < (time() - 3000)) {
171 171
             	    if (isset($this->all_flights[$key]['id'])) {
172 172
             		if ($globalDebug) echo "--- Delete old values with id ".$this->all_flights[$key]['id']."\n";
173 173
 			/*
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
             		$real_arrival = $this->arrival($key);
179 179
             		$Spotter = new Spotter($this->db);
180 180
             		if ($this->all_flights[$key]['latitude'] != '' && $this->all_flights[$key]['longitude'] != '') {
181
-				$result = $Spotter->updateLatestSpotterData($this->all_flights[$key]['id'],$this->all_flights[$key]['ident'],$this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$this->all_flights[$key]['altitude'],$this->all_flights[$key]['ground'],$this->all_flights[$key]['speed'],$this->all_flights[$key]['datetime'],$real_arrival['airport_icao'],$real_arrival['airport_time']);
181
+				$result = $Spotter->updateLatestSpotterData($this->all_flights[$key]['id'], $this->all_flights[$key]['ident'], $this->all_flights[$key]['latitude'], $this->all_flights[$key]['longitude'], $this->all_flights[$key]['altitude'], $this->all_flights[$key]['ground'], $this->all_flights[$key]['speed'], $this->all_flights[$key]['datetime'], $real_arrival['airport_icao'], $real_arrival['airport_time']);
182 182
 				if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n";
183 183
 			}
184 184
 			// Put in archive
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
 	$send = false;
215 215
 	
216 216
 	// SBS format is CSV format
217
-	if(is_array($line) && isset($line['hex'])) {
217
+	if (is_array($line) && isset($line['hex'])) {
218 218
 	    //print_r($line);
219 219
   	    if ($line['hex'] != '' && $line['hex'] != '00000' && $line['hex'] != '000000' && $line['hex'] != '111111' && ctype_xdigit($line['hex']) && strlen($line['hex']) === 6) {
220 220
 
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
 		//print_r($this->all_flights);
249 249
 		if (!isset($this->all_flights[$id]['hex']) && ctype_xdigit($hex)) {
250 250
 		    $this->all_flights[$id] = array('hex' => $hex);
251
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0));
251
+		    $this->all_flights[$id] = array_merge($this->all_flights[$id], array('addedSpotter' => 0));
252 252
 		    //if (isset($line['datetime']) && preg_match('/^(\d{4}(?:\-\d{2}){2} \d{2}(?:\:\d{2}){2})$/',$line['datetime'])) {
253 253
 			//$this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => $line['datetime']));
254 254
 		    //} else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => date('Y-m-d H:i:s')));
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
 			$Spotter = new Spotter($this->db);
259 259
 			$aircraft_icao = $Spotter->getAllAircraftType($hex);
260 260
 			$Spotter->db = null;
261
-			if ($globalDebugTimeElapsed) echo 'Time elapsed for update getallaircrattype : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
261
+			if ($globalDebugTimeElapsed) echo 'Time elapsed for update getallaircrattype : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
262 262
 
263 263
 			if ($aircraft_icao == '' && isset($line['aircraft_type'])) {
264 264
 			    if ($line['aircraft_type'] == 'PARA_GLIDER') $aircraft_icao = 'GLID';
@@ -266,32 +266,32 @@  discard block
 block discarded – undo
266 266
 			    elseif ($line['aircraft_type'] == 'TOW_PLANE') $aircraft_icao = 'TOWPLANE';
267 267
 			    elseif ($line['aircraft_type'] == 'POWERED_AIRCRAFT') $aircraft_icao = 'POWAIRC';
268 268
 			}
269
-			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $aircraft_icao));
269
+			$this->all_flights[$id] = array_merge($this->all_flights[$id], array('aircraft_icao' => $aircraft_icao));
270 270
 		    } else if (isset($line['aircraft_name'])) {
271 271
 			// Get aircraft ICAO from aircraft name
272 272
 			$Spotter = new Spotter($this->db);
273 273
 			$aircraft_icao = $Spotter->getAircraftIcao($line['aircraft_name']);
274 274
 			$Spotter->db = null;
275
-			if ($aircraft_icao != '') $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $aircraft_icao));
276
-			else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => 'NA'));
277
-		    } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $line['aircraft_icao']));
278
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => '','departure_airport' => '', 'arrival_airport' => '','latitude' => '', 'longitude' => '', 'speed' => '', 'altitude' => '','altitude_real' => '', 'heading' => '','departure_airport_time' => '','arrival_airport_time' => '','squawk' => '','route_stop' => '','registration' => '','pilot_id' => '','pilot_name' => '','waypoints' => '','ground' => '0', 'format_source' => '','source_name' => '','over_country' => '','verticalrate' => '','noarchive' => false,'putinarchive' => true));
279
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('lastupdate' => time()));
275
+			if ($aircraft_icao != '') $this->all_flights[$id] = array_merge($this->all_flights[$id], array('aircraft_icao' => $aircraft_icao));
276
+			else $this->all_flights[$id] = array_merge($this->all_flights[$id], array('aircraft_icao' => 'NA'));
277
+		    } else $this->all_flights[$id] = array_merge($this->all_flights[$id], array('aircraft_icao' => $line['aircraft_icao']));
278
+		    $this->all_flights[$id] = array_merge($this->all_flights[$id], array('ident' => '', 'departure_airport' => '', 'arrival_airport' => '', 'latitude' => '', 'longitude' => '', 'speed' => '', 'altitude' => '', 'altitude_real' => '', 'heading' => '', 'departure_airport_time' => '', 'arrival_airport_time' => '', 'squawk' => '', 'route_stop' => '', 'registration' => '', 'pilot_id' => '', 'pilot_name' => '', 'waypoints' => '', 'ground' => '0', 'format_source' => '', 'source_name' => '', 'over_country' => '', 'verticalrate' => '', 'noarchive' => false, 'putinarchive' => true));
279
+		    $this->all_flights[$id] = array_merge($this->all_flights[$id], array('lastupdate' => time()));
280 280
 		    if (!isset($line['id'])) {
281 281
 			if (!isset($globalDaemon)) $globalDaemon = TRUE;
282 282
 //			if (isset($line['format_source']) && ($line['format_source'] == 'sbs' || $line['format_source'] == 'tsv' || $line['format_source'] == 'raw') && $globalDaemon) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'].'-'.date('YmdGi')));
283 283
 //			if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs') && $globalDaemon) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi')));
284
-			if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson')) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi')));
284
+			if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson')) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi')));
285 285
 		        //else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident']));
286
-		     } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id']));
286
+		     } else $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $line['id']));
287 287
 
288 288
 		    if ($globalDebug) echo "*********** New aircraft hex : ".$hex." ***********\n";
289 289
 		    if ($globalAllFlights !== FALSE) $dataFound = true;
290 290
 		}
291 291
 		
292
-		if (isset($line['datetime']) && preg_match('/^(\d{4}(?:\-\d{2}){2} \d{2}(?:\:\d{2}){2})$/',$line['datetime'])) {
292
+		if (isset($line['datetime']) && preg_match('/^(\d{4}(?:\-\d{2}){2} \d{2}(?:\:\d{2}){2})$/', $line['datetime'])) {
293 293
 		    if (!isset($this->all_flights[$id]['datetime']) || strtotime($line['datetime']) >= strtotime($this->all_flights[$id]['datetime'])) {
294
-			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => $line['datetime']));
294
+			$this->all_flights[$id] = array_merge($this->all_flights[$id], array('datetime' => $line['datetime']));
295 295
 		    } else {
296 296
 				if (strtotime($line['datetime']) == strtotime($this->all_flights[$id]['datetime']) && $globalDebug) echo "!!! Date is the same as previous data for ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."\n";
297 297
 				elseif (strtotime($line['datetime']) > strtotime($this->all_flights[$id]['datetime']) && $globalDebug) echo "!!! Date previous latest data (".$line['datetime']." > ".$this->all_flights[$id]['datetime'].") !!! for ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."\n";
@@ -302,23 +302,23 @@  discard block
 block discarded – undo
302 302
 				*/
303 303
 				return '';
304 304
 		    }
305
-		} else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => date('Y-m-d H:i:s')));
305
+		} else $this->all_flights[$id] = array_merge($this->all_flights[$id], array('datetime' => date('Y-m-d H:i:s')));
306 306
 
307 307
 		if (isset($line['registration']) && $line['registration'] != '' && $line['registration'] != 'z.NO-REG') {
308
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('registration' => $line['registration']));
308
+		    $this->all_flights[$id] = array_merge($this->all_flights[$id], array('registration' => $line['registration']));
309 309
 		}
310 310
 		if (isset($line['waypoints']) && $line['waypoints'] != '') {
311
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('waypoints' => $line['waypoints']));
311
+		    $this->all_flights[$id] = array_merge($this->all_flights[$id], array('waypoints' => $line['waypoints']));
312 312
 		}
313 313
 		if (isset($line['pilot_id']) && $line['pilot_id'] != '') {
314
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('pilot_id' => $line['pilot_id']));
314
+		    $this->all_flights[$id] = array_merge($this->all_flights[$id], array('pilot_id' => $line['pilot_id']));
315 315
 		}
316 316
 		if (isset($line['pilot_name']) && $line['pilot_name'] != '') {
317
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('pilot_name' => $line['pilot_name']));
317
+		    $this->all_flights[$id] = array_merge($this->all_flights[$id], array('pilot_name' => $line['pilot_name']));
318 318
 		}
319 319
  
320 320
 		if (isset($line['ident']) && $line['ident'] != '' && $line['ident'] != '????????' && $line['ident'] != '00000000' && ($this->all_flights[$id]['ident'] != trim($line['ident'])) && preg_match('/^[a-zA-Z0-9]+$/', $line['ident'])) {
321
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => trim($line['ident'])));
321
+		    $this->all_flights[$id] = array_merge($this->all_flights[$id], array('ident' => trim($line['ident'])));
322 322
 		    if ($this->all_flights[$id]['addedSpotter'] == 1) {
323 323
 			$timeelapsed = microtime(true);
324 324
             		$Spotter = new Spotter($this->db);
@@ -328,10 +328,10 @@  discard block
 block discarded – undo
328 328
 			elseif (isset($line['format_source']) && $line['format_source'] == 'whazzup') $fromsource = 'ivao';
329 329
 			elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim';
330 330
 			elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao';
331
-            		$result = $Spotter->updateIdentSpotterData($this->all_flights[$id]['id'],$this->all_flights[$id]['ident'],$fromsource);
331
+            		$result = $Spotter->updateIdentSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $fromsource);
332 332
 			if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n";
333 333
 			$Spotter->db = null;
334
-			if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
334
+			if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
335 335
 		    }
336 336
 
337 337
 /*
@@ -342,24 +342,24 @@  discard block
 block discarded – undo
342 342
 		        else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident']));
343 343
 		     } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id']));
344 344
   */
345
-		    if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident']));
345
+		    if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident']));
346 346
 
347 347
 		    //$putinarchive = true;
348 348
 		    if (isset($line['departure_airport_time']) && $line['departure_airport_time'] != 0) {
349
-			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport_time' => $line['departure_airport_time']));
349
+			$this->all_flights[$id] = array_merge($this->all_flights[$id], array('departure_airport_time' => $line['departure_airport_time']));
350 350
 		    }
351 351
 		    if (isset($line['arrival_airport_time']) && $line['arrival_airport_time'] != 0) {
352
-			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('arrival_airport_time' => $line['arrival_airport_time']));
352
+			$this->all_flights[$id] = array_merge($this->all_flights[$id], array('arrival_airport_time' => $line['arrival_airport_time']));
353 353
 		    }
354 354
 		    if (isset($line['departure_airport_icao']) && isset($line['arrival_airport_icao'])) {
355
-		    		$this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $line['departure_airport_icao'],'arrival_airport' => $line['arrival_airport_icao'],'route_stop' => ''));
355
+		    		$this->all_flights[$id] = array_merge($this->all_flights[$id], array('departure_airport' => $line['departure_airport_icao'], 'arrival_airport' => $line['arrival_airport_icao'], 'route_stop' => ''));
356 356
 		    } elseif (isset($line['departure_airport_iata']) && isset($line['arrival_airport_iata'])) {
357 357
 				$timeelapsed = microtime(true);
358 358
 				$Spotter = new Spotter($this->db);
359 359
 				$line['departure_airport_icao'] = $Spotter->getAirportIcao($line['departure_airport_iata']);
360 360
 				$line['arrival_airport_icao'] = $Spotter->getAirportIcao($line['arrival_airport_iata']);
361
-		    		$this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $line['departure_airport_icao'],'arrival_airport' => $line['arrival_airport_icao'],'route_stop' => ''));
362
-				if ($globalDebugTimeElapsed) echo 'Time elapsed for update getAirportICAO : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
361
+		    		$this->all_flights[$id] = array_merge($this->all_flights[$id], array('departure_airport' => $line['departure_airport_icao'], 'arrival_airport' => $line['arrival_airport_icao'], 'route_stop' => ''));
362
+				if ($globalDebugTimeElapsed) echo 'Time elapsed for update getAirportICAO : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
363 363
 
364 364
 		    } elseif (!isset($line['format_source']) || $line['format_source'] != 'aprs') {
365 365
 			$timeelapsed = microtime(true);
@@ -372,34 +372,34 @@  discard block
 block discarded – undo
372 372
 				$Translation->db = null;
373 373
 			}
374 374
 			$Spotter->db = null;
375
-			if ($globalDebugTimeElapsed) echo 'Time elapsed for update getrouteinfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
375
+			if ($globalDebugTimeElapsed) echo 'Time elapsed for update getrouteinfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
376 376
 
377 377
 			if (isset($route['fromairport_icao']) && isset($route['toairport_icao'])) {
378 378
 			    //if ($route['FromAirport_ICAO'] != $route['ToAirport_ICAO']) {
379 379
 			    if ($route['fromairport_icao'] != $route['toairport_icao']) {
380 380
 				//    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $route['FromAirport_ICAO'],'arrival_airport' => $route['ToAirport_ICAO'],'route_stop' => $route['RouteStop']));
381
-		    		$this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $route['fromairport_icao'],'arrival_airport' => $route['toairport_icao'],'route_stop' => $route['routestop']));
381
+		    		$this->all_flights[$id] = array_merge($this->all_flights[$id], array('departure_airport' => $route['fromairport_icao'], 'arrival_airport' => $route['toairport_icao'], 'route_stop' => $route['routestop']));
382 382
 		    	    }
383 383
 			}
384 384
 			if (!isset($globalFork)) $globalFork = TRUE;
385 385
 			if (!$globalIVAO && !$globalVATSIM && !$globalphpVMS && !$globalVAM && (!isset($line['format_source']) || $line['format_source'] != 'aprs')) {
386
-				if (!isset($this->all_flights[$id]['schedule_check']) || $this->all_flights[$id]['schedule_check'] === false) $this->get_Schedule($id,trim($line['ident']));
386
+				if (!isset($this->all_flights[$id]['schedule_check']) || $this->all_flights[$id]['schedule_check'] === false) $this->get_Schedule($id, trim($line['ident']));
387 387
 			}
388 388
 		    }
389 389
 		}
390 390
 
391 391
 		if (isset($line['speed']) && $line['speed'] != '') {
392 392
 		//    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed' => $line[12]));
393
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed' => round($line['speed'])));
394
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed_fromsrc' => true));
393
+		    $this->all_flights[$id] = array_merge($this->all_flights[$id], array('speed' => round($line['speed'])));
394
+		    $this->all_flights[$id] = array_merge($this->all_flights[$id], array('speed_fromsrc' => true));
395 395
 		    //$dataFound = true;
396 396
 		} else if (!isset($this->all_flights[$id]['speed_fromsrc']) && isset($this->all_flights[$id]['time_last_coord']) && $this->all_flights[$id]['time_last_coord'] != time() && isset($line['latitude']) && isset($line['longitude'])) {
397
-		    $distance = $Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m');
397
+		    $distance = $Common->distance($line['latitude'], $line['longitude'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], 'm');
398 398
 		    if ($distance > 1000 && $distance < 10000) {
399 399
 		    // use datetime
400 400
 			$speed = $distance/(time() - $this->all_flights[$id]['time_last_coord']);
401 401
 			$speed = $speed*3.6;
402
-			if ($speed < 1000) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed' => round($speed)));
402
+			if ($speed < 1000) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('speed' => round($speed)));
403 403
   			if ($globalDebug) echo "ø Calculated Speed for ".$this->all_flights[$id]['hex']." : ".$speed." - distance : ".$distance."\n";
404 404
 		    }
405 405
 		}
@@ -407,11 +407,11 @@  discard block
 block discarded – undo
407 407
 
408 408
 
409 409
 	        if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) {
410
-	    	    if (isset($this->all_flights[$id]['time_last_coord'])) $timediff = round(time()-$this->all_flights[$id]['time_last_coord']);
410
+	    	    if (isset($this->all_flights[$id]['time_last_coord'])) $timediff = round(time() - $this->all_flights[$id]['time_last_coord']);
411 411
 	    	    else unset($timediff);
412
-	    	    if ($this->tmd > 5 || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || (isset($globalVAM) && $globalVAM) || !isset($timediff) || $timediff > 800 || ($timediff > 10 && isset($this->all_flights[$id]['latitude']) && isset($this->all_flights[$id]['longitude']) && $Common->withinThreshold($timediff,$Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m')))) {
412
+	    	    if ($this->tmd > 5 || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || (isset($globalVAM) && $globalVAM) || !isset($timediff) || $timediff > 800 || ($timediff > 10 && isset($this->all_flights[$id]['latitude']) && isset($this->all_flights[$id]['longitude']) && $Common->withinThreshold($timediff, $Common->distance($line['latitude'], $line['longitude'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], 'm')))) {
413 413
 			if (isset($this->all_flights[$id]['archive_latitude']) && isset($this->all_flights[$id]['archive_longitude']) && isset($this->all_flights[$id]['livedb_latitude']) && isset($this->all_flights[$id]['livedb_longitude'])) {
414
-			    if (!$Common->checkLine($this->all_flights[$id]['archive_latitude'],$this->all_flights[$id]['archive_longitude'],$this->all_flights[$id]['livedb_latitude'],$this->all_flights[$id]['livedb_longitude'],$line['latitude'],$line['longitude'])) {
414
+			    if (!$Common->checkLine($this->all_flights[$id]['archive_latitude'], $this->all_flights[$id]['archive_longitude'], $this->all_flights[$id]['livedb_latitude'], $this->all_flights[$id]['livedb_longitude'], $line['latitude'], $line['longitude'])) {
415 415
 				$this->all_flights[$id]['archive_latitude'] = $line['latitude'];
416 416
 				$this->all_flights[$id]['archive_longitude'] = $line['longitude'];
417 417
 				$this->all_flights[$id]['putinarchive'] = true;
@@ -419,10 +419,10 @@  discard block
 block discarded – undo
419 419
 				if ($globalDebug) echo "\n".' ------- Check Country.... ';
420 420
 				$timeelapsed = microtime(true);
421 421
 				$Spotter = new Spotter($this->db);
422
-				$all_country = $Spotter->getCountryFromLatitudeLongitude($line['latitude'],$line['longitude']);
422
+				$all_country = $Spotter->getCountryFromLatitudeLongitude($line['latitude'], $line['longitude']);
423 423
 				if (!empty($all_country)) $this->all_flights[$id]['over_country'] = $all_country['iso2'];
424 424
 				$Spotter->db = null;
425
-				if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
425
+				if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
426 426
 				$this->tmd = 0;
427 427
 				if ($globalDebug) echo 'FOUND : '.$this->all_flights[$id]['over_country'].' ---------------'."\n";
428 428
 			    }
@@ -431,13 +431,13 @@  discard block
 block discarded – undo
431 431
 			if (isset($line['latitude']) && $line['latitude'] != '' && $line['latitude'] != 0 && $line['latitude'] < 91 && $line['latitude'] > -90) {
432 432
 			    //if (!isset($this->all_flights[$id]['latitude']) || $this->all_flights[$id]['latitude'] == '' || abs($this->all_flights[$id]['latitude']-$line['latitude']) < 3 || $line['format_source'] != 'sbs' || time() - $this->all_flights[$id]['lastupdate'] > 30) {
433 433
 				if (!isset($this->all_flights[$id]['archive_latitude'])) $this->all_flights[$id]['archive_latitude'] = $line['latitude'];
434
-				if (!isset($this->all_flights[$id]['livedb_latitude']) || abs($this->all_flights[$id]['livedb_latitude']-$line['latitude']) > $globalCoordMinChange || $this->all_flights[$id]['format_source'] == 'aprs') {
434
+				if (!isset($this->all_flights[$id]['livedb_latitude']) || abs($this->all_flights[$id]['livedb_latitude'] - $line['latitude']) > $globalCoordMinChange || $this->all_flights[$id]['format_source'] == 'aprs') {
435 435
 				    $this->all_flights[$id]['livedb_latitude'] = $line['latitude'];
436 436
 				    $dataFound = true;
437 437
 				    $this->all_flights[$id]['time_last_coord'] = time();
438 438
 				}
439 439
 				// elseif ($globalDebug) echo '!*!*! Ignore data, too close to previous one'."\n";
440
-				$this->all_flights[$id] = array_merge($this->all_flights[$id],array('latitude' => $line['latitude']));
440
+				$this->all_flights[$id] = array_merge($this->all_flights[$id], array('latitude' => $line['latitude']));
441 441
 				/*
442 442
 				if (abs($this->all_flights[$id]['archive_latitude']-$this->all_flights[$id]['latitude']) > 0.3) {
443 443
 				    $this->all_flights[$id]['archive_latitude'] = $line['latitude'];
@@ -455,13 +455,13 @@  discard block
 block discarded – undo
455 455
 			    if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360;
456 456
 			    //if (!isset($this->all_flights[$id]['longitude']) || $this->all_flights[$id]['longitude'] == ''  || abs($this->all_flights[$id]['longitude']-$line['longitude']) < 2 || $line['format_source'] != 'sbs' || time() - $this->all_flights[$id]['lastupdate'] > 30) {
457 457
 				if (!isset($this->all_flights[$id]['archive_longitude'])) $this->all_flights[$id]['archive_longitude'] = $line['longitude'];
458
-				if (!isset($this->all_flights[$id]['livedb_longitude']) || abs($this->all_flights[$id]['livedb_longitude']-$line['longitude']) > $globalCoordMinChange || $this->all_flights[$id]['format_source'] == 'aprs') {
458
+				if (!isset($this->all_flights[$id]['livedb_longitude']) || abs($this->all_flights[$id]['livedb_longitude'] - $line['longitude']) > $globalCoordMinChange || $this->all_flights[$id]['format_source'] == 'aprs') {
459 459
 				    $this->all_flights[$id]['livedb_longitude'] = $line['longitude'];
460 460
 				    $dataFound = true;
461 461
 				    $this->all_flights[$id]['time_last_coord'] = time();
462 462
 				}
463 463
 				// elseif ($globalDebug) echo '!*!*! Ignore data, too close to previous one'."\n";
464
-				$this->all_flights[$id] = array_merge($this->all_flights[$id],array('longitude' => $line['longitude']));
464
+				$this->all_flights[$id] = array_merge($this->all_flights[$id], array('longitude' => $line['longitude']));
465 465
 				/*
466 466
 				if (abs($this->all_flights[$id]['archive_longitude']-$this->all_flights[$id]['longitude']) > 0.3) {
467 467
 				    $this->all_flights[$id]['archive_longitude'] = $line['longitude'];
@@ -479,45 +479,45 @@  discard block
 block discarded – undo
479 479
 		    } else if ($globalDebug && $timediff > 20) {
480 480
 			$this->tmd = $this->tmd + 1;
481 481
 			echo '!!! Too much distance in short time... for '.$this->all_flights[$id]['ident']."\n";
482
-			echo 'Time : '.$timediff.'s - Distance : '.$Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m')."m -";
483
-			echo 'Speed : '.(($Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m')/$timediff)*3.6)." km/h - ";
482
+			echo 'Time : '.$timediff.'s - Distance : '.$Common->distance($line['latitude'], $line['longitude'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], 'm')."m -";
483
+			echo 'Speed : '.(($Common->distance($line['latitude'], $line['longitude'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], 'm')/$timediff)*3.6)." km/h - ";
484 484
 			echo 'Lat : '.$line['latitude'].' - long : '.$line['longitude'].' - prev lat : '.$this->all_flights[$id]['latitude'].' - prev long : '.$this->all_flights[$id]['longitude']." \n";
485 485
 		    }
486 486
 		}
487 487
 		if (isset($line['last_update']) && $line['last_update'] != '') {
488 488
 		    if (isset($this->all_flights[$id]['last_update']) && $this->all_flights[$id]['last_update'] != $line['last_update']) $dataFound = true;
489
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('last_update' => $line['last_update']));
489
+		    $this->all_flights[$id] = array_merge($this->all_flights[$id], array('last_update' => $line['last_update']));
490 490
 		}
491 491
 		if (isset($line['verticalrate']) && $line['verticalrate'] != '') {
492
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('verticalrate' => $line['verticalrate']));
492
+		    $this->all_flights[$id] = array_merge($this->all_flights[$id], array('verticalrate' => $line['verticalrate']));
493 493
 		    //$dataFound = true;
494 494
 		}
495 495
 		if (isset($line['format_source']) && $line['format_source'] != '') {
496
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('format_source' => $line['format_source']));
496
+		    $this->all_flights[$id] = array_merge($this->all_flights[$id], array('format_source' => $line['format_source']));
497 497
 		}
498 498
 		if (isset($line['source_name']) && $line['source_name'] != '') {
499
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('source_name' => $line['source_name']));
499
+		    $this->all_flights[$id] = array_merge($this->all_flights[$id], array('source_name' => $line['source_name']));
500 500
 		}
501 501
 		if (isset($line['emergency']) && $line['emergency'] != '') {
502
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('emergency' => $line['emergency']));
502
+		    $this->all_flights[$id] = array_merge($this->all_flights[$id], array('emergency' => $line['emergency']));
503 503
 		    //$dataFound = true;
504 504
 		}
505 505
 		if (isset($line['ground']) && $line['ground'] != '') {
506 506
 		    if (isset($this->all_flights[$id]['ground']) && $this->all_flights[$id]['ground'] == 1 && $line['ground'] == 0) {
507 507
 			// Here we force archive of flight because after ground it's a new one (or should be)
508
-			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0));
509
-			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('forcenew' => 1));
510
-			if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw') && $globalDaemon) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdGi')));
511
-		        elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id']));
512
-			elseif (isset($this->all_flights[$id]['ident'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident']));
508
+			$this->all_flights[$id] = array_merge($this->all_flights[$id], array('addedSpotter' => 0));
509
+			$this->all_flights[$id] = array_merge($this->all_flights[$id], array('forcenew' => 1));
510
+			if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw') && $globalDaemon) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdGi')));
511
+		        elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $line['id']));
512
+			elseif (isset($this->all_flights[$id]['ident'])) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident']));
513 513
 		    }
514 514
 		    if ($line['ground'] != 1) $line['ground'] = 0;
515
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ground' => $line['ground']));
515
+		    $this->all_flights[$id] = array_merge($this->all_flights[$id], array('ground' => $line['ground']));
516 516
 		    //$dataFound = true;
517 517
 		}
518 518
 		if (isset($line['squawk']) && $line['squawk'] != '') {
519 519
 		    if (isset($this->all_flights[$id]['squawk']) && $this->all_flights[$id]['squawk'] != '7500' && $this->all_flights[$id]['squawk'] != '7600' && $this->all_flights[$id]['squawk'] != '7700' && isset($this->all_flights[$id]['id'])) {
520
-			    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk']));
520
+			    $this->all_flights[$id] = array_merge($this->all_flights[$id], array('squawk' => $line['squawk']));
521 521
 			    $highlight = '';
522 522
 			    if ($this->all_flights[$id]['squawk'] == '7500') $highlight = 'Squawk 7500 : Hijack at '.date('Y-m-d G:i').' UTC';
523 523
 			    if ($this->all_flights[$id]['squawk'] == '7600') $highlight = 'Squawk 7600 : Lost Comm (radio failure) at '.date('Y-m-d G:i').' UTC';
@@ -525,48 +525,48 @@  discard block
 block discarded – undo
525 525
 			    if ($highlight != '') {
526 526
 				$timeelapsed = microtime(true);
527 527
 				$Spotter = new Spotter($this->db);
528
-				$Spotter->setHighlightFlight($this->all_flights[$id]['id'],$highlight);
528
+				$Spotter->setHighlightFlight($this->all_flights[$id]['id'], $highlight);
529 529
 				$Spotter->db = null;
530
-				if ($globalDebugTimeElapsed) echo 'Time elapsed for update sethighlightflight : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
530
+				if ($globalDebugTimeElapsed) echo 'Time elapsed for update sethighlightflight : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
531 531
 
532 532
 				$this->all_flights[$id]['putinarchive'] = true;
533 533
 				//$putinarchive = true;
534 534
 				//$highlight = '';
535 535
 			    }
536 536
 			    
537
-		    } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk']));
537
+		    } else $this->all_flights[$id] = array_merge($this->all_flights[$id], array('squawk' => $line['squawk']));
538 538
 		    //$dataFound = true;
539 539
 		}
540 540
 
541 541
 		if (isset($line['altitude']) && $line['altitude'] != '') {
542 542
 		    //if (!isset($this->all_flights[$id]['altitude']) || $this->all_flights[$id]['altitude'] == '' || ($this->all_flights[$id]['altitude'] > 0 && $line['altitude'] != 0)) {
543
-			if (abs(round($line['altitude']/100)-$this->all_flights[$id]['altitude']) > 2) $this->all_flights[$id]['putinarchive'] = true;
544
-			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('altitude' => round($line['altitude']/100)));
545
-			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('altitude_real' => $line['altitude']));
543
+			if (abs(round($line['altitude']/100) - $this->all_flights[$id]['altitude']) > 2) $this->all_flights[$id]['putinarchive'] = true;
544
+			$this->all_flights[$id] = array_merge($this->all_flights[$id], array('altitude' => round($line['altitude']/100)));
545
+			$this->all_flights[$id] = array_merge($this->all_flights[$id], array('altitude_real' => $line['altitude']));
546 546
 			//$dataFound = true;
547 547
 		    //} elseif ($globalDebug) echo "!!! Strange altitude data... not added.\n";
548 548
   		}
549 549
 
550 550
 		if (isset($line['noarchive']) && $line['noarchive'] === true) {
551
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('noarchive' => true));
551
+		    $this->all_flights[$id] = array_merge($this->all_flights[$id], array('noarchive' => true));
552 552
 		}
553 553
 		
554 554
 		if (isset($line['heading']) && $line['heading'] != '') {
555
-		    if (abs($this->all_flights[$id]['heading']-round($line['heading'])) > 2) $this->all_flights[$id]['putinarchive'] = true;
556
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => round($line['heading'])));
557
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading_fromsrc' => true));
555
+		    if (abs($this->all_flights[$id]['heading'] - round($line['heading'])) > 2) $this->all_flights[$id]['putinarchive'] = true;
556
+		    $this->all_flights[$id] = array_merge($this->all_flights[$id], array('heading' => round($line['heading'])));
557
+		    $this->all_flights[$id] = array_merge($this->all_flights[$id], array('heading_fromsrc' => true));
558 558
 		    //$dataFound = true;
559 559
   		} elseif (!isset($this->all_flights[$id]['heading_fromsrc']) && isset($this->all_flights[$id]['archive_latitude']) && $this->all_flights[$id]['archive_latitude'] != $this->all_flights[$id]['latitude'] && isset($this->all_flights[$id]['archive_longitude']) && $this->all_flights[$id]['archive_longitude'] != $this->all_flights[$id]['longitude']) {
560
-  		    $heading = $Common->getHeading($this->all_flights[$id]['archive_latitude'],$this->all_flights[$id]['archive_longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude']);
561
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => round($heading)));
562
-		    if (abs($this->all_flights[$id]['heading']-round($heading)) > 2) $this->all_flights[$id]['putinarchive'] = true;
560
+  		    $heading = $Common->getHeading($this->all_flights[$id]['archive_latitude'], $this->all_flights[$id]['archive_longitude'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude']);
561
+		    $this->all_flights[$id] = array_merge($this->all_flights[$id], array('heading' => round($heading)));
562
+		    if (abs($this->all_flights[$id]['heading'] - round($heading)) > 2) $this->all_flights[$id]['putinarchive'] = true;
563 563
   		    if ($globalDebug) echo "ø Calculated Heading for ".$this->all_flights[$id]['hex']." : ".$heading."\n";
564 564
   		} elseif (isset($this->all_flights[$id]['format_source']) && $this->all_flights[$id]['format_source'] == 'ACARS') {
565 565
   		    // If not enough messages and ACARS set heading to 0
566
-  		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => 0));
566
+  		    $this->all_flights[$id] = array_merge($this->all_flights[$id], array('heading' => 0));
567 567
   		}
568
-		if (isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalSourcesupdate) $dataFound = false;
569
-		elseif (isset($globalSBS1update) && $globalSBS1update != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalSBS1update) $dataFound = false;
568
+		if (isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_flights[$id]['lastupdate']) && time() - $this->all_flights[$id]['lastupdate'] < $globalSourcesupdate) $dataFound = false;
569
+		elseif (isset($globalSBS1update) && $globalSBS1update != '' && isset($this->all_flights[$id]['lastupdate']) && time() - $this->all_flights[$id]['lastupdate'] < $globalSBS1update) $dataFound = false;
570 570
 
571 571
 //		print_r($this->all_flights[$id]);
572 572
 		//gets the callsign from the last hour
@@ -576,7 +576,7 @@  discard block
 block discarded – undo
576 576
 		if ($dataFound === true && isset($this->all_flights[$id]['hex'])) {
577 577
 		    $this->all_flights[$id]['lastupdate'] = time();
578 578
 		    if ($this->all_flights[$id]['addedSpotter'] == 0) {
579
-		        if (!isset($globalDistanceIgnore['latitude']) || $this->all_flights[$id]['longitude'] == ''  || $this->all_flights[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) {
579
+		        if (!isset($globalDistanceIgnore['latitude']) || $this->all_flights[$id]['longitude'] == '' || $this->all_flights[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $globalDistanceIgnore['latitude'], $globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) {
580 580
 			    //print_r($this->all_flights);
581 581
 			    //echo $this->all_flights[$id]['id'].' - '.$this->all_flights[$id]['addedSpotter']."\n";
582 582
 			    //$last_hour_ident = Spotter->getIdentFromLastHour($this->all_flights[$id]['ident']);
@@ -586,61 +586,61 @@  discard block
 block discarded – undo
586 586
 				$SpotterLive = new SpotterLive($this->db);
587 587
 				if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson')) {
588 588
 				    $recent_ident = $SpotterLive->checkModeSRecent($this->all_flights[$id]['hex']);
589
-				    if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkModeSRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
589
+				    if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkModeSRecent : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
590 590
 				} elseif (isset($line['id'])) {
591 591
 				    $recent_ident = $SpotterLive->checkIdRecent($line['id']);
592
-				    if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
592
+				    if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
593 593
 				} elseif (isset($this->all_flights[$id]['ident']) && $this->all_flights[$id]['ident'] != '') {
594 594
 				    $recent_ident = $SpotterLive->checkIdentRecent($this->all_flights[$id]['ident']);
595
-				    if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
595
+				    if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
596 596
 				} else $recent_ident = '';
597
-				$SpotterLive->db=null;
597
+				$SpotterLive->db = null;
598 598
 
599 599
 				if ($globalDebug && $recent_ident == '') echo " Not in DB.\n";
600 600
 				elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n";
601 601
 			    } else {
602 602
 				$recent_ident = '';
603
-				$this->all_flights[$id] = array_merge($this->all_flights[$id],array('forcenew' => 0));
603
+				$this->all_flights[$id] = array_merge($this->all_flights[$id], array('forcenew' => 0));
604 604
 			    }
605 605
 			    //if there was no aircraft with the same callsign within the last hour and go post it into the archive
606
-			    if($recent_ident == "")
606
+			    if ($recent_ident == "")
607 607
 			    {
608 608
 				if ($globalDebug) echo "\o/ Add ".$this->all_flights[$id]['ident']." in archive DB : ";
609 609
 				if ($this->all_flights[$id]['departure_airport'] == "") { $this->all_flights[$id]['departure_airport'] = "NA"; }
610 610
 				if ($this->all_flights[$id]['arrival_airport'] == "") { $this->all_flights[$id]['arrival_airport'] = "NA"; }
611 611
 				//adds the spotter data for the archive
612 612
 				$ignoreImport = false;
613
-				foreach($globalAirportIgnore as $airportIgnore) {
613
+				foreach ($globalAirportIgnore as $airportIgnore) {
614 614
 				    if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) {
615 615
 					$ignoreImport = true;
616 616
 				    }
617 617
 				}
618 618
 				if (count($globalAirportAccept) > 0) {
619 619
 				    $ignoreImport = true;
620
-				    foreach($globalAirportIgnore as $airportIgnore) {
620
+				    foreach ($globalAirportIgnore as $airportIgnore) {
621 621
 					if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) {
622 622
 					    $ignoreImport = false;
623 623
 					}
624 624
 				    }
625 625
 				}
626 626
 				if (isset($globalAirlineIgnore) && is_array($globalAirlineIgnore)) {
627
-				    foreach($globalAirlineIgnore as $airlineIgnore) {
628
-					if ((is_numeric(substr(substr($this->all_flights[$id]['ident'],0,4),-1,1)) && substr($this->all_flights[$id]['ident'],0,3) == $airlineIgnore) || (is_numeric(substr(substr($this->all_flights[$id]['ident'],0,3),-1,1)) && substr($this->all_flights[$id]['ident'],0,2) == $airlineIgnore)) {
627
+				    foreach ($globalAirlineIgnore as $airlineIgnore) {
628
+					if ((is_numeric(substr(substr($this->all_flights[$id]['ident'], 0, 4), -1, 1)) && substr($this->all_flights[$id]['ident'], 0, 3) == $airlineIgnore) || (is_numeric(substr(substr($this->all_flights[$id]['ident'], 0, 3), -1, 1)) && substr($this->all_flights[$id]['ident'], 0, 2) == $airlineIgnore)) {
629 629
 					    $ignoreImport = true;
630 630
 					}
631 631
 				    }
632 632
 				}
633 633
 				if (isset($globalAirlineAccept) && count($globalAirlineAccept) > 0) {
634 634
 				    $ignoreImport = true;
635
-				    foreach($globalAirlineAccept as $airlineAccept) {
636
-					if ((is_numeric(substr(substr($this->all_flights[$id]['ident'],0,4),-1,1)) && substr($this->all_flights[$id]['ident'],0,3) == $airlineAccept) || (is_numeric(substr(substr($this->all_flights[$id]['ident'],0,3),-1,1)) && substr($this->all_flights[$id]['ident'],0,2) == $airlineAccept)) {
635
+				    foreach ($globalAirlineAccept as $airlineAccept) {
636
+					if ((is_numeric(substr(substr($this->all_flights[$id]['ident'], 0, 4), -1, 1)) && substr($this->all_flights[$id]['ident'], 0, 3) == $airlineAccept) || (is_numeric(substr(substr($this->all_flights[$id]['ident'], 0, 3), -1, 1)) && substr($this->all_flights[$id]['ident'], 0, 2) == $airlineAccept)) {
637 637
 					    $ignoreImport = false;
638 638
 					}
639 639
 				    }
640 640
 				}
641 641
 				if (isset($globalPilotIdAccept) && count($globalPilotIdAccept) > 0) {
642 642
 				    $ignoreImport = true;
643
-				    foreach($globalPilotIdAccept as $pilotIdAccept) {
643
+				    foreach ($globalPilotIdAccept as $pilotIdAccept) {
644 644
 					if ($this->all_flights[$id]['pilot_id'] == $pilotIdAccept) {
645 645
 					    $ignoreImport = false;
646 646
 					}
@@ -652,27 +652,27 @@  discard block
 block discarded – undo
652 652
 				    if ($this->all_flights[$id]['squawk'] == '7500') $highlight = 'Squawk 7500 : Hijack';
653 653
 				    if ($this->all_flights[$id]['squawk'] == '7600') $highlight = 'Squawk 7600 : Lost Comm (radio failure)';
654 654
 				    if ($this->all_flights[$id]['squawk'] == '7700') $highlight = 'Squawk 7700 : Emergency';
655
-				    if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi')));
655
+				    if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi')));
656 656
 				    $timeelapsed = microtime(true);
657 657
 				    $Spotter = new Spotter($this->db);
658
-				    $result = $Spotter->addSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['aircraft_icao'], $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['waypoints'], $this->all_flights[$id]['altitude'], $this->all_flights[$id]['heading'], $this->all_flights[$id]['speed'], $this->all_flights[$id]['datetime'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport_time'],$this->all_flights[$id]['squawk'],$this->all_flights[$id]['route_stop'],$highlight,$this->all_flights[$id]['hex'],$this->all_flights[$id]['registration'],$this->all_flights[$id]['pilot_id'],$this->all_flights[$id]['pilot_name'],$this->all_flights[$id]['verticalrate'],$this->all_flights[$id]['ground'],$this->all_flights[$id]['format_source'],$this->all_flights[$id]['source_name']);
658
+				    $result = $Spotter->addSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['aircraft_icao'], $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['waypoints'], $this->all_flights[$id]['altitude'], $this->all_flights[$id]['heading'], $this->all_flights[$id]['speed'], $this->all_flights[$id]['datetime'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport_time'], $this->all_flights[$id]['squawk'], $this->all_flights[$id]['route_stop'], $highlight, $this->all_flights[$id]['hex'], $this->all_flights[$id]['registration'], $this->all_flights[$id]['pilot_id'], $this->all_flights[$id]['pilot_name'], $this->all_flights[$id]['verticalrate'], $this->all_flights[$id]['ground'], $this->all_flights[$id]['format_source'], $this->all_flights[$id]['source_name']);
659 659
 				    $Spotter->db = null;
660 660
 				    if ($globalDebug && isset($result)) echo $result."\n";
661
-				    if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
661
+				    if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
662 662
 				    
663 663
 				    // Add source stat in DB
664 664
 				    $Stats = new Stats($this->db);
665 665
 				    if (!empty($this->stats)) {
666 666
 					if ($globalDebug) echo 'Add source stats : ';
667
-				        foreach($this->stats as $date => $data) {
668
-					    foreach($data as $source => $sourced) {
667
+				        foreach ($this->stats as $date => $data) {
668
+					    foreach ($data as $source => $sourced) {
669 669
 					        //print_r($sourced);
670
-				    	        if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar',$date);
671
-				    	        if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist',$date);
670
+				    	        if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']), $source, 'polar', $date);
671
+				    	        if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']), $source, 'hist', $date);
672 672
 				    		if (isset($sourced['msg'])) {
673 673
 				    		    if (time() - $sourced['msg']['date'] > 10) {
674 674
 				    		        $nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date']));
675
-				    		        echo $Stats->addStatSource($nbmsg,$source,'msg',$date);
675
+				    		        echo $Stats->addStatSource($nbmsg, $source, 'msg', $date);
676 676
 			    			        unset($this->stats[$date][$source]['msg']);
677 677
 			    			    }
678 678
 			    			}
@@ -708,18 +708,18 @@  discard block
 block discarded – undo
708 708
 				    //SpotterLive->deleteLiveSpotterDataNotUpdated();
709 709
 				    $SpotterLive = new SpotterLive($this->db);
710 710
 				    $SpotterLive->deleteLiveSpotterData();
711
-				    $SpotterLive->db=null;
711
+				    $SpotterLive->db = null;
712 712
 				    if ($globalDebug) echo " Done\n";
713 713
 				    $this->last_delete = time();
714 714
 				}
715 715
 			    } else {
716
-				if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt'|| $line['format_source'] === 'planeupdatefaa'  || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson')) {
716
+				if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson')) {
717 717
 				    $this->all_flights[$id]['id'] = $recent_ident;
718 718
 				    $this->all_flights[$id]['addedSpotter'] = 1;
719 719
 				}
720 720
 				if (isset($globalDaemon) && !$globalDaemon) {
721 721
 					$Spotter = new Spotter($this->db);
722
-					$Spotter->updateLatestSpotterData($this->all_flights[$id]['id'],$this->all_flights[$id]['ident'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$this->all_flights[$id]['altitude'],$this->all_flights[$id]['ground'],$this->all_flights[$id]['speed'],$this->all_flights[$id]['datetime'],$this->all_flights[$id]['arrival_airport'],$this->all_flights[$id]['arrival_airport_time']);
722
+					$Spotter->updateLatestSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['altitude'], $this->all_flights[$id]['ground'], $this->all_flights[$id]['speed'], $this->all_flights[$id]['datetime'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['arrival_airport_time']);
723 723
 					$Spotter->db = null;
724 724
 				}
725 725
 				
@@ -743,37 +743,37 @@  discard block
 block discarded – undo
743 743
 		    if ($this->all_flights[$id]['departure_airport'] == "") { $this->all_flights[$id]['departure_airport'] = "NA"; }
744 744
 		    if ($this->all_flights[$id]['arrival_airport'] == "") { $this->all_flights[$id]['arrival_airport'] = "NA"; }
745 745
 
746
-		    foreach($globalAirportIgnore as $airportIgnore) {
746
+		    foreach ($globalAirportIgnore as $airportIgnore) {
747 747
 		        if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) {
748 748
 			    $ignoreImport = true;
749 749
 			}
750 750
 		    }
751 751
 		    if (count($globalAirportAccept) > 0) {
752 752
 		        $ignoreImport = true;
753
-		        foreach($globalAirportIgnore as $airportIgnore) {
753
+		        foreach ($globalAirportIgnore as $airportIgnore) {
754 754
 			    if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) {
755 755
 				$ignoreImport = false;
756 756
 			    }
757 757
 			}
758 758
 		    }
759 759
 		    if (isset($globalAirlineIgnore) && is_array($globalAirlineIgnore)) {
760
-			foreach($globalAirlineIgnore as $airlineIgnore) {
761
-			    if ((is_numeric(substr(substr($this->all_flights[$id]['ident'],0,4),-1,1)) && substr($this->all_flights[$id]['ident'],0,3) == $airlineIgnore) || (is_numeric(substr(substr($this->all_flights[$id]['ident'],0,3),-1,1)) && substr($this->all_flights[$id]['ident'],0,2) == $airlineIgnore)) {
760
+			foreach ($globalAirlineIgnore as $airlineIgnore) {
761
+			    if ((is_numeric(substr(substr($this->all_flights[$id]['ident'], 0, 4), -1, 1)) && substr($this->all_flights[$id]['ident'], 0, 3) == $airlineIgnore) || (is_numeric(substr(substr($this->all_flights[$id]['ident'], 0, 3), -1, 1)) && substr($this->all_flights[$id]['ident'], 0, 2) == $airlineIgnore)) {
762 762
 				$ignoreImport = true;
763 763
 			    }
764 764
 			}
765 765
 		    }
766 766
 		    if (isset($globalAirlineAccept) && count($globalAirlineAccept) > 0) {
767 767
 			$ignoreImport = true;
768
-			foreach($globalAirlineAccept as $airlineAccept) {
769
-			    if ((is_numeric(substr(substr($this->all_flights[$id]['ident'],0,4),-1,1)) && substr($this->all_flights[$id]['ident'],0,3) == $airlineAccept) || (is_numeric(substr(substr($this->all_flights[$id]['ident'],0,3),-1,1)) && substr($this->all_flights[$id]['ident'],0,2) == $airlineAccept)) {
768
+			foreach ($globalAirlineAccept as $airlineAccept) {
769
+			    if ((is_numeric(substr(substr($this->all_flights[$id]['ident'], 0, 4), -1, 1)) && substr($this->all_flights[$id]['ident'], 0, 3) == $airlineAccept) || (is_numeric(substr(substr($this->all_flights[$id]['ident'], 0, 3), -1, 1)) && substr($this->all_flights[$id]['ident'], 0, 2) == $airlineAccept)) {
770 770
 				$ignoreImport = false;
771 771
 			    }
772 772
 			}
773 773
 		    }
774 774
 		    if (isset($globalPilotIdAccept) && count($globalPilotIdAccept) > 0) {
775 775
 			$ignoreImport = true;
776
-			foreach($globalPilotIdAccept as $pilotIdAccept) {
776
+			foreach ($globalPilotIdAccept as $pilotIdAccept) {
777 777
 			    if ($this->all_flights[$id]['pilot_id'] == $pilotIdAccept) {
778 778
 			        $ignoreImport = false;
779 779
 			    }
@@ -781,13 +781,13 @@  discard block
 block discarded – undo
781 781
 		    }
782 782
 
783 783
 		    if (!$ignoreImport) {
784
-			if (!isset($globalDistanceIgnore['latitude']) || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) {
784
+			if (!isset($globalDistanceIgnore['latitude']) || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $globalDistanceIgnore['latitude'], $globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) {
785 785
 				if ($globalDebug) echo "\o/ Add ".$this->all_flights[$id]['ident']." from ".$this->all_flights[$id]['format_source']." in Live DB : ";
786 786
 				$timeelapsed = microtime(true);
787 787
 				$SpotterLive = new SpotterLive($this->db);
788
-				$result = $SpotterLive->addLiveSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['aircraft_icao'], $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['waypoints'], $this->all_flights[$id]['altitude'], $this->all_flights[$id]['heading'], $this->all_flights[$id]['speed'],$this->all_flights[$id]['datetime'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport_time'], $this->all_flights[$id]['squawk'],$this->all_flights[$id]['route_stop'],$this->all_flights[$id]['hex'],$this->all_flights[$id]['putinarchive'],$this->all_flights[$id]['registration'],$this->all_flights[$id]['pilot_id'],$this->all_flights[$id]['pilot_name'], $this->all_flights[$id]['verticalrate'], $this->all_flights[$id]['noarchive'], $this->all_flights[$id]['ground'],$this->all_flights[$id]['format_source'],$this->all_flights[$id]['source_name'],$this->all_flights[$id]['over_country']);
788
+				$result = $SpotterLive->addLiveSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['aircraft_icao'], $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['waypoints'], $this->all_flights[$id]['altitude'], $this->all_flights[$id]['heading'], $this->all_flights[$id]['speed'], $this->all_flights[$id]['datetime'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport_time'], $this->all_flights[$id]['squawk'], $this->all_flights[$id]['route_stop'], $this->all_flights[$id]['hex'], $this->all_flights[$id]['putinarchive'], $this->all_flights[$id]['registration'], $this->all_flights[$id]['pilot_id'], $this->all_flights[$id]['pilot_name'], $this->all_flights[$id]['verticalrate'], $this->all_flights[$id]['noarchive'], $this->all_flights[$id]['ground'], $this->all_flights[$id]['format_source'], $this->all_flights[$id]['source_name'], $this->all_flights[$id]['over_country']);
789 789
 				$SpotterLive->db = null;
790
-				if ($globalDebugTimeElapsed) echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
790
+				if ($globalDebugTimeElapsed) echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
791 791
 
792 792
 				// Put statistics in $this->stats variable
793 793
 				//if ($line['format_source'] != 'aprs') {
@@ -805,19 +805,19 @@  discard block
 block discarded – undo
805 805
 							$latitude = $globalCenterLatitude;
806 806
 							$longitude = $globalCenterLongitude;
807 807
 						}
808
-						$this->source_location[$source] = array('latitude' => $latitude,'longitude' => $longitude);
808
+						$this->source_location[$source] = array('latitude' => $latitude, 'longitude' => $longitude);
809 809
 					} else {
810 810
 						$latitude = $this->source_location[$source]['latitude'];
811 811
 						$longitude = $this->source_location[$source]['longitude'];
812 812
 					}
813
-					$stats_heading = $Common->getHeading($latitude,$longitude,$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude']);
813
+					$stats_heading = $Common->getHeading($latitude, $longitude, $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude']);
814 814
 					//$stats_heading = $stats_heading%22.5;
815 815
 					$stats_heading = round($stats_heading/22.5);
816
-					$stats_distance = $Common->distance($latitude,$longitude,$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude']);
816
+					$stats_distance = $Common->distance($latitude, $longitude, $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude']);
817 817
 					$current_date = date('Y-m-d');
818 818
 					if ($stats_heading == 16) $stats_heading = 0;
819 819
 					if (!isset($this->stats[$current_date][$source]['polar'][1])) {
820
-						for ($i=0;$i<=15;$i++) {
820
+						for ($i = 0; $i <= 15; $i++) {
821 821
 						    $this->stats[$current_date][$source]['polar'][$i] = 0;
822 822
 						}
823 823
 						$this->stats[$current_date][$source]['polar'][$stats_heading] = $stats_distance;
@@ -832,9 +832,9 @@  discard block
 block discarded – undo
832 832
 					if (!isset($this->stats[$current_date][$source]['hist'][$distance])) {
833 833
 						if (isset($this->stats[$current_date][$source]['hist'][0])) {
834 834
 						    end($this->stats[$current_date][$source]['hist']);
835
-						    $mini = key($this->stats[$current_date][$source]['hist'])+10;
835
+						    $mini = key($this->stats[$current_date][$source]['hist']) + 10;
836 836
 						} else $mini = 0;
837
-						for ($i=$mini;$i<=$distance;$i+=10) {
837
+						for ($i = $mini; $i <= $distance; $i += 10) {
838 838
 						    $this->stats[$current_date][$source]['hist'][$i] = 0;
839 839
 						}
840 840
 						$this->stats[$current_date][$source]['hist'][$distance] = 1;
@@ -847,7 +847,7 @@  discard block
 block discarded – undo
847 847
 				if ($this->all_flights[$id]['putinarchive']) $send = true;
848 848
 				//if ($globalDebug) echo "Distance : ".Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude'])."\n";
849 849
 				if ($globalDebug) echo $result."\n";
850
-			} elseif (isset($this->all_flights[$id]['latitude']) && isset($globalDistanceIgnore['latitude']) && $globalDebug) echo "!! Too far -> Distance : ".$Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude'])."\n";
850
+			} elseif (isset($this->all_flights[$id]['latitude']) && isset($globalDistanceIgnore['latitude']) && $globalDebug) echo "!! Too far -> Distance : ".$Common->distance($this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $globalDistanceIgnore['latitude'], $globalDistanceIgnore['longitude'])."\n";
851 851
 			//$this->del();
852 852
 			
853 853
 			
Please login to merge, or discard this patch.
install/index.php 1 patch
Spacing   +195 added lines, -195 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
 require_once(dirname(__FILE__).'/class.create_db.php');
10 10
 require_once(dirname(__FILE__).'/class.update_schema.php');
11 11
 require_once(dirname(__FILE__).'/class.settings.php');
12
-$title="Install";
12
+$title = "Install";
13 13
 require(dirname(__FILE__).'/../require/settings.php');
14 14
 require(dirname(__FILE__).'/header.php');
15 15
 
@@ -63,8 +63,8 @@  discard block
 block discarded – undo
63 63
 if (!extension_loaded('curl')) {
64 64
 	$error[] = "Curl is not loaded.";
65 65
 }
66
-if(function_exists('apache_get_modules') ){
67
-	if(!in_array('mod_rewrite',apache_get_modules())) {
66
+if (function_exists('apache_get_modules')) {
67
+	if (!in_array('mod_rewrite', apache_get_modules())) {
68 68
 		$error[] = "mod_rewrite is not available.";
69 69
 	}
70 70
 /*
@@ -79,8 +79,8 @@  discard block
 block discarded – undo
79 79
 }
80 80
 if (isset($_SERVER['REQUEST_SCHEME']) && isset($_SERVER['SERVER_NAME']) && isset($_SERVER['SERVER_PORT']) && isset($_SERVER['REQUEST_URI'])) {
81 81
 	if (function_exists('get_headers')) {
82
-		$check_header = @get_headers($_SERVER['REQUEST_SCHEME'].'://'.$_SERVER["SERVER_NAME"].':'.$_SERVER["SERVER_PORT"].str_replace('install/','search',str_replace('index.php',$_SERVER["REQUEST_URI"])));
83
-		if (isset($check_header[0]) && !stripos($check_header[0],"200 OK")) {
82
+		$check_header = @get_headers($_SERVER['REQUEST_SCHEME'].'://'.$_SERVER["SERVER_NAME"].':'.$_SERVER["SERVER_PORT"].str_replace('install/', 'search', str_replace('index.php', $_SERVER["REQUEST_URI"])));
83
+		if (isset($check_header[0]) && !stripos($check_header[0], "200 OK")) {
84 84
 			print '<div class="info column"><p><strong>Check your configuration, rewrite don\'t seems to work.</strong></p></div>';
85 85
 		}
86 86
 	}
@@ -420,13 +420,13 @@  discard block
 block discarded – undo
420 420
 ?>
421 421
 							<tr>
422 422
 								<?php
423
-								    if (filter_var($source['host'],FILTER_VALIDATE_URL)) {
423
+								    if (filter_var($source['host'], FILTER_VALIDATE_URL)) {
424 424
 								?>
425 425
 								<td><input type="text" name="host[]" id="host" value="<?php print $source['host']; ?>" /></td>
426 426
 								<td><input type="number" name="port[]" id="port" value="<?php print $source['port']; ?>" /></td>
427 427
 								<?php
428 428
 								    } else {
429
-									$hostport = explode(':',$source['host']);
429
+									$hostport = explode(':', $source['host']);
430 430
 									if (isset($hostport[1])) {
431 431
 										$host = $hostport[0];
432 432
 										$port = $hostport[1];
@@ -749,7 +749,7 @@  discard block
 block discarded – undo
749 749
 			<br />
750 750
 			<p>
751 751
 				<label for="aircraftsize">Size of aircraft icon on map (default to 30px if zoom > 7 else 15px), empty to default</label>
752
-				<input type="number" name="aircraftsize" id="aircraftsize" value="<?php if (isset($globalAircraftSize)) echo $globalAircraftSize;?>" />
752
+				<input type="number" name="aircraftsize" id="aircraftsize" value="<?php if (isset($globalAircraftSize)) echo $globalAircraftSize; ?>" />
753 753
 			</p>
754 754
 			<br />
755 755
 			<p>
@@ -795,14 +795,14 @@  discard block
 block discarded – undo
795 795
 $error = '';
796 796
 
797 797
 if (isset($_POST['dbtype'])) {
798
-	$dbtype = filter_input(INPUT_POST,'dbtype',FILTER_SANITIZE_STRING);
799
-	$dbroot = filter_input(INPUT_POST,'dbroot',FILTER_SANITIZE_STRING);
800
-	$dbrootpass = filter_input(INPUT_POST,'dbrootpass',FILTER_SANITIZE_STRING);
801
-	$dbname = filter_input(INPUT_POST,'dbname',FILTER_SANITIZE_STRING);
802
-	$dbuser = filter_input(INPUT_POST,'dbuser',FILTER_SANITIZE_STRING);
803
-	$dbuserpass = filter_input(INPUT_POST,'dbuserpass',FILTER_SANITIZE_STRING);
804
-	$dbhost = filter_input(INPUT_POST,'dbhost',FILTER_SANITIZE_STRING);
805
-	$dbport = filter_input(INPUT_POST,'dbport',FILTER_SANITIZE_STRING);
798
+	$dbtype = filter_input(INPUT_POST, 'dbtype', FILTER_SANITIZE_STRING);
799
+	$dbroot = filter_input(INPUT_POST, 'dbroot', FILTER_SANITIZE_STRING);
800
+	$dbrootpass = filter_input(INPUT_POST, 'dbrootpass', FILTER_SANITIZE_STRING);
801
+	$dbname = filter_input(INPUT_POST, 'dbname', FILTER_SANITIZE_STRING);
802
+	$dbuser = filter_input(INPUT_POST, 'dbuser', FILTER_SANITIZE_STRING);
803
+	$dbuserpass = filter_input(INPUT_POST, 'dbuserpass', FILTER_SANITIZE_STRING);
804
+	$dbhost = filter_input(INPUT_POST, 'dbhost', FILTER_SANITIZE_STRING);
805
+	$dbport = filter_input(INPUT_POST, 'dbport', FILTER_SANITIZE_STRING);
806 806
 
807 807
 	if ($dbtype == 'mysql' && !extension_loaded('pdo_mysql')) $error .= 'Mysql driver for PDO must be loaded';
808 808
 	if ($dbtype == 'pgsql' && !extension_loaded('pdo_pgsql')) $error .= 'PosgreSQL driver for PDO must be loaded';
@@ -822,48 +822,48 @@  discard block
 block discarded – undo
822 822
 	} else $settings = array_merge($settings,array('globalDBdriver' => $dbtype,'globalDBhost' => $dbhost,'globalDBuser' => $dbuser,'globalDBport' => $dbport,'globalDBpass' => $dbuserpass,'globalDBname' => $dbname));
823 823
 	*/
824 824
 	
825
-	$settings = array_merge($settings,array('globalDBdriver' => $dbtype,'globalDBhost' => $dbhost,'globalDBuser' => $dbuser,'globalDBport' => $dbport,'globalDBpass' => $dbuserpass,'globalDBname' => $dbname));
825
+	$settings = array_merge($settings, array('globalDBdriver' => $dbtype, 'globalDBhost' => $dbhost, 'globalDBuser' => $dbuser, 'globalDBport' => $dbport, 'globalDBpass' => $dbuserpass, 'globalDBname' => $dbname));
826 826
 
827
-	$sitename = filter_input(INPUT_POST,'sitename',FILTER_SANITIZE_STRING);
828
-	$siteurl = filter_input(INPUT_POST,'siteurl',FILTER_SANITIZE_STRING);
829
-	$timezone = filter_input(INPUT_POST,'timezone',FILTER_SANITIZE_STRING);
830
-	$language = filter_input(INPUT_POST,'language',FILTER_SANITIZE_STRING);
831
-	$settings = array_merge($settings,array('globalName' => $sitename,'globalURL' => $siteurl, 'globalTimezone' => $timezone,'globalLanguage' => $language));
827
+	$sitename = filter_input(INPUT_POST, 'sitename', FILTER_SANITIZE_STRING);
828
+	$siteurl = filter_input(INPUT_POST, 'siteurl', FILTER_SANITIZE_STRING);
829
+	$timezone = filter_input(INPUT_POST, 'timezone', FILTER_SANITIZE_STRING);
830
+	$language = filter_input(INPUT_POST, 'language', FILTER_SANITIZE_STRING);
831
+	$settings = array_merge($settings, array('globalName' => $sitename, 'globalURL' => $siteurl, 'globalTimezone' => $timezone, 'globalLanguage' => $language));
832 832
 
833
-	$mapprovider = filter_input(INPUT_POST,'mapprovider',FILTER_SANITIZE_STRING);
834
-	$mapboxid = filter_input(INPUT_POST,'mapboxid',FILTER_SANITIZE_STRING);
835
-	$mapboxtoken = filter_input(INPUT_POST,'mapboxtoken',FILTER_SANITIZE_STRING);
836
-	$googlekey = filter_input(INPUT_POST,'googlekey',FILTER_SANITIZE_STRING);
837
-	$bingkey = filter_input(INPUT_POST,'bingkey',FILTER_SANITIZE_STRING);
838
-	$mapquestkey = filter_input(INPUT_POST,'mapquestkey',FILTER_SANITIZE_STRING);
839
-	$hereappid = filter_input(INPUT_POST,'hereappid',FILTER_SANITIZE_STRING);
840
-	$hereappcode = filter_input(INPUT_POST,'hereappcode',FILTER_SANITIZE_STRING);
841
-	$settings = array_merge($settings,array('globalMapProvider' => $mapprovider,'globalMapboxId' => $mapboxid,'globalMapboxToken' => $mapboxtoken,'globalGoogleAPIKey' => $googlekey,'globalBingMapKey' => $bingkey,'globalHereappID' => $hereappid,'globalHereappCode' => $hereappcode,'globalMapQuestKey' => $mapquestkey));
833
+	$mapprovider = filter_input(INPUT_POST, 'mapprovider', FILTER_SANITIZE_STRING);
834
+	$mapboxid = filter_input(INPUT_POST, 'mapboxid', FILTER_SANITIZE_STRING);
835
+	$mapboxtoken = filter_input(INPUT_POST, 'mapboxtoken', FILTER_SANITIZE_STRING);
836
+	$googlekey = filter_input(INPUT_POST, 'googlekey', FILTER_SANITIZE_STRING);
837
+	$bingkey = filter_input(INPUT_POST, 'bingkey', FILTER_SANITIZE_STRING);
838
+	$mapquestkey = filter_input(INPUT_POST, 'mapquestkey', FILTER_SANITIZE_STRING);
839
+	$hereappid = filter_input(INPUT_POST, 'hereappid', FILTER_SANITIZE_STRING);
840
+	$hereappcode = filter_input(INPUT_POST, 'hereappcode', FILTER_SANITIZE_STRING);
841
+	$settings = array_merge($settings, array('globalMapProvider' => $mapprovider, 'globalMapboxId' => $mapboxid, 'globalMapboxToken' => $mapboxtoken, 'globalGoogleAPIKey' => $googlekey, 'globalBingMapKey' => $bingkey, 'globalHereappID' => $hereappid, 'globalHereappCode' => $hereappcode, 'globalMapQuestKey' => $mapquestkey));
842 842
 	
843
-	$latitudemax = filter_input(INPUT_POST,'latitudemax',FILTER_SANITIZE_STRING);
844
-	$latitudemin = filter_input(INPUT_POST,'latitudemin',FILTER_SANITIZE_STRING);
845
-	$longitudemax = filter_input(INPUT_POST,'longitudemax',FILTER_SANITIZE_STRING);
846
-	$longitudemin = filter_input(INPUT_POST,'longitudemin',FILTER_SANITIZE_STRING);
847
-	$livezoom = filter_input(INPUT_POST,'livezoom',FILTER_SANITIZE_NUMBER_INT);
848
-	$settings = array_merge($settings,array('globalLatitudeMax' => $latitudemax,'globalLatitudeMin' => $latitudemin,'globalLongitudeMax' => $longitudemax,'globalLongitudeMin' => $longitudemin,'globalLiveZoom' => $livezoom));
843
+	$latitudemax = filter_input(INPUT_POST, 'latitudemax', FILTER_SANITIZE_STRING);
844
+	$latitudemin = filter_input(INPUT_POST, 'latitudemin', FILTER_SANITIZE_STRING);
845
+	$longitudemax = filter_input(INPUT_POST, 'longitudemax', FILTER_SANITIZE_STRING);
846
+	$longitudemin = filter_input(INPUT_POST, 'longitudemin', FILTER_SANITIZE_STRING);
847
+	$livezoom = filter_input(INPUT_POST, 'livezoom', FILTER_SANITIZE_NUMBER_INT);
848
+	$settings = array_merge($settings, array('globalLatitudeMax' => $latitudemax, 'globalLatitudeMin' => $latitudemin, 'globalLongitudeMax' => $longitudemax, 'globalLongitudeMin' => $longitudemin, 'globalLiveZoom' => $livezoom));
849 849
 
850
-	$squawk_country = filter_input(INPUT_POST,'squawk_country',FILTER_SANITIZE_STRING);
851
-	$settings = array_merge($settings,array('globalSquawkCountry' => $squawk_country));
850
+	$squawk_country = filter_input(INPUT_POST, 'squawk_country', FILTER_SANITIZE_STRING);
851
+	$settings = array_merge($settings, array('globalSquawkCountry' => $squawk_country));
852 852
 
853
-	$latitudecenter = filter_input(INPUT_POST,'latitudecenter',FILTER_SANITIZE_STRING);
854
-	$longitudecenter = filter_input(INPUT_POST,'longitudecenter',FILTER_SANITIZE_STRING);
855
-	$settings = array_merge($settings,array('globalCenterLatitude' => $latitudecenter,'globalCenterLongitude' => $longitudecenter));
853
+	$latitudecenter = filter_input(INPUT_POST, 'latitudecenter', FILTER_SANITIZE_STRING);
854
+	$longitudecenter = filter_input(INPUT_POST, 'longitudecenter', FILTER_SANITIZE_STRING);
855
+	$settings = array_merge($settings, array('globalCenterLatitude' => $latitudecenter, 'globalCenterLongitude' => $longitudecenter));
856 856
 
857
-	$acars = filter_input(INPUT_POST,'acars',FILTER_SANITIZE_STRING);
857
+	$acars = filter_input(INPUT_POST, 'acars', FILTER_SANITIZE_STRING);
858 858
 	if ($acars == 'acars') {
859
-		$settings = array_merge($settings,array('globalACARS' => 'TRUE'));
859
+		$settings = array_merge($settings, array('globalACARS' => 'TRUE'));
860 860
 	} else {
861
-		$settings = array_merge($settings,array('globalACARS' => 'FALSE'));
861
+		$settings = array_merge($settings, array('globalACARS' => 'FALSE'));
862 862
 	}
863 863
 
864
-	$flightawareusername = filter_input(INPUT_POST,'flightawareusername',FILTER_SANITIZE_STRING);
865
-	$flightawarepassword = filter_input(INPUT_POST,'flightawarepassword',FILTER_SANITIZE_STRING);
866
-	$settings = array_merge($settings,array('globalFlightAwareUsername' => $flightawareusername,'globalFlightAwarePassword' => $flightawarepassword));
864
+	$flightawareusername = filter_input(INPUT_POST, 'flightawareusername', FILTER_SANITIZE_STRING);
865
+	$flightawarepassword = filter_input(INPUT_POST, 'flightawarepassword', FILTER_SANITIZE_STRING);
866
+	$settings = array_merge($settings, array('globalFlightAwareUsername' => $flightawareusername, 'globalFlightAwarePassword' => $flightawarepassword));
867 867
 	
868 868
 	$source_name = $_POST['source_name'];
869 869
 	$source_latitude = $_POST['source_latitude'];
@@ -877,8 +877,8 @@  discard block
 block discarded – undo
877 877
 	
878 878
 	$sources = array();
879 879
 	foreach ($source_name as $keys => $name) {
880
-	    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]);
881
-	    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]);
880
+	    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]);
881
+	    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]);
882 882
 	}
883 883
 	if (count($sources) > 0) $_SESSION['sources'] = $sources;
884 884
 
@@ -891,13 +891,13 @@  discard block
 block discarded – undo
891 891
 	$sbsurl = $_POST['sbsurl'];
892 892
 	*/
893 893
 
894
-	$globalvatsim = filter_input(INPUT_POST,'globalvatsim',FILTER_SANITIZE_STRING);
895
-	$globalivao = filter_input(INPUT_POST,'globalivao',FILTER_SANITIZE_STRING);
896
-	$globalphpvms = filter_input(INPUT_POST,'globalphpvms',FILTER_SANITIZE_STRING);
897
-	$globalvam = filter_input(INPUT_POST,'globalvam',FILTER_SANITIZE_STRING);
898
-	$globalsbs = filter_input(INPUT_POST,'globalsbs',FILTER_SANITIZE_STRING);
899
-	$globalaprs = filter_input(INPUT_POST,'globalaprs',FILTER_SANITIZE_STRING);
900
-	$datasource = filter_input(INPUT_POST,'datasource',FILTER_SANITIZE_STRING);
894
+	$globalvatsim = filter_input(INPUT_POST, 'globalvatsim', FILTER_SANITIZE_STRING);
895
+	$globalivao = filter_input(INPUT_POST, 'globalivao', FILTER_SANITIZE_STRING);
896
+	$globalphpvms = filter_input(INPUT_POST, 'globalphpvms', FILTER_SANITIZE_STRING);
897
+	$globalvam = filter_input(INPUT_POST, 'globalvam', FILTER_SANITIZE_STRING);
898
+	$globalsbs = filter_input(INPUT_POST, 'globalsbs', FILTER_SANITIZE_STRING);
899
+	$globalaprs = filter_input(INPUT_POST, 'globalaprs', FILTER_SANITIZE_STRING);
900
+	$datasource = filter_input(INPUT_POST, 'datasource', FILTER_SANITIZE_STRING);
901 901
 
902 902
 /*	
903 903
 	$globalSBS1Hosts = array();
@@ -913,7 +913,7 @@  discard block
 block discarded – undo
913 913
 	}
914 914
 	$settings = array_merge($settings,array('globalSBS1Hosts' => $globalSBS1Hosts));
915 915
 */
916
-	$settings_comment = array_merge($settings_comment,array('globalSBS1Hosts'));
916
+	$settings_comment = array_merge($settings_comment, array('globalSBS1Hosts'));
917 917
 	$host = $_POST['host'];
918 918
 	$port = $_POST['port'];
919 919
 	$name = $_POST['name'];
@@ -924,89 +924,89 @@  discard block
 block discarded – undo
924 924
 	foreach ($host as $key => $h) {
925 925
 		if (isset($sourcestats[$key]) && $sourcestats[$key] == 1) $cov = 'TRUE';
926 926
 		else $cov = 'FALSE';
927
-		if ($h != '') $gSources[] = array('host' => $h, 'port' => $port[$key],'name' => $name[$key],'format' => $format[$key],'sourcestats' => $cov);
927
+		if ($h != '') $gSources[] = array('host' => $h, 'port' => $port[$key], 'name' => $name[$key], 'format' => $format[$key], 'sourcestats' => $cov);
928 928
 	}
929
-	$settings = array_merge($settings,array('globalSources' => $gSources));
929
+	$settings = array_merge($settings, array('globalSources' => $gSources));
930 930
 
931 931
 /*
932 932
 	$sbstimeout = filter_input(INPUT_POST,'sbstimeout',FILTER_SANITIZE_NUMBER_INT);
933 933
 	$settings = array_merge($settings,array('globalSourcesTimeOut' => $sbstimeout));
934 934
 */
935
-	$acarshost = filter_input(INPUT_POST,'acarshost',FILTER_SANITIZE_STRING);
936
-	$acarsport = filter_input(INPUT_POST,'acarsport',FILTER_SANITIZE_NUMBER_INT);
937
-	$settings = array_merge($settings,array('globalACARSHost' => $acarshost,'globalACARSPort' => $acarsport));
935
+	$acarshost = filter_input(INPUT_POST, 'acarshost', FILTER_SANITIZE_STRING);
936
+	$acarsport = filter_input(INPUT_POST, 'acarsport', FILTER_SANITIZE_NUMBER_INT);
937
+	$settings = array_merge($settings, array('globalACARSHost' => $acarshost, 'globalACARSPort' => $acarsport));
938 938
 
939
-	$bitly = filter_input(INPUT_POST,'bitly',FILTER_SANITIZE_STRING);
940
-	$settings = array_merge($settings,array('globalBitlyAccessToken' => $bitly));
939
+	$bitly = filter_input(INPUT_POST, 'bitly', FILTER_SANITIZE_STRING);
940
+	$settings = array_merge($settings, array('globalBitlyAccessToken' => $bitly));
941 941
 
942
-	$notamsource = filter_input(INPUT_POST,'notamsource',FILTER_SANITIZE_STRING);
943
-	$settings = array_merge($settings,array('globalNOTAMSource' => $notamsource));
944
-	$metarsource = filter_input(INPUT_POST,'metarsource',FILTER_SANITIZE_STRING);
945
-	$settings = array_merge($settings,array('globalMETARurl' => $metarsource));
942
+	$notamsource = filter_input(INPUT_POST, 'notamsource', FILTER_SANITIZE_STRING);
943
+	$settings = array_merge($settings, array('globalNOTAMSource' => $notamsource));
944
+	$metarsource = filter_input(INPUT_POST, 'metarsource', FILTER_SANITIZE_STRING);
945
+	$settings = array_merge($settings, array('globalMETARurl' => $metarsource));
946 946
 
947
-	$zoilatitude = filter_input(INPUT_POST,'zoilatitude',FILTER_SANITIZE_STRING);
948
-	$zoilongitude = filter_input(INPUT_POST,'zoilongitude',FILTER_SANITIZE_STRING);
949
-	$zoidistance = filter_input(INPUT_POST,'zoidistance',FILTER_SANITIZE_NUMBER_INT);
947
+	$zoilatitude = filter_input(INPUT_POST, 'zoilatitude', FILTER_SANITIZE_STRING);
948
+	$zoilongitude = filter_input(INPUT_POST, 'zoilongitude', FILTER_SANITIZE_STRING);
949
+	$zoidistance = filter_input(INPUT_POST, 'zoidistance', FILTER_SANITIZE_NUMBER_INT);
950 950
 	if ($zoilatitude != '' && $zoilongitude != '' && $zoidistance != '') {
951
-		$settings = array_merge($settings,array('globalDistanceIgnore' => array('latitude' => $zoilatitude,'longitude' => $zoilongitude,'distance' => $zoidistance)));
952
-	} else $settings = array_merge($settings,array('globalDistanceIgnore' => array()));
951
+		$settings = array_merge($settings, array('globalDistanceIgnore' => array('latitude' => $zoilatitude, 'longitude' => $zoilongitude, 'distance' => $zoidistance)));
952
+	} else $settings = array_merge($settings, array('globalDistanceIgnore' => array()));
953 953
 
954
-	$refresh = filter_input(INPUT_POST,'refresh',FILTER_SANITIZE_NUMBER_INT);
955
-	$settings = array_merge($settings,array('globalLiveInterval' => $refresh));
956
-	$maprefresh = filter_input(INPUT_POST,'maprefresh',FILTER_SANITIZE_NUMBER_INT);
957
-	$settings = array_merge($settings,array('globalMapRefresh' => $maprefresh));
958
-	$mapidle = filter_input(INPUT_POST,'mapidle',FILTER_SANITIZE_NUMBER_INT);
959
-	$settings = array_merge($settings,array('globalMapIdleTimeout' => $mapidle));
960
-	$closestmindist = filter_input(INPUT_POST,'closestmindist',FILTER_SANITIZE_NUMBER_INT);
961
-	$settings = array_merge($settings,array('globalClosestMinDist' => $closestmindist));
954
+	$refresh = filter_input(INPUT_POST, 'refresh', FILTER_SANITIZE_NUMBER_INT);
955
+	$settings = array_merge($settings, array('globalLiveInterval' => $refresh));
956
+	$maprefresh = filter_input(INPUT_POST, 'maprefresh', FILTER_SANITIZE_NUMBER_INT);
957
+	$settings = array_merge($settings, array('globalMapRefresh' => $maprefresh));
958
+	$mapidle = filter_input(INPUT_POST, 'mapidle', FILTER_SANITIZE_NUMBER_INT);
959
+	$settings = array_merge($settings, array('globalMapIdleTimeout' => $mapidle));
960
+	$closestmindist = filter_input(INPUT_POST, 'closestmindist', FILTER_SANITIZE_NUMBER_INT);
961
+	$settings = array_merge($settings, array('globalClosestMinDist' => $closestmindist));
962 962
 
963
-	$aircraftsize = filter_input(INPUT_POST,'aircraftsize',FILTER_SANITIZE_NUMBER_INT);
964
-	$settings = array_merge($settings,array('globalAircraftSize' => $aircraftsize));
963
+	$aircraftsize = filter_input(INPUT_POST, 'aircraftsize', FILTER_SANITIZE_NUMBER_INT);
964
+	$settings = array_merge($settings, array('globalAircraftSize' => $aircraftsize));
965 965
 
966
-	$archivemonths = filter_input(INPUT_POST,'archivemonths',FILTER_SANITIZE_NUMBER_INT);
967
-	$settings = array_merge($settings,array('globalArchiveMonths' => $archivemonths));
966
+	$archivemonths = filter_input(INPUT_POST, 'archivemonths', FILTER_SANITIZE_NUMBER_INT);
967
+	$settings = array_merge($settings, array('globalArchiveMonths' => $archivemonths));
968 968
 	
969
-	$archiveyear = filter_input(INPUT_POST,'archiveyear',FILTER_SANITIZE_STRING);
969
+	$archiveyear = filter_input(INPUT_POST, 'archiveyear', FILTER_SANITIZE_STRING);
970 970
 	if ($archiveyear == "archiveyear") {
971
-		$settings = array_merge($settings,array('globalArchiveYear' => 'TRUE'));
971
+		$settings = array_merge($settings, array('globalArchiveYear' => 'TRUE'));
972 972
 	} else {
973
-		$settings = array_merge($settings,array('globalArchiveYear' => 'FALSE'));
973
+		$settings = array_merge($settings, array('globalArchiveYear' => 'FALSE'));
974 974
 	}
975
-	$archivekeepmonths = filter_input(INPUT_POST,'archivekeepmonths',FILTER_SANITIZE_NUMBER_INT);
976
-	$settings = array_merge($settings,array('globalArchiveKeepMonths' => $archivekeepmonths));
977
-	$archivekeeptrackmonths = filter_input(INPUT_POST,'archivekeeptrackmonths',FILTER_SANITIZE_NUMBER_INT);
978
-	$settings = array_merge($settings,array('globalArchiveKeepTrackMonths' => $archivekeeptrackmonths));
975
+	$archivekeepmonths = filter_input(INPUT_POST, 'archivekeepmonths', FILTER_SANITIZE_NUMBER_INT);
976
+	$settings = array_merge($settings, array('globalArchiveKeepMonths' => $archivekeepmonths));
977
+	$archivekeeptrackmonths = filter_input(INPUT_POST, 'archivekeeptrackmonths', FILTER_SANITIZE_NUMBER_INT);
978
+	$settings = array_merge($settings, array('globalArchiveKeepTrackMonths' => $archivekeeptrackmonths));
979 979
 
980
-	$britishairways = filter_input(INPUT_POST,'britishairways',FILTER_SANITIZE_STRING);
981
-	$settings = array_merge($settings,array('globalBritishAirwaysKey' => $britishairways));
982
-	$transavia = filter_input(INPUT_POST,'transavia',FILTER_SANITIZE_STRING);
983
-	$settings = array_merge($settings,array('globalTransaviaKey' => $transavia));
980
+	$britishairways = filter_input(INPUT_POST, 'britishairways', FILTER_SANITIZE_STRING);
981
+	$settings = array_merge($settings, array('globalBritishAirwaysKey' => $britishairways));
982
+	$transavia = filter_input(INPUT_POST, 'transavia', FILTER_SANITIZE_STRING);
983
+	$settings = array_merge($settings, array('globalTransaviaKey' => $transavia));
984 984
 
985
-	$lufthansakey = filter_input(INPUT_POST,'lufthansakey',FILTER_SANITIZE_STRING);
986
-	$lufthansasecret = filter_input(INPUT_POST,'lufthansasecret',FILTER_SANITIZE_STRING);
987
-	$settings = array_merge($settings,array('globalLufthansaKey' => array('key' => $lufthansakey,'secret' => $lufthansasecret)));
985
+	$lufthansakey = filter_input(INPUT_POST, 'lufthansakey', FILTER_SANITIZE_STRING);
986
+	$lufthansasecret = filter_input(INPUT_POST, 'lufthansasecret', FILTER_SANITIZE_STRING);
987
+	$settings = array_merge($settings, array('globalLufthansaKey' => array('key' => $lufthansakey, 'secret' => $lufthansasecret)));
988 988
 
989 989
 	// Create in settings.php keys not yet configurable if not already here
990 990
 	//if (!isset($globalImageBingKey)) $settings = array_merge($settings,array('globalImageBingKey' => ''));
991
-	if (!isset($globalDebug)) $settings = array_merge($settings,array('globalDebug' => 'TRUE'));
991
+	if (!isset($globalDebug)) $settings = array_merge($settings, array('globalDebug' => 'TRUE'));
992 992
 
993
-	$archive = filter_input(INPUT_POST,'archive',FILTER_SANITIZE_STRING);
993
+	$archive = filter_input(INPUT_POST, 'archive', FILTER_SANITIZE_STRING);
994 994
 	if ($archive == 'archive') {
995
-		$settings = array_merge($settings,array('globalArchive' => 'TRUE'));
995
+		$settings = array_merge($settings, array('globalArchive' => 'TRUE'));
996 996
 	} else {
997
-		$settings = array_merge($settings,array('globalArchive' => 'FALSE'));
997
+		$settings = array_merge($settings, array('globalArchive' => 'FALSE'));
998 998
 	}
999
-	$daemon = filter_input(INPUT_POST,'daemon',FILTER_SANITIZE_STRING);
999
+	$daemon = filter_input(INPUT_POST, 'daemon', FILTER_SANITIZE_STRING);
1000 1000
 	if ($daemon == 'daemon') {
1001
-		$settings = array_merge($settings,array('globalDaemon' => 'TRUE'));
1001
+		$settings = array_merge($settings, array('globalDaemon' => 'TRUE'));
1002 1002
 	} else {
1003
-		$settings = array_merge($settings,array('globalDaemon' => 'FALSE'));
1003
+		$settings = array_merge($settings, array('globalDaemon' => 'FALSE'));
1004 1004
 	}
1005
-	$schedules = filter_input(INPUT_POST,'schedules',FILTER_SANITIZE_STRING);
1005
+	$schedules = filter_input(INPUT_POST, 'schedules', FILTER_SANITIZE_STRING);
1006 1006
 	if ($schedules == 'schedules') {
1007
-		$settings = array_merge($settings,array('globalSchedulesFetch' => 'TRUE'));
1007
+		$settings = array_merge($settings, array('globalSchedulesFetch' => 'TRUE'));
1008 1008
 	} else {
1009
-		$settings = array_merge($settings,array('globalSchedulesFetch' => 'FALSE'));
1009
+		$settings = array_merge($settings, array('globalSchedulesFetch' => 'FALSE'));
1010 1010
 	}
1011 1011
 
1012 1012
 /*
@@ -1017,171 +1017,171 @@  discard block
 block discarded – undo
1017 1017
 		$settings = array_merge($settings,array('globalFlightAware' => 'FALSE','globalSBS1' => 'TRUE'));
1018 1018
 	}
1019 1019
 */
1020
-	$settings = array_merge($settings,array('globalFlightAware' => 'FALSE'));
1021
-	if ($globalsbs == 'sbs') $settings = array_merge($settings,array('globalSBS1' => 'TRUE'));
1022
-	else $settings = array_merge($settings,array('globalSBS1' => 'FALSE'));
1023
-	if ($globalaprs == 'aprs') $settings = array_merge($settings,array('globalAPRS' => 'TRUE'));
1024
-	else $settings = array_merge($settings,array('globalAPRS' => 'FALSE'));
1020
+	$settings = array_merge($settings, array('globalFlightAware' => 'FALSE'));
1021
+	if ($globalsbs == 'sbs') $settings = array_merge($settings, array('globalSBS1' => 'TRUE'));
1022
+	else $settings = array_merge($settings, array('globalSBS1' => 'FALSE'));
1023
+	if ($globalaprs == 'aprs') $settings = array_merge($settings, array('globalAPRS' => 'TRUE'));
1024
+	else $settings = array_merge($settings, array('globalAPRS' => 'FALSE'));
1025 1025
 	if ($globalivao == 'ivao') {
1026 1026
 		//$settings = array_merge($settings,array('globalIVAO' => 'TRUE','globalVATSIM' => 'FALSE'));
1027
-		$settings = array_merge($settings,array('globalIVAO' => 'TRUE'));
1028
-	} else $settings = array_merge($settings,array('globalIVAO' => 'FALSE'));
1027
+		$settings = array_merge($settings, array('globalIVAO' => 'TRUE'));
1028
+	} else $settings = array_merge($settings, array('globalIVAO' => 'FALSE'));
1029 1029
 	if ($globalvatsim == 'vatsim') {
1030 1030
 		//$settings = array_merge($settings,array('globalVATSIM' => 'TRUE','globalIVAO' => 'FALSE'));
1031
-		$settings = array_merge($settings,array('globalVATSIM' => 'TRUE'));
1032
-	} else $settings = array_merge($settings,array('globalVATSIM' => 'FALSE'));
1031
+		$settings = array_merge($settings, array('globalVATSIM' => 'TRUE'));
1032
+	} else $settings = array_merge($settings, array('globalVATSIM' => 'FALSE'));
1033 1033
 	if ($globalphpvms == 'phpvms') {
1034
-		$settings = array_merge($settings,array('globalphpVMS' => 'TRUE'));
1035
-	} else $settings = array_merge($settings,array('globalphpVMS' => 'FALSE'));
1034
+		$settings = array_merge($settings, array('globalphpVMS' => 'TRUE'));
1035
+	} else $settings = array_merge($settings, array('globalphpVMS' => 'FALSE'));
1036 1036
 	if ($globalvam == 'vam') {
1037
-		$settings = array_merge($settings,array('globalVAM' => 'TRUE'));
1038
-	} else $settings = array_merge($settings,array('globalVAM' => 'FALSE'));
1037
+		$settings = array_merge($settings, array('globalVAM' => 'TRUE'));
1038
+	} else $settings = array_merge($settings, array('globalVAM' => 'FALSE'));
1039 1039
 	if ($globalvatsim == 'vatsim' || $globalivao == 'ivao' || $globalphpvms == 'phpvms') {
1040
-		$settings = array_merge($settings,array('globalSchedulesFetch' => 'FALSE','globalTranslationFetch' => 'FALSE'));
1041
-	} else $settings = array_merge($settings,array('globalSchedulesFetch' => 'TRUE','globalTranslationFetch' => 'TRUE'));
1040
+		$settings = array_merge($settings, array('globalSchedulesFetch' => 'FALSE', 'globalTranslationFetch' => 'FALSE'));
1041
+	} else $settings = array_merge($settings, array('globalSchedulesFetch' => 'TRUE', 'globalTranslationFetch' => 'TRUE'));
1042 1042
 	
1043 1043
 
1044 1044
 
1045
-	$notam = filter_input(INPUT_POST,'notam',FILTER_SANITIZE_STRING);
1045
+	$notam = filter_input(INPUT_POST, 'notam', FILTER_SANITIZE_STRING);
1046 1046
 	if ($notam == 'notam') {
1047
-		$settings = array_merge($settings,array('globalNOTAM' => 'TRUE'));
1047
+		$settings = array_merge($settings, array('globalNOTAM' => 'TRUE'));
1048 1048
 	} else {
1049
-		$settings = array_merge($settings,array('globalNOTAM' => 'FALSE'));
1049
+		$settings = array_merge($settings, array('globalNOTAM' => 'FALSE'));
1050 1050
 	}
1051
-	$owner = filter_input(INPUT_POST,'owner',FILTER_SANITIZE_STRING);
1051
+	$owner = filter_input(INPUT_POST, 'owner', FILTER_SANITIZE_STRING);
1052 1052
 	if ($owner == 'owner') {
1053
-		$settings = array_merge($settings,array('globalOwner' => 'TRUE'));
1053
+		$settings = array_merge($settings, array('globalOwner' => 'TRUE'));
1054 1054
 	} else {
1055
-		$settings = array_merge($settings,array('globalOwner' => 'FALSE'));
1055
+		$settings = array_merge($settings, array('globalOwner' => 'FALSE'));
1056 1056
 	}
1057
-	$map3d = filter_input(INPUT_POST,'map3d',FILTER_SANITIZE_STRING);
1057
+	$map3d = filter_input(INPUT_POST, 'map3d', FILTER_SANITIZE_STRING);
1058 1058
 	if ($map3d == 'map3d') {
1059
-		$settings = array_merge($settings,array('globalMap3D' => 'TRUE'));
1059
+		$settings = array_merge($settings, array('globalMap3D' => 'TRUE'));
1060 1060
 	} else {
1061
-		$settings = array_merge($settings,array('globalMap3D' => 'FALSE'));
1061
+		$settings = array_merge($settings, array('globalMap3D' => 'FALSE'));
1062 1062
 	}
1063
-	$mapsatellites = filter_input(INPUT_POST,'mapsatellites',FILTER_SANITIZE_STRING);
1063
+	$mapsatellites = filter_input(INPUT_POST, 'mapsatellites', FILTER_SANITIZE_STRING);
1064 1064
 	if ($mapsatellites == 'mapsatellites') {
1065
-		$settings = array_merge($settings,array('globalMapSatellites' => 'TRUE'));
1065
+		$settings = array_merge($settings, array('globalMapSatellites' => 'TRUE'));
1066 1066
 	} else {
1067
-		$settings = array_merge($settings,array('globalMapSatellites' => 'FALSE'));
1067
+		$settings = array_merge($settings, array('globalMapSatellites' => 'FALSE'));
1068 1068
 	}
1069
-	$map3ddefault = filter_input(INPUT_POST,'map3ddefault',FILTER_SANITIZE_STRING);
1069
+	$map3ddefault = filter_input(INPUT_POST, 'map3ddefault', FILTER_SANITIZE_STRING);
1070 1070
 	if ($map3ddefault == 'map3ddefault') {
1071
-		$settings = array_merge($settings,array('globalMap3Ddefault' => 'TRUE'));
1071
+		$settings = array_merge($settings, array('globalMap3Ddefault' => 'TRUE'));
1072 1072
 	} else {
1073
-		$settings = array_merge($settings,array('globalMap3Ddefault' => 'FALSE'));
1073
+		$settings = array_merge($settings, array('globalMap3Ddefault' => 'FALSE'));
1074 1074
 	}
1075
-	$translate = filter_input(INPUT_POST,'translate',FILTER_SANITIZE_STRING);
1075
+	$translate = filter_input(INPUT_POST, 'translate', FILTER_SANITIZE_STRING);
1076 1076
 	if ($translate == 'translate') {
1077
-		$settings = array_merge($settings,array('globalTranslate' => 'TRUE'));
1077
+		$settings = array_merge($settings, array('globalTranslate' => 'TRUE'));
1078 1078
 	} else {
1079
-		$settings = array_merge($settings,array('globalTranslate' => 'FALSE'));
1079
+		$settings = array_merge($settings, array('globalTranslate' => 'FALSE'));
1080 1080
 	}
1081
-	$realairlines = filter_input(INPUT_POST,'realairlines',FILTER_SANITIZE_STRING);
1081
+	$realairlines = filter_input(INPUT_POST, 'realairlines', FILTER_SANITIZE_STRING);
1082 1082
 	if ($realairlines == 'realairlines') {
1083
-		$settings = array_merge($settings,array('globalUseRealAirlines' => 'TRUE'));
1083
+		$settings = array_merge($settings, array('globalUseRealAirlines' => 'TRUE'));
1084 1084
 	} else {
1085
-		$settings = array_merge($settings,array('globalUseRealAirlines' => 'FALSE'));
1085
+		$settings = array_merge($settings, array('globalUseRealAirlines' => 'FALSE'));
1086 1086
 	}
1087
-	$estimation = filter_input(INPUT_POST,'estimation',FILTER_SANITIZE_STRING);
1087
+	$estimation = filter_input(INPUT_POST, 'estimation', FILTER_SANITIZE_STRING);
1088 1088
 	if ($estimation == 'estimation') {
1089
-		$settings = array_merge($settings,array('globalMapEstimation' => 'TRUE'));
1089
+		$settings = array_merge($settings, array('globalMapEstimation' => 'TRUE'));
1090 1090
 	} else {
1091
-		$settings = array_merge($settings,array('globalMapEstimation' => 'FALSE'));
1091
+		$settings = array_merge($settings, array('globalMapEstimation' => 'FALSE'));
1092 1092
 	}
1093
-	$metar = filter_input(INPUT_POST,'metar',FILTER_SANITIZE_STRING);
1093
+	$metar = filter_input(INPUT_POST, 'metar', FILTER_SANITIZE_STRING);
1094 1094
 	if ($metar == 'metar') {
1095
-		$settings = array_merge($settings,array('globalMETAR' => 'TRUE'));
1095
+		$settings = array_merge($settings, array('globalMETAR' => 'TRUE'));
1096 1096
 	} else {
1097
-		$settings = array_merge($settings,array('globalMETAR' => 'FALSE'));
1097
+		$settings = array_merge($settings, array('globalMETAR' => 'FALSE'));
1098 1098
 	}
1099
-	$metarcycle = filter_input(INPUT_POST,'metarcycle',FILTER_SANITIZE_STRING);
1099
+	$metarcycle = filter_input(INPUT_POST, 'metarcycle', FILTER_SANITIZE_STRING);
1100 1100
 	if ($metarcycle == 'metarcycle') {
1101
-		$settings = array_merge($settings,array('globalMETARcycle' => 'TRUE'));
1101
+		$settings = array_merge($settings, array('globalMETARcycle' => 'TRUE'));
1102 1102
 	} else {
1103
-		$settings = array_merge($settings,array('globalMETARcycle' => 'FALSE'));
1103
+		$settings = array_merge($settings, array('globalMETARcycle' => 'FALSE'));
1104 1104
 	}
1105
-	$fork = filter_input(INPUT_POST,'fork',FILTER_SANITIZE_STRING);
1105
+	$fork = filter_input(INPUT_POST, 'fork', FILTER_SANITIZE_STRING);
1106 1106
 	if ($fork == 'fork') {
1107
-		$settings = array_merge($settings,array('globalFork' => 'TRUE'));
1107
+		$settings = array_merge($settings, array('globalFork' => 'TRUE'));
1108 1108
 	} else {
1109
-		$settings = array_merge($settings,array('globalFork' => 'FALSE'));
1109
+		$settings = array_merge($settings, array('globalFork' => 'FALSE'));
1110 1110
 	}
1111 1111
 
1112
-	$colormap = filter_input(INPUT_POST,'colormap',FILTER_SANITIZE_STRING);
1112
+	$colormap = filter_input(INPUT_POST, 'colormap', FILTER_SANITIZE_STRING);
1113 1113
 	if ($colormap == 'colormap') {
1114
-		$settings = array_merge($settings,array('globalMapAltitudeColor' => 'TRUE'));
1114
+		$settings = array_merge($settings, array('globalMapAltitudeColor' => 'TRUE'));
1115 1115
 	} else {
1116
-		$settings = array_merge($settings,array('globalMapAltitudeColor' => 'FALSE'));
1116
+		$settings = array_merge($settings, array('globalMapAltitudeColor' => 'FALSE'));
1117 1117
 	}
1118 1118
 	
1119 1119
 	if (isset($_POST['aircrafticoncolor'])) {
1120
-		$aircrafticoncolor = filter_input(INPUT_POST,'aircrafticoncolor',FILTER_SANITIZE_STRING);
1121
-		$settings = array_merge($settings,array('globalAircraftIconColor' => substr($aircrafticoncolor,1)));
1120
+		$aircrafticoncolor = filter_input(INPUT_POST, 'aircrafticoncolor', FILTER_SANITIZE_STRING);
1121
+		$settings = array_merge($settings, array('globalAircraftIconColor' => substr($aircrafticoncolor, 1)));
1122 1122
 	}
1123 1123
 
1124
-	$airportzoom = filter_input(INPUT_POST,'airportzoom',FILTER_SANITIZE_NUMBER_INT);
1125
-	$settings = array_merge($settings,array('globalAirportZoom' => $airportzoom));
1124
+	$airportzoom = filter_input(INPUT_POST, 'airportzoom', FILTER_SANITIZE_NUMBER_INT);
1125
+	$settings = array_merge($settings, array('globalAirportZoom' => $airportzoom));
1126 1126
 
1127
-	$unitdistance = filter_input(INPUT_POST,'unitdistance',FILTER_SANITIZE_STRING);
1128
-	$settings = array_merge($settings,array('globalUnitDistance' => $unitdistance));
1129
-	$unitaltitude = filter_input(INPUT_POST,'unitaltitude',FILTER_SANITIZE_STRING);
1130
-	$settings = array_merge($settings,array('globalUnitAltitude' => $unitaltitude));
1131
-	$unitspeed = filter_input(INPUT_POST,'unitspeed',FILTER_SANITIZE_STRING);
1132
-	$settings = array_merge($settings,array('globalUnitSpeed' => $unitspeed));
1127
+	$unitdistance = filter_input(INPUT_POST, 'unitdistance', FILTER_SANITIZE_STRING);
1128
+	$settings = array_merge($settings, array('globalUnitDistance' => $unitdistance));
1129
+	$unitaltitude = filter_input(INPUT_POST, 'unitaltitude', FILTER_SANITIZE_STRING);
1130
+	$settings = array_merge($settings, array('globalUnitAltitude' => $unitaltitude));
1131
+	$unitspeed = filter_input(INPUT_POST, 'unitspeed', FILTER_SANITIZE_STRING);
1132
+	$settings = array_merge($settings, array('globalUnitSpeed' => $unitspeed));
1133 1133
 
1134
-	$mappopup = filter_input(INPUT_POST,'mappopup',FILTER_SANITIZE_STRING);
1134
+	$mappopup = filter_input(INPUT_POST, 'mappopup', FILTER_SANITIZE_STRING);
1135 1135
 	if ($mappopup == 'mappopup') {
1136
-		$settings = array_merge($settings,array('globalMapPopup' => 'TRUE'));
1136
+		$settings = array_merge($settings, array('globalMapPopup' => 'TRUE'));
1137 1137
 	} else {
1138
-		$settings = array_merge($settings,array('globalMapPopup' => 'FALSE'));
1138
+		$settings = array_merge($settings, array('globalMapPopup' => 'FALSE'));
1139 1139
 	}
1140
-	$airportpopup = filter_input(INPUT_POST,'airportpopup',FILTER_SANITIZE_STRING);
1140
+	$airportpopup = filter_input(INPUT_POST, 'airportpopup', FILTER_SANITIZE_STRING);
1141 1141
 	if ($airportpopup == 'airportpopup') {
1142
-		$settings = array_merge($settings,array('globalAirportPopup' => 'TRUE'));
1142
+		$settings = array_merge($settings, array('globalAirportPopup' => 'TRUE'));
1143 1143
 	} else {
1144
-		$settings = array_merge($settings,array('globalAirportPopup' => 'FALSE'));
1144
+		$settings = array_merge($settings, array('globalAirportPopup' => 'FALSE'));
1145 1145
 	}
1146
-	$maphistory = filter_input(INPUT_POST,'maphistory',FILTER_SANITIZE_STRING);
1146
+	$maphistory = filter_input(INPUT_POST, 'maphistory', FILTER_SANITIZE_STRING);
1147 1147
 	if ($maphistory == 'maphistory') {
1148
-		$settings = array_merge($settings,array('globalMapHistory' => 'TRUE'));
1148
+		$settings = array_merge($settings, array('globalMapHistory' => 'TRUE'));
1149 1149
 	} else {
1150
-		$settings = array_merge($settings,array('globalMapHistory' => 'FALSE'));
1150
+		$settings = array_merge($settings, array('globalMapHistory' => 'FALSE'));
1151 1151
 	}
1152
-	$flightroute = filter_input(INPUT_POST,'flightroute',FILTER_SANITIZE_STRING);
1152
+	$flightroute = filter_input(INPUT_POST, 'flightroute', FILTER_SANITIZE_STRING);
1153 1153
 	if ($flightroute == 'flightroute') {
1154
-		$settings = array_merge($settings,array('globalMapRoute' => 'TRUE'));
1154
+		$settings = array_merge($settings, array('globalMapRoute' => 'TRUE'));
1155 1155
 	} else {
1156
-		$settings = array_merge($settings,array('globalMapRoute' => 'FALSE'));
1156
+		$settings = array_merge($settings, array('globalMapRoute' => 'FALSE'));
1157 1157
 	}
1158
-	$allflights = filter_input(INPUT_POST,'allflights',FILTER_SANITIZE_STRING);
1158
+	$allflights = filter_input(INPUT_POST, 'allflights', FILTER_SANITIZE_STRING);
1159 1159
 	if ($allflights == 'allflights') {
1160
-		$settings = array_merge($settings,array('globalAllFlights' => 'TRUE'));
1160
+		$settings = array_merge($settings, array('globalAllFlights' => 'TRUE'));
1161 1161
 	} else {
1162
-		$settings = array_merge($settings,array('globalAllFlights' => 'FALSE'));
1162
+		$settings = array_merge($settings, array('globalAllFlights' => 'FALSE'));
1163 1163
 	}
1164
-	$waypoints = filter_input(INPUT_POST,'waypoints',FILTER_SANITIZE_STRING);
1164
+	$waypoints = filter_input(INPUT_POST, 'waypoints', FILTER_SANITIZE_STRING);
1165 1165
 	if ($waypoints == 'waypoints') {
1166
-		$settings = array_merge($settings,array('globalWaypoints' => 'TRUE'));
1166
+		$settings = array_merge($settings, array('globalWaypoints' => 'TRUE'));
1167 1167
 	} else {
1168
-		$settings = array_merge($settings,array('globalWaypoints' => 'FALSE'));
1168
+		$settings = array_merge($settings, array('globalWaypoints' => 'FALSE'));
1169 1169
 	}
1170 1170
 
1171
-	if (!isset($globalTransaction)) $settings = array_merge($settings,array('globalTransaction' => 'TRUE'));
1171
+	if (!isset($globalTransaction)) $settings = array_merge($settings, array('globalTransaction' => 'TRUE'));
1172 1172
 
1173 1173
 	// Set some defaults values...
1174 1174
 	if (!isset($globalAircraftImageSources)) {
1175
-	    $globalAircraftImageSources = array('ivaomtl','wikimedia','airportdata','deviantart','flickr','bing','jetphotos','planepictures','planespotters');
1176
-	    $settings = array_merge($settings,array('globalAircraftImageSources' => $globalAircraftImageSources));
1175
+	    $globalAircraftImageSources = array('ivaomtl', 'wikimedia', 'airportdata', 'deviantart', 'flickr', 'bing', 'jetphotos', 'planepictures', 'planespotters');
1176
+	    $settings = array_merge($settings, array('globalAircraftImageSources' => $globalAircraftImageSources));
1177 1177
 	}
1178 1178
 
1179 1179
 	if (!isset($globalSchedulesSources)) {
1180
-	    $globalSchedulesSources = array('flightmapper','costtotravel','flightradar24','flightaware');
1181
-    	    $settings = array_merge($settings,array('globalSchedulesSources' => $globalSchedulesSources));
1180
+	    $globalSchedulesSources = array('flightmapper', 'costtotravel', 'flightradar24', 'flightaware');
1181
+    	    $settings = array_merge($settings, array('globalSchedulesSources' => $globalSchedulesSources));
1182 1182
     	}
1183 1183
 
1184
-	$settings = array_merge($settings,array('globalInstalled' => 'TRUE'));
1184
+	$settings = array_merge($settings, array('globalInstalled' => 'TRUE'));
1185 1185
 
1186 1186
 	if ($error == '') settings::modify_settings($settings);
1187 1187
 	if ($error == '') settings::comment_settings($settings_comment);
Please login to merge, or discard this patch.
atc-geojson.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
 	header('Content-disposition: attachment; filename="atc.geojson"');
8 8
 }
9 9
 header('Content-Type: text/javascript');
10
-$ATC=new ATC();
10
+$ATC = new ATC();
11 11
 if (isset($_GET['coord'])) 
12 12
 {
13 13
 	//$coords = explode(',',$_GET['coord']);
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
 $output = '{"type": "FeatureCollection","features": [';
20 20
 if (!empty($spotter_array))
21 21
 {	  
22
-	foreach($spotter_array as $spotter_item)
22
+	foreach ($spotter_array as $spotter_item)
23 23
 	{
24 24
 		date_default_timezone_set('UTC');
25 25
 		//waypoint plotting
Please login to merge, or discard this patch.