Completed
Push — master ( 2c5525...528bd8 )
by Yannick
32:59
created
tracker-data.php 1 patch
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -78,10 +78,10 @@  discard block
 block discarded – undo
78 78
 print '<div class="details">';
79 79
 print '<div><span>'._("Altitude").'</span>';
80 80
 if (isset($globalGroundAltitude) && $globalGroundAltitude) {
81
-    try {
81
+	try {
82 82
 	$groundAltitude = $Elevation->getElevation($spotter_item['latitude'],$spotter_item['longitude']);
83
-    } catch(Exception $e) {
84
-    }
83
+	} catch(Exception $e) {
84
+	}
85 85
 }
86 86
 print '<span class="altitude">';
87 87
 if ((!isset($_COOKIE['unitaltitude']) && isset($globalUnitAltitude) && $globalUnitAltitude == 'feet') || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'feet')) {
@@ -91,17 +91,17 @@  discard block
 block discarded – undo
91 91
 }
92 92
 print '</span>';
93 93
 if (isset($groundAltitude) && $groundAltitude < $spotter_item['altitude']*0.3048) {
94
-    print '<br>';
95
-    print '<span>'._("Ground Altitude").'</span>';
96
-    print '<i>';
97
-    print '<span class="groundaltitude">';
98
-    if ((!isset($_COOKIE['unitaltitude']) && isset($globalUnitAltitude) && $globalUnitAltitude == 'feet') || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'feet')) {
94
+	print '<br>';
95
+	print '<span>'._("Ground Altitude").'</span>';
96
+	print '<i>';
97
+	print '<span class="groundaltitude">';
98
+	if ((!isset($_COOKIE['unitaltitude']) && isset($globalUnitAltitude) && $globalUnitAltitude == 'feet') || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'feet')) {
99 99
 	print round($groundAltitude*3.28084).' feet';
100
-    } else {
100
+	} else {
101 101
 	print round($groundAltitude).' m';
102
-    }
103
-    print '</span>';
104
-    print '</i>';
102
+	}
103
+	print '</span>';
104
+	print '</i>';
105 105
 }
106 106
 print '</div>';
107 107
 print '<div><span>'._("Speed").'</span>';
Please login to merge, or discard this patch.
require/class.SpotterImport.php 1 patch
Indentation   +424 added lines, -424 removed lines patch added patch discarded remove patch
@@ -9,20 +9,20 @@  discard block
 block discarded – undo
9 9
 require_once(dirname(__FILE__).'/class.Source.php');
10 10
 require_once(dirname(__FILE__).'/class.GeoidHeight.php');
11 11
 if (isset($globalServerAPRS) && $globalServerAPRS) {
12
-    require_once(dirname(__FILE__).'/class.APRS.php');
12
+	require_once(dirname(__FILE__).'/class.APRS.php');
13 13
 }
14 14
 
15 15
 class SpotterImport {
16
-    private $all_flights = array();
17
-    private $last_delete_hourly = 0;
18
-    private $last_delete = 0;
19
-    private $stats = array();
20
-    private $tmd = 0;
21
-    private $source_location = array();
22
-    public $db = null;
23
-    public $nb = 0;
16
+	private $all_flights = array();
17
+	private $last_delete_hourly = 0;
18
+	private $last_delete = 0;
19
+	private $stats = array();
20
+	private $tmd = 0;
21
+	private $source_location = array();
22
+	public $db = null;
23
+	public $nb = 0;
24 24
 
25
-    public function __construct($dbc = null) {
25
+	public function __construct($dbc = null) {
26 26
 	global $globalBeta, $globalServerAPRS, $APRSSpotter, $globalNoDB, $GeoidClass, $globalDebug, $globalGeoid;
27 27
 	if (!(isset($globalNoDB) && $globalNoDB)) {
28 28
 		$Connection = new Connection($dbc);
@@ -34,14 +34,14 @@  discard block
 block discarded – undo
34 34
 		$currentdate = date('Y-m-d');
35 35
 		$sourcestat = $Stats->getStatsSource($currentdate);
36 36
 		if (!empty($sourcestat)) {
37
-		    foreach($sourcestat as $srcst) {
38
-		    	$type = $srcst['stats_type'];
37
+			foreach($sourcestat as $srcst) {
38
+				$type = $srcst['stats_type'];
39 39
 			if ($type == 'polar' || $type == 'hist') {
40
-			    $source = $srcst['source_name'];
41
-			    $data = $srcst['source_data'];
42
-			    $this->stats[$currentdate][$source][$type] = json_decode($data,true);
43
-	    		}
44
-		    }
40
+				$source = $srcst['source_name'];
41
+				$data = $srcst['source_data'];
42
+				$this->stats[$currentdate][$source][$type] = json_decode($data,true);
43
+				}
44
+			}
45 45
 		}
46 46
 	}
47 47
 	if (isset($globalServerAPRS) && $globalServerAPRS) {
@@ -56,9 +56,9 @@  discard block
 block discarded – undo
56 56
 			$GeoidClass = FALSE;
57 57
 		}
58 58
 	}
59
-    }
59
+	}
60 60
 
61
-    public function get_Schedule($id,$ident) {
61
+	public function get_Schedule($id,$ident) {
62 62
 	global $globalDebug, $globalFork, $globalSchedulesFetch;
63 63
 	// Get schedule here, so it's done only one time
64 64
 	
@@ -78,43 +78,43 @@  discard block
 block discarded – undo
78 78
 	$operator = $Spotter->getOperator($ident);
79 79
 	$scheduleexist = false;
80 80
 	if ($Schedule->checkSchedule($operator) == 0) {
81
-	    $operator = $Translation->checkTranslation($ident);
82
-	    if ($Schedule->checkSchedule($operator) == 0) {
81
+		$operator = $Translation->checkTranslation($ident);
82
+		if ($Schedule->checkSchedule($operator) == 0) {
83 83
 		$schedule = $Schedule->fetchSchedule($operator);
84 84
 		if (count($schedule) > 0 && isset($schedule['DepartureTime']) && isset($schedule['ArrivalTime'])) {
85
-		    if ($globalDebug) echo "-> Schedule info for ".$operator." (".$ident.")\n";
86
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport_time' => $schedule['DepartureTime']));
87
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('arrival_airport_time' => $schedule['ArrivalTime']));
88
-		    // Should also check if route schedule = route from DB
89
-		    if ($schedule['DepartureAirportIATA'] != '') {
85
+			if ($globalDebug) echo "-> Schedule info for ".$operator." (".$ident.")\n";
86
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport_time' => $schedule['DepartureTime']));
87
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('arrival_airport_time' => $schedule['ArrivalTime']));
88
+			// Should also check if route schedule = route from DB
89
+			if ($schedule['DepartureAirportIATA'] != '') {
90 90
 			if ($this->all_flights[$id]['departure_airport'] != $Spotter->getAirportIcao($schedule['DepartureAirportIATA'])) {
91
-			    $airport_icao = $Spotter->getAirportIcao($schedule['DepartureAirportIATA']);
92
-			    if (trim($airport_icao) != '') {
91
+				$airport_icao = $Spotter->getAirportIcao($schedule['DepartureAirportIATA']);
92
+				if (trim($airport_icao) != '') {
93 93
 				$this->all_flights[$id]['departure_airport'] = $airport_icao;
94 94
 				if ($globalDebug) echo "-> Change departure airport to ".$airport_icao." for ".$ident."\n";
95
-			    }
95
+				}
96
+			}
96 97
 			}
97
-		    }
98
-		    if ($schedule['ArrivalAirportIATA'] != '') {
98
+			if ($schedule['ArrivalAirportIATA'] != '') {
99 99
 			if ($this->all_flights[$id]['arrival_airport'] != $Spotter->getAirportIcao($schedule['ArrivalAirportIATA'])) {
100
-			    $airport_icao = $Spotter->getAirportIcao($schedule['ArrivalAirportIATA']);
101
-			    if (trim($airport_icao) != '') {
100
+				$airport_icao = $Spotter->getAirportIcao($schedule['ArrivalAirportIATA']);
101
+				if (trim($airport_icao) != '') {
102 102
 				$this->all_flights[$id]['arrival_airport'] = $airport_icao;
103 103
 				if ($globalDebug) echo "-> Change arrival airport to ".$airport_icao." for ".$ident."\n";
104
-			    }
104
+				}
105 105
 			}
106
-		    }
107
-		    $Schedule->addSchedule($operator,$this->all_flights[$id]['departure_airport'],$this->all_flights[$id]['departure_airport_time'],$this->all_flights[$id]['arrival_airport'],$this->all_flights[$id]['arrival_airport_time'],$schedule['Source']);
106
+			}
107
+			$Schedule->addSchedule($operator,$this->all_flights[$id]['departure_airport'],$this->all_flights[$id]['departure_airport_time'],$this->all_flights[$id]['arrival_airport'],$this->all_flights[$id]['arrival_airport_time'],$schedule['Source']);
108 108
 		}
109
-	    } else $scheduleexist = true;
109
+		} else $scheduleexist = true;
110 110
 	} else $scheduleexist = true;
111 111
 	// close connection, at least one way will work ?
112
-       if ($scheduleexist) {
112
+	   if ($scheduleexist) {
113 113
 		if ($globalDebug) echo "-> get arrival/departure airport info for ".$ident."\n";
114
-    		$sch = $Schedule->getSchedule($operator);
114
+			$sch = $Schedule->getSchedule($operator);
115 115
 		$this->all_flights[$id] = array_merge($this->all_flights[$id],array('arrival_airport' => $sch['arrival_airport_icao'],'departure_airport' => $sch['departure_airport_icao'],'departure_airport_time' => $sch['departure_airport_time'],'arrival_airport_time' => $sch['arrival_airport_time']));
116 116
 		if ($this->all_flights[$id]['addedSpotter'] == 1) $Spotter->updateLatestScheduleSpotterData($this->all_flights[$id]['id'],$sch['departure_airport_icao'],$sch['departure_airport_time'],$sch['arrival_airport_icao'],$sch['arrival_airport_time']);
117
-       }
117
+	   }
118 118
 	$Spotter->db = null;
119 119
 	$Schedule->db = null;
120 120
 	$Translation->db = null;
@@ -129,65 +129,65 @@  discard block
 block discarded – undo
129 129
 	}
130 130
 	  */
131 131
 	}
132
-    }
132
+	}
133 133
 
134
-    public function checkAll() {
134
+	public function checkAll() {
135 135
 	global $globalDebug, $globalNoImport;
136 136
 	if ($globalDebug) echo "Update last seen flights data...\n";
137 137
 	if (!isset($globalNoImport) || $globalNoImport === FALSE) {
138
-	    foreach ($this->all_flights as $key => $flight) {
138
+		foreach ($this->all_flights as $key => $flight) {
139 139
 		if (isset($this->all_flights[$key]['id'])) {
140
-		    //echo $this->all_flights[$key]['id'].' - '.$this->all_flights[$key]['latitude'].'  '.$this->all_flights[$key]['longitude']."\n";
141
-    		    $Spotter = new Spotter($this->db);
142
-        	    $real_arrival = $this->arrival($key);
143
-        	    if (isset($this->all_flights[$key]['altitude']) && isset($this->all_flights[$key]['datetime'])) $Spotter->updateLatestSpotterData($this->all_flights[$key]['id'],$this->all_flights[$key]['ident'],$this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$this->all_flights[$key]['altitude'],$this->all_flights[$key]['ground'],$this->all_flights[$key]['speed'],$this->all_flights[$key]['datetime'],$real_arrival['airport_icao'],$real_arrival['airport_time']);
144
-        	}
145
-	    }
140
+			//echo $this->all_flights[$key]['id'].' - '.$this->all_flights[$key]['latitude'].'  '.$this->all_flights[$key]['longitude']."\n";
141
+				$Spotter = new Spotter($this->db);
142
+				$real_arrival = $this->arrival($key);
143
+				if (isset($this->all_flights[$key]['altitude']) && isset($this->all_flights[$key]['datetime'])) $Spotter->updateLatestSpotterData($this->all_flights[$key]['id'],$this->all_flights[$key]['ident'],$this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$this->all_flights[$key]['altitude'],$this->all_flights[$key]['ground'],$this->all_flights[$key]['speed'],$this->all_flights[$key]['datetime'],$real_arrival['airport_icao'],$real_arrival['airport_time']);
144
+			}
145
+		}
146
+	}
146 147
 	}
147
-    }
148 148
 
149
-    public function arrival($key) {
149
+	public function arrival($key) {
150 150
 	global $globalClosestMinDist, $globalDebug;
151 151
 	if ($globalDebug) echo 'Update arrival...'."\n";
152 152
 	$Spotter = new Spotter($this->db);
153
-        $airport_icao = '';
154
-        $airport_time = '';
155
-        if (!isset($globalClosestMinDist) || $globalClosestMinDist == '') $globalClosestMinDist = 50;
153
+		$airport_icao = '';
154
+		$airport_time = '';
155
+		if (!isset($globalClosestMinDist) || $globalClosestMinDist == '') $globalClosestMinDist = 50;
156 156
 	if ($this->all_flights[$key]['latitude'] != '' && $this->all_flights[$key]['longitude'] != '') {
157
-	    $closestAirports = $Spotter->closestAirports($this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$globalClosestMinDist);
158
-    	    if (isset($closestAirports[0])) {
159
-        	if (isset($this->all_flights[$key]['arrival_airport']) && $this->all_flights[$key]['arrival_airport'] == $closestAirports[0]['icao']) {
160
-        	    $airport_icao = $closestAirports[0]['icao'];
161
-        	    $airport_time = $this->all_flights[$key]['datetime'];
162
-        	    if ($globalDebug) echo "---++ Find arrival airport. airport_icao : ".$airport_icao."\n";
163
-        	} elseif (count($closestAirports > 1) && isset($this->all_flights[$key]['arrival_airport']) && $this->all_flights[$key]['arrival_airport'] != '') {
164
-        	    foreach ($closestAirports as $airport) {
165
-        		if ($this->all_flights[$key]['arrival_airport'] == $airport['icao']) {
166
-        		    $airport_icao = $airport['icao'];
167
-        		    $airport_time = $this->all_flights[$key]['datetime'];
168
-        		    if ($globalDebug) echo "---++ Find arrival airport. airport_icao : ".$airport_icao."\n";
169
-        		    break;
170
-        		}
171
-        	    }
172
-        	} elseif ($this->all_flights[$key]['altitude'] == 0 || ($this->all_flights[$key]['altitude_real'] != '' && ($closestAirports[0]['altitude'] < $this->all_flights[$key]['altitude_real'] && $this->all_flights[$key]['altitude_real'] < $closestAirports[0]['altitude']+5000))) {
173
-        		$airport_icao = $closestAirports[0]['icao'];
174
-        		$airport_time = $this->all_flights[$key]['datetime'];
175
-        	} else {
176
-        		if ($globalDebug) echo "----- Can't find arrival airport. Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.$this->all_flights[$key]['altitude_real']."\n";
177
-        	}
178
-    	    } else {
179
-    		    if ($globalDebug) echo "----- No Airport near last coord. Latitude : ".$this->all_flights[$key]['latitude'].' - Longitude : '.$this->all_flights[$key]['longitude'].' - MinDist : '.$globalClosestMinDist."\n";
180
-    	    }
157
+		$closestAirports = $Spotter->closestAirports($this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$globalClosestMinDist);
158
+			if (isset($closestAirports[0])) {
159
+			if (isset($this->all_flights[$key]['arrival_airport']) && $this->all_flights[$key]['arrival_airport'] == $closestAirports[0]['icao']) {
160
+				$airport_icao = $closestAirports[0]['icao'];
161
+				$airport_time = $this->all_flights[$key]['datetime'];
162
+				if ($globalDebug) echo "---++ Find arrival airport. airport_icao : ".$airport_icao."\n";
163
+			} elseif (count($closestAirports > 1) && isset($this->all_flights[$key]['arrival_airport']) && $this->all_flights[$key]['arrival_airport'] != '') {
164
+				foreach ($closestAirports as $airport) {
165
+				if ($this->all_flights[$key]['arrival_airport'] == $airport['icao']) {
166
+					$airport_icao = $airport['icao'];
167
+					$airport_time = $this->all_flights[$key]['datetime'];
168
+					if ($globalDebug) echo "---++ Find arrival airport. airport_icao : ".$airport_icao."\n";
169
+					break;
170
+				}
171
+				}
172
+			} elseif ($this->all_flights[$key]['altitude'] == 0 || ($this->all_flights[$key]['altitude_real'] != '' && ($closestAirports[0]['altitude'] < $this->all_flights[$key]['altitude_real'] && $this->all_flights[$key]['altitude_real'] < $closestAirports[0]['altitude']+5000))) {
173
+				$airport_icao = $closestAirports[0]['icao'];
174
+				$airport_time = $this->all_flights[$key]['datetime'];
175
+			} else {
176
+				if ($globalDebug) echo "----- Can't find arrival airport. Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.$this->all_flights[$key]['altitude_real']."\n";
177
+			}
178
+			} else {
179
+				if ($globalDebug) echo "----- No Airport near last coord. Latitude : ".$this->all_flights[$key]['latitude'].' - Longitude : '.$this->all_flights[$key]['longitude'].' - MinDist : '.$globalClosestMinDist."\n";
180
+			}
181 181
 
182
-        } else {
183
-        	if ($globalDebug) echo "---- No latitude or longitude. Ident : ".$this->all_flights[$key]['ident']."\n";
184
-        }
185
-        return array('airport_icao' => $airport_icao,'airport_time' => $airport_time);
186
-    }
182
+		} else {
183
+			if ($globalDebug) echo "---- No latitude or longitude. Ident : ".$this->all_flights[$key]['ident']."\n";
184
+		}
185
+		return array('airport_icao' => $airport_icao,'airport_time' => $airport_time);
186
+	}
187 187
 
188 188
 
189 189
 
190
-    public function del() {
190
+	public function del() {
191 191
 	global $globalDebug, $globalNoImport, $globalNoDB;
192 192
 	// Delete old infos
193 193
 	if ($globalDebug) echo 'Delete old values and update latest data...'."\n";
@@ -199,9 +199,9 @@  discard block
 block discarded – undo
199 199
 			}
200 200
 		}
201 201
 	}
202
-    }
202
+	}
203 203
 
204
-    public function delKey($key) {
204
+	public function delKey($key) {
205 205
 	global $globalDebug, $globalNoImport, $globalNoDB;
206 206
 	// Delete old infos
207 207
 	if (isset($this->all_flights[$key]['id'])) {
@@ -223,9 +223,9 @@  discard block
 block discarded – undo
223 223
 		if ($globalDebug) echo "\n";
224 224
 	}
225 225
 	unset($this->all_flights[$key]);
226
-    }
226
+	}
227 227
 
228
-    public function add($line) {
228
+	public function add($line) {
229 229
 	global $globalPilotIdAccept, $globalAirportAccept, $globalAirlineAccept, $globalAirlineIgnore, $globalAirportIgnore, $globalFork, $globalDistanceIgnore, $globalDaemon, $globalSBS1update, $globalDebug, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalCoordMinChange, $globalDebugTimeElapsed, $globalCenterLatitude, $globalCenterLongitude, $globalBeta, $globalSourcesupdate, $globalAirlinesSource, $globalVAM, $globalAllFlights, $globalServerAPRS, $APRSSpotter, $globalNoImport, $globalNoDB, $globalVA, $globalAircraftMaxUpdate, $globalAircraftMinUpdate, $globalLiveInterval, $GeoidClass, $globalArchive;
230 230
 	//if (!isset($globalDebugTimeElapsed) || $globalDebugTimeElapsed == '') $globalDebugTimeElapsed = FALSE;
231 231
 	if (!isset($globalCoordMinChange) || $globalCoordMinChange == '') $globalCoordMinChange = '0.01';
@@ -251,20 +251,20 @@  discard block
 block discarded – undo
251 251
 	
252 252
 	// SBS format is CSV format
253 253
 	if(is_array($line) && (isset($line['hex']) || isset($line['id']))) {
254
-	    //print_r($line);
255
-	    if (isset($line['hex'])) $line['hex'] = strtoupper($line['hex']);
256
-  	    if (isset($line['id']) || (isset($line['hex']) && $line['hex'] != '' && substr($line['hex'],0,1) != '~' && $line['hex'] != '00000' && $line['hex'] != '000000' && $line['hex'] != '111111' && ctype_xdigit($line['hex']) && strlen($line['hex']) === 6)) {
254
+		//print_r($line);
255
+		if (isset($line['hex'])) $line['hex'] = strtoupper($line['hex']);
256
+  		if (isset($line['id']) || (isset($line['hex']) && $line['hex'] != '' && substr($line['hex'],0,1) != '~' && $line['hex'] != '00000' && $line['hex'] != '000000' && $line['hex'] != '111111' && ctype_xdigit($line['hex']) && strlen($line['hex']) === 6)) {
257 257
 
258 258
 		// Increment message number
259 259
 		if (isset($line['sourcestats']) && $line['sourcestats'] === TRUE) {
260
-		    $current_date = date('Y-m-d');
261
-		    if (isset($line['source_name'])) $source = $line['source_name'];
262
-		    else $source = '';
263
-		    if ($source == '' || $line['format_source'] == 'aprs') $source = $line['format_source'];
264
-		    if (!isset($this->stats[$current_date][$source]['msg'])) {
265
-		    	$this->stats[$current_date][$source]['msg']['date'] = time();
266
-		    	$this->stats[$current_date][$source]['msg']['nb'] = 1;
267
-		    } else $this->stats[$current_date][$source]['msg']['nb'] += 1;
260
+			$current_date = date('Y-m-d');
261
+			if (isset($line['source_name'])) $source = $line['source_name'];
262
+			else $source = '';
263
+			if ($source == '' || $line['format_source'] == 'aprs') $source = $line['format_source'];
264
+			if (!isset($this->stats[$current_date][$source]['msg'])) {
265
+				$this->stats[$current_date][$source]['msg']['date'] = time();
266
+				$this->stats[$current_date][$source]['msg']['nb'] = 1;
267
+			} else $this->stats[$current_date][$source]['msg']['nb'] += 1;
268 268
 		}
269 269
 		
270 270
 		/*
@@ -280,54 +280,54 @@  discard block
 block discarded – undo
280 280
 		//$this->db = $dbc;
281 281
 
282 282
 		//$hex = trim($line['hex']);
283
-	        if (!isset($line['id'])) $id = trim($line['hex']);
284
-	        else $id = trim($line['id']);
283
+			if (!isset($line['id'])) $id = trim($line['hex']);
284
+			else $id = trim($line['id']);
285 285
 		
286 286
 		if (!isset($this->all_flights[$id])) {
287
-		    if ($globalDebug) echo 'New flight...'."\n";
288
-		    $this->all_flights[$id] = array();
289
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0));
290
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => '','departure_airport' => '', 'arrival_airport' => '','latitude' => '', 'longitude' => '', 'speed' => '', 'altitude' => '','altitude_real' => '','altitude_previous' => '', 'heading' => '','departure_airport_time' => '','arrival_airport_time' => '','squawk' => '','route_stop' => '','registration' => '','pilot_id' => '','pilot_name' => '','waypoints' => '','ground' => '0', 'format_source' => '','source_name' => '','over_country' => '','verticalrate' => '','noarchive' => false,'putinarchive' => true,'source_type' => ''));
291
-		    if (isset($globalDaemon) && $globalDaemon === FALSE) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('lastupdate' => time()));
292
-		    if (!isset($line['id'])) {
287
+			if ($globalDebug) echo 'New flight...'."\n";
288
+			$this->all_flights[$id] = array();
289
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0));
290
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => '','departure_airport' => '', 'arrival_airport' => '','latitude' => '', 'longitude' => '', 'speed' => '', 'altitude' => '','altitude_real' => '','altitude_previous' => '', 'heading' => '','departure_airport_time' => '','arrival_airport_time' => '','squawk' => '','route_stop' => '','registration' => '','pilot_id' => '','pilot_name' => '','waypoints' => '','ground' => '0', 'format_source' => '','source_name' => '','over_country' => '','verticalrate' => '','noarchive' => false,'putinarchive' => true,'source_type' => ''));
291
+			if (isset($globalDaemon) && $globalDaemon === FALSE) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('lastupdate' => time()));
292
+			if (!isset($line['id'])) {
293 293
 			if (!isset($globalDaemon)) $globalDaemon = TRUE;
294 294
 //			if (isset($line['format_source']) && ($line['format_source'] == 'sbs' || $line['format_source'] == 'tsv' || $line['format_source'] == 'raw') && $globalDaemon) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'].'-'.date('YmdGi')));
295 295
 //			if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs') && $globalDaemon) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi')));
296 296
 			if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'aircraftjson' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $id.'-'.date('YmdHi')));
297
-		        //else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident']));
298
-		     } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id']));
299
-		    if ($globalAllFlights !== FALSE) $dataFound = true;
297
+				//else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident']));
298
+			 } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id']));
299
+			if ($globalAllFlights !== FALSE) $dataFound = true;
300 300
 		}
301 301
 		if (isset($line['source_type']) && $line['source_type'] != '') {
302
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('source_type' => $line['source_type']));
302
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('source_type' => $line['source_type']));
303 303
 		}
304 304
 		
305 305
 		//print_r($this->all_flights);
306 306
 		if (isset($line['hex']) && !isset($this->all_flights[$id]['hex']) && ctype_xdigit($line['hex'])) {
307
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('hex' => trim($line['hex'])));
308
-		    //if (isset($line['datetime']) && preg_match('/^(\d{4}(?:\-\d{2}){2} \d{2}(?:\:\d{2}){2})$/',$line['datetime'])) {
307
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('hex' => trim($line['hex'])));
308
+			//if (isset($line['datetime']) && preg_match('/^(\d{4}(?:\-\d{2}){2} \d{2}(?:\:\d{2}){2})$/',$line['datetime'])) {
309 309
 			//$this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => $line['datetime']));
310
-		    //} else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => date('Y-m-d H:i:s')));
311
-		    if (!isset($line['aircraft_name']) && (!isset($line['aircraft_icao']) || $line['aircraft_icao'] == '????') && $line['format_source'] != 'whazzup' && $line['format_source'] != 'vatsimtxt' && $line['format_source'] != 'pireps' && $line['format_source'] != 'phpvmacars' && $line['format_source'] != 'vam' && $line['format_source'] != 'flightgearsp' && $line['format_source'] != 'flightgearmp') {
310
+			//} else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => date('Y-m-d H:i:s')));
311
+			if (!isset($line['aircraft_name']) && (!isset($line['aircraft_icao']) || $line['aircraft_icao'] == '????') && $line['format_source'] != 'whazzup' && $line['format_source'] != 'vatsimtxt' && $line['format_source'] != 'pireps' && $line['format_source'] != 'phpvmacars' && $line['format_source'] != 'vam' && $line['format_source'] != 'flightgearsp' && $line['format_source'] != 'flightgearmp') {
312 312
 			$timeelapsed = microtime(true);
313 313
 			if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
314
-			    $Spotter = new Spotter($this->db);
315
-			    if (isset($this->all_flights[$id]['source_type'])) {
314
+				$Spotter = new Spotter($this->db);
315
+				if (isset($this->all_flights[$id]['source_type'])) {
316 316
 				$aircraft_icao = $Spotter->getAllAircraftType(trim($line['hex']),$this->all_flights[$id]['source_type']);
317
-			    } else {
317
+				} else {
318 318
 				$aircraft_icao = $Spotter->getAllAircraftType(trim($line['hex']));
319
-			    }
320
-			    $Spotter->db = null;
321
-			    if ($globalDebugTimeElapsed) echo 'Time elapsed for update getallaircrattype : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
322
-			    if ($aircraft_icao != '') $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $aircraft_icao));
319
+				}
320
+				$Spotter->db = null;
321
+				if ($globalDebugTimeElapsed) echo 'Time elapsed for update getallaircrattype : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
322
+				if ($aircraft_icao != '') $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $aircraft_icao));
323 323
 			}
324
-		    }
325
-		    if ($globalAllFlights !== FALSE) $dataFound = true;
326
-		    if ($globalDebug) echo "*********** New aircraft hex : ".$line['hex']." ***********\n";
324
+			}
325
+			if ($globalAllFlights !== FALSE) $dataFound = true;
326
+			if ($globalDebug) echo "*********** New aircraft hex : ".$line['hex']." ***********\n";
327 327
 		}
328
-	        if (isset($line['id']) && !isset($line['hex'])) {
329
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('hex' => ''));
330
-	        }
328
+			if (isset($line['id']) && !isset($line['hex'])) {
329
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('hex' => ''));
330
+			}
331 331
 		if (isset($line['aircraft_icao']) && $line['aircraft_icao'] != '') {
332 332
 			$icao = $line['aircraft_icao'];
333 333
 			if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
@@ -357,9 +357,9 @@  discard block
 block discarded – undo
357 357
 		}
358 358
 		//if (isset($line['datetime']) && preg_match('/^(\d{4}(?:\-\d{2}){2} \d{2}(?:\:\d{2}){2})$/',$line['datetime'])) {
359 359
 		if (isset($line['datetime']) && strtotime($line['datetime']) > time()-20*60 && strtotime($line['datetime']) < time()+20*60) {
360
-		    if (!isset($this->all_flights[$id]['datetime']) || strtotime($line['datetime']) >= strtotime($this->all_flights[$id]['datetime'])) {
360
+			if (!isset($this->all_flights[$id]['datetime']) || strtotime($line['datetime']) >= strtotime($this->all_flights[$id]['datetime'])) {
361 361
 			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => $line['datetime']));
362
-		    } else {
362
+			} else {
363 363
 				if (strtotime($line['datetime']) == strtotime($this->all_flights[$id]['datetime']) && $globalDebug) echo "!!! Date is the same as previous data for ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."\n";
364 364
 				elseif (strtotime($line['datetime']) > strtotime($this->all_flights[$id]['datetime']) && $globalDebug) echo "!!! Date previous latest data (".$line['datetime']." > ".$this->all_flights[$id]['datetime'].") !!! for ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."\n";
365 365
 				/*
@@ -368,7 +368,7 @@  discard block
 block discarded – undo
368 368
 				print_r($line);
369 369
 				*/
370 370
 				return '';
371
-		    }
371
+			}
372 372
 		} elseif (isset($line['datetime']) && strtotime($line['datetime']) < time()-20*60) {
373 373
 			if ($globalDebug) echo "!!! Date is too old ".$line['datetime']." for ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."!!!\n";
374 374
 			return '';
@@ -384,21 +384,21 @@  discard block
 block discarded – undo
384 384
 		}
385 385
 
386 386
 		if (isset($line['registration']) && $line['registration'] != '' && $line['registration'] != 'z.NO-REG' && $line['registration'] != 'NA') {
387
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('registration' => $line['registration']));
387
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('registration' => $line['registration']));
388 388
 		}
