Completed
Push — master ( 19db41...d56a2b )
by Yannick
05:45
created
require/class.SpotterImport.php 1 patch
Indentation   +351 added lines, -351 removed lines patch added patch discarded remove patch
@@ -9,16 +9,16 @@  discard block
 block discarded – undo
9 9
 require_once(dirname(__FILE__).'/class.Source.php');
10 10
 
11 11
 class SpotterImport {
12
-    private $all_flights = array();
13
-    private $last_delete_hourly = 0;
14
-    private $last_delete = 0;
15
-    private $stats = array();
16
-    private $tmd = 0;
17
-    private $source_location = array();
18
-    public $db = null;
19
-    public $nb = 0;
20
-
21
-    public function __construct($dbc = null) {
12
+	private $all_flights = array();
13
+	private $last_delete_hourly = 0;
14
+	private $last_delete = 0;
15
+	private $stats = array();
16
+	private $tmd = 0;
17
+	private $source_location = array();
18
+	public $db = null;
19
+	public $nb = 0;
20
+
21
+	public function __construct($dbc = null) {
22 22
 	global $globalBeta;
23 23
 	$Connection = new Connection($dbc);
24 24
 	$this->db = $Connection->db();
@@ -29,18 +29,18 @@  discard block
 block discarded – undo
29 29
 	$currentdate = date('Y-m-d');
30 30
 	$sourcestat = $Stats->getStatsSource($currentdate);
31 31
 	if (!empty($sourcestat)) {
32
-	    foreach($sourcestat as $srcst) {
33
-	    	$type = $srcst['stats_type'];
32
+		foreach($sourcestat as $srcst) {
33
+			$type = $srcst['stats_type'];
34 34
 		if ($type == 'polar' || $type == 'hist') {
35
-		    $source = $srcst['source_name'];
36
-		    $data = $srcst['source_data'];
37
-		    $this->stats[$currentdate][$source][$type] = json_decode($data,true);
38
-	        }
39
-	    }
35
+			$source = $srcst['source_name'];
36
+			$data = $srcst['source_data'];
37
+			$this->stats[$currentdate][$source][$type] = json_decode($data,true);
38
+			}
39
+		}
40
+	}
40 41
 	}
41
-    }
42 42
 
43
-    public function get_Schedule($id,$ident) {
43
+	public function get_Schedule($id,$ident) {
44 44
 	global $globalDebug, $globalFork, $globalSchedulesFetch;
45 45
 	// Get schedule here, so it's done only one time
46 46
 	
@@ -59,35 +59,35 @@  discard block
 block discarded – undo
59 59
 	$Translation = new Translation($dbc);
60 60
 	$operator = $Spotter->getOperator($ident);
61 61
 	if ($Schedule->checkSchedule($operator) == 0) {
62
-	    $operator = $Translation->checkTranslation($ident);
63
-	    if ($Schedule->checkSchedule($operator) == 0) {
62
+		$operator = $Translation->checkTranslation($ident);
63
+		if ($Schedule->checkSchedule($operator) == 0) {
64 64
 		$schedule = $Schedule->fetchSchedule($operator);
65 65
 		if (count($schedule) > 0 && isset($schedule['DepartureTime']) && isset($schedule['ArrivalTime'])) {
66
-		    if ($globalDebug) echo "-> Schedule info for ".$operator." (".$ident.")\n";
67
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport_time' => $schedule['DepartureTime']));
68
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('arrival_airport_time' => $schedule['ArrivalTime']));
69
-		    // Should also check if route schedule = route from DB
70
-		    if ($schedule['DepartureAirportIATA'] != '') {
66
+			if ($globalDebug) echo "-> Schedule info for ".$operator." (".$ident.")\n";
67
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport_time' => $schedule['DepartureTime']));
68
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('arrival_airport_time' => $schedule['ArrivalTime']));
69
+			// Should also check if route schedule = route from DB
70
+			if ($schedule['DepartureAirportIATA'] != '') {
71 71
 			if ($this->all_flights[$id]['departure_airport'] != $Spotter->getAirportIcao($schedule['DepartureAirportIATA'])) {
72
-			    $airport_icao = $Spotter->getAirportIcao($schedule['DepartureAirportIATA']);
73
-			    if ($airport_icao != '') {
72
+				$airport_icao = $Spotter->getAirportIcao($schedule['DepartureAirportIATA']);
73
+				if ($airport_icao != '') {
74 74
 				$this->all_flights[$id]['departure_airport'] = $airport_icao;
75 75
 				if ($globalDebug) echo "-> Change departure airport to ".$airport_icao." for ".$ident."\n";
76
-			    }
76
+				}
77
+			}
77 78
 			}
78
-		    }
79
-		    if ($schedule['ArrivalAirportIATA'] != '') {
79
+			if ($schedule['ArrivalAirportIATA'] != '') {
80 80
 			if ($this->all_flights[$id]['arrival_airport'] != $Spotter->getAirportIcao($schedule['ArrivalAirportIATA'])) {
81
-			    $airport_icao = $Spotter->getAirportIcao($schedule['ArrivalAirportIATA']);
82
-			    if ($airport_icao != '') {
81
+				$airport_icao = $Spotter->getAirportIcao($schedule['ArrivalAirportIATA']);
82
+				if ($airport_icao != '') {
83 83
 				$this->all_flights[$id]['arrival_airport'] = $airport_icao;
84 84
 				if ($globalDebug) echo "-> Change arrival airport to ".$airport_icao." for ".$ident."\n";
85
-			    }
85
+				}
86
+			}
86 87
 			}
87
-		    }
88
-		    $Schedule->addSchedule($operator,$this->all_flights[$id]['departure_airport'],$this->all_flights[$id]['departure_airport_time'],$this->all_flights[$id]['arrival_airport'],$this->all_flights[$id]['arrival_airport_time'],$schedule['Source']);
88
+			$Schedule->addSchedule($operator,$this->all_flights[$id]['departure_airport'],$this->all_flights[$id]['departure_airport_time'],$this->all_flights[$id]['arrival_airport'],$this->all_flights[$id]['arrival_airport_time'],$schedule['Source']);
89
+		}
89 90
 		}
90
-	    }
91 91
 	}
92 92
 	// close connection, at least one way will work ?
93 93
        
@@ -105,92 +105,92 @@  discard block
 block discarded – undo
105 105
 	}
106 106
 	  */
107 107
 	}
108
-    }
108
+	}
109 109
 
110
-    public function checkAll() {
110
+	public function checkAll() {
111 111
 	global $globalDebug;
112 112
 	if ($globalDebug) echo "Update last seen flights data...\n";
113 113
 	foreach ($this->all_flights as $key => $flight) {
114
-	    if (isset($this->all_flights[$key]['id'])) {
114
+		if (isset($this->all_flights[$key]['id'])) {
115 115
 		//echo $this->all_flights[$key]['id'].' - '.$this->all_flights[$key]['latitude'].'  '.$this->all_flights[$key]['longitude']."\n";
116
-    		$Spotter = new Spotter($this->db);
117
-        	$real_arrival = $this->arrival($key);
118
-        	$Spotter->updateLatestSpotterData($this->all_flights[$key]['id'],$this->all_flights[$key]['ident'],$this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$this->all_flights[$key]['altitude'],$this->all_flights[$key]['ground'],$this->all_flights[$key]['speed'],$this->all_flights[$key]['datetime'],$real_arrival['airport_icao'],$real_arrival['airport_time']);
119
-            }
116
+			$Spotter = new Spotter($this->db);
117
+			$real_arrival = $this->arrival($key);
118
+			$Spotter->updateLatestSpotterData($this->all_flights[$key]['id'],$this->all_flights[$key]['ident'],$this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$this->all_flights[$key]['altitude'],$this->all_flights[$key]['ground'],$this->all_flights[$key]['speed'],$this->all_flights[$key]['datetime'],$real_arrival['airport_icao'],$real_arrival['airport_time']);
119
+			}
120
+	}
120 121
 	}
121
-    }
122 122
 
123
-    public function arrival($key) {
123
+	public function arrival($key) {
124 124
 	global $globalClosestMinDist, $globalDebug;
125 125
 	if ($globalDebug) echo 'Update arrival...'."\n";
126 126
 	$Spotter = new Spotter($this->db);
127
-        $airport_icao = '';
128
-        $airport_time = '';
129
-        if (!isset($globalClosestMinDist) || $globalClosestMinDist == '') $globalClosestMinDist = 50;
127
+		$airport_icao = '';
128
+		$airport_time = '';
129
+		if (!isset($globalClosestMinDist) || $globalClosestMinDist == '') $globalClosestMinDist = 50;
130 130
 	if ($this->all_flights[$key]['latitude'] != '' && $this->all_flights[$key]['longitude'] != '') {
131
-	    $closestAirports = $Spotter->closestAirports($this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$globalClosestMinDist);
132
-    	    if (isset($closestAirports[0])) {
133
-        	if (isset($this->all_flights[$key]['arrival_airport']) && $this->all_flights[$key]['arrival_airport'] == $closestAirports[0]['icao']) {
134
-        	    $airport_icao = $closestAirports[0]['icao'];
135
-        	    $airport_time = $this->all_flights[$key]['datetime'];
136
-        	    if ($globalDebug) echo "---++ Find arrival airport. airport_icao : ".$airport_icao."\n";
137
-        	} elseif (count($closestAirports > 1) && isset($this->all_flights[$key]['arrival_airport']) && $this->all_flights[$key]['arrival_airport'] != '') {
138
-        	    foreach ($closestAirports as $airport) {
139
-        		if ($this->all_flights[$key]['arrival_airport'] == $airport['icao']) {
140
-        		    $airport_icao = $airport['icao'];
141
-        		    $airport_time = $this->all_flights[$key]['datetime'];
142
-        		    if ($globalDebug) echo "---++ Find arrival airport. airport_icao : ".$airport_icao."\n";
143
-        		    break;
144
-        		}
145
-        	    }
146
-        	} elseif ($this->all_flights[$key]['altitude'] == 0 || ($this->all_flights[$key]['altitude_real'] != '' && ($closestAirports[0]['altitude'] < $this->all_flights[$key]['altitude_real'] && $this->all_flights[$key]['altitude_real'] < $closestAirports[0]['altitude']+5000))) {
147
-        		$airport_icao = $closestAirports[0]['icao'];
148
-        		$airport_time = $this->all_flights[$key]['datetime'];
149
-        	} else {
150
-        		if ($globalDebug) echo "----- Can't find arrival airport. Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.$this->all_flights[$key]['altitude_real']."\n";
151
-        	}
152
-    	    } else {
153
-    		    if ($globalDebug) echo "----- No Airport near last coord. Latitude : ".$this->all_flights[$key]['latitude'].' - Longitude : '.$this->all_flights[$key]['longitude'].' - MinDist : '.$globalClosestMinDist."\n";
154
-    	    }
155
-
156
-        } else {
157
-        	if ($globalDebug) echo "---- No latitude or longitude. Ident : ".$this->all_flights[$key]['ident']."\n";
158
-        }
159
-        return array('airport_icao' => $airport_icao,'airport_time' => $airport_time);
160
-    }
161
-
162
-
163
-
164
-    public function del() {
131
+		$closestAirports = $Spotter->closestAirports($this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$globalClosestMinDist);
132
+			if (isset($closestAirports[0])) {
133
+			if (isset($this->all_flights[$key]['arrival_airport']) && $this->all_flights[$key]['arrival_airport'] == $closestAirports[0]['icao']) {
134
+				$airport_icao = $closestAirports[0]['icao'];
135
+				$airport_time = $this->all_flights[$key]['datetime'];
136
+				if ($globalDebug) echo "---++ Find arrival airport. airport_icao : ".$airport_icao."\n";
137
+			} elseif (count($closestAirports > 1) && isset($this->all_flights[$key]['arrival_airport']) && $this->all_flights[$key]['arrival_airport'] != '') {
138
+				foreach ($closestAirports as $airport) {
139
+				if ($this->all_flights[$key]['arrival_airport'] == $airport['icao']) {
140
+					$airport_icao = $airport['icao'];
141
+					$airport_time = $this->all_flights[$key]['datetime'];
142
+					if ($globalDebug) echo "---++ Find arrival airport. airport_icao : ".$airport_icao."\n";
143
+					break;
144
+				}
145
+				}
146
+			} elseif ($this->all_flights[$key]['altitude'] == 0 || ($this->all_flights[$key]['altitude_real'] != '' && ($closestAirports[0]['altitude'] < $this->all_flights[$key]['altitude_real'] && $this->all_flights[$key]['altitude_real'] < $closestAirports[0]['altitude']+5000))) {
147
+				$airport_icao = $closestAirports[0]['icao'];
148
+				$airport_time = $this->all_flights[$key]['datetime'];
149
+			} else {
150
+				if ($globalDebug) echo "----- Can't find arrival airport. Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.$this->all_flights[$key]['altitude_real']."\n";
151
+			}
152
+			} else {
153
+				if ($globalDebug) echo "----- No Airport near last coord. Latitude : ".$this->all_flights[$key]['latitude'].' - Longitude : '.$this->all_flights[$key]['longitude'].' - MinDist : '.$globalClosestMinDist."\n";
154
+			}
155
+
156
+		} else {
157
+			if ($globalDebug) echo "---- No latitude or longitude. Ident : ".$this->all_flights[$key]['ident']."\n";
158
+		}
159
+		return array('airport_icao' => $airport_icao,'airport_time' => $airport_time);
160
+	}
161
+
162
+
163
+
164
+	public function del() {
165 165
 	global $globalDebug;
166 166
 	// Delete old infos
167 167
 	if ($globalDebug) echo 'Delete old values and update latest data...'."\n";
168 168
 	foreach ($this->all_flights as $key => $flight) {
169
-    	    if (isset($flight['lastupdate'])) {
170
-        	if ($flight['lastupdate'] < (time()-3000)) {
171
-            	    if (isset($this->all_flights[$key]['id'])) {
172
-            		if ($globalDebug) echo "--- Delete old values with id ".$this->all_flights[$key]['id']."\n";
169
+			if (isset($flight['lastupdate'])) {
170
+			if ($flight['lastupdate'] < (time()-3000)) {
171
+					if (isset($this->all_flights[$key]['id'])) {
172
+					if ($globalDebug) echo "--- Delete old values with id ".$this->all_flights[$key]['id']."\n";
173 173
 			/*
174 174
 			$SpotterLive = new SpotterLive();
175 175
             		$SpotterLive->deleteLiveSpotterDataById($this->all_flights[$key]['id']);
176 176
 			$SpotterLive->db = null;
177 177
 			*/
178
-            		$real_arrival = $this->arrival($key);
179
-            		$Spotter = new Spotter($this->db);
180
-            		if ($this->all_flights[$key]['latitude'] != '' && $this->all_flights[$key]['longitude'] != '') {
178
+					$real_arrival = $this->arrival($key);
179
+					$Spotter = new Spotter($this->db);
180
+					if ($this->all_flights[$key]['latitude'] != '' && $this->all_flights[$key]['longitude'] != '') {
181 181
 				$result = $Spotter->updateLatestSpotterData($this->all_flights[$key]['id'],$this->all_flights[$key]['ident'],$this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$this->all_flights[$key]['altitude'],$this->all_flights[$key]['ground'],$this->all_flights[$key]['speed'],$this->all_flights[$key]['datetime'],$real_arrival['airport_icao'],$real_arrival['airport_time']);
182 182
 				if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n";
183 183
 			}
184 184
 			// Put in archive
185 185
 //			$Spotter->db = null;
186
-            	    }
187
-            	    unset($this->all_flights[$key]);
188
-    	        }
189
-	    }
190
-        }
191
-    }
192
-
193
-    public function add($line) {
186
+					}
187
+					unset($this->all_flights[$key]);
188
+				}
189
+		}
190
+		}
191
+	}
192
+
193
+	public function add($line) {
194 194
 	global $globalPilotIdAccept, $globalAirportAccept, $globalAirlineAccept, $globalAirlineIgnore, $globalAirportIgnore, $globalFork, $globalDistanceIgnore, $globalDaemon, $globalSBS1update, $globalDebug, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalCoordMinChange, $globalDebugTimeElapsed, $globalCenterLatitude, $globalCenterLongitude, $globalBeta, $globalSourcesupdate, $globalAirlinesSource, $globalVAM, $globalAllFlights;
195 195
 	//if (!isset($globalDebugTimeElapsed) || $globalDebugTimeElapsed == '') $globalDebugTimeElapsed = FALSE;
196 196
 	if (!isset($globalCoordMinChange) || $globalCoordMinChange == '') $globalCoordMinChange = '0.02';
@@ -215,18 +215,18 @@  discard block
 block discarded – undo
215 215
 	
216 216
 	// SBS format is CSV format
217 217
 	if(is_array($line) && isset($line['hex'])) {
218
-	    //print_r($line);
219
-  	    if ($line['hex'] != '' && $line['hex'] != '00000' && $line['hex'] != '000000' && $line['hex'] != '111111' && ctype_xdigit($line['hex']) && strlen($line['hex']) === 6) {
218
+		//print_r($line);
219
+  		if ($line['hex'] != '' && $line['hex'] != '00000' && $line['hex'] != '000000' && $line['hex'] != '111111' && ctype_xdigit($line['hex']) && strlen($line['hex']) === 6) {
220 220
 
221 221
 		// Increment message number
222 222
 		if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE) {
223
-		    $current_date = date('Y-m-d');
224
-		    $source = $line['source_name'];
225
-		    if ($source == '' || $line['format_source'] == 'aprs') $source = $line['format_source'];
226
-		    if (!isset($this->stats[$current_date][$source]['msg'])) {
227
-		    	$this->stats[$current_date][$source]['msg']['date'] = time();
228
-		    	$this->stats[$current_date][$source]['msg']['nb'] = 1;
229
-		    } else $this->stats[$current_date][$source]['msg']['nb'] += 1;
223
+			$current_date = date('Y-m-d');
224
+			$source = $line['source_name'];
225
+			if ($source == '' || $line['format_source'] == 'aprs') $source = $line['format_source'];
226
+			if (!isset($this->stats[$current_date][$source]['msg'])) {
227
+				$this->stats[$current_date][$source]['msg']['date'] = time();
228
+				$this->stats[$current_date][$source]['msg']['nb'] = 1;
229
+			} else $this->stats[$current_date][$source]['msg']['nb'] += 1;
230 230
 		}
231 231
 		
232 232
 		/*
@@ -242,17 +242,17 @@  discard block
 block discarded – undo
242 242
 		//$this->db = $dbc;
243 243
 
244 244
 		$hex = trim($line['hex']);
245
-	        if (!isset($line['id'])) $id = trim($line['hex']);
246
-	        else $id = trim($line['id']);
245
+			if (!isset($line['id'])) $id = trim($line['hex']);
246
+			else $id = trim($line['id']);
247 247
 		
248 248
 		//print_r($this->all_flights);
249 249
 		if (!isset($this->all_flights[$id]['hex']) && ctype_xdigit($hex)) {
250
-		    $this->all_flights[$id] = array('hex' => $hex);
251
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0));
252
-		    //if (isset($line['datetime']) && preg_match('/^(\d{4}(?:\-\d{2}){2} \d{2}(?:\:\d{2}){2})$/',$line['datetime'])) {
250
+			$this->all_flights[$id] = array('hex' => $hex);
251
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0));
252
+			//if (isset($line['datetime']) && preg_match('/^(\d{4}(?:\-\d{2}){2} \d{2}(?:\:\d{2}){2})$/',$line['datetime'])) {
253 253
 			//$this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => $line['datetime']));
254
-		    //} else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => date('Y-m-d H:i:s')));
255
-		    if (!isset($line['aircraft_name']) && (!isset($line['aircraft_icao']) || $line['aircraft_icao'] == '????')) {
254
+			//} else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => date('Y-m-d H:i:s')));
255
+			if (!isset($line['aircraft_name']) && (!isset($line['aircraft_icao']) || $line['aircraft_icao'] == '????')) {
256 256
 
257 257
 			$timeelapsed = microtime(true);
258 258
 			$Spotter = new Spotter($this->db);
@@ -261,38 +261,38 @@  discard block
 block discarded – undo
261 261
 			if ($globalDebugTimeElapsed) echo 'Time elapsed for update getallaircrattype : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
262 262
 
263 263
 			if ($aircraft_icao == '' && isset($line['aircraft_type'])) {
264
-			    if ($line['aircraft_type'] == 'PARA_GLIDER') $aircraft_icao = 'GLID';
265
-			    elseif ($line['aircraft_type'] == 'HELICOPTER_ROTORCRAFT') $aircraft_icao = 'UHEL';
266
-			    elseif ($line['aircraft_type'] == 'TOW_PLANE') $aircraft_icao = 'TOWPLANE';
267
-			    elseif ($line['aircraft_type'] == 'POWERED_AIRCRAFT') $aircraft_icao = 'POWAIRC';
264
+				if ($line['aircraft_type'] == 'PARA_GLIDER') $aircraft_icao = 'GLID';
265
+				elseif ($line['aircraft_type'] == 'HELICOPTER_ROTORCRAFT') $aircraft_icao = 'UHEL';
266
+				elseif ($line['aircraft_type'] == 'TOW_PLANE') $aircraft_icao = 'TOWPLANE';
267
+				elseif ($line['aircraft_type'] == 'POWERED_AIRCRAFT') $aircraft_icao = 'POWAIRC';
268 268
 			}
269 269
 			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $aircraft_icao));
270
-		    } else if (isset($line['aircraft_name'])) {
270
+			} else if (isset($line['aircraft_name'])) {
271 271
 			// Get aircraft ICAO from aircraft name
272 272
 			$Spotter = new Spotter($this->db);
273 273
 			$aircraft_icao = $Spotter->getAircraftIcao($line['aircraft_name']);
274 274
 			$Spotter->db = null;
275 275
 			if ($aircraft_icao != '') $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $aircraft_icao));
276 276
 			else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => 'NA'));
277
-		    } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $line['aircraft_icao']));
278
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => '','departure_airport' => '', 'arrival_airport' => '','latitude' => '', 'longitude' => '', 'speed' => '', 'altitude' => '','altitude_real' => '', 'heading' => '','departure_airport_time' => '','arrival_airport_time' => '','squawk' => '','route_stop' => '','registration' => '','pilot_id' => '','pilot_name' => '','waypoints' => '','ground' => '0', 'format_source' => '','source_name' => '','over_country' => '','verticalrate' => '','noarchive' => false,'putinarchive' => true));
279
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('lastupdate' => time()));
280
-		    if (!isset($line['id'])) {
277
+			} else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $line['aircraft_icao']));
278
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => '','departure_airport' => '', 'arrival_airport' => '','latitude' => '', 'longitude' => '', 'speed' => '', 'altitude' => '','altitude_real' => '', 'heading' => '','departure_airport_time' => '','arrival_airport_time' => '','squawk' => '','route_stop' => '','registration' => '','pilot_id' => '','pilot_name' => '','waypoints' => '','ground' => '0', 'format_source' => '','source_name' => '','over_country' => '','verticalrate' => '','noarchive' => false,'putinarchive' => true));
279
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('lastupdate' => time()));
280
+			if (!isset($line['id'])) {
281 281
 			if (!isset($globalDaemon)) $globalDaemon = TRUE;
282 282
 //			if (isset($line['format_source']) && ($line['format_source'] == 'sbs' || $line['format_source'] == 'tsv' || $line['format_source'] == 'raw') && $globalDaemon) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'].'-'.date('YmdGi')));
283 283
 //			if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs') && $globalDaemon) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi')));
284 284
 			if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson')) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi')));
285
-		        //else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident']));
286
-		     } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id']));
285
+				//else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident']));
286
+			 } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id']));
287 287
 
288
-		    if ($globalDebug) echo "*********** New aircraft hex : ".$hex." ***********\n";
289
-		    if ($globalAllFlights !== FALSE) $dataFound = true;
288
+			if ($globalDebug) echo "*********** New aircraft hex : ".$hex." ***********\n";
289
+			if ($globalAllFlights !== FALSE) $dataFound = true;
290 290
 		}
291 291
 		
292 292
 		if (isset($line['datetime']) && preg_match('/^(\d{4}(?:\-\d{2}){2} \d{2}(?:\:\d{2}){2})$/',$line['datetime'])) {
293
-		    if (!isset($this->all_flights[$id]['datetime']) || strtotime($line['datetime']) >= strtotime($this->all_flights[$id]['datetime'])) {
293
+			if (!isset($this->all_flights[$id]['datetime']) || strtotime($line['datetime']) >= strtotime($this->all_flights[$id]['datetime'])) {
294 294
 			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => $line['datetime']));
295
-		    } else {
295
+			} else {
296 296
 				if (strtotime($line['datetime']) == strtotime($this->all_flights[$id]['datetime']) && $globalDebug) echo "!!! Date is the same as previous data for ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."\n";
297 297
 				elseif (strtotime($line['datetime']) > strtotime($this->all_flights[$id]['datetime']) && $globalDebug) echo "!!! Date previous latest data (".$line['datetime']." > ".$this->all_flights[$id]['datetime'].") !!! for ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."\n";
298 298
 				/*
@@ -301,38 +301,38 @@  discard block
 block discarded – undo
301 301
 				print_r($line);
302 302
 				*/
303 303
 				return '';
304
-		    }
304
+			}
305 305
 		} else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => date('Y-m-d H:i:s')));
306 306
 
307 307
 		if (isset($line['registration']) && $line['registration'] != '' && $line['registration'] != 'z.NO-REG') {
308
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('registration' => $line['registration']));
308
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('registration' => $line['registration']));
309 309
 		}
310 310
 		if (isset($line['waypoints']) && $line['waypoints'] != '') {
311
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('waypoints' => $line['waypoints']));
311
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('waypoints' => $line['waypoints']));
312 312
 		}
313 313
 		if (isset($line['pilot_id']) && $line['pilot_id'] != '') {
314
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('pilot_id' => $line['pilot_id']));
314
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('pilot_id' => $line['pilot_id']));
315 315
 		}
316 316
 		if (isset($line['pilot_name']) && $line['pilot_name'] != '') {
317
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('pilot_name' => $line['pilot_name']));
317
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('pilot_name' => $line['pilot_name']));
318 318
 		}
319 319
  
320 320
 		if (isset($line['ident']) && $line['ident'] != '' && $line['ident'] != '????????' && $line['ident'] != '00000000' && ($this->all_flights[$id]['ident'] != trim($line['ident'])) && preg_match('/^[a-zA-Z0-9]+$/', $line['ident'])) {
321
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => trim($line['ident'])));
322
-		    if ($this->all_flights[$id]['addedSpotter'] == 1) {
321
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => trim($line['ident'])));
322
+			if ($this->all_flights[$id]['addedSpotter'] == 1) {
323 323
 			$timeelapsed = microtime(true);
324
-            		$Spotter = new Spotter($this->db);
325
-            		$fromsource = NULL;
326
-            		if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource;
327
-            		elseif (isset($line['format_source']) && $line['format_source'] == 'vatsimtxt') $fromsource = 'vatsim';
324
+					$Spotter = new Spotter($this->db);
325
+					$fromsource = NULL;
326
+					if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource;
327
+					elseif (isset($line['format_source']) && $line['format_source'] == 'vatsimtxt') $fromsource = 'vatsim';
328 328
 			elseif (isset($line['format_source']) && $line['format_source'] == 'whazzup') $fromsource = 'ivao';
329 329
 			elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim';
330 330
 			elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao';
331
-            		$result = $Spotter->updateIdentSpotterData($this->all_flights[$id]['id'],$this->all_flights[$id]['ident'],$fromsource);
331
+					$result = $Spotter->updateIdentSpotterData($this->all_flights[$id]['id'],$this->all_flights[$id]['ident'],$fromsource);
332 332
 			if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n";
333 333
 			$Spotter->db = null;
334 334
 			if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
335
-		    }
335
+			}
336 336
 
337 337
 /*
338 338
 		    if (!isset($line['id'])) {
@@ -342,26 +342,26 @@  discard block
 block discarded – undo
342 342
 		        else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident']));
343 343
 		     } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id']));
344 344
   */
345
-		    if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident']));
345
+			if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident']));
346 346
 
347
-		    //$putinarchive = true;
348
-		    if (isset($line['departure_airport_time']) && $line['departure_airport_time'] != 0) {
347
+			//$putinarchive = true;
348
+			if (isset($line['departure_airport_time']) && $line['departure_airport_time'] != 0) {
349 349
 			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport_time' => $line['departure_airport_time']));
350
-		    }
351
-		    if (isset($line['arrival_airport_time']) && $line['arrival_airport_time'] != 0) {
350
+			}
351
+			if (isset($line['arrival_airport_time']) && $line['arrival_airport_time'] != 0) {
352 352
 			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('arrival_airport_time' => $line['arrival_airport_time']));
353
-		    }
354
-		    if (isset($line['departure_airport_icao']) && isset($line['arrival_airport_icao'])) {
355
-		    		$this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $line['departure_airport_icao'],'arrival_airport' => $line['arrival_airport_icao'],'route_stop' => ''));
356
-		    } elseif (isset($line['departure_airport_iata']) && isset($line['arrival_airport_iata'])) {
353
+			}
354
+			if (isset($line['departure_airport_icao']) && isset($line['arrival_airport_icao'])) {
355
+					$this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $line['departure_airport_icao'],'arrival_airport' => $line['arrival_airport_icao'],'route_stop' => ''));
356
+			} elseif (isset($line['departure_airport_iata']) && isset($line['arrival_airport_iata'])) {
357 357
 				$timeelapsed = microtime(true);
358 358
 				$Spotter = new Spotter($this->db);
359 359
 				$line['departure_airport_icao'] = $Spotter->getAirportIcao($line['departure_airport_iata']);
360 360
 				$line['arrival_airport_icao'] = $Spotter->getAirportIcao($line['arrival_airport_iata']);
361
-		    		$this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $line['departure_airport_icao'],'arrival_airport' => $line['arrival_airport_icao'],'route_stop' => ''));
361
+					$this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $line['departure_airport_icao'],'arrival_airport' => $line['arrival_airport_icao'],'route_stop' => ''));
362 362
 				if ($globalDebugTimeElapsed) echo 'Time elapsed for update getAirportICAO : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
363 363
 
