Completed
Push — master ( 613dee...cccbb0 )
by Yannick
31:28
created
live-sat-geojson.php 2 patches
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
 		header('Content-disposition: attachment; filename="flightairmap-sat.json"');
14 14
 	}
15 15
 }
16
-$history = urldecode(filter_input(INPUT_GET,'history',FILTER_SANITIZE_STRING));
16
+$history = urldecode(filter_input(INPUT_GET, 'history', FILTER_SANITIZE_STRING));
17 17
 header('Content-Type: text/javascript');
18 18
 
19 19
 $begintime = microtime(true);
@@ -21,10 +21,10 @@  discard block
 block discarded – undo
21 21
 
22 22
 $spotter_array = array();
23 23
 if (isset($_COOKIE['sattypes']) && $_COOKIE['sattypes'] != '') {
24
-	$sattypes = explode(',',$_COOKIE['sattypes']);
24
+	$sattypes = explode(',', $_COOKIE['sattypes']);
25 25
 	foreach ($sattypes as $sattype) {
26 26
 		//$spotter_array = array_merge($Satellite->position_all_type($sattype,$timeb-$globalLiveInterval,$timeb),$spotter_array);
27
-		$spotter_array = array_merge($Satellite->position_all_type($sattype),$spotter_array);
27
+		$spotter_array = array_merge($Satellite->position_all_type($sattype), $spotter_array);
28 28
 	}
29 29
 }
30 30
 
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 
37 37
 //$spotter_array = array_unique($spotter_array,SORT_REGULAR);
38 38
 //print_r($spotter_array);
39
-$sqltime = round(microtime(true)-$begintime,2);
39
+$sqltime = round(microtime(true) - $begintime, 2);
40 40
 
41 41
 $output = '{"type":"FeatureCollection","features":[';
42 42
 if (!empty($spotter_array) && is_array($spotter_array))
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 	$last_name = '';
45 45
 	$coordinatearray = '';
46 46
 	$timearray = array();
47
-	foreach($spotter_array as $spotter_item)
47
+	foreach ($spotter_array as $spotter_item)
48 48
 	{
49 49
 		$output_data = '';
50 50
 		$output_data .= '{"type":"Feature","properties":{';
@@ -61,14 +61,14 @@  discard block
 block discarded – undo
61 61
 		}
62 62
 		$output_data .= '"altitude":0,';
63 63
 		$output_data .= '"sqt":'.$sqltime.',';
64
-		$nextlatlon = $Satellite->position($spotter_item['name'],time()+$globalMapRefresh+20);
64
+		$nextlatlon = $Satellite->position($spotter_item['name'], time() + $globalMapRefresh + 20);
65 65
 		$nextlat = $nextlatlon['latitude'];
66
-		if (abs($nextlat-$spotter_item['latitude']) > 90) {
66
+		if (abs($nextlat - $spotter_item['latitude']) > 90) {
67 67
 			if ($spotter_item['latitude'] < 0) $nexlat = -90;
68 68
 			else $nexlat = 90;
69 69
 		}
70 70
 		$nextlon = $nextlatlon['longitude'];
71
-		if (abs($nextlon-$spotter_item['longitude']) > 180) {
71
+		if (abs($nextlon - $spotter_item['longitude']) > 180) {
72 72
 			if ($spotter_item['longitude'] < 0) $nextlon = -180;
73 73
 			else $nextlon = 180;
74 74
 		}
@@ -79,27 +79,27 @@  discard block
 block discarded – undo
79 79
 		$output_data .= ']}},';
80 80
 		$output .= $output_data;
81 81
 		if ($history == $spotter_item['name']) {
82
-			$spotter_history_array = $Satellite->position($spotter_item['name'],time()-6000,time());
82
+			$spotter_history_array = $Satellite->position($spotter_item['name'], time() - 6000, time());
83 83
 			$spotter_history_array = array_reverse($spotter_history_array);
84 84
 			$output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['name'].'","type": "history"},"geometry": {"type": "LineString","coordinates": [';
85 85
 			foreach ($spotter_history_array as $key => $spotter_history) {
86
-				if ((isset($previous_lon) && abs($previous_lon-$spotter_history['longitude']) > 180) || (isset($previous_lat) && abs($previous_lat-$spotter_history['latitude']) > 90)) {
86
+				if ((isset($previous_lon) && abs($previous_lon - $spotter_history['longitude']) > 180) || (isset($previous_lat) && abs($previous_lat - $spotter_history['latitude']) > 90)) {
87 87
 					break;
88 88
 				}
89 89
 				$output_history .= '[';
90
-				$output_history .=  $spotter_history['longitude'].', ';
91
-				$output_history .=  $spotter_history['latitude'];
90
+				$output_history .= $spotter_history['longitude'].', ';
91
+				$output_history .= $spotter_history['latitude'];
92 92
 				$output_history .= '],';
93 93
 				$previous_lon = $spotter_history['longitude'];
94 94
 				$previous_lat = $spotter_history['latitude'];
95 95
 			}
96
-			$output_history = substr($output_history,0,-1);
96
+			$output_history = substr($output_history, 0, -1);
97 97
 			$output_history .= ']}},';
98 98
 			$output .= $output_history;
99 99
 		}
100 100
 	}
101 101
 }
102
-if (isset($output_data)) $output = substr($output,0,-1);
102
+if (isset($output_data)) $output = substr($output, 0, -1);
103 103
 $output .= ']}';
104 104
 print $output;
105 105
 ?>
Please login to merge, or discard this patch.
Braces   +13 added lines, -5 removed lines patch added patch discarded remove patch
@@ -64,13 +64,19 @@  discard block
 block discarded – undo
64 64
 		$nextlatlon = $Satellite->position($spotter_item['name'],time()+$globalMapRefresh+20);
65 65
 		$nextlat = $nextlatlon['latitude'];
66 66
 		if (abs($nextlat-$spotter_item['latitude']) > 90) {
67
-			if ($spotter_item['latitude'] < 0) $nexlat = -90;
68
-			else $nexlat = 90;
67
+			if ($spotter_item['latitude'] < 0) {
68
+				$nexlat = -90;
69
+			} else {
70
+				$nexlat = 90;
71
+			}
69 72
 		}
70 73
 		$nextlon = $nextlatlon['longitude'];
71 74
 		if (abs($nextlon-$spotter_item['longitude']) > 180) {
72
-			if ($spotter_item['longitude'] < 0) $nextlon = -180;
73
-			else $nextlon = 180;
75
+			if ($spotter_item['longitude'] < 0) {
76
+				$nextlon = -180;
77
+			} else {
78
+				$nextlon = 180;
79
+			}
74 80
 		}
75 81
 		$output_data .= '"nextlatlon":['.$nextlat.','.$nextlon.']},';
76 82
 		//$output_data .= '"heading":"'.$Common->getHeading($spotter_item['latitude'],$spotter_item['longitude'],$nextlatlon['latitude'],$nextlatlon['longitude']).'",';
@@ -99,7 +105,9 @@  discard block
 block discarded – undo
99 105
 		}
100 106
 	}
101 107
 }
102
-if (isset($output_data)) $output = substr($output,0,-1);
108
+if (isset($output_data)) {
109
+	$output = substr($output,0,-1);
110
+}
103 111
 $output .= ']}';
104 112
 print $output;
105 113
 ?>
Please login to merge, or discard this patch.
live-sat-czml.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -20,17 +20,17 @@  discard block
 block discarded – undo
20 20
 
21 21
 $spotter_array = array();
22 22
 if (isset($_COOKIE['sattypes']) && $_COOKIE['sattypes'] != '') {
23
-	$sattypes = explode(',',$_COOKIE['sattypes']);
23
+	$sattypes = explode(',', $_COOKIE['sattypes']);
24 24
 	foreach ($sattypes as $sattype) {
25
-		$spotter_array = array_merge($Satellite->position_all_type($sattype,$timeb-$globalLiveInterval,$timeb),$spotter_array);
25
+		$spotter_array = array_merge($Satellite->position_all_type($sattype, $timeb - $globalLiveInterval, $timeb), $spotter_array);
26 26
 	}
27 27
 }
28 28
 if ((isset($_COOKIE['displayiss']) && $_COOKIE['displayiss'] == 'true') || !isset($_COOKIE['displayiss'])) {
29
-	$spotter_array = array_merge($Satellite->position('ISS (ZARYA)',time()-$globalLiveInterval,time()),$spotter_array);
30
-	$spotter_array = array_merge($Satellite->position('TIANGONG 1',time()-$globalLiveInterval,time()),$spotter_array);
31
-	$spotter_array = array_merge($Satellite->position('TIANGONG-2',time()-$globalLiveInterval,time()),$spotter_array);
29
+	$spotter_array = array_merge($Satellite->position('ISS (ZARYA)', time() - $globalLiveInterval, time()), $spotter_array);
30
+	$spotter_array = array_merge($Satellite->position('TIANGONG 1', time() - $globalLiveInterval, time()), $spotter_array);
31
+	$spotter_array = array_merge($Satellite->position('TIANGONG-2', time() - $globalLiveInterval, time()), $spotter_array);
32 32
 }
33
-$spotter_array = array_unique($spotter_array,SORT_REGULAR);
33
+$spotter_array = array_unique($spotter_array, SORT_REGULAR);
34 34
 /*
35 35
 $modelsdb = array();
36 36
 if (file_exists('models/space/space_modelsdb')) {
@@ -54,14 +54,14 @@  discard block
 block discarded – undo
54 54
 //	$output .= ',"clock": {"interval" : "'.date("c",time()-$globalLiveInterval).'/'.date("c").'","currentTime" : "'.date("c",time() - $globalLiveInterval).'","multiplier" : 1,"range" : "LOOP_STOP","step": "SYSTEM_CLOCK_MULTIPLIER"}';
55 55
 
56 56
 //	$output .= ',"clock": {"interval" : "'.date("c",time()-$globalLiveInterval).'/'.date("c").'","currentTime" : "'.date("c",time() - $globalLiveInterval).'","multiplier" : 1,"range" : "UNBOUNDED","step": "SYSTEM_CLOCK_MULTIPLIER"}';
57
-$output .= ',"clock": {"currentTime" : "'.date("c",time() - $globalLiveInterval).'","multiplier" : 1,"range" : "UNBOUNDED","step": "SYSTEM_CLOCK_MULTIPLIER"}';
57
+$output .= ',"clock": {"currentTime" : "'.date("c", time() - $globalLiveInterval).'","multiplier" : 1,"range" : "UNBOUNDED","step": "SYSTEM_CLOCK_MULTIPLIER"}';
58 58
 //$output .= ',"clock": {"currentTime" : "%minitime%","multiplier" : 1,"range" : "UNBOUNDED","step": "SYSTEM_CLOCK_MULTIPLIER"}';
59 59
 
60 60
 //	$output .= ',"clock": {"interval" : "'.date("c",time()-$globalLiveInterval).'/'.date("c").'","currentTime" : "'.date("c",time() - $globalLiveInterval).'","multiplier" : 1,"step": "SYSTEM_CLOCK_MULTIPLIER"}';
61 61
 $output .= '},';
62 62
 if (!empty($spotter_array) && is_array($spotter_array))
63 63
 {
64
-	foreach($spotter_array as $spotter_item)
64
+	foreach ($spotter_array as $spotter_item)
65 65
 	{
66 66
 		$j++;
67 67
 		date_default_timezone_set('UTC');
@@ -115,23 +115,23 @@  discard block
 block discarded – undo
115 115
 					$output .= '"model": {"gltf" : "'.$globalURL.'/models/space/cubiesat.glb'.'","scale" : 1.0,"minimumPixelSize": 25,"maximunPixelSize": 300 },';
116 116
 				} elseif ($spotter_item['name'] == 'TERRA') {
117 117
 					$output .= '"model": {"gltf" : "'.$globalURL.'/models/space/terra.glb'.'","scale" : 1.0,"minimumPixelSize": 25,"maximunPixelSize": 300 },';
118
-				} elseif (strpos($spotter_item['name'],'O3B') !== false) {
118
+				} elseif (strpos($spotter_item['name'], 'O3B') !== false) {
119 119
 					$output .= '"model": {"gltf" : "'.$globalURL.'/models/space/o3b.glb'.'","scale" : 1.0,"minimumPixelSize": 25,"maximunPixelSize": 300 },';
120
-				} elseif (strpos($spotter_item['name'],'GLOBALSTAR') !== false) {
120
+				} elseif (strpos($spotter_item['name'], 'GLOBALSTAR') !== false) {
121 121
 					$output .= '"model": {"gltf" : "'.$globalURL.'/models/space/globalstar.glb'.'","scale" : 1.0,"minimumPixelSize": 25,"maximunPixelSize": 300 },';
122
-				} elseif (strpos($spotter_item['name'],'GPS') !== false) {
122
+				} elseif (strpos($spotter_item['name'], 'GPS') !== false) {
123 123
 					$output .= '"model": {"gltf" : "'.$globalURL.'/models/space/gps.glb'.'","scale" : 1.0,"minimumPixelSize": 25,"maximunPixelSize": 300 },';
124
-				} elseif (strpos($spotter_item['name'],'GENESIS') !== false) {
124
+				} elseif (strpos($spotter_item['name'], 'GENESIS') !== false) {
125 125
 					$output .= '"model": {"gltf" : "'.$globalURL.'/models/space/genesis.glb'.'","scale" : 1.0,"minimumPixelSize": 25,"maximunPixelSize": 300 },';
126
-				} elseif (strpos($spotter_item['name'],'OSCAR 7') !== false) {
126
+				} elseif (strpos($spotter_item['name'], 'OSCAR 7') !== false) {
127 127
 					$output .= '"model": {"gltf" : "'.$globalURL.'/models/space/oscar7.glb'.'","scale" : 1.0,"minimumPixelSize": 25,"maximunPixelSize": 300 },';
128
-				} elseif (strpos($spotter_item['name'],'FLOCK') !== false) {
128
+				} elseif (strpos($spotter_item['name'], 'FLOCK') !== false) {
129 129
 					$output .= '"model": {"gltf" : "'.$globalURL.'/models/space/cubesat.glb'.'","scale" : 1.0,"minimumPixelSize": 25,"maximunPixelSize": 300 },';
130
-				} elseif (strpos($spotter_item['name'],'PLEIADES') !== false) {
130
+				} elseif (strpos($spotter_item['name'], 'PLEIADES') !== false) {
131 131
 					$output .= '"model": {"gltf" : "'.$globalURL.'/models/space/pleiades.glb'.'","scale" : 1.0,"minimumPixelSize": 25,"maximunPixelSize": 300 },';
132
-				} elseif (strpos($spotter_item['name'],'DUCHIFAT') !== false) {
132
+				} elseif (strpos($spotter_item['name'], 'DUCHIFAT') !== false) {
133 133
 					$output .= '"model": {"gltf" : "'.$globalURL.'/models/space/duchifat.glb'.'","scale" : 1.0,"minimumPixelSize": 25,"maximunPixelSize": 300 },';
134
-				} elseif (strpos($spotter_item['name'],'FORMOSAT-2') !== false) {
134
+				} elseif (strpos($spotter_item['name'], 'FORMOSAT-2') !== false) {
135 135
 					$output .= '"model": {"gltf" : "'.$globalURL.'/models/space/formosat2.glb'.'","scale" : 1.0,"minimumPixelSize": 25,"maximunPixelSize": 300 },';
136 136
 				} elseif ($spotter_item['type'] == 'iridium') {
137 137
 					$output .= '"model": {"gltf" : "'.$globalURL.'/models/space/iridium.glb'.'","scale" : 1.0,"minimumPixelSize": 25,"maximunPixelSize": 300 },';
@@ -153,14 +153,14 @@  discard block
 block discarded – undo
153 153
 	//		$output .= '"epoch" : "'.date("c",strtotime($spotter_item['date'])).'", ';
154 154
 			$output .= '"interpolationAlgorithm":"HERMITE","interpolationDegree":3,';
155 155
 			$output .= '"cartographicDegrees": [';
156
-			$output .= '"'.date("c",$spotter_item['timestamp']).'", ';
156
+			$output .= '"'.date("c", $spotter_item['timestamp']).'", ';
157 157
 			$output .= $spotter_item['longitude'].', ';
158 158
 			$output .= $spotter_item['latitude'].', ';
159 159
 			$output .= $spotter_item['altitude']*1000;
160 160
 			$orientation = '"orientation" : { ';
161 161
 			$orientation .= '"unitQuaternion": [';
162 162
 		} else {
163
-			$output .= ',"'.date("c",$spotter_item['timestamp']).'", ';
163
+			$output .= ',"'.date("c", $spotter_item['timestamp']).'", ';
164 164
 			$output .= $spotter_item['longitude'].', ';
165 165
 			$output .= $spotter_item['latitude'].', ';
166 166
 			$output .= $spotter_item['altitude']*1000;
Please login to merge, or discard this patch.
require/class.Scheduler.php 3 patches
Indentation   +159 added lines, -159 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 
9 9
 class Schedule {
10 10
 	protected $cookies = array();
11
-        public $db;
11
+		public $db;
12 12
 	public function __construct($dbc = null) {
13 13
 		$Connection = new Connection($dbc);
14 14
 		$this->db = $Connection->db();
@@ -16,22 +16,22 @@  discard block
 block discarded – undo
16 16
 	}
17 17
 	
18 18
 	/**
19
-	* Add schedule data to database
20
-	* @param String $ident aircraft ident
21
-	* @param String $departure_airport_icao departure airport icao
22
-	* @param String $departure_airport_time departure airport time
23
-	* @param String $arrival_airport_icao arrival airport icao
24
-	* @param String $arrival_airport_time arrival airport time
19
+	 * Add schedule data to database
20
+	 * @param String $ident aircraft ident
21
+	 * @param String $departure_airport_icao departure airport icao
22
+	 * @param String $departure_airport_time departure airport time
23
+	 * @param String $arrival_airport_icao arrival airport icao
24
+	 * @param String $arrival_airport_time arrival airport time
25 25
 	/ @param String $source source of data
26
-	*/
26
+	 */
27 27
 	
28 28
 	public function addSchedule($ident,$departure_airport_icao,$departure_airport_time,$arrival_airport_icao,$arrival_airport_time,$source = 'website') {
29 29
 		date_default_timezone_set('UTC');
30 30
 		$date = date("Y-m-d H:i:s",time());
31
-	        //if ($departure_airport_time == '' && $arrival_airport_time == '') exit;
32
-	        //$query = "SELECT COUNT(*) FROM schedule WHERE ident = :ident";
33
-	        $query = "SELECT COUNT(*) FROM routes WHERE CallSign = :ident";
34
-	        $query_values = array(':ident' => $ident);
31
+			//if ($departure_airport_time == '' && $arrival_airport_time == '') exit;
32
+			//$query = "SELECT COUNT(*) FROM schedule WHERE ident = :ident";
33
+			$query = "SELECT COUNT(*) FROM routes WHERE CallSign = :ident";
34
+			$query_values = array(':ident' => $ident);
35 35
 		 try {
36 36
 			$sth = $this->db->prepare($query);
37 37
 			$sth->execute($query_values);
@@ -40,18 +40,18 @@  discard block
 block discarded – undo
40 40
 		}
41 41
 		if ($sth->fetchColumn() > 0) {
42 42
 			if ($departure_airport_time == '' && $arrival_airport_time == '') {
43
-			    $query = "SELECT COUNT(*) FROM routes WHERE CallSign = :ident AND FromAirport_ICAO = :departure_airport_icao AND ToAirport_ICAO = :arrival_airport_icao";
44
-			    $query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao);
43
+				$query = "SELECT COUNT(*) FROM routes WHERE CallSign = :ident AND FromAirport_ICAO = :departure_airport_icao AND ToAirport_ICAO = :arrival_airport_icao";
44
+				$query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao);
45 45
 			} elseif ($arrival_airport_time == '') {
46
-			    $query = "SELECT COUNT(*) FROM routes WHERE CallSign = :ident AND FromAirport_ICAO = :departure_airport_icao AND FromAirport_Time = :departure_airport_time AND ToAirport_ICAO = :arrival_airport_icao";
47
-			    $query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':departure_airport_time' => $departure_airport_time,':arrival_airport_icao' => $arrival_airport_icao);
46
+				$query = "SELECT COUNT(*) FROM routes WHERE CallSign = :ident AND FromAirport_ICAO = :departure_airport_icao AND FromAirport_Time = :departure_airport_time AND ToAirport_ICAO = :arrival_airport_icao";
47
+				$query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':departure_airport_time' => $departure_airport_time,':arrival_airport_icao' => $arrival_airport_icao);
48 48
 			} elseif ($departure_airport_time == '') {
49
-			    $query = "SELECT COUNT(*) FROM routes WHERE CallSign = :ident AND FromAirport_ICAO = :departure_airport_icao AND ToAirport_ICAO = :arrival_airport_icao AND ToAirport_Time = :arrival_airport_time";
50
-			    $query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_time' => $arrival_airport_time);
49
+				$query = "SELECT COUNT(*) FROM routes WHERE CallSign = :ident AND FromAirport_ICAO = :departure_airport_icao AND ToAirport_ICAO = :arrival_airport_icao AND ToAirport_Time = :arrival_airport_time";
50
+				$query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_time' => $arrival_airport_time);
51 51
 			} else {
52
-			    //$query = "SELECT COUNT(*) FROM schedule WHERE ident = :ident AND departure_airport_icao = :departure_airport_icao AND departure_airport_time = :departure_airport_time AND arrival_airport_icao = :arrival_airport_icao AND arrival_airport_time = :arrival_airport_time";
53
-			    $query = "SELECT COUNT(*) FROM routes WHERE CallSign = :ident AND FromAirport_ICAO = :departure_airport_icao AND FromAirport_Time = :departure_airport_time AND ToAirport_ICAO = :arrival_airport_icao AND ToAirport_Time = :arrival_airport_time";
54
-			    $query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':departure_airport_time' => $departure_airport_time,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_time' => $arrival_airport_time);
52
+				//$query = "SELECT COUNT(*) FROM schedule WHERE ident = :ident AND departure_airport_icao = :departure_airport_icao AND departure_airport_time = :departure_airport_time AND arrival_airport_icao = :arrival_airport_icao AND arrival_airport_time = :arrival_airport_time";
53
+				$query = "SELECT COUNT(*) FROM routes WHERE CallSign = :ident AND FromAirport_ICAO = :departure_airport_icao AND FromAirport_Time = :departure_airport_time AND ToAirport_ICAO = :arrival_airport_icao AND ToAirport_Time = :arrival_airport_time";
54
+				$query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':departure_airport_time' => $departure_airport_time,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_time' => $arrival_airport_time);
55 55
 			}
56 56
 			try {
57 57
 				$sth = $this->db->prepare($query);
@@ -62,17 +62,17 @@  discard block
 block discarded – undo
62 62
 			if ($sth->fetchColumn() == 0) {
63 63
 				//$query = 'UPDATE schedule SET departure_airport_icao = :departure_airport_icao, departure_airport_time = :departure_airport_time, arrival_airport_icao = :arrival_airport_icao, arrival_airport_time = :arrival_airport_time, date_modified = :date, source = :source WHERE ident = :ident';
64 64
 				if ($departure_airport_time == '' && $arrival_airport_time == '') {
65
-                            	    $query = 'UPDATE routes SET FromAirport_ICAO = :departure_airport_icao, ToAirport_ICAO = :arrival_airport_icao, date_modified = :date, Source = :source WHERE CallSign = :ident';
66
-				    $query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao, ':date' => $date, ':source' => $source);
65
+									$query = 'UPDATE routes SET FromAirport_ICAO = :departure_airport_icao, ToAirport_ICAO = :arrival_airport_icao, date_modified = :date, Source = :source WHERE CallSign = :ident';
66
+					$query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao, ':date' => $date, ':source' => $source);
67 67
 				} elseif ($arrival_airport_time == '') {
68
-                            	    $query = 'UPDATE routes SET FromAirport_ICAO = :departure_airport_icao, FromAiport_Time = :departure_airport_time, ToAirport_ICAO = :arrival_airport_icao, date_modified = :date, Source = :source WHERE CallSign = :ident';
69
-				    $query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':departure_airport_time' => $departure_airport_time,':arrival_airport_icao' => $arrival_airport_icao, ':date' => $date, ':source' => $source);
68
+									$query = 'UPDATE routes SET FromAirport_ICAO = :departure_airport_icao, FromAiport_Time = :departure_airport_time, ToAirport_ICAO = :arrival_airport_icao, date_modified = :date, Source = :source WHERE CallSign = :ident';
69
+					$query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':departure_airport_time' => $departure_airport_time,':arrival_airport_icao' => $arrival_airport_icao, ':date' => $date, ':source' => $source);
70 70
 				} elseif ($departure_airport_time == '') {
71
-                            	    $query = 'UPDATE routes SET FromAirport_ICAO = :departure_airport_icao, ToAirport_ICAO = :arrival_airport_icao, ToAirport_Time = :arrival_airport_time, date_modified = :date, Source = :source WHERE CallSign = :ident';
72
-				    $query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_time' => $arrival_airport_time, ':date' => $date, ':source' => $source);
71
+									$query = 'UPDATE routes SET FromAirport_ICAO = :departure_airport_icao, ToAirport_ICAO = :arrival_airport_icao, ToAirport_Time = :arrival_airport_time, date_modified = :date, Source = :source WHERE CallSign = :ident';
72
+					$query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_time' => $arrival_airport_time, ':date' => $date, ':source' => $source);
73 73
 				} else {
74
-                            	    $query = 'UPDATE routes SET FromAirport_ICAO = :departure_airport_icao, FromAiport_Time = :departure_airport_time, ToAirport_ICAO = :arrival_airport_icao, ToAirport_Time = :arrival_airport_time, date_modified = :date, Source = :source WHERE CallSign = :ident';
75
-				    $query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':departure_airport_time' => $departure_airport_time,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_time' => $arrival_airport_time, ':date' => $date, ':source' => $source);
74
+									$query = 'UPDATE routes SET FromAirport_ICAO = :departure_airport_icao, FromAiport_Time = :departure_airport_time, ToAirport_ICAO = :arrival_airport_icao, ToAirport_Time = :arrival_airport_time, date_modified = :date, Source = :source WHERE CallSign = :ident';
75
+					$query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':departure_airport_time' => $departure_airport_time,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_time' => $arrival_airport_time, ':date' => $date, ':source' => $source);
76 76
 				}
77 77
 				 try {
78 78
 					$sth = $this->db->prepare($query);
@@ -105,15 +105,15 @@  discard block
 block discarded – undo
105 105
 	}
106 106
 
107 107
 	public function getSchedule($ident) {
108
-	        $Translation = new Translation($this->db);
109
-	        $operator = $Translation->checkTranslation($ident,false);
110
-	        if ($ident != $operator) {
111
-	    		$query = "SELECT FromAirport_ICAO as departure_airport_icao, ToAirport_ICAO as arrival_airport_icao, FromAirport_Time as departure_airport_time, ToAirport_Time as arrival_airport_time FROM routes WHERE FromAirport_ICAO <> '' AND ToAirport_ICAO <> '' AND CallSign = :operator OR CallSign = :ident LIMIT 1";
112
-	    		$query_values = array(':ident' => $ident,'operator' => $operator);
113
-	    	} else {
114
-		        $query = "SELECT FromAirport_ICAO as departure_airport_icao, ToAirport_ICAO as arrival_airport_icao, FromAirport_Time as departure_airport_time, ToAirport_Time as arrival_airport_time FROM routes WHERE FromAirport_ICAO <> '' AND ToAirport_ICAO <> '' AND CallSign = :ident LIMIT 1";
115
-	    		$query_values = array(':ident' => $ident);
116
-	    	}
108
+			$Translation = new Translation($this->db);
109
+			$operator = $Translation->checkTranslation($ident,false);
110
+			if ($ident != $operator) {
111
+				$query = "SELECT FromAirport_ICAO as departure_airport_icao, ToAirport_ICAO as arrival_airport_icao, FromAirport_Time as departure_airport_time, ToAirport_Time as arrival_airport_time FROM routes WHERE FromAirport_ICAO <> '' AND ToAirport_ICAO <> '' AND CallSign = :operator OR CallSign = :ident LIMIT 1";
112
+				$query_values = array(':ident' => $ident,'operator' => $operator);
113
+			} else {
114
+				$query = "SELECT FromAirport_ICAO as departure_airport_icao, ToAirport_ICAO as arrival_airport_icao, FromAirport_Time as departure_airport_time, ToAirport_Time as arrival_airport_time FROM routes WHERE FromAirport_ICAO <> '' AND ToAirport_ICAO <> '' AND CallSign = :ident LIMIT 1";
115
+				$query_values = array(':ident' => $ident);
116
+			}
117 117
 		 try {
118 118
 			$sth = $this->db->prepare($query);
119 119
 			$sth->execute($query_values);
@@ -129,15 +129,15 @@  discard block
 block discarded – undo
129 129
 
130 130
 	public function checkSchedule($ident) {
131 131
 		global $globalDBdriver;
132
-	        //$query = "SELECT COUNT(*) as nb FROM schedule WHERE ident = :ident AND date_added > DATE_SUB(CURDATE(), INTERVAL 8 DAY) - 8 LIMIT 1";
133
-	        if ($globalDBdriver == 'mysql') {
132
+			//$query = "SELECT COUNT(*) as nb FROM schedule WHERE ident = :ident AND date_added > DATE_SUB(CURDATE(), INTERVAL 8 DAY) - 8 LIMIT 1";
133
+			if ($globalDBdriver == 'mysql') {
134 134
 			$query = "SELECT COUNT(*) as nb FROM routes WHERE FromAirport_ICAO <> '' AND ToAirport_ICAO <> '' AND CallSign = :ident AND ((date_added BETWEEN DATE(DATE_SUB(CURDATE(), INTERVAL 1 MONTH)) AND DATE(NOW()) and date_modified IS NULL) OR (date_modified BETWEEN DATE(DATE_SUB(CURDATE(), INTERVAL 15 DAY)) AND DATE(NOW()))) LIMIT 1";
135 135
 		} else {
136 136
 			$query = "SELECT COUNT(*) as nb FROM routes WHERE FromAirport_ICAO <> '' AND ToAirport_ICAO <> '' AND CallSign = :ident 
137 137
 			AND ((date_added::timestamp BETWEEN CURRENT_TIMESTAMP - INTERVAL '1 MONTH' AND CURRENT_TIMESTAMP) and date_modified::timestamp IS NULL)
138 138
 			     OR (date_modified::timestamp BETWEEN CURRENT_TIMESTAMP - INTERVAL '1 MONTH' AND CURRENT_TIMESTAMP) LIMIT 1";
139 139
 		}
140
-	        $query_values = array(':ident' => $ident);
140
+			$query_values = array(':ident' => $ident);
141 141
 		 try {
142 142
 			$sth = $this->db->prepare($query);
143 143
 			$sth->execute($query_values);
@@ -150,12 +150,12 @@  discard block
 block discarded – undo
150 150
 	}
151 151
 
152 152
 	/**
153
-	* Get flight info from Air France
154
-	* @param String $callsign The callsign
155
-	* @param String $date date we want flight number info
156
-	* @param String $carrier IATA code
157
-	* @return Flight departure and arrival airports and time
158
-	*/
153
+	 * Get flight info from Air France
154
+	 * @param String $callsign The callsign
155
+	 * @param String $date date we want flight number info
156
+	 * @param String $carrier IATA code
157
+	 * @return Flight departure and arrival airports and time
158
+	 */
159 159
 	private function getAirFrance($callsign, $date = 'NOW',$carrier = 'AF') {
160 160
 		$Common = new Common();
161 161
 		$check_date = new Datetime($date);
@@ -191,11 +191,11 @@  discard block
 block discarded – undo
191 191
 	}
192 192
 
193 193
 	/**
194
-	* Get flight info from EasyJet
195
-	* @param String $callsign The callsign
196
-	* @param String $date date we want flight number info
197
-	* @return Flight departure and arrival airports and time
198
-	*/
194
+	 * Get flight info from EasyJet
195
+	 * @param String $callsign The callsign
196
+	 * @param String $date date we want flight number info
197
+	 * @return Flight departure and arrival airports and time
198
+	 */
199 199
 	private function getEasyJet($callsign, $date = 'NOW') {
200 200
 		global $globalTimezone;
201 201
 		$Common = new Common();
@@ -219,10 +219,10 @@  discard block
 block discarded – undo
219 219
 	}
220 220
 
221 221
 	/**
222
-	* Get flight info from Ryanair
223
-	* @param String $callsign The callsign
224
-	* @return Flight departure and arrival airports and time
225
-	*/
222
+	 * Get flight info from Ryanair
223
+	 * @param String $callsign The callsign
224
+	 * @return Flight departure and arrival airports and time
225
+	 */
226 226
 	private function getRyanair($callsign) {
227 227
 		$Common = new Common();
228 228
 		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
@@ -245,10 +245,10 @@  discard block
 block discarded – undo
245 245
 	}
246 246
 
247 247
 	/**
248
-	* Get flight info from Swiss
249
-	* @param String $callsign The callsign
250
-	* @return Flight departure and arrival airports and time
251
-	*/
248
+	 * Get flight info from Swiss
249
+	 * @param String $callsign The callsign
250
+	 * @return Flight departure and arrival airports and time
251
+	 */
252 252
 	private function getSwiss($callsign) {
253 253
 		$Common = new Common();
254 254
 		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
@@ -277,11 +277,11 @@  discard block
 block discarded – undo
277 277
 	}
278 278
 	
279 279
 	/**
280
-	* Get flight info from British Airways API
281
-	* @param String $callsign The callsign
282
-	* @param String $date date we want flight number info
283
-	* @return Flight departure and arrival airports and time
284
-	*/
280
+	 * Get flight info from British Airways API
281
+	 * @param String $callsign The callsign
282
+	 * @param String $date date we want flight number info
283
+	 * @return Flight departure and arrival airports and time
284
+	 */
285 285
 	public function getBritishAirways($callsign, $date = 'NOW') {
286 286
 		global $globalBritishAirwaysKey;
287 287
 		$Common = new Common();
@@ -305,11 +305,11 @@  discard block
 block discarded – undo
305 305
 	}
306 306
 
307 307
 	/**
308
-	* Get flight info from Lutfhansa API
309
-	* @param String $callsign The callsign
310
-	* @param String $date date we want flight number info
311
-	* @return Flight departure and arrival airports and time
312
-	*/
308
+	 * Get flight info from Lutfhansa API
309
+	 * @param String $callsign The callsign
310
+	 * @param String $date date we want flight number info
311
+	 * @return Flight departure and arrival airports and time
312
+	 */
313 313
 	public function getLufthansa($callsign, $date = 'NOW') {
314 314
 		global $globalLufthansaKey;
315 315
 		$Common = new Common();
@@ -339,11 +339,11 @@  discard block
 block discarded – undo
339 339
 	}
340 340
 
341 341
 	/**
342
-	* Get flight info from Transavia API
343
-	* @param String $callsign The callsign
344
-	* @param String $date date we want flight number info
345
-	* @return Flight departure and arrival airports and time
346
-	*/
342
+	 * Get flight info from Transavia API
343
+	 * @param String $callsign The callsign
344
+	 * @param String $date date we want flight number info
345
+	 * @return Flight departure and arrival airports and time
346
+	 */
347 347
 	public function getTransavia($callsign, $date = 'NOW') {
348 348
 		global $globalTransaviaKey;
349 349
 		$Common = new Common();
@@ -369,10 +369,10 @@  discard block
 block discarded – undo
369 369
 	}
370 370
 
371 371
 	/**
372
-	* Get flight info from Tunisair
373
-	* @param String $callsign The callsign
374
-	* @return Flight departure and arrival airports and time
375
-	*/
372
+	 * Get flight info from Tunisair
373
+	 * @param String $callsign The callsign
374
+	 * @return Flight departure and arrival airports and time
375
+	 */
376 376
 	public function getTunisair($callsign) {
377 377
 		$Common = new Common();
378 378
 		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
@@ -389,10 +389,10 @@  discard block
 block discarded – undo
389 389
 	}
390 390
 
391 391
 	/**
392
-	* Get flight info from Vueling
393
-	* @param String $callsign The callsign
394
-	* @return Flight departure and arrival airports and time
395
-	*/
392
+	 * Get flight info from Vueling
393
+	 * @param String $callsign The callsign
394
+	 * @return Flight departure and arrival airports and time
395
+	 */
396 396
 	public function getVueling($callsign,$date = 'NOW') {
397 397
 		$Common = new Common();
398 398
 		$check_date = new Datetime($date);
@@ -414,11 +414,11 @@  discard block
 block discarded – undo
414 414
 	}
415 415
 
416 416
 	/**
417
-	* Get flight info from Iberia
418
-	* @param String $callsign The callsign
419
-	* @param String $date date we want flight number info
420
-	* @return Flight departure and arrival airports and time
421
-	*/
417
+	 * Get flight info from Iberia
418
+	 * @param String $callsign The callsign
419
+	 * @param String $date date we want flight number info
420
+	 * @return Flight departure and arrival airports and time
421
+	 */
422 422
 	public function getIberia($callsign, $date = 'NOW') {
423 423
 		$Common = new Common();
424 424
 		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
@@ -448,11 +448,11 @@  discard block
 block discarded – undo
448 448
 	}
449 449
 
450 450
 	/**
451
-	* Get flight info from Star Alliance
452
-	* @param String $callsign The callsign
453
-	* @param String $date date we want flight number info
454
-	* @return Flight departure and arrival airports and time
455
-	*/
451
+	 * Get flight info from Star Alliance
452
+	 * @param String $callsign The callsign
453
+	 * @param String $date date we want flight number info
454
+	 * @return Flight departure and arrival airports and time
455
+	 */
456 456
 
457 457
 	private function getStarAlliance($callsign, $date = 'NOW',$carrier = '') {
458 458
 		$Common = new Common();
@@ -484,11 +484,11 @@  discard block
 block discarded – undo
484 484
 
485 485
 
486 486
 	/**
487
-	* Get flight info from Alitalia
488
-	* @param String $callsign The callsign
489
-	* @param String $date date we want flight number info
490
-	* @return Flight departure and arrival airports and time
491
-	*/
487
+	 * Get flight info from Alitalia
488
+	 * @param String $callsign The callsign
489
+	 * @param String $date date we want flight number info
490
+	 * @return Flight departure and arrival airports and time
491
+	 */
492 492
 	private function getAlitalia($callsign, $date = 'NOW') {
493 493
 		$Common = new Common();
494 494
 		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
@@ -507,11 +507,11 @@  discard block
 block discarded – undo
507 507
 	}
508 508
 
509 509
 	/**
510
-	* Get flight info from Brussels airlines
511
-	* @param String $callsign The callsign
512
-	* @param String $date date we want flight number info
513
-	* @return Flight departure and arrival airports and time
514
-	*/
510
+	 * Get flight info from Brussels airlines
511
+	 * @param String $callsign The callsign
512
+	 * @param String $date date we want flight number info
513
+	 * @return Flight departure and arrival airports and time
514
+	 */
515 515
 	private function getBrussels($callsign, $date = 'NOW') {
516 516
 		$Common = new Common();
517 517
 		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
@@ -521,24 +521,24 @@  discard block
 block discarded – undo
521 521
 		if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array();
522 522
 		$data = $Common->getData($url);
523 523
 		if ($data != '') {
524
-		    //echo $data;
525
-		    $parsed_json = json_decode($data,true);
526
-		    if (isset($parsed_json[0]['FromAirportCode'])) {
524
+			//echo $data;
525
+			$parsed_json = json_decode($data,true);
526
+			if (isset($parsed_json[0]['FromAirportCode'])) {
527 527
 			$DepartureAirportIata = $parsed_json[0]['FromAirportCode'];
528 528
 			$ArrivalAirportIata = $parsed_json[0]['ToAirportCode'];
529 529
 			$departureTime = date('H:i',strtotime($parsed_json[0]['ScheduledDepatureDate']));
530 530
 			$arrivalTime = date('H:i',strtotime($parsed_json[0]['ScheduledArrivalDate']));
531 531
 			return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_brussels');
532
-		    }
532
+			}
533 533
 		}
534 534
 	}
535 535
 
536 536
 	/**
537
-	* Get flight info from FlightRadar24
538
-	* @param String $callsign The callsign
539
-	* @param String $date date we want flight number info
540
-	* @return Flight departure and arrival airports and time
541
-	*/
537
+	 * Get flight info from FlightRadar24
538
+	 * @param String $callsign The callsign
539
+	 * @param String $date date we want flight number info
540
+	 * @return Flight departure and arrival airports and time
541
+	 */
542 542
 /*
543 543
 	public function getFlightRadar24($callsign, $date = 'NOW') {
544 544
 		$Common = new Common();
@@ -567,11 +567,11 @@  discard block
 block discarded – undo
567 567
 	}
568 568
   */
569 569
 	/**
570
-	* Get flight info from Lufthansa
571
-	* @param String $callsign The callsign
572
-	* @param String $date date we want flight number info
573
-	* @return Flight departure and arrival airports and time
574
-	*/
570
+	 * Get flight info from Lufthansa
571
+	 * @param String $callsign The callsign
572
+	 * @param String $date date we want flight number info
573
+	 * @return Flight departure and arrival airports and time
574
+	 */
575 575
 
576 576
 /*	private function getLufthansa($callsign, $date = 'NOW') {
577 577
 		$Common = new Common();
@@ -599,10 +599,10 @@  discard block
 block discarded – undo
599 599
 	}
600 600
   */
601 601
 	/**
602
-	* Get flight info from flytap
603
-	* @param String $callsign The callsign
604
-	* @return Flight departure and arrival airports and time
605
-	*/
602
+	 * Get flight info from flytap
603
+	 * @param String $callsign The callsign
604
+	 * @return Flight departure and arrival airports and time
605
+	 */
606 606
 	private function getFlyTap($callsign) {
607 607
 		$Common = new Common();
608 608
 		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
@@ -625,10 +625,10 @@  discard block
 block discarded – undo
625 625
 	}
626 626
 
627 627
 	/**
628
-	* Get flight info from flightmapper
629
-	* @param String $callsign The callsign
630
-	* @return Flight departure and arrival airports and time
631
-	*/
628
+	 * Get flight info from flightmapper
629
+	 * @param String $callsign The callsign
630
+	 * @return Flight departure and arrival airports and time
631
+	 */
632 632
 	public function getFlightMapper($callsign) {
633 633
 		$Common = new Common();
634 634
 		$airline_icao = '';
@@ -656,11 +656,11 @@  discard block
 block discarded – undo
656 656
 				$aarr = '';
657 657
 				$n = sscanf($sched,'%*s %5[0-9:] %*[^()] (%3[A-Z]) %5[0-9:] %*[^()] (%3[A-Z])',$dhour,$darr,$ahour,$aarr);
658 658
 				if ($n == 7) {
659
-				    $departureTime = $dhour;
660
-				    $arrivalTime = $ahour;
661
-				    $DepartureAirportIata = str_replace(array('(',')'),'',$darr);
662
-				    $ArrivalAirportIata = str_replace(array('(',')'),'',$aarr);
663
-				    return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_flightmapper');
659
+					$departureTime = $dhour;
660
+					$arrivalTime = $ahour;
661
+					$DepartureAirportIata = str_replace(array('(',')'),'',$darr);
662
+					$ArrivalAirportIata = str_replace(array('(',')'),'',$aarr);
663
+					return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_flightmapper');
664 664
 				}
665 665
 			}
666 666
 		}
@@ -668,10 +668,10 @@  discard block
 block discarded – undo
668 668
 	}
669 669
 
670 670
 	/**
671
-	* Get flight info from flightaware
672
-	* @param String $callsign The callsign
673
-	* @return Flight departure and arrival airports and time
674
-	*/
671
+	 * Get flight info from flightaware
672
+	 * @param String $callsign The callsign
673
+	 * @return Flight departure and arrival airports and time
674
+	 */
675 675
 	public function getFlightAware($callsign) {
676 676
 		$Common = new Common();
677 677
 		/*
@@ -704,10 +704,10 @@  discard block
 block discarded – undo
704 704
 	}
705 705
 
706 706
 	/**
707
-	* Get flight info from CostToTravel
708
-	* @param String $callsign The callsign
709
-	* @return Flight departure and arrival airports and time
710
-	*/
707
+	 * Get flight info from CostToTravel
708
+	 * @param String $callsign The callsign
709
+	 * @return Flight departure and arrival airports and time
710
+	 */
711 711
 	public function getCostToTravel($callsign) {
712 712
 		$Common = new Common();
713 713
 		$url= "http://www.costtotravel.com/flight-number/".$callsign;
@@ -729,11 +729,11 @@  discard block
 block discarded – undo
729 729
 	}
730 730
 
731 731
 	/**
732
-	* Get flight info from Air Canada
733
-	* @param String $callsign The callsign
734
-	* @param String $date date we want flight number info
735
-	* @return Flight departure and arrival airports and time
736
-	*/
732
+	 * Get flight info from Air Canada
733
+	 * @param String $callsign The callsign
734
+	 * @param String $date date we want flight number info
735
+	 * @return Flight departure and arrival airports and time
736
+	 */
737 737
 	private function getAirCanada($callsign,$date = 'NOW') {
738 738
 		$Common = new Common();
739 739
 		if (class_exists("DomDocument") === FALSE) return array();
@@ -758,11 +758,11 @@  discard block
 block discarded – undo
758 758
 	}
759 759
 
760 760
 	/**
761
-	* Get flight info from Vietnam Airlines
762
-	* @param String $callsign The callsign
763
-	* @param String $date date we want flight number info
764
-	* @return Flight departure and arrival airports and time
765
-	*/
761
+	 * Get flight info from Vietnam Airlines
762
+	 * @param String $callsign The callsign
763
+	 * @param String $date date we want flight number info
764
+	 * @return Flight departure and arrival airports and time
765
+	 */
766 766
 	private function getVietnamAirlines($callsign, $date = 'NOW') {
767 767
 		$Common = new Common();
768 768
 		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
@@ -784,12 +784,12 @@  discard block
 block discarded – undo
784 784
 	}
785 785
 
786 786
 	/**
787
-	* Get flight info from Air Berlin
788
-	* @param String $callsign The callsign
789
-	* @param String $date date we want flight number info
790
-	* @param String $carrier airline code
791
-	* @return Flight departure and arrival airports and time
792
-	*/
787
+	 * Get flight info from Air Berlin
788
+	 * @param String $callsign The callsign
789
+	 * @param String $date date we want flight number info
790
+	 * @param String $carrier airline code
791
+	 * @return Flight departure and arrival airports and time
792
+	 */
793 793
 	private function getAirBerlin($callsign, $date = 'NOW',$carrier = 'AB') {
794 794
 		$Common = new Common();
795 795
 		date_default_timezone_set('UTC');
@@ -818,11 +818,11 @@  discard block
 block discarded – undo
818 818
 			$table = $Common->table2array($data);
819 819
 			$flight = $table;
820 820
 			if (isset($flight[5][4])) {
821
-			    $arrivalTime = $flight[5][4];
822
-			    $arrivalAirport = $flight[5][3];
821
+				$arrivalTime = $flight[5][4];
822
+				$arrivalAirport = $flight[5][3];
823 823
 			} else {
824
-			    $arrivalTime = '';
825
-			    $arrivalAirport = '';
824
+				$arrivalTime = '';
825
+				$arrivalAirport = '';
826 826
 			}
827 827
 		} else return array();
828 828
 		$url = 'http://www.airberlin.com/en-US/site/json/suggestAirport.php?searchfor=departures&searchflightid=0&departures%5B%5D=&suggestsource%5B0%5D=activeairports&withcountries=0&withoutroutings=0&promotion%5Bid%5D=&promotion%5Btype%5D=&routesource%5B0%5D=airberlin&routesource%5B1%5D=partner';
@@ -1090,7 +1090,7 @@  discard block
 block discarded – undo
1090 1090
 					}
1091 1091
 			}
1092 1092
 		}
1093
-	        return array();
1093
+			return array();
1094 1094
 	}
1095 1095
 }
1096 1096
 
Please login to merge, or discard this patch.
Spacing   +170 added lines, -170 removed lines patch added patch discarded remove patch
@@ -25,9 +25,9 @@  discard block
 block discarded – undo
25 25
 	/ @param String $source source of data
26 26
 	*/
27 27
 	
28
-	public function addSchedule($ident,$departure_airport_icao,$departure_airport_time,$arrival_airport_icao,$arrival_airport_time,$source = 'website') {
28
+	public function addSchedule($ident, $departure_airport_icao, $departure_airport_time, $arrival_airport_icao, $arrival_airport_time, $source = 'website') {
29 29
 		date_default_timezone_set('UTC');
30
-		$date = date("Y-m-d H:i:s",time());
30
+		$date = date("Y-m-d H:i:s", time());
31 31
 	        //if ($departure_airport_time == '' && $arrival_airport_time == '') exit;
32 32
 	        //$query = "SELECT COUNT(*) FROM schedule WHERE ident = :ident";
33 33
 	        $query = "SELECT COUNT(*) FROM routes WHERE CallSign = :ident";
@@ -35,69 +35,69 @@  discard block
 block discarded – undo
35 35
 		 try {
36 36
 			$sth = $this->db->prepare($query);
37 37
 			$sth->execute($query_values);
38
-		} catch(PDOException $e) {
38
+		} catch (PDOException $e) {
39 39
 			return "error : ".$e->getMessage();
40 40
 		}
41 41
 		if ($sth->fetchColumn() > 0) {
42 42
 			if ($departure_airport_time == '' && $arrival_airport_time == '') {
43 43
 			    $query = "SELECT COUNT(*) FROM routes WHERE CallSign = :ident AND FromAirport_ICAO = :departure_airport_icao AND ToAirport_ICAO = :arrival_airport_icao";
44
-			    $query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao);
44
+			    $query_values = array(':ident' => $ident, ':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao);
45 45
 			} elseif ($arrival_airport_time == '') {
46 46
 			    $query = "SELECT COUNT(*) FROM routes WHERE CallSign = :ident AND FromAirport_ICAO = :departure_airport_icao AND FromAirport_Time = :departure_airport_time AND ToAirport_ICAO = :arrival_airport_icao";
47
-			    $query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':departure_airport_time' => $departure_airport_time,':arrival_airport_icao' => $arrival_airport_icao);
47
+			    $query_values = array(':ident' => $ident, ':departure_airport_icao' => $departure_airport_icao, ':departure_airport_time' => $departure_airport_time, ':arrival_airport_icao' => $arrival_airport_icao);
48 48
 			} elseif ($departure_airport_time == '') {
49 49
 			    $query = "SELECT COUNT(*) FROM routes WHERE CallSign = :ident AND FromAirport_ICAO = :departure_airport_icao AND ToAirport_ICAO = :arrival_airport_icao AND ToAirport_Time = :arrival_airport_time";
50
-			    $query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_time' => $arrival_airport_time);
50
+			    $query_values = array(':ident' => $ident, ':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao, ':arrival_airport_time' => $arrival_airport_time);
51 51
 			} else {
52 52
 			    //$query = "SELECT COUNT(*) FROM schedule WHERE ident = :ident AND departure_airport_icao = :departure_airport_icao AND departure_airport_time = :departure_airport_time AND arrival_airport_icao = :arrival_airport_icao AND arrival_airport_time = :arrival_airport_time";
53 53
 			    $query = "SELECT COUNT(*) FROM routes WHERE CallSign = :ident AND FromAirport_ICAO = :departure_airport_icao AND FromAirport_Time = :departure_airport_time AND ToAirport_ICAO = :arrival_airport_icao AND ToAirport_Time = :arrival_airport_time";
54
-			    $query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':departure_airport_time' => $departure_airport_time,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_time' => $arrival_airport_time);
54
+			    $query_values = array(':ident' => $ident, ':departure_airport_icao' => $departure_airport_icao, ':departure_airport_time' => $departure_airport_time, ':arrival_airport_icao' => $arrival_airport_icao, ':arrival_airport_time' => $arrival_airport_time);
55 55
 			}
56 56
 			try {
57 57
 				$sth = $this->db->prepare($query);
58 58
 				$sth->execute($query_values);
59
-			} catch(PDOException $e) {
59
+			} catch (PDOException $e) {
60 60
 				return "error : ".$e->getMessage();
61 61
 			}
62 62
 			if ($sth->fetchColumn() == 0) {
63 63
 				//$query = 'UPDATE schedule SET departure_airport_icao = :departure_airport_icao, departure_airport_time = :departure_airport_time, arrival_airport_icao = :arrival_airport_icao, arrival_airport_time = :arrival_airport_time, date_modified = :date, source = :source WHERE ident = :ident';
64 64
 				if ($departure_airport_time == '' && $arrival_airport_time == '') {
65 65
                             	    $query = 'UPDATE routes SET FromAirport_ICAO = :departure_airport_icao, ToAirport_ICAO = :arrival_airport_icao, date_modified = :date, Source = :source WHERE CallSign = :ident';
66
-				    $query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao, ':date' => $date, ':source' => $source);
66
+				    $query_values = array(':ident' => $ident, ':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao, ':date' => $date, ':source' => $source);
67 67
 				} elseif ($arrival_airport_time == '') {
68 68
                             	    $query = 'UPDATE routes SET FromAirport_ICAO = :departure_airport_icao, FromAiport_Time = :departure_airport_time, ToAirport_ICAO = :arrival_airport_icao, date_modified = :date, Source = :source WHERE CallSign = :ident';
69
-				    $query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':departure_airport_time' => $departure_airport_time,':arrival_airport_icao' => $arrival_airport_icao, ':date' => $date, ':source' => $source);
69
+				    $query_values = array(':ident' => $ident, ':departure_airport_icao' => $departure_airport_icao, ':departure_airport_time' => $departure_airport_time, ':arrival_airport_icao' => $arrival_airport_icao, ':date' => $date, ':source' => $source);
70 70
 				} elseif ($departure_airport_time == '') {
71 71
                             	    $query = 'UPDATE routes SET FromAirport_ICAO = :departure_airport_icao, ToAirport_ICAO = :arrival_airport_icao, ToAirport_Time = :arrival_airport_time, date_modified = :date, Source = :source WHERE CallSign = :ident';
72
-				    $query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_time' => $arrival_airport_time, ':date' => $date, ':source' => $source);
72
+				    $query_values = array(':ident' => $ident, ':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao, ':arrival_airport_time' => $arrival_airport_time, ':date' => $date, ':source' => $source);
73 73
 				} else {
74 74
                             	    $query = 'UPDATE routes SET FromAirport_ICAO = :departure_airport_icao, FromAiport_Time = :departure_airport_time, ToAirport_ICAO = :arrival_airport_icao, ToAirport_Time = :arrival_airport_time, date_modified = :date, Source = :source WHERE CallSign = :ident';
75
-				    $query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':departure_airport_time' => $departure_airport_time,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_time' => $arrival_airport_time, ':date' => $date, ':source' => $source);
75
+				    $query_values = array(':ident' => $ident, ':departure_airport_icao' => $departure_airport_icao, ':departure_airport_time' => $departure_airport_time, ':arrival_airport_icao' => $arrival_airport_icao, ':arrival_airport_time' => $arrival_airport_time, ':date' => $date, ':source' => $source);
76 76
 				}
77 77
 				 try {
78 78
 					$sth = $this->db->prepare($query);
79 79
 					$sth->execute($query_values);
80
-				} catch(PDOException $e) {
80
+				} catch (PDOException $e) {
81 81
 					return "error : ".$e->getMessage();
82 82
 				}
83 83
 			} else {
84 84
 				//$query = 'UPDATE schedule SET date_lastseen = :date WHERE ident = :ident';
85 85
 				$query = 'UPDATE routes SET date_lastseen = :date WHERE CallSign = :ident';
86
-				$query_values = array(':ident' => $ident,':date' => $date);
86
+				$query_values = array(':ident' => $ident, ':date' => $date);
87 87
 				 try {
88 88
 					$sth = $this->db->prepare($query);
89 89
 					$sth->execute($query_values);
90
-				} catch(PDOException $e) {
90
+				} catch (PDOException $e) {
91 91
 					return "error : ".$e->getMessage();
92 92
 				}
93 93
 			}
94 94
 		} else {
95 95
 			$query = 'INSERT INTO  routes (CallSign,FromAirport_ICAO, FromAirport_Time, ToAirport_ICAO, ToAirport_Time,date_added,source)  VALUES (:ident,:departure_airport_icao,:departure_airport_time,:arrival_airport_icao,:arrival_airport_time,:date,:source)';
96
-			$query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':departure_airport_time' => $departure_airport_time,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_time' => $arrival_airport_time, ':date' => $date, ':source' => $source);
96
+			$query_values = array(':ident' => $ident, ':departure_airport_icao' => $departure_airport_icao, ':departure_airport_time' => $departure_airport_time, ':arrival_airport_icao' => $arrival_airport_icao, ':arrival_airport_time' => $arrival_airport_time, ':date' => $date, ':source' => $source);
97 97
 			 try {
98 98
 				$sth = $this->db->prepare($query);
99 99
 				$sth->execute($query_values);
100
-			} catch(PDOException $e) {
100
+			} catch (PDOException $e) {
101 101
 				return "error : ".$e->getMessage();
102 102
 			}
103 103
 		}
@@ -106,10 +106,10 @@  discard block
 block discarded – undo
106 106
 
107 107
 	public function getSchedule($ident) {
108 108
 	        $Translation = new Translation($this->db);
109
-	        $operator = $Translation->checkTranslation($ident,false);
109
+	        $operator = $Translation->checkTranslation($ident, false);
110 110
 	        if ($ident != $operator) {
111 111
 	    		$query = "SELECT FromAirport_ICAO as departure_airport_icao, ToAirport_ICAO as arrival_airport_icao, FromAirport_Time as departure_airport_time, ToAirport_Time as arrival_airport_time FROM routes WHERE FromAirport_ICAO <> '' AND ToAirport_ICAO <> '' AND CallSign = :operator OR CallSign = :ident LIMIT 1";
112
-	    		$query_values = array(':ident' => $ident,'operator' => $operator);
112
+	    		$query_values = array(':ident' => $ident, 'operator' => $operator);
113 113
 	    	} else {
114 114
 		        $query = "SELECT FromAirport_ICAO as departure_airport_icao, ToAirport_ICAO as arrival_airport_icao, FromAirport_Time as departure_airport_time, ToAirport_Time as arrival_airport_time FROM routes WHERE FromAirport_ICAO <> '' AND ToAirport_ICAO <> '' AND CallSign = :ident LIMIT 1";
115 115
 	    		$query_values = array(':ident' => $ident);
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 		 try {
118 118
 			$sth = $this->db->prepare($query);
119 119
 			$sth->execute($query_values);
120
-		} catch(PDOException $e) {
120
+		} catch (PDOException $e) {
121 121
 			return "error : ".$e->getMessage();
122 122
 		}
123 123
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 		 try {
142 142
 			$sth = $this->db->prepare($query);
143 143
 			$sth->execute($query_values);
144
-		} catch(PDOException $e) {
144
+		} catch (PDOException $e) {
145 145
 			return "error : ".$e->getMessage();
146 146
 		}
147 147
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
@@ -156,16 +156,16 @@  discard block
 block discarded – undo
156 156
 	* @param String $carrier IATA code
157 157
 	* @return Flight departure and arrival airports and time
158 158
 	*/
159
-	private function getAirFrance($callsign, $date = 'NOW',$carrier = 'AF') {
159
+	private function getAirFrance($callsign, $date = 'NOW', $carrier = 'AF') {
160 160
 		$Common = new Common();
161 161
 		$check_date = new Datetime($date);
162
-		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
163
-		if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array();
162
+		$numvol = preg_replace('/^[A-Z]*/', '', $callsign);
163
+		if (!filter_var($numvol, FILTER_VALIDATE_INT)) return array();
164 164
 		$url = "http://www.airfrance.fr/cgi-bin/AF/FR/fr/local/resainfovol/infovols/detailsVolJson.do?codeCompagnie[0]=".$carrier."&numeroVol[0]=".$numvol."&dayFlightDate=".$check_date->format('d')."&yearMonthFlightDate=".$check_date->format('Ym');
165 165
 		$json = $Common->getData($url);
166 166
 	
167 167
 		$parsed_json = json_decode($json);
168
-		if (property_exists($parsed_json,'errors') === false) {
168
+		if (property_exists($parsed_json, 'errors') === false) {
169 169
 			//$originLong = $parsed_json->{'flightsList'}[0]->{'segmentsList'}[0]->{'originLong'};
170 170
 			$originShort = $parsed_json->{'flightsList'}[0]->{'segmentsList'}[0]->{'originShort'};
171 171
 			//$departureDateMedium = $parsed_json->{'flightsList'}[0]->{'segmentsList'}[0]->{'departureDateMedium'};
@@ -175,9 +175,9 @@  discard block
 block discarded – undo
175 175
 			//$arrivalDateMedium = $parsed_json->{'flightsList'}[0]->{'segmentsList'}[0]->{'arrivalDateMedium'};
176 176
 			$arrivalTime = $parsed_json->{'flightsList'}[0]->{'segmentsList'}[0]->{'arrivalTime'};
177 177
 
178
-			preg_match('/\((.*?)\)/',$originShort,$originiata);
178
+			preg_match('/\((.*?)\)/', $originShort, $originiata);
179 179
 			$DepartureAirportIata = $originiata[1];
180
-			preg_match('/\((.*?)\)/',$destinationShort,$destinationiata);
180
+			preg_match('/\((.*?)\)/', $destinationShort, $destinationiata);
181 181
 			$ArrivalAirportIata = $destinationiata[1];
182 182
 
183 183
 			/*
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
 			$arrivalTime = gmdate('H:i',strtotime($arrivalTime));
187 187
 			*/
188 188
 		
189
-			return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_airfrance');
189
+			return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_airfrance');
190 190
 		} else return array();
191 191
 	}
192 192
 
@@ -201,8 +201,8 @@  discard block
 block discarded – undo
201 201
 		$Common = new Common();
202 202
 		date_default_timezone_set($globalTimezone);
203 203
 		$check_date = new Datetime($date);
204
-		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
205
-		if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array();
204
+		$numvol = preg_replace('/^[A-Z]*/', '', $callsign);
205
+		if (!filter_var($numvol, FILTER_VALIDATE_INT)) return array();
206 206
 		$url = "http://www.easyjet.com/ft/api/flights?date=".$check_date->format('Y-m-d')."&fn=".$callsign;
207 207
 		$json = $Common->getData($url);
208 208
 		$parsed_json = json_decode($json);
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
 			$departureTime = $parsed_json->{'flights'}[0]->{'dates'}->{'fstd'};
215 215
 			$arrivalTime = $parsed_json->{'flights'}[0]->{'dates'}->{'fsta'};
216 216
 
217
-			return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_easyjet');
217
+			return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_easyjet');
218 218
 		} else return array();
219 219
 	}
220 220
 
@@ -225,12 +225,12 @@  discard block
 block discarded – undo
225 225
 	*/
226 226
 	private function getRyanair($callsign) {
227 227
 		$Common = new Common();
228
-		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
229
-		if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array();
228
+		$numvol = preg_replace('/^[A-Z]*/', '', $callsign);
229
+		if (!filter_var($numvol, FILTER_VALIDATE_INT)) return array();
230 230
 		$url = "http://www.ryanair.com/fr/api/2/flight-info/0/50/";
231 231
 		$post = '{"flight":"'.$numvol.'","minDepartureTime":"00:00","maxDepartureTime":"23:59"}';
232
-		$headers = array('Content-Type: application/json','Content-Length: ' . strlen($post));
233
-		$json = $Common->getData($url,'post',$post,$headers);
232
+		$headers = array('Content-Type: application/json', 'Content-Length: '.strlen($post));
233
+		$json = $Common->getData($url, 'post', $post, $headers);
234 234
 		$parsed_json = json_decode($json);
235 235
 		if (isset($parsed_json->{'flightInfo'})) {
236 236
 			$flights = $parsed_json->{'flightInfo'};
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
 				$ArrivalAirportIata = $parsed_json->{'flightInfo'}[0]->{'arrivalAirport'}->{'iata'}; //name
240 240
 				$departureTime = $parsed_json->{'flightInfo'}[0]->{'departureTime'};
241 241
 				$arrivalTime = $parsed_json->{'flightInfo'}[0]->{'arrivalTime'};
242
-				return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime, 'Source' => 'website_ryanair');
242
+				return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_ryanair');
243 243
 			} else return array();
244 244
 		} else return array();
245 245
 	}
@@ -251,8 +251,8 @@  discard block
 block discarded – undo
251 251
 	*/
252 252
 	private function getSwiss($callsign) {
253 253
 		$Common = new Common();
254
-		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
255
-		if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array();
254
+		$numvol = preg_replace('/^[A-Z]*/', '', $callsign);
255
+		if (!filter_var($numvol, FILTER_VALIDATE_INT)) return array();
256 256
 		$url = "http://www.world-of-swiss.com/fr/routenetwork.json";
257 257
 		$json = $Common->getData($url);
258 258
 		$parsed_json = json_decode($json);
@@ -266,12 +266,12 @@  discard block
 block discarded – undo
266 266
 				if ($flight->{'no'} == "Vol LX ".$numvol) {
267 267
 					$DepartureAirportIata = $flight->{'from'}->{'code'}; //city
268 268
 					$ArrivalAirportIata = $flight->{'to'}->{'code'}; //city
269
-					$departureTime = substr($flight->{'from'}->{'hour'},0,5);
270
-					$arrivalTime = substr($flight->{'to'}->{'hour'},0,5);
269
+					$departureTime = substr($flight->{'from'}->{'hour'},0, 5);
270
+					$arrivalTime = substr($flight->{'to'}->{'hour'},0, 5);
271 271
 				}
272 272
 			}
273 273
 			if (isset($DepartureAirportIata) && isset($ArrivalAirportIata)) {
274
-				return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_swiss');
274
+				return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_swiss');
275 275
 			} else return array();
276 276
 		} else return array();
277 277
 	}
@@ -286,21 +286,21 @@  discard block
 block discarded – undo
286 286
 		global $globalBritishAirwaysKey;
287 287
 		$Common = new Common();
288 288
 		$check_date = new Datetime($date);
289
-		$numvol = sprintf('%04d',preg_replace('/^[A-Z]*/','',$callsign));
290
-		if (!filter_var(preg_replace('/^[A-Z]*/','',$callsign),FILTER_VALIDATE_INT)) return array();
289
+		$numvol = sprintf('%04d', preg_replace('/^[A-Z]*/', '', $callsign));
290
+		if (!filter_var(preg_replace('/^[A-Z]*/', '', $callsign), FILTER_VALIDATE_INT)) return array();
291 291
 		if ($globalBritishAirwaysKey == '') return array();
292 292
 		$url = "https://api.ba.com/rest-v1/v1/flights;flightNumber=".$numvol.";scheduledDepartureDate=".$check_date->format('Y-m-d').".json";
293 293
 		$headers = array('Client-Key: '.$globalBritishAirwaysKey);
294
-		$json = $Common->getData($url,'get','',$headers);
294
+		$json = $Common->getData($url, 'get', '', $headers);
295 295
 		if ($json == '') return array();
296 296
 		$parsed_json = json_decode($json);
297 297
 		$flights = $parsed_json->{'FlightsResponse'};
298 298
 		if (count($flights) > 0) {
299 299
 			$DepartureAirportIata = $parsed_json->{'FlightsResponse'}->{'Flight'}->{'Sector'}->{'DepartureAirport'};
300 300
 			$ArrivalAirportIata = $parsed_json->{'FlightsResponse'}->{'Flight'}->{'Sector'}->{'ArrivalAirport'};
301
-			$departureTime = date('H:i',strtotime($parsed_json->{'FlightsResponse'}->{'Flight'}->{'Sector'}->{'ScheduledDepartureDateTime'}));
302
-			$arrivalTime = date('H:i',strtotime($parsed_json->{'FlightsResponse'}->{'Flight'}->{'Sector'}->{'ScheduledArrivalDateTime'}));
303
-			return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_britishairways');
301
+			$departureTime = date('H:i', strtotime($parsed_json->{'FlightsResponse'}->{'Flight'}->{'Sector'}->{'ScheduledDepartureDateTime'}));
302
+			$arrivalTime = date('H:i', strtotime($parsed_json->{'FlightsResponse'}->{'Flight'}->{'Sector'}->{'ScheduledArrivalDateTime'}));
303
+			return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_britishairways');
304 304
 		} else return array();
305 305
 	}
306 306
 
@@ -314,27 +314,27 @@  discard block
 block discarded – undo
314 314
 		global $globalLufthansaKey;
315 315
 		$Common = new Common();
316 316
 		$check_date = new Datetime($date);
317
-		$numvol = sprintf('%04d',preg_replace('/^[A-Z]*/','',$callsign));
318
-		if (!filter_var(preg_replace('/^[A-Z]*/','',$callsign),FILTER_VALIDATE_INT)) return array();
317
+		$numvol = sprintf('%04d', preg_replace('/^[A-Z]*/', '', $callsign));
318
+		if (!filter_var(preg_replace('/^[A-Z]*/', '', $callsign), FILTER_VALIDATE_INT)) return array();
319 319
 		if (!isset($globalLufthansaKey) || $globalLufthansaKey == '' || !isset($globalLufthansaKey['key']) || $globalLufthansaKey['key'] == '') return array();
320 320
 		$url = "https://api.lufthansa.com/v1/oauth/token";
321
-		$post = array('client_id' => $globalLufthansaKey['key'],'client_secret' => $globalLufthansaKey['secret'],'grant_type' => 'client_credentials');
322
-		$data = $Common->getData($url,'post',$post);
321
+		$post = array('client_id' => $globalLufthansaKey['key'], 'client_secret' => $globalLufthansaKey['secret'], 'grant_type' => 'client_credentials');
322
+		$data = $Common->getData($url, 'post', $post);
323 323
 		$parsed_data = json_decode($data);
324 324
 		if (!isset($parsed_data->{'access_token'})) return array();
325 325
 		$token = $parsed_data->{'access_token'};
326 326
 		
327 327
 		$url = "https://api.lufthansa.com/v1/operations/flightstatus/LH".$numvol."/".$check_date->format('Y-m-d');
328
-		$headers = array('Authorization: Bearer '.$token,'Accept: application/json');
329
-		$json = $Common->getData($url,'get','',$headers);
328
+		$headers = array('Authorization: Bearer '.$token, 'Accept: application/json');
329
+		$json = $Common->getData($url, 'get', '', $headers);
330 330
 		if ($json == '') return array();
331 331
 		$parsed_json = json_decode($json);
332 332
 		if (isset($parsed_json->{'FlightStatusResource'}) && count($parsed_json->{'FlightStatusResource'}) > 0) {
333 333
 			$DepartureAirportIata = $parsed_json->{'FlightStatusResource'}->{'Flights'}->{'Flight'}->{'Departure'}->{'AirportCode'};
334
-			$departureTime = date('H:i',strtotime($parsed_json->{'FlightStatusResource'}->{'Flights'}->{'Flight'}->{'Departure'}->{'ScheduledTimeLocal'}->{'DateTime'}));
334
+			$departureTime = date('H:i', strtotime($parsed_json->{'FlightStatusResource'}->{'Flights'}->{'Flight'}->{'Departure'}->{'ScheduledTimeLocal'}->{'DateTime'}));
335 335
 			$ArrivalAirportIata = $parsed_json->{'FlightStatusResource'}->{'Flights'}->{'Flight'}->{'Arrival'}->{'AirportCode'};
336
-			$arrivalTime = date('H:i',strtotime($parsed_json->{'FlightStatusResource'}->{'Flights'}->{'Flight'}->{'Arrival'}->{'ScheduledTimeLocal'}->{'DateTime'}));
337
-			return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_lufthansa');
336
+			$arrivalTime = date('H:i', strtotime($parsed_json->{'FlightStatusResource'}->{'Flights'}->{'Flight'}->{'Arrival'}->{'ScheduledTimeLocal'}->{'DateTime'}));
337
+			return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_lufthansa');
338 338
 		} else return array();
339 339
 	}
340 340
 
@@ -348,23 +348,23 @@  discard block
 block discarded – undo
348 348
 		global $globalTransaviaKey;
349 349
 		$Common = new Common();
350 350
 		$check_date = new Datetime($date);
351
-		$numvol = sprintf('%04d',preg_replace('/^[A-Z]*/','',$callsign));
352
-		if (!filter_var(preg_replace('/^[A-Z]*/','',$callsign),FILTER_VALIDATE_INT)) return array();
351
+		$numvol = sprintf('%04d', preg_replace('/^[A-Z]*/', '', $callsign));
352
+		if (!filter_var(preg_replace('/^[A-Z]*/', '', $callsign), FILTER_VALIDATE_INT)) return array();
353 353
 		if ($globalTransaviaKey == '') return array();
354 354
 		$url = "https://tst.api.transavia.com/v1/flightstatus/departuredate/".$check_date->format('Ymd').'/flightnumber/HV'.$numvol;
355 355
 		//$url = "https://api.transavia.com/v1/flightstatus/departuredate/".$check_date->format('Ymd').'/flightnumber/HV'.$numvol;
356 356
 		$headers = array('apikey: '.$globalTransaviaKey);
357
-		$json = $Common->getData($url,'get','',$headers);
357
+		$json = $Common->getData($url, 'get', '', $headers);
358 358
 		//echo 'result : '.$json;
359 359
 		if ($json == '') return array();
360 360
 		$parsed_json = json_decode($json);
361 361
 		
362 362
 		if (isset($parsed_json->{'data'}[0])) {
363 363
 			$DepartureAirportIata = $parsed_json->{'data'}[0]->{'flight'}->{'departureAirport'}->{'locationCode'};
364
-			$departureTime = date('H:i',strtotime($parsed_json->{'data'}[0]->{'flight'}->{'departureDateTime'}));
364
+			$departureTime = date('H:i', strtotime($parsed_json->{'data'}[0]->{'flight'}->{'departureDateTime'}));
365 365
 			$ArrivalAirportIata = $parsed_json->{'data'}[0]->{'flight'}->{'arrivalAirport'}->{'locationCode'};
366
-			$arrivalTime = date('H:i',strtotime($parsed_json->{'data'}[0]->{'flight'}->{'arrivalDateTime'}));
367
-			return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_transavia');
366
+			$arrivalTime = date('H:i', strtotime($parsed_json->{'data'}[0]->{'flight'}->{'arrivalDateTime'}));
367
+			return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_transavia');
368 368
 		} else return array();
369 369
 	}
370 370
 
@@ -375,14 +375,14 @@  discard block
 block discarded – undo
375 375
 	*/
376 376
 	public function getTunisair($callsign) {
377 377
 		$Common = new Common();
378
-		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
379
-		if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array();
378
+		$numvol = preg_replace('/^[A-Z]*/', '', $callsign);
379
+		if (!filter_var($numvol, FILTER_VALIDATE_INT)) return array();
380 380
 		$url = "http://www.tunisair.com/site/publish/module/Volj/fr/Flight_List.asp";
381 381
 		$data = $Common->getData($url);
382 382
 		$table = $Common->table2array($data);
383 383
 		foreach ($table as $flight) {
384
-			if (isset($flight[1]) && $flight[1] == "TU ".sprintf('%04d',$numvol)) {
385
-				return array('DepartureAirportIATA' => $flight[2],'DepartureTime' => str_replace('.',':',$flight[5]),'ArrivalAirportIATA' => $flight[3],'ArrivalTime' => str_replace('.',':',$flight[6]),'Source' => 'website_tunisair');
384
+			if (isset($flight[1]) && $flight[1] == "TU ".sprintf('%04d', $numvol)) {
385
+				return array('DepartureAirportIATA' => $flight[2], 'DepartureTime' => str_replace('.', ':', $flight[5]), 'ArrivalAirportIATA' => $flight[3], 'ArrivalTime' => str_replace('.', ':', $flight[6]), 'Source' => 'website_tunisair');
386 386
 			}
387 387
 		}
388 388
 		return array();
@@ -393,21 +393,21 @@  discard block
 block discarded – undo
393 393
 	* @param String $callsign The callsign
394 394
 	* @return Flight departure and arrival airports and time
395 395
 	*/
396
-	public function getVueling($callsign,$date = 'NOW') {
396
+	public function getVueling($callsign, $date = 'NOW') {
397 397
 		$Common = new Common();
398 398
 		$check_date = new Datetime($date);
399
-		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
400
-		if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array();
401
-		$final_date = str_replace('/','%2F',$check_date->format('d/m/Y'));
399
+		$numvol = preg_replace('/^[A-Z]*/', '', $callsign);
400
+		if (!filter_var($numvol, FILTER_VALIDATE_INT)) return array();
401
+		$final_date = str_replace('/', '%2F', $check_date->format('d/m/Y'));
402 402
 		$url = "http://www.vueling.com/Base/BaseProxy/RenderMacro/?macroalias=FlightStatusResult&searchBy=bycode&date=".$final_date."&flightNumber=".$numvol."&idioma=en-GB";
403 403
 		$data = $Common->getData($url);
404
-		$data=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$data));
404
+		$data = trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '', $data));
405 405
 		if ($data != '') {
406
-			preg_match('/flightOri=[A-Z]{3}/',$data,$result);
407
-			$DepartureAirportIata = str_replace('flightOri=','',$result[0]);
408
-			preg_match('/flightDest=[A-Z]{3}/',$data,$result);
409
-			$ArrivalAirportIata = str_replace('flightDest=','',$result[0]);
410
-			if ($DepartureAirportIata != '' && $ArrivalAirportIata != '') return array('DepartureAirportIATA' => $DepartureAirportIata,'ArrivalAirportIATA' => $ArrivalAirportIata,'Source' => 'website_vueling');
406
+			preg_match('/flightOri=[A-Z]{3}/', $data, $result);
407
+			$DepartureAirportIata = str_replace('flightOri=', '', $result[0]);
408
+			preg_match('/flightDest=[A-Z]{3}/', $data, $result);
409
+			$ArrivalAirportIata = str_replace('flightDest=', '', $result[0]);
410
+			if ($DepartureAirportIata != '' && $ArrivalAirportIata != '') return array('DepartureAirportIATA' => $DepartureAirportIata, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'Source' => 'website_vueling');
411 411
 			else return array();
412 412
 		}
413 413
 		return array();
@@ -421,27 +421,27 @@  discard block
 block discarded – undo
421 421
 	*/
422 422
 	public function getIberia($callsign, $date = 'NOW') {
423 423
 		$Common = new Common();
424
-		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
424
+		$numvol = preg_replace('/^[A-Z]*/', '', $callsign);
425 425
 		$check_date = new Datetime($date);
426
-		if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array();
426
+		if (!filter_var($numvol, FILTER_VALIDATE_INT)) return array();
427 427
 		$url = "https://www.iberia.com/web/flightDetail.do";
428
-		$post = array('numvuelo' => $numvol,'fecha' => $check_date->format('Ymd'),'airlineID' => 'IB');
429
-		$data = $Common->getData($url,'post',$post);
428
+		$post = array('numvuelo' => $numvol, 'fecha' => $check_date->format('Ymd'), 'airlineID' => 'IB');
429
+		$data = $Common->getData($url, 'post', $post);
430 430
 		if ($data != '') {
431 431
 			$table = $Common->table2array($data);
432 432
 			//print_r($table);
433 433
 			if (count($table) > 0) {
434 434
 				$flight = $table;
435
-				preg_match('/([A-Z]{3})/',$flight[3][0],$DepartureAirportIataMatch);
436
-				preg_match('/([A-Z]{3})/',$flight[5][0],$ArrivalAirportIataMatch);
435
+				preg_match('/([A-Z]{3})/', $flight[3][0], $DepartureAirportIataMatch);
436
+				preg_match('/([A-Z]{3})/', $flight[5][0], $ArrivalAirportIataMatch);
437 437
 				$DepartureAirportIata = $DepartureAirportIataMatch[0];
438 438
 				$ArrivalAirportIata = $ArrivalAirportIataMatch[0];
439
-				$departureTime = substr(trim(str_replace(' lunes','',str_replace('&nbsp;','',$flight[3][2]))),0,5);
440
-				$arrivalTime = trim(str_replace(' lunes','',str_replace('&nbsp;','',$flight[5][1])));
439
+				$departureTime = substr(trim(str_replace(' lunes', '', str_replace('&nbsp;', '', $flight[3][2]))), 0, 5);
440
+				$arrivalTime = trim(str_replace(' lunes', '', str_replace('&nbsp;', '', $flight[5][1])));
441 441
 				if ($arrivalTime == 'Hora estimada de llegada') {
442
-					$arrivalTime = substr(trim(str_replace(' lunes','',str_replace('&nbsp;','',$flight[5][2]))),0,5);
443
-				} else $arrivalTime = substr($arrivalTime,0,5);
444
-				return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_iberia');
442
+					$arrivalTime = substr(trim(str_replace(' lunes', '', str_replace('&nbsp;', '', $flight[5][2]))), 0, 5);
443
+				} else $arrivalTime = substr($arrivalTime, 0, 5);
444
+				return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_iberia');
445 445
 			}
446 446
 		}
447 447
 		return array();
@@ -454,11 +454,11 @@  discard block
 block discarded – undo
454 454
 	* @return Flight departure and arrival airports and time
455 455
 	*/
456 456
 
457
-	private function getStarAlliance($callsign, $date = 'NOW',$carrier = '') {
457
+	private function getStarAlliance($callsign, $date = 'NOW', $carrier = '') {
458 458
 		$Common = new Common();
459
-		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
459
+		$numvol = preg_replace('/^[A-Z]*/', '', $callsign);
460 460
 		$check_date = new Datetime($date);
461
-		if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array();
461
+		if (!filter_var($numvol, FILTER_VALIDATE_INT)) return array();
462 462
 		$url = "http://www.staralliance.com/flifoQueryAction.do?myAirline=&airlineCode=".$carrier."&flightNo=".$numvol."&day=".$check_date->format('d')."&month=".$check_date->format('m')."&year=".$check_date->format('Y')."&departuredate=".$check_date->format('d-M-Y');
463 463
 		$data = $Common->getData($url);
464 464
 		if ($data != '') {
@@ -467,13 +467,13 @@  discard block
 block discarded – undo
467 467
 				$flight = $table;
468 468
 				//print_r($table);
469 469
 				if (isset($flight[25]) && isset($flight[29])) {
470
-					preg_match('/([A-Z]{3})/',$flight[25][1],$DepartureAirportIataMatch);
471
-					preg_match('/([A-Z]{3})/',$flight[25][3],$ArrivalAirportIataMatch);
470
+					preg_match('/([A-Z]{3})/', $flight[25][1], $DepartureAirportIataMatch);
471
+					preg_match('/([A-Z]{3})/', $flight[25][3], $ArrivalAirportIataMatch);
472 472
 					$DepartureAirportIata = $DepartureAirportIataMatch[0];
473 473
 					$ArrivalAirportIata = $ArrivalAirportIataMatch[0];
474
-					$departureTime = substr(trim(str_replace('Scheduled: ','',$flight[29][0])),0,5);
475
-					$arrivalTime = substr(trim(str_replace('Scheduled: ','',$flight[29][1])),0,5);
476
-					return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_staralliance');
474
+					$departureTime = substr(trim(str_replace('Scheduled: ', '', $flight[29][0])), 0, 5);
475
+					$arrivalTime = substr(trim(str_replace('Scheduled: ', '', $flight[29][1])), 0, 5);
476
+					return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_staralliance');
477 477
 				} else return array();
478 478
 			}
479 479
 			
@@ -491,10 +491,10 @@  discard block
 block discarded – undo
491 491
 	*/
492 492
 	private function getAlitalia($callsign, $date = 'NOW') {
493 493
 		$Common = new Common();
494
-		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
494
+		$numvol = preg_replace('/^[A-Z]*/', '', $callsign);
495 495
 		$check_date = new Datetime($date);
496
-		$url= "http://booking.alitalia.com/FlightStatus/fr_fr/FlightInfo?Brand=az&NumeroVolo=".$numvol."&DataCompleta=".$check_date->format('d/m/Y');
497
-		if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array();
496
+		$url = "http://booking.alitalia.com/FlightStatus/fr_fr/FlightInfo?Brand=az&NumeroVolo=".$numvol."&DataCompleta=".$check_date->format('d/m/Y');
497
+		if (!filter_var($numvol, FILTER_VALIDATE_INT)) return array();
498 498
 		$data = $Common->getData($url);
499 499
 		if ($data != '') {
500 500
 			$table = $Common->text2array($data);
@@ -502,7 +502,7 @@  discard block
 block discarded – undo
502 502
 			$ArrivalAirportIata = '';
503 503
 			$departureTime = $table[4];
504 504
 			$arrivalTime = $table[5];
505
-			return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_alitalia');
505
+			return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_alitalia');
506 506
 		}
507 507
 	}
508 508
 
@@ -514,21 +514,21 @@  discard block
 block discarded – undo
514 514
 	*/
515 515
 	private function getBrussels($callsign, $date = 'NOW') {
516 516
 		$Common = new Common();
517
-		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
517
+		$numvol = preg_replace('/^[A-Z]*/', '', $callsign);
518 518
 		$check_date = new Datetime($date);
519
-		$url= "http://www.brusselsairlines.com/api/flightstatus/getresults?from=NA&to=NA&date=".$check_date->format('d/m/Y')."&hour=NA&lookup=flightnumber&flightnumber=".$numvol."&publicationID=302";
519
+		$url = "http://www.brusselsairlines.com/api/flightstatus/getresults?from=NA&to=NA&date=".$check_date->format('d/m/Y')."&hour=NA&lookup=flightnumber&flightnumber=".$numvol."&publicationID=302";
520 520
 		//http://www.brusselsairlines.com/fr-fr/informations-pratiques/statut-de-votre-vol/resultat.aspx?flightnumber=".$numvol."&date=".$check_date->format('d/m/Y')."&lookup=flightnumber";
521
-		if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array();
521
+		if (!filter_var($numvol, FILTER_VALIDATE_INT)) return array();
522 522
 		$data = $Common->getData($url);
523 523
 		if ($data != '') {
524 524
 		    //echo $data;
525
-		    $parsed_json = json_decode($data,true);
525
+		    $parsed_json = json_decode($data, true);
526 526
 		    if (isset($parsed_json[0]['FromAirportCode'])) {
527 527
 			$DepartureAirportIata = $parsed_json[0]['FromAirportCode'];
528 528
 			$ArrivalAirportIata = $parsed_json[0]['ToAirportCode'];
529
-			$departureTime = date('H:i',strtotime($parsed_json[0]['ScheduledDepatureDate']));
530
-			$arrivalTime = date('H:i',strtotime($parsed_json[0]['ScheduledArrivalDate']));
531
-			return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_brussels');
529
+			$departureTime = date('H:i', strtotime($parsed_json[0]['ScheduledDepatureDate']));
530
+			$arrivalTime = date('H:i', strtotime($parsed_json[0]['ScheduledArrivalDate']));
531
+			return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_brussels');
532 532
 		    }
533 533
 		}
534 534
 	}
@@ -605,21 +605,21 @@  discard block
 block discarded – undo
605 605
 	*/
606 606
 	private function getFlyTap($callsign) {
607 607
 		$Common = new Common();
608
-		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
609
-		$url= "http://www.flytap.com/France/fr/PlanifierEtReserver/Outils/DepartsEtArrivees";
608
+		$numvol = preg_replace('/^[A-Z]*/', '', $callsign);
609
+		$url = "http://www.flytap.com/France/fr/PlanifierEtReserver/Outils/DepartsEtArrivees";
610 610
 		//$check_date = new Datetime($date);
611
-		if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array();
612
-		$post = array('arrivalsdepartures_content' => 'number','arrivalsdepartures_tp' => $numvol,'arrivalsdepartures_trk' => 'ARR','arrivalsdepartures_date_trk' => '1','aptCode' => '','arrivalsdepartures' => 'DEP','arrivalsdepartures_date' => '1','aptCodeFrom' => '','aptCodeTo' => '','arrivalsdepartures2' => 'DEP','arrivalsdepartures_date2' => '1');
613
-		$data = $Common->getData($url,'post',$post);
611
+		if (!filter_var($numvol, FILTER_VALIDATE_INT)) return array();
612
+		$post = array('arrivalsdepartures_content' => 'number', 'arrivalsdepartures_tp' => $numvol, 'arrivalsdepartures_trk' => 'ARR', 'arrivalsdepartures_date_trk' => '1', 'aptCode' => '', 'arrivalsdepartures' => 'DEP', 'arrivalsdepartures_date' => '1', 'aptCodeFrom' => '', 'aptCodeTo' => '', 'arrivalsdepartures2' => 'DEP', 'arrivalsdepartures_date2' => '1');
613
+		$data = $Common->getData($url, 'post', $post);
614 614
 		if ($data != '') {
615 615
 			$table = $Common->table2array($data);
616
-			$departureTime = trim(substr($table[15][0],0,5));
617
-			$arrivalTime = trim(substr($table[35][0],0,5));
618
-			preg_match('/([A-Z]{3})/',$table[11][0],$DepartureAirportIataMatch);
619
-			preg_match('/([A-Z]{3})/',$table[31][0],$ArrivalAirportIataMatch);
616
+			$departureTime = trim(substr($table[15][0], 0, 5));
617
+			$arrivalTime = trim(substr($table[35][0], 0, 5));
618
+			preg_match('/([A-Z]{3})/', $table[11][0], $DepartureAirportIataMatch);
619
+			preg_match('/([A-Z]{3})/', $table[31][0], $ArrivalAirportIataMatch);
620 620
 			$DepartureAirportIata = $DepartureAirportIataMatch[0];
621 621
 			$ArrivalAirportIata = $ArrivalAirportIataMatch[0];
622
-			return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_flytap');
622
+			return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_flytap');
623 623
 		}
624 624
 		return array();
625 625
 	}
@@ -641,10 +641,10 @@  discard block
 block discarded – undo
641 641
 			} 
642 642
 		}
643 643
 		if ($airline_icao == '') return array();
644
-		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
645
-		$url= "http://info.flightmapper.net/flight/".$airline_icao.'_'.$numvol;
644
+		$numvol = preg_replace('/^[A-Z]*/', '', $callsign);
645
+		$url = "http://info.flightmapper.net/flight/".$airline_icao.'_'.$numvol;
646 646
 		//$check_date = new Datetime($date);
647
-		if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array();
647
+		if (!filter_var($numvol, FILTER_VALIDATE_INT)) return array();
648 648
 		$data = $Common->getData($url);
649 649
 		if ($data != '') {
650 650
 			$table = $Common->table2array($data);
@@ -654,13 +654,13 @@  discard block
 block discarded – undo
654 654
 				$darr = '';
655 655
 				$ahour = '';
656 656
 				$aarr = '';
657
-				$n = sscanf($sched,'%*s %5[0-9:] %*[^()] (%3[A-Z]) %5[0-9:] %*[^()] (%3[A-Z])',$dhour,$darr,$ahour,$aarr);
657
+				$n = sscanf($sched, '%*s %5[0-9:] %*[^()] (%3[A-Z]) %5[0-9:] %*[^()] (%3[A-Z])', $dhour, $darr, $ahour, $aarr);
658 658
 				if ($n == 7) {
659 659
 				    $departureTime = $dhour;
660 660
 				    $arrivalTime = $ahour;
661
-				    $DepartureAirportIata = str_replace(array('(',')'),'',$darr);
662
-				    $ArrivalAirportIata = str_replace(array('(',')'),'',$aarr);
663
-				    return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_flightmapper');
661
+				    $DepartureAirportIata = str_replace(array('(', ')'), '', $darr);
662
+				    $ArrivalAirportIata = str_replace(array('(', ')'), '', $aarr);
663
+				    return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_flightmapper');
664 664
 				}
665 665
 			}
666 666
 		}
@@ -684,20 +684,20 @@  discard block
 block discarded – undo
684 684
 			} 
685 685
 		}
686 686
 		*/
687
-		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
688
-		$url= "http://fr.flightaware.com/live/flight/".$callsign;
687
+		$numvol = preg_replace('/^[A-Z]*/', '', $callsign);
688
+		$url = "http://fr.flightaware.com/live/flight/".$callsign;
689 689
 		//$check_date = new Datetime($date);
690
-		if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array();
690
+		if (!filter_var($numvol, FILTER_VALIDATE_INT)) return array();
691 691
 		$data = $Common->getData($url);
692 692
 		if ($data != '') {
693 693
 			$table = $Common->table2array($data);
694 694
 			if (isset($table[11][0])) {
695
-				$departureTime = str_replace('h',':',substr($table[5][0],0,5));
696
-				$arrivalTime = str_replace('h',':',substr($table[5][1],0,5));
695
+				$departureTime = str_replace('h', ':', substr($table[5][0], 0, 5));
696
+				$arrivalTime = str_replace('h', ':', substr($table[5][1], 0, 5));
697 697
 				echo $table[3][0];
698
-				sscanf($table[3][0],'%*[^(] (%3[A-Z] / %*4[A-Z])',$DepartureAirportIata);
699
-				sscanf($table[3][1],'%*[^(] (%3[A-Z] / %*4[A-Z])',$ArrivalAirportIata);
700
-				return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_flightaware');
698
+				sscanf($table[3][0], '%*[^(] (%3[A-Z] / %*4[A-Z])', $DepartureAirportIata);
699
+				sscanf($table[3][1], '%*[^(] (%3[A-Z] / %*4[A-Z])', $ArrivalAirportIata);
700
+				return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_flightaware');
701 701
 			}
702 702
 		}
703 703
 		return array();
@@ -710,7 +710,7 @@  discard block
 block discarded – undo
710 710
 	*/
711 711
 	public function getCostToTravel($callsign) {
712 712
 		$Common = new Common();
713
-		$url= "http://www.costtotravel.com/flight-number/".$callsign;
713
+		$url = "http://www.costtotravel.com/flight-number/".$callsign;
714 714
 		//$check_date = new Datetime($date);
715 715
 		//if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array();
716 716
 		$data = $Common->getData($url);
@@ -718,11 +718,11 @@  discard block
 block discarded – undo
718 718
 			$table = $Common->table2array($data);
719 719
 			//print_r($table);
720 720
 			if (isset($table[11][1])) {
721
-				$departureTime = substr($table[11][1],0,5);
722
-				$arrivalTime = substr($table[17][1],0,5);
723
-				$DepartureAirportIata = substr($table[13][1],0,3);
724
-				$ArrivalAirportIata = substr($table[15][1],0,3);
725
-				return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_costtotravel');
721
+				$departureTime = substr($table[11][1], 0, 5);
722
+				$arrivalTime = substr($table[17][1], 0, 5);
723
+				$DepartureAirportIata = substr($table[13][1], 0, 3);
724
+				$ArrivalAirportIata = substr($table[15][1], 0, 3);
725
+				return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_costtotravel');
726 726
 			}
727 727
 		}
728 728
 		return array();
@@ -734,14 +734,14 @@  discard block
 block discarded – undo
734 734
 	* @param String $date date we want flight number info
735 735
 	* @return Flight departure and arrival airports and time
736 736
 	*/
737
-	private function getAirCanada($callsign,$date = 'NOW') {
737
+	private function getAirCanada($callsign, $date = 'NOW') {
738 738
 		$Common = new Common();
739 739
 		if (class_exists("DomDocument") === FALSE) return array();
740 740
 		date_default_timezone_set('UTC');
741 741
 		$check_date = new Datetime($date);
742
-		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
743
-		$url= "http://services.aircanada.com/portal/rest/getFlightsByFlightNumber?forceTimetable=true&flightNumber=".$numvol."&carrierCode=AC&date=".$check_date->format('m-d-Y')."&app_key=AE919FDCC80311DF9BABC975DFD72085&cache=74249";
744
-		if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array();
742
+		$numvol = preg_replace('/^[A-Z]*/', '', $callsign);
743
+		$url = "http://services.aircanada.com/portal/rest/getFlightsByFlightNumber?forceTimetable=true&flightNumber=".$numvol."&carrierCode=AC&date=".$check_date->format('m-d-Y')."&app_key=AE919FDCC80311DF9BABC975DFD72085&cache=74249";
744
+		if (!filter_var($numvol, FILTER_VALIDATE_INT)) return array();
745 745
 		$data = $Common->getData($url);
746 746
 		$dom = new DomDocument();
747 747
 		$dom->loadXML($data);
@@ -749,11 +749,11 @@  discard block
 block discarded – undo
749 749
 		$departure = $dom->getElementsByTagName('DepartureStationInfo')->item(0);
750 750
 		if (isset($departure->getElementsByTagName('Airport')->item(0)->firstChild->nodeValue)) {
751 751
 			$DepartureAirportIata = $departure->getElementsByTagName('Airport')->item(0)->firstChild->nodeValue;
752
-			$departureTime = date('H:i',strtotime($departure->getElementsByTagName('ScheduledTime')->item(0)->firstChild->nodeValue));
752
+			$departureTime = date('H:i', strtotime($departure->getElementsByTagName('ScheduledTime')->item(0)->firstChild->nodeValue));
753 753
 			$arrival = $dom->getElementsByTagName('ArrivalStationInfo')->item(0);
754 754
 			$ArrivalAirportIata = $arrival->getElementsByTagName('Airport')->item(0)->firstChild->nodeValue;
755
-			$arrivalTime = date('H:i',strtotime($arrival->getElementsByTagName('ScheduledTime')->item(0)->firstChild->nodeValue));
756
-			return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_aircanada');
755
+			$arrivalTime = date('H:i', strtotime($arrival->getElementsByTagName('ScheduledTime')->item(0)->firstChild->nodeValue));
756
+			return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_aircanada');
757 757
 		} else return array();
758 758
 	}
759 759
 
@@ -765,21 +765,21 @@  discard block
 block discarded – undo
765 765
 	*/
766 766
 	private function getVietnamAirlines($callsign, $date = 'NOW') {
767 767
 		$Common = new Common();
768
-		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
768
+		$numvol = preg_replace('/^[A-Z]*/', '', $callsign);
769 769
 		$check_date = new Datetime($date);
770
-		$url= "https://cat.sabresonicweb.com/SSWVN/meridia?posid=VNVN&page=flifoFlightInfoDetailsMessage_learn&action=flightInfoDetails&airline=VN&language=fr&depDay=".$check_date->format('j')."&depMonth=".strtoupper($check_date->format('M'))."&=&flight=".$numvol."&";
771
-		if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array();
770
+		$url = "https://cat.sabresonicweb.com/SSWVN/meridia?posid=VNVN&page=flifoFlightInfoDetailsMessage_learn&action=flightInfoDetails&airline=VN&language=fr&depDay=".$check_date->format('j')."&depMonth=".strtoupper($check_date->format('M'))."&=&flight=".$numvol."&";
771
+		if (!filter_var($numvol, FILTER_VALIDATE_INT)) return array();
772 772
 		$data = $Common->getData($url);
773 773
 		if ($data != '') {
774 774
 			$table = $Common->table2array($data);
775 775
 			$flight = $table;
776
-			preg_match('/([A-Z]{3})/',$flight[3][0],$DepartureAirportIataMatch);
777
-			preg_match('/([A-Z]{3})/',$flight[21][0],$ArrivalAirportIataMatch);
776
+			preg_match('/([A-Z]{3})/', $flight[3][0], $DepartureAirportIataMatch);
777
+			preg_match('/([A-Z]{3})/', $flight[21][0], $ArrivalAirportIataMatch);
778 778
 			$DepartureAirportIata = $DepartureAirportIataMatch[0];
779 779
 			$ArrivalAirportIata = $ArrivalAirportIataMatch[0];
780 780
 			$departureTime = $flight[5][1];
781 781
 			$arrivalTime = $flight[23][1];
782
-			return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_vietnamairlines');
782
+			return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_vietnamairlines');
783 783
 		}
784 784
 	}
785 785
 
@@ -790,16 +790,16 @@  discard block
 block discarded – undo
790 790
 	* @param String $carrier airline code
791 791
 	* @return Flight departure and arrival airports and time
792 792
 	*/
793
-	private function getAirBerlin($callsign, $date = 'NOW',$carrier = 'AB') {
793
+	private function getAirBerlin($callsign, $date = 'NOW', $carrier = 'AB') {
794 794
 		$Common = new Common();
795 795
 		date_default_timezone_set('UTC');
796 796
 		//AB = airberlin, HG/NLY = NIKI, 4T/BHP = Belair 
797
-		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
797
+		$numvol = preg_replace('/^[A-Z]*/', '', $callsign);
798 798
 		$check_date = new Datetime($date);
799
-		$url= "http://www.airberlin.com/en-US/site/aims.php";
800
-		if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array();
801
-		$post = array('type' => 'departure','searchFlightNo' => '1','requestsent' => 'true', 'flightno' => $numvol,'date' => $check_date->format('Y-m-d'),'carrier' => $carrier);
802
-		$data = $Common->getData($url,'post',$post);
799
+		$url = "http://www.airberlin.com/en-US/site/aims.php";
800
+		if (!filter_var($numvol, FILTER_VALIDATE_INT)) return array();
801
+		$post = array('type' => 'departure', 'searchFlightNo' => '1', 'requestsent' => 'true', 'flightno' => $numvol, 'date' => $check_date->format('Y-m-d'), 'carrier' => $carrier);
802
+		$data = $Common->getData($url, 'post', $post);
803 803
 		//echo $data;
804 804
 		$DepartureAirportIata = '';
805 805
 		$ArrivalAirportIata = '';
@@ -812,8 +812,8 @@  discard block
 block discarded – undo
812 812
 			if (isset($flight[5][2])) $departureAirport = $flight[5][2];
813 813
 			else $departureAirport = '';
814 814
 		} else return array();
815
-		$post = array('type' => 'arrival','searchFlightNo' => '1','requestsent' => 'true', 'flightno' => $numvol,'date' => $check_date->format('Y-m-d'),'carrier' => 'AB');
816
-		$data = $Common->getData($url,'post',$post);
815
+		$post = array('type' => 'arrival', 'searchFlightNo' => '1', 'requestsent' => 'true', 'flightno' => $numvol, 'date' => $check_date->format('Y-m-d'), 'carrier' => 'AB');
816
+		$data = $Common->getData($url, 'post', $post);
817 817
 		if ($data != '') {
818 818
 			$table = $Common->table2array($data);
819 819
 			$flight = $table;
@@ -841,13 +841,13 @@  discard block
 block discarded – undo
841 841
 			}
842 842
 		}
843 843
 		if (isset($DepartureAirportIata)) {
844
-			return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_airberlin');
844
+			return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_airberlin');
845 845
 		} else return array();
846 846
 	}
847 847
 
848 848
 
849 849
 	
850
-	public function fetchSchedule($ident,$date = 'NOW') {
850
+	public function fetchSchedule($ident, $date = 'NOW') {
851 851
 		global $globalSchedulesSources, $globalSchedulesFetch;
852 852
 		//$Common = new Common();
853 853
 		if (!$globalSchedulesFetch) return array();
@@ -917,7 +917,7 @@  discard block
 block discarded – undo
917 917
 				// Brussels Airlines
918 918
 				case "BEL":
919 919
 				case "SN":
920
-					return $this->getBrussels($ident,$date);
920
+					return $this->getBrussels($ident, $date);
921 921
 /*
922 922
 				// Copa Airlines
923 923
 				case "CMP":
@@ -1002,17 +1002,17 @@  discard block
 block discarded – undo
1002 1002
 				// Air France
1003 1003
 				case "AF":
1004 1004
 				case "AFR":
1005
-					return $this->getAirFrance($ident,$date,'AF');
1005
+					return $this->getAirFrance($ident, $date, 'AF');
1006 1006
 				// HOP
1007 1007
 				case "A5":
1008 1008
 				case "HOP":
1009
-					return $this->getAirFrance($ident,$date,'A5');
1009
+					return $this->getAirFrance($ident, $date, 'A5');
1010 1010
 				// EasyJet
1011 1011
 				case "U2":
1012 1012
 				case "DS":
1013 1013
 				case "EZY":
1014 1014
 				case "EZS":
1015
-					return $this->getEasyJet($ident,$date);
1015
+					return $this->getEasyJet($ident, $date);
1016 1016
 				// Ryanair
1017 1017
 				case "FR":
1018 1018
 				case "RYR":
@@ -1062,25 +1062,25 @@  discard block
 block discarded – undo
1062 1062
 					return $this->getIberia($ident);
1063 1063
 				// Vietnam Airlines
1064 1064
 				case "HVN":
1065
-					return $this->getVietnamAirlines($ident,$date);
1065
+					return $this->getVietnamAirlines($ident, $date);
1066 1066
 				// Air Berlin
1067 1067
 				case "AB":
1068 1068
 				case "BER":
1069
-					return $this->getAirBerlin($ident,$date,'AB');
1069
+					return $this->getAirBerlin($ident, $date, 'AB');
1070 1070
 				// NIKI
1071 1071
 				case "HG":
1072 1072
 				case "NLY":
1073
-					return $this->getAirBerlin($ident,$date,'HG');
1073
+					return $this->getAirBerlin($ident, $date, 'HG');
1074 1074
 				// BelAir
1075 1075
 				case "4T":
1076 1076
 				case "BHP":
1077
-					return $this->getAirBerlin($ident,$date,'4T');
1077
+					return $this->getAirBerlin($ident, $date, '4T');
1078 1078
 				default:
1079 1079
 					// Randomly use a generic function to get hours
1080 1080
 					if (strlen($airline_icao) == 2) {
1081
-						if (!isset($globalSchedulesSources)) $globalSchedulesSources = array('flightmapper','costtotravel','flightradar24','flightaware');
1081
+						if (!isset($globalSchedulesSources)) $globalSchedulesSources = array('flightmapper', 'costtotravel', 'flightradar24', 'flightaware');
1082 1082
 						if (count($globalSchedulesSources) > 0) {
1083
-							$rand = mt_rand(0,count($globalSchedulesSources)-1);
1083
+							$rand = mt_rand(0, count($globalSchedulesSources) - 1);
1084 1084
 							$source = $globalSchedulesSources[$rand];
1085 1085
 							if ($source == 'flightmapper') return $this->getFlightMapper($ident);
1086 1086
 							elseif ($source == 'costtotravel') return $this->getCostToTravel($ident);
Please login to merge, or discard this patch.
Braces   +170 added lines, -58 removed lines patch added patch discarded remove patch
@@ -12,7 +12,9 @@  discard block
 block discarded – undo
12 12
 	public function __construct($dbc = null) {
13 13
 		$Connection = new Connection($dbc);
14 14
 		$this->db = $Connection->db();
15
-		if ($this->db === null) die('Error: No DB connection.');
15
+		if ($this->db === null) {
16
+			die('Error: No DB connection.');
17
+		}
16 18
 	}
17 19
 	
18 20
 	/**
@@ -124,7 +126,9 @@  discard block
 block discarded – undo
124 126
 		$sth->closeCursor();
125 127
 		if (count($row) > 0) {
126 128
 			return $row;
127
-		} else return array();
129
+		} else {
130
+			return array();
131
+		}
128 132
 	}
129 133
 
130 134
 	public function checkSchedule($ident) {
@@ -160,7 +164,9 @@  discard block
 block discarded – undo
160 164
 		$Common = new Common();
161 165
 		$check_date = new Datetime($date);
162 166
 		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
163
-		if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array();
167
+		if (!filter_var($numvol,FILTER_VALIDATE_INT)) {
168
+			return array();
169
+		}
164 170
 		$url = "http://www.airfrance.fr/cgi-bin/AF/FR/fr/local/resainfovol/infovols/detailsVolJson.do?codeCompagnie[0]=".$carrier."&numeroVol[0]=".$numvol."&dayFlightDate=".$check_date->format('d')."&yearMonthFlightDate=".$check_date->format('Ym');
165 171
 		$json = $Common->getData($url);
166 172
 	
@@ -187,7 +193,9 @@  discard block
 block discarded – undo
187 193
 			*/
188 194
 		
189 195
 			return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_airfrance');
190
-		} else return array();
196
+		} else {
197
+			return array();
198
+		}
191 199
 	}
192 200
 
193 201
 	/**
@@ -202,7 +210,9 @@  discard block
 block discarded – undo
202 210
 		date_default_timezone_set($globalTimezone);
203 211
 		$check_date = new Datetime($date);
204 212
 		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
205
-		if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array();
213
+		if (!filter_var($numvol,FILTER_VALIDATE_INT)) {
214
+			return array();
215
+		}
206 216
 		$url = "http://www.easyjet.com/ft/api/flights?date=".$check_date->format('Y-m-d')."&fn=".$callsign;
207 217
 		$json = $Common->getData($url);
208 218
 		$parsed_json = json_decode($json);
@@ -215,7 +225,9 @@  discard block
 block discarded – undo
215 225
 			$arrivalTime = $parsed_json->{'flights'}[0]->{'dates'}->{'fsta'};
216 226
 
217 227
 			return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_easyjet');
218
-		} else return array();
228
+		} else {
229
+			return array();
230
+		}
219 231
 	}
220 232
 
221 233
 	/**
@@ -226,7 +238,9 @@  discard block
 block discarded – undo
226 238
 	private function getRyanair($callsign) {
227 239
 		$Common = new Common();
228 240
 		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
229
-		if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array();
241
+		if (!filter_var($numvol,FILTER_VALIDATE_INT)) {
242
+			return array();
243
+		}
230 244
 		$url = "http://www.ryanair.com/fr/api/2/flight-info/0/50/";
231 245
 		$post = '{"flight":"'.$numvol.'","minDepartureTime":"00:00","maxDepartureTime":"23:59"}';
232 246
 		$headers = array('Content-Type: application/json','Content-Length: ' . strlen($post));
@@ -240,8 +254,12 @@  discard block
 block discarded – undo
240 254
 				$departureTime = $parsed_json->{'flightInfo'}[0]->{'departureTime'};
241 255
 				$arrivalTime = $parsed_json->{'flightInfo'}[0]->{'arrivalTime'};
242 256
 				return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime, 'Source' => 'website_ryanair');
243
-			} else return array();
244
-		} else return array();
257
+			} else {
258
+				return array();
259
+			}
260
+		} else {
261
+			return array();
262
+		}
245 263
 	}
246 264
 
247 265
 	/**
@@ -252,7 +270,9 @@  discard block
 block discarded – undo
252 270
 	private function getSwiss($callsign) {
253 271
 		$Common = new Common();
254 272
 		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
255
-		if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array();
273
+		if (!filter_var($numvol,FILTER_VALIDATE_INT)) {
274
+			return array();
275
+		}
256 276
 		$url = "http://www.world-of-swiss.com/fr/routenetwork.json";
257 277
 		$json = $Common->getData($url);
258 278
 		$parsed_json = json_decode($json);
@@ -272,8 +292,12 @@  discard block
 block discarded – undo
272 292
 			}
273 293
 			if (isset($DepartureAirportIata) && isset($ArrivalAirportIata)) {
274 294
 				return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_swiss');
275
-			} else return array();
276
-		} else return array();
295
+			} else {
296
+				return array();
297
+			}
298
+		} else {
299
+			return array();
300
+		}
277 301
 	}
278 302
 	
279 303
 	/**
@@ -287,12 +311,18 @@  discard block
 block discarded – undo
287 311
 		$Common = new Common();
288 312
 		$check_date = new Datetime($date);
289 313
 		$numvol = sprintf('%04d',preg_replace('/^[A-Z]*/','',$callsign));
290
-		if (!filter_var(preg_replace('/^[A-Z]*/','',$callsign),FILTER_VALIDATE_INT)) return array();
291
-		if ($globalBritishAirwaysKey == '') return array();
314
+		if (!filter_var(preg_replace('/^[A-Z]*/','',$callsign),FILTER_VALIDATE_INT)) {
315
+			return array();
316
+		}
317
+		if ($globalBritishAirwaysKey == '') {
318
+			return array();
319
+		}
292 320
 		$url = "https://api.ba.com/rest-v1/v1/flights;flightNumber=".$numvol.";scheduledDepartureDate=".$check_date->format('Y-m-d').".json";
293 321
 		$headers = array('Client-Key: '.$globalBritishAirwaysKey);
294 322
 		$json = $Common->getData($url,'get','',$headers);
295
-		if ($json == '') return array();
323
+		if ($json == '') {
324
+			return array();
325
+		}
296 326
 		$parsed_json = json_decode($json);
297 327
 		$flights = $parsed_json->{'FlightsResponse'};
298 328
 		if (count($flights) > 0) {
@@ -301,7 +331,9 @@  discard block
 block discarded – undo
301 331
 			$departureTime = date('H:i',strtotime($parsed_json->{'FlightsResponse'}->{'Flight'}->{'Sector'}->{'ScheduledDepartureDateTime'}));
302 332
 			$arrivalTime = date('H:i',strtotime($parsed_json->{'FlightsResponse'}->{'Flight'}->{'Sector'}->{'ScheduledArrivalDateTime'}));
303 333
 			return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_britishairways');
304
-		} else return array();
334
+		} else {
335
+			return array();
336
+		}
305 337
 	}
306 338
 
307 339
 	/**
@@ -315,19 +347,27 @@  discard block
 block discarded – undo
315 347
 		$Common = new Common();
316 348
 		$check_date = new Datetime($date);
317 349
 		$numvol = sprintf('%04d',preg_replace('/^[A-Z]*/','',$callsign));
318
-		if (!filter_var(preg_replace('/^[A-Z]*/','',$callsign),FILTER_VALIDATE_INT)) return array();
319
-		if (!isset($globalLufthansaKey) || $globalLufthansaKey == '' || !isset($globalLufthansaKey['key']) || $globalLufthansaKey['key'] == '') return array();
350
+		if (!filter_var(preg_replace('/^[A-Z]*/','',$callsign),FILTER_VALIDATE_INT)) {
351
+			return array();
352
+		}
353
+		if (!isset($globalLufthansaKey) || $globalLufthansaKey == '' || !isset($globalLufthansaKey['key']) || $globalLufthansaKey['key'] == '') {
354
+			return array();
355
+		}
320 356
 		$url = "https://api.lufthansa.com/v1/oauth/token";
321 357
 		$post = array('client_id' => $globalLufthansaKey['key'],'client_secret' => $globalLufthansaKey['secret'],'grant_type' => 'client_credentials');
322 358
 		$data = $Common->getData($url,'post',$post);
323 359
 		$parsed_data = json_decode($data);
324
-		if (!isset($parsed_data->{'access_token'})) return array();
360
+		if (!isset($parsed_data->{'access_token'})) {
361
+			return array();
362
+		}
325 363
 		$token = $parsed_data->{'access_token'};
326 364
 		
327 365
 		$url = "https://api.lufthansa.com/v1/operations/flightstatus/LH".$numvol."/".$check_date->format('Y-m-d');
328 366
 		$headers = array('Authorization: Bearer '.$token,'Accept: application/json');
329 367
 		$json = $Common->getData($url,'get','',$headers);
330
-		if ($json == '') return array();
368
+		if ($json == '') {
369
+			return array();
370
+		}
331 371
 		$parsed_json = json_decode($json);
332 372
 		if (isset($parsed_json->{'FlightStatusResource'}) && count($parsed_json->{'FlightStatusResource'}) > 0) {
333 373
 			$DepartureAirportIata = $parsed_json->{'FlightStatusResource'}->{'Flights'}->{'Flight'}->{'Departure'}->{'AirportCode'};
@@ -335,7 +375,9 @@  discard block
 block discarded – undo
335 375
 			$ArrivalAirportIata = $parsed_json->{'FlightStatusResource'}->{'Flights'}->{'Flight'}->{'Arrival'}->{'AirportCode'};
336 376
 			$arrivalTime = date('H:i',strtotime($parsed_json->{'FlightStatusResource'}->{'Flights'}->{'Flight'}->{'Arrival'}->{'ScheduledTimeLocal'}->{'DateTime'}));
337 377
 			return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_lufthansa');
338
-		} else return array();
378
+		} else {
379
+			return array();
380
+		}
339 381
 	}
340 382
 
341 383
 	/**
@@ -349,14 +391,20 @@  discard block
 block discarded – undo
349 391
 		$Common = new Common();
350 392
 		$check_date = new Datetime($date);
351 393
 		$numvol = sprintf('%04d',preg_replace('/^[A-Z]*/','',$callsign));
352
-		if (!filter_var(preg_replace('/^[A-Z]*/','',$callsign),FILTER_VALIDATE_INT)) return array();
353
-		if ($globalTransaviaKey == '') return array();
394
+		if (!filter_var(preg_replace('/^[A-Z]*/','',$callsign),FILTER_VALIDATE_INT)) {
395
+			return array();
396
+		}
397
+		if ($globalTransaviaKey == '') {
398
+			return array();
399
+		}
354 400
 		$url = "https://tst.api.transavia.com/v1/flightstatus/departuredate/".$check_date->format('Ymd').'/flightnumber/HV'.$numvol;
355 401
 		//$url = "https://api.transavia.com/v1/flightstatus/departuredate/".$check_date->format('Ymd').'/flightnumber/HV'.$numvol;
356 402
 		$headers = array('apikey: '.$globalTransaviaKey);
357 403
 		$json = $Common->getData($url,'get','',$headers);
358 404
 		//echo 'result : '.$json;
359
-		if ($json == '') return array();
405
+		if ($json == '') {
406
+			return array();
407
+		}
360 408
 		$parsed_json = json_decode($json);
361 409
 		
362 410
 		if (isset($parsed_json->{'data'}[0])) {
@@ -365,7 +413,9 @@  discard block
 block discarded – undo
365 413
 			$ArrivalAirportIata = $parsed_json->{'data'}[0]->{'flight'}->{'arrivalAirport'}->{'locationCode'};
366 414
 			$arrivalTime = date('H:i',strtotime($parsed_json->{'data'}[0]->{'flight'}->{'arrivalDateTime'}));
367 415
 			return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_transavia');
368
-		} else return array();
416
+		} else {
417
+			return array();
418
+		}
369 419
 	}
370 420
 
371 421
 	/**
@@ -376,7 +426,9 @@  discard block
 block discarded – undo
376 426
 	public function getTunisair($callsign) {
377 427
 		$Common = new Common();
378 428
 		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
379
-		if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array();
429
+		if (!filter_var($numvol,FILTER_VALIDATE_INT)) {
430
+			return array();
431
+		}
380 432
 		$url = "http://www.tunisair.com/site/publish/module/Volj/fr/Flight_List.asp";
381 433
 		$data = $Common->getData($url);
382 434
 		$table = $Common->table2array($data);
@@ -397,7 +449,9 @@  discard block
 block discarded – undo
397 449
 		$Common = new Common();
398 450
 		$check_date = new Datetime($date);
399 451
 		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
400
-		if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array();
452
+		if (!filter_var($numvol,FILTER_VALIDATE_INT)) {
453
+			return array();
454
+		}
401 455
 		$final_date = str_replace('/','%2F',$check_date->format('d/m/Y'));
402 456
 		$url = "http://www.vueling.com/Base/BaseProxy/RenderMacro/?macroalias=FlightStatusResult&searchBy=bycode&date=".$final_date."&flightNumber=".$numvol."&idioma=en-GB";
403 457
 		$data = $Common->getData($url);
@@ -407,8 +461,11 @@  discard block
 block discarded – undo
407 461
 			$DepartureAirportIata = str_replace('flightOri=','',$result[0]);
408 462
 			preg_match('/flightDest=[A-Z]{3}/',$data,$result);
409 463
 			$ArrivalAirportIata = str_replace('flightDest=','',$result[0]);
410
-			if ($DepartureAirportIata != '' && $ArrivalAirportIata != '') return array('DepartureAirportIATA' => $DepartureAirportIata,'ArrivalAirportIATA' => $ArrivalAirportIata,'Source' => 'website_vueling');
411
-			else return array();
464
+			if ($DepartureAirportIata != '' && $ArrivalAirportIata != '') {
465
+				return array('DepartureAirportIATA' => $DepartureAirportIata,'ArrivalAirportIATA' => $ArrivalAirportIata,'Source' => 'website_vueling');
466
+			} else {
467
+				return array();
468
+			}
412 469
 		}
413 470
 		return array();
414 471
 	}
@@ -423,7 +480,9 @@  discard block
 block discarded – undo
423 480
 		$Common = new Common();
424 481
 		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
425 482
 		$check_date = new Datetime($date);
426
-		if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array();
483
+		if (!filter_var($numvol,FILTER_VALIDATE_INT)) {
484
+			return array();
485
+		}
427 486
 		$url = "https://www.iberia.com/web/flightDetail.do";
428 487
 		$post = array('numvuelo' => $numvol,'fecha' => $check_date->format('Ymd'),'airlineID' => 'IB');
429 488
 		$data = $Common->getData($url,'post',$post);
@@ -440,7 +499,9 @@  discard block
 block discarded – undo
440 499
 				$arrivalTime = trim(str_replace(' lunes','',str_replace('&nbsp;','',$flight[5][1])));
441 500
 				if ($arrivalTime == 'Hora estimada de llegada') {
442 501
 					$arrivalTime = substr(trim(str_replace(' lunes','',str_replace('&nbsp;','',$flight[5][2]))),0,5);
443
-				} else $arrivalTime = substr($arrivalTime,0,5);
502
+				} else {
503
+					$arrivalTime = substr($arrivalTime,0,5);
504
+				}
444 505
 				return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_iberia');
445 506
 			}
446 507
 		}
@@ -458,7 +519,9 @@  discard block
 block discarded – undo
458 519
 		$Common = new Common();
459 520
 		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
460 521
 		$check_date = new Datetime($date);
461
-		if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array();
522
+		if (!filter_var($numvol,FILTER_VALIDATE_INT)) {
523
+			return array();
524
+		}
462 525
 		$url = "http://www.staralliance.com/flifoQueryAction.do?myAirline=&airlineCode=".$carrier."&flightNo=".$numvol."&day=".$check_date->format('d')."&month=".$check_date->format('m')."&year=".$check_date->format('Y')."&departuredate=".$check_date->format('d-M-Y');
463 526
 		$data = $Common->getData($url);
464 527
 		if ($data != '') {
@@ -474,7 +537,9 @@  discard block
 block discarded – undo
474 537
 					$departureTime = substr(trim(str_replace('Scheduled: ','',$flight[29][0])),0,5);
475 538
 					$arrivalTime = substr(trim(str_replace('Scheduled: ','',$flight[29][1])),0,5);
476 539
 					return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_staralliance');
477
-				} else return array();
540
+				} else {
541
+					return array();
542
+				}
478 543
 			}
479 544
 			
480 545
 
@@ -494,7 +559,9 @@  discard block
 block discarded – undo
494 559
 		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
495 560
 		$check_date = new Datetime($date);
496 561
 		$url= "http://booking.alitalia.com/FlightStatus/fr_fr/FlightInfo?Brand=az&NumeroVolo=".$numvol."&DataCompleta=".$check_date->format('d/m/Y');
497
-		if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array();
562
+		if (!filter_var($numvol,FILTER_VALIDATE_INT)) {
563
+			return array();
564
+		}
498 565
 		$data = $Common->getData($url);
499 566
 		if ($data != '') {
500 567
 			$table = $Common->text2array($data);
@@ -518,7 +585,9 @@  discard block
 block discarded – undo
518 585
 		$check_date = new Datetime($date);
519 586
 		$url= "http://www.brusselsairlines.com/api/flightstatus/getresults?from=NA&to=NA&date=".$check_date->format('d/m/Y')."&hour=NA&lookup=flightnumber&flightnumber=".$numvol."&publicationID=302";
520 587
 		//http://www.brusselsairlines.com/fr-fr/informations-pratiques/statut-de-votre-vol/resultat.aspx?flightnumber=".$numvol."&date=".$check_date->format('d/m/Y')."&lookup=flightnumber";
521
-		if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array();
588
+		if (!filter_var($numvol,FILTER_VALIDATE_INT)) {
589
+			return array();
590
+		}
522 591
 		$data = $Common->getData($url);
523 592
 		if ($data != '') {
524 593
 		    //echo $data;
@@ -608,7 +677,9 @@  discard block
 block discarded – undo
608 677
 		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
609 678
 		$url= "http://www.flytap.com/France/fr/PlanifierEtReserver/Outils/DepartsEtArrivees";
610 679
 		//$check_date = new Datetime($date);
611
-		if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array();
680
+		if (!filter_var($numvol,FILTER_VALIDATE_INT)) {
681
+			return array();
682
+		}
612 683
 		$post = array('arrivalsdepartures_content' => 'number','arrivalsdepartures_tp' => $numvol,'arrivalsdepartures_trk' => 'ARR','arrivalsdepartures_date_trk' => '1','aptCode' => '','arrivalsdepartures' => 'DEP','arrivalsdepartures_date' => '1','aptCodeFrom' => '','aptCodeTo' => '','arrivalsdepartures2' => 'DEP','arrivalsdepartures_date2' => '1');
613 684
 		$data = $Common->getData($url,'post',$post);
614 685
 		if ($data != '') {
@@ -640,11 +711,15 @@  discard block
 block discarded – undo
640 711
 				$airline_icao = substr($callsign, 0, 3);
641 712
 			} 
642 713
 		}
643
-		if ($airline_icao == '') return array();
714
+		if ($airline_icao == '') {
715
+			return array();
716
+		}
644 717
 		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
645 718
 		$url= "http://info.flightmapper.net/flight/".$airline_icao.'_'.$numvol;
646 719
 		//$check_date = new Datetime($date);
647
-		if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array();
720
+		if (!filter_var($numvol,FILTER_VALIDATE_INT)) {
721
+			return array();
722
+		}
648 723
 		$data = $Common->getData($url);
649 724
 		if ($data != '') {
650 725
 			$table = $Common->table2array($data);
@@ -687,7 +762,9 @@  discard block
 block discarded – undo
687 762
 		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
688 763
 		$url= "http://fr.flightaware.com/live/flight/".$callsign;
689 764
 		//$check_date = new Datetime($date);
690
-		if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array();
765
+		if (!filter_var($numvol,FILTER_VALIDATE_INT)) {
766
+			return array();
767
+		}
691 768
 		$data = $Common->getData($url);
692 769
 		if ($data != '') {
693 770
 			$table = $Common->table2array($data);
@@ -736,16 +813,22 @@  discard block
 block discarded – undo
736 813
 	*/
737 814
 	private function getAirCanada($callsign,$date = 'NOW') {
738 815
 		$Common = new Common();
739
-		if (class_exists("DomDocument") === FALSE) return array();
816
+		if (class_exists("DomDocument") === FALSE) {
817
+			return array();
818
+		}
740 819
 		date_default_timezone_set('UTC');
741 820
 		$check_date = new Datetime($date);
742 821
 		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
743 822
 		$url= "http://services.aircanada.com/portal/rest/getFlightsByFlightNumber?forceTimetable=true&flightNumber=".$numvol."&carrierCode=AC&date=".$check_date->format('m-d-Y')."&app_key=AE919FDCC80311DF9BABC975DFD72085&cache=74249";
744
-		if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array();
823
+		if (!filter_var($numvol,FILTER_VALIDATE_INT)) {
824
+			return array();
825
+		}
745 826
 		$data = $Common->getData($url);
746 827
 		$dom = new DomDocument();
747 828
 		$dom->loadXML($data);
748
-		if ($dom->getElementsByTagName('DepartureStationInfo')->length == 0) return array();
829
+		if ($dom->getElementsByTagName('DepartureStationInfo')->length == 0) {
830
+			return array();
831
+		}
749 832
 		$departure = $dom->getElementsByTagName('DepartureStationInfo')->item(0);
750 833
 		if (isset($departure->getElementsByTagName('Airport')->item(0)->firstChild->nodeValue)) {
751 834
 			$DepartureAirportIata = $departure->getElementsByTagName('Airport')->item(0)->firstChild->nodeValue;
@@ -754,7 +837,9 @@  discard block
 block discarded – undo
754 837
 			$ArrivalAirportIata = $arrival->getElementsByTagName('Airport')->item(0)->firstChild->nodeValue;
755 838
 			$arrivalTime = date('H:i',strtotime($arrival->getElementsByTagName('ScheduledTime')->item(0)->firstChild->nodeValue));
756 839
 			return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_aircanada');
757
-		} else return array();
840
+		} else {
841
+			return array();
842
+		}
758 843
 	}
759 844
 
760 845
 	/**
@@ -768,7 +853,9 @@  discard block
 block discarded – undo
768 853
 		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
769 854
 		$check_date = new Datetime($date);
770 855
 		$url= "https://cat.sabresonicweb.com/SSWVN/meridia?posid=VNVN&page=flifoFlightInfoDetailsMessage_learn&action=flightInfoDetails&airline=VN&language=fr&depDay=".$check_date->format('j')."&depMonth=".strtoupper($check_date->format('M'))."&=&flight=".$numvol."&";
771
-		if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array();
856
+		if (!filter_var($numvol,FILTER_VALIDATE_INT)) {
857
+			return array();
858
+		}
772 859
 		$data = $Common->getData($url);
773 860
 		if ($data != '') {
774 861
 			$table = $Common->table2array($data);
@@ -797,7 +884,9 @@  discard block
 block discarded – undo
797 884
 		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
798 885
 		$check_date = new Datetime($date);
799 886
 		$url= "http://www.airberlin.com/en-US/site/aims.php";
800
-		if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array();
887
+		if (!filter_var($numvol,FILTER_VALIDATE_INT)) {
888
+			return array();
889
+		}
801 890
 		$post = array('type' => 'departure','searchFlightNo' => '1','requestsent' => 'true', 'flightno' => $numvol,'date' => $check_date->format('Y-m-d'),'carrier' => $carrier);
802 891
 		$data = $Common->getData($url,'post',$post);
803 892
 		//echo $data;
@@ -807,11 +896,19 @@  discard block
 block discarded – undo
807 896
 		if ($data != '') {
808 897
 			$table = $Common->table2array($data);
809 898
 			$flight = $table;
810
-			if (isset($flight[5][4])) $departureTime = $flight[5][4];
811
-			else $departureTime = '';
812
-			if (isset($flight[5][2])) $departureAirport = $flight[5][2];
813
-			else $departureAirport = '';
814
-		} else return array();
899
+			if (isset($flight[5][4])) {
900
+				$departureTime = $flight[5][4];
901
+			} else {
902
+				$departureTime = '';
903
+			}
904
+			if (isset($flight[5][2])) {
905
+				$departureAirport = $flight[5][2];
906
+			} else {
907
+				$departureAirport = '';
908
+			}
909
+		} else {
910
+			return array();
911
+		}
815 912
 		$post = array('type' => 'arrival','searchFlightNo' => '1','requestsent' => 'true', 'flightno' => $numvol,'date' => $check_date->format('Y-m-d'),'carrier' => 'AB');
816 913
 		$data = $Common->getData($url,'post',$post);
817 914
 		if ($data != '') {
@@ -824,10 +921,14 @@  discard block
 block discarded – undo
824 921
 			    $arrivalTime = '';
825 922
 			    $arrivalAirport = '';
826 923
 			}
827
-		} else return array();
924
+		} else {
925
+			return array();
926
+		}
828 927
 		$url = 'http://www.airberlin.com/en-US/site/json/suggestAirport.php?searchfor=departures&searchflightid=0&departures%5B%5D=&suggestsource%5B0%5D=activeairports&withcountries=0&withoutroutings=0&promotion%5Bid%5D=&promotion%5Btype%5D=&routesource%5B0%5D=airberlin&routesource%5B1%5D=partner';
829 928
 		$json = $Common->getData($url);
830
-		if ($json == '') return array();
929
+		if ($json == '') {
930
+			return array();
931
+		}
831 932
 		$parsed_json = json_decode($json);
832 933
 		$airports = $parsed_json->{'suggestList'};
833 934
 		if (count($airports) > 0) {
@@ -842,7 +943,9 @@  discard block
 block discarded – undo
842 943
 		}
843 944
 		if (isset($DepartureAirportIata)) {
844 945
 			return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_airberlin');
845
-		} else return array();
946
+		} else {
947
+			return array();
948
+		}
846 949
 	}
847 950
 
848 951
 
@@ -850,7 +953,9 @@  discard block
 block discarded – undo
850 953
 	public function fetchSchedule($ident,$date = 'NOW') {
851 954
 		global $globalSchedulesSources, $globalSchedulesFetch;
852 955
 		//$Common = new Common();
853
-		if (!$globalSchedulesFetch) return array();
956
+		if (!$globalSchedulesFetch) {
957
+			return array();
958
+		}
854 959
 		$airline_icao = '';
855 960
 		if (!is_numeric(substr($ident, 0, 3)))
856 961
 		{
@@ -1078,14 +1183,21 @@  discard block
 block discarded – undo
1078 1183
 				default:
1079 1184
 					// Randomly use a generic function to get hours
1080 1185
 					if (strlen($airline_icao) == 2) {
1081
-						if (!isset($globalSchedulesSources)) $globalSchedulesSources = array('flightmapper','costtotravel','flightradar24','flightaware');
1186
+						if (!isset($globalSchedulesSources)) {
1187
+							$globalSchedulesSources = array('flightmapper','costtotravel','flightradar24','flightaware');
1188
+						}
1082 1189
 						if (count($globalSchedulesSources) > 0) {
1083 1190
 							$rand = mt_rand(0,count($globalSchedulesSources)-1);
1084 1191
 							$source = $globalSchedulesSources[$rand];
1085
-							if ($source == 'flightmapper') return $this->getFlightMapper($ident);
1086
-							elseif ($source == 'costtotravel') return $this->getCostToTravel($ident);
1192
+							if ($source == 'flightmapper') {
1193
+								return $this->getFlightMapper($ident);
1194
+							} elseif ($source == 'costtotravel') {
1195
+								return $this->getCostToTravel($ident);
1196
+							}
1087 1197
 							//elseif ($source == 'flightradar24') return $this->getFlightRadar24($ident,$date);
1088
-							elseif ($source == 'flightaware') return $this->getFlightAware($ident);
1198
+							elseif ($source == 'flightaware') {
1199
+								return $this->getFlightAware($ident);
1200
+							}
1089 1201
 						}
1090 1202
 					}
1091 1203
 			}
Please login to merge, or discard this patch.
index.php 3 patches
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
4 4
 require_once('require/class.Language.php');
5 5
 require_once('require/class.Satellite.php');
6 6
 
7
-$trackident = filter_input(INPUT_GET,'trackid',FILTER_SANITIZE_STRING);
7
+$trackident = filter_input(INPUT_GET, 'trackid', FILTER_SANITIZE_STRING);
8 8
 if ($trackident != '') {
9 9
 	require_once('require/class.SpotterLive.php');
10 10
 	$SpotterLive = new SpotterLive();
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 		$spotterid = $Spotter->getSpotterIDBasedOnFlightAwareID($trackident);
15 15
 		header('Location: '.$globalURL.'/flightid/'.$spotterid);
16 16
 	} else {
17
-		setcookie('MapTrack',$resulttrackident[0]['flightaware_id']);
17
+		setcookie('MapTrack', $resulttrackident[0]['flightaware_id']);
18 18
 	}
19 19
 } else {
20 20
 	unset($_COOKIE['MapTrack']);
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
 		        <div class="form-group">
195 195
 			    <label>From (UTC):</label>
196 196
 		            <div class='input-group date' id='datetimepicker1'>
197
-            			<input type='text' name="start_date" class="form-control" value="<?php if (isset($_POST['start_date'])) print $_POST['start_date']; elseif (isset($_COOKIE['archive_begin'])) print date("m/d/Y h:i a",$_COOKIE['archive_begin']); ?>" required />
197
+            			<input type='text' name="start_date" class="form-control" value="<?php if (isset($_POST['start_date'])) print $_POST['start_date']; elseif (isset($_COOKIE['archive_begin'])) print date("m/d/Y h:i a", $_COOKIE['archive_begin']); ?>" required />
198 198
 		                <span class="input-group-addon">
199 199
             			    <span class="glyphicon glyphicon-calendar"></span>
200 200
 		                </span>
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
 		        <div class="form-group">
204 204
 			    <label>To (UTC):</label>
205 205
 		            <div class='input-group date' id='datetimepicker2'>
206
-		                <input type='text' name="end_date" class="form-control" value="<?php if (isset($_POST['end_date'])) print $_POST['end_date']; elseif (isset($_COOKIE['archive_end'])) print date("m/d/Y h:i a",$_COOKIE['archive_end']); ?>" />
206
+		                <input type='text' name="end_date" class="form-control" value="<?php if (isset($_POST['end_date'])) print $_POST['end_date']; elseif (isset($_COOKIE['archive_end'])) print date("m/d/Y h:i a", $_COOKIE['archive_end']); ?>" />
207 207
             			<span class="input-group-addon">
208 208
 		                    <span class="glyphicon glyphicon-calendar"></span>
209 209
             			</span>
@@ -327,9 +327,9 @@  discard block
 block discarded – undo
327 327
 		    <li><?php echo _("Type of Terrain:"); ?>
328 328
 			<select  class="selectpicker" onchange="terrainType(this);">
329 329
 			    <option value="stk"<?php if (!isset($_COOKIE['MapTerrain']) || $_COOKIE['MapTerrain'] == 'stk') print ' selected'; ?>>stk terrain</option>
330
-			    <option value="ellipsoid"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'ellipsoid') print ' selected';?>>ellipsoid</option>
331
-			    <option value="vrterrain"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'vrterrain') print ' selected';?>>vr terrain</option>
332
-			    <option value="articdem"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'articdem') print ' selected';?>>ArticDEM</option>
330
+			    <option value="ellipsoid"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'ellipsoid') print ' selected'; ?>>ellipsoid</option>
331
+			    <option value="vrterrain"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'vrterrain') print ' selected'; ?>>vr terrain</option>
332
+			    <option value="articdem"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'articdem') print ' selected'; ?>>ArticDEM</option>
333 333
 			</select>
334 334
 		    </li>
335 335
 <?php
@@ -365,7 +365,7 @@  discard block
 block discarded – undo
365 365
 		    <li><div class="checkbox"><label><input type="checkbox" name="displayminimap" value="1" onclick="clickDisplayMinimap(this)" <?php if (!isset($_COOKIE['displayminimap']) || (isset($_COOKIE['displayminimap']) && $_COOKIE['displayminimap'] == 'true')) print 'checked'; ?> ><?php echo _("Show mini-map"); ?></label></div></li>
366 366
 <?php
367 367
     }
368
-    if (time() > mktime(0,0,0,12,1,date("Y")) && time() < mktime(0,0,0,12,31,date("Y"))) {
368
+    if (time() > mktime(0, 0, 0, 12, 1, date("Y")) && time() < mktime(0, 0, 0, 12, 31, date("Y"))) {
369 369
 ?>
370 370
 		    <li><div class="checkbox"><label><input type="checkbox" name="displaysanta" value="1" onclick="clickSanta(this)"><i class="fa fa-snowflake-o" aria-hidden="true"></i> <?php echo _("Show Santa Claus now"); ?> <i class="fa fa-snowflake-o" aria-hidden="true"></i></label></div></li>
371 371
 <?php
@@ -541,10 +541,10 @@  discard block
 block discarded – undo
541 541
 					$Spotter = new Spotter();
542 542
 					$allairlinenames = $Spotter->getAllAirlineNames();
543 543
 				}
544
-				foreach($allairlinenames as $airline) {
544
+				foreach ($allairlinenames as $airline) {
545 545
 					$airline_name = $airline['airline_name'];
546
-					if (strlen($airline_name) > 30) $airline_name = substr($airline_name,0,30).'...';
547
-					if (isset($_COOKIE['filter_Airlines']) && in_array($airline['airline_icao'],explode(',',$_COOKIE['filter_Airlines']))) {
546
+					if (strlen($airline_name) > 30) $airline_name = substr($airline_name, 0, 30).'...';
547
+					if (isset($_COOKIE['filter_Airlines']) && in_array($airline['airline_icao'], explode(',', $_COOKIE['filter_Airlines']))) {
548 548
 						echo '<option value="'.$airline['airline_icao'].'" selected>'.$airline_name.'</option>';
549 549
 					} else {
550 550
 						echo '<option value="'.$airline['airline_icao'].'">'.$airline_name.'</option>';
@@ -563,7 +563,7 @@  discard block
 block discarded – undo
563 563
 			<select class="selectpicker" onchange="alliance(this);" id="display_alliance">
564 564
 			    <option value="all"<?php if (!isset($_COOKIE['filter_alliance']) || $_COOKIE['filter_alliance'] == 'all' || $_COOKIE['filter_alliance'] == '') echo ' selected'; ?>><?php echo _("All"); ?></option>
565 565
 			    <?php
566
-				foreach($allalliancenames as $alliance) {
566
+				foreach ($allalliancenames as $alliance) {
567 567
 					$alliance_name = $alliance['alliance'];
568 568
 					if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] == $alliance_name) {
569 569
 						echo '<option value="'.$alliance_name.'" selected>'.$alliance_name.'</option>';
@@ -599,8 +599,8 @@  discard block
 block discarded – undo
599 599
 				*/
600 600
 				$Source = new Source();
601 601
 				$datasource = $Source->getLocationInfoByType('gs');
602
-				foreach($datasource as $src) {
603
-					if (isset($_COOKIE['filter_Sources']) && in_array($src['name'],explode(',',$_COOKIE['filter_Sources']))) {
602
+				foreach ($datasource as $src) {
603
+					if (isset($_COOKIE['filter_Sources']) && in_array($src['name'], explode(',', $_COOKIE['filter_Sources']))) {
604 604
 						echo '<option value="'.$src['name'].'" selected>'.$src['name'].'</option>';
605 605
 					} else {
606 606
 						echo '<option value="'.$src['name'].'">'.$src['name'].'</option>';
@@ -679,7 +679,7 @@  discard block
 block discarded – undo
679 679
 					else if ($type_name == 'radar') $type_name = 'Radar Calibration';
680 680
 					else if ($type_name == 'tle-new') $type_name = 'Last 30 days launches';
681 681
 					
682
-					if (isset($_COOKIE['sattypes']) && in_array($type['tle_type'],explode(',',$_COOKIE['sattypes']))) {
682
+					if (isset($_COOKIE['sattypes']) && in_array($type['tle_type'], explode(',', $_COOKIE['sattypes']))) {
683 683
 						print '<option value="'.$type['tle_type'].'" selected>'.$type_name.'</option>';
684 684
 					} else {
685 685
 						print '<option value="'.$type['tle_type'].'">'.$type_name.'</option>';
Please login to merge, or discard this patch.
Braces   +437 added lines, -110 removed lines patch added patch discarded remove patch
@@ -162,11 +162,26 @@  discard block
 block discarded – undo
162 162
 				<li><div class="checkbox"><label><input type="checkbox" name="notamcb" value="1" onclick="showNotam();" /><?php echo _("Display NOTAM"); ?></label></div></li>
163 163
 				<li><?php echo _("NOTAM scope:"); ?>
164 164
 					<select class="selectpicker" onchange="notamscope(this);">
165
-						<option<?php if (!isset($_COOKIE['notamscope']) || $_COOKIE['notamscope'] == 'All') print ' selected'; ?>>All</option>
166
-						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport/Enroute warning') print ' selected'; ?>>Airport/Enroute warning</option>
167
-						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport warning') print ' selected'; ?>>Airport warning</option>
168
-						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Navigation warning') print ' selected'; ?>>Navigation warning</option>
169
-						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Enroute warning') print ' selected'; ?>>Enroute warning</option>
165
+						<option<?php if (!isset($_COOKIE['notamscope']) || $_COOKIE['notamscope'] == 'All') {
166
+	print ' selected';
167
+}
168
+?>>All</option>
169
+						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport/Enroute warning') {
170
+	print ' selected';
171
+}
172
+?>>Airport/Enroute warning</option>
173
+						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport warning') {
174
+	print ' selected';
175
+}
176
+?>>Airport warning</option>
177
+						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Navigation warning') {
178
+	print ' selected';
179
+}
180
+?>>Navigation warning</option>
181
+						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Enroute warning') {
182
+	print ' selected';
183
+}
184
+?>>Enroute warning</option>
170 185
 					</select
171 186
 				</li>
172 187
 			</ul>
@@ -194,7 +209,12 @@  discard block
 block discarded – undo
194 209
 		        <div class="form-group">
195 210
 			    <label>From (UTC):</label>
196 211
 		            <div class='input-group date' id='datetimepicker1'>
197
-            			<input type='text' name="start_date" class="form-control" value="<?php if (isset($_POST['start_date'])) print $_POST['start_date']; elseif (isset($_COOKIE['archive_begin'])) print date("m/d/Y h:i a",$_COOKIE['archive_begin']); ?>" required />
212
+            			<input type='text' name="start_date" class="form-control" value="<?php if (isset($_POST['start_date'])) {
213
+	print $_POST['start_date'];
214
+} elseif (isset($_COOKIE['archive_begin'])) {
215
+	print date("m/d/Y h:i a",$_COOKIE['archive_begin']);
216
+}
217
+?>" required />
198 218
 		                <span class="input-group-addon">
199 219
             			    <span class="glyphicon glyphicon-calendar"></span>
200 220
 		                </span>
@@ -203,7 +223,12 @@  discard block
 block discarded – undo
203 223
 		        <div class="form-group">
204 224
 			    <label>To (UTC):</label>
205 225
 		            <div class='input-group date' id='datetimepicker2'>
206
-		                <input type='text' name="end_date" class="form-control" value="<?php if (isset($_POST['end_date'])) print $_POST['end_date']; elseif (isset($_COOKIE['archive_end'])) print date("m/d/Y h:i a",$_COOKIE['archive_end']); ?>" />
226
+		                <input type='text' name="end_date" class="form-control" value="<?php if (isset($_POST['end_date'])) {
227
+	print $_POST['end_date'];
228
+} elseif (isset($_COOKIE['archive_end'])) {
229
+	print date("m/d/Y h:i a",$_COOKIE['archive_end']);
230
+}
231
+?>" />
207 232
             			<span class="input-group-addon">
208 233
 		                    <span class="glyphicon glyphicon-calendar"></span>
209 234
             			</span>
@@ -228,8 +253,20 @@  discard block
 block discarded – undo
228 253
 			</script>
229 254
 		    <li><?php echo _("Playback speed:"); ?>
230 255
 			<div class="range">
231
-			    <input type="range" min="0" max="50" step="1" name="archivespeed" onChange="archivespeedrange.value=value;" value="<?php  if (isset($_POST['archivespeed'])) print $_POST['archivespeed']; elseif (isset($_COOKIE['archive_speed'])) print $_COOKIE['archive_speed']; else print '1'; ?>">
232
-			    <output id="archivespeedrange"><?php  if (isset($_COOKIE['archive_speed'])) print $_COOKIE['archive_speed']; else print '1'; ?></output>
256
+			    <input type="range" min="0" max="50" step="1" name="archivespeed" onChange="archivespeedrange.value=value;" value="<?php  if (isset($_POST['archivespeed'])) {
257
+	print $_POST['archivespeed'];
258
+} elseif (isset($_COOKIE['archive_speed'])) {
259
+	print $_COOKIE['archive_speed'];
260
+} else {
261
+	print '1';
262
+}
263
+?>">
264
+			    <output id="archivespeedrange"><?php  if (isset($_COOKIE['archive_speed'])) {
265
+	print $_COOKIE['archive_speed'];
266
+} else {
267
+	print '1';
268
+}
269
+?></output>
233 270
 			</div>
234 271
 		    </li>
235 272
 		    <li><input type="submit" name="archive" value="Show archive" class="btn btn-primary" /></li>
@@ -251,15 +288,27 @@  discard block
 block discarded – undo
251 288
 		    <li><?php echo _("Type of Map:"); ?>
252 289
 			<select  class="selectpicker" onchange="mapType(this);">
253 290
 			    <?php
254
-				if (!isset($_COOKIE['MapType']) || $_COOKIE['MapType'] == '') $MapType = $globalMapProvider;
255
-				else $MapType = $_COOKIE['MapType'];
291
+				if (!isset($_COOKIE['MapType']) || $_COOKIE['MapType'] == '') {
292
+					$MapType = $globalMapProvider;
293
+				} else {
294
+					$MapType = $_COOKIE['MapType'];
295
+				}
256 296
 			    ?>
257 297
 			    <?php
258 298
 				if (isset($globalBingMapKey) && $globalBingMapKey != '') {
259 299
 			    ?>
260
-			    <option value="Bing-Aerial"<?php if ($MapType == 'Bing-Aerial') print ' selected'; ?>>Bing-Aerial</option>
261
-			    <option value="Bing-Hybrid"<?php if ($MapType == 'Bing-Hybrid') print ' selected'; ?>>Bing-Hybrid</option>
262
-			    <option value="Bing-Road"<?php if ($MapType == 'Bing-Road') print ' selected'; ?>>Bing-Road</option>
300
+			    <option value="Bing-Aerial"<?php if ($MapType == 'Bing-Aerial') {
301
+	print ' selected';
302
+}
303
+?>>Bing-Aerial</option>
304
+			    <option value="Bing-Hybrid"<?php if ($MapType == 'Bing-Hybrid') {
305
+	print ' selected';
306
+}
307
+?>>Bing-Hybrid</option>
308
+			    <option value="Bing-Road"<?php if ($MapType == 'Bing-Road') {
309
+	print ' selected';
310
+}
311
+?>>Bing-Road</option>
263 312
 			    <?php
264 313
 				}
265 314
 			    ?>
@@ -269,56 +318,131 @@  discard block
 block discarded – undo
269 318
 			    <?php
270 319
 				    if (isset($globalHereappId) && $globalHereappId != '' && isset($globalHereappCode) && $globalHereappCode != '') {
271 320
 			    ?>
272
-			    <option value="Here-Aerial"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Aerial</option>
273
-			    <option value="Here-Hybrid"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Hybrid</option>
274
-			    <option value="Here-Road"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Road</option>
321
+			    <option value="Here-Aerial"<?php if ($MapType == 'Here') {
322
+	print ' selected';
323
+}
324
+?>>Here-Aerial</option>
325
+			    <option value="Here-Hybrid"<?php if ($MapType == 'Here') {
326
+	print ' selected';
327
+}
328
+?>>Here-Hybrid</option>
329
+			    <option value="Here-Road"<?php if ($MapType == 'Here') {
330
+	print ' selected';
331
+}
332
+?>>Here-Road</option>
275 333
 			    <?php
276 334
 				    }
277 335
 			    ?>
278 336
 			    <?php
279 337
 				    if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '') {
280 338
 			    ?>
281
-			    <option value="Google-Roadmap"<?php if ($MapType == 'Google-Roadmap') print ' selected'; ?>>Google Roadmap</option>
282
-			    <option value="Google-Satellite"<?php if ($MapType == 'Google-Satellite') print ' selected'; ?>>Google Satellite</option>
283
-			    <option value="Google-Hybrid"<?php if ($MapType == 'Google-Hybrid') print ' selected'; ?>>Google Hybrid</option>
284
-			    <option value="Google-Terrain"<?php if ($MapType == 'Google-Terrain') print ' selected'; ?>>Google Terrain</option>
339
+			    <option value="Google-Roadmap"<?php if ($MapType == 'Google-Roadmap') {
340
+	print ' selected';
341
+}
342
+?>>Google Roadmap</option>
343
+			    <option value="Google-Satellite"<?php if ($MapType == 'Google-Satellite') {
344
+	print ' selected';
345
+}
346
+?>>Google Satellite</option>
347
+			    <option value="Google-Hybrid"<?php if ($MapType == 'Google-Hybrid') {
348
+	print ' selected';
349
+}
350
+?>>Google Hybrid</option>
351
+			    <option value="Google-Terrain"<?php if ($MapType == 'Google-Terrain') {
352
+	print ' selected';
353
+}
354
+?>>Google Terrain</option>
285 355
 			    <?php
286 356
 				    }
287 357
 			    ?>
288 358
 			    <?php
289 359
 				    if (isset($globalMapQuestKey) && $globalMapQuestKey != '') {
290 360
 			    ?>
291
-			    <option value="MapQuest-OSM"<?php if ($MapType == 'MapQuest-OSM') print ' selected'; ?>>MapQuest-OSM</option>
292
-			    <option value="MapQuest-Aerial"<?php if ($MapType == 'MapQuest-Aerial') print ' selected'; ?>>MapQuest-Aerial</option>
293
-			    <option value="MapQuest-Hybrid"<?php if ($MapType == 'MapQuest-Hybrid') print ' selected'; ?>>MapQuest-Hybrid</option>
361
+			    <option value="MapQuest-OSM"<?php if ($MapType == 'MapQuest-OSM') {
362
+	print ' selected';
363
+}
364
+?>>MapQuest-OSM</option>
365
+			    <option value="MapQuest-Aerial"<?php if ($MapType == 'MapQuest-Aerial') {
366
+	print ' selected';
367
+}
368
+?>>MapQuest-Aerial</option>
369
+			    <option value="MapQuest-Hybrid"<?php if ($MapType == 'MapQuest-Hybrid') {
370
+	print ' selected';
371
+}
372
+?>>MapQuest-Hybrid</option>
294 373
 			    <?php
295 374
 				    }
296 375
 			    ?>
297
-			    <option value="Yandex"<?php if ($MapType == 'Yandex') print ' selected'; ?>>Yandex</option>
376
+			    <option value="Yandex"<?php if ($MapType == 'Yandex') {
377
+	print ' selected';
378
+}
379
+?>>Yandex</option>
298 380
 			    <?php
299 381
 				}
300 382
 			    ?>
301 383
 			    <?php
302 384
 				    if (isset($globalMapboxToken) && $globalMapboxToken != '') {
303
-					if (!isset($_COOKIE['MapTypeId'])) $MapBoxId = 'default';
304
-					else $MapBoxId = $_COOKIE['MapTypeId'];
385
+					if (!isset($_COOKIE['MapTypeId'])) {
386
+						$MapBoxId = 'default';
387
+					} else {
388
+						$MapBoxId = $_COOKIE['MapTypeId'];
389
+					}
305 390
 			    ?>
306
-			    <option value="Mapbox-default"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'default') print ' selected'; ?>>Mapbox default</option>
307
-			    <option value="Mapbox-mapbox.streets"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets') print ' selected'; ?>>Mapbox streets</option>
308
-			    <option value="Mapbox-mapbox.light"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.light') print ' selected'; ?>>Mapbox light</option>
309
-			    <option value="Mapbox-mapbox.dark"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.dark') print ' selected'; ?>>Mapbox dark</option>
310
-			    <option value="Mapbox-mapbox.satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.satellite') print ' selected'; ?>>Mapbox satellite</option>
311
-			    <option value="Mapbox-mapbox.streets-satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-satellite') print ' selected'; ?>>Mapbox streets-satellite</option>
312
-			    <option value="Mapbox-mapbox.streets-basic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-basic') print ' selected'; ?>>Mapbox streets-basic</option>
313
-			    <option value="Mapbox-mapbox.comic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.comic') print ' selected'; ?>>Mapbox comic</option>
314
-			    <option value="Mapbox-mapbox.outdoors"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.outdoors') print ' selected'; ?>>Mapbox outdoors</option>
315
-			    <option value="Mapbox-mapbox.pencil"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pencil') print ' selected'; ?>>Mapbox pencil</option>
316
-			    <option value="Mapbox-mapbox.pirates"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pirates') print ' selected'; ?>>Mapbox pirates</option>
317
-			    <option value="Mapbox-mapbox.emerald"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.emerald') print ' selected'; ?>>Mapbox emerald</option>
391
+			    <option value="Mapbox-default"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'default') {
392
+	print ' selected';
393
+}
394
+?>>Mapbox default</option>
395
+			    <option value="Mapbox-mapbox.streets"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets') {
396
+	print ' selected';
397
+}
398
+?>>Mapbox streets</option>
399
+			    <option value="Mapbox-mapbox.light"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.light') {
400
+	print ' selected';
401
+}
402
+?>>Mapbox light</option>
403
+			    <option value="Mapbox-mapbox.dark"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.dark') {
404
+	print ' selected';
405
+}
406
+?>>Mapbox dark</option>
407
+			    <option value="Mapbox-mapbox.satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.satellite') {
408
+	print ' selected';
409
+}
410
+?>>Mapbox satellite</option>
411
+			    <option value="Mapbox-mapbox.streets-satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-satellite') {
412
+	print ' selected';
413
+}
414
+?>>Mapbox streets-satellite</option>
415
+			    <option value="Mapbox-mapbox.streets-basic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-basic') {
416
+	print ' selected';
417
+}
418
+?>>Mapbox streets-basic</option>
419
+			    <option value="Mapbox-mapbox.comic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.comic') {
420
+	print ' selected';
421
+}
422
+?>>Mapbox comic</option>
423
+			    <option value="Mapbox-mapbox.outdoors"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.outdoors') {
424
+	print ' selected';
425
+}
426
+?>>Mapbox outdoors</option>
427
+			    <option value="Mapbox-mapbox.pencil"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pencil') {
428
+	print ' selected';
429
+}
430
+?>>Mapbox pencil</option>
431
+			    <option value="Mapbox-mapbox.pirates"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pirates') {
432
+	print ' selected';
433
+}
434
+?>>Mapbox pirates</option>
435
+			    <option value="Mapbox-mapbox.emerald"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.emerald') {
436
+	print ' selected';
437
+}
438
+?>>Mapbox emerald</option>
318 439
 			    <?php
319 440
 				    }
320 441
 			    ?>
321
-			    <option value="OpenStreetMap"<?php if ($MapType == 'OpenStreetMap') print ' selected'; ?>>OpenStreetMap</option>
442
+			    <option value="OpenStreetMap"<?php if ($MapType == 'OpenStreetMap') {
443
+	print ' selected';
444
+}
445
+?>>OpenStreetMap</option>
322 446
 			</select>
323 447
 		    </li>
324 448
 <?php
@@ -326,10 +450,22 @@  discard block
 block discarded – undo
326 450
 ?>
327 451
 		    <li><?php echo _("Type of Terrain:"); ?>
328 452
 			<select  class="selectpicker" onchange="terrainType(this);">
329
-			    <option value="stk"<?php if (!isset($_COOKIE['MapTerrain']) || $_COOKIE['MapTerrain'] == 'stk') print ' selected'; ?>>stk terrain</option>
330
-			    <option value="ellipsoid"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'ellipsoid') print ' selected';?>>ellipsoid</option>
331
-			    <option value="vrterrain"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'vrterrain') print ' selected';?>>vr terrain</option>
332
-			    <option value="articdem"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'articdem') print ' selected';?>>ArticDEM</option>
453
+			    <option value="stk"<?php if (!isset($_COOKIE['MapTerrain']) || $_COOKIE['MapTerrain'] == 'stk') {
454
+	print ' selected';
455
+}
456
+?>>stk terrain</option>
457
+			    <option value="ellipsoid"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'ellipsoid') {
458
+	print ' selected';
459
+}
460
+?>>ellipsoid</option>
461
+			    <option value="vrterrain"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'vrterrain') {
462
+	print ' selected';
463
+}
464
+?>>vr terrain</option>
465
+			    <option value="articdem"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'articdem') {
466
+	print ' selected';
467
+}
468
+?>>ArticDEM</option>
333 469
 			</select>
334 470
 		    </li>
335 471
 <?php
@@ -341,28 +477,61 @@  discard block
 block discarded – undo
341 477
 <?php
342 478
 	if (!isset($globalAircraft) || $globalAircraft === TRUE) {
343 479
 ?>
344
-		    <li><div class="checkbox"><label><input type="checkbox" name="flightpopup" value="1" onclick="clickFlightPopup(this)" <?php if (isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true') print 'checked'; ?> ><?php echo _("Display flight info as popup"); ?></label></div></li>
345
-		    <li><div class="checkbox"><label><input type="checkbox" name="flightpath" value="1" onclick="clickFlightPath(this)" <?php if ((isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true')) print 'checked'; ?> ><?php echo _("Display flight path"); ?></label></div></li>
346
-		    <li><div class="checkbox"><label><input type="checkbox" name="flightroute" value="1" onclick="clickFlightRoute(this)" <?php if ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == 'true') || (isset($globalMapRoute) && $globalMapRoute)) print 'checked'; ?> ><?php echo _("Display flight route on click"); ?></label></div></li>
347
-		    <li><div class="checkbox"><label><input type="checkbox" name="flightremainingroute" value="1" onclick="clickFlightRemainingRoute(this)" <?php if ((isset($_COOKIE['MapRemainingRoute']) && $_COOKIE['MapRemainingRoute'] == 'true') || !isset($_COOKIE['MapRemainingRoute']) || (isset($globalMapRemainingRoute) && $globalMapRemainingRoute)) print 'checked'; ?> ><?php echo _("Display flight remaining route on click"); ?></label></div></li>
348
-		    <li><div class="checkbox"><label><input type="checkbox" name="flightestimation" value="1" onclick="clickFlightEstimation(this)" <?php if ((isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'true') || (!isset($_COOKIE['flightestimation']) && !isset($globalMapEstimation)) || (!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation)) print 'checked'; ?> ><?php echo _("Planes animate between updates"); ?></label></div></li>
480
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightpopup" value="1" onclick="clickFlightPopup(this)" <?php if (isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true') {
481
+	print 'checked';
482
+}
483
+?> ><?php echo _("Display flight info as popup"); ?></label></div></li>
484
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightpath" value="1" onclick="clickFlightPath(this)" <?php if ((isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true')) {
485
+	print 'checked';
486
+}
487
+?> ><?php echo _("Display flight path"); ?></label></div></li>
488
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightroute" value="1" onclick="clickFlightRoute(this)" <?php if ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == 'true') || (isset($globalMapRoute) && $globalMapRoute)) {
489
+	print 'checked';
490
+}
491
+?> ><?php echo _("Display flight route on click"); ?></label></div></li>
492
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightremainingroute" value="1" onclick="clickFlightRemainingRoute(this)" <?php if ((isset($_COOKIE['MapRemainingRoute']) && $_COOKIE['MapRemainingRoute'] == 'true') || !isset($_COOKIE['MapRemainingRoute']) || (isset($globalMapRemainingRoute) && $globalMapRemainingRoute)) {
493
+	print 'checked';
494
+}
495
+?> ><?php echo _("Display flight remaining route on click"); ?></label></div></li>
496
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightestimation" value="1" onclick="clickFlightEstimation(this)" <?php if ((isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'true') || (!isset($_COOKIE['flightestimation']) && !isset($globalMapEstimation)) || (!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation)) {
497
+	print 'checked';
498
+}
499
+?> ><?php echo _("Planes animate between updates"); ?></label></div></li>
349 500
 <?php
350 501
 	}
351 502
 	if (isset($globalSatellite) && $globalSatellite === TRUE) {
352 503
 ?>
353
-		    <li><div class="checkbox"><label><input type="checkbox" name="satelliteestimation" value="1" onclick="clickSatelliteEstimation(this)" <?php if ((isset($_COOKIE['satelliteestimation']) && $_COOKIE['satelliteestimation'] == 'true') || (!isset($_COOKIE['satelliteestimation']) && !isset($globalMapEstimation)) || (!isset($_COOKIE['satelliteestimation']) && isset($globalMapEstimation) && $globalMapEstimation)) print 'checked'; ?> ><?php echo _("Satellites animate between updates"); ?></label></div></li>
504
+		    <li><div class="checkbox"><label><input type="checkbox" name="satelliteestimation" value="1" onclick="clickSatelliteEstimation(this)" <?php if ((isset($_COOKIE['satelliteestimation']) && $_COOKIE['satelliteestimation'] == 'true') || (!isset($_COOKIE['satelliteestimation']) && !isset($globalMapEstimation)) || (!isset($_COOKIE['satelliteestimation']) && isset($globalMapEstimation) && $globalMapEstimation)) {
505
+	print 'checked';
506
+}
507
+?> ><?php echo _("Satellites animate between updates"); ?></label></div></li>
354 508
 <?php
355 509
 	}
356 510
     }
357 511
 ?>
358
-		    <li><div class="checkbox"><label><input type="checkbox" name="displayairports" value="1" onclick="clickDisplayAirports(this)" <?php if (isset($_COOKIE['displayairports']) && $_COOKIE['displayairports'] == 'true' || !isset($_COOKIE['displayairports'])) print 'checked'; ?> ><?php echo _("Display airports on map"); ?></label></div></li>
359
-		    <li><div class="checkbox"><label><input type="checkbox" name="displaygroundstation" value="1" onclick="clickDisplayGroundStation(this)" <?php if ((isset($_COOKIE['show_GroundStation']) && $_COOKIE['show_GroundStation'] == 'true') || (!isset($_COOKIE['show_GroundStation']) && (!isset($globalMapGroundStation) || $globalMapGroundStation === TRUE))) print 'checked'; ?> ><?php echo _("Display ground station on map"); ?></label></div></li>
360
-		    <li><div class="checkbox"><label><input type="checkbox" name="displayweatherstation" value="1" onclick="clickDisplayWeatherStation(this)" <?php if ((isset($_COOKIE['show_WeatherStation']) && $_COOKIE['show_WeatherStation'] == 'true') || (!isset($_COOKIE['show_WeatherStation']) && (!isset($globalMapWeatherStation) || $globalMapWeatherStation === TRUE))) print 'checked'; ?> ><?php echo _("Display weather station on map"); ?></label></div></li>
361
-		    <li><div class="checkbox"><label><input type="checkbox" name="displaylightning" value="1" onclick="clickDisplayLightning(this)" <?php if ((isset($_COOKIE['show_Lightning']) && $_COOKIE['show_Lightning'] == 'true') || (!isset($_COOKIE['show_Lightning']) && (!isset($globalMapLightning) || $globalMapLightning === TRUE))) print 'checked'; ?> ><?php echo _("Display lightning on map"); ?></label></div></li>
512
+		    <li><div class="checkbox"><label><input type="checkbox" name="displayairports" value="1" onclick="clickDisplayAirports(this)" <?php if (isset($_COOKIE['displayairports']) && $_COOKIE['displayairports'] == 'true' || !isset($_COOKIE['displayairports'])) {
513
+	print 'checked';
514
+}
515
+?> ><?php echo _("Display airports on map"); ?></label></div></li>
516
+		    <li><div class="checkbox"><label><input type="checkbox" name="displaygroundstation" value="1" onclick="clickDisplayGroundStation(this)" <?php if ((isset($_COOKIE['show_GroundStation']) && $_COOKIE['show_GroundStation'] == 'true') || (!isset($_COOKIE['show_GroundStation']) && (!isset($globalMapGroundStation) || $globalMapGroundStation === TRUE))) {
517
+	print 'checked';
518
+}
519
+?> ><?php echo _("Display ground station on map"); ?></label></div></li>
520
+		    <li><div class="checkbox"><label><input type="checkbox" name="displayweatherstation" value="1" onclick="clickDisplayWeatherStation(this)" <?php if ((isset($_COOKIE['show_WeatherStation']) && $_COOKIE['show_WeatherStation'] == 'true') || (!isset($_COOKIE['show_WeatherStation']) && (!isset($globalMapWeatherStation) || $globalMapWeatherStation === TRUE))) {
521
+	print 'checked';
522
+}
523
+?> ><?php echo _("Display weather station on map"); ?></label></div></li>
524
+		    <li><div class="checkbox"><label><input type="checkbox" name="displaylightning" value="1" onclick="clickDisplayLightning(this)" <?php if ((isset($_COOKIE['show_Lightning']) && $_COOKIE['show_Lightning'] == 'true') || (!isset($_COOKIE['show_Lightning']) && (!isset($globalMapLightning) || $globalMapLightning === TRUE))) {
525
+	print 'checked';
526
+}
527
+?> ><?php echo _("Display lightning on map"); ?></label></div></li>
362 528
 <?php
363 529
     if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
364 530
 ?>
365
-		    <li><div class="checkbox"><label><input type="checkbox" name="displayminimap" value="1" onclick="clickDisplayMinimap(this)" <?php if (!isset($_COOKIE['displayminimap']) || (isset($_COOKIE['displayminimap']) && $_COOKIE['displayminimap'] == 'true')) print 'checked'; ?> ><?php echo _("Show mini-map"); ?></label></div></li>
531
+		    <li><div class="checkbox"><label><input type="checkbox" name="displayminimap" value="1" onclick="clickDisplayMinimap(this)" <?php if (!isset($_COOKIE['displayminimap']) || (isset($_COOKIE['displayminimap']) && $_COOKIE['displayminimap'] == 'true')) {
532
+	print 'checked';
533
+}
534
+?> ><?php echo _("Show mini-map"); ?></label></div></li>
366 535
 <?php
367 536
     }
368 537
     if (time() > mktime(0,0,0,12,1,date("Y")) && time() < mktime(0,0,0,12,31,date("Y"))) {
@@ -375,17 +544,25 @@  discard block
 block discarded – undo
375 544
 			if (function_exists('array_column')) {
376 545
 			    if (array_search(TRUE, array_column($globalSources, 'sourcestats')) !== FALSE) {
377 546
 		    ?>
378
-		    <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) print 'checked'; ?> ><?php echo _("Display polar on map"); ?></label></div></li>
547
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) {
548
+	print 'checked';
549
+}
550
+?> ><?php echo _("Display polar on map"); ?></label></div></li>
379 551
 		    <?php
380 552
 			    }
381 553
 			} elseif (isset($globalSources)) {
382 554
 			    $dispolar = false;
383 555
 			    foreach ($globalSources as $testsource) {
384
-			        if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) $dispolar = true;
556
+			        if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) {
557
+			        	$dispolar = true;
558
+			        }
385 559
 			    }
386 560
 			    if ($dispolar) {
387 561
 		    ?>
388
-		    <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) print 'checked'; ?> ><?php echo _("Display polar on map"); ?></label></div></li>
562
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) {
563
+	print 'checked';
564
+}
565
+?> ><?php echo _("Display polar on map"); ?></label></div></li>
389 566
 		    <?php
390 567
 			    }
391 568
 		        }
@@ -398,12 +575,22 @@  discard block
 block discarded – undo
398 575
 			if (!isset($globalAircraft) || $globalAircraft === TRUE) {
399 576
 		    	    if (extension_loaded('gd') && function_exists('gd_info')) {
400 577
 		    ?>
401
-		    <li><input type="checkbox" name="aircraftcoloraltitude" value="1" onclick="iconColorAltitude(this)" <?php if (isset($_COOKIE['IconColorAltitude']) && $_COOKIE['IconColorAltitude'] == 'true') print 'checked'; ?> ><?php echo _("Aircraft icon color based on altitude"); ?></li>
578
+		    <li><input type="checkbox" name="aircraftcoloraltitude" value="1" onclick="iconColorAltitude(this)" <?php if (isset($_COOKIE['IconColorAltitude']) && $_COOKIE['IconColorAltitude'] == 'true') {
579
+	print 'checked';
580
+}
581
+?> ><?php echo _("Aircraft icon color based on altitude"); ?></li>
402 582
 		    <?php 
403 583
 				if (!isset($_COOKIE['IconColorAltitude']) || $_COOKIE['IconColorAltitude'] == 'false') {
404 584
 		    ?>
405 585
 		    <li><?php echo _("Aircraft icon color:"); ?>
406
-			<input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(aircraftcolor.value);" value="#<?php if (isset($_COOKIE['IconColor'])) print $_COOKIE['IconColor']; elseif (isset($globalAircraftIconColor)) print $globalAircraftIconColor; else print '1a3151'; ?>">
586
+			<input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(aircraftcolor.value);" value="#<?php if (isset($_COOKIE['IconColor'])) {
587
+	print $_COOKIE['IconColor'];
588
+} elseif (isset($globalAircraftIconColor)) {
589
+	print $globalAircraftIconColor;
590
+} else {
591
+	print '1a3151';
592
+}
593
+?>">
407 594
 		    </li>
408 595
 		    <?php
409 596
 				}
@@ -415,7 +602,14 @@  discard block
 block discarded – undo
415 602
 			    if (extension_loaded('gd') && function_exists('gd_info')) {
416 603
 		    ?>
417 604
 		    <li><?php echo _("Marine icon color:"); ?>
418
-			<input type="color" name="marinecolor" id="html5colorpicker" onchange="MarineiconColor(marinecolor.value);" value="#<?php if (isset($_COOKIE['MarineIconColor'])) print $_COOKIE['MarineIconColor']; elseif (isset($globalMarineIconColor)) print $globalMarineIconColor; else print '1a3151'; ?>">
605
+			<input type="color" name="marinecolor" id="html5colorpicker" onchange="MarineiconColor(marinecolor.value);" value="#<?php if (isset($_COOKIE['MarineIconColor'])) {
606
+	print $_COOKIE['MarineIconColor'];
607
+} elseif (isset($globalMarineIconColor)) {
608
+	print $globalMarineIconColor;
609
+} else {
610
+	print '1a3151';
611
+}
612
+?>">
419 613
 		    </li>
420 614
 		    <?php
421 615
 			    }
@@ -426,7 +620,14 @@  discard block
 block discarded – undo
426 620
 			    if (extension_loaded('gd') && function_exists('gd_info')) {
427 621
 		    ?>
428 622
 		    <li><?php echo _("Tracker icon color:"); ?>
429
-			<input type="color" name="trackercolor" id="html5colorpicker" onchange="TrackericonColor(trackercolor.value);" value="#<?php if (isset($_COOKIE['TrackerIconColor'])) print $_COOKIE['TrackerIconColor']; elseif (isset($globalTrackerIconColor)) print $globalTrackerIconColor; else print '1a3151'; ?>">
623
+			<input type="color" name="trackercolor" id="html5colorpicker" onchange="TrackericonColor(trackercolor.value);" value="#<?php if (isset($_COOKIE['TrackerIconColor'])) {
624
+	print $_COOKIE['TrackerIconColor'];
625
+} elseif (isset($globalTrackerIconColor)) {
626
+	print $globalTrackerIconColor;
627
+} else {
628
+	print '1a3151';
629
+}
630
+?>">
430 631
 		    </li>
431 632
 		    <?php
432 633
 			    }
@@ -437,8 +638,22 @@  discard block
 block discarded – undo
437 638
 		    ?>
438 639
 		    <li><?php echo _("Show airport icon at zoom level:"); ?>
439 640
 			<div class="range">
440
-			    <input type="range" min="0" max="19" step="1" name="airportzoom" onchange="range.value=value;airportDisplayZoom(airportzoom.value);" value="<?php if (isset($_COOKIE['AirportZoom'])) print $_COOKIE['AirportZoom']; elseif (isset($globalAirportZoom)) print $globalAirportZoom; else print '7'; ?>">
441
-			    <output id="range"><?php if (isset($_COOKIE['AirportZoom'])) print $_COOKIE['AirportZoom']; elseif (isset($globalAirportZoom)) print $globalAirportZoom; else print '7'; ?></output>
641
+			    <input type="range" min="0" max="19" step="1" name="airportzoom" onchange="range.value=value;airportDisplayZoom(airportzoom.value);" value="<?php if (isset($_COOKIE['AirportZoom'])) {
642
+	print $_COOKIE['AirportZoom'];
643
+} elseif (isset($globalAirportZoom)) {
644
+	print $globalAirportZoom;
645
+} else {
646
+	print '7';
647
+}
648
+?>">
649
+			    <output id="range"><?php if (isset($_COOKIE['AirportZoom'])) {
650
+	print $_COOKIE['AirportZoom'];
651
+} elseif (isset($globalAirportZoom)) {
652
+	print $globalAirportZoom;
653
+} else {
654
+	print '7';
655
+}
656
+?></output>
442 657
 			</div>
443 658
 		    </li>
444 659
 		    <?php
@@ -450,9 +665,19 @@  discard block
 block discarded – undo
450 665
 <?php
451 666
 	if (!isset($globalAircraft) || $globalAircraft === TRUE) {
452 667
 ?>
453
-		    <li><input type="checkbox" name="aircraftcolorforce" value="1" onclick="iconColorForce(this)" <?php if (isset($_COOKIE['IconColorForce']) && $_COOKIE['IconColorForce'] == 'true') print 'checked'; ?> ><?php echo _("Force Aircraft color"); ?></li>
668
+		    <li><input type="checkbox" name="aircraftcolorforce" value="1" onclick="iconColorForce(this)" <?php if (isset($_COOKIE['IconColorForce']) && $_COOKIE['IconColorForce'] == 'true') {
669
+	print 'checked';
670
+}
671
+?> ><?php echo _("Force Aircraft color"); ?></li>
454 672
 		    <li><?php echo _("Aircraft icon color:"); ?>
455
-			<input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(aircraftcolor.value);" value="#<?php if (isset($_COOKIE['IconColor'])) print $_COOKIE['IconColor']; elseif (isset($globalAircraftIconColor)) print $globalAircraftIconColor; else print 'ff0000'; ?>">
673
+			<input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(aircraftcolor.value);" value="#<?php if (isset($_COOKIE['IconColor'])) {
674
+	print $_COOKIE['IconColor'];
675
+} elseif (isset($globalAircraftIconColor)) {
676
+	print $globalAircraftIconColor;
677
+} else {
678
+	print 'ff0000';
679
+}
680
+?>">
456 681
 		    </li>
457 682
 <?php
458 683
 	}
@@ -460,9 +685,19 @@  discard block
 block discarded – undo
460 685
 <?php
461 686
 	if (isset($globalMarine) && $globalMarine === TRUE) {
462 687
 ?>
463
-		    <li><input type="checkbox" name="marinecolorforce" value="1" onclick="MarineiconColorForce(this)" <?php if (isset($_COOKIE['MarineIconColorForce']) && $_COOKIE['MarineIconColorForce'] == 'true') print 'checked'; ?> ><?php echo _("Force Marine color"); ?></li>
688
+		    <li><input type="checkbox" name="marinecolorforce" value="1" onclick="MarineiconColorForce(this)" <?php if (isset($_COOKIE['MarineIconColorForce']) && $_COOKIE['MarineIconColorForce'] == 'true') {
689
+	print 'checked';
690
+}
691
+?> ><?php echo _("Force Marine color"); ?></li>
464 692
 		    <li><?php echo _("Marine icon color:"); ?>
465
-			<input type="color" name="marinecolor" id="html5colorpicker" onchange="MarineiconColor(marinecolor.value);" value="#<?php if (isset($_COOKIE['MarineIconColor'])) print $_COOKIE['MarineIconColor']; elseif (isset($globalMarineIconColor)) print $globalMarineIconColor; else print 'ff0000'; ?>">
693
+			<input type="color" name="marinecolor" id="html5colorpicker" onchange="MarineiconColor(marinecolor.value);" value="#<?php if (isset($_COOKIE['MarineIconColor'])) {
694
+	print $_COOKIE['MarineIconColor'];
695
+} elseif (isset($globalMarineIconColor)) {
696
+	print $globalMarineIconColor;
697
+} else {
698
+	print 'ff0000';
699
+}
700
+?>">
466 701
 		    </li>
467 702
 <?php
468 703
 	}
@@ -470,9 +705,19 @@  discard block
 block discarded – undo
470 705
 <?php
471 706
 	if (isset($globalTracker) && $globalTracker === TRUE) {
472 707
 ?>
473
-		    <li><input type="checkbox" name="trackercolorforce" value="1" onclick="TrackericonColorForce(this)" <?php if (isset($_COOKIE['TrackerIconColorForce']) && $_COOKIE['TrackerIconColorForce'] == 'true') print 'checked'; ?> ><?php echo _("Force Tracker color"); ?></li>
708
+		    <li><input type="checkbox" name="trackercolorforce" value="1" onclick="TrackericonColorForce(this)" <?php if (isset($_COOKIE['TrackerIconColorForce']) && $_COOKIE['TrackerIconColorForce'] == 'true') {
709
+	print 'checked';
710
+}
711
+?> ><?php echo _("Force Tracker color"); ?></li>
474 712
 		    <li><?php echo _("Tracker icon color:"); ?>
475
-			<input type="color" name="trackercolor" id="html5colorpicker" onchange="TrackericonColor(trackercolor.value);" value="#<?php if (isset($_COOKIE['TrackerIconColor'])) print $_COOKIE['TrackerIconColor']; elseif (isset($globalTrackerIconColor)) print $globalTrackerIconColor; else print 'ff0000'; ?>">
713
+			<input type="color" name="trackercolor" id="html5colorpicker" onchange="TrackericonColor(trackercolor.value);" value="#<?php if (isset($_COOKIE['TrackerIconColor'])) {
714
+	print $_COOKIE['TrackerIconColor'];
715
+} elseif (isset($globalTrackerIconColor)) {
716
+	print $globalTrackerIconColor;
717
+} else {
718
+	print 'ff0000';
719
+}
720
+?>">
476 721
 		    </li>
477 722
 <?php
478 723
 	}
@@ -480,22 +725,46 @@  discard block
 block discarded – undo
480 725
 ?>
481 726
 		    <li><?php echo _("Distance unit:"); ?>
482 727
 			<select class="selectpicker" onchange="unitdistance(this);">
483
-			    <option value="km"<?php if ((!isset($_COOKIE['unitdistance']) && (!isset($globalUnitDistance) || (isset($globalUnitDistance) && $globalUnitDistance == 'km'))) || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'km')) echo ' selected'; ?>>km</option>
484
-			    <option value="nm"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) echo ' selected'; ?>>nm</option>
485
-			    <option value="mi"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) echo ' selected'; ?>>mi</option>
728
+			    <option value="km"<?php if ((!isset($_COOKIE['unitdistance']) && (!isset($globalUnitDistance) || (isset($globalUnitDistance) && $globalUnitDistance == 'km'))) || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'km')) {
729
+	echo ' selected';
730
+}
731
+?>>km</option>
732
+			    <option value="nm"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) {
733
+	echo ' selected';
734
+}
735
+?>>nm</option>
736
+			    <option value="mi"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) {
737
+	echo ' selected';
738
+}
739
+?>>mi</option>
486 740
 		        </select>
487 741
 		    </li>
488 742
 		    <li><?php echo _("Altitude unit:"); ?>
489 743
 			<select class="selectpicker" onchange="unitaltitude(this);">
490
-			    <option value="m"<?php if ((!isset($_COOKIE['unitaltitude']) && (!isset($globalUnitAltitude) || (isset($globalUnitAltitude) && $globalUnitAltitude == 'm'))) || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'm')) echo ' selected'; ?>>m</option>
491
-			    <option value="feet"<?php if ((!isset($_COOKIE['unitaltitude']) && isset($globalUnitAltitude) && $globalUnitAltitude == 'feet') || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'feet')) echo ' selected'; ?>>feet</option>
744
+			    <option value="m"<?php if ((!isset($_COOKIE['unitaltitude']) && (!isset($globalUnitAltitude) || (isset($globalUnitAltitude) && $globalUnitAltitude == 'm'))) || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'm')) {
745
+	echo ' selected';
746
+}
747
+?>>m</option>
748
+			    <option value="feet"<?php if ((!isset($_COOKIE['unitaltitude']) && isset($globalUnitAltitude) && $globalUnitAltitude == 'feet') || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'feet')) {
749
+	echo ' selected';
750
+}
751
+?>>feet</option>
492 752
 		        </select>
493 753
 		    </li>
494 754
 		    <li><?php echo _("Speed unit:"); ?>
495 755
 			<select class="selectpicker" onchange="unitspeed(this);">
496
-			    <option value="kmh"<?php if ((!isset($_COOKIE['unitspeed']) && (!isset($globalUnitSpeed) || (isset($globalUnitSpeed) && $globalUnitSpeed == 'kmh'))) || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'kmh')) echo ' selected'; ?>>km/h</option>
497
-			    <option value="mph"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'mph') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'mph')) echo ' selected'; ?>>mph</option>
498
-			    <option value="knots"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'knots') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'knots')) echo ' selected'; ?>>knots</option>
756
+			    <option value="kmh"<?php if ((!isset($_COOKIE['unitspeed']) && (!isset($globalUnitSpeed) || (isset($globalUnitSpeed) && $globalUnitSpeed == 'kmh'))) || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'kmh')) {
757
+	echo ' selected';
758
+}
759
+?>>km/h</option>
760
+			    <option value="mph"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'mph') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'mph')) {
761
+	echo ' selected';
762
+}
763
+?>>mph</option>
764
+			    <option value="knots"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'knots') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'knots')) {
765
+	echo ' selected';
766
+}
767
+?>>knots</option>
499 768
 		        </select>
500 769
 		    </li>
501 770
 
@@ -513,9 +782,18 @@  discard block
 block discarded – undo
513 782
 		    <?php
514 783
 			if (((isset($globalVATSIM) && $globalVATSIM) || isset($globalIVAO) && $globalIVAO || isset($globalphpVMS) && $globalphpVMS) && (!isset($globalMapVAchoose) || $globalMapVAchoose)) {
515 784
 		    ?>
516
-			<?php if (isset($globalVATSIM) && $globalVATSIM) { ?><li><input type="checkbox" name="vatsim" value="1" onclick="clickVATSIM(this)" <?php if ((isset($_COOKIE['ShowVATSIM']) && $_COOKIE['ShowVATSIM'] == 'true') || !isset($_COOKIE['ShowVATSIM'])) print 'checked'; ?> ><?php echo _("Display VATSIM data"); ?></li><?php } ?>
517
-			<?php if (isset($globalIVAO) && $globalIVAO) { ?><li><input type="checkbox" name="ivao" value="1" onclick="clickIVAO(this)" <?php if ((isset($_COOKIE['ShowIVAO']) && $_COOKIE['ShowIVAO'] == 'true') || !isset($_COOKIE['ShowIVAO'])) print 'checked'; ?> ><?php echo _("Display IVAO data"); ?></li><?php } ?>
518
-			<?php if (isset($globalphpVMS) && $globalphpVMS) { ?><li><input type="checkbox" name="phpvms" value="1" onclick="clickphpVMS(this)" <?php if ((isset($_COOKIE['ShowVMS']) && $_COOKIE['ShowVMS'] == 'true') || !isset($_COOKIE['ShowVMS'])) print 'checked'; ?> ><?php echo _("Display phpVMS data"); ?></li><?php } ?>
785
+			<?php if (isset($globalVATSIM) && $globalVATSIM) { ?><li><input type="checkbox" name="vatsim" value="1" onclick="clickVATSIM(this)" <?php if ((isset($_COOKIE['ShowVATSIM']) && $_COOKIE['ShowVATSIM'] == 'true') || !isset($_COOKIE['ShowVATSIM'])) {
786
+	print 'checked';
787
+}
788
+?> ><?php echo _("Display VATSIM data"); ?></li><?php } ?>
789
+			<?php if (isset($globalIVAO) && $globalIVAO) { ?><li><input type="checkbox" name="ivao" value="1" onclick="clickIVAO(this)" <?php if ((isset($_COOKIE['ShowIVAO']) && $_COOKIE['ShowIVAO'] == 'true') || !isset($_COOKIE['ShowIVAO'])) {
790
+	print 'checked';
791
+}
792
+?> ><?php echo _("Display IVAO data"); ?></li><?php } ?>
793
+			<?php if (isset($globalphpVMS) && $globalphpVMS) { ?><li><input type="checkbox" name="phpvms" value="1" onclick="clickphpVMS(this)" <?php if ((isset($_COOKIE['ShowVMS']) && $_COOKIE['ShowVMS'] == 'true') || !isset($_COOKIE['ShowVMS'])) {
794
+	print 'checked';
795
+}
796
+?> ><?php echo _("Display phpVMS data"); ?></li><?php } ?>
519 797
 		    <?php
520 798
 			}
521 799
 		    ?>
@@ -523,10 +801,16 @@  discard block
 block discarded – undo
523 801
 			if (!(isset($globalVA) && $globalVA) && !(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalphpVMS) && $globalphpVMS) && isset($globalSBS1) && $globalSBS1 && isset($globalAPRS) && $globalAPRS && (!isset($globalMapchoose) || $globalMapchoose)) {
524 802
 		    ?>
525 803
 			<?php if (isset($globalSBS1) && $globalSBS1) { ?>
526
-			    <li><div class="checkbox"><label><input type="checkbox" name="sbs" value="1" onclick="clickSBS1(this)" <?php if ((isset($_COOKIE['ShowSBS1']) && $_COOKIE['ShowSBS1'] == 'true') || !isset($_COOKIE['ShowSBS1'])) print 'checked'; ?> ><?php echo _("Display ADS-B data"); ?></label></div></li>
804
+			    <li><div class="checkbox"><label><input type="checkbox" name="sbs" value="1" onclick="clickSBS1(this)" <?php if ((isset($_COOKIE['ShowSBS1']) && $_COOKIE['ShowSBS1'] == 'true') || !isset($_COOKIE['ShowSBS1'])) {
805
+	print 'checked';
806
+}
807
+?> ><?php echo _("Display ADS-B data"); ?></label></div></li>
527 808
 			<?php } ?>
528 809
 			<?php if (isset($globalAPRS) && $globalAPRS) { ?>
529
-			    <li><div class="checkbox"><label><input type="checkbox" name="aprs" value="1" onclick="clickAPRS(this)" <?php if ((isset($_COOKIE['ShowAPRS']) && $_COOKIE['ShowAPRS'] == 'true') || !isset($_COOKIE['ShowAPRS'])) print 'checked'; ?> ><?php echo _("Display APRS data"); ?></label></div></li>
810
+			    <li><div class="checkbox"><label><input type="checkbox" name="aprs" value="1" onclick="clickAPRS(this)" <?php if ((isset($_COOKIE['ShowAPRS']) && $_COOKIE['ShowAPRS'] == 'true') || !isset($_COOKIE['ShowAPRS'])) {
811
+	print 'checked';
812
+}
813
+?> ><?php echo _("Display APRS data"); ?></label></div></li>
530 814
 			<?php } ?>
531 815
 		    <?php
532 816
 			}
@@ -543,7 +827,9 @@  discard block
 block discarded – undo
543 827
 				}
544 828
 				foreach($allairlinenames as $airline) {
545 829
 					$airline_name = $airline['airline_name'];
546
-					if (strlen($airline_name) > 30) $airline_name = substr($airline_name,0,30).'...';
830
+					if (strlen($airline_name) > 30) {
831
+						$airline_name = substr($airline_name,0,30).'...';
832
+					}
547 833
 					if (isset($_COOKIE['filter_Airlines']) && in_array($airline['airline_icao'],explode(',',$_COOKIE['filter_Airlines']))) {
548 834
 						echo '<option value="'.$airline['airline_icao'].'" selected>'.$airline_name.'</option>';
549 835
 					} else {
@@ -561,7 +847,10 @@  discard block
 block discarded – undo
561 847
 		    <li><?php echo _("Display alliance:"); ?>
562 848
 		    <br/>
563 849
 			<select class="selectpicker" onchange="alliance(this);" id="display_alliance">
564
-			    <option value="all"<?php if (!isset($_COOKIE['filter_alliance']) || $_COOKIE['filter_alliance'] == 'all' || $_COOKIE['filter_alliance'] == '') echo ' selected'; ?>><?php echo _("All"); ?></option>
850
+			    <option value="all"<?php if (!isset($_COOKIE['filter_alliance']) || $_COOKIE['filter_alliance'] == 'all' || $_COOKIE['filter_alliance'] == '') {
851
+	echo ' selected';
852
+}
853
+?>><?php echo _("All"); ?></option>
565 854
 			    <?php
566 855
 				foreach($allalliancenames as $alliance) {
567 856
 					$alliance_name = $alliance['alliance'];
@@ -621,10 +910,22 @@  discard block
 block discarded – undo
621 910
 		    ?>
622 911
 		    <li><?php echo _("Display airlines of type:"); ?><br/>
623 912
 			<select class="selectpicker" onchange="airlinestype(this);">
624
-			    <option value="all"<?php if (!isset($_COOKIE['filter_airlinestype']) || $_COOKIE['filter_airlinestype'] == 'all' || $_COOKIE['filter_airlinestype'] == '') echo ' selected'; ?>><?php echo _("All"); ?></option>
625
-			    <option value="passenger"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'passenger') echo ' selected'; ?>><?php echo _("Passenger"); ?></option>
626
-			    <option value="cargo"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'cargo') echo ' selected'; ?>><?php echo _("Cargo"); ?></option>
627
-			    <option value="military"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'military') echo ' selected'; ?>><?php echo _("Military"); ?></option>
913
+			    <option value="all"<?php if (!isset($_COOKIE['filter_airlinestype']) || $_COOKIE['filter_airlinestype'] == 'all' || $_COOKIE['filter_airlinestype'] == '') {
914
+	echo ' selected';
915
+}
916
+?>><?php echo _("All"); ?></option>
917
+			    <option value="passenger"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'passenger') {
918
+	echo ' selected';
919
+}
920
+?>><?php echo _("Passenger"); ?></option>
921
+			    <option value="cargo"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'cargo') {
922
+	echo ' selected';
923
+}
924
+?>><?php echo _("Cargo"); ?></option>
925
+			    <option value="military"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'military') {
926
+	echo ' selected';
927
+}
928
+?>><?php echo _("Military"); ?></option>
628 929
 			</select>
629 930
 		    </li>
630 931
 		    <?php
@@ -632,7 +933,10 @@  discard block
 block discarded – undo
632 933
 		    ?>
633 934
 		    <li>
634 935
 			<?php echo _("Display flight with ident:"); ?>
635
-			<input type="text" name="identfilter" onchange="identfilter();" id="identfilter" value="<?php if (isset($_COOKIE['filter_ident'])) print $_COOKIE['filter_ident']; ?>" />
936
+			<input type="text" name="identfilter" onchange="identfilter();" id="identfilter" value="<?php if (isset($_COOKIE['filter_ident'])) {
937
+	print $_COOKIE['filter_ident'];
938
+}
939
+?>" />
636 940
 		    </li>
637 941
 		    <?php
638 942
 			}
@@ -651,7 +955,10 @@  discard block
 block discarded – undo
651 955
 	    <h1 class="sidebar-header"><?php echo _("Satellites"); ?><span class="sidebar-close"><i class="fa fa-caret-left"></i></span></h1>
652 956
 	    <form>
653 957
 		<ul>
654
-		    <li><div class="checkbox"><label><input type="checkbox" name="displayiss" value="1" onclick="clickDisplayISS(this)" <?php if ((isset($_COOKIE['displayiss']) && $_COOKIE['displayiss'] == 'true') || !isset($_COOKIE['displayiss'])) print 'checked'; ?> ><?php echo _("Show ISS, Tiangong-1 and Tiangong-2 on map"); ?></label></div></li>
958
+		    <li><div class="checkbox"><label><input type="checkbox" name="displayiss" value="1" onclick="clickDisplayISS(this)" <?php if ((isset($_COOKIE['displayiss']) && $_COOKIE['displayiss'] == 'true') || !isset($_COOKIE['displayiss'])) {
959
+	print 'checked';
960
+}
961
+?> ><?php echo _("Show ISS, Tiangong-1 and Tiangong-2 on map"); ?></label></div></li>
655 962
 		    <li><?php echo _("Type:"); ?>
656 963
 			<select class="selectpicker" multiple onchange="sattypes(this);">
657 964
 			    <?php
@@ -659,25 +966,45 @@  discard block
 block discarded – undo
659 966
 				$types = $Satellite->get_tle_types();
660 967
 				foreach ($types as $type) {
661 968
 					$type_name = $type['tle_type'];
662
-					if ($type_name == 'musson') $type_name = 'Russian LEO Navigation';
663
-					else if ($type_name == 'nnss') $type_name = 'Navi Navigation Satellite System';
664
-					else if ($type_name == 'sbas') $type_name = 'Satellite-Based Augmentation System';
665
-					else if ($type_name == 'glo-ops') $type_name = 'Glonass Operational';
666
-					else if ($type_name == 'gps-ops') $type_name = 'GPS Operational';
667
-					else if ($type_name == 'argos') $type_name = 'ARGOS Data Collection System';
668
-					else if ($type_name == 'tdrss') $type_name = 'Tracking and Data Relay Satellite System';
669
-					else if ($type_name == 'sarsat') $type_name = 'Search & Rescue';
670
-					else if ($type_name == 'dmc') $type_name = 'Disaster Monitoring';
671
-					else if ($type_name == 'resource') $type_name = 'Earth Resources';
672
-					else if ($type_name == 'stations') $type_name = 'Space Stations';
673
-					else if ($type_name == 'geo') $type_name = 'Geostationary';
674
-					else if ($type_name == 'amateur') $type_name = 'Amateur Radio';
675
-					else if ($type_name == 'x-comm') $type_name = 'Experimental';
676
-					else if ($type_name == 'other-comm') $type_name = 'Other Comm';
677
-					else if ($type_name == 'science') $type_name = 'Space & Earth Science';
678
-					else if ($type_name == 'military') $type_name = 'Miscellaneous Military';
679
-					else if ($type_name == 'radar') $type_name = 'Radar Calibration';
680
-					else if ($type_name == 'tle-new') $type_name = 'Last 30 days launches';
969
+					if ($type_name == 'musson') {
970
+						$type_name = 'Russian LEO Navigation';
971
+					} else if ($type_name == 'nnss') {
972
+						$type_name = 'Navi Navigation Satellite System';
973
+					} else if ($type_name == 'sbas') {
974
+						$type_name = 'Satellite-Based Augmentation System';
975
+					} else if ($type_name == 'glo-ops') {
976
+						$type_name = 'Glonass Operational';
977
+					} else if ($type_name == 'gps-ops') {
978
+						$type_name = 'GPS Operational';
979
+					} else if ($type_name == 'argos') {
980
+						$type_name = 'ARGOS Data Collection System';
981
+					} else if ($type_name == 'tdrss') {
982
+						$type_name = 'Tracking and Data Relay Satellite System';
983
+					} else if ($type_name == 'sarsat') {
984
+						$type_name = 'Search & Rescue';
985
+					} else if ($type_name == 'dmc') {
986
+						$type_name = 'Disaster Monitoring';
987
+					} else if ($type_name == 'resource') {
988
+						$type_name = 'Earth Resources';
989
+					} else if ($type_name == 'stations') {
990
+						$type_name = 'Space Stations';
991
+					} else if ($type_name == 'geo') {
992
+						$type_name = 'Geostationary';
993
+					} else if ($type_name == 'amateur') {
994
+						$type_name = 'Amateur Radio';
995
+					} else if ($type_name == 'x-comm') {
996
+						$type_name = 'Experimental';
997
+					} else if ($type_name == 'other-comm') {
998
+						$type_name = 'Other Comm';
999
+					} else if ($type_name == 'science') {
1000
+						$type_name = 'Space & Earth Science';
1001
+					} else if ($type_name == 'military') {
1002
+						$type_name = 'Miscellaneous Military';
1003
+					} else if ($type_name == 'radar') {
1004
+						$type_name = 'Radar Calibration';
1005
+					} else if ($type_name == 'tle-new') {
1006
+						$type_name = 'Last 30 days launches';
1007
+					}
681 1008
 					
682 1009
 					if (isset($_COOKIE['sattypes']) && in_array($type['tle_type'],explode(',',$_COOKIE['sattypes']))) {
683 1010
 						print '<option value="'.$type['tle_type'].'" selected>'.$type_name.'</option>';
Please login to merge, or discard this patch.
Indentation   +93 added lines, -93 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
     <?php }; if (isset($globalSatellite) && $globalSatellite) { ?><td><div id="ibxsatellite"><h4><?php echo _("Satellites Displayed"); ?></h4><br /><i class="fa fa-spinner fa-pulse fa-fw"></i></div></td><?php } ?>
48 48
 </tr></table></div>
49 49
 <?php
50
-    if ((!isset($_COOKIE['MapFormat']) && isset($globalMap3Ddefault) && $globalMap3Ddefault) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d')) {
50
+	if ((!isset($_COOKIE['MapFormat']) && isset($globalMap3Ddefault) && $globalMap3Ddefault) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d')) {
51 51
 ?>
52 52
 <script src="<?php echo $globalURL; ?>/js/map.3d.js.php"></script>
53 53
 <?php
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 <script src="<?php echo $globalURL; ?>/js/map-marine.3d.js.php"></script>
72 72
 <?php
73 73
 	}
74
-    }
74
+	}
75 75
 ?>
76 76
 
77 77
 <div id="sidebar" class="sidebar collapsed">
@@ -82,34 +82,34 @@  discard block
 block discarded – undo
82 82
 	<li><a href="#" onclick="getUserLocation(); return false;" title="<?php echo _("Plot your Location"); ?>"><i class="fa fa-map-marker"></i></a></li>
83 83
 	<li><a href="#" onclick="getCompassDirection(); return false;" title="<?php echo _("Compass Mode"); ?>"><i class="fa fa-compass"></i></a></li>
84 84
 <?php
85
-    if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
85
+	if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
86 86
 	if (isset($globalArchive) && $globalArchive == TRUE) {
87 87
 ?>
88 88
 	<li><a href="#archive" role="tab" title="<?php echo _("Archive"); ?>"><i class="fa fa-archive"></i></a></li>
89 89
 <?php
90 90
 	}
91
-    }
91
+	}
92 92
 ?>
93 93
 	<li><a href="#home" role="tab" title="<?php echo _("Layers"); ?>"><i class="fa fa-map"></i></a></li>
94 94
 	<li><a href="#filters" role="tab" title="<?php echo _("Filters"); ?>"><i class="fa fa-filter"></i></a></li>
95 95
 	<li><a href="#settings" role="tab" title="<?php echo _("Settings"); ?>"><i class="fa fa-gears"></i></a></li>
96 96
 <?php
97
-    if (isset($globalMap3D) && $globalMap3D) {
97
+	if (isset($globalMap3D) && $globalMap3D) {
98 98
 	if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) {
99 99
 ?>
100 100
 	<li><a href="#" onclick="show3D(); return false;" role="tab" title="3D"><b>3D</b></a></li>
101 101
 <?php
102
-	    if (isset($globalSatellite) && $globalSatellite) {
102
+		if (isset($globalSatellite) && $globalSatellite) {
103 103
 ?>
104 104
 	<li><a href="#satellites" role="tab" title="<?php echo _("Satellites"); ?>"><i class="satellite"></i></a></li>
105 105
 <?php
106
-	    }
106
+		}
107 107
 	} else {
108 108
 ?>
109 109
 	<li><a href="#" onclick="show2D(); return false;" role="tab" title="2D"><b>2D</b></a></li>
110 110
 <?php
111 111
 	}
112
-    }
112
+	}
113 113
 ?>
114 114
     </ul>
115 115
 
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
 ?>
185 185
         </div>
186 186
 <?php
187
-    if (isset($globalArchive) && $globalArchive == TRUE) {
187
+	if (isset($globalArchive) && $globalArchive == TRUE) {
188 188
 ?>
189 189
         <div class="sidebar-pane" id="archive">
190 190
 	    <h1 class="sidebar-header"><?php echo _("Playback"); ?> <i>Bêta</i><span class="sidebar-close"><i class="fa fa-caret-left"></i></span></h1>
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
 	    </form>
244 244
 	</div>
245 245
 <?php
246
-    }
246
+	}
247 247
 ?>
248 248
         <div class="sidebar-pane" id="settings">
249 249
 	    <h1 class="sidebar-header"><?php echo _("Settings"); ?><span class="sidebar-close"><i class="fa fa-caret-left"></i></span></h1>
@@ -254,56 +254,56 @@  discard block
 block discarded – undo
254 254
 			    <?php
255 255
 				if (!isset($_COOKIE['MapType']) || $_COOKIE['MapType'] == '') $MapType = $globalMapProvider;
256 256
 				else $MapType = $_COOKIE['MapType'];
257
-			    ?>
257
+				?>
258 258
 			    <?php
259 259
 				if (isset($globalBingMapKey) && $globalBingMapKey != '') {
260
-			    ?>
260
+				?>
261 261
 			    <option value="Bing-Aerial"<?php if ($MapType == 'Bing-Aerial') print ' selected'; ?>>Bing-Aerial</option>
262 262
 			    <option value="Bing-Hybrid"<?php if ($MapType == 'Bing-Hybrid') print ' selected'; ?>>Bing-Hybrid</option>
263 263
 			    <option value="Bing-Road"<?php if ($MapType == 'Bing-Road') print ' selected'; ?>>Bing-Road</option>
264 264
 			    <?php
265 265
 				}
266
-			    ?>
266
+				?>
267 267
 			    <?php
268
-			        if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) {
269
-			    ?>
268
+					if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) {
269
+				?>
270 270
 			    <?php
271
-				    if (isset($globalHereappId) && $globalHereappId != '' && isset($globalHereappCode) && $globalHereappCode != '') {
272
-			    ?>
271
+					if (isset($globalHereappId) && $globalHereappId != '' && isset($globalHereappCode) && $globalHereappCode != '') {
272
+				?>
273 273
 			    <option value="Here-Aerial"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Aerial</option>
274 274
 			    <option value="Here-Hybrid"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Hybrid</option>
275 275
 			    <option value="Here-Road"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Road</option>
276 276
 			    <?php
277
-				    }
278
-			    ?>
277
+					}
278
+				?>
279 279
 			    <?php
280
-				    if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '') {
281
-			    ?>
280
+					if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '') {
281
+				?>
282 282
 			    <option value="Google-Roadmap"<?php if ($MapType == 'Google-Roadmap') print ' selected'; ?>>Google Roadmap</option>
283 283
 			    <option value="Google-Satellite"<?php if ($MapType == 'Google-Satellite') print ' selected'; ?>>Google Satellite</option>
284 284
 			    <option value="Google-Hybrid"<?php if ($MapType == 'Google-Hybrid') print ' selected'; ?>>Google Hybrid</option>
285 285
 			    <option value="Google-Terrain"<?php if ($MapType == 'Google-Terrain') print ' selected'; ?>>Google Terrain</option>
286 286
 			    <?php
287
-				    }
288
-			    ?>
287
+					}
288
+				?>
289 289
 			    <?php
290
-				    if (isset($globalMapQuestKey) && $globalMapQuestKey != '') {
291
-			    ?>
290
+					if (isset($globalMapQuestKey) && $globalMapQuestKey != '') {
291
+				?>
292 292
 			    <option value="MapQuest-OSM"<?php if ($MapType == 'MapQuest-OSM') print ' selected'; ?>>MapQuest-OSM</option>
293 293
 			    <option value="MapQuest-Aerial"<?php if ($MapType == 'MapQuest-Aerial') print ' selected'; ?>>MapQuest-Aerial</option>
294 294
 			    <option value="MapQuest-Hybrid"<?php if ($MapType == 'MapQuest-Hybrid') print ' selected'; ?>>MapQuest-Hybrid</option>
295 295
 			    <?php
296
-				    }
297
-			    ?>
296
+					}
297
+				?>
298 298
 			    <option value="Yandex"<?php if ($MapType == 'Yandex') print ' selected'; ?>>Yandex</option>
299 299
 			    <?php
300 300
 				}
301
-			    ?>
301
+				?>
302 302
 			    <?php
303
-				    if (isset($globalMapboxToken) && $globalMapboxToken != '') {
303
+					if (isset($globalMapboxToken) && $globalMapboxToken != '') {
304 304
 					if (!isset($_COOKIE['MapTypeId'])) $MapBoxId = 'default';
305 305
 					else $MapBoxId = $_COOKIE['MapTypeId'];
306
-			    ?>
306
+				?>
307 307
 			    <option value="Mapbox-default"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'default') print ' selected'; ?>>Mapbox default</option>
308 308
 			    <option value="Mapbox-mapbox.streets"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets') print ' selected'; ?>>Mapbox streets</option>
309 309
 			    <option value="Mapbox-mapbox.light"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.light') print ' selected'; ?>>Mapbox light</option>
@@ -317,13 +317,13 @@  discard block
 block discarded – undo
317 317
 			    <option value="Mapbox-mapbox.pirates"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pirates') print ' selected'; ?>>Mapbox pirates</option>
318 318
 			    <option value="Mapbox-mapbox.emerald"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.emerald') print ' selected'; ?>>Mapbox emerald</option>
319 319
 			    <?php
320
-				    }
321
-			    ?>
320
+					}
321
+				?>
322 322
 			    <option value="OpenStreetMap"<?php if ($MapType == 'OpenStreetMap') print ' selected'; ?>>OpenStreetMap</option>
323 323
 			</select>
324 324
 		    </li>
325 325
 <?php
326
-    if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
326
+	if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
327 327
 ?>
328 328
 		    <li><?php echo _("Type of Terrain:"); ?>
329 329
 			<select  class="selectpicker" onchange="terrainType(this);">
@@ -334,10 +334,10 @@  discard block
 block discarded – undo
334 334
 			</select>
335 335
 		    </li>
336 336
 <?php
337
-    }
337
+	}
338 338
 ?>
339 339
 <?php
340
-    if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') {
340
+	if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') {
341 341
 ?>
342 342
 <?php
343 343
 	if (!isset($globalAircraft) || $globalAircraft === TRUE) {
@@ -354,88 +354,88 @@  discard block
 block discarded – undo
354 354
 		    <li><div class="checkbox"><label><input type="checkbox" name="satelliteestimation" value="1" onclick="clickSatelliteEstimation(this)" <?php if ((isset($_COOKIE['satelliteestimation']) && $_COOKIE['satelliteestimation'] == 'true') || (!isset($_COOKIE['satelliteestimation']) && !isset($globalMapEstimation)) || (!isset($_COOKIE['satelliteestimation']) && isset($globalMapEstimation) && $globalMapEstimation)) print 'checked'; ?> ><?php echo _("Satellites animate between updates"); ?></label></div></li>
355 355
 <?php
356 356
 	}
357
-    }
357
+	}
358 358
 ?>
359 359
 		    <li><div class="checkbox"><label><input type="checkbox" name="displayairports" value="1" onclick="clickDisplayAirports(this)" <?php if (isset($_COOKIE['displayairports']) && $_COOKIE['displayairports'] == 'true' || !isset($_COOKIE['displayairports'])) print 'checked'; ?> ><?php echo _("Display airports on map"); ?></label></div></li>
360 360
 		    <li><div class="checkbox"><label><input type="checkbox" name="displaygroundstation" value="1" onclick="clickDisplayGroundStation(this)" <?php if ((isset($_COOKIE['show_GroundStation']) && $_COOKIE['show_GroundStation'] == 'true') || (!isset($_COOKIE['show_GroundStation']) && (!isset($globalMapGroundStation) || $globalMapGroundStation === TRUE))) print 'checked'; ?> ><?php echo _("Display ground station on map"); ?></label></div></li>
361 361
 		    <li><div class="checkbox"><label><input type="checkbox" name="displayweatherstation" value="1" onclick="clickDisplayWeatherStation(this)" <?php if ((isset($_COOKIE['show_WeatherStation']) && $_COOKIE['show_WeatherStation'] == 'true') || (!isset($_COOKIE['show_WeatherStation']) && (!isset($globalMapWeatherStation) || $globalMapWeatherStation === TRUE))) print 'checked'; ?> ><?php echo _("Display weather station on map"); ?></label></div></li>
362 362
 		    <li><div class="checkbox"><label><input type="checkbox" name="displaylightning" value="1" onclick="clickDisplayLightning(this)" <?php if ((isset($_COOKIE['show_Lightning']) && $_COOKIE['show_Lightning'] == 'true') || (!isset($_COOKIE['show_Lightning']) && (!isset($globalMapLightning) || $globalMapLightning === TRUE))) print 'checked'; ?> ><?php echo _("Display lightning on map"); ?></label></div></li>
363 363
 <?php
364
-    if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
364
+	if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
365 365
 ?>
366 366
 		    <li><div class="checkbox"><label><input type="checkbox" name="displayminimap" value="1" onclick="clickDisplayMinimap(this)" <?php if (!isset($_COOKIE['displayminimap']) || (isset($_COOKIE['displayminimap']) && $_COOKIE['displayminimap'] == 'true')) print 'checked'; ?> ><?php echo _("Show mini-map"); ?></label></div></li>
367 367
 <?php
368
-    }
369
-    if (time() > mktime(0,0,0,12,1,date("Y")) && time() < mktime(0,0,0,12,31,date("Y"))) {
368
+	}
369
+	if (time() > mktime(0,0,0,12,1,date("Y")) && time() < mktime(0,0,0,12,31,date("Y"))) {
370 370
 ?>
371 371
 		    <li><div class="checkbox"><label><input type="checkbox" name="displaysanta" value="1" onclick="clickSanta(this)"><i class="fa fa-snowflake-o" aria-hidden="true"></i> <?php echo _("Show Santa Claus now"); ?> <i class="fa fa-snowflake-o" aria-hidden="true"></i></label></div></li>
372 372
 <?php
373
-    }
373
+	}
374 374
 ?>
375 375
 		    <?php
376 376
 			if (function_exists('array_column')) {
377
-			    if (array_search(TRUE, array_column($globalSources, 'sourcestats')) !== FALSE) {
378
-		    ?>
377
+				if (array_search(TRUE, array_column($globalSources, 'sourcestats')) !== FALSE) {
378
+			?>
379 379
 		    <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) print 'checked'; ?> ><?php echo _("Display polar on map"); ?></label></div></li>
380 380
 		    <?php
381
-			    }
381
+				}
382 382
 			} elseif (isset($globalSources)) {
383
-			    $dispolar = false;
384
-			    foreach ($globalSources as $testsource) {
385
-			        if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) $dispolar = true;
386
-			    }
387
-			    if ($dispolar) {
388
-		    ?>
383
+				$dispolar = false;
384
+				foreach ($globalSources as $testsource) {
385
+					if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) $dispolar = true;
386
+				}
387
+				if ($dispolar) {
388
+			?>
389 389
 		    <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) print 'checked'; ?> ><?php echo _("Display polar on map"); ?></label></div></li>
390 390
 		    <?php
391
-			    }
392
-		        }
393
-		    ?>
391
+				}
392
+				}
393
+			?>
394 394
 <?php
395
-    if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') {
395
+	if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') {
396 396
 ?>
397 397
 
398 398
 		    <?php
399 399
 			if (!isset($globalAircraft) || $globalAircraft === TRUE) {
400
-		    	    if (extension_loaded('gd') && function_exists('gd_info')) {
401
-		    ?>
400
+					if (extension_loaded('gd') && function_exists('gd_info')) {
401
+			?>
402 402
 		    <li><input type="checkbox" name="aircraftcoloraltitude" value="1" onclick="iconColorAltitude(this)" <?php if (isset($_COOKIE['IconColorAltitude']) && $_COOKIE['IconColorAltitude'] == 'true') print 'checked'; ?> ><?php echo _("Aircraft icon color based on altitude"); ?></li>
403 403
 		    <?php 
404 404
 				if (!isset($_COOKIE['IconColorAltitude']) || $_COOKIE['IconColorAltitude'] == 'false') {
405
-		    ?>
405
+			?>
406 406
 		    <li><?php echo _("Aircraft icon color:"); ?>
407 407
 			<input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(aircraftcolor.value);" value="#<?php if (isset($_COOKIE['IconColor'])) print $_COOKIE['IconColor']; elseif (isset($globalAircraftIconColor)) print $globalAircraftIconColor; else print '1a3151'; ?>">
408 408
 		    </li>
409 409
 		    <?php
410 410
 				}
411
-			    }
412
-		        }
413
-		    ?>
411
+				}
412
+				}
413
+			?>
414 414
 		    <?php
415 415
 			if (isset($globalMarine) && $globalMarine === TRUE) {
416
-			    if (extension_loaded('gd') && function_exists('gd_info')) {
417
-		    ?>
416
+				if (extension_loaded('gd') && function_exists('gd_info')) {
417
+			?>
418 418
 		    <li><?php echo _("Marine icon color:"); ?>
419 419
 			<input type="color" name="marinecolor" id="html5colorpicker" onchange="MarineiconColor(marinecolor.value);" value="#<?php if (isset($_COOKIE['MarineIconColor'])) print $_COOKIE['MarineIconColor']; elseif (isset($globalMarineIconColor)) print $globalMarineIconColor; else print '1a3151'; ?>">
420 420
 		    </li>
421 421
 		    <?php
422
-			    }
423
-		        }
424
-		    ?>
422
+				}
423
+				}
424
+			?>
425 425
 		    <?php
426 426
 			if (isset($globalTracker) && $globalTracker === TRUE) {
427
-			    if (extension_loaded('gd') && function_exists('gd_info')) {
428
-		    ?>
427
+				if (extension_loaded('gd') && function_exists('gd_info')) {
428
+			?>
429 429
 		    <li><?php echo _("Tracker icon color:"); ?>
430 430
 			<input type="color" name="trackercolor" id="html5colorpicker" onchange="TrackericonColor(trackercolor.value);" value="#<?php if (isset($_COOKIE['TrackerIconColor'])) print $_COOKIE['TrackerIconColor']; elseif (isset($globalTrackerIconColor)) print $globalTrackerIconColor; else print '1a3151'; ?>">
431 431
 		    </li>
432 432
 		    <?php
433
-			    }
434
-		        }
435
-		    ?>
433
+				}
434
+				}
435
+			?>
436 436
 		    <?php
437 437
 			if (!isset($globalAircraft) || $globalAircraft === TRUE) {
438
-		    ?>
438
+			?>
439 439
 		    <li><?php echo _("Show airport icon at zoom level:"); ?>
440 440
 			<div class="range">
441 441
 			    <input type="range" min="0" max="19" step="1" name="airportzoom" onchange="range.value=value;airportDisplayZoom(airportzoom.value);" value="<?php if (isset($_COOKIE['AirportZoom'])) print $_COOKIE['AirportZoom']; elseif (isset($globalAirportZoom)) print $globalAirportZoom; else print '7'; ?>">
@@ -444,9 +444,9 @@  discard block
 block discarded – undo
444 444
 		    </li>
445 445
 		    <?php
446 446
 			}
447
-		    ?>
447
+			?>
448 448
 <?php
449
-    } elseif (isset($_COOKIE['MapFormat']) || $_COOKIE['MapFOrmat'] == '3d') {
449
+	} elseif (isset($_COOKIE['MapFormat']) || $_COOKIE['MapFOrmat'] == '3d') {
450 450
 ?>
451 451
 <?php
452 452
 	if (!isset($globalAircraft) || $globalAircraft === TRUE) {
@@ -477,7 +477,7 @@  discard block
 block discarded – undo
477 477
 		    </li>
478 478
 <?php
479 479
 	}
480
-    }
480
+	}
481 481
 ?>
482 482
 		    <li><?php echo _("Distance unit:"); ?>
483 483
 			<select class="selectpicker" onchange="unitdistance(this);">
@@ -510,19 +510,19 @@  discard block
 block discarded – undo
510 510
 		    <ul>
511 511
 		    <?php
512 512
 			if (!isset($globalAircraft) || $globalAircraft) {
513
-		    ?>
513
+			?>
514 514
 		    <?php
515 515
 			if (((isset($globalVATSIM) && $globalVATSIM) || isset($globalIVAO) && $globalIVAO || isset($globalphpVMS) && $globalphpVMS) && (!isset($globalMapVAchoose) || $globalMapVAchoose)) {
516
-		    ?>
516
+			?>
517 517
 			<?php if (isset($globalVATSIM) && $globalVATSIM) { ?><li><input type="checkbox" name="vatsim" value="1" onclick="clickVATSIM(this)" <?php if ((isset($_COOKIE['ShowVATSIM']) && $_COOKIE['ShowVATSIM'] == 'true') || !isset($_COOKIE['ShowVATSIM'])) print 'checked'; ?> ><?php echo _("Display VATSIM data"); ?></li><?php } ?>
518 518
 			<?php if (isset($globalIVAO) && $globalIVAO) { ?><li><input type="checkbox" name="ivao" value="1" onclick="clickIVAO(this)" <?php if ((isset($_COOKIE['ShowIVAO']) && $_COOKIE['ShowIVAO'] == 'true') || !isset($_COOKIE['ShowIVAO'])) print 'checked'; ?> ><?php echo _("Display IVAO data"); ?></li><?php } ?>
519 519
 			<?php if (isset($globalphpVMS) && $globalphpVMS) { ?><li><input type="checkbox" name="phpvms" value="1" onclick="clickphpVMS(this)" <?php if ((isset($_COOKIE['ShowVMS']) && $_COOKIE['ShowVMS'] == 'true') || !isset($_COOKIE['ShowVMS'])) print 'checked'; ?> ><?php echo _("Display phpVMS data"); ?></li><?php } ?>
520 520
 		    <?php
521 521
 			}
522
-		    ?>
522
+			?>
523 523
 		    <?php
524 524
 			if (!(isset($globalVA) && $globalVA) && !(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalphpVMS) && $globalphpVMS) && isset($globalSBS1) && $globalSBS1 && isset($globalAPRS) && $globalAPRS && (!isset($globalMapchoose) || $globalMapchoose)) {
525
-		    ?>
525
+			?>
526 526
 			<?php if (isset($globalSBS1) && $globalSBS1) { ?>
527 527
 			    <li><div class="checkbox"><label><input type="checkbox" name="sbs" value="1" onclick="clickSBS1(this)" <?php if ((isset($_COOKIE['ShowSBS1']) && $_COOKIE['ShowSBS1'] == 'true') || !isset($_COOKIE['ShowSBS1'])) print 'checked'; ?> ><?php echo _("Display ADS-B data"); ?></label></div></li>
528 528
 			<?php } ?>
@@ -531,7 +531,7 @@  discard block
 block discarded – undo
531 531
 			<?php } ?>
532 532
 		    <?php
533 533
 			}
534
-		    ?>
534
+			?>
535 535
 		    <li><?php echo _("Display airlines:"); ?>
536 536
 		    <br/>
537 537
 			<select class="selectpicker" multiple onchange="airlines(this);" id="display_airlines">
@@ -551,14 +551,14 @@  discard block
 block discarded – undo
551 551
 						echo '<option value="'.$airline['airline_icao'].'">'.$airline_name.'</option>';
552 552
 					}
553 553
 				}
554
-			    ?>
554
+				?>
555 555
 			</select>
556 556
 		    </li>
557 557
 		    <?php
558 558
 			$Spotter = new Spotter();
559 559
 			$allalliancenames = $Spotter->getAllAllianceNames();
560 560
 			if (!empty($allalliancenames)) {
561
-		    ?>
561
+			?>
562 562
 		    <li><?php echo _("Display alliance:"); ?>
563 563
 		    <br/>
564 564
 			<select class="selectpicker" onchange="alliance(this);" id="display_alliance">
@@ -572,18 +572,18 @@  discard block
 block discarded – undo
572 572
 						echo '<option value="'.$alliance_name.'">'.$alliance_name.'</option>';
573 573
 					}
574 574
 				}
575
-			    ?>
575
+				?>
576 576
 			</select>
577 577
 		    </li>
578 578
 		    <?php
579 579
 			}
580
-		    ?>
580
+			?>
581 581
 		    <?php
582 582
 			}
583
-		    ?>
583
+			?>
584 584
 		    <?php
585 585
 			if (isset($globalAPRS) && $globalAPRS) {
586
-		    ?>
586
+			?>
587 587
 		    <li><?php echo _("Display APRS sources name:"); ?>
588 588
 			<select class="selectpicker" multiple onchange="sources(this);">
589 589
 			    <?php
@@ -607,18 +607,18 @@  discard block
 block discarded – undo
607 607
 						echo '<option value="'.$src['name'].'">'.$src['name'].'</option>';
608 608
 					}
609 609
 				}
610
-			    ?>
610
+				?>
611 611
 			</select>
612 612
 		    </li>
613 613
 		    <?php
614 614
 			}
615
-		    ?>
615
+			?>
616 616
 		    <?php
617 617
 			if (!isset($globalAircraft) && $globalAircraft) {
618
-		    ?>
618
+			?>
619 619
 		    <?php
620 620
 			if (!(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalphpVMS) && $globalphpVMS)) {
621
-		    ?>
621
+			?>
622 622
 		    <li><?php echo _("Display airlines of type:"); ?><br/>
623 623
 			<select class="selectpicker" onchange="airlinestype(this);">
624 624
 			    <option value="all"<?php if (!isset($_COOKIE['filter_airlinestype']) || $_COOKIE['filter_airlinestype'] == 'all' || $_COOKIE['filter_airlinestype'] == '') echo ' selected'; ?>><?php echo _("All"); ?></option>
@@ -629,14 +629,14 @@  discard block
 block discarded – undo
629 629
 		    </li>
630 630
 		    <?php
631 631
 			}
632
-		    ?>
632
+			?>
633 633
 		    <li>
634 634
 			<?php echo _("Display flight with ident:"); ?>
635 635
 			<input type="text" name="identfilter" onchange="identfilter();" id="identfilter" value="<?php if (isset($_COOKIE['filter_ident'])) print $_COOKIE['filter_ident']; ?>" />
636 636
 		    </li>
637 637
 		    <?php
638 638
 			}
639
-		    ?>
639
+			?>
640 640
 		</ul>
641 641
 	    </form>
642 642
 	    <form method="post">
@@ -645,7 +645,7 @@  discard block
 block discarded – undo
645 645
 	    </form>
646 646
     	</div>
647 647
 <?php
648
-    if (isset($globalSatellite) && $globalSatellite) {
648
+	if (isset($globalSatellite) && $globalSatellite) {
649 649
 ?>
650 650
         <div class="sidebar-pane" id="satellites">
651 651
 	    <h1 class="sidebar-header"><?php echo _("Satellites"); ?><span class="sidebar-close"><i class="fa fa-caret-left"></i></span></h1>
@@ -685,14 +685,14 @@  discard block
 block discarded – undo
685 685
 						print '<option value="'.$type['tle_type'].'">'.$type_name.'</option>';
686 686
 					}
687 687
 				}
688
-			    ?>
688
+				?>
689 689
 			</select>
690 690
 		    </li>
691 691
 		</ul>
692 692
 	    </form>
693 693
 	</div>
694 694
 <?php
695
-    }
695
+	}
696 696
 ?>
697 697
     </div>
698 698
 </div>
Please login to merge, or discard this patch.
sitemap.php 3 patches
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 	$output .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">';
15 15
 
16 16
 		$spotter_array = $Spotter->getAllFlightsforSitemap();
17
-		foreach($spotter_array as $spotter_item)
17
+		foreach ($spotter_array as $spotter_item)
18 18
 		{
19 19
 			$output .= '<url>';
20 20
 			    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/flightid/'.$spotter_item['spotter_id'].'</loc>';
@@ -25,13 +25,13 @@  discard block
 block discarded – undo
25 25
 	$output .= '</urlset>';
26 26
 	
27 27
 	
28
-} else if (isset($_GET['type']) && $_GET['type'] == "aircraft"){
28
+} else if (isset($_GET['type']) && $_GET['type'] == "aircraft") {
29 29
 
30 30
 	$output .= '<?xml version="1.0" encoding="UTF-8"?>';
31 31
 	$output .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">';
32 32
 		$aircraft_types = $Stats->getAllAircraftTypes();
33 33
 		if (empty($aircraft_types)) $aircraft_types = $Spotter->getAllAircraftTypes();
34
-		foreach($aircraft_types as $aircraft_item)
34
+		foreach ($aircraft_types as $aircraft_item)
35 35
 		{
36 36
 			$output .= '<url>';
37 37
 			    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/aircraft/'.urlencode($aircraft_item['aircraft_icao']).'</loc>';
@@ -42,13 +42,13 @@  discard block
 block discarded – undo
42 42
 	$output .= '</urlset>';
43 43
 	
44 44
 	
45
-} else if (isset($_GET['type']) && $_GET['type'] == "registration"){
45
+} else if (isset($_GET['type']) && $_GET['type'] == "registration") {
46 46
 
47 47
 	$output .= '<?xml version="1.0" encoding="UTF-8"?>';
48 48
 	$output .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">';
49 49
 
50 50
 		$aircraft_registrations = $Spotter->getAllAircraftRegistrations();
51
-		foreach($aircraft_registrations as $aircraft_item)
51
+		foreach ($aircraft_registrations as $aircraft_item)
52 52
 		{
53 53
 			$output .= '<url>';
54 54
 			    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/registration/'.urlencode($aircraft_item['registration']).'</loc>';
@@ -58,13 +58,13 @@  discard block
 block discarded – undo
58 58
 		}
59 59
 	$output .= '</urlset>';
60 60
 	
61
-} else if (isset($_GET['type']) && $_GET['type'] == "airline"){
61
+} else if (isset($_GET['type']) && $_GET['type'] == "airline") {
62 62
 
63 63
 	$output .= '<?xml version="1.0" encoding="UTF-8"?>';
64 64
 	$output .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">';
65 65
 
66 66
 		$airline_names = $Stats->getAllAirlineNames();
67
-		foreach($airline_names as $airline_item)
67
+		foreach ($airline_names as $airline_item)
68 68
 		{
69 69
 			$output .= '<url>';
70 70
 			    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/airline/'.urlencode($airline_item['airline_icao']).'</loc>';
@@ -74,14 +74,14 @@  discard block
 block discarded – undo
74 74
 		}
75 75
 	$output .= '</urlset>';
76 76
 	
77
-} else if (isset($_GET['type']) && $_GET['type'] == "airport"){
77
+} else if (isset($_GET['type']) && $_GET['type'] == "airport") {
78 78
 
79 79
 	$output .= '<?xml version="1.0" encoding="UTF-8"?>';
80 80
 	$output .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">';
81 81
 
82 82
 		$airport_names = $Stats->getAllAirportNames();
83 83
 		if (empty($airport_names)) $airport_names = $Spotter->getAllAirportNames();
84
-		foreach($airport_names as $airport_item)
84
+		foreach ($airport_names as $airport_item)
85 85
 		{
86 86
 			$output .= '<url>';
87 87
 			    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/airport/'.$airport_item['airport_icao'].'</loc>';
@@ -91,14 +91,14 @@  discard block
 block discarded – undo
91 91
 		}
92 92
 	$output .= '</urlset>';
93 93
 	
94
-} else if (isset($_GET['type']) && $_GET['type'] == "manufacturer"){
94
+} else if (isset($_GET['type']) && $_GET['type'] == "manufacturer") {
95 95
 
96 96
 	$output .= '<?xml version="1.0" encoding="UTF-8"?>';
97 97
 	$output .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">';
98 98
 
99 99
 		$manufacturer_names = $Stats->getAllManufacturers();
100 100
 		if (empty($manufacturer_names)) $manufacturer_names = $Spotter->getAllManufacturers();
101
-		foreach($manufacturer_names as $manufacturer_item)
101
+		foreach ($manufacturer_names as $manufacturer_item)
102 102
 		{
103 103
 			$output .= '<url>';
104 104
 			    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/manufacturer/'.urlencode(strtolower(str_replace(" ", "-", $manufacturer_item['aircraft_manufacturer']))).'</loc>';
@@ -108,13 +108,13 @@  discard block
 block discarded – undo
108 108
 		}
109 109
 	$output .= '</urlset>';
110 110
 	
111
-} else if (isset($_GET['type']) && $_GET['type'] == "country"){
111
+} else if (isset($_GET['type']) && $_GET['type'] == "country") {
112 112
 
113 113
 	$output .= '<?xml version="1.0" encoding="UTF-8"?>';
114 114
 	$output .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">';
115 115
 
116 116
 		$country_names = $Spotter->getAllCountries();
117
-		foreach($country_names as $country_item)
117
+		foreach ($country_names as $country_item)
118 118
 		{
119 119
 			$output .= '<url>';
120 120
 			    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/country/'.urlencode(strtolower(str_replace(" ", "-", $country_item['country']))).'</loc>';
@@ -124,13 +124,13 @@  discard block
 block discarded – undo
124 124
 		}
125 125
 	$output .= '</urlset>';
126 126
 	
127
-} else if (isset($_GET['type']) && $_GET['type'] == "ident"){
127
+} else if (isset($_GET['type']) && $_GET['type'] == "ident") {
128 128
 
129 129
 	$output .= '<?xml version="1.0" encoding="UTF-8"?>';
130 130
 	$output .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">';
131 131
 
132 132
 		$ident_names = $Spotter->getAllIdents();
133
-		foreach($ident_names as $ident_item)
133
+		foreach ($ident_names as $ident_item)
134 134
 		{
135 135
 			if (ctype_alnum($ident_item['ident'])) {
136 136
 				$output .= '<url>';
@@ -142,13 +142,13 @@  discard block
 block discarded – undo
142 142
 		}
143 143
 	$output .= '</urlset>';
144 144
 	
145
-} else if (isset($_GET['type']) && $_GET['type'] == "date"){
145
+} else if (isset($_GET['type']) && $_GET['type'] == "date") {
146 146
 
147 147
 	$output .= '<?xml version="1.0" encoding="UTF-8"?>';
148 148
 	$output .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">';
149 149
 
150 150
 		$date_names = $Spotter->getAllDates();
151
-		foreach($date_names as $date_item)
151
+		foreach ($date_names as $date_item)
152 152
 		{
153 153
 			$output .= '<url>';
154 154
 			    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/date/'.date("Y-m-d", strtotime($date_item['date'])).'</loc>';
@@ -158,13 +158,13 @@  discard block
 block discarded – undo
158 158
 		}
159 159
 	$output .= '</urlset>';
160 160
 	
161
-} else if (isset($_GET['type']) && $_GET['type'] == "route"){
161
+} else if (isset($_GET['type']) && $_GET['type'] == "route") {
162 162
 
163 163
 	$output .= '<?xml version="1.0" encoding="UTF-8"?>';
164 164
 	$output .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">';
165 165
 
166 166
 		$route_names = $Spotter->getAllRoutes();
167
-		foreach($route_names as $route_item)
167
+		foreach ($route_names as $route_item)
168 168
 		{
169 169
 			$output .= '<url>';
170 170
 			    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/route/'.$route_item['airport_departure_icao'].'/'.$route_item['airport_arrival_icao'].'</loc>';
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
 		}
175 175
 	$output .= '</urlset>';
176 176
 	
177
-} else if (isset($_GET['type']) && $_GET['type'] == "static"){
177
+} else if (isset($_GET['type']) && $_GET['type'] == "static") {
178 178
 
179 179
 	$output .= '<?xml version="1.0" encoding="UTF-8"?>';
180 180
 	$output .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">';
Please login to merge, or discard this patch.
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -30,7 +30,9 @@  discard block
 block discarded – undo
30 30
 	$output .= '<?xml version="1.0" encoding="UTF-8"?>';
31 31
 	$output .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">';
32 32
 		$aircraft_types = $Stats->getAllAircraftTypes();
33
-		if (empty($aircraft_types)) $aircraft_types = $Spotter->getAllAircraftTypes();
33
+		if (empty($aircraft_types)) {
34
+			$aircraft_types = $Spotter->getAllAircraftTypes();
35
+		}
34 36
 		foreach($aircraft_types as $aircraft_item)
35 37
 		{
36 38
 			$output .= '<url>';
@@ -80,7 +82,9 @@  discard block
 block discarded – undo
80 82
 	$output .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">';
81 83
 
82 84
 		$airport_names = $Stats->getAllAirportNames();
83
-		if (empty($airport_names)) $airport_names = $Spotter->getAllAirportNames();
85
+		if (empty($airport_names)) {
86
+			$airport_names = $Spotter->getAllAirportNames();
87
+		}
84 88
 		foreach($airport_names as $airport_item)
85 89
 		{
86 90
 			$output .= '<url>';
@@ -97,7 +101,9 @@  discard block
 block discarded – undo
97 101
 	$output .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">';
98 102
 
99 103
 		$manufacturer_names = $Stats->getAllManufacturers();
100
-		if (empty($manufacturer_names)) $manufacturer_names = $Spotter->getAllManufacturers();
104
+		if (empty($manufacturer_names)) {
105
+			$manufacturer_names = $Spotter->getAllManufacturers();
106
+		}
101 107
 		foreach($manufacturer_names as $manufacturer_item)
102 108
 		{
103 109
 			$output .= '<url>';
Please login to merge, or discard this patch.
Indentation   +106 added lines, -106 removed lines patch added patch discarded remove patch
@@ -17,9 +17,9 @@  discard block
 block discarded – undo
17 17
 		foreach($spotter_array as $spotter_item)
18 18
 		{
19 19
 			$output .= '<url>';
20
-			    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/flightid/'.$spotter_item['spotter_id'].'</loc>';
21
-			    $output .= '<lastmod>'.date("c", time()).'</lastmod>';
22
-			    $output .= '<changefreq>weekly</changefreq>';
20
+				$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/flightid/'.$spotter_item['spotter_id'].'</loc>';
21
+				$output .= '<lastmod>'.date("c", time()).'</lastmod>';
22
+				$output .= '<changefreq>weekly</changefreq>';
23 23
 			$output .= '</url>';
24 24
 		}
25 25
 	$output .= '</urlset>';
@@ -34,9 +34,9 @@  discard block
 block discarded – undo
34 34
 		foreach($aircraft_types as $aircraft_item)
35 35
 		{
36 36
 			$output .= '<url>';
37
-			    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/aircraft/'.urlencode($aircraft_item['aircraft_icao']).'</loc>';
38
-			    $output .= '<lastmod>'.date("c", time()).'</lastmod>';
39
-			    $output .= '<changefreq>daily</changefreq>';
37
+				$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/aircraft/'.urlencode($aircraft_item['aircraft_icao']).'</loc>';
38
+				$output .= '<lastmod>'.date("c", time()).'</lastmod>';
39
+				$output .= '<changefreq>daily</changefreq>';
40 40
 			$output .= '</url>';
41 41
 		}
42 42
 	$output .= '</urlset>';
@@ -51,9 +51,9 @@  discard block
 block discarded – undo
51 51
 		foreach($aircraft_registrations as $aircraft_item)
52 52
 		{
53 53
 			$output .= '<url>';
54
-			    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/registration/'.urlencode($aircraft_item['registration']).'</loc>';
55
-			    $output .= '<lastmod>'.date("c", time()).'</lastmod>';
56
-			    $output .= '<changefreq>daily</changefreq>';
54
+				$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/registration/'.urlencode($aircraft_item['registration']).'</loc>';
55
+				$output .= '<lastmod>'.date("c", time()).'</lastmod>';
56
+				$output .= '<changefreq>daily</changefreq>';
57 57
 			$output .= '</url>';
58 58
 		}
59 59
 	$output .= '</urlset>';
@@ -67,9 +67,9 @@  discard block
 block discarded – undo
67 67
 		foreach($airline_names as $airline_item)
68 68
 		{
69 69
 			$output .= '<url>';
70
-			    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/airline/'.urlencode($airline_item['airline_icao']).'</loc>';
71
-			    $output .= '<lastmod>'.date("c", time()).'</lastmod>';
72
-			    $output .= '<changefreq>daily</changefreq>';
70
+				$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/airline/'.urlencode($airline_item['airline_icao']).'</loc>';
71
+				$output .= '<lastmod>'.date("c", time()).'</lastmod>';
72
+				$output .= '<changefreq>daily</changefreq>';
73 73
 			$output .= '</url>';
74 74
 		}
75 75
 	$output .= '</urlset>';
@@ -84,9 +84,9 @@  discard block
 block discarded – undo
84 84
 		foreach($airport_names as $airport_item)
85 85
 		{
86 86
 			$output .= '<url>';
87
-			    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/airport/'.$airport_item['airport_icao'].'</loc>';
88
-			    $output .= '<lastmod>'.date("c", time()).'</lastmod>';
89
-			    $output .= '<changefreq>daily</changefreq>';
87
+				$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/airport/'.$airport_item['airport_icao'].'</loc>';
88
+				$output .= '<lastmod>'.date("c", time()).'</lastmod>';
89
+				$output .= '<changefreq>daily</changefreq>';
90 90
 			$output .= '</url>';
91 91
 		}
92 92
 	$output .= '</urlset>';
@@ -101,9 +101,9 @@  discard block
 block discarded – undo
101 101
 		foreach($manufacturer_names as $manufacturer_item)
102 102
 		{
103 103
 			$output .= '<url>';
104
-			    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/manufacturer/'.urlencode(strtolower(str_replace(" ", "-", $manufacturer_item['aircraft_manufacturer']))).'</loc>';
105
-			    $output .= '<lastmod>'.date("c", time()).'</lastmod>';
106
-			    $output .= '<changefreq>daily</changefreq>';
104
+				$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/manufacturer/'.urlencode(strtolower(str_replace(" ", "-", $manufacturer_item['aircraft_manufacturer']))).'</loc>';
105
+				$output .= '<lastmod>'.date("c", time()).'</lastmod>';
106
+				$output .= '<changefreq>daily</changefreq>';
107 107
 			$output .= '</url>';
108 108
 		}
109 109
 	$output .= '</urlset>';
@@ -117,9 +117,9 @@  discard block
 block discarded – undo
117 117
 		foreach($country_names as $country_item)
118 118
 		{
119 119
 			$output .= '<url>';
120
-			    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/country/'.urlencode(strtolower(str_replace(" ", "-", $country_item['country']))).'</loc>';
121
-			    $output .= '<lastmod>'.date("c", time()).'</lastmod>';
122
-			    $output .= '<changefreq>daily</changefreq>';
120
+				$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/country/'.urlencode(strtolower(str_replace(" ", "-", $country_item['country']))).'</loc>';
121
+				$output .= '<lastmod>'.date("c", time()).'</lastmod>';
122
+				$output .= '<changefreq>daily</changefreq>';
123 123
 			$output .= '</url>';
124 124
 		}
125 125
 	$output .= '</urlset>';
@@ -134,9 +134,9 @@  discard block
 block discarded – undo
134 134
 		{
135 135
 			if (ctype_alnum($ident_item['ident'])) {
136 136
 				$output .= '<url>';
137
-				    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/ident/'.urlencode($ident_item['ident']).'</loc>';
138
-				    $output .= '<lastmod>'.date("c", time()).'</lastmod>';
139
-				    $output .= '<changefreq>daily</changefreq>';
137
+					$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/ident/'.urlencode($ident_item['ident']).'</loc>';
138
+					$output .= '<lastmod>'.date("c", time()).'</lastmod>';
139
+					$output .= '<changefreq>daily</changefreq>';
140 140
 				$output .= '</url>';
141 141
 			}
142 142
 		}
@@ -151,9 +151,9 @@  discard block
 block discarded – undo
151 151
 		foreach($date_names as $date_item)
152 152
 		{
153 153
 			$output .= '<url>';
154
-			    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/date/'.date("Y-m-d", strtotime($date_item['date'])).'</loc>';
155
-			    $output .= '<lastmod>'.date("c", time()).'</lastmod>';
156
-			    $output .= '<changefreq>daily</changefreq>';
154
+				$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/date/'.date("Y-m-d", strtotime($date_item['date'])).'</loc>';
155
+				$output .= '<lastmod>'.date("c", time()).'</lastmod>';
156
+				$output .= '<changefreq>daily</changefreq>';
157 157
 			$output .= '</url>';
158 158
 		}
159 159
 	$output .= '</urlset>';
@@ -167,9 +167,9 @@  discard block
 block discarded – undo
167 167
 		foreach($route_names as $route_item)
168 168
 		{
169 169
 			$output .= '<url>';
170
-			    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/route/'.$route_item['airport_departure_icao'].'/'.$route_item['airport_arrival_icao'].'</loc>';
171
-			    $output .= '<lastmod>'.date("c", time()).'</lastmod>';
172
-			    $output .= '<changefreq>daily</changefreq>';
170
+				$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/route/'.$route_item['airport_departure_icao'].'/'.$route_item['airport_arrival_icao'].'</loc>';
171
+				$output .= '<lastmod>'.date("c", time()).'</lastmod>';
172
+				$output .= '<changefreq>daily</changefreq>';
173 173
 			$output .= '</url>';
174 174
 		}
175 175
 	$output .= '</urlset>';
@@ -181,117 +181,117 @@  discard block
 block discarded – undo
181 181
 		
182 182
 		/* STATIC PAGES */
183 183
 		$output .= '<url>';
184
-		    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/</loc>';
185
-		    $output .= '<lastmod>'.date("c", time()).'</lastmod>';
186
-		    $output .= '<changefreq>daily</changefreq>';
184
+			$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/</loc>';
185
+			$output .= '<lastmod>'.date("c", time()).'</lastmod>';
186
+			$output .= '<changefreq>daily</changefreq>';
187 187
 		$output .= '</url>';
188 188
 		$output .= '<url>';
189
-		    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/latest</loc>';
190
-		    $output .= '<lastmod>'.date("c", time()).'</lastmod>';
191
-		    $output .= '<changefreq>daily</changefreq>';
189
+			$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/latest</loc>';
190
+			$output .= '<lastmod>'.date("c", time()).'</lastmod>';
191
+			$output .= '<changefreq>daily</changefreq>';
192 192
 		$output .= '</url>';
193 193
 		$output .= '<url>';
194
-		    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/highlights</loc>';
195
-		    $output .= '<lastmod>'.date("c", time()).'</lastmod>';
196
-		    $output .= '<changefreq>daily</changefreq>';
194
+			$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/highlights</loc>';
195
+			$output .= '<lastmod>'.date("c", time()).'</lastmod>';
196
+			$output .= '<changefreq>daily</changefreq>';
197 197
 		$output .= '</url>';
198 198
 		$output .= '<url>';
199
-		    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/aircraft</loc>';
200
-		    $output .= '<lastmod>'.date("c", time()).'</lastmod>';
201
-		    $output .= '<changefreq>daily</changefreq>';
199
+			$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/aircraft</loc>';
200
+			$output .= '<lastmod>'.date("c", time()).'</lastmod>';
201
+			$output .= '<changefreq>daily</changefreq>';
202 202
 		$output .= '</url>';
203 203
 		$output .= '<url>';
204
-		    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/airline</loc>';
205
-		    $output .= '<lastmod>'.date("c", time()).'</lastmod>';
206
-		    $output .= '<changefreq>daily</changefreq>';
204
+			$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/airline</loc>';
205
+			$output .= '<lastmod>'.date("c", time()).'</lastmod>';
206
+			$output .= '<changefreq>daily</changefreq>';
207 207
 		$output .= '</url>';
208 208
 		$output .= '<url>';
209
-		    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/airport</loc>';
210
-		    $output .= '<lastmod>'.date("c", time()).'</lastmod>';
211
-		    $output .= '<changefreq>daily</changefreq>';
209
+			$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/airport</loc>';
210
+			$output .= '<lastmod>'.date("c", time()).'</lastmod>';
211
+			$output .= '<changefreq>daily</changefreq>';
212 212
 		$output .= '</url>';
213 213
 		$output .= '<url>';
214
-		    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/search</loc>';
215
-		    $output .= '<lastmod>'.date("c", time()).'</lastmod>';
216
-		    $output .= '<changefreq>daily</changefreq>';
214
+			$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/search</loc>';
215
+			$output .= '<lastmod>'.date("c", time()).'</lastmod>';
216
+			$output .= '<changefreq>daily</changefreq>';
217 217
 		$output .= '</url>';
218 218
 		$output .= '<url>';
219
-		    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/about</loc>';
220
-		    $output .= '<lastmod>'.date("c", time()).'</lastmod>';
221
-		    $output .= '<changefreq>weekly</changefreq>';
219
+			$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/about</loc>';
220
+			$output .= '<lastmod>'.date("c", time()).'</lastmod>';
221
+			$output .= '<changefreq>weekly</changefreq>';
222 222
 		$output .= '</url>';
223 223
 		
224 224
 		
225 225
 		/* STATISTIC PAGES */
226 226
 		$output .= '<url>';
227
-		    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/statistics/aircraft</loc>';
228
-		    $output .= '<lastmod>'.date("c", time()).'</lastmod>';
229
-		    $output .= '<changefreq>daily</changefreq>';
227
+			$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/statistics/aircraft</loc>';
228
+			$output .= '<lastmod>'.date("c", time()).'</lastmod>';
229
+			$output .= '<changefreq>daily</changefreq>';
230 230
 		$output .= '</url>';
231 231
 		$output .= '<url>';
232
-		    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/statistics/registration</loc>';
233
-		    $output .= '<lastmod>'.date("c", time()).'</lastmod>';
234
-		    $output .= '<changefreq>daily</changefreq>';
232
+			$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/statistics/registration</loc>';
233
+			$output .= '<lastmod>'.date("c", time()).'</lastmod>';
234
+			$output .= '<changefreq>daily</changefreq>';
235 235
 		$output .= '</url>';
236 236
 		$output .= '<url>';
237
-		    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/statistics/manufacturer</loc>';
238
-		    $output .= '<lastmod>'.date("c", time()).'</lastmod>';
239
-		    $output .= '<changefreq>daily</changefreq>';
237
+			$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/statistics/manufacturer</loc>';
238
+			$output .= '<lastmod>'.date("c", time()).'</lastmod>';
239
+			$output .= '<changefreq>daily</changefreq>';
240 240
 		$output .= '</url>';
241 241
 		$output .= '<url>';
242
-		    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/statistics/airline</loc>';
243
-		    $output .= '<lastmod>'.date("c", time()).'</lastmod>';
244
-		    $output .= '<changefreq>daily</changefreq>';
242
+			$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/statistics/airline</loc>';
243
+			$output .= '<lastmod>'.date("c", time()).'</lastmod>';
244
+			$output .= '<changefreq>daily</changefreq>';
245 245
 		$output .= '</url>';
246 246
 		$output .= '<url>';
247
-		    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/statistics/airline-country</loc>';
248
-		    $output .= '<lastmod>'.date("c", time()).'</lastmod>';
249
-		    $output .= '<changefreq>daily</changefreq>';
247
+			$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/statistics/airline-country</loc>';
248
+			$output .= '<lastmod>'.date("c", time()).'</lastmod>';
249
+			$output .= '<changefreq>daily</changefreq>';
250 250
 		$output .= '</url>';
251 251
 		$output .= '<url>';
252
-		    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/statistics/airport-departure</loc>';
253
-		    $output .= '<lastmod>'.date("c", time()).'</lastmod>';
254
-		    $output .= '<changefreq>daily</changefreq>';
252
+			$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/statistics/airport-departure</loc>';
253
+			$output .= '<lastmod>'.date("c", time()).'</lastmod>';
254
+			$output .= '<changefreq>daily</changefreq>';
255 255
 		$output .= '</url>';
256 256
 		$output .= '<url>';
257
-		    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/statistics/airport-departure-country</loc>';
258
-		    $output .= '<lastmod>'.date("c", time()).'</lastmod>';
259
-		    $output .= '<changefreq>daily</changefreq>';
257
+			$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/statistics/airport-departure-country</loc>';
258
+			$output .= '<lastmod>'.date("c", time()).'</lastmod>';
259
+			$output .= '<changefreq>daily</changefreq>';
260 260
 		$output .= '</url>';
261 261
 		$output .= '<url>';
262
-		    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/statistics/airport-arrival</loc>';
263
-		    $output .= '<lastmod>'.date("c", time()).'</lastmod>';
264
-		    $output .= '<changefreq>daily</changefreq>';
262
+			$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/statistics/airport-arrival</loc>';
263
+			$output .= '<lastmod>'.date("c", time()).'</lastmod>';
264
+			$output .= '<changefreq>daily</changefreq>';
265 265
 		$output .= '</url>';
266 266
 		$output .= '<url>';
267
-		    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/statistics/airport-arrival-country</loc>';
268
-		    $output .= '<lastmod>'.date("c", time()).'</lastmod>';
269
-		    $output .= '<changefreq>daily</changefreq>';
267
+			$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/statistics/airport-arrival-country</loc>';
268
+			$output .= '<lastmod>'.date("c", time()).'</lastmod>';
269
+			$output .= '<changefreq>daily</changefreq>';
270 270
 		$output .= '</url>';
271 271
 		$output .= '<url>';
272
-		    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/statistics/route-airport</loc>';
273
-		    $output .= '<lastmod>'.date("c", time()).'</lastmod>';
274
-		    $output .= '<changefreq>daily</changefreq>';
272
+			$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/statistics/route-airport</loc>';
273
+			$output .= '<lastmod>'.date("c", time()).'</lastmod>';
274
+			$output .= '<changefreq>daily</changefreq>';
275 275
 		$output .= '</url>';
276 276
 		$output .= '<url>';
277
-		    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/statistics/route-waypoint</loc>';
278
-		    $output .= '<lastmod>'.date("c", time()).'</lastmod>';
279
-		    $output .= '<changefreq>daily</changefreq>';
277
+			$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/statistics/route-waypoint</loc>';
278
+			$output .= '<lastmod>'.date("c", time()).'</lastmod>';
279
+			$output .= '<changefreq>daily</changefreq>';
280 280
 		$output .= '</url>';
281 281
 		$output .= '<url>';
282
-		    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/statistics/callsign</loc>';
283
-		    $output .= '<lastmod>'.date("c", time()).'</lastmod>';
284
-		    $output .= '<changefreq>daily</changefreq>';
282
+			$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/statistics/callsign</loc>';
283
+			$output .= '<lastmod>'.date("c", time()).'</lastmod>';
284
+			$output .= '<changefreq>daily</changefreq>';
285 285
 		$output .= '</url>';
286 286
 		$output .= '<url>';
287
-		    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/statistics/date</loc>';
288
-		    $output .= '<lastmod>'.date("c", time()).'</lastmod>';
289
-		    $output .= '<changefreq>daily</changefreq>';
287
+			$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/statistics/date</loc>';
288
+			$output .= '<lastmod>'.date("c", time()).'</lastmod>';
289
+			$output .= '<changefreq>daily</changefreq>';
290 290
 		$output .= '</url>';
291 291
 		$output .= '<url>';
292
-		    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/statistics/time</loc>';
293
-		    $output .= '<lastmod>'.date("c", time()).'</lastmod>';
294
-		    $output .= '<changefreq>daily</changefreq>';
292
+			$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/statistics/time</loc>';
293
+			$output .= '<lastmod>'.date("c", time()).'</lastmod>';
294
+			$output .= '<changefreq>daily</changefreq>';
295 295
 		$output .= '</url>';
296 296
 	$output .= '</urlset>';
297 297
 	
@@ -301,31 +301,31 @@  discard block
 block discarded – undo
301 301
 	$output .= '<?xml version="1.0" encoding="UTF-8"?>';
302 302
 	$output .= '<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">';
303 303
 		$output .= '<sitemap>';
304
-	    	$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/sitemap/static</loc>';
304
+			$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/sitemap/static</loc>';
305 305
 		$output .= '</sitemap>';
306 306
 		$output .= '<sitemap>';
307
-	    	$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/sitemap/flight</loc>';
307
+			$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/sitemap/flight</loc>';
308 308
 		$output .= '</sitemap>';
309 309
 		$output .= '<sitemap>';
310
-	    	$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/sitemap/aircraft</loc>';
310
+			$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/sitemap/aircraft</loc>';
311 311
 		$output .= '</sitemap>';
312 312
 		$output .= '<sitemap>';
313
-	    	$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/sitemap/registration</loc>';
313
+			$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/sitemap/registration</loc>';
314 314
 		$output .= '</sitemap>';
315 315
 		$output .= '<sitemap>';
316
-	    	$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/sitemap/airline</loc>';
316
+			$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/sitemap/airline</loc>';
317 317
 		$output .= '</sitemap>';
318 318
 		$output .= '<sitemap>';
319
-	    	$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/sitemap/airport</loc>';
319
+			$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/sitemap/airport</loc>';
320 320
 		$output .= '</sitemap>';
321 321
 		$output .= '<sitemap>';
322
-	    	$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/sitemap/manufacturer</loc>';
322
+			$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/sitemap/manufacturer</loc>';
323 323
 		$output .= '</sitemap>';
324 324
 		$output .= '<sitemap>';
325
-	    	$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/sitemap/country</loc>';
325
+			$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/sitemap/country</loc>';
326 326
 		$output .= '</sitemap>';
327 327
 		$output .= '<sitemap>';
328
-	    	$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/sitemap/ident</loc>';
328
+			$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/sitemap/ident</loc>';
329 329
 		$output .= '</sitemap>';
330 330
 		/*
331 331
 		$output .= '<sitemap>';
@@ -333,7 +333,7 @@  discard block
 block discarded – undo
333 333
 		$output .= '</sitemap>';
334 334
 		*/
335 335
 		$output .= '<sitemap>';
336
-	    	$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/sitemap/route</loc>';
336
+			$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/sitemap/route</loc>';
337 337
 		$output .= '</sitemap>';
338 338
 	$output .= '</sitemapindex>';
339 339
 	
Please login to merge, or discard this patch.
require/class.SpotterArchive.php 4 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@
 block discarded – undo
14 14
 	/**
15 15
 	* Get SQL query part for filter used
16 16
 	* @param Array $filter the filter
17
-	* @return Array the SQL part
17
+	* @return string the SQL part
18 18
 	*/
19 19
 	public function getFilter($filter = array(),$where = false,$and = false) {
20 20
 		global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver;
Please login to merge, or discard this patch.
Braces   +40 added lines, -14 removed lines patch added patch discarded remove patch
@@ -6,7 +6,9 @@  discard block
 block discarded – undo
6 6
 	public function __construct($dbc = null) {
7 7
 		$Connection = new Connection($dbc);
8 8
 		$this->db = $Connection->db;
9
-		if ($this->db === null) die('Error: No DB connection.');
9
+		if ($this->db === null) {
10
+			die('Error: No DB connection.');
11
+		}
10 12
 	}
11 13
 
12 14
 	/**
@@ -27,7 +29,9 @@  discard block
 block discarded – undo
27 29
 		if (isset($filter[0]['source'])) {
28 30
 			$filters = array_merge($filters,$filter);
29 31
 		}
30
-		if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter);
32
+		if (is_array($globalFilter)) {
33
+			$filter = array_merge($filter,$globalFilter);
34
+		}
31 35
 		$filter_query_join = '';
32 36
 		$filter_query_where = '';
33 37
 		foreach($filters as $flt) {
@@ -112,8 +116,11 @@  discard block
 block discarded – undo
112 116
 			}
113 117
 			$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output".preg_replace('/^ AND/',' WHERE',$filter_query_date).") sd ON sd.flightaware_id = spotter_archive_output.flightaware_id";
114 118
 		}
115
-		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
116
-		elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND';
119
+		if ($filter_query_where == '' && $where) {
120
+			$filter_query_where = ' WHERE';
121
+		} elseif ($filter_query_where != '' && $and) {
122
+			$filter_query_where .= ' AND';
123
+		}
117 124
 		if ($filter_query_where != '') {
118 125
 			$filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where);
119 126
 		}
@@ -127,10 +134,17 @@  discard block
 block discarded – undo
127 134
 		if ($over_country == '') {
128 135
 			$Spotter = new Spotter($this->db);
129 136
 			$data_country = $Spotter->getCountryFromLatitudeLongitude($latitude,$longitude);
130
-			if (!empty($data_country)) $country = $data_country['iso2'];
131
-			else $country = '';
132
-		} else $country = $over_country;
133
-		if ($airline_type === NULL) $airline_type ='';
137
+			if (!empty($data_country)) {
138
+				$country = $data_country['iso2'];
139
+			} else {
140
+				$country = '';
141
+			}
142
+		} else {
143
+			$country = $over_country;
144
+		}
145
+		if ($airline_type === NULL) {
146
+			$airline_type ='';
147
+		}
134 148
 	
135 149
 		//if ($country == '') echo "\n".'************ UNKNOW COUNTRY ****************'."\n";
136 150
 		//else echo "\n".'*/*/*/*/*/*/*/ Country : '.$country.' */*/*/*/*/*/*/*/*/'."\n";
@@ -626,7 +640,9 @@  discard block
 block discarded – undo
626 640
 		    $additional_query .= "(spotter_archive_output.pilot_name like '%".$q_item."%') OR ";
627 641
 		    $additional_query .= "(spotter_archive_output.ident like '%".$q_item."%') OR ";
628 642
 		    $translate = $Translation->ident2icao($q_item);
629
-		    if ($translate != $q_item) $additional_query .= "(spotter_archive_output.ident like '%".$translate."%') OR ";
643
+		    if ($translate != $q_item) {
644
+		    	$additional_query .= "(spotter_archive_output.ident like '%".$translate."%') OR ";
645
+		    }
630 646
 		    $additional_query .= "(spotter_archive_output.highlight like '%".$q_item."%')";
631 647
 		    $additional_query .= ")";
632 648
 		}
@@ -842,7 +858,9 @@  discard block
 block discarded – undo
842 858
 			date_default_timezone_set($globalTimezone);
843 859
 			$datetime = new DateTime();
844 860
 			$offset = $datetime->format('P');
845
-		} else $offset = '+00:00';
861
+		} else {
862
+			$offset = '+00:00';
863
+		}
846 864
 		if ($date_array[1] != "")
847 865
 		{                
848 866
 			$date_array[0] = date("Y-m-d H:i:s", strtotime($date_array[0]));
@@ -1108,9 +1126,13 @@  discard block
 block discarded – undo
1108 1126
 				$query .= "AND date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
1109 1127
 			}
1110 1128
 		}
1111
-                if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
1129
+                if ($sincedate != '') {
1130
+                	$query .= "AND date > '".$sincedate."' ";
1131
+                }
1112 1132
 	$query .= "GROUP BY c.name, c.iso3, c.iso2 ORDER BY nb DESC";
1113
-	if ($limit) $query .= " LIMIT 0,10";
1133
+	if ($limit) {
1134
+		$query .= " LIMIT 0,10";
1135
+	}
1114 1136
       
1115 1137
 	
1116 1138
 	$sth = $this->db->prepare($query);
@@ -1154,9 +1176,13 @@  discard block
 block discarded – undo
1154 1176
 				$query .= "AND s.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
1155 1177
 			}
1156 1178
 		}
1157
-                if ($sincedate != '') $query .= "AND s.date > '".$sincedate."' ";
1179
+                if ($sincedate != '') {
1180
+                	$query .= "AND s.date > '".$sincedate."' ";
1181
+                }
1158 1182
 	$query .= "GROUP BY o.airline_icao,c.name, c.iso3, c.iso2 ORDER BY nb DESC";
1159
-	if ($limit) $query .= " LIMIT 0,10";
1183
+	if ($limit) {
1184
+		$query .= " LIMIT 0,10";
1185
+	}
1160 1186
       
1161 1187
 	
1162 1188
 	$sth = $this->db->prepare($query);
Please login to merge, or discard this patch.
Indentation   +528 added lines, -528 removed lines patch added patch discarded remove patch
@@ -10,10 +10,10 @@  discard block
 block discarded – undo
10 10
 	}
11 11
 
12 12
 	/**
13
-	* Get SQL query part for filter used
14
-	* @param Array $filter the filter
15
-	* @return Array the SQL part
16
-	*/
13
+	 * Get SQL query part for filter used
14
+	 * @param Array $filter the filter
15
+	 * @return Array the SQL part
16
+	 */
17 17
 	public function getFilter($filter = array(),$where = false,$and = false) {
18 18
 		global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver;
19 19
 		$filters = array();
@@ -151,44 +151,44 @@  discard block
 block discarded – undo
151 151
 	}
152 152
 
153 153
 
154
-        /**
155
-        * Gets all the spotter information based on a particular callsign
156
-        *
157
-        * @return Array the spotter information
158
-        *
159
-        */
160
-        public function getLastArchiveSpotterDataByIdent($ident)
161
-        {
154
+		/**
155
+		 * Gets all the spotter information based on a particular callsign
156
+		 *
157
+		 * @return Array the spotter information
158
+		 *
159
+		 */
160
+		public function getLastArchiveSpotterDataByIdent($ident)
161
+		{
162 162
 		$Spotter = new Spotter($this->db);
163
-                date_default_timezone_set('UTC');
163
+				date_default_timezone_set('UTC');
164 164
 
165
-                $ident = filter_var($ident, FILTER_SANITIZE_STRING);
166
-                //$query  = "SELECT spotter_archive.* FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate LIMIT 1";
167
-                $query  = "SELECT spotter_archive.* FROM spotter_archive WHERE ident = :ident ORDER BY date DESC LIMIT 1";
165
+				$ident = filter_var($ident, FILTER_SANITIZE_STRING);
166
+				//$query  = "SELECT spotter_archive.* FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate LIMIT 1";
167
+				$query  = "SELECT spotter_archive.* FROM spotter_archive WHERE ident = :ident ORDER BY date DESC LIMIT 1";
168 168
 
169
-                $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident));
169
+				$spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident));
170 170
 
171
-                return $spotter_array;
172
-        }
171
+				return $spotter_array;
172
+		}
173 173
 
174 174
 
175
-        /**
176
-        * Gets last the spotter information based on a particular id
177
-        *
178
-        * @return Array the spotter information
179
-        *
180
-        */
181
-        public function getLastArchiveSpotterDataById($id)
182
-        {
183
-    		$Spotter = new Spotter($this->db);
184
-                date_default_timezone_set('UTC');
185
-                $id = filter_var($id, FILTER_SANITIZE_STRING);
186
-                //$query  = SpotterArchive->$global_query." WHERE spotter_archive.flightaware_id = :id";
187
-                //$query  = "SELECT spotter_archive.* FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.flightaware_id = :id GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate LIMIT 1";
188
-                $query  = "SELECT * FROM spotter_archive WHERE flightaware_id = :id ORDER BY date DESC LIMIT 1";
175
+		/**
176
+		 * Gets last the spotter information based on a particular id
177
+		 *
178
+		 * @return Array the spotter information
179
+		 *
180
+		 */
181
+		public function getLastArchiveSpotterDataById($id)
182
+		{
183
+			$Spotter = new Spotter($this->db);
184
+				date_default_timezone_set('UTC');
185
+				$id = filter_var($id, FILTER_SANITIZE_STRING);
186
+				//$query  = SpotterArchive->$global_query." WHERE spotter_archive.flightaware_id = :id";
187
+				//$query  = "SELECT spotter_archive.* FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.flightaware_id = :id GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate LIMIT 1";
188
+				$query  = "SELECT * FROM spotter_archive WHERE flightaware_id = :id ORDER BY date DESC LIMIT 1";
189 189
 
190 190
 //              $spotter_array = Spotter->getDataFromDB($query,array(':id' => $id));
191
-                  /*
191
+				  /*
192 192
                 try {
193 193
                         $Connection = new Connection();
194 194
                         $sth = Connection->$db->prepare($query);
@@ -198,122 +198,122 @@  discard block
 block discarded – undo
198 198
                 }
199 199
                 $spotter_array = $sth->fetchAll(PDO->FETCH_ASSOC);
200 200
                 */
201
-                $spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id));
202
-
203
-                return $spotter_array;
204
-        }
205
-
206
-        /**
207
-        * Gets all the spotter information based on a particular id
208
-        *
209
-        * @return Array the spotter information
210
-        *
211
-        */
212
-        public function getAllArchiveSpotterDataById($id)
201
+				$spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id));
202
+
203
+				return $spotter_array;
204
+		}
205
+
206
+		/**
207
+		 * Gets all the spotter information based on a particular id
208
+		 *
209
+		 * @return Array the spotter information
210
+		 *
211
+		 */
212
+		public function getAllArchiveSpotterDataById($id)
213 213
 	{
214
-                date_default_timezone_set('UTC');
215
-                $id = filter_var($id, FILTER_SANITIZE_STRING);
216
-                $query  = $this->global_query." WHERE spotter_archive.flightaware_id = :id ORDER BY date";
214
+				date_default_timezone_set('UTC');
215
+				$id = filter_var($id, FILTER_SANITIZE_STRING);
216
+				$query  = $this->global_query." WHERE spotter_archive.flightaware_id = :id ORDER BY date";
217 217
 
218 218
 //              $spotter_array = Spotter->getDataFromDB($query,array(':id' => $id));
219 219
 
220
-                try {
221
-                        $sth = $this->db->prepare($query);
222
-                        $sth->execute(array(':id' => $id));
223
-                } catch(PDOException $e) {
224
-                        echo $e->getMessage();
225
-                        die;
226
-                }
227
-                $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
228
-
229
-                return $spotter_array;
230
-        }
231
-
232
-        /**
233
-        * Gets coordinate & time spotter information based on a particular id
234
-        *
235
-        * @return Array the spotter information
236
-        *
237
-        */
238
-        public function getCoordArchiveSpotterDataById($id)
239
-        {
240
-                date_default_timezone_set('UTC');
241
-                $id = filter_var($id, FILTER_SANITIZE_STRING);
242
-                $query  = "SELECT spotter_archive.latitude, spotter_archive.longitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id";
220
+				try {
221
+						$sth = $this->db->prepare($query);
222
+						$sth->execute(array(':id' => $id));
223
+				} catch(PDOException $e) {
224
+						echo $e->getMessage();
225
+						die;
226
+				}
227
+				$spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
228
+
229
+				return $spotter_array;
230
+		}
231
+
232
+		/**
233
+		 * Gets coordinate & time spotter information based on a particular id
234
+		 *
235
+		 * @return Array the spotter information
236
+		 *
237
+		 */
238
+		public function getCoordArchiveSpotterDataById($id)
239
+		{
240
+				date_default_timezone_set('UTC');
241
+				$id = filter_var($id, FILTER_SANITIZE_STRING);
242
+				$query  = "SELECT spotter_archive.latitude, spotter_archive.longitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id";
243 243
 
244 244
 //              $spotter_array = Spotter->getDataFromDB($query,array(':id' => $id));
245 245
 
246
-                try {
247
-                        $sth = $this->db->prepare($query);
248
-                        $sth->execute(array(':id' => $id));
249
-                } catch(PDOException $e) {
250
-                        echo $e->getMessage();
251
-                        die;
252
-                }
253
-                $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
246
+				try {
247
+						$sth = $this->db->prepare($query);
248
+						$sth->execute(array(':id' => $id));
249
+				} catch(PDOException $e) {
250
+						echo $e->getMessage();
251
+						die;
252
+				}
253
+				$spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
254 254
 
255
-                return $spotter_array;
256
-        }
255
+				return $spotter_array;
256
+		}
257 257
 
258 258
 
259
-        /**
260
-        * Gets altitude information based on a particular callsign
261
-        *
262
-        * @return Array the spotter information
263
-        *
264
-        */
265
-        public function getAltitudeArchiveSpotterDataByIdent($ident)
266
-        {
259
+		/**
260
+		 * Gets altitude information based on a particular callsign
261
+		 *
262
+		 * @return Array the spotter information
263
+		 *
264
+		 */
265
+		public function getAltitudeArchiveSpotterDataByIdent($ident)
266
+		{
267 267
 
268
-                date_default_timezone_set('UTC');
268
+				date_default_timezone_set('UTC');
269 269
 
270
-                $ident = filter_var($ident, FILTER_SANITIZE_STRING);
271
-                $query  = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.ident = :ident AND spotter_archive.latitude <> 0 AND spotter_archive.longitude <> 0 ORDER BY date";
270
+				$ident = filter_var($ident, FILTER_SANITIZE_STRING);
271
+				$query  = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.ident = :ident AND spotter_archive.latitude <> 0 AND spotter_archive.longitude <> 0 ORDER BY date";
272 272
 
273
-                try {
274
-                        $sth = $this->db->prepare($query);
275
-                        $sth->execute(array(':ident' => $ident));
276
-                } catch(PDOException $e) {
277
-                        echo $e->getMessage();
278
-                        die;
279
-                }
280
-                $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
273
+				try {
274
+						$sth = $this->db->prepare($query);
275
+						$sth->execute(array(':ident' => $ident));
276
+				} catch(PDOException $e) {
277
+						echo $e->getMessage();
278
+						die;
279
+				}
280
+				$spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
281 281
 
282
-                return $spotter_array;
283
-        }
282
+				return $spotter_array;
283
+		}
284 284
 
285
-        /**
286
-        * Gets altitude information based on a particular id
287
-        *
288
-        * @return Array the spotter information
289
-        *
290
-        */
291
-        public function getAltitudeArchiveSpotterDataById($id)
292
-        {
285
+		/**
286
+		 * Gets altitude information based on a particular id
287
+		 *
288
+		 * @return Array the spotter information
289
+		 *
290
+		 */
291
+		public function getAltitudeArchiveSpotterDataById($id)
292
+		{
293 293
 
294
-                date_default_timezone_set('UTC');
294
+				date_default_timezone_set('UTC');
295 295
 
296
-                $id = filter_var($id, FILTER_SANITIZE_STRING);
297
-                $query  = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id AND spotter_archive.latitude <> 0 AND spotter_archive.longitude <> 0 ORDER BY date";
296
+				$id = filter_var($id, FILTER_SANITIZE_STRING);
297
+				$query  = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id AND spotter_archive.latitude <> 0 AND spotter_archive.longitude <> 0 ORDER BY date";
298 298
 
299
-                try {
300
-                        $sth = $this->db->prepare($query);
301
-                        $sth->execute(array(':id' => $id));
302
-                } catch(PDOException $e) {
303
-                        echo $e->getMessage();
304
-                        die;
305
-                }
306
-                $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
299
+				try {
300
+						$sth = $this->db->prepare($query);
301
+						$sth->execute(array(':id' => $id));
302
+				} catch(PDOException $e) {
303
+						echo $e->getMessage();
304
+						die;
305
+				}
306
+				$spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
307 307
 
308
-                return $spotter_array;
309
-        }
308
+				return $spotter_array;
309
+		}
310 310
 
311
-        /**
312
-        * Gets altitude & speed information based on a particular id
313
-        *
314
-        * @return Array the spotter information
315
-        *
316
-        */
311
+		/**
312
+		 * Gets altitude & speed information based on a particular id
313
+		 *
314
+		 * @return Array the spotter information
315
+		 *
316
+		 */
317 317
 	public function getAltitudeSpeedArchiveSpotterDataById($id)
318 318
 	{
319 319
 		date_default_timezone_set('UTC');
@@ -330,12 +330,12 @@  discard block
 block discarded – undo
330 330
 		return $spotter_array;
331 331
 	}
332 332
 
333
-        /**
334
-        * Gets altitude information based on a particular callsign
335
-        *
336
-        * @return Array the spotter information
337
-        *
338
-        */
333
+		/**
334
+		 * Gets altitude information based on a particular callsign
335
+		 *
336
+		 * @return Array the spotter information
337
+		 *
338
+		 */
339 339
 	public function getLastAltitudeArchiveSpotterDataByIdent($ident)
340 340
 	{
341 341
 		date_default_timezone_set('UTC');
@@ -355,12 +355,12 @@  discard block
 block discarded – undo
355 355
 
356 356
 
357 357
 
358
-       /**
359
-        * Gets all the archive spotter information
360
-        *
361
-        * @return Array the spotter information
362
-        *
363
-        */
358
+	   /**
359
+	    * Gets all the archive spotter information
360
+	    *
361
+	    * @return Array the spotter information
362
+	    *
363
+	    */
364 364
 	public function getSpotterArchiveData($ident,$flightaware_id,$date)
365 365
 	{
366 366
 		$Spotter = new Spotter($this->db);
@@ -388,34 +388,34 @@  discard block
 block discarded – undo
388 388
 	}
389 389
 
390 390
 	/**
391
-        * Gets Minimal Live Spotter data
392
-        *
393
-        * @return Array the spotter information
394
-        *
395
-        */
396
-        public function getMinLiveSpotterData($begindate,$enddate,$filter = array())
397
-        {
398
-                global $globalDBdriver, $globalLiveInterval;
399
-                date_default_timezone_set('UTC');
400
-
401
-                $filter_query = '';
402
-                if (isset($filter['source']) && !empty($filter['source'])) {
403
-                        $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') ";
404
-                }
405
-                // Use spotter_output also ?
406
-                if (isset($filter['airlines']) && !empty($filter['airlines'])) {
407
-                        $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id ";
408
-                }
409
-                if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
410
-                        $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_archive.flightaware_id ";
411
-                }
412
-                if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
413
-                        $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
414
-                }
391
+	 * Gets Minimal Live Spotter data
392
+	 *
393
+	 * @return Array the spotter information
394
+	 *
395
+	 */
396
+		public function getMinLiveSpotterData($begindate,$enddate,$filter = array())
397
+		{
398
+				global $globalDBdriver, $globalLiveInterval;
399
+				date_default_timezone_set('UTC');
400
+
401
+				$filter_query = '';
402
+				if (isset($filter['source']) && !empty($filter['source'])) {
403
+						$filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') ";
404
+				}
405
+				// Use spotter_output also ?
406
+				if (isset($filter['airlines']) && !empty($filter['airlines'])) {
407
+						$filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id ";
408
+				}
409
+				if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
410
+						$filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_archive.flightaware_id ";
411
+				}
412
+				if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
413
+						$filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
414
+				}
415 415
 
416
-                //if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
417
-                if ($globalDBdriver == 'mysql') {
418
-                        /*
416
+				//if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
417
+				if ($globalDBdriver == 'mysql') {
418
+						/*
419 419
                         $query  = 'SELECT a.aircraft_shadow, spotter_archive.ident, spotter_archive.flightaware_id, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk 
420 420
                     		    FROM spotter_archive 
421 421
                     		    INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE (l.date BETWEEN '."'".$begindate."'".' AND '."'".$enddate."'".') GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate '.$filter_query.'LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON spotter_archive.aircraft_icao = a.icao';
@@ -434,56 +434,56 @@  discard block
 block discarded – undo
434 434
 				    INNER JOIN (SELECT * FROM aircraft) a on spotter_archive.aircraft_icao = a.icao
435 435
 				    WHERE spotter_archive.date BETWEEN '."'".$begindate."'".' AND '."'".$begindate."'".' 
436 436
                         	    '.$filter_query.' ORDER BY flightaware_id';
437
-                } else {
438
-                        //$query  = 'SELECT spotter_archive.ident, spotter_archive.flightaware_id, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, a.aircraft_shadow FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate '.$filter_query.'INNER JOIN (SELECT * FROM aircraft) a on spotter_archive.aircraft_icao = a.icao';
439
-                        $query  = 'SELECT spotter_archive.date,spotter_archive.flightaware_id, spotter_archive.ident, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, a.aircraft_shadow,a.engine_type, a.engine_count, a.wake_category 
437
+				} else {
438
+						//$query  = 'SELECT spotter_archive.ident, spotter_archive.flightaware_id, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, a.aircraft_shadow FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate '.$filter_query.'INNER JOIN (SELECT * FROM aircraft) a on spotter_archive.aircraft_icao = a.icao';
439
+						$query  = 'SELECT spotter_archive.date,spotter_archive.flightaware_id, spotter_archive.ident, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, a.aircraft_shadow,a.engine_type, a.engine_count, a.wake_category 
440 440
                         	    FROM spotter_archive 
441 441
                         	    INNER JOIN (SELECT * FROM aircraft) a on spotter_archive.aircraft_icao = a.icao
442 442
                         	    WHERE spotter_archive.date >= '."'".$begindate."'".' AND spotter_archive.date <= '."'".$enddate."'".'
443 443
                         	    '.$filter_query.' ORDER BY flightaware_id';
444
-                }
445
-                //echo $query;
446
-                try {
447
-                        $sth = $this->db->prepare($query);
448
-                        $sth->execute();
449
-                } catch(PDOException $e) {
450
-                        echo $e->getMessage();
451
-                        die;
452
-                }
453
-                $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
444
+				}
445
+				//echo $query;
446
+				try {
447
+						$sth = $this->db->prepare($query);
448
+						$sth->execute();
449
+				} catch(PDOException $e) {
450
+						echo $e->getMessage();
451
+						die;
452
+				}
453
+				$spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
454 454
 
455
-                return $spotter_array;
456
-        }
455
+				return $spotter_array;
456
+		}
457 457
 
458 458
 	/**
459
-        * Gets Minimal Live Spotter data
460
-        *
461
-        * @return Array the spotter information
462
-        *
463
-        */
464
-        public function getMinLiveSpotterDataPlayback($begindate,$enddate,$filter = array())
465
-        {
466
-                global $globalDBdriver, $globalLiveInterval;
467
-                date_default_timezone_set('UTC');
468
-
469
-                $filter_query = '';
470
-                if (isset($filter['source']) && !empty($filter['source'])) {
471
-                        $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') ";
472
-                }
473
-                // Should use spotter_output also ?
474
-                if (isset($filter['airlines']) && !empty($filter['airlines'])) {
475
-                        $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id ";
476
-                }
477
-                if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
478
-                        $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_archive.flightaware_id ";
479
-                }
480
-                if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
481
-                        $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
482
-                }
459
+	 * Gets Minimal Live Spotter data
460
+	 *
461
+	 * @return Array the spotter information
462
+	 *
463
+	 */
464
+		public function getMinLiveSpotterDataPlayback($begindate,$enddate,$filter = array())
465
+		{
466
+				global $globalDBdriver, $globalLiveInterval;
467
+				date_default_timezone_set('UTC');
468
+
469
+				$filter_query = '';
470
+				if (isset($filter['source']) && !empty($filter['source'])) {
471
+						$filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') ";
472
+				}
473
+				// Should use spotter_output also ?
474
+				if (isset($filter['airlines']) && !empty($filter['airlines'])) {
475
+						$filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id ";
476
+				}
477
+				if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
478
+						$filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_archive.flightaware_id ";
479
+				}
480
+				if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
481
+						$filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
482
+				}
483 483
 
484
-                //if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
485
-                if ($globalDBdriver == 'mysql') {
486
-                        /*
484
+				//if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
485
+				if ($globalDBdriver == 'mysql') {
486
+						/*
487 487
                         $query  = 'SELECT a.aircraft_shadow, spotter_archive.ident, spotter_archive.flightaware_id, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk 
488 488
                     		    FROM spotter_archive 
489 489
                     		    INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE (l.date BETWEEN '."'".$begindate."'".' AND '."'".$enddate."'".') GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate '.$filter_query.'LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON spotter_archive.aircraft_icao = a.icao';
@@ -494,95 +494,95 @@  discard block
 block discarded – undo
494 494
 				    WHERE (spotter_archive_output.date BETWEEN '."'".$begindate."'".' AND '."'".$enddate."'".') 
495 495
                         	    '.$filter_query.' GROUP BY spotter_archive_output.flightaware_id, spotter_archive_output.ident, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao, spotter_archive_output.arrival_airport_icao, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk, a.aircraft_shadow';
496 496
 
497
-                } else {
498
-                        //$query  = 'SELECT spotter_archive_output.ident, spotter_archive_output.flightaware_id, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao as departure_airport, spotter_archive_output.arrival_airport_icao as arrival_airport, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk, a.aircraft_shadow FROM spotter_archive_output INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive_output l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_archive_output.flightaware_id = s.flightaware_id AND spotter_archive_output.date = s.maxdate '.$filter_query.'INNER JOIN (SELECT * FROM aircraft) a on spotter_archive_output.aircraft_icao = a.icao';
499
-                       /*
497
+				} else {
498
+						//$query  = 'SELECT spotter_archive_output.ident, spotter_archive_output.flightaware_id, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao as departure_airport, spotter_archive_output.arrival_airport_icao as arrival_airport, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk, a.aircraft_shadow FROM spotter_archive_output INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive_output l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_archive_output.flightaware_id = s.flightaware_id AND spotter_archive_output.date = s.maxdate '.$filter_query.'INNER JOIN (SELECT * FROM aircraft) a on spotter_archive_output.aircraft_icao = a.icao';
499
+					   /*
500 500
                         $query  = 'SELECT spotter_archive_output.ident, spotter_archive_output.flightaware_id, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao as departure_airport, spotter_archive_output.arrival_airport_icao as arrival_airport, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk, a.aircraft_shadow
501 501
                         	    FROM spotter_archive_output 
502 502
                         	    INNER JOIN (SELECT * FROM aircraft) a on spotter_archive_output.aircraft_icao = a.icao
503 503
                         	    WHERE spotter_archive_output.date >= '."'".$begindate."'".' AND spotter_archive_output.date <= '."'".$enddate."'".'
504 504
                         	    '.$filter_query.' GROUP BY spotter_archive_output.flightaware_id, spotter_archive_output.ident, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao, spotter_archive_output.arrival_airport_icao, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk, a.aircraft_shadow';
505 505
                         */
506
-                        $query  = 'SELECT DISTINCT spotter_archive_output.flightaware_id, spotter_archive_output.ident, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao as departure_airport, spotter_archive_output.arrival_airport_icao as arrival_airport, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk, a.aircraft_shadow
506
+						$query  = 'SELECT DISTINCT spotter_archive_output.flightaware_id, spotter_archive_output.ident, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao as departure_airport, spotter_archive_output.arrival_airport_icao as arrival_airport, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk, a.aircraft_shadow
507 507
                         	    FROM spotter_archive_output 
508 508
                         	    INNER JOIN (SELECT * FROM aircraft) a on spotter_archive_output.aircraft_icao = a.icao
509 509
                         	    WHERE spotter_archive_output.date >= '."'".$begindate."'".' AND spotter_archive_output.date <= '."'".$enddate."'".'
510 510
                         	    '.$filter_query.' LIMIT 200 OFFSET 0';
511 511
 //                        	    .' GROUP BY spotter_output.flightaware_id, spotter_output.ident, spotter_output.aircraft_icao, spotter_output.departure_airport_icao, spotter_output.arrival_airport_icao, spotter_output.latitude, spotter_output.longitude, spotter_output.altitude, spotter_output.heading, spotter_output.ground_speed, spotter_output.squawk, a.aircraft_shadow';
512 512
                         	    
513
-                }
514
-                //echo $query;
515
-                try {
516
-                        $sth = $this->db->prepare($query);
517
-                        $sth->execute();
518
-                } catch(PDOException $e) {
519
-                        echo $e->getMessage();
520
-                        die;
521
-                }
522
-                $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
513
+				}
514
+				//echo $query;
515
+				try {
516
+						$sth = $this->db->prepare($query);
517
+						$sth->execute();
518
+				} catch(PDOException $e) {
519
+						echo $e->getMessage();
520
+						die;
521
+				}
522
+				$spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
523 523
 
524
-                return $spotter_array;
525
-        }
524
+				return $spotter_array;
525
+		}
526 526
 
527 527
 	 /**
528
-        * Gets count Live Spotter data
529
-        *
530
-        * @return Array the spotter information
531
-        *
532
-        */
533
-        public function getLiveSpotterCount($begindate,$enddate,$filter = array())
534
-        {
535
-                global $globalDBdriver, $globalLiveInterval;
536
-                date_default_timezone_set('UTC');
537
-
538
-                $filter_query = '';
539
-                if (isset($filter['source']) && !empty($filter['source'])) {
540
-                        $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') ";
541
-                }
542
-                if (isset($filter['airlines']) && !empty($filter['airlines'])) {
543
-                        $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id ";
544
-                }
545
-                if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
546
-                        $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_archive.flightaware_id ";
547
-                }
548
-                if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
549
-                        $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
550
-                }
528
+	  * Gets count Live Spotter data
529
+	  *
530
+	  * @return Array the spotter information
531
+	  *
532
+	  */
533
+		public function getLiveSpotterCount($begindate,$enddate,$filter = array())
534
+		{
535
+				global $globalDBdriver, $globalLiveInterval;
536
+				date_default_timezone_set('UTC');
551 537
 
552
-                //if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
553
-                if ($globalDBdriver == 'mysql') {
538
+				$filter_query = '';
539
+				if (isset($filter['source']) && !empty($filter['source'])) {
540
+						$filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') ";
541
+				}
542
+				if (isset($filter['airlines']) && !empty($filter['airlines'])) {
543
+						$filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id ";
544
+				}
545
+				if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
546
+						$filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_archive.flightaware_id ";
547
+				}
548
+				if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
549
+						$filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
550
+				}
551
+
552
+				//if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
553
+				if ($globalDBdriver == 'mysql') {
554 554
 			$query = 'SELECT COUNT(DISTINCT flightaware_id) as nb 
555 555
 			FROM spotter_archive l 
556 556
 			WHERE (l.date BETWEEN DATE_SUB('."'".$begindate."'".',INTERVAL '.$globalLiveInterval.' SECOND) AND '."'".$begindate."'".')'.$filter_query;
557
-                } else {
557
+				} else {
558 558
 			$query = 'SELECT COUNT(DISTINCT flightaware_id) as nb FROM spotter_archive l WHERE (l.date BETWEEN '."'".$begindate."' - INTERVAL '".$globalLiveInterval." SECONDS' AND "."'".$enddate."'".')'.$filter_query;
559
-                }
560
-                //echo $query;
561
-                try {
562
-                        $sth = $this->db->prepare($query);
563
-                        $sth->execute();
564
-                } catch(PDOException $e) {
565
-                        echo $e->getMessage();
566
-                        die;
567
-                }
559
+				}
560
+				//echo $query;
561
+				try {
562
+						$sth = $this->db->prepare($query);
563
+						$sth->execute();
564
+				} catch(PDOException $e) {
565
+						echo $e->getMessage();
566
+						die;
567
+				}
568 568
 		$result = $sth->fetch(PDO::FETCH_ASSOC);
569 569
 		$sth->closeCursor();
570
-                return $result['nb'];
570
+				return $result['nb'];
571 571
 
572
-        }
572
+		}
573 573
 
574 574
 
575 575
 
576 576
 	// Spotter_Archive_output
577 577
 	
578
-    /**
579
-    * Gets all the spotter information
580
-    *
581
-    * @return Array the spotter information
582
-    *
583
-    */
584
-    public function searchSpotterData($q = '', $registration = '', $aircraft_icao = '', $aircraft_manufacturer = '', $highlights = '', $airline_icao = '', $airline_country = '', $airline_type = '', $airport = '', $airport_country = '', $callsign = '', $departure_airport_route = '', $arrival_airport_route = '', $owner = '',$pilot_id = '',$pilot_name = '',$altitude = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '',$origLat = '',$origLon = '',$dist = '', $filters=array())
585
-    {
578
+	/**
579
+	 * Gets all the spotter information
580
+	 *
581
+	 * @return Array the spotter information
582
+	 *
583
+	 */
584
+	public function searchSpotterData($q = '', $registration = '', $aircraft_icao = '', $aircraft_manufacturer = '', $highlights = '', $airline_icao = '', $airline_country = '', $airline_type = '', $airport = '', $airport_country = '', $callsign = '', $departure_airport_route = '', $arrival_airport_route = '', $owner = '',$pilot_id = '',$pilot_name = '',$altitude = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '',$origLat = '',$origLon = '',$dist = '', $filters=array())
585
+	{
586 586
 	global $globalTimezone, $globalDBdriver;
587 587
 	require_once(dirname(__FILE__).'/class.Translation.php');
588 588
 	$Translation = new Translation($this->db);
@@ -596,159 +596,159 @@  discard block
 block discarded – undo
596 596
 	$filter_query = $this->getFilter($filters);
597 597
 	if ($q != "")
598 598
 	{
599
-	    if (!is_string($q))
600
-	    {
599
+		if (!is_string($q))
600
+		{
601 601
 		return false;
602
-	    } else {
602
+		} else {
603 603
 	        
604 604
 		$q_array = explode(" ", $q);
605 605
 		
606 606
 		foreach ($q_array as $q_item){
607
-		    $additional_query .= " AND (";
608
-		    $additional_query .= "(spotter_archive_output.spotter_id like '%".$q_item."%') OR ";
609
-		    $additional_query .= "(spotter_archive_output.aircraft_icao like '%".$q_item."%') OR ";
610
-		    $additional_query .= "(spotter_archive_output.aircraft_name like '%".$q_item."%') OR ";
611
-		    $additional_query .= "(spotter_archive_output.aircraft_manufacturer like '%".$q_item."%') OR ";
612
-		    $additional_query .= "(spotter_archive_output.airline_icao like '%".$q_item."%') OR ";
613
-		    $additional_query .= "(spotter_archive_output.airline_name like '%".$q_item."%') OR ";
614
-		    $additional_query .= "(spotter_archive_output.airline_country like '%".$q_item."%') OR ";
615
-		    $additional_query .= "(spotter_archive_output.departure_airport_icao like '%".$q_item."%') OR ";
616
-		    $additional_query .= "(spotter_archive_output.departure_airport_name like '%".$q_item."%') OR ";
617
-		    $additional_query .= "(spotter_archive_output.departure_airport_city like '%".$q_item."%') OR ";
618
-		    $additional_query .= "(spotter_archive_output.departure_airport_country like '%".$q_item."%') OR ";
619
-		    $additional_query .= "(spotter_archive_output.arrival_airport_icao like '%".$q_item."%') OR ";
620
-		    $additional_query .= "(spotter_archive_output.arrival_airport_name like '%".$q_item."%') OR ";
621
-		    $additional_query .= "(spotter_archive_output.arrival_airport_city like '%".$q_item."%') OR ";
622
-		    $additional_query .= "(spotter_archive_output.arrival_airport_country like '%".$q_item."%') OR ";
623
-		    $additional_query .= "(spotter_archive_output.registration like '%".$q_item."%') OR ";
624
-		    $additional_query .= "(spotter_archive_output.owner_name like '%".$q_item."%') OR ";
625
-		    $additional_query .= "(spotter_archive_output.pilot_id like '%".$q_item."%') OR ";
626
-		    $additional_query .= "(spotter_archive_output.pilot_name like '%".$q_item."%') OR ";
627
-		    $additional_query .= "(spotter_archive_output.ident like '%".$q_item."%') OR ";
628
-		    $translate = $Translation->ident2icao($q_item);
629
-		    if ($translate != $q_item) $additional_query .= "(spotter_archive_output.ident like '%".$translate."%') OR ";
630
-		    $additional_query .= "(spotter_archive_output.highlight like '%".$q_item."%')";
631
-		    $additional_query .= ")";
607
+			$additional_query .= " AND (";
608
+			$additional_query .= "(spotter_archive_output.spotter_id like '%".$q_item."%') OR ";
609
+			$additional_query .= "(spotter_archive_output.aircraft_icao like '%".$q_item."%') OR ";
610
+			$additional_query .= "(spotter_archive_output.aircraft_name like '%".$q_item."%') OR ";
611
+			$additional_query .= "(spotter_archive_output.aircraft_manufacturer like '%".$q_item."%') OR ";
612
+			$additional_query .= "(spotter_archive_output.airline_icao like '%".$q_item."%') OR ";
613
+			$additional_query .= "(spotter_archive_output.airline_name like '%".$q_item."%') OR ";
614
+			$additional_query .= "(spotter_archive_output.airline_country like '%".$q_item."%') OR ";
615
+			$additional_query .= "(spotter_archive_output.departure_airport_icao like '%".$q_item."%') OR ";
616
+			$additional_query .= "(spotter_archive_output.departure_airport_name like '%".$q_item."%') OR ";
617
+			$additional_query .= "(spotter_archive_output.departure_airport_city like '%".$q_item."%') OR ";
618
+			$additional_query .= "(spotter_archive_output.departure_airport_country like '%".$q_item."%') OR ";
619
+			$additional_query .= "(spotter_archive_output.arrival_airport_icao like '%".$q_item."%') OR ";
620
+			$additional_query .= "(spotter_archive_output.arrival_airport_name like '%".$q_item."%') OR ";
621
+			$additional_query .= "(spotter_archive_output.arrival_airport_city like '%".$q_item."%') OR ";
622
+			$additional_query .= "(spotter_archive_output.arrival_airport_country like '%".$q_item."%') OR ";
623
+			$additional_query .= "(spotter_archive_output.registration like '%".$q_item."%') OR ";
624
+			$additional_query .= "(spotter_archive_output.owner_name like '%".$q_item."%') OR ";
625
+			$additional_query .= "(spotter_archive_output.pilot_id like '%".$q_item."%') OR ";
626
+			$additional_query .= "(spotter_archive_output.pilot_name like '%".$q_item."%') OR ";
627
+			$additional_query .= "(spotter_archive_output.ident like '%".$q_item."%') OR ";
628
+			$translate = $Translation->ident2icao($q_item);
629
+			if ($translate != $q_item) $additional_query .= "(spotter_archive_output.ident like '%".$translate."%') OR ";
630
+			$additional_query .= "(spotter_archive_output.highlight like '%".$q_item."%')";
631
+			$additional_query .= ")";
632
+		}
632 633
 		}
633
-	    }
634 634
 	}
635 635
 	
636 636
 	if ($registration != "")
637 637
 	{
638
-	    $registration = filter_var($registration,FILTER_SANITIZE_STRING);
639
-	    if (!is_string($registration))
640
-	    {
638
+		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
639
+		if (!is_string($registration))
640
+		{
641 641
 		return false;
642
-	    } else {
642
+		} else {
643 643
 		$additional_query .= " AND (spotter_archive_output.registration = '".$registration."')";
644
-	    }
644
+		}
645 645
 	}
646 646
 	
647 647
 	if ($aircraft_icao != "")
648 648
 	{
649
-	    $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
650
-	    if (!is_string($aircraft_icao))
651
-	    {
649
+		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
650
+		if (!is_string($aircraft_icao))
651
+		{
652 652
 		return false;
653
-	    } else {
653
+		} else {
654 654
 		$additional_query .= " AND (spotter_archive_output.aircraft_icao = '".$aircraft_icao."')";
655
-	    }
655
+		}
656 656
 	}
657 657
 	
658 658
 	if ($aircraft_manufacturer != "")
659 659
 	{
660
-	    $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
661
-	    if (!is_string($aircraft_manufacturer))
662
-	    {
660
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
661
+		if (!is_string($aircraft_manufacturer))
662
+		{
663 663
 		return false;
664
-	    } else {
664
+		} else {
665 665
 		$additional_query .= " AND (spotter_archive_output.aircraft_manufacturer = '".$aircraft_manufacturer."')";
666
-	    }
666
+		}
667 667
 	}
668 668
 	
669 669
 	if ($highlights == "true")
670 670
 	{
671
-	    if (!is_string($highlights))
672
-	    {
671
+		if (!is_string($highlights))
672
+		{
673 673
 		return false;
674
-	    } else {
674
+		} else {
675 675
 		$additional_query .= " AND (spotter_archive_output.highlight <> '')";
676
-	    }
676
+		}
677 677
 	}
678 678
 	
679 679
 	if ($airline_icao != "")
680 680
 	{
681
-	    $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
682
-	    if (!is_string($airline_icao))
683
-	    {
681
+		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
682
+		if (!is_string($airline_icao))
683
+		{
684 684
 		return false;
685
-	    } else {
685
+		} else {
686 686
 		$additional_query .= " AND (spotter_archive_output.airline_icao = '".$airline_icao."')";
687
-	    }
687
+		}
688 688
 	}
689 689
 	
690 690
 	if ($airline_country != "")
691 691
 	{
692
-	    $airline_country = filter_var($airline_country,FILTER_SANITIZE_STRING);
693
-	    if (!is_string($airline_country))
694
-	    {
692
+		$airline_country = filter_var($airline_country,FILTER_SANITIZE_STRING);
693
+		if (!is_string($airline_country))
694
+		{
695 695
 		return false;
696
-	    } else {
696
+		} else {
697 697
 		$additional_query .= " AND (spotter_archive_output.airline_country = '".$airline_country."')";
698
-	    }
698
+		}
699 699
 	}
700 700
 	
701 701
 	if ($airline_type != "")
702 702
 	{
703
-	    $airline_type = filter_var($airline_type,FILTER_SANITIZE_STRING);
704
-	    if (!is_string($airline_type))
705
-	    {
703
+		$airline_type = filter_var($airline_type,FILTER_SANITIZE_STRING);
704
+		if (!is_string($airline_type))
705
+		{
706 706
 		return false;
707
-	    } else {
707
+		} else {
708 708
 		if ($airline_type == "passenger")
709 709
 		{
710
-		    $additional_query .= " AND (spotter_archive_output.airline_type = 'passenger')";
710
+			$additional_query .= " AND (spotter_archive_output.airline_type = 'passenger')";
711 711
 		}
712 712
 		if ($airline_type == "cargo")
713 713
 		{
714
-		    $additional_query .= " AND (spotter_archive_output.airline_type = 'cargo')";
714
+			$additional_query .= " AND (spotter_archive_output.airline_type = 'cargo')";
715 715
 		}
716 716
 		if ($airline_type == "military")
717 717
 		{
718
-		    $additional_query .= " AND (spotter_archive_output.airline_type = 'military')";
718
+			$additional_query .= " AND (spotter_archive_output.airline_type = 'military')";
719
+		}
719 720
 		}
720
-	    }
721 721
 	}
722 722
 	
723 723
 	if ($airport != "")
724 724
 	{
725
-	    $airport = filter_var($airport,FILTER_SANITIZE_STRING);
726
-	    if (!is_string($airport))
727
-	    {
725
+		$airport = filter_var($airport,FILTER_SANITIZE_STRING);
726
+		if (!is_string($airport))
727
+		{
728 728
 		return false;
729
-	    } else {
729
+		} else {
730 730
 		$additional_query .= " AND ((spotter_archive_output.departure_airport_icao = '".$airport."') OR (spotter_archive_output.arrival_airport_icao = '".$airport."'))";
731
-	    }
731
+		}
732 732
 	}
733 733
 	
734 734
 	if ($airport_country != "")
735 735
 	{
736
-	    $airport_country = filter_var($airport_country,FILTER_SANITIZE_STRING);
737
-	    if (!is_string($airport_country))
738
-	    {
736
+		$airport_country = filter_var($airport_country,FILTER_SANITIZE_STRING);
737
+		if (!is_string($airport_country))
738
+		{
739 739
 		return false;
740
-	    } else {
740
+		} else {
741 741
 		$additional_query .= " AND ((spotter_archive_output.departure_airport_country = '".$airport_country."') OR (spotter_archive_output.arrival_airport_country = '".$airport_country."'))";
742
-	    }
742
+		}
743 743
 	}
744 744
     
745 745
 	if ($callsign != "")
746 746
 	{
747
-	    $callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
748
-	    if (!is_string($callsign))
749
-	    {
747
+		$callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
748
+		if (!is_string($callsign))
749
+		{
750 750
 		return false;
751
-	    } else {
751
+		} else {
752 752
 		$translate = $Translation->ident2icao($callsign);
753 753
 		if ($translate != $callsign) {
754 754
 			$additional_query .= " AND (spotter_archive_output.ident = :callsign OR spotter_archive_output.ident = :translate)";
@@ -756,81 +756,81 @@  discard block
 block discarded – undo
756 756
 		} else {
757 757
 			$additional_query .= " AND (spotter_archive_output.ident = '".$callsign."')";
758 758
 		}
759
-	    }
759
+		}
760 760
 	}
761 761
 
762 762
 	if ($owner != "")
763 763
 	{
764
-	    $owner = filter_var($owner,FILTER_SANITIZE_STRING);
765
-	    if (!is_string($owner))
766
-	    {
764
+		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
765
+		if (!is_string($owner))
766
+		{
767 767
 		return false;
768
-	    } else {
768
+		} else {
769 769
 		$additional_query .= " AND (spotter_archive_output.owner_name = '".$owner."')";
770
-	    }
770
+		}
771 771
 	}
772 772
 
773 773
 	if ($pilot_name != "")
774 774
 	{
775
-	    $pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING);
776
-	    if (!is_string($pilot_name))
777
-	    {
775
+		$pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING);
776
+		if (!is_string($pilot_name))
777
+		{
778 778
 		return false;
779
-	    } else {
779
+		} else {
780 780
 		$additional_query .= " AND (spotter_archive_output.pilot_name = '".$pilot_name."')";
781
-	    }
781
+		}
782 782
 	}
783 783
 	
784 784
 	if ($pilot_id != "")
785 785
 	{
786
-	    $pilot_id = filter_var($pilot_id,FILTER_SANITIZE_NUMBER_INT);
787
-	    if (!is_string($pilot_id))
788
-	    {
786
+		$pilot_id = filter_var($pilot_id,FILTER_SANITIZE_NUMBER_INT);
787
+		if (!is_string($pilot_id))
788
+		{
789 789
 		return false;
790
-	    } else {
790
+		} else {
791 791
 		$additional_query .= " AND (spotter_archive_output.pilot_id = '".$pilot_id."')";
792
-	    }
792
+		}
793 793
 	}
794 794
 	
795 795
 	if ($departure_airport_route != "")
796 796
 	{
797
-	    $departure_airport_route = filter_var($departure_airport_route,FILTER_SANITIZE_STRING);
798
-	    if (!is_string($departure_airport_route))
799
-	    {
797
+		$departure_airport_route = filter_var($departure_airport_route,FILTER_SANITIZE_STRING);
798
+		if (!is_string($departure_airport_route))
799
+		{
800 800
 		return false;
801
-	    } else {
801
+		} else {
802 802
 		$additional_query .= " AND (spotter_archive_output.departure_airport_icao = '".$departure_airport_route."')";
803
-	    }
803
+		}
804 804
 	}
805 805
 	
806 806
 	if ($arrival_airport_route != "")
807 807
 	{
808
-	    $arrival_airport_route = filter_var($arrival_airport_route,FILTER_SANITIZE_STRING);
809
-	    if (!is_string($arrival_airport_route))
810
-	    {
808
+		$arrival_airport_route = filter_var($arrival_airport_route,FILTER_SANITIZE_STRING);
809
+		if (!is_string($arrival_airport_route))
810
+		{
811 811
 		return false;
812
-	    } else {
812
+		} else {
813 813
 		$additional_query .= " AND (spotter_archive_output.arrival_airport_icao = '".$arrival_airport_route."')";
814
-	    }
814
+		}
815 815
 	}
816 816
 	
817 817
 	if ($altitude != "")
818 818
 	{
819
-	    $altitude_array = explode(",", $altitude);
819
+		$altitude_array = explode(",", $altitude);
820 820
 	    
821
-	    $altitude_array[0] = filter_var($altitude_array[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
822
-	    $altitude_array[1] = filter_var($altitude_array[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
821
+		$altitude_array[0] = filter_var($altitude_array[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
822
+		$altitude_array[1] = filter_var($altitude_array[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
823 823
 	    
824 824
 
825
-	    if ($altitude_array[1] != "")
826
-	    {                
825
+		if ($altitude_array[1] != "")
826
+		{                
827 827
 		$altitude_array[0] = substr($altitude_array[0], 0, -2);
828 828
 		$altitude_array[1] = substr($altitude_array[1], 0, -2);
829 829
 		$additional_query .= " AND altitude BETWEEN '".$altitude_array[0]."' AND '".$altitude_array[1]."' ";
830
-	    } else {
830
+		} else {
831 831
 		$altitude_array[0] = substr($altitude_array[0], 0, -2);
832 832
 		$additional_query .= " AND altitude <= '".$altitude_array[0]."' ";
833
-	    }
833
+		}
834 834
 	}
835 835
 	
836 836
 	if ($date_posted != "")
@@ -915,14 +915,14 @@  discard block
 block discarded – undo
915 915
 		}
916 916
 	}
917 917
 
918
-    /**
919
-    * Gets all the spotter information based on the callsign
920
-    *
921
-    * @return Array the spotter information
922
-    *
923
-    */
924
-    public function getSpotterDataByIdent($ident = '', $limit = '', $sort = '')
925
-    {
918
+	/**
919
+	 * Gets all the spotter information based on the callsign
920
+	 *
921
+	 * @return Array the spotter information
922
+	 *
923
+	 */
924
+	public function getSpotterDataByIdent($ident = '', $limit = '', $sort = '')
925
+	{
926 926
 	$global_query = "SELECT spotter_archive_output.* FROM spotter_archive_output";
927 927
 	
928 928
 	date_default_timezone_set('UTC');
@@ -934,35 +934,35 @@  discard block
 block discarded – undo
934 934
 	
935 935
 	if ($ident != "")
936 936
 	{
937
-	    if (!is_string($ident))
938
-	    {
937
+		if (!is_string($ident))
938
+		{
939 939
 		return false;
940
-	    } else {
940
+		} else {
941 941
 		$additional_query = " AND spotter_archive_output.ident = :ident";
942 942
 		$query_values = array(':ident' => $ident);
943
-	    }
943
+		}
944 944
 	}
945 945
 	
946 946
 	if ($limit != "")
947 947
 	{
948
-	    $limit_array = explode(",", $limit);
948
+		$limit_array = explode(",", $limit);
949 949
 	    
950
-	    $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
951
-	    $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
950
+		$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
951
+		$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
952 952
 	    
953
-	    if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
954
-	    {
953
+		if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
954
+		{
955 955
 		//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
956 956
 		$limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0];
957
-	    }
957
+		}
958 958
 	}
959 959
 
960 960
 	if ($sort != "")
961 961
 	{
962
-	    $search_orderby_array = $Spotter->getOrderBy();
963
-	    $orderby_query = $search_orderby_array[$sort]['sql'];
962
+		$search_orderby_array = $Spotter->getOrderBy();
963
+		$orderby_query = $search_orderby_array[$sort]['sql'];
964 964
 	} else {
965
-	    $orderby_query = " ORDER BY spotter_archive_output.date DESC";
965
+		$orderby_query = " ORDER BY spotter_archive_output.date DESC";
966 966
 	}
967 967
 
968 968
 	$query = $global_query." WHERE spotter_archive_output.ident <> '' ".$additional_query." ".$orderby_query;
@@ -970,17 +970,17 @@  discard block
 block discarded – undo
970 970
 	$spotter_array = $Spotter->getDataFromDB($query, $query_values, $limit_query);
971 971
 
972 972
 	return $spotter_array;
973
-    }
973
+	}
974 974
 
975 975
 
976
-    /**
977
-    * Gets all the spotter information based on the owner
978
-    *
979
-    * @return Array the spotter information
980
-    *
981
-    */
982
-    public function getSpotterDataByOwner($owner = '', $limit = '', $sort = '', $filter = array())
983
-    {
976
+	/**
977
+	 * Gets all the spotter information based on the owner
978
+	 *
979
+	 * @return Array the spotter information
980
+	 *
981
+	 */
982
+	public function getSpotterDataByOwner($owner = '', $limit = '', $sort = '', $filter = array())
983
+	{
984 984
 	$global_query = "SELECT spotter_archive_output.* FROM spotter_archive_output";
985 985
 	
986 986
 	date_default_timezone_set('UTC');
@@ -993,35 +993,35 @@  discard block
 block discarded – undo
993 993
 	
994 994
 	if ($owner != "")
995 995
 	{
996
-	    if (!is_string($owner))
997
-	    {
996
+		if (!is_string($owner))
997
+		{
998 998
 		return false;
999
-	    } else {
999
+		} else {
1000 1000
 		$additional_query = " AND (spotter_archive_output.owner_name = :owner)";
1001 1001
 		$query_values = array(':owner' => $owner);
1002
-	    }
1002
+		}
1003 1003
 	}
1004 1004
 	
1005 1005
 	if ($limit != "")
1006 1006
 	{
1007
-	    $limit_array = explode(",", $limit);
1007
+		$limit_array = explode(",", $limit);
1008 1008
 	    
1009
-	    $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1010
-	    $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1009
+		$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1010
+		$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1011 1011
 	    
1012
-	    if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1013
-	    {
1012
+		if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1013
+		{
1014 1014
 		//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
1015 1015
 		$limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0];
1016
-	    }
1016
+		}
1017 1017
 	}
1018 1018
 
1019 1019
 	if ($sort != "")
1020 1020
 	{
1021
-	    $search_orderby_array = $Spotter->getOrderBy();
1022
-	    $orderby_query = $search_orderby_array[$sort]['sql'];
1021
+		$search_orderby_array = $Spotter->getOrderBy();
1022
+		$orderby_query = $search_orderby_array[$sort]['sql'];
1023 1023
 	} else {
1024
-	    $orderby_query = " ORDER BY spotter_archive_output.date DESC";
1024
+		$orderby_query = " ORDER BY spotter_archive_output.date DESC";
1025 1025
 	}
1026 1026
 
1027 1027
 	$query = $global_query.$filter_query." spotter_archive_output.owner_name <> '' ".$additional_query." ".$orderby_query;
@@ -1029,16 +1029,16 @@  discard block
 block discarded – undo
1029 1029
 	$spotter_array = $Spotter->getDataFromDB($query, $query_values, $limit_query);
1030 1030
 
1031 1031
 	return $spotter_array;
1032
-    }
1033
-
1034
-    /**
1035
-    * Gets all the spotter information based on the pilot
1036
-    *
1037
-    * @return Array the spotter information
1038
-    *
1039
-    */
1040
-    public function getSpotterDataByPilot($pilot = '', $limit = '', $sort = '', $filter = array())
1041
-    {
1032
+	}
1033
+
1034
+	/**
1035
+	 * Gets all the spotter information based on the pilot
1036
+	 *
1037
+	 * @return Array the spotter information
1038
+	 *
1039
+	 */
1040
+	public function getSpotterDataByPilot($pilot = '', $limit = '', $sort = '', $filter = array())
1041
+	{
1042 1042
 	$global_query = "SELECT spotter_archive_output.* FROM spotter_archive_output";
1043 1043
 	
1044 1044
 	date_default_timezone_set('UTC');
@@ -1057,24 +1057,24 @@  discard block
 block discarded – undo
1057 1057
 	
1058 1058
 	if ($limit != "")
1059 1059
 	{
1060
-	    $limit_array = explode(",", $limit);
1060
+		$limit_array = explode(",", $limit);
1061 1061
 	    
1062
-	    $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1063
-	    $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1062
+		$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1063
+		$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1064 1064
 	    
1065
-	    if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1066
-	    {
1065
+		if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1066
+		{
1067 1067
 		//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
1068 1068
 		$limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0];
1069
-	    }
1069
+		}
1070 1070
 	}
1071 1071
 
1072 1072
 	if ($sort != "")
1073 1073
 	{
1074
-	    $search_orderby_array = $Spotter->getOrderBy();
1075
-	    $orderby_query = $search_orderby_array[$sort]['sql'];
1074
+		$search_orderby_array = $Spotter->getOrderBy();
1075
+		$orderby_query = $search_orderby_array[$sort]['sql'];
1076 1076
 	} else {
1077
-	    $orderby_query = " ORDER BY spotter_archive_output.date DESC";
1077
+		$orderby_query = " ORDER BY spotter_archive_output.date DESC";
1078 1078
 	}
1079 1079
 
1080 1080
 	$query = $global_query.$filter_query." spotter_archive_output.pilot_name <> '' ".$additional_query." ".$orderby_query;
@@ -1082,16 +1082,16 @@  discard block
 block discarded – undo
1082 1082
 	$spotter_array = $Spotter->getDataFromDB($query, $query_values, $limit_query);
1083 1083
 
1084 1084
 	return $spotter_array;
1085
-    }
1086
-
1087
-    /**
1088
-    * Gets all number of flight over countries
1089
-    *
1090
-    * @return Array the airline country list
1091
-    *
1092
-    */
1093
-    public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '')
1094
-    {
1085
+	}
1086
+
1087
+	/**
1088
+	 * Gets all number of flight over countries
1089
+	 *
1090
+	 * @return Array the airline country list
1091
+	 *
1092
+	 */
1093
+	public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '')
1094
+	{
1095 1095
 	global $globalDBdriver;
1096 1096
 	/*
1097 1097
 	$query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb 
@@ -1101,14 +1101,14 @@  discard block
 block discarded – undo
1101 1101
 	$query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb
1102 1102
 		    FROM countries c, spotter_archive s
1103 1103
 		    WHERE c.iso2 = s.over_country ";
1104
-                if ($olderthanmonths > 0) {
1105
-            		if ($globalDBdriver == 'mysql') {
1104
+				if ($olderthanmonths > 0) {
1105
+					if ($globalDBdriver == 'mysql') {
1106 1106
 				$query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
1107 1107
 			} else {
1108 1108
 				$query .= "AND date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
1109 1109
 			}
1110 1110
 		}
1111
-                if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
1111
+				if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
1112 1112
 	$query .= "GROUP BY c.name, c.iso3, c.iso2 ORDER BY nb DESC";
1113 1113
 	if ($limit) $query .= " LIMIT 0,10";
1114 1114
       
@@ -1121,23 +1121,23 @@  discard block
 block discarded – undo
1121 1121
         
1122 1122
 	while($row = $sth->fetch(PDO::FETCH_ASSOC))
1123 1123
 	{
1124
-	    $temp_array['flight_count'] = $row['nb'];
1125
-	    $temp_array['flight_country'] = $row['name'];
1126
-	    $temp_array['flight_country_iso3'] = $row['iso3'];
1127
-	    $temp_array['flight_country_iso2'] = $row['iso2'];
1128
-	    $flight_array[] = $temp_array;
1124
+		$temp_array['flight_count'] = $row['nb'];
1125
+		$temp_array['flight_country'] = $row['name'];
1126
+		$temp_array['flight_country_iso3'] = $row['iso3'];
1127
+		$temp_array['flight_country_iso2'] = $row['iso2'];
1128
+		$flight_array[] = $temp_array;
1129 1129
 	}
1130 1130
 	return $flight_array;
1131
-    }
1132
-
1133
-    /**
1134
-    * Gets all number of flight over countries
1135
-    *
1136
-    * @return Array the airline country list
1137
-    *
1138
-    */
1139
-    public function countAllFlightOverCountriesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '')
1140
-    {
1131
+	}
1132
+
1133
+	/**
1134
+	 * Gets all number of flight over countries
1135
+	 *
1136
+	 * @return Array the airline country list
1137
+	 *
1138
+	 */
1139
+	public function countAllFlightOverCountriesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '')
1140
+	{
1141 1141
 	global $globalDBdriver;
1142 1142
 	/*
1143 1143
 	$query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb 
@@ -1147,14 +1147,14 @@  discard block
 block discarded – undo
1147 1147
 	$query = "SELECT o.airline_icao,c.name, c.iso3, c.iso2, count(c.name) as nb
1148 1148
 		    FROM countries c, spotter_archive s, spotter_output o
1149 1149
 		    WHERE c.iso2 = s.over_country AND o.airline_icao <> '' AND o.flightaware_id = s.flightaware_id ";
1150
-                if ($olderthanmonths > 0) {
1151
-            		if ($globalDBdriver == 'mysql') {
1150
+				if ($olderthanmonths > 0) {
1151
+					if ($globalDBdriver == 'mysql') {
1152 1152
 				$query .= 'AND s.date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
1153 1153
 			} else {
1154 1154
 				$query .= "AND s.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
1155 1155
 			}
1156 1156
 		}
1157
-                if ($sincedate != '') $query .= "AND s.date > '".$sincedate."' ";
1157
+				if ($sincedate != '') $query .= "AND s.date > '".$sincedate."' ";
1158 1158
 	$query .= "GROUP BY o.airline_icao,c.name, c.iso3, c.iso2 ORDER BY nb DESC";
1159 1159
 	if ($limit) $query .= " LIMIT 0,10";
1160 1160
       
@@ -1167,24 +1167,24 @@  discard block
 block discarded – undo
1167 1167
         
1168 1168
 	while($row = $sth->fetch(PDO::FETCH_ASSOC))
1169 1169
 	{
1170
-	    $temp_array['airline_icao'] = $row['airline_icao'];
1171
-	    $temp_array['flight_count'] = $row['nb'];
1172
-	    $temp_array['flight_country'] = $row['name'];
1173
-	    $temp_array['flight_country_iso3'] = $row['iso3'];
1174
-	    $temp_array['flight_country_iso2'] = $row['iso2'];
1175
-	    $flight_array[] = $temp_array;
1170
+		$temp_array['airline_icao'] = $row['airline_icao'];
1171
+		$temp_array['flight_count'] = $row['nb'];
1172
+		$temp_array['flight_country'] = $row['name'];
1173
+		$temp_array['flight_country_iso3'] = $row['iso3'];
1174
+		$temp_array['flight_country_iso2'] = $row['iso2'];
1175
+		$flight_array[] = $temp_array;
1176 1176
 	}
1177 1177
 	return $flight_array;
1178
-    }
1179
-
1180
-    /**
1181
-    * Gets last spotter information based on a particular callsign
1182
-    *
1183
-    * @return Array the spotter information
1184
-    *
1185
-    */
1186
-    public function getDateArchiveSpotterDataById($id,$date)
1187
-    {
1178
+	}
1179
+
1180
+	/**
1181
+	 * Gets last spotter information based on a particular callsign
1182
+	 *
1183
+	 * @return Array the spotter information
1184
+	 *
1185
+	 */
1186
+	public function getDateArchiveSpotterDataById($id,$date)
1187
+	{
1188 1188
 	$Spotter = new Spotter($this->db);
1189 1189
 	date_default_timezone_set('UTC');
1190 1190
 	$id = filter_var($id, FILTER_SANITIZE_STRING);
@@ -1192,16 +1192,16 @@  discard block
 block discarded – undo
1192 1192
 	$date = date('c',$date);
1193 1193
 	$spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id,':date' => $date));
1194 1194
 	return $spotter_array;
1195
-    }
1196
-
1197
-    /**
1198
-    * Gets all the spotter information based on a particular callsign
1199
-    *
1200
-    * @return Array the spotter information
1201
-    *
1202
-    */
1203
-    public function getDateArchiveSpotterDataByIdent($ident,$date)
1204
-    {
1195
+	}
1196
+
1197
+	/**
1198
+	 * Gets all the spotter information based on a particular callsign
1199
+	 *
1200
+	 * @return Array the spotter information
1201
+	 *
1202
+	 */
1203
+	public function getDateArchiveSpotterDataByIdent($ident,$date)
1204
+	{
1205 1205
 	$Spotter = new Spotter($this->db);
1206 1206
 	date_default_timezone_set('UTC');
1207 1207
 	$ident = filter_var($ident, FILTER_SANITIZE_STRING);
@@ -1209,16 +1209,16 @@  discard block
 block discarded – undo
1209 1209
 	$date = date('c',$date);
1210 1210
 	$spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident,':date' => $date));
1211 1211
 	return $spotter_array;
1212
-    }
1213
-
1214
-    /**
1215
-    * Gets all the spotter information based on the airport
1216
-    *
1217
-    * @return Array the spotter information
1218
-    *
1219
-    */
1220
-    public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '',$filters = array())
1221
-    {
1212
+	}
1213
+
1214
+	/**
1215
+	 * Gets all the spotter information based on the airport
1216
+	 *
1217
+	 * @return Array the spotter information
1218
+	 *
1219
+	 */
1220
+	public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '',$filters = array())
1221
+	{
1222 1222
 	global $global_query;
1223 1223
 	$Spotter = new Spotter($this->db);
1224 1224
 	date_default_timezone_set('UTC');
@@ -1229,35 +1229,35 @@  discard block
 block discarded – undo
1229 1229
 	
1230 1230
 	if ($airport != "")
1231 1231
 	{
1232
-	    if (!is_string($airport))
1233
-	    {
1232
+		if (!is_string($airport))
1233
+		{
1234 1234
 		return false;
1235
-	    } else {
1235
+		} else {
1236 1236
 		$additional_query .= " AND ((spotter_archive_output.departure_airport_icao = :airport) OR (spotter_archive_output.arrival_airport_icao = :airport))";
1237 1237
 		$query_values = array(':airport' => $airport);
1238
-	    }
1238
+		}
1239 1239
 	}
1240 1240
 	
1241 1241
 	if ($limit != "")
1242 1242
 	{
1243
-	    $limit_array = explode(",", $limit);
1243
+		$limit_array = explode(",", $limit);
1244 1244
 	    
1245
-	    $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1246
-	    $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1245
+		$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1246
+		$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1247 1247
 	    
1248
-	    if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1249
-	    {
1248
+		if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1249
+		{
1250 1250
 		//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
1251 1251
 		$limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0];
1252
-	    }
1252
+		}
1253 1253
 	}
1254 1254
 	
1255 1255
 	if ($sort != "")
1256 1256
 	{
1257
-	    $search_orderby_array = $Spotter->getOrderBy();
1258
-	    $orderby_query = $search_orderby_array[$sort]['sql'];
1257
+		$search_orderby_array = $Spotter->getOrderBy();
1258
+		$orderby_query = $search_orderby_array[$sort]['sql'];
1259 1259
 	} else {
1260
-	    $orderby_query = " ORDER BY spotter_archive_output.date DESC";
1260
+		$orderby_query = " ORDER BY spotter_archive_output.date DESC";
1261 1261
 	}
1262 1262
 
1263 1263
 	$query = $global_query.$filter_query." spotter_archive_output.ident <> '' ".$additional_query." AND ((spotter_archive_output.departure_airport_icao <> 'NA') AND (spotter_archive_output.arrival_airport_icao <> 'NA')) ".$orderby_query;
@@ -1265,6 +1265,6 @@  discard block
 block discarded – undo
1265 1265
 	$spotter_array = $Spotter->getDataFromDB($query, $query_values, $limit_query);
1266 1266
 
1267 1267
 	return $spotter_array;
1268
-    }
1268
+	}
1269 1269
 }
1270 1270
 ?>
1271 1271
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +117 added lines, -117 removed lines patch added patch discarded remove patch
@@ -14,82 +14,82 @@  discard block
 block discarded – undo
14 14
 	* @param Array $filter the filter
15 15
 	* @return Array the SQL part
16 16
 	*/
17
-	public function getFilter($filter = array(),$where = false,$and = false) {
17
+	public function getFilter($filter = array(), $where = false, $and = false) {
18 18
 		global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver;
19 19
 		$filters = array();
20 20
 		if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) {
21 21
 			if (isset($globalStatsFilters[$globalFilterName][0]['source'])) {
22 22
 				$filters = $globalStatsFilters[$globalFilterName];
23 23
 			} else {
24
-				$filter = array_merge($filter,$globalStatsFilters[$globalFilterName]);
24
+				$filter = array_merge($filter, $globalStatsFilters[$globalFilterName]);
25 25
 			}
26 26
 		}
27 27
 		if (isset($filter[0]['source'])) {
28
-			$filters = array_merge($filters,$filter);
28
+			$filters = array_merge($filters, $filter);
29 29
 		}
30
-		if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter);
30
+		if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter);
31 31
 		$filter_query_join = '';
32 32
 		$filter_query_where = '';
33
-		foreach($filters as $flt) {
33
+		foreach ($filters as $flt) {
34 34
 			if (isset($flt['airlines']) && !empty($flt['airlines'])) {
35 35
 				if ($flt['airlines'][0] != '') {
36 36
 					if (isset($flt['source'])) {
37
-						$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','",$flt['airlines'])."') AND spotter_archive_output.format_source IN ('".implode("','",$flt['source'])."')) saff ON saff.flightaware_id = spotter_archive_output.flightaware_id";
37
+						$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','", $flt['airlines'])."') AND spotter_archive_output.format_source IN ('".implode("','", $flt['source'])."')) saff ON saff.flightaware_id = spotter_archive_output.flightaware_id";
38 38
 					} else {
39
-						$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','",$flt['airlines'])."')) saff ON saff.flightaware_id = spotter_archive_output.flightaware_id";
39
+						$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','", $flt['airlines'])."')) saff ON saff.flightaware_id = spotter_archive_output.flightaware_id";
40 40
 					}
41 41
 				}
42 42
 			}
43 43
 			if (isset($flt['pilots_id']) && !empty($flt['pilots_id'])) {
44 44
 				if (isset($flt['source'])) {
45
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."') AND spotter_archive_output.format_source IN ('".implode("','",$flt['source'])."')) sp ON sp.flightaware_id = spotter_archive_output.flightaware_id";
45
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.pilot_id IN ('".implode("','", $flt['pilots_id'])."') AND spotter_archive_output.format_source IN ('".implode("','", $flt['source'])."')) sp ON sp.flightaware_id = spotter_archive_output.flightaware_id";
46 46
 				} else {
47
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."')) sp ON sp.flightaware_id = spotter_archive_output.flightaware_id";
47
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.pilot_id IN ('".implode("','", $flt['pilots_id'])."')) sp ON sp.flightaware_id = spotter_archive_output.flightaware_id";
48 48
 				}
49 49
 			}
50 50
 			if (isset($flt['idents']) && !empty($flt['idents'])) {
51 51
 				if (isset($flt['source'])) {
52
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.ident IN ('".implode("','",$flt['idents'])."') AND spotter_archive_output.format_source IN ('".implode("','",$flt['source'])."')) spi ON spi.flightaware_id = spotter_archive_output.flightaware_id";
52
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.ident IN ('".implode("','", $flt['idents'])."') AND spotter_archive_output.format_source IN ('".implode("','", $flt['source'])."')) spi ON spi.flightaware_id = spotter_archive_output.flightaware_id";
53 53
 				} else {
54
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.ident IN ('".implode("','",$flt['idents'])."')) spi ON spi.flightaware_id = spotter_archive_output.flightaware_id";
54
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.ident IN ('".implode("','", $flt['idents'])."')) spi ON spi.flightaware_id = spotter_archive_output.flightaware_id";
55 55
 				}
56 56
 			}
57 57
 			if (isset($flt['registrations']) && !empty($flt['registrations'])) {
58 58
 				if (isset($flt['source'])) {
59
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.registration IN ('".implode("','",$flt['registrations'])."') AND spotter_archive_output.format_source IN ('".implode("','",$flt['source'])."')) sre ON sre.flightaware_id = spotter_archive_output.flightaware_id";
59
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.registration IN ('".implode("','", $flt['registrations'])."') AND spotter_archive_output.format_source IN ('".implode("','", $flt['source'])."')) sre ON sre.flightaware_id = spotter_archive_output.flightaware_id";
60 60
 				} else {
61
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.registration IN ('".implode("','",$flt['registrations'])."')) sre ON sre.flightaware_id = spotter_archive_output.flightaware_id";
61
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.registration IN ('".implode("','", $flt['registrations'])."')) sre ON sre.flightaware_id = spotter_archive_output.flightaware_id";
62 62
 				}
63 63
 			}
64 64
 			if ((isset($flt['airlines']) && empty($flt['airlines']) && isset($flt['pilots_id']) && empty($flt['pilots_id']) && isset($flt['idents']) && empty($flt['idents']) && isset($flt['registrations']) && empty($flt['registrations'])) || (!isset($flt['airlines']) && !isset($flt['pilots_id']) && !isset($flt['idents']) && !isset($flt['registrations']))) {
65 65
 				if (isset($flt['source'])) {
66
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_output.format_source IN ('".implode("','",$flt['source'])."')) saa ON saa.flightaware_id = spotter_archive_output.flightaware_id";
66
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_output.format_source IN ('".implode("','", $flt['source'])."')) saa ON saa.flightaware_id = spotter_archive_output.flightaware_id";
67 67
 				}
68 68
 			}
69 69
 		}
70 70
 		if (isset($filter['airlines']) && !empty($filter['airlines'])) {
71 71
 			if ($filter['airlines'][0] != '') {
72
-				$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) saf ON saf.flightaware_id = spotter_archive_output.flightaware_id";
72
+				$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) saf ON saf.flightaware_id = spotter_archive_output.flightaware_id";
73 73
 			}
74 74
 		}
75 75
 		if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
76 76
 			$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_archive_output.flightaware_id ";
77 77
 		}
78 78
 		if (isset($filter['pilots_id']) && !empty($filter['pilots_id'])) {
79
-			$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.pilot_id IN ('".implode("','",$filter['pilots_id'])."')) spi ON spi.flightaware_id = spotter_archive_output.flightaware_id";
79
+			$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.pilot_id IN ('".implode("','", $filter['pilots_id'])."')) spi ON spi.flightaware_id = spotter_archive_output.flightaware_id";
80 80
 		}
81 81
 		if (isset($filter['source']) && !empty($filter['source'])) {
82 82
 			if (count($filter['source']) == 1) {
83 83
 				$filter_query_where .= " AND format_source = '".$filter['source'][0]."'";
84 84
 			} else {
85
-				$filter_query_where .= " AND format_source IN ('".implode("','",$filter['source'])."')";
85
+				$filter_query_where .= " AND format_source IN ('".implode("','", $filter['source'])."')";
86 86
 			}
87 87
 		}
88 88
 		if (isset($filter['ident']) && !empty($filter['ident'])) {
89 89
 			$filter_query_where .= " AND ident = '".$filter['ident']."'";
90 90
 		}
91 91
 		if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
92
-			$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
92
+			$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')";
93 93
 		}
94 94
 		if ((isset($filter['year']) && $filter['year'] != '') || (isset($filter['month']) && $filter['month'] != '') || (isset($filter['day']) && $filter['day'] != '')) {
95 95
 			$filter_query_date = '';
@@ -114,41 +114,41 @@  discard block
 block discarded – undo
114 114
 					$filter_query_date .= " AND EXTRACT(DAY FROM spotter_archive_output.date) = '".$filter['day']."'";
115 115
 				}
116 116
 			}
117
-			$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output".preg_replace('/^ AND/',' WHERE',$filter_query_date).") sd ON sd.flightaware_id = spotter_archive_output.flightaware_id";
117
+			$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output".preg_replace('/^ AND/', ' WHERE', $filter_query_date).") sd ON sd.flightaware_id = spotter_archive_output.flightaware_id";
118 118
 		}
119 119
 		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
120 120
 		elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND';
121 121
 		if ($filter_query_where != '') {
122
-			$filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where);
122
+			$filter_query_where = preg_replace('/^ AND/', ' WHERE', $filter_query_where);
123 123
 		}
124 124
 		$filter_query = $filter_query_join.$filter_query_where;
125 125
 		return $filter_query;
126 126
 	}
127 127
 
128 128
 	// Spotter_archive
129
-	public function addSpotterArchiveData($flightaware_id = '', $ident = '', $registration = '', $airline_name = '', $airline_icao = '', $airline_country = '', $airline_type = '', $aircraft_icao = '', $aircraft_shadow = '', $aircraft_name = '', $aircraft_manufacturer = '', $departure_airport_icao = '', $departure_airport_name = '', $departure_airport_city = '', $departure_airport_country = '', $departure_airport_time = '',$arrival_airport_icao = '', $arrival_airport_name = '', $arrival_airport_city ='', $arrival_airport_country = '', $arrival_airport_time = '', $route_stop = '', $date = '',$latitude = '', $longitude = '', $waypoints = '', $altitude = '', $real_altitude = '',$heading = '', $ground_speed = '', $squawk = '', $ModeS = '', $pilot_id = '', $pilot_name = '',$verticalrate = '',$format_source = '', $source_name = '', $over_country = '') {
129
+	public function addSpotterArchiveData($flightaware_id = '', $ident = '', $registration = '', $airline_name = '', $airline_icao = '', $airline_country = '', $airline_type = '', $aircraft_icao = '', $aircraft_shadow = '', $aircraft_name = '', $aircraft_manufacturer = '', $departure_airport_icao = '', $departure_airport_name = '', $departure_airport_city = '', $departure_airport_country = '', $departure_airport_time = '', $arrival_airport_icao = '', $arrival_airport_name = '', $arrival_airport_city = '', $arrival_airport_country = '', $arrival_airport_time = '', $route_stop = '', $date = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $real_altitude = '', $heading = '', $ground_speed = '', $squawk = '', $ModeS = '', $pilot_id = '', $pilot_name = '', $verticalrate = '', $format_source = '', $source_name = '', $over_country = '') {
130 130
 		require_once(dirname(__FILE__).'/class.Spotter.php');
131 131
 		if ($over_country == '') {
132 132
 			$Spotter = new Spotter($this->db);
133
-			$data_country = $Spotter->getCountryFromLatitudeLongitude($latitude,$longitude);
133
+			$data_country = $Spotter->getCountryFromLatitudeLongitude($latitude, $longitude);
134 134
 			if (!empty($data_country)) $country = $data_country['iso2'];
135 135
 			else $country = '';
136 136
 		} else $country = $over_country;
137
-		if ($airline_type === NULL) $airline_type ='';
137
+		if ($airline_type === NULL) $airline_type = '';
138 138
 	
139 139
 		//if ($country == '') echo "\n".'************ UNKNOW COUNTRY ****************'."\n";
140 140
 		//else echo "\n".'*/*/*/*/*/*/*/ Country : '.$country.' */*/*/*/*/*/*/*/*/'."\n";
141 141
 
142 142
 		// Route is not added in spotter_archive
143
-		$query  = "INSERT INTO spotter_archive (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_shadow, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, departure_airport_time,arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, arrival_airport_time, route_stop, date,latitude, longitude, waypoints, altitude, heading, ground_speed, squawk, ModeS, pilot_id, pilot_name, verticalrate,format_source,over_country,source_name,real_altitude)
143
+		$query = "INSERT INTO spotter_archive (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_shadow, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, departure_airport_time,arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, arrival_airport_time, route_stop, date,latitude, longitude, waypoints, altitude, heading, ground_speed, squawk, ModeS, pilot_id, pilot_name, verticalrate,format_source,over_country,source_name,real_altitude)
144 144
 		        VALUES (:flightaware_id, :ident, :registration, :airline_name, :airline_icao, :airline_country, :airline_type, :aircraft_icao, :aircraft_shadow, :aircraft_name, :aircraft_manufacturer, :departure_airport_icao, :departure_airport_name, :departure_airport_city, :departure_airport_country, :departure_airport_time,:arrival_airport_icao, :arrival_airport_name, :arrival_airport_city, :arrival_airport_country, :arrival_airport_time, :route_stop, :date,:latitude, :longitude, :waypoints, :altitude, :heading, :ground_speed, :squawk, :ModeS, :pilot_id, :pilot_name, :verticalrate, :format_source, :over_country, :source_name,:real_altitude)";
145 145
 
146
-		$query_values = array(':flightaware_id' => $flightaware_id, ':ident' => $ident, ':registration' => $registration, ':airline_name' => $airline_name, ':airline_icao' => $airline_icao, ':airline_country' => $airline_country, ':airline_type' => $airline_type, ':aircraft_icao' => $aircraft_icao, ':aircraft_shadow' => $aircraft_shadow, ':aircraft_name' => $aircraft_name, ':aircraft_manufacturer' => $aircraft_manufacturer, ':departure_airport_icao' => $departure_airport_icao, ':departure_airport_name' => $departure_airport_name, ':departure_airport_city' => $departure_airport_city, ':departure_airport_country' => $departure_airport_country, ':departure_airport_time' => $departure_airport_time,':arrival_airport_icao' => $arrival_airport_icao, ':arrival_airport_name' => $arrival_airport_name, ':arrival_airport_city' => $arrival_airport_city, ':arrival_airport_country' => $arrival_airport_country, ':arrival_airport_time' => $arrival_airport_time, ':route_stop' => $route_stop, ':date' => $date,':latitude' => $latitude, ':longitude' => $longitude, ':waypoints' => $waypoints, ':altitude' => $altitude, ':heading' => $heading, ':ground_speed' => $ground_speed, ':squawk' => $squawk, ':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':format_source' => $format_source, ':over_country' => $country, ':source_name' => $source_name,':real_altitude' => $real_altitude);
146
+		$query_values = array(':flightaware_id' => $flightaware_id, ':ident' => $ident, ':registration' => $registration, ':airline_name' => $airline_name, ':airline_icao' => $airline_icao, ':airline_country' => $airline_country, ':airline_type' => $airline_type, ':aircraft_icao' => $aircraft_icao, ':aircraft_shadow' => $aircraft_shadow, ':aircraft_name' => $aircraft_name, ':aircraft_manufacturer' => $aircraft_manufacturer, ':departure_airport_icao' => $departure_airport_icao, ':departure_airport_name' => $departure_airport_name, ':departure_airport_city' => $departure_airport_city, ':departure_airport_country' => $departure_airport_country, ':departure_airport_time' => $departure_airport_time, ':arrival_airport_icao' => $arrival_airport_icao, ':arrival_airport_name' => $arrival_airport_name, ':arrival_airport_city' => $arrival_airport_city, ':arrival_airport_country' => $arrival_airport_country, ':arrival_airport_time' => $arrival_airport_time, ':route_stop' => $route_stop, ':date' => $date, ':latitude' => $latitude, ':longitude' => $longitude, ':waypoints' => $waypoints, ':altitude' => $altitude, ':heading' => $heading, ':ground_speed' => $ground_speed, ':squawk' => $squawk, ':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':format_source' => $format_source, ':over_country' => $country, ':source_name' => $source_name, ':real_altitude' => $real_altitude);
147 147
 		try {
148 148
 			$sth = $this->db->prepare($query);
149 149
 			$sth->execute($query_values);
150 150
 			$sth->closeCursor();
151
-		} catch(PDOException $e) {
151
+		} catch (PDOException $e) {
152 152
 			return "error : ".$e->getMessage();
153 153
 		}
154 154
 		return "success";
@@ -168,9 +168,9 @@  discard block
 block discarded – undo
168 168
 
169 169
                 $ident = filter_var($ident, FILTER_SANITIZE_STRING);
170 170
                 //$query  = "SELECT spotter_archive.* FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate LIMIT 1";
171
-                $query  = "SELECT spotter_archive.* FROM spotter_archive WHERE ident = :ident ORDER BY date DESC LIMIT 1";
171
+                $query = "SELECT spotter_archive.* FROM spotter_archive WHERE ident = :ident ORDER BY date DESC LIMIT 1";
172 172
 
173
-                $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident));
173
+                $spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident));
174 174
 
175 175
                 return $spotter_array;
176 176
         }
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
                 $id = filter_var($id, FILTER_SANITIZE_STRING);
190 190
                 //$query  = SpotterArchive->$global_query." WHERE spotter_archive.flightaware_id = :id";
191 191
                 //$query  = "SELECT spotter_archive.* FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.flightaware_id = :id GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate LIMIT 1";
192
-                $query  = "SELECT * FROM spotter_archive WHERE flightaware_id = :id ORDER BY date DESC LIMIT 1";
192
+                $query = "SELECT * FROM spotter_archive WHERE flightaware_id = :id ORDER BY date DESC LIMIT 1";
193 193
 
194 194
 //              $spotter_array = Spotter->getDataFromDB($query,array(':id' => $id));
195 195
                   /*
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
                 }
203 203
                 $spotter_array = $sth->fetchAll(PDO->FETCH_ASSOC);
204 204
                 */
205
-                $spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id));
205
+                $spotter_array = $Spotter->getDataFromDB($query, array(':id' => $id));
206 206
 
207 207
                 return $spotter_array;
208 208
         }
@@ -217,14 +217,14 @@  discard block
 block discarded – undo
217 217
 	{
218 218
                 date_default_timezone_set('UTC');
219 219
                 $id = filter_var($id, FILTER_SANITIZE_STRING);
220
-                $query  = $this->global_query." WHERE spotter_archive.flightaware_id = :id ORDER BY date";
220
+                $query = $this->global_query." WHERE spotter_archive.flightaware_id = :id ORDER BY date";
221 221
 
222 222
 //              $spotter_array = Spotter->getDataFromDB($query,array(':id' => $id));
223 223
 
224 224
                 try {
225 225
                         $sth = $this->db->prepare($query);
226 226
                         $sth->execute(array(':id' => $id));
227
-                } catch(PDOException $e) {
227
+                } catch (PDOException $e) {
228 228
                         echo $e->getMessage();
229 229
                         die;
230 230
                 }
@@ -243,14 +243,14 @@  discard block
 block discarded – undo
243 243
         {
244 244
                 date_default_timezone_set('UTC');
245 245
                 $id = filter_var($id, FILTER_SANITIZE_STRING);
246
-                $query  = "SELECT spotter_archive.latitude, spotter_archive.longitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id";
246
+                $query = "SELECT spotter_archive.latitude, spotter_archive.longitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id";
247 247
 
248 248
 //              $spotter_array = Spotter->getDataFromDB($query,array(':id' => $id));
249 249
 
250 250
                 try {
251 251
                         $sth = $this->db->prepare($query);
252 252
                         $sth->execute(array(':id' => $id));
253
-                } catch(PDOException $e) {
253
+                } catch (PDOException $e) {
254 254
                         echo $e->getMessage();
255 255
                         die;
256 256
                 }
@@ -272,12 +272,12 @@  discard block
 block discarded – undo
272 272
                 date_default_timezone_set('UTC');
273 273
 
274 274
                 $ident = filter_var($ident, FILTER_SANITIZE_STRING);
275
-                $query  = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.ident = :ident AND spotter_archive.latitude <> 0 AND spotter_archive.longitude <> 0 ORDER BY date";
275
+                $query = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.ident = :ident AND spotter_archive.latitude <> 0 AND spotter_archive.longitude <> 0 ORDER BY date";
276 276
 
277 277
                 try {
278 278
                         $sth = $this->db->prepare($query);
279 279
                         $sth->execute(array(':ident' => $ident));
280
-                } catch(PDOException $e) {
280
+                } catch (PDOException $e) {
281 281
                         echo $e->getMessage();
282 282
                         die;
283 283
                 }
@@ -298,12 +298,12 @@  discard block
 block discarded – undo
298 298
                 date_default_timezone_set('UTC');
299 299
 
300 300
                 $id = filter_var($id, FILTER_SANITIZE_STRING);
301
-                $query  = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id AND spotter_archive.latitude <> 0 AND spotter_archive.longitude <> 0 ORDER BY date";
301
+                $query = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id AND spotter_archive.latitude <> 0 AND spotter_archive.longitude <> 0 ORDER BY date";
302 302
 
303 303
                 try {
304 304
                         $sth = $this->db->prepare($query);
305 305
                         $sth->execute(array(':id' => $id));
306
-                } catch(PDOException $e) {
306
+                } catch (PDOException $e) {
307 307
                         echo $e->getMessage();
308 308
                         die;
309 309
                 }
@@ -322,11 +322,11 @@  discard block
 block discarded – undo
322 322
 	{
323 323
 		date_default_timezone_set('UTC');
324 324
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
325
-		$query  = "SELECT spotter_archive.altitude, spotter_archive.real_altitude,spotter_archive.ground_speed, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id ORDER BY date";
325
+		$query = "SELECT spotter_archive.altitude, spotter_archive.real_altitude,spotter_archive.ground_speed, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id ORDER BY date";
326 326
 		try {
327 327
 			$sth = $this->db->prepare($query);
328 328
 			$sth->execute(array(':id' => $id));
329
-		} catch(PDOException $e) {
329
+		} catch (PDOException $e) {
330 330
 			echo $e->getMessage();
331 331
 			die;
332 332
 		}
@@ -344,12 +344,12 @@  discard block
 block discarded – undo
344 344
 	{
345 345
 		date_default_timezone_set('UTC');
346 346
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
347
-		$query  = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate LIMIT 1";
347
+		$query = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate LIMIT 1";
348 348
 //                $query  = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.ident = :ident";
349 349
 		try {
350 350
 			$sth = $this->db->prepare($query);
351 351
 			$sth->execute(array(':ident' => $ident));
352
-		} catch(PDOException $e) {
352
+		} catch (PDOException $e) {
353 353
 			echo $e->getMessage();
354 354
 			die;
355 355
 		}
@@ -365,12 +365,12 @@  discard block
 block discarded – undo
365 365
         * @return Array the spotter information
366 366
         *
367 367
         */
368
-	public function getSpotterArchiveData($ident,$flightaware_id,$date)
368
+	public function getSpotterArchiveData($ident, $flightaware_id, $date)
369 369
 	{
370 370
 		$Spotter = new Spotter($this->db);
371 371
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
372
-		$query  = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.flightaware_id = :flightaware_id AND l.date LIKE :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate";
373
-		$spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident,':flightaware_id' => $flightaware_id,':date' => $date.'%'));
372
+		$query = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.flightaware_id = :flightaware_id AND l.date LIKE :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate";
373
+		$spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident, ':flightaware_id' => $flightaware_id, ':date' => $date.'%'));
374 374
 		return $spotter_array;
375 375
 	}
376 376
 
@@ -385,7 +385,7 @@  discard block
 block discarded – undo
385 385
 		try {
386 386
 			$sth = $this->db->prepare($query);
387 387
 			$sth->execute();
388
-		} catch(PDOException $e) {
388
+		} catch (PDOException $e) {
389 389
 			echo $e->getMessage();
390 390
 			die;
391 391
 		}
@@ -397,24 +397,24 @@  discard block
 block discarded – undo
397 397
         * @return Array the spotter information
398 398
         *
399 399
         */
400
-        public function getMinLiveSpotterData($begindate,$enddate,$filter = array())
400
+        public function getMinLiveSpotterData($begindate, $enddate, $filter = array())
401 401
         {
402 402
                 global $globalDBdriver, $globalLiveInterval;
403 403
                 date_default_timezone_set('UTC');
404 404
 
405 405
                 $filter_query = '';
406 406
                 if (isset($filter['source']) && !empty($filter['source'])) {
407
-                        $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') ";
407
+                        $filter_query .= " AND format_source IN ('".implode("','", $filter['source'])."') ";
408 408
                 }
409 409
                 // Use spotter_output also ?
410 410
                 if (isset($filter['airlines']) && !empty($filter['airlines'])) {
411
-                        $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id ";
411
+                        $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id ";
412 412
                 }
413 413
                 if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
414 414
                         $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_archive.flightaware_id ";
415 415
                 }
416 416
                 if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
417
-                        $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
417
+                        $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')";
418 418
                 }
419 419
 
420 420
                 //if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
@@ -433,14 +433,14 @@  discard block
 block discarded – undo
433 433
 						GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id 
434 434
 				    AND spotter_archive.date = s.maxdate '.$filter_query.'LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON spotter_archive.aircraft_icao = a.icao';
435 435
 */
436
-			$query  = 'SELECT spotter_archive.date,spotter_archive.flightaware_id, spotter_archive.ident, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, a.aircraft_shadow,a.engine_type, a.engine_count, a.wake_category 
436
+			$query = 'SELECT spotter_archive.date,spotter_archive.flightaware_id, spotter_archive.ident, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, a.aircraft_shadow,a.engine_type, a.engine_count, a.wake_category 
437 437
 				    FROM spotter_archive 
438 438
 				    INNER JOIN (SELECT * FROM aircraft) a on spotter_archive.aircraft_icao = a.icao
439 439
 				    WHERE spotter_archive.date BETWEEN '."'".$begindate."'".' AND '."'".$begindate."'".' 
440 440
                         	    '.$filter_query.' ORDER BY flightaware_id';
441 441
                 } else {
442 442
                         //$query  = 'SELECT spotter_archive.ident, spotter_archive.flightaware_id, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, a.aircraft_shadow FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate '.$filter_query.'INNER JOIN (SELECT * FROM aircraft) a on spotter_archive.aircraft_icao = a.icao';
443
-                        $query  = 'SELECT spotter_archive.date,spotter_archive.flightaware_id, spotter_archive.ident, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, a.aircraft_shadow,a.engine_type, a.engine_count, a.wake_category 
443
+                        $query = 'SELECT spotter_archive.date,spotter_archive.flightaware_id, spotter_archive.ident, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, a.aircraft_shadow,a.engine_type, a.engine_count, a.wake_category 
444 444
                         	    FROM spotter_archive 
445 445
                         	    INNER JOIN (SELECT * FROM aircraft) a on spotter_archive.aircraft_icao = a.icao
446 446
                         	    WHERE spotter_archive.date >= '."'".$begindate."'".' AND spotter_archive.date <= '."'".$enddate."'".'
@@ -450,7 +450,7 @@  discard block
 block discarded – undo
450 450
                 try {
451 451
                         $sth = $this->db->prepare($query);
452 452
                         $sth->execute();
453
-                } catch(PDOException $e) {
453
+                } catch (PDOException $e) {
454 454
                         echo $e->getMessage();
455 455
                         die;
456 456
                 }
@@ -465,24 +465,24 @@  discard block
 block discarded – undo
465 465
         * @return Array the spotter information
466 466
         *
467 467
         */
468
-        public function getMinLiveSpotterDataPlayback($begindate,$enddate,$filter = array())
468
+        public function getMinLiveSpotterDataPlayback($begindate, $enddate, $filter = array())
469 469
         {
470 470
                 global $globalDBdriver, $globalLiveInterval;
471 471
                 date_default_timezone_set('UTC');
472 472
 
473 473
                 $filter_query = '';
474 474
                 if (isset($filter['source']) && !empty($filter['source'])) {
475
-                        $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') ";
475
+                        $filter_query .= " AND format_source IN ('".implode("','", $filter['source'])."') ";
476 476
                 }
477 477
                 // Should use spotter_output also ?
478 478
                 if (isset($filter['airlines']) && !empty($filter['airlines'])) {
479
-                        $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id ";
479
+                        $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id ";
480 480
                 }
481 481
                 if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
482 482
                         $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_archive.flightaware_id ";
483 483
                 }
484 484
                 if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
485
-                        $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
485
+                        $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')";
486 486
                 }
487 487
 
488 488
                 //if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
@@ -492,7 +492,7 @@  discard block
 block discarded – undo
492 492
                     		    FROM spotter_archive 
493 493
                     		    INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE (l.date BETWEEN '."'".$begindate."'".' AND '."'".$enddate."'".') GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate '.$filter_query.'LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON spotter_archive.aircraft_icao = a.icao';
494 494
 			*/
495
-			$query  = 'SELECT a.aircraft_shadow, spotter_archive_output.ident, spotter_archive_output.flightaware_id, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao as departure_airport, spotter_archive_output.arrival_airport_icao as arrival_airport, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk 
495
+			$query = 'SELECT a.aircraft_shadow, spotter_archive_output.ident, spotter_archive_output.flightaware_id, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao as departure_airport, spotter_archive_output.arrival_airport_icao as arrival_airport, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk 
496 496
 				    FROM spotter_archive_output 
497 497
 				    LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON spotter_archive_output.aircraft_icao = a.icao 
498 498
 				    WHERE (spotter_archive_output.date BETWEEN '."'".$begindate."'".' AND '."'".$enddate."'".') 
@@ -507,7 +507,7 @@  discard block
 block discarded – undo
507 507
                         	    WHERE spotter_archive_output.date >= '."'".$begindate."'".' AND spotter_archive_output.date <= '."'".$enddate."'".'
508 508
                         	    '.$filter_query.' GROUP BY spotter_archive_output.flightaware_id, spotter_archive_output.ident, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao, spotter_archive_output.arrival_airport_icao, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk, a.aircraft_shadow';
509 509
                         */
510
-                        $query  = 'SELECT DISTINCT spotter_archive_output.flightaware_id, spotter_archive_output.ident, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao as departure_airport, spotter_archive_output.arrival_airport_icao as arrival_airport, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk, a.aircraft_shadow
510
+                        $query = 'SELECT DISTINCT spotter_archive_output.flightaware_id, spotter_archive_output.ident, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao as departure_airport, spotter_archive_output.arrival_airport_icao as arrival_airport, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk, a.aircraft_shadow
511 511
                         	    FROM spotter_archive_output 
512 512
                         	    INNER JOIN (SELECT * FROM aircraft) a on spotter_archive_output.aircraft_icao = a.icao
513 513
                         	    WHERE spotter_archive_output.date >= '."'".$begindate."'".' AND spotter_archive_output.date <= '."'".$enddate."'".'
@@ -519,7 +519,7 @@  discard block
 block discarded – undo
519 519
                 try {
520 520
                         $sth = $this->db->prepare($query);
521 521
                         $sth->execute();
522
-                } catch(PDOException $e) {
522
+                } catch (PDOException $e) {
523 523
                         echo $e->getMessage();
524 524
                         die;
525 525
                 }
@@ -534,23 +534,23 @@  discard block
 block discarded – undo
534 534
         * @return Array the spotter information
535 535
         *
536 536
         */
537
-        public function getLiveSpotterCount($begindate,$enddate,$filter = array())
537
+        public function getLiveSpotterCount($begindate, $enddate, $filter = array())
538 538
         {
539 539
                 global $globalDBdriver, $globalLiveInterval;
540 540
                 date_default_timezone_set('UTC');
541 541
 
542 542
                 $filter_query = '';
543 543
                 if (isset($filter['source']) && !empty($filter['source'])) {
544
-                        $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') ";
544
+                        $filter_query .= " AND format_source IN ('".implode("','", $filter['source'])."') ";
545 545
                 }
546 546
                 if (isset($filter['airlines']) && !empty($filter['airlines'])) {
547
-                        $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id ";
547
+                        $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id ";
548 548
                 }
549 549
                 if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
550 550
                         $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_archive.flightaware_id ";
551 551
                 }
552 552
                 if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
553
-                        $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
553
+                        $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')";
554 554
                 }
555 555
 
556 556
                 //if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
@@ -565,7 +565,7 @@  discard block
 block discarded – undo
565 565
                 try {
566 566
                         $sth = $this->db->prepare($query);
567 567
                         $sth->execute();
568
-                } catch(PDOException $e) {
568
+                } catch (PDOException $e) {
569 569
                         echo $e->getMessage();
570 570
                         die;
571 571
                 }
@@ -585,7 +585,7 @@  discard block
 block discarded – undo
585 585
     * @return Array the spotter information
586 586
     *
587 587
     */
588
-    public function searchSpotterData($q = '', $registration = '', $aircraft_icao = '', $aircraft_manufacturer = '', $highlights = '', $airline_icao = '', $airline_country = '', $airline_type = '', $airport = '', $airport_country = '', $callsign = '', $departure_airport_route = '', $arrival_airport_route = '', $owner = '',$pilot_id = '',$pilot_name = '',$altitude = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '',$origLat = '',$origLon = '',$dist = '', $filters=array())
588
+    public function searchSpotterData($q = '', $registration = '', $aircraft_icao = '', $aircraft_manufacturer = '', $highlights = '', $airline_icao = '', $airline_country = '', $airline_type = '', $airport = '', $airport_country = '', $callsign = '', $departure_airport_route = '', $arrival_airport_route = '', $owner = '', $pilot_id = '', $pilot_name = '', $altitude = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '', $origLat = '', $origLon = '', $dist = '', $filters = array())
589 589
     {
590 590
 	global $globalTimezone, $globalDBdriver;
591 591
 	require_once(dirname(__FILE__).'/class.Translation.php');
@@ -607,7 +607,7 @@  discard block
 block discarded – undo
607 607
 	        
608 608
 		$q_array = explode(" ", $q);
609 609
 		
610
-		foreach ($q_array as $q_item){
610
+		foreach ($q_array as $q_item) {
611 611
 		    $additional_query .= " AND (";
612 612
 		    $additional_query .= "(spotter_archive_output.spotter_id like '%".$q_item."%') OR ";
613 613
 		    $additional_query .= "(spotter_archive_output.aircraft_icao like '%".$q_item."%') OR ";
@@ -639,7 +639,7 @@  discard block
 block discarded – undo
639 639
 	
640 640
 	if ($registration != "")
641 641
 	{
642
-	    $registration = filter_var($registration,FILTER_SANITIZE_STRING);
642
+	    $registration = filter_var($registration, FILTER_SANITIZE_STRING);
643 643
 	    if (!is_string($registration))
644 644
 	    {
645 645
 		return false;
@@ -650,7 +650,7 @@  discard block
 block discarded – undo
650 650
 	
651 651
 	if ($aircraft_icao != "")
652 652
 	{
653
-	    $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
653
+	    $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
654 654
 	    if (!is_string($aircraft_icao))
655 655
 	    {
656 656
 		return false;
@@ -661,7 +661,7 @@  discard block
 block discarded – undo
661 661
 	
662 662
 	if ($aircraft_manufacturer != "")
663 663
 	{
664
-	    $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
664
+	    $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
665 665
 	    if (!is_string($aircraft_manufacturer))
666 666
 	    {
667 667
 		return false;
@@ -682,7 +682,7 @@  discard block
 block discarded – undo
682 682
 	
683 683
 	if ($airline_icao != "")
684 684
 	{
685
-	    $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
685
+	    $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
686 686
 	    if (!is_string($airline_icao))
687 687
 	    {
688 688
 		return false;
@@ -693,7 +693,7 @@  discard block
 block discarded – undo
693 693
 	
694 694
 	if ($airline_country != "")
695 695
 	{
696
-	    $airline_country = filter_var($airline_country,FILTER_SANITIZE_STRING);
696
+	    $airline_country = filter_var($airline_country, FILTER_SANITIZE_STRING);
697 697
 	    if (!is_string($airline_country))
698 698
 	    {
699 699
 		return false;
@@ -704,7 +704,7 @@  discard block
 block discarded – undo
704 704
 	
705 705
 	if ($airline_type != "")
706 706
 	{
707
-	    $airline_type = filter_var($airline_type,FILTER_SANITIZE_STRING);
707
+	    $airline_type = filter_var($airline_type, FILTER_SANITIZE_STRING);
708 708
 	    if (!is_string($airline_type))
709 709
 	    {
710 710
 		return false;
@@ -726,7 +726,7 @@  discard block
 block discarded – undo
726 726
 	
727 727
 	if ($airport != "")
728 728
 	{
729
-	    $airport = filter_var($airport,FILTER_SANITIZE_STRING);
729
+	    $airport = filter_var($airport, FILTER_SANITIZE_STRING);
730 730
 	    if (!is_string($airport))
731 731
 	    {
732 732
 		return false;
@@ -737,7 +737,7 @@  discard block
 block discarded – undo
737 737
 	
738 738
 	if ($airport_country != "")
739 739
 	{
740
-	    $airport_country = filter_var($airport_country,FILTER_SANITIZE_STRING);
740
+	    $airport_country = filter_var($airport_country, FILTER_SANITIZE_STRING);
741 741
 	    if (!is_string($airport_country))
742 742
 	    {
743 743
 		return false;
@@ -748,7 +748,7 @@  discard block
 block discarded – undo
748 748
     
749 749
 	if ($callsign != "")
750 750
 	{
751
-	    $callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
751
+	    $callsign = filter_var($callsign, FILTER_SANITIZE_STRING);
752 752
 	    if (!is_string($callsign))
753 753
 	    {
754 754
 		return false;
@@ -756,7 +756,7 @@  discard block
 block discarded – undo
756 756
 		$translate = $Translation->ident2icao($callsign);
757 757
 		if ($translate != $callsign) {
758 758
 			$additional_query .= " AND (spotter_archive_output.ident = :callsign OR spotter_archive_output.ident = :translate)";
759
-			$query_values = array_merge($query_values,array(':callsign' => $callsign,':translate' => $translate));
759
+			$query_values = array_merge($query_values, array(':callsign' => $callsign, ':translate' => $translate));
760 760
 		} else {
761 761
 			$additional_query .= " AND (spotter_archive_output.ident = '".$callsign."')";
762 762
 		}
@@ -765,7 +765,7 @@  discard block
 block discarded – undo
765 765
 
766 766
 	if ($owner != "")
767 767
 	{
768
-	    $owner = filter_var($owner,FILTER_SANITIZE_STRING);
768
+	    $owner = filter_var($owner, FILTER_SANITIZE_STRING);
769 769
 	    if (!is_string($owner))
770 770
 	    {
771 771
 		return false;
@@ -776,7 +776,7 @@  discard block
 block discarded – undo
776 776
 
777 777
 	if ($pilot_name != "")
778 778
 	{
779
-	    $pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING);
779
+	    $pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING);
780 780
 	    if (!is_string($pilot_name))
781 781
 	    {
782 782
 		return false;
@@ -787,7 +787,7 @@  discard block
 block discarded – undo
787 787
 	
788 788
 	if ($pilot_id != "")
789 789
 	{
790
-	    $pilot_id = filter_var($pilot_id,FILTER_SANITIZE_NUMBER_INT);
790
+	    $pilot_id = filter_var($pilot_id, FILTER_SANITIZE_NUMBER_INT);
791 791
 	    if (!is_string($pilot_id))
792 792
 	    {
793 793
 		return false;
@@ -798,7 +798,7 @@  discard block
 block discarded – undo
798 798
 	
799 799
 	if ($departure_airport_route != "")
800 800
 	{
801
-	    $departure_airport_route = filter_var($departure_airport_route,FILTER_SANITIZE_STRING);
801
+	    $departure_airport_route = filter_var($departure_airport_route, FILTER_SANITIZE_STRING);
802 802
 	    if (!is_string($departure_airport_route))
803 803
 	    {
804 804
 		return false;
@@ -809,7 +809,7 @@  discard block
 block discarded – undo
809 809
 	
810 810
 	if ($arrival_airport_route != "")
811 811
 	{
812
-	    $arrival_airport_route = filter_var($arrival_airport_route,FILTER_SANITIZE_STRING);
812
+	    $arrival_airport_route = filter_var($arrival_airport_route, FILTER_SANITIZE_STRING);
813 813
 	    if (!is_string($arrival_airport_route))
814 814
 	    {
815 815
 		return false;
@@ -822,8 +822,8 @@  discard block
 block discarded – undo
822 822
 	{
823 823
 	    $altitude_array = explode(",", $altitude);
824 824
 	    
825
-	    $altitude_array[0] = filter_var($altitude_array[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
826
-	    $altitude_array[1] = filter_var($altitude_array[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
825
+	    $altitude_array[0] = filter_var($altitude_array[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
826
+	    $altitude_array[1] = filter_var($altitude_array[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
827 827
 	    
828 828
 
829 829
 	    if ($altitude_array[1] != "")
@@ -840,8 +840,8 @@  discard block
 block discarded – undo
840 840
 	if ($date_posted != "")
841 841
 	{
842 842
 		$date_array = explode(",", $date_posted);
843
-		$date_array[0] = filter_var($date_array[0],FILTER_SANITIZE_STRING);
844
-		$date_array[1] = filter_var($date_array[1],FILTER_SANITIZE_STRING);
843
+		$date_array[0] = filter_var($date_array[0], FILTER_SANITIZE_STRING);
844
+		$date_array[1] = filter_var($date_array[1], FILTER_SANITIZE_STRING);
845 845
 		if ($globalTimezone != '') {
846 846
 			date_default_timezone_set($globalTimezone);
847 847
 			$datetime = new DateTime();
@@ -868,8 +868,8 @@  discard block
 block discarded – undo
868 868
 		if ($limit != "")
869 869
 		{
870 870
 			$limit_array = explode(",", $limit);
871
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
872
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
871
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
872
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
873 873
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
874 874
 			{
875 875
 				//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
@@ -877,8 +877,8 @@  discard block
 block discarded – undo
877 877
 			}
878 878
 		}
879 879
 		if ($origLat != "" && $origLon != "" && $dist != "") {
880
-			$dist = number_format($dist*0.621371,2,'.','');
881
-			$query="SELECT spotter_archive_output.*, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - ABS(CAST(spotter_archive.latitude as double precision)))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(ABS(CAST(spotter_archive.latitude as double precision))*pi()/180)*POWER(SIN(($origLon-CAST(spotter_archive.longitude as double precision))*pi()/180/2),2))) as distance 
880
+			$dist = number_format($dist*0.621371, 2, '.', '');
881
+			$query = "SELECT spotter_archive_output.*, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - ABS(CAST(spotter_archive.latitude as double precision)))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(ABS(CAST(spotter_archive.latitude as double precision))*pi()/180)*POWER(SIN(($origLon-CAST(spotter_archive.longitude as double precision))*pi()/180/2),2))) as distance 
882 882
 			      FROM spotter_archive_output, spotter_archive WHERE spotter_output_archive.flightaware_id = spotter_archive.flightaware_id AND spotter_output.ident <> '' ".$additional_query."AND CAST(spotter_archive.longitude as double precision) between ($origLon-$dist/ABS(cos(radians($origLat))*69)) and ($origLon+$dist/ABS(cos(radians($origLat))*69)) and CAST(spotter_archive.latitude as double precision) between ($origLat-($dist/69)) and ($origLat+($dist/69)) 
883 883
 			      AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - ABS(CAST(spotter_archive.latitude as double precision)))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(ABS(CAST(spotter_archive.latitude as double precision))*pi()/180)*POWER(SIN(($origLon-CAST(spotter_archive.longitude as double precision))*pi()/180/2),2)))) < $dist".$filter_query." ORDER BY distance";
884 884
 		} else {
@@ -894,12 +894,12 @@  discard block
 block discarded – undo
894 894
 				$additional_query .= " AND (spotter_archive_output.waypoints <> '')";
895 895
 			}
896 896
 
897
-			$query  = "SELECT spotter_archive_output.* FROM spotter_archive_output 
897
+			$query = "SELECT spotter_archive_output.* FROM spotter_archive_output 
898 898
 			    WHERE spotter_archive_output.ident <> '' 
899 899
 			    ".$additional_query."
900 900
 			    ".$filter_query.$orderby_query;
901 901
 		}
902
-		$spotter_array = $Spotter->getDataFromDB($query, $query_values,$limit_query);
902
+		$spotter_array = $Spotter->getDataFromDB($query, $query_values, $limit_query);
903 903
 		return $spotter_array;
904 904
 	}
905 905
 
@@ -914,7 +914,7 @@  discard block
 block discarded – undo
914 914
 		try {
915 915
 			$sth = $this->db->prepare($query);
916 916
 			$sth->execute();
917
-		} catch(PDOException $e) {
917
+		} catch (PDOException $e) {
918 918
 			return "error";
919 919
 		}
920 920
 	}
@@ -951,8 +951,8 @@  discard block
 block discarded – undo
951 951
 	{
952 952
 	    $limit_array = explode(",", $limit);
953 953
 	    
954
-	    $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
955
-	    $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
954
+	    $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
955
+	    $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
956 956
 	    
957 957
 	    if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
958 958
 	    {
@@ -993,7 +993,7 @@  discard block
 block discarded – undo
993 993
 	$query_values = array();
994 994
 	$limit_query = '';
995 995
 	$additional_query = '';
996
-	$filter_query = $this->getFilter($filter,true,true);
996
+	$filter_query = $this->getFilter($filter, true, true);
997 997
 	
998 998
 	if ($owner != "")
999 999
 	{
@@ -1010,8 +1010,8 @@  discard block
 block discarded – undo
1010 1010
 	{
1011 1011
 	    $limit_array = explode(",", $limit);
1012 1012
 	    
1013
-	    $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1014
-	    $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1013
+	    $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1014
+	    $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1015 1015
 	    
1016 1016
 	    if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1017 1017
 	    {
@@ -1051,7 +1051,7 @@  discard block
 block discarded – undo
1051 1051
 	$query_values = array();
1052 1052
 	$limit_query = '';
1053 1053
 	$additional_query = '';
1054
-	$filter_query = $this->getFilter($filter,true,true);
1054
+	$filter_query = $this->getFilter($filter, true, true);
1055 1055
 	
1056 1056
 	if ($pilot != "")
1057 1057
 	{
@@ -1063,8 +1063,8 @@  discard block
 block discarded – undo
1063 1063
 	{
1064 1064
 	    $limit_array = explode(",", $limit);
1065 1065
 	    
1066
-	    $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1067
-	    $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1066
+	    $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1067
+	    $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1068 1068
 	    
1069 1069
 	    if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1070 1070
 	    {
@@ -1094,7 +1094,7 @@  discard block
 block discarded – undo
1094 1094
     * @return Array the airline country list
1095 1095
     *
1096 1096
     */
1097
-    public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '')
1097
+    public function countAllFlightOverCountries($limit = true, $olderthanmonths = 0, $sincedate = '')
1098 1098
     {
1099 1099
 	global $globalDBdriver;
1100 1100
 	/*
@@ -1123,7 +1123,7 @@  discard block
 block discarded – undo
1123 1123
 	$flight_array = array();
1124 1124
 	$temp_array = array();
1125 1125
         
1126
-	while($row = $sth->fetch(PDO::FETCH_ASSOC))
1126
+	while ($row = $sth->fetch(PDO::FETCH_ASSOC))
1127 1127
 	{
1128 1128
 	    $temp_array['flight_count'] = $row['nb'];
1129 1129
 	    $temp_array['flight_country'] = $row['name'];
@@ -1140,7 +1140,7 @@  discard block
 block discarded – undo
1140 1140
     * @return Array the airline country list
1141 1141
     *
1142 1142
     */
1143
-    public function countAllFlightOverCountriesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '')
1143
+    public function countAllFlightOverCountriesByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '')
1144 1144
     {
1145 1145
 	global $globalDBdriver;
1146 1146
 	/*
@@ -1169,7 +1169,7 @@  discard block
 block discarded – undo
1169 1169
 	$flight_array = array();
1170 1170
 	$temp_array = array();
1171 1171
         
1172
-	while($row = $sth->fetch(PDO::FETCH_ASSOC))
1172
+	while ($row = $sth->fetch(PDO::FETCH_ASSOC))
1173 1173
 	{
1174 1174
 	    $temp_array['airline_icao'] = $row['airline_icao'];
1175 1175
 	    $temp_array['flight_count'] = $row['nb'];
@@ -1187,14 +1187,14 @@  discard block
 block discarded – undo
1187 1187
     * @return Array the spotter information
1188 1188
     *
1189 1189
     */
1190
-    public function getDateArchiveSpotterDataById($id,$date)
1190
+    public function getDateArchiveSpotterDataById($id, $date)
1191 1191
     {
1192 1192
 	$Spotter = new Spotter($this->db);
1193 1193
 	date_default_timezone_set('UTC');
1194 1194
 	$id = filter_var($id, FILTER_SANITIZE_STRING);
1195
-	$query  = 'SELECT spotter_archive.* FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.flightaware_id = :id AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate ORDER BY spotter_archive.date DESC';
1196
-	$date = date('c',$date);
1197
-	$spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id,':date' => $date));
1195
+	$query = 'SELECT spotter_archive.* FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.flightaware_id = :id AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate ORDER BY spotter_archive.date DESC';
1196
+	$date = date('c', $date);
1197
+	$spotter_array = $Spotter->getDataFromDB($query, array(':id' => $id, ':date' => $date));
1198 1198
 	return $spotter_array;
1199 1199
     }
1200 1200
 
@@ -1204,14 +1204,14 @@  discard block
 block discarded – undo
1204 1204
     * @return Array the spotter information
1205 1205
     *
1206 1206
     */
1207
-    public function getDateArchiveSpotterDataByIdent($ident,$date)
1207
+    public function getDateArchiveSpotterDataByIdent($ident, $date)
1208 1208
     {
1209 1209
 	$Spotter = new Spotter($this->db);
1210 1210
 	date_default_timezone_set('UTC');
1211 1211
 	$ident = filter_var($ident, FILTER_SANITIZE_STRING);
1212
-	$query  = 'SELECT spotter_archive.* FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate ORDER BY spotter_archive.date DESC';
1213
-	$date = date('c',$date);
1214
-	$spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident,':date' => $date));
1212
+	$query = 'SELECT spotter_archive.* FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate ORDER BY spotter_archive.date DESC';
1213
+	$date = date('c', $date);
1214
+	$spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident, ':date' => $date));
1215 1215
 	return $spotter_array;
1216 1216
     }
1217 1217
 
@@ -1221,7 +1221,7 @@  discard block
 block discarded – undo
1221 1221
     * @return Array the spotter information
1222 1222
     *
1223 1223
     */
1224
-    public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '',$filters = array())
1224
+    public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '', $filters = array())
1225 1225
     {
1226 1226
 	global $global_query;
1227 1227
 	$Spotter = new Spotter($this->db);
@@ -1229,7 +1229,7 @@  discard block
 block discarded – undo
1229 1229
 	$query_values = array();
1230 1230
 	$limit_query = '';
1231 1231
 	$additional_query = '';
1232
-	$filter_query = $this->getFilter($filters,true,true);
1232
+	$filter_query = $this->getFilter($filters, true, true);
1233 1233
 	
1234 1234
 	if ($airport != "")
1235 1235
 	{
@@ -1246,8 +1246,8 @@  discard block
 block discarded – undo
1246 1246
 	{
1247 1247
 	    $limit_array = explode(",", $limit);
1248 1248
 	    
1249
-	    $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1250
-	    $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1249
+	    $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1250
+	    $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1251 1251
 	    
1252 1252
 	    if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1253 1253
 	    {
Please login to merge, or discard this patch.
require/class.Source.php 2 patches
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
 		try {
17 17
 			$sth = $this->db->prepare($query);
18 18
 			$sth->execute($query_values);
19
-		} catch(PDOException $e) {
19
+		} catch (PDOException $e) {
20 20
 			return "error : ".$e->getMessage();
21 21
 		}
22 22
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -29,20 +29,20 @@  discard block
 block discarded – undo
29 29
 		try {
30 30
 			$sth = $this->db->prepare($query);
31 31
 			$sth->execute($query_values);
32
-		} catch(PDOException $e) {
32
+		} catch (PDOException $e) {
33 33
 			return "error : ".$e->getMessage();
34 34
 		}
35 35
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
36 36
 		return $all;
37 37
 	}
38 38
 
39
-	public function getLocationInfobyNameType($name,$type) {
39
+	public function getLocationInfobyNameType($name, $type) {
40 40
 		$query = "SELECT * FROM source_location WHERE name = :name AND type = :type";
41
-		$query_values = array(':name' => $name,':type' => $type);
41
+		$query_values = array(':name' => $name, ':type' => $type);
42 42
 		try {
43 43
 			$sth = $this->db->prepare($query);
44 44
 			$sth->execute($query_values);
45
-		} catch(PDOException $e) {
45
+		} catch (PDOException $e) {
46 46
 			return "error : ".$e->getMessage();
47 47
 		}
48 48
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 		try {
56 56
 			$sth = $this->db->prepare($query);
57 57
 			$sth->execute($query_values);
58
-		} catch(PDOException $e) {
58
+		} catch (PDOException $e) {
59 59
 			return "error : ".$e->getMessage();
60 60
 		}
61 61
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -65,10 +65,10 @@  discard block
 block discarded – undo
65 65
 	public function getLocationInfoByType($type, $coord = array(), $limit = false) {
66 66
 		$query = "SELECT * FROM source_location WHERE type = :type";
67 67
 		if (is_array($coord) && !empty($coord)) {
68
-			$minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
69
-			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
70
-			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
71
-			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
68
+			$minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
69
+			$minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
70
+			$maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
71
+			$maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
72 72
 			$query .= " AND source_location.latitude BETWEEN ".$minlat." AND ".$maxlat." AND source_location.longitude BETWEEN ".$minlong." AND ".$maxlong." AND source_location.latitude <> 0 AND source_location.longitude <> 0";
73 73
 		}
74 74
 		$query .= " ORDER BY last_seen DESC";
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 		try {
78 78
 			$sth = $this->db->prepare($query);
79 79
 			$sth->execute($query_values);
80
-		} catch(PDOException $e) {
80
+		} catch (PDOException $e) {
81 81
 			return "error : ".$e->getMessage();
82 82
 		}
83 83
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 		try {
91 91
 			$sth = $this->db->prepare($query);
92 92
 			$sth->execute($query_values);
93
-		} catch(PDOException $e) {
93
+		} catch (PDOException $e) {
94 94
 			return "error : ".$e->getMessage();
95 95
 		}
96 96
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -103,56 +103,56 @@  discard block
 block discarded – undo
103 103
 		try {
104 104
 			$sth = $this->db->prepare($query);
105 105
 			$sth->execute($query_values);
106
-		} catch(PDOException $e) {
106
+		} catch (PDOException $e) {
107 107
 			return "error : ".$e->getMessage();
108 108
 		}
109 109
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
110 110
 		return $all;
111 111
 	}
112 112
 
113
-	public function addLocation($name,$latitude,$longitude,$altitude,$city,$country,$source,$logo = 'antenna.png',$type = '',$source_id = 0,$location_id = 0,$last_seen = '', $description = '') {
113
+	public function addLocation($name, $latitude, $longitude, $altitude, $city, $country, $source, $logo = 'antenna.png', $type = '', $source_id = 0, $location_id = 0, $last_seen = '', $description = '') {
114 114
 		if ($last_seen == '') $last_seen = date('Y-m-d H:i:s');
115 115
 		$query = "INSERT INTO source_location (name,latitude,longitude,altitude,country,city,logo,source,type,source_id,last_seen,location_id,description) VALUES (:name,:latitude,:longitude,:altitude,:country,:city,:logo,:source,:type,:source_id,:last_seen,:location_id,:description)";
116
-		$query_values = array(':name' => $name,':latitude' => $latitude, ':longitude' => $longitude,':altitude' => $altitude,':city' => $city,':country' => $country,':logo' => $logo,':source' => $source,':type' => $type,':source_id' => $source_id,':last_seen' => $last_seen,':location_id' => $location_id,':description' => $description);
116
+		$query_values = array(':name' => $name, ':latitude' => $latitude, ':longitude' => $longitude, ':altitude' => $altitude, ':city' => $city, ':country' => $country, ':logo' => $logo, ':source' => $source, ':type' => $type, ':source_id' => $source_id, ':last_seen' => $last_seen, ':location_id' => $location_id, ':description' => $description);
117 117
 		try {
118 118
 			$sth = $this->db->prepare($query);
119 119
 			$sth->execute($query_values);
120
-		} catch(PDOException $e) {
120
+		} catch (PDOException $e) {
121 121
 			echo "error : ".$e->getMessage();
122 122
 		}
123 123
 	}
124 124
 
125
-	public function updateLocation($name,$latitude,$longitude,$altitude,$city,$country,$source,$logo = 'antenna.png',$type = '',$source_id = 0,$location_id = 0,$last_seen = '',$description = '') {
125
+	public function updateLocation($name, $latitude, $longitude, $altitude, $city, $country, $source, $logo = 'antenna.png', $type = '', $source_id = 0, $location_id = 0, $last_seen = '', $description = '') {
126 126
 		if ($last_seen == '') $last_seen = date('Y-m-d H:i:s');
127 127
 		$query = "UPDATE source_location SET latitude = :latitude,longitude = :longitude,altitude = :altitude,country = :country,city = :city,logo = :logo,type = :type, source_id = :source_id, last_seen = :last_seen,location_id = :location_id, description = :description WHERE name = :name AND source = :source";
128
-		$query_values = array(':name' => $name,':latitude' => $latitude, ':longitude' => $longitude,':altitude' => $altitude,':city' => $city,':country' => $country,':logo' => $logo,':source' => $source,':type' => $type,':source_id' => $source_id,':last_seen' => $last_seen,':location_id' => $location_id,':description' => $description);
128
+		$query_values = array(':name' => $name, ':latitude' => $latitude, ':longitude' => $longitude, ':altitude' => $altitude, ':city' => $city, ':country' => $country, ':logo' => $logo, ':source' => $source, ':type' => $type, ':source_id' => $source_id, ':last_seen' => $last_seen, ':location_id' => $location_id, ':description' => $description);
129 129
 		try {
130 130
 			$sth = $this->db->prepare($query);
131 131
 			$sth->execute($query_values);
132
-		} catch(PDOException $e) {
132
+		} catch (PDOException $e) {
133 133
 			return "error : ".$e->getMessage();
134 134
 		}
135 135
 	}
136 136
 
137
-	public function updateLocationDescByName($name,$source,$source_id = 0,$description = '') {
137
+	public function updateLocationDescByName($name, $source, $source_id = 0, $description = '') {
138 138
 		$query = "UPDATE source_location SET description = :description WHERE source_id = :source_id AND name = :name AND source = :source";
139
-		$query_values = array(':name' => $name,':source' => $source,':source_id' => $source_id,':description' => $description);
139
+		$query_values = array(':name' => $name, ':source' => $source, ':source_id' => $source_id, ':description' => $description);
140 140
 		try {
141 141
 			$sth = $this->db->prepare($query);
142 142
 			$sth->execute($query_values);
143
-		} catch(PDOException $e) {
143
+		} catch (PDOException $e) {
144 144
 			return "error : ".$e->getMessage();
145 145
 		}
146 146
 	}
147 147
 
148
-	public function updateLocationByLocationID($name,$latitude,$longitude,$altitude,$city,$country,$source,$logo = 'antenna.png',$type = '',$source_id = 0, $location_id,$last_seen = '',$description = '') {
148
+	public function updateLocationByLocationID($name, $latitude, $longitude, $altitude, $city, $country, $source, $logo = 'antenna.png', $type = '', $source_id = 0, $location_id, $last_seen = '', $description = '') {
149 149
 		if ($last_seen == '') $last_seen = date('Y-m-d H:i:s');
150 150
 		$query = "UPDATE source_location SET latitude = :latitude,longitude = :longitude,altitude = :altitude,country = :country,city = :city,logo = :logo,type = :type, last_seen = :last_seen, description = :description WHERE location_id = :location_id AND source = :source AND source_id = :source_id";
151
-		$query_values = array(':source_id' => $source_id,':latitude' => $latitude, ':longitude' => $longitude,':altitude' => $altitude,':city' => $city,':country' => $country,':logo' => $logo,':source' => $source,':type' => $type,':last_seen' => $last_seen,':location_id' => $location_id,':description' => $description);
151
+		$query_values = array(':source_id' => $source_id, ':latitude' => $latitude, ':longitude' => $longitude, ':altitude' => $altitude, ':city' => $city, ':country' => $country, ':logo' => $logo, ':source' => $source, ':type' => $type, ':last_seen' => $last_seen, ':location_id' => $location_id, ':description' => $description);
152 152
 		try {
153 153
 			$sth = $this->db->prepare($query);
154 154
 			$sth->execute($query_values);
155
-		} catch(PDOException $e) {
155
+		} catch (PDOException $e) {
156 156
 			echo "error : ".$e->getMessage();
157 157
 		}
158 158
 	}
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
 		try {
164 164
 			$sth = $this->db->prepare($query);
165 165
 			$sth->execute($query_values);
166
-		} catch(PDOException $e) {
166
+		} catch (PDOException $e) {
167 167
 			return "error : ".$e->getMessage();
168 168
 		}
169 169
 	}
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
 		try {
175 175
 			$sth = $this->db->prepare($query);
176 176
 			$sth->execute($query_values);
177
-		} catch(PDOException $e) {
177
+		} catch (PDOException $e) {
178 178
 			return "error : ".$e->getMessage();
179 179
 		}
180 180
 	}
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
 		try {
186 186
 			$sth = $this->db->prepare($query);
187 187
 			$sth->execute($query_values);
188
-		} catch(PDOException $e) {
188
+		} catch (PDOException $e) {
189 189
 			return "error : ".$e->getMessage();
190 190
 		}
191 191
 	}
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
 		try {
196 196
 			$sth = $this->db->prepare($query);
197 197
 			$sth->execute();
198
-		} catch(PDOException $e) {
198
+		} catch (PDOException $e) {
199 199
 			return "error : ".$e->getMessage();
200 200
 		}
201 201
 	}
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
 		try {
225 225
 			$sth = $this->db->prepare($query);
226 226
 			$sth->execute(array(':type' => $type));
227
-		} catch(PDOException $e) {
227
+		} catch (PDOException $e) {
228 228
 			return "error";
229 229
 		}
230 230
 		return "success";
Please login to merge, or discard this patch.
Braces   +15 added lines, -5 removed lines patch added patch discarded remove patch
@@ -7,7 +7,9 @@  discard block
 block discarded – undo
7 7
 	public function __construct($dbc = null) {
8 8
 		$Connection = new Connection($dbc);
9 9
 		$this->db = $Connection->db;
10
-		if ($this->db === null) die('Error: No DB connection.');
10
+		if ($this->db === null) {
11
+			die('Error: No DB connection.');
12
+		}
11 13
 	}
12 14
 
13 15
 	public function getAllLocationInfo() {
@@ -72,7 +74,9 @@  discard block
 block discarded – undo
72 74
 			$query .= " AND source_location.latitude BETWEEN ".$minlat." AND ".$maxlat." AND source_location.longitude BETWEEN ".$minlong." AND ".$maxlong." AND source_location.latitude <> 0 AND source_location.longitude <> 0";
73 75
 		}
74 76
 		$query .= " ORDER BY last_seen DESC";
75
-		if ($limit) $query .= " LIMIT 200";
77
+		if ($limit) {
78
+			$query .= " LIMIT 200";
79
+		}
76 80
 		$query_values = array(':type' => $type);
77 81
 		try {
78 82
 			$sth = $this->db->prepare($query);
@@ -111,7 +115,9 @@  discard block
 block discarded – undo
111 115
 	}
112 116
 
113 117
 	public function addLocation($name,$latitude,$longitude,$altitude,$city,$country,$source,$logo = 'antenna.png',$type = '',$source_id = 0,$location_id = 0,$last_seen = '', $description = '') {
114
-		if ($last_seen == '') $last_seen = date('Y-m-d H:i:s');
118
+		if ($last_seen == '') {
119
+			$last_seen = date('Y-m-d H:i:s');
120
+		}
115 121
 		$query = "INSERT INTO source_location (name,latitude,longitude,altitude,country,city,logo,source,type,source_id,last_seen,location_id,description) VALUES (:name,:latitude,:longitude,:altitude,:country,:city,:logo,:source,:type,:source_id,:last_seen,:location_id,:description)";
116 122
 		$query_values = array(':name' => $name,':latitude' => $latitude, ':longitude' => $longitude,':altitude' => $altitude,':city' => $city,':country' => $country,':logo' => $logo,':source' => $source,':type' => $type,':source_id' => $source_id,':last_seen' => $last_seen,':location_id' => $location_id,':description' => $description);
117 123
 		try {
@@ -123,7 +129,9 @@  discard block
 block discarded – undo
123 129
 	}
124 130
 
125 131
 	public function updateLocation($name,$latitude,$longitude,$altitude,$city,$country,$source,$logo = 'antenna.png',$type = '',$source_id = 0,$location_id = 0,$last_seen = '',$description = '') {
126
-		if ($last_seen == '') $last_seen = date('Y-m-d H:i:s');
132
+		if ($last_seen == '') {
133
+			$last_seen = date('Y-m-d H:i:s');
134
+		}
127 135
 		$query = "UPDATE source_location SET latitude = :latitude,longitude = :longitude,altitude = :altitude,country = :country,city = :city,logo = :logo,type = :type, source_id = :source_id, last_seen = :last_seen,location_id = :location_id, description = :description WHERE name = :name AND source = :source";
128 136
 		$query_values = array(':name' => $name,':latitude' => $latitude, ':longitude' => $longitude,':altitude' => $altitude,':city' => $city,':country' => $country,':logo' => $logo,':source' => $source,':type' => $type,':source_id' => $source_id,':last_seen' => $last_seen,':location_id' => $location_id,':description' => $description);
129 137
 		try {
@@ -146,7 +154,9 @@  discard block
 block discarded – undo
146 154
 	}
147 155
 
148 156
 	public function updateLocationByLocationID($name,$latitude,$longitude,$altitude,$city,$country,$source,$logo = 'antenna.png',$type = '',$source_id = 0, $location_id,$last_seen = '',$description = '') {
149
-		if ($last_seen == '') $last_seen = date('Y-m-d H:i:s');
157
+		if ($last_seen == '') {
158
+			$last_seen = date('Y-m-d H:i:s');
159
+		}
150 160
 		$query = "UPDATE source_location SET latitude = :latitude,longitude = :longitude,altitude = :altitude,country = :country,city = :city,logo = :logo,type = :type, last_seen = :last_seen, description = :description WHERE location_id = :location_id AND source = :source AND source_id = :source_id";
151 161
 		$query_values = array(':source_id' => $source_id,':latitude' => $latitude, ':longitude' => $longitude,':altitude' => $altitude,':city' => $city,':country' => $country,':logo' => $logo,':source' => $source,':type' => $type,':last_seen' => $last_seen,':location_id' => $location_id,':description' => $description);
152 162
 		try {
Please login to merge, or discard this patch.
location-geojson.php 3 patches
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -14,36 +14,36 @@
 block discarded – undo
14 14
 	{
15 15
 		$coords = explode(',',$_GET['coord']);
16 16
 		if ((isset($_COOKIE['show_GroundStation']) && $_COOKIE['show_GroundStation'] == 'true') 
17
-		    || (!isset($_COOKIE['show_GroundStation']) && (!isset($globalMapGroundStation) || $globalMapGroundStation === TRUE))) {
17
+			|| (!isset($_COOKIE['show_GroundStation']) && (!isset($globalMapGroundStation) || $globalMapGroundStation === TRUE))) {
18 18
 			//$spotter_array = $Source->getAllLocationInfo();
19 19
 			$spotter_array = array_merge($spotter_array,$Source->getLocationInfoByType('gs',$coords));
20 20
 		}
21 21
 		if ((isset($_COOKIE['show_WeatherStation']) && $_COOKIE['show_WeatherStation'] == 'true') 
22
-		    || (!isset($_COOKIE['show_WeatherStation']) && (!isset($globalMapWeatherStation) || $globalMapWeatherStation === TRUE))) {
22
+			|| (!isset($_COOKIE['show_WeatherStation']) && (!isset($globalMapWeatherStation) || $globalMapWeatherStation === TRUE))) {
23 23
 			$spotter_array = array_merge($spotter_array,$Source->getLocationInfoByType('wx',$coords));
24 24
 		}
25 25
 		if ((isset($_COOKIE['show_Lightning']) && $_COOKIE['show_Lightning'] == 'true') 
26
-		    || (!isset($_COOKIE['show_Lightning']) && (!isset($globalMapLightning) || $globalMapLightning === TRUE))) {
26
+			|| (!isset($_COOKIE['show_Lightning']) && (!isset($globalMapLightning) || $globalMapLightning === TRUE))) {
27 27
 			$spotter_array = array_merge($spotter_array,$Source->getLocationInfoByType('lightning',$coords));
28 28
 		}
29 29
 		
30 30
 		if ((isset($_COOKIE['show_Fire']) && $_COOKIE['show_Fire'] == 'true') 
31
-		    || (!isset($_COOKIE['show_Fire']) && (!isset($globalMapFire) || $globalMapFire === TRUE))) {
31
+			|| (!isset($_COOKIE['show_Fire']) && (!isset($globalMapFire) || $globalMapFire === TRUE))) {
32 32
 			$spotter_array = array_merge($spotter_array,$Source->getLocationInfoByType('fires',$coords,true));
33 33
 		}
34 34
 		$spotter_array = array_merge($spotter_array,$Source->getLocationInfoByType(''));
35 35
 	} else {
36 36
 		if ((isset($_COOKIE['show_GroundStation']) && $_COOKIE['show_GroundStation'] == 'true') 
37
-		    || (!isset($_COOKIE['show_GroundStation']) && (!isset($globalMapGroundStation) || $globalMapGroundStation === TRUE))) {
37
+			|| (!isset($_COOKIE['show_GroundStation']) && (!isset($globalMapGroundStation) || $globalMapGroundStation === TRUE))) {
38 38
 			//$spotter_array = $Source->getAllLocationInfo();
39 39
 			$spotter_array = array_merge($spotter_array,$Source->getLocationInfoByType('gs'));
40 40
 		}
41 41
 		if ((isset($_COOKIE['show_WeatherStation']) && $_COOKIE['show_WeatherStation'] == 'true') 
42
-		    || (!isset($_COOKIE['show_WeatherStation']) && (!isset($globalMapWeatherStation) || $globalMapWeatherStation === TRUE))) {
42
+			|| (!isset($_COOKIE['show_WeatherStation']) && (!isset($globalMapWeatherStation) || $globalMapWeatherStation === TRUE))) {
43 43
 			$spotter_array = array_merge($spotter_array,$Source->getLocationInfoByType('wx'));
44 44
 		}
45 45
 		if ((isset($_COOKIE['show_Lightning']) && $_COOKIE['show_Lightning'] == 'true') 
46
-		    || (!isset($_COOKIE['show_Lightning']) && (!isset($globalMapLightning) || $globalMapLightning === TRUE))) {
46
+			|| (!isset($_COOKIE['show_Lightning']) && (!isset($globalMapLightning) || $globalMapLightning === TRUE))) {
47 47
 			$spotter_array = array_merge($spotter_array,$Source->getLocationInfoByType('lightning'));
48 48
 		}
49 49
 		/*
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -12,39 +12,39 @@  discard block
 block discarded – undo
12 12
 if (!isset($globalDemo)) {
13 13
 	if (isset($_GET['coord'])) 
14 14
 	{
15
-		$coords = explode(',',$_GET['coord']);
15
+		$coords = explode(',', $_GET['coord']);
16 16
 		if ((isset($_COOKIE['show_GroundStation']) && $_COOKIE['show_GroundStation'] == 'true') 
17 17
 		    || (!isset($_COOKIE['show_GroundStation']) && (!isset($globalMapGroundStation) || $globalMapGroundStation === TRUE))) {
18 18
 			//$spotter_array = $Source->getAllLocationInfo();
19
-			$spotter_array = array_merge($spotter_array,$Source->getLocationInfoByType('gs',$coords));
19
+			$spotter_array = array_merge($spotter_array, $Source->getLocationInfoByType('gs', $coords));
20 20
 		}
21 21
 		if ((isset($_COOKIE['show_WeatherStation']) && $_COOKIE['show_WeatherStation'] == 'true') 
22 22
 		    || (!isset($_COOKIE['show_WeatherStation']) && (!isset($globalMapWeatherStation) || $globalMapWeatherStation === TRUE))) {
23
-			$spotter_array = array_merge($spotter_array,$Source->getLocationInfoByType('wx',$coords));
23
+			$spotter_array = array_merge($spotter_array, $Source->getLocationInfoByType('wx', $coords));
24 24
 		}
25 25
 		if ((isset($_COOKIE['show_Lightning']) && $_COOKIE['show_Lightning'] == 'true') 
26 26
 		    || (!isset($_COOKIE['show_Lightning']) && (!isset($globalMapLightning) || $globalMapLightning === TRUE))) {
27
-			$spotter_array = array_merge($spotter_array,$Source->getLocationInfoByType('lightning',$coords));
27
+			$spotter_array = array_merge($spotter_array, $Source->getLocationInfoByType('lightning', $coords));
28 28
 		}
29 29
 		
30 30
 		if ((isset($_COOKIE['show_Fire']) && $_COOKIE['show_Fire'] == 'true') 
31 31
 		    || (!isset($_COOKIE['show_Fire']) && (!isset($globalMapFire) || $globalMapFire === TRUE))) {
32
-			$spotter_array = array_merge($spotter_array,$Source->getLocationInfoByType('fires',$coords,true));
32
+			$spotter_array = array_merge($spotter_array, $Source->getLocationInfoByType('fires', $coords, true));
33 33
 		}
34
-		$spotter_array = array_merge($spotter_array,$Source->getLocationInfoByType(''));
34
+		$spotter_array = array_merge($spotter_array, $Source->getLocationInfoByType(''));
35 35
 	} else {
36 36
 		if ((isset($_COOKIE['show_GroundStation']) && $_COOKIE['show_GroundStation'] == 'true') 
37 37
 		    || (!isset($_COOKIE['show_GroundStation']) && (!isset($globalMapGroundStation) || $globalMapGroundStation === TRUE))) {
38 38
 			//$spotter_array = $Source->getAllLocationInfo();
39
-			$spotter_array = array_merge($spotter_array,$Source->getLocationInfoByType('gs'));
39
+			$spotter_array = array_merge($spotter_array, $Source->getLocationInfoByType('gs'));
40 40
 		}
41 41
 		if ((isset($_COOKIE['show_WeatherStation']) && $_COOKIE['show_WeatherStation'] == 'true') 
42 42
 		    || (!isset($_COOKIE['show_WeatherStation']) && (!isset($globalMapWeatherStation) || $globalMapWeatherStation === TRUE))) {
43
-			$spotter_array = array_merge($spotter_array,$Source->getLocationInfoByType('wx'));
43
+			$spotter_array = array_merge($spotter_array, $Source->getLocationInfoByType('wx'));
44 44
 		}
45 45
 		if ((isset($_COOKIE['show_Lightning']) && $_COOKIE['show_Lightning'] == 'true') 
46 46
 		    || (!isset($_COOKIE['show_Lightning']) && (!isset($globalMapLightning) || $globalMapLightning === TRUE))) {
47
-			$spotter_array = array_merge($spotter_array,$Source->getLocationInfoByType('lightning'));
47
+			$spotter_array = array_merge($spotter_array, $Source->getLocationInfoByType('lightning'));
48 48
 		}
49 49
 		/*
50 50
 		if ((isset($_COOKIE['show_Fire']) && $_COOKIE['show_Fire'] == 'true') 
@@ -52,14 +52,14 @@  discard block
 block discarded – undo
52 52
 			$spotter_array = array_merge($spotter_array,$Source->getLocationInfoByType('fires',array(),true));
53 53
 		}
54 54
 		*/
55
-		$spotter_array = array_merge($spotter_array,$Source->getLocationInfoByType(''));
55
+		$spotter_array = array_merge($spotter_array, $Source->getLocationInfoByType(''));
56 56
 	}
57 57
 }
58 58
 
59 59
 $output = '{"type": "FeatureCollection","features": [';
60 60
 if (!empty($spotter_array) && count($spotter_array) > 0)
61 61
 {
62
-	foreach($spotter_array as $spotter_item)
62
+	foreach ($spotter_array as $spotter_item)
63 63
 	{
64 64
 		date_default_timezone_set('UTC');
65 65
 		$output .= '{"type": "Feature",';
@@ -78,8 +78,8 @@  discard block
 block discarded – undo
78 78
 		$output .= '"icon": "'.$globalURL.'/images/'.$spotter_item['logo'].'",';
79 79
 		$output .= '"type": "'.$spotter_item['type'].'",';
80 80
 		if ($spotter_item['type'] == 'wx') {
81
-			$weather = json_decode($spotter_item['description'],true);
82
-			if (isset($weather['temp'])) $output.= '"temp": "'.$weather['temp'].'",';
81
+			$weather = json_decode($spotter_item['description'], true);
82
+			if (isset($weather['temp'])) $output .= '"temp": "'.$weather['temp'].'",';
83 83
 		}
84 84
 		$output .= '"image_thumb": "'.$spotter_item['image_thumb'].'"';
85 85
 		$output .= '},';
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
 		$output .= '}';
90 90
 		$output .= '},';
91 91
 	}
92
-	$output  = substr($output, 0, -1);
92
+	$output = substr($output, 0, -1);
93 93
 }
94 94
 $output .= ']}';
95 95
 print $output;
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -79,7 +79,9 @@
 block discarded – undo
79 79
 		$output .= '"type": "'.$spotter_item['type'].'",';
80 80
 		if ($spotter_item['type'] == 'wx') {
81 81
 			$weather = json_decode($spotter_item['description'],true);
82
-			if (isset($weather['temp'])) $output.= '"temp": "'.$weather['temp'].'",';
82
+			if (isset($weather['temp'])) {
83
+				$output.= '"temp": "'.$weather['temp'].'",';
84
+			}
83 85
 		}
84 86
 		$output .= '"image_thumb": "'.$spotter_item['image_thumb'].'"';
85 87
 		$output .= '},';
Please login to merge, or discard this patch.
live-czml.php 3 patches
Indentation   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -39,30 +39,30 @@  discard block
 block discarded – undo
39 39
 
40 40
 
41 41
 function quaternionrotate($heading, $attitude = 0, $bank = 0) {
42
-    // Assuming the angles are in radians.
43
-    $c1 = cos($heading/2);
44
-    $s1 = sin($heading/2);
45
-    $c2 = cos($attitude/2);
46
-    $s2 = sin($attitude/2);
47
-    $c3 = cos($bank/2);
48
-    $s3 = sin($bank/2);
49
-    $c1c2 = $c1*$c2;
50
-    $s1s2 = $s1*$s2;
51
-    $w =$c1c2*$c3 - $s1s2*$s3;
52
-    $x =$c1c2*$s3 + $s1s2*$c3;
53
-    $y =$s1*$c2*$c3 + $c1*$s2*$s3;
54
-    $z =$c1*$s2*$c3 - $s1*$c2*$s3;
55
-    return array('x' => $x,'y' => $y,'z' => $z,'w' => $w);
42
+	// Assuming the angles are in radians.
43
+	$c1 = cos($heading/2);
44
+	$s1 = sin($heading/2);
45
+	$c2 = cos($attitude/2);
46
+	$s2 = sin($attitude/2);
47
+	$c3 = cos($bank/2);
48
+	$s3 = sin($bank/2);
49
+	$c1c2 = $c1*$c2;
50
+	$s1s2 = $s1*$s2;
51
+	$w =$c1c2*$c3 - $s1s2*$s3;
52
+	$x =$c1c2*$s3 + $s1s2*$c3;
53
+	$y =$s1*$c2*$c3 + $c1*$s2*$s3;
54
+	$z =$c1*$s2*$c3 - $s1*$c2*$s3;
55
+	return array('x' => $x,'y' => $y,'z' => $z,'w' => $w);
56 56
 //    return array('x' => '0.0','y' => '-0.931','z' => '0.0','w' => '0.365');
57 57
 
58 58
 }
59 59
 
60 60
 
61 61
 if (isset($_GET['download'])) {
62
-    if ($_GET['download'] == "true")
63
-    {
62
+	if ($_GET['download'] == "true")
63
+	{
64 64
 	header('Content-disposition: attachment; filename="flightairmap.json"');
65
-    }
65
+	}
66 66
 }
67 67
 header('Content-Type: text/javascript');
68 68
 
@@ -239,10 +239,10 @@  discard block
 block discarded – undo
239 239
 			$image = "images/placeholder_thumb.png";
240 240
 		}
241 241
 
242
-                if (isset($spotter_item['flightaware_id'])) $id = $spotter_item['flightaware_id'];
243
-                elseif (isset($spotter_item['famtrackid'])) $id = $spotter_item['famtrackid'];
244
-                elseif (isset($spotter_item['fammarine_id'])) $id = $spotter_item['fammarine_id'];
245
-                if ($prev_flightaware_id != $id) {
242
+				if (isset($spotter_item['flightaware_id'])) $id = $spotter_item['flightaware_id'];
243
+				elseif (isset($spotter_item['famtrackid'])) $id = $spotter_item['famtrackid'];
244
+				elseif (isset($spotter_item['fammarine_id'])) $id = $spotter_item['fammarine_id'];
245
+				if ($prev_flightaware_id != $id) {
246 246
 			if ($prev_flightaware_id != '') {
247 247
 				if ($nblatlong == 1) {
248 248
 					$output .= ',"'.date("c").'", ';
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
 							$spotter_item['wake_category'] = $aircraft_info[0]['wake_category'];
302 302
 							$spotter_item['engine_count'] = $aircraft_info[0]['engine_count'];
303 303
 						} else $aircraft_shadow = '';
304
-	    					$output .= ' "billboard" : {"image" : "'.$globalURL.'/images/aircrafts/new/'.$aircraft_shadow.'","scale" : 0.5';
304
+							$output .= ' "billboard" : {"image" : "'.$globalURL.'/images/aircrafts/new/'.$aircraft_shadow.'","scale" : 0.5';
305 305
 						if (isset($_COOKIE['IconColorForce']) && $_COOKIE['IconColorForce'] && isset($_COOKIE['IconColor'])) {
306 306
 							$rgb = $Common->hex2rgb($_COOKIE['IconColor']);
307 307
 							$output .= ',"color": {"rgba" : ['.$rgb[0].','.$rgb[1].','.$rgb[2].',255]}';
@@ -331,7 +331,7 @@  discard block
 block discarded – undo
331 331
 							$rgb = $Common->hex2rgb($_COOKIE['IconColor']);
332 332
 							$output .= ',"color": {"rgba" : ['.$rgb[0].','.$rgb[1].','.$rgb[2].',255]}';
333 333
 						}
334
-    						$output .= '},';
334
+							$output .= '},';
335 335
 					} elseif ($aircraft_icao != '') {
336 336
 						$aircraft_info = $Spotter->getAllAircraftInfo($aircraft_icao);
337 337
 						if (isset($aircraft_info[0]['engine_type'])) {
Please login to merge, or discard this patch.
Spacing   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -48,11 +48,11 @@  discard block
 block discarded – undo
48 48
     $s3 = sin($bank/2);
49 49
     $c1c2 = $c1*$c2;
50 50
     $s1s2 = $s1*$s2;
51
-    $w =$c1c2*$c3 - $s1s2*$s3;
52
-    $x =$c1c2*$s3 + $s1s2*$c3;
53
-    $y =$s1*$c2*$c3 + $c1*$s2*$s3;
54
-    $z =$c1*$s2*$c3 - $s1*$c2*$s3;
55
-    return array('x' => $x,'y' => $y,'z' => $z,'w' => $w);
51
+    $w = $c1c2*$c3 - $s1s2*$s3;
52
+    $x = $c1c2*$s3 + $s1s2*$c3;
53
+    $y = $s1*$c2*$c3 + $c1*$s2*$s3;
54
+    $z = $c1*$s2*$c3 - $s1*$c2*$s3;
55
+    return array('x' => $x, 'y' => $y, 'z' => $z, 'w' => $w);
56 56
 //    return array('x' => '0.0','y' => '-0.931','z' => '0.0','w' => '0.365');
57 57
 
58 58
 }
@@ -73,16 +73,16 @@  discard block
 block discarded – undo
73 73
 $min = false;
74 74
 $allhistory = false;
75 75
 $filter['source'] = array();
76
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt'));
77
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup'));
78
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars'));
79
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs','famaprs'));
80
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs'));
81
-if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING);
82
-if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING);
83
-if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING);
84
-if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING);
85
-if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING);
76
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'], array('vatsimtxt'));
77
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'], array('whazzup'));
78
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'], array('phpvmacars'));
79
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'], array('sbs', 'famaprs'));
80
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'], array('aprs'));
81
+if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'], FILTER_SANITIZE_STRING);
82
+if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',', $_COOKIE['filter_Airlines']), FILTER_SANITIZE_STRING);
83
+if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',', $_COOKIE['filter_Sources']), FILTER_SANITIZE_STRING);
84
+if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'], FILTER_SANITIZE_STRING);
85
+if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'], FILTER_SANITIZE_STRING);
86 86
 /*
87 87
 if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) {
88 88
 	$min = true;
@@ -129,12 +129,12 @@  discard block
 block discarded – undo
129 129
 	$from_archive = true;
130 130
 //	$begindate = filter_input(INPUT_GET,'begindate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~')));
131 131
 //	$enddate = filter_input(INPUT_GET,'enddate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~')));
132
-	$begindate = filter_input(INPUT_GET,'begindate',FILTER_SANITIZE_NUMBER_INT);
133
-	$enddate = filter_input(INPUT_GET,'enddate',FILTER_SANITIZE_NUMBER_INT);
134
-	$archivespeed = filter_input(INPUT_GET,'speed',FILTER_SANITIZE_NUMBER_INT);
135
-	$begindate = date('Y-m-d H:i:s',$begindate);
136
-	$enddate = date('Y-m-d H:i:s',$enddate);
137
-	$spotter_array = $SpotterArchive->getMinLiveSpotterDataPlayback($begindate,$enddate,$filter);
132
+	$begindate = filter_input(INPUT_GET, 'begindate', FILTER_SANITIZE_NUMBER_INT);
133
+	$enddate = filter_input(INPUT_GET, 'enddate', FILTER_SANITIZE_NUMBER_INT);
134
+	$archivespeed = filter_input(INPUT_GET, 'speed', FILTER_SANITIZE_NUMBER_INT);
135
+	$begindate = date('Y-m-d H:i:s', $begindate);
136
+	$enddate = date('Y-m-d H:i:s', $enddate);
137
+	$spotter_array = $SpotterArchive->getMinLiveSpotterDataPlayback($begindate, $enddate, $filter);
138 138
 } elseif (isset($_COOKIE['archive']) && isset($_COOKIE['archive_begin']) && isset($_COOKIE['archive_end']) && isset($_COOKIE['archive_speed'])) {
139 139
 	$from_archive = true;
140 140
 //	$begindate = filter_input(INPUT_GET,'begindate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~')));
@@ -144,34 +144,34 @@  discard block
 block discarded – undo
144 144
 	$begindate = $_COOKIE['archive_begin'];
145 145
 	$enddate = $_COOKIE['archive_end'];
146 146
 
147
-	$archivespeed = filter_var($_COOKIE['archive_speed'],FILTER_SANITIZE_NUMBER_INT);
148
-	$begindate = date('Y-m-d H:i:s',$begindate);
149
-	$enddate = date('Y-m-d H:i:s',$enddate);
147
+	$archivespeed = filter_var($_COOKIE['archive_speed'], FILTER_SANITIZE_NUMBER_INT);
148
+	$begindate = date('Y-m-d H:i:s', $begindate);
149
+	$enddate = date('Y-m-d H:i:s', $enddate);
150 150
 //	echo 'Begin : '.$begindate.' - End : '.$enddate."\n";
151
-	$spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate,$enddate,$filter);
151
+	$spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate, $enddate, $filter);
152 152
 } elseif ($tracker) {
153 153
 	$coord = array();
154 154
 	if (isset($_GET['coord']) && $_GET['coord'] != '') {
155
-		$coord = explode(',',$_GET['coord']);
155
+		$coord = explode(',', $_GET['coord']);
156 156
 	}
157
-	$spotter_array = $TrackerLive->getMinLastLiveTrackerData($coord,$filter,true);
157
+	$spotter_array = $TrackerLive->getMinLastLiveTrackerData($coord, $filter, true);
158 158
 } elseif ($marine) {
159 159
 	$coord = array();
160 160
 	if (isset($_GET['coord']) && $_GET['coord'] != '') {
161
-		$coord = explode(',',$_GET['coord']);
161
+		$coord = explode(',', $_GET['coord']);
162 162
 	}
163
-	$spotter_array = $MarineLive->getMinLastLiveMarineData($coord,$filter,true);
163
+	$spotter_array = $MarineLive->getMinLastLiveMarineData($coord, $filter, true);
164 164
 } else {
165 165
 	$coord = array();
166 166
 	if (isset($_GET['coord']) && $_GET['coord'] != '') {
167
-		$coord = explode(',',$_GET['coord']);
167
+		$coord = explode(',', $_GET['coord']);
168 168
 	}
169
-	$spotter_array = $SpotterLive->getMinLastLiveSpotterData($coord,$filter,true);
169
+	$spotter_array = $SpotterLive->getMinLastLiveSpotterData($coord, $filter, true);
170 170
 }
171 171
 //print_r($spotter_array);
172 172
 if (!empty($spotter_array) && isset($coord)) {
173 173
 	if (isset($_GET['archive'])) {
174
-		$flightcnt = $SpotterArchive->getLiveSpotterCount($begindate,$enddate,$filter);
174
+		$flightcnt = $SpotterArchive->getLiveSpotterCount($begindate, $enddate, $filter);
175 175
 	} elseif ($tracker) {
176 176
 		$flightcnt = $TrackerLive->getLiveTrackerCount($filter);
177 177
 	} elseif ($marine) {
@@ -182,15 +182,15 @@  discard block
 block discarded – undo
182 182
 	if ($flightcnt == '') $flightcnt = 0;
183 183
 } else $flightcnt = 0;
184 184
 
185
-$sqltime = round(microtime(true)-$begintime,2);
185
+$sqltime = round(microtime(true) - $begintime, 2);
186 186
 $minitime = time();
187 187
 $maxitime = 0;
188
-$lastupdate = filter_input(INPUT_GET,'update',FILTER_SANITIZE_NUMBER_INT);
188
+$lastupdate = filter_input(INPUT_GET, 'update', FILTER_SANITIZE_NUMBER_INT);
189 189
 $modelsdb = array();
190 190
 if (file_exists(dirname(__FILE__).'/models/modelsdb')) {
191
-	if (($handle = fopen(dirname(__FILE__).'/models/modelsdb','r')) !== FALSE) {
192
-		while (($row = fgetcsv($handle,1000)) !== FALSE) {
193
-			if (isset($row[1]) ){
191
+	if (($handle = fopen(dirname(__FILE__).'/models/modelsdb', 'r')) !== FALSE) {
192
+		while (($row = fgetcsv($handle, 1000)) !== FALSE) {
193
+			if (isset($row[1])) {
194 194
 				$model = $row[0];
195 195
 				$modelsdb[$model] = $row[1];
196 196
 			}
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
 if (!empty($spotter_array) && is_array($spotter_array))
228 228
 {
229 229
 	$nblatlong = 0;
230
-	foreach($spotter_array as $spotter_item)
230
+	foreach ($spotter_array as $spotter_item)
231 231
 	{
232 232
 		$j++;
233 233
 		//if (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'airwhere') $heightrelative = 'RELATIVE_TO_GROUND';
@@ -267,11 +267,11 @@  discard block
 block discarded – undo
267 267
 			$output .= '"lastupdate": "'.$lastupdate.'",';
268 268
 			$output .= '"format": "'.$spotter_item['format_source'].'",';
269 269
 			if ($tracker) {
270
-				$output.= '"type": "tracker"';
270
+				$output .= '"type": "tracker"';
271 271
 			} elseif ($marine) {
272
-				$output.= '"type": "marine"';
272
+				$output .= '"type": "marine"';
273 273
 			} else {
274
-				$output.= '"type": "flight"';
274
+				$output .= '"type": "flight"';
275 275
 			}
276 276
 			$output .= '},';
277 277
 
@@ -615,8 +615,8 @@  discard block
 block discarded – undo
615 615
 					$output .= '},';
616 616
 				}
617 617
 			}
618
-			if (isset($onground) && $onground) $output = str_replace('%onground%','true',$output);
619
-			else $output = str_replace('%onground%','false',$output);
618
+			if (isset($onground) && $onground) $output = str_replace('%onground%', 'true', $output);
619
+			else $output = str_replace('%onground%', 'false', $output);
620 620
 
621 621
 	//		$output .= '"heightReference": "CLAMP_TO_GROUND",';
622 622
 			//$output .= '"heightReference": "'.$heightrelative.'",';
@@ -631,7 +631,7 @@  discard block
 block discarded – undo
631 631
 			$output .= '"cartographicDegrees": [';
632 632
 			if ($minitime > strtotime($spotter_item['date'])) $minitime = strtotime($spotter_item['date']);
633 633
 			if ($maxitime < strtotime($spotter_item['date'])) $maxitime = strtotime($spotter_item['date']);
634
-			$output .= '"'.date("c",strtotime($spotter_item['date'])).'", ';
634
+			$output .= '"'.date("c", strtotime($spotter_item['date'])).'", ';
635 635
 			$output .= $spotter_item['longitude'].', ';
636 636
 			$output .= $spotter_item['latitude'];
637 637
 			$prevlong = $spotter_item['longitude'];
@@ -659,8 +659,8 @@  discard block
 block discarded – undo
659 659
 			//$quat = quaternionrotate(deg2rad($spotter_item['heading']),deg2rad(0),deg2rad(0));
660 660
 			//$orientation .= '"'.date("c",strtotime($spotter_item['date'])).'",'.$quat['x'].','.$quat['y'].','.$quat['z'].','.$quat['w'];
661 661
 		} else {
662
-			$nblatlong = $nblatlong+1;
663
-			$output .= ',"'.date("c",strtotime($spotter_item['date'])).'", ';
662
+			$nblatlong = $nblatlong + 1;
663
+			$output .= ',"'.date("c", strtotime($spotter_item['date'])).'", ';
664 664
 			if ($maxitime < strtotime($spotter_item['date'])) $maxitime = strtotime($spotter_item['date']);
665 665
 			if ($spotter_item['ground_speed'] == 0) {
666 666
 				$output .= $prevlong.', ';
@@ -700,15 +700,15 @@  discard block
 block discarded – undo
700 700
 }
701 701
 $output .= ']';
702 702
 if (isset($globalArchive) && $globalArchive === TRUE) {
703
-	if ((time()-$globalLiveInterval) > $minitime) {
704
-		if (time()-$globalLiveInterval > $maxitime) {
705
-			$output = str_replace('%minitime%',date("c",$maxitime),$output);
703
+	if ((time() - $globalLiveInterval) > $minitime) {
704
+		if (time() - $globalLiveInterval > $maxitime) {
705
+			$output = str_replace('%minitime%', date("c", $maxitime), $output);
706 706
 		} else {
707
-			$output = str_replace('%minitime%',date("c",time()-$globalLiveInterval),$output);
707
+			$output = str_replace('%minitime%', date("c", time() - $globalLiveInterval), $output);
708 708
 		}
709 709
 	}
710
-	else $output = str_replace('%minitime%',date("c",$minitime),$output);
711
-} else $output = str_replace('%minitime%',date("c",$minitime),$output);
712
-$output = str_replace('%maxitime%',date("c",$maxitime),$output);
710
+	else $output = str_replace('%minitime%', date("c", $minitime), $output);
711
+} else $output = str_replace('%minitime%', date("c", $minitime), $output);
712
+$output = str_replace('%maxitime%', date("c", $maxitime), $output);
713 713
 print $output;
714 714
 ?>
Please login to merge, or discard this patch.
Braces   +113 added lines, -41 removed lines patch added patch discarded remove patch
@@ -8,8 +8,12 @@  discard block
 block discarded – undo
8 8
 }
9 9
 $tracker = false;
10 10
 $marine = false;
11
-if (isset($_GET['tracker'])) $tracker = true;
12
-if (isset($_GET['marine'])) $marine = true;
11
+if (isset($_GET['tracker'])) {
12
+	$tracker = true;
13
+}
14
+if (isset($_GET['marine'])) {
15
+	$marine = true;
16
+}
13 17
 if ($tracker) {
14 18
 	require_once('require/class.Tracker.php');
15 19
 	require_once('require/class.TrackerLive.php');
@@ -66,23 +70,46 @@  discard block
 block discarded – undo
66 70
 }
67 71
 header('Content-Type: text/javascript');
68 72
 
69
-if (!isset($globalJsonCompress)) $compress = true;
70
-else $compress = $globalJsonCompress;
73
+if (!isset($globalJsonCompress)) {
74
+	$compress = true;
75
+} else {
76
+	$compress = $globalJsonCompress;
77
+}
71 78
 
72 79
 $from_archive = false;
73 80
 $min = false;
74 81
 $allhistory = false;
75 82
 $filter['source'] = array();
76
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt'));
77
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup'));
78
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars'));
79
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs','famaprs'));
80
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs'));
81
-if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING);
82
-if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING);
83
-if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING);
84
-if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING);
85
-if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING);
83
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') {
84
+	$filter['source'] = array_merge($filter['source'],array('vatsimtxt'));
85
+}
86
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') {
87
+	$filter['source'] = array_merge($filter['source'],array('whazzup'));
88
+}
89
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') {
90
+	$filter['source'] = array_merge($filter['source'],array('phpvmacars'));
91
+}
92
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') {
93
+	$filter['source'] = array_merge($filter['source'],array('sbs','famaprs'));
94
+}
95
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') {
96
+	$filter['source'] = array_merge($filter['source'],array('aprs'));
97
+}
98
+if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') {
99
+	$filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING);
100
+}
101
+if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') {
102
+	$filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING);
103
+}
104
+if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') {
105
+	$filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING);
106
+}
107
+if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') {
108
+	$filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING);
109
+}
110
+if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') {
111
+	$filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING);
112
+}
86 113
 /*
87 114
 if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) {
88 115
 	$min = true;
@@ -179,8 +206,12 @@  discard block
 block discarded – undo
179 206
 	} else {
180 207
 		$flightcnt = $SpotterLive->getLiveSpotterCount($filter);
181 208
 	}
182
-	if ($flightcnt == '') $flightcnt = 0;
183
-} else $flightcnt = 0;
209
+	if ($flightcnt == '') {
210
+		$flightcnt = 0;
211
+	}
212
+	} else {
213
+	$flightcnt = 0;
214
+}
184 215
 
185 216
 $sqltime = round(microtime(true)-$begintime,2);
186 217
 $minitime = time();
@@ -203,7 +234,9 @@  discard block
 block discarded – undo
203 234
 $j = 0;
204 235
 $prev_flightaware_id = '';
205 236
 $speed = 1;
206
-if (isset($archivespeed)) $speed = $archivespeed;
237
+if (isset($archivespeed)) {
238
+	$speed = $archivespeed;
239
+}
207 240
 $output = '[';
208 241
 if ($tracker) {
209 242
 	$output .= '{"id" : "document", "name" : "tracker","version" : "1.0"';
@@ -239,17 +272,24 @@  discard block
 block discarded – undo
239 272
 			$image = "images/placeholder_thumb.png";
240 273
 		}
241 274
 
242
-                if (isset($spotter_item['flightaware_id'])) $id = $spotter_item['flightaware_id'];
243
-                elseif (isset($spotter_item['famtrackid'])) $id = $spotter_item['famtrackid'];
244
-                elseif (isset($spotter_item['fammarine_id'])) $id = $spotter_item['fammarine_id'];
275
+                if (isset($spotter_item['flightaware_id'])) {
276
+                	$id = $spotter_item['flightaware_id'];
277
+                } elseif (isset($spotter_item['famtrackid'])) {
278
+                	$id = $spotter_item['famtrackid'];
279
+                } elseif (isset($spotter_item['fammarine_id'])) {
280
+                	$id = $spotter_item['fammarine_id'];
281
+                }
245 282
                 if ($prev_flightaware_id != $id) {
246 283
 			if ($prev_flightaware_id != '') {
247 284
 				if ($nblatlong == 1) {
248 285
 					$output .= ',"'.date("c").'", ';
249 286
 					$output .= $prevlong.', ';
250 287
 					$output .= $prevlat;
251
-					if (!$marine) $output .= ', '.$prevalt;
252
-					else $output .= ', 0';
288
+					if (!$marine) {
289
+						$output .= ', '.$prevalt;
290
+					} else {
291
+						$output .= ', 0';
292
+					}
253 293
 				}
254 294
 				$output .= ']';
255 295
 				$output .= '}';
@@ -300,7 +340,9 @@  discard block
 block discarded – undo
300 340
 							$spotter_item['engine_type'] = $aircraft_info[0]['engine_type'];
301 341
 							$spotter_item['wake_category'] = $aircraft_info[0]['wake_category'];
302 342
 							$spotter_item['engine_count'] = $aircraft_info[0]['engine_count'];
303
-						} else $aircraft_shadow = '';
343
+						} else {
344
+							$aircraft_shadow = '';
345
+						}
304 346
 	    					$output .= ' "billboard" : {"image" : "'.$globalURL.'/images/aircrafts/new/'.$aircraft_shadow.'","scale" : 0.5';
305 347
 						if (isset($_COOKIE['IconColorForce']) && $_COOKIE['IconColorForce'] && isset($_COOKIE['IconColor'])) {
306 348
 							$rgb = $Common->hex2rgb($_COOKIE['IconColor']);
@@ -308,7 +350,9 @@  discard block
 block discarded – undo
308 350
 						}
309 351
 						$output .= '},';
310 352
 					}
311
-				} else $output .= ' "billboard" : {"image" : "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAfCAYAAACVgY94AAAACXBIWXMAAC4jAAAuIwF4pT92AAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAHvgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCdmCZTAKAEAGDLY2LjAFAtAGAnf+bTAICd+Jl7AQBblCEVAaCRACATZYhEAGg7AKzPVopFAFgwABRmS8Q5ANgtADBJV2ZIALC3AMDOEAuyAAgMADBRiIUpAAR7AGDIIyN4AISZABRG8lc88SuuEOcqAAB4mbI8uSQ5RYFbCC1xB1dXLh4ozkkXKxQ2YQJhmkAuwnmZGTKBNA/g88wAAKCRFRHgg/P9eM4Ors7ONo62Dl8t6r8G/yJiYuP+5c+rcEAAAOF0ftH+LC+zGoA7BoBt/qIl7gRoXgugdfeLZrIPQLUAoOnaV/Nw+H48PEWhkLnZ2eXk5NhKxEJbYcpXff5nwl/AV/1s+X48/Pf14L7iJIEyXYFHBPjgwsz0TKUcz5IJhGLc5o9H/LcL//wd0yLESWK5WCoU41EScY5EmozzMqUiiUKSKcUl0v9k4t8s+wM+3zUAsGo+AXuRLahdYwP2SycQWHTA4vcAAPK7b8HUKAgDgGiD4c93/+8//UegJQCAZkmScQAAXkQkLlTKsz/HCAAARKCBKrBBG/TBGCzABhzBBdzBC/xgNoRCJMTCQhBCCmSAHHJgKayCQiiGzbAdKmAv1EAdNMBRaIaTcA4uwlW4Dj1wD/phCJ7BKLyBCQRByAgTYSHaiAFiilgjjggXmYX4IcFIBBKLJCDJiBRRIkuRNUgxUopUIFVIHfI9cgI5h1xGupE7yAAygvyGvEcxlIGyUT3UDLVDuag3GoRGogvQZHQxmo8WoJvQcrQaPYw2oefQq2gP2o8+Q8cwwOgYBzPEbDAuxsNCsTgsCZNjy7EirAyrxhqwVqwDu4n1Y8+xdwQSgUXACTYEd0IgYR5BSFhMWE7YSKggHCQ0EdoJNwkDhFHCJyKTqEu0JroR+cQYYjIxh1hILCPWEo8TLxB7iEPENyQSiUMyJ7mQAkmxpFTSEtJG0m5SI+ksqZs0SBojk8naZGuyBzmULCAryIXkneTD5DPkG+Qh8lsKnWJAcaT4U+IoUspqShnlEOU05QZlmDJBVaOaUt2ooVQRNY9aQq2htlKvUYeoEzR1mjnNgxZJS6WtopXTGmgXaPdpr+h0uhHdlR5Ol9BX0svpR+iX6AP0dwwNhhWDx4hnKBmbGAcYZxl3GK+YTKYZ04sZx1QwNzHrmOeZD5lvVVgqtip8FZHKCpVKlSaVGyovVKmqpqreqgtV81XLVI+pXlN9rkZVM1PjqQnUlqtVqp1Q61MbU2epO6iHqmeob1Q/pH5Z/YkGWcNMw09DpFGgsV/jvMYgC2MZs3gsIWsNq4Z1gTXEJrHN2Xx2KruY/R27iz2qqaE5QzNKM1ezUvOUZj8H45hx+Jx0TgnnKKeX836K3hTvKeIpG6Y0TLkxZVxrqpaXllirSKtRq0frvTau7aedpr1Fu1n7gQ5Bx0onXCdHZ4/OBZ3nU9lT3acKpxZNPTr1ri6qa6UbobtEd79up+6Ynr5egJ5Mb6feeb3n+hx9L/1U/W36p/VHDFgGswwkBtsMzhg8xTVxbzwdL8fb8VFDXcNAQ6VhlWGX4YSRudE8o9VGjUYPjGnGXOMk423GbcajJgYmISZLTepN7ppSTbmmKaY7TDtMx83MzaLN1pk1mz0x1zLnm+eb15vft2BaeFostqi2uGVJsuRaplnutrxuhVo5WaVYVVpds0atna0l1rutu6cRp7lOk06rntZnw7Dxtsm2qbcZsOXYBtuutm22fWFnYhdnt8Wuw+6TvZN9un2N/T0HDYfZDqsdWh1+c7RyFDpWOt6azpzuP33F9JbpL2dYzxDP2DPjthPLKcRpnVOb00dnF2e5c4PziIuJS4LLLpc+Lpsbxt3IveRKdPVxXeF60vWdm7Obwu2o26/uNu5p7ofcn8w0nymeWTNz0MPIQ+BR5dE/C5+VMGvfrH5PQ0+BZ7XnIy9jL5FXrdewt6V3qvdh7xc+9j5yn+M+4zw33jLeWV/MN8C3yLfLT8Nvnl+F30N/I/9k/3r/0QCngCUBZwOJgUGBWwL7+Hp8Ib+OPzrbZfay2e1BjKC5QRVBj4KtguXBrSFoyOyQrSH355jOkc5pDoVQfujW0Adh5mGLw34MJ4WHhVeGP45wiFga0TGXNXfR3ENz30T6RJZE3ptnMU85ry1KNSo+qi5qPNo3ujS6P8YuZlnM1VidWElsSxw5LiquNm5svt/87fOH4p3iC+N7F5gvyF1weaHOwvSFpxapLhIsOpZATIhOOJTwQRAqqBaMJfITdyWOCnnCHcJnIi/RNtGI2ENcKh5O8kgqTXqS7JG8NXkkxTOlLOW5hCepkLxMDUzdmzqeFpp2IG0yPTq9MYOSkZBxQqohTZO2Z+pn5mZ2y6xlhbL+xW6Lty8elQfJa7OQrAVZLQq2QqboVFoo1yoHsmdlV2a/zYnKOZarnivN7cyzytuQN5zvn//tEsIS4ZK2pYZLVy0dWOa9rGo5sjxxedsK4xUFK4ZWBqw8uIq2Km3VT6vtV5eufr0mek1rgV7ByoLBtQFr6wtVCuWFfevc1+1dT1gvWd+1YfqGnRs+FYmKrhTbF5cVf9go3HjlG4dvyr+Z3JS0qavEuWTPZtJm6ebeLZ5bDpaql+aXDm4N2dq0Dd9WtO319kXbL5fNKNu7g7ZDuaO/PLi8ZafJzs07P1SkVPRU+lQ27tLdtWHX+G7R7ht7vPY07NXbW7z3/T7JvttVAVVN1WbVZftJ+7P3P66Jqun4lvttXa1ObXHtxwPSA/0HIw6217nU1R3SPVRSj9Yr60cOxx++/p3vdy0NNg1VjZzG4iNwRHnk6fcJ3/ceDTradox7rOEH0x92HWcdL2pCmvKaRptTmvtbYlu6T8w+0dbq3nr8R9sfD5w0PFl5SvNUyWna6YLTk2fyz4ydlZ19fi753GDborZ752PO32oPb++6EHTh0kX/i+c7vDvOXPK4dPKy2+UTV7hXmq86X23qdOo8/pPTT8e7nLuarrlca7nuer21e2b36RueN87d9L158Rb/1tWeOT3dvfN6b/fF9/XfFt1+cif9zsu72Xcn7q28T7xf9EDtQdlD3YfVP1v+3Njv3H9qwHeg89HcR/cGhYPP/pH1jw9DBY+Zj8uGDYbrnjg+OTniP3L96fynQ89kzyaeF/6i/suuFxYvfvjV69fO0ZjRoZfyl5O/bXyl/erA6xmv28bCxh6+yXgzMV70VvvtwXfcdx3vo98PT+R8IH8o/2j5sfVT0Kf7kxmTk/8EA5jz/GMzLdsAAAAgY0hSTQAAeiUAAICDAAD5/wAAgOkAAHUwAADqYAAAOpgAABdvkl/FRgAAA7VJREFUeNrEl2uIlWUQx39nXUu0m2uQbZYrbabdLKMs/VBkmHQjioqFIhBS+hKEQpQRgVAf2u5RQkGBRUllRH4I2e5ZUBJlEZVt5i0tTfHStrZ6fn35L70d9n7Obg88vOedmWfmf2bmmZkXlRrtq9V16mZ1iVqqhd5agXvQf1c5zw/V8dXqrqO6dQKwBrgdWApsCb0VqAc2AnOrMVANwIsD4BLgTOBPYB2wHJgEzAG+ANqAu4ZsZYiuX5QwfqI2hvaNulA9J7zLQn8o76vUuuHOwXHqSzH4aIF+TWjnBkSH+nCBf716SP1KPWO4AJ6ltgfIjRW8p9U/1KPz/ry6RT2mIDNF3Zjz19Ya4G1R/J16dgWvQd2pPlXhMdVZPUTgxfCW1wJgXUJpQlvfg8zs8K8r0Caom9QHetG7NGfa1ElDBThRXRtFd/Qh16puKIS3e7+clBjdy7kL1b3q4fzJQQGck5z6Nb97kxujblWf64HXov7Vl/E4YXWccP9AAd6dAx+ox/WTArNzY1t64B0f8K0DyLXuUvRGZfcpCo1VX4tg6wB76WMB0dALf526foAX8cqUot2pGP8B2Kz+krBeNYjS8636dh/8Beo2deoA9TWp76pd6g0q9cDNwKvAD8A84EfglLRBe2g+JWAfcEF68bPABOCoAl/gIPA5MA64FVgGnNhP292W3r0SeB1YVlJXAjcBP8XwyQUj9AKwAzg2+/fQSsBhoJxBAaALaIzenZGnD911wA7gEDAD2FFSpwOzgDHZ5T7+ZSlGd2d6AXgi5+qAn+O5U0PbBVwKtAD3AHuB8f3YGBUdncCGoQ4LE9XtGRqK9LnduVPRIu2BPqwD65IYbS7Qpql7Ql9YoJcy9bwzkgPrfOCj5G33+h54E/g0PAr5thq4ApgyEgNrc27aWwVaPTA1QJ4BjgTGFvhteV40EgPrgvTP7qlmZqFnl9WD+b2posN83E/NrEkOjlI/U1fkfUYa/pe5IE3qZPW8jFOqiyN7p3pAPX04c7AxYSoDDcAjKT2LgLXA6IR2M3Bviv59wDTgQGTPH84Qd8+HXfHcoUws2zM0HMjuUPep+xP2PWpnwtw0GJsldbBpewQwE/gbeDyt7H1gcW53O7AC+A3Yn6+/W+Ld9SnWA15DAVhc8xK2TuA9YHrCuhV4EngFuBx4YagG6qv8cF+T52kB2Zy+e1I8taUacNV+uBdXO7ABmJwJpwx8XQvF9TUCWM64tiQhbq/oMv+7BwFWpQzNT8vbVQul/wwAGzzdmXU1xuUAAAAASUVORK5CYII=","scale" : 0.5},';
353
+				} else {
354
+					$output .= ' "billboard" : {"image" : "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAfCAYAAACVgY94AAAACXBIWXMAAC4jAAAuIwF4pT92AAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAHvgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCdmCZTAKAEAGDLY2LjAFAtAGAnf+bTAICd+Jl7AQBblCEVAaCRACATZYhEAGg7AKzPVopFAFgwABRmS8Q5ANgtADBJV2ZIALC3AMDOEAuyAAgMADBRiIUpAAR7AGDIIyN4AISZABRG8lc88SuuEOcqAAB4mbI8uSQ5RYFbCC1xB1dXLh4ozkkXKxQ2YQJhmkAuwnmZGTKBNA/g88wAAKCRFRHgg/P9eM4Ors7ONo62Dl8t6r8G/yJiYuP+5c+rcEAAAOF0ftH+LC+zGoA7BoBt/qIl7gRoXgugdfeLZrIPQLUAoOnaV/Nw+H48PEWhkLnZ2eXk5NhKxEJbYcpXff5nwl/AV/1s+X48/Pf14L7iJIEyXYFHBPjgwsz0TKUcz5IJhGLc5o9H/LcL//wd0yLESWK5WCoU41EScY5EmozzMqUiiUKSKcUl0v9k4t8s+wM+3zUAsGo+AXuRLahdYwP2SycQWHTA4vcAAPK7b8HUKAgDgGiD4c93/+8//UegJQCAZkmScQAAXkQkLlTKsz/HCAAARKCBKrBBG/TBGCzABhzBBdzBC/xgNoRCJMTCQhBCCmSAHHJgKayCQiiGzbAdKmAv1EAdNMBRaIaTcA4uwlW4Dj1wD/phCJ7BKLyBCQRByAgTYSHaiAFiilgjjggXmYX4IcFIBBKLJCDJiBRRIkuRNUgxUopUIFVIHfI9cgI5h1xGupE7yAAygvyGvEcxlIGyUT3UDLVDuag3GoRGogvQZHQxmo8WoJvQcrQaPYw2oefQq2gP2o8+Q8cwwOgYBzPEbDAuxsNCsTgsCZNjy7EirAyrxhqwVqwDu4n1Y8+xdwQSgUXACTYEd0IgYR5BSFhMWE7YSKggHCQ0EdoJNwkDhFHCJyKTqEu0JroR+cQYYjIxh1hILCPWEo8TLxB7iEPENyQSiUMyJ7mQAkmxpFTSEtJG0m5SI+ksqZs0SBojk8naZGuyBzmULCAryIXkneTD5DPkG+Qh8lsKnWJAcaT4U+IoUspqShnlEOU05QZlmDJBVaOaUt2ooVQRNY9aQq2htlKvUYeoEzR1mjnNgxZJS6WtopXTGmgXaPdpr+h0uhHdlR5Ol9BX0svpR+iX6AP0dwwNhhWDx4hnKBmbGAcYZxl3GK+YTKYZ04sZx1QwNzHrmOeZD5lvVVgqtip8FZHKCpVKlSaVGyovVKmqpqreqgtV81XLVI+pXlN9rkZVM1PjqQnUlqtVqp1Q61MbU2epO6iHqmeob1Q/pH5Z/YkGWcNMw09DpFGgsV/jvMYgC2MZs3gsIWsNq4Z1gTXEJrHN2Xx2KruY/R27iz2qqaE5QzNKM1ezUvOUZj8H45hx+Jx0TgnnKKeX836K3hTvKeIpG6Y0TLkxZVxrqpaXllirSKtRq0frvTau7aedpr1Fu1n7gQ5Bx0onXCdHZ4/OBZ3nU9lT3acKpxZNPTr1ri6qa6UbobtEd79up+6Ynr5egJ5Mb6feeb3n+hx9L/1U/W36p/VHDFgGswwkBtsMzhg8xTVxbzwdL8fb8VFDXcNAQ6VhlWGX4YSRudE8o9VGjUYPjGnGXOMk423GbcajJgYmISZLTepN7ppSTbmmKaY7TDtMx83MzaLN1pk1mz0x1zLnm+eb15vft2BaeFostqi2uGVJsuRaplnutrxuhVo5WaVYVVpds0atna0l1rutu6cRp7lOk06rntZnw7Dxtsm2qbcZsOXYBtuutm22fWFnYhdnt8Wuw+6TvZN9un2N/T0HDYfZDqsdWh1+c7RyFDpWOt6azpzuP33F9JbpL2dYzxDP2DPjthPLKcRpnVOb00dnF2e5c4PziIuJS4LLLpc+Lpsbxt3IveRKdPVxXeF60vWdm7Obwu2o26/uNu5p7ofcn8w0nymeWTNz0MPIQ+BR5dE/C5+VMGvfrH5PQ0+BZ7XnIy9jL5FXrdewt6V3qvdh7xc+9j5yn+M+4zw33jLeWV/MN8C3yLfLT8Nvnl+F30N/I/9k/3r/0QCngCUBZwOJgUGBWwL7+Hp8Ib+OPzrbZfay2e1BjKC5QRVBj4KtguXBrSFoyOyQrSH355jOkc5pDoVQfujW0Adh5mGLw34MJ4WHhVeGP45wiFga0TGXNXfR3ENz30T6RJZE3ptnMU85ry1KNSo+qi5qPNo3ujS6P8YuZlnM1VidWElsSxw5LiquNm5svt/87fOH4p3iC+N7F5gvyF1weaHOwvSFpxapLhIsOpZATIhOOJTwQRAqqBaMJfITdyWOCnnCHcJnIi/RNtGI2ENcKh5O8kgqTXqS7JG8NXkkxTOlLOW5hCepkLxMDUzdmzqeFpp2IG0yPTq9MYOSkZBxQqohTZO2Z+pn5mZ2y6xlhbL+xW6Lty8elQfJa7OQrAVZLQq2QqboVFoo1yoHsmdlV2a/zYnKOZarnivN7cyzytuQN5zvn//tEsIS4ZK2pYZLVy0dWOa9rGo5sjxxedsK4xUFK4ZWBqw8uIq2Km3VT6vtV5eufr0mek1rgV7ByoLBtQFr6wtVCuWFfevc1+1dT1gvWd+1YfqGnRs+FYmKrhTbF5cVf9go3HjlG4dvyr+Z3JS0qavEuWTPZtJm6ebeLZ5bDpaql+aXDm4N2dq0Dd9WtO319kXbL5fNKNu7g7ZDuaO/PLi8ZafJzs07P1SkVPRU+lQ27tLdtWHX+G7R7ht7vPY07NXbW7z3/T7JvttVAVVN1WbVZftJ+7P3P66Jqun4lvttXa1ObXHtxwPSA/0HIw6217nU1R3SPVRSj9Yr60cOxx++/p3vdy0NNg1VjZzG4iNwRHnk6fcJ3/ceDTradox7rOEH0x92HWcdL2pCmvKaRptTmvtbYlu6T8w+0dbq3nr8R9sfD5w0PFl5SvNUyWna6YLTk2fyz4ydlZ19fi753GDborZ752PO32oPb++6EHTh0kX/i+c7vDvOXPK4dPKy2+UTV7hXmq86X23qdOo8/pPTT8e7nLuarrlca7nuer21e2b36RueN87d9L158Rb/1tWeOT3dvfN6b/fF9/XfFt1+cif9zsu72Xcn7q28T7xf9EDtQdlD3YfVP1v+3Njv3H9qwHeg89HcR/cGhYPP/pH1jw9DBY+Zj8uGDYbrnjg+OTniP3L96fynQ89kzyaeF/6i/suuFxYvfvjV69fO0ZjRoZfyl5O/bXyl/erA6xmv28bCxh6+yXgzMV70VvvtwXfcdx3vo98PT+R8IH8o/2j5sfVT0Kf7kxmTk/8EA5jz/GMzLdsAAAAgY0hSTQAAeiUAAICDAAD5/wAAgOkAAHUwAADqYAAAOpgAABdvkl/FRgAAA7VJREFUeNrEl2uIlWUQx39nXUu0m2uQbZYrbabdLKMs/VBkmHQjioqFIhBS+hKEQpQRgVAf2u5RQkGBRUllRH4I2e5ZUBJlEZVt5i0tTfHStrZ6fn35L70d9n7Obg88vOedmWfmf2bmmZkXlRrtq9V16mZ1iVqqhd5agXvQf1c5zw/V8dXqrqO6dQKwBrgdWApsCb0VqAc2AnOrMVANwIsD4BLgTOBPYB2wHJgEzAG+ANqAu4ZsZYiuX5QwfqI2hvaNulA9J7zLQn8o76vUuuHOwXHqSzH4aIF+TWjnBkSH+nCBf716SP1KPWO4AJ6ltgfIjRW8p9U/1KPz/ry6RT2mIDNF3Zjz19Ya4G1R/J16dgWvQd2pPlXhMdVZPUTgxfCW1wJgXUJpQlvfg8zs8K8r0Caom9QHetG7NGfa1ElDBThRXRtFd/Qh16puKIS3e7+clBjdy7kL1b3q4fzJQQGck5z6Nb97kxujblWf64HXov7Vl/E4YXWccP9AAd6dAx+ox/WTArNzY1t64B0f8K0DyLXuUvRGZfcpCo1VX4tg6wB76WMB0dALf526foAX8cqUot2pGP8B2Kz+krBeNYjS8636dh/8Beo2deoA9TWp76pd6g0q9cDNwKvAD8A84EfglLRBe2g+JWAfcEF68bPABOCoAl/gIPA5MA64FVgGnNhP292W3r0SeB1YVlJXAjcBP8XwyQUj9AKwAzg2+/fQSsBhoJxBAaALaIzenZGnD911wA7gEDAD2FFSpwOzgDHZ5T7+ZSlGd2d6AXgi5+qAn+O5U0PbBVwKtAD3AHuB8f3YGBUdncCGoQ4LE9XtGRqK9LnduVPRIu2BPqwD65IYbS7Qpql7Ql9YoJcy9bwzkgPrfOCj5G33+h54E/g0PAr5thq4ApgyEgNrc27aWwVaPTA1QJ4BjgTGFvhteV40EgPrgvTP7qlmZqFnl9WD+b2posN83E/NrEkOjlI/U1fkfUYa/pe5IE3qZPW8jFOqiyN7p3pAPX04c7AxYSoDDcAjKT2LgLXA6IR2M3Bviv59wDTgQGTPH84Qd8+HXfHcoUws2zM0HMjuUPep+xP2PWpnwtw0GJsldbBpewQwE/gbeDyt7H1gcW53O7AC+A3Yn6+/W+Ld9SnWA15DAVhc8xK2TuA9YHrCuhV4EngFuBx4YagG6qv8cF+T52kB2Zy+e1I8taUacNV+uBdXO7ABmJwJpwx8XQvF9TUCWM64tiQhbq/oMv+7BwFWpQzNT8vbVQul/wwAGzzdmXU1xuUAAAAASUVORK5CYII=","scale" : 0.5},';
355
+				}
312 356
 			} elseif ($one3dmodel) {
313 357
 				if (isset($globalMap3DForceModel) && $globalMap3DForceModel != '') {
314 358
 					$output .= '"model": {"gltf" : "'.$globalURL.'/models/'.$globalMap3DForceModel.'","scale" : 1.0,"minimumPixelSize": 20';
@@ -339,7 +383,9 @@  discard block
 block discarded – undo
339 383
 							$spotter_item['engine_type'] = $aircraft_info[0]['engine_type'];
340 384
 							$spotter_item['wake_category'] = $aircraft_info[0]['wake_category'];
341 385
 							$spotter_item['engine_count'] = $aircraft_info[0]['engine_count'];
342
-						} else $aircraft_shadow = '';
386
+						} else {
387
+							$aircraft_shadow = '';
388
+						}
343 389
 						if ($aircraft_shadow != '') {
344 390
 							if (isset($modelsdb[$aircraft_shadow])) {
345 391
 								$output .= '"model": {"gltf" : "'.$globalURL.'/models/'.$modelsdb[$aircraft_shadow].'","scale" : 1.0,"minimumPixelSize": 20';
@@ -476,7 +522,9 @@  discard block
 block discarded – undo
476 522
 								}
477 523
 								$output .= '},';
478 524
 								//if ($spotter_item['aircraft_shadow'] != '') $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",';
479
-								if ($spotter_item['aircraft_icao'] != '') $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",';
525
+								if ($spotter_item['aircraft_icao'] != '') {
526
+									$output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",';
527
+								}
480 528
 								$modelsdb[$aircraft_icao] = 'Cesium_Air.glb';
481 529
 							}
482 530
 						} elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') {
@@ -498,7 +546,9 @@  discard block
 block discarded – undo
498 546
 							}
499 547
 							$output .= '},';
500 548
 							//if ($spotter_item['aircraft_shadow'] != '') $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",';
501
-							if ($spotter_item['aircraft_icao'] != '') $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",';
549
+							if ($spotter_item['aircraft_icao'] != '') {
550
+								$output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",';
551
+							}
502 552
 							$modelsdb[$aircraft_icao] = 'Cesium_Air.glb';
503 553
 						}
504 554
 					} else {
@@ -511,7 +561,9 @@  discard block
 block discarded – undo
511 561
 						}
512 562
 						$output .= '},';
513 563
 						//if ($spotter_item['aircraft_shadow'] != '') $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",';
514
-						if ($spotter_item['aircraft_icao'] != '') $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",';
564
+						if ($spotter_item['aircraft_icao'] != '') {
565
+							$output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",';
566
+						}
515 567
 						$modelsdb[$aircraft_icao] = 'Cesium_Air.glb';
516 568
 					}
517 569
 				} elseif ($tracker && isset($spotter_item['type'])) {
@@ -615,8 +667,11 @@  discard block
 block discarded – undo
615 667
 					$output .= '},';
616 668
 				}
617 669
 			}
618
-			if (isset($onground) && $onground) $output = str_replace('%onground%','true',$output);
619
-			else $output = str_replace('%onground%','false',$output);
670
+			if (isset($onground) && $onground) {
671
+				$output = str_replace('%onground%','true',$output);
672
+			} else {
673
+				$output = str_replace('%onground%','false',$output);
674
+			}
620 675
 
621 676
 	//		$output .= '"heightReference": "CLAMP_TO_GROUND",';
622 677
 			//$output .= '"heightReference": "'.$heightrelative.'",';
@@ -629,8 +684,12 @@  discard block
 block discarded – undo
629 684
 	//		$output .= '"interpolationDegree" : 5,';
630 685
 	//		$output .= '"epoch" : "'.date("c",strtotime($spotter_item['date'])).'", ';
631 686
 			$output .= '"cartographicDegrees": [';
632
-			if ($minitime > strtotime($spotter_item['date'])) $minitime = strtotime($spotter_item['date']);
633
-			if ($maxitime < strtotime($spotter_item['date'])) $maxitime = strtotime($spotter_item['date']);
687
+			if ($minitime > strtotime($spotter_item['date'])) {
688
+				$minitime = strtotime($spotter_item['date']);
689
+			}
690
+			if ($maxitime < strtotime($spotter_item['date'])) {
691
+				$maxitime = strtotime($spotter_item['date']);
692
+			}
634 693
 			$output .= '"'.date("c",strtotime($spotter_item['date'])).'", ';
635 694
 			$output .= $spotter_item['longitude'].', ';
636 695
 			$output .= $spotter_item['latitude'];
@@ -653,7 +712,9 @@  discard block
 block discarded – undo
653 712
 					$output .= ', '.round($spotter_item['altitude']*30.48);
654 713
 					$prevalt = round($spotter_item['altitude']*30.48);
655 714
 				}
656
-			} else $output .= ', 0';
715
+			} else {
716
+				$output .= ', 0';
717
+			}
657 718
 			//$orientation = '"orientation" : { ';
658 719
 			//$orientation .= '"unitQuaternion": [';
659 720
 			//$quat = quaternionrotate(deg2rad($spotter_item['heading']),deg2rad(0),deg2rad(0));
@@ -661,13 +722,18 @@  discard block
 block discarded – undo
661 722
 		} else {
662 723
 			$nblatlong = $nblatlong+1;
663 724
 			$output .= ',"'.date("c",strtotime($spotter_item['date'])).'", ';
664
-			if ($maxitime < strtotime($spotter_item['date'])) $maxitime = strtotime($spotter_item['date']);
725
+			if ($maxitime < strtotime($spotter_item['date'])) {
726
+				$maxitime = strtotime($spotter_item['date']);
727
+			}
665 728
 			if ($spotter_item['ground_speed'] == 0) {
666 729
 				$output .= $prevlong.', ';
667 730
 				$output .= $prevlat;
668 731
 				//if (!$marine && (!isset($onground) || !$onground)) $output .= ', '.$prevalt;
669
-				if (!$marine) $output .= ', '.$prevalt;
670
-				else $output .= ', 0';
732
+				if (!$marine) {
733
+					$output .= ', '.$prevalt;
734
+				} else {
735
+					$output .= ', 0';
736
+				}
671 737
 			} else {
672 738
 				$output .= $spotter_item['longitude'].', ';
673 739
 				$output .= $spotter_item['latitude'];
@@ -680,14 +746,17 @@  discard block
 block discarded – undo
680 746
 							$output .= ', 0';
681 747
 						}
682 748
 					} else {
683
-						if (isset($spotter_item['real_altitude']) && $spotter_item['real_altitude'] != '') $output .= ', '.round($spotter_item['real_altitude']*0.3048);
684
-						elseif ($tracker) {
749
+						if (isset($spotter_item['real_altitude']) && $spotter_item['real_altitude'] != '') {
750
+							$output .= ', '.round($spotter_item['real_altitude']*0.3048);
751
+						} elseif ($tracker) {
685 752
 							$output .= ', '.round($spotter_item['altitude']*0.3048);
686 753
 						} else {
687 754
 							$output .= ', '.round($spotter_item['altitude']*30.48);
688 755
 						}
689 756
 					}
690
-				} else $output .= ', 0';
757
+				} else {
758
+					$output .= ', 0';
759
+				}
691 760
 			}
692 761
 			//$quat = quaternionrotate(deg2rad($spotter_item['heading']),deg2rad(0),deg2rad(0));
693 762
 			//$orientation .= ',"'.date("c",strtotime($spotter_item['date'])).'",'.$quat['x'].','.$quat['y'].','.$quat['z'].','.$quat['w'];
@@ -706,9 +775,12 @@  discard block
 block discarded – undo
706 775
 		} else {
707 776
 			$output = str_replace('%minitime%',date("c",time()-$globalLiveInterval),$output);
708 777
 		}
778
+	} else {
779
+		$output = str_replace('%minitime%',date("c",$minitime),$output);
709 780
 	}
710
-	else $output = str_replace('%minitime%',date("c",$minitime),$output);
711
-} else $output = str_replace('%minitime%',date("c",$minitime),$output);
781
+	} else {
782
+	$output = str_replace('%minitime%',date("c",$minitime),$output);
783
+}
712 784
 $output = str_replace('%maxitime%',date("c",$maxitime),$output);
713 785
 print $output;
714 786
 ?>
Please login to merge, or discard this patch.