389 389
 		if (isset($line['waypoints']) && $line['waypoints'] != '') {
390
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('waypoints' => $line['waypoints']));
390
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('waypoints' => $line['waypoints']));
391 391
 		}
392 392
 		if (isset($line['pilot_id']) && $line['pilot_id'] != '') {
393
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('pilot_id' => trim($line['pilot_id'])));
393
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('pilot_id' => trim($line['pilot_id'])));
394 394
 		}
395 395
 		if (isset($line['pilot_name']) && $line['pilot_name'] != '') {
396
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('pilot_name' => trim($line['pilot_name'])));
396
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('pilot_name' => trim($line['pilot_name'])));
397 397
 		}
398 398
  
399 399
 		if (isset($line['ident']) && trim($line['ident']) != '' && $line['ident'] != '????????' && $line['ident'] != '00000000' && ($this->all_flights[$id]['ident'] != trim($line['ident'])) && preg_match('/^[a-zA-Z0-9]+$/', $line['ident'])) {
400 400
 
401
-		    if ($this->all_flights[$id]['addedSpotter'] == 1) {
401
+			if ($this->all_flights[$id]['addedSpotter'] == 1) {
402 402
 			if ($globalVA !== TRUE && $globalIVAO !== TRUE && $globalVATSIM !== TRUE && $globalphpVMS !== TRUE && $globalVAM !== TRUE && $this->all_flights[$id]['lastupdate'] < time() - 1600) {
403 403
 				if ($globalDebug) echo '---!!!! New ident, reset aircraft data...'."\n";
404 404
 				$this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0));
@@ -407,23 +407,23 @@  discard block
 block discarded – undo
407 407
 				elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id']));
408 408
 				elseif (isset($this->all_flights[$id]['ident'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident']));
409 409
 			} else {
410
-			    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => trim($line['ident'])));
411
-			    if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
410
+				$this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => trim($line['ident'])));
411
+				if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
412 412
 				$timeelapsed = microtime(true);
413
-            			$Spotter = new Spotter($this->db);
414
-            			$fromsource = NULL;
415
-            			if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource;
416
-            			elseif (isset($line['format_source']) && $line['format_source'] == 'vatsimtxt') $fromsource = 'vatsim';
413
+						$Spotter = new Spotter($this->db);
414
+						$fromsource = NULL;
415
+						if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource;
416
+						elseif (isset($line['format_source']) && $line['format_source'] == 'vatsimtxt') $fromsource = 'vatsim';
417 417
 				elseif (isset($line['format_source']) && $line['format_source'] == 'whazzup') $fromsource = 'ivao';
418 418
 				elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim';
419 419
 				elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao';
420
-            			$result = $Spotter->updateIdentSpotterData($this->all_flights[$id]['id'],$this->all_flights[$id]['ident'],$fromsource,$this->all_flights[$id]['source_type']);
420
+						$result = $Spotter->updateIdentSpotterData($this->all_flights[$id]['id'],$this->all_flights[$id]['ident'],$fromsource,$this->all_flights[$id]['source_type']);
421 421
 				if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n";
422 422
 				$Spotter->db = null;
423 423
 				if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
424
-			    }
424
+				}
425 425
 			}
426
-		    } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => trim($line['ident'])));
426
+			} else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => trim($line['ident'])));
427 427
 		    
428 428
 /*
429 429
 		    if (!isset($line['id'])) {
@@ -433,63 +433,63 @@  discard block
 block discarded – undo
433 433
 		        else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident']));
434 434
 		     } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id']));
435 435
   */
436
-		    if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident']));
436
+			if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident']));
437 437
 
438
-		    //$putinarchive = true;
439
-		    if (isset($line['departure_airport_time']) && $line['departure_airport_time'] != 0) {
438
+			//$putinarchive = true;
439
+			if (isset($line['departure_airport_time']) && $line['departure_airport_time'] != 0) {
440 440
 			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport_time' => $line['departure_airport_time']));
441
-		    }
442
-		    if (isset($line['arrival_airport_time']) && $line['arrival_airport_time'] != 0) {
441
+			}
442
+			if (isset($line['arrival_airport_time']) && $line['arrival_airport_time'] != 0) {
443 443
 			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('arrival_airport_time' => $line['arrival_airport_time']));
444
-		    }
445
-		    if (isset($line['departure_airport_icao']) && isset($line['arrival_airport_icao'])) {
446
-		    		$this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $line['departure_airport_icao'],'arrival_airport' => $line['arrival_airport_icao'],'route_stop' => ''));
447
-		    } elseif (isset($line['departure_airport_iata']) && isset($line['arrival_airport_iata'])) {
444
+			}
445
+			if (isset($line['departure_airport_icao']) && isset($line['arrival_airport_icao'])) {
446
+					$this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $line['departure_airport_icao'],'arrival_airport' => $line['arrival_airport_icao'],'route_stop' => ''));
447
+			} elseif (isset($line['departure_airport_iata']) && isset($line['arrival_airport_iata'])) {
448 448
 			$timeelapsed = microtime(true);
449 449
 			if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
450 450
 				$Spotter = new Spotter($this->db);
451 451
 				$line['departure_airport_icao'] = $Spotter->getAirportIcao($line['departure_airport_iata']);
452 452
 				$line['arrival_airport_icao'] = $Spotter->getAirportIcao($line['arrival_airport_iata']);
453
-		    		$this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $line['departure_airport_icao'],'arrival_airport' => $line['arrival_airport_icao'],'route_stop' => ''));
453
+					$this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $line['departure_airport_icao'],'arrival_airport' => $line['arrival_airport_icao'],'route_stop' => ''));
454 454
 				if ($globalDebugTimeElapsed) echo 'Time elapsed for update getAirportICAO : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
455
-                        }
456
-		    } elseif (!isset($line['format_source']) || $line['format_source'] != 'aprs') {
455
+						}
456
+			} elseif (!isset($line['format_source']) || $line['format_source'] != 'aprs') {
457 457
 			$timeelapsed = microtime(true);
458 458
 			if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
459
-			    $Spotter = new Spotter($this->db);
460
-			    $route = $Spotter->getRouteInfo(trim($line['ident']));
461
-			    if (!isset($route['fromairport_icao']) && !isset($route['toairport_icao'])) {
459
+				$Spotter = new Spotter($this->db);
460
+				$route = $Spotter->getRouteInfo(trim($line['ident']));
461
+				if (!isset($route['fromairport_icao']) && !isset($route['toairport_icao'])) {
462 462
 				$Translation = new Translation($this->db);
463 463
 				$ident = $Translation->checkTranslation(trim($line['ident']));
464 464
 				$route = $Spotter->getRouteInfo($ident);
465 465
 				$Translation->db = null;
466
-			    }
467
-			    $Spotter->db = null;
468
-			    if ($globalDebugTimeElapsed) echo 'Time elapsed for update getrouteinfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
469
-                    	}
466
+				}
467
+				$Spotter->db = null;
468
+				if ($globalDebugTimeElapsed) echo 'Time elapsed for update getrouteinfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
469
+						}
470 470
 			if (isset($route['fromairport_icao']) && isset($route['toairport_icao'])) {
471
-			    //if ($route['FromAirport_ICAO'] != $route['ToAirport_ICAO']) {
472
-			    if ($route['fromairport_icao'] != $route['toairport_icao']) {
471
+				//if ($route['FromAirport_ICAO'] != $route['ToAirport_ICAO']) {
472
+				if ($route['fromairport_icao'] != $route['toairport_icao']) {
473 473
 				//    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $route['FromAirport_ICAO'],'arrival_airport' => $route['ToAirport_ICAO'],'route_stop' => $route['RouteStop']));
474
-		    		$this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $route['fromairport_icao'],'arrival_airport' => $route['toairport_icao'],'route_stop' => $route['routestop']));
475
-		    	    }
474
+					$this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $route['fromairport_icao'],'arrival_airport' => $route['toairport_icao'],'route_stop' => $route['routestop']));
475
+					}
476 476
 			}
477 477
 			if (!isset($globalFork)) $globalFork = TRUE;
478 478
 			if (!$globalVA && !$globalIVAO && !$globalVATSIM && !$globalphpVMS && !$globalVAM && (!isset($line['format_source']) || $line['format_source'] != 'aprs')) {
479 479
 				if (!isset($this->all_flights[$id]['schedule_check']) || $this->all_flights[$id]['schedule_check'] === false) $this->get_Schedule($id,trim($line['ident']));
480 480
 			}
481
-		    }
481
+			}
482 482
 		}
483 483
 
484 484
 		if (isset($line['speed']) && $line['speed'] != '' && $line['speed'] != 0) {
485 485
 		//    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed' => $line[12]));
486
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed' => round($line['speed'])));
487
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed_fromsrc' => true));
488
-		    //$dataFound = true;
486
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed' => round($line['speed'])));
487
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed_fromsrc' => true));
488
+			//$dataFound = true;
489 489
 		} else if (!isset($this->all_flights[$id]['speed_fromsrc']) && isset($this->all_flights[$id]['time_last_coord']) && $this->all_flights[$id]['time_last_coord'] != time() && isset($line['latitude']) && isset($line['longitude'])) {
490
-		    $distance = $Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m');
491
-		    if ($distance > 1000 && $distance < 10000) {
492
-		    // use datetime
490
+			$distance = $Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m');
491
+			if ($distance > 1000 && $distance < 10000) {
492
+			// use datetime
493 493
 			$speed = $distance/(time() - $this->all_flights[$id]['time_last_coord']);
494 494
 			$speed = $speed*3.6;
495 495
 			if ($speed < 1000) {
@@ -498,49 +498,49 @@  discard block
 block discarded – undo
498 498
 	  		} else {
499 499
 	  			if ($globalDebug) echo "ø IGNORED : Calculated Speed for ".$this->all_flights[$id]['hex']." : ".round($speed)." - distance : ".$distance."\n";
500 500
 	  		}
501
-		    }
501
+			}
502 502
 		}
503 503
 
504 504
 
505 505
 
506
-	        if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) {
507
-	    	    if (ctype_digit(strval($line['latitude'])) || ctype_digit(strval($line['longitude']))) {
508
-	    	    	if ($globalDebug) echo "/!\ Invalid latitude or/and longitude data : lat: ".$line['latitude']." - lng: ".$line['longitude']."\n";
509
-	    	    	return false;
510
-	    	    }
511
-	    	    if (isset($this->all_flights[$id]['time_last_coord'])) $timediff = round(time()-$this->all_flights[$id]['time_last_coord']);
512
-	    	    else unset($timediff);
513
-	    	    if (isset($this->all_flights[$id]['time_last_archive_coord'])) $timediff_archive = round(time()-$this->all_flights[$id]['time_last_archive_coord']);
514
-	    	    else unset($timediff_archive);
515
-	    	    if ($this->tmd > 5
516
-	    	        || (isset($line['format_source']) 
517
-	    	    	    && $line['format_source'] == 'airwhere' 
518
-	    	    	    && ((!isset($this->all_flights[$id]['latitude']) 
519
-	    	    		|| !isset($this->all_flights[$id]['longitude'])) 
520
-	    	    		|| (isset($this->all_flights[$id]['latitude']) 
521
-	    	    		    && isset($this->all_flights[$id]['longitude']) 
522
-	    	    		    && $this->all_flights[$id]['latitude'] != $line['latitude'] 
523
-	    	    		    && $this->all_flights[$id]['longitude'] != $line['longitude']
524
-	    	    		)
525
-	    	    	    )
526
-	    	    	)
527
-	    		|| (isset($globalVA) && $globalVA) 
528
-	    	    	|| (isset($globalIVAO) && $globalIVAO)
529
-	    	    	|| (isset($globalVATSIM) && $globalVATSIM)
530
-	    	    	|| (isset($globalphpVMS) && $globalphpVMS)
531
-	    	    	|| (isset($globalVAM) && $globalVAM)
532
-	    	    	|| !isset($timediff)
533
-	    	    	|| $timediff > $globalLiveInterval
534
-	    	    	|| $globalArchive
535
-	    	    	|| ($timediff > 30 
536
-	    	    	    && isset($this->all_flights[$id]['latitude']) 
537
-	    	    	    && isset($this->all_flights[$id]['longitude']) 
538
-	    	    	    && $Common->withinThreshold($timediff,$Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m'))
539
-	    	    	    )
540
-	    	    	) {
506
+			if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) {
507
+				if (ctype_digit(strval($line['latitude'])) || ctype_digit(strval($line['longitude']))) {
508
+					if ($globalDebug) echo "/!\ Invalid latitude or/and longitude data : lat: ".$line['latitude']." - lng: ".$line['longitude']."\n";
509
+					return false;
510
+				}
511
+				if (isset($this->all_flights[$id]['time_last_coord'])) $timediff = round(time()-$this->all_flights[$id]['time_last_coord']);
512
+				else unset($timediff);
513
+				if (isset($this->all_flights[$id]['time_last_archive_coord'])) $timediff_archive = round(time()-$this->all_flights[$id]['time_last_archive_coord']);
514
+				else unset($timediff_archive);
515
+				if ($this->tmd > 5
516
+					|| (isset($line['format_source']) 
517
+						&& $line['format_source'] == 'airwhere' 
518
+						&& ((!isset($this->all_flights[$id]['latitude']) 
519
+						|| !isset($this->all_flights[$id]['longitude'])) 
520
+						|| (isset($this->all_flights[$id]['latitude']) 
521
+							&& isset($this->all_flights[$id]['longitude']) 
522
+							&& $this->all_flights[$id]['latitude'] != $line['latitude'] 
523
+							&& $this->all_flights[$id]['longitude'] != $line['longitude']
524
+						)
525
+						)
526
+					)
527
+				|| (isset($globalVA) && $globalVA) 
528
+					|| (isset($globalIVAO) && $globalIVAO)
529
+					|| (isset($globalVATSIM) && $globalVATSIM)
530
+					|| (isset($globalphpVMS) && $globalphpVMS)
531
+					|| (isset($globalVAM) && $globalVAM)
532
+					|| !isset($timediff)
533
+					|| $timediff > $globalLiveInterval
534
+					|| $globalArchive
535
+					|| ($timediff > 30 
536
+						&& isset($this->all_flights[$id]['latitude']) 
537
+						&& isset($this->all_flights[$id]['longitude']) 
538
+						&& $Common->withinThreshold($timediff,$Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m'))
539
+						)
540
+					) {
541 541
 
542 542
 			if ((isset($timediff) && !isset($timediff_archive)) || (isset($this->all_flights[$id]['archive_latitude']) && isset($this->all_flights[$id]['archive_longitude']) && isset($this->all_flights[$id]['livedb_latitude']) && isset($this->all_flights[$id]['livedb_longitude']))) {
543
-			    if ((isset($timediff_archive) && $timediff_archive > $globalAircraftMaxUpdate)
543
+				if ((isset($timediff_archive) && $timediff_archive > $globalAircraftMaxUpdate)
544 544
 				|| (isset($line['format_source']) && $line['format_source'] == 'airwhere') 
545 545
 				|| !$Common->checkLine($this->all_flights[$id]['archive_latitude'],$this->all_flights[$id]['archive_longitude'],$this->all_flights[$id]['livedb_latitude'],$this->all_flights[$id]['livedb_longitude'],$line['latitude'],$line['longitude'])) {
546 546
 				$this->all_flights[$id]['archive_latitude'] = $line['latitude'];
@@ -548,9 +548,9 @@  discard block
 block discarded – undo
548 548
 				$this->all_flights[$id]['putinarchive'] = true;
549 549
 				$this->tmd = 0;
550 550
 				if (!isset($globalNoImport) || $globalNoImport === FALSE) {
551
-				    if ($globalDebug) echo "\n".' ------- Check Country for '.$this->all_flights[$id]['ident'].' with latitude : '.$line['latitude'].' and longitude : '.$line['longitude'].'.... ';
552
-				    $timeelapsed = microtime(true);
553
-				    if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
551
+					if ($globalDebug) echo "\n".' ------- Check Country for '.$this->all_flights[$id]['ident'].' with latitude : '.$line['latitude'].' and longitude : '.$line['longitude'].'.... ';
552
+					$timeelapsed = microtime(true);
553
+					if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
554 554
 					$Spotter = new Spotter($this->db);
555 555
 					$all_country = $Spotter->getCountryFromLatitudeLongitude($line['latitude'],$line['longitude']);
556 556
 					if (!empty($all_country)) $this->all_flights[$id]['over_country'] = $all_country['iso2'];
@@ -558,11 +558,11 @@  discard block
 block discarded – undo
558 558
 					$Spotter->db = null;
559 559
 					if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
560 560
 					if ($globalDebug) echo 'FOUND : '.$this->all_flights[$id]['over_country'].' ---------------'."\n";
561
-				    }
561
+					}
562 562
 				}
563 563
 				$this->all_flights[$id]['time_last_archive_coord'] = time();
564
-			    } 
565
-			    /*
564
+				} 
565
+				/*
566 566
 			    else {
567 567
 				if (!isset($timediff)) echo 'NO TIMEDIFF';
568 568
 				else {
@@ -576,16 +576,16 @@  discard block
 block discarded – undo
576 576
 			}
577 577
 
578 578
 			if (isset($line['latitude']) && $line['latitude'] != '' && $line['latitude'] != 0 && $line['latitude'] < 91 && $line['latitude'] > -90) {
579
-			    //if (!isset($this->all_flights[$id]['latitude']) || $this->all_flights[$id]['latitude'] == '' || abs($this->all_flights[$id]['latitude']-$line['latitude']) < 3 || $line['format_source'] != 'sbs' || time() - $this->all_flights[$id]['lastupdate'] > 30) {
579
+				//if (!isset($this->all_flights[$id]['latitude']) || $this->all_flights[$id]['latitude'] == '' || abs($this->all_flights[$id]['latitude']-$line['latitude']) < 3 || $line['format_source'] != 'sbs' || time() - $this->all_flights[$id]['lastupdate'] > 30) {
580 580
 				if (!isset($this->all_flights[$id]['archive_latitude'])) {
581 581
 					$this->all_flights[$id]['archive_latitude'] = $line['latitude'];
582 582
 					$this->all_flights[$id]['time_last_coord'] = time();
583 583
 				}
584 584
 				//if (!isset($this->all_flights[$id]['livedb_latitude']) || abs($this->all_flights[$id]['livedb_latitude']-$line['latitude']) > $globalCoordMinChange || $this->all_flights[$id]['format_source'] == 'aprs' || ($this->all_flights[$id]['format_source'] == 'airwhere' && abs($this->all_flights[$id]['livedb_latitude']-$line['latitude']) > 0.0001)) {
585 585
 				if (!isset($this->all_flights[$id]['livedb_latitude']) || abs($this->all_flights[$id]['livedb_latitude']-$line['latitude']) > $globalCoordMinChange || ($this->all_flights[$id]['format_source'] == 'airwhere' && abs($this->all_flights[$id]['livedb_latitude']-$line['latitude']) > 0.0001)) {
586
-				    $this->all_flights[$id]['livedb_latitude'] = $line['latitude'];
587
-				    $dataFound = true;
588
-				    $this->all_flights[$id]['time_last_coord'] = time();
586
+					$this->all_flights[$id]['livedb_latitude'] = $line['latitude'];
587
+					$dataFound = true;
588
+					$this->all_flights[$id]['time_last_coord'] = time();
589 589
 				}
590 590
 				// elseif ($globalDebug) echo '!*!*! Ignore data, too close to previous one'."\n";
591 591
 				$this->all_flights[$id] = array_merge($this->all_flights[$id],array('latitude' => $line['latitude']));
@@ -596,24 +596,24 @@  discard block
 block discarded – undo
596 596
 				    //$putinarchive = true;
597 597
 				}
598 598
 				*/
599
-			    /*
599
+				/*
600 600
 			    } elseif (isset($this->all_flights[$id]['latitude'])) {
601 601
 				if ($globalDebug) echo '!!! Strange latitude value - diff : '.abs($this->all_flights[$id]['latitude']-$line['latitude']).'- previous lat : '.$this->all_flights[$id]['latitude'].'- new lat : '.$line['latitude']."\n";
602 602
 			    }
603 603
 			    */
604 604
 			}
605 605
 			if (isset($line['longitude']) && $line['longitude'] != '' && $line['longitude'] != 0 && $line['longitude'] < 360 && $line['longitude'] > -180) {
606
-			    if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360;
607
-			    //if (!isset($this->all_flights[$id]['longitude']) || $this->all_flights[$id]['longitude'] == ''  || abs($this->all_flights[$id]['longitude']-$line['longitude']) < 2 || $line['format_source'] != 'sbs' || time() - $this->all_flights[$id]['lastupdate'] > 30) {
606
+				if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360;
607
+				//if (!isset($this->all_flights[$id]['longitude']) || $this->all_flights[$id]['longitude'] == ''  || abs($this->all_flights[$id]['longitude']-$line['longitude']) < 2 || $line['format_source'] != 'sbs' || time() - $this->all_flights[$id]['lastupdate'] > 30) {
608 608
 				if (!isset($this->all_flights[$id]['archive_longitude'])) {
609 609
 					$this->all_flights[$id]['archive_longitude'] = $line['longitude'];
610 610
 					$this->all_flights[$id]['time_last_coord'] = time();
611 611
 				}
612 612
 				//if (!isset($this->all_flights[$id]['livedb_longitude']) || abs($this->all_flights[$id]['livedb_longitude']-$line['longitude']) > $globalCoordMinChange || $this->all_flights[$id]['format_source'] == 'aprs' || ($this->all_flights[$id]['format_source'] == 'airwhere' && abs($this->all_flights[$id]['livedb_longitude']-$line['longitude']) > 0.0001)) {
613 613
 				if (!isset($this->all_flights[$id]['livedb_longitude']) || abs($this->all_flights[$id]['livedb_longitude']-$line['longitude']) > $globalCoordMinChange || ($this->all_flights[$id]['format_source'] == 'airwhere' && abs($this->all_flights[$id]['livedb_longitude']-$line['longitude']) > 0.0001)) {
614
-				    $this->all_flights[$id]['livedb_longitude'] = $line['longitude'];
615
-				    $dataFound = true;
616
-				    $this->all_flights[$id]['time_last_coord'] = time();
614
+					$this->all_flights[$id]['livedb_longitude'] = $line['longitude'];
615
+					$dataFound = true;
616
+					$this->all_flights[$id]['time_last_coord'] = time();
617 617
 				}
618 618
 				// elseif ($globalDebug) echo '!*!*! Ignore data, too close to previous one'."\n";
619 619
 				$this->all_flights[$id] = array_merge($this->all_flights[$id],array('longitude' => $line['longitude']));
@@ -631,67 +631,67 @@  discard block
 block discarded – undo
631 631
 			    */
632 632
 			}
633 633
 
634
-		    } else if ($globalDebug && $timediff > 30) {
634
+			} else if ($globalDebug && $timediff > 30) {
635 635
 			$this->tmd = $this->tmd + 1;
636 636
 			echo '!!! Too much distance in short time... for '.$this->all_flights[$id]['ident']."\n";
637 637
 			echo 'Time : '.$timediff.'s - Distance : '.$Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m')."m -";
638 638
 			echo 'Speed : '.(($Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m')/$timediff)*3.6)." km/h - ";
639 639
 			echo 'Lat : '.$line['latitude'].' - long : '.$line['longitude'].' - prev lat : '.$this->all_flights[$id]['latitude'].' - prev long : '.$this->all_flights[$id]['longitude']." \n";
640
-		    }
640
+			}
641 641
 		}
642 642
 		if (isset($line['last_update']) && $line['last_update'] != '') {
643
-		    if (isset($this->all_flights[$id]['last_update']) && $this->all_flights[$id]['last_update'] != $line['last_update']) $dataFound = true;
644
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('last_update' => $line['last_update']));
643
+			if (isset($this->all_flights[$id]['last_update']) && $this->all_flights[$id]['last_update'] != $line['last_update']) $dataFound = true;
644
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('last_update' => $line['last_update']));
645 645
 		}
646 646
 		if (isset($line['verticalrate']) && $line['verticalrate'] != '') {
647
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('verticalrate' => $line['verticalrate']));
648
-		    //$dataFound = true;
647
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('verticalrate' => $line['verticalrate']));
648
+			//$dataFound = true;
649 649
 		}