364
-		    } elseif (!isset($line['format_source']) || $line['format_source'] != 'aprs') {
364
+			} elseif (!isset($line['format_source']) || $line['format_source'] != 'aprs') {
365 365
 			$timeelapsed = microtime(true);
366 366
 			$Spotter = new Spotter($this->db);
367 367
 			$route = $Spotter->getRouteInfo(trim($line['ident']));
@@ -375,43 +375,43 @@  discard block
 block discarded – undo
375 375
 			if ($globalDebugTimeElapsed) echo 'Time elapsed for update getrouteinfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
376 376
 
377 377
 			if (isset($route['fromairport_icao']) && isset($route['toairport_icao'])) {
378
-			    //if ($route['FromAirport_ICAO'] != $route['ToAirport_ICAO']) {
379
-			    if ($route['fromairport_icao'] != $route['toairport_icao']) {
378
+				//if ($route['FromAirport_ICAO'] != $route['ToAirport_ICAO']) {
379
+				if ($route['fromairport_icao'] != $route['toairport_icao']) {
380 380
 				//    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $route['FromAirport_ICAO'],'arrival_airport' => $route['ToAirport_ICAO'],'route_stop' => $route['RouteStop']));
381
-		    		$this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $route['fromairport_icao'],'arrival_airport' => $route['toairport_icao'],'route_stop' => $route['routestop']));
382
-		    	    }
381
+					$this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $route['fromairport_icao'],'arrival_airport' => $route['toairport_icao'],'route_stop' => $route['routestop']));
382
+					}
383 383
 			}
384 384
 			if (!isset($globalFork)) $globalFork = TRUE;
385 385
 			if (!$globalIVAO && !$globalVATSIM && !$globalphpVMS && !$globalVAM && (!isset($line['format_source']) || $line['format_source'] != 'aprs')) {
386 386
 				if (!isset($this->all_flights[$id]['schedule_check']) || $this->all_flights[$id]['schedule_check'] === false) $this->get_Schedule($id,trim($line['ident']));
387 387
 			}
388
-		    }
388
+			}
389 389
 		}
390 390
 
391 391
 		if (isset($line['speed']) && $line['speed'] != '') {
392 392
 		//    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed' => $line[12]));
393
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed' => round($line['speed'])));
394
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed_fromsrc' => true));
395
-		    //$dataFound = true;
393
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed' => round($line['speed'])));
394
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed_fromsrc' => true));
395
+			//$dataFound = true;
396 396
 		} else if (!isset($this->all_flights[$id]['speed_fromsrc']) && isset($this->all_flights[$id]['time_last_coord']) && $this->all_flights[$id]['time_last_coord'] != time() && isset($line['latitude']) && isset($line['longitude'])) {
397
-		    $distance = $Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m');
398
-		    if ($distance > 1000 && $distance < 10000) {
399
-		    // use datetime
397
+			$distance = $Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m');
398
+			if ($distance > 1000 && $distance < 10000) {
399
+			// use datetime
400 400
 			$speed = $distance/(time() - $this->all_flights[$id]['time_last_coord']);
401 401
 			$speed = $speed*3.6;
402 402
 			if ($speed < 1000) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed' => round($speed)));
403 403
   			if ($globalDebug) echo "ø Calculated Speed for ".$this->all_flights[$id]['hex']." : ".$speed." - distance : ".$distance."\n";
404
-		    }
404
+			}
405 405
 		}
406 406
 
407 407
 
408 408
 
409
-	        if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) {
410
-	    	    if (isset($this->all_flights[$id]['time_last_coord'])) $timediff = round(time()-$this->all_flights[$id]['time_last_coord']);
411
-	    	    else unset($timediff);
412
-	    	    if ($this->tmd > 5 || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || (isset($globalVAM) && $globalVAM) || !isset($timediff) || $timediff > 800 || ($timediff > 10 && isset($this->all_flights[$id]['latitude']) && isset($this->all_flights[$id]['longitude']) && $Common->withinThreshold($timediff,$Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m')))) {
409
+			if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) {
410
+				if (isset($this->all_flights[$id]['time_last_coord'])) $timediff = round(time()-$this->all_flights[$id]['time_last_coord']);
411
+				else unset($timediff);
412
+				if ($this->tmd > 5 || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || (isset($globalVAM) && $globalVAM) || !isset($timediff) || $timediff > 800 || ($timediff > 10 && isset($this->all_flights[$id]['latitude']) && isset($this->all_flights[$id]['longitude']) && $Common->withinThreshold($timediff,$Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m')))) {
413 413
 			if (isset($this->all_flights[$id]['archive_latitude']) && isset($this->all_flights[$id]['archive_longitude']) && isset($this->all_flights[$id]['livedb_latitude']) && isset($this->all_flights[$id]['livedb_longitude'])) {
414
-			    if (!$Common->checkLine($this->all_flights[$id]['archive_latitude'],$this->all_flights[$id]['archive_longitude'],$this->all_flights[$id]['livedb_latitude'],$this->all_flights[$id]['livedb_longitude'],$line['latitude'],$line['longitude'])) {
414
+				if (!$Common->checkLine($this->all_flights[$id]['archive_latitude'],$this->all_flights[$id]['archive_longitude'],$this->all_flights[$id]['livedb_latitude'],$this->all_flights[$id]['livedb_longitude'],$line['latitude'],$line['longitude'])) {
415 415
 				$this->all_flights[$id]['archive_latitude'] = $line['latitude'];
416 416
 				$this->all_flights[$id]['archive_longitude'] = $line['longitude'];
417 417
 				$this->all_flights[$id]['putinarchive'] = true;
@@ -425,16 +425,16 @@  discard block
 block discarded – undo
425 425
 				if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
426 426
 				$this->tmd = 0;
427 427
 				if ($globalDebug) echo 'FOUND : '.$this->all_flights[$id]['over_country'].' ---------------'."\n";
428
-			    }
428
+				}
429 429
 			}
430 430
 
431 431
 			if (isset($line['latitude']) && $line['latitude'] != '' && $line['latitude'] != 0 && $line['latitude'] < 91 && $line['latitude'] > -90) {
432
-			    //if (!isset($this->all_flights[$id]['latitude']) || $this->all_flights[$id]['latitude'] == '' || abs($this->all_flights[$id]['latitude']-$line['latitude']) < 3 || $line['format_source'] != 'sbs' || time() - $this->all_flights[$id]['lastupdate'] > 30) {
432
+				//if (!isset($this->all_flights[$id]['latitude']) || $this->all_flights[$id]['latitude'] == '' || abs($this->all_flights[$id]['latitude']-$line['latitude']) < 3 || $line['format_source'] != 'sbs' || time() - $this->all_flights[$id]['lastupdate'] > 30) {
433 433
 				if (!isset($this->all_flights[$id]['archive_latitude'])) $this->all_flights[$id]['archive_latitude'] = $line['latitude'];
434 434
 				if (!isset($this->all_flights[$id]['livedb_latitude']) || abs($this->all_flights[$id]['livedb_latitude']-$line['latitude']) > $globalCoordMinChange || $this->all_flights[$id]['format_source'] == 'aprs') {
435
-				    $this->all_flights[$id]['livedb_latitude'] = $line['latitude'];
436
-				    $dataFound = true;
437
-				    $this->all_flights[$id]['time_last_coord'] = time();
435
+					$this->all_flights[$id]['livedb_latitude'] = $line['latitude'];
436
+					$dataFound = true;
437
+					$this->all_flights[$id]['time_last_coord'] = time();
438 438
 				}
439 439
 				// elseif ($globalDebug) echo '!*!*! Ignore data, too close to previous one'."\n";
440 440
 				$this->all_flights[$id] = array_merge($this->all_flights[$id],array('latitude' => $line['latitude']));
@@ -445,20 +445,20 @@  discard block
 block discarded – undo
445 445
 				    //$putinarchive = true;
446 446
 				}
447 447
 				*/
448
-			    /*
448
+				/*
449 449
 			    } elseif (isset($this->all_flights[$id]['latitude'])) {
450 450
 				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";
451 451
 			    }
452 452
 			    */
453 453
 			}
454 454
 			if (isset($line['longitude']) && $line['longitude'] != '' && $line['longitude'] != 0 && $line['longitude'] < 360 && $line['longitude'] > -180) {
455
-			    if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360;
456
-			    //if (!isset($this->all_flights[$id]['longitude']) || $this->all_flights[$id]['longitude'] == ''  || abs($this->all_flights[$id]['longitude']-$line['longitude']) < 2 || $line['format_source'] != 'sbs' || time() - $this->all_flights[$id]['lastupdate'] > 30) {
455
+				if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360;
456
+				//if (!isset($this->all_flights[$id]['longitude']) || $this->all_flights[$id]['longitude'] == ''  || abs($this->all_flights[$id]['longitude']-$line['longitude']) < 2 || $line['format_source'] != 'sbs' || time() - $this->all_flights[$id]['lastupdate'] > 30) {
457 457
 				if (!isset($this->all_flights[$id]['archive_longitude'])) $this->all_flights[$id]['archive_longitude'] = $line['longitude'];
458 458
 				if (!isset($this->all_flights[$id]['livedb_longitude']) || abs($this->all_flights[$id]['livedb_longitude']-$line['longitude']) > $globalCoordMinChange || $this->all_flights[$id]['format_source'] == 'aprs') {
459
-				    $this->all_flights[$id]['livedb_longitude'] = $line['longitude'];
460
-				    $dataFound = true;
461
-				    $this->all_flights[$id]['time_last_coord'] = time();
459
+					$this->all_flights[$id]['livedb_longitude'] = $line['longitude'];
460
+					$dataFound = true;
461
+					$this->all_flights[$id]['time_last_coord'] = time();
462 462
 				}
463 463
 				// elseif ($globalDebug) echo '!*!*! Ignore data, too close to previous one'."\n";
464 464
 				$this->all_flights[$id] = array_merge($this->all_flights[$id],array('longitude' => $line['longitude']));
@@ -476,53 +476,53 @@  discard block
 block discarded – undo
476 476
 			    */
477 477
 			}
478 478
 
479
-		    } else if ($globalDebug && $timediff > 20) {
479
+			} else if ($globalDebug && $timediff > 20) {
480 480
 			$this->tmd = $this->tmd + 1;
481 481
 			echo '!!! Too much distance in short time... for '.$this->all_flights[$id]['ident']."\n";
482 482
 			echo 'Time : '.$timediff.'s - Distance : '.$Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m')."m -";
483 483
 			echo 'Speed : '.(($Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m')/$timediff)*3.6)." km/h - ";
484 484
 			echo 'Lat : '.$line['latitude'].' - long : '.$line['longitude'].' - prev lat : '.$this->all_flights[$id]['latitude'].' - prev long : '.$this->all_flights[$id]['longitude']." \n";
485
-		    }
485
+			}
486 486
 		}
487 487
 		if (isset($line['last_update']) && $line['last_update'] != '') {
488
-		    if (isset($this->all_flights[$id]['last_update']) && $this->all_flights[$id]['last_update'] != $line['last_update']) $dataFound = true;
489
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('last_update' => $line['last_update']));
488
+			if (isset($this->all_flights[$id]['last_update']) && $this->all_flights[$id]['last_update'] != $line['last_update']) $dataFound = true;
489
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('last_update' => $line['last_update']));
490 490
 		}
491 491
 		if (isset($line['verticalrate']) && $line['verticalrate'] != '') {
492
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('verticalrate' => $line['verticalrate']));
493
-		    //$dataFound = true;
492
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('verticalrate' => $line['verticalrate']));
493
+			//$dataFound = true;
494 494
 		}
495 495
 		if (isset($line['format_source']) && $line['format_source'] != '') {
496
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('format_source' => $line['format_source']));
496
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('format_source' => $line['format_source']));
497 497
 		}
498 498
 		if (isset($line['source_name']) && $line['source_name'] != '') {
499
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('source_name' => $line['source_name']));
499
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('source_name' => $line['source_name']));
500 500
 		}
501 501
 		if (isset($line['emergency']) && $line['emergency'] != '') {
502
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('emergency' => $line['emergency']));
503
-		    //$dataFound = true;
502
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('emergency' => $line['emergency']));
503
+			//$dataFound = true;
504 504
 		}
505 505
 		if (isset($line['ground']) && $line['ground'] != '') {
506
-		    if (isset($this->all_flights[$id]['ground']) && $this->all_flights[$id]['ground'] == 1 && $line['ground'] == 0) {
506
+			if (isset($this->all_flights[$id]['ground']) && $this->all_flights[$id]['ground'] == 1 && $line['ground'] == 0) {
507 507
 			// Here we force archive of flight because after ground it's a new one (or should be)
508 508
 			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0));
509 509
 			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('forcenew' => 1));
510 510
 			if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw') && $globalDaemon) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdGi')));
511
-		        elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id']));
511
+				elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id']));
512 512
 			elseif (isset($this->all_flights[$id]['ident'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident']));
513
-		    }
514
-		    if ($line['ground'] != 1) $line['ground'] = 0;
515
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ground' => $line['ground']));
516
-		    //$dataFound = true;
513
+			}
514
+			if ($line['ground'] != 1) $line['ground'] = 0;
515
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('ground' => $line['ground']));
516
+			//$dataFound = true;
517 517
 		}
518 518
 		if (isset($line['squawk']) && $line['squawk'] != '') {
519
-		    if (isset($this->all_flights[$id]['squawk']) && $this->all_flights[$id]['squawk'] != '7500' && $this->all_flights[$id]['squawk'] != '7600' && $this->all_flights[$id]['squawk'] != '7700' && isset($this->all_flights[$id]['id'])) {
520
-			    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk']));
521
-			    $highlight = '';
522
-			    if ($this->all_flights[$id]['squawk'] == '7500') $highlight = 'Squawk 7500 : Hijack at '.date('Y-m-d G:i').' UTC';
523
-			    if ($this->all_flights[$id]['squawk'] == '7600') $highlight = 'Squawk 7600 : Lost Comm (radio failure) at '.date('Y-m-d G:i').' UTC';
524
-			    if ($this->all_flights[$id]['squawk'] == '7700') $highlight = 'Squawk 7700 : Emergency at '.date('Y-m-d G:i').' UTC';
525
-			    if ($highlight != '') {
519
+			if (isset($this->all_flights[$id]['squawk']) && $this->all_flights[$id]['squawk'] != '7500' && $this->all_flights[$id]['squawk'] != '7600' && $this->all_flights[$id]['squawk'] != '7700' && isset($this->all_flights[$id]['id'])) {
520
+				$this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk']));
521
+				$highlight = '';
522
+				if ($this->all_flights[$id]['squawk'] == '7500') $highlight = 'Squawk 7500 : Hijack at '.date('Y-m-d G:i').' UTC';
523
+				if ($this->all_flights[$id]['squawk'] == '7600') $highlight = 'Squawk 7600 : Lost Comm (radio failure) at '.date('Y-m-d G:i').' UTC';
524
+				if ($this->all_flights[$id]['squawk'] == '7700') $highlight = 'Squawk 7700 : Emergency at '.date('Y-m-d G:i').' UTC';
525
+				if ($highlight != '') {
526 526
 				$timeelapsed = microtime(true);
527 527
 				$Spotter = new Spotter($this->db);
528 528
 				$Spotter->setHighlightFlight($this->all_flights[$id]['id'],$highlight);
@@ -532,38 +532,38 @@  discard block
 block discarded – undo
532 532
 				$this->all_flights[$id]['putinarchive'] = true;
533 533
 				//$putinarchive = true;
534 534
 				//$highlight = '';
535
-			    }
535
+				}
536 536
 			    
537
-		    } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk']));
538
-		    //$dataFound = true;
537
+			} else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk']));
538
+			//$dataFound = true;
539 539
 		}
540 540
 
541 541
 		if (isset($line['altitude']) && $line['altitude'] != '') {
542
-		    //if (!isset($this->all_flights[$id]['altitude']) || $this->all_flights[$id]['altitude'] == '' || ($this->all_flights[$id]['altitude'] > 0 && $line['altitude'] != 0)) {
542
+			//if (!isset($this->all_flights[$id]['altitude']) || $this->all_flights[$id]['altitude'] == '' || ($this->all_flights[$id]['altitude'] > 0 && $line['altitude'] != 0)) {
543 543
 			if (is_int($this->all_flights[$id]['altitude']) && abs(round($line['altitude']/100)-$this->all_flights[$id]['altitude']) > 2) $this->all_flights[$id]['putinarchive'] = true;
544 544
 			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('altitude' => round($line['altitude']/100)));
545 545
 			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('altitude_real' => $line['altitude']));
546 546
 			//$dataFound = true;
547
-		    //} elseif ($globalDebug) echo "!!! Strange altitude data... not added.\n";
547
+			//} elseif ($globalDebug) echo "!!! Strange altitude data... not added.\n";
548 548
   		}
549 549
 
550 550
 		if (isset($line['noarchive']) && $line['noarchive'] === true) {
551
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('noarchive' => true));
551
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('noarchive' => true));
552 552
 		}
553 553
 		
554 554
 		if (isset($line['heading']) && $line['heading'] != '') {
555
-		    if (is_int($this->all_flights[$id]['heading']) && abs($this->all_flights[$id]['heading']-round($line['heading'])) > 2) $this->all_flights[$id]['putinarchive'] = true;
556
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => round($line['heading'])));
557
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading_fromsrc' => true));
558
-		    //$dataFound = true;
555
+			if (is_int($this->all_flights[$id]['heading']) && abs($this->all_flights[$id]['heading']-round($line['heading'])) > 2) $this->all_flights[$id]['putinarchive'] = true;
556
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => round($line['heading'])));
557
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading_fromsrc' => true));
558
+			//$dataFound = true;
559 559
   		} elseif (!isset($this->all_flights[$id]['heading_fromsrc']) && isset($this->all_flights[$id]['archive_latitude']) && $this->all_flights[$id]['archive_latitude'] != $this->all_flights[$id]['latitude'] && isset($this->all_flights[$id]['archive_longitude']) && $this->all_flights[$id]['archive_longitude'] != $this->all_flights[$id]['longitude']) {
560
-  		    $heading = $Common->getHeading($this->all_flights[$id]['archive_latitude'],$this->all_flights[$id]['archive_longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude']);
561
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => round($heading)));
562
-		    if (abs($this->all_flights[$id]['heading']-round($heading)) > 2) $this->all_flights[$id]['putinarchive'] = true;
563
-  		    if ($globalDebug) echo "ø Calculated Heading for ".$this->all_flights[$id]['hex']." : ".$heading."\n";
560
+  			$heading = $Common->getHeading($this->all_flights[$id]['archive_latitude'],$this->all_flights[$id]['archive_longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude']);
561
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => round($heading)));
562
+			if (abs($this->all_flights[$id]['heading']-round($heading)) > 2) $this->all_flights[$id]['putinarchive'] = true;
563
+  			if ($globalDebug) echo "ø Calculated Heading for ".$this->all_flights[$id]['hex']." : ".$heading."\n";
564 564
   		} elseif (isset($this->all_flights[$id]['format_source']) && $this->all_flights[$id]['format_source'] == 'ACARS') {
565
-  		    // If not enough messages and ACARS set heading to 0
566
-  		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => 0));
565
+  			// If not enough messages and ACARS set heading to 0
566
+  			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => 0));
567 567
   		}
568 568
 		if (isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalSourcesupdate) $dataFound = false;
569 569
 		elseif (isset($globalSBS1update) && $globalSBS1update != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalSBS1update) $dataFound = false;
@@ -574,119 +574,119 @@  discard block
 block discarded – undo
574 574
 		//if ($dataFound == true && isset($this->all_flights[$id]['hex']) && $this->all_flights[$id]['ident'] != '' && $this->all_flights[$id]['latitude'] != '' && $this->all_flights[$id]['longitude'] != '') {
575 575
 		//if ($dataFound === true && isset($this->all_flights[$id]['hex']) && $this->all_flights[$id]['heading'] != '' && $this->all_flights[$id]['latitude'] != '' && $this->all_flights[$id]['longitude'] != '') {
576 576
 		if ($dataFound === true && isset($this->all_flights[$id]['hex'])) {
577
-		    $this->all_flights[$id]['lastupdate'] = time();
578
-		    if ($this->all_flights[$id]['addedSpotter'] == 0) {
579
-		        if (!isset($globalDistanceIgnore['latitude']) || $this->all_flights[$id]['longitude'] == ''  || $this->all_flights[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) {
580
-			    //print_r($this->all_flights);
581
-			    //echo $this->all_flights[$id]['id'].' - '.$this->all_flights[$id]['addedSpotter']."\n";
582
-			    //$last_hour_ident = Spotter->getIdentFromLastHour($this->all_flights[$id]['ident']);
583
-			    if (!isset($this->all_flights[$id]['forcenew']) || $this->all_flights[$id]['forcenew'] == 0) {
577
+			$this->all_flights[$id]['lastupdate'] = time();
578
+			if ($this->all_flights[$id]['addedSpotter'] == 0) {
579
+				if (!isset($globalDistanceIgnore['latitude']) || $this->all_flights[$id]['longitude'] == ''  || $this->all_flights[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) {
580
+				//print_r($this->all_flights);
581
+				//echo $this->all_flights[$id]['id'].' - '.$this->all_flights[$id]['addedSpotter']."\n";
582
+				//$last_hour_ident = Spotter->getIdentFromLastHour($this->all_flights[$id]['ident']);
583
+				if (!isset($this->all_flights[$id]['forcenew']) || $this->all_flights[$id]['forcenew'] == 0) {
584 584
 				if ($globalDebug) echo "Check if aircraft is already in DB...";
585 585
 				$timeelapsed = microtime(true);
586 586
 				$SpotterLive = new SpotterLive($this->db);
587 587
 				if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson')) {
588
-				    $recent_ident = $SpotterLive->checkModeSRecent($this->all_flights[$id]['hex']);
589
-				    if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkModeSRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
588
+					$recent_ident = $SpotterLive->checkModeSRecent($this->all_flights[$id]['hex']);
589
+					if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkModeSRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
590 590
 				} elseif (isset($line['id'])) {
591
-				    $recent_ident = $SpotterLive->checkIdRecent($line['id']);
592
-				    if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
591
+					$recent_ident = $SpotterLive->checkIdRecent($line['id']);
592
+					if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
593 593
 				} elseif (isset($this->all_flights[$id]['ident']) && $this->all_flights[$id]['ident'] != '') {
594
-				    $recent_ident = $SpotterLive->checkIdentRecent($this->all_flights[$id]['ident']);
595
-				    if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
594
+					$recent_ident = $SpotterLive->checkIdentRecent($this->all_flights[$id]['ident']);
595
+					if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
596 596
 				} else $recent_ident = '';
597 597
 				$SpotterLive->db=null;
598 598
 
599 599
 				if ($globalDebug && $recent_ident == '') echo " Not in DB.\n";
600 600
 				elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n";
601
-			    } else {
601
+				} else {
602 602
 				$recent_ident = '';
603 603
 				$this->all_flights[$id] = array_merge($this->all_flights[$id],array('forcenew' => 0));
604
-			    }
605
-			    //if there was no aircraft with the same callsign within the last hour and go post it into the archive
606
-			    if($recent_ident == "")
607
-			    {
604
+				}
605
+				//if there was no aircraft with the same callsign within the last hour and go post it into the archive
606
+				if($recent_ident == "")
607
+				{
608 608
 				if ($globalDebug) echo "\o/ Add ".$this->all_flights[$id]['ident']." in archive DB : ";
609 609
 				if ($this->all_flights[$id]['departure_airport'] == "") { $this->all_flights[$id]['departure_airport'] = "NA"; }
610 610
 				if ($this->all_flights[$id]['arrival_airport'] == "") { $this->all_flights[$id]['arrival_airport'] = "NA"; }
611 611
 				//adds the spotter data for the archive
612 612
 				$ignoreImport = false;
613 613
 				foreach($globalAirportIgnore as $airportIgnore) {
614
-				    if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) {
614
+					if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) {
615 615
 					$ignoreImport = true;
616
-				    }
616
+					}
617 617
 				}
618 618
 				if (count($globalAirportAccept) > 0) {
619
-				    $ignoreImport = true;
620
-				    foreach($globalAirportIgnore as $airportIgnore) {
619
+					$ignoreImport = true;
620
+					foreach($globalAirportIgnore as $airportIgnore) {
621 621
 					if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) {
622
-					    $ignoreImport = false;
622
+						$ignoreImport = false;
623
+					}
623 624
 					}
624
-				    }
625 625
 				}
626 626
 				if (isset($globalAirlineIgnore) && is_array($globalAirlineIgnore)) {
627
-				    foreach($globalAirlineIgnore as $airlineIgnore) {
627
+					foreach($globalAirlineIgnore as $airlineIgnore) {
628 628
 					if ((is_numeric(substr(substr($this->all_flights[$id]['ident'],0,4),-1,1)) && substr($this->all_flights[$id]['ident'],0,3) == $airlineIgnore) || (is_numeric(substr(substr($this->all_flights[$id]['ident'],0,3),-1,1)) && substr($this->all_flights[$id]['ident'],0,2) == $airlineIgnore)) {
629
-					    $ignoreImport = true;
629
+						$ignoreImport = true;
630
+					}
630 631
 					}
631
-				    }
632 632
 				}
633 633
 				if (isset($globalAirlineAccept) && count($globalAirlineAccept) > 0) {
634
-				    $ignoreImport = true;
635
-				    foreach($globalAirlineAccept as $airlineAccept) {
634
+					$ignoreImport = true;
635
+					foreach($globalAirlineAccept as $airlineAccept) {
636 636
 					if ((is_numeric(substr(substr($this->all_flights[$id]['ident'],0,4),-1,1)) && substr($this->all_flights[$id]['ident'],0,3) == $airlineAccept) || (is_numeric(substr(substr($this->all_flights[$id]['ident'],0,3),-1,1)) && substr($this->all_flights[$id]['ident'],0,2) == $airlineAccept)) {
637
-					    $ignoreImport = false;
637
+						$ignoreImport = false;
638
+					}
638 639
 					}
639
-				    }
640 640
 				}
641 641
 				if (isset($globalPilotIdAccept) && count($globalPilotIdAccept) > 0) {
642
-				    $ignoreImport = true;
643
-				    foreach($globalPilotIdAccept as $pilotIdAccept) {
642
+					$ignoreImport = true;
643
+					foreach($globalPilotIdAccept as $pilotIdAccept) {
644 644
 					if ($this->all_flights[$id]['pilot_id'] == $pilotIdAccept) {
645
-					    $ignoreImport = false;
645
+						$ignoreImport = false;
646
+					}
646 647
 					}
647
-				    }
648 648
 				}
649 649
 				
650 650
 				if (!$ignoreImport) {
651
-				    $highlight = '';
652
-				    if ($this->all_flights[$id]['squawk'] == '7500') $highlight = 'Squawk 7500 : Hijack';
653
-				    if ($this->all_flights[$id]['squawk'] == '7600') $highlight = 'Squawk 7600 : Lost Comm (radio failure)';
654
-				    if ($this->all_flights[$id]['squawk'] == '7700') $highlight = 'Squawk 7700 : Emergency';
655
-				    if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi')));
656
-				    $timeelapsed = microtime(true);
657
-				    $Spotter = new Spotter($this->db);
658
-				    $result = $Spotter->addSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['aircraft_icao'], $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['waypoints'], $this->all_flights[$id]['altitude'], $this->all_flights[$id]['heading'], $this->all_flights[$id]['speed'], $this->all_flights[$id]['datetime'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport_time'],$this->all_flights[$id]['squawk'],$this->all_flights[$id]['route_stop'],$highlight,$this->all_flights[$id]['hex'],$this->all_flights[$id]['registration'],$this->all_flights[$id]['pilot_id'],$this->all_flights[$id]['pilot_name'],$this->all_flights[$id]['verticalrate'],$this->all_flights[$id]['ground'],$this->all_flights[$id]['format_source'],$this->all_flights[$id]['source_name']);
659
-				    $Spotter->db = null;
660
-				    if ($globalDebug && isset($result)) echo $result."\n";
661
-				    if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
651
+					$highlight = '';
652
+					if ($this->all_flights[$id]['squawk'] == '7500') $highlight = 'Squawk 7500 : Hijack';
653
+					if ($this->all_flights[$id]['squawk'] == '7600') $highlight = 'Squawk 7600 : Lost Comm (radio failure)';
654
+					if ($this->all_flights[$id]['squawk'] == '7700') $highlight = 'Squawk 7700 : Emergency';
655
+					if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi')));
656
+					$timeelapsed = microtime(true);
657
+					$Spotter = new Spotter($this->db);
658
+					$result = $Spotter->addSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['aircraft_icao'], $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['waypoints'], $this->all_flights[$id]['altitude'], $this->all_flights[$id]['heading'], $this->all_flights[$id]['speed'], $this->all_flights[$id]['datetime'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport_time'],$this->all_flights[$id]['squawk'],$this->all_flights[$id]['route_stop'],$highlight,$this->all_flights[$id]['hex'],$this->all_flights[$id]['registration'],$this->all_flights[$id]['pilot_id'],$this->all_flights[$id]['pilot_name'],$this->all_flights[$id]['verticalrate'],$this->all_flights[$id]['ground'],$this->all_flights[$id]['format_source'],$this->all_flights[$id]['source_name']);
659
+					$Spotter->db = null;
660
+					if ($globalDebug && isset($result)) echo $result."\n";
661
+					if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
662 662
 				    
663
-				    // Add source stat in DB
664
-				    $Stats = new Stats($this->db);
665
-				    if (!empty($this->stats)) {
663
+					// Add source stat in DB
664
+					$Stats = new Stats($this->db);
665
+					if (!empty($this->stats)) {
666 666
 					if ($globalDebug) echo 'Add source stats : ';
667
-				        foreach($this->stats as $date => $data) {
668
-					    foreach($data as $source => $sourced) {
669
-					        //print_r($sourced);
670
-				    	        if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar',$date);
671
-				    	        if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist',$date);
672
-				    		if (isset($sourced['msg'])) {
673
-				    		    if (time() - $sourced['msg']['date'] > 10) {
674
-				    		        $nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date']));
675
-				    		        echo $Stats->addStatSource($nbmsg,$source,'msg',$date);
676
-			    			        unset($this->stats[$date][$source]['msg']);
677
-			    			    }
678
-			    			}
679
-			    		    }
680
-			    		    if ($date != date('Y-m-d')) {
681
-			    			unset($this->stats[$date]);
682
-			    		    }
683
-				    	}
684
-				    	if ($globalDebug) echo 'Done'."\n";
685
-
686
-				    }
687
-				    $Stats->db = null;
667
+						foreach($this->stats as $date => $data) {
668
+						foreach($data as $source => $sourced) {
669
+							//print_r($sourced);
670
+								if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar',$date);
671
+								if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist',$date);
672
+							if (isset($sourced['msg'])) {
673
+								if (time() - $sourced['msg']['date'] > 10) {
674
+									$nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date']));
675
+									echo $Stats->addStatSource($nbmsg,$source,'msg',$date);
676
+									unset($this->stats[$date][$source]['msg']);
677
+								}
678
+							}
679
+							}
680
+							if ($date != date('Y-m-d')) {
681
+							unset($this->stats[$date]);
682
+							}
683
+						}
684
+						if ($globalDebug) echo 'Done'."\n";
685
+
686
+					}
687
+					$Stats->db = null;
688 688
 				    
689
-				    $this->del();
689
+					$this->del();
690 690
 				} elseif ($globalDebug) echo 'Ignore data'."\n";
691 691
 				//$ignoreImport = false;
692 692
 				$this->all_flights[$id]['addedSpotter'] = 1;
@@ -704,18 +704,18 @@  discard block
 block discarded – undo
704 704
 			*/
705 705
 			//SpotterLive->deleteLiveSpotterDataByIdent($this->all_flights[$id]['ident']);
706 706
 				if ($this->last_delete == 0 || time() - $this->last_delete > 1800) {
707
-				    if ($globalDebug) echo "---- Deleting Live Spotter data older than 9 hours...";
708
-				    //SpotterLive->deleteLiveSpotterDataNotUpdated();
709
-				    $SpotterLive = new SpotterLive($this->db);
710
-				    $SpotterLive->deleteLiveSpotterData();
711
-				    $SpotterLive->db=null;
712
-				    if ($globalDebug) echo " Done\n";
713
-				    $this->last_delete = time();
707
+					if ($globalDebug) echo "---- Deleting Live Spotter data older than 9 hours...";
708
+					//SpotterLive->deleteLiveSpotterDataNotUpdated();
709
+					$SpotterLive = new SpotterLive($this->db);
710
+					$SpotterLive->deleteLiveSpotterData();
711
+					$SpotterLive->db=null;
712
+					if ($globalDebug) echo " Done\n";
713
+					$this->last_delete = time();
714 714
 				}
715
-			    } else {
715
+				} else {
716 716
 				if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt'|| $line['format_source'] === 'planeupdatefaa'  || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson')) {
717
-				    $this->all_flights[$id]['id'] = $recent_ident;
718
-				    $this->all_flights[$id]['addedSpotter'] = 1;
717
+					$this->all_flights[$id]['id'] = $recent_ident;
718
+					$this->all_flights[$id]['addedSpotter'] = 1;
719 719
 				}
720 720
 				if (isset($globalDaemon) && !$globalDaemon) {
721 721
 					$Spotter = new Spotter($this->db);
@@ -723,14 +723,14 @@  discard block
 block discarded – undo
723 723
 					$Spotter->db = null;
724 724
 				}
725 725
 				
726
-			    }
726
+				}
727
+			}
727 728
 			}
728
-		    }
729
-		    //adds the spotter LIVE data
730
-		    //SpotterLive->addLiveSpotterData($flightaware_id, $ident, $aircraft_type, $departure_airport, $arrival_airport, $latitude, $longitude, $waypoints, $altitude, $heading, $groundspeed);
731
-		    //echo "\nAdd in Live !! \n";
732
-		    //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";
733
-		    if ($globalDebug) {
729
+			//adds the spotter LIVE data
730
+			//SpotterLive->addLiveSpotterData($flightaware_id, $ident, $aircraft_type, $departure_airport, $arrival_airport, $latitude, $longitude, $waypoints, $altitude, $heading, $groundspeed);
731
+			//echo "\nAdd in Live !! \n";
732
+			//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";
733
+			if ($globalDebug) {
734 734
 			if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || (isset($globalVAM) && $globalVAM)) {
735 735
 				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";
736 736
 				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";
@@ -738,49 +738,49 @@  discard block
 block discarded – undo
738 738
 				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";
739 739
 				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";
740 740
 			}
741
-		    }
742
-		    $ignoreImport = false;
743
-		    if ($this->all_flights[$id]['departure_airport'] == "") { $this->all_flights[$id]['departure_airport'] = "NA"; }
744
-		    if ($this->all_flights[$id]['arrival_airport'] == "") { $this->all_flights[$id]['arrival_airport'] = "NA"; }
741
+			}
742
+			$ignoreImport = false;
743
+			if ($this->all_flights[$id]['departure_airport'] == "") { $this->all_flights[$id]['departure_airport'] = "NA"; }
744
+			if ($this->all_flights[$id]['arrival_airport'] == "") { $this->all_flights[$id]['arrival_airport'] = "NA"; }
745 745
 
746
-		    foreach($globalAirportIgnore as $airportIgnore) {
747
-		        if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) {
748
-			    $ignoreImport = true;
746
+			foreach($globalAirportIgnore as $airportIgnore) {
747
+				if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) {
748
+				$ignoreImport = true;
749
+			}
749 750
 			}
750
-		    }
751
-		    if (count($globalAirportAccept) > 0) {
752
-		        $ignoreImport = true;
753
-		        foreach($globalAirportIgnore as $airportIgnore) {
754
-			    if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) {
751
+			if (count($globalAirportAccept) > 0) {
752
+				$ignoreImport = true;
753
+				foreach($globalAirportIgnore as $airportIgnore) {
754
+				if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) {
755 755
 				$ignoreImport = false;
756
-			    }
756
+				}
757 757
 			}
758
-		    }
759
-		    if (isset($globalAirlineIgnore) && is_array($globalAirlineIgnore)) {
758
+			}
759
+			if (isset($globalAirlineIgnore) && is_array($globalAirlineIgnore)) {
760 760
 			foreach($globalAirlineIgnore as $airlineIgnore) {
761
-			    if ((is_numeric(substr(substr($this->all_flights[$id]['ident'],0,4),-1,1)) && substr($this->all_flights[$id]['ident'],0,3) == $airlineIgnore) || (is_numeric(substr(substr($this->all_flights[$id]['ident'],0,3),-1,1)) && substr($this->all_flights[$id]['ident'],0,2) == $airlineIgnore)) {
761
+				if ((is_numeric(substr(substr($this->all_flights[$id]['ident'],0,4),-1,1)) && substr($this->all_flights[$id]['ident'],0,3) == $airlineIgnore) || (is_numeric(substr(substr($this->all_flights[$id]['ident'],0,3),-1,1)) && substr($this->all_flights[$id]['ident'],0,2) == $airlineIgnore)) {
762 762
 				$ignoreImport = true;
763
-			    }
763
+				}
764 764
 			}
765
-		    }
766
-		    if (isset($globalAirlineAccept) && count($globalAirlineAccept) > 0) {
765
+			}
766
+			if (isset($globalAirlineAccept) && count($globalAirlineAccept) > 0) {
767 767
 			$ignoreImport = true;
768 768
 			foreach($globalAirlineAccept as $airlineAccept) {
769
-			    if ((is_numeric(substr(substr($this->all_flights[$id]['ident'],0,4),-1,1)) && substr($this->all_flights[$id]['ident'],0,3) == $airlineAccept) || (is_numeric(substr(substr($this->all_flights[$id]['ident'],0,3),-1,1)) && substr($this->all_flights[$id]['ident'],0,2) == $airlineAccept)) {
769
+				if ((is_numeric(substr(substr($this->all_flights[$id]['ident'],0,4),-1,1)) && substr($this->all_flights[$id]['ident'],0,3) == $airlineAccept) || (is_numeric(substr(substr($this->all_flights[$id]['ident'],0,3),-1,1)) && substr($this->all_flights[$id]['ident'],0,2) == $airlineAccept)) {
770 770
 				$ignoreImport = false;
771
-			    }
771
+				}
772 772
 			}
773
-		    }
774
-		    if (isset($globalPilotIdAccept) && count($globalPilotIdAccept) > 0) {
773
+			}
774
+			if (isset($globalPilotIdAccept) && count($globalPilotIdAccept) > 0) {
775 775
 			$ignoreImport = true;
776 776
 			foreach($globalPilotIdAccept as $pilotIdAccept) {
777
-			    if ($this->all_flights[$id]['pilot_id'] == $pilotIdAccept) {
778
-			        $ignoreImport = false;
779
-			    }
777
+				if ($this->all_flights[$id]['pilot_id'] == $pilotIdAccept) {
778
+					$ignoreImport = false;
779
+				}
780
+			}
780 781
 			}
781
-		    }
782 782
 
783
-		    if (!$ignoreImport) {
783
+			if (!$ignoreImport) {
784 784
 			if (!isset($globalDistanceIgnore['latitude']) || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) {
785 785
 				if ($globalDebug) echo "\o/ Add ".$this->all_flights[$id]['ident']." from ".$this->all_flights[$id]['format_source']." in Live DB : ";
786 786
 				$timeelapsed = microtime(true);
@@ -818,7 +818,7 @@  discard block
 block discarded – undo
818 818
 					if ($stats_heading == 16) $stats_heading = 0;
819 819
 					if (!isset($this->stats[$current_date][$source]['polar'][1])) {
820 820
 						for ($i=0;$i<=15;$i++) {
821
-						    $this->stats[$current_date][$source]['polar'][$i] = 0;
821
+							$this->stats[$current_date][$source]['polar'][$i] = 0;
822 822
 						}
823 823
 						$this->stats[$current_date][$source]['polar'][$stats_heading] = $stats_distance;
824 824
 					} else {
@@ -831,11 +831,11 @@  discard block
 block discarded – undo
831 831
 					//var_dump($this->stats);
832 832
 					if (!isset($this->stats[$current_date][$source]['hist'][$distance])) {
833 833
 						if (isset($this->stats[$current_date][$source]['hist'][0])) {
834
-						    end($this->stats[$current_date][$source]['hist']);
835
-						    $mini = key($this->stats[$current_date][$source]['hist'])+10;
834
+							end($this->stats[$current_date][$source]['hist']);
835
+							$mini = key($this->stats[$current_date][$source]['hist'])+10;
836 836
 						} else $mini = 0;
837 837
 						for ($i=$mini;$i<=$distance;$i+=10) {
838
-						    $this->stats[$current_date][$source]['hist'][$i] = 0;
838
+							$this->stats[$current_date][$source]['hist'][$i] = 0;
839 839
 						}
840 840
 						$this->stats[$current_date][$source]['hist'][$distance] = 1;
841 841
 					} else {
@@ -852,22 +852,22 @@  discard block
 block discarded – undo
852 852
 			
853 853
 			
854 854
 			if ($this->last_delete_hourly == 0 || time() - $this->last_delete_hourly > 900) {
855
-			    if ($globalDebug) echo "---- Deleting Live Spotter data Not updated since 2 hour...";
856
-			    $SpotterLive = new SpotterLive($this->db);
857
-			    $SpotterLive->deleteLiveSpotterDataNotUpdated();
858
-			    $SpotterLive->db = null;
859
-			    //SpotterLive->deleteLiveSpotterData();
860
-			    if ($globalDebug) echo " Done\n";
861
-			    $this->last_delete_hourly = time();
855
+				if ($globalDebug) echo "---- Deleting Live Spotter data Not updated since 2 hour...";
856
+				$SpotterLive = new SpotterLive($this->db);
857
+				$SpotterLive->deleteLiveSpotterDataNotUpdated();
858
+				$SpotterLive->db = null;
859
+				//SpotterLive->deleteLiveSpotterData();
860
+				if ($globalDebug) echo " Done\n";
861
+				$this->last_delete_hourly = time();
862 862
 			}
863 863
 			
864
-		    }
865
-		    //$ignoreImport = false;
864
+			}
865
+			//$ignoreImport = false;
866 866
 		}
867 867
 		//if (function_exists('pcntl_fork') && $globalFork) pcntl_signal(SIGCHLD, SIG_IGN);
868 868
 		if ($send) return $this->all_flights[$id];
869
-	    }
869
+		}
870
+	}
870 871
 	}
871
-    }
872 872
 }
873 873
 ?>
Please login to merge, or discard this patch.
require/class.Spotter.php 1 patch
Indentation   +1275 added lines, -1275 removed lines patch added patch discarded remove patch
@@ -13,10 +13,10 @@  discard block
 block discarded – undo
13 13
 	}
14 14
 
15 15
 	/**
16
-	* Get SQL query part for filter used
17
-	* @param Array $filter the filter
18
-	* @return Array the SQL part
19
-	*/
16
+	 * Get SQL query part for filter used
17
+	 * @param Array $filter the filter
18
+	 * @return Array the SQL part
19
+	 */
20 20
 	public function getFilter($filter = array(),$where = false,$and = false) {
21 21
 		global $globalFilter, $globalStatsFilters, $globalFilterName;
22 22
 		$filters = array();
@@ -84,14 +84,14 @@  discard block
 block discarded – undo
84 84
 	}
85 85
 
86 86
 	/**
87
-	* Executes the SQL statements to get the spotter 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 spotter information
93
-	*
94
-	*/
87
+	 * Executes the SQL statements to get the spotter 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 spotter information
93
+	 *
94
+	 */
95 95
 	public function getDataFromDB($query, $params = array(), $limitQuery = '',$schedules = false)
96 96
 	{
97 97
 		global $globalSquawkCountry, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalAirlinesSource, $globalVAM;
@@ -255,11 +255,11 @@  discard block
 block discarded – undo
255 255
 					if ($aircraft_array[0]['aircraft_shadow'] != NULL) {
256 256
 						$temp_array['aircraft_shadow'] = $aircraft_array[0]['aircraft_shadow'];
257 257
 					} else $temp_array['aircraft_shadow'] = 'default.png';
258
-                                } else {
259
-                            		$temp_array['aircraft_shadow'] = 'default.png';
258
+								} else {
259
+									$temp_array['aircraft_shadow'] = 'default.png';
260 260
 					$temp_array['aircraft_name'] = 'N/A';
261 261
 					$temp_array['aircraft_manufacturer'] = 'N/A';
262
-                            	}
262
+								}
263 263
 			}
264 264
 			$fromsource = NULL;
265 265
 			if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource;
@@ -454,11 +454,11 @@  discard block
 block discarded – undo
454 454
 	
455 455
 	
456 456
 	/**
457
-	* Gets all the spotter information
458
-	*
459
-	* @return Array the spotter information
460
-	*
461
-	*/
457
+	 * Gets all the spotter information
458
+	 *
459
+	 * @return Array the spotter information
460
+	 *
461
+	 */
462 462
 	public function searchSpotterData($q = '', $registration = '', $aircraft_icao = '', $aircraft_manufacturer = '', $highlights = '', $airline_icao = '', $airline_country = '', $airline_type = '', $airport = '', $airport_country = '', $callsign = '', $departure_airport_route = '', $arrival_airport_route = '', $owner = '',$pilot_id = '',$pilot_name = '',$altitude = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '',$origLat = '',$origLon = '',$dist = '',$filters = array())
463 463
 	{
464 464
 		global $globalTimezone, $globalDBdriver;
@@ -805,11 +805,11 @@  discard block
 block discarded – undo
805 805
 	
806 806
 	
807 807
 	/**
808
-	* Gets all the spotter information based on the latest data entry
809
-	*
810
-	* @return Array the spotter information
811
-	*
812
-	*/
808
+	 * Gets all the spotter information based on the latest data entry
809
+	 *
810
+	 * @return Array the spotter information
811
+	 *
812
+	 */
813 813
 	public function getLatestSpotterData($limit = '', $sort = '', $filter = array())
814 814
 	{
815 815
 		global $global_query;
@@ -848,12 +848,12 @@  discard block
 block discarded – undo
848 848
 	}
849 849
     
850 850
     
851
-    /**
852
-	* Gets all the spotter information based on a user's latitude and longitude
853
-	*
854
-	* @return Array the spotter information
855
-	*
856
-	*/
851
+	/**
852
+	 * Gets all the spotter information based on a user's latitude and longitude
853
+	 *
854
+	 * @return Array the spotter information
855
+	 *
856
+	 */
857 857
 	public function getLatestSpotterForLayar($lat, $lng, $radius, $interval)
858 858
 	{
859 859
 		date_default_timezone_set('UTC');
@@ -881,7 +881,7 @@  discard block
 block discarded – undo
881 881
 				return false;
882 882
 			}
883 883
 		}
884
-    		$additional_query = '';
884
+			$additional_query = '';
885 885
 		if ($interval != "")
886 886
 		{
887 887
 			if (!is_string($interval))
@@ -921,12 +921,12 @@  discard block
 block discarded – undo
921 921
 	}
922 922
     
923 923
     
924
-    /**
925
-	* Gets all the spotter information sorted by the newest aircraft type
926
-	*
927
-	* @return Array the spotter information
928
-	*
929
-	*/
924
+	/**
925
+	 * Gets all the spotter information sorted by the newest aircraft type
926
+	 *
927
+	 * @return Array the spotter information
928
+	 *
929
+	 */
930 930
 	public function getNewestSpotterDataSortedByAircraftType($limit = '', $sort = '',$filter = array())