650 650
 		if (isset($line['format_source']) && $line['format_source'] != '') {
651
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('format_source' => $line['format_source']));
651
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('format_source' => $line['format_source']));
652 652
 		}
653 653
 		if (isset($line['source_name']) && $line['source_name'] != '') {
654
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('source_name' => $line['source_name']));
654
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('source_name' => $line['source_name']));
655 655
 		}
656 656
 		if (isset($line['emergency']) && $line['emergency'] != '') {
657
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('emergency' => $line['emergency']));
658
-		    //$dataFound = true;
657
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('emergency' => $line['emergency']));
658
+			//$dataFound = true;
659 659
 		}
660 660
 		if (isset($line['ground']) && $line['ground'] != '') {
661
-		    if (isset($this->all_flights[$id]['ground']) && $this->all_flights[$id]['ground'] == 1 && $line['ground'] == 0) {
661
+			if (isset($this->all_flights[$id]['ground']) && $this->all_flights[$id]['ground'] == 1 && $line['ground'] == 0) {
662 662
 			// Here we force archive of flight because after ground it's a new one (or should be)
663 663
 			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0));
664 664
 			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('forcenew' => 1));
665 665
 			if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'aircraftjson' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $id.'-'.date('YmdHi')));
666
-		        elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id']));
666
+				elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id']));
667 667
 			elseif (isset($this->all_flights[$id]['ident'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident']));
668
-		    }
669
-		    if ($line['ground'] != 1) $line['ground'] = 0;
670
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ground' => $line['ground']));
671
-		    //$dataFound = true;
668
+			}
669
+			if ($line['ground'] != 1) $line['ground'] = 0;
670
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('ground' => $line['ground']));
671
+			//$dataFound = true;
672 672
 		}
673 673
 		if (isset($line['squawk']) && $line['squawk'] != '') {
674
-		    if (isset($this->all_flights[$id]['squawk']) && $this->all_flights[$id]['squawk'] != '7500' && $this->all_flights[$id]['squawk'] != '7600' && $this->all_flights[$id]['squawk'] != '7700' && isset($this->all_flights[$id]['id'])) {
675
-			    if ($this->all_flights[$id]['squawk'] != $line['squawk']) $this->all_flights[$id]['putinarchive'] = true;
676
-			    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk']));
677
-			    $highlight = '';
678
-			    if ($this->all_flights[$id]['squawk'] == '7500') $highlight = 'Squawk 7500 : Hijack at '.date('Y-m-d G:i').' UTC';
679
-			    if ($this->all_flights[$id]['squawk'] == '7600') $highlight = 'Squawk 7600 : Lost Comm (radio failure) at '.date('Y-m-d G:i').' UTC';
680
-			    if ($this->all_flights[$id]['squawk'] == '7700') $highlight = 'Squawk 7700 : Emergency at '.date('Y-m-d G:i').' UTC';
681
-			    if ($highlight != '') {
674
+			if (isset($this->all_flights[$id]['squawk']) && $this->all_flights[$id]['squawk'] != '7500' && $this->all_flights[$id]['squawk'] != '7600' && $this->all_flights[$id]['squawk'] != '7700' && isset($this->all_flights[$id]['id'])) {
675
+				if ($this->all_flights[$id]['squawk'] != $line['squawk']) $this->all_flights[$id]['putinarchive'] = true;
676
+				$this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk']));
677
+				$highlight = '';
678
+				if ($this->all_flights[$id]['squawk'] == '7500') $highlight = 'Squawk 7500 : Hijack at '.date('Y-m-d G:i').' UTC';
679
+				if ($this->all_flights[$id]['squawk'] == '7600') $highlight = 'Squawk 7600 : Lost Comm (radio failure) at '.date('Y-m-d G:i').' UTC';
680
+				if ($this->all_flights[$id]['squawk'] == '7700') $highlight = 'Squawk 7700 : Emergency at '.date('Y-m-d G:i').' UTC';
681
+				if ($highlight != '') {
682 682
 				$timeelapsed = microtime(true);
683 683
 				if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
684
-				    $Spotter = new Spotter($this->db);
685
-				    $Spotter->setHighlightFlight($this->all_flights[$id]['id'],$highlight);
686
-				    $Spotter->db = null;
687
-				    if ($globalDebugTimeElapsed) echo 'Time elapsed for update sethighlightflight : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
684
+					$Spotter = new Spotter($this->db);
685
+					$Spotter->setHighlightFlight($this->all_flights[$id]['id'],$highlight);
686
+					$Spotter->db = null;
687
+					if ($globalDebugTimeElapsed) echo 'Time elapsed for update sethighlightflight : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
688 688
 				}
689 689
 				//$putinarchive = true;
690 690
 				//$highlight = '';
691
-			    }
691
+				}
692 692
 			    
693
-		    } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk']));
694
-		    //$dataFound = true;
693
+			} else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk']));
694
+			//$dataFound = true;
695 695
 		}
696 696
 
697 697
 		if (isset($line['altitude']) && $line['altitude'] != '') {
@@ -702,13 +702,13 @@  discard block
 block discarded – undo
702 702
 					$line['altitude'] = $line['altitude'] - $geoid;
703 703
 				}
704 704
 			}
705
-		    //if (!isset($this->all_flights[$id]['altitude']) || $this->all_flights[$id]['altitude'] == '' || ($this->all_flights[$id]['altitude'] > 0 && $line['altitude'] != 0)) {
705
+			//if (!isset($this->all_flights[$id]['altitude']) || $this->all_flights[$id]['altitude'] == '' || ($this->all_flights[$id]['altitude'] > 0 && $line['altitude'] != 0)) {
706 706
 			if (is_int($this->all_flights[$id]['altitude']) && abs(round($line['altitude']/100)-$this->all_flights[$id]['altitude']) > 3) $this->all_flights[$id]['putinarchive'] = true;
707 707
 			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('altitude' => round($line['altitude']/100)));
708 708
 			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('altitude_real' => $line['altitude']));
709 709
 			//$dataFound = true;
710
-		    //} elseif ($globalDebug) echo "!!! Strange altitude data... not added.\n";
711
-		    if ($globalVA !== TRUE && $globalIVAO !== TRUE && $globalVATSIM !== TRUE && $globalphpVMS !== TRUE && $globalVAM !== TRUE) {
710
+			//} elseif ($globalDebug) echo "!!! Strange altitude data... not added.\n";
711
+			if ($globalVA !== TRUE && $globalIVAO !== TRUE && $globalVATSIM !== TRUE && $globalphpVMS !== TRUE && $globalVAM !== TRUE) {
712 712
 			if (isset($this->all_flights[$id]['over_country']) && $this->all_flights[$id]['over_country'] != '' && isset($this->all_flights[$id]['altitude_previous']) && $this->all_flights[$id]['altitude_previous'] != '' && $this->all_flights[$id]['altitude_previous'] < $this->all_flights[$id]['altitude_real'] && isset($this->all_flights[$id]['lastupdate']) && $this->all_flights[$id]['lastupdate'] < time() - 1600) {
713 713
 				if ($globalDebug) echo '--- Reset because of altitude'."\n";
714 714
 				$this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0));
@@ -717,27 +717,27 @@  discard block
 block discarded – undo
717 717
 				elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id']));
718 718
 				elseif (isset($this->all_flights[$id]['ident'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident']));
719 719
 			}
720
-		    }
721
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('altitude_previous' => $line['altitude']));
720
+			}
721
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('altitude_previous' => $line['altitude']));
722 722
 		}
723 723
 
724 724
 		if (isset($line['noarchive']) && $line['noarchive'] === true) {
725
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('noarchive' => true));
725
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('noarchive' => true));
726 726
 		}
727 727
 		
728 728
 		if (isset($line['heading']) && $line['heading'] != '') {
729
-		    if (is_int($this->all_flights[$id]['heading']) && abs($this->all_flights[$id]['heading']-round($line['heading'])) > 10) $this->all_flights[$id]['putinarchive'] = true;
730
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => round($line['heading'])));
731
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading_fromsrc' => true));
732
-		    //$dataFound = true;
729
+			if (is_int($this->all_flights[$id]['heading']) && abs($this->all_flights[$id]['heading']-round($line['heading'])) > 10) $this->all_flights[$id]['putinarchive'] = true;
730
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => round($line['heading'])));
731
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading_fromsrc' => true));
732
+			//$dataFound = true;
733 733
   		} elseif (!isset($this->all_flights[$id]['heading_fromsrc']) && isset($this->all_flights[$id]['archive_latitude']) && $this->all_flights[$id]['archive_latitude'] != $this->all_flights[$id]['latitude'] && isset($this->all_flights[$id]['archive_longitude']) && $this->all_flights[$id]['archive_longitude'] != $this->all_flights[$id]['longitude']) {
734
-  		    $heading = $Common->getHeading($this->all_flights[$id]['archive_latitude'],$this->all_flights[$id]['archive_longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude']);
735
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => round($heading)));
736
-		    if (abs($this->all_flights[$id]['heading']-round($heading)) > 10) $this->all_flights[$id]['putinarchive'] = true;
737
-  		    if ($globalDebug) echo "ø Calculated Heading for ".$this->all_flights[$id]['hex']." : ".$heading."\n";
734
+  			$heading = $Common->getHeading($this->all_flights[$id]['archive_latitude'],$this->all_flights[$id]['archive_longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude']);
735
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => round($heading)));
736
+			if (abs($this->all_flights[$id]['heading']-round($heading)) > 10) $this->all_flights[$id]['putinarchive'] = true;
737
+  			if ($globalDebug) echo "ø Calculated Heading for ".$this->all_flights[$id]['hex']." : ".$heading."\n";
738 738
   		} elseif (isset($this->all_flights[$id]['format_source']) && $this->all_flights[$id]['format_source'] == 'ACARS') {
739
-  		    // If not enough messages and ACARS set heading to 0
740
-  		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => 0));
739
+  			// If not enough messages and ACARS set heading to 0
740
+  			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => 0));
741 741
   		}
742 742
 		if ($globalDaemon === TRUE && isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalSourcesupdate) $dataFound = false;
743 743
 		elseif ($globalDaemon === TRUE && isset($globalSBS1update) && $globalSBS1update != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalSBS1update) $dataFound = false;
@@ -750,133 +750,133 @@  discard block
 block discarded – undo
750 750
 		//if ($dataFound === true && isset($this->all_flights[$id]['hex']) && $this->all_flights[$id]['heading'] != '' && $this->all_flights[$id]['latitude'] != '' && $this->all_flights[$id]['longitude'] != '') {
751 751
 		//if ($dataFound === true && isset($this->all_flights[$id]['hex'])) {
752 752
 		if ($dataFound === true && isset($this->all_flights[$id]['id'])) {
753
-		    $this->all_flights[$id]['lastupdate'] = time();
754
-		    if ((!isset($globalNoImport) || $globalNoImport === FALSE) && $this->all_flights[$id]['addedSpotter'] == 0) {
755
-		        if (!isset($globalDistanceIgnore['latitude']) || $this->all_flights[$id]['longitude'] == ''  || $this->all_flights[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) {
756
-			    //print_r($this->all_flights);
757
-			    //echo $this->all_flights[$id]['id'].' - '.$this->all_flights[$id]['addedSpotter']."\n";
758
-			    //$last_hour_ident = Spotter->getIdentFromLastHour($this->all_flights[$id]['ident']);
759
-			    if (!isset($this->all_flights[$id]['forcenew']) || $this->all_flights[$id]['forcenew'] == 0) {
753
+			$this->all_flights[$id]['lastupdate'] = time();
754
+			if ((!isset($globalNoImport) || $globalNoImport === FALSE) && $this->all_flights[$id]['addedSpotter'] == 0) {
755
+				if (!isset($globalDistanceIgnore['latitude']) || $this->all_flights[$id]['longitude'] == ''  || $this->all_flights[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) {
756
+				//print_r($this->all_flights);
757
+				//echo $this->all_flights[$id]['id'].' - '.$this->all_flights[$id]['addedSpotter']."\n";
758
+				//$last_hour_ident = Spotter->getIdentFromLastHour($this->all_flights[$id]['ident']);
759
+				if (!isset($this->all_flights[$id]['forcenew']) || $this->all_flights[$id]['forcenew'] == 0) {
760 760
 				if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
761
-				    if ($globalDebug) echo "Check if aircraft is already in DB...";
762
-				    $timeelapsed = microtime(true);
763
-				    $SpotterLive = new SpotterLive($this->db);
764
-				    if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'aircraftjson' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) {
761
+					if ($globalDebug) echo "Check if aircraft is already in DB...";
762
+					$timeelapsed = microtime(true);
763
+					$SpotterLive = new SpotterLive($this->db);
764
+					if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'aircraftjson' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) {
765 765
 					$recent_ident = $SpotterLive->checkModeSRecent($this->all_flights[$id]['hex']);
766 766
 					if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkModeSRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
767
-				    } elseif (isset($line['id'])) {
767
+					} elseif (isset($line['id'])) {
768 768
 					$recent_ident = $SpotterLive->checkIdRecent($line['id']);
769 769
 					if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
770
-				    } elseif (isset($this->all_flights[$id]['ident']) && $this->all_flights[$id]['ident'] != '') {
770
+					} elseif (isset($this->all_flights[$id]['ident']) && $this->all_flights[$id]['ident'] != '') {
771 771
 					$recent_ident = $SpotterLive->checkIdentRecent($this->all_flights[$id]['ident']);
772 772
 					if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
773
-				    } else $recent_ident = '';
774
-				    $SpotterLive->db=null;
775
-				    if ($globalDebug && $recent_ident == '') echo " Not in DB.\n";
776
-				    elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n";
773
+					} else $recent_ident = '';
774
+					$SpotterLive->db=null;
775
+					if ($globalDebug && $recent_ident == '') echo " Not in DB.\n";
776
+					elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n";
777 777
 				} else $recent_ident = '';
778
-			    } else {
778
+				} else {
779 779
 				$recent_ident = '';
780 780
 				$this->all_flights[$id] = array_merge($this->all_flights[$id],array('forcenew' => 0));
781
-			    }
782
-			    //if there was no aircraft with the same callsign within the last hour and go post it into the archive
783
-			    if($recent_ident == "")
784
-			    {
781
+				}
782
+				//if there was no aircraft with the same callsign within the last hour and go post it into the archive
783
+				if($recent_ident == "")
784
+				{
785 785
 				if ($globalDebug) echo "\o/ Add ".$this->all_flights[$id]['ident']." in archive DB : ";
786 786
 				if ($this->all_flights[$id]['departure_airport'] == "") { $this->all_flights[$id]['departure_airport'] = "NA"; }
787 787
 				if ($this->all_flights[$id]['arrival_airport'] == "") { $this->all_flights[$id]['arrival_airport'] = "NA"; }
788 788
 				//adds the spotter data for the archive
789 789
 				$ignoreImport = false;
790 790
 				foreach($globalAirportIgnore as $airportIgnore) {
791
-				    if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) {
791
+					if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) {
792 792
 					$ignoreImport = true;
793
-				    }
793
+					}
794 794
 				}
795 795
 				if (count($globalAirportAccept) > 0) {
796
-				    $ignoreImport = true;
797
-				    foreach($globalAirportIgnore as $airportIgnore) {
796
+					$ignoreImport = true;
797
+					foreach($globalAirportIgnore as $airportIgnore) {
798 798
 					if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) {
799
-					    $ignoreImport = false;
799
+						$ignoreImport = false;
800
+					}
800 801
 					}
801
-				    }
802 802
 				}
803 803
 				if (isset($globalAirlineIgnore) && is_array($globalAirlineIgnore)) {
804
-				    foreach($globalAirlineIgnore as $airlineIgnore) {
804
+					foreach($globalAirlineIgnore as $airlineIgnore) {
805 805
 					if ((is_numeric(substr(substr($this->all_flights[$id]['ident'],0,4),-1,1)) && substr($this->all_flights[$id]['ident'],0,3) == $airlineIgnore) || (is_numeric(substr(substr($this->all_flights[$id]['ident'],0,3),-1,1)) && substr($this->all_flights[$id]['ident'],0,2) == $airlineIgnore)) {
806
-					    $ignoreImport = true;
806
+						$ignoreImport = true;
807
+					}
807 808
 					}
808
-				    }
809 809
 				}
810 810
 				if (isset($globalAirlineAccept) && count($globalAirlineAccept) > 0) {
811
-				    $ignoreImport = true;
812
-				    foreach($globalAirlineAccept as $airlineAccept) {
811
+					$ignoreImport = true;
812
+					foreach($globalAirlineAccept as $airlineAccept) {
813 813
 					if ((is_numeric(substr(substr($this->all_flights[$id]['ident'],0,4),-1,1)) && substr($this->all_flights[$id]['ident'],0,3) == $airlineAccept) || (is_numeric(substr(substr($this->all_flights[$id]['ident'],0,3),-1,1)) && substr($this->all_flights[$id]['ident'],0,2) == $airlineAccept)) {
814
-					    $ignoreImport = false;
814
+						$ignoreImport = false;
815
+					}
815 816
 					}
816
-				    }
817 817
 				}
818 818
 				if (isset($globalPilotIdAccept) && count($globalPilotIdAccept) > 0) {
819
-				    $ignoreImport = true;
820
-				    foreach($globalPilotIdAccept as $pilotIdAccept) {
819
+					$ignoreImport = true;
820
+					foreach($globalPilotIdAccept as $pilotIdAccept) {
821 821
 					if ($this->all_flights[$id]['pilot_id'] == $pilotIdAccept) {
822
-					    $ignoreImport = false;
822
+						$ignoreImport = false;
823
+					}
823 824
 					}
824
-				    }
825 825
 				}
826 826
 				
827 827
 				if (!$ignoreImport) {
828
-				    $highlight = '';
829
-				    if ($this->all_flights[$id]['squawk'] == '7500') $highlight = 'Squawk 7500 : Hijack';
830
-				    if ($this->all_flights[$id]['squawk'] == '7600') $highlight = 'Squawk 7600 : Lost Comm (radio failure)';
831
-				    if ($this->all_flights[$id]['squawk'] == '7700') $highlight = 'Squawk 7700 : Emergency';
832
-				    if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi')));
833
-				    $timeelapsed = microtime(true);
834
-				    if (!isset($globalNoImport) || $globalNoImport === FALSE) {
828
+					$highlight = '';
829
+					if ($this->all_flights[$id]['squawk'] == '7500') $highlight = 'Squawk 7500 : Hijack';
830
+					if ($this->all_flights[$id]['squawk'] == '7600') $highlight = 'Squawk 7600 : Lost Comm (radio failure)';
831
+					if ($this->all_flights[$id]['squawk'] == '7700') $highlight = 'Squawk 7700 : Emergency';
832
+					if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi')));
833
+					$timeelapsed = microtime(true);
834
+					if (!isset($globalNoImport) || $globalNoImport === FALSE) {
835 835
 					if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
836
-					    $Spotter = new Spotter($this->db);
837
-					    $result = $Spotter->addSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['aircraft_icao'], $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['waypoints'], $this->all_flights[$id]['altitude'],$this->all_flights[$id]['altitude_real'], $this->all_flights[$id]['heading'], $this->all_flights[$id]['speed'], $this->all_flights[$id]['datetime'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport_time'],$this->all_flights[$id]['squawk'],$this->all_flights[$id]['route_stop'],$highlight,$this->all_flights[$id]['hex'],$this->all_flights[$id]['registration'],$this->all_flights[$id]['pilot_id'],$this->all_flights[$id]['pilot_name'],$this->all_flights[$id]['verticalrate'],$this->all_flights[$id]['ground'],$this->all_flights[$id]['format_source'],$this->all_flights[$id]['source_name'],$this->all_flights[$id]['source_type']);
838
-					    $Spotter->db = null;
839
-					    if ($globalDebug) {
836
+						$Spotter = new Spotter($this->db);
837
+						$result = $Spotter->addSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['aircraft_icao'], $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['waypoints'], $this->all_flights[$id]['altitude'],$this->all_flights[$id]['altitude_real'], $this->all_flights[$id]['heading'], $this->all_flights[$id]['speed'], $this->all_flights[$id]['datetime'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport_time'],$this->all_flights[$id]['squawk'],$this->all_flights[$id]['route_stop'],$highlight,$this->all_flights[$id]['hex'],$this->all_flights[$id]['registration'],$this->all_flights[$id]['pilot_id'],$this->all_flights[$id]['pilot_name'],$this->all_flights[$id]['verticalrate'],$this->all_flights[$id]['ground'],$this->all_flights[$id]['format_source'],$this->all_flights[$id]['source_name'],$this->all_flights[$id]['source_type']);
838
+						$Spotter->db = null;
839
+						if ($globalDebug) {
840 840
 						if (isset($result['error'])) echo 'Error: '.$result['error']."\n";
841 841
 						else echo 'Success';
842
-					    }
843
-					    if (count($result) > 1) {
844
-					    // ':airline_name' => $airline_name,':airline_icao' => $airline_icao,':airline_country' => $airline_country,':airline_type' => $airline_type,
842
+						}
843
+						if (count($result) > 1) {
844
+						// ':airline_name' => $airline_name,':airline_icao' => $airline_icao,':airline_country' => $airline_country,':airline_type' => $airline_type,
845 845
 						if ($this->all_flights[$id]['aircraft_icao'] == '') $this->all_flights[$id]['aircraft_icao'] = $result[':aircraft_icao'];
846 846
 						if ($this->all_flights[$id]['registration'] == '') $this->all_flights[$id]['registration'] = $result[':registration'];
847
-					    }
847
+						}
848 848
 					}
849
-				    }
850
-				    if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
851
-				    if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
849
+					}
850
+					if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
851
+					if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
852 852
 
853
-				    // Add source stat in DB
854
-				    $Stats = new Stats($this->db);
855
-				    if (!empty($this->stats)) {
853
+					// Add source stat in DB
854
+					$Stats = new Stats($this->db);
855
+					if (!empty($this->stats)) {
856 856
 					if ($globalDebug) echo 'Add source stats : ';
857
-				        foreach($this->stats as $date => $data) {
858
-					    foreach($data as $source => $sourced) {
859
-					        //print_r($sourced);
860
-				    	        if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar',$date);
861
-				    	        if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist',$date);
862
-				    		if (isset($sourced['msg'])) {
863
-				    		    if (time() - $sourced['msg']['date'] > 10) {
864
-				    		        $nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date']));
865
-				    		        echo $Stats->addStatSource($nbmsg,$source,'msg',$date);
866
-			    			        unset($this->stats[$date][$source]['msg']);
867
-			    			    }
868
-			    			}
869
-			    		    }
870
-			    		    if ($date != date('Y-m-d')) {
871
-			    			unset($this->stats[$date]);
872
-			    		    }
873
-				    	}
874
-				    	if ($globalDebug) echo 'Done'."\n";
857
+						foreach($this->stats as $date => $data) {
858
+						foreach($data as $source => $sourced) {
859
+							//print_r($sourced);
860
+								if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar',$date);
861
+								if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist',$date);
862
+							if (isset($sourced['msg'])) {
863
+								if (time() - $sourced['msg']['date'] > 10) {
864
+									$nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date']));
865
+									echo $Stats->addStatSource($nbmsg,$source,'msg',$date);
866
+									unset($this->stats[$date][$source]['msg']);
867
+								}
868
+							}
869
+							}
870
+							if ($date != date('Y-m-d')) {
871
+							unset($this->stats[$date]);
872
+							}
873
+						}
874
+						if ($globalDebug) echo 'Done'."\n";
875 875
 
876
-				    }
877
-				    $Stats->db = null;
878
-				    }
879
-				    $this->del();
876
+					}
877
+					$Stats->db = null;
878
+					}
879
+					$this->del();
880 880
 				} elseif ($globalDebug) echo 'Ignore data'."\n";
881 881
 				//$ignoreImport = false;
882 882
 				$this->all_flights[$id]['addedSpotter'] = 1;
@@ -894,41 +894,41 @@  discard block
 block discarded – undo
894 894
 			*/
895 895
 			//SpotterLive->deleteLiveSpotterDataByIdent($this->all_flights[$id]['ident']);
896 896
 				if ($this->last_delete == 0 || time() - $this->last_delete > 1800) {
897
-				    if ($globalDebug) echo "---- Deleting Live Spotter data older than 9 hours...";
898
-				    //SpotterLive->deleteLiveSpotterDataNotUpdated();
899
-				    if (!isset($globalNoImport) || $globalNoImport === FALSE) {
897
+					if ($globalDebug) echo "---- Deleting Live Spotter data older than 9 hours...";
898
+					//SpotterLive->deleteLiveSpotterDataNotUpdated();
899
+					if (!isset($globalNoImport) || $globalNoImport === FALSE) {
900 900
 					if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
901
-					    $SpotterLive = new SpotterLive($this->db);
902
-					    $SpotterLive->deleteLiveSpotterData();
903
-					    $SpotterLive->db=null;
901
+						$SpotterLive = new SpotterLive($this->db);
902
+						$SpotterLive->deleteLiveSpotterData();
903
+						$SpotterLive->db=null;
904 904
 					}
905
-				    }
906
-				    if ($globalDebug) echo " Done\n";
907
-				    $this->last_delete = time();
905
+					}
906
+					if ($globalDebug) echo " Done\n";
907
+					$this->last_delete = time();
908 908
 				}
909
-			    } else {
909
+				} else {
910 910
 				if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'aircraftjson' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt'|| $line['format_source'] === 'planeupdatefaa'  || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'famaprs' || $line['format_source'] === 'airwhere')) {
911
-				    $this->all_flights[$id]['id'] = $recent_ident;
912
-				    $this->all_flights[$id]['addedSpotter'] = 1;
911
+					$this->all_flights[$id]['id'] = $recent_ident;
912
+					$this->all_flights[$id]['addedSpotter'] = 1;
913 913
 				}
914 914
 				if (isset($globalDaemon) && !$globalDaemon) {
915
-				    if (!isset($globalNoImport) || $globalNoImport === FALSE) {
915
+					if (!isset($globalNoImport) || $globalNoImport === FALSE) {
916 916
 					if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
917
-					    $Spotter = new Spotter($this->db);
918
-					    $Spotter->updateLatestSpotterData($this->all_flights[$id]['id'],$this->all_flights[$id]['ident'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$this->all_flights[$id]['altitude'],$this->all_flights[$id]['altitude_real'],$this->all_flights[$id]['ground'],$this->all_flights[$id]['speed'],$this->all_flights[$id]['datetime'],$this->all_flights[$id]['arrival_airport'],$this->all_flights[$id]['arrival_airport_time']);
919
-					    $Spotter->db = null;
917
+						$Spotter = new Spotter($this->db);
918
+						$Spotter->updateLatestSpotterData($this->all_flights[$id]['id'],$this->all_flights[$id]['ident'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$this->all_flights[$id]['altitude'],$this->all_flights[$id]['altitude_real'],$this->all_flights[$id]['ground'],$this->all_flights[$id]['speed'],$this->all_flights[$id]['datetime'],$this->all_flights[$id]['arrival_airport'],$this->all_flights[$id]['arrival_airport_time']);
919
+						$Spotter->db = null;
920
+					}
920 921
 					}
921
-				    }
922 922
 				}
923 923
 				
924
-			    }
924
+				}
925 925
 			}
926
-		    }
927
-		    //adds the spotter LIVE data
928
-		    //SpotterLive->addLiveSpotterData($flightaware_id, $ident, $aircraft_type, $departure_airport, $arrival_airport, $latitude, $longitude, $waypoints, $altitude, $heading, $groundspeed);
929
-		    //echo "\nAdd in Live !! \n";
930
-		    //echo "{$line[8]} {$line[7]} - MODES:{$line[4]}  CALLSIGN:{$line[10]}   ALT:{$line[11]}   VEL:{$line[12]}   HDG:{$line[13]}   LAT:{$line[14]}   LON:{$line[15]}   VR:{$line[16]}   SQUAWK:{$line[17]}\n";
931
-		    if ($globalDebug) {
926
+			}
927
+			//adds the spotter LIVE data
928
+			//SpotterLive->addLiveSpotterData($flightaware_id, $ident, $aircraft_type, $departure_airport, $arrival_airport, $latitude, $longitude, $waypoints, $altitude, $heading, $groundspeed);
929
+			//echo "\nAdd in Live !! \n";
930
+			//echo "{$line[8]} {$line[7]} - MODES:{$line[4]}  CALLSIGN:{$line[10]}   ALT:{$line[11]}   VEL:{$line[12]}   HDG:{$line[13]}   LAT:{$line[14]}   LON:{$line[15]}   VR:{$line[16]}   SQUAWK:{$line[17]}\n";
931
+			if ($globalDebug) {
932 932
 			if ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || (isset($globalVAM) && $globalVAM)) {
933 933
 				if (isset($this->all_flights[$id]['source_name'])) echo 'DATA : hex : '.$this->all_flights[$id]['hex'].' - ident : '.$this->all_flights[$id]['ident'].' - ICAO : '.$this->all_flights[$id]['aircraft_icao'].' - Departure Airport : '.$this->all_flights[$id]['departure_airport'].' - Arrival Airport : '.$this->all_flights[$id]['arrival_airport'].' - Latitude : '.$this->all_flights[$id]['latitude'].' - Longitude : '.$this->all_flights[$id]['longitude'].' - waypoints : '.$this->all_flights[$id]['waypoints'].' - Altitude : '.$this->all_flights[$id]['altitude'].' - Heading : '.$this->all_flights[$id]['heading'].' - Speed : '.$this->all_flights[$id]['speed'].' - Departure Airport Time : '.$this->all_flights[$id]['departure_airport_time'].' - Arrival Airport time : '.$this->all_flights[$id]['arrival_airport_time'].' - Pilot : '.$this->all_flights[$id]['pilot_name'].' - Source name : '.$this->all_flights[$id]['source_name']."\n";
934 934
 				else echo 'DATA : hex : '.$this->all_flights[$id]['hex'].' - ident : '.$this->all_flights[$id]['ident'].' - ICAO : '.$this->all_flights[$id]['aircraft_icao'].' - Departure Airport : '.$this->all_flights[$id]['departure_airport'].' - Arrival Airport : '.$this->all_flights[$id]['arrival_airport'].' - Latitude : '.$this->all_flights[$id]['latitude'].' - Longitude : '.$this->all_flights[$id]['longitude'].' - waypoints : '.$this->all_flights[$id]['waypoints'].' - Altitude : '.$this->all_flights[$id]['altitude'].' - Heading : '.$this->all_flights[$id]['heading'].' - Speed : '.$this->all_flights[$id]['speed'].' - Departure Airport Time : '.$this->all_flights[$id]['departure_airport_time'].' - Arrival Airport time : '.$this->all_flights[$id]['arrival_airport_time'].' - Pilot : '.$this->all_flights[$id]['pilot_name']."\n";
@@ -936,60 +936,60 @@  discard block
 block discarded – undo
936 936
 				if (isset($this->all_flights[$id]['source_name'])) echo 'DATA : hex : '.$this->all_flights[$id]['hex'].' - ident : '.$this->all_flights[$id]['ident'].' - ICAO : '.$this->all_flights[$id]['aircraft_icao'].' - Departure Airport : '.$this->all_flights[$id]['departure_airport'].' - Arrival Airport : '.$this->all_flights[$id]['arrival_airport'].' - Latitude : '.$this->all_flights[$id]['latitude'].' - Longitude : '.$this->all_flights[$id]['longitude'].' - waypoints : '.$this->all_flights[$id]['waypoints'].' - Altitude : '.$this->all_flights[$id]['altitude'].' - Heading : '.$this->all_flights[$id]['heading'].' - Speed : '.$this->all_flights[$id]['speed'].' - Departure Airport Time : '.$this->all_flights[$id]['departure_airport_time'].' - Arrival Airport time : '.$this->all_flights[$id]['arrival_airport_time'].' - Source Name : '.$this->all_flights[$id]['source_name']."\n";
937 937
 				else echo 'DATA : hex : '.$this->all_flights[$id]['hex'].' - ident : '.$this->all_flights[$id]['ident'].' - ICAO : '.$this->all_flights[$id]['aircraft_icao'].' - Departure Airport : '.$this->all_flights[$id]['departure_airport'].' - Arrival Airport : '.$this->all_flights[$id]['arrival_airport'].' - Latitude : '.$this->all_flights[$id]['latitude'].' - Longitude : '.$this->all_flights[$id]['longitude'].' - waypoints : '.$this->all_flights[$id]['waypoints'].' - Altitude : '.$this->all_flights[$id]['altitude'].' - Heading : '.$this->all_flights[$id]['heading'].' - Speed : '.$this->all_flights[$id]['speed'].' - Departure Airport Time : '.$this->all_flights[$id]['departure_airport_time'].' - Arrival Airport time : '.$this->all_flights[$id]['arrival_airport_time']."\n";
938 938
 			}
939
-		    }
940
-		    $ignoreImport = false;
941
-		    if ($this->all_flights[$id]['departure_airport'] == "") { $this->all_flights[$id]['departure_airport'] = "NA"; }
942
-		    if ($this->all_flights[$id]['arrival_airport'] == "") { $this->all_flights[$id]['arrival_airport'] = "NA"; }
939
+			}
940
+			$ignoreImport = false;
941
+			if ($this->all_flights[$id]['departure_airport'] == "") { $this->all_flights[$id]['departure_airport'] = "NA"; }
942
+			if ($this->all_flights[$id]['arrival_airport'] == "") { $this->all_flights[$id]['arrival_airport'] = "NA"; }
943 943
 
944
-		    foreach($globalAirportIgnore as $airportIgnore) {
945
-		        if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) {
946
-			    $ignoreImport = true;
944
+			foreach($globalAirportIgnore as $airportIgnore) {
945
+				if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) {
946
+				$ignoreImport = true;
947
+			}
947 948
 			}
948
-		    }
949
-		    if (count($globalAirportAccept) > 0) {
950
-		        $ignoreImport = true;
951
-		        foreach($globalAirportIgnore as $airportIgnore) {
952
-			    if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) {
949
+			if (count($globalAirportAccept) > 0) {
950
+				$ignoreImport = true;
951
+				foreach($globalAirportIgnore as $airportIgnore) {
952
+				if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) {
953 953
 				$ignoreImport = false;
954
-			    }
954
+				}
955 955
 			}
956
-		    }
957
-		    if (isset($globalAirlineIgnore) && is_array($globalAirlineIgnore)) {
956
+			}
957
+			if (isset($globalAirlineIgnore) && is_array($globalAirlineIgnore)) {
958 958
 			foreach($globalAirlineIgnore as $airlineIgnore) {
959
-			    if ((is_numeric(substr(substr($this->all_flights[$id]['ident'],0,4),-1,1)) && substr($this->all_flights[$id]['ident'],0,3) == $airlineIgnore) || (is_numeric(substr(substr($this->all_flights[$id]['ident'],0,3),-1,1)) && substr($this->all_flights[$id]['ident'],0,2) == $airlineIgnore)) {
959
+				if ((is_numeric(substr(substr($this->all_flights[$id]['ident'],0,4),-1,1)) && substr($this->all_flights[$id]['ident'],0,3) == $airlineIgnore) || (is_numeric(substr(substr($this->all_flights[$id]['ident'],0,3),-1,1)) && substr($this->all_flights[$id]['ident'],0,2) == $airlineIgnore)) {
960 960
 				$ignoreImport = true;
961
-			    }
961
+				}
962 962
 			}
963
-		    }
964
-		    if (isset($globalAirlineAccept) && count($globalAirlineAccept) > 0) {
963
+			}
964
+			if (isset($globalAirlineAccept) && count($globalAirlineAccept) > 0) {
965 965
 			$ignoreImport = true;
966 966
 			foreach($globalAirlineAccept as $airlineAccept) {
967
-			    if ((is_numeric(substr(substr($this->all_flights[$id]['ident'],0,4),-1,1)) && substr($this->all_flights[$id]['ident'],0,3) == $airlineAccept) || (is_numeric(substr(substr($this->all_flights[$id]['ident'],0,3),-1,1)) && substr($this->all_flights[$id]['ident'],0,2) == $airlineAccept)) {
967
+				if ((is_numeric(substr(substr($this->all_flights[$id]['ident'],0,4),-1,1)) && substr($this->all_flights[$id]['ident'],0,3) == $airlineAccept) || (is_numeric(substr(substr($this->all_flights[$id]['ident'],0,3),-1,1)) && substr($this->all_flights[$id]['ident'],0,2) == $airlineAccept)) {
968 968
 				$ignoreImport = false;
969
-			    }
969
+				}
970
+			}
970 971
 			}
971
-		    }
972
-		    if (isset($globalPilotIdAccept) && count($globalPilotIdAccept) > 0) {
972
+			if (isset($globalPilotIdAccept) && count($globalPilotIdAccept) > 0) {
973 973
 			$ignoreImport = true;
974 974
 			foreach($globalPilotIdAccept as $pilotIdAccept) {
975
-			    if ($this->all_flights[$id]['pilot_id'] == $pilotIdAccept) {
976
-			        $ignoreImport = false;
977
-			    }
975
+				if ($this->all_flights[$id]['pilot_id'] == $pilotIdAccept) {
976
+					$ignoreImport = false;
977
+				}
978
+			}
978 979
 			}
979
-		    }
980 980
 
981
-		    if (!$ignoreImport) {
981
+			if (!$ignoreImport) {
982 982
 			if (!isset($globalDistanceIgnore['latitude']) || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) {
983 983
 				if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi')));
984 984
 				$timeelapsed = microtime(true);
985 985
 				if (!isset($globalNoImport) || $globalNoImport === FALSE) {
986
-				    if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
986
+					if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
987 987
 					if ($globalDebug) echo "\o/ Add ".$this->all_flights[$id]['ident']." from ".$this->all_flights[$id]['format_source']." in Live DB : ";
988 988
 					$SpotterLive = new SpotterLive($this->db);
989 989
 					$result = $SpotterLive->addLiveSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['aircraft_icao'], $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['waypoints'], $this->all_flights[$id]['altitude'],$this->all_flights[$id]['altitude_real'], $this->all_flights[$id]['heading'], $this->all_flights[$id]['speed'],$this->all_flights[$id]['datetime'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport_time'], $this->all_flights[$id]['squawk'],$this->all_flights[$id]['route_stop'],$this->all_flights[$id]['hex'],$this->all_flights[$id]['putinarchive'],$this->all_flights[$id]['registration'],$this->all_flights[$id]['pilot_id'],$this->all_flights[$id]['pilot_name'], $this->all_flights[$id]['verticalrate'], $this->all_flights[$id]['noarchive'], $this->all_flights[$id]['ground'],$this->all_flights[$id]['format_source'],$this->all_flights[$id]['source_name'],$this->all_flights[$id]['over_country']);
990 990
 					$SpotterLive->db = null;
991 991
 					if ($globalDebug) echo $result."\n";
992
-				    }
992
+					}
993 993
 				}
994 994
 				if (isset($globalServerAPRS) && $globalServerAPRS && $this->all_flights[$id]['putinarchive']) {
995 995
 					$APRSSpotter->addLiveSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['aircraft_icao'], $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['waypoints'], $this->all_flights[$id]['altitude'], $this->all_flights[$id]['altitude_real'], $this->all_flights[$id]['heading'], $this->all_flights[$id]['speed'],$this->all_flights[$id]['datetime'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport_time'], $this->all_flights[$id]['squawk'],$this->all_flights[$id]['route_stop'],$this->all_flights[$id]['hex'],$this->all_flights[$id]['putinarchive'],$this->all_flights[$id]['registration'],$this->all_flights[$id]['pilot_id'],$this->all_flights[$id]['pilot_name'], $this->all_flights[$id]['verticalrate'], $this->all_flights[$id]['noarchive'], $this->all_flights[$id]['ground'],$this->all_flights[$id]['format_source'],$this->all_flights[$id]['source_name'],$this->all_flights[$id]['over_country']);
@@ -1001,7 +1001,7 @@  discard block
 block discarded – undo
1001 1001
 				//if ($line['format_source'] != 'aprs') {
1002 1002
 				//if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt')) {
1003 1003
 				if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
1004
-				    if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE && $this->all_flights[$id]['latitude'] != '' && $this->all_flights[$id]['longitude'] != '') {
1004
+					if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE && $this->all_flights[$id]['latitude'] != '' && $this->all_flights[$id]['longitude'] != '') {
1005 1005
 					$source = $this->all_flights[$id]['source_name'];
1006 1006
 					if ($source == '') $source = $this->all_flights[$id]['format_source'];
1007 1007
 					if (!isset($this->source_location[$source])) {
@@ -1027,7 +1027,7 @@  discard block
 block discarded – undo
1027 1027
 					if ($stats_heading == 16) $stats_heading = 0;
1028 1028
 					if (!isset($this->stats[$current_date][$source]['polar'][1])) {
1029 1029
 						for ($i=0;$i<=15;$i++) {
1030
-						    $this->stats[$current_date][$source]['polar'][$i] = 0;
1030
+							$this->stats[$current_date][$source]['polar'][$i] = 0;
1031 1031
 						}
1032 1032
 						$this->stats[$current_date][$source]['polar'][$stats_heading] = $stats_distance;
1033 1033
 					} else {
@@ -1040,17 +1040,17 @@  discard block
 block discarded – undo
1040 1040
 					//var_dump($this->stats);
1041 1041
 					if (!isset($this->stats[$current_date][$source]['hist'][$distance])) {
1042 1042
 						if (isset($this->stats[$current_date][$source]['hist'][0])) {
1043
-						    end($this->stats[$current_date][$source]['hist']);
1044
-						    $mini = key($this->stats[$current_date][$source]['hist'])+10;
1043
+							end($this->stats[$current_date][$source]['hist']);
1044
+							$mini = key($this->stats[$current_date][$source]['hist'])+10;
1045 1045
 						} else $mini = 0;
1046 1046
 						for ($i=$mini;$i<=$distance;$i+=10) {
1047
-						    $this->stats[$current_date][$source]['hist'][$i] = 0;
1047
+							$this->stats[$current_date][$source]['hist'][$i] = 0;
1048 1048
 						}
1049 1049
 						$this->stats[$current_date][$source]['hist'][$distance] = 1;
1050 1050
 					} else {
1051 1051
 						$this->stats[$current_date][$source]['hist'][$distance] += 1;
1052 1052
 					}
1053
-				    }
1053
+					}
1054 1054
 				}
1055 1055
 
1056 1056
 				$this->all_flights[$id]['lastupdate'] = time();
@@ -1060,7 +1060,7 @@  discard block
 block discarded – undo
1060 1060
 			//$this->del();
1061 1061
 			
1062 1062
 			if ($this->last_delete_hourly == 0 || time() - $this->last_delete_hourly > 900) {
1063
-			    if ((!isset($globalNoImport) || $globalNoImport === FALSE) && (!isset($globalNoDB) || $globalNoDB !== TRUE)) {
1063
+				if ((!isset($globalNoImport) || $globalNoImport === FALSE) && (!isset($globalNoDB) || $globalNoDB !== TRUE)) {
1064 1064
 				if ($globalDebug) echo "---- Deleting Live Spotter data Not updated since 2 hour...";
1065 1065
 				$SpotterLive = new SpotterLive($this->db);
1066 1066
 				$SpotterLive->deleteLiveSpotterDataNotUpdated();
@@ -1068,19 +1068,19 @@  discard block
 block discarded – undo
1068 1068
 				//SpotterLive->deleteLiveSpotterData();
1069 1069
 				if ($globalDebug) echo " Done\n";
1070 1070
 				$this->last_delete_hourly = time();
1071
-			    } else {
1071
+				} else {
1072 1072
 				$this->del();
1073 1073
 				$this->last_delete_hourly = time();
1074
-			    }
1074
+				}
1075 1075
 			}
1076 1076
 			
1077
-		    }
1078
-		    //$ignoreImport = false;
1077
+			}
1078
+			//$ignoreImport = false;
1079 1079
 		}
1080 1080
 		//if (function_exists('pcntl_fork') && $globalFork) pcntl_signal(SIGCHLD, SIG_IGN);
1081 1081
 		if ($send) return $this->all_flights[$id];
1082
-	    }
1082
+		}
1083
+	}
1083 1084
 	}
1084
-    }
1085 1085
 }
1086 1086
 ?>
Please login to merge, or discard this patch.
airport-geojson.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 		date_default_timezone_set('UTC');
28 28
 		//waypoint plotting
29 29
 		$output .= '{"type": "Feature",';
30
-		    $output .= '"properties": {';
30
+			$output .= '"properties": {';
31 31
 			$output .= '"name": '.json_encode(str_replace('"',"'",$spotter_item['name'])).',';
32 32
 			$output .= '"city": '.json_encode(str_replace('"',"'",$spotter_item['city'])).',';
33 33
 			$output .= '"country": "'.$spotter_item['country'].'",';
@@ -50,13 +50,13 @@  discard block
 block discarded – undo
50 50
 			$output .= '"homepage": "'.$spotter_item['home_link'].'",';
51 51
 			$output .= '"image_thumb": "'.$spotter_item['image_thumb'].'"';
52 52
 //			$output .= '"photo": "'.$spotter_item['image_thumbnail'].'",';