931 931
 	{
932 932
 		global $global_query;
@@ -967,11 +967,11 @@  discard block
 block discarded – undo
967 967
     
968 968
     
969 969
 	/**
970
-	* Gets all the spotter information sorted by the newest aircraft registration
971
-	*
972
-	* @return Array the spotter information
973
-	*
974
-	*/
970
+	 * Gets all the spotter information sorted by the newest aircraft registration
971
+	 *
972
+	 * @return Array the spotter information
973
+	 *
974
+	 */
975 975
 	public function getNewestSpotterDataSortedByAircraftRegistration($limit = '', $sort = '', $filter = array())
976 976
 	{
977 977
 		global $global_query;
@@ -1011,11 +1011,11 @@  discard block
 block discarded – undo
1011 1011
 
1012 1012
 
1013 1013
 	/**
1014
-	* Gets all the spotter information sorted by the newest airline
1015
-	*
1016
-	* @return Array the spotter information
1017
-	*
1018
-	*/
1014
+	 * Gets all the spotter information sorted by the newest airline
1015
+	 *
1016
+	 * @return Array the spotter information
1017
+	 *
1018
+	 */
1019 1019
 	public function getNewestSpotterDataSortedByAirline($limit = '', $sort = '',$filter = array())
1020 1020
 	{
1021 1021
 		global $global_query;
@@ -1054,12 +1054,12 @@  discard block
 block discarded – undo
1054 1054
 	}
1055 1055
     
1056 1056
     
1057
-    /**
1058
-	* Gets all the spotter information sorted by the newest departure airport
1059
-	*
1060
-	* @return Array the spotter information
1061
-	*
1062
-	*/
1057
+	/**
1058
+	 * Gets all the spotter information sorted by the newest departure airport
1059
+	 *
1060
+	 * @return Array the spotter information
1061
+	 *
1062
+	 */
1063 1063
 	public function getNewestSpotterDataSortedByDepartureAirport($limit = '', $sort = '', $filter = array())
1064 1064
 	{
1065 1065
 		global $global_query;
@@ -1101,11 +1101,11 @@  discard block
 block discarded – undo
1101 1101
 
1102 1102
 
1103 1103
 	/**
1104
-	* Gets all the spotter information sorted by the newest arrival airport
1105
-	*
1106
-	* @return Array the spotter information
1107
-	*
1108
-	*/
1104
+	 * Gets all the spotter information sorted by the newest arrival airport
1105
+	 *
1106
+	 * @return Array the spotter information
1107
+	 *
1108
+	 */
1109 1109
 	public function getNewestSpotterDataSortedByArrivalAirport($limit = '', $sort = '', $filter = array())
1110 1110
 	{
1111 1111
 		global $global_query;
@@ -1144,11 +1144,11 @@  discard block
 block discarded – undo
1144 1144
 	
1145 1145
 
1146 1146
 	/**
1147
-	* Gets all the spotter information based on the spotter id
1148
-	*
1149
-	* @return Array the spotter information
1150
-	*
1151
-	*/
1147
+	 * Gets all the spotter information based on the spotter id
1148
+	 *
1149
+	 * @return Array the spotter information
1150
+	 *
1151
+	 */
1152 1152
 	public function getSpotterDataByID($id = '')
1153 1153
 	{
1154 1154
 		global $global_query;
@@ -1170,11 +1170,11 @@  discard block
 block discarded – undo
1170 1170
 	
1171 1171
 	
1172 1172
 	/**
1173
-	* Gets all the spotter information based on the callsign
1174
-	*
1175
-	* @return Array the spotter information
1176
-	*
1177
-	*/
1173
+	 * Gets all the spotter information based on the callsign
1174
+	 *
1175
+	 * @return Array the spotter information
1176
+	 *
1177
+	 */
1178 1178
 	public function getSpotterDataByIdent($ident = '', $limit = '', $sort = '')
1179 1179
 	{
1180 1180
 		global $global_query;
@@ -1227,11 +1227,11 @@  discard block
 block discarded – undo
1227 1227
 	
1228 1228
 	
1229 1229
 	/**
1230
-	* Gets all the spotter information based on the aircraft type
1231
-	*
1232
-	* @return Array the spotter information
1233
-	*
1234
-	*/
1230
+	 * Gets all the spotter information based on the aircraft type
1231
+	 *
1232
+	 * @return Array the spotter information
1233
+	 *
1234
+	 */
1235 1235
 	public function getSpotterDataByAircraft($aircraft_type = '', $limit = '', $sort = '', $filter = array())
1236 1236
 	{
1237 1237
 		global $global_query;
@@ -1285,11 +1285,11 @@  discard block
 block discarded – undo
1285 1285
 	
1286 1286
 	
1287 1287
 	/**
1288
-	* Gets all the spotter information based on the aircraft registration
1289
-	*
1290
-	* @return Array the spotter information
1291
-	*
1292
-	*/
1288
+	 * Gets all the spotter information based on the aircraft registration
1289
+	 *
1290
+	 * @return Array the spotter information
1291
+	 *
1292
+	 */
1293 1293
 	public function getSpotterDataByRegistration($registration = '', $limit = '', $sort = '', $filter = array())
1294 1294
 	{
1295 1295
 		global $global_query;
@@ -1346,11 +1346,11 @@  discard block
 block discarded – undo
1346 1346
 	
1347 1347
 	
1348 1348
 	/**
1349
-	* Gets all the spotter information based on the airline
1350
-	*
1351
-	* @return Array the spotter information
1352
-	*
1353
-	*/
1349
+	 * Gets all the spotter information based on the airline
1350
+	 *
1351
+	 * @return Array the spotter information
1352
+	 *
1353
+	 */
1354 1354
 	public function getSpotterDataByAirline($airline = '', $limit = '', $sort = '',$filters = array())
1355 1355
 	{
1356 1356
 		global $global_query;
@@ -1403,11 +1403,11 @@  discard block
 block discarded – undo
1403 1403
 	
1404 1404
 	
1405 1405
 	/**
1406
-	* Gets all the spotter information based on the airport
1407
-	*
1408
-	* @return Array the spotter information
1409
-	*
1410
-	*/
1406
+	 * Gets all the spotter information based on the airport
1407
+	 *
1408
+	 * @return Array the spotter information
1409
+	 *
1410
+	 */
1411 1411
 	public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '',$filters = array())
1412 1412
 	{
1413 1413
 		global $global_query;
@@ -1461,11 +1461,11 @@  discard block
 block discarded – undo
1461 1461
 
1462 1462
 
1463 1463
 	/**
1464
-	* Gets all the spotter information based on the date
1465
-	*
1466
-	* @return Array the spotter information
1467
-	*
1468
-	*/
1464
+	 * Gets all the spotter information based on the date
1465
+	 *
1466
+	 * @return Array the spotter information
1467
+	 *
1468
+	 */
1469 1469
 	public function getSpotterDataByDate($date = '', $limit = '', $sort = '',$filter = array())
1470 1470
 	{
1471 1471
 		global $global_query, $globalTimezone, $globalDBdriver;
@@ -1526,11 +1526,11 @@  discard block
 block discarded – undo
1526 1526
 
1527 1527
 
1528 1528
 	/**
1529
-	* Gets all the spotter information based on the country name
1530
-	*
1531
-	* @return Array the spotter information
1532
-	*
1533
-	*/
1529
+	 * Gets all the spotter information based on the country name
1530
+	 *
1531
+	 * @return Array the spotter information
1532
+	 *
1533
+	 */
1534 1534
 	public function getSpotterDataByCountry($country = '', $limit = '', $sort = '',$filters = array())
1535 1535
 	{
1536 1536
 		global $global_query;
@@ -1584,11 +1584,11 @@  discard block
 block discarded – undo
1584 1584
 	
1585 1585
 	
1586 1586
 	/**
1587
-	* Gets all the spotter information based on the manufacturer name
1588
-	*
1589
-	* @return Array the spotter information
1590
-	*
1591
-	*/
1587
+	 * Gets all the spotter information based on the manufacturer name
1588
+	 *
1589
+	 * @return Array the spotter information
1590
+	 *
1591
+	 */
1592 1592
 	public function getSpotterDataByManufacturer($aircraft_manufacturer = '', $limit = '', $sort = '', $filters = array())
1593 1593
 	{
1594 1594
 		global $global_query;
@@ -1644,13 +1644,13 @@  discard block
 block discarded – undo
1644 1644
   
1645 1645
   
1646 1646
 	/**
1647
-	* Gets a list of all aircraft that take a route
1648
-	*
1649
-	* @param String $departure_airport_icao ICAO code of departure airport
1650
-	* @param String $arrival_airport_icao ICAO code of arrival airport
1651
-	* @return Array the spotter information
1652
-	*
1653
-	*/
1647
+	 * Gets a list of all aircraft that take a route
1648
+	 *
1649
+	 * @param String $departure_airport_icao ICAO code of departure airport
1650
+	 * @param String $arrival_airport_icao ICAO code of arrival airport
1651
+	 * @return Array the spotter information
1652
+	 *
1653
+	 */
1654 1654
 	public function getSpotterDataByRoute($departure_airport_icao = '', $arrival_airport_icao = '', $limit = '', $sort = '', $filters = array())
1655 1655
 	{
1656 1656
 		global $global_query;
@@ -1717,11 +1717,11 @@  discard block
 block discarded – undo
1717 1717
 	
1718 1718
 	
1719 1719
 	/**
1720
-	* Gets all the spotter information based on the special column in the table
1721
-	*
1722
-	* @return Array the spotter information
1723
-	*
1724
-	*/
1720
+	 * Gets all the spotter information based on the special column in the table
1721
+	 *
1722
+	 * @return Array the spotter information
1723
+	 *
1724
+	 */
1725 1725
 	public function getSpotterDataByHighlight($limit = '', $sort = '', $filter = array())
1726 1726
 	{
1727 1727
 		global $global_query;
@@ -1760,11 +1760,11 @@  discard block
 block discarded – undo
1760 1760
 	}
1761 1761
 
1762 1762
 	/**
1763
-	* Gets all the highlight based on a aircraft registration
1764
-	*
1765
-	* @return String the highlight text
1766
-	*
1767
-	*/
1763
+	 * Gets all the highlight based on a aircraft registration
1764
+	 *
1765
+	 * @return String the highlight text
1766
+	 *
1767
+	 */
1768 1768
 	public function getHighlightByRegistration($registration,$filter = array())
1769 1769
 	{
1770 1770
 		global $global_query;
@@ -1786,13 +1786,13 @@  discard block
 block discarded – undo
1786 1786
 
1787 1787
 	
1788 1788
 	/**
1789
-	* Gets the squawk usage from squawk code
1790
-	*
1791
-	* @param String $squawk squawk code
1792
-	* @param String $country country
1793
-	* @return String usage
1794
-	*
1795
-	*/
1789
+	 * Gets the squawk usage from squawk code
1790
+	 *
1791
+	 * @param String $squawk squawk code
1792
+	 * @param String $country country
1793
+	 * @return String usage
1794
+	 *
1795
+	 */
1796 1796
 	public function getSquawkUsage($squawk = '',$country = 'FR')
1797 1797
 	{
1798 1798
 		
@@ -1813,12 +1813,12 @@  discard block
 block discarded – undo
1813 1813
 	}
1814 1814
 
1815 1815
 	/**
1816
-	* Gets the airport icao from the iata
1817
-	*
1818
-	* @param String $airport_iata the iata code of the airport
1819
-	* @return String airport iata
1820
-	*
1821
-	*/
1816
+	 * Gets the airport icao from the iata
1817
+	 *
1818
+	 * @param String $airport_iata the iata code of the airport
1819
+	 * @return String airport iata
1820
+	 *
1821
+	 */
1822 1822
 	public function getAirportIcao($airport_iata = '')
1823 1823
 	{
1824 1824
 		
@@ -1838,14 +1838,14 @@  discard block
 block discarded – undo
1838 1838
 	}
1839 1839
 
1840 1840
 	/**
1841
-	* Gets the airport distance
1842
-	*
1843
-	* @param String $airport_icao the icao code of the airport
1844
-	* @param Float $latitude the latitude
1845
-	* @param Float $longitude the longitude
1846
-	* @return Float distance to the airport
1847
-	*
1848
-	*/
1841
+	 * Gets the airport distance
1842
+	 *
1843
+	 * @param String $airport_icao the icao code of the airport
1844
+	 * @param Float $latitude the latitude
1845
+	 * @param Float $longitude the longitude
1846
+	 * @return Float distance to the airport
1847
+	 *
1848
+	 */
1849 1849
 	public function getAirportDistance($airport_icao,$latitude,$longitude)
1850 1850
 	{
1851 1851
 		
@@ -1866,12 +1866,12 @@  discard block
 block discarded – undo
1866 1866
 	}
1867 1867
 	
1868 1868
 	/**
1869
-	* Gets the airport info based on the icao
1870
-	*
1871
-	* @param String $airport the icao code of the airport
1872
-	* @return Array airport information
1873
-	*
1874
-	*/
1869
+	 * Gets the airport info based on the icao
1870
+	 *
1871
+	 * @param String $airport the icao code of the airport
1872
+	 * @return Array airport information
1873
+	 *
1874
+	 */
1875 1875
 	public function getAllAirportInfo($airport = '')
1876 1876
 	{
1877 1877
 		
@@ -1917,12 +1917,12 @@  discard block
 block discarded – undo
1917 1917
 	}
1918 1918
 	
1919 1919
 	/**
1920
-	* Gets the airport info based on the country
1921
-	*
1922
-	* @param Array $countries Airports countries
1923
-	* @return Array airport information
1924
-	*
1925
-	*/
1920
+	 * Gets the airport info based on the country
1921
+	 *
1922
+	 * @param Array $countries Airports countries
1923
+	 * @return Array airport information
1924
+	 *
1925
+	 */
1926 1926
 	public function getAllAirportInfobyCountry($countries)
1927 1927
 	{
1928 1928
 		$lst_countries = '';
@@ -1960,12 +1960,12 @@  discard block
 block discarded – undo
1960 1960
 	}
1961 1961
 	
1962 1962
 	/**
1963
-	* Gets airports info based on the coord
1964
-	*
1965
-	* @param Array $coord Airports longitude min,latitude min, longitude max, latitude max
1966
-	* @return Array airport information
1967
-	*
1968
-	*/
1963
+	 * Gets airports info based on the coord
1964
+	 *
1965
+	 * @param Array $coord Airports longitude min,latitude min, longitude max, latitude max
1966
+	 * @return Array airport information
1967
+	 *
1968
+	 */
1969 1969
 	public function getAllAirportInfobyCoord($coord)
1970 1970
 	{
1971 1971
 		global $globalDBdriver;
@@ -1996,12 +1996,12 @@  discard block
 block discarded – undo
1996 1996
 	}
1997 1997
 
1998 1998
 	/**
1999
-	* Gets waypoints info based on the coord
2000
-	*
2001
-	* @param Array $coord waypoints coord
2002
-	* @return Array airport information
2003
-	*
2004
-	*/
1999
+	 * Gets waypoints info based on the coord
2000
+	 *
2001
+	 * @param Array $coord waypoints coord
2002
+	 * @return Array airport information
2003
+	 *
2004
+	 */
2005 2005
 	public function getAllWaypointsInfobyCoord($coord)
2006 2006
 	{
2007 2007
 		if (is_array($coord)) {
@@ -2035,12 +2035,12 @@  discard block
 block discarded – undo
2035 2035
 	
2036 2036
 	
2037 2037
 	/**
2038
-	* Gets the airline info based on the icao code or iata code
2039
-	*
2040
-	* @param String $airline_icao the iata code of the airport
2041
-	* @return Array airport information
2042
-	*
2043
-	*/
2038
+	 * Gets the airline info based on the icao code or iata code
2039
+	 *
2040
+	 * @param String $airline_icao the iata code of the airport
2041
+	 * @return Array airport information
2042
+	 *
2043
+	 */
2044 2044
 	public function getAllAirlineInfo($airline_icao, $fromsource = NULL)
2045 2045
 	{
2046 2046
 		global $globalUseRealAirlines;
@@ -2071,7 +2071,7 @@  discard block
 block discarded – undo
2071 2071
 			} else {
2072 2072
 				$sth->execute(array(':airline_icao' => $airline_icao,':fromsource' => $fromsource));
2073 2073
 			}
2074
-                        /*
2074
+						/*
2075 2075
 			$airline_array = array();
2076 2076
 			$temp_array = array();
2077 2077
 		
@@ -2103,12 +2103,12 @@  discard block
 block discarded – undo
2103 2103
 	
2104 2104
 	
2105 2105
 	/**
2106
-	* Gets the aircraft info based on the aircraft type
2107
-	*
2108
-	* @param String $aircraft_type the aircraft type
2109
-	* @return Array aircraft information
2110
-	*
2111
-	*/
2106
+	 * Gets the aircraft info based on the aircraft type
2107
+	 *
2108
+	 * @param String $aircraft_type the aircraft type
2109
+	 * @return Array aircraft information
2110
+	 *
2111
+	 */
2112 2112
 	public function getAllAircraftInfo($aircraft_type)
2113 2113
 	{
2114 2114
 		$aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING);
@@ -2140,12 +2140,12 @@  discard block
 block discarded – undo
2140 2140
 	}
2141 2141
 
2142 2142
 	/**
2143
-	* Gets the aircraft icao based on the aircraft name/type
2144
-	*
2145
-	* @param String $aircraft_type the aircraft type
2146
-	* @return String aircraft information
2147
-	*
2148
-	*/
2143
+	 * Gets the aircraft icao based on the aircraft name/type
2144
+	 *
2145
+	 * @param String $aircraft_type the aircraft type
2146
+	 * @return String aircraft information
2147
+	 *
2148
+	 */
2149 2149
 	public function getAircraftIcao($aircraft_type)
2150 2150
 	{
2151 2151
 		$aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING);
@@ -2170,12 +2170,12 @@  discard block
 block discarded – undo
2170 2170
 	}
2171 2171
 	
2172 2172
 	/**
2173
-	* Gets the aircraft info based on the aircraft ident
2174
-	*
2175
-	* @param String $aircraft_modes the aircraft ident (hex)
2176
-	* @return String aircraft type
2177
-	*
2178
-	*/
2173
+	 * Gets the aircraft info based on the aircraft ident
2174
+	 *
2175
+	 * @param String $aircraft_modes the aircraft ident (hex)
2176
+	 * @return String aircraft type
2177
+	 *
2178
+	 */
2179 2179
 	public function getAllAircraftType($aircraft_modes)
2180 2180
 	{
2181 2181
 		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
@@ -2193,12 +2193,12 @@  discard block
 block discarded – undo
2193 2193
 	}
2194 2194
 
2195 2195
 	/**
2196
-	* Gets correct aircraft operator corde
2197
-	*
2198
-	* @param String $operator the aircraft operator code (callsign)
2199
-	* @return String aircraft operator code
2200
-	*
2201
-	*/
2196
+	 * Gets correct aircraft operator corde
2197
+	 *
2198
+	 * @param String $operator the aircraft operator code (callsign)
2199
+	 * @return String aircraft operator code
2200
+	 *
2201
+	 */
2202 2202
 	public function getOperator($operator)
2203 2203
 	{
2204 2204
 		$operator = filter_var($operator,FILTER_SANITIZE_STRING);
@@ -2215,16 +2215,16 @@  discard block
 block discarded – undo
2215 2215
 	}
2216 2216
 
2217 2217
 	/**
2218
-	* Gets the aircraft route based on the aircraft callsign
2219
-	*
2220
-	* @param String $callsign the aircraft callsign
2221
-	* @return Array aircraft type
2222
-	*
2223
-	*/
2218
+	 * Gets the aircraft route based on the aircraft callsign
2219
+	 *
2220
+	 * @param String $callsign the aircraft callsign
2221
+	 * @return Array aircraft type
2222
+	 *
2223
+	 */
2224 2224
 	public function getRouteInfo($callsign)
2225 2225
 	{
2226 2226
 		$callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
2227
-                if ($callsign == '') return array();
2227
+				if ($callsign == '') return array();
2228 2228
 		$query  = "SELECT routes.Operator_ICAO, routes.FromAirport_ICAO, routes.ToAirport_ICAO, routes.RouteStop, routes.FromAirport_Time, routes.ToAirport_Time FROM routes WHERE CallSign = :callsign LIMIT 1";
2229 2229
 		
2230 2230
 		$sth = $this->db->prepare($query);
@@ -2238,12 +2238,12 @@  discard block
 block discarded – undo
2238 2238
 	}
2239 2239
 	
2240 2240
 	/**
2241
-	* Gets the aircraft info based on the aircraft registration
2242
-	*
2243
-	* @param String $registration the aircraft registration
2244
-	* @return Array aircraft information
2245
-	*
2246
-	*/
2241
+	 * Gets the aircraft info based on the aircraft registration
2242
+	 *
2243
+	 * @param String $registration the aircraft registration
2244
+	 * @return Array aircraft information
2245
+	 *
2246
+	 */
2247 2247
 	public function getAircraftInfoByRegistration($registration)
2248 2248
 	{
2249 2249
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -2270,12 +2270,12 @@  discard block
 block discarded – undo
2270 2270
 	}
2271 2271
 	
2272 2272
 	/**
2273
-	* Gets the aircraft owner & base based on the aircraft registration
2274
-	*
2275
-	* @param String $registration the aircraft registration
2276
-	* @return Array aircraft information
2277
-	*
2278
-	*/
2273
+	 * Gets the aircraft owner & base based on the aircraft registration
2274
+	 *
2275
+	 * @param String $registration the aircraft registration
2276
+	 * @return Array aircraft information
2277
+	 *
2278
+	 */
2279 2279
 	public function getAircraftOwnerByRegistration($registration)
2280 2280
 	{
2281 2281
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -2292,11 +2292,11 @@  discard block
 block discarded – undo
2292 2292
 	
2293 2293
   
2294 2294
   /**
2295
-	* Gets all flights (but with only little info)
2296
-	*
2297
-	* @return Array basic flight information
2298
-	*
2299
-	*/
2295
+   * Gets all flights (but with only little info)
2296
+   *
2297
+   * @return Array basic flight information
2298
+   *
2299
+   */
2300 2300
 	public function getAllFlightsforSitemap()
2301 2301
 	{
2302 2302
 		//$query  = "SELECT spotter_output.spotter_id, spotter_output.ident, spotter_output.airline_name, spotter_output.aircraft_name, spotter_output.aircraft_icao FROM spotter_output ORDER BY LIMIT ";
@@ -2304,7 +2304,7 @@  discard block
 block discarded – undo
2304 2304
 		
2305 2305
 		$sth = $this->db->prepare($query);
2306 2306
 		$sth->execute();
2307
-                  /*
2307
+				  /*
2308 2308
 		$flight_array = array();
2309 2309
 		$temp_array = array();
2310 2310
 		
@@ -2326,11 +2326,11 @@  discard block
 block discarded – undo
2326 2326
 	}
2327 2327
   
2328 2328
 	/**
2329
-	* Gets a list of all aircraft manufacturers
2330
-	*
2331
-	* @return Array list of aircraft types
2332
-	*
2333
-	*/
2329
+	 * Gets a list of all aircraft manufacturers
2330
+	 *
2331
+	 * @return Array list of aircraft types
2332
+	 *
2333
+	 */
2334 2334
 	public function getAllManufacturers()
2335 2335
 	{
2336 2336
 		/*
@@ -2359,11 +2359,11 @@  discard block
 block discarded – undo
2359 2359
   
2360 2360
   
2361 2361
   /**
2362
-	* Gets a list of all aircraft types
2363
-	*
2364
-	* @return Array list of aircraft types
2365
-	*
2366
-	*/
2362
+   * Gets a list of all aircraft types
2363
+   *
2364
+   * @return Array list of aircraft types
2365
+   *
2366
+   */
2367 2367
 	public function getAllAircraftTypes($filters = array())
2368 2368
 	{
2369 2369
 		/*
@@ -2396,11 +2396,11 @@  discard block
 block discarded – undo
2396 2396
 	
2397 2397
 	
2398 2398
 	/**
2399
-	* Gets a list of all aircraft registrations
2400
-	*
2401
-	* @return Array list of aircraft registrations
2402
-	*
2403
-	*/
2399
+	 * Gets a list of all aircraft registrations
2400
+	 *
2401
+	 * @return Array list of aircraft registrations
2402
+	 *
2403
+	 */
2404 2404
 	public function getAllAircraftRegistrations($filters = array())
2405 2405
 	{
2406 2406
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2425,12 +2425,12 @@  discard block
 block discarded – undo
2425 2425
 	}
2426 2426
 
2427 2427
 	/**
2428
-	* Gets all source name
2429
-	*
2430
-	* @param String type format of source
2431
-	* @return Array list of source name
2432
-	*
2433
-	*/
2428
+	 * Gets all source name
2429
+	 *
2430
+	 * @param String type format of source
2431
+	 * @return Array list of source name
2432
+	 *
2433
+	 */
2434 2434
 	public function getAllSourceName($type = '',$filters = array())
2435 2435
 	{
2436 2436
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2461,11 +2461,11 @@  discard block
 block discarded – undo
2461 2461
 
2462 2462
 
2463 2463
 	/**
2464
-	* Gets a list of all airline names
2465
-	*
2466
-	* @return Array list of airline names
2467
-	*
2468
-	*/
2464
+	 * Gets a list of all airline names
2465
+	 *
2466
+	 * @return Array list of airline names
2467
+	 *
2468
+	 */
2469 2469
 	public function getAllAirlineNames($airline_type = '',$forsource = NULL,$filters = array())
2470 2470
 	{
2471 2471
 		global $globalAirlinesSource,$globalVATSIM, $globalIVAO;
@@ -2515,11 +2515,11 @@  discard block
 block discarded – undo
2515 2515
 	
2516 2516
 	
2517 2517
 	/**
2518
-	* Gets a list of all airline countries
2519
-	*
2520
-	* @return Array list of airline countries
2521
-	*
2522
-	*/
2518
+	 * Gets a list of all airline countries
2519
+	 *
2520
+	 * @return Array list of airline countries
2521
+	 *
2522
+	 */
2523 2523
 	public function getAllAirlineCountries($filters = array())
2524 2524
 	{
2525 2525
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2547,11 +2547,11 @@  discard block
 block discarded – undo
2547 2547
 	
2548 2548
 	
2549 2549
 	/**
2550
-	* Gets a list of all departure & arrival names
2551
-	*
2552
-	* @return Array list of airport names
2553
-	*
2554
-	*/
2550
+	 * Gets a list of all departure & arrival names
2551
+	 *
2552
+	 * @return Array list of airport names
2553
+	 *
2554
+	 */
2555 2555
 	public function getAllAirportNames($filters = array())
2556 2556
 	{
2557 2557
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2600,11 +2600,11 @@  discard block
 block discarded – undo
2600 2600
 	
2601 2601
 	
2602 2602
 	/**
2603
-	* Gets a list of all departure & arrival airport countries
2604
-	*
2605
-	* @return Array list of airport countries
2606
-	*
2607
-	*/
2603
+	 * Gets a list of all departure & arrival airport countries
2604
+	 *
2605
+	 * @return Array list of airport countries
2606
+	 *
2607
+	 */
2608 2608
 	public function getAllAirportCountries($filters = array())
2609 2609
 	{
2610 2610
 		$airport_array = array();
@@ -2652,11 +2652,11 @@  discard block
 block discarded – undo
2652 2652
 	
2653 2653
 	
2654 2654
 	/**
2655
-	* Gets a list of all countries (airline, departure airport & arrival airport)
2656
-	*
2657
-	* @return Array list of countries
2658
-	*
2659
-	*/
2655
+	 * Gets a list of all countries (airline, departure airport & arrival airport)
2656
+	 *
2657
+	 * @return Array list of countries
2658
+	 *
2659
+	 */
2660 2660
 	public function getAllCountries($filters = array())
2661 2661
 	{
2662 2662
 		$Connection= new Connection($this->db);
@@ -2733,11 +2733,11 @@  discard block
 block discarded – undo
2733 2733
 	
2734 2734
 	
2735 2735
 	/**
2736
-	* Gets a list of all idents/callsigns
2737
-	*
2738
-	* @return Array list of ident/callsign names
2739
-	*
2740
-	*/
2736
+	 * Gets a list of all idents/callsigns
2737
+	 *
2738
+	 * @return Array list of ident/callsign names
2739
+	 *
2740
+	 */
2741 2741
 	public function getAllIdents($filters = array())
2742 2742
 	{
2743 2743
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2761,9 +2761,9 @@  discard block
 block discarded – undo
2761 2761
 	}
2762 2762
 
2763 2763
 	/**
2764
-	* Get a list of flights from airport since 7 days
2765
-	* @return Array number, icao, name and city of airports
2766
-	*/
2764
+	 * Get a list of flights from airport since 7 days
2765
+	 * @return Array number, icao, name and city of airports
2766
+	 */
2767 2767
 
2768 2768
 	public function getLast7DaysAirportsDeparture($airport_icao = '',$filters = array()) {
2769 2769
 		global $globalTimezone, $globalDBdriver;
@@ -2794,9 +2794,9 @@  discard block
 block discarded – undo
2794 2794
 	}
2795 2795
 
2796 2796
 	/**
2797
-	* Get a list of flights from airport since 7 days
2798
-	* @return Array number, icao, name and city of airports
2799
-	*/
2797
+	 * Get a list of flights from airport since 7 days
2798
+	 * @return Array number, icao, name and city of airports
2799
+	 */
2800 2800
 
2801 2801
 	public function getLast7DaysAirportsDepartureByAirlines($airport_icao = '') {
2802 2802
 		global $globalTimezone, $globalDBdriver;
@@ -2826,9 +2826,9 @@  discard block
 block discarded – undo
2826 2826
 	}
2827 2827
 
2828 2828
 	/**
2829
-	* Get a list of flights from detected airport since 7 days
2830
-	* @return Array number, icao, name and city of airports
2831
-	*/
2829
+	 * Get a list of flights from detected airport since 7 days
2830
+	 * @return Array number, icao, name and city of airports
2831
+	 */
2832 2832
 
2833 2833
 	public function getLast7DaysDetectedAirportsDeparture($airport_icao = '', $filters = array()) {
2834 2834
 		global $globalTimezone, $globalDBdriver;
@@ -2866,9 +2866,9 @@  discard block
 block discarded – undo
2866 2866
 	}
2867 2867
 
2868 2868
 	/**
2869
-	* Get a list of flights from detected airport since 7 days
2870
-	* @return Array number, icao, name and city of airports
2871
-	*/
2869
+	 * Get a list of flights from detected airport since 7 days
2870
+	 * @return Array number, icao, name and city of airports
2871
+	 */
2872 2872
 
2873 2873
 	public function getLast7DaysDetectedAirportsDepartureByAirlines($airport_icao = '') {
2874 2874
 		global $globalTimezone, $globalDBdriver;
@@ -2910,9 +2910,9 @@  discard block
 block discarded – undo
2910 2910
 
2911 2911
 
2912 2912
 	/**
2913
-	* Get a list of flights to airport since 7 days
2914
-	* @return Array number, icao, name and city of airports
2915
-	*/
2913
+	 * Get a list of flights to airport since 7 days
2914
+	 * @return Array number, icao, name and city of airports
2915
+	 */
2916 2916
 
2917 2917
 	public function getLast7DaysAirportsArrival($airport_icao = '', $filters = array()) {
2918 2918
 		global $globalTimezone, $globalDBdriver;
@@ -2945,9 +2945,9 @@  discard block
 block discarded – undo
2945 2945
 
2946 2946
 
2947 2947
 	/**
2948
-	* Get a list of flights detected to airport since 7 days
2949
-	* @return Array number, icao, name and city of airports
2950
-	*/
2948
+	 * Get a list of flights detected to airport since 7 days
2949
+	 * @return Array number, icao, name and city of airports
2950
+	 */
2951 2951
 
2952 2952
 	public function getLast7DaysDetectedAirportsArrival($airport_icao = '',$filters = array()) {
2953 2953
 		global $globalTimezone, $globalDBdriver;
@@ -2988,9 +2988,9 @@  discard block
 block discarded – undo
2988 2988
 
2989 2989
 
2990 2990
 	/**
2991
-	* Get a list of flights to airport since 7 days
2992
-	* @return Array number, icao, name and city of airports
2993
-	*/
2991
+	 * Get a list of flights to airport since 7 days
2992
+	 * @return Array number, icao, name and city of airports
2993
+	 */
2994 2994
 
2995 2995
 	public function getLast7DaysAirportsArrivalByAirlines($airport_icao = '') {
2996 2996
 		global $globalTimezone, $globalDBdriver;
@@ -3022,9 +3022,9 @@  discard block
 block discarded – undo
3022 3022
 
3023 3023
 
3024 3024
 	/**
3025
-	* Get a list of flights detected to airport since 7 days
3026
-	* @return Array number, icao, name and city of airports
3027
-	*/
3025
+	 * Get a list of flights detected to airport since 7 days
3026
+	 * @return Array number, icao, name and city of airports
3027
+	 */
3028 3028
 
3029 3029
 	public function getLast7DaysDetectedAirportsArrivalByAirlines($airport_icao = '') {
3030 3030
 		global $globalTimezone, $globalDBdriver;
@@ -3068,11 +3068,11 @@  discard block
 block discarded – undo
3068 3068
 
3069 3069
 
3070 3070
 	/**
3071
-	* Gets a list of all dates
3072
-	*
3073
-	* @return Array list of date names
3074
-	*
3075
-	*/
3071
+	 * Gets a list of all dates
3072
+	 *
3073
+	 * @return Array list of date names
3074
+	 *
3075
+	 */
3076 3076
 	public function getAllDates()
3077 3077
 	{
3078 3078
 		global $globalTimezone, $globalDBdriver;
@@ -3113,11 +3113,11 @@  discard block
 block discarded – undo
3113 3113
 	
3114 3114
 	
3115 3115
 	/**
3116
-	* Gets all route combinations
3117
-	*
3118
-	* @return Array the route list
3119
-	*
3120
-	*/
3116
+	 * Gets all route combinations
3117
+	 *
3118
+	 * @return Array the route list
3119
+	 *
3120
+	 */
3121 3121
 	public function getAllRoutes()
3122 3122
 	{
3123 3123
 		$query  = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route,  spotter_output.departure_airport_icao, spotter_output.arrival_airport_icao 
@@ -3143,13 +3143,13 @@  discard block
 block discarded – undo
3143 3143
 	}
3144 3144
 
3145 3145
 	/**
3146
-	* Update ident spotter data
3147
-	*
3148
-	* @param String $flightaware_id the ID from flightaware
3149
-	* @param String $ident the flight ident
3150
-	* @return String success or false
3151
-	*
3152
-	*/	
3146
+	 * Update ident spotter data
3147
+	 *
3148
+	 * @param String $flightaware_id the ID from flightaware
3149
+	 * @param String $ident the flight ident
3150
+	 * @return String success or false
3151
+	 *
3152
+	 */	
3153 3153
 	public function updateIdentSpotterData($flightaware_id = '', $ident = '',$fromsource = NULL)
3154 3154
 	{
3155 3155
 		if (!is_numeric(substr($ident, 0, 3)))
@@ -3170,14 +3170,14 @@  discard block
 block discarded – undo
3170 3170
 		} else {
3171 3171
 			$airline_array = $this->getAllAirlineInfo("NA");
3172 3172
 		}
3173
-                $airline_name = $airline_array[0]['name'];
3174
-                $airline_icao = $airline_array[0]['icao'];
3175
-                $airline_country = $airline_array[0]['country'];
3176
-                $airline_type = $airline_array[0]['type'];
3173
+				$airline_name = $airline_array[0]['name'];
3174
+				$airline_icao = $airline_array[0]['icao'];
3175
+				$airline_country = $airline_array[0]['country'];
3176
+				$airline_type = $airline_array[0]['type'];
3177 3177
 
3178 3178
 
3179 3179
 		$query = 'UPDATE spotter_output SET ident = :ident, airline_name = :airline_name, airline_icao = :airline_icao, airline_country = :airline_country, airline_type = :airline_type WHERE flightaware_id = :flightaware_id';
3180
-                $query_values = array(':flightaware_id' => $flightaware_id,':ident' => $ident,':airline_name' => $airline_name,':airline_icao' => $airline_icao,':airline_country' => $airline_country,':airline_type' => $airline_type);
3180
+				$query_values = array(':flightaware_id' => $flightaware_id,':ident' => $ident,':airline_name' => $airline_name,':airline_icao' => $airline_icao,':airline_country' => $airline_country,':airline_type' => $airline_type);
3181 3181
 
3182 3182
 		try {
3183 3183
 			$sth = $this->db->prepare($query);
@@ -3190,19 +3190,19 @@  discard block
 block discarded – undo
3190 3190
 
3191 3191
 	}
3192 3192
 	/**
3193
-	* Update latest spotter data
3194
-	*
3195
-	* @param String $flightaware_id the ID from flightaware
3196
-	* @param String $ident the flight ident
3197
-	* @param String $arrival_airport_icao the arrival airport
3198
-	* @return String success or false
3199
-	*
3200
-	*/	
3193
+	 * Update latest spotter data
3194
+	 *
3195
+	 * @param String $flightaware_id the ID from flightaware
3196
+	 * @param String $ident the flight ident
3197
+	 * @param String $arrival_airport_icao the arrival airport
3198
+	 * @return String success or false
3199
+	 *
3200
+	 */	
3201 3201
 	public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '',$arrival_airport_time = '')
3202 3202
 	{
3203 3203
 		if ($groundspeed == '') $groundspeed = NULL;
3204 3204
 		$query = 'UPDATE spotter_output SET ident = :ident, last_latitude = :last_latitude, last_longitude = :last_longitude, last_altitude = :last_altitude, last_ground = :last_ground, last_seen = :last_seen, real_arrival_airport_icao = :real_arrival_airport_icao, real_arrival_airport_time = :real_arrival_airport_time, last_ground_speed = :last_ground_speed WHERE flightaware_id = :flightaware_id';
3205
-                $query_values = array(':flightaware_id' => $flightaware_id,':real_arrival_airport_icao' => $arrival_airport_icao,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_altitude' => $altitude,':last_ground_speed' => $groundspeed,':last_seen' => $date,':real_arrival_airport_time' => $arrival_airport_time, ':last_ground' => $ground, ':ident' => $ident);
3205
+				$query_values = array(':flightaware_id' => $flightaware_id,':real_arrival_airport_icao' => $arrival_airport_icao,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_altitude' => $altitude,':last_ground_speed' => $groundspeed,':last_seen' => $date,':real_arrival_airport_time' => $arrival_airport_time, ':last_ground' => $ground, ':ident' => $ident);
3206 3206
 
3207 3207
 		try {
3208 3208
 			$sth = $this->db->prepare($query);
@@ -3216,32 +3216,32 @@  discard block
 block discarded – undo
3216 3216
 	}
3217 3217
 
3218 3218
 	/**
3219
-	* Adds a new spotter data
3220
-	*
3221
-	* @param String $flightaware_id the ID from flightaware
3222
-	* @param String $ident the flight ident
3223
-	* @param String $aircraft_icao the aircraft type
3224
-	* @param String $departure_airport_icao the departure airport
3225
-	* @param String $arrival_airport_icao the arrival airport
3226
-	* @param String $latitude latitude of flight
3227
-	* @param String $longitude latitude of flight
3228
-	* @param String $waypoints waypoints of flight
3229
-	* @param String $altitude altitude of flight
3230
-	* @param String $heading heading of flight
3231
-	* @param String $groundspeed speed of flight
3232
-	* @param String $date date of flight
3233
-	* @param String $departure_airport_time departure time of flight
3234
-	* @param String $arrival_airport_time arrival time of flight
3235
-	* @param String $squawk squawk code of flight
3236
-	* @param String $route_stop route stop of flight
3237
-	* @param String $highlight highlight or not
3238
-	* @param String $ModeS ModesS code of flight
3239
-	* @param String $registration registration code of flight
3240
-	* @param String $pilot_id pilot id of flight (for virtual airlines)
3241
-	* @param String $pilot_name pilot name of flight (for virtual airlines)
3242
-	* @param String $verticalrate vertival rate of flight
3243
-	* @return String success or false
3244
-	*/
3219
+	 * Adds a new spotter data
3220
+	 *
3221
+	 * @param String $flightaware_id the ID from flightaware
3222
+	 * @param String $ident the flight ident
3223
+	 * @param String $aircraft_icao the aircraft type
3224
+	 * @param String $departure_airport_icao the departure airport
3225
+	 * @param String $arrival_airport_icao the arrival airport
3226
+	 * @param String $latitude latitude of flight
3227
+	 * @param String $longitude latitude of flight
3228
+	 * @param String $waypoints waypoints of flight
3229
+	 * @param String $altitude altitude of flight
3230
+	 * @param String $heading heading of flight
3231
+	 * @param String $groundspeed speed of flight
3232
+	 * @param String $date date of flight
3233
+	 * @param String $departure_airport_time departure time of flight
3234
+	 * @param String $arrival_airport_time arrival time of flight
3235
+	 * @param String $squawk squawk code of flight
3236
+	 * @param String $route_stop route stop of flight
3237
+	 * @param String $highlight highlight or not
3238
+	 * @param String $ModeS ModesS code of flight
3239
+	 * @param String $registration registration code of flight
3240
+	 * @param String $pilot_id pilot id of flight (for virtual airlines)
3241
+	 * @param String $pilot_name pilot name of flight (for virtual airlines)
3242
+	 * @param String $verticalrate vertival rate of flight
3243
+	 * @return String success or false
3244
+	 */
3245 3245
 	public function addSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $departure_airport_time = '', $arrival_airport_time = '',$squawk = '', $route_stop = '', $highlight = '', $ModeS = '', $registration = '',$pilot_id = '', $pilot_name = '', $verticalrate = '', $ground = false,$format_source = '', $source_name = '')
3246 3246
 	{
3247 3247
 		global $globalURL, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalDebugTimeElapsed, $globalAirlinesSource, $globalVAM;
@@ -3455,8 +3455,8 @@  discard block
 block discarded – undo
3455 3455
     
3456 3456
 		if ($globalIVAO && $aircraft_icao != '')
3457 3457
 		{
3458
-            		if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao'];
3459
-            		else $airline_icao = '';
3458
+					if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao'];
3459
+					else $airline_icao = '';
3460 3460
 			$image_array = $Image->getSpotterImage('',$aircraft_icao,$airline_icao);
3461 3461
 			if (!isset($image_array[0]['registration']))
3462 3462
 			{
@@ -3487,52 +3487,52 @@  discard block
 block discarded – undo
3487 3487
 	
3488 3488
 		if (count($airline_array) == 0) 
3489 3489
 		{
3490
-                        $airline_array = $this->getAllAirlineInfo('NA');
3491
-                }
3492
-                if (count($aircraft_array) == 0) 
3493
-                {
3494
-                        $aircraft_array = $this->getAllAircraftInfo('NA');
3495
-                }
3496
-                if (count($departure_airport_array) == 0) 
3497
-                {
3498
-                        $departure_airport_array = $this->getAllAirportInfo('NA');
3499
-                }
3500
-                if (count($arrival_airport_array) == 0) 
3501
-                {
3502
-                        $arrival_airport_array = $this->getAllAirportInfo('NA');
3503
-                }
3504
-                if ($registration == '') $registration = 'NA';
3505
-                if ($latitude == '' && $longitude == '') {
3506
-            		$latitude = 0;
3507
-            		$longitude = 0;
3508
-            	}
3509
-                if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL;
3510
-                if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL;
3511
-                if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
3512
-                if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
3513
-                if (!isset($aircraft_owner)) $aircraft_owner = NULL;
3514
-                $query  = "INSERT INTO spotter_output (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, latitude, longitude, waypoints, altitude, heading, ground_speed, date, departure_airport_time, arrival_airport_time, squawk, route_stop,highlight,ModeS, pilot_id, pilot_name, verticalrate, owner_name, ground, format_source, source_name) 
3490
+						$airline_array = $this->getAllAirlineInfo('NA');
3491
+				}
3492
+				if (count($aircraft_array) == 0) 
3493
+				{
3494
+						$aircraft_array = $this->getAllAircraftInfo('NA');
3495
+				}
3496
+				if (count($departure_airport_array) == 0) 
3497
+				{
3498
+						$departure_airport_array = $this->getAllAirportInfo('NA');
3499
+				}
3500
+				if (count($arrival_airport_array) == 0) 
3501
+				{
3502
+						$arrival_airport_array = $this->getAllAirportInfo('NA');
3503
+				}
3504
+				if ($registration == '') $registration = 'NA';
3505
+				if ($latitude == '' && $longitude == '') {
3506
+					$latitude = 0;
3507
+					$longitude = 0;
3508
+				}
3509
+				if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL;
3510
+				if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL;
3511
+				if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
3512
+				if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
3513
+				if (!isset($aircraft_owner)) $aircraft_owner = NULL;
3514
+				$query  = "INSERT INTO spotter_output (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, latitude, longitude, waypoints, altitude, heading, ground_speed, date, departure_airport_time, arrival_airport_time, squawk, route_stop,highlight,ModeS, pilot_id, pilot_name, verticalrate, owner_name, ground, format_source, source_name) 
3515 3515
                 VALUES (:flightaware_id,:ident,:registration,:airline_name,:airline_icao,:airline_country,:airline_type,:aircraft_icao,:aircraft_type,:aircraft_manufacturer,:departure_airport_icao,:departure_airport_name,:departure_airport_city,:departure_airport_country, :arrival_airport_icao, :arrival_airport_name, :arrival_airport_city, :arrival_airport_country, :latitude,:longitude,:waypoints,:altitude,:heading,:groundspeed,:date, :departure_airport_time, :arrival_airport_time, :squawk, :route_stop, :highlight, :ModeS, :pilot_id, :pilot_name, :verticalrate, :owner_name,:ground, :format_source, :source_name)";
3516 3516
 
3517
-                $airline_name = $airline_array[0]['name'];
3518
-                $airline_icao = $airline_array[0]['icao'];
3519
-                $airline_country = $airline_array[0]['country'];
3520
-                $airline_type = $airline_array[0]['type'];
3517
+				$airline_name = $airline_array[0]['name'];
3518
+				$airline_icao = $airline_array[0]['icao'];
3519
+				$airline_country = $airline_array[0]['country'];
3520
+				$airline_type = $airline_array[0]['type'];
3521 3521
 		if ($airline_type == '') {
3522 3522
 			$timeelapsed = microtime(true);
3523 3523
 			$airline_type = $this->getAircraftTypeBymodeS($ModeS);
3524 3524
 			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3525 3525
 		}
3526 3526
 		if ($airline_type == null) $airline_type = '';
3527
-                $aircraft_type = $aircraft_array[0]['type'];
3528
-                $aircraft_manufacturer = $aircraft_array[0]['manufacturer'];
3529
-                $departure_airport_name = $departure_airport_array[0]['name'];
3530
-                $departure_airport_city = $departure_airport_array[0]['city'];
3531
-                $departure_airport_country = $departure_airport_array[0]['country'];
3532
-                $arrival_airport_name = $arrival_airport_array[0]['name'];
3533
-                $arrival_airport_city = $arrival_airport_array[0]['city'];
3534
-                $arrival_airport_country = $arrival_airport_array[0]['country'];
3535
-                $query_values = array(':flightaware_id' => $flightaware_id,':ident' => $ident, ':registration' => $registration,':airline_name' => $airline_name,':airline_icao' => $airline_icao,':airline_country' => $airline_country,':airline_type' => $airline_type,':aircraft_icao' => $aircraft_icao,':aircraft_type' => $aircraft_type,':aircraft_manufacturer' => $aircraft_manufacturer,':departure_airport_icao' => $departure_airport_icao,':departure_airport_name' => $departure_airport_name,':departure_airport_city' => $departure_airport_city,':departure_airport_country' => $departure_airport_country,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_name' => $arrival_airport_name,':arrival_airport_city' => $arrival_airport_city,':arrival_airport_country' => $arrival_airport_country,':latitude' => $latitude,':longitude' => $longitude, ':waypoints' => $waypoints,':altitude' => $altitude,':heading' => $heading,':groundspeed' => $groundspeed,':date' => $date,':departure_airport_time' => $departure_airport_time,':arrival_airport_time' => $arrival_airport_time, ':squawk' => $squawk, ':route_stop' => $route_stop, ':highlight' => $highlight, ':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':owner_name' => $aircraft_owner, ':format_source' => $format_source, ':ground' => $ground, ':source_name' => $source_name);
3527
+				$aircraft_type = $aircraft_array[0]['type'];
3528
+				$aircraft_manufacturer = $aircraft_array[0]['manufacturer'];
3529
+				$departure_airport_name = $departure_airport_array[0]['name'];
3530
+				$departure_airport_city = $departure_airport_array[0]['city'];
3531
+				$departure_airport_country = $departure_airport_array[0]['country'];
3532
+				$arrival_airport_name = $arrival_airport_array[0]['name'];
3533
+				$arrival_airport_city = $arrival_airport_array[0]['city'];
3534
+				$arrival_airport_country = $arrival_airport_array[0]['country'];
3535
+				$query_values = array(':flightaware_id' => $flightaware_id,':ident' => $ident, ':registration' => $registration,':airline_name' => $airline_name,':airline_icao' => $airline_icao,':airline_country' => $airline_country,':airline_type' => $airline_type,':aircraft_icao' => $aircraft_icao,':aircraft_type' => $aircraft_type,':aircraft_manufacturer' => $aircraft_manufacturer,':departure_airport_icao' => $departure_airport_icao,':departure_airport_name' => $departure_airport_name,':departure_airport_city' => $departure_airport_city,':departure_airport_country' => $departure_airport_country,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_name' => $arrival_airport_name,':arrival_airport_city' => $arrival_airport_city,':arrival_airport_country' => $arrival_airport_country,':latitude' => $latitude,':longitude' => $longitude, ':waypoints' => $waypoints,':altitude' => $altitude,':heading' => $heading,':groundspeed' => $groundspeed,':date' => $date,':departure_airport_time' => $departure_airport_time,':arrival_airport_time' => $arrival_airport_time, ':squawk' => $squawk, ':route_stop' => $route_stop, ':highlight' => $highlight, ':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':owner_name' => $aircraft_owner, ':format_source' => $format_source, ':ground' => $ground, ':source_name' => $source_name);
3536 3536
 
3537 3537
 		try {
3538 3538
 		        
@@ -3540,7 +3540,7 @@  discard block
 block discarded – undo
3540 3540
 			$sth->execute($query_values);
3541 3541
 			$this->db = null;
3542 3542
 		} catch (PDOException $e) {
3543
-		    return "error : ".$e->getMessage();
3543
+			return "error : ".$e->getMessage();
3544 3544
 		}
3545 3545
 		
3546 3546
 		return "success";
@@ -3549,11 +3549,11 @@  discard block
 block discarded – undo
3549 3549
 	
3550 3550
   
3551 3551
 	/**
3552
-	* Gets the aircraft ident within the last hour
3553
-	*
3554
-	* @return String the ident
3555
-	*
3556
-	*/
3552
+	 * Gets the aircraft ident within the last hour
3553
+	 *
3554
+	 * @return String the ident
3555
+	 *
3556
+	 */
3557 3557
 	public function getIdentFromLastHour($ident)
3558 3558
 	{
3559 3559
 		global $globalDBdriver, $globalTimezone;
@@ -3569,11 +3569,11 @@  discard block
 block discarded – undo
3569 3569
 								AND spotter_output.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS'
3570 3570
 								AND spotter_output.date < now() AT TIME ZONE 'UTC'";
3571 3571
 			$query_data = array(':ident' => $ident);
3572
-    		}
3572
+			}
3573 3573
 		
3574 3574
 		$sth = $this->db->prepare($query);
3575 3575
 		$sth->execute($query_data);
3576
-    		$ident_result='';
3576
+			$ident_result='';
3577 3577
 		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3578 3578
 		{
3579 3579
 			$ident_result = $row['ident'];
@@ -3584,11 +3584,11 @@  discard block
 block discarded – undo
3584 3584
 	
3585 3585
 	
3586 3586
 	/**
3587
-	* Gets the aircraft data from the last 20 seconds
3588
-	*
3589
-	* @return Array the spotter data
3590
-	*
3591
-	*/
3587
+	 * Gets the aircraft data from the last 20 seconds
3588
+	 *
3589
+	 * @return Array the spotter data
3590
+	 *
3591
+	 */
3592 3592
 	public function getRealTimeData($q = '')
3593 3593
 	{
3594 3594
 		global $globalDBdriver;
@@ -3632,11 +3632,11 @@  discard block
 block discarded – undo
3632 3632
 	
3633 3633
 	
3634 3634
 	 /**
3635
-	* Gets all airlines that have flown over
3636
-	*
3637
-	* @return Array the airline list
3638
-	*
3639
-	*/
3635
+	  * Gets all airlines that have flown over
3636
+	  *
3637
+	  * @return Array the airline list
3638
+	  *
3639
+	  */
3640 3640
 	public function countAllAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
3641 3641
 	{
3642 3642
 		global $globalDBdriver;
@@ -3650,7 +3650,7 @@  discard block
 block discarded – undo
3650 3650
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
3651 3651
 			}
3652 3652
 		}
3653
-                if ($sincedate != '') {
3653
+				if ($sincedate != '') {
3654 3654
 			if ($globalDBdriver == 'mysql') {
3655 3655
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
3656 3656
 			} else {
@@ -3677,26 +3677,26 @@  discard block
 block discarded – undo
3677 3677
 	}
3678 3678
 
3679 3679
 	 /**
3680
-	* Gets all pilots that have flown over
3681
-	*
3682
-	* @return Array the pilots list
3683
-	*
3684
-	*/
3680
+	  * Gets all pilots that have flown over
3681
+	  *
3682
+	  * @return Array the pilots list
3683
+	  *
3684
+	  */
3685 3685
 	public function countAllPilots($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
3686 3686
 	{
3687 3687
 		global $globalDBdriver;
3688 3688
 		$filter_query = $this->getFilter($filters,true,true);
3689 3689
 		$query  = "SELECT DISTINCT spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count, spotter_output.format_source
3690 3690
 		 			FROM spotter_output".$filter_query." spotter_output.pilot_id <> '' ";
3691
-                if ($olderthanmonths > 0) {
3692
-            		if ($globalDBdriver == 'mysql') {
3691
+				if ($olderthanmonths > 0) {
3692
+					if ($globalDBdriver == 'mysql') {
3693 3693
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
3694 3694
 			} else {
3695 3695
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
3696 3696
 			}
3697 3697
 		}
3698
-                if ($sincedate != '') {
3699
-            		if ($globalDBdriver == 'mysql') {
3698
+				if ($sincedate != '') {
3699
+					if ($globalDBdriver == 'mysql') {
3700 3700
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
3701 3701
 			} else {
3702 3702
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -3724,25 +3724,25 @@  discard block
 block discarded – undo
3724 3724
 	}
3725 3725
 	
3726 3726
 		 /**
3727
-	* Gets all pilots that have flown over
3728
-	*
3729
-	* @return Array the pilots list
3730
-	*
3731
-	*/
3727
+		  * Gets all pilots that have flown over
3728
+		  *
3729
+		  * @return Array the pilots list
3730
+		  *
3731
+		  */
3732 3732
 	public function countAllPilotsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '')
3733 3733
 	{
3734 3734
 		global $globalDBdriver;
3735 3735
 		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count, spotter_output.format_source
3736 3736
 		 			FROM spotter_output WHERE spotter_output.pilot_id <> '' ";
3737
-                if ($olderthanmonths > 0) {
3738
-            		if ($globalDBdriver == 'mysql') {
3737
+				if ($olderthanmonths > 0) {
3738
+					if ($globalDBdriver == 'mysql') {
3739 3739
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
3740 3740
 			} else {
3741 3741
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
3742 3742
 			}
3743 3743
 		}
3744
-                if ($sincedate != '') {
3745
-            		if ($globalDBdriver == 'mysql') {
3744
+				if ($sincedate != '') {
3745
+					if ($globalDBdriver == 'mysql') {
3746 3746
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
3747 3747
 			} else {
3748 3748
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -3771,26 +3771,26 @@  discard block
 block discarded – undo
3771 3771
 	}
3772 3772
 	
3773 3773
 	 /**
3774
-	* Gets all owner that have flown over
3775
-	*
3776
-	* @return Array the pilots list
3777
-	*
3778
-	*/
3774
+	  * Gets all owner that have flown over
3775
+	  *
3776
+	  * @return Array the pilots list
3777
+	  *
3778
+	  */
3779 3779
 	public function countAllOwners($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
3780 3780
 	{
3781 3781
 		global $globalDBdriver;
3782 3782
 		$filter_query = $this->getFilter($filters,true,true);
3783 3783
 		$query  = "SELECT DISTINCT spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
3784 3784
 		 			FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL ";
3785
-                if ($olderthanmonths > 0) {
3786
-            		if ($globalDBdriver == 'mysql') {
3785
+				if ($olderthanmonths > 0) {
3786
+					if ($globalDBdriver == 'mysql') {
3787 3787
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
3788 3788
 			} else {
3789 3789
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
3790 3790
 			}
3791 3791
 		}
3792
-                if ($sincedate != '') {
3793
-            		if ($globalDBdriver == 'mysql') {
3792
+				if ($sincedate != '') {
3793
+					if ($globalDBdriver == 'mysql') {
3794 3794
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
3795 3795
 			} else {
3796 3796
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -3816,26 +3816,26 @@  discard block
 block discarded – undo
3816 3816
 	}
3817 3817
 	
3818 3818
 	 /**
3819
-	* Gets all owner that have flown over
3820
-	*
3821
-	* @return Array the pilots list
3822
-	*
3823
-	*/
3819
+	  * Gets all owner that have flown over
3820
+	  *
3821
+	  * @return Array the pilots list
3822
+	  *
3823
+	  */
3824 3824
 	public function countAllOwnersByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
3825 3825
 	{
3826 3826
 		global $globalDBdriver;
3827 3827
 		$filter_query = $this->getFilter($filters,true,true);
3828 3828
 		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
3829 3829
 		 			FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL ";
3830
-                if ($olderthanmonths > 0) {
3831
-            		if ($globalDBdriver == 'mysql') {
3830
+				if ($olderthanmonths > 0) {
3831
+					if ($globalDBdriver == 'mysql') {
3832 3832
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
3833 3833
 			} else {
3834 3834
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
3835 3835
 			}
3836 3836
 		}
3837
-                if ($sincedate != '') {
3838
-            		if ($globalDBdriver == 'mysql') {
3837
+				if ($sincedate != '') {
3838
+					if ($globalDBdriver == 'mysql') {
3839 3839
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
3840 3840
 			} else {
3841 3841
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -3862,11 +3862,11 @@  discard block
 block discarded – undo
3862 3862
 	}
3863 3863
 
3864 3864
 	/**
3865
-	* Gets all airlines that have flown over by aircraft
3866
-	*
3867
-	* @return Array the airline list
3868
-	*
3869
-	*/
3865
+	 * Gets all airlines that have flown over by aircraft
3866
+	 *
3867
+	 * @return Array the airline list
3868
+	 *
3869
+	 */
3870 3870
 	public function countAllAirlinesByAircraft($aircraft_icao,$filters = array())
3871 3871
 	{
3872 3872
 		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
@@ -3898,11 +3898,11 @@  discard block
 block discarded – undo
3898 3898
 
3899 3899
 
3900 3900
 	/**
3901
-	* Gets all airline countries that have flown over by aircraft
3902
-	*
3903
-	* @return Array the airline country list
3904
-	*
3905
-	*/
3901
+	 * Gets all airline countries that have flown over by aircraft
3902
+	 *
3903
+	 * @return Array the airline country list
3904
+	 *
3905
+	 */
3906 3906
 	public function countAllAirlineCountriesByAircraft($aircraft_icao,$filters = array())
3907 3907
 	{
3908 3908
 		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
@@ -3934,11 +3934,11 @@  discard block
 block discarded – undo
3934 3934
 	
3935 3935
 	
3936 3936
 	/**
3937
-	* Gets all airlines that have flown over by airport
3938
-	*
3939
-	* @return Array the airline list
3940
-	*
3941
-	*/
3937
+	 * Gets all airlines that have flown over by airport
3938
+	 *
3939
+	 * @return Array the airline list
3940
+	 *
3941
+	 */
3942 3942
 	public function countAllAirlinesByAirport($airport_icao,$filters = array())
3943 3943
 	{
3944 3944
 		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
@@ -3969,11 +3969,11 @@  discard block
 block discarded – undo
3969 3969
 
3970 3970
 
3971 3971
 	/**
3972
-	* Gets all airline countries that have flown over by airport icao
3973
-	*
3974
-	* @return Array the airline country list
3975
-	*
3976
-	*/
3972
+	 * Gets all airline countries that have flown over by airport icao
3973
+	 *
3974
+	 * @return Array the airline country list
3975
+	 *
3976
+	 */
3977 3977
 	public function countAllAirlineCountriesByAirport($airport_icao,$filters = array())
3978 3978
 	{
3979 3979
 		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
@@ -4003,11 +4003,11 @@  discard block
 block discarded – undo
4003 4003
 
4004 4004
 
4005 4005
 	/**
4006
-	* Gets all airlines that have flown over by aircraft manufacturer
4007
-	*
4008
-	* @return Array the airline list
4009
-	*
4010
-	*/
4006
+	 * Gets all airlines that have flown over by aircraft manufacturer
4007
+	 *
4008
+	 * @return Array the airline list
4009
+	 *
4010
+	 */
4011 4011
 	public function countAllAirlinesByManufacturer($aircraft_manufacturer,$filters = array())
4012 4012
 	{
4013 4013
 		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
@@ -4038,11 +4038,11 @@  discard block
 block discarded – undo
4038 4038
 
4039 4039
 
4040 4040
 	/**
4041
-	* Gets all airline countries that have flown over by aircraft manufacturer
4042
-	*
4043
-	* @return Array the airline country list
4044
-	*
4045
-	*/
4041
+	 * Gets all airline countries that have flown over by aircraft manufacturer
4042
+	 *
4043
+	 * @return Array the airline country list
4044
+	 *
4045
+	 */
4046 4046
 	public function countAllAirlineCountriesByManufacturer($aircraft_manufacturer,$filters = array())
4047 4047
 	{
4048 4048
 		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
@@ -4071,11 +4071,11 @@  discard block
 block discarded – undo
4071 4071
 
4072 4072
 
4073 4073
 	/**
4074
-	* Gets all airlines that have flown over by date
4075
-	*
4076
-	* @return Array the airline list
4077
-	*
4078
-	*/
4074
+	 * Gets all airlines that have flown over by date
4075
+	 *
4076
+	 * @return Array the airline list
4077
+	 *
4078
+	 */
4079 4079
 	public function countAllAirlinesByDate($date,$filters = array())
4080 4080
 	{
4081 4081
 		global $globalTimezone, $globalDBdriver;
@@ -4119,11 +4119,11 @@  discard block
 block discarded – undo
4119 4119
 	
4120 4120
 	
4121 4121
 	/**
4122
-	* Gets all airline countries that have flown over by date
4123
-	*
4124
-	* @return Array the airline country list
4125
-	*
4126
-	*/
4122
+	 * Gets all airline countries that have flown over by date
4123
+	 *
4124
+	 * @return Array the airline country list
4125
+	 *
4126
+	 */
4127 4127
 	public function countAllAirlineCountriesByDate($date,$filters = array())
4128 4128
 	{
4129 4129
 		global $globalTimezone, $globalDBdriver;
@@ -4166,11 +4166,11 @@  discard block
 block discarded – undo
4166 4166
 
4167 4167
 
4168 4168
 	/**
4169
-	* Gets all airlines that have flown over by ident/callsign
4170
-	*
4171
-	* @return Array the airline list
4172
-	*
4173
-	*/
4169
+	 * Gets all airlines that have flown over by ident/callsign
4170
+	 *
4171
+	 * @return Array the airline list
4172
+	 *
4173
+	 */
4174 4174
 	public function countAllAirlinesByIdent($ident,$filters = array())
4175 4175
 	{
4176 4176
 		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
@@ -4200,11 +4200,11 @@  discard block
 block discarded – undo
4200 4200
 	}
4201 4201
 
4202 4202
 	/**
4203
-	* Gets all airlines that have flown over by route
4204
-	*
4205
-	* @return Array the airline list
4206
-	*
4207
-	*/
4203
+	 * Gets all airlines that have flown over by route
4204
+	 *
4205
+	 * @return Array the airline list
4206
+	 *
4207
+	 */
4208 4208
 	public function countAllAirlinesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
4209 4209
 	{
4210 4210
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4236,11 +4236,11 @@  discard block
 block discarded – undo
4236 4236
 	}
4237 4237
 
4238 4238
 	/**
4239
-	* Gets all airline countries that have flown over by route
4240
-	*
4241
-	* @return Array the airline country list
4242
-	*
4243
-	*/
4239
+	 * Gets all airline countries that have flown over by route
4240
+	 *
4241
+	 * @return Array the airline country list
4242
+	 *
4243
+	 */
4244 4244
 	public function countAllAirlineCountriesByRoute($departure_airport_icao, $arrival_airport_icao,$filters= array())
4245 4245
 	{
4246 4246
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4272,11 +4272,11 @@  discard block
 block discarded – undo
4272 4272
 
4273 4273
 
4274 4274
 	/**
4275
-	* Gets all airlines that have flown over by country
4276
-	*
4277
-	* @return Array the airline list
4278
-	*
4279
-	*/
4275
+	 * Gets all airlines that have flown over by country
4276
+	 *
4277
+	 * @return Array the airline list
4278
+	 *
4279
+	 */
4280 4280
 	public function countAllAirlinesByCountry($country,$filters = array())
4281 4281
 	{
4282 4282
 		$country = filter_var($country,FILTER_SANITIZE_STRING);
@@ -4306,11 +4306,11 @@  discard block
 block discarded – undo
4306 4306
 
4307 4307
 
4308 4308
 	/**
4309
-	* Gets all airline countries that have flown over by country
4310
-	*
4311
-	* @return Array the airline country list
4312
-	*
4313
-	*/
4309
+	 * Gets all airline countries that have flown over by country
4310
+	 *
4311
+	 * @return Array the airline country list
4312
+	 *
4313
+	 */
4314 4314
 	public function countAllAirlineCountriesByCountry($country,$filters = array())
4315 4315
 	{
4316 4316
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4339,11 +4339,11 @@  discard block
 block discarded – undo
4339 4339
 
4340 4340
 
4341 4341
 	/**
4342
-	* Gets all airlines countries
4343
-	*
4344
-	* @return Array the airline country list
4345
-	*
4346
-	*/
4342
+	 * Gets all airlines countries
4343
+	 *
4344
+	 * @return Array the airline country list
4345
+	 *
4346
+	 */
4347 4347
 	public function countAllAirlineCountries($limit = true, $filters = array())
4348 4348
 	{
4349 4349
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4369,11 +4369,11 @@  discard block
 block discarded – undo
4369 4369
 	}
4370 4370
 
4371 4371
 	/**
4372
-	* Gets all number of flight over countries
4373
-	*
4374
-	* @return Array the airline country list
4375
-	*
4376
-	*/
4372
+	 * Gets all number of flight over countries
4373
+	 *
4374
+	 * @return Array the airline country list
4375
+	 *
4376
+	 */
4377 4377
 	public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '')
4378 4378
 	{
4379 4379
 		global $globalDBdriver;
@@ -4388,15 +4388,15 @@  discard block
 block discarded – undo
4388 4388
 		$query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb 
4389 4389
 					FROM countries c, spotter_live s
4390 4390
 					WHERE c.iso2 = s.over_country ";
4391
-                if ($olderthanmonths > 0) {
4391
+				if ($olderthanmonths > 0) {
4392 4392
 			if ($globalDBdriver == 'mysql') {
4393 4393
 				$query .= 'AND spotter_live.date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
4394 4394
 			} else {
4395 4395
 				$query .= "AND spotter_live.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
4396 4396
 			}
4397 4397
 		}
4398
-                if ($sincedate != '') {
4399
-            		if ($globalDBdriver == 'mysql') {
4398
+				if ($sincedate != '') {
4399
+					if ($globalDBdriver == 'mysql') {
4400 4400
 				$query .= "AND spotter_live.date > '".$sincedate."' ";
4401 4401
 			} else {
4402 4402
 				$query .= "AND spotter_live.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -4426,11 +4426,11 @@  discard block
 block discarded – undo
4426 4426
 	
4427 4427
 	
4428 4428
 	/**
4429
-	* Gets all aircraft types that have flown over
4430
-	*
4431
-	* @return Array the aircraft list
4432
-	*
4433
-	*/
4429
+	 * Gets all aircraft types that have flown over
4430
+	 *
4431
+	 * @return Array the aircraft list
4432
+	 *
4433
+	 */
4434 4434
 	public function countAllAircraftTypes($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
4435 4435
 	{
4436 4436
 		global $globalDBdriver;
@@ -4473,11 +4473,11 @@  discard block
 block discarded – undo
4473 4473
 	}
4474 4474
 
4475 4475
 	/**
4476
-	* Gets all aircraft types that have flown over by airline
4477
-	*
4478
-	* @return Array the aircraft list
4479
-	*
4480
-	*/
4476
+	 * Gets all aircraft types that have flown over by airline
4477
+	 *
4478
+	 * @return Array the aircraft list
4479
+	 *
4480
+	 */
4481 4481
 	public function countAllAircraftTypesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
4482 4482
 	{
4483 4483
 		global $globalDBdriver;
@@ -4520,11 +4520,11 @@  discard block
 block discarded – undo
4520 4520
 	}
4521 4521
 
4522 4522
 	/**
4523
-	* Gets all aircraft types that have flown over by months
4524
-	*
4525
-	* @return Array the aircraft list
4526
-	*
4527
-	*/
4523
+	 * Gets all aircraft types that have flown over by months
4524
+	 *
4525
+	 * @return Array the aircraft list
4526
+	 *
4527
+	 */
4528 4528
 	public function countAllAircraftTypesByMonths($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
4529 4529
 	{
4530 4530
 		global $globalDBdriver;
@@ -4568,11 +4568,11 @@  discard block
 block discarded – undo
4568 4568
 
4569 4569
 
4570 4570
 	/**
4571
-	* Gets all aircraft registration that have flown over by aircaft icao
4572
-	*
4573
-	* @return Array the aircraft list
4574
-	*
4575
-	*/
4571
+	 * Gets all aircraft registration that have flown over by aircaft icao
4572
+	 *
4573
+	 * @return Array the aircraft list
4574
+	 *
4575
+	 */
4576 4576
 	public function countAllAircraftRegistrationByAircraft($aircraft_icao,$filters = array())
4577 4577
 	{
4578 4578
 		$Image = new Image($this->db);
@@ -4611,11 +4611,11 @@  discard block
 block discarded – undo
4611 4611
 
4612 4612
 
4613 4613
 	/**
4614
-	* Gets all aircraft types that have flown over by airline icao
4615
-	*
4616
-	* @return Array the aircraft list
4617
-	*
4618
-	*/
4614
+	 * Gets all aircraft types that have flown over by airline icao
4615
+	 *
4616
+	 * @return Array the aircraft list
4617
+	 *
4618
+	 */
4619 4619
 	public function countAllAircraftTypesByAirline($airline_icao,$filters = array())
4620 4620
 	{
4621 4621
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4644,11 +4644,11 @@  discard block
 block discarded – undo
4644 4644
 
4645 4645
 
4646 4646
 	/**
4647
-	* Gets all aircraft registration that have flown over by airline icao
4648
-	*
4649
-	* @return Array the aircraft list
4650
-	*
4651
-	*/
4647
+	 * Gets all aircraft registration that have flown over by airline icao
4648
+	 *
4649
+	 * @return Array the aircraft list
4650
+	 *
4651
+	 */
4652 4652
 	public function countAllAircraftRegistrationByAirline($airline_icao,$filters = array())
4653 4653
 	{
4654 4654
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4686,11 +4686,11 @@  discard block
 block discarded – undo
4686 4686
 
4687 4687
 
4688 4688
 	/**
4689
-	* Gets all aircraft manufacturer that have flown over by airline icao
4690
-	*
4691
-	* @return Array the aircraft list
4692
-	*
4693
-	*/
4689
+	 * Gets all aircraft manufacturer that have flown over by airline icao
4690
+	 *
4691
+	 * @return Array the aircraft list
4692
+	 *
4693
+	 */
4694 4694
 	public function countAllAircraftManufacturerByAirline($airline_icao,$filters = array())
4695 4695
 	{
4696 4696
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4718,11 +4718,11 @@  discard block
 block discarded – undo
4718 4718
 
4719 4719
 
4720 4720
 	/**
4721
-	* Gets all aircraft types that have flown over by airline icao
4722
-	*
4723
-	* @return Array the aircraft list
4724
-	*
4725
-	*/
4721
+	 * Gets all aircraft types that have flown over by airline icao
4722
+	 *
4723
+	 * @return Array the aircraft list
4724
+	 *
4725
+	 */
4726 4726
 	public function countAllAircraftTypesByAirport($airport_icao,$filters = array())
4727 4727
 	{
4728 4728
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4751,11 +4751,11 @@  discard block
 block discarded – undo
4751 4751
 
4752 4752
 
4753 4753
 	/**
4754
-	* Gets all aircraft registration that have flown over by airport icao
4755
-	*
4756
-	* @return Array the aircraft list
4757
-	*
4758
-	*/
4754
+	 * Gets all aircraft registration that have flown over by airport icao
4755
+	 *
4756
+	 * @return Array the aircraft list
4757
+	 *
4758
+	 */
4759 4759
 	public function countAllAircraftRegistrationByAirport($airport_icao,$filters = array())
4760 4760
 	{
4761 4761
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4792,11 +4792,11 @@  discard block
 block discarded – undo
4792 4792
 	
4793 4793
 	
4794 4794
 	/**
4795
-	* Gets all aircraft manufacturer that have flown over by airport icao
4796
-	*
4797
-	* @return Array the aircraft list
4798
-	*
4799
-	*/
4795
+	 * Gets all aircraft manufacturer that have flown over by airport icao
4796
+	 *
4797
+	 * @return Array the aircraft list
4798
+	 *
4799
+	 */
4800 4800
 	public function countAllAircraftManufacturerByAirport($airport_icao,$filters = array())
4801 4801
 	{
4802 4802
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4822,11 +4822,11 @@  discard block
 block discarded – undo
4822 4822
 	}
4823 4823
 
4824 4824
 	/**
4825
-	* Gets all aircraft types that have flown over by aircraft manufacturer
4826
-	*
4827
-	* @return Array the aircraft list
4828
-	*
4829
-	*/
4825
+	 * Gets all aircraft types that have flown over by aircraft manufacturer
4826
+	 *
4827
+	 * @return Array the aircraft list
4828
+	 *
4829
+	 */
4830 4830
 	public function countAllAircraftTypesByManufacturer($aircraft_manufacturer,$filters = array())
4831 4831
 	{
4832 4832
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4853,11 +4853,11 @@  discard block
 block discarded – undo
4853 4853
 
4854 4854
 
4855 4855
 	/**
4856
-	* Gets all aircraft registration that have flown over by aircaft manufacturer
4857
-	*
4858
-	* @return Array the aircraft list
4859
-	*
4860
-	*/
4856
+	 * Gets all aircraft registration that have flown over by aircaft manufacturer
4857
+	 *
4858
+	 * @return Array the aircraft list
4859
+	 *
4860
+	 */
4861 4861
 	public function countAllAircraftRegistrationByManufacturer($aircraft_manufacturer, $filters = array())
4862 4862
 	{
4863 4863
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4893,11 +4893,11 @@  discard block
 block discarded – undo
4893 4893
 	}
4894 4894
 
4895 4895
 	/**
4896
-	* Gets all aircraft types that have flown over by date
4897
-	*
4898
-	* @return Array the aircraft list
4899
-	*
4900
-	*/
4896
+	 * Gets all aircraft types that have flown over by date
4897
+	 *
4898
+	 * @return Array the aircraft list
4899
+	 *
4900
+	 */
4901 4901
 	public function countAllAircraftTypesByDate($date,$filters = array())
4902 4902
 	{
4903 4903
 		global $globalTimezone, $globalDBdriver;
@@ -4939,11 +4939,11 @@  discard block
 block discarded – undo
4939 4939
 
4940 4940
 
4941 4941
 	/**
4942
-	* Gets all aircraft registration that have flown over by date
4943
-	*
4944
-	* @return Array the aircraft list
4945
-	*
4946
-	*/
4942
+	 * Gets all aircraft registration that have flown over by date
4943
+	 *
4944
+	 * @return Array the aircraft list
4945
+	 *
4946
+	 */
4947 4947
 	public function countAllAircraftRegistrationByDate($date,$filters = array())
4948 4948
 	{
4949 4949
 		global $globalTimezone, $globalDBdriver;
@@ -4994,11 +4994,11 @@  discard block
 block discarded – undo
4994 4994
 
4995 4995
 
4996 4996
 	/**
4997
-	* Gets all aircraft manufacturer that have flown over by date
4998
-	*
4999
-	* @return Array the aircraft manufacturer list
5000
-	*
5001
-	*/
4997
+	 * Gets all aircraft manufacturer that have flown over by date
4998
+	 *
4999
+	 * @return Array the aircraft manufacturer list
5000
+	 *
5001
+	 */
5002 5002
 	public function countAllAircraftManufacturerByDate($date,$filters = array())
5003 5003
 	{
5004 5004
 		global $globalTimezone, $globalDBdriver;
@@ -5040,11 +5040,11 @@  discard block
 block discarded – undo
5040 5040
 
5041 5041
 
5042 5042
 	/**
5043
-	* Gets all aircraft types that have flown over by ident/callsign
5044
-	*
5045
-	* @return Array the aircraft list
5046
-	*
5047
-	*/
5043
+	 * Gets all aircraft types that have flown over by ident/callsign
5044
+	 *
5045
+	 * @return Array the aircraft list
5046
+	 *
5047
+	 */
5048 5048
 	public function countAllAircraftTypesByIdent($ident,$filters = array())
5049 5049
 	{
5050 5050
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5073,11 +5073,11 @@  discard block
 block discarded – undo
5073 5073
 
5074 5074
 
5075 5075
 	/**
5076
-	* Gets all aircraft registration that have flown over by ident/callsign
5077
-	*
5078
-	* @return Array the aircraft list
5079
-	*
5080
-	*/
5076
+	 * Gets all aircraft registration that have flown over by ident/callsign
5077
+	 *
5078
+	 * @return Array the aircraft list
5079
+	 *
5080
+	 */
5081 5081
 	public function countAllAircraftRegistrationByIdent($ident,$filters = array())
5082 5082
 	{
5083 5083
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5117,11 +5117,11 @@  discard block
 block discarded – undo
5117 5117
 
5118 5118
 
5119 5119
 	/**
5120
-	* Gets all aircraft manufacturer that have flown over by ident/callsign
5121
-	*
5122
-	* @return Array the aircraft manufacturer list
5123
-	*
5124
-	*/
5120
+	 * Gets all aircraft manufacturer that have flown over by ident/callsign
5121
+	 *
5122
+	 * @return Array the aircraft manufacturer list
5123
+	 *
5124
+	 */
5125 5125
 	public function countAllAircraftManufacturerByIdent($ident,$filters = array())
5126 5126
 	{
5127 5127
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5147,11 +5147,11 @@  discard block
 block discarded – undo
5147 5147
 
5148 5148
 
5149 5149
 	/**
5150
-	* Gets all aircraft types that have flown over by route
5151
-	*
5152
-	* @return Array the aircraft list
5153
-	*
5154
-	*/
5150
+	 * Gets all aircraft types that have flown over by route
5151
+	 *
5152
+	 * @return Array the aircraft list
5153
+	 *
5154
+	 */
5155 5155
 	public function countAllAircraftTypesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
5156 5156
 	{
5157 5157
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5180,11 +5180,11 @@  discard block
 block discarded – undo
5180 5180
 	}
5181 5181
 
5182 5182
 	/**
5183
-	* Gets all aircraft registration that have flown over by route
5184
-	*
5185
-	* @return Array the aircraft list
5186
-	*
5187
-	*/
5183
+	 * Gets all aircraft registration that have flown over by route
5184
+	 *
5185
+	 * @return Array the aircraft list
5186
+	 *
5187
+	 */
5188 5188
 	public function countAllAircraftRegistrationByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
5189 5189
 	{
5190 5190
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5226,11 +5226,11 @@  discard block
 block discarded – undo
5226 5226
 	
5227 5227
 	
5228 5228
 	/**
5229
-	* Gets all aircraft manufacturer that have flown over by route
5230
-	*
5231
-	* @return Array the aircraft manufacturer list
5232
-	*
5233
-	*/
5229
+	 * Gets all aircraft manufacturer that have flown over by route
5230
+	 *
5231
+	 * @return Array the aircraft manufacturer list
5232
+	 *
5233
+	 */
5234 5234
 	public function countAllAircraftManufacturerByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
5235 5235
 	{
5236 5236
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5264,11 +5264,11 @@  discard block
 block discarded – undo
5264 5264
 	
5265 5265
 	
5266 5266
 	/**
5267
-	* Gets all aircraft types that have flown over by country
5268
-	*
5269
-	* @return Array the aircraft list
5270
-	*
5271
-	*/
5267
+	 * Gets all aircraft types that have flown over by country
5268
+	 *
5269
+	 * @return Array the aircraft list
5270
+	 *
5271
+	 */
5272 5272
 	public function countAllAircraftTypesByCountry($country,$filters = array())
5273 5273
 	{
5274 5274
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5299,11 +5299,11 @@  discard block
 block discarded – undo
5299 5299
 
5300 5300
 
5301 5301
 	/**
5302
-	* Gets all aircraft registration that have flown over by country
5303
-	*
5304
-	* @return Array the aircraft list
5305
-	*
5306
-	*/
5302
+	 * Gets all aircraft registration that have flown over by country
5303
+	 *
5304
+	 * @return Array the aircraft list
5305
+	 *
5306
+	 */
5307 5307
 	public function countAllAircraftRegistrationByCountry($country,$filters = array())
5308 5308
 	{
5309 5309
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5343,11 +5343,11 @@  discard block
 block discarded – undo
5343 5343
 	
5344 5344
 	
5345 5345
 	/**
5346
-	* Gets all aircraft manufacturer that have flown over by country
5347
-	*
5348
-	* @return Array the aircraft manufacturer list
5349
-	*
5350
-	*/
5346
+	 * Gets all aircraft manufacturer that have flown over by country
5347
+	 *
5348
+	 * @return Array the aircraft manufacturer list
5349
+	 *
5350
+	 */
5351 5351
 	public function countAllAircraftManufacturerByCountry($country,$filters = array())
5352 5352
 	{
5353 5353
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5378,17 +5378,17 @@  discard block
 block discarded – undo
5378 5378
 	
5379 5379
 	
5380 5380
 	/**
5381
-	* Gets all aircraft manufacturers that have flown over
5382
-	*
5383
-	* @return Array the aircraft list
5384
-	*
5385
-	*/
5381
+	 * Gets all aircraft manufacturers that have flown over
5382
+	 *
5383
+	 * @return Array the aircraft list
5384
+	 *
5385
+	 */
5386 5386
 	public function countAllAircraftManufacturers($filters = array())
5387 5387
 	{
5388 5388
 		$filter_query = $this->getFilter($filters,true,true);
5389 5389
 		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5390 5390
                     FROM spotter_output ".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.aircraft_manufacturer <> 'Not Available'";
5391
-                $query .= " GROUP BY spotter_output.aircraft_manufacturer
5391
+				$query .= " GROUP BY spotter_output.aircraft_manufacturer
5392 5392
 					ORDER BY aircraft_manufacturer_count DESC
5393 5393
 					LIMIT 10";
5394 5394
       
@@ -5413,11 +5413,11 @@  discard block
 block discarded – undo
5413 5413
 	
5414 5414
 	
5415 5415
 	/**
5416
-	* Gets all aircraft registrations that have flown over
5417
-	*
5418
-	* @return Array the aircraft list
5419
-	*
5420
-	*/
5416
+	 * Gets all aircraft registrations that have flown over
5417
+	 *
5418
+	 * @return Array the aircraft list
5419
+	 *
5420
+	 */
5421 5421
 	public function countAllAircraftRegistrations($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
5422 5422
 	{
5423 5423
 		global $globalDBdriver;
@@ -5425,15 +5425,15 @@  discard block
 block discarded – undo
5425 5425
 		$filter_query = $this->getFilter($filters,true,true);
5426 5426
 		$query  = "SELECT DISTINCT spotter_output.registration, COUNT(spotter_output.registration) AS aircraft_registration_count, spotter_output.aircraft_icao,  spotter_output.aircraft_name, spotter_output.airline_name    
5427 5427
                     FROM spotter_output ".$filter_query." spotter_output.registration <> '' AND spotter_output.registration <> 'NA'";
5428
-                if ($olderthanmonths > 0) {
5429
-            		if ($globalDBdriver == 'mysql') {
5428
+				if ($olderthanmonths > 0) {
5429
+					if ($globalDBdriver == 'mysql') {
5430 5430
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
5431 5431
 			} else {
5432 5432
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
5433 5433
 			}
5434 5434
 		}
5435
-                if ($sincedate != '') {
5436
-            		if ($globalDBdriver == 'mysql') {
5435
+				if ($sincedate != '') {
5436
+					if ($globalDBdriver == 'mysql') {
5437 5437
 				$query .= " AND spotter_output.date > '".$sincedate."'";
5438 5438
 			} else {
5439 5439
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -5442,7 +5442,7 @@  discard block
 block discarded – undo
5442 5442
 
5443 5443
 		// if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5444 5444
 		//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5445
-                $query .= " GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC";
5445
+				$query .= " GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC";
5446 5446
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5447 5447
 		
5448 5448
 		$sth = $this->db->prepare($query);
@@ -5473,11 +5473,11 @@  discard block
 block discarded – undo
5473 5473
 
5474 5474
 
5475 5475
 	/**
5476
-	* Gets all aircraft registrations that have flown over
5477
-	*
5478
-	* @return Array the aircraft list
5479
-	*
5480
-	*/
5476
+	 * Gets all aircraft registrations that have flown over
5477
+	 *
5478
+	 * @return Array the aircraft list
5479
+	 *
5480
+	 */
5481 5481
 	public function countAllAircraftRegistrationsByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
5482 5482
 	{
5483 5483
 		global $globalDBdriver;
@@ -5485,15 +5485,15 @@  discard block
 block discarded – undo
5485 5485
 		$Image = new Image($this->db);
5486 5486
 		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.registration, COUNT(spotter_output.registration) AS aircraft_registration_count, spotter_output.aircraft_icao,  spotter_output.aircraft_name, spotter_output.airline_name    
5487 5487
                     FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.registration <> '' AND spotter_output.registration <> 'NA' ";
5488
-                if ($olderthanmonths > 0) {
5489
-            		if ($globalDBdriver == 'mysql') {
5488
+				if ($olderthanmonths > 0) {
5489
+					if ($globalDBdriver == 'mysql') {
5490 5490
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
5491 5491
 			} else {
5492 5492
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
5493 5493
 			}
5494 5494
 		}
5495
-                if ($sincedate != '') {
5496
-            		if ($globalDBdriver == 'mysql') {
5495
+				if ($sincedate != '') {
5496
+					if ($globalDBdriver == 'mysql') {
5497 5497
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
5498 5498
 			} else {
5499 5499
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -5502,7 +5502,7 @@  discard block
 block discarded – undo
5502 5502
 
5503 5503
 		// if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5504 5504
 		//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5505
-                $query .= "GROUP BY spotter_output.airline_icao, spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC";
5505
+				$query .= "GROUP BY spotter_output.airline_icao, spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC";
5506 5506
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5507 5507
 		
5508 5508
 		$sth = $this->db->prepare($query);
@@ -5534,35 +5534,35 @@  discard block
 block discarded – undo
5534 5534
 	
5535 5535
 	
5536 5536
 	/**
5537
-	* Gets all departure airports of the airplanes that have flown over
5538
-	*
5539
-	* @return Array the airport list
5540
-	*
5541
-	*/
5537
+	 * Gets all departure airports of the airplanes that have flown over
5538
+	 *
5539
+	 * @return Array the airport list
5540
+	 *
5541
+	 */
5542 5542
 	public function countAllDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
5543 5543
 	{
5544 5544
 		global $globalDBdriver;
5545 5545
 		$filter_query = $this->getFilter($filters,true,true);
5546 5546
 		$query  = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
5547 5547
 				FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA'";
5548
-                if ($olderthanmonths > 0) {
5549
-            		if ($globalDBdriver == 'mysql') {
5548
+				if ($olderthanmonths > 0) {
5549
+					if ($globalDBdriver == 'mysql') {
5550 5550
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
5551 5551
 			} else {
5552 5552
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
5553 5553
 			}
5554
-                }
5555
-                if ($sincedate != '') {
5556
-            		if ($globalDBdriver == 'mysql') {
5554
+				}
5555
+				if ($sincedate != '') {
5556
+					if ($globalDBdriver == 'mysql') {
5557 5557
 				$query .= " AND spotter_output.date > '".$sincedate."'";
5558 5558
 			} else {
5559 5559
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
5560 5560
 			}
5561 5561
 		}
5562 5562
 
5563
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5564
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5565
-                $query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
5563
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5564
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5565
+				$query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
5566 5566
 				ORDER BY airport_departure_icao_count DESC";
5567 5567
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5568 5568
       
@@ -5586,35 +5586,35 @@  discard block
 block discarded – undo
5586 5586
 	}
5587 5587
 
5588 5588
 	/**
5589
-	* Gets all departure airports of the airplanes that have flown over
5590
-	*
5591
-	* @return Array the airport list
5592
-	*
5593
-	*/
5589
+	 * Gets all departure airports of the airplanes that have flown over
5590
+	 *
5591
+	 * @return Array the airport list
5592
+	 *
5593
+	 */
5594 5594
 	public function countAllDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
5595 5595
 	{
5596 5596
 		global $globalDBdriver;
5597 5597
 		$filter_query = $this->getFilter($filters,true,true);
5598 5598
 		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
5599 5599
 			FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' ";
5600
-                if ($olderthanmonths > 0) {
5601
-            		if ($globalDBdriver == 'mysql') {
5600
+				if ($olderthanmonths > 0) {
5601
+					if ($globalDBdriver == 'mysql') {
5602 5602
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
5603 5603
 			} else {
5604 5604
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
5605 5605
 			}
5606
-                }
5607
-                if ($sincedate != '') {
5608
-            		if ($globalDBdriver == 'mysql') {
5606
+				}
5607
+				if ($sincedate != '') {
5608
+					if ($globalDBdriver == 'mysql') {
5609 5609
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
5610 5610
 			} else {
5611 5611
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
5612 5612
 			}
5613 5613
 		}
5614 5614
 
5615
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5616
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5617
-                $query .= "GROUP BY spotter_output.airline_icao, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
5615
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5616
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5617
+				$query .= "GROUP BY spotter_output.airline_icao, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
5618 5618
 				ORDER BY airport_departure_icao_count DESC";
5619 5619
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5620 5620
       
@@ -5639,37 +5639,37 @@  discard block
 block discarded – undo
5639 5639
 	}
5640 5640
 
5641 5641
 	/**
5642
-	* Gets all detected departure airports of the airplanes that have flown over
5643
-	*
5644
-	* @return Array the airport list
5645
-	*
5646
-	*/
5642
+	 * Gets all detected departure airports of the airplanes that have flown over
5643
+	 *
5644
+	 * @return Array the airport list
5645
+	 *
5646
+	 */
5647 5647
 	public function countAllDetectedDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
5648 5648
 	{
5649 5649
 		global $globalDBdriver;
5650 5650
 		$filter_query = $this->getFilter($filters,true,true);
5651 5651
 		$query  = "SELECT DISTINCT spotter_output.real_departure_airport_icao AS departure_airport_icao, COUNT(spotter_output.real_departure_airport_icao) AS airport_departure_icao_count, airport.name as departure_airport_name, airport.city as departure_airport_city, airport.country as departure_airport_country
5652 5652
 				FROM airport, spotter_output".$filter_query." spotter_output.real_departure_airport_icao <> '' AND spotter_output.real_departure_airport_icao <> 'NA' AND airport.icao = spotter_output.real_departure_airport_icao";
5653
-                if ($olderthanmonths > 0) {
5654
-            		if ($globalDBdriver == 'mysql') {
5653
+				if ($olderthanmonths > 0) {
5654
+					if ($globalDBdriver == 'mysql') {
5655 5655
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
5656 5656
 			} else {
5657 5657
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
5658 5658
 			}
5659
-                }
5660
-                if ($sincedate != '') {
5661
-            		if ($globalDBdriver == 'mysql') {
5659
+				}
5660
+				if ($sincedate != '') {
5661
+					if ($globalDBdriver == 'mysql') {
5662 5662
 				$query .= " AND spotter_output.date > '".$sincedate."'";
5663 5663
 			} else {
5664 5664
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
5665 5665
 			}
5666 5666
 		}
5667
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5668
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5669
-                $query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
5667
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5668
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5669
+				$query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
5670 5670
 				ORDER BY airport_departure_icao_count DESC";
5671 5671
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5672
-    		//echo $query;
5672
+			//echo $query;
5673 5673
 		$sth = $this->db->prepare($query);
5674 5674
 		$sth->execute();
5675 5675
       
@@ -5690,35 +5690,35 @@  discard block
 block discarded – undo
5690 5690
 	}
5691 5691
 	
5692 5692
 	/**
5693
-	* Gets all detected departure airports of the airplanes that have flown over
5694
-	*
5695
-	* @return Array the airport list
5696
-	*
5697
-	*/
5693
+	 * Gets all detected departure airports of the airplanes that have flown over
5694
+	 *
5695
+	 * @return Array the airport list
5696
+	 *
5697
+	 */
5698 5698
 	public function countAllDetectedDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
5699 5699
 	{
5700 5700
 		global $globalDBdriver;
5701 5701
 		$filter_query = $this->getFilter($filters,true,true);
5702 5702
 		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.real_departure_airport_icao AS departure_airport_icao, COUNT(spotter_output.real_departure_airport_icao) AS airport_departure_icao_count, airport.name as departure_airport_name, airport.city as departure_airport_city, airport.country as departure_airport_country
5703 5703
 				FROM airport, spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.real_departure_airport_icao <> '' AND spotter_output.real_departure_airport_icao <> 'NA' AND airport.icao = spotter_output.real_departure_airport_icao ";
5704
-                if ($olderthanmonths > 0) {
5705
-            		if ($globalDBdriver == 'mysql') {
5704
+				if ($olderthanmonths > 0) {
5705
+					if ($globalDBdriver == 'mysql') {
5706 5706
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
5707 5707
 			} else {
5708 5708
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
5709 5709
 			}
5710
-                }
5711
-                if ($sincedate != '') {
5712
-            		if ($globalDBdriver == 'mysql') {
5710
+				}
5711
+				if ($sincedate != '') {
5712
+					if ($globalDBdriver == 'mysql') {
5713 5713
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
5714 5714
 			} else {
5715 5715
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP) ";
5716 5716
 			}
5717 5717
 		}
5718 5718
 
5719
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5720
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5721
-                $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
5719
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5720
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5721
+				$query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
5722 5722
 				ORDER BY airport_departure_icao_count DESC";
5723 5723
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5724 5724
       
@@ -5743,11 +5743,11 @@  discard block
 block discarded – undo
5743 5743
 	}	
5744 5744
 	
5745 5745
 	/**
5746
-	* Gets all departure airports of the airplanes that have flown over based on an airline icao
5747
-	*
5748
-	* @return Array the airport list
5749
-	*
5750
-	*/
5746
+	 * Gets all departure airports of the airplanes that have flown over based on an airline icao
5747
+	 *
5748
+	 * @return Array the airport list
5749
+	 *
5750
+	 */
5751 5751
 	public function countAllDepartureAirportsByAirline($airline_icao,$filters = array())
5752 5752
 	{
5753 5753
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5781,11 +5781,11 @@  discard block
 block discarded – undo
5781 5781
 	
5782 5782
 	
5783 5783
 	/**
5784
-	* Gets all departure airports by country of the airplanes that have flown over based on an airline icao
5785
-	*
5786
-	* @return Array the airport list
5787
-	*
5788
-	*/
5784
+	 * Gets all departure airports by country of the airplanes that have flown over based on an airline icao
5785
+	 *
5786
+	 * @return Array the airport list
5787
+	 *
5788
+	 */
5789 5789
 	public function countAllDepartureAirportCountriesByAirline($airline_icao,$filters = array())
5790 5790
 	{
5791 5791
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5816,11 +5816,11 @@  discard block
 block discarded – undo
5816 5816
 	
5817 5817
 	
5818 5818
 	/**
5819
-	* Gets all departure airports of the airplanes that have flown over based on an aircraft icao
5820
-	*
5821
-	* @return Array the airport list
5822
-	*
5823
-	*/
5819
+	 * Gets all departure airports of the airplanes that have flown over based on an aircraft icao
5820
+	 *
5821
+	 * @return Array the airport list
5822
+	 *
5823
+	 */
5824 5824
 	public function countAllDepartureAirportsByAircraft($aircraft_icao,$filters = array())
5825 5825
 	{
5826 5826
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5853,11 +5853,11 @@  discard block
 block discarded – undo
5853 5853
 	
5854 5854
 	
5855 5855
 	/**
5856
-	* Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao
5857
-	*
5858
-	* @return Array the airport list
5859
-	*
5860
-	*/
5856
+	 * Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao
5857
+	 *
5858
+	 * @return Array the airport list
5859
+	 *
5860
+	 */
5861 5861
 	public function countAllDepartureAirportCountriesByAircraft($aircraft_icao,$filters = array())
5862 5862
 	{
5863 5863
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5887,11 +5887,11 @@  discard block
 block discarded – undo
5887 5887
 	
5888 5888
 	
5889 5889
 	/**
5890
-	* Gets all departure airports of the airplanes that have flown over based on an aircraft registration
5891
-	*
5892
-	* @return Array the airport list
5893
-	*
5894
-	*/
5890
+	 * Gets all departure airports of the airplanes that have flown over based on an aircraft registration
5891
+	 *
5892
+	 * @return Array the airport list
5893
+	 *
5894
+	 */
5895 5895
 	public function countAllDepartureAirportsByRegistration($registration,$filters = array())
5896 5896
 	{
5897 5897
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5924,11 +5924,11 @@  discard block
 block discarded – undo
5924 5924
 	
5925 5925
 	
5926 5926
 	/**
5927
-	* Gets all departure airports by country of the airplanes that have flown over based on an aircraft registration
5928
-	*
5929
-	* @return Array the airport list
5930
-	*
5931
-	*/
5927
+	 * Gets all departure airports by country of the airplanes that have flown over based on an aircraft registration
5928
+	 *
5929
+	 * @return Array the airport list
5930
+	 *
5931
+	 */
5932 5932
 	public function countAllDepartureAirportCountriesByRegistration($registration,$filters = array())
5933 5933
 	{
5934 5934
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5958,11 +5958,11 @@  discard block
 block discarded – undo
5958 5958
 	
5959 5959
 	
5960 5960
 	/**
5961
-	* Gets all departure airports of the airplanes that have flown over based on an arrivl airport icao
5962
-	*
5963
-	* @return Array the airport list
5964
-	*
5965
-	*/
5961
+	 * Gets all departure airports of the airplanes that have flown over based on an arrivl airport icao
5962
+	 *
5963
+	 * @return Array the airport list
5964
+	 *
5965
+	 */
5966 5966
 	public function countAllDepartureAirportsByAirport($airport_icao,$filters = array())
5967 5967
 	{
5968 5968
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5995,11 +5995,11 @@  discard block
 block discarded – undo
5995 5995
 	
5996 5996
 	
5997 5997
 	/**
5998
-	* Gets all departure airports by country of the airplanes that have flown over based on an airport icao
5999
-	*
6000
-	* @return Array the airport list
6001
-	*
6002
-	*/
5998
+	 * Gets all departure airports by country of the airplanes that have flown over based on an airport icao
5999
+	 *
6000
+	 * @return Array the airport list
6001
+	 *
6002
+	 */
6003 6003
 	public function countAllDepartureAirportCountriesByAirport($airport_icao,$filters = array())
6004 6004
 	{
6005 6005
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6030,11 +6030,11 @@  discard block
 block discarded – undo
6030 6030
 	
6031 6031
 	
6032 6032
 	/**
6033
-	* Gets all departure airports of the airplanes that have flown over based on an aircraft manufacturer
6034
-	*
6035
-	* @return Array the airport list
6036
-	*
6037
-	*/
6033
+	 * Gets all departure airports of the airplanes that have flown over based on an aircraft manufacturer
6034
+	 *
6035
+	 * @return Array the airport list
6036
+	 *
6037
+	 */
6038 6038
 	public function countAllDepartureAirportsByManufacturer($aircraft_manufacturer,$filters = array())
6039 6039
 	{
6040 6040
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6067,11 +6067,11 @@  discard block
 block discarded – undo
6067 6067
 	
6068 6068
 	
6069 6069
 	/**
6070
-	* Gets all departure airports by country of the airplanes that have flown over based on an aircraft manufacturer
6071
-	*
6072
-	* @return Array the airport list
6073
-	*
6074
-	*/
6070
+	 * Gets all departure airports by country of the airplanes that have flown over based on an aircraft manufacturer
6071
+	 *
6072
+	 * @return Array the airport list
6073
+	 *
6074
+	 */
6075 6075
 	public function countAllDepartureAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array())
6076 6076
 	{
6077 6077
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6101,11 +6101,11 @@  discard block
 block discarded – undo
6101 6101
 	
6102 6102
 	
6103 6103
 	/**
6104
-	* Gets all departure airports of the airplanes that have flown over based on a date
6105
-	*
6106
-	* @return Array the airport list
6107
-	*
6108
-	*/
6104
+	 * Gets all departure airports of the airplanes that have flown over based on a date
6105
+	 *
6106
+	 * @return Array the airport list
6107
+	 *
6108
+	 */
6109 6109
 	public function countAllDepartureAirportsByDate($date,$filters = array())
6110 6110
 	{
6111 6111
 		global $globalTimezone, $globalDBdriver;
@@ -6151,11 +6151,11 @@  discard block
 block discarded – undo
6151 6151
 	
6152 6152
 	
6153 6153
 	/**
6154
-	* Gets all departure airports by country of the airplanes that have flown over based on a date
6155
-	*
6156
-	* @return Array the airport list
6157
-	*
6158
-	*/
6154
+	 * Gets all departure airports by country of the airplanes that have flown over based on a date
6155
+	 *
6156
+	 * @return Array the airport list
6157
+	 *
6158
+	 */
6159 6159
 	public function countAllDepartureAirportCountriesByDate($date,$filters = array())
6160 6160
 	{
6161 6161
 		global $globalTimezone, $globalDBdriver;
@@ -6198,11 +6198,11 @@  discard block
 block discarded – undo
6198 6198
 	
6199 6199
 	
6200 6200
 	/**
6201
-	* Gets all departure airports of the airplanes that have flown over based on a ident/callsign
6202
-	*
6203
-	* @return Array the airport list
6204
-	*
6205
-	*/
6201
+	 * Gets all departure airports of the airplanes that have flown over based on a ident/callsign
6202
+	 *
6203
+	 * @return Array the airport list
6204
+	 *
6205
+	 */
6206 6206
 	public function countAllDepartureAirportsByIdent($ident,$filters = array())
6207 6207
 	{
6208 6208
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6236,11 +6236,11 @@  discard block
 block discarded – undo
6236 6236
 	
6237 6237
 	
6238 6238
 	/**
6239
-	* Gets all departure airports by country of the airplanes that have flown over based on a callsign/ident
6240
-	*
6241
-	* @return Array the airport list
6242
-	*
6243
-	*/
6239
+	 * Gets all departure airports by country of the airplanes that have flown over based on a callsign/ident
6240
+	 *
6241
+	 * @return Array the airport list
6242
+	 *
6243
+	 */
6244 6244
 	public function countAllDepartureAirportCountriesByIdent($ident,$filters = array())
6245 6245
 	{
6246 6246
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6271,11 +6271,11 @@  discard block
 block discarded – undo
6271 6271
 	
6272 6272
 	
6273 6273
 	/**
6274
-	* Gets all departure airports of the airplanes that have flown over based on a country
6275
-	*
6276
-	* @return Array the airport list
6277
-	*
6278
-	*/
6274
+	 * Gets all departure airports of the airplanes that have flown over based on a country
6275
+	 *
6276
+	 * @return Array the airport list
6277
+	 *
6278
+	 */
6279 6279
 	public function countAllDepartureAirportsByCountry($country,$filters = array())
6280 6280
 	{
6281 6281
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6309,11 +6309,11 @@  discard block
 block discarded – undo
6309 6309
 
6310 6310
 
6311 6311
 	/**
6312
-	* Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao
6313
-	*
6314
-	* @return Array the airport list
6315
-	*
6316
-	*/
6312
+	 * Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao
6313
+	 *
6314
+	 * @return Array the airport list
6315
+	 *
6316
+	 */
6317 6317
 	public function countAllDepartureAirportCountriesByCountry($country,$filters = array())
6318 6318
 	{
6319 6319
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6343,40 +6343,40 @@  discard block
 block discarded – undo
6343 6343
 	
6344 6344
 
6345 6345
 	/**
6346
-	* Gets all arrival airports of the airplanes that have flown over
6347
-	*
6348
-	* @return Array the airport list
6349
-	*
6350
-	*/
6346
+	 * Gets all arrival airports of the airplanes that have flown over
6347
+	 *
6348
+	 * @return Array the airport list
6349
+	 *
6350
+	 */
6351 6351
 	public function countAllArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array())
6352 6352
 	{
6353 6353
 		global $globalDBdriver;
6354 6354
 		$filter_query = $this->getFilter($filters,true,true);
6355 6355
 		$query  = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
6356 6356
 				FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA'";
6357
-                if ($olderthanmonths > 0) {
6358
-            		if ($globalDBdriver == 'mysql') {
6357
+				if ($olderthanmonths > 0) {
6358
+					if ($globalDBdriver == 'mysql') {
6359 6359
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
6360 6360
 			} else {
6361 6361
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
6362 6362
 			}
6363
-                if ($sincedate != '') {
6364
-            		if ($globalDBdriver == 'mysql') {
6363
+				if ($sincedate != '') {
6364
+					if ($globalDBdriver == 'mysql') {
6365 6365
 				$query .= " AND spotter_output.date > '".$sincedate."'";
6366 6366
 			} else {
6367 6367
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
6368 6368
 			}
6369 6369
 		}
6370
-            		if ($globalDBdriver == 'mysql') {
6370
+					if ($globalDBdriver == 'mysql') {
6371 6371
 				$query .= " AND spotter_output.date > '".$sincedate."'";
6372 6372
 			} else {
6373 6373
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
6374 6374
 			}
6375 6375
 		}
6376 6376
 
6377
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6378
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6379
-                $query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
6377
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6378
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6379
+				$query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
6380 6380
 					ORDER BY airport_arrival_icao_count DESC";
6381 6381
 		if ($limit) $query .= " LIMIT 10";
6382 6382
       
@@ -6405,40 +6405,40 @@  discard block
 block discarded – undo
6405 6405
 	}
6406 6406
 
6407 6407
 	/**
6408
-	* Gets all arrival airports of the airplanes that have flown over
6409
-	*
6410
-	* @return Array the airport list
6411
-	*
6412
-	*/
6408
+	 * Gets all arrival airports of the airplanes that have flown over
6409
+	 *
6410
+	 * @return Array the airport list
6411
+	 *
6412
+	 */
6413 6413
 	public function countAllArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array())
6414 6414
 	{
6415 6415
 		global $globalDBdriver;
6416 6416
 		$filter_query = $this->getFilter($filters,true,true);
6417 6417
 		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
6418 6418
 			FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' ";
6419
-                if ($olderthanmonths > 0) {
6420
-            		if ($globalDBdriver == 'mysql') {
6419
+				if ($olderthanmonths > 0) {
6420
+					if ($globalDBdriver == 'mysql') {
6421 6421
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
6422 6422
 			} else {
6423 6423
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
6424 6424
 			}
6425
-                if ($sincedate != '') {
6426
-            		if ($globalDBdriver == 'mysql') {
6425
+				if ($sincedate != '') {
6426
+					if ($globalDBdriver == 'mysql') {
6427 6427
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
6428 6428
 			} else {
6429 6429
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
6430 6430
 			}
6431 6431
 		}
6432
-            		if ($globalDBdriver == 'mysql') {
6432
+					if ($globalDBdriver == 'mysql') {
6433 6433
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
6434 6434
 			} else {
6435 6435
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
6436 6436
 			}
6437 6437
 		}
6438 6438
 
6439
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6440
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6441
-                $query .= "GROUP BY spotter_output.airline_icao,spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
6439
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6440
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6441
+				$query .= "GROUP BY spotter_output.airline_icao,spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
6442 6442
 					ORDER BY airport_arrival_icao_count DESC";
6443 6443
 		if ($limit) $query .= " LIMIT 10";
6444 6444
       
@@ -6469,39 +6469,39 @@  discard block
 block discarded – undo
6469 6469
 
6470 6470
 
6471 6471
 	/**
6472
-	* Gets all detected arrival airports of the airplanes that have flown over
6473
-	*
6474
-	* @return Array the airport list
6475
-	*
6476
-	*/
6472
+	 * Gets all detected arrival airports of the airplanes that have flown over
6473
+	 *
6474
+	 * @return Array the airport list
6475
+	 *
6476
+	 */
6477 6477
 	public function countAllDetectedArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array())
6478 6478
 	{
6479 6479
 		global $globalDBdriver;
6480 6480
 		$filter_query = $this->getFilter($filters,true,true);
6481 6481
 		$query  = "SELECT DISTINCT spotter_output.real_arrival_airport_icao as arrival_airport_icao, COUNT(spotter_output.real_arrival_airport_icao) AS airport_arrival_icao_count, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country 
6482 6482
 			FROM airport,spotter_output".$filter_query." spotter_output.real_arrival_airport_icao <> '' AND spotter_output.real_arrival_airport_icao <> 'NA' AND airport.icao = spotter_output.real_arrival_airport_icao";
6483
-                if ($olderthanmonths > 0) {
6484
-            		if ($globalDBdriver == 'mysql') {
6483
+				if ($olderthanmonths > 0) {
6484
+					if ($globalDBdriver == 'mysql') {
6485 6485
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
6486 6486
 			} else {
6487 6487
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
6488 6488
 			}
6489
-                if ($sincedate != '') {
6490
-            		if ($globalDBdriver == 'mysql') {
6489
+				if ($sincedate != '') {
6490
+					if ($globalDBdriver == 'mysql') {
6491 6491
 				$query .= " AND spotter_output.date > '".$sincedate."'";
6492 6492
 			} else {
6493 6493
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
6494 6494
 			}
6495 6495
 		}
6496
-            		if ($globalDBdriver == 'mysql') {
6496
+					if ($globalDBdriver == 'mysql') {
6497 6497
 				$query .= " AND spotter_output.date > '".$sincedate."'";
6498 6498
 			} else {
6499 6499
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
6500 6500
 			}
6501 6501
 		}
6502
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6503
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6504
-                $query .= " GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
6502
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6503
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6504
+				$query .= " GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
6505 6505
 					ORDER BY airport_arrival_icao_count DESC";
6506 6506
 		if ($limit) $query .= " LIMIT 10";
6507 6507
       
@@ -6530,40 +6530,40 @@  discard block
 block discarded – undo
6530 6530
 	}
6531 6531
 	
6532 6532
 	/**
6533
-	* Gets all detected arrival airports of the airplanes that have flown over
6534
-	*
6535
-	* @return Array the airport list
6536
-	*
6537
-	*/
6533
+	 * Gets all detected arrival airports of the airplanes that have flown over
6534
+	 *
6535
+	 * @return Array the airport list
6536
+	 *
6537
+	 */
6538 6538
 	public function countAllDetectedArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array())
6539 6539
 	{
6540 6540
 		global $globalDBdriver;
6541 6541
 		$filter_query = $this->getFilter($filters,true,true);
6542 6542
 		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.real_arrival_airport_icao as arrival_airport_icao, COUNT(spotter_output.real_arrival_airport_icao) AS airport_arrival_icao_count, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country 
6543 6543
 			FROM airport,spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.real_arrival_airport_icao <> '' AND spotter_output.real_arrival_airport_icao <> 'NA' AND airport.icao = spotter_output.real_arrival_airport_icao ";
6544
-                if ($olderthanmonths > 0) {
6545
-            		if ($globalDBdriver == 'mysql') {
6544
+				if ($olderthanmonths > 0) {
6545
+					if ($globalDBdriver == 'mysql') {
6546 6546
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
6547 6547
 			} else {
6548 6548
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
6549 6549
 			}
6550
-                if ($sincedate != '') {
6551
-            		if ($globalDBdriver == 'mysql') {
6550
+				if ($sincedate != '') {
6551
+					if ($globalDBdriver == 'mysql') {
6552 6552
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
6553 6553
 			} else {
6554 6554
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
6555 6555
 			}
6556 6556
 		}
6557
-            		if ($globalDBdriver == 'mysql') {
6557
+					if ($globalDBdriver == 'mysql') {
6558 6558
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
6559 6559
 			} else {
6560 6560
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
6561 6561
 			}
6562 6562
 		}
6563 6563
 
6564
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6565
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6566
-                $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
6564
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6565
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6566
+				$query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
6567 6567
 					ORDER BY airport_arrival_icao_count DESC";
6568 6568
 		if ($limit) $query .= " LIMIT 10";
6569 6569
       
@@ -6593,11 +6593,11 @@  discard block
 block discarded – undo
6593 6593
 	}	
6594 6594
 	
6595 6595
 	/**
6596
-	* Gets all arrival airports of the airplanes that have flown over based on an airline icao
6597
-	*
6598
-	* @return Array the airport list
6599
-	*
6600
-	*/
6596
+	 * Gets all arrival airports of the airplanes that have flown over based on an airline icao
6597
+	 *
6598
+	 * @return Array the airport list
6599
+	 *
6600
+	 */
6601 6601
 	public function countAllArrivalAirportsByAirline($airline_icao, $filters = array())
6602 6602
 	{
6603 6603
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6629,11 +6629,11 @@  discard block
 block discarded – undo
6629 6629
 	
6630 6630
 	
6631 6631
 	/**
6632
-	* Gets all arrival airports by country of the airplanes that have flown over based on an airline icao
6633
-	*
6634
-	* @return Array the airport list
6635
-	*
6636
-	*/
6632
+	 * Gets all arrival airports by country of the airplanes that have flown over based on an airline icao
6633
+	 *
6634
+	 * @return Array the airport list
6635
+	 *
6636
+	 */
6637 6637
 	public function countAllArrivalAirportCountriesByAirline($airline_icao,$filters = array())
6638 6638
 	{
6639 6639
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6664,11 +6664,11 @@  discard block
 block discarded – undo
6664 6664
 	
6665 6665
 	
6666 6666
 	/**
6667
-	* Gets all arrival airports of the airplanes that have flown over based on an aircraft icao
6668
-	*
6669
-	* @return Array the airport list
6670
-	*
6671
-	*/
6667
+	 * Gets all arrival airports of the airplanes that have flown over based on an aircraft icao
6668
+	 *
6669
+	 * @return Array the airport list
6670
+	 *
6671
+	 */
6672 6672
 	public function countAllArrivalAirportsByAircraft($aircraft_icao,$filters = array())
6673 6673
 	{
6674 6674
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6702,11 +6702,11 @@  discard block
 block discarded – undo
6702 6702
 	
6703 6703
 	
6704 6704
 	/**
6705
-	* Gets all arrival airports by country of the airplanes that have flown over based on an aircraft icao
6706
-	*
6707
-	* @return Array the airport list
6708
-	*
6709
-	*/
6705
+	 * Gets all arrival airports by country of the airplanes that have flown over based on an aircraft icao
6706
+	 *
6707
+	 * @return Array the airport list
6708
+	 *
6709
+	 */
6710 6710
 	public function countAllArrivalAirportCountriesByAircraft($aircraft_icao,$filters = array())
6711 6711
 	{
6712 6712
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6736,11 +6736,11 @@  discard block
 block discarded – undo
6736 6736
 	
6737 6737
 	
6738 6738
 	/**
6739
-	* Gets all arrival airports of the airplanes that have flown over based on an aircraft registration
6740
-	*
6741
-	* @return Array the airport list
6742
-	*
6743
-	*/
6739
+	 * Gets all arrival airports of the airplanes that have flown over based on an aircraft registration
6740
+	 *
6741
+	 * @return Array the airport list
6742
+	 *
6743
+	 */
6744 6744
 	public function countAllArrivalAirportsByRegistration($registration,$filters = array())
6745 6745
 	{
6746 6746
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6774,11 +6774,11 @@  discard block
 block discarded – undo
6774 6774
 	
6775 6775
 	
6776 6776
 	/**
6777
-	* Gets all arrival airports by country of the airplanes that have flown over based on an aircraft registration
6778
-	*
6779
-	* @return Array the airport list
6780
-	*
6781
-	*/
6777
+	 * Gets all arrival airports by country of the airplanes that have flown over based on an aircraft registration
6778
+	 *
6779
+	 * @return Array the airport list
6780
+	 *
6781
+	 */
6782 6782
 	public function countAllArrivalAirportCountriesByRegistration($registration,$filters = array())
6783 6783
 	{
6784 6784
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6809,11 +6809,11 @@  discard block
 block discarded – undo
6809 6809
 	
6810 6810
 	
6811 6811
 	/**
6812
-	* Gets all arrival airports of the airplanes that have flown over based on an departure airport
6813
-	*
6814
-	* @return Array the airport list
6815
-	*
6816
-	*/
6812
+	 * Gets all arrival airports of the airplanes that have flown over based on an departure airport
6813
+	 *
6814
+	 * @return Array the airport list
6815
+	 *
6816
+	 */
6817 6817
 	public function countAllArrivalAirportsByAirport($airport_icao,$filters = array())
6818 6818
 	{
6819 6819
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6846,11 +6846,11 @@  discard block
 block discarded – undo
6846 6846
 	
6847 6847
 	
6848 6848
 	/**
6849
-	* Gets all arrival airports by country of the airplanes that have flown over based on an airport icao
6850
-	*
6851
-	* @return Array the airport list
6852
-	*
6853
-	*/
6849
+	 * Gets all arrival airports by country of the airplanes that have flown over based on an airport icao
6850
+	 *
6851
+	 * @return Array the airport list
6852
+	 *
6853
+	 */
6854 6854
 	public function countAllArrivalAirportCountriesByAirport($airport_icao,$filters = array())
6855 6855
 	{
6856 6856
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6880,11 +6880,11 @@  discard block
 block discarded – undo
6880 6880
 	
6881 6881
 	
6882 6882
 	/**
6883
-	* Gets all arrival airports of the airplanes that have flown over based on a aircraft manufacturer
6884
-	*
6885
-	* @return Array the airport list
6886
-	*
6887
-	*/
6883
+	 * Gets all arrival airports of the airplanes that have flown over based on a aircraft manufacturer
6884
+	 *
6885
+	 * @return Array the airport list
6886
+	 *
6887
+	 */
6888 6888
 	public function countAllArrivalAirportsByManufacturer($aircraft_manufacturer,$filters = array())
6889 6889
 	{
6890 6890
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6918,11 +6918,11 @@  discard block
 block discarded – undo
6918 6918
 	
6919 6919
 	
6920 6920
 	/**
6921
-	* Gets all arrival airports by country of the airplanes that have flown over based on a aircraft manufacturer
6922
-	*
6923
-	* @return Array the airport list
6924
-	*
6925
-	*/
6921
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a aircraft manufacturer
6922
+	 *
6923
+	 * @return Array the airport list
6924
+	 *
6925
+	 */
6926 6926
 	public function countAllArrivalAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array())
6927 6927
 	{
6928 6928
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6953,11 +6953,11 @@  discard block
 block discarded – undo
6953 6953
 	
6954 6954
 	
6955 6955
 	/**
6956
-	* Gets all arrival airports of the airplanes that have flown over based on a date
6957
-	*
6958
-	* @return Array the airport list
6959
-	*
6960
-	*/
6956
+	 * Gets all arrival airports of the airplanes that have flown over based on a date
6957
+	 *
6958
+	 * @return Array the airport list
6959
+	 *
6960
+	 */
6961 6961
 	public function countAllArrivalAirportsByDate($date,$filters = array())
6962 6962
 	{
6963 6963
 		global $globalTimezone, $globalDBdriver;
@@ -7003,11 +7003,11 @@  discard block
 block discarded – undo
7003 7003
 	
7004 7004
 	
7005 7005
 	/**
7006
-	* Gets all arrival airports by country of the airplanes that have flown over based on a date
7007
-	*
7008
-	* @return Array the airport list
7009
-	*
7010
-	*/
7006
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a date
7007
+	 *
7008
+	 * @return Array the airport list
7009
+	 *
7010
+	 */
7011 7011
 	public function countAllArrivalAirportCountriesByDate($date, $filters = array())
7012 7012
 	{
7013 7013
 		global $globalTimezone, $globalDBdriver;
@@ -7050,11 +7050,11 @@  discard block
 block discarded – undo
7050 7050
 	
7051 7051
 	
7052 7052
 	/**
7053
-	* Gets all arrival airports of the airplanes that have flown over based on a ident/callsign
7054
-	*
7055
-	* @return Array the airport list
7056
-	*
7057
-	*/
7053
+	 * Gets all arrival airports of the airplanes that have flown over based on a ident/callsign
7054
+	 *
7055
+	 * @return Array the airport list
7056
+	 *
7057
+	 */
7058 7058
 	public function countAllArrivalAirportsByIdent($ident,$filters = array())
7059 7059
 	{
7060 7060
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7087,11 +7087,11 @@  discard block
 block discarded – undo
7087 7087
 	
7088 7088
 	
7089 7089
 	/**
7090
-	* Gets all arrival airports by country of the airplanes that have flown over based on a callsign/ident
7091
-	*
7092
-	* @return Array the airport list
7093
-	*
7094
-	*/
7090
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a callsign/ident
7091
+	 *
7092
+	 * @return Array the airport list
7093
+	 *
7094
+	 */
7095 7095
 	public function countAllArrivalAirportCountriesByIdent($ident, $filters = array())
7096 7096
 	{
7097 7097
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7122,11 +7122,11 @@  discard block
 block discarded – undo
7122 7122
 	
7123 7123
 	
7124 7124
 	/**
7125
-	* Gets all arrival airports of the airplanes that have flown over based on a country
7126
-	*
7127
-	* @return Array the airport list
7128
-	*
7129
-	*/
7125
+	 * Gets all arrival airports of the airplanes that have flown over based on a country
7126
+	 *
7127
+	 * @return Array the airport list
7128
+	 *
7129
+	 */
7130 7130
 	public function countAllArrivalAirportsByCountry($country,$filters = array())
7131 7131
 	{
7132 7132
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7159,11 +7159,11 @@  discard block
 block discarded – undo
7159 7159
 	
7160 7160
 	
7161 7161
 	/**
7162
-	* Gets all arrival airports by country of the airplanes that have flown over based on a country
7163
-	*
7164
-	* @return Array the airport list
7165
-	*
7166
-	*/
7162
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a country
7163
+	 *
7164
+	 * @return Array the airport list
7165
+	 *
7166
+	 */
7167 7167
 	public function countAllArrivalAirportCountriesByCountry($country,$filters = array())
7168 7168
 	{
7169 7169
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7194,11 +7194,11 @@  discard block
 block discarded – undo
7194 7194
 
7195 7195
 
7196 7196
 	/**
7197
-	* Counts all airport departure countries
7198
-	*
7199
-	* @return Array the airport departure list
7200
-	*
7201
-	*/
7197
+	 * Counts all airport departure countries
7198
+	 *
7199
+	 * @return Array the airport departure list
7200
+	 *
7201
+	 */
7202 7202
 	public function countAllDepartureCountries($filters = array())
7203 7203
 	{
7204 7204
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7228,11 +7228,11 @@  discard block
 block discarded – undo
7228 7228
 	
7229 7229
 	
7230 7230
 	/**
7231
-	* Counts all airport arrival countries
7232
-	*
7233
-	* @return Array the airport arrival list
7234
-	*
7235
-	*/
7231
+	 * Counts all airport arrival countries
7232
+	 *
7233
+	 * @return Array the airport arrival list
7234
+	 *
7235
+	 */
7236 7236
 	public function countAllArrivalCountries($limit = true,$filters = array())
7237 7237
 	{
7238 7238
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7265,11 +7265,11 @@  discard block
 block discarded – undo
7265 7265
 
7266 7266
 
7267 7267
 	/**
7268
-	* Gets all route combinations
7269
-	*
7270
-	* @return Array the route list
7271
-	*
7272
-	*/
7268
+	 * Gets all route combinations
7269
+	 *
7270
+	 * @return Array the route list
7271
+	 *
7272
+	 */
7273 7273
 	public function countAllRoutes($filters = array())
7274 7274
 	{
7275 7275
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7308,11 +7308,11 @@  discard block
 block discarded – undo
7308 7308
 	
7309 7309
 	
7310 7310
 	/**
7311
-	* Gets all route combinations based on an aircraft
7312
-	*
7313
-	* @return Array the route list
7314
-	*
7315
-	*/
7311
+	 * Gets all route combinations based on an aircraft
7312
+	 *
7313
+	 * @return Array the route list
7314
+	 *
7315
+	 */
7316 7316
 	public function countAllRoutesByAircraft($aircraft_icao,$filters = array())
7317 7317
 	{
7318 7318
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7348,11 +7348,11 @@  discard block
 block discarded – undo
7348 7348
 	
7349 7349
 	
7350 7350
 	/**
7351
-	* Gets all route combinations based on an aircraft registration
7352
-	*
7353
-	* @return Array the route list
7354
-	*
7355
-	*/
7351
+	 * Gets all route combinations based on an aircraft registration
7352
+	 *
7353
+	 * @return Array the route list
7354
+	 *
7355
+	 */
7356 7356
 	public function countAllRoutesByRegistration($registration, $filters = array())
7357 7357
 	{
7358 7358
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7390,11 +7390,11 @@  discard block
 block discarded – undo
7390 7390
 	
7391 7391
 	
7392 7392
 	/**
7393
-	* Gets all route combinations based on an airline
7394
-	*
7395
-	* @return Array the route list
7396
-	*
7397
-	*/
7393
+	 * Gets all route combinations based on an airline
7394
+	 *
7395
+	 * @return Array the route list
7396
+	 *
7397
+	 */
7398 7398
 	public function countAllRoutesByAirline($airline_icao, $filters = array())
7399 7399
 	{
7400 7400
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7432,11 +7432,11 @@  discard block
 block discarded – undo
7432 7432
 	
7433 7433
 	
7434 7434
 	/**
7435
-	* Gets all route combinations based on an airport
7436
-	*
7437
-	* @return Array the route list
7438
-	*
7439
-	*/
7435
+	 * Gets all route combinations based on an airport
7436
+	 *
7437
+	 * @return Array the route list
7438
+	 *
7439
+	 */
7440 7440
 	public function countAllRoutesByAirport($airport_icao, $filters = array())
7441 7441
 	{
7442 7442
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7473,11 +7473,11 @@  discard block
 block discarded – undo
7473 7473
 	
7474 7474
 	
7475 7475
 	/**
7476
-	* Gets all route combinations based on an country
7477
-	*
7478
-	* @return Array the route list
7479
-	*
7480
-	*/
7476
+	 * Gets all route combinations based on an country
7477
+	 *
7478
+	 * @return Array the route list
7479
+	 *
7480
+	 */
7481 7481
 	public function countAllRoutesByCountry($country, $filters = array())
7482 7482
 	{
7483 7483
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7513,11 +7513,11 @@  discard block
 block discarded – undo
7513 7513
 
7514 7514
 
7515 7515
 	/**
7516
-	* Gets all route combinations based on an date
7517
-	*
7518
-	* @return Array the route list
7519
-	*
7520
-	*/
7516
+	 * Gets all route combinations based on an date
7517
+	 *
7518
+	 * @return Array the route list
7519
+	 *
7520
+	 */
7521 7521
 	public function countAllRoutesByDate($date, $filters = array())
7522 7522
 	{
7523 7523
 		global $globalTimezone, $globalDBdriver;
@@ -7567,11 +7567,11 @@  discard block
 block discarded – undo
7567 7567
 	
7568 7568
 	
7569 7569
 	/**
7570
-	* Gets all route combinations based on an ident/callsign
7571
-	*
7572
-	* @return Array the route list
7573
-	*
7574
-	*/
7570
+	 * Gets all route combinations based on an ident/callsign
7571
+	 *
7572
+	 * @return Array the route list
7573
+	 *
7574
+	 */
7575 7575
 	public function countAllRoutesByIdent($ident, $filters = array())
7576 7576
 	{
7577 7577
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7608,11 +7608,11 @@  discard block
 block discarded – undo
7608 7608
 	
7609 7609
 	
7610 7610
 	/**
7611
-	* Gets all route combinations based on an manufacturer
7612
-	*
7613
-	* @return Array the route list
7614
-	*
7615
-	*/
7611
+	 * Gets all route combinations based on an manufacturer
7612
+	 *
7613
+	 * @return Array the route list
7614
+	 *
7615
+	 */
7616 7616
 	public function countAllRoutesByManufacturer($aircraft_manufacturer, $filters = array())
7617 7617
 	{
7618 7618
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7650,11 +7650,11 @@  discard block
 block discarded – undo
7650 7650
 	
7651 7651
 	
7652 7652
 	/**
7653
-	* Gets all route combinations with waypoints
7654
-	*
7655
-	* @return Array the route list
7656
-	*
7657
-	*/
7653
+	 * Gets all route combinations with waypoints
7654
+	 *
7655
+	 * @return Array the route list
7656
+	 *
7657
+	 */
7658 7658
 	public function countAllRoutesWithWaypoints($filters = array())
7659 7659
 	{
7660 7660
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7691,11 +7691,11 @@  discard block
 block discarded – undo
7691 7691
 	}
7692 7692
 	
7693 7693
 	/**
7694
-	* Gets all callsigns that have flown over
7695
-	*
7696
-	* @return Array the callsign list
7697
-	*
7698
-	*/
7694
+	 * Gets all callsigns that have flown over
7695
+	 *
7696
+	 * @return Array the callsign list
7697
+	 *
7698
+	 */
7699 7699
 	public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
7700 7700
 	{
7701 7701
 		global $globalDBdriver;
@@ -7733,11 +7733,11 @@  discard block
 block discarded – undo
7733 7733
 	}
7734 7734
 
7735 7735
 	/**
7736
-	* Gets all callsigns that have flown over
7737
-	*
7738
-	* @return Array the callsign list
7739
-	*
7740
-	*/
7736
+	 * Gets all callsigns that have flown over
7737
+	 *
7738
+	 * @return Array the callsign list
7739
+	 *
7740
+	 */
7741 7741
 	public function countAllCallsignsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
7742 7742
 	{
7743 7743
 		global $globalDBdriver;
@@ -7778,11 +7778,11 @@  discard block
 block discarded – undo
7778 7778
 
7779 7779
 
7780 7780
 	/**
7781
-	* Counts all dates
7782
-	*
7783
-	* @return Array the date list
7784
-	*
7785
-	*/
7781
+	 * Counts all dates
7782
+	 *
7783
+	 * @return Array the date list
7784
+	 *
7785
+	 */
7786 7786
 	public function countAllDates($filters = array())
7787 7787
 	{
7788 7788
 		global $globalTimezone, $globalDBdriver;
@@ -7827,11 +7827,11 @@  discard block
 block discarded – undo
7827 7827
 	}
7828 7828
 	
7829 7829
 	/**
7830
-	* Counts all dates
7831
-	*
7832
-	* @return Array the date list
7833
-	*
7834
-	*/
7830
+	 * Counts all dates
7831
+	 *
7832
+	 * @return Array the date list
7833
+	 *
7834
+	 */
7835 7835
 	public function countAllDatesByAirlines($filters = array())
7836 7836
 	{
7837 7837
 		global $globalTimezone, $globalDBdriver;
@@ -7876,11 +7876,11 @@  discard block
 block discarded – undo
7876 7876
 	}	
7877 7877
 	
7878 7878
 	/**
7879
-	* Counts all dates during the last 7 days
7880
-	*
7881
-	* @return Array the date list
7882
-	*
7883
-	*/
7879
+	 * Counts all dates during the last 7 days
7880
+	 *
7881
+	 * @return Array the date list
7882
+	 *
7883
+	 */
7884 7884
 	public function countAllDatesLast7Days($filters = array())
7885 7885
 	{
7886 7886
 		global $globalTimezone, $globalDBdriver;
@@ -7902,7 +7902,7 @@  discard block
 block discarded – undo
7902 7902
 			$query .= " GROUP BY date_name 
7903 7903
 								ORDER BY date_name ASC";
7904 7904
 			$query_data = array(':offset' => $offset);
7905
-    		}
7905
+			}
7906 7906
 		
7907 7907
 		$sth = $this->db->prepare($query);
7908 7908
 		$sth->execute($query_data);
@@ -7922,11 +7922,11 @@  discard block
 block discarded – undo
7922 7922
 	}
7923 7923
 
7924 7924
 	/**
7925
-	* Counts all dates during the last month
7926
-	*
7927
-	* @return Array the date list
7928
-	*
7929
-	*/
7925
+	 * Counts all dates during the last month
7926
+	 *
7927
+	 * @return Array the date list
7928
+	 *
7929
+	 */
7930 7930
 	public function countAllDatesLastMonth($filters = array())
7931 7931
 	{
7932 7932
 		global $globalTimezone, $globalDBdriver;
@@ -7948,7 +7948,7 @@  discard block
 block discarded – undo
7948 7948
 			$query .= " GROUP BY date_name 
7949 7949
 								ORDER BY date_name ASC";
7950 7950
 			$query_data = array(':offset' => $offset);
7951
-    		}
7951
+			}
7952 7952
 		
7953 7953
 		$sth = $this->db->prepare($query);
7954 7954
 		$sth->execute($query_data);
@@ -7969,11 +7969,11 @@  discard block
 block discarded – undo
7969 7969
 
7970 7970
 
7971 7971
 	/**
7972
-	* Counts all dates during the last month
7973
-	*
7974
-	* @return Array the date list
7975
-	*
7976
-	*/
7972
+	 * Counts all dates during the last month
7973
+	 *
7974
+	 * @return Array the date list
7975
+	 *
7976
+	 */
7977 7977
 	public function countAllDatesLastMonthByAirlines($filters = array())
7978 7978
 	{
7979 7979
 		global $globalTimezone, $globalDBdriver;
@@ -7996,7 +7996,7 @@  discard block
 block discarded – undo
7996 7996
 								GROUP BY spotter_output.airline_icao, date_name 
7997 7997
 								ORDER BY date_name ASC";
7998 7998
 			$query_data = array(':offset' => $offset);
7999
-    		}
7999
+			}
8000 8000
 		
8001 8001
 		$sth = $this->db->prepare($query);
8002 8002
 		$sth->execute($query_data);
@@ -8018,11 +8018,11 @@  discard block
 block discarded – undo
8018 8018
 	
8019 8019
 
8020 8020
 	/**
8021
-	* Counts all month
8022
-	*
8023
-	* @return Array the month list
8024
-	*
8025
-	*/
8021
+	 * Counts all month
8022
+	 *
8023
+	 * @return Array the month list
8024
+	 *
8025
+	 */
8026 8026
 	public function countAllMonths($filters = array())
8027 8027
 	{
8028 8028
 		global $globalTimezone, $globalDBdriver;
@@ -8064,11 +8064,11 @@  discard block
 block discarded – undo
8064 8064
 	}
8065 8065
 
8066 8066
 	/**
8067
-	* Counts all month
8068
-	*
8069
-	* @return Array the month list
8070
-	*
8071
-	*/
8067
+	 * Counts all month
8068
+	 *
8069
+	 * @return Array the month list
8070
+	 *
8071
+	 */
8072 8072
 	public function countAllMonthsByAirlines($filters = array())
8073 8073
 	{
8074 8074
 		global $globalTimezone, $globalDBdriver;
@@ -8113,11 +8113,11 @@  discard block
 block discarded – undo
8113 8113
 	}
8114 8114
 
8115 8115
 	/**
8116
-	* Counts all military month
8117
-	*
8118
-	* @return Array the month list
8119
-	*
8120
-	*/
8116
+	 * Counts all military month
8117
+	 *
8118
+	 * @return Array the month list
8119
+	 *
8120
+	 */
8121 8121
 	public function countAllMilitaryMonths($filters = array())
8122 8122
 	{
8123 8123
 		global $globalTimezone, $globalDBdriver;
@@ -8158,11 +8158,11 @@  discard block
 block discarded – undo
8158 8158
 	}
8159 8159
 	
8160 8160
 	/**
8161
-	* Counts all month owners
8162
-	*
8163
-	* @return Array the month list
8164
-	*
8165
-	*/
8161
+	 * Counts all month owners
8162
+	 *
8163
+	 * @return Array the month list
8164
+	 *
8165
+	 */
8166 8166
 	public function countAllMonthsOwners($filters = array())
8167 8167
 	{
8168 8168
 		global $globalTimezone, $globalDBdriver;
@@ -8204,11 +8204,11 @@  discard block
 block discarded – undo
8204 8204
 	}
8205 8205
 	
8206 8206
 	/**
8207
-	* Counts all month owners
8208
-	*
8209
-	* @return Array the month list
8210
-	*
8211
-	*/
8207
+	 * Counts all month owners
8208
+	 *
8209
+	 * @return Array the month list
8210
+	 *
8211
+	 */
8212 8212
 	public function countAllMonthsOwnersByAirlines($filters = array())
8213 8213
 	{
8214 8214
 		global $globalTimezone, $globalDBdriver;
@@ -8251,11 +8251,11 @@  discard block
 block discarded – undo
8251 8251
 	}
8252 8252
 
8253 8253
 	/**
8254
-	* Counts all month pilot
8255
-	*
8256
-	* @return Array the month list
8257
-	*
8258
-	*/
8254
+	 * Counts all month pilot
8255
+	 *
8256
+	 * @return Array the month list
8257
+	 *
8258
+	 */
8259 8259
 	public function countAllMonthsPilots($filters = array())
8260 8260
 	{
8261 8261
 		global $globalTimezone, $globalDBdriver;
@@ -8297,11 +8297,11 @@  discard block
 block discarded – undo
8297 8297
 	}
8298 8298
 	
8299 8299
 	/**
8300
-	* Counts all month pilot
8301
-	*
8302
-	* @return Array the month list
8303
-	*
8304
-	*/
8300
+	 * Counts all month pilot
8301
+	 *
8302
+	 * @return Array the month list
8303
+	 *
8304
+	 */
8305 8305
 	public function countAllMonthsPilotsByAirlines($filters = array())
8306 8306
 	{
8307 8307
 		global $globalTimezone, $globalDBdriver;
@@ -8344,11 +8344,11 @@  discard block
 block discarded – undo
8344 8344
 	}
8345 8345
 
8346 8346
 	/**
8347
-	* Counts all month airline
8348
-	*
8349
-	* @return Array the month list
8350
-	*
8351
-	*/
8347
+	 * Counts all month airline
8348
+	 *
8349
+	 * @return Array the month list
8350
+	 *
8351
+	 */
8352 8352
 	public function countAllMonthsAirlines($filters = array())
8353 8353
 	{
8354 8354
 		global $globalTimezone, $globalDBdriver;
@@ -8390,11 +8390,11 @@  discard block
 block discarded – undo
8390 8390
 	}
8391 8391
 	
8392 8392
 	/**
8393
-	* Counts all month aircraft
8394
-	*
8395
-	* @return Array the month list
8396
-	*
8397
-	*/
8393
+	 * Counts all month aircraft
8394
+	 *
8395
+	 * @return Array the month list
8396
+	 *
8397
+	 */
8398 8398
 	public function countAllMonthsAircrafts($filters = array())
8399 8399
 	{
8400 8400
 		global $globalTimezone, $globalDBdriver;
@@ -8437,11 +8437,11 @@  discard block
 block discarded – undo
8437 8437
 	
8438 8438
 
8439 8439
 	/**
8440
-	* Counts all month aircraft
8441
-	*
8442
-	* @return Array the month list
8443
-	*
8444
-	*/
8440
+	 * Counts all month aircraft
8441
+	 *
8442
+	 * @return Array the month list
8443
+	 *
8444
+	 */
8445 8445
 	public function countAllMonthsAircraftsByAirlines($filters = array())
8446 8446
 	{
8447 8447
 		global $globalTimezone, $globalDBdriver;
@@ -8484,11 +8484,11 @@  discard block
 block discarded – undo
8484 8484
 	}
8485 8485
 
8486 8486
 	/**
8487
-	* Counts all month real arrival
8488
-	*
8489
-	* @return Array the month list
8490
-	*
8491
-	*/
8487
+	 * Counts all month real arrival
8488
+	 *
8489
+	 * @return Array the month list
8490
+	 *
8491
+	 */
8492 8492
 	public function countAllMonthsRealArrivals($filters = array())
8493 8493
 	{
8494 8494
 		global $globalTimezone, $globalDBdriver;
@@ -8531,11 +8531,11 @@  discard block
 block discarded – undo
8531 8531
 	
8532 8532
 
8533 8533
 	/**
8534
-	* Counts all month real arrival
8535
-	*
8536
-	* @return Array the month list
8537
-	*
8538
-	*/
8534
+	 * Counts all month real arrival
8535
+	 *
8536
+	 * @return Array the month list
8537
+	 *
8538
+	 */
8539 8539
 	public function countAllMonthsRealArrivalsByAirlines($filters = array())
8540 8540
 	{
8541 8541
 		global $globalTimezone, $globalDBdriver;
@@ -8579,11 +8579,11 @@  discard block
 block discarded – undo
8579 8579
 	
8580 8580
 
8581 8581
 	/**
8582
-	* Counts all dates during the last year
8583
-	*
8584
-	* @return Array the date list
8585
-	*
8586
-	*/
8582
+	 * Counts all dates during the last year
8583
+	 *
8584
+	 * @return Array the date list
8585
+	 *
8586
+	 */
8587 8587
 	public function countAllMonthsLastYear($filters)
8588 8588
 	{
8589 8589
 		global $globalTimezone, $globalDBdriver;
@@ -8605,7 +8605,7 @@  discard block
 block discarded – undo
8605 8605
 			$query .= " GROUP BY year_name, month_name
8606 8606
 								ORDER BY year_name, month_name ASC";
8607 8607
 			$query_data = array(':offset' => $offset);
8608
-    		}
8608
+			}
8609 8609
 		
8610 8610
 		$sth = $this->db->prepare($query);
8611 8611
 		$sth->execute($query_data);
@@ -8628,11 +8628,11 @@  discard block
 block discarded – undo
8628 8628
 	
8629 8629
 	
8630 8630
 	/**
8631
-	* Counts all hours
8632
-	*
8633
-	* @return Array the hour list
8634
-	*
8635
-	*/
8631
+	 * Counts all hours
8632
+	 *
8633
+	 * @return Array the hour list
8634
+	 *
8635
+	 */
8636 8636
 	public function countAllHours($orderby,$filters = array())
8637 8637
 	{
8638 8638
 		global $globalTimezone, $globalDBdriver;
@@ -8693,11 +8693,11 @@  discard block
 block discarded – undo
8693 8693
 	}
8694 8694
 	
8695 8695
 	/**
8696
-	* Counts all hours
8697
-	*
8698
-	* @return Array the hour list
8699
-	*
8700
-	*/
8696
+	 * Counts all hours
8697
+	 *
8698
+	 * @return Array the hour list
8699
+	 *
8700
+	 */
8701 8701
 	public function countAllHoursByAirlines($orderby, $filters = array())
8702 8702
 	{
8703 8703
 		global $globalTimezone, $globalDBdriver;
@@ -8760,11 +8760,11 @@  discard block
 block discarded – undo
8760 8760
 
8761 8761
 
8762 8762
 	/**
8763
-	* Counts all hours by airline
8764
-	*
8765
-	* @return Array the hour list
8766
-	*
8767
-	*/
8763
+	 * Counts all hours by airline
8764
+	 *
8765
+	 * @return Array the hour list
8766
+	 *
8767
+	 */
8768 8768
 	public function countAllHoursByAirline($airline_icao, $filters = array())
8769 8769
 	{
8770 8770
 		global $globalTimezone, $globalDBdriver;
@@ -8810,11 +8810,11 @@  discard block
 block discarded – undo
8810 8810
 	
8811 8811
 	
8812 8812
 	/**
8813
-	* Counts all hours by aircraft
8814
-	*
8815
-	* @return Array the hour list
8816
-	*
8817
-	*/
8813
+	 * Counts all hours by aircraft
8814
+	 *
8815
+	 * @return Array the hour list
8816
+	 *
8817
+	 */
8818 8818
 	public function countAllHoursByAircraft($aircraft_icao, $filters = array())
8819 8819
 	{
8820 8820
 		global $globalTimezone, $globalDBdriver;
@@ -8857,11 +8857,11 @@  discard block
 block discarded – undo
8857 8857
 	
8858 8858
 	
8859 8859
 	/**
8860
-	* Counts all hours by aircraft registration
8861
-	*
8862
-	* @return Array the hour list
8863
-	*
8864
-	*/
8860
+	 * Counts all hours by aircraft registration
8861
+	 *
8862
+	 * @return Array the hour list
8863
+	 *
8864
+	 */
8865 8865
 	public function countAllHoursByRegistration($registration, $filters = array())
8866 8866
 	{
8867 8867
 		global $globalTimezone, $globalDBdriver;
@@ -8904,11 +8904,11 @@  discard block
 block discarded – undo
8904 8904
 	
8905 8905
 	
8906 8906
 	/**
8907
-	* Counts all hours by airport
8908
-	*
8909
-	* @return Array the hour list
8910
-	*
8911
-	*/
8907
+	 * Counts all hours by airport
8908
+	 *
8909
+	 * @return Array the hour list
8910
+	 *
8911
+	 */
8912 8912
 	public function countAllHoursByAirport($airport_icao, $filters = array())
8913 8913
 	{
8914 8914
 		global $globalTimezone, $globalDBdriver;
@@ -8952,11 +8952,11 @@  discard block
 block discarded – undo
8952 8952
 	
8953 8953
 	
8954 8954
 	/**
8955
-	* Counts all hours by manufacturer
8956
-	*
8957
-	* @return Array the hour list
8958
-	*
8959
-	*/
8955
+	 * Counts all hours by manufacturer
8956
+	 *
8957
+	 * @return Array the hour list
8958
+	 *
8959
+	 */
8960 8960
 	public function countAllHoursByManufacturer($aircraft_manufacturer,$filters =array())
8961 8961
 	{
8962 8962
 		global $globalTimezone, $globalDBdriver;
@@ -9000,11 +9000,11 @@  discard block
 block discarded – undo
9000 9000
 	
9001 9001
 	
9002 9002
 	/**
9003
-	* Counts all hours by date
9004
-	*
9005
-	* @return Array the hour list
9006
-	*
9007
-	*/
9003
+	 * Counts all hours by date
9004
+	 *
9005
+	 * @return Array the hour list
9006
+	 *
9007
+	 */
9008 9008
 	public function countAllHoursByDate($date, $filters = array())
9009 9009
 	{
9010 9010
 		global $globalTimezone, $globalDBdriver;
@@ -9048,11 +9048,11 @@  discard block
 block discarded – undo
9048 9048
 	
9049 9049
 	
9050 9050
 	/**
9051
-	* Counts all hours by a ident/callsign
9052
-	*
9053
-	* @return Array the hour list
9054
-	*
9055
-	*/
9051
+	 * Counts all hours by a ident/callsign
9052
+	 *
9053
+	 * @return Array the hour list
9054
+	 *
9055
+	 */
9056 9056
 	public function countAllHoursByIdent($ident, $filters = array())
9057 9057
 	{
9058 9058
 		global $globalTimezone, $globalDBdriver;
@@ -9097,11 +9097,11 @@  discard block
 block discarded – undo
9097 9097
 	
9098 9098
 	
9099 9099
 	/**
9100
-	* Counts all hours by route
9101
-	*
9102
-	* @return Array the hour list
9103
-	*
9104
-	*/
9100
+	 * Counts all hours by route
9101
+	 *
9102
+	 * @return Array the hour list
9103
+	 *
9104
+	 */
9105 9105
 	public function countAllHoursByRoute($departure_airport_icao, $arrival_airport_icao, $filters =array())
9106 9106
 	{
9107 9107
 		global $globalTimezone, $globalDBdriver;
@@ -9145,11 +9145,11 @@  discard block
 block discarded – undo
9145 9145
 	
9146 9146
 	
9147 9147
 	/**
9148
-	* Counts all hours by country
9149
-	*
9150
-	* @return Array the hour list
9151
-	*
9152
-	*/
9148
+	 * Counts all hours by country
9149
+	 *
9150
+	 * @return Array the hour list
9151
+	 *
9152
+	 */
9153 9153
 	public function countAllHoursByCountry($country, $filters = array())
9154 9154
 	{
9155 9155
 		global $globalTimezone, $globalDBdriver;
@@ -9194,11 +9194,11 @@  discard block
 block discarded – undo
9194 9194
 
9195 9195
 
9196 9196
 	/**
9197
-	* Counts all aircraft that have flown over
9198
-	*
9199
-	* @return Integer the number of aircrafts
9200
-	*
9201
-	*/
9197
+	 * Counts all aircraft that have flown over
9198
+	 *
9199
+	 * @return Integer the number of aircrafts
9200
+	 *
9201
+	 */
9202 9202
 	public function countOverallAircrafts($filters = array())
9203 9203
 	{
9204 9204
 		$filter_query = $this->getFilter($filters,true,true);
@@ -9210,11 +9210,11 @@  discard block
 block discarded – undo
9210 9210
 	}
9211 9211
 
9212 9212
 	/**
9213
-	* Counts all flight that really arrival
9214
-	*
9215
-	* @return Integer the number of aircrafts
9216
-	*
9217
-	*/
9213
+	 * Counts all flight that really arrival
9214
+	 *
9215
+	 * @return Integer the number of aircrafts
9216
+	 *
9217
+	 */
9218 9218
 	public function countOverallArrival($filters = array())
9219 9219
 	{
9220 9220
 		$filter_query = $this->getFilter($filters,true,true);
@@ -9227,11 +9227,11 @@  discard block
 block discarded – undo
9227 9227
 	}
9228 9228
 
9229 9229
 	/**
9230
-	* Counts all pilots that have flown over
9231
-	*
9232
-	* @return Integer the number of pilots
9233
-	*
9234
-	*/
9230
+	 * Counts all pilots that have flown over
9231
+	 *
9232
+	 * @return Integer the number of pilots
9233
+	 *
9234
+	 */
9235 9235
 	public function countOverallPilots($filters = array())
9236 9236
 	{
9237 9237
 		$filter_query = $this->getFilter($filters,true,true);
@@ -9243,11 +9243,11 @@  discard block
 block discarded – undo
9243 9243
 	}
9244 9244
 
9245 9245
 	/**
9246
-	* Counts all owners that have flown over
9247
-	*
9248
-	* @return Integer the number of owners
9249
-	*
9250
-	*/
9246
+	 * Counts all owners that have flown over
9247
+	 *
9248
+	 * @return Integer the number of owners
9249
+	 *
9250
+	 */
9251 9251
 	public function countOverallOwners($filters = array())
9252 9252
 	{
9253 9253
 		$filter_query = $this->getFilter($filters,true,true);
@@ -9260,11 +9260,11 @@  discard block
 block discarded – undo
9260 9260
 	
9261 9261
 	
9262 9262
 	/**
9263
-	* Counts all flights that have flown over
9264
-	*
9265
-	* @return Integer the number of flights
9266
-	*
9267
-	*/
9263
+	 * Counts all flights that have flown over
9264
+	 *
9265
+	 * @return Integer the number of flights
9266
+	 *
9267
+	 */
9268 9268
 	public function countOverallFlights($filters = array())
9269 9269
 	{
9270 9270
 		$query  = "SELECT COUNT(spotter_output.spotter_id) AS flight_count  
@@ -9277,11 +9277,11 @@  discard block
 block discarded – undo
9277 9277
 	}
9278 9278
 	
9279 9279
 	/**
9280
-	* Counts all military flights that have flown over
9281
-	*
9282
-	* @return Integer the number of flights
9283
-	*
9284
-	*/
9280
+	 * Counts all military flights that have flown over
9281
+	 *
9282
+	 * @return Integer the number of flights
9283
+	 *
9284
+	 */
9285 9285
 	public function countOverallMilitaryFlights($filters = array())
9286 9286
 	{
9287 9287
 		$filter_query = $this->getFilter($filters,true,true);
@@ -9296,11 +9296,11 @@  discard block
 block discarded – undo
9296 9296
 	
9297 9297
 	
9298 9298
 	/**
9299
-	* Counts all airlines that have flown over
9300
-	*
9301
-	* @return Integer the number of airlines
9302
-	*
9303
-	*/
9299
+	 * Counts all airlines that have flown over
9300
+	 *
9301
+	 * @return Integer the number of airlines
9302
+	 *
9303
+	 */
9304 9304
 	public function countOverallAirlines($filters = array())
9305 9305
 	{
9306 9306
 		$query  = "SELECT COUNT(DISTINCT spotter_output.airline_name) AS airline_count 
@@ -9314,11 +9314,11 @@  discard block
 block discarded – undo
9314 9314
 
9315 9315
   
9316 9316
 	/**
9317
-	* Counts all hours of today
9318
-	*
9319
-	* @return Array the hour list
9320
-	*
9321
-	*/
9317
+	 * Counts all hours of today
9318
+	 *
9319
+	 * @return Array the hour list
9320
+	 *
9321
+	 */
9322 9322
 	public function countAllHoursFromToday($filters = array())
9323 9323
 	{
9324 9324
 		global $globalTimezone, $globalDBdriver;
@@ -9358,11 +9358,11 @@  discard block
 block discarded – undo
9358 9358
 	}
9359 9359
     
9360 9360
 	/**
9361
-	* Gets all the spotter information based on calculated upcoming flights
9362
-	*
9363
-	* @return Array the spotter information
9364
-	*
9365
-	*/
9361
+	 * Gets all the spotter information based on calculated upcoming flights
9362
+	 *
9363
+	 * @return Array the spotter information
9364
+	 *
9365
+	 */
9366 9366
 	public function getUpcomingFlights($limit = '', $sort = '', $filters = array())
9367 9367
 	{
9368 9368
 		global $global_query, $globalDBdriver, $globalTimezone;
@@ -9437,12 +9437,12 @@  discard block
 block discarded – undo
9437 9437
 	}
9438 9438
     
9439 9439
     
9440
-     /**
9441
-	* Gets the Barrie Spotter ID based on the FlightAware ID
9442
-	*
9443
-	* @return Integer the Barrie Spotter ID
9440
+	 /**
9441
+	  * Gets the Barrie Spotter ID based on the FlightAware ID
9442
+	  *
9443
+	  * @return Integer the Barrie Spotter ID
9444 9444
 q	*
9445
-	*/
9445
+	  */
9446 9446
 	public function getSpotterIDBasedOnFlightAwareID($flightaware_id)
9447 9447
 	{
9448 9448
 		$flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING);
@@ -9463,13 +9463,13 @@  discard block
 block discarded – undo
9463 9463
   
9464 9464
  
9465 9465
 	/**
9466
-	* Parses a date string
9467
-	*
9468
-	* @param String $dateString the date string
9469
-	* @param String $timezone the timezone of a user
9470
-	* @return Array the time information
9471
-	*
9472
-	*/
9466
+	 * Parses a date string
9467
+	 *
9468
+	 * @param String $dateString the date string
9469
+	 * @param String $timezone the timezone of a user
9470
+	 * @return Array the time information
9471
+	 *
9472
+	 */
9473 9473
 	public function parseDateString($dateString, $timezone = '')
9474 9474
 	{
9475 9475
 		$time_array = array();
@@ -9505,12 +9505,12 @@  discard block
 block discarded – undo
9505 9505
 	
9506 9506
 	
9507 9507
 	/**
9508
-	* Parses the direction degrees to working
9509
-	*
9510
-	* @param Float $direction the direction in degrees
9511
-	* @return Array the direction information
9512
-	*
9513
-	*/
9508
+	 * Parses the direction degrees to working
9509
+	 *
9510
+	 * @param Float $direction the direction in degrees
9511
+	 * @return Array the direction information
9512
+	 *
9513
+	 */
9514 9514
 	public function parseDirection($direction = 0)
9515 9515
 	{
9516 9516
 		if ($direction == '') $direction = 0;
@@ -9589,12 +9589,12 @@  discard block
 block discarded – undo
9589 9589
 	
9590 9590
 	
9591 9591
 	/**
9592
-	* Gets the aircraft registration
9593
-	*
9594
-	* @param String $flightaware_id the flight aware id
9595
-	* @return String the aircraft registration
9596
-	*
9597
-	*/
9592
+	 * Gets the aircraft registration
9593
+	 *
9594
+	 * @param String $flightaware_id the flight aware id
9595
+	 * @return String the aircraft registration
9596
+	 *
9597
+	 */
9598 9598
 	
9599 9599
 	public function getAircraftRegistration($flightaware_id)
9600 9600
 	{
@@ -9623,12 +9623,12 @@  discard block
 block discarded – undo
9623 9623
 
9624 9624
 
9625 9625
 	/**
9626
-	* Gets the aircraft registration from ModeS
9627
-	*
9628
-	* @param String $aircraft_modes the flight ModeS in hex
9629
-	* @return String the aircraft registration
9630
-	*
9631
-	*/
9626
+	 * Gets the aircraft registration from ModeS
9627
+	 *
9628
+	 * @param String $aircraft_modes the flight ModeS in hex
9629
+	 * @return String the aircraft registration
9630
+	 *
9631
+	 */
9632 9632
 	public function getAircraftRegistrationBymodeS($aircraft_modes)
9633 9633
 	{
9634 9634
 		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
@@ -9641,19 +9641,19 @@  discard block
 block discarded – undo
9641 9641
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
9642 9642
 		$sth->closeCursor();
9643 9643
 		if (count($row) > 0) {
9644
-		    //return $row['Registration'];
9645
-		    return $row['registration'];
9644
+			//return $row['Registration'];
9645
+			return $row['registration'];
9646 9646
 		} else return '';
9647 9647
 	
9648 9648
 	}
9649 9649
 
9650 9650
 	/**
9651
-	* Gets the aircraft type from ModeS
9652
-	*
9653
-	* @param String $aircraft_modes the flight ModeS in hex
9654
-	* @return String the aircraft type
9655
-	*
9656
-	*/
9651
+	 * Gets the aircraft type from ModeS
9652
+	 *
9653
+	 * @param String $aircraft_modes the flight ModeS in hex
9654
+	 * @return String the aircraft type
9655
+	 *
9656
+	 */
9657 9657
 	public function getAircraftTypeBymodeS($aircraft_modes)
9658 9658
 	{
9659 9659
 		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
@@ -9666,19 +9666,19 @@  discard block
 block discarded – undo
9666 9666
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
9667 9667
 		$sth->closeCursor();
9668 9668
 		if (count($row) > 0) {
9669
-		    if ($row['type_flight'] == null) return '';
9670
-		    else return $row['type_flight'];
9669
+			if ($row['type_flight'] == null) return '';
9670
+			else return $row['type_flight'];
9671 9671
 		} else return '';
9672 9672
 	
9673 9673
 	}
9674 9674
 
9675 9675
 	/**
9676
-	* Gets Countrie from latitude/longitude
9677
-	*
9678
-	* @param Float $latitude latitute of the flight
9679
-	* @param Float $longitude longitute of the flight
9680
-	* @return String the countrie
9681
-	*/
9676
+	 * Gets Countrie from latitude/longitude
9677
+	 *
9678
+	 * @param Float $latitude latitute of the flight
9679
+	 * @param Float $longitude longitute of the flight
9680
+	 * @return String the countrie
9681
+	 */
9682 9682
 	public function getCountryFromLatitudeLongitude($latitude,$longitude)
9683 9683
 	{
9684 9684
 		global $globalDBdriver, $globalDebug;
@@ -9715,12 +9715,12 @@  discard block
 block discarded – undo
9715 9715
 	}
9716 9716
 
9717 9717
 	/**
9718
-	* converts the registration code using the country prefix
9719
-	*
9720
-	* @param String $registration the aircraft registration
9721
-	* @return String the aircraft registration
9722
-	*
9723
-	*/
9718
+	 * converts the registration code using the country prefix
9719
+	 *
9720
+	 * @param String $registration the aircraft registration
9721
+	 * @return String the aircraft registration
9722
+	 *
9723
+	 */
9724 9724
 	public function convertAircraftRegistration($registration)
9725 9725
 	{
9726 9726
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -9772,12 +9772,12 @@  discard block
 block discarded – undo
9772 9772
 	}
9773 9773
 
9774 9774
 	/**
9775
-	* Country from the registration code
9776
-	*
9777
-	* @param String $registration the aircraft registration
9778
-	* @return String the country
9779
-	*
9780
-	*/
9775
+	 * Country from the registration code
9776
+	 *
9777
+	 * @param String $registration the aircraft registration
9778
+	 * @return String the country
9779
+	 *
9780
+	 */
9781 9781
 	public function countryFromAircraftRegistration($registration)
9782 9782
 	{
9783 9783
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -9796,8 +9796,8 @@  discard block
 block discarded – undo
9796 9796
 				$country = $row['country'];
9797 9797
 			}
9798 9798
 		} else {
9799
-    			$registration_1 = substr($registration, 0, 1);
9800
-		        $registration_2 = substr($registration, 0, 2);
9799
+				$registration_1 = substr($registration, 0, 1);
9800
+				$registration_2 = substr($registration, 0, 2);
9801 9801
 
9802 9802
 			$country = '';
9803 9803
 			//first get the prefix based on two characters
@@ -9833,11 +9833,11 @@  discard block
 block discarded – undo
9833 9833
 	}
9834 9834
 	
9835 9835
 	/**
9836
-	* Set a new highlight value for a flight
9837
-	*
9838
-	* @param String $flightaware_id flightaware_id from spotter_output table
9839
-	* @param String $highlight New highlight value
9840
-	*/
9836
+	 * Set a new highlight value for a flight
9837
+	 *
9838
+	 * @param String $flightaware_id flightaware_id from spotter_output table
9839
+	 * @param String $highlight New highlight value
9840
+	 */
9841 9841
 	public function setHighlightFlight($flightaware_id,$highlight) {
9842 9842
 		
9843 9843
 		$query  = "UPDATE spotter_output SET highlight = :highlight WHERE flightaware_id = :flightaware_id";
@@ -9846,12 +9846,12 @@  discard block
 block discarded – undo
9846 9846
 	}
9847 9847
 	
9848 9848
 	/**
9849
-	* Gets the short url from bit.ly
9850
-	*
9851
-	* @param String $url the full url
9852
-	* @return String the bit.ly url
9853
-	*
9854
-	*/
9849
+	 * Gets the short url from bit.ly
9850
+	 *
9851
+	 * @param String $url the full url
9852
+	 * @return String the bit.ly url
9853
+	 *
9854
+	 */
9855 9855
 	public function getBitlyURL($url)
9856 9856
 	{
9857 9857
 		global $globalBitlyAccessToken;
@@ -10140,11 +10140,11 @@  discard block
 block discarded – undo
10140 10140
 			$query="SELECT name, icao, latitude, longitude, altitude, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(latitude*pi()/180)*POWER(SIN(($origLon-longitude)*pi()/180/2),2))) as distance 
10141 10141
 	                      FROM airport WHERE longitude between ($origLon-$dist/cos(radians($origLat))*69) and ($origLon+$dist/cos(radians($origLat)*69)) and latitude between ($origLat-($dist/69)) and ($origLat+($dist/69)) 
10142 10142
 	                      AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(latitude*pi()/180)*POWER(SIN(($origLon-longitude)*pi()/180/2),2)))) < $dist ORDER BY distance limit 100;";
10143
-                } else {
10143
+				} else {
10144 10144
 			$query="SELECT name, icao, latitude, longitude, altitude, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(longitude as double precision))*pi()/180/2),2))) as distance 
10145 10145
 	                      FROM airport WHERE CAST(longitude as double precision) between ($origLon-$dist/cos(radians($origLat))*69) and ($origLon+$dist/cos(radians($origLat))*69) and CAST(latitude as double precision) between ($origLat-($dist/69)) and ($origLat+($dist/69)) 
10146 10146
 	                      AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(longitude as double precision))*pi()/180/2),2)))) < $dist ORDER BY distance limit 100;";
10147
-    		}
10147
+			}
10148 10148
 		$sth = $this->db->prepare($query);
10149 10149
 		$sth->execute();
10150 10150
 		return $sth->fetchAll(PDO::FETCH_ASSOC);
Please login to merge, or discard this patch.