53
-		    $output .= '},';
54
-		    $output .= '"geometry": {';
53
+			$output .= '},';
54
+			$output .= '"geometry": {';
55 55
 			$output .= '"type": "Point",';
56 56
 			$output .= '"coordinates": [';
57
-			    $output .= $spotter_item['longitude'].', '.$spotter_item['latitude'];
57
+				$output .= $spotter_item['longitude'].', '.$spotter_item['latitude'];
58 58
 			$output .= ']';
59
-		    $output .= '}';
59
+			$output .= '}';
60 60
 		$output .= '},';
61 61
 	}
62 62
 	$output  = substr($output, 0, -1);
Please login to merge, or discard this patch.
live-czml.php 1 patch
Indentation   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -50,30 +50,30 @@  discard block
 block discarded – undo
50 50
 
51 51
 
52 52
 function quaternionrotate($heading, $attitude = 0, $bank = 0) {
53
-    // Assuming the angles are in radians.
54
-    $c1 = cos($heading/2);
55
-    $s1 = sin($heading/2);
56
-    $c2 = cos($attitude/2);
57
-    $s2 = sin($attitude/2);
58
-    $c3 = cos($bank/2);
59
-    $s3 = sin($bank/2);
60
-    $c1c2 = $c1*$c2;
61
-    $s1s2 = $s1*$s2;
62
-    $w =$c1c2*$c3 - $s1s2*$s3;
63
-    $x =$c1c2*$s3 + $s1s2*$c3;
64
-    $y =$s1*$c2*$c3 + $c1*$s2*$s3;
65
-    $z =$c1*$s2*$c3 - $s1*$c2*$s3;
66
-    return array('x' => $x,'y' => $y,'z' => $z,'w' => $w);
53
+	// Assuming the angles are in radians.
54
+	$c1 = cos($heading/2);
55
+	$s1 = sin($heading/2);
56
+	$c2 = cos($attitude/2);
57
+	$s2 = sin($attitude/2);
58
+	$c3 = cos($bank/2);
59
+	$s3 = sin($bank/2);
60
+	$c1c2 = $c1*$c2;
61
+	$s1s2 = $s1*$s2;
62
+	$w =$c1c2*$c3 - $s1s2*$s3;
63
+	$x =$c1c2*$s3 + $s1s2*$c3;
64
+	$y =$s1*$c2*$c3 + $c1*$s2*$s3;
65
+	$z =$c1*$s2*$c3 - $s1*$c2*$s3;
66
+	return array('x' => $x,'y' => $y,'z' => $z,'w' => $w);
67 67
 //    return array('x' => '0.0','y' => '-0.931','z' => '0.0','w' => '0.365');
68 68
 
69 69
 }
70 70
 
71 71
 
72 72
 if (isset($_GET['download'])) {
73
-    if ($_GET['download'] == "true")
74
-    {
73
+	if ($_GET['download'] == "true")
74
+	{
75 75
 	header('Content-disposition: attachment; filename="flightairmap.json"');
76
-    }
76
+	}
77 77
 }
78 78
 header('Content-Type: text/javascript');
79 79
 
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
 	if (isset($_GET['coord']) && $_GET['coord'] != '') {
185 185
 		$coord = explode(',',$_GET['coord']);
186 186
 		if (!(filter_var($coord[0],FILTER_VALIDATE_FLOAT) && filter_var($coord[1],FILTER_VALIDATE_FLOAT) && filter_var($coord[2],FILTER_VALIDATE_FLOAT) && filter_var($coord[3],FILTER_VALIDATE_FLOAT) 
187
-		    && $coord[0] > -180.0 && $coord[0] < 180.0 && $coord[1] > -90.0 && $coord[1] < 90.0 && $coord[2] > -180.0 && $coord[2] < 180.0 && $coord[3] > -90.0 && $coord[3] < 90.0)) {
187
+			&& $coord[0] > -180.0 && $coord[0] < 180.0 && $coord[1] > -90.0 && $coord[1] < 90.0 && $coord[2] > -180.0 && $coord[2] < 180.0 && $coord[3] > -90.0 && $coord[3] < 90.0)) {
188 188
 			$coord = array();
189 189
 		}
190 190
 	}
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
 	if (!((isset($_COOKIE['singlemodel']) && $_COOKIE['singlemodel'] == 'true') && (isset($_COOKIE['MapTrackMarine']) && $_COOKIE['MapTrackMarine'] != '')) && isset($_GET['coord']) && $_GET['coord'] != '') {
209 209
 		$coord = explode(',',$_GET['coord']);
210 210
 		if (!(filter_var($coord[0],FILTER_VALIDATE_FLOAT) && filter_var($coord[1],FILTER_VALIDATE_FLOAT) && filter_var($coord[2],FILTER_VALIDATE_FLOAT) && filter_var($coord[3],FILTER_VALIDATE_FLOAT) 
211
-		    && $coord[0] > -180.0 && $coord[0] < 180.0 && $coord[1] > -90.0 && $coord[1] < 90.0 && $coord[2] > -180.0 && $coord[2] < 180.0 && $coord[3] > -90.0 && $coord[3] < 90.0)) {
211
+			&& $coord[0] > -180.0 && $coord[0] < 180.0 && $coord[1] > -90.0 && $coord[1] < 90.0 && $coord[2] > -180.0 && $coord[2] < 180.0 && $coord[3] > -90.0 && $coord[3] < 90.0)) {
212 212
 			$coord = array();
213 213
 		}
214 214
 	}
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
 	if (!((isset($_COOKIE['singlemodel']) && $_COOKIE['singlemodel'] == 'true') && (isset($_COOKIE['MapTrack']) && $_COOKIE['MapTrack'] != '')) && isset($_GET['coord']) && $_GET['coord'] != '') {
230 230
 		$coord = explode(',',$_GET['coord']);
231 231
 		if (!(filter_var($coord[0],FILTER_VALIDATE_FLOAT) && filter_var($coord[1],FILTER_VALIDATE_FLOAT) && filter_var($coord[2],FILTER_VALIDATE_FLOAT) && filter_var($coord[3],FILTER_VALIDATE_FLOAT) 
232
-		    && $coord[0] > -180.0 && $coord[0] < 180.0 && $coord[1] > -90.0 && $coord[1] < 90.0 && $coord[2] > -180.0 && $coord[2] < 180.0 && $coord[3] > -90.0 && $coord[3] < 90.0)) {
232
+			&& $coord[0] > -180.0 && $coord[0] < 180.0 && $coord[1] > -90.0 && $coord[1] < 90.0 && $coord[2] > -180.0 && $coord[2] < 180.0 && $coord[3] > -90.0 && $coord[3] < 90.0)) {
233 233
 			$coord = array();
234 234
 		}
235 235
 	}
@@ -350,10 +350,10 @@  discard block
 block discarded – undo
350 350
 			$image = "images/placeholder_thumb.png";
351 351
 		}
352 352
 
353
-                if (isset($spotter_item['flightaware_id'])) $id = $spotter_item['flightaware_id'];
354
-                elseif (isset($spotter_item['famtrackid'])) $id = $spotter_item['famtrackid'];
355
-                elseif (isset($spotter_item['fammarine_id'])) $id = $spotter_item['fammarine_id'];
356
-                if ($prev_flightaware_id != $id) {
353
+				if (isset($spotter_item['flightaware_id'])) $id = $spotter_item['flightaware_id'];
354
+				elseif (isset($spotter_item['famtrackid'])) $id = $spotter_item['famtrackid'];
355
+				elseif (isset($spotter_item['fammarine_id'])) $id = $spotter_item['fammarine_id'];
356
+				if ($prev_flightaware_id != $id) {
357 357
 			if ($prev_flightaware_id != '') {
358 358
 				/*
359 359
 				if ($nblatlong == 1) {
@@ -449,7 +449,7 @@  discard block
 block discarded – undo
449 449
 							$spotter_item['wake_category'] = $aircraft_info[0]['wake_category'];
450 450
 							$spotter_item['engine_count'] = $aircraft_info[0]['engine_count'];
451 451
 						} else $aircraft_shadow = '';
452
-	    					$output .= ' "billboard" : {"image" : "'.$globalURL.'/images/aircrafts/new/'.$aircraft_shadow.'","scale" : 0.5';
452
+							$output .= ' "billboard" : {"image" : "'.$globalURL.'/images/aircrafts/new/'.$aircraft_shadow.'","scale" : 0.5';
453 453
 						if (isset($_COOKIE['IconColorForce']) && $_COOKIE['IconColorForce'] == 'true' && isset($_COOKIE['IconColor'])) {
454 454
 							$rgb = $Common->hex2rgb($_COOKIE['IconColor']);
455 455
 							$output .= ',"color": {"rgba" : ['.$rgb[0].','.$rgb[1].','.$rgb[2].',255]}';
@@ -480,7 +480,7 @@  discard block
 block discarded – undo
480 480
 							$rgb = $Common->hex2rgb($_COOKIE['IconColor']);
481 481
 							$output .= ',"color": {"rgba" : ['.$rgb[0].','.$rgb[1].','.$rgb[2].',255]}';
482 482
 						}
483
-    						$output .= '},';
483
+							$output .= '},';
484 484
 					} elseif (isset($modelsdb[$aircraft_icao]) && $aircraft_icao != '') {
485 485
 						$output .= '"model": {"gltf" : "'.$globalURL.'/models/'.$modelsdb[$aircraft_icao].'","scale" : '.$scale.',"minimumPixelSize": '.$minimumpixelsize.'';
486 486
 						$output .= ',"heightReference": "'.$heightrelative.'"';
@@ -488,7 +488,7 @@  discard block
 block discarded – undo
488 488
 							$rgb = $Common->hex2rgb($_COOKIE['IconColor']);
489 489
 							$output .= ',"color": {"rgba" : ['.$rgb[0].','.$rgb[1].','.$rgb[2].',255]}';
490 490
 						}
491
-    						$output .= '},';
491
+							$output .= '},';
492 492
 					} elseif ($aircraft_icao != '') {
493 493
 						$aircraft_info = $Spotter->getAllAircraftInfo($aircraft_icao);
494 494
 						if (isset($aircraft_info[0]['engine_type'])) {
Please login to merge, or discard this patch.
index.php 1 patch
Indentation   +104 added lines, -104 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
     <?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 } ?>
51 51
 </tr></table></div>
52 52
 <?php
53
-    if ((!isset($_COOKIE['MapFormat']) && isset($globalMap3Ddefault) && $globalMap3Ddefault) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d')) {
53
+	if ((!isset($_COOKIE['MapFormat']) && isset($globalMap3Ddefault) && $globalMap3Ddefault) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d')) {
54 54
 ?>
55 55
 <script src="<?php echo $globalURL; ?>/js/map.3d.js.php<?php if (isset($tsk)) print '?tsk='.$tsk; ?>"></script>
56 56
 <?php
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 <script src="<?php echo $globalURL; ?>/js/map-marine.3d.js.php"></script>
75 75
 <?php
76 76
 	}
77
-    }
77
+	}
78 78
 ?>
79 79
 
80 80
 <div id="sidebar" class="sidebar collapsed">
@@ -85,13 +85,13 @@  discard block
 block discarded – undo
85 85
 	<li><a href="" onclick="getUserLocation(); return false;" title="<?php echo _("Plot your Location"); ?>"><i class="fa fa-map-marker"></i></a></li>
86 86
 	<li><a href="" onclick="getCompassDirection(); return false;" title="<?php echo _("Compass Mode"); ?>"><i class="fa fa-compass"></i></a></li>
87 87
 <?php
88
-    //if ((isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') || (isset($globalBeta) && $globalBeta === TRUE)) {
88
+	//if ((isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') || (isset($globalBeta) && $globalBeta === TRUE)) {
89 89
 	if (isset($globalArchive) && $globalArchive == TRUE && (!isset($globalAircraft) || $globalAircraft === TRUE)) {
90 90
 ?>
91 91
 	<li><a href="#archive" role="tab" title="<?php echo _("Archive"); ?>"><i class="fa fa-archive"></i></a></li>
92 92
 <?php
93 93
 	}
94
-    //}
94
+	//}
95 95
 ?>
96 96
 	<li><a href="#home" role="tab" title="<?php echo _("Layers"); ?>"><i class="fa fa-map"></i></a></li>
97 97
 	<li><a href="#filters" role="tab" title="<?php echo _("Filters"); ?>"><i class="fa fa-filter"></i></a></li>
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 ?>
106 106
 
107 107
 <?php
108
-    if (isset($globalMap3D) && $globalMap3D) {
108
+	if (isset($globalMap3D) && $globalMap3D) {
109 109
 	if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) {
110 110
 ?>
111 111
 	<li><a href="" onclick="show3D(); return false;" role="tab" title="3D"><b>3D</b></a></li>
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
 	<li><a href="" onclick="show2D(); return false;" role="tab" title="2D"><b>2D</b></a></li>
116 116
 <?php
117 117
 	}
118
-    }
118
+	}
119 119
 ?>
120 120
     </ul>
121 121
 
@@ -284,15 +284,15 @@  discard block
 block discarded – undo
284 284
 		    </div>
285 285
 		</li>
286 286
 		<?php
287
-		    if (isset($globalDemo) && $globalDemo) {
287
+			if (isset($globalDemo) && $globalDemo) {
288 288
 		?>
289 289
 		<li><button type="button" class="btn btn-primary disabled"><?php echo _("Show archive"); ?></button> Disabled in Demo mode</li>
290 290
 		<?php
291
-		    } else {
291
+			} else {
292 292
 		?>
293 293
 		<li><button type="button" onclick="addarchive(begindate,enddate);" class="btn btn-primary"><?php echo _("Show archive"); ?></button></li>
294 294
 		<?php
295
-		    }
295
+			}
296 296
 		?>
297 297
 	    </ul>
298 298
 	    <ul>
@@ -311,83 +311,83 @@  discard block
 block discarded – undo
311 311
 				if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) {
312 312
 					if (!isset($_COOKIE['MapType']) || $_COOKIE['MapType'] == '') $MapType = $globalMapProvider;
313 313
 					else $MapType = $_COOKIE['MapType'];
314
-			    ?>
314
+				?>
315 315
 			<select  class="selectpicker" onchange="mapType(this);">
316 316
 			    <?php
317 317
 				} else {
318 318
 					if (!isset($_COOKIE['MapType3D']) || $_COOKIE['MapType3D'] == '') $MapType = $globalMapProvider;
319 319
 					else $MapType = $_COOKIE['MapType3D'];
320
-			    ?>
320
+				?>
321 321
 			<select  class="selectpicker" onchange="mapType3D(this);">
322 322
 			    <?php
323 323
 				}
324
-			    ?>
324
+				?>
325 325
 			    <?php
326 326
 				if (isset($globalMapOffline) && $globalMapOffline === TRUE) {
327
-			    ?>
327
+				?>
328 328
 			    <option value="offline"<?php if ($MapType == 'offline') print ' selected'; ?>>Natural Earth (local)</option>
329 329
 			    <?php
330 330
 				} else {
331
-				    if (file_exists(dirname(__FILE__).'/js/Cesium/Assets/Textures/NaturalEarthII/tilemapresource.xml')) {
332
-			    ?>
331
+					if (file_exists(dirname(__FILE__).'/js/Cesium/Assets/Textures/NaturalEarthII/tilemapresource.xml')) {
332
+				?>
333 333
 			    <option value="offline"<?php if ($MapType == 'offline') print ' selected'; ?>>Natural Earth (local)</option>
334 334
 			    <?php
335
-				    }
336
-			    ?>
335
+					}
336
+				?>
337 337
 			    <option value="ArcGIS-Streetmap"<?php if ($MapType == 'ArcGIS-Streetmap') print ' selected'; ?>>ArcGIS Streetmap</option>
338 338
 			    <option value="ArcGIS-Satellite"<?php if ($MapType == 'ArcGIS-Satellite') print ' selected'; ?>>ArcGIS Satellite</option>
339 339
 			    <option value="ArcGIS-Satellite"<?php if ($MapType == 'ArcGIS-Ocean') print ' selected'; ?>>ArcGIS Ocean</option>
340 340
 			    <?php
341
-				    if (isset($globalBingMapKey) && $globalBingMapKey != '') {
342
-			    ?>
341
+					if (isset($globalBingMapKey) && $globalBingMapKey != '') {
342
+				?>
343 343
 			    <option value="Bing-Aerial"<?php if ($MapType == 'Bing-Aerial') print ' selected'; ?>>Bing-Aerial</option>
344 344
 			    <option value="Bing-Hybrid"<?php if ($MapType == 'Bing-Hybrid') print ' selected'; ?>>Bing-Hybrid</option>
345 345
 			    <option value="Bing-Road"<?php if ($MapType == 'Bing-Road') print ' selected'; ?>>Bing-Road</option>
346 346
 			    <?php
347
-				    }
348
-			    ?>
347
+					}
348
+				?>
349 349
 			    <?php
350
-				    if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) {
351
-			    ?>
350
+					if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) {
351
+				?>
352 352
 			    <?php
353 353
 					if (isset($globalHereappId) && $globalHereappId != '' && isset($globalHereappCode) && $globalHereappCode != '') {
354
-			    ?>
354
+				?>
355 355
 			    <option value="Here-Aerial"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Aerial</option>
356 356
 			    <option value="Here-Hybrid"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Hybrid</option>
357 357
 			    <option value="Here-Road"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Road</option>
358 358
 			    <?php
359 359
 					}
360
-			    ?>
360
+				?>
361 361
 			    <?php
362 362
 					if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '') {
363
-			    ?>
363
+				?>
364 364
 			    <option value="Google-Roadmap"<?php if ($MapType == 'Google-Roadmap') print ' selected'; ?>>Google Roadmap</option>
365 365
 			    <option value="Google-Satellite"<?php if ($MapType == 'Google-Satellite') print ' selected'; ?>>Google Satellite</option>
366 366
 			    <option value="Google-Hybrid"<?php if ($MapType == 'Google-Hybrid') print ' selected'; ?>>Google Hybrid</option>
367 367
 			    <option value="Google-Terrain"<?php if ($MapType == 'Google-Terrain') print ' selected'; ?>>Google Terrain</option>
368 368
 			    <?php
369 369
 					}
370
-			    ?>
370
+				?>
371 371
 			    <?php
372 372
 					if (isset($globalMapQuestKey) && $globalMapQuestKey != '') {
373
-			    ?>
373
+				?>
374 374
 			    <option value="MapQuest-OSM"<?php if ($MapType == 'MapQuest-OSM') print ' selected'; ?>>MapQuest-OSM</option>
375 375
 			    <option value="MapQuest-Aerial"<?php if ($MapType == 'MapQuest-Aerial') print ' selected'; ?>>MapQuest-Aerial</option>
376 376
 			    <option value="MapQuest-Hybrid"<?php if ($MapType == 'MapQuest-Hybrid') print ' selected'; ?>>MapQuest-Hybrid</option>
377 377
 			    <?php
378 378
 					}
379
-			    ?>
379
+				?>
380 380
 			    <option value="Yandex"<?php if ($MapType == 'Yandex') print ' selected'; ?>>Yandex</option>
381 381
 			    <option value="offline"<?php if ($MapType == 'offline') print ' selected'; ?>>Natural Earth</option>
382 382
 			    <?php
383
-				    }
384
-			    ?>
383
+					}
384
+				?>
385 385
 			    <option value="NatGeo-Street"<?php if ($MapType == 'NatGeo-Street') print ' selected'; ?>>National Geographic Street</option>
386 386
 			    <?php
387
-				    if (isset($globalMapboxToken) && $globalMapboxToken != '') {
387
+					if (isset($globalMapboxToken) && $globalMapboxToken != '') {
388 388
 					if (!isset($_COOKIE['MapTypeId'])) $MapBoxId = 'default';
389 389
 					else $MapBoxId = $_COOKIE['MapTypeId'];
390
-			    ?>
390
+				?>
391 391
 			    <option value="MapboxGL"<?php if ($MapType == 'MapboxGL') print ' selected'; ?>>Mapbox GL</option>
392 392
 			    <option value="Mapbox-default"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'default') print ' selected'; ?>>Mapbox default</option>
393 393
 			    <option value="Mapbox-mapbox.streets"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets') print ' selected'; ?>>Mapbox streets</option>
@@ -402,16 +402,16 @@  discard block
 block discarded – undo
402 402
 			    <option value="Mapbox-mapbox.pirates"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pirates') print ' selected'; ?>>Mapbox pirates</option>
403 403
 			    <option value="Mapbox-mapbox.emerald"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.emerald') print ' selected'; ?>>Mapbox emerald</option>
404 404
 			    <?php
405
-				    }
406
-			    ?>
405
+					}
406
+				?>
407 407
 			    <option value="OpenStreetMap"<?php if ($MapType == 'OpenStreetMap') print ' selected'; ?>>OpenStreetMap</option>
408 408
 			    <?php
409 409
 				}
410
-			    ?>
410
+				?>
411 411
 			</select>
412 412
 		    </li>
413 413
 <?php
414
-    if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d' && (!isset($globalMapOffline) || $globalMapOffline === FALSE)) {
414
+	if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d' && (!isset($globalMapOffline) || $globalMapOffline === FALSE)) {
415 415
 ?>
416 416
 		    <li><?php echo _("Type of Terrain:"); ?>
417 417
 			<select  class="selectpicker" onchange="terrainType(this);">
@@ -422,18 +422,18 @@  discard block
 block discarded – undo
422 422
 			</select>
423 423
 		    </li>
424 424
 <?php
425
-    }
425
+	}
426 426
 ?>
427 427
 
428 428
 <?php
429
-    if (isset($globalMap3D) && $globalMap3D) {
429
+	if (isset($globalMap3D) && $globalMap3D) {
430 430
 ?>
431 431
 		    <li><div class="checkbox"><label><input type="checkbox" name="synchro2d3d" value="1" onclick="clickSyncMap2D3D(this)" <?php if (isset($_COOKIE['Map2D3DSync']) && $_COOKIE['Map2D3DSync'] == 'true') print 'checked'; ?> ><?php echo _("Use same type of map for 2D & 3D"); ?></label></div></li>
432 432
 <?php
433
-    }
433
+	}
434 434
 ?>
435 435
 <?php
436
-    if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') {
436
+	if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') {
437 437
 ?>
438 438
 		    <li><div class="checkbox"><label><input type="checkbox" name="display2dbuildings" value="1" onclick="clickDisplay2DBuildings(this)" <?php if (isset($_COOKIE['Map2DBuildings']) && $_COOKIE['Map2DBuildings'] == 'true') print 'checked'; ?> ><?php echo _("Display 2.5D buidings on map"); ?></label></div></li>
439 439
 
@@ -456,7 +456,7 @@  discard block
 block discarded – undo
456 456
 		    <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>
457 457
 <?php
458 458
 	}
459
-    }
459
+	}
460 460
 ?>
461 461
 		    <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>
462 462
 		    <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>
@@ -475,82 +475,82 @@  discard block
 block discarded – undo
475 475
 	}
476 476
 ?>
477 477
 <?php
478
-    if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
478
+	if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
479 479
 ?>
480 480
 		    <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>
481 481
 		    <li><div class="checkbox"><label><input type="checkbox" name="shadows" value="1" onclick="clickShadows(this)" <?php if ((!isset($_COOKIE['map3dnoshadows']) && (!isset($globalMap3DShadows) || $globalMap3DShadows)) || (isset($_COOKIE['map3dnoshadows']) && $_COOKIE['map3dnoshadows'] == 'false')) print 'checked'; ?> ><?php echo _("Use shadows"); ?></label></div></li>
482 482
 		    <li><div class="checkbox"><label><input type="checkbox" name="one3dmodel" value="1" onclick="useOne3Dmodel(this)" <?php if ((isset($_COOKIE['one3dmodel']) && $_COOKIE['one3dmodel'] == 'true') || (!isset($_COOKIE['one3dmodel']) && isset($globalMap3DOneModel) && $globalMap3DOneModel)) print 'checked'; ?> ><?php echo _("Use same 3D model for all aircraft (use fewer resources)"); ?></label></div></li>
483 483
 		    <li><div class="checkbox"><label><input type="checkbox" name="updaterealtime" value="1" onclick="clickUpdateRealtime(this)" <?php if ((isset($_COOKIE['updaterealtime']) && $_COOKIE['updaterealtime'] == 'true') || !isset($_COOKIE['updaterealtime'])) print 'checked'; ?> ><?php echo _("Display realtime data in infobox"); ?></label></div></li>
484 484
 <?php
485
-    }
486
-    if (time() > mktime(0,0,0,12,1,date("Y")) && time() < mktime(0,0,0,12,31,date("Y"))) {
485
+	}
486
+	if (time() > mktime(0,0,0,12,1,date("Y")) && time() < mktime(0,0,0,12,31,date("Y"))) {
487 487
 ?>
488 488
 		    <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>
489 489
 <?php
490
-    }
490
+	}
491 491
 ?>
492 492
 		    <?php
493 493
 			if (function_exists('array_column')) {
494
-			    if (array_search(TRUE, array_column($globalSources, 'sourcestats')) !== FALSE) {
495
-		    ?>
494
+				if (array_search(TRUE, array_column($globalSources, 'sourcestats')) !== FALSE) {
495
+			?>
496 496
 		    <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>
497 497
 		    <?php
498
-			    }
498
+				}
499 499
 			} elseif (isset($globalSources)) {
500
-			    $dispolar = false;
501
-			    foreach ($globalSources as $testsource) {
502
-			        if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) $dispolar = true;
503
-			    }
504
-			    if ($dispolar) {
505
-		    ?>
500
+				$dispolar = false;
501
+				foreach ($globalSources as $testsource) {
502
+					if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) $dispolar = true;
503
+				}
504
+				if ($dispolar) {
505
+			?>
506 506
 		    <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>
507 507
 		    <?php
508
-			    }
509
-		        }
510
-		    ?>
508
+				}
509
+				}
510
+			?>
511 511
 <?php
512
-    if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') {
512
+	if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') {
513 513
 ?>
514 514
 
515 515
 		    <?php
516 516
 			if (!isset($globalAircraft) || $globalAircraft === TRUE) {
517
-		    	    if (extension_loaded('gd') && function_exists('gd_info')) {
518
-		    ?>
517
+					if (extension_loaded('gd') && function_exists('gd_info')) {
518
+			?>
519 519
 		    <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>
520 520
 		    <?php 
521 521
 				if (!isset($_COOKIE['IconColorAltitude']) || $_COOKIE['IconColorAltitude'] == 'false') {
522
-		    ?>
522
+			?>
523 523
 			<li><?php echo _("Aircraft icon color:"); ?><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'; ?>"></li>
524 524
 		    <?php
525 525
 				}
526
-			    }
527
-		        }
528
-		    ?>
526
+				}
527
+				}
528
+			?>
529 529
 		    <?php
530 530
 			if (isset($globalMarine) && $globalMarine === TRUE) {
531
-			    if (extension_loaded('gd') && function_exists('gd_info')) {
532
-		    ?>
531
+				if (extension_loaded('gd') && function_exists('gd_info')) {
532
+			?>
533 533
 		    <li><?php echo _("Marine icon color:"); ?>
534 534
 			<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'; ?>">
535 535
 		    </li>
536 536
 		    <?php
537
-			    }
538
-		        }
539
-		    ?>
537
+				}
538
+				}
539
+			?>
540 540
 		    <?php
541 541
 			if (isset($globalTracker) && $globalTracker === TRUE) {
542
-			    if (extension_loaded('gd') && function_exists('gd_info')) {
543
-		    ?>
542
+				if (extension_loaded('gd') && function_exists('gd_info')) {
543
+			?>
544 544
 		    <li><?php echo _("Tracker icon color:"); ?>
545 545
 			<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'; ?>">
546 546
 		    </li>
547 547
 		    <?php
548
-			    }
549
-		        }
550
-		    ?>
548
+				}
549
+				}
550
+			?>
551 551
 		    <?php
552 552
 			if (!isset($globalAircraft) || $globalAircraft === TRUE) {
553
-		    ?>
553
+			?>
554 554
 		    <li><?php echo _("Show airport icon at zoom level:"); ?>
555 555
 			<div class="range">
556 556
 			    <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'; ?>">
@@ -559,9 +559,9 @@  discard block
 block discarded – undo
559 559
 		    </li>
560 560
 		    <?php
561 561
 			}
562
-		    ?>
562
+			?>
563 563
 <?php
564
-    } elseif (isset($_COOKIE['MapFormat']) || $_COOKIE['MapFOrmat'] == '3d') {
564
+	} elseif (isset($_COOKIE['MapFormat']) || $_COOKIE['MapFOrmat'] == '3d') {
565 565
 ?>
566 566
 		    <li><?php echo _("Set scaling factor for rendering resolution:"); ?>
567 567
 			<div class="range">
@@ -599,7 +599,7 @@  discard block
 block discarded – undo
599 599
 		    </li>
600 600
 <?php
601 601
 	}
602
-    }
602
+	}
603 603
 ?>
604 604
 		    <li><?php echo _("Distance unit:"); ?>
605 605
 			<select class="selectpicker" onchange="unitdistance(this);">
@@ -632,19 +632,19 @@  discard block
 block discarded – undo
632 632
 		    <ul>
633 633
 		    <?php
634 634
 			if (!isset($globalAircraft) || $globalAircraft) {
635
-		    ?>
635
+			?>
636 636
 		    <?php
637 637
 			if (((isset($globalVATSIM) && $globalVATSIM) || isset($globalIVAO) && $globalIVAO || isset($globalphpVMS) && $globalphpVMS) && (!isset($globalMapVAchoose) || $globalMapVAchoose)) {
638
-		    ?>
638
+			?>
639 639
 			<?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 } ?>
640 640
 			<?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 } ?>
641 641
 			<?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 } ?>
642 642
 		    <?php
643 643
 			}
644
-		    ?>
644
+			?>
645 645
 		    <?php
646 646
 			if (!(isset($globalVA) && $globalVA) && !(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalphpVMS) && $globalphpVMS) && isset($globalSBS1) && $globalSBS1 && isset($globalAPRS) && $globalAPRS && (!isset($globalMapchoose) || $globalMapchoose)) {
647
-		    ?>
647
+			?>
648 648
 			<?php if (isset($globalSBS1) && $globalSBS1) { ?>
649 649
 			    <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>
650 650
 			<?php } ?>
@@ -653,7 +653,7 @@  discard block
 block discarded – undo
653 653
 			<?php } ?>
654 654
 		    <?php
655 655
 			}
656
-		    ?>
656
+			?>
657 657
 		    <li><?php echo _("Display airlines:"); ?>
658 658
 		    <br/>
659 659
 			<select class="selectpicker" multiple onchange="airlines(this);" id="display_airlines">
@@ -673,14 +673,14 @@  discard block
 block discarded – undo
673 673
 						echo '<option value="'.$airline['airline_icao'].'">'.$airline_name.'</option>';
674 674
 					}
675 675
 				}
676
-			    ?>
676
+				?>
677 677
 			</select>
678 678
 		    </li>
679 679
 		    <?php
680 680
 			$Spotter = new Spotter();
681 681
 			$allalliancenames = $Spotter->getAllAllianceNames();
682 682
 			if (!empty($allalliancenames)) {
683
-		    ?>
683
+			?>
684 684
 		    <li><?php echo _("Display alliance:"); ?>
685 685
 		    <br/>
686 686
 			<select class="selectpicker" onchange="alliance(this);" id="display_alliance">
@@ -694,18 +694,18 @@  discard block
 block discarded – undo
694 694
 						echo '<option value="'.$alliance_name.'">'.$alliance_name.'</option>';
695 695
 					}
696 696
 				}
697
-			    ?>
697
+				?>
698 698
 			</select>
699 699
 		    </li>
700 700
 		    <?php
701 701
 			}
702
-		    ?>
702
+			?>
703 703
 		    <?php
704 704
 			}
705
-		    ?>
705
+			?>
706 706
 		    <?php
707 707
 			if (isset($globalAPRS) && $globalAPRS) {
708
-		    ?>
708
+			?>
709 709
 		    <li><?php echo _("Display APRS sources name:"); ?>
710 710
 			<select class="selectpicker" multiple onchange="sources(this);">
711 711
 			    <?php
@@ -729,18 +729,18 @@  discard block
 block discarded – undo
729 729
 						echo '<option value="'.$src['name'].'">'.$src['name'].'</option>';
730 730
 					}
731 731
 				}
732
-			    ?>
732
+				?>
733 733
 			</select>
734 734
 		    </li>
735 735
 		    <?php
736 736
 			}
737
-		    ?>
737
+			?>
738 738
 		    <?php
739 739
 			if (!isset($globalAircraft) || $globalAircraft) {
740
-		    ?>
740
+			?>
741 741
 		    <?php
742
-			    if (!(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalphpVMS) && $globalphpVMS)) {
743
-		    ?>
742
+				if (!(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalphpVMS) && $globalphpVMS)) {
743
+			?>
744 744
 		    <li><?php echo _("Display airlines of type:"); ?><br/>
745 745
 			<select class="selectpicker" onchange="airlinestype(this);">
746 746
 			    <option value="all"<?php if (!isset($_COOKIE['filter_airlinestype']) || $_COOKIE['filter_airlinestype'] == 'all' || $_COOKIE['filter_airlinestype'] == '') echo ' selected'; ?>><?php echo _("All"); ?></option>
@@ -750,14 +750,14 @@  discard block
 block discarded – undo
750 750
 			</select>
751 751
 		    </li>
752 752
 		    <?php
753
-			    }
754
-		    ?>
753
+				}
754
+			?>
755 755
 		    <?php
756 756
 			}
757
-		    ?>
757
+			?>
758 758
 		    <?php
759 759
 			if (isset($globalMarine) && $globalMarine) {
760
-		    ?>
760
+			?>
761 761
 		    <li>
762 762
 			<?php echo _("Display vessels with MMSI:"); ?>
763 763
 			<input type="text" name="mmsifilter" onchange="mmsifilter();" id="mmsifilter" value="<?php if (isset($_COOKIE['filter_mmsi'])) print $_COOKIE['filter_mmsi']; ?>" />
@@ -776,7 +776,7 @@  discard block
 block discarded – undo
776 776
 						foreach ($races as $race) {
777 777
 							print '<option value="'.$race['race_id'].'">'.$race['race_name'].'</option>';
778 778
 						}
779
-			    ?>
779
+				?>
780 780
 			</select>
781 781
 		    </li>
782 782
 
@@ -784,7 +784,7 @@  discard block
 block discarded – undo
784 784
 					}
785 785
 				}
786 786
 			}
787
-		    ?>
787
+			?>
788 788
 		    <li>
789 789
 			<?php echo _("Display with ident:"); ?>
790 790
 			<input type="text" name="identfilter" onchange="identfilter();" id="identfilter" value="<?php if (isset($_COOKIE['filter_ident'])) print $_COOKIE['filter_ident']; ?>" />
@@ -797,7 +797,7 @@  discard block
 block discarded – undo
797 797
 	    </form>
798 798
     	</div>
799 799
 <?php
800
-    if (isset($globalSatellite) && $globalSatellite) {
800
+	if (isset($globalSatellite) && $globalSatellite) {
801 801
 ?>
802 802
         <div class="sidebar-pane" id="satellites">
803 803
 	    <h1 class="sidebar-header"><?php echo _("Satellites"); ?><span class="sidebar-close"><i class="fa fa-caret-left"></i></span></h1>
@@ -837,14 +837,14 @@  discard block
 block discarded – undo
837 837
 						print '<option value="'.$type['tle_type'].'">'.$type_name.'</option>';
838 838
 					}
839 839
 				}
840
-			    ?>
840
+				?>
841 841
 			</select>
842 842
 		    </li>
843 843
 		</ul>
844 844
 	    </form>
845 845
 	</div>
846 846
 <?php
847
-    }
847
+	}
848 848
 ?>
849 849
     </div>
850 850
 </div>
Please login to merge, or discard this patch.
js/map-marine.2d.js.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -549,8 +549,8 @@  discard block
 block discarded – undo
549 549
 			}
550 550
                     }
551 551
 		    <?php
552
-            		} else {
553
-            	    ?>
552
+					} else {
553
+					?>
554 554
 		    if (map.getZoom() > 7) {
555 555
                 	var style = {
556 556
                     	    "color": "#529dff",
@@ -569,7 +569,7 @@  discard block
 block discarded – undo
569 569
                 	layer_marine_data.addLayer(layer);
570 570
 		    }
571 571
 <?php
572
-            		}
572
+					}
573 573
 ?>
574 574
 				}
575 575
 			    }
Please login to merge, or discard this patch.
require/class.Tracker.php 1 patch
Indentation   +210 added lines, -210 removed lines patch added patch discarded remove patch
@@ -14,10 +14,10 @@  discard block
 block discarded – undo
14 14
 	}
15 15
 
16 16
 	/**
17
-	* Get SQL query part for filter used
18
-	* @param Array $filter the filter
19
-	* @return Array the SQL part
20
-	*/
17
+	 * Get SQL query part for filter used
18
+	 * @param Array $filter the filter
19
+	 * @return Array the SQL part
20
+	 */
21 21
 	
22 22
 	public function getFilter($filter = array(),$where = false,$and = false) {
23 23
 		global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver;
@@ -84,14 +84,14 @@  discard block
 block discarded – undo
84 84
 	}
85 85
 
86 86
 	/**
87
-	* Executes the SQL statements to get the tracker information
88
-	*
89
-	* @param String $query the SQL query
90
-	* @param Array $params parameter of the query
91
-	* @param String $limitQuery the limit query
92
-	* @return Array the tracker information
93
-	*
94
-	*/
87
+	 * Executes the SQL statements to get the tracker information
88
+	 *
89
+	 * @param String $query the SQL query
90
+	 * @param Array $params parameter of the query
91
+	 * @param String $limitQuery the limit query
92
+	 * @return Array the tracker information
93
+	 *
94
+	 */
95 95
 	public function getDataFromDB($query, $params = array(), $limitQuery = '',$schedules = false)
96 96
 	{
97 97
 		date_default_timezone_set('UTC');
@@ -204,11 +204,11 @@  discard block
 block discarded – undo
204 204
 	
205 205
 	
206 206
 	/**
207
-	* Gets all the tracker information based on the latest data entry
208
-	*
209
-	* @return Array the tracker information
210
-	*
211
-	*/
207
+	 * Gets all the tracker information based on the latest data entry
208
+	 *
209
+	 * @return Array the tracker information
210
+	 *
211
+	 */
212 212
 	public function getLatestTrackerData($limit = '', $sort = '', $filter = array())
213 213
 	{
214 214
 		global $global_tracker_query;
@@ -266,11 +266,11 @@  discard block
 block discarded – undo
266 266
 	}
267 267
 
268 268
 	/**
269
-	* Gets all the tracker information based on the callsign
270
-	*
271
-	* @return Array the tracker information
272
-	*
273
-	*/
269
+	 * Gets all the tracker information based on the callsign
270
+	 *
271
+	 * @return Array the tracker information
272
+	 *
273
+	 */
274 274
 	public function getTrackerDataByIdent($ident = '', $limit = '', $sort = '', $filter = array())
275 275
 	{
276 276
 		global $global_tracker_query;
@@ -381,12 +381,12 @@  discard block
 block discarded – undo
381 381
 
382 382
 
383 383
 	/**
384
-	* Gets all source name
385
-	*
386
-	* @param String type format of source
387
-	* @return Array list of source name
388
-	*
389
-	*/
384
+	 * Gets all source name
385
+	 *
386
+	 * @param String type format of source
387
+	 * @return Array list of source name
388
+	 *
389
+	 */
390 390
 	public function getAllSourceName($type = '',$filters = array())
391 391
 	{
392 392
 		$filter_query = $this->getFilter($filters,true,true);
@@ -416,11 +416,11 @@  discard block
 block discarded – undo
416 416
 
417 417
 
418 418
 	/**
419
-	* Gets a list of all idents/callsigns
420
-	*
421
-	* @return Array list of ident/callsign names
422
-	*
423
-	*/
419
+	 * Gets a list of all idents/callsigns
420
+	 *
421
+	 * @return Array list of ident/callsign names
422
+	 *
423
+	 */
424 424
 	public function getAllIdents($filters = array())
425 425
 	{
426 426
 		$filter_query = $this->getFilter($filters,true,true);
@@ -488,18 +488,18 @@  discard block
 block discarded – undo
488 488
 	
489 489
 	
490 490
 	/**
491
-	* Update ident tracker data
492
-	*
493
-	* @param String $flightaware_id the ID from flightaware
494
-	* @param String $ident the flight ident
495
-	* @return String success or false
496
-	*
497
-	*/	
491
+	 * Update ident tracker data
492
+	 *
493
+	 * @param String $flightaware_id the ID from flightaware
494
+	 * @param String $ident the flight ident
495
+	 * @return String success or false
496
+	 *
497
+	 */	
498 498
 	public function updateIdentTrackerData($famtrackid = '', $ident = '',$fromsource = NULL)
499 499
 	{
500 500
 
501 501
 		$query = 'UPDATE tracker_output SET ident = :ident WHERE famtrackid = :famtrackid';
502
-                $query_values = array(':famtrackid' => $famtrackid,':ident' => $ident);
502
+				$query_values = array(':famtrackid' => $famtrackid,':ident' => $ident);
503 503
 
504 504
 		try {
505 505
 			$sth = $this->db->prepare($query);
@@ -512,18 +512,18 @@  discard block
 block discarded – undo
512 512
 
513 513
 	}
514 514
 	/**
515
-	* Update latest tracker data
516
-	*
517
-	* @param String $flightaware_id the ID from flightaware
518
-	* @param String $ident the flight ident
519
-	* @param String $arrival_airport_icao the arrival airport
520
-	* @return String success or false
521
-	*
522
-	*/	
515
+	 * Update latest tracker data
516
+	 *
517
+	 * @param String $flightaware_id the ID from flightaware
518
+	 * @param String $ident the flight ident
519
+	 * @param String $arrival_airport_icao the arrival airport
520
+	 * @return String success or false
521
+	 *
522
+	 */	
523 523
 	public function updateLatestTrackerData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $groundspeed = NULL, $date = '')
524 524
 	{
525 525
 		$query = 'UPDATE tracker_output SET ident = :ident, last_latitude = :last_latitude, last_longitude = :last_longitude, last_altitude = :last_altitude, last_seen = :last_seen, last_ground_speed = :last_ground_speed WHERE famtrackid = :famtrackid';
526
-                $query_values = array(':famtrackid' => $famtrackid,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_altitude' => $altitude,':last_ground_speed' => $groundspeed,':last_seen' => $date,':ident' => $ident);
526
+				$query_values = array(':famtrackid' => $famtrackid,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_altitude' => $altitude,':last_ground_speed' => $groundspeed,':last_seen' => $date,':ident' => $ident);
527 527
 
528 528
 		try {
529 529
 			$sth = $this->db->prepare($query);
@@ -537,32 +537,32 @@  discard block
 block discarded – undo
537 537
 	}
538 538
 
539 539
 	/**
540
-	* Adds a new tracker data
541
-	*
542
-	* @param String $flightaware_id the ID from flightaware
543
-	* @param String $ident the flight ident
544
-	* @param String $aircraft_icao the aircraft type
545
-	* @param String $departure_airport_icao the departure airport
546
-	* @param String $arrival_airport_icao the arrival airport
547
-	* @param String $latitude latitude of flight
548
-	* @param String $longitude latitude of flight
549
-	* @param String $waypoints waypoints of flight
550
-	* @param String $altitude altitude of flight
551
-	* @param String $heading heading of flight
552
-	* @param String $groundspeed speed of flight
553
-	* @param String $date date of flight
554
-	* @param String $departure_airport_time departure time of flight
555
-	* @param String $arrival_airport_time arrival time of flight
556
-	* @param String $squawk squawk code of flight
557
-	* @param String $route_stop route stop of flight
558
-	* @param String $highlight highlight or not
559
-	* @param String $ModeS ModesS code of flight
560
-	* @param String $registration registration code of flight
561
-	* @param String $pilot_id pilot id of flight (for virtual airlines)
562
-	* @param String $pilot_name pilot name of flight (for virtual airlines)
563
-	* @param String $verticalrate vertival rate of flight
564
-	* @return String success or false
565
-	*/
540
+	 * Adds a new tracker data
541
+	 *
542
+	 * @param String $flightaware_id the ID from flightaware
543
+	 * @param String $ident the flight ident
544
+	 * @param String $aircraft_icao the aircraft type
545
+	 * @param String $departure_airport_icao the departure airport
546
+	 * @param String $arrival_airport_icao the arrival airport
547
+	 * @param String $latitude latitude of flight
548
+	 * @param String $longitude latitude of flight
549
+	 * @param String $waypoints waypoints of flight
550
+	 * @param String $altitude altitude of flight
551
+	 * @param String $heading heading of flight
552
+	 * @param String $groundspeed speed of flight
553
+	 * @param String $date date of flight
554
+	 * @param String $departure_airport_time departure time of flight
555
+	 * @param String $arrival_airport_time arrival time of flight
556
+	 * @param String $squawk squawk code of flight
557
+	 * @param String $route_stop route stop of flight
558
+	 * @param String $highlight highlight or not
559
+	 * @param String $ModeS ModesS code of flight
560
+	 * @param String $registration registration code of flight
561
+	 * @param String $pilot_id pilot id of flight (for virtual airlines)
562
+	 * @param String $pilot_name pilot name of flight (for virtual airlines)
563
+	 * @param String $verticalrate vertival rate of flight
564
+	 * @return String success or false
565
+	 */
566 566
 	public function addTrackerData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $comment = '', $type = '',$format_source = '', $source_name = '')
567 567
 	{
568 568
 		global $globalURL;
@@ -647,16 +647,16 @@  discard block
 block discarded – undo
647 647
 		$comment = filter_var($comment,FILTER_SANITIZE_STRING);
648 648
 		$type = filter_var($type,FILTER_SANITIZE_STRING);
649 649
 	
650
-                if ($latitude == '' && $longitude == '') {
651
-            		$latitude = 0;
652
-            		$longitude = 0;
653
-            	}
654
-                if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
655
-                if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
656
-                $query  = "INSERT INTO tracker_output (famtrackid, ident, latitude, longitude, altitude, heading, ground_speed, date, format_source, source_name, comment, type) 
650
+				if ($latitude == '' && $longitude == '') {
651
+					$latitude = 0;
652
+					$longitude = 0;
653
+				}
654
+				if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
655
+				if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
656
+				$query  = "INSERT INTO tracker_output (famtrackid, ident, latitude, longitude, altitude, heading, ground_speed, date, format_source, source_name, comment, type) 
657 657
                 VALUES (:famtrackid,:ident,:latitude,:longitude,:altitude,:heading,:speed,:date,:format_source, :source_name,:comment,:type)";
658 658
 
659
-                $query_values = array(':famtrackid' => $famtrackid,':ident' => $ident,':latitude' => $latitude,':longitude' => $longitude,':altitude' => $altitude,':heading' => $heading,':speed' => $groundspeed,':date' => $date,':format_source' => $format_source, ':source_name' => $source_name,':comment' => $comment,':type' => $type);
659
+				$query_values = array(':famtrackid' => $famtrackid,':ident' => $ident,':latitude' => $latitude,':longitude' => $longitude,':altitude' => $altitude,':heading' => $heading,':speed' => $groundspeed,':date' => $date,':format_source' => $format_source, ':source_name' => $source_name,':comment' => $comment,':type' => $type);
660 660
 
661 661
 		try {
662 662
 		        
@@ -664,7 +664,7 @@  discard block
 block discarded – undo
664 664
 			$sth->execute($query_values);
665 665
 			$this->db = null;
666 666
 		} catch (PDOException $e) {
667
-		    return "error : ".$e->getMessage();
667
+			return "error : ".$e->getMessage();
668 668
 		}
669 669
 		
670 670
 		return "success";
@@ -673,11 +673,11 @@  discard block
 block discarded – undo
673 673
 	
674 674
   
675 675
 	/**
676
-	* Gets the aircraft ident within the last hour
677
-	*
678
-	* @return String the ident
679
-	*
680
-	*/
676
+	 * Gets the aircraft ident within the last hour
677
+	 *
678
+	 * @return String the ident
679
+	 *
680
+	 */
681 681
 	public function getIdentFromLastHour($ident)
682 682
 	{
683 683
 		global $globalDBdriver, $globalTimezone;
@@ -693,11 +693,11 @@  discard block
 block discarded – undo
693 693
 								AND tracker_output.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS'
694 694
 								AND tracker_output.date < now() AT TIME ZONE 'UTC'";
695 695
 			$query_data = array(':ident' => $ident);
696
-    		}
696
+			}
697 697
 		
698 698
 		$sth = $this->db->prepare($query);
699 699
 		$sth->execute($query_data);
700
-    		$ident_result='';
700
+			$ident_result='';
701 701
 		while($row = $sth->fetch(PDO::FETCH_ASSOC))
702 702
 		{
703 703
 			$ident_result = $row['ident'];
@@ -708,11 +708,11 @@  discard block
 block discarded – undo
708 708
 	
709 709
 	
710 710
 	/**
711
-	* Gets the aircraft data from the last 20 seconds
712
-	*
713
-	* @return Array the tracker data
714
-	*
715
-	*/
711
+	 * Gets the aircraft data from the last 20 seconds
712
+	 *
713
+	 * @return Array the tracker data
714
+	 *
715
+	 */
716 716
 	public function getRealTimeData($q = '')
717 717
 	{
718 718
 		global $globalDBdriver;
@@ -746,11 +746,11 @@  discard block
 block discarded – undo
746 746
 	}
747 747
 
748 748
 	/**
749
-	* Gets all number of flight over countries
750
-	*
751
-	* @return Array the airline country list
752
-	*
753
-	*/
749
+	 * Gets all number of flight over countries
750
+	 *
751
+	 * @return Array the airline country list
752
+	 *
753
+	 */
754 754
 	public function countAllTrackerOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
755 755
 	{
756 756
 		global $globalDBdriver, $globalArchive;
@@ -820,11 +820,11 @@  discard block
 block discarded – undo
820 820
 	}
821 821
 	
822 822
 	/**
823
-	* Gets all callsigns that have flown over
824
-	*
825
-	* @return Array the callsign list
826
-	*
827
-	*/
823
+	 * Gets all callsigns that have flown over
824
+	 *
825
+	 * @return Array the callsign list
826
+	 *
827
+	 */
828 828
 	public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '', $month = '', $day = '')
829 829
 	{
830 830
 		global $globalDBdriver;
@@ -891,11 +891,11 @@  discard block
 block discarded – undo
891 891
 
892 892
 
893 893
 	/**
894
-	* Counts all dates
895
-	*
896
-	* @return Array the date list
897
-	*
898
-	*/
894
+	 * Counts all dates
895
+	 *
896
+	 * @return Array the date list
897
+	 *
898
+	 */
899 899
 	public function countAllDates($filters = array())
900 900
 	{
901 901
 		global $globalTimezone, $globalDBdriver;
@@ -941,11 +941,11 @@  discard block
 block discarded – undo
941 941
 	
942 942
 	
943 943
 	/**
944
-	* Counts all dates during the last 7 days
945
-	*
946
-	* @return Array the date list
947
-	*
948
-	*/
944
+	 * Counts all dates during the last 7 days
945
+	 *
946
+	 * @return Array the date list
947
+	 *
948
+	 */
949 949
 	public function countAllDatesLast7Days($filters = array())
950 950
 	{
951 951
 		global $globalTimezone, $globalDBdriver;
@@ -967,7 +967,7 @@  discard block
 block discarded – undo
967 967
 			$query .= " GROUP BY date_name 
968 968
 								ORDER BY date_name ASC";
969 969
 			$query_data = array(':offset' => $offset);
970
-    		}
970
+			}
971 971
 		
972 972
 		$sth = $this->db->prepare($query);
973 973
 		$sth->execute($query_data);
@@ -987,11 +987,11 @@  discard block
 block discarded – undo
987 987
 	}
988 988
 
989 989
 	/**
990
-	* Counts all dates during the last month
991
-	*
992
-	* @return Array the date list
993
-	*
994
-	*/
990
+	 * Counts all dates during the last month
991
+	 *
992
+	 * @return Array the date list
993
+	 *
994
+	 */
995 995
 	public function countAllDatesLastMonth($filters = array())
996 996
 	{
997 997
 		global $globalTimezone, $globalDBdriver;
@@ -1013,7 +1013,7 @@  discard block
 block discarded – undo
1013 1013
 			$query .= " GROUP BY date_name 
1014 1014
 								ORDER BY date_name ASC";
1015 1015
 			$query_data = array(':offset' => $offset);
1016
-    		}
1016
+			}
1017 1017
 		
1018 1018
 		$sth = $this->db->prepare($query);
1019 1019
 		$sth->execute($query_data);
@@ -1035,11 +1035,11 @@  discard block
 block discarded – undo
1035 1035
 
1036 1036
 
1037 1037
 	/**
1038
-	* Counts all month
1039
-	*
1040
-	* @return Array the month list
1041
-	*
1042
-	*/
1038
+	 * Counts all month
1039
+	 *
1040
+	 * @return Array the month list
1041
+	 *
1042
+	 */
1043 1043
 	public function countAllMonths($filters = array())
1044 1044
 	{
1045 1045
 		global $globalTimezone, $globalDBdriver;
@@ -1084,11 +1084,11 @@  discard block
 block discarded – undo
1084 1084
 	
1085 1085
 
1086 1086
 	/**
1087
-	* Counts all dates during the last year
1088
-	*
1089
-	* @return Array the date list
1090
-	*
1091
-	*/
1087
+	 * Counts all dates during the last year
1088
+	 *
1089
+	 * @return Array the date list
1090
+	 *
1091
+	 */
1092 1092
 	public function countAllMonthsLastYear($filters)
1093 1093
 	{
1094 1094
 		global $globalTimezone, $globalDBdriver;
@@ -1110,7 +1110,7 @@  discard block
 block discarded – undo
1110 1110
 			$query .= " GROUP BY year_name, month_name
1111 1111
 								ORDER BY year_name, month_name ASC";
1112 1112
 			$query_data = array(':offset' => $offset);
1113
-    		}
1113
+			}
1114 1114
 		
1115 1115
 		$sth = $this->db->prepare($query);
1116 1116
 		$sth->execute($query_data);
@@ -1133,11 +1133,11 @@  discard block
 block discarded – undo
1133 1133
 	
1134 1134
 	
1135 1135
 	/**
1136
-	* Counts all hours
1137
-	*
1138
-	* @return Array the hour list
1139
-	*
1140
-	*/
1136
+	 * Counts all hours
1137
+	 *
1138
+	 * @return Array the hour list
1139
+	 *
1140
+	 */
1141 1141
 	public function countAllHours($orderby,$filters = array())
1142 1142
 	{
1143 1143
 		global $globalTimezone, $globalDBdriver;
@@ -1200,11 +1200,11 @@  discard block
 block discarded – undo
1200 1200
 	
1201 1201
 	
1202 1202
 	/**
1203
-	* Counts all hours by date
1204
-	*
1205
-	* @return Array the hour list
1206
-	*
1207
-	*/
1203
+	 * Counts all hours by date
1204
+	 *
1205
+	 * @return Array the hour list
1206
+	 *
1207
+	 */
1208 1208
 	public function countAllHoursByDate($date, $filters = array())
1209 1209
 	{
1210 1210
 		global $globalTimezone, $globalDBdriver;
@@ -1248,11 +1248,11 @@  discard block
 block discarded – undo
1248 1248
 	
1249 1249
 	
1250 1250
 	/**
1251
-	* Counts all hours by a ident/callsign
1252
-	*
1253
-	* @return Array the hour list
1254
-	*
1255
-	*/
1251
+	 * Counts all hours by a ident/callsign
1252
+	 *
1253
+	 * @return Array the hour list
1254
+	 *
1255
+	 */
1256 1256
 	public function countAllHoursByIdent($ident, $filters = array())
1257 1257
 	{
1258 1258
 		global $globalTimezone, $globalDBdriver;
@@ -1297,11 +1297,11 @@  discard block
 block discarded – undo
1297 1297
 	
1298 1298
 	
1299 1299
 	/**
1300
-	* Counts all trackers that have flown over
1301
-	*
1302
-	* @return Integer the number of trackers
1303
-	*
1304
-	*/
1300
+	 * Counts all trackers that have flown over
1301
+	 *
1302
+	 * @return Integer the number of trackers
1303
+	 *
1304
+	 */
1305 1305
 	public function countOverallTracker($filters = array(),$year = '',$month = '')
1306 1306
 	{
1307 1307
 		global $globalDBdriver;
@@ -1336,11 +1336,11 @@  discard block
 block discarded – undo
1336 1336
 	}
1337 1337
 	
1338 1338
 	/**
1339
-	* Counts all trackers type that have flown over
1340
-	*
1341
-	* @return Integer the number of flights
1342
-	*
1343
-	*/
1339
+	 * Counts all trackers type that have flown over
1340
+	 *
1341
+	 * @return Integer the number of flights
1342
+	 *
1343
+	 */
1344 1344
 	public function countOverallTrackerTypes($filters = array(),$year = '',$month = '')
1345 1345
 	{
1346 1346
 		global $globalDBdriver;
@@ -1375,11 +1375,11 @@  discard block
 block discarded – undo
1375 1375
 	
1376 1376
   
1377 1377
 	/**
1378
-	* Counts all hours of today
1379
-	*
1380
-	* @return Array the hour list
1381
-	*
1382
-	*/
1378
+	 * Counts all hours of today
1379
+	 *
1380
+	 * @return Array the hour list
1381
+	 *
1382
+	 */
1383 1383
 	public function countAllHoursFromToday($filters = array())
1384 1384
 	{
1385 1385
 		global $globalTimezone, $globalDBdriver;
@@ -1419,12 +1419,12 @@  discard block
 block discarded – undo
1419 1419
 	}
1420 1420
     
1421 1421
     
1422
-     /**
1423
-	* Gets the Barrie Spotter ID based on the FlightAware ID
1424
-	*
1425
-	* @return Integer the Barrie Spotter ID
1422
+	 /**
1423
+	  * Gets the Barrie Spotter ID based on the FlightAware ID
1424
+	  *
1425
+	  * @return Integer the Barrie Spotter ID
1426 1426
 q	*
1427
-	*/
1427
+	  */
1428 1428
 	public function getTrackerIDBasedOnFamTrackID($famtrackid)
1429 1429
 	{
1430 1430
 		$famtrackid = filter_var($famtrackid,FILTER_SANITIZE_STRING);
@@ -1445,13 +1445,13 @@  discard block
 block discarded – undo
1445 1445
   
1446 1446
  
1447 1447
 	/**
1448
-	* Parses a date string
1449
-	*
1450
-	* @param String $dateString the date string
1451
-	* @param String $timezone the timezone of a user
1452
-	* @return Array the time information
1453
-	*
1454
-	*/
1448
+	 * Parses a date string
1449
+	 *
1450
+	 * @param String $dateString the date string
1451
+	 * @param String $timezone the timezone of a user
1452
+	 * @return Array the time information
1453
+	 *
1454
+	 */
1455 1455
 	public function parseDateString($dateString, $timezone = '')
1456 1456
 	{
1457 1457
 		$time_array = array();
@@ -1484,12 +1484,12 @@  discard block
 block discarded – undo
1484 1484
 	}
1485 1485
 	
1486 1486
 	/**
1487
-	* Parses the direction degrees to working
1488
-	*
1489
-	* @param Float $direction the direction in degrees
1490
-	* @return Array the direction information
1491
-	*
1492
-	*/
1487
+	 * Parses the direction degrees to working
1488
+	 *
1489
+	 * @param Float $direction the direction in degrees
1490
+	 * @return Array the direction information
1491
+	 *
1492
+	 */
1493 1493
 	public function parseDirection($direction = 0)
1494 1494
 	{
1495 1495
 		if ($direction == '') $direction = 0;
@@ -1568,12 +1568,12 @@  discard block
 block discarded – undo
1568 1568
 	
1569 1569
 	
1570 1570
 	/**
1571
-	* Gets Country from latitude/longitude
1572
-	*
1573
-	* @param Float $latitude latitute of the flight
1574
-	* @param Float $longitude longitute of the flight
1575
-	* @return String the countrie
1576
-	*/
1571
+	 * Gets Country from latitude/longitude
1572
+	 *
1573
+	 * @param Float $latitude latitute of the flight
1574
+	 * @param Float $longitude longitute of the flight
1575
+	 * @return String the countrie
1576
+	 */
1577 1577
 	public function getCountryFromLatitudeLongitude($latitude,$longitude)
1578 1578
 	{
1579 1579
 		global $globalDBdriver, $globalDebug;
@@ -1610,11 +1610,11 @@  discard block
 block discarded – undo
1610 1610
 	}
1611 1611
 
1612 1612
 	/**
1613
-	* Gets Country from iso2
1614
-	*
1615
-	* @param String $iso2 ISO2 country code
1616
-	* @return String the countrie
1617
-	*/
1613
+	 * Gets Country from iso2
1614
+	 *
1615
+	 * @param String $iso2 ISO2 country code
1616
+	 * @return String the countrie
1617
+	 */
1618 1618
 	public function getCountryFromISO2($iso2)
1619 1619
 	{
1620 1620
 		global $globalDBdriver, $globalDebug;
@@ -1642,11 +1642,11 @@  discard block
 block discarded – undo
1642 1642
 	}
1643 1643
 
1644 1644
 	/**
1645
-	* Gets all vessels types that have flown over
1646
-	*
1647
-	* @return Array the vessel type list
1648
-	*
1649
-	*/
1645
+	 * Gets all vessels types that have flown over
1646
+	 *
1647
+	 * @return Array the vessel type list
1648
+	 *
1649
+	 */
1650 1650
 	public function countAllTrackerTypes($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '',$month = '',$day = '')
1651 1651
 	{
1652 1652
 		global $globalDBdriver;
@@ -1711,11 +1711,11 @@  discard block
 block discarded – undo
1711 1711
 	}
1712 1712
 
1713 1713
 	/**
1714
-	* Gets all the tracker information
1715
-	*
1716
-	* @return Array the tracker information
1717
-	*
1718
-	*/
1714
+	 * Gets all the tracker information
1715
+	 *
1716
+	 * @return Array the tracker information
1717
+	 *
1718
+	 */
1719 1719
 	public function searchTrackerData($q = '', $callsign = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '',$origLat = '',$origLon = '',$dist = '',$filters = array())
1720 1720
 	{
1721 1721
 		global $globalTimezone, $globalDBdriver;
@@ -1820,12 +1820,12 @@  discard block
 block discarded – undo
1820 1820
 	}
1821 1821
 
1822 1822
 	/**
1823
-	* Gets the short url from bit.ly
1824
-	*
1825
-	* @param String $url the full url
1826
-	* @return String the bit.ly url
1827
-	*
1828
-	*/
1823
+	 * Gets the short url from bit.ly
1824
+	 *
1825
+	 * @param String $url the full url
1826
+	 * @return String the bit.ly url
1827
+	 *
1828
+	 */
1829 1829
 	public function getBitlyURL($url)
1830 1830
 	{
1831 1831
 		global $globalBitlyAccessToken;
Please login to merge, or discard this patch.
table-output.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -347,7 +347,7 @@  discard block
 block discarded – undo
347 347
 				}
348 348
 			}
349 349
 		}
350
-    		if ($type == 'aircraft') {
350
+			if ($type == 'aircraft') {
351 351
 			if ((isset($globalUsePilot) && $globalUsePilot) || (!isset($globalUsePilot) && ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalVAM) && $globalVAM) || (isset($globalphpVMS) && $globalphpVMS)))) {
352 352
 				print '<th class="pilot"><span class="nomobile">'._("Pilot name").'</span><span class="mobile">'._("Pilot").'</span></a></th>';
353 353
 			}
@@ -689,7 +689,7 @@  discard block
 block discarded – undo
689 689
 	} elseif(strtolower($current_page) != "currently" && strtolower($current_page) != "upcoming" && strtolower($current_page) != "acars-latest" && strtolower($current_page) != "acars-archive" && strtolower($current_page) != "accident-latest" && strtolower($current_page) != "incident-latest" && strtolower($current_page) != "accident-detailed" && strtolower($current_page) != "incident-detailed"){
690 690
 		if ($type == 'aircraft') {
691 691
 			if (!isset($spotter_item['squawk']) || $spotter_item['squawk'] == 0) {
692
-			    $spotter_item['squawk'] = '-';
692
+				$spotter_item['squawk'] = '-';
693 693
 			}
694 694
 			if ($spotter_item['image_thumbnail'] != "")
695 695
 			{
@@ -728,7 +728,7 @@  discard block
 block discarded – undo
728 728
 				print '</td>'."\n";
729 729
 			} else {
730 730
 				print '<td class="aircraft_thumbnail">'."\n";
731
-	       //   	 	print '<a href="'.$globalURL.'/flightid/'.$spotter_item['spotter_id'].'"><img src="'.$globalURL.'/images/placeholder_thumb.png" alt="Click to see more information about this flight" title="Click to see more information about this flight" width="100px" /></a>';
731
+		   //   	 	print '<a href="'.$globalURL.'/flightid/'.$spotter_item['spotter_id'].'"><img src="'.$globalURL.'/images/placeholder_thumb.png" alt="Click to see more information about this flight" title="Click to see more information about this flight" width="100px" /></a>';
732 732
 		//}
733 733
 				if (!isset($spotter_item['airline_name']) && !isset($spotter_item['aircraft_name'])) {
734 734
 					print '<a href="'.$globalURL.'/flightid/'.$spotter_item['spotter_id'].'"><img src="'.$globalURL.'/images/placeholder_thumb.png" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' '._("Not available").' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '._("Not available").'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n";
Please login to merge, or discard this patch.
require/class.Marine.php 1 patch
Indentation   +276 added lines, -276 removed lines patch added patch discarded remove patch
@@ -12,10 +12,10 @@  discard block
 block discarded – undo
12 12
 	}
13 13
 
14 14
 	/**
15
-	* Get SQL query part for filter used
16
-	* @param Array $filter the filter
17
-	* @return Array the SQL part
18
-	*/
15
+	 * Get SQL query part for filter used
16
+	 * @param Array $filter the filter
17
+	 * @return Array the SQL part
18
+	 */
19 19
 	
20 20
 	public function getFilter($filter = array(),$where = false,$and = false) {
21 21
 		global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver;
@@ -88,14 +88,14 @@  discard block
 block discarded – undo
88 88
 	}
89 89
 
90 90
 	/**
91
-	* Executes the SQL statements to get the spotter information
92
-	*
93
-	* @param String $query the SQL query
94
-	* @param Array $params parameter of the query
95
-	* @param String $limitQuery the limit query
96
-	* @return Array the spotter information
97
-	*
98
-	*/
91
+	 * Executes the SQL statements to get the spotter information
92
+	 *
93
+	 * @param String $query the SQL query
94
+	 * @param Array $params parameter of the query
95
+	 * @param String $limitQuery the limit query
96
+	 * @return Array the spotter information
97
+	 *
98
+	 */
99 99
 	public function getDataFromDB($query, $params = array(), $limitQuery = '',$schedules = false)
100 100
 	{
101 101
 		date_default_timezone_set('UTC');
@@ -231,11 +231,11 @@  discard block
 block discarded – undo
231 231
 	
232 232
 	
233 233
 	/**
234
-	* Gets all the spotter information based on the latest data entry
235
-	*
236
-	* @return Array the spotter information
237
-	*
238
-	*/
234
+	 * Gets all the spotter information based on the latest data entry
235
+	 *
236
+	 * @return Array the spotter information
237
+	 *
238
+	 */
239 239
 	public function getLatestMarineData($limit = '', $sort = '', $filter = array())
240 240
 	{
241 241
 		global $global_marine_query;
@@ -284,11 +284,11 @@  discard block
 block discarded – undo
284 284
 	}
285 285
 
286 286
 	/**
287
-	* Gets all the spotter information based on the callsign
288
-	*
289
-	* @return Array the spotter information
290
-	*
291
-	*/
287
+	 * Gets all the spotter information based on the callsign
288
+	 *
289
+	 * @return Array the spotter information
290
+	 *
291
+	 */
292 292
 	public function getMarineDataByIdent($ident = '', $limit = '', $sort = '', $filter = array())
293 293
 	{
294 294
 		global $global_marine_query;
@@ -340,11 +340,11 @@  discard block
 block discarded – undo
340 340
 	}
341 341
 
342 342
 	/**
343
-	* Gets all the marine information based on the type
344
-	*
345
-	* @return Array the marine information
346
-	*
347
-	*/
343
+	 * Gets all the marine information based on the type
344
+	 *
345
+	 * @return Array the marine information
346
+	 *
347
+	 */
348 348
 	public function getMarineDataByType($type = '', $limit = '', $sort = '', $filter = array())
349 349
 	{
350 350
 		global $global_marine_query;
@@ -450,11 +450,11 @@  discard block
 block discarded – undo
450 450
 	}
451 451
 
452 452
 	/**
453
-	* Gets all the marine information based on the captain
454
-	*
455
-	* @return Array the marine information
456
-	*
457
-	*/
453
+	 * Gets all the marine information based on the captain
454
+	 *
455
+	 * @return Array the marine information
456
+	 *
457
+	 */
458 458
 	public function getMarineDataByCaptain($captain = '', $limit = '', $sort = '', $filter = array())
459 459
 	{
460 460
 		global $global_marine_query;
@@ -493,11 +493,11 @@  discard block
 block discarded – undo
493 493
 	}
494 494
 
495 495
 	/**
496
-	* Gets all the marine information based on the race
497
-	*
498
-	* @return Array the marine information
499
-	*
500
-	*/
496
+	 * Gets all the marine information based on the race
497
+	 *
498
+	 * @return Array the marine information
499
+	 *
500
+	 */
501 501
 	public function getMarineDataByRace($race = '', $limit = '', $sort = '', $filter = array())
502 502
 	{
503 503
 		global $global_marine_query;
@@ -536,11 +536,11 @@  discard block
 block discarded – undo
536 536
 	}
537 537
 
538 538
 	/**
539
-	* Count races by captain
540
-	*
541
-	* @return String Duration of all races
542
-	*
543
-	*/
539
+	 * Count races by captain
540
+	 *
541
+	 * @return String Duration of all races
542
+	 *
543
+	 */
544 544
 	public function countRacesByCaptain($captain,$filters = array())
545 545
 	{
546 546
 		$captain = filter_var($captain,FILTER_SANITIZE_STRING);
@@ -556,11 +556,11 @@  discard block
 block discarded – undo
556 556
 	}
557 557
 
558 558
 	/**
559
-	* Count captains by race
560
-	*
561
-	* @return String Duration of all races
562
-	*
563
-	*/
559
+	 * Count captains by race
560
+	 *
561
+	 * @return String Duration of all races
562
+	 *
563
+	 */
564 564
 	public function countCaptainsByRace($race,$filters = array())
565 565
 	{
566 566
 		$race = filter_var($race,FILTER_SANITIZE_STRING);
@@ -576,11 +576,11 @@  discard block
 block discarded – undo
576 576
 	}
577 577
 
578 578
 	/**
579
-	* Gets all boat types that have been used by a captain
580
-	*
581
-	* @return Array the boat list
582
-	*
583
-	*/
579
+	 * Gets all boat types that have been used by a captain
580
+	 *
581
+	 * @return Array the boat list
582
+	 *
583
+	 */
584 584
 	public function countAllBoatTypesByCaptain($captain,$filters = array(),$year = '',$month = '',$day = '')
585 585
 	{
586 586
 		global $globalDBdriver;
@@ -625,11 +625,11 @@  discard block
 block discarded – undo
625 625
 	}
626 626
 
627 627
 	/**
628
-	* Gets all boat types that have been used on a race
629
-	*
630
-	* @return Array the boat list
631
-	*
632
-	*/
628
+	 * Gets all boat types that have been used on a race
629
+	 *
630
+	 * @return Array the boat list
631
+	 *
632
+	 */
633 633
 	public function countAllBoatTypesByRace($race,$filters = array(),$year = '',$month = '',$day = '')
634 634
 	{
635 635
 		global $globalDBdriver;
@@ -674,11 +674,11 @@  discard block
 block discarded – undo
674 674
 	}
675 675
 
676 676
 	/**
677
-	* Gets race duration by captain
678
-	*
679
-	* @return String Duration of all race
680
-	*
681
-	*/
677
+	 * Gets race duration by captain
678
+	 *
679
+	 * @return String Duration of all race
680
+	 *
681
+	 */
682 682
 	public function getRaceDurationByCaptain($captain,$filters = array(),$year = '',$month = '',$day = '')
683 683
 	{
684 684
 		global $globalDBdriver;
@@ -724,11 +724,11 @@  discard block
 block discarded – undo
724 724
 	}
725 725
 
726 726
 	/**
727
-	* Gets a list of all captain names and captain ids
728
-	*
729
-	* @return Array list of captain names and captain ids
730
-	*
731
-	*/
727
+	 * Gets a list of all captain names and captain ids
728
+	 *
729
+	 * @return Array list of captain names and captain ids
730
+	 *
731
+	 */
732 732
 	public function getAllCaptainNames($filters = array())
733 733
 	{
734 734
 		$filter_query = $this->getFilter($filters,true,true);
@@ -742,11 +742,11 @@  discard block
 block discarded – undo
742 742
 	} 
743 743
 
744 744
 	/**
745
-	* Gets a list of all race names and race ids
746
-	*
747
-	* @return Array list of race names and race ids
748
-	*
749
-	*/
745
+	 * Gets a list of all race names and race ids
746
+	 *
747
+	 * @return Array list of race names and race ids
748
+	 *
749
+	 */
750 750
 	public function getAllRaceNames($filters = array())
751 751
 	{
752 752
 		$filter_query = $this->getFilter($filters,true,true);
@@ -760,12 +760,12 @@  discard block
 block discarded – undo
760 760
 	} 
761 761
 
762 762
 	/**
763
-	* Gets all source name
764
-	*
765
-	* @param String type format of source
766
-	* @return Array list of source name
767
-	*
768
-	*/
763
+	 * Gets all source name
764
+	 *
765
+	 * @param String type format of source
766
+	 * @return Array list of source name
767
+	 *
768
+	 */
769 769
 	public function getAllSourceName($type = '',$filters = array())
770 770
 	{
771 771
 		$filter_query = $this->getFilter($filters,true,true);
@@ -795,11 +795,11 @@  discard block
 block discarded – undo
795 795
 
796 796
 
797 797
 	/**
798
-	* Gets a list of all idents/callsigns
799
-	*
800
-	* @return Array list of ident/callsign names
801
-	*
802
-	*/
798
+	 * Gets a list of all idents/callsigns
799
+	 *
800
+	 * @return Array list of ident/callsign names
801
+	 *
802
+	 */
803 803
 	public function getAllIdents($filters = array())
804 804
 	{
805 805
 		$filter_query = $this->getFilter($filters,true,true);
@@ -823,11 +823,11 @@  discard block
 block discarded – undo
823 823
 	}
824 824
 
825 825
 	/**
826
-	* Gets all info from a mmsi
827
-	*
828
-	* @return Array ident
829
-	*
830
-	*/
826
+	 * Gets all info from a mmsi
827
+	 *
828
+	 * @return Array ident
829
+	 *
830
+	 */
831 831
 	public function getIdentity($mmsi)
832 832
 	{
833 833
 		$mmsi = filter_var($mmsi,FILTER_SANITIZE_NUMBER_INT);
@@ -840,9 +840,9 @@  discard block
 block discarded – undo
840 840
 	}
841 841
 
842 842
 	/**
843
-	* Add identity
844
-	*
845
-	*/
843
+	 * Add identity
844
+	 *
845
+	 */
846 846
 	public function addIdentity($mmsi,$imo,$ident,$callsign,$type)
847 847
 	{
848 848
 		$mmsi = filter_var($mmsi,FILTER_SANITIZE_NUMBER_INT);
@@ -908,13 +908,13 @@  discard block
 block discarded – undo
908 908
 	}
909 909
 
910 910
 	/**
911
-	* Update ident tracker data
912
-	*
913
-	* @param String $fammarine_id the ID
914
-	* @param String $ident the marine ident
915
-	* @return String success or false
916
-	*
917
-	*/
911
+	 * Update ident tracker data
912
+	 *
913
+	 * @param String $fammarine_id the ID
914
+	 * @param String $ident the marine ident
915
+	 * @return String success or false
916
+	 *
917
+	 */
918 918
 	public function updateIdentMarineData($fammarine_id = '', $ident = '',$fromsource = NULL)
919 919
 	{
920 920
 		$query = 'UPDATE marine_output SET ident = :ident WHERE fammarine_id = :fammarine_id';
@@ -929,13 +929,13 @@  discard block
 block discarded – undo
929 929
 	}
930 930
 
931 931
 	/**
932
-	* Update arrival marine data
933
-	*
934
-	* @param String $fammarine_id the ID
935
-	* @param String $arrival_code the marine ident
936
-	* @return String success or false
937
-	*
938
-	*/
932
+	 * Update arrival marine data
933
+	 *
934
+	 * @param String $fammarine_id the ID
935
+	 * @param String $arrival_code the marine ident
936
+	 * @return String success or false
937
+	 *
938
+	 */
939 939
 	public function updateArrivalPortNameMarineData($fammarine_id = '', $arrival_code = '',$fromsource = NULL)
940 940
 	{
941 941
 		$query = 'UPDATE marine_output SET arrival_port_name = :arrival_code WHERE fammarine_id = :fammarine_id';
@@ -950,19 +950,19 @@  discard block
 block discarded – undo
950 950
 	}
951 951
 
952 952
 	/**
953
-	* Update Status data
954
-	*
955
-	* @param String $fammarine_id the ID
956
-	* @param String $status_id the marine status id
957
-	* @param String $status the marine status
958
-	* @return String success or false
959
-	*
960
-	*/
953
+	 * Update Status data
954
+	 *
955
+	 * @param String $fammarine_id the ID
956
+	 * @param String $status_id the marine status id
957
+	 * @param String $status the marine status
958
+	 * @return String success or false
959
+	 *
960
+	 */
961 961
 	public function updateStatusMarineData($fammarine_id = '', $status_id = '',$status = '')
962 962
 	{
963 963
 
964 964
 		$query = 'UPDATE marine_output SET status = :status, status_id = :status_id WHERE fammarine_id = :fammarine_id';
965
-                $query_values = array(':fammarine_id' => $fammarine_id,':status' => $status,':status_id' => $status_id);
965
+				$query_values = array(':fammarine_id' => $fammarine_id,':status' => $status,':status_id' => $status_id);
966 966
 
967 967
 		try {
968 968
 			$sth = $this->db->prepare($query);
@@ -975,17 +975,17 @@  discard block
 block discarded – undo
975 975
 
976 976
 	}
977 977
 	/**
978
-	* Update latest marine data
979
-	*
980
-	* @param String $fammarine_id the ID
981
-	* @param String $ident the marine ident
982
-	* @return String success or false
983
-	*
984
-	*/	
978
+	 * Update latest marine data
979
+	 *
980
+	 * @param String $fammarine_id the ID
981
+	 * @param String $ident the marine ident
982
+	 * @return String success or false
983
+	 *
984
+	 */	
985 985
 	public function updateLatestMarineData($fammarine_id = '', $ident = '', $latitude = '', $longitude = '', $groundspeed = NULL, $date = '',$distance = NULL,$race_rank = NULL, $race_time = NULL)
986 986
 	{
987 987
 		$query = 'UPDATE marine_output SET ident = :ident, last_latitude = :last_latitude, last_longitude = :last_longitude, last_seen = :last_seen, last_ground_speed = :last_ground_speed, distance = :distance, race_rank = :race_rank, race_time = :race_time WHERE fammarine_id = :fammarine_id';
988
-                $query_values = array(':fammarine_id' => $fammarine_id,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_ground_speed' => $groundspeed,':last_seen' => $date,':ident' => $ident,':distance' => $distance,':race_rank' => $race_rank,':race_time' => $race_time);
988
+				$query_values = array(':fammarine_id' => $fammarine_id,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_ground_speed' => $groundspeed,':last_seen' => $date,':ident' => $ident,':distance' => $distance,':race_rank' => $race_rank,':race_time' => $race_time);
989 989
 
990 990
 		try {
991 991
 			$sth = $this->db->prepare($query);
@@ -999,30 +999,30 @@  discard block
 block discarded – undo
999 999
 	}
1000 1000
 
1001 1001
 	/**
1002
-	* Adds a new marine data
1003
-	*
1004
-	* @param String $fammarine_id the ID
1005
-	* @param String $ident the marine ident
1006
-	* @param String $departure_airport_icao the departure airport
1007
-	* @param String $arrival_airport_icao the arrival airport
1008
-	* @param String $latitude latitude of flight
1009
-	* @param String $longitude latitude of flight
1010
-	* @param String $waypoints waypoints of flight
1011
-	* @param String $heading heading of flight
1012
-	* @param String $groundspeed speed of flight
1013
-	* @param String $date date of flight
1014
-	* @param String $departure_airport_time departure time of flight
1015
-	* @param String $arrival_airport_time arrival time of flight
1016
-	* @param String $squawk squawk code of flight
1017
-	* @param String $route_stop route stop of flight
1018
-	* @param String $highlight highlight or not
1019
-	* @param String $ModeS ModesS code of flight
1020
-	* @param String $registration registration code of flight
1021
-	* @param String $pilot_id pilot id of flight (for virtual airlines)
1022
-	* @param String $pilot_name pilot name of flight (for virtual airlines)
1023
-	* @param String $verticalrate vertival rate of flight
1024
-	* @return String success or false
1025
-	*/
1002
+	 * Adds a new marine data
1003
+	 *
1004
+	 * @param String $fammarine_id the ID
1005
+	 * @param String $ident the marine ident
1006
+	 * @param String $departure_airport_icao the departure airport
1007
+	 * @param String $arrival_airport_icao the arrival airport
1008
+	 * @param String $latitude latitude of flight
1009
+	 * @param String $longitude latitude of flight
1010
+	 * @param String $waypoints waypoints of flight
1011
+	 * @param String $heading heading of flight
1012
+	 * @param String $groundspeed speed of flight
1013
+	 * @param String $date date of flight
1014
+	 * @param String $departure_airport_time departure time of flight
1015
+	 * @param String $arrival_airport_time arrival time of flight
1016
+	 * @param String $squawk squawk code of flight
1017
+	 * @param String $route_stop route stop of flight
1018
+	 * @param String $highlight highlight or not
1019
+	 * @param String $ModeS ModesS code of flight
1020
+	 * @param String $registration registration code of flight
1021
+	 * @param String $pilot_id pilot id of flight (for virtual airlines)
1022
+	 * @param String $pilot_name pilot name of flight (for virtual airlines)
1023
+	 * @param String $verticalrate vertival rate of flight
1024
+	 * @return String success or false
1025
+	 */
1026 1026
 	public function addMarineData($fammarine_id = '', $ident = '', $latitude = '', $longitude = '', $heading = '', $groundspeed = '', $date = '', $mmsi = '',$type = '',$typeid = '',$imo = '',$callsign = '',$arrival_code = '',$arrival_date = '',$status = '',$statusid = '',$format_source = '', $source_name = '', $captain_id = '',$captain_name = '',$race_id = '', $race_name = '', $distance = '',$race_rank = '', $race_time = '')
1027 1027
 	{
1028 1028
 		global $globalURL, $globalMarineImageFetch;
@@ -1155,11 +1155,11 @@  discard block
 block discarded – undo
1155 1155
 	
1156 1156
   
1157 1157
 	/**
1158
-	* Gets the aircraft ident within the last hour
1159
-	*
1160
-	* @return String the ident
1161
-	*
1162
-	*/
1158
+	 * Gets the aircraft ident within the last hour
1159
+	 *
1160
+	 * @return String the ident
1161
+	 *
1162
+	 */
1163 1163
 	public function getIdentFromLastHour($ident)
1164 1164
 	{
1165 1165
 		global $globalDBdriver, $globalTimezone;
@@ -1175,11 +1175,11 @@  discard block
 block discarded – undo
1175 1175
 								AND marine_output.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS'
1176 1176
 								AND marine_output.date < now() AT TIME ZONE 'UTC'";
1177 1177
 			$query_data = array(':ident' => $ident);
1178
-    		}
1178
+			}
1179 1179
 		
1180 1180
 		$sth = $this->db->prepare($query);
1181 1181
 		$sth->execute($query_data);
1182
-    		$ident_result='';
1182
+			$ident_result='';
1183 1183
 		while($row = $sth->fetch(PDO::FETCH_ASSOC))
1184 1184
 		{
1185 1185
 			$ident_result = $row['ident'];
@@ -1190,11 +1190,11 @@  discard block
 block discarded – undo
1190 1190
 	
1191 1191
 	
1192 1192
 	/**
1193
-	* Gets the aircraft data from the last 20 seconds
1194
-	*
1195
-	* @return Array the marine data
1196
-	*
1197
-	*/
1193
+	 * Gets the aircraft data from the last 20 seconds
1194
+	 *
1195
+	 * @return Array the marine data
1196
+	 *
1197
+	 */
1198 1198
 	public function getRealTimeData($q = '')
1199 1199
 	{
1200 1200
 		global $globalDBdriver;
@@ -1232,11 +1232,11 @@  discard block
 block discarded – undo
1232 1232
 	
1233 1233
 
1234 1234
 	/**
1235
-	* Gets all number of flight over countries
1236
-	*
1237
-	* @return Array the airline country list
1238
-	*
1239
-	*/
1235
+	 * Gets all number of flight over countries
1236
+	 *
1237
+	 * @return Array the airline country list
1238
+	 *
1239
+	 */
1240 1240
 
1241 1241
 	public function countAllMarineOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
1242 1242
 	{
@@ -1309,11 +1309,11 @@  discard block
 block discarded – undo
1309 1309
 	
1310 1310
 	
1311 1311
 	/**
1312
-	* Gets all callsigns that have flown over
1313
-	*
1314
-	* @return Array the callsign list
1315
-	*
1316
-	*/
1312
+	 * Gets all callsigns that have flown over
1313
+	 *
1314
+	 * @return Array the callsign list
1315
+	 *
1316
+	 */
1317 1317
 	public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '', $month = '', $day = '')
1318 1318
 	{
1319 1319
 		global $globalDBdriver;
@@ -1380,11 +1380,11 @@  discard block
 block discarded – undo
1380 1380
 
1381 1381
 
1382 1382
 	/**
1383
-	* Counts all dates
1384
-	*
1385
-	* @return Array the date list
1386
-	*
1387
-	*/
1383
+	 * Counts all dates
1384
+	 *
1385
+	 * @return Array the date list
1386
+	 *
1387
+	 */
1388 1388
 	public function countAllDates($filters = array())
1389 1389
 	{
1390 1390
 		global $globalTimezone, $globalDBdriver;
@@ -1430,11 +1430,11 @@  discard block
 block discarded – undo
1430 1430
 	
1431 1431
 	
1432 1432
 	/**
1433
-	* Counts all dates during the last 7 days
1434
-	*
1435
-	* @return Array the date list
1436
-	*
1437
-	*/
1433
+	 * Counts all dates during the last 7 days
1434
+	 *
1435
+	 * @return Array the date list
1436
+	 *
1437
+	 */
1438 1438
 	public function countAllDatesLast7Days($filters = array())
1439 1439
 	{
1440 1440
 		global $globalTimezone, $globalDBdriver;
@@ -1456,7 +1456,7 @@  discard block
 block discarded – undo
1456 1456
 			$query .= " GROUP BY date_name 
1457 1457
 								ORDER BY date_name ASC";
1458 1458
 			$query_data = array(':offset' => $offset);
1459
-    		}
1459
+			}
1460 1460
 		
1461 1461
 		$sth = $this->db->prepare($query);
1462 1462
 		$sth->execute($query_data);
@@ -1476,11 +1476,11 @@  discard block
 block discarded – undo
1476 1476
 	}
1477 1477
 
1478 1478
 	/**
1479
-	* Counts all dates during the last month
1480
-	*
1481
-	* @return Array the date list
1482
-	*
1483
-	*/
1479
+	 * Counts all dates during the last month
1480
+	 *
1481
+	 * @return Array the date list
1482
+	 *
1483
+	 */
1484 1484
 	public function countAllDatesLastMonth($filters = array())
1485 1485
 	{
1486 1486
 		global $globalTimezone, $globalDBdriver;
@@ -1502,7 +1502,7 @@  discard block
 block discarded – undo
1502 1502
 			$query .= " GROUP BY date_name 
1503 1503
 								ORDER BY date_name ASC";
1504 1504
 			$query_data = array(':offset' => $offset);
1505
-    		}
1505
+			}
1506 1506
 		
1507 1507
 		$sth = $this->db->prepare($query);
1508 1508
 		$sth->execute($query_data);
@@ -1524,11 +1524,11 @@  discard block
 block discarded – undo
1524 1524
 
1525 1525
 
1526 1526
 	/**
1527
-	* Counts all month
1528
-	*
1529
-	* @return Array the month list
1530
-	*
1531
-	*/
1527
+	 * Counts all month
1528
+	 *
1529
+	 * @return Array the month list
1530
+	 *
1531
+	 */
1532 1532
 	public function countAllMonths($filters = array())
1533 1533
 	{
1534 1534
 		global $globalTimezone, $globalDBdriver;
@@ -1573,11 +1573,11 @@  discard block
 block discarded – undo
1573 1573
 	
1574 1574
 
1575 1575
 	/**
1576
-	* Counts all dates during the last year
1577
-	*
1578
-	* @return Array the date list
1579
-	*
1580
-	*/
1576
+	 * Counts all dates during the last year
1577
+	 *
1578
+	 * @return Array the date list
1579
+	 *
1580
+	 */
1581 1581
 	public function countAllMonthsLastYear($filters)
1582 1582
 	{
1583 1583
 		global $globalTimezone, $globalDBdriver;
@@ -1599,7 +1599,7 @@  discard block
 block discarded – undo
1599 1599
 			$query .= " GROUP BY year_name, month_name
1600 1600
 								ORDER BY year_name, month_name ASC";
1601 1601
 			$query_data = array(':offset' => $offset);
1602
-    		}
1602
+			}
1603 1603
 		
1604 1604
 		$sth = $this->db->prepare($query);
1605 1605
 		$sth->execute($query_data);
@@ -1622,11 +1622,11 @@  discard block
 block discarded – undo
1622 1622
 	
1623 1623
 	
1624 1624
 	/**
1625
-	* Counts all hours
1626
-	*
1627
-	* @return Array the hour list
1628
-	*
1629
-	*/
1625
+	 * Counts all hours
1626
+	 *
1627
+	 * @return Array the hour list
1628
+	 *
1629
+	 */
1630 1630
 	public function countAllHours($orderby,$filters = array())
1631 1631
 	{
1632 1632
 		global $globalTimezone, $globalDBdriver;
@@ -1689,11 +1689,11 @@  discard block
 block discarded – undo
1689 1689
 	
1690 1690
 	
1691 1691
 	/**
1692
-	* Counts all hours by date
1693
-	*
1694
-	* @return Array the hour list
1695
-	*
1696
-	*/
1692
+	 * Counts all hours by date
1693
+	 *
1694
+	 * @return Array the hour list
1695
+	 *
1696
+	 */
1697 1697
 	public function countAllHoursByDate($date, $filters = array())
1698 1698
 	{
1699 1699
 		global $globalTimezone, $globalDBdriver;
@@ -1737,11 +1737,11 @@  discard block
 block discarded – undo
1737 1737
 	
1738 1738
 	
1739 1739
 	/**
1740
-	* Counts all hours by a ident/callsign
1741
-	*
1742
-	* @return Array the hour list
1743
-	*
1744
-	*/
1740
+	 * Counts all hours by a ident/callsign
1741
+	 *
1742
+	 * @return Array the hour list
1743
+	 *
1744
+	 */
1745 1745
 	public function countAllHoursByIdent($ident, $filters = array())
1746 1746
 	{
1747 1747
 		global $globalTimezone, $globalDBdriver;
@@ -1786,11 +1786,11 @@  discard block
 block discarded – undo
1786 1786
 	
1787 1787
 	
1788 1788
 	/**
1789
-	* Counts all vessels
1790
-	*
1791
-	* @return Integer the number of vessels
1792
-	*
1793
-	*/
1789
+	 * Counts all vessels
1790
+	 *
1791
+	 * @return Integer the number of vessels
1792
+	 *
1793
+	 */
1794 1794
 	public function countOverallMarine($filters = array(),$year = '',$month = '')
1795 1795
 	{
1796 1796
 		global $globalDBdriver;
@@ -1825,11 +1825,11 @@  discard block
 block discarded – undo
1825 1825
 	}
1826 1826
 	
1827 1827
 	/**
1828
-	* Counts all vessel type
1829
-	*
1830
-	* @return Integer the number of vessels
1831
-	*
1832
-	*/
1828
+	 * Counts all vessel type
1829
+	 *
1830
+	 * @return Integer the number of vessels
1831
+	 *
1832
+	 */
1833 1833
 	public function countOverallMarineTypes($filters = array(),$year = '',$month = '')
1834 1834
 	{
1835 1835
 		global $globalDBdriver;
@@ -1864,11 +1864,11 @@  discard block
 block discarded – undo
1864 1864
 	
1865 1865
   
1866 1866
 	/**
1867
-	* Counts all hours of today
1868
-	*
1869
-	* @return Array the hour list
1870
-	*
1871
-	*/
1867
+	 * Counts all hours of today
1868
+	 *
1869
+	 * @return Array the hour list
1870
+	 *
1871
+	 */
1872 1872
 	public function countAllHoursFromToday($filters = array())
1873 1873
 	{
1874 1874
 		global $globalTimezone, $globalDBdriver;
@@ -1908,12 +1908,12 @@  discard block
 block discarded – undo
1908 1908
 	}
1909 1909
     
1910 1910
     
1911
-     /**
1912
-	* Gets the Barrie Spotter ID based on the FlightAware ID
1913
-	*
1914
-	* @return Integer the Barrie Spotter ID
1911
+	 /**
1912
+	  * Gets the Barrie Spotter ID based on the FlightAware ID
1913
+	  *
1914
+	  * @return Integer the Barrie Spotter ID
1915 1915
 q	*
1916
-	*/
1916
+	  */
1917 1917
 	public function getMarineIDBasedOnFamMarineID($fammarine_id)
1918 1918
 	{
1919 1919
 		$fammarine_id = filter_var($fammarine_id,FILTER_SANITIZE_STRING);
@@ -1934,13 +1934,13 @@  discard block
 block discarded – undo
1934 1934
   
1935 1935
  
1936 1936
 	/**
1937
-	* Parses a date string
1938
-	*
1939
-	* @param String $dateString the date string
1940
-	* @param String $timezone the timezone of a user
1941
-	* @return Array the time information
1942
-	*
1943
-	*/
1937
+	 * Parses a date string
1938
+	 *
1939
+	 * @param String $dateString the date string
1940
+	 * @param String $timezone the timezone of a user
1941
+	 * @return Array the time information
1942
+	 *
1943
+	 */
1944 1944
 	public function parseDateString($dateString, $timezone = '')
1945 1945
 	{
1946 1946
 		$time_array = array();
@@ -1973,12 +1973,12 @@  discard block
 block discarded – undo
1973 1973
 	}
1974 1974
 	
1975 1975
 	/**
1976
-	* Parses the direction degrees to working
1977
-	*
1978
-	* @param Float $direction the direction in degrees
1979
-	* @return Array the direction information
1980
-	*
1981
-	*/
1976
+	 * Parses the direction degrees to working
1977
+	 *
1978
+	 * @param Float $direction the direction in degrees
1979
+	 * @return Array the direction information
1980
+	 *
1981
+	 */
1982 1982
 	public function parseDirection($direction = 0)
1983 1983
 	{
1984 1984
 		if ($direction == '') $direction = 0;
@@ -2057,12 +2057,12 @@  discard block
 block discarded – undo
2057 2057
 	
2058 2058
 	
2059 2059
 	/**
2060
-	* Gets Country from latitude/longitude
2061
-	*
2062
-	* @param Float $latitude latitute of the flight
2063
-	* @param Float $longitude longitute of the flight
2064
-	* @return String the countrie
2065
-	*/
2060
+	 * Gets Country from latitude/longitude
2061
+	 *
2062
+	 * @param Float $latitude latitute of the flight
2063
+	 * @param Float $longitude longitute of the flight
2064
+	 * @return String the countrie
2065
+	 */
2066 2066
 	public function getCountryFromLatitudeLongitude($latitude,$longitude)
2067 2067
 	{
2068 2068
 		global $globalDBdriver, $globalDebug;
@@ -2099,11 +2099,11 @@  discard block
 block discarded – undo
2099 2099
 	}
2100 2100
 
2101 2101
 	/**
2102
-	* Gets Country from iso2
2103
-	*
2104
-	* @param String $iso2 ISO2 country code
2105
-	* @return String the countrie
2106
-	*/
2102
+	 * Gets Country from iso2
2103
+	 *
2104
+	 * @param String $iso2 ISO2 country code
2105
+	 * @return String the countrie
2106
+	 */
2107 2107
 	public function getCountryFromISO2($iso2)
2108 2108
 	{
2109 2109
 		global $globalDBdriver, $globalDebug;
@@ -2132,12 +2132,12 @@  discard block
 block discarded – undo
2132 2132
 
2133 2133
 	
2134 2134
 	/**
2135
-	* Gets the short url from bit.ly
2136
-	*
2137
-	* @param String $url the full url
2138
-	* @return String the bit.ly url
2139
-	*
2140
-	*/
2135
+	 * Gets the short url from bit.ly
2136
+	 *
2137
+	 * @param String $url the full url
2138
+	 * @return String the bit.ly url
2139
+	 *
2140
+	 */
2141 2141
 	public function getBitlyURL($url)
2142 2142
 	{
2143 2143
 		global $globalBitlyAccessToken;
@@ -2164,11 +2164,11 @@  discard block
 block discarded – undo
2164 2164
 
2165 2165
 	
2166 2166
 	/**
2167
-	* Gets all vessels types that have flown over
2168
-	*
2169
-	* @return Array the vessel type list
2170
-	*
2171
-	*/
2167
+	 * Gets all vessels types that have flown over
2168
+	 *
2169
+	 * @return Array the vessel type list
2170
+	 *
2171
+	 */
2172 2172
 	public function countAllMarineTypes($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '',$month = '',$day = '')
2173 2173
 	{
2174 2174
 		global $globalDBdriver;
@@ -2234,11 +2234,11 @@  discard block
 block discarded – undo
2234 2234
 	}
2235 2235
 
2236 2236
 	/**
2237
-	* Gets all the tracker information
2238
-	*
2239
-	* @return Array the tracker information
2240
-	*
2241
-	*/
2237
+	 * Gets all the tracker information
2238
+	 *
2239
+	 * @return Array the tracker information
2240
+	 *
2241
+	 */
2242 2242
 	public function searchMarineData($q = '', $callsign = '',$mmsi = '', $imo = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '',$origLat = '',$origLon = '',$dist = '',$filters = array())
2243 2243
 	{
2244 2244
 		global $globalTimezone, $globalDBdriver;
@@ -2367,11 +2367,11 @@  discard block
 block discarded – undo
2367 2367
 	}
2368 2368
 
2369 2369
 	/**
2370
-	* Check marine by id
2371
-	*
2372
-	* @return String the ident
2373
-	*
2374
-	*/
2370
+	 * Check marine by id
2371
+	 *
2372
+	 * @return String the ident
2373
+	 *
2374
+	 */
2375 2375
 	public function checkId($id)
2376 2376
 	{
2377 2377
 		global $globalDBdriver, $globalTimezone;
Please login to merge, or discard this patch.