Completed
Push — master ( b81903...7ff9c7 )
by Yannick
07:01
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.
statistics.php 1 patch
Indentation   +179 added lines, -179 removed lines patch added patch discarded remove patch
@@ -39,11 +39,11 @@  discard block
 block discarded – undo
39 39
 		if (isset($globalTimezone) && $globalTimezone != '') date_default_timezone_set($globalTimezone);
40 40
 		print '<i>Last update: '.date('Y-m-d G:i:s',$lastupdate).'</i>';
41 41
 	}
42
-    ?>
42
+	?>
43 43
     </div>
44 44
     <?php    
45 45
 	// print_r($Stats->getAllAirlineNames()); 
46
-    ?>
46
+	?>
47 47
     <?php include('statistics-sub-menu.php'); ?>
48 48
     <p class="global-stats">
49 49
         <span><span class="badge"><?php print number_format($Stats->countOverallFlights($airline_icao,$filter_name)); ?></span> <?php echo _("Flights"); ?></span>
@@ -51,23 +51,23 @@  discard block
 block discarded – undo
51 51
         <span><span class="badge"><?php print number_format($Stats->countOverallArrival($airline_icao,$filter_name)); ?></span> <?php echo _("Arrivals seen"); ?></span>
52 52
         <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
53 53
 	<?php
54
-	    if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) {
54
+		if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) {
55 55
 	?>
56 56
     	    <span><span class="badge"><?php print number_format($Stats->countOverallPilots($airline_icao,$filter_name)); ?></span> <?php echo _("Pilots"); ?></span>
57 57
 	    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
58 58
         <?php
59
-    	    } else {
60
-    	?>
59
+			} else {
60
+		?>
61 61
     	    <span><span class="badge"><?php print number_format($Stats->countOverallOwners($airline_icao,$filter_name)); ?></span> <?php echo _("Owners"); ?></span>
62 62
 	    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
63 63
     	<?php
64
-    	    }
65
-    	?>
64
+			}
65
+		?>
66 66
         <span><span class="badge"><?php print number_format($Stats->countOverallAircrafts($airline_icao,$filter_name)); ?></span> <?php echo _("Aircrafts"); ?></span>
67 67
         <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
68 68
         <?php
69
-    		if ($airline_icao == '') {
70
-    	?>
69
+			if ($airline_icao == '') {
70
+		?>
71 71
         <span><span class="badge"><?php print number_format($Stats->countOverallAirlines($filter_name)); ?></span> <?php echo _("Airlines"); ?></span>
72 72
 	<!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
73 73
 	<?php
@@ -88,25 +88,25 @@  discard block
 block discarded – undo
88 88
             <div class="col-md-6">
89 89
                 <h2><?php echo _("Top 10 Most Common Aircraft Type"); ?></h2>
90 90
                  <?php
91
-                  $aircraft_array = $Stats->countAllAircraftTypes(true,$airline_icao,$filter_name);
92
-		    if (count($aircraft_array) == 0) print _("No data available");
93
-		    else {
91
+				  $aircraft_array = $Stats->countAllAircraftTypes(true,$airline_icao,$filter_name);
92
+			if (count($aircraft_array) == 0) print _("No data available");
93
+			else {
94 94
 
95
-                    print '<div id="chart1" class="chart" width="100%"></div>
95
+					print '<div id="chart1" class="chart" width="100%"></div>
96 96
                     <script> 
97 97
                         google.load("visualization", "1", {packages:["corechart"]});
98 98
                       google.setOnLoadCallback(drawChart1);
99 99
                       function drawChart1() {
100 100
                         var data = google.visualization.arrayToDataTable([
101 101
                             ["'._("Aircraft").'", "'._("# of times").'"], ';
102
-                            $aircraft_data = '';
103
-                          foreach($aircraft_array as $aircraft_item)
104
-                                    {
105
-                                            $aircraft_data .= '[ "'.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],';
106
-                                    }
107
-                                    $aircraft_data = substr($aircraft_data, 0, -1);
108
-                                    print $aircraft_data;
109
-                        print ']);
102
+							$aircraft_data = '';
103
+						  foreach($aircraft_array as $aircraft_item)
104
+									{
105
+											$aircraft_data .= '[ "'.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],';
106
+									}
107
+									$aircraft_data = substr($aircraft_data, 0, -1);
108
+									print $aircraft_data;
109
+						print ']);
110 110
 
111 111
                         var options = {
112 112
                             chartArea: {"width": "80%", "height": "60%"},
@@ -121,8 +121,8 @@  discard block
 block discarded – undo
121 121
                               drawChart1();
122 122
                             });
123 123
                   </script>';
124
-                  }
125
-                  ?>
124
+				  }
125
+				  ?>
126 126
                 <div class="more">
127 127
                     <a href="<?php print $globalURL; ?>/statistics/aircraft" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
128 128
                 </div>
@@ -130,26 +130,26 @@  discard block
 block discarded – undo
130 130
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
131 131
 <?php
132 132
 //    echo $airline_icao;
133
-    if ($airline_icao == '' || $airline_icao == 'all') {
133
+	if ($airline_icao == '' || $airline_icao == 'all') {
134 134
 	$airline_array = $Stats->countAllAirlines(true,$filter_name);
135 135
 	if (count($airline_array) > 0) {
136
-            print '<div class="col-md-6">';
137
-	    print '<h2>'._("Top 10 Most Common Airline").'</h2>';
138
-	    print '<div id="chart2" class="chart" width="100%"></div>
136
+			print '<div class="col-md-6">';
137
+		print '<h2>'._("Top 10 Most Common Airline").'</h2>';
138
+		print '<div id="chart2" class="chart" width="100%"></div>
139 139
                     <script> 
140 140
                         google.load("visualization", "1", {packages:["corechart"]});
141 141
                       google.setOnLoadCallback(drawChart2);
142 142
                       function drawChart2() {
143 143
                         var data = google.visualization.arrayToDataTable([
144 144
                             ["'._("Airline").'", "'._("# of times").'"], ';
145
-	    $airline_data = '';
146
-	    foreach($airline_array as $airline_item)
147
-	    {
145
+		$airline_data = '';
146
+		foreach($airline_array as $airline_item)
147
+		{
148 148
 		$airline_data .= '[ "'.$airline_item['airline_name'].' ('.$airline_item['airline_icao'].')",'.$airline_item['airline_count'].'],';
149
-	    }
150
-	    $airline_data = substr($airline_data, 0, -1);
151
-	    print $airline_data;
152
-	    print ']);
149
+		}
150
+		$airline_data = substr($airline_data, 0, -1);
151
+		print $airline_data;
152
+		print ']);
153 153
 
154 154
                         var options = {
155 155
                             chartArea: {"width": "80%", "height": "60%"},
@@ -164,23 +164,23 @@  discard block
 block discarded – undo
164 164
                               drawChart2();
165 165
                             });
166 166
                   </script>';
167
-	    print '<div class="more"><a href="'.$globalURL.'/statistics/airline" class="btn btn-default btn" role="button">'._("See full statistic").'&raquo;</a></div>';
168
-    	    print '</div>';
167
+		print '<div class="more"><a href="'.$globalURL.'/statistics/airline" class="btn btn-default btn" role="button">'._("See full statistic").'&raquo;</a></div>';
168
+			print '</div>';
169 169
 	}
170 170
 ?>
171 171
         </div>
172 172
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
173 173
 <?php
174
-    }
174
+	}
175 175
 ?>
176 176
         <div class="row column">
177 177
 <?php
178
-    $flightover_array = $Stats->countAllFlightOverCountries($airline_icao,$filter_name);
179
-    if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) {
178
+	$flightover_array = $Stats->countAllFlightOverCountries($airline_icao,$filter_name);
179
+	if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) {
180 180
 	if (empty($flightover_array)) {
181
-	    print '<div class="col-md-12">';
181
+		print '<div class="col-md-12">';
182 182
 	} else {
183
-            print '<div class="col-md-6">';
183
+			print '<div class="col-md-6">';
184 184
 	}
185 185
 ?>
186 186
                 <h2><?php echo _("Top 10 Most Common Pilots"); ?></h2>
@@ -188,21 +188,21 @@  discard block
 block discarded – undo
188 188
 	$pilot_array = $Stats->countAllPilots(true,$airline_icao,$filter_name);
189 189
 	if (count($pilot_array) == 0) print _("No data available");
190 190
 	else {
191
-	    print '<div id="chart7" class="chart" width="100%"></div>
191
+		print '<div id="chart7" class="chart" width="100%"></div>
192 192
                     <script> 
193 193
                         google.load("visualization", "1", {packages:["corechart"]});
194 194
                       google.setOnLoadCallback(drawChart7);
195 195
                       function drawChart7() {
196 196
                         var data = google.visualization.arrayToDataTable([
197 197
                             ["'._("Pilots").'", "'._("# of times").'"], ';
198
-	    $pilot_data = '';
199
-	    foreach($pilot_array as $pilot_item)
200
-	    {
198
+		$pilot_data = '';
199
+		foreach($pilot_array as $pilot_item)
200
+		{
201 201
 		$pilot_data .= '[ "'.$pilot_item['pilot_name'].' ('.$pilot_item['pilot_id'].')",'.$pilot_item['pilot_count'].'],';
202
-	    }
203
-	    $pilot_data = substr($pilot_data, 0, -1);
204
-	    print $pilot_data;
205
-	    print ']);
202
+		}
203
+		$pilot_data = substr($pilot_data, 0, -1);
204
+		print $pilot_data;
205
+		print ']);
206 206
 
207 207
                         var options = {
208 208
                             chartArea: {"width": "80%", "height": "60%"},
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
                               drawChart7();
218 218
                             });
219 219
                   </script>';
220
-        }
220
+		}
221 221
 ?>
222 222
                 <div class="more">
223 223
                     <a href="<?php print $globalURL; ?>/statistics/pilot" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
         
227 227
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
228 228
 <?php
229
-    } else {
229
+	} else {
230 230
 ?>
231 231
             <div class="col-md-6">
232 232
                 <h2><?php echo _("Top 10 Most Common Owners"); ?></h2>
@@ -234,21 +234,21 @@  discard block
 block discarded – undo
234 234
 	$owner_array = $Stats->countAllOwners(true,$airline_icao,$filter_name);
235 235
 	if (count($owner_array) == 0) print _("No data available");
236 236
 	else {
237
-	    print '<div id="chart7" class="chart" width="100%"></div>
237
+		print '<div id="chart7" class="chart" width="100%"></div>
238 238
                     <script> 
239 239
                         google.load("visualization", "1", {packages:["corechart"]});
240 240
                       google.setOnLoadCallback(drawChart7);
241 241
                       function drawChart7() {
242 242
                         var data = google.visualization.arrayToDataTable([
243 243
                             ["'._("Owner").'", "'._("# of times").'"], ';
244
-                            $owner_data = '';
245
-	    foreach($owner_array as $owner_item)
246
-	    {
244
+							$owner_data = '';
245
+		foreach($owner_array as $owner_item)
246
+		{
247 247
 		$owner_data .= '[ "'.$owner_item['owner_name'].'",'.$owner_item['owner_count'].'],';
248
-	    }
249
-	    $owner_data = substr($owner_data, 0, -1);
250
-	    print $owner_data;
251
-	    print ']);
248
+		}
249
+		$owner_data = substr($owner_data, 0, -1);
250
+		print $owner_data;
251
+		print ']);
252 252
 
253 253
                         var options = {
254 254
                             chartArea: {"width": "80%", "height": "60%"},
@@ -272,8 +272,8 @@  discard block
 block discarded – undo
272 272
         
273 273
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
274 274
 <?php
275
-    }
276
-    if (!empty($flightover_array)) {
275
+	}
276
+	if (!empty($flightover_array)) {
277 277
 ?>
278 278
             <div class="col-md-6">
279 279
                 <h2><?php echo _("Top 20 Most Common Country a Flight was Over"); ?></h2>
@@ -281,21 +281,21 @@  discard block
 block discarded – undo
281 281
 	 //$flightover_array = $Stats->countAllFlightOverCountries();
282 282
 	if (count($flightover_array) == 0) print _("No data available");
283 283
 	else {
284
-	    print '<div id="chart10" class="chart" width="100%"></div>
284
+		print '<div id="chart10" class="chart" width="100%"></div>
285 285
                     <script> 
286 286
                         google.load("visualization", "1", {packages:["corechart"]});
287 287
                       google.setOnLoadCallback(drawChart10);
288 288
                       function drawChart10() {
289 289
                         var data = google.visualization.arrayToDataTable([
290 290
                             ["'._("Country").'", "'._("# of times").'"], ';
291
-                            $flightover_data = '';
292
-	    foreach($flightover_array as $flightover_item)
293
-	    {
291
+							$flightover_data = '';
292
+		foreach($flightover_array as $flightover_item)
293
+		{
294 294
 		$flightover_data .= '[ "'.$flightover_item['flight_country'].' ('.$flightover_item['flight_country_iso2'].')",'.$flightover_item['flight_count'].'],';
295
-	    }
296
-	    $flightover_data = substr($flightover_data, 0, -1);
297
-	    print $flightover_data;
298
-	    print ']);
295
+		}
296
+		$flightover_data = substr($flightover_data, 0, -1);
297
+		print $flightover_data;
298
+		print ']);
299 299
 
300 300
                         var options = {
301 301
                             chartArea: {"width": "80%", "height": "60%"},
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
                 </div>
320 320
             </div>
321 321
 <?php
322
-    }
322
+	}
323 323
 ?>
324 324
         </div>
325 325
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
@@ -329,8 +329,8 @@  discard block
 block discarded – undo
329 329
         <div class="row column">
330 330
             <div class="col-md-6">
331 331
 <?php
332
-    $airport_airport_array = $Stats->countAllDepartureAirports(true,$airline_icao,$filter_name);
333
-    if (count($airport_airport_array) > 0) {
332
+	$airport_airport_array = $Stats->countAllDepartureAirports(true,$airline_icao,$filter_name);
333
+	if (count($airport_airport_array) > 0) {
334 334
 	print '<h2>'._("Top 10 Most Common Departure Airports").'</h2>';
335 335
 	print '<div id="chart3" class="chart" width="100%"></div>
336 336
                 <script>
@@ -343,13 +343,13 @@  discard block
 block discarded – undo
343 343
 
344 344
                 var data = google.visualization.arrayToDataTable([ 
345 345
                     ["'._("Airport").'", "'._("# of times").'"],';
346
-                    $airport_data = '';
346
+					$airport_data = '';
347 347
 	foreach($airport_airport_array as $airport_item)
348 348
 	{
349
-	    $name = $airport_item['airport_departure_city'].', '.$airport_item['airport_departure_country'].' ('.$airport_item['airport_departure_icao'].')';
350
-	    $name = str_replace("'", "", $name);
351
-	    $name = str_replace('"', "", $name);
352
-	    $airport_data .= '[ "'.$name.'",'.$airport_item['airport_departure_icao_count'].'],';
349
+		$name = $airport_item['airport_departure_city'].', '.$airport_item['airport_departure_country'].' ('.$airport_item['airport_departure_icao'].')';
350
+		$name = str_replace("'", "", $name);
351
+		$name = str_replace('"', "", $name);
352
+		$airport_data .= '[ "'.$name.'",'.$airport_item['airport_departure_icao_count'].'],';
353 353
 	}
354 354
 	$airport_data = substr($airport_data, 0, -1);
355 355
 	print $airport_data;
@@ -368,15 +368,15 @@  discard block
 block discarded – undo
368 368
               }
369 369
                 </script>';
370 370
 	print '<div class="more"><a href="'.$globalURL.'/statistics/airport-departure" class="btn btn-default btn" role="button">'._("See full statistic").'&raquo;</a></div>';
371
-    }
371
+	}
372 372
 ?>
373 373
             </div>
374 374
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
375 375
 
376 376
             <div class="col-md-6">
377 377
 <?php
378
-    $airport_airport_array2 = $Stats->countAllArrivalAirports(true,$airline_icao,$filter_name);
379
-    if (count($airport_airport_array2) > 0) {
378
+	$airport_airport_array2 = $Stats->countAllArrivalAirports(true,$airline_icao,$filter_name);
379
+	if (count($airport_airport_array2) > 0) {
380 380
 	print '<h2>'._("Top 10 Most Common Arrival Airports").'</h2>';
381 381
 	print '<div id="chart4" class="chart" width="100%"></div>
382 382
                 <script>
@@ -392,9 +392,9 @@  discard block
 block discarded – undo
392 392
 	$airport_data2 = '';
393 393
 	foreach($airport_airport_array2 as $airport_item2)
394 394
 	{
395
-	    $name2 = $airport_item2['airport_arrival_city'].', '.$airport_item2['airport_arrival_country'].' ('.$airport_item2['airport_arrival_icao'].')';
396
-	    $name2 = str_replace(array("'",'"'), '', $name2);
397
-	    $airport_data2 .= '[ "'.$name2.'",'.$airport_item2['airport_arrival_icao_count'].'],';
395
+		$name2 = $airport_item2['airport_arrival_city'].', '.$airport_item2['airport_arrival_country'].' ('.$airport_item2['airport_arrival_icao'].')';
396
+		$name2 = str_replace(array("'",'"'), '', $name2);
397
+		$airport_data2 .= '[ "'.$name2.'",'.$airport_item2['airport_arrival_icao_count'].'],';
398 398
 	}
399 399
 	$airport_data2 = substr($airport_data2, 0, -1);
400 400
 	print $airport_data2;
@@ -413,7 +413,7 @@  discard block
 block discarded – undo
413 413
               }
414 414
                 </script>';
415 415
 	print '<div class="more"><a href="'.$globalURL.'/statistics/airport-arrival" class="btn btn-default btn" role="button">'._("See full statistic").'&raquo;</a></div>';
416
-    }
416
+	}
417 417
 ?>
418 418
             </div>
419 419
         </div>
@@ -423,24 +423,24 @@  discard block
 block discarded – undo
423 423
             <div class="col-md-6">
424 424
                 <h2><?php echo _("Busiest Months of the last 12 Months"); ?></h2>
425 425
                 <?php
426
-                  $year_array = $Stats->countAllMonthsLastYear(true,$airline_icao,$filter_name);
427
-		    if (count($year_array) == 0) print _("No data available");
428
-		    else {
429
-                  print '<div id="chart8" class="chart" width="100%"></div>
426
+				  $year_array = $Stats->countAllMonthsLastYear(true,$airline_icao,$filter_name);
427
+			if (count($year_array) == 0) print _("No data available");
428
+			else {
429
+				  print '<div id="chart8" class="chart" width="100%"></div>
430 430
                     <script> 
431 431
                         google.load("visualization", "1", {packages:["corechart"]});
432 432
                       google.setOnLoadCallback(drawChart8);
433 433
                       function drawChart8() {
434 434
                         var data = google.visualization.arrayToDataTable([
435 435
                             ["'._("Month").'", "'._("# of Flights").'"], ';
436
-                            $year_data = '';
437
-                          foreach($year_array as $year_item)
438
-                                    {
439
-                                        $year_data .= '[ "'.date('F, Y',strtotime($year_item['year_name'].'-'.$year_item['month_name'].'-01')).'",'.$year_item['date_count'].'],';
440
-                                    }
441
-                                    $year_data = substr($year_data, 0, -1);
442
-                                    print $year_data;
443
-                        print ']);
436
+							$year_data = '';
437
+						  foreach($year_array as $year_item)
438
+									{
439
+										$year_data .= '[ "'.date('F, Y',strtotime($year_item['year_name'].'-'.$year_item['month_name'].'-01')).'",'.$year_item['date_count'].'],';
440
+									}
441
+									$year_data = substr($year_data, 0, -1);
442
+									print $year_data;
443
+						print ']);
444 444
 
445 445
                         var options = {
446 446
                             legend: {position: "none"},
@@ -458,8 +458,8 @@  discard block
 block discarded – undo
458 458
                               drawChart8();
459 459
                             });
460 460
                   </script>';
461
-                  }
462
-                  ?>
461
+				  }
462
+				  ?>
463 463
                 <div class="more">
464 464
                     <a href="<?php print $globalURL; ?>/statistics/year" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
465 465
                 </div>
@@ -469,24 +469,24 @@  discard block
 block discarded – undo
469 469
             <div class="col-md-6">
470 470
                 <h2><?php echo _("Busiest Day in the last Month"); ?></h2>
471 471
                 <?php
472
-                  $month_array = $Stats->countAllDatesLastMonth($airline_icao,$filter_name);
473
-		    if (count($month_array) == 0) print _("No data available");
474
-		    else {
475
-                  print '<div id="chart9" class="chart" width="100%"></div>
472
+				  $month_array = $Stats->countAllDatesLastMonth($airline_icao,$filter_name);
473
+			if (count($month_array) == 0) print _("No data available");
474
+			else {
475
+				  print '<div id="chart9" class="chart" width="100%"></div>
476 476
                     <script> 
477 477
                         google.load("visualization", "1", {packages:["corechart"]});
478 478
                       google.setOnLoadCallback(drawChart9);
479 479
                       function drawChart9() {
480 480
                         var data = google.visualization.arrayToDataTable([
481 481
                             ["'._("Day").'", "'._("# of Flights").'"], ';
482
-                            $month_data = '';
483
-                          foreach($month_array as $month_item)
484
-                                    {
485
-                                        $month_data .= '[ "'.date('F j, Y',strtotime($month_item['date_name'])).'",'.$month_item['date_count'].'],';
486
-                                    }
487
-                                    $month_data = substr($month_data, 0, -1);
488
-                                    print $month_data;
489
-                        print ']);
482
+							$month_data = '';
483
+						  foreach($month_array as $month_item)
484
+									{
485
+										$month_data .= '[ "'.date('F j, Y',strtotime($month_item['date_name'])).'",'.$month_item['date_count'].'],';
486
+									}
487
+									$month_data = substr($month_data, 0, -1);
488
+									print $month_data;
489
+						print ']);
490 490
 
491 491
                         var options = {
492 492
                             legend: {position: "none"},
@@ -504,8 +504,8 @@  discard block
 block discarded – undo
504 504
                               drawChart9();
505 505
                             });
506 506
                   </script>';
507
-                  }
508
-                  ?>
507
+				  }
508
+				  ?>
509 509
                 <div class="more">
510 510
                     <a href="<?php print $globalURL; ?>/statistics/month" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
511 511
                 </div>
@@ -515,25 +515,25 @@  discard block
 block discarded – undo
515 515
             <div class="col-md-6">
516 516
                 <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2>
517 517
                 <?php
518
-                    $date_array = $Stats->countAllDatesLast7Days($airline_icao,$filter_name);
519
-		    if (empty($date_array)) print _("No data available");
520
-		    else {
521
-                  print '<div id="chart5" class="chart" width="100%"></div>
518
+					$date_array = $Stats->countAllDatesLast7Days($airline_icao,$filter_name);
519
+			if (empty($date_array)) print _("No data available");
520
+			else {
521
+				  print '<div id="chart5" class="chart" width="100%"></div>
522 522
                     <script> 
523 523
                         google.load("visualization", "1", {packages:["corechart"]});
524 524
                       google.setOnLoadCallback(drawChart5);
525 525
                       function drawChart5() {
526 526
                         var data = google.visualization.arrayToDataTable([
527 527
                             ["'._("Date").'", "'._("# of Flights").'"], ';
528
-                            $date_data = '';
528
+							$date_data = '';
529 529
                         
530
-                          foreach($date_array as $date_item)
531
-                                    {
532
-                                        $date_data .= '[ "'.date("F j, Y", strtotime($date_item['date_name'])).'",'.$date_item['date_count'].'],';
533
-                                    }
534
-                                    $date_data = substr($date_data, 0, -1);
535
-                                    print $date_data;
536
-                        print ']);
530
+						  foreach($date_array as $date_item)
531
+									{
532
+										$date_data .= '[ "'.date("F j, Y", strtotime($date_item['date_name'])).'",'.$date_item['date_count'].'],';
533
+									}
534
+									$date_data = substr($date_data, 0, -1);
535
+									print $date_data;
536
+						print ']);
537 537
 
538 538
                         var options = {
539 539
                             legend: {position: "none"},
@@ -551,8 +551,8 @@  discard block
 block discarded – undo
551 551
                               drawChart5();
552 552
                             });
553 553
                   </script>';
554
-                  }
555
-                  ?>
554
+				  }
555
+				  ?>
556 556
                 <div class="more">
557 557
                     <a href="<?php print $globalURL; ?>/statistics/date" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
558 558
                 </div>
@@ -562,25 +562,25 @@  discard block
 block discarded – undo
562 562
             <div class="col-md-6">
563 563
                 <h2><?php echo _("Busiest Time of the Day"); ?></h2>
564 564
                 <?php
565
-                  $hour_array = $Stats->countAllHours('hour',true,$airline_icao,$filter_name);
566
-		    if (empty($hour_array)) print _("No data available");
567
-		    else {
565
+				  $hour_array = $Stats->countAllHours('hour',true,$airline_icao,$filter_name);
566
+			if (empty($hour_array)) print _("No data available");
567
+			else {
568 568
 
569
-                  print '<div id="chart6" class="chart" width="100%"></div>
569
+				  print '<div id="chart6" class="chart" width="100%"></div>
570 570
                     <script> 
571 571
                         google.load("visualization", "1", {packages:["corechart"]});
572 572
                       google.setOnLoadCallback(drawChart6);
573 573
                       function drawChart6() {
574 574
                         var data = google.visualization.arrayToDataTable([
575 575
                             ["'._("Hour").'", "'._("# of Flights").'"], ';
576
-                            $hour_data = '';
577
-                          foreach($hour_array as $hour_item)
578
-                                    {
579
-                                        $hour_data .= '[ "'.$hour_item['hour_name'].':00",'.$hour_item['hour_count'].'],';
580
-                                    }
581
-                                    $hour_data = substr($hour_data, 0, -1);
582
-                                    print $hour_data;
583
-                        print ']);
576
+							$hour_data = '';
577
+						  foreach($hour_array as $hour_item)
578
+									{
579
+										$hour_data .= '[ "'.$hour_item['hour_name'].':00",'.$hour_item['hour_count'].'],';
580
+									}
581
+									$hour_data = substr($hour_data, 0, -1);
582
+									print $hour_data;
583
+						print ']);
584 584
 
585 585
                         var options = {
586 586
                             legend: {position: "none"},
@@ -598,8 +598,8 @@  discard block
 block discarded – undo
598 598
                               drawChart6();
599 599
                             });
600 600
                   </script>';
601
-                  }
602
-                ?>
601
+				  }
602
+				?>
603 603
                 <div class="more">
604 604
                     <a href="<?php print $globalURL; ?>/statistics/time" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
605 605
                 </div>
@@ -607,21 +607,21 @@  discard block
 block discarded – undo
607 607
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
608 608
         </div>
609 609
 <?php
610
-    if (($airline_icao == '' || $airline_icao == 'all') && $filter_name == '') {
610
+	if (($airline_icao == '' || $airline_icao == 'all') && $filter_name == '') {
611 611
 ?>
612 612
         <div class="row column">
613 613
         	<?php
614
-        	    $polar = $Stats->getStatsSource(date('Y-m-d'),'polar');
615
-        	    if (!empty($polar)) {
616
-            		print '<h2>'._("Coverage pattern").'</h2>';
617
-        		foreach ($polar as $eachpolar) {
618
-        		    unset($polar_data);
619
-	        	    $Spotter = new Spotter();
620
-        		    $data = json_decode($eachpolar['source_data']);
621
-        		    foreach($data as $value => $key) {
622
-        			$direction = $Spotter->parseDirection(($value*22.5));
623
-        			$distance = $key;
624
-        			$unit = 'km';
614
+				$polar = $Stats->getStatsSource(date('Y-m-d'),'polar');
615
+				if (!empty($polar)) {
616
+					print '<h2>'._("Coverage pattern").'</h2>';
617
+				foreach ($polar as $eachpolar) {
618
+					unset($polar_data);
619
+					$Spotter = new Spotter();
620
+					$data = json_decode($eachpolar['source_data']);
621
+					foreach($data as $value => $key) {
622
+					$direction = $Spotter->parseDirection(($value*22.5));
623
+					$distance = $key;
624
+					$unit = 'km';
625 625
 				if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) {
626 626
 					$distance = round($distance*0.539957);
627 627
 					$unit = 'nm';
@@ -632,10 +632,10 @@  discard block
 block discarded – undo
632 632
 					$distance = $distance;
633 633
 					$unit = 'km';
634 634
 				}
635
-        			if (!isset($polar_data)) $polar_data = '{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}';
636
-        	    		else $polar_data = $polar_data.',{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}';
637
-        		    }
638
-        	?>
635
+					if (!isset($polar_data)) $polar_data = '{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}';
636
+						else $polar_data = $polar_data.',{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}';
637
+					}
638
+			?>
639 639
             <div class="col-md-6">
640 640
                 <h4><?php print $eachpolar['source_name']; ?></h4>
641 641
         	<div id="polar-<?php print str_replace(' ','_',strtolower($eachpolar['source_name'])); ?>" class="chart" width="100%"></div>
@@ -667,22 +667,22 @@  discard block
 block discarded – undo
667 667
 		</script>
668 668
             </div>
669 669
             <?php
670
-        	    }
671
-        	}
672
-            ?>
670
+				}
671
+			}
672
+			?>
673 673
         </div>
674 674
         <div class="row column">
675 675
             <div class="col-md-6">
676 676
         	<?php
677
-        	    $msg = $Stats->getStatsSource(date('Y-m-d'),'msg');
678
-        	    if (!empty($msg)) {
679
-            		print '<h2>'._("Messages received").'</h2>';
680
-        		foreach ($msg as $eachmsg) {
681
-        		    //$eachmsg = $msg[0];
682
-        		    $data = $eachmsg['source_data'];
683
-        		    if ($data > 500) $max = (round(($data+100)/100))*100;
684
-        		    else $max = 500;
685
-        	?>
677
+				$msg = $Stats->getStatsSource(date('Y-m-d'),'msg');
678
+				if (!empty($msg)) {
679
+					print '<h2>'._("Messages received").'</h2>';
680
+				foreach ($msg as $eachmsg) {
681
+					//$eachmsg = $msg[0];
682
+					$data = $eachmsg['source_data'];
683
+					if ($data > 500) $max = (round(($data+100)/100))*100;
684
+					else $max = 500;
685
+			?>
686 686
         	<div id="msg-<?php print str_replace(' ','_',strtolower($eachmsg['source_name'])); ?>" class="col-md-4"></div>
687 687
         	<script>
688 688
 		      var g = new JustGage({
@@ -698,9 +698,9 @@  discard block
 block discarded – undo
698 698
 			  });
699 699
 		</script>
700 700
             <?php
701
-        	   }
702
-        	}
703
-            ?>
701
+			   }
702
+			}
703
+			?>
704 704
             </div>
705 705
         </div>
706 706
         <div class="row column">
@@ -727,19 +727,19 @@  discard block
 block discarded – undo
727 727
 				$hist_data .= '[ "'.$distance.'",'.$nb.'],';
728 728
 			}
729 729
 			$hist_data = substr($hist_data, 0, -1);
730
-            ?>
730
+			?>
731 731
             <div class="col-md-6">
732 732
                 <h2><?php echo sprintf(_("Flights Distance for %s"),$source); ?></h2>
733 733
                 <?php
734
-                  print '<div id="charthist-'.str_replace(' ','_',strtolower($source)).'" class="chart" width="100%"></div>
734
+				  print '<div id="charthist-'.str_replace(' ','_',strtolower($source)).'" class="chart" width="100%"></div>
735 735
                     <script> 
736 736
                         google.load("visualization", "1", {packages:["corechart"]});
737 737
                       google.setOnLoadCallback(drawCharthist_'.str_replace(' ','_',strtolower($source)).');
738 738
                       function drawCharthist_'.str_replace(' ','_',strtolower($source)).'() {
739 739
                         var data = google.visualization.arrayToDataTable([
740 740
                             ["'._("Distance").'", "'._("# of Flights").'"], ';
741
-                            print $hist_data;
742
-                        print ']);
741
+							print $hist_data;
742
+						print ']);
743 743
 
744 744
                         var options = {
745 745
                             legend: {position: "none"},
@@ -757,15 +757,15 @@  discard block
 block discarded – undo
757 757
                               drawCharthist_'.str_replace(' ','_',strtolower($source)).'();
758 758
                             });
759 759
                   </script>';
760
-        	?>
760
+			?>
761 761
     	    </div>
762 762
 	    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
763 763
         	<?php
764
-                  }
765
-                ?>
764
+				  }
765
+				?>
766 766
         </div>
767 767
 <?php
768
-    }
768
+	}
769 769
 ?>
770 770
     </div>
771 771
 </div>  
Please login to merge, or discard this patch.
live-geojson.php 1 patch
Indentation   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -11,10 +11,10 @@  discard block
 block discarded – undo
11 11
 $Common = new Common();
12 12
 
13 13
 if (isset($_GET['download'])) {
14
-    if ($_GET['download'] == "true")
15
-    {
14
+	if ($_GET['download'] == "true")
15
+	{
16 16
 	header('Content-disposition: attachment; filename="flightairmap.json"');
17
-    }
17
+	}
18 18
 }
19 19
 header('Content-Type: text/javascript');
20 20
 
@@ -333,26 +333,26 @@  discard block
 block discarded – undo
333 333
 				
334 334
 				if ((isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true') 
335 335
 				|| (!isset($_COOKIE['flightpath']) 
336
-				    && (!isset($globalMapHistory) || $globalMapHistory || $allhistory)
337
-				    || (isset($history) && $history != '' && $history != 'NA' && ($history == $spotter_item['ident'] || $history == $spotter_item['flightaware_id']))) 
336
+					&& (!isset($globalMapHistory) || $globalMapHistory || $allhistory)
337
+					|| (isset($history) && $history != '' && $history != 'NA' && ($history == $spotter_item['ident'] || $history == $spotter_item['flightaware_id']))) 
338 338
 				|| (isset($history) && $history == '' && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id'])) {
339
-                                    if ($from_archive) {
340
-					    $spotter_history_array = $SpotterArchive->getAllArchiveSpotterDataById($spotter_item['flightaware_id']);
341
-                                    } else {
342
-					    $spotter_history_array = $SpotterLive->getAllLiveSpotterDataById($spotter_item['flightaware_id']);
343
-                                    }
344
-                            	$d = false;
339
+									if ($from_archive) {
340
+						$spotter_history_array = $SpotterArchive->getAllArchiveSpotterDataById($spotter_item['flightaware_id']);
341
+									} else {
342
+						$spotter_history_array = $SpotterLive->getAllLiveSpotterDataById($spotter_item['flightaware_id']);
343
+									}
344
+								$d = false;
345 345
 				foreach ($spotter_history_array as $key => $spotter_history)
346 346
 				{
347 347
 					$alt = round($spotter_history['altitude']/10)*10;
348 348
 					if (!isset($prev_alt) || $prev_alt != $alt) {
349
-					    if (isset($prev_alt)) {
349
+						if (isset($prev_alt)) {
350 350
 						$output_history .= '['.$spotter_history['longitude'].', '.$spotter_history['latitude'].', '.$spotter_history['altitude'].']';
351 351
 						$output_history .= ']}},';
352 352
 						$output .= $output_history;
353
-					    }
354
-					    if ($compress) $output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history","a": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": [';
355
-					    else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": [';
353
+						}
354
+						if ($compress) $output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history","a": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": [';
355
+						else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": [';
356 356
 					}
357 357
 					$output_history .= '[';
358 358
 					$output_history .=  $spotter_history['longitude'].', ';
@@ -360,38 +360,38 @@  discard block
 block discarded – undo
360 360
 					$output_history .=  $spotter_history['altitude']*30.48;
361 361
 					$output_history .= '],';
362 362
 					$prev_alt = $alt;
363
-				    //}
363
+					//}
364 364
 				}
365 365
 				if (isset($output_history)) {
366
-				    $output_history  = substr($output_history, 0, -1);
367
-				    $output_history .= ']}},';
368
-				    $output .= $output_history;
369
-				    unset($prev_alt);
370
-				    unset($output_history);
366
+					$output_history  = substr($output_history, 0, -1);
367
+					$output_history .= ']}},';
368
+					$output .= $output_history;
369
+					unset($prev_alt);
370
+					unset($output_history);
371 371
 				}
372 372
 				}
373 373
 				
374 374
 				if (isset($history) && $history == $spotter_item['ident'] && isset($spotter_item['departure_airport']) && $spotter_item['departure_airport'] != 'NA' && isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA' && ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") || (!isset($_COOKIE['MapRoute']) && (!isset($globalMapRoute) || (isset($globalMapRoute) && $globalMapRoute))))) {
375
-				    $output_air = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "route"},"geometry": {"type": "LineString","coordinates": [';
376
-				    if (isset($spotter_item['departure_airport_latitude'])) {
375
+					$output_air = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "route"},"geometry": {"type": "LineString","coordinates": [';
376
+					if (isset($spotter_item['departure_airport_latitude'])) {
377 377
 					$output_air .= '['.$spotter_item['departure_airport_longitude'].','.$spotter_item['departure_airport_latitude'].'],';
378
-				    } elseif (isset($spotter_item['departure_airport']) && $spotter_item['departure_airport'] != 'NA') {
378
+					} elseif (isset($spotter_item['departure_airport']) && $spotter_item['departure_airport'] != 'NA') {
379 379
 					$dairport = $Spotter->getAllAirportInfo($spotter_item['departure_airport']);
380 380
 					if (isset($dairport[0]['latitude'])) {
381
-					    $output_air .= '['.$dairport[0]['longitude'].','.$dairport[0]['latitude'].'],';
381
+						$output_air .= '['.$dairport[0]['longitude'].','.$dairport[0]['latitude'].'],';
382 382
 					}
383
-				    }
384
-				    if (isset($spotter_item['arrival_airport_latitude'])) {
383
+					}
384
+					if (isset($spotter_item['arrival_airport_latitude'])) {
385 385
 					$output_air .= '['.$spotter_item['arrival_airport_longitude'].','.$spotter_item['arrival_airport_latitude'].']';
386
-				    } elseif (isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA') {
386
+					} elseif (isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA') {
387 387
 					$aairport = $Spotter->getAllAirportInfo($spotter_item['arrival_airport']);
388 388
 					if (isset($aairport[0]['latitude'])) {
389
-					    $output_air .= '['.$aairport[0]['longitude'].','.$aairport[0]['latitude'].']';
389
+						$output_air .= '['.$aairport[0]['longitude'].','.$aairport[0]['latitude'].']';
390 390
 					}
391
-				    }
392
-				    $output_air .= ']}},';
393
-				    $output .= $output_air;
394
-				    unset($output_air);
391
+					}
392
+					$output_air .= ']}},';
393
+					$output .= $output_air;
394
+					unset($output_air);
395 395
 				}
396 396
 			}
397 397
 			$output  = substr($output, 0, -1);
Please login to merge, or discard this patch.
require/class.SpotterLive.php 1 patch
Indentation   +204 added lines, -204 removed lines patch added patch discarded remove patch
@@ -12,10 +12,10 @@  discard block
 block discarded – undo
12 12
 
13 13
 
14 14
 	/**
15
-	* Get SQL query part for filter used
16
-	* @param Array $filter the filter
17
-	* @return Array the SQL part
18
-	*/
15
+	 * Get SQL query part for filter used
16
+	 * @param Array $filter the filter
17
+	 * @return Array the SQL part
18
+	 */
19 19
 	public function getFilter($filter = array(),$where = false,$and = false) {
20 20
 		global $globalFilter, $globalStatsFilters, $globalFilterName;
21 21
 		$filters = array();
@@ -83,11 +83,11 @@  discard block
 block discarded – undo
83 83
 	}
84 84
 
85 85
 	/**
86
-	* Gets all the spotter information based on the latest data entry
87
-	*
88
-	* @return Array the spotter information
89
-	*
90
-	*/
86
+	 * Gets all the spotter information based on the latest data entry
87
+	 *
88
+	 * @return Array the spotter information
89
+	 *
90
+	 */
91 91
 	public function getLiveSpotterData($limit = '', $sort = '', $filter = array())
92 92
 	{
93 93
 		global $globalDBdriver, $globalLiveInterval;
@@ -126,11 +126,11 @@  discard block
 block discarded – undo
126 126
 	}
127 127
 
128 128
 	/**
129
-	* Gets Minimal Live Spotter data
130
-	*
131
-	* @return Array the spotter information
132
-	*
133
-	*/
129
+	 * Gets Minimal Live Spotter data
130
+	 *
131
+	 * @return Array the spotter information
132
+	 *
133
+	 */
134 134
 	public function getMinLiveSpotterData($filter = array())
135 135
 	{
136 136
 		global $globalDBdriver, $globalLiveInterval;
@@ -181,11 +181,11 @@  discard block
 block discarded – undo
181 181
 	}
182 182
 
183 183
 	/**
184
-	* Gets Minimal Live Spotter data since xx seconds
185
-	*
186
-	* @return Array the spotter information
187
-	*
188
-	*/
184
+	 * Gets Minimal Live Spotter data since xx seconds
185
+	 *
186
+	 * @return Array the spotter information
187
+	 *
188
+	 */
189 189
 	public function getMinLastLiveSpotterData($filter = array())
190 190
 	{
191 191
 		global $globalDBdriver, $globalLiveInterval;
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
 			$query  = 'SELECT a.aircraft_shadow, a.engine_type, a.engine_count, a.wake_category, spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
200 200
 			FROM spotter_live LEFT JOIN (SELECT aircraft_shadow,engine_type, engine_count, wake_category,icao FROM aircraft) a ON spotter_live.aircraft_icao = a.icao'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= spotter_live.date AND spotter_live.latitude <> '0' AND spotter_live.longitude <> '0' 
201 201
 			ORDER BY spotter_live.flightaware_id, spotter_live.date";
202
-                } else {
202
+				} else {
203 203
 /*
204 204
 			$query  = "SELECT a.aircraft_shadow, spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
205 205
 			FROM spotter_live WHERE CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= spotter_live.date 
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
 //			echo $query;
212 212
 		}
213 213
 
214
-    		try {
214
+			try {
215 215
 			$sth = $this->db->prepare($query);
216 216
 			$sth->execute();
217 217
 		} catch(PDOException $e) {
@@ -223,11 +223,11 @@  discard block
 block discarded – undo
223 223
 	}
224 224
 
225 225
 	/**
226
-	* Gets number of latest data entry
227
-	*
228
-	* @return String number of entry
229
-	*
230
-	*/
226
+	 * Gets number of latest data entry
227
+	 *
228
+	 * @return String number of entry
229
+	 *
230
+	 */
231 231
 	public function getLiveSpotterCount($filter = array())
232 232
 	{
233 233
 		global $globalDBdriver, $globalLiveInterval;
@@ -254,11 +254,11 @@  discard block
 block discarded – undo
254 254
 	}
255 255
 
256 256
 	/**
257
-	* Gets all the spotter information based on the latest data entry and coord
258
-	*
259
-	* @return Array the spotter information
260
-	*
261
-	*/
257
+	 * Gets all the spotter information based on the latest data entry and coord
258
+	 *
259
+	 * @return Array the spotter information
260
+	 *
261
+	 */
262 262
 	public function getLiveSpotterDatabyCoord($coord, $filter = array())
263 263
 	{
264 264
 		global $globalDBdriver, $globalLiveInterval;
@@ -283,11 +283,11 @@  discard block
 block discarded – undo
283 283
 	}
284 284
 
285 285
 	/**
286
-	* Gets all the spotter information based on a user's latitude and longitude
287
-	*
288
-	* @return Array the spotter information
289
-	*
290
-	*/
286
+	 * Gets all the spotter information based on a user's latitude and longitude
287
+	 *
288
+	 * @return Array the spotter information
289
+	 *
290
+	 */
291 291
 	public function getLatestSpotterForLayar($lat, $lng, $radius, $interval)
292 292
 	{
293 293
 		$Spotter = new Spotter($this->db);
@@ -297,145 +297,145 @@  discard block
 block discarded – undo
297 297
 				return false;
298 298
 			}
299 299
 		}
300
-        if ($lng != '')
301
-                {
302
-                        if (!is_numeric($lng))
303
-                        {
304
-                                return false;
305
-                        }
306
-                }
307
-
308
-                if ($radius != '')
309
-                {
310
-                        if (!is_numeric($radius))
311
-                        {
312
-                                return false;
313
-                        }
314
-                }
300
+		if ($lng != '')
301
+				{
302
+						if (!is_numeric($lng))
303
+						{
304
+								return false;
305
+						}
306
+				}
307
+
308
+				if ($radius != '')
309
+				{
310
+						if (!is_numeric($radius))
311
+						{
312
+								return false;
313
+						}
314
+				}
315 315
 		$additional_query = '';
316
-        if ($interval != '')
317
-                {
318
-                        if (!is_string($interval))
319
-                        {
320
-                                //$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';
321
-			        return false;
322
-                        } else {
323
-                if ($interval == '1m')
324
-                {
325
-                    $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';
326
-                } else if ($interval == '15m'){
327
-                    $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= spotter_live.date ';
328
-                } 
329
-            }
330
-                } else {
331
-         $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';   
332
-        }
333
-
334
-                $query  = "SELECT spotter_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_live 
316
+		if ($interval != '')
317
+				{
318
+						if (!is_string($interval))
319
+						{
320
+								//$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';
321
+					return false;
322
+						} else {
323
+				if ($interval == '1m')
324
+				{
325
+					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';
326
+				} else if ($interval == '15m'){
327
+					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= spotter_live.date ';
328
+				} 
329
+			}
330
+				} else {
331
+		 $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';   
332
+		}
333
+
334
+				$query  = "SELECT spotter_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_live 
335 335
                    WHERE spotter_live.latitude <> '' 
336 336
                                    AND spotter_live.longitude <> '' 
337 337
                    ".$additional_query."
338 338
                    HAVING distance < :radius  
339 339
                                    ORDER BY distance";
340 340
 
341
-                $spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius));
341
+				$spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius));
342 342
 
343
-                return $spotter_array;
344
-        }
343
+				return $spotter_array;
344
+		}
345 345
 
346 346
     
347
-        /**
348
-	* Gets all the spotter information based on a particular callsign
349
-	*
350
-	* @return Array the spotter information
351
-	*
352
-	*/
347
+		/**
348
+		 * Gets all the spotter information based on a particular callsign
349
+		 *
350
+		 * @return Array the spotter information
351
+		 *
352
+		 */
353 353
 	public function getLastLiveSpotterDataByIdent($ident)
354 354
 	{
355 355
 		$Spotter = new Spotter($this->db);
356 356
 		date_default_timezone_set('UTC');
357 357
 
358 358
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
359
-                $query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
359
+				$query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
360 360
 
361 361
 		$spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident),'',true);
362 362
 
363 363
 		return $spotter_array;
364 364
 	}
365 365
 
366
-        /**
367
-	* Gets all the spotter information based on a particular callsign
368
-	*
369
-	* @return Array the spotter information
370
-	*
371
-	*/
366
+		/**
367
+		 * Gets all the spotter information based on a particular callsign
368
+		 *
369
+		 * @return Array the spotter information
370
+		 *
371
+		 */
372 372
 	public function getDateLiveSpotterDataByIdent($ident,$date)
373 373
 	{
374 374
 		$Spotter = new Spotter($this->db);
375 375
 		date_default_timezone_set('UTC');
376 376
 
377 377
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
378
-                $query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
378
+				$query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
379 379
 
380
-                $date = date('c',$date);
380
+				$date = date('c',$date);
381 381
 		$spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident,':date' => $date));
382 382
 
383 383
 		return $spotter_array;
384 384
 	}
385 385
 
386
-        /**
387
-	* Gets last spotter information based on a particular callsign
388
-	*
389
-	* @return Array the spotter information
390
-	*
391
-	*/
386
+		/**
387
+		 * Gets last spotter information based on a particular callsign
388
+		 *
389
+		 * @return Array the spotter information
390
+		 *
391
+		 */
392 392
 	public function getLastLiveSpotterDataById($id)
393 393
 	{
394 394
 		$Spotter = new Spotter($this->db);
395 395
 		date_default_timezone_set('UTC');
396 396
 
397 397
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
398
-                $query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
398
+				$query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
399 399
 
400 400
 		$spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id),'',true);
401 401
 
402 402
 		return $spotter_array;
403 403
 	}
404 404
 
405
-        /**
406
-	* Gets last spotter information based on a particular callsign
407
-	*
408
-	* @return Array the spotter information
409
-	*
410
-	*/
405
+		/**
406
+		 * Gets last spotter information based on a particular callsign
407
+		 *
408
+		 * @return Array the spotter information
409
+		 *
410
+		 */
411 411
 	public function getDateLiveSpotterDataById($id,$date)
412 412
 	{
413 413
 		$Spotter = new Spotter($this->db);
414 414
 		date_default_timezone_set('UTC');
415 415
 
416 416
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
417
-                $query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
418
-                $date = date('c',$date);
417
+				$query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
418
+				$date = date('c',$date);
419 419
 		$spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id,':date' => $date),'',true);
420 420
 
421 421
 		return $spotter_array;
422 422
 	}
423 423
 
424
-        /**
425
-	* Gets altitude information based on a particular callsign
426
-	*
427
-	* @return Array the spotter information
428
-	*
429
-	*/
424
+		/**
425
+		 * Gets altitude information based on a particular callsign
426
+		 *
427
+		 * @return Array the spotter information
428
+		 *
429
+		 */
430 430
 	public function getAltitudeLiveSpotterDataByIdent($ident)
431 431
 	{
432 432
 
433 433
 		date_default_timezone_set('UTC');
434 434
 
435 435
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
436
-                $query  = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident';
436
+				$query  = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident';
437 437
 
438
-    		try {
438
+			try {
439 439
 			
440 440
 			$sth = $this->db->prepare($query);
441 441
 			$sth->execute(array(':ident' => $ident));
@@ -448,12 +448,12 @@  discard block
 block discarded – undo
448 448
 		return $spotter_array;
449 449
 	}
450 450
 
451
-        /**
452
-	* Gets all the spotter information based on a particular id
453
-	*
454
-	* @return Array the spotter information
455
-	*
456
-	*/
451
+		/**
452
+		 * Gets all the spotter information based on a particular id
453
+		 *
454
+		 * @return Array the spotter information
455
+		 *
456
+		 */
457 457
 	public function getAllLiveSpotterDataById($id,$liveinterval = false)
458 458
 	{
459 459
 		global $globalDBdriver, $globalLiveInterval;
@@ -481,18 +481,18 @@  discard block
 block discarded – undo
481 481
 		return $spotter_array;
482 482
 	}
483 483
 
484
-        /**
485
-	* Gets all the spotter information based on a particular ident
486
-	*
487
-	* @return Array the spotter information
488
-	*
489
-	*/
484
+		/**
485
+		 * Gets all the spotter information based on a particular ident
486
+		 *
487
+		 * @return Array the spotter information
488
+		 *
489
+		 */
490 490
 	public function getAllLiveSpotterDataByIdent($ident)
491 491
 	{
492 492
 		date_default_timezone_set('UTC');
493 493
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
494 494
 		$query  = self::$global_query.' WHERE spotter_live.ident = :ident';
495
-    		try {
495
+			try {
496 496
 			
497 497
 			$sth = $this->db->prepare($query);
498 498
 			$sth->execute(array(':ident' => $ident));
@@ -506,23 +506,23 @@  discard block
 block discarded – undo
506 506
 
507 507
 
508 508
 	/**
509
-	* Deletes all info in the table
510
-	*
511
-	* @return String success or false
512
-	*
513
-	*/
509
+	 * Deletes all info in the table
510
+	 *
511
+	 * @return String success or false
512
+	 *
513
+	 */
514 514
 	public function deleteLiveSpotterData()
515 515
 	{
516 516
 		global $globalDBdriver;
517 517
 		if ($globalDBdriver == 'mysql') {
518 518
 			//$query  = "DELETE FROM spotter_live WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE) >= spotter_live.date";
519 519
 			$query  = 'DELETE FROM spotter_live WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 9 HOUR) >= spotter_live.date';
520
-            		//$query  = "DELETE FROM spotter_live WHERE spotter_live.id IN (SELECT spotter_live.id FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) >= spotter_live.date)";
520
+					//$query  = "DELETE FROM spotter_live WHERE spotter_live.id IN (SELECT spotter_live.id FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) >= spotter_live.date)";
521 521
 		} else {
522 522
 			$query  = "DELETE FROM spotter_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' >= spotter_live.date";
523 523
 		}
524 524
         
525
-    		try {
525
+			try {
526 526
 			
527 527
 			$sth = $this->db->prepare($query);
528 528
 			$sth->execute();
@@ -534,18 +534,18 @@  discard block
 block discarded – undo
534 534
 	}
535 535
 
536 536
 	/**
537
-	* Deletes all info in the table for aircraft not seen since 2 HOUR
538
-	*
539
-	* @return String success or false
540
-	*
541
-	*/
537
+	 * Deletes all info in the table for aircraft not seen since 2 HOUR
538
+	 *
539
+	 * @return String success or false
540
+	 *
541
+	 */
542 542
 	public function deleteLiveSpotterDataNotUpdated()
543 543
 	{
544 544
 		global $globalDBdriver, $globalDebug;
545 545
 		if ($globalDBdriver == 'mysql') {
546 546
 			//$query = 'SELECT flightaware_id FROM spotter_live WHERE DATE_SUB(UTC_TIMESTAMP(), INTERVAL 1 HOUR) >= spotter_live.date AND spotter_live.flightaware_id NOT IN (SELECT flightaware_id FROM spotter_live WHERE DATE_SUB(UTC_TIMESTAMP(), INTERVAL 1 HOUR) < spotter_live.date) LIMIT 800 OFFSET 0';
547
-    			$query = "SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT flightaware_id,MAX(date) as max_date FROM spotter_live GROUP BY flightaware_id) s ON s.flightaware_id = spotter_live.flightaware_id AND DATE_SUB(UTC_TIMESTAMP(), INTERVAL 2 HOUR) >= s.max_date LIMIT 1200 OFFSET 0";
548
-    			try {
547
+				$query = "SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT flightaware_id,MAX(date) as max_date FROM spotter_live GROUP BY flightaware_id) s ON s.flightaware_id = spotter_live.flightaware_id AND DATE_SUB(UTC_TIMESTAMP(), INTERVAL 2 HOUR) >= s.max_date LIMIT 1200 OFFSET 0";
548
+				try {
549 549
 				
550 550
 				$sth = $this->db->prepare($query);
551 551
 				$sth->execute();
@@ -553,8 +553,8 @@  discard block
 block discarded – undo
553 553
 				return "error";
554 554
 			}
555 555
 			$query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN (';
556
-                        $i = 0;
557
-                        $j =0;
556
+						$i = 0;
557
+						$j =0;
558 558
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
559 559
 			foreach($all as $row)
560 560
 			{
@@ -562,20 +562,20 @@  discard block
 block discarded – undo
562 562
 				$j++;
563 563
 				if ($j == 30) {
564 564
 					if ($globalDebug) echo ".";
565
-				    	try {
565
+						try {
566 566
 						
567 567
 						$sth = $this->db->prepare(substr($query_delete,0,-1).")");
568 568
 						$sth->execute();
569 569
 					} catch(PDOException $e) {
570 570
 						return "error";
571 571
 					}
572
-                                	$query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN (';
573
-                                	$j = 0;
572
+									$query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN (';
573
+									$j = 0;
574 574
 				}
575 575
 				$query_delete .= "'".$row['flightaware_id']."',";
576 576
 			}
577 577
 			if ($i > 0) {
578
-    				try {
578
+					try {
579 579
 					
580 580
 					$sth = $this->db->prepare(substr($query_delete,0,-1).")");
581 581
 					$sth->execute();
@@ -586,9 +586,9 @@  discard block
 block discarded – undo
586 586
 			return "success";
587 587
 		} elseif ($globalDBdriver == 'pgsql') {
588 588
 			//$query = "SELECT flightaware_id FROM spotter_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' >= spotter_live.date AND spotter_live.flightaware_id NOT IN (SELECT flightaware_id FROM spotter_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' < spotter_live.date) LIMIT 800 OFFSET 0";
589
-    			//$query = "SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT flightaware_id,MAX(date) as max_date FROM spotter_live GROUP BY flightaware_id) s ON s.flightaware_id = spotter_live.flightaware_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0";
590
-    			$query = "DELETE FROM spotter_live WHERE flightaware_id IN (SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT flightaware_id,MAX(date) as max_date FROM spotter_live GROUP BY flightaware_id) s ON s.flightaware_id = spotter_live.flightaware_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0)";
591
-    			try {
589
+				//$query = "SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT flightaware_id,MAX(date) as max_date FROM spotter_live GROUP BY flightaware_id) s ON s.flightaware_id = spotter_live.flightaware_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0";
590
+				$query = "DELETE FROM spotter_live WHERE flightaware_id IN (SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT flightaware_id,MAX(date) as max_date FROM spotter_live GROUP BY flightaware_id) s ON s.flightaware_id = spotter_live.flightaware_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0)";
591
+				try {
592 592
 				
593 593
 				$sth = $this->db->prepare($query);
594 594
 				$sth->execute();
@@ -632,17 +632,17 @@  discard block
 block discarded – undo
632 632
 	}
633 633
 
634 634
 	/**
635
-	* Deletes all info in the table for an ident
636
-	*
637
-	* @return String success or false
638
-	*
639
-	*/
635
+	 * Deletes all info in the table for an ident
636
+	 *
637
+	 * @return String success or false
638
+	 *
639
+	 */
640 640
 	public function deleteLiveSpotterDataByIdent($ident)
641 641
 	{
642 642
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
643 643
 		$query  = 'DELETE FROM spotter_live WHERE ident = :ident';
644 644
         
645
-    		try {
645
+			try {
646 646
 			
647 647
 			$sth = $this->db->prepare($query);
648 648
 			$sth->execute(array(':ident' => $ident));
@@ -654,17 +654,17 @@  discard block
 block discarded – undo
654 654
 	}
655 655
 
656 656
 	/**
657
-	* Deletes all info in the table for an id
658
-	*
659
-	* @return String success or false
660
-	*
661
-	*/
657
+	 * Deletes all info in the table for an id
658
+	 *
659
+	 * @return String success or false
660
+	 *
661
+	 */
662 662
 	public function deleteLiveSpotterDataById($id)
663 663
 	{
664 664
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
665 665
 		$query  = 'DELETE FROM spotter_live WHERE flightaware_id = :id';
666 666
         
667
-    		try {
667
+			try {
668 668
 			
669 669
 			$sth = $this->db->prepare($query);
670 670
 			$sth->execute(array(':id' => $id));
@@ -677,11 +677,11 @@  discard block
 block discarded – undo
677 677
 
678 678
 
679 679
 	/**
680
-	* Gets the aircraft ident within the last hour
681
-	*
682
-	* @return String the ident
683
-	*
684
-	*/
680
+	 * Gets the aircraft ident within the last hour
681
+	 *
682
+	 * @return String the ident
683
+	 *
684
+	 */
685 685
 	public function getIdentFromLastHour($ident)
686 686
 	{
687 687
 		global $globalDBdriver, $globalTimezone;
@@ -707,14 +707,14 @@  discard block
 block discarded – undo
707 707
 			$ident_result = $row['ident'];
708 708
 		}
709 709
 		return $ident_result;
710
-        }
710
+		}
711 711
 
712 712
 	/**
713
-	* Check recent aircraft
714
-	*
715
-	* @return String the ident
716
-	*
717
-	*/
713
+	 * Check recent aircraft
714
+	 *
715
+	 * @return String the ident
716
+	 *
717
+	 */
718 718
 	public function checkIdentRecent($ident)
719 719
 	{
720 720
 		global $globalDBdriver, $globalTimezone;
@@ -740,14 +740,14 @@  discard block
 block discarded – undo
740 740
 			$ident_result = $row['flightaware_id'];
741 741
 		}
742 742
 		return $ident_result;
743
-        }
743
+		}
744 744
 
745 745
 	/**
746
-	* Check recent aircraft by id
747
-	*
748
-	* @return String the ident
749
-	*
750
-	*/
746
+	 * Check recent aircraft by id
747
+	 *
748
+	 * @return String the ident
749
+	 *
750
+	 */
751 751
 	public function checkIdRecent($id)
752 752
 	{
753 753
 		global $globalDBdriver, $globalTimezone;
@@ -773,14 +773,14 @@  discard block
 block discarded – undo
773 773
 			$ident_result = $row['flightaware_id'];
774 774
 		}
775 775
 		return $ident_result;
776
-        }
776
+		}
777 777
 
778 778
 	/**
779
-	* Check recent aircraft by ModeS
780
-	*
781
-	* @return String the ModeS
782
-	*
783
-	*/
779
+	 * Check recent aircraft by ModeS
780
+	 *
781
+	 * @return String the ModeS
782
+	 *
783
+	 */
784 784
 	public function checkModeSRecent($modes)
785 785
 	{
786 786
 		global $globalDBdriver, $globalTimezone;
@@ -807,19 +807,19 @@  discard block
 block discarded – undo
807 807
 			$ident_result = $row['flightaware_id'];
808 808
 		}
809 809
 		return $ident_result;
810
-        }
810
+		}
811 811
 
812 812
 	/**
813
-	* Adds a new spotter data
814
-	*
815
-	* @param String $flightaware_id the ID from flightaware
816
-	* @param String $ident the flight ident
817
-	* @param String $aircraft_icao the aircraft type
818
-	* @param String $departure_airport_icao the departure airport
819
-	* @param String $arrival_airport_icao the arrival airport
820
-	* @return String success or false
821
-	*
822
-	*/
813
+	 * Adds a new spotter data
814
+	 *
815
+	 * @param String $flightaware_id the ID from flightaware
816
+	 * @param String $ident the flight ident
817
+	 * @param String $aircraft_icao the aircraft type
818
+	 * @param String $departure_airport_icao the departure airport
819
+	 * @param String $arrival_airport_icao the arrival airport
820
+	 * @return String success or false
821
+	 *
822
+	 */
823 823
 	public function addLiveSpotterData($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 = '', $ModeS = '', $putinarchive = false,$registration = '',$pilot_id = '', $pilot_name = '', $verticalrate = '', $noarchive = false, $ground = false,$format_source = '', $source_name = '', $over_country = '')
824 824
 	{
825 825
 		global $globalURL, $globalArchive, $globalDebug;
@@ -954,10 +954,10 @@  discard block
 block discarded – undo
954 954
 		$arrival_airport_country = '';
955 955
 		
956 956
             	
957
-            	if ($squawk == '' || $Common->isInteger($squawk) === false ) $squawk = NULL;
958
-            	if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) $verticalrate = NULL;
959
-            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
960
-            	if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
957
+				if ($squawk == '' || $Common->isInteger($squawk) === false ) $squawk = NULL;
958
+				if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) $verticalrate = NULL;
959
+				if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
960
+				if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
961 961
             	
962 962
 		$query  = 'INSERT INTO spotter_live (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_shadow, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, 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, ModeS, pilot_id, pilot_name, verticalrate, ground, format_source, source_name, over_country) 
963 963
 		VALUES (:flightaware_id,:ident,:registration,:airline_name,:airline_icao,:airline_country,:airline_type,:aircraft_icao,:aircraft_shadow,: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,:ModeS, :pilot_id, :pilot_name, :verticalrate, :ground, :format_source, :source_name, :over_country)';
@@ -967,14 +967,14 @@  discard block
 block discarded – undo
967 967
 			
968 968
 			$sth = $this->db->prepare($query);
969 969
 			$sth->execute($query_values);
970
-                } catch(PDOException $e) {
971
-                	return "error : ".$e->getMessage();
972
-                }
970
+				} catch(PDOException $e) {
971
+					return "error : ".$e->getMessage();
972
+				}
973 973
 		if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) {
974
-		    if ($globalDebug) echo '(Add to SBS archive : ';
975
-		    $SpotterArchive = new SpotterArchive($this->db);
976
-		    $result =  $SpotterArchive->addSpotterArchiveData($flightaware_id, $ident, $registration, $airline_name, $airline_icao, $airline_country, $airline_type, $aircraft_icao, $aircraft_shadow, $aircraft_name, $aircraft_manufacturer, $departure_airport_icao, $departure_airport_name, $departure_airport_city, $departure_airport_country, $departure_airport_time,$arrival_airport_icao, $arrival_airport_name, $arrival_airport_city, $arrival_airport_country, $arrival_airport_time, $route_stop, $date,$latitude, $longitude, $waypoints, $altitude, $heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name,$verticalrate,$format_source,$source_name, $over_country);
977
-		    if ($globalDebug) echo $result.')';
974
+			if ($globalDebug) echo '(Add to SBS archive : ';
975
+			$SpotterArchive = new SpotterArchive($this->db);
976
+			$result =  $SpotterArchive->addSpotterArchiveData($flightaware_id, $ident, $registration, $airline_name, $airline_icao, $airline_country, $airline_type, $aircraft_icao, $aircraft_shadow, $aircraft_name, $aircraft_manufacturer, $departure_airport_icao, $departure_airport_name, $departure_airport_city, $departure_airport_country, $departure_airport_time,$arrival_airport_icao, $arrival_airport_name, $arrival_airport_city, $arrival_airport_country, $arrival_airport_time, $route_stop, $date,$latitude, $longitude, $waypoints, $altitude, $heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name,$verticalrate,$format_source,$source_name, $over_country);
977
+			if ($globalDebug) echo $result.')';
978 978
 		}
979 979
 		return "success";
980 980
 
Please login to merge, or discard this patch.
install/class.update_db.php 1 patch
Indentation   +404 added lines, -404 removed lines patch added patch discarded remove patch
@@ -75,38 +75,38 @@  discard block
 block discarded – undo
75 75
 		try {
76 76
 			//$Connection = new Connection();
77 77
 			$sth = $Connection->db->prepare($query);
78
-                        $sth->execute(array(':source' => $database_file));
79
-                } catch(PDOException $e) {
80
-                        return "error : ".$e->getMessage();
81
-                }
78
+						$sth->execute(array(':source' => $database_file));
79
+				} catch(PDOException $e) {
80
+						return "error : ".$e->getMessage();
81
+				}
82 82
 
83
-    		if ($globalDebug) echo " - Add routes to DB -";
84
-    		update_db::connect_sqlite($database_file);
83
+			if ($globalDebug) echo " - Add routes to DB -";
84
+			update_db::connect_sqlite($database_file);
85 85
 		//$query = 'select Route.RouteID, Route.callsign, operator.Icao AS operator_icao, FromAir.Icao AS FromAirportIcao, ToAir.Icao AS ToAirportIcao from Route inner join operator ON Route.operatorId = operator.operatorId LEFT JOIN Airport AS FromAir ON route.FromAirportId = FromAir.AirportId LEFT JOIN Airport AS ToAir ON ToAir.AirportID = route.ToAirportID';
86 86
 		$query = "select Route.RouteID, Route.callsign, operator.Icao AS operator_icao, FromAir.Icao AS FromAirportIcao, ToAir.Icao AS ToAirportIcao, rstp.allstop AS AllStop from Route inner join operator ON Route.operatorId = operator.operatorId LEFT JOIN Airport AS FromAir ON route.FromAirportId = FromAir.AirportId LEFT JOIN Airport AS ToAir ON ToAir.AirportID = route.ToAirportID LEFT JOIN (select RouteId,GROUP_CONCAT(icao,' ') as allstop from routestop left join Airport as air ON routestop.AirportId = air.AirportID group by RouteID) AS rstp ON Route.RouteID = rstp.RouteID";
87 87
 		try {
88
-                        $sth = update_db::$db_sqlite->prepare($query);
89
-                        $sth->execute();
90
-                } catch(PDOException $e) {
91
-                        return "error : ".$e->getMessage();
92
-                }
88
+						$sth = update_db::$db_sqlite->prepare($query);
89
+						$sth->execute();
90
+				} catch(PDOException $e) {
91
+						return "error : ".$e->getMessage();
92
+				}
93 93
 		//$query_dest = 'INSERT INTO routes (`RouteID`,`CallSign`,`Operator_ICAO`,`FromAirport_ICAO`,`ToAirport_ICAO`,`RouteStop`,`Source`) VALUES (:RouteID, :CallSign, :Operator_ICAO, :FromAirport_ICAO, :ToAirport_ICAO, :routestop, :source)';
94 94
 		$query_dest = 'INSERT INTO routes (CallSign,Operator_ICAO,FromAirport_ICAO,ToAirport_ICAO,RouteStop,Source) VALUES (:CallSign, :Operator_ICAO, :FromAirport_ICAO, :ToAirport_ICAO, :routestop, :source)';
95 95
 		$Connection = new Connection();
96 96
 		$sth_dest = $Connection->db->prepare($query_dest);
97 97
 		try {
98 98
 			if ($globalTransaction) $Connection->db->beginTransaction();
99
-            		while ($values = $sth->fetch(PDO::FETCH_ASSOC)) {
99
+					while ($values = $sth->fetch(PDO::FETCH_ASSOC)) {
100 100
 				//$query_dest_values = array(':RouteID' => $values['RouteId'],':CallSign' => $values['Callsign'],':Operator_ICAO' => $values['operator_icao'],':FromAirport_ICAO' => $values['FromAirportIcao'],':ToAirport_ICAO' => $values['ToAirportIcao'],':routestop' => $values['AllStop'],':source' => $database_file);
101 101
 				$query_dest_values = array(':CallSign' => $values['Callsign'],':Operator_ICAO' => $values['operator_icao'],':FromAirport_ICAO' => $values['FromAirportIcao'],':ToAirport_ICAO' => $values['ToAirportIcao'],':routestop' => $values['AllStop'],':source' => $database_file);
102 102
 				$sth_dest->execute($query_dest_values);
103
-            		}
103
+					}
104 104
 			if ($globalTransaction) $Connection->db->commit();
105 105
 		} catch(PDOException $e) {
106 106
 			if ($globalTransaction) $Connection->db->rollBack(); 
107 107
 			return "error : ".$e->getMessage();
108 108
 		}
109
-                return '';
109
+				return '';
110 110
 	}
111 111
 	public static function retrieve_route_oneworld($database_file) {
112 112
 		global $globalDebug, $globalTransaction;
@@ -117,12 +117,12 @@  discard block
 block discarded – undo
117 117
 		try {
118 118
 			//$Connection = new Connection();
119 119
 			$sth = $Connection->db->prepare($query);
120
-                        $sth->execute(array(':source' => 'oneworld'));
121
-                } catch(PDOException $e) {
122
-                        return "error : ".$e->getMessage();
123
-                }
120
+						$sth->execute(array(':source' => 'oneworld'));
121
+				} catch(PDOException $e) {
122
+						return "error : ".$e->getMessage();
123
+				}
124 124
 
125
-    		if ($globalDebug) echo " - Add routes to DB -";
125
+			if ($globalDebug) echo " - Add routes to DB -";
126 126
 		require_once(dirname(__FILE__).'/../require/class.Spotter.php');
127 127
 		$Spotter = new Spotter();
128 128
 		if ($fh = fopen($database_file,"r")) {
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 			}
147 147
 			if ($globalTransaction) $Connection->db->commit();
148 148
 		}
149
-                return '';
149
+				return '';
150 150
 	}
151 151
 	
152 152
 	public static function retrieve_route_skyteam($database_file) {
@@ -158,12 +158,12 @@  discard block
 block discarded – undo
158 158
 		try {
159 159
 			//$Connection = new Connection();
160 160
 			$sth = $Connection->db->prepare($query);
161
-                        $sth->execute(array(':source' => 'skyteam'));
162
-                } catch(PDOException $e) {
163
-                        return "error : ".$e->getMessage();
164
-                }
161
+						$sth->execute(array(':source' => 'skyteam'));
162
+				} catch(PDOException $e) {
163
+						return "error : ".$e->getMessage();
164
+				}
165 165
 
166
-    		if ($globalDebug) echo " - Add routes to DB -";
166
+			if ($globalDebug) echo " - Add routes to DB -";
167 167
 
168 168
 		require_once(dirname(__FILE__).'/../require/class.Spotter.php');
169 169
 		$Spotter = new Spotter();
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
 				return "error : ".$e->getMessage();
190 190
 			}
191 191
 		}
192
-                return '';
192
+				return '';
193 193
 	}
194 194
 	public static function retrieve_modes_sqlite_to_dest($database_file) {
195 195
 		global $globalTransaction;
@@ -198,27 +198,27 @@  discard block
 block discarded – undo
198 198
 		try {
199 199
 			$Connection = new Connection();
200 200
 			$sth = $Connection->db->prepare($query);
201
-                        $sth->execute(array(':source' => $database_file));
202
-                } catch(PDOException $e) {
203
-                        return "error : ".$e->getMessage();
204
-                }
201
+						$sth->execute(array(':source' => $database_file));
202
+				} catch(PDOException $e) {
203
+						return "error : ".$e->getMessage();
204
+				}
205 205
 		$query = "DELETE FROM aircraft_owner WHERE Source = '' OR Source IS NULL OR Source = :source";
206 206
 		try {
207 207
 			$Connection = new Connection();
208 208
 			$sth = $Connection->db->prepare($query);
209
-                        $sth->execute(array(':source' => $database_file));
210
-                } catch(PDOException $e) {
211
-                        return "error : ".$e->getMessage();
212
-                }
209
+						$sth->execute(array(':source' => $database_file));
210
+				} catch(PDOException $e) {
211
+						return "error : ".$e->getMessage();
212
+				}
213 213
 
214
-    		update_db::connect_sqlite($database_file);
214
+			update_db::connect_sqlite($database_file);
215 215
 		$query = 'select * from Aircraft';
216 216
 		try {
217
-                        $sth = update_db::$db_sqlite->prepare($query);
218
-                        $sth->execute();
219
-                } catch(PDOException $e) {
220
-                        return "error : ".$e->getMessage();
221
-                }
217
+						$sth = update_db::$db_sqlite->prepare($query);
218
+						$sth->execute();
219
+				} catch(PDOException $e) {
220
+						return "error : ".$e->getMessage();
221
+				}
222 222
 		//$query_dest = 'INSERT INTO aircraft_modes (`AircraftID`,`FirstCreated`,`LastModified`, `ModeS`,`ModeSCountry`,`Registration`,`ICAOTypeCode`,`SerialNo`, `OperatorFlagCode`, `Manufacturer`, `Type`, `FirstRegDate`, `CurrentRegDate`, `Country`, `PreviousID`, `DeRegDate`, `Status`, `PopularName`,`GenericName`,`AircraftClass`, `Engines`, `OwnershipStatus`,`RegisteredOwners`,`MTOW`, `TotalHours`, `YearBuilt`, `CofACategory`, `CofAExpiry`, `UserNotes`, `Interested`, `UserTag`, `InfoUrl`, `PictureUrl1`, `PictureUrl2`, `PictureUrl3`, `UserBool1`, `UserBool2`, `UserBool3`, `UserBool4`, `UserBool5`, `UserString1`, `UserString2`, `UserString3`, `UserString4`, `UserString5`, `UserInt1`, `UserInt2`, `UserInt3`, `UserInt4`, `UserInt5`) VALUES (:AircraftID,:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:SerialNo, :OperatorFlagCode, :Manufacturer, :Type, :FirstRegDate, :CurrentRegDate, :Country, :PreviousID, :DeRegDate, :Status, :PopularName,:GenericName,:AircraftClass, :Engines, :OwnershipStatus,:RegisteredOwners,:MTOW, :TotalHours,:YearBuilt, :CofACategory, :CofAExpiry, :UserNotes, :Interested, :UserTag, :InfoUrl, :PictureUrl1, :PictureUrl2, :PictureUrl3, :UserBool1, :UserBool2, :UserBool3, :UserBool4, :UserBool5, :UserString1, :UserString2, :UserString3, :UserString4, :UserString5, :UserInt1, :UserInt2, :UserInt3, :UserInt4, :UserInt5)';
223 223
 		$query_dest = 'INSERT INTO aircraft_modes (LastModified, ModeS,ModeSCountry,Registration,ICAOTypeCode,type_flight,Source) VALUES (:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:type,:source)';
224 224
 		
@@ -229,17 +229,17 @@  discard block
 block discarded – undo
229 229
 		$sth_dest_owner = $Connection->db->prepare($query_dest_owner);
230 230
 		try {
231 231
 			if ($globalTransaction) $Connection->db->beginTransaction();
232
-            		while ($values = $sth->fetch(PDO::FETCH_ASSOC)) {
232
+					while ($values = $sth->fetch(PDO::FETCH_ASSOC)) {
233 233
 			//$query_dest_values = array(':AircraftID' => $values['AircraftID'],':FirstCreated' => $values['FirstCreated'],':LastModified' => $values['LastModified'],':ModeS' => $values['ModeS'],':ModeSCountry' => $values['ModeSCountry'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':SerialNo' => $values['SerialNo'], ':OperatorFlagCode' => $values['OperatorFlagCode'], ':Manufacturer' => $values['Manufacturer'], ':Type' => $values['Type'], ':FirstRegDate' => $values['FirstRegDate'], ':CurrentRegDate' => $values['CurrentRegDate'], ':Country' => $values['Country'], ':PreviousID' => $values['PreviousID'], ':DeRegDate' => $values['DeRegDate'], ':Status' => $values['Status'], ':PopularName' => $values['PopularName'],':GenericName' => $values['GenericName'],':AircraftClass' => $values['AircraftClass'], ':Engines' => $values['Engines'], ':OwnershipStatus' => $values['OwnershipStatus'],':RegisteredOwners' => $values['RegisteredOwners'],':MTOW' => $values['MTOW'], ':TotalHours' => $values['TotalHours'],':YearBuilt' => $values['YearBuilt'], ':CofACategory' => $values['CofACategory'], ':CofAExpiry' => $values['CofAExpiry'], ':UserNotes' => $values['UserNotes'], ':Interested' => $values['Interested'], ':UserTag' => $values['UserTag'], ':InfoUrl' => $values['InfoURL'], ':PictureUrl1' => $values['PictureURL1'], ':PictureUrl2' => $values['PictureURL2'], ':PictureUrl3' => $values['PictureURL3'], ':UserBool1' => $values['UserBool1'], ':UserBool2' => $values['UserBool2'], ':UserBool3' => $values['UserBool3'], ':UserBool4' => $values['UserBool4'], ':UserBool5' => $values['UserBool5'], ':UserString1' => $values['UserString1'], ':UserString2' => $values['UserString2'], ':UserString3' => $values['UserString3'], ':UserString4' => $values['UserString4'], ':UserString5' => $values['UserString5'], ':UserInt1' => $values['UserInt1'], ':UserInt2' => $values['UserInt2'], ':UserInt3' => $values['UserInt3'], ':UserInt4' => $values['UserInt4'], ':UserInt5' => $values['UserInt5']);
234 234
 				if ($values['UserString4'] == 'M') $type = 'military';
235 235
 				else $type = null;
236 236
 				$query_dest_values = array(':LastModified' => $values['LastModified'],':ModeS' => $values['ModeS'],':ModeSCountry' => $values['ModeSCountry'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':source' => $database_file,':type' => $type);
237 237
 				$sth_dest->execute($query_dest_values);
238 238
 				if ($values['RegisteredOwners'] != '' && $values['RegisteredOwners'] != NULL && $values['RegisteredOwners'] != 'Private') {
239
-				    $query_dest_owner_values = array(':registration' => $values['Registration'],':source' => $database_file,':owner' => $values['RegisteredOwners']);
240
-				    $sth_dest_owner->execute($query_dest_owner_values);
239
+					$query_dest_owner_values = array(':registration' => $values['Registration'],':source' => $database_file,':owner' => $values['RegisteredOwners']);
240
+					$sth_dest_owner->execute($query_dest_owner_values);
241 241
 				}
242
-            		}
242
+					}
243 243
 			if ($globalTransaction) $Connection->db->commit();
244 244
 		} catch(PDOException $e) {
245 245
 			return "error : ".$e->getMessage();
@@ -250,10 +250,10 @@  discard block
 block discarded – undo
250 250
 		try {
251 251
 			$Connection = new Connection();
252 252
 			$sth = $Connection->db->prepare($query);
253
-                        $sth->execute(array(':source' => $database_file));
254
-                } catch(PDOException $e) {
255
-                        return "error : ".$e->getMessage();
256
-                }
253
+						$sth->execute(array(':source' => $database_file));
254
+				} catch(PDOException $e) {
255
+						return "error : ".$e->getMessage();
256
+				}
257 257
 		return '';
258 258
 	}
259 259
 
@@ -265,10 +265,10 @@  discard block
 block discarded – undo
265 265
 		try {
266 266
 			$Connection = new Connection();
267 267
 			$sth = $Connection->db->prepare($query);
268
-                        $sth->execute(array(':source' => $database_file));
269
-                } catch(PDOException $e) {
270
-                        return "error : ".$e->getMessage();
271
-                }
268
+						$sth->execute(array(':source' => $database_file));
269
+				} catch(PDOException $e) {
270
+						return "error : ".$e->getMessage();
271
+				}
272 272
 		
273 273
 		if ($fh = fopen($database_file,"r")) {
274 274
 			//$query_dest = 'INSERT INTO aircraft_modes (`AircraftID`,`FirstCreated`,`LastModified`, `ModeS`,`ModeSCountry`,`Registration`,`ICAOTypeCode`,`SerialNo`, `OperatorFlagCode`, `Manufacturer`, `Type`, `FirstRegDate`, `CurrentRegDate`, `Country`, `PreviousID`, `DeRegDate`, `Status`, `PopularName`,`GenericName`,`AircraftClass`, `Engines`, `OwnershipStatus`,`RegisteredOwners`,`MTOW`, `TotalHours`, `YearBuilt`, `CofACategory`, `CofAExpiry`, `UserNotes`, `Interested`, `UserTag`, `InfoUrl`, `PictureUrl1`, `PictureUrl2`, `PictureUrl3`, `UserBool1`, `UserBool2`, `UserBool3`, `UserBool4`, `UserBool5`, `UserString1`, `UserString2`, `UserString3`, `UserString4`, `UserString5`, `UserInt1`, `UserInt2`, `UserInt3`, `UserInt4`, `UserInt5`) VALUES (:AircraftID,:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:SerialNo, :OperatorFlagCode, :Manufacturer, :Type, :FirstRegDate, :CurrentRegDate, :Country, :PreviousID, :DeRegDate, :Status, :PopularName,:GenericName,:AircraftClass, :Engines, :OwnershipStatus,:RegisteredOwners,:MTOW, :TotalHours,:YearBuilt, :CofACategory, :CofAExpiry, :UserNotes, :Interested, :UserTag, :InfoUrl, :PictureUrl1, :PictureUrl2, :PictureUrl3, :UserBool1, :UserBool2, :UserBool3, :UserBool4, :UserBool5, :UserString1, :UserString2, :UserString3, :UserString4, :UserString5, :UserInt1, :UserInt2, :UserInt3, :UserInt4, :UserInt5)';
@@ -278,26 +278,26 @@  discard block
 block discarded – undo
278 278
 			$sth_dest = $Connection->db->prepare($query_dest);
279 279
 			try {
280 280
 				if ($globalTransaction) $Connection->db->beginTransaction();
281
-            			while (!feof($fh)) {
282
-            				$values = array();
283
-            				$line = $Common->hex2str(fgets($fh,9999));
281
+						while (!feof($fh)) {
282
+							$values = array();
283
+							$line = $Common->hex2str(fgets($fh,9999));
284 284
 					//FFFFFF                     RIDEAU VALLEY SOARINGASW-20               C-FBKN MZ 123.400
285
-            				$values['ModeS'] = substr($line,0,6);
286
-            				$values['Registration'] = trim(substr($line,69,6));
287
-            				$aircraft_name = trim(substr($line,48,6));
288
-            				// Check if we can find ICAO, else set it to GLID
289
-            				$aircraft_name_split = explode(' ',$aircraft_name);
290
-            				$search_more = '';
291
-            				if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'";
292
-            				$query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more;
293
-            				$sth_search = $Connection->db->prepare($query_search);
285
+							$values['ModeS'] = substr($line,0,6);
286
+							$values['Registration'] = trim(substr($line,69,6));
287
+							$aircraft_name = trim(substr($line,48,6));
288
+							// Check if we can find ICAO, else set it to GLID
289
+							$aircraft_name_split = explode(' ',$aircraft_name);
290
+							$search_more = '';
291
+							if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'";
292
+							$query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more;
293
+							$sth_search = $Connection->db->prepare($query_search);
294 294
 					try {
295
-                                    		$sth_search->execute();
296
-	            				$result = $sth_search->fetch(PDO::FETCH_ASSOC);
297
-	            				//if (count($result) > 0) {
298
-	            				if (isset($result['icao']) && $result['icao'] != '') {
299
-	            				    $values['ICAOTypeCode'] = $result['icao'];
300
-	            				} 
295
+											$sth_search->execute();
296
+								$result = $sth_search->fetch(PDO::FETCH_ASSOC);
297
+								//if (count($result) > 0) {
298
+								if (isset($result['icao']) && $result['icao'] != '') {
299
+									$values['ICAOTypeCode'] = $result['icao'];
300
+								} 
301 301
 					} catch(PDOException $e) {
302 302
 						return "error : ".$e->getMessage();
303 303
 					}
@@ -320,10 +320,10 @@  discard block
 block discarded – undo
320 320
 		try {
321 321
 			$Connection = new Connection();
322 322
 			$sth = $Connection->db->prepare($query);
323
-                        $sth->execute(array(':source' => $database_file));
324
-                } catch(PDOException $e) {
325
-                        return "error : ".$e->getMessage();
326
-                }
323
+						$sth->execute(array(':source' => $database_file));
324
+				} catch(PDOException $e) {
325
+						return "error : ".$e->getMessage();
326
+				}
327 327
 		return '';
328 328
 	}
329 329
 
@@ -334,10 +334,10 @@  discard block
 block discarded – undo
334 334
 		try {
335 335
 			$Connection = new Connection();
336 336
 			$sth = $Connection->db->prepare($query);
337
-                        $sth->execute(array(':source' => $database_file));
338
-                } catch(PDOException $e) {
339
-                        return "error : ".$e->getMessage();
340
-                }
337
+						$sth->execute(array(':source' => $database_file));
338
+				} catch(PDOException $e) {
339
+						return "error : ".$e->getMessage();
340
+				}
341 341
 		
342 342
 		if ($fh = fopen($database_file,"r")) {
343 343
 			//$query_dest = 'INSERT INTO aircraft_modes (`AircraftID`,`FirstCreated`,`LastModified`, `ModeS`,`ModeSCountry`,`Registration`,`ICAOTypeCode`,`SerialNo`, `OperatorFlagCode`, `Manufacturer`, `Type`, `FirstRegDate`, `CurrentRegDate`, `Country`, `PreviousID`, `DeRegDate`, `Status`, `PopularName`,`GenericName`,`AircraftClass`, `Engines`, `OwnershipStatus`,`RegisteredOwners`,`MTOW`, `TotalHours`, `YearBuilt`, `CofACategory`, `CofAExpiry`, `UserNotes`, `Interested`, `UserTag`, `InfoUrl`, `PictureUrl1`, `PictureUrl2`, `PictureUrl3`, `UserBool1`, `UserBool2`, `UserBool3`, `UserBool4`, `UserBool5`, `UserString1`, `UserString2`, `UserString3`, `UserString4`, `UserString5`, `UserInt1`, `UserInt2`, `UserInt3`, `UserInt4`, `UserInt5`) VALUES (:AircraftID,:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:SerialNo, :OperatorFlagCode, :Manufacturer, :Type, :FirstRegDate, :CurrentRegDate, :Country, :PreviousID, :DeRegDate, :Status, :PopularName,:GenericName,:AircraftClass, :Engines, :OwnershipStatus,:RegisteredOwners,:MTOW, :TotalHours,:YearBuilt, :CofACategory, :CofAExpiry, :UserNotes, :Interested, :UserTag, :InfoUrl, :PictureUrl1, :PictureUrl2, :PictureUrl3, :UserBool1, :UserBool2, :UserBool3, :UserBool4, :UserBool5, :UserString1, :UserString2, :UserString3, :UserString4, :UserString5, :UserInt1, :UserInt2, :UserInt3, :UserInt4, :UserInt5)';
@@ -348,24 +348,24 @@  discard block
 block discarded – undo
348 348
 			try {
349 349
 				if ($globalTransaction) $Connection->db->beginTransaction();
350 350
 				$tmp = fgetcsv($fh,9999,',',"'");
351
-            			while (!feof($fh)) {
352
-            				$line = fgetcsv($fh,9999,',',"'");
351
+						while (!feof($fh)) {
352
+							$line = fgetcsv($fh,9999,',',"'");
353 353
             				
354 354
 					//FFFFFF                     RIDEAU VALLEY SOARINGASW-20               C-FBKN MZ 123.400
355 355
 					//print_r($line);
356
-            				$values['ModeS'] = $line[1];
357
-            				$values['Registration'] = $line[3];
358
-            				$aircraft_name = $line[2];
359
-            				// Check if we can find ICAO, else set it to GLID
360
-            				$aircraft_name_split = explode(' ',$aircraft_name);
361
-            				$search_more = '';
362
-            				if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'";
363
-            				$query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more;
364
-            				$sth_search = $Connection->db->prepare($query_search);
356
+							$values['ModeS'] = $line[1];
357
+							$values['Registration'] = $line[3];
358
+							$aircraft_name = $line[2];
359
+							// Check if we can find ICAO, else set it to GLID
360
+							$aircraft_name_split = explode(' ',$aircraft_name);
361
+							$search_more = '';
362
+							if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'";
363
+							$query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more;
364
+							$sth_search = $Connection->db->prepare($query_search);
365 365
 					try {
366
-                                    		$sth_search->execute();
367
-	            				$result = $sth_search->fetch(PDO::FETCH_ASSOC);
368
-	            				if (isset($result['icao']) && $result['icao'] != '') $values['ICAOTypeCode'] = $result['icao'];
366
+											$sth_search->execute();
367
+								$result = $sth_search->fetch(PDO::FETCH_ASSOC);
368
+								if (isset($result['icao']) && $result['icao'] != '') $values['ICAOTypeCode'] = $result['icao'];
369 369
 					} catch(PDOException $e) {
370 370
 						return "error : ".$e->getMessage();
371 371
 					}
@@ -388,10 +388,10 @@  discard block
 block discarded – undo
388 388
 		try {
389 389
 			$Connection = new Connection();
390 390
 			$sth = $Connection->db->prepare($query);
391
-                        $sth->execute(array(':source' => $database_file));
392
-                } catch(PDOException $e) {
393
-                        return "error : ".$e->getMessage();
394
-                }
391
+						$sth->execute(array(':source' => $database_file));
392
+				} catch(PDOException $e) {
393
+						return "error : ".$e->getMessage();
394
+				}
395 395
 		return '';
396 396
 	}
397 397
 
@@ -402,10 +402,10 @@  discard block
 block discarded – undo
402 402
 		try {
403 403
 			$Connection = new Connection();
404 404
 			$sth = $Connection->db->prepare($query);
405
-                        $sth->execute(array(':source' => $database_file));
406
-                } catch(PDOException $e) {
407
-                        return "error : ".$e->getMessage();
408
-                }
405
+						$sth->execute(array(':source' => $database_file));
406
+				} catch(PDOException $e) {
407
+						return "error : ".$e->getMessage();
408
+				}
409 409
 		
410 410
 		if ($fh = fopen($database_file,"r")) {
411 411
 			//$query_dest = 'INSERT INTO aircraft_modes (`AircraftID`,`FirstCreated`,`LastModified`, `ModeS`,`ModeSCountry`,`Registration`,`ICAOTypeCode`,`SerialNo`, `OperatorFlagCode`, `Manufacturer`, `Type`, `FirstRegDate`, `CurrentRegDate`, `Country`, `PreviousID`, `DeRegDate`, `Status`, `PopularName`,`GenericName`,`AircraftClass`, `Engines`, `OwnershipStatus`,`RegisteredOwners`,`MTOW`, `TotalHours`, `YearBuilt`, `CofACategory`, `CofAExpiry`, `UserNotes`, `Interested`, `UserTag`, `InfoUrl`, `PictureUrl1`, `PictureUrl2`, `PictureUrl3`, `UserBool1`, `UserBool2`, `UserBool3`, `UserBool4`, `UserBool5`, `UserString1`, `UserString2`, `UserString3`, `UserString4`, `UserString5`, `UserInt1`, `UserInt2`, `UserInt3`, `UserInt4`, `UserInt5`) VALUES (:AircraftID,:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:SerialNo, :OperatorFlagCode, :Manufacturer, :Type, :FirstRegDate, :CurrentRegDate, :Country, :PreviousID, :DeRegDate, :Status, :PopularName,:GenericName,:AircraftClass, :Engines, :OwnershipStatus,:RegisteredOwners,:MTOW, :TotalHours,:YearBuilt, :CofACategory, :CofAExpiry, :UserNotes, :Interested, :UserTag, :InfoUrl, :PictureUrl1, :PictureUrl2, :PictureUrl3, :UserBool1, :UserBool2, :UserBool3, :UserBool4, :UserBool5, :UserString1, :UserString2, :UserString3, :UserString4, :UserString5, :UserInt1, :UserInt2, :UserInt3, :UserInt4, :UserInt5)';
@@ -416,95 +416,95 @@  discard block
 block discarded – undo
416 416
 			try {
417 417
 				if ($globalTransaction) $Connection->db->beginTransaction();
418 418
 				$tmp = fgetcsv($fh,9999,',','"');
419
-            			while (!feof($fh)) {
420
-            				$line = fgetcsv($fh,9999,',','"');
421
-            				$values = array();
422
-            				//print_r($line);
423
-            				if ($country == 'F') {
424
-            				    $values['registration'] = $line[0];
425
-            				    $values['base'] = $line[4];
426
-            				    $values['owner'] = $line[5];
427
-            				    if ($line[6] == '') $values['date_first_reg'] = null;
428
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6]));
429
-					    $values['cancel'] = $line[7];
419
+						while (!feof($fh)) {
420
+							$line = fgetcsv($fh,9999,',','"');
421
+							$values = array();
422
+							//print_r($line);
423
+							if ($country == 'F') {
424
+								$values['registration'] = $line[0];
425
+								$values['base'] = $line[4];
426
+								$values['owner'] = $line[5];
427
+								if ($line[6] == '') $values['date_first_reg'] = null;
428
+						else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6]));
429
+						$values['cancel'] = $line[7];
430 430
 					} elseif ($country == 'EI') {
431
-					    // TODO : add modeS & reg to aircraft_modes
432
-            				    $values['registration'] = $line[0];
433
-            				    $values['base'] = $line[3];
434
-            				    $values['owner'] = $line[2];
435
-            				    if ($line[1] == '') $values['date_first_reg'] = null;
436
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[1]));
437
-					    $values['cancel'] = '';
431
+						// TODO : add modeS & reg to aircraft_modes
432
+								$values['registration'] = $line[0];
433
+								$values['base'] = $line[3];
434
+								$values['owner'] = $line[2];
435
+								if ($line[1] == '') $values['date_first_reg'] = null;
436
+						else $values['date_first_reg'] = date("Y-m-d",strtotime($line[1]));
437
+						$values['cancel'] = '';
438 438
 					} elseif ($country == 'HB') {
439
-					    // TODO : add modeS & reg to aircraft_modes
440
-            				    $values['registration'] = $line[0];
441
-            				    $values['base'] = null;
442
-            				    $values['owner'] = $line[5];
443
-            				    $values['date_first_reg'] = null;
444
-					    $values['cancel'] = '';
439
+						// TODO : add modeS & reg to aircraft_modes
440
+								$values['registration'] = $line[0];
441
+								$values['base'] = null;
442
+								$values['owner'] = $line[5];
443
+								$values['date_first_reg'] = null;
444
+						$values['cancel'] = '';
445 445
 					} elseif ($country == 'OK') {
446
-					    // TODO : add modeS & reg to aircraft_modes
447
-            				    $values['registration'] = $line[3];
448
-            				    $values['base'] = null;
449
-            				    $values['owner'] = $line[5];
450
-            				    if ($line[18] == '') $values['date_first_reg'] = null;
451
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[18]));
452
-					    $values['cancel'] = '';
446
+						// TODO : add modeS & reg to aircraft_modes
447
+								$values['registration'] = $line[3];
448
+								$values['base'] = null;
449
+								$values['owner'] = $line[5];
450
+								if ($line[18] == '') $values['date_first_reg'] = null;
451
+						else $values['date_first_reg'] = date("Y-m-d",strtotime($line[18]));
452
+						$values['cancel'] = '';
453 453
 					} elseif ($country == 'VH') {
454
-					    // TODO : add modeS & reg to aircraft_modes
455
-            				    $values['registration'] = $line[0];
456
-            				    $values['base'] = null;
457
-            				    $values['owner'] = $line[12];
458
-            				    if ($line[28] == '') $values['date_first_reg'] = null;
459
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[28]));
460
-
461
-					    $values['cancel'] = $line[39];
454
+						// TODO : add modeS & reg to aircraft_modes
455
+								$values['registration'] = $line[0];
456
+								$values['base'] = null;
457
+								$values['owner'] = $line[12];
458
+								if ($line[28] == '') $values['date_first_reg'] = null;
459
+						else $values['date_first_reg'] = date("Y-m-d",strtotime($line[28]));
460
+
461
+						$values['cancel'] = $line[39];
462 462
 					} elseif ($country == 'OE' || $country == '9A' || $country == 'VP' || $country == 'LX' || $country == 'P2' || $country == 'HC') {
463
-            				    $values['registration'] = $line[0];
464
-            				    $values['base'] = null;
465
-            				    $values['owner'] = $line[4];
466
-            				    $values['date_first_reg'] = null;
467
-					    $values['cancel'] = '';
463
+								$values['registration'] = $line[0];
464
+								$values['base'] = null;
465
+								$values['owner'] = $line[4];
466
+								$values['date_first_reg'] = null;
467
+						$values['cancel'] = '';
468 468
 					} elseif ($country == 'CC') {
469
-            				    $values['registration'] = $line[0];
470
-            				    $values['base'] = null;
471
-            				    $values['owner'] = $line[6];
472
-            				    $values['date_first_reg'] = null;
473
-					    $values['cancel'] = '';
469
+								$values['registration'] = $line[0];
470
+								$values['base'] = null;
471
+								$values['owner'] = $line[6];
472
+								$values['date_first_reg'] = null;
473
+						$values['cancel'] = '';
474 474
 					} elseif ($country == 'HJ') {
475
-            				    $values['registration'] = $line[0];
476
-            				    $values['base'] = null;
477
-            				    $values['owner'] = $line[8];
478
-            				    if ($line[7] == '') $values['date_first_reg'] = null;
479
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7]));
480
-					    $values['cancel'] = '';
475
+								$values['registration'] = $line[0];
476
+								$values['base'] = null;
477
+								$values['owner'] = $line[8];
478
+								if ($line[7] == '') $values['date_first_reg'] = null;
479
+						else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7]));
480
+						$values['cancel'] = '';
481 481
 					} elseif ($country == 'PP') {
482
-            				    $values['registration'] = $line[0];
483
-            				    $values['base'] = null;
484
-            				    $values['owner'] = $line[4];
485
-            				    if ($line[6] == '') $values['date_first_reg'] = null;
486
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6]));
487
-					    $values['cancel'] = $line[7];
482
+								$values['registration'] = $line[0];
483
+								$values['base'] = null;
484
+								$values['owner'] = $line[4];
485
+								if ($line[6] == '') $values['date_first_reg'] = null;
486
+						else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6]));
487
+						$values['cancel'] = $line[7];
488 488
 					} elseif ($country == 'E7') {
489
-            				    $values['registration'] = $line[0];
490
-            				    $values['base'] = null;
491
-            				    $values['owner'] = $line[4];
492
-            				    if ($line[5] == '') $values['date_first_reg'] = null;
493
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[5]));
494
-					    $values['cancel'] = '';
489
+								$values['registration'] = $line[0];
490
+								$values['base'] = null;
491
+								$values['owner'] = $line[4];
492
+								if ($line[5] == '') $values['date_first_reg'] = null;
493
+						else $values['date_first_reg'] = date("Y-m-d",strtotime($line[5]));
494
+						$values['cancel'] = '';
495 495
 					} elseif ($country == '8Q') {
496
-            				    $values['registration'] = $line[0];
497
-            				    $values['base'] = null;
498
-            				    $values['owner'] = $line[3];
499
-            				    if ($line[7] == '') $values['date_first_reg'] = null;
500
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7]));
501
-					    $values['cancel'] = '';
496
+								$values['registration'] = $line[0];
497
+								$values['base'] = null;
498
+								$values['owner'] = $line[3];
499
+								if ($line[7] == '') $values['date_first_reg'] = null;
500
+						else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7]));
501
+						$values['cancel'] = '';
502 502
 					} elseif ($country == 'ZK' || $country == 'OM' || $country == 'TF') {
503
-            				    $values['registration'] = $line[0];
504
-            				    $values['base'] = null;
505
-            				    $values['owner'] = $line[3];
506
-            				    $values['date_first_reg'] = null;
507
-					    $values['cancel'] = '';
503
+								$values['registration'] = $line[0];
504
+								$values['base'] = null;
505
+								$values['owner'] = $line[3];
506
+								$values['date_first_reg'] = null;
507
+						$values['cancel'] = '';
508 508
 					}
509 509
 					if ($values['cancel'] == '' && $values['registration'] != null) {
510 510
 						$query_dest_values = array(':registration' => $values['registration'],':base' => $values['base'],':date_first_reg' => $values['date_first_reg'],':owner' => $values['owner'],':source' => $database_file);
@@ -626,20 +626,20 @@  discard block
 block discarded – undo
626 626
 		try {
627 627
 			$Connection = new Connection();
628 628
 			$sth = $Connection->db->prepare($query);
629
-                        $sth->execute();
630
-                } catch(PDOException $e) {
631
-                        return "error : ".$e->getMessage();
632
-                }
629
+						$sth->execute();
630
+				} catch(PDOException $e) {
631
+						return "error : ".$e->getMessage();
632
+				}
633 633
 
634 634
 
635 635
 		$query = 'ALTER TABLE airport DROP INDEX icaoidx';
636 636
 		try {
637 637
 			$Connection = new Connection();
638 638
 			$sth = $Connection->db->prepare($query);
639
-                        $sth->execute();
640
-                } catch(PDOException $e) {
641
-                        return "error : ".$e->getMessage();
642
-                }
639
+						$sth->execute();
640
+				} catch(PDOException $e) {
641
+						return "error : ".$e->getMessage();
642
+				}
643 643
 
644 644
 		$query_dest = "INSERT INTO airport (`airport_id`,`name`,`city`,`country`,`iata`,`icao`,`latitude`,`longitude`,`altitude`,`type`,`home_link`,`wikipedia_link`,`image_thumb`,`image`)
645 645
 		    VALUES (:airport_id, :name, :city, :country, :iata, :icao, :latitude, :longitude, :altitude, :type, :home_link, :wikipedia_link, :image_thumb, :image)";
@@ -705,10 +705,10 @@  discard block
 block discarded – undo
705 705
 		try {
706 706
 			$Connection = new Connection();
707 707
 			$sth = $Connection->db->prepare($query);
708
-                        $sth->execute();
709
-                } catch(PDOException $e) {
710
-                        return "error : ".$e->getMessage();
711
-                }
708
+						$sth->execute();
709
+				} catch(PDOException $e) {
710
+						return "error : ".$e->getMessage();
711
+				}
712 712
 
713 713
 
714 714
 		if ($globalDebug) echo "Insert Not available Airport...\n";
@@ -718,10 +718,10 @@  discard block
 block discarded – undo
718 718
 		try {
719 719
 			$Connection = new Connection();
720 720
 			$sth = $Connection->db->prepare($query);
721
-                        $sth->execute($query_values);
722
-                } catch(PDOException $e) {
723
-                        return "error : ".$e->getMessage();
724
-                }
721
+						$sth->execute($query_values);
722
+				} catch(PDOException $e) {
723
+						return "error : ".$e->getMessage();
724
+				}
725 725
 		$i++;
726 726
 /*
727 727
 		$query = 'DELETE FROM airport WHERE airport_id IN (SELECT * FROM (SELECT min(a.airport_id) FROM airport a GROUP BY a.icao) x)';
@@ -835,7 +835,7 @@  discard block
 block discarded – undo
835 835
 
836 836
 
837 837
 
838
-                return "success";
838
+				return "success";
839 839
 	}
840 840
 	
841 841
 	public static function translation() {
@@ -851,10 +851,10 @@  discard block
 block discarded – undo
851 851
 		try {
852 852
 			$Connection = new Connection();
853 853
 			$sth = $Connection->db->prepare($query);
854
-                        $sth->execute(array(':source' => 'translation.csv'));
855
-                } catch(PDOException $e) {
856
-                        return "error : ".$e->getMessage();
857
-                }
854
+						$sth->execute(array(':source' => 'translation.csv'));
855
+				} catch(PDOException $e) {
856
+						return "error : ".$e->getMessage();
857
+				}
858 858
 
859 859
 		
860 860
 		//update_db::unzip($out_file);
@@ -873,21 +873,21 @@  discard block
 block discarded – undo
873 873
 					$data = $row;
874 874
 					$operator = $data[2];
875 875
 					if ($operator != '' && is_numeric(substr(substr($operator, 0, 3), -1, 1))) {
876
-                                                $airline_array = $Spotter->getAllAirlineInfo(substr($operator, 0, 2));
877
-                                                //echo substr($operator, 0, 2)."\n";;
878
-                                                if (count($airline_array) > 0) {
876
+												$airline_array = $Spotter->getAllAirlineInfo(substr($operator, 0, 2));
877
+												//echo substr($operator, 0, 2)."\n";;
878
+												if (count($airline_array) > 0) {
879 879
 							//print_r($airline_array);
880 880
 							$operator = $airline_array[0]['icao'].substr($operator,2);
881
-                                                }
882
-                                        }
881
+												}
882
+										}
883 883
 					
884 884
 					$operator_correct = $data[3];
885 885
 					if ($operator_correct != '' && is_numeric(substr(substr($operator_correct, 0, 3), -1, 1))) {
886
-                                                $airline_array = $Spotter->getAllAirlineInfo(substr($operator_correct, 0, 2));
887
-                                                if (count($airline_array) > 0) {
888
-                                            		$operator_correct = $airline_array[0]['icao'].substr($operator_correct,2);
889
-                                            	}
890
-                                        }
886
+												$airline_array = $Spotter->getAllAirlineInfo(substr($operator_correct, 0, 2));
887
+												if (count($airline_array) > 0) {
888
+													$operator_correct = $airline_array[0]['icao'].substr($operator_correct,2);
889
+												}
890
+										}
891 891
 					$query = 'INSERT INTO translation (Reg,Reg_correct,Operator,Operator_correct,Source) VALUES (:Reg, :Reg_correct, :Operator, :Operator_correct, :source)';
892 892
 					try {
893 893
 						$sth = $Connection->db->prepare($query);
@@ -901,7 +901,7 @@  discard block
 block discarded – undo
901 901
 			//$Connection->db->commit();
902 902
 		}
903 903
 		return '';
904
-        }
904
+		}
905 905
 	
906 906
 	public static function translation_fam() {
907 907
 		require_once(dirname(__FILE__).'/../require/class.Spotter.php');
@@ -911,10 +911,10 @@  discard block
 block discarded – undo
911 911
 		try {
912 912
 			$Connection = new Connection();
913 913
 			$sth = $Connection->db->prepare($query);
914
-                        $sth->execute(array(':source' => 'website_fam'));
915
-                } catch(PDOException $e) {
916
-                        return "error : ".$e->getMessage();
917
-                }
914
+						$sth->execute(array(':source' => 'website_fam'));
915
+				} catch(PDOException $e) {
916
+						return "error : ".$e->getMessage();
917
+				}
918 918
 
919 919
 		
920 920
 		//update_db::unzip($out_file);
@@ -943,7 +943,7 @@  discard block
 block discarded – undo
943 943
 			//$Connection->db->commit();
944 944
 		}
945 945
 		return '';
946
-        }
946
+		}
947 947
 
948 948
 	public static function modes_faa() {
949 949
 		global $tmp_dir, $globalTransaction;
@@ -951,19 +951,19 @@  discard block
 block discarded – undo
951 951
 		try {
952 952
 			$Connection = new Connection();
953 953
 			$sth = $Connection->db->prepare($query);
954
-                        $sth->execute(array(':source' => 'website_faa'));
955
-                } catch(PDOException $e) {
956
-                        return "error : ".$e->getMessage();
957
-                }
954
+						$sth->execute(array(':source' => 'website_faa'));
955
+				} catch(PDOException $e) {
956
+						return "error : ".$e->getMessage();
957
+				}
958 958
 
959 959
 		$query = "DELETE FROM aircraft_owner WHERE Source = '' OR Source = :source";
960 960
 		try {
961 961
 			$Connection = new Connection();
962 962
 			$sth = $Connection->db->prepare($query);
963
-                        $sth->execute(array(':source' => 'website_faa'));
964
-                } catch(PDOException $e) {
965
-                        return "error : ".$e->getMessage();
966
-                }
963
+						$sth->execute(array(':source' => 'website_faa'));
964
+				} catch(PDOException $e) {
965
+						return "error : ".$e->getMessage();
966
+				}
967 967
 
968 968
 		
969 969
 		//$aircrafts_icao = array('7102811' => 'P28R',...
@@ -1001,17 +1001,17 @@  discard block
 block discarded – undo
1001 1001
 			if ($globalTransaction) $Connection->db->commit();
1002 1002
 		}
1003 1003
 		return '';
1004
-        }
1004
+		}
1005 1005
 	public static function modes_fam() {
1006 1006
 		global $tmp_dir, $globalTransaction;
1007 1007
 		$query = "DELETE FROM aircraft_modes WHERE Source = '' OR Source = :source";
1008 1008
 		try {
1009 1009
 			$Connection = new Connection();
1010 1010
 			$sth = $Connection->db->prepare($query);
1011
-                        $sth->execute(array(':source' => 'website_fam'));
1012
-                } catch(PDOException $e) {
1013
-                        return "error : ".$e->getMessage();
1014
-                }
1011
+						$sth->execute(array(':source' => 'website_fam'));
1012
+				} catch(PDOException $e) {
1013
+						return "error : ".$e->getMessage();
1014
+				}
1015 1015
 
1016 1016
 		
1017 1017
 		//update_db::unzip($out_file);
@@ -1040,7 +1040,7 @@  discard block
 block discarded – undo
1040 1040
 			if ($globalTransaction) $Connection->db->commit();
1041 1041
 		}
1042 1042
 		return '';
1043
-        }
1043
+		}
1044 1044
         
1045 1045
 	public static function owner_fam() {
1046 1046
 		global $tmp_dir, $globalTransaction;
@@ -1048,10 +1048,10 @@  discard block
 block discarded – undo
1048 1048
 		try {
1049 1049
 			$Connection = new Connection();
1050 1050
 			$sth = $Connection->db->prepare($query);
1051
-                        $sth->execute(array(':source' => 'website_fam'));
1052
-                } catch(PDOException $e) {
1053
-                        return "error : ".$e->getMessage();
1054
-                }
1051
+						$sth->execute(array(':source' => 'website_fam'));
1052
+				} catch(PDOException $e) {
1053
+						return "error : ".$e->getMessage();
1054
+				}
1055 1055
 
1056 1056
 		$delimiter = "\t";
1057 1057
 		$Connection = new Connection();
@@ -1077,7 +1077,7 @@  discard block
 block discarded – undo
1077 1077
 			if ($globalTransaction) $Connection->db->commit();
1078 1078
 		}
1079 1079
 		return '';
1080
-        }
1080
+		}
1081 1081
 
1082 1082
 	public static function routes_fam() {
1083 1083
 		global $tmp_dir, $globalTransaction;
@@ -1085,10 +1085,10 @@  discard block
 block discarded – undo
1085 1085
 		try {
1086 1086
 			$Connection = new Connection();
1087 1087
 			$sth = $Connection->db->prepare($query);
1088
-                        $sth->execute(array(':source' => 'website_fam'));
1089
-                } catch(PDOException $e) {
1090
-                        return "error : ".$e->getMessage();
1091
-                }
1088
+						$sth->execute(array(':source' => 'website_fam'));
1089
+				} catch(PDOException $e) {
1090
+						return "error : ".$e->getMessage();
1091
+				}
1092 1092
 
1093 1093
 		
1094 1094
 		//update_db::unzip($out_file);
@@ -1117,7 +1117,7 @@  discard block
 block discarded – undo
1117 1117
 			if ($globalTransaction) $Connection->db->commit();
1118 1118
 		}
1119 1119
 		return '';
1120
-        }
1120
+		}
1121 1121
 
1122 1122
 	public static function tle($filename,$tletype) {
1123 1123
 		require_once(dirname(__FILE__).'/../require/class.Spotter.php');
@@ -1128,10 +1128,10 @@  discard block
 block discarded – undo
1128 1128
 		try {
1129 1129
 			$Connection = new Connection();
1130 1130
 			$sth = $Connection->db->prepare($query);
1131
-                        $sth->execute(array(':source' => $filename));
1132
-                } catch(PDOException $e) {
1133
-                        return "error : ".$e->getMessage();
1134
-                }
1131
+						$sth->execute(array(':source' => $filename));
1132
+				} catch(PDOException $e) {
1133
+						return "error : ".$e->getMessage();
1134
+				}
1135 1135
 		
1136 1136
 		$Connection = new Connection();
1137 1137
 		if (($handle = fopen($filename, 'r')) !== FALSE)
@@ -1166,54 +1166,54 @@  discard block
 block discarded – undo
1166 1166
 			//$Connection->db->commit();
1167 1167
 		}
1168 1168
 		return '';
1169
-        }
1169
+		}
1170 1170
 
1171 1171
 	/**
1172
-        * Convert a HTML table to an array
1173
-        * @param String $data HTML page
1174
-        * @return Array array of the tables in HTML page
1175
-        */
1176
-        private static function table2array($data) {
1177
-                $html = str_get_html($data);
1178
-                $tabledata=array();
1179
-                foreach($html->find('tr') as $element)
1180
-                {
1181
-                        $td = array();
1182
-                        foreach( $element->find('th') as $row)
1183
-                        {
1184
-                                $td [] = trim($row->plaintext);
1185
-                        }
1186
-                        $td=array_filter($td);
1187
-                        $tabledata[] = $td;
1188
-
1189
-                        $td = array();
1190
-                        $tdi = array();
1191
-                        foreach( $element->find('td') as $row)
1192
-                        {
1193
-                                $td [] = trim($row->plaintext);
1194
-                                $tdi [] = trim($row->innertext);
1195
-                        }
1196
-                        $td=array_filter($td);
1197
-                        $tdi=array_filter($tdi);
1198
-                    //    $tabledata[]=array_merge($td,$tdi);
1199
-                        $tabledata[]=$td;
1200
-                }
1201
-                return(array_filter($tabledata));
1202
-        }
1203
-
1204
-       /**
1205
-        * Get data from form result
1206
-        * @param String $url form URL
1207
-        * @return String the result
1208
-        */
1209
-        private static function getData($url) {
1210
-                $ch = curl_init();
1211
-                curl_setopt($ch, CURLOPT_URL, $url);
1212
-                curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
1213
-                curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
1214
-                curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.2) Gecko/20090729 Firefox/3.5.2 GTB5');
1215
-                return curl_exec($ch);
1216
-        }
1172
+	 * Convert a HTML table to an array
1173
+	 * @param String $data HTML page
1174
+	 * @return Array array of the tables in HTML page
1175
+	 */
1176
+		private static function table2array($data) {
1177
+				$html = str_get_html($data);
1178
+				$tabledata=array();
1179
+				foreach($html->find('tr') as $element)
1180
+				{
1181
+						$td = array();
1182
+						foreach( $element->find('th') as $row)
1183
+						{
1184
+								$td [] = trim($row->plaintext);
1185
+						}
1186
+						$td=array_filter($td);
1187
+						$tabledata[] = $td;
1188
+
1189
+						$td = array();
1190
+						$tdi = array();
1191
+						foreach( $element->find('td') as $row)
1192
+						{
1193
+								$td [] = trim($row->plaintext);
1194
+								$tdi [] = trim($row->innertext);
1195
+						}
1196
+						$td=array_filter($td);
1197
+						$tdi=array_filter($tdi);
1198
+					//    $tabledata[]=array_merge($td,$tdi);
1199
+						$tabledata[]=$td;
1200
+				}
1201
+				return(array_filter($tabledata));
1202
+		}
1203
+
1204
+	   /**
1205
+	    * Get data from form result
1206
+	    * @param String $url form URL
1207
+	    * @return String the result
1208
+	    */
1209
+		private static function getData($url) {
1210
+				$ch = curl_init();
1211
+				curl_setopt($ch, CURLOPT_URL, $url);
1212
+				curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
1213
+				curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
1214
+				curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.2) Gecko/20090729 Firefox/3.5.2 GTB5');
1215
+				return curl_exec($ch);
1216
+		}
1217 1217
 /*
1218 1218
 	public static function waypoints() {
1219 1219
 		$data = update_db::getData('http://www.fallingrain.com/world/FR/waypoints.html');
@@ -1296,7 +1296,7 @@  discard block
 block discarded – undo
1296 1296
 			if ($globalTransaction) $Connection->db->commit();
1297 1297
 		}
1298 1298
 		return '';
1299
-        }
1299
+		}
1300 1300
 
1301 1301
 	public static function ivao_airlines($filename) {
1302 1302
 		//require_once(dirname(__FILE__).'/../require/class.Spotter.php');
@@ -1306,10 +1306,10 @@  discard block
 block discarded – undo
1306 1306
 		try {
1307 1307
 			$Connection = new Connection();
1308 1308
 			$sth = $Connection->db->prepare($query);
1309
-                        $sth->execute();
1310
-                } catch(PDOException $e) {
1311
-                        return "error : ".$e->getMessage();
1312
-                }
1309
+						$sth->execute();
1310
+				} catch(PDOException $e) {
1311
+						return "error : ".$e->getMessage();
1312
+				}
1313 1313
 
1314 1314
 		$header = NULL;
1315 1315
 		$delimiter = ':';
@@ -1333,7 +1333,7 @@  discard block
 block discarded – undo
1333 1333
 			if ($globalTransaction) $Connection->db->commit();
1334 1334
 		}
1335 1335
 		return '';
1336
-        }
1336
+		}
1337 1337
 	
1338 1338
 	public static function update_airspace() {
1339 1339
 		global $tmp_dir, $globalDBdriver;
@@ -1343,11 +1343,11 @@  discard block
 block discarded – undo
1343 1343
 			$query = 'DROP TABLE airspace';
1344 1344
 			try {
1345 1345
 				$sth = $Connection->db->prepare($query);
1346
-                    		$sth->execute();
1347
-	                } catch(PDOException $e) {
1346
+							$sth->execute();
1347
+					} catch(PDOException $e) {
1348 1348
 				return "error : ".$e->getMessage();
1349
-	                }
1350
-	        }
1349
+					}
1350
+			}
1351 1351
 
1352 1352
 
1353 1353
 		if ($globalDBdriver == 'mysql') update_db::gunzip('../db/airspace.sql.gz',$tmp_dir.'airspace.sql');
@@ -1402,10 +1402,10 @@  discard block
 block discarded – undo
1402 1402
 			$query = 'DROP TABLE countries';
1403 1403
 			try {
1404 1404
 				$sth = $Connection->db->prepare($query);
1405
-            	        	$sth->execute();
1406
-	                } catch(PDOException $e) {
1407
-    	                	echo "error : ".$e->getMessage();
1408
-	                }
1405
+							$sth->execute();
1406
+					} catch(PDOException $e) {
1407
+							echo "error : ".$e->getMessage();
1408
+					}
1409 1409
 		}
1410 1410
 		if ($globalDBdriver == 'mysql') {
1411 1411
 			update_db::gunzip('../db/countries.sql.gz',$tmp_dir.'countries.sql');
@@ -1865,11 +1865,11 @@  discard block
 block discarded – undo
1865 1865
 						$query = 'DROP TABLE airspace';
1866 1866
 						try {
1867 1867
 							$sth = $Connection->db->prepare($query);
1868
-    	    	    					$sth->execute();
1869
-			            		} catch(PDOException $e) {
1868
+										$sth->execute();
1869
+								} catch(PDOException $e) {
1870 1870
 							return "error : ".$e->getMessage();
1871
-		            			}
1872
-		    			}
1871
+								}
1872
+						}
1873 1873
 					$error = create_db::import_file($tmp_dir.'airspace.sql');
1874 1874
 					update_db::insert_airspace_version($airspace_md5);
1875 1875
 				} else $error = "File ".$tmp_dir.'airpsace.sql.gz'." doesn't exist. Download failed.";
@@ -1989,12 +1989,12 @@  discard block
 block discarded – undo
1989 1989
 		echo $data;
1990 1990
 		*/
1991 1991
 		if (file_exists($tmp_dir.'aircrafts.html')) {
1992
-		    //var_dump(file_get_html($tmp_dir.'aircrafts.html'));
1993
-		    $fh = fopen($tmp_dir.'aircrafts.html',"r");
1994
-		    $result = fread($fh,100000000);
1995
-		    //echo $result;
1996
-		    //var_dump(str_get_html($result));
1997
-		    //print_r(self::table2array($result));
1992
+			//var_dump(file_get_html($tmp_dir.'aircrafts.html'));
1993
+			$fh = fopen($tmp_dir.'aircrafts.html',"r");
1994
+			$result = fread($fh,100000000);
1995
+			//echo $result;
1996
+			//var_dump(str_get_html($result));
1997
+			//print_r(self::table2array($result));
1998 1998
 		}
1999 1999
 
2000 2000
 	}
@@ -2008,10 +2008,10 @@  discard block
 block discarded – undo
2008 2008
 		try {
2009 2009
 			$Connection = new Connection();
2010 2010
 			$sth = $Connection->db->prepare($query);
2011
-                        $sth->execute();
2012
-                } catch(PDOException $e) {
2013
-                        return "error : ".$e->getMessage();
2014
-                }
2011
+						$sth->execute();
2012
+				} catch(PDOException $e) {
2013
+						return "error : ".$e->getMessage();
2014
+				}
2015 2015
 
2016 2016
 		$error = '';
2017 2017
 		if ($globalDebug) echo "Notam : Download...";
@@ -2067,8 +2067,8 @@  discard block
 block discarded – undo
2067 2067
 					$data['date_end'] = date("Y-m-d H:i:s",strtotime($to));
2068 2068
 					$data['permanent'] = 0;
2069 2069
 				} else {
2070
-				    $data['date_end'] = NULL;
2071
-				    $data['permanent'] = 1;
2070
+					$data['date_end'] = NULL;
2071
+					$data['permanent'] = 1;
2072 2072
 				}
2073 2073
 				$data['full_notam'] = $notam['title'].'<br>'.$notam['description'];
2074 2074
 				$NOTAM = new NOTAM();
@@ -2127,13 +2127,13 @@  discard block
 block discarded – undo
2127 2127
 		try {
2128 2128
 			$Connection = new Connection();
2129 2129
 			$sth = $Connection->db->prepare($query);
2130
-                        $sth->execute();
2131
-                } catch(PDOException $e) {
2132
-                        return "error : ".$e->getMessage();
2133
-                }
2134
-                $row = $sth->fetch(PDO::FETCH_ASSOC);
2135
-                if ($row['nb'] > 0) return false;
2136
-                else return true;
2130
+						$sth->execute();
2131
+				} catch(PDOException $e) {
2132
+						return "error : ".$e->getMessage();
2133
+				}
2134
+				$row = $sth->fetch(PDO::FETCH_ASSOC);
2135
+				if ($row['nb'] > 0) return false;
2136
+				else return true;
2137 2137
 	}
2138 2138
 
2139 2139
 	public static function insert_last_update() {
@@ -2142,10 +2142,10 @@  discard block
 block discarded – undo
2142 2142
 		try {
2143 2143
 			$Connection = new Connection();
2144 2144
 			$sth = $Connection->db->prepare($query);
2145
-                        $sth->execute();
2146
-                } catch(PDOException $e) {
2147
-                        return "error : ".$e->getMessage();
2148
-                }
2145
+						$sth->execute();
2146
+				} catch(PDOException $e) {
2147
+						return "error : ".$e->getMessage();
2148
+				}
2149 2149
 	}
2150 2150
 
2151 2151
 	public static function check_airspace_version($version) {
@@ -2153,13 +2153,13 @@  discard block
 block discarded – undo
2153 2153
 		try {
2154 2154
 			$Connection = new Connection();
2155 2155
 			$sth = $Connection->db->prepare($query);
2156
-                        $sth->execute(array(':version' => $version));
2157
-                } catch(PDOException $e) {
2158
-                        return "error : ".$e->getMessage();
2159
-                }
2160
-                $row = $sth->fetch(PDO::FETCH_ASSOC);
2161
-                if ($row['nb'] > 0) return true;
2162
-                else return false;
2156
+						$sth->execute(array(':version' => $version));
2157
+				} catch(PDOException $e) {
2158
+						return "error : ".$e->getMessage();
2159
+				}
2160
+				$row = $sth->fetch(PDO::FETCH_ASSOC);
2161
+				if ($row['nb'] > 0) return true;
2162
+				else return false;
2163 2163
 	}
2164 2164
 
2165 2165
 
@@ -2169,10 +2169,10 @@  discard block
 block discarded – undo
2169 2169
 		try {
2170 2170
 			$Connection = new Connection();
2171 2171
 			$sth = $Connection->db->prepare($query);
2172
-                        $sth->execute(array(':version' => $version));
2173
-                } catch(PDOException $e) {
2174
-                        return "error : ".$e->getMessage();
2175
-                }
2172
+						$sth->execute(array(':version' => $version));
2173
+				} catch(PDOException $e) {
2174
+						return "error : ".$e->getMessage();
2175
+				}
2176 2176
 	}
2177 2177
 
2178 2178
 	public static function check_last_notam_update() {
@@ -2185,13 +2185,13 @@  discard block
 block discarded – undo
2185 2185
 		try {
2186 2186
 			$Connection = new Connection();
2187 2187
 			$sth = $Connection->db->prepare($query);
2188
-                        $sth->execute();
2189
-                } catch(PDOException $e) {
2190
-                        return "error : ".$e->getMessage();
2191
-                }
2192
-                $row = $sth->fetch(PDO::FETCH_ASSOC);
2193
-                if ($row['nb'] > 0) return false;
2194
-                else return true;
2188
+						$sth->execute();
2189
+				} catch(PDOException $e) {
2190
+						return "error : ".$e->getMessage();
2191
+				}
2192
+				$row = $sth->fetch(PDO::FETCH_ASSOC);
2193
+				if ($row['nb'] > 0) return false;
2194
+				else return true;
2195 2195
 	}
2196 2196
 
2197 2197
 	public static function insert_last_notam_update() {
@@ -2200,10 +2200,10 @@  discard block
 block discarded – undo
2200 2200
 		try {
2201 2201
 			$Connection = new Connection();
2202 2202
 			$sth = $Connection->db->prepare($query);
2203
-                        $sth->execute();
2204
-                } catch(PDOException $e) {
2205
-                        return "error : ".$e->getMessage();
2206
-                }
2203
+						$sth->execute();
2204
+				} catch(PDOException $e) {
2205
+						return "error : ".$e->getMessage();
2206
+				}
2207 2207
 	}
2208 2208
 	public static function check_last_airspace_update() {
2209 2209
 		global $globalDBdriver;
@@ -2215,13 +2215,13 @@  discard block
 block discarded – undo
2215 2215
 		try {
2216 2216
 			$Connection = new Connection();
2217 2217
 			$sth = $Connection->db->prepare($query);
2218
-                        $sth->execute();
2219
-                } catch(PDOException $e) {
2220
-                        return "error : ".$e->getMessage();
2221
-                }
2222
-                $row = $sth->fetch(PDO::FETCH_ASSOC);
2223
-                if ($row['nb'] > 0) return false;
2224
-                else return true;
2218
+						$sth->execute();
2219
+				} catch(PDOException $e) {
2220
+						return "error : ".$e->getMessage();
2221
+				}
2222
+				$row = $sth->fetch(PDO::FETCH_ASSOC);
2223
+				if ($row['nb'] > 0) return false;
2224
+				else return true;
2225 2225
 	}
2226 2226
 
2227 2227
 	public static function insert_last_airspace_update() {
@@ -2230,10 +2230,10 @@  discard block
 block discarded – undo
2230 2230
 		try {
2231 2231
 			$Connection = new Connection();
2232 2232
 			$sth = $Connection->db->prepare($query);
2233
-                        $sth->execute();
2234
-                } catch(PDOException $e) {
2235
-                        return "error : ".$e->getMessage();
2236
-                }
2233
+						$sth->execute();
2234
+				} catch(PDOException $e) {
2235
+						return "error : ".$e->getMessage();
2236
+				}
2237 2237
 	}
2238 2238
 
2239 2239
 	public static function check_last_owner_update() {
@@ -2246,13 +2246,13 @@  discard block
 block discarded – undo
2246 2246
 		try {
2247 2247
 			$Connection = new Connection();
2248 2248
 			$sth = $Connection->db->prepare($query);
2249
-                        $sth->execute();
2250
-                } catch(PDOException $e) {
2251
-                        return "error : ".$e->getMessage();
2252
-                }
2253
-                $row = $sth->fetch(PDO::FETCH_ASSOC);
2254
-                if ($row['nb'] > 0) return false;
2255
-                else return true;
2249
+						$sth->execute();
2250
+				} catch(PDOException $e) {
2251
+						return "error : ".$e->getMessage();
2252
+				}
2253
+				$row = $sth->fetch(PDO::FETCH_ASSOC);
2254
+				if ($row['nb'] > 0) return false;
2255
+				else return true;
2256 2256
 	}
2257 2257
 
2258 2258
 	public static function insert_last_owner_update() {
@@ -2261,10 +2261,10 @@  discard block
 block discarded – undo
2261 2261
 		try {
2262 2262
 			$Connection = new Connection();
2263 2263
 			$sth = $Connection->db->prepare($query);
2264
-                        $sth->execute();
2265
-                } catch(PDOException $e) {
2266
-                        return "error : ".$e->getMessage();
2267
-                }
2264
+						$sth->execute();
2265
+				} catch(PDOException $e) {
2266
+						return "error : ".$e->getMessage();
2267
+				}
2268 2268
 	}
2269 2269
 	public static function check_last_schedules_update() {
2270 2270
 		global $globalDBdriver;
@@ -2276,13 +2276,13 @@  discard block
 block discarded – undo
2276 2276
 		try {
2277 2277
 			$Connection = new Connection();
2278 2278
 			$sth = $Connection->db->prepare($query);
2279
-                        $sth->execute();
2280
-                } catch(PDOException $e) {
2281
-                        return "error : ".$e->getMessage();
2282
-                }
2283
-                $row = $sth->fetch(PDO::FETCH_ASSOC);
2284
-                if ($row['nb'] > 0) return false;
2285
-                else return true;
2279
+						$sth->execute();
2280
+				} catch(PDOException $e) {
2281
+						return "error : ".$e->getMessage();
2282
+				}
2283
+				$row = $sth->fetch(PDO::FETCH_ASSOC);
2284
+				if ($row['nb'] > 0) return false;
2285
+				else return true;
2286 2286
 	}
2287 2287
 
2288 2288
 	public static function insert_last_schedules_update() {
@@ -2291,10 +2291,10 @@  discard block
 block discarded – undo
2291 2291
 		try {
2292 2292
 			$Connection = new Connection();
2293 2293
 			$sth = $Connection->db->prepare($query);
2294
-                        $sth->execute();
2295
-                } catch(PDOException $e) {
2296
-                        return "error : ".$e->getMessage();
2297
-                }
2294
+						$sth->execute();
2295
+				} catch(PDOException $e) {
2296
+						return "error : ".$e->getMessage();
2297
+				}
2298 2298
 	}
2299 2299
 	public static function check_last_tle_update() {
2300 2300
 		global $globalDBdriver;
@@ -2306,13 +2306,13 @@  discard block
 block discarded – undo
2306 2306
 		try {
2307 2307
 			$Connection = new Connection();
2308 2308
 			$sth = $Connection->db->prepare($query);
2309
-                        $sth->execute();
2310
-                } catch(PDOException $e) {
2311
-                        return "error : ".$e->getMessage();
2312
-                }
2313
-                $row = $sth->fetch(PDO::FETCH_ASSOC);
2314
-                if ($row['nb'] > 0) return false;
2315
-                else return true;
2309
+						$sth->execute();
2310
+				} catch(PDOException $e) {
2311
+						return "error : ".$e->getMessage();
2312
+				}
2313
+				$row = $sth->fetch(PDO::FETCH_ASSOC);
2314
+				if ($row['nb'] > 0) return false;
2315
+				else return true;
2316 2316
 	}
2317 2317
 
2318 2318
 	public static function insert_last_tle_update() {
@@ -2321,10 +2321,10 @@  discard block
 block discarded – undo
2321 2321
 		try {
2322 2322
 			$Connection = new Connection();
2323 2323
 			$sth = $Connection->db->prepare($query);
2324
-                        $sth->execute();
2325
-                } catch(PDOException $e) {
2326
-                        return "error : ".$e->getMessage();
2327
-                }
2324
+						$sth->execute();
2325
+				} catch(PDOException $e) {
2326
+						return "error : ".$e->getMessage();
2327
+				}
2328 2328
 	}
2329 2329
 	public static function delete_duplicatemodes() {
2330 2330
 		global $globalDBdriver;
@@ -2336,10 +2336,10 @@  discard block
 block discarded – undo
2336 2336
 		try {
2337 2337
 			$Connection = new Connection();
2338 2338
 			$sth = $Connection->db->prepare($query);
2339
-                        $sth->execute();
2340
-                } catch(PDOException $e) {
2341
-                        return "error : ".$e->getMessage();
2342
-                }
2339
+						$sth->execute();
2340
+				} catch(PDOException $e) {
2341
+						return "error : ".$e->getMessage();
2342
+				}
2343 2343
 	}
2344 2344
 	public static function delete_duplicateowner() {
2345 2345
 		global $globalDBdriver;
@@ -2351,10 +2351,10 @@  discard block
 block discarded – undo
2351 2351
 		try {
2352 2352
 			$Connection = new Connection();
2353 2353
 			$sth = $Connection->db->prepare($query);
2354
-                        $sth->execute();
2355
-                } catch(PDOException $e) {
2356
-                        return "error : ".$e->getMessage();
2357
-                }
2354
+						$sth->execute();
2355
+				} catch(PDOException $e) {
2356
+						return "error : ".$e->getMessage();
2357
+				}
2358 2358
 	}
2359 2359
 	
2360 2360
 	public static function update_all() {
Please login to merge, or discard this patch.
require/class.Accident.php 1 patch
Indentation   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -23,10 +23,10 @@  discard block
 block discarded – undo
23 23
 	}
24 24
 	
25 25
 	/**
26
-	* Get Latest ACARS data from DB
27
-	*
28
-	* @return Array Return ACARS data in array
29
-	*/
26
+	 * Get Latest ACARS data from DB
27
+	 *
28
+	 * @return Array Return ACARS data in array
29
+	 */
30 30
 	public function getLatestAccidentData($limit = '',$type = '') {
31 31
 	global $globalURL, $globalDBdriver;
32 32
 	$Image = new Image($this->db);
@@ -37,36 +37,36 @@  discard block
 block discarded – undo
37 37
 	$limit_query = '';
38 38
 	if ($limit != "")
39 39
 	{
40
-	    $limit_array = explode(",", $limit);
40
+		$limit_array = explode(",", $limit);
41 41
 
42
-	    $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
43
-	    $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
42
+		$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
43
+		$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
44 44
 
45
-	    if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
46
-	    {
45
+		if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
46
+		{
47 47
 		$limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0];
48
-	    }
48
+		}
49 49
 	}
50 50
 
51 51
 	if ($type != '') {
52
-	    $query = "SELECT * FROM accidents WHERE accidents_id IN (SELECT max(accidents_id) FROM accidents WHERE type = :type GROUP BY registration) ORDER BY date DESC".$limit_query;
53
-	    $query_values = array(':type' => $type);
52
+		$query = "SELECT * FROM accidents WHERE accidents_id IN (SELECT max(accidents_id) FROM accidents WHERE type = :type GROUP BY registration) ORDER BY date DESC".$limit_query;
53
+		$query_values = array(':type' => $type);
54 54
 	} else {
55
-	    //$query = "SELECT * FROM accidents GROUP BY registration ORDER BY date DESC".$limit_query;
56
-	    $query = "SELECT * FROM accidents WHERE accidents_id IN (SELECT max(accidents_id) FROM accidents GROUP BY registration) ORDER BY date DESC".$limit_query;
57
-	    $query_values = array();
55
+		//$query = "SELECT * FROM accidents GROUP BY registration ORDER BY date DESC".$limit_query;
56
+		$query = "SELECT * FROM accidents WHERE accidents_id IN (SELECT max(accidents_id) FROM accidents GROUP BY registration) ORDER BY date DESC".$limit_query;
57
+		$query_values = array();
58 58
 	}
59 59
 	try {
60 60
 
61
-	    $sth = $this->db->prepare($query);
62
-	    $sth->execute($query_values);
61
+		$sth = $this->db->prepare($query);
62
+		$sth->execute($query_values);
63 63
 	} catch(PDOException $e) {
64
-	    return "error : ".$e->getMessage();
64
+		return "error : ".$e->getMessage();
65 65
 	}
66 66
 	$i = 0;
67 67
 	while ($row = $sth->fetch(PDO::FETCH_ASSOC)) {
68
-	    $data = array();
69
-	    if ($row['registration'] != '') {
68
+		$data = array();
69
+		if ($row['registration'] != '') {
70 70
 //		$row['registration'] = str_replace('.','',$row['registration']);
71 71
 		$image_array = $Image->getSpotterImage($row['registration']);
72 72
 		if (count($image_array) > 0) $data = array_merge($data,array('image' => $image_array[0]['image'],'image_thumbnail' => $image_array[0]['image_thumbnail'],'image_copyright' => $image_array[0]['image_copyright'],'image_source' => $image_array[0]['image_source'],'image_source_website' => $image_array[0]['image_source_website']));
@@ -89,33 +89,33 @@  discard block
 block discarded – undo
89 89
 			$data['aircraft_base'] = $owner_data['base'];
90 90
 			$data['aircraft_date_first_reg'] = $owner_data['date_first_reg'];
91 91
 		}
92
-	    } else $data = array_merge($data,array('image' => '','image_thumbnail' => '','image_copyright' => '','image_source' => '','image_source_website' => ''));
93
-	    if ($row['registration'] == '') $row['registration'] = 'NA';
94
-	    if ($row['ident'] == '') $row['ident'] = 'NA';
95
-	    $identicao = $Spotter->getAllAirlineInfo(substr($row['ident'],0,2));
96
-	    if (isset($identicao[0])) {
92
+		} else $data = array_merge($data,array('image' => '','image_thumbnail' => '','image_copyright' => '','image_source' => '','image_source_website' => ''));
93
+		if ($row['registration'] == '') $row['registration'] = 'NA';
94
+		if ($row['ident'] == '') $row['ident'] = 'NA';
95
+		$identicao = $Spotter->getAllAirlineInfo(substr($row['ident'],0,2));
96
+		if (isset($identicao[0])) {
97 97
 		if (substr($row['ident'],0,2) == 'AF') {
98
-		    if (filter_var(substr($row['ident'],2),FILTER_VALIDATE_INT,array("flags"=>FILTER_FLAG_ALLOW_OCTAL))) $icao = $row['ident'];
99
-		    else $icao = 'AFR'.ltrim(substr($row['ident'],2),'0');
98
+			if (filter_var(substr($row['ident'],2),FILTER_VALIDATE_INT,array("flags"=>FILTER_FLAG_ALLOW_OCTAL))) $icao = $row['ident'];
99
+			else $icao = 'AFR'.ltrim(substr($row['ident'],2),'0');
100 100
 		} else $icao = $identicao[0]['icao'].ltrim(substr($row['ident'],2),'0');
101 101
 
102 102
 		$data = array_merge($data,array('airline_icao' => $identicao[0]['icao'],'airline_name' => $identicao[0]['name']));
103
-	    } else $icao = $row['ident'];
104
-	    $icao = $Translation->checkTranslation($icao,false);
105
-	    //$data = array_merge($data,array('registration' => $row['registration'], 'date' => $row['date'], 'ident' => $icao,'url' => $row['url']));
106
-	    $data = array_merge($row,$data);
107
-	    if ($data['ident'] == null) $data['ident'] = $icao;
108
-	    if ($data['title'] == null) {
103
+		} else $icao = $row['ident'];
104
+		$icao = $Translation->checkTranslation($icao,false);
105
+		//$data = array_merge($data,array('registration' => $row['registration'], 'date' => $row['date'], 'ident' => $icao,'url' => $row['url']));
106
+		$data = array_merge($row,$data);
107
+		if ($data['ident'] == null) $data['ident'] = $icao;
108
+		if ($data['title'] == null) {
109 109
 		$data['message'] = $row['type'].' of '.$row['registration'].' at '.$row['place'].','.$row['country'];
110
-	    } else $data['message'] = strtolower($data['title']);
111
-	    $result[] = $data;
112
-	    $i++;
110
+		} else $data['message'] = strtolower($data['title']);
111
+		$result[] = $data;
112
+		$i++;
113 113
 	}
114 114
 	if (isset($result)) {
115
-	    $result[0]['query_number_rows'] = $i;
116
-	    return $result;
115
+		$result[0]['query_number_rows'] = $i;
116
+		return $result;
117 117
 	}
118 118
 	else return array();
119
-    }
119
+	}
120 120
 }
121 121
 ?>
122 122
\ No newline at end of file
Please login to merge, or discard this patch.
table-output.php 1 patch
Indentation   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -388,17 +388,17 @@  discard block
 block discarded – undo
388 388
 				else {
389 389
 					$planespotter_url_array = explode("_", $spotter_item['image']);
390 390
 					$planespotter_id = str_replace(".jpg", "", $planespotter_url_array[1]);
391
-                                        $image_src = 'https://www.planespotters.net/Aviation_Photos/photo.show?id='.$planespotter_id;
391
+										$image_src = 'https://www.planespotters.net/Aviation_Photos/photo.show?id='.$planespotter_id;
392 392
 				}
393 393
 				if (isset($spotter_item['airline_name'])) {
394 394
 					print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['airline_name'].'" alt="'.$spotter_item['registration'].' - '.$spotter_item['airline_name'].'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Airline:").' '.$spotter_item['airline_name'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">&copy; '.$spotter_item['image_copyright'].'</div>';
395 395
 				} else {
396 396
 					print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '._("Not available").'" alt="'.$spotter_item['registration'].' - '._("Not available").'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Airline:").' '._("Not available").'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">&copy; '.$spotter_item['image_copyright'].'</div>';
397 397
 				}
398
-                        } else {
399
-                    		if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') {
400
-                    		$image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']);
401
-                    		} else 	$image_thumbnail = $spotter_item['image_thumbnail'];
398
+						} else {
399
+							if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') {
400
+							$image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']);
401
+							} else 	$image_thumbnail = $spotter_item['image_thumbnail'];
402 402
 				if (isset($spotter_item['airline_name'])) {
403 403
 					print '<img src="'.$image_thumbnail.'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['airline_name'].'" alt="'.$spotter_item['registration'].' - '.$spotter_item['airline_name'].'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Airline:").' '.$spotter_item['airline_name'].'" data-html="true" width="100px" />'."\n".'<div class="thumbnail-copyright">&copy; '.$spotter_item['image_copyright'].'</div>';
404 404
 				} else {
@@ -413,7 +413,7 @@  discard block
 block discarded – undo
413 413
 		}
414 414
 	} elseif(strtolower($current_page) != "currently" && strtolower($current_page) != "upcoming" && strtolower($current_page) != "acars-latest" && strtolower($current_page) != "acars-archive" && strtolower($current_page) != "accident-latest" && strtolower($current_page) != "incident-latest"){
415 415
 		if (!isset($spotter_item['squawk']) || $spotter_item['squawk'] == 0) {
416
-		    $spotter_item['squawk'] = '-';
416
+			$spotter_item['squawk'] = '-';
417 417
 		}
418 418
 		if ($spotter_item['image_thumbnail'] != "")
419 419
 		{
@@ -424,7 +424,7 @@  discard block
 block discarded – undo
424 424
 				else {
425 425
 					$planespotter_url_array = explode("_", $spotter_array[0]['image']);
426 426
 					$planespotter_id = str_replace(".jpg", "", $planespotter_url_array[1]);
427
-                                        $image_src = 'https://www.planespotters.net/Aviation_Photos/photo.show?id='.$planespotter_id;
427
+										$image_src = 'https://www.planespotters.net/Aviation_Photos/photo.show?id='.$planespotter_id;
428 428
 				}
429 429
 				if (!isset($spotter_item['airline_name']) && isset($spotter_item['aircraft_name'])) {
430 430
 					print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '._("Not available").'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">&copy; '.$spotter_item['image_copyright'].'</div>';
@@ -436,9 +436,9 @@  discard block
 block discarded – undo
436 436
 					print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '.$spotter_item['airline_name'].'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '.$spotter_item['airline_name'].'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '.$spotter_item['airline_name'].'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">&copy; '.$spotter_item['image_copyright'].'</div>';
437 437
 				}
438 438
 			} else {
439
-                    		if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') {
440
-                    		$image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']);
441
-                    		} else 	$image_thumbnail = $spotter_item['image_thumbnail'];
439
+							if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') {
440
+							$image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']);
441
+							} else 	$image_thumbnail = $spotter_item['image_thumbnail'];
442 442
 				if (!isset($spotter_item['airline_name']) && isset($spotter_item['aircraft_name'])) {
443 443
 					print '<a href="'.$globalURL.'/flightid/'.$spotter_item['spotter_id'].'"><img src="'.$image_thumbnail.'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '._("Not available").'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">&copy; '.$spotter_item['image_copyright'].'</div>';
444 444
 				} elseif (!isset($spotter_item['aircraft_name']) && isset($spotter_item['airline_name'])) {
@@ -452,7 +452,7 @@  discard block
 block discarded – undo
452 452
 			print '</td>'."\n";
453 453
 		} else {
454 454
 			print '<td class="aircraft_thumbnail">'."\n";
455
-       //   	 	print '<a href="'.$globalURL.'/flightid/'.$spotter_item['spotter_id'].'"><img src="'.$globalURL.'/images/placeholder_thumb.png" alt="Click to see more information about this flight" title="Click to see more information about this flight" width="100px" /></a>';
455
+	   //   	 	print '<a href="'.$globalURL.'/flightid/'.$spotter_item['spotter_id'].'"><img src="'.$globalURL.'/images/placeholder_thumb.png" alt="Click to see more information about this flight" title="Click to see more information about this flight" width="100px" /></a>';
456 456
 	//}
457 457
 			if (!isset($spotter_item['airline_name']) && !isset($spotter_item['aircraft_name'])) {
458 458
 				print '<a href="'.$globalURL.'/flightid/'.$spotter_item['spotter_id'].'"><img src="'.$globalURL.'/images/placeholder_thumb.png" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' '._("Not available").' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '._("Not available").'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n";
@@ -557,13 +557,13 @@  discard block
 block discarded – undo
557 557
 				$distance = $Spotter->getAirportDistance($spotter_item['departure_airport'],$latitude,$longitude);
558 558
 			} else $distance = '';
559 559
 			if ($distance != '') {
560
-			    if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) {
561
-				    echo '<br/><i>'.round($distance*0.539957).' nm</i>';
562
-			    } elseif ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) {
563
-				    echo '<br/><i>'.round($distance*0.621371).' mi</i>';
564
-			    } elseif ((!isset($_COOKIE['unitdistance']) && ((isset($globalUnitDistance) && $globalUnitDistance == 'km') || !isset($globalUnitDistance))) || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'km')) {
565
-				    echo '<br/><i>'.$distance.' km</i>';
566
-			    }
560
+				if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) {
561
+					echo '<br/><i>'.round($distance*0.539957).' nm</i>';
562
+				} elseif ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) {
563
+					echo '<br/><i>'.round($distance*0.621371).' mi</i>';
564
+				} elseif ((!isset($_COOKIE['unitdistance']) && ((isset($globalUnitDistance) && $globalUnitDistance == 'km') || !isset($globalUnitDistance))) || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'km')) {
565
+					echo '<br/><i>'.$distance.' km</i>';
566
+				}
567 567
 			}
568 568
 		}
569 569
 		print '</td>'."\n";
@@ -624,13 +624,13 @@  discard block
 block discarded – undo
624 624
 				$distance = $Spotter->getAirportDistance($spotter_item['arrival_airport'],$latitude,$longitude);
625 625
 			} else $distance = '';
626 626
 				if ($distance != '') {
627
-				    if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) {
628
-					    echo '<br/><i>'.round($distance*0.539957).' nm</i>';
629
-				    } elseif ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) {
630
-					    echo '<br/><i>'.round($distance*0.621371).' mi</i>';
631
-				    } elseif ((!isset($_COOKIE['unitdistance']) && ((isset($globalUnitDistance) && $globalUnitDistance == 'km') || !isset($globalUnitDistance))) || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'km')) {
632
-					    echo '<br/><i>'.$distance.' km</i>';
633
-				    }
627
+					if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) {
628
+						echo '<br/><i>'.round($distance*0.539957).' nm</i>';
629
+					} elseif ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) {
630
+						echo '<br/><i>'.round($distance*0.621371).' mi</i>';
631
+					} elseif ((!isset($_COOKIE['unitdistance']) && ((isset($globalUnitDistance) && $globalUnitDistance == 'km') || !isset($globalUnitDistance))) || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'km')) {
632
+						echo '<br/><i>'.$distance.' km</i>';
633
+					}
634 634
 				}
635 635
 			}
636 636
 			print '</td>'."\n";
Please login to merge, or discard this patch.
require/class.Spotter.php 1 patch
Indentation   +1292 added lines, -1292 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;
@@ -455,11 +455,11 @@  discard block
 block discarded – undo
455 455
 	
456 456
 	
457 457
 	/**
458
-	* Gets all the spotter information
459
-	*
460
-	* @return Array the spotter information
461
-	*
462
-	*/
458
+	 * Gets all the spotter information
459
+	 *
460
+	 * @return Array the spotter information
461
+	 *
462
+	 */
463 463
 	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())
464 464
 	{
465 465
 		global $globalTimezone, $globalDBdriver;
@@ -806,11 +806,11 @@  discard block
 block discarded – undo
806 806
 	
807 807
 	
808 808
 	/**
809
-	* Gets all the spotter information based on the latest data entry
810
-	*
811
-	* @return Array the spotter information
812
-	*
813
-	*/
809
+	 * Gets all the spotter information based on the latest data entry
810
+	 *
811
+	 * @return Array the spotter information
812
+	 *
813
+	 */
814 814
 	public function getLatestSpotterData($limit = '', $sort = '', $filter = array())
815 815
 	{
816 816
 		global $global_query;
@@ -849,12 +849,12 @@  discard block
 block discarded – undo
849 849
 	}
850 850
     
851 851
     
852
-    /**
853
-	* Gets all the spotter information based on a user's latitude and longitude
854
-	*
855
-	* @return Array the spotter information
856
-	*
857
-	*/
852
+	/**
853
+	 * Gets all the spotter information based on a user's latitude and longitude
854
+	 *
855
+	 * @return Array the spotter information
856
+	 *
857
+	 */
858 858
 	public function getLatestSpotterForLayar($lat, $lng, $radius, $interval)
859 859
 	{
860 860
 		date_default_timezone_set('UTC');
@@ -882,7 +882,7 @@  discard block
 block discarded – undo
882 882
 				return false;
883 883
 			}
884 884
 		}
885
-    		$additional_query = '';
885
+			$additional_query = '';
886 886
 		if ($interval != "")
887 887
 		{
888 888
 			if (!is_string($interval))
@@ -922,12 +922,12 @@  discard block
 block discarded – undo
922 922
 	}
923 923
     
924 924
     
925
-    /**
926
-	* Gets all the spotter information sorted by the newest aircraft type
927
-	*
928
-	* @return Array the spotter information
929
-	*
930
-	*/
925
+	/**
926
+	 * Gets all the spotter information sorted by the newest aircraft type
927
+	 *
928
+	 * @return Array the spotter information
929
+	 *
930
+	 */
931 931
 	public function getNewestSpotterDataSortedByAircraftType($limit = '', $sort = '',$filter = array())
932 932
 	{
933 933
 		global $global_query;
@@ -968,11 +968,11 @@  discard block
 block discarded – undo
968 968
     
969 969
     
970 970
 	/**
971
-	* Gets all the spotter information sorted by the newest aircraft registration
972
-	*
973
-	* @return Array the spotter information
974
-	*
975
-	*/
971
+	 * Gets all the spotter information sorted by the newest aircraft registration
972
+	 *
973
+	 * @return Array the spotter information
974
+	 *
975
+	 */
976 976
 	public function getNewestSpotterDataSortedByAircraftRegistration($limit = '', $sort = '', $filter = array())
977 977
 	{
978 978
 		global $global_query;
@@ -1012,11 +1012,11 @@  discard block
 block discarded – undo
1012 1012
 
1013 1013
 
1014 1014
 	/**
1015
-	* Gets all the spotter information sorted by the newest airline
1016
-	*
1017
-	* @return Array the spotter information
1018
-	*
1019
-	*/
1015
+	 * Gets all the spotter information sorted by the newest airline
1016
+	 *
1017
+	 * @return Array the spotter information
1018
+	 *
1019
+	 */
1020 1020
 	public function getNewestSpotterDataSortedByAirline($limit = '', $sort = '',$filter = array())
1021 1021
 	{
1022 1022
 		global $global_query;
@@ -1055,12 +1055,12 @@  discard block
 block discarded – undo
1055 1055
 	}
1056 1056
     
1057 1057
     
1058
-    /**
1059
-	* Gets all the spotter information sorted by the newest departure airport
1060
-	*
1061
-	* @return Array the spotter information
1062
-	*
1063
-	*/
1058
+	/**
1059
+	 * Gets all the spotter information sorted by the newest departure airport
1060
+	 *
1061
+	 * @return Array the spotter information
1062
+	 *
1063
+	 */
1064 1064
 	public function getNewestSpotterDataSortedByDepartureAirport($limit = '', $sort = '', $filter = array())
1065 1065
 	{
1066 1066
 		global $global_query;
@@ -1102,11 +1102,11 @@  discard block
 block discarded – undo
1102 1102
 
1103 1103
 
1104 1104
 	/**
1105
-	* Gets all the spotter information sorted by the newest arrival airport
1106
-	*
1107
-	* @return Array the spotter information
1108
-	*
1109
-	*/
1105
+	 * Gets all the spotter information sorted by the newest arrival airport
1106
+	 *
1107
+	 * @return Array the spotter information
1108
+	 *
1109
+	 */
1110 1110
 	public function getNewestSpotterDataSortedByArrivalAirport($limit = '', $sort = '', $filter = array())
1111 1111
 	{
1112 1112
 		global $global_query;
@@ -1145,11 +1145,11 @@  discard block
 block discarded – undo
1145 1145
 	
1146 1146
 
1147 1147
 	/**
1148
-	* Gets all the spotter information based on the spotter id
1149
-	*
1150
-	* @return Array the spotter information
1151
-	*
1152
-	*/
1148
+	 * Gets all the spotter information based on the spotter id
1149
+	 *
1150
+	 * @return Array the spotter information
1151
+	 *
1152
+	 */
1153 1153
 	public function getSpotterDataByID($id = '')
1154 1154
 	{
1155 1155
 		global $global_query;
@@ -1171,11 +1171,11 @@  discard block
 block discarded – undo
1171 1171
 	
1172 1172
 	
1173 1173
 	/**
1174
-	* Gets all the spotter information based on the callsign
1175
-	*
1176
-	* @return Array the spotter information
1177
-	*
1178
-	*/
1174
+	 * Gets all the spotter information based on the callsign
1175
+	 *
1176
+	 * @return Array the spotter information
1177
+	 *
1178
+	 */
1179 1179
 	public function getSpotterDataByIdent($ident = '', $limit = '', $sort = '')
1180 1180
 	{
1181 1181
 		global $global_query;
@@ -1228,11 +1228,11 @@  discard block
 block discarded – undo
1228 1228
 	
1229 1229
 	
1230 1230
 	/**
1231
-	* Gets all the spotter information based on the aircraft type
1232
-	*
1233
-	* @return Array the spotter information
1234
-	*
1235
-	*/
1231
+	 * Gets all the spotter information based on the aircraft type
1232
+	 *
1233
+	 * @return Array the spotter information
1234
+	 *
1235
+	 */
1236 1236
 	public function getSpotterDataByAircraft($aircraft_type = '', $limit = '', $sort = '', $filter = array())
1237 1237
 	{
1238 1238
 		global $global_query;
@@ -1286,11 +1286,11 @@  discard block
 block discarded – undo
1286 1286
 	
1287 1287
 	
1288 1288
 	/**
1289
-	* Gets all the spotter information based on the aircraft registration
1290
-	*
1291
-	* @return Array the spotter information
1292
-	*
1293
-	*/
1289
+	 * Gets all the spotter information based on the aircraft registration
1290
+	 *
1291
+	 * @return Array the spotter information
1292
+	 *
1293
+	 */
1294 1294
 	public function getSpotterDataByRegistration($registration = '', $limit = '', $sort = '', $filter = array())
1295 1295
 	{
1296 1296
 		global $global_query;
@@ -1347,11 +1347,11 @@  discard block
 block discarded – undo
1347 1347
 	
1348 1348
 	
1349 1349
 	/**
1350
-	* Gets all the spotter information based on the airline
1351
-	*
1352
-	* @return Array the spotter information
1353
-	*
1354
-	*/
1350
+	 * Gets all the spotter information based on the airline
1351
+	 *
1352
+	 * @return Array the spotter information
1353
+	 *
1354
+	 */
1355 1355
 	public function getSpotterDataByAirline($airline = '', $limit = '', $sort = '',$filters = array())
1356 1356
 	{
1357 1357
 		global $global_query;
@@ -1404,11 +1404,11 @@  discard block
 block discarded – undo
1404 1404
 	
1405 1405
 	
1406 1406
 	/**
1407
-	* Gets all the spotter information based on the airport
1408
-	*
1409
-	* @return Array the spotter information
1410
-	*
1411
-	*/
1407
+	 * Gets all the spotter information based on the airport
1408
+	 *
1409
+	 * @return Array the spotter information
1410
+	 *
1411
+	 */
1412 1412
 	public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '',$filters = array())
1413 1413
 	{
1414 1414
 		global $global_query;
@@ -1462,11 +1462,11 @@  discard block
 block discarded – undo
1462 1462
 
1463 1463
 
1464 1464
 	/**
1465
-	* Gets all the spotter information based on the date
1466
-	*
1467
-	* @return Array the spotter information
1468
-	*
1469
-	*/
1465
+	 * Gets all the spotter information based on the date
1466
+	 *
1467
+	 * @return Array the spotter information
1468
+	 *
1469
+	 */
1470 1470
 	public function getSpotterDataByDate($date = '', $limit = '', $sort = '',$filter = array())
1471 1471
 	{
1472 1472
 		global $global_query, $globalTimezone, $globalDBdriver;
@@ -1527,11 +1527,11 @@  discard block
 block discarded – undo
1527 1527
 
1528 1528
 
1529 1529
 	/**
1530
-	* Gets all the spotter information based on the country name
1531
-	*
1532
-	* @return Array the spotter information
1533
-	*
1534
-	*/
1530
+	 * Gets all the spotter information based on the country name
1531
+	 *
1532
+	 * @return Array the spotter information
1533
+	 *
1534
+	 */
1535 1535
 	public function getSpotterDataByCountry($country = '', $limit = '', $sort = '',$filters = array())
1536 1536
 	{
1537 1537
 		global $global_query;
@@ -1585,11 +1585,11 @@  discard block
 block discarded – undo
1585 1585
 	
1586 1586
 	
1587 1587
 	/**
1588
-	* Gets all the spotter information based on the manufacturer name
1589
-	*
1590
-	* @return Array the spotter information
1591
-	*
1592
-	*/
1588
+	 * Gets all the spotter information based on the manufacturer name
1589
+	 *
1590
+	 * @return Array the spotter information
1591
+	 *
1592
+	 */
1593 1593
 	public function getSpotterDataByManufacturer($aircraft_manufacturer = '', $limit = '', $sort = '', $filters = array())
1594 1594
 	{
1595 1595
 		global $global_query;
@@ -1645,13 +1645,13 @@  discard block
 block discarded – undo
1645 1645
   
1646 1646
   
1647 1647
 	/**
1648
-	* Gets a list of all aircraft that take a route
1649
-	*
1650
-	* @param String $departure_airport_icao ICAO code of departure airport
1651
-	* @param String $arrival_airport_icao ICAO code of arrival airport
1652
-	* @return Array the spotter information
1653
-	*
1654
-	*/
1648
+	 * Gets a list of all aircraft that take a route
1649
+	 *
1650
+	 * @param String $departure_airport_icao ICAO code of departure airport
1651
+	 * @param String $arrival_airport_icao ICAO code of arrival airport
1652
+	 * @return Array the spotter information
1653
+	 *
1654
+	 */
1655 1655
 	public function getSpotterDataByRoute($departure_airport_icao = '', $arrival_airport_icao = '', $limit = '', $sort = '', $filters = array())
1656 1656
 	{
1657 1657
 		global $global_query;
@@ -1720,11 +1720,11 @@  discard block
 block discarded – undo
1720 1720
 	
1721 1721
 	
1722 1722
 	/**
1723
-	* Gets all the spotter information based on the special column in the table
1724
-	*
1725
-	* @return Array the spotter information
1726
-	*
1727
-	*/
1723
+	 * Gets all the spotter information based on the special column in the table
1724
+	 *
1725
+	 * @return Array the spotter information
1726
+	 *
1727
+	 */
1728 1728
 	public function getSpotterDataByHighlight($limit = '', $sort = '', $filter = array())
1729 1729
 	{
1730 1730
 		global $global_query;
@@ -1763,11 +1763,11 @@  discard block
 block discarded – undo
1763 1763
 	}
1764 1764
 
1765 1765
 	/**
1766
-	* Gets all the highlight based on a aircraft registration
1767
-	*
1768
-	* @return String the highlight text
1769
-	*
1770
-	*/
1766
+	 * Gets all the highlight based on a aircraft registration
1767
+	 *
1768
+	 * @return String the highlight text
1769
+	 *
1770
+	 */
1771 1771
 	public function getHighlightByRegistration($registration,$filter = array())
1772 1772
 	{
1773 1773
 		global $global_query;
@@ -1789,13 +1789,13 @@  discard block
 block discarded – undo
1789 1789
 
1790 1790
 	
1791 1791
 	/**
1792
-	* Gets the squawk usage from squawk code
1793
-	*
1794
-	* @param String $squawk squawk code
1795
-	* @param String $country country
1796
-	* @return String usage
1797
-	*
1798
-	*/
1792
+	 * Gets the squawk usage from squawk code
1793
+	 *
1794
+	 * @param String $squawk squawk code
1795
+	 * @param String $country country
1796
+	 * @return String usage
1797
+	 *
1798
+	 */
1799 1799
 	public function getSquawkUsage($squawk = '',$country = 'FR')
1800 1800
 	{
1801 1801
 		
@@ -1816,12 +1816,12 @@  discard block
 block discarded – undo
1816 1816
 	}
1817 1817
 
1818 1818
 	/**
1819
-	* Gets the airport icao from the iata
1820
-	*
1821
-	* @param String $airport_iata the iata code of the airport
1822
-	* @return String airport iata
1823
-	*
1824
-	*/
1819
+	 * Gets the airport icao from the iata
1820
+	 *
1821
+	 * @param String $airport_iata the iata code of the airport
1822
+	 * @return String airport iata
1823
+	 *
1824
+	 */
1825 1825
 	public function getAirportIcao($airport_iata = '')
1826 1826
 	{
1827 1827
 		
@@ -1841,14 +1841,14 @@  discard block
 block discarded – undo
1841 1841
 	}
1842 1842
 
1843 1843
 	/**
1844
-	* Gets the airport distance
1845
-	*
1846
-	* @param String $airport_icao the icao code of the airport
1847
-	* @param Float $latitude the latitude
1848
-	* @param Float $longitude the longitude
1849
-	* @return Float distance to the airport
1850
-	*
1851
-	*/
1844
+	 * Gets the airport distance
1845
+	 *
1846
+	 * @param String $airport_icao the icao code of the airport
1847
+	 * @param Float $latitude the latitude
1848
+	 * @param Float $longitude the longitude
1849
+	 * @return Float distance to the airport
1850
+	 *
1851
+	 */
1852 1852
 	public function getAirportDistance($airport_icao,$latitude,$longitude)
1853 1853
 	{
1854 1854
 		
@@ -1869,12 +1869,12 @@  discard block
 block discarded – undo
1869 1869
 	}
1870 1870
 	
1871 1871
 	/**
1872
-	* Gets the airport info based on the icao
1873
-	*
1874
-	* @param String $airport the icao code of the airport
1875
-	* @return Array airport information
1876
-	*
1877
-	*/
1872
+	 * Gets the airport info based on the icao
1873
+	 *
1874
+	 * @param String $airport the icao code of the airport
1875
+	 * @return Array airport information
1876
+	 *
1877
+	 */
1878 1878
 	public function getAllAirportInfo($airport = '')
1879 1879
 	{
1880 1880
 		
@@ -1920,12 +1920,12 @@  discard block
 block discarded – undo
1920 1920
 	}
1921 1921
 	
1922 1922
 	/**
1923
-	* Gets the airport info based on the country
1924
-	*
1925
-	* @param Array $countries Airports countries
1926
-	* @return Array airport information
1927
-	*
1928
-	*/
1923
+	 * Gets the airport info based on the country
1924
+	 *
1925
+	 * @param Array $countries Airports countries
1926
+	 * @return Array airport information
1927
+	 *
1928
+	 */
1929 1929
 	public function getAllAirportInfobyCountry($countries)
1930 1930
 	{
1931 1931
 		$lst_countries = '';
@@ -1963,12 +1963,12 @@  discard block
 block discarded – undo
1963 1963
 	}
1964 1964
 	
1965 1965
 	/**
1966
-	* Gets airports info based on the coord
1967
-	*
1968
-	* @param Array $coord Airports longitude min,latitude min, longitude max, latitude max
1969
-	* @return Array airport information
1970
-	*
1971
-	*/
1966
+	 * Gets airports info based on the coord
1967
+	 *
1968
+	 * @param Array $coord Airports longitude min,latitude min, longitude max, latitude max
1969
+	 * @return Array airport information
1970
+	 *
1971
+	 */
1972 1972
 	public function getAllAirportInfobyCoord($coord)
1973 1973
 	{
1974 1974
 		global $globalDBdriver;
@@ -1999,12 +1999,12 @@  discard block
 block discarded – undo
1999 1999
 	}
2000 2000
 
2001 2001
 	/**
2002
-	* Gets waypoints info based on the coord
2003
-	*
2004
-	* @param Array $coord waypoints coord
2005
-	* @return Array airport information
2006
-	*
2007
-	*/
2002
+	 * Gets waypoints info based on the coord
2003
+	 *
2004
+	 * @param Array $coord waypoints coord
2005
+	 * @return Array airport information
2006
+	 *
2007
+	 */
2008 2008
 	public function getAllWaypointsInfobyCoord($coord)
2009 2009
 	{
2010 2010
 		if (is_array($coord)) {
@@ -2038,12 +2038,12 @@  discard block
 block discarded – undo
2038 2038
 	
2039 2039
 	
2040 2040
 	/**
2041
-	* Gets the airline info based on the icao code or iata code
2042
-	*
2043
-	* @param String $airline_icao the iata code of the airport
2044
-	* @return Array airport information
2045
-	*
2046
-	*/
2041
+	 * Gets the airline info based on the icao code or iata code
2042
+	 *
2043
+	 * @param String $airline_icao the iata code of the airport
2044
+	 * @return Array airport information
2045
+	 *
2046
+	 */
2047 2047
 	public function getAllAirlineInfo($airline_icao, $fromsource = NULL)
2048 2048
 	{
2049 2049
 		global $globalUseRealAirlines;
@@ -2074,7 +2074,7 @@  discard block
 block discarded – undo
2074 2074
 			} else {
2075 2075
 				$sth->execute(array(':airline_icao' => $airline_icao,':fromsource' => $fromsource));
2076 2076
 			}
2077
-                        /*
2077
+						/*
2078 2078
 			$airline_array = array();
2079 2079
 			$temp_array = array();
2080 2080
 		
@@ -2106,12 +2106,12 @@  discard block
 block discarded – undo
2106 2106
 	
2107 2107
 	
2108 2108
 	/**
2109
-	* Gets the aircraft info based on the aircraft type
2110
-	*
2111
-	* @param String $aircraft_type the aircraft type
2112
-	* @return Array aircraft information
2113
-	*
2114
-	*/
2109
+	 * Gets the aircraft info based on the aircraft type
2110
+	 *
2111
+	 * @param String $aircraft_type the aircraft type
2112
+	 * @return Array aircraft information
2113
+	 *
2114
+	 */
2115 2115
 	public function getAllAircraftInfo($aircraft_type)
2116 2116
 	{
2117 2117
 		$aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING);
@@ -2143,12 +2143,12 @@  discard block
 block discarded – undo
2143 2143
 	}
2144 2144
 
2145 2145
 	/**
2146
-	* Gets the aircraft icao based on the aircraft name/type
2147
-	*
2148
-	* @param String $aircraft_type the aircraft type
2149
-	* @return String aircraft information
2150
-	*
2151
-	*/
2146
+	 * Gets the aircraft icao based on the aircraft name/type
2147
+	 *
2148
+	 * @param String $aircraft_type the aircraft type
2149
+	 * @return String aircraft information
2150
+	 *
2151
+	 */
2152 2152
 	public function getAircraftIcao($aircraft_type)
2153 2153
 	{
2154 2154
 		$aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING);
@@ -2173,12 +2173,12 @@  discard block
 block discarded – undo
2173 2173
 	}
2174 2174
 	
2175 2175
 	/**
2176
-	* Gets the aircraft info based on the aircraft modes
2177
-	*
2178
-	* @param String $aircraft_modes the aircraft ident (hex)
2179
-	* @return String aircraft type
2180
-	*
2181
-	*/
2176
+	 * Gets the aircraft info based on the aircraft modes
2177
+	 *
2178
+	 * @param String $aircraft_modes the aircraft ident (hex)
2179
+	 * @return String aircraft type
2180
+	 *
2181
+	 */
2182 2182
 	public function getAllAircraftType($aircraft_modes)
2183 2183
 	{
2184 2184
 		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
@@ -2196,12 +2196,12 @@  discard block
 block discarded – undo
2196 2196
 	}
2197 2197
 
2198 2198
 	/**
2199
-	* Gets the aircraft info based on the aircraft registration
2200
-	*
2201
-	* @param String $registration the aircraft registration
2202
-	* @return String aircraft type
2203
-	*
2204
-	*/
2199
+	 * Gets the aircraft info based on the aircraft registration
2200
+	 *
2201
+	 * @param String $registration the aircraft registration
2202
+	 * @return String aircraft type
2203
+	 *
2204
+	 */
2205 2205
 	public function getAllAircraftTypeByRegistration($registration)
2206 2206
 	{
2207 2207
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -2219,12 +2219,12 @@  discard block
 block discarded – undo
2219 2219
 	}
2220 2220
 
2221 2221
 	/**
2222
-	* Gets correct aircraft operator corde
2223
-	*
2224
-	* @param String $operator the aircraft operator code (callsign)
2225
-	* @return String aircraft operator code
2226
-	*
2227
-	*/
2222
+	 * Gets correct aircraft operator corde
2223
+	 *
2224
+	 * @param String $operator the aircraft operator code (callsign)
2225
+	 * @return String aircraft operator code
2226
+	 *
2227
+	 */
2228 2228
 	public function getOperator($operator)
2229 2229
 	{
2230 2230
 		$operator = filter_var($operator,FILTER_SANITIZE_STRING);
@@ -2241,16 +2241,16 @@  discard block
 block discarded – undo
2241 2241
 	}
2242 2242
 
2243 2243
 	/**
2244
-	* Gets the aircraft route based on the aircraft callsign
2245
-	*
2246
-	* @param String $callsign the aircraft callsign
2247
-	* @return Array aircraft type
2248
-	*
2249
-	*/
2244
+	 * Gets the aircraft route based on the aircraft callsign
2245
+	 *
2246
+	 * @param String $callsign the aircraft callsign
2247
+	 * @return Array aircraft type
2248
+	 *
2249
+	 */
2250 2250
 	public function getRouteInfo($callsign)
2251 2251
 	{
2252 2252
 		$callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
2253
-                if ($callsign == '') return array();
2253
+				if ($callsign == '') return array();
2254 2254
 		$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";
2255 2255
 		
2256 2256
 		$sth = $this->db->prepare($query);
@@ -2264,12 +2264,12 @@  discard block
 block discarded – undo
2264 2264
 	}
2265 2265
 	
2266 2266
 	/**
2267
-	* Gets the aircraft info based on the aircraft registration
2268
-	*
2269
-	* @param String $registration the aircraft registration
2270
-	* @return Array aircraft information
2271
-	*
2272
-	*/
2267
+	 * Gets the aircraft info based on the aircraft registration
2268
+	 *
2269
+	 * @param String $registration the aircraft registration
2270
+	 * @return Array aircraft information
2271
+	 *
2272
+	 */
2273 2273
 	public function getAircraftInfoByRegistration($registration)
2274 2274
 	{
2275 2275
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -2296,12 +2296,12 @@  discard block
 block discarded – undo
2296 2296
 	}
2297 2297
 	
2298 2298
 	/**
2299
-	* Gets the aircraft owner & base based on the aircraft registration
2300
-	*
2301
-	* @param String $registration the aircraft registration
2302
-	* @return Array aircraft information
2303
-	*
2304
-	*/
2299
+	 * Gets the aircraft owner & base based on the aircraft registration
2300
+	 *
2301
+	 * @param String $registration the aircraft registration
2302
+	 * @return Array aircraft information
2303
+	 *
2304
+	 */
2305 2305
 	public function getAircraftOwnerByRegistration($registration)
2306 2306
 	{
2307 2307
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -2318,11 +2318,11 @@  discard block
 block discarded – undo
2318 2318
 	
2319 2319
   
2320 2320
   /**
2321
-	* Gets all flights (but with only little info)
2322
-	*
2323
-	* @return Array basic flight information
2324
-	*
2325
-	*/
2321
+   * Gets all flights (but with only little info)
2322
+   *
2323
+   * @return Array basic flight information
2324
+   *
2325
+   */
2326 2326
 	public function getAllFlightsforSitemap()
2327 2327
 	{
2328 2328
 		//$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 ";
@@ -2330,7 +2330,7 @@  discard block
 block discarded – undo
2330 2330
 		
2331 2331
 		$sth = $this->db->prepare($query);
2332 2332
 		$sth->execute();
2333
-                  /*
2333
+				  /*
2334 2334
 		$flight_array = array();
2335 2335
 		$temp_array = array();
2336 2336
 		
@@ -2352,11 +2352,11 @@  discard block
 block discarded – undo
2352 2352
 	}
2353 2353
   
2354 2354
 	/**
2355
-	* Gets a list of all aircraft manufacturers
2356
-	*
2357
-	* @return Array list of aircraft types
2358
-	*
2359
-	*/
2355
+	 * Gets a list of all aircraft manufacturers
2356
+	 *
2357
+	 * @return Array list of aircraft types
2358
+	 *
2359
+	 */
2360 2360
 	public function getAllManufacturers()
2361 2361
 	{
2362 2362
 		/*
@@ -2385,11 +2385,11 @@  discard block
 block discarded – undo
2385 2385
   
2386 2386
   
2387 2387
   /**
2388
-	* Gets a list of all aircraft types
2389
-	*
2390
-	* @return Array list of aircraft types
2391
-	*
2392
-	*/
2388
+   * Gets a list of all aircraft types
2389
+   *
2390
+   * @return Array list of aircraft types
2391
+   *
2392
+   */
2393 2393
 	public function getAllAircraftTypes($filters = array())
2394 2394
 	{
2395 2395
 		/*
@@ -2422,11 +2422,11 @@  discard block
 block discarded – undo
2422 2422
 	
2423 2423
 	
2424 2424
 	/**
2425
-	* Gets a list of all aircraft registrations
2426
-	*
2427
-	* @return Array list of aircraft registrations
2428
-	*
2429
-	*/
2425
+	 * Gets a list of all aircraft registrations
2426
+	 *
2427
+	 * @return Array list of aircraft registrations
2428
+	 *
2429
+	 */
2430 2430
 	public function getAllAircraftRegistrations($filters = array())
2431 2431
 	{
2432 2432
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2451,12 +2451,12 @@  discard block
 block discarded – undo
2451 2451
 	}
2452 2452
 
2453 2453
 	/**
2454
-	* Gets all source name
2455
-	*
2456
-	* @param String type format of source
2457
-	* @return Array list of source name
2458
-	*
2459
-	*/
2454
+	 * Gets all source name
2455
+	 *
2456
+	 * @param String type format of source
2457
+	 * @return Array list of source name
2458
+	 *
2459
+	 */
2460 2460
 	public function getAllSourceName($type = '',$filters = array())
2461 2461
 	{
2462 2462
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2487,11 +2487,11 @@  discard block
 block discarded – undo
2487 2487
 
2488 2488
 
2489 2489
 	/**
2490
-	* Gets a list of all airline names
2491
-	*
2492
-	* @return Array list of airline names
2493
-	*
2494
-	*/
2490
+	 * Gets a list of all airline names
2491
+	 *
2492
+	 * @return Array list of airline names
2493
+	 *
2494
+	 */
2495 2495
 	public function getAllAirlineNames($airline_type = '',$forsource = NULL,$filters = array())
2496 2496
 	{
2497 2497
 		global $globalAirlinesSource,$globalVATSIM, $globalIVAO;
@@ -2541,11 +2541,11 @@  discard block
 block discarded – undo
2541 2541
 	
2542 2542
 	
2543 2543
 	/**
2544
-	* Gets a list of all airline countries
2545
-	*
2546
-	* @return Array list of airline countries
2547
-	*
2548
-	*/
2544
+	 * Gets a list of all airline countries
2545
+	 *
2546
+	 * @return Array list of airline countries
2547
+	 *
2548
+	 */
2549 2549
 	public function getAllAirlineCountries($filters = array())
2550 2550
 	{
2551 2551
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2573,11 +2573,11 @@  discard block
 block discarded – undo
2573 2573
 	
2574 2574
 	
2575 2575
 	/**
2576
-	* Gets a list of all departure & arrival names
2577
-	*
2578
-	* @return Array list of airport names
2579
-	*
2580
-	*/
2576
+	 * Gets a list of all departure & arrival names
2577
+	 *
2578
+	 * @return Array list of airport names
2579
+	 *
2580
+	 */
2581 2581
 	public function getAllAirportNames($filters = array())
2582 2582
 	{
2583 2583
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2626,11 +2626,11 @@  discard block
 block discarded – undo
2626 2626
 	
2627 2627
 	
2628 2628
 	/**
2629
-	* Gets a list of all departure & arrival airport countries
2630
-	*
2631
-	* @return Array list of airport countries
2632
-	*
2633
-	*/
2629
+	 * Gets a list of all departure & arrival airport countries
2630
+	 *
2631
+	 * @return Array list of airport countries
2632
+	 *
2633
+	 */
2634 2634
 	public function getAllAirportCountries($filters = array())
2635 2635
 	{
2636 2636
 		$airport_array = array();
@@ -2678,11 +2678,11 @@  discard block
 block discarded – undo
2678 2678
 	
2679 2679
 	
2680 2680
 	/**
2681
-	* Gets a list of all countries (airline, departure airport & arrival airport)
2682
-	*
2683
-	* @return Array list of countries
2684
-	*
2685
-	*/
2681
+	 * Gets a list of all countries (airline, departure airport & arrival airport)
2682
+	 *
2683
+	 * @return Array list of countries
2684
+	 *
2685
+	 */
2686 2686
 	public function getAllCountries($filters = array())
2687 2687
 	{
2688 2688
 		$Connection= new Connection($this->db);
@@ -2759,11 +2759,11 @@  discard block
 block discarded – undo
2759 2759
 	
2760 2760
 	
2761 2761
 	/**
2762
-	* Gets a list of all idents/callsigns
2763
-	*
2764
-	* @return Array list of ident/callsign names
2765
-	*
2766
-	*/
2762
+	 * Gets a list of all idents/callsigns
2763
+	 *
2764
+	 * @return Array list of ident/callsign names
2765
+	 *
2766
+	 */
2767 2767
 	public function getAllIdents($filters = array())
2768 2768
 	{
2769 2769
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2787,9 +2787,9 @@  discard block
 block discarded – undo
2787 2787
 	}
2788 2788
 
2789 2789
 	/**
2790
-	* Get a list of flights from airport since 7 days
2791
-	* @return Array number, icao, name and city of airports
2792
-	*/
2790
+	 * Get a list of flights from airport since 7 days
2791
+	 * @return Array number, icao, name and city of airports
2792
+	 */
2793 2793
 
2794 2794
 	public function getLast7DaysAirportsDeparture($airport_icao = '',$filters = array()) {
2795 2795
 		global $globalTimezone, $globalDBdriver;
@@ -2820,9 +2820,9 @@  discard block
 block discarded – undo
2820 2820
 	}
2821 2821
 
2822 2822
 	/**
2823
-	* Get a list of flights from airport since 7 days
2824
-	* @return Array number, icao, name and city of airports
2825
-	*/
2823
+	 * Get a list of flights from airport since 7 days
2824
+	 * @return Array number, icao, name and city of airports
2825
+	 */
2826 2826
 
2827 2827
 	public function getLast7DaysAirportsDepartureByAirlines($airport_icao = '') {
2828 2828
 		global $globalTimezone, $globalDBdriver;
@@ -2852,9 +2852,9 @@  discard block
 block discarded – undo
2852 2852
 	}
2853 2853
 
2854 2854
 	/**
2855
-	* Get a list of flights from detected airport since 7 days
2856
-	* @return Array number, icao, name and city of airports
2857
-	*/
2855
+	 * Get a list of flights from detected airport since 7 days
2856
+	 * @return Array number, icao, name and city of airports
2857
+	 */
2858 2858
 
2859 2859
 	public function getLast7DaysDetectedAirportsDeparture($airport_icao = '', $filters = array()) {
2860 2860
 		global $globalTimezone, $globalDBdriver;
@@ -2892,9 +2892,9 @@  discard block
 block discarded – undo
2892 2892
 	}
2893 2893
 
2894 2894
 	/**
2895
-	* Get a list of flights from detected airport since 7 days
2896
-	* @return Array number, icao, name and city of airports
2897
-	*/
2895
+	 * Get a list of flights from detected airport since 7 days
2896
+	 * @return Array number, icao, name and city of airports
2897
+	 */
2898 2898
 
2899 2899
 	public function getLast7DaysDetectedAirportsDepartureByAirlines($airport_icao = '') {
2900 2900
 		global $globalTimezone, $globalDBdriver;
@@ -2936,9 +2936,9 @@  discard block
 block discarded – undo
2936 2936
 
2937 2937
 
2938 2938
 	/**
2939
-	* Get a list of flights to airport since 7 days
2940
-	* @return Array number, icao, name and city of airports
2941
-	*/
2939
+	 * Get a list of flights to airport since 7 days
2940
+	 * @return Array number, icao, name and city of airports
2941
+	 */
2942 2942
 
2943 2943
 	public function getLast7DaysAirportsArrival($airport_icao = '', $filters = array()) {
2944 2944
 		global $globalTimezone, $globalDBdriver;
@@ -2971,9 +2971,9 @@  discard block
 block discarded – undo
2971 2971
 
2972 2972
 
2973 2973
 	/**
2974
-	* Get a list of flights detected to airport since 7 days
2975
-	* @return Array number, icao, name and city of airports
2976
-	*/
2974
+	 * Get a list of flights detected to airport since 7 days
2975
+	 * @return Array number, icao, name and city of airports
2976
+	 */
2977 2977
 
2978 2978
 	public function getLast7DaysDetectedAirportsArrival($airport_icao = '',$filters = array()) {
2979 2979
 		global $globalTimezone, $globalDBdriver;
@@ -3014,9 +3014,9 @@  discard block
 block discarded – undo
3014 3014
 
3015 3015
 
3016 3016
 	/**
3017
-	* Get a list of flights to airport since 7 days
3018
-	* @return Array number, icao, name and city of airports
3019
-	*/
3017
+	 * Get a list of flights to airport since 7 days
3018
+	 * @return Array number, icao, name and city of airports
3019
+	 */
3020 3020
 
3021 3021
 	public function getLast7DaysAirportsArrivalByAirlines($airport_icao = '') {
3022 3022
 		global $globalTimezone, $globalDBdriver;
@@ -3048,9 +3048,9 @@  discard block
 block discarded – undo
3048 3048
 
3049 3049
 
3050 3050
 	/**
3051
-	* Get a list of flights detected to airport since 7 days
3052
-	* @return Array number, icao, name and city of airports
3053
-	*/
3051
+	 * Get a list of flights detected to airport since 7 days
3052
+	 * @return Array number, icao, name and city of airports
3053
+	 */
3054 3054
 
3055 3055
 	public function getLast7DaysDetectedAirportsArrivalByAirlines($airport_icao = '') {
3056 3056
 		global $globalTimezone, $globalDBdriver;
@@ -3094,11 +3094,11 @@  discard block
 block discarded – undo
3094 3094
 
3095 3095
 
3096 3096
 	/**
3097
-	* Gets a list of all dates
3098
-	*
3099
-	* @return Array list of date names
3100
-	*
3101
-	*/
3097
+	 * Gets a list of all dates
3098
+	 *
3099
+	 * @return Array list of date names
3100
+	 *
3101
+	 */
3102 3102
 	public function getAllDates()
3103 3103
 	{
3104 3104
 		global $globalTimezone, $globalDBdriver;
@@ -3139,11 +3139,11 @@  discard block
 block discarded – undo
3139 3139
 	
3140 3140
 	
3141 3141
 	/**
3142
-	* Gets all route combinations
3143
-	*
3144
-	* @return Array the route list
3145
-	*
3146
-	*/
3142
+	 * Gets all route combinations
3143
+	 *
3144
+	 * @return Array the route list
3145
+	 *
3146
+	 */
3147 3147
 	public function getAllRoutes()
3148 3148
 	{
3149 3149
 		$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 
@@ -3169,13 +3169,13 @@  discard block
 block discarded – undo
3169 3169
 	}
3170 3170
 
3171 3171
 	/**
3172
-	* Update ident spotter data
3173
-	*
3174
-	* @param String $flightaware_id the ID from flightaware
3175
-	* @param String $ident the flight ident
3176
-	* @return String success or false
3177
-	*
3178
-	*/	
3172
+	 * Update ident spotter data
3173
+	 *
3174
+	 * @param String $flightaware_id the ID from flightaware
3175
+	 * @param String $ident the flight ident
3176
+	 * @return String success or false
3177
+	 *
3178
+	 */	
3179 3179
 	public function updateIdentSpotterData($flightaware_id = '', $ident = '',$fromsource = NULL)
3180 3180
 	{
3181 3181
 		if (!is_numeric(substr($ident, 0, 3)))
@@ -3196,14 +3196,14 @@  discard block
 block discarded – undo
3196 3196
 		} else {
3197 3197
 			$airline_array = $this->getAllAirlineInfo("NA");
3198 3198
 		}
3199
-                $airline_name = $airline_array[0]['name'];
3200
-                $airline_icao = $airline_array[0]['icao'];
3201
-                $airline_country = $airline_array[0]['country'];
3202
-                $airline_type = $airline_array[0]['type'];
3199
+				$airline_name = $airline_array[0]['name'];
3200
+				$airline_icao = $airline_array[0]['icao'];
3201
+				$airline_country = $airline_array[0]['country'];
3202
+				$airline_type = $airline_array[0]['type'];
3203 3203
 
3204 3204
 
3205 3205
 		$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';
3206
-                $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);
3206
+				$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);
3207 3207
 
3208 3208
 		try {
3209 3209
 			$sth = $this->db->prepare($query);
@@ -3216,19 +3216,19 @@  discard block
 block discarded – undo
3216 3216
 
3217 3217
 	}
3218 3218
 	/**
3219
-	* Update latest spotter data
3220
-	*
3221
-	* @param String $flightaware_id the ID from flightaware
3222
-	* @param String $ident the flight ident
3223
-	* @param String $arrival_airport_icao the arrival airport
3224
-	* @return String success or false
3225
-	*
3226
-	*/	
3219
+	 * Update latest spotter data
3220
+	 *
3221
+	 * @param String $flightaware_id the ID from flightaware
3222
+	 * @param String $ident the flight ident
3223
+	 * @param String $arrival_airport_icao the arrival airport
3224
+	 * @return String success or false
3225
+	 *
3226
+	 */	
3227 3227
 	public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '',$arrival_airport_time = '')
3228 3228
 	{
3229 3229
 		if ($groundspeed == '') $groundspeed = NULL;
3230 3230
 		$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';
3231
-                $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);
3231
+				$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);
3232 3232
 
3233 3233
 		try {
3234 3234
 			$sth = $this->db->prepare($query);
@@ -3242,32 +3242,32 @@  discard block
 block discarded – undo
3242 3242
 	}
3243 3243
 
3244 3244
 	/**
3245
-	* Adds a new spotter data
3246
-	*
3247
-	* @param String $flightaware_id the ID from flightaware
3248
-	* @param String $ident the flight ident
3249
-	* @param String $aircraft_icao the aircraft type
3250
-	* @param String $departure_airport_icao the departure airport
3251
-	* @param String $arrival_airport_icao the arrival airport
3252
-	* @param String $latitude latitude of flight
3253
-	* @param String $longitude latitude of flight
3254
-	* @param String $waypoints waypoints of flight
3255
-	* @param String $altitude altitude of flight
3256
-	* @param String $heading heading of flight
3257
-	* @param String $groundspeed speed of flight
3258
-	* @param String $date date of flight
3259
-	* @param String $departure_airport_time departure time of flight
3260
-	* @param String $arrival_airport_time arrival time of flight
3261
-	* @param String $squawk squawk code of flight
3262
-	* @param String $route_stop route stop of flight
3263
-	* @param String $highlight highlight or not
3264
-	* @param String $ModeS ModesS code of flight
3265
-	* @param String $registration registration code of flight
3266
-	* @param String $pilot_id pilot id of flight (for virtual airlines)
3267
-	* @param String $pilot_name pilot name of flight (for virtual airlines)
3268
-	* @param String $verticalrate vertival rate of flight
3269
-	* @return String success or false
3270
-	*/
3245
+	 * Adds a new spotter data
3246
+	 *
3247
+	 * @param String $flightaware_id the ID from flightaware
3248
+	 * @param String $ident the flight ident
3249
+	 * @param String $aircraft_icao the aircraft type
3250
+	 * @param String $departure_airport_icao the departure airport
3251
+	 * @param String $arrival_airport_icao the arrival airport
3252
+	 * @param String $latitude latitude of flight
3253
+	 * @param String $longitude latitude of flight
3254
+	 * @param String $waypoints waypoints of flight
3255
+	 * @param String $altitude altitude of flight
3256
+	 * @param String $heading heading of flight
3257
+	 * @param String $groundspeed speed of flight
3258
+	 * @param String $date date of flight
3259
+	 * @param String $departure_airport_time departure time of flight
3260
+	 * @param String $arrival_airport_time arrival time of flight
3261
+	 * @param String $squawk squawk code of flight
3262
+	 * @param String $route_stop route stop of flight
3263
+	 * @param String $highlight highlight or not
3264
+	 * @param String $ModeS ModesS code of flight
3265
+	 * @param String $registration registration code of flight
3266
+	 * @param String $pilot_id pilot id of flight (for virtual airlines)
3267
+	 * @param String $pilot_name pilot name of flight (for virtual airlines)
3268
+	 * @param String $verticalrate vertival rate of flight
3269
+	 * @return String success or false
3270
+	 */
3271 3271
 	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 = '')
3272 3272
 	{
3273 3273
 		global $globalURL, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalDebugTimeElapsed, $globalAirlinesSource, $globalVAM;
@@ -3481,8 +3481,8 @@  discard block
 block discarded – undo
3481 3481
     
3482 3482
 		if ($globalIVAO && $aircraft_icao != '')
3483 3483
 		{
3484
-            		if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao'];
3485
-            		else $airline_icao = '';
3484
+					if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao'];
3485
+					else $airline_icao = '';
3486 3486
 			$image_array = $Image->getSpotterImage('',$aircraft_icao,$airline_icao);
3487 3487
 			if (!isset($image_array[0]['registration']))
3488 3488
 			{
@@ -3513,52 +3513,52 @@  discard block
 block discarded – undo
3513 3513
 	
3514 3514
 		if (count($airline_array) == 0) 
3515 3515
 		{
3516
-                        $airline_array = $this->getAllAirlineInfo('NA');
3517
-                }
3518
-                if (count($aircraft_array) == 0) 
3519
-                {
3520
-                        $aircraft_array = $this->getAllAircraftInfo('NA');
3521
-                }
3522
-                if (count($departure_airport_array) == 0) 
3523
-                {
3524
-                        $departure_airport_array = $this->getAllAirportInfo('NA');
3525
-                }
3526
-                if (count($arrival_airport_array) == 0) 
3527
-                {
3528
-                        $arrival_airport_array = $this->getAllAirportInfo('NA');
3529
-                }
3530
-                if ($registration == '') $registration = 'NA';
3531
-                if ($latitude == '' && $longitude == '') {
3532
-            		$latitude = 0;
3533
-            		$longitude = 0;
3534
-            	}
3535
-                if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL;
3536
-                if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL;
3537
-                if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
3538
-                if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
3539
-                if (!isset($aircraft_owner)) $aircraft_owner = NULL;
3540
-                $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) 
3516
+						$airline_array = $this->getAllAirlineInfo('NA');
3517
+				}
3518
+				if (count($aircraft_array) == 0) 
3519
+				{
3520
+						$aircraft_array = $this->getAllAircraftInfo('NA');
3521
+				}
3522
+				if (count($departure_airport_array) == 0) 
3523
+				{
3524
+						$departure_airport_array = $this->getAllAirportInfo('NA');
3525
+				}
3526
+				if (count($arrival_airport_array) == 0) 
3527
+				{
3528
+						$arrival_airport_array = $this->getAllAirportInfo('NA');
3529
+				}
3530
+				if ($registration == '') $registration = 'NA';
3531
+				if ($latitude == '' && $longitude == '') {
3532
+					$latitude = 0;
3533
+					$longitude = 0;
3534
+				}
3535
+				if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL;
3536
+				if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL;
3537
+				if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
3538
+				if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
3539
+				if (!isset($aircraft_owner)) $aircraft_owner = NULL;
3540
+				$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) 
3541 3541
                 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)";
3542 3542
 
3543
-                $airline_name = $airline_array[0]['name'];
3544
-                $airline_icao = $airline_array[0]['icao'];
3545
-                $airline_country = $airline_array[0]['country'];
3546
-                $airline_type = $airline_array[0]['type'];
3543
+				$airline_name = $airline_array[0]['name'];
3544
+				$airline_icao = $airline_array[0]['icao'];
3545
+				$airline_country = $airline_array[0]['country'];
3546
+				$airline_type = $airline_array[0]['type'];
3547 3547
 		if ($airline_type == '') {
3548 3548
 			$timeelapsed = microtime(true);
3549 3549
 			$airline_type = $this->getAircraftTypeBymodeS($ModeS);
3550 3550
 			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3551 3551
 		}
3552 3552
 		if ($airline_type == null) $airline_type = '';
3553
-                $aircraft_type = $aircraft_array[0]['type'];
3554
-                $aircraft_manufacturer = $aircraft_array[0]['manufacturer'];
3555
-                $departure_airport_name = $departure_airport_array[0]['name'];
3556
-                $departure_airport_city = $departure_airport_array[0]['city'];
3557
-                $departure_airport_country = $departure_airport_array[0]['country'];
3558
-                $arrival_airport_name = $arrival_airport_array[0]['name'];
3559
-                $arrival_airport_city = $arrival_airport_array[0]['city'];
3560
-                $arrival_airport_country = $arrival_airport_array[0]['country'];
3561
-                $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);
3553
+				$aircraft_type = $aircraft_array[0]['type'];
3554
+				$aircraft_manufacturer = $aircraft_array[0]['manufacturer'];
3555
+				$departure_airport_name = $departure_airport_array[0]['name'];
3556
+				$departure_airport_city = $departure_airport_array[0]['city'];
3557
+				$departure_airport_country = $departure_airport_array[0]['country'];
3558
+				$arrival_airport_name = $arrival_airport_array[0]['name'];
3559
+				$arrival_airport_city = $arrival_airport_array[0]['city'];
3560
+				$arrival_airport_country = $arrival_airport_array[0]['country'];
3561
+				$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);
3562 3562
 
3563 3563
 		try {
3564 3564
 		        
@@ -3566,7 +3566,7 @@  discard block
 block discarded – undo
3566 3566
 			$sth->execute($query_values);
3567 3567
 			$this->db = null;
3568 3568
 		} catch (PDOException $e) {
3569
-		    return "error : ".$e->getMessage();
3569
+			return "error : ".$e->getMessage();
3570 3570
 		}
3571 3571
 		
3572 3572
 		return "success";
@@ -3575,11 +3575,11 @@  discard block
 block discarded – undo
3575 3575
 	
3576 3576
   
3577 3577
 	/**
3578
-	* Gets the aircraft ident within the last hour
3579
-	*
3580
-	* @return String the ident
3581
-	*
3582
-	*/
3578
+	 * Gets the aircraft ident within the last hour
3579
+	 *
3580
+	 * @return String the ident
3581
+	 *
3582
+	 */
3583 3583
 	public function getIdentFromLastHour($ident)
3584 3584
 	{
3585 3585
 		global $globalDBdriver, $globalTimezone;
@@ -3595,11 +3595,11 @@  discard block
 block discarded – undo
3595 3595
 								AND spotter_output.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS'
3596 3596
 								AND spotter_output.date < now() AT TIME ZONE 'UTC'";
3597 3597
 			$query_data = array(':ident' => $ident);
3598
-    		}
3598
+			}
3599 3599
 		
3600 3600
 		$sth = $this->db->prepare($query);
3601 3601
 		$sth->execute($query_data);
3602
-    		$ident_result='';
3602
+			$ident_result='';
3603 3603
 		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3604 3604
 		{
3605 3605
 			$ident_result = $row['ident'];
@@ -3610,11 +3610,11 @@  discard block
 block discarded – undo
3610 3610
 	
3611 3611
 	
3612 3612
 	/**
3613
-	* Gets the aircraft data from the last 20 seconds
3614
-	*
3615
-	* @return Array the spotter data
3616
-	*
3617
-	*/
3613
+	 * Gets the aircraft data from the last 20 seconds
3614
+	 *
3615
+	 * @return Array the spotter data
3616
+	 *
3617
+	 */
3618 3618
 	public function getRealTimeData($q = '')
3619 3619
 	{
3620 3620
 		global $globalDBdriver;
@@ -3658,11 +3658,11 @@  discard block
 block discarded – undo
3658 3658
 	
3659 3659
 	
3660 3660
 	 /**
3661
-	* Gets all airlines that have flown over
3662
-	*
3663
-	* @return Array the airline list
3664
-	*
3665
-	*/
3661
+	  * Gets all airlines that have flown over
3662
+	  *
3663
+	  * @return Array the airline list
3664
+	  *
3665
+	  */
3666 3666
 	public function countAllAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
3667 3667
 	{
3668 3668
 		global $globalDBdriver;
@@ -3676,7 +3676,7 @@  discard block
 block discarded – undo
3676 3676
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
3677 3677
 			}
3678 3678
 		}
3679
-                if ($sincedate != '') {
3679
+				if ($sincedate != '') {
3680 3680
 			if ($globalDBdriver == 'mysql') {
3681 3681
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
3682 3682
 			} else {
@@ -3703,26 +3703,26 @@  discard block
 block discarded – undo
3703 3703
 	}
3704 3704
 
3705 3705
 	 /**
3706
-	* Gets all pilots that have flown over
3707
-	*
3708
-	* @return Array the pilots list
3709
-	*
3710
-	*/
3706
+	  * Gets all pilots that have flown over
3707
+	  *
3708
+	  * @return Array the pilots list
3709
+	  *
3710
+	  */
3711 3711
 	public function countAllPilots($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
3712 3712
 	{
3713 3713
 		global $globalDBdriver;
3714 3714
 		$filter_query = $this->getFilter($filters,true,true);
3715 3715
 		$query  = "SELECT DISTINCT spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count, spotter_output.format_source
3716 3716
 		 			FROM spotter_output".$filter_query." spotter_output.pilot_id <> '' ";
3717
-                if ($olderthanmonths > 0) {
3718
-            		if ($globalDBdriver == 'mysql') {
3717
+				if ($olderthanmonths > 0) {
3718
+					if ($globalDBdriver == 'mysql') {
3719 3719
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
3720 3720
 			} else {
3721 3721
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
3722 3722
 			}
3723 3723
 		}
3724
-                if ($sincedate != '') {
3725
-            		if ($globalDBdriver == 'mysql') {
3724
+				if ($sincedate != '') {
3725
+					if ($globalDBdriver == 'mysql') {
3726 3726
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
3727 3727
 			} else {
3728 3728
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -3750,25 +3750,25 @@  discard block
 block discarded – undo
3750 3750
 	}
3751 3751
 	
3752 3752
 		 /**
3753
-	* Gets all pilots that have flown over
3754
-	*
3755
-	* @return Array the pilots list
3756
-	*
3757
-	*/
3753
+		  * Gets all pilots that have flown over
3754
+		  *
3755
+		  * @return Array the pilots list
3756
+		  *
3757
+		  */
3758 3758
 	public function countAllPilotsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '')
3759 3759
 	{
3760 3760
 		global $globalDBdriver;
3761 3761
 		$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
3762 3762
 		 			FROM spotter_output WHERE spotter_output.pilot_id <> '' ";
3763
-                if ($olderthanmonths > 0) {
3764
-            		if ($globalDBdriver == 'mysql') {
3763
+				if ($olderthanmonths > 0) {
3764
+					if ($globalDBdriver == 'mysql') {
3765 3765
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
3766 3766
 			} else {
3767 3767
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
3768 3768
 			}
3769 3769
 		}
3770
-                if ($sincedate != '') {
3771
-            		if ($globalDBdriver == 'mysql') {
3770
+				if ($sincedate != '') {
3771
+					if ($globalDBdriver == 'mysql') {
3772 3772
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
3773 3773
 			} else {
3774 3774
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -3797,26 +3797,26 @@  discard block
 block discarded – undo
3797 3797
 	}
3798 3798
 	
3799 3799
 	 /**
3800
-	* Gets all owner that have flown over
3801
-	*
3802
-	* @return Array the pilots list
3803
-	*
3804
-	*/
3800
+	  * Gets all owner that have flown over
3801
+	  *
3802
+	  * @return Array the pilots list
3803
+	  *
3804
+	  */
3805 3805
 	public function countAllOwners($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
3806 3806
 	{
3807 3807
 		global $globalDBdriver;
3808 3808
 		$filter_query = $this->getFilter($filters,true,true);
3809 3809
 		$query  = "SELECT DISTINCT spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
3810 3810
 		 			FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL ";
3811
-                if ($olderthanmonths > 0) {
3812
-            		if ($globalDBdriver == 'mysql') {
3811
+				if ($olderthanmonths > 0) {
3812
+					if ($globalDBdriver == 'mysql') {
3813 3813
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
3814 3814
 			} else {
3815 3815
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
3816 3816
 			}
3817 3817
 		}
3818
-                if ($sincedate != '') {
3819
-            		if ($globalDBdriver == 'mysql') {
3818
+				if ($sincedate != '') {
3819
+					if ($globalDBdriver == 'mysql') {
3820 3820
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
3821 3821
 			} else {
3822 3822
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -3842,26 +3842,26 @@  discard block
 block discarded – undo
3842 3842
 	}
3843 3843
 	
3844 3844
 	 /**
3845
-	* Gets all owner that have flown over
3846
-	*
3847
-	* @return Array the pilots list
3848
-	*
3849
-	*/
3845
+	  * Gets all owner that have flown over
3846
+	  *
3847
+	  * @return Array the pilots list
3848
+	  *
3849
+	  */
3850 3850
 	public function countAllOwnersByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
3851 3851
 	{
3852 3852
 		global $globalDBdriver;
3853 3853
 		$filter_query = $this->getFilter($filters,true,true);
3854 3854
 		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
3855 3855
 		 			FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL ";
3856
-                if ($olderthanmonths > 0) {
3857
-            		if ($globalDBdriver == 'mysql') {
3856
+				if ($olderthanmonths > 0) {
3857
+					if ($globalDBdriver == 'mysql') {
3858 3858
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
3859 3859
 			} else {
3860 3860
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
3861 3861
 			}
3862 3862
 		}
3863
-                if ($sincedate != '') {
3864
-            		if ($globalDBdriver == 'mysql') {
3863
+				if ($sincedate != '') {
3864
+					if ($globalDBdriver == 'mysql') {
3865 3865
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
3866 3866
 			} else {
3867 3867
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -3888,11 +3888,11 @@  discard block
 block discarded – undo
3888 3888
 	}
3889 3889
 
3890 3890
 	/**
3891
-	* Gets all airlines that have flown over by aircraft
3892
-	*
3893
-	* @return Array the airline list
3894
-	*
3895
-	*/
3891
+	 * Gets all airlines that have flown over by aircraft
3892
+	 *
3893
+	 * @return Array the airline list
3894
+	 *
3895
+	 */
3896 3896
 	public function countAllAirlinesByAircraft($aircraft_icao,$filters = array())
3897 3897
 	{
3898 3898
 		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
@@ -3924,11 +3924,11 @@  discard block
 block discarded – undo
3924 3924
 
3925 3925
 
3926 3926
 	/**
3927
-	* Gets all airline countries that have flown over by aircraft
3928
-	*
3929
-	* @return Array the airline country list
3930
-	*
3931
-	*/
3927
+	 * Gets all airline countries that have flown over by aircraft
3928
+	 *
3929
+	 * @return Array the airline country list
3930
+	 *
3931
+	 */
3932 3932
 	public function countAllAirlineCountriesByAircraft($aircraft_icao,$filters = array())
3933 3933
 	{
3934 3934
 		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
@@ -3960,11 +3960,11 @@  discard block
 block discarded – undo
3960 3960
 	
3961 3961
 	
3962 3962
 	/**
3963
-	* Gets all airlines that have flown over by airport
3964
-	*
3965
-	* @return Array the airline list
3966
-	*
3967
-	*/
3963
+	 * Gets all airlines that have flown over by airport
3964
+	 *
3965
+	 * @return Array the airline list
3966
+	 *
3967
+	 */
3968 3968
 	public function countAllAirlinesByAirport($airport_icao,$filters = array())
3969 3969
 	{
3970 3970
 		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
@@ -3995,11 +3995,11 @@  discard block
 block discarded – undo
3995 3995
 
3996 3996
 
3997 3997
 	/**
3998
-	* Gets all airline countries that have flown over by airport icao
3999
-	*
4000
-	* @return Array the airline country list
4001
-	*
4002
-	*/
3998
+	 * Gets all airline countries that have flown over by airport icao
3999
+	 *
4000
+	 * @return Array the airline country list
4001
+	 *
4002
+	 */
4003 4003
 	public function countAllAirlineCountriesByAirport($airport_icao,$filters = array())
4004 4004
 	{
4005 4005
 		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
@@ -4029,11 +4029,11 @@  discard block
 block discarded – undo
4029 4029
 
4030 4030
 
4031 4031
 	/**
4032
-	* Gets all airlines that have flown over by aircraft manufacturer
4033
-	*
4034
-	* @return Array the airline list
4035
-	*
4036
-	*/
4032
+	 * Gets all airlines that have flown over by aircraft manufacturer
4033
+	 *
4034
+	 * @return Array the airline list
4035
+	 *
4036
+	 */
4037 4037
 	public function countAllAirlinesByManufacturer($aircraft_manufacturer,$filters = array())
4038 4038
 	{
4039 4039
 		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
@@ -4064,11 +4064,11 @@  discard block
 block discarded – undo
4064 4064
 
4065 4065
 
4066 4066
 	/**
4067
-	* Gets all airline countries that have flown over by aircraft manufacturer
4068
-	*
4069
-	* @return Array the airline country list
4070
-	*
4071
-	*/
4067
+	 * Gets all airline countries that have flown over by aircraft manufacturer
4068
+	 *
4069
+	 * @return Array the airline country list
4070
+	 *
4071
+	 */
4072 4072
 	public function countAllAirlineCountriesByManufacturer($aircraft_manufacturer,$filters = array())
4073 4073
 	{
4074 4074
 		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
@@ -4097,11 +4097,11 @@  discard block
 block discarded – undo
4097 4097
 
4098 4098
 
4099 4099
 	/**
4100
-	* Gets all airlines that have flown over by date
4101
-	*
4102
-	* @return Array the airline list
4103
-	*
4104
-	*/
4100
+	 * Gets all airlines that have flown over by date
4101
+	 *
4102
+	 * @return Array the airline list
4103
+	 *
4104
+	 */
4105 4105
 	public function countAllAirlinesByDate($date,$filters = array())
4106 4106
 	{
4107 4107
 		global $globalTimezone, $globalDBdriver;
@@ -4145,11 +4145,11 @@  discard block
 block discarded – undo
4145 4145
 	
4146 4146
 	
4147 4147
 	/**
4148
-	* Gets all airline countries that have flown over by date
4149
-	*
4150
-	* @return Array the airline country list
4151
-	*
4152
-	*/
4148
+	 * Gets all airline countries that have flown over by date
4149
+	 *
4150
+	 * @return Array the airline country list
4151
+	 *
4152
+	 */
4153 4153
 	public function countAllAirlineCountriesByDate($date,$filters = array())
4154 4154
 	{
4155 4155
 		global $globalTimezone, $globalDBdriver;
@@ -4192,11 +4192,11 @@  discard block
 block discarded – undo
4192 4192
 
4193 4193
 
4194 4194
 	/**
4195
-	* Gets all airlines that have flown over by ident/callsign
4196
-	*
4197
-	* @return Array the airline list
4198
-	*
4199
-	*/
4195
+	 * Gets all airlines that have flown over by ident/callsign
4196
+	 *
4197
+	 * @return Array the airline list
4198
+	 *
4199
+	 */
4200 4200
 	public function countAllAirlinesByIdent($ident,$filters = array())
4201 4201
 	{
4202 4202
 		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
@@ -4226,11 +4226,11 @@  discard block
 block discarded – undo
4226 4226
 	}
4227 4227
 
4228 4228
 	/**
4229
-	* Gets all airlines that have flown over by route
4230
-	*
4231
-	* @return Array the airline list
4232
-	*
4233
-	*/
4229
+	 * Gets all airlines that have flown over by route
4230
+	 *
4231
+	 * @return Array the airline list
4232
+	 *
4233
+	 */
4234 4234
 	public function countAllAirlinesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
4235 4235
 	{
4236 4236
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4262,11 +4262,11 @@  discard block
 block discarded – undo
4262 4262
 	}
4263 4263
 
4264 4264
 	/**
4265
-	* Gets all airline countries that have flown over by route
4266
-	*
4267
-	* @return Array the airline country list
4268
-	*
4269
-	*/
4265
+	 * Gets all airline countries that have flown over by route
4266
+	 *
4267
+	 * @return Array the airline country list
4268
+	 *
4269
+	 */
4270 4270
 	public function countAllAirlineCountriesByRoute($departure_airport_icao, $arrival_airport_icao,$filters= array())
4271 4271
 	{
4272 4272
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4298,11 +4298,11 @@  discard block
 block discarded – undo
4298 4298
 
4299 4299
 
4300 4300
 	/**
4301
-	* Gets all airlines that have flown over by country
4302
-	*
4303
-	* @return Array the airline list
4304
-	*
4305
-	*/
4301
+	 * Gets all airlines that have flown over by country
4302
+	 *
4303
+	 * @return Array the airline list
4304
+	 *
4305
+	 */
4306 4306
 	public function countAllAirlinesByCountry($country,$filters = array())
4307 4307
 	{
4308 4308
 		$country = filter_var($country,FILTER_SANITIZE_STRING);
@@ -4332,11 +4332,11 @@  discard block
 block discarded – undo
4332 4332
 
4333 4333
 
4334 4334
 	/**
4335
-	* Gets all airline countries that have flown over by country
4336
-	*
4337
-	* @return Array the airline country list
4338
-	*
4339
-	*/
4335
+	 * Gets all airline countries that have flown over by country
4336
+	 *
4337
+	 * @return Array the airline country list
4338
+	 *
4339
+	 */
4340 4340
 	public function countAllAirlineCountriesByCountry($country,$filters = array())
4341 4341
 	{
4342 4342
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4365,11 +4365,11 @@  discard block
 block discarded – undo
4365 4365
 
4366 4366
 
4367 4367
 	/**
4368
-	* Gets all airlines countries
4369
-	*
4370
-	* @return Array the airline country list
4371
-	*
4372
-	*/
4368
+	 * Gets all airlines countries
4369
+	 *
4370
+	 * @return Array the airline country list
4371
+	 *
4372
+	 */
4373 4373
 	public function countAllAirlineCountries($limit = true, $filters = array())
4374 4374
 	{
4375 4375
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4395,11 +4395,11 @@  discard block
 block discarded – undo
4395 4395
 	}
4396 4396
 
4397 4397
 	/**
4398
-	* Gets all number of flight over countries
4399
-	*
4400
-	* @return Array the airline country list
4401
-	*
4402
-	*/
4398
+	 * Gets all number of flight over countries
4399
+	 *
4400
+	 * @return Array the airline country list
4401
+	 *
4402
+	 */
4403 4403
 	public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
4404 4404
 	{
4405 4405
 		global $globalDBdriver;
@@ -4421,15 +4421,15 @@  discard block
 block discarded – undo
4421 4421
 		$SpotterLive = new SpotterLive();
4422 4422
 		$filter_query = $SpotterLive->getFilter($filters,true,true);
4423 4423
 		$filter_query .= ' over_country IS NOT NULL';
4424
-                if ($olderthanmonths > 0) {
4424
+				if ($olderthanmonths > 0) {
4425 4425
 			if ($globalDBdriver == 'mysql') {
4426 4426
 				$filter_query .= ' AND spotter_live.date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
4427 4427
 			} else {
4428 4428
 				$filter_query .= " AND spotter_live.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
4429 4429
 			}
4430 4430
 		}
4431
-                if ($sincedate != '') {
4432
-            		if ($globalDBdriver == 'mysql') {
4431
+				if ($sincedate != '') {
4432
+					if ($globalDBdriver == 'mysql') {
4433 4433
 				$filter_query .= " AND spotter_live.date > '".$sincedate."' ";
4434 4434
 			} else {
4435 4435
 				$filter_query .= " AND spotter_live.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -4459,11 +4459,11 @@  discard block
 block discarded – undo
4459 4459
 	
4460 4460
 	
4461 4461
 	/**
4462
-	* Gets all aircraft types that have flown over
4463
-	*
4464
-	* @return Array the aircraft list
4465
-	*
4466
-	*/
4462
+	 * Gets all aircraft types that have flown over
4463
+	 *
4464
+	 * @return Array the aircraft list
4465
+	 *
4466
+	 */
4467 4467
 	public function countAllAircraftTypes($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
4468 4468
 	{
4469 4469
 		global $globalDBdriver;
@@ -4506,11 +4506,11 @@  discard block
 block discarded – undo
4506 4506
 	}
4507 4507
 
4508 4508
 	/**
4509
-	* Gets all aircraft types that have flown over by airline
4510
-	*
4511
-	* @return Array the aircraft list
4512
-	*
4513
-	*/
4509
+	 * Gets all aircraft types that have flown over by airline
4510
+	 *
4511
+	 * @return Array the aircraft list
4512
+	 *
4513
+	 */
4514 4514
 	public function countAllAircraftTypesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
4515 4515
 	{
4516 4516
 		global $globalDBdriver;
@@ -4553,11 +4553,11 @@  discard block
 block discarded – undo
4553 4553
 	}
4554 4554
 
4555 4555
 	/**
4556
-	* Gets all aircraft types that have flown over by months
4557
-	*
4558
-	* @return Array the aircraft list
4559
-	*
4560
-	*/
4556
+	 * Gets all aircraft types that have flown over by months
4557
+	 *
4558
+	 * @return Array the aircraft list
4559
+	 *
4560
+	 */
4561 4561
 	public function countAllAircraftTypesByMonths($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
4562 4562
 	{
4563 4563
 		global $globalDBdriver;
@@ -4601,11 +4601,11 @@  discard block
 block discarded – undo
4601 4601
 
4602 4602
 
4603 4603
 	/**
4604
-	* Gets all aircraft registration that have flown over by aircaft icao
4605
-	*
4606
-	* @return Array the aircraft list
4607
-	*
4608
-	*/
4604
+	 * Gets all aircraft registration that have flown over by aircaft icao
4605
+	 *
4606
+	 * @return Array the aircraft list
4607
+	 *
4608
+	 */
4609 4609
 	public function countAllAircraftRegistrationByAircraft($aircraft_icao,$filters = array())
4610 4610
 	{
4611 4611
 		$Image = new Image($this->db);
@@ -4644,11 +4644,11 @@  discard block
 block discarded – undo
4644 4644
 
4645 4645
 
4646 4646
 	/**
4647
-	* Gets all aircraft types that have flown over by airline icao
4648
-	*
4649
-	* @return Array the aircraft list
4650
-	*
4651
-	*/
4647
+	 * Gets all aircraft types that have flown over by airline icao
4648
+	 *
4649
+	 * @return Array the aircraft list
4650
+	 *
4651
+	 */
4652 4652
 	public function countAllAircraftTypesByAirline($airline_icao,$filters = array())
4653 4653
 	{
4654 4654
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4677,11 +4677,11 @@  discard block
 block discarded – undo
4677 4677
 
4678 4678
 
4679 4679
 	/**
4680
-	* Gets all aircraft registration that have flown over by airline icao
4681
-	*
4682
-	* @return Array the aircraft list
4683
-	*
4684
-	*/
4680
+	 * Gets all aircraft registration that have flown over by airline icao
4681
+	 *
4682
+	 * @return Array the aircraft list
4683
+	 *
4684
+	 */
4685 4685
 	public function countAllAircraftRegistrationByAirline($airline_icao,$filters = array())
4686 4686
 	{
4687 4687
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4719,11 +4719,11 @@  discard block
 block discarded – undo
4719 4719
 
4720 4720
 
4721 4721
 	/**
4722
-	* Gets all aircraft manufacturer that have flown over by airline icao
4723
-	*
4724
-	* @return Array the aircraft list
4725
-	*
4726
-	*/
4722
+	 * Gets all aircraft manufacturer that have flown over by airline icao
4723
+	 *
4724
+	 * @return Array the aircraft list
4725
+	 *
4726
+	 */
4727 4727
 	public function countAllAircraftManufacturerByAirline($airline_icao,$filters = array())
4728 4728
 	{
4729 4729
 		$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 types that have flown over by airline icao
4755
-	*
4756
-	* @return Array the aircraft list
4757
-	*
4758
-	*/
4754
+	 * Gets all aircraft types that have flown over by airline icao
4755
+	 *
4756
+	 * @return Array the aircraft list
4757
+	 *
4758
+	 */
4759 4759
 	public function countAllAircraftTypesByAirport($airport_icao,$filters = array())
4760 4760
 	{
4761 4761
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4784,11 +4784,11 @@  discard block
 block discarded – undo
4784 4784
 
4785 4785
 
4786 4786
 	/**
4787
-	* Gets all aircraft registration that have flown over by airport icao
4788
-	*
4789
-	* @return Array the aircraft list
4790
-	*
4791
-	*/
4787
+	 * Gets all aircraft registration that have flown over by airport icao
4788
+	 *
4789
+	 * @return Array the aircraft list
4790
+	 *
4791
+	 */
4792 4792
 	public function countAllAircraftRegistrationByAirport($airport_icao,$filters = array())
4793 4793
 	{
4794 4794
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4825,11 +4825,11 @@  discard block
 block discarded – undo
4825 4825
 	
4826 4826
 	
4827 4827
 	/**
4828
-	* Gets all aircraft manufacturer that have flown over by airport icao
4829
-	*
4830
-	* @return Array the aircraft list
4831
-	*
4832
-	*/
4828
+	 * Gets all aircraft manufacturer that have flown over by airport icao
4829
+	 *
4830
+	 * @return Array the aircraft list
4831
+	 *
4832
+	 */
4833 4833
 	public function countAllAircraftManufacturerByAirport($airport_icao,$filters = array())
4834 4834
 	{
4835 4835
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4855,11 +4855,11 @@  discard block
 block discarded – undo
4855 4855
 	}
4856 4856
 
4857 4857
 	/**
4858
-	* Gets all aircraft types that have flown over by aircraft manufacturer
4859
-	*
4860
-	* @return Array the aircraft list
4861
-	*
4862
-	*/
4858
+	 * Gets all aircraft types that have flown over by aircraft manufacturer
4859
+	 *
4860
+	 * @return Array the aircraft list
4861
+	 *
4862
+	 */
4863 4863
 	public function countAllAircraftTypesByManufacturer($aircraft_manufacturer,$filters = array())
4864 4864
 	{
4865 4865
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4886,11 +4886,11 @@  discard block
 block discarded – undo
4886 4886
 
4887 4887
 
4888 4888
 	/**
4889
-	* Gets all aircraft registration that have flown over by aircaft manufacturer
4890
-	*
4891
-	* @return Array the aircraft list
4892
-	*
4893
-	*/
4889
+	 * Gets all aircraft registration that have flown over by aircaft manufacturer
4890
+	 *
4891
+	 * @return Array the aircraft list
4892
+	 *
4893
+	 */
4894 4894
 	public function countAllAircraftRegistrationByManufacturer($aircraft_manufacturer, $filters = array())
4895 4895
 	{
4896 4896
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4926,11 +4926,11 @@  discard block
 block discarded – undo
4926 4926
 	}
4927 4927
 
4928 4928
 	/**
4929
-	* Gets all aircraft types that have flown over by date
4930
-	*
4931
-	* @return Array the aircraft list
4932
-	*
4933
-	*/
4929
+	 * Gets all aircraft types that have flown over by date
4930
+	 *
4931
+	 * @return Array the aircraft list
4932
+	 *
4933
+	 */
4934 4934
 	public function countAllAircraftTypesByDate($date,$filters = array())
4935 4935
 	{
4936 4936
 		global $globalTimezone, $globalDBdriver;
@@ -4972,11 +4972,11 @@  discard block
 block discarded – undo
4972 4972
 
4973 4973
 
4974 4974
 	/**
4975
-	* Gets all aircraft registration that have flown over by date
4976
-	*
4977
-	* @return Array the aircraft list
4978
-	*
4979
-	*/
4975
+	 * Gets all aircraft registration that have flown over by date
4976
+	 *
4977
+	 * @return Array the aircraft list
4978
+	 *
4979
+	 */
4980 4980
 	public function countAllAircraftRegistrationByDate($date,$filters = array())
4981 4981
 	{
4982 4982
 		global $globalTimezone, $globalDBdriver;
@@ -5027,11 +5027,11 @@  discard block
 block discarded – undo
5027 5027
 
5028 5028
 
5029 5029
 	/**
5030
-	* Gets all aircraft manufacturer that have flown over by date
5031
-	*
5032
-	* @return Array the aircraft manufacturer list
5033
-	*
5034
-	*/
5030
+	 * Gets all aircraft manufacturer that have flown over by date
5031
+	 *
5032
+	 * @return Array the aircraft manufacturer list
5033
+	 *
5034
+	 */
5035 5035
 	public function countAllAircraftManufacturerByDate($date,$filters = array())
5036 5036
 	{
5037 5037
 		global $globalTimezone, $globalDBdriver;
@@ -5073,11 +5073,11 @@  discard block
 block discarded – undo
5073 5073
 
5074 5074
 
5075 5075
 	/**
5076
-	* Gets all aircraft types that have flown over by ident/callsign
5077
-	*
5078
-	* @return Array the aircraft list
5079
-	*
5080
-	*/
5076
+	 * Gets all aircraft types that have flown over by ident/callsign
5077
+	 *
5078
+	 * @return Array the aircraft list
5079
+	 *
5080
+	 */
5081 5081
 	public function countAllAircraftTypesByIdent($ident,$filters = array())
5082 5082
 	{
5083 5083
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5106,11 +5106,11 @@  discard block
 block discarded – undo
5106 5106
 
5107 5107
 
5108 5108
 	/**
5109
-	* Gets all aircraft registration that have flown over by ident/callsign
5110
-	*
5111
-	* @return Array the aircraft list
5112
-	*
5113
-	*/
5109
+	 * Gets all aircraft registration that have flown over by ident/callsign
5110
+	 *
5111
+	 * @return Array the aircraft list
5112
+	 *
5113
+	 */
5114 5114
 	public function countAllAircraftRegistrationByIdent($ident,$filters = array())
5115 5115
 	{
5116 5116
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5150,11 +5150,11 @@  discard block
 block discarded – undo
5150 5150
 
5151 5151
 
5152 5152
 	/**
5153
-	* Gets all aircraft manufacturer that have flown over by ident/callsign
5154
-	*
5155
-	* @return Array the aircraft manufacturer list
5156
-	*
5157
-	*/
5153
+	 * Gets all aircraft manufacturer that have flown over by ident/callsign
5154
+	 *
5155
+	 * @return Array the aircraft manufacturer list
5156
+	 *
5157
+	 */
5158 5158
 	public function countAllAircraftManufacturerByIdent($ident,$filters = array())
5159 5159
 	{
5160 5160
 		$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 types that have flown over by route
5184
-	*
5185
-	* @return Array the aircraft list
5186
-	*
5187
-	*/
5183
+	 * Gets all aircraft types that have flown over by route
5184
+	 *
5185
+	 * @return Array the aircraft list
5186
+	 *
5187
+	 */
5188 5188
 	public function countAllAircraftTypesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
5189 5189
 	{
5190 5190
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5213,11 +5213,11 @@  discard block
 block discarded – undo
5213 5213
 	}
5214 5214
 
5215 5215
 	/**
5216
-	* Gets all aircraft registration that have flown over by route
5217
-	*
5218
-	* @return Array the aircraft list
5219
-	*
5220
-	*/
5216
+	 * Gets all aircraft registration that have flown over by route
5217
+	 *
5218
+	 * @return Array the aircraft list
5219
+	 *
5220
+	 */
5221 5221
 	public function countAllAircraftRegistrationByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
5222 5222
 	{
5223 5223
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5259,11 +5259,11 @@  discard block
 block discarded – undo
5259 5259
 	
5260 5260
 	
5261 5261
 	/**
5262
-	* Gets all aircraft manufacturer that have flown over by route
5263
-	*
5264
-	* @return Array the aircraft manufacturer list
5265
-	*
5266
-	*/
5262
+	 * Gets all aircraft manufacturer that have flown over by route
5263
+	 *
5264
+	 * @return Array the aircraft manufacturer list
5265
+	 *
5266
+	 */
5267 5267
 	public function countAllAircraftManufacturerByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
5268 5268
 	{
5269 5269
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5297,11 +5297,11 @@  discard block
 block discarded – undo
5297 5297
 	
5298 5298
 	
5299 5299
 	/**
5300
-	* Gets all aircraft types that have flown over by country
5301
-	*
5302
-	* @return Array the aircraft list
5303
-	*
5304
-	*/
5300
+	 * Gets all aircraft types that have flown over by country
5301
+	 *
5302
+	 * @return Array the aircraft list
5303
+	 *
5304
+	 */
5305 5305
 	public function countAllAircraftTypesByCountry($country,$filters = array())
5306 5306
 	{
5307 5307
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5332,11 +5332,11 @@  discard block
 block discarded – undo
5332 5332
 
5333 5333
 
5334 5334
 	/**
5335
-	* Gets all aircraft registration that have flown over by country
5336
-	*
5337
-	* @return Array the aircraft list
5338
-	*
5339
-	*/
5335
+	 * Gets all aircraft registration that have flown over by country
5336
+	 *
5337
+	 * @return Array the aircraft list
5338
+	 *
5339
+	 */
5340 5340
 	public function countAllAircraftRegistrationByCountry($country,$filters = array())
5341 5341
 	{
5342 5342
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5376,11 +5376,11 @@  discard block
 block discarded – undo
5376 5376
 	
5377 5377
 	
5378 5378
 	/**
5379
-	* Gets all aircraft manufacturer that have flown over by country
5380
-	*
5381
-	* @return Array the aircraft manufacturer list
5382
-	*
5383
-	*/
5379
+	 * Gets all aircraft manufacturer that have flown over by country
5380
+	 *
5381
+	 * @return Array the aircraft manufacturer list
5382
+	 *
5383
+	 */
5384 5384
 	public function countAllAircraftManufacturerByCountry($country,$filters = array())
5385 5385
 	{
5386 5386
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5411,17 +5411,17 @@  discard block
 block discarded – undo
5411 5411
 	
5412 5412
 	
5413 5413
 	/**
5414
-	* Gets all aircraft manufacturers that have flown over
5415
-	*
5416
-	* @return Array the aircraft list
5417
-	*
5418
-	*/
5414
+	 * Gets all aircraft manufacturers that have flown over
5415
+	 *
5416
+	 * @return Array the aircraft list
5417
+	 *
5418
+	 */
5419 5419
 	public function countAllAircraftManufacturers($filters = array())
5420 5420
 	{
5421 5421
 		$filter_query = $this->getFilter($filters,true,true);
5422 5422
 		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5423 5423
                     FROM spotter_output ".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.aircraft_manufacturer <> 'Not Available'";
5424
-                $query .= " GROUP BY spotter_output.aircraft_manufacturer
5424
+				$query .= " GROUP BY spotter_output.aircraft_manufacturer
5425 5425
 					ORDER BY aircraft_manufacturer_count DESC
5426 5426
 					LIMIT 10";
5427 5427
       
@@ -5446,11 +5446,11 @@  discard block
 block discarded – undo
5446 5446
 	
5447 5447
 	
5448 5448
 	/**
5449
-	* Gets all aircraft registrations that have flown over
5450
-	*
5451
-	* @return Array the aircraft list
5452
-	*
5453
-	*/
5449
+	 * Gets all aircraft registrations that have flown over
5450
+	 *
5451
+	 * @return Array the aircraft list
5452
+	 *
5453
+	 */
5454 5454
 	public function countAllAircraftRegistrations($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
5455 5455
 	{
5456 5456
 		global $globalDBdriver;
@@ -5458,15 +5458,15 @@  discard block
 block discarded – undo
5458 5458
 		$filter_query = $this->getFilter($filters,true,true);
5459 5459
 		$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    
5460 5460
                     FROM spotter_output ".$filter_query." spotter_output.registration <> '' AND spotter_output.registration <> 'NA'";
5461
-                if ($olderthanmonths > 0) {
5462
-            		if ($globalDBdriver == 'mysql') {
5461
+				if ($olderthanmonths > 0) {
5462
+					if ($globalDBdriver == 'mysql') {
5463 5463
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
5464 5464
 			} else {
5465 5465
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
5466 5466
 			}
5467 5467
 		}
5468
-                if ($sincedate != '') {
5469
-            		if ($globalDBdriver == 'mysql') {
5468
+				if ($sincedate != '') {
5469
+					if ($globalDBdriver == 'mysql') {
5470 5470
 				$query .= " AND spotter_output.date > '".$sincedate."'";
5471 5471
 			} else {
5472 5472
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -5475,7 +5475,7 @@  discard block
 block discarded – undo
5475 5475
 
5476 5476
 		// if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5477 5477
 		//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5478
-                $query .= " GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC";
5478
+				$query .= " GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC";
5479 5479
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5480 5480
 		
5481 5481
 		$sth = $this->db->prepare($query);
@@ -5506,11 +5506,11 @@  discard block
 block discarded – undo
5506 5506
 
5507 5507
 
5508 5508
 	/**
5509
-	* Gets all aircraft registrations that have flown over
5510
-	*
5511
-	* @return Array the aircraft list
5512
-	*
5513
-	*/
5509
+	 * Gets all aircraft registrations that have flown over
5510
+	 *
5511
+	 * @return Array the aircraft list
5512
+	 *
5513
+	 */
5514 5514
 	public function countAllAircraftRegistrationsByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
5515 5515
 	{
5516 5516
 		global $globalDBdriver;
@@ -5518,15 +5518,15 @@  discard block
 block discarded – undo
5518 5518
 		$Image = new Image($this->db);
5519 5519
 		$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    
5520 5520
                     FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.registration <> '' AND spotter_output.registration <> 'NA' ";
5521
-                if ($olderthanmonths > 0) {
5522
-            		if ($globalDBdriver == 'mysql') {
5521
+				if ($olderthanmonths > 0) {
5522
+					if ($globalDBdriver == 'mysql') {
5523 5523
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
5524 5524
 			} else {
5525 5525
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
5526 5526
 			}
5527 5527
 		}
5528
-                if ($sincedate != '') {
5529
-            		if ($globalDBdriver == 'mysql') {
5528
+				if ($sincedate != '') {
5529
+					if ($globalDBdriver == 'mysql') {
5530 5530
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
5531 5531
 			} else {
5532 5532
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -5535,7 +5535,7 @@  discard block
 block discarded – undo
5535 5535
 
5536 5536
 		// if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5537 5537
 		//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5538
-                $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";
5538
+				$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";
5539 5539
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5540 5540
 		
5541 5541
 		$sth = $this->db->prepare($query);
@@ -5567,35 +5567,35 @@  discard block
 block discarded – undo
5567 5567
 	
5568 5568
 	
5569 5569
 	/**
5570
-	* Gets all departure airports of the airplanes that have flown over
5571
-	*
5572
-	* @return Array the airport list
5573
-	*
5574
-	*/
5570
+	 * Gets all departure airports of the airplanes that have flown over
5571
+	 *
5572
+	 * @return Array the airport list
5573
+	 *
5574
+	 */
5575 5575
 	public function countAllDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
5576 5576
 	{
5577 5577
 		global $globalDBdriver;
5578 5578
 		$filter_query = $this->getFilter($filters,true,true);
5579 5579
 		$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 
5580 5580
 				FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA'";
5581
-                if ($olderthanmonths > 0) {
5582
-            		if ($globalDBdriver == 'mysql') {
5581
+				if ($olderthanmonths > 0) {
5582
+					if ($globalDBdriver == 'mysql') {
5583 5583
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
5584 5584
 			} else {
5585 5585
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
5586 5586
 			}
5587
-                }
5588
-                if ($sincedate != '') {
5589
-            		if ($globalDBdriver == 'mysql') {
5587
+				}
5588
+				if ($sincedate != '') {
5589
+					if ($globalDBdriver == 'mysql') {
5590 5590
 				$query .= " AND spotter_output.date > '".$sincedate."'";
5591 5591
 			} else {
5592 5592
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
5593 5593
 			}
5594 5594
 		}
5595 5595
 
5596
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5597
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5598
-                $query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
5596
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5597
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5598
+				$query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
5599 5599
 				ORDER BY airport_departure_icao_count DESC";
5600 5600
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5601 5601
       
@@ -5619,35 +5619,35 @@  discard block
 block discarded – undo
5619 5619
 	}
5620 5620
 
5621 5621
 	/**
5622
-	* Gets all departure airports of the airplanes that have flown over
5623
-	*
5624
-	* @return Array the airport list
5625
-	*
5626
-	*/
5622
+	 * Gets all departure airports of the airplanes that have flown over
5623
+	 *
5624
+	 * @return Array the airport list
5625
+	 *
5626
+	 */
5627 5627
 	public function countAllDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
5628 5628
 	{
5629 5629
 		global $globalDBdriver;
5630 5630
 		$filter_query = $this->getFilter($filters,true,true);
5631 5631
 		$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 
5632 5632
 			FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' ";
5633
-                if ($olderthanmonths > 0) {
5634
-            		if ($globalDBdriver == 'mysql') {
5633
+				if ($olderthanmonths > 0) {
5634
+					if ($globalDBdriver == 'mysql') {
5635 5635
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
5636 5636
 			} else {
5637 5637
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
5638 5638
 			}
5639
-                }
5640
-                if ($sincedate != '') {
5641
-            		if ($globalDBdriver == 'mysql') {
5639
+				}
5640
+				if ($sincedate != '') {
5641
+					if ($globalDBdriver == 'mysql') {
5642 5642
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
5643 5643
 			} else {
5644 5644
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
5645 5645
 			}
5646 5646
 		}
5647 5647
 
5648
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5649
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5650
-                $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
5648
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5649
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5650
+				$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
5651 5651
 				ORDER BY airport_departure_icao_count DESC";
5652 5652
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5653 5653
       
@@ -5672,37 +5672,37 @@  discard block
 block discarded – undo
5672 5672
 	}
5673 5673
 
5674 5674
 	/**
5675
-	* Gets all detected departure airports of the airplanes that have flown over
5676
-	*
5677
-	* @return Array the airport list
5678
-	*
5679
-	*/
5675
+	 * Gets all detected departure airports of the airplanes that have flown over
5676
+	 *
5677
+	 * @return Array the airport list
5678
+	 *
5679
+	 */
5680 5680
 	public function countAllDetectedDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
5681 5681
 	{
5682 5682
 		global $globalDBdriver;
5683 5683
 		$filter_query = $this->getFilter($filters,true,true);
5684 5684
 		$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
5685 5685
 				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";
5686
-                if ($olderthanmonths > 0) {
5687
-            		if ($globalDBdriver == 'mysql') {
5686
+				if ($olderthanmonths > 0) {
5687
+					if ($globalDBdriver == 'mysql') {
5688 5688
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
5689 5689
 			} else {
5690 5690
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
5691 5691
 			}
5692
-                }
5693
-                if ($sincedate != '') {
5694
-            		if ($globalDBdriver == 'mysql') {
5692
+				}
5693
+				if ($sincedate != '') {
5694
+					if ($globalDBdriver == 'mysql') {
5695 5695
 				$query .= " AND spotter_output.date > '".$sincedate."'";
5696 5696
 			} else {
5697 5697
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
5698 5698
 			}
5699 5699
 		}
5700
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5701
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5702
-                $query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
5700
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5701
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5702
+				$query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
5703 5703
 				ORDER BY airport_departure_icao_count DESC";
5704 5704
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5705
-    		//echo $query;
5705
+			//echo $query;
5706 5706
 		$sth = $this->db->prepare($query);
5707 5707
 		$sth->execute();
5708 5708
       
@@ -5723,35 +5723,35 @@  discard block
 block discarded – undo
5723 5723
 	}
5724 5724
 	
5725 5725
 	/**
5726
-	* Gets all detected departure airports of the airplanes that have flown over
5727
-	*
5728
-	* @return Array the airport list
5729
-	*
5730
-	*/
5726
+	 * Gets all detected departure airports of the airplanes that have flown over
5727
+	 *
5728
+	 * @return Array the airport list
5729
+	 *
5730
+	 */
5731 5731
 	public function countAllDetectedDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
5732 5732
 	{
5733 5733
 		global $globalDBdriver;
5734 5734
 		$filter_query = $this->getFilter($filters,true,true);
5735 5735
 		$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
5736 5736
 				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 ";
5737
-                if ($olderthanmonths > 0) {
5738
-            		if ($globalDBdriver == 'mysql') {
5737
+				if ($olderthanmonths > 0) {
5738
+					if ($globalDBdriver == 'mysql') {
5739 5739
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
5740 5740
 			} else {
5741 5741
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
5742 5742
 			}
5743
-                }
5744
-                if ($sincedate != '') {
5745
-            		if ($globalDBdriver == 'mysql') {
5743
+				}
5744
+				if ($sincedate != '') {
5745
+					if ($globalDBdriver == 'mysql') {
5746 5746
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
5747 5747
 			} else {
5748 5748
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP) ";
5749 5749
 			}
5750 5750
 		}
5751 5751
 
5752
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5753
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5754
-                $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
5752
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5753
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5754
+				$query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
5755 5755
 				ORDER BY airport_departure_icao_count DESC";
5756 5756
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5757 5757
       
@@ -5776,11 +5776,11 @@  discard block
 block discarded – undo
5776 5776
 	}	
5777 5777
 	
5778 5778
 	/**
5779
-	* Gets all departure airports of the airplanes that have flown over based on an airline icao
5780
-	*
5781
-	* @return Array the airport list
5782
-	*
5783
-	*/
5779
+	 * Gets all departure airports of the airplanes that have flown over based on an airline icao
5780
+	 *
5781
+	 * @return Array the airport list
5782
+	 *
5783
+	 */
5784 5784
 	public function countAllDepartureAirportsByAirline($airline_icao,$filters = array())
5785 5785
 	{
5786 5786
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5814,11 +5814,11 @@  discard block
 block discarded – undo
5814 5814
 	
5815 5815
 	
5816 5816
 	/**
5817
-	* Gets all departure airports by country of the airplanes that have flown over based on an airline icao
5818
-	*
5819
-	* @return Array the airport list
5820
-	*
5821
-	*/
5817
+	 * Gets all departure airports by country of the airplanes that have flown over based on an airline icao
5818
+	 *
5819
+	 * @return Array the airport list
5820
+	 *
5821
+	 */
5822 5822
 	public function countAllDepartureAirportCountriesByAirline($airline_icao,$filters = array())
5823 5823
 	{
5824 5824
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5849,11 +5849,11 @@  discard block
 block discarded – undo
5849 5849
 	
5850 5850
 	
5851 5851
 	/**
5852
-	* Gets all departure airports of the airplanes that have flown over based on an aircraft icao
5853
-	*
5854
-	* @return Array the airport list
5855
-	*
5856
-	*/
5852
+	 * Gets all departure airports of the airplanes that have flown over based on an aircraft icao
5853
+	 *
5854
+	 * @return Array the airport list
5855
+	 *
5856
+	 */
5857 5857
 	public function countAllDepartureAirportsByAircraft($aircraft_icao,$filters = array())
5858 5858
 	{
5859 5859
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5886,11 +5886,11 @@  discard block
 block discarded – undo
5886 5886
 	
5887 5887
 	
5888 5888
 	/**
5889
-	* Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao
5890
-	*
5891
-	* @return Array the airport list
5892
-	*
5893
-	*/
5889
+	 * Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao
5890
+	 *
5891
+	 * @return Array the airport list
5892
+	 *
5893
+	 */
5894 5894
 	public function countAllDepartureAirportCountriesByAircraft($aircraft_icao,$filters = array())
5895 5895
 	{
5896 5896
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5920,11 +5920,11 @@  discard block
 block discarded – undo
5920 5920
 	
5921 5921
 	
5922 5922
 	/**
5923
-	* Gets all departure airports of the airplanes that have flown over based on an aircraft registration
5924
-	*
5925
-	* @return Array the airport list
5926
-	*
5927
-	*/
5923
+	 * Gets all departure airports of the airplanes that have flown over based on an aircraft registration
5924
+	 *
5925
+	 * @return Array the airport list
5926
+	 *
5927
+	 */
5928 5928
 	public function countAllDepartureAirportsByRegistration($registration,$filters = array())
5929 5929
 	{
5930 5930
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5957,11 +5957,11 @@  discard block
 block discarded – undo
5957 5957
 	
5958 5958
 	
5959 5959
 	/**
5960
-	* Gets all departure airports by country of the airplanes that have flown over based on an aircraft registration
5961
-	*
5962
-	* @return Array the airport list
5963
-	*
5964
-	*/
5960
+	 * Gets all departure airports by country of the airplanes that have flown over based on an aircraft registration
5961
+	 *
5962
+	 * @return Array the airport list
5963
+	 *
5964
+	 */
5965 5965
 	public function countAllDepartureAirportCountriesByRegistration($registration,$filters = array())
5966 5966
 	{
5967 5967
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5991,11 +5991,11 @@  discard block
 block discarded – undo
5991 5991
 	
5992 5992
 	
5993 5993
 	/**
5994
-	* Gets all departure airports of the airplanes that have flown over based on an arrivl airport icao
5995
-	*
5996
-	* @return Array the airport list
5997
-	*
5998
-	*/
5994
+	 * Gets all departure airports of the airplanes that have flown over based on an arrivl airport icao
5995
+	 *
5996
+	 * @return Array the airport list
5997
+	 *
5998
+	 */
5999 5999
 	public function countAllDepartureAirportsByAirport($airport_icao,$filters = array())
6000 6000
 	{
6001 6001
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6028,11 +6028,11 @@  discard block
 block discarded – undo
6028 6028
 	
6029 6029
 	
6030 6030
 	/**
6031
-	* Gets all departure airports by country of the airplanes that have flown over based on an airport icao
6032
-	*
6033
-	* @return Array the airport list
6034
-	*
6035
-	*/
6031
+	 * Gets all departure airports by country of the airplanes that have flown over based on an airport icao
6032
+	 *
6033
+	 * @return Array the airport list
6034
+	 *
6035
+	 */
6036 6036
 	public function countAllDepartureAirportCountriesByAirport($airport_icao,$filters = array())
6037 6037
 	{
6038 6038
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6063,11 +6063,11 @@  discard block
 block discarded – undo
6063 6063
 	
6064 6064
 	
6065 6065
 	/**
6066
-	* Gets all departure airports of the airplanes that have flown over based on an aircraft manufacturer
6067
-	*
6068
-	* @return Array the airport list
6069
-	*
6070
-	*/
6066
+	 * Gets all departure airports of the airplanes that have flown over based on an aircraft manufacturer
6067
+	 *
6068
+	 * @return Array the airport list
6069
+	 *
6070
+	 */
6071 6071
 	public function countAllDepartureAirportsByManufacturer($aircraft_manufacturer,$filters = array())
6072 6072
 	{
6073 6073
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6100,11 +6100,11 @@  discard block
 block discarded – undo
6100 6100
 	
6101 6101
 	
6102 6102
 	/**
6103
-	* Gets all departure airports by country of the airplanes that have flown over based on an aircraft manufacturer
6104
-	*
6105
-	* @return Array the airport list
6106
-	*
6107
-	*/
6103
+	 * Gets all departure airports by country of the airplanes that have flown over based on an aircraft manufacturer
6104
+	 *
6105
+	 * @return Array the airport list
6106
+	 *
6107
+	 */
6108 6108
 	public function countAllDepartureAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array())
6109 6109
 	{
6110 6110
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6134,11 +6134,11 @@  discard block
 block discarded – undo
6134 6134
 	
6135 6135
 	
6136 6136
 	/**
6137
-	* Gets all departure airports of the airplanes that have flown over based on a date
6138
-	*
6139
-	* @return Array the airport list
6140
-	*
6141
-	*/
6137
+	 * Gets all departure airports of the airplanes that have flown over based on a date
6138
+	 *
6139
+	 * @return Array the airport list
6140
+	 *
6141
+	 */
6142 6142
 	public function countAllDepartureAirportsByDate($date,$filters = array())
6143 6143
 	{
6144 6144
 		global $globalTimezone, $globalDBdriver;
@@ -6184,11 +6184,11 @@  discard block
 block discarded – undo
6184 6184
 	
6185 6185
 	
6186 6186
 	/**
6187
-	* Gets all departure airports by country of the airplanes that have flown over based on a date
6188
-	*
6189
-	* @return Array the airport list
6190
-	*
6191
-	*/
6187
+	 * Gets all departure airports by country of the airplanes that have flown over based on a date
6188
+	 *
6189
+	 * @return Array the airport list
6190
+	 *
6191
+	 */
6192 6192
 	public function countAllDepartureAirportCountriesByDate($date,$filters = array())
6193 6193
 	{
6194 6194
 		global $globalTimezone, $globalDBdriver;
@@ -6231,11 +6231,11 @@  discard block
 block discarded – undo
6231 6231
 	
6232 6232
 	
6233 6233
 	/**
6234
-	* Gets all departure airports of the airplanes that have flown over based on a ident/callsign
6235
-	*
6236
-	* @return Array the airport list
6237
-	*
6238
-	*/
6234
+	 * Gets all departure airports of the airplanes that have flown over based on a ident/callsign
6235
+	 *
6236
+	 * @return Array the airport list
6237
+	 *
6238
+	 */
6239 6239
 	public function countAllDepartureAirportsByIdent($ident,$filters = array())
6240 6240
 	{
6241 6241
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6269,11 +6269,11 @@  discard block
 block discarded – undo
6269 6269
 	
6270 6270
 	
6271 6271
 	/**
6272
-	* Gets all departure airports by country of the airplanes that have flown over based on a callsign/ident
6273
-	*
6274
-	* @return Array the airport list
6275
-	*
6276
-	*/
6272
+	 * Gets all departure airports by country of the airplanes that have flown over based on a callsign/ident
6273
+	 *
6274
+	 * @return Array the airport list
6275
+	 *
6276
+	 */
6277 6277
 	public function countAllDepartureAirportCountriesByIdent($ident,$filters = array())
6278 6278
 	{
6279 6279
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6304,11 +6304,11 @@  discard block
 block discarded – undo
6304 6304
 	
6305 6305
 	
6306 6306
 	/**
6307
-	* Gets all departure airports of the airplanes that have flown over based on a country
6308
-	*
6309
-	* @return Array the airport list
6310
-	*
6311
-	*/
6307
+	 * Gets all departure airports of the airplanes that have flown over based on a country
6308
+	 *
6309
+	 * @return Array the airport list
6310
+	 *
6311
+	 */
6312 6312
 	public function countAllDepartureAirportsByCountry($country,$filters = array())
6313 6313
 	{
6314 6314
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6342,11 +6342,11 @@  discard block
 block discarded – undo
6342 6342
 
6343 6343
 
6344 6344
 	/**
6345
-	* Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao
6346
-	*
6347
-	* @return Array the airport list
6348
-	*
6349
-	*/
6345
+	 * Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao
6346
+	 *
6347
+	 * @return Array the airport list
6348
+	 *
6349
+	 */
6350 6350
 	public function countAllDepartureAirportCountriesByCountry($country,$filters = array())
6351 6351
 	{
6352 6352
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6376,40 +6376,40 @@  discard block
 block discarded – undo
6376 6376
 	
6377 6377
 
6378 6378
 	/**
6379
-	* Gets all arrival airports of the airplanes that have flown over
6380
-	*
6381
-	* @return Array the airport list
6382
-	*
6383
-	*/
6379
+	 * Gets all arrival airports of the airplanes that have flown over
6380
+	 *
6381
+	 * @return Array the airport list
6382
+	 *
6383
+	 */
6384 6384
 	public function countAllArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array())
6385 6385
 	{
6386 6386
 		global $globalDBdriver;
6387 6387
 		$filter_query = $this->getFilter($filters,true,true);
6388 6388
 		$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 
6389 6389
 				FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA'";
6390
-                if ($olderthanmonths > 0) {
6391
-            		if ($globalDBdriver == 'mysql') {
6390
+				if ($olderthanmonths > 0) {
6391
+					if ($globalDBdriver == 'mysql') {
6392 6392
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
6393 6393
 			} else {
6394 6394
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
6395 6395
 			}
6396
-                if ($sincedate != '') {
6397
-            		if ($globalDBdriver == 'mysql') {
6396
+				if ($sincedate != '') {
6397
+					if ($globalDBdriver == 'mysql') {
6398 6398
 				$query .= " AND spotter_output.date > '".$sincedate."'";
6399 6399
 			} else {
6400 6400
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
6401 6401
 			}
6402 6402
 		}
6403
-            		if ($globalDBdriver == 'mysql') {
6403
+					if ($globalDBdriver == 'mysql') {
6404 6404
 				$query .= " AND spotter_output.date > '".$sincedate."'";
6405 6405
 			} else {
6406 6406
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
6407 6407
 			}
6408 6408
 		}
6409 6409
 
6410
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6411
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6412
-                $query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
6410
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6411
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6412
+				$query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
6413 6413
 					ORDER BY airport_arrival_icao_count DESC";
6414 6414
 		if ($limit) $query .= " LIMIT 10";
6415 6415
       
@@ -6438,40 +6438,40 @@  discard block
 block discarded – undo
6438 6438
 	}
6439 6439
 
6440 6440
 	/**
6441
-	* Gets all arrival airports of the airplanes that have flown over
6442
-	*
6443
-	* @return Array the airport list
6444
-	*
6445
-	*/
6441
+	 * Gets all arrival airports of the airplanes that have flown over
6442
+	 *
6443
+	 * @return Array the airport list
6444
+	 *
6445
+	 */
6446 6446
 	public function countAllArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array())
6447 6447
 	{
6448 6448
 		global $globalDBdriver;
6449 6449
 		$filter_query = $this->getFilter($filters,true,true);
6450 6450
 		$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 
6451 6451
 			FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' ";
6452
-                if ($olderthanmonths > 0) {
6453
-            		if ($globalDBdriver == 'mysql') {
6452
+				if ($olderthanmonths > 0) {
6453
+					if ($globalDBdriver == 'mysql') {
6454 6454
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
6455 6455
 			} else {
6456 6456
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
6457 6457
 			}
6458
-                if ($sincedate != '') {
6459
-            		if ($globalDBdriver == 'mysql') {
6458
+				if ($sincedate != '') {
6459
+					if ($globalDBdriver == 'mysql') {
6460 6460
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
6461 6461
 			} else {
6462 6462
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
6463 6463
 			}
6464 6464
 		}
6465
-            		if ($globalDBdriver == 'mysql') {
6465
+					if ($globalDBdriver == 'mysql') {
6466 6466
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
6467 6467
 			} else {
6468 6468
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
6469 6469
 			}
6470 6470
 		}
6471 6471
 
6472
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6473
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6474
-                $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
6472
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6473
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6474
+				$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
6475 6475
 					ORDER BY airport_arrival_icao_count DESC";
6476 6476
 		if ($limit) $query .= " LIMIT 10";
6477 6477
       
@@ -6502,39 +6502,39 @@  discard block
 block discarded – undo
6502 6502
 
6503 6503
 
6504 6504
 	/**
6505
-	* Gets all detected arrival airports of the airplanes that have flown over
6506
-	*
6507
-	* @return Array the airport list
6508
-	*
6509
-	*/
6505
+	 * Gets all detected arrival airports of the airplanes that have flown over
6506
+	 *
6507
+	 * @return Array the airport list
6508
+	 *
6509
+	 */
6510 6510
 	public function countAllDetectedArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array())
6511 6511
 	{
6512 6512
 		global $globalDBdriver;
6513 6513
 		$filter_query = $this->getFilter($filters,true,true);
6514 6514
 		$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 
6515 6515
 			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";
6516
-                if ($olderthanmonths > 0) {
6517
-            		if ($globalDBdriver == 'mysql') {
6516
+				if ($olderthanmonths > 0) {
6517
+					if ($globalDBdriver == 'mysql') {
6518 6518
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
6519 6519
 			} else {
6520 6520
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
6521 6521
 			}
6522
-                if ($sincedate != '') {
6523
-            		if ($globalDBdriver == 'mysql') {
6522
+				if ($sincedate != '') {
6523
+					if ($globalDBdriver == 'mysql') {
6524 6524
 				$query .= " AND spotter_output.date > '".$sincedate."'";
6525 6525
 			} else {
6526 6526
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
6527 6527
 			}
6528 6528
 		}
6529
-            		if ($globalDBdriver == 'mysql') {
6529
+					if ($globalDBdriver == 'mysql') {
6530 6530
 				$query .= " AND spotter_output.date > '".$sincedate."'";
6531 6531
 			} else {
6532 6532
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
6533 6533
 			}
6534 6534
 		}
6535
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6536
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6537
-                $query .= " GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
6535
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6536
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6537
+				$query .= " GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
6538 6538
 					ORDER BY airport_arrival_icao_count DESC";
6539 6539
 		if ($limit) $query .= " LIMIT 10";
6540 6540
       
@@ -6563,40 +6563,40 @@  discard block
 block discarded – undo
6563 6563
 	}
6564 6564
 	
6565 6565
 	/**
6566
-	* Gets all detected arrival airports of the airplanes that have flown over
6567
-	*
6568
-	* @return Array the airport list
6569
-	*
6570
-	*/
6566
+	 * Gets all detected arrival airports of the airplanes that have flown over
6567
+	 *
6568
+	 * @return Array the airport list
6569
+	 *
6570
+	 */
6571 6571
 	public function countAllDetectedArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array())
6572 6572
 	{
6573 6573
 		global $globalDBdriver;
6574 6574
 		$filter_query = $this->getFilter($filters,true,true);
6575 6575
 		$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 
6576 6576
 			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 ";
6577
-                if ($olderthanmonths > 0) {
6578
-            		if ($globalDBdriver == 'mysql') {
6577
+				if ($olderthanmonths > 0) {
6578
+					if ($globalDBdriver == 'mysql') {
6579 6579
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
6580 6580
 			} else {
6581 6581
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
6582 6582
 			}
6583
-                if ($sincedate != '') {
6584
-            		if ($globalDBdriver == 'mysql') {
6583
+				if ($sincedate != '') {
6584
+					if ($globalDBdriver == 'mysql') {
6585 6585
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
6586 6586
 			} else {
6587 6587
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
6588 6588
 			}
6589 6589
 		}
6590
-            		if ($globalDBdriver == 'mysql') {
6590
+					if ($globalDBdriver == 'mysql') {
6591 6591
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
6592 6592
 			} else {
6593 6593
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
6594 6594
 			}
6595 6595
 		}
6596 6596
 
6597
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6598
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6599
-                $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
6597
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6598
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6599
+				$query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
6600 6600
 					ORDER BY airport_arrival_icao_count DESC";
6601 6601
 		if ($limit) $query .= " LIMIT 10";
6602 6602
       
@@ -6626,11 +6626,11 @@  discard block
 block discarded – undo
6626 6626
 	}	
6627 6627
 	
6628 6628
 	/**
6629
-	* Gets all arrival airports of the airplanes that have flown over based on an airline icao
6630
-	*
6631
-	* @return Array the airport list
6632
-	*
6633
-	*/
6629
+	 * Gets all arrival airports of the airplanes that have flown over based on an airline icao
6630
+	 *
6631
+	 * @return Array the airport list
6632
+	 *
6633
+	 */
6634 6634
 	public function countAllArrivalAirportsByAirline($airline_icao, $filters = array())
6635 6635
 	{
6636 6636
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6662,11 +6662,11 @@  discard block
 block discarded – undo
6662 6662
 	
6663 6663
 	
6664 6664
 	/**
6665
-	* Gets all arrival airports by country of the airplanes that have flown over based on an airline icao
6666
-	*
6667
-	* @return Array the airport list
6668
-	*
6669
-	*/
6665
+	 * Gets all arrival airports by country of the airplanes that have flown over based on an airline icao
6666
+	 *
6667
+	 * @return Array the airport list
6668
+	 *
6669
+	 */
6670 6670
 	public function countAllArrivalAirportCountriesByAirline($airline_icao,$filters = array())
6671 6671
 	{
6672 6672
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6697,11 +6697,11 @@  discard block
 block discarded – undo
6697 6697
 	
6698 6698
 	
6699 6699
 	/**
6700
-	* Gets all arrival airports of the airplanes that have flown over based on an aircraft icao
6701
-	*
6702
-	* @return Array the airport list
6703
-	*
6704
-	*/
6700
+	 * Gets all arrival airports of the airplanes that have flown over based on an aircraft icao
6701
+	 *
6702
+	 * @return Array the airport list
6703
+	 *
6704
+	 */
6705 6705
 	public function countAllArrivalAirportsByAircraft($aircraft_icao,$filters = array())
6706 6706
 	{
6707 6707
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6735,11 +6735,11 @@  discard block
 block discarded – undo
6735 6735
 	
6736 6736
 	
6737 6737
 	/**
6738
-	* Gets all arrival airports by country of the airplanes that have flown over based on an aircraft icao
6739
-	*
6740
-	* @return Array the airport list
6741
-	*
6742
-	*/
6738
+	 * Gets all arrival airports by country of the airplanes that have flown over based on an aircraft icao
6739
+	 *
6740
+	 * @return Array the airport list
6741
+	 *
6742
+	 */
6743 6743
 	public function countAllArrivalAirportCountriesByAircraft($aircraft_icao,$filters = array())
6744 6744
 	{
6745 6745
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6769,11 +6769,11 @@  discard block
 block discarded – undo
6769 6769
 	
6770 6770
 	
6771 6771
 	/**
6772
-	* Gets all arrival airports of the airplanes that have flown over based on an aircraft registration
6773
-	*
6774
-	* @return Array the airport list
6775
-	*
6776
-	*/
6772
+	 * Gets all arrival airports of the airplanes that have flown over based on an aircraft registration
6773
+	 *
6774
+	 * @return Array the airport list
6775
+	 *
6776
+	 */
6777 6777
 	public function countAllArrivalAirportsByRegistration($registration,$filters = array())
6778 6778
 	{
6779 6779
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6807,11 +6807,11 @@  discard block
 block discarded – undo
6807 6807
 	
6808 6808
 	
6809 6809
 	/**
6810
-	* Gets all arrival airports by country of the airplanes that have flown over based on an aircraft registration
6811
-	*
6812
-	* @return Array the airport list
6813
-	*
6814
-	*/
6810
+	 * Gets all arrival airports by country of the airplanes that have flown over based on an aircraft registration
6811
+	 *
6812
+	 * @return Array the airport list
6813
+	 *
6814
+	 */
6815 6815
 	public function countAllArrivalAirportCountriesByRegistration($registration,$filters = array())
6816 6816
 	{
6817 6817
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6842,11 +6842,11 @@  discard block
 block discarded – undo
6842 6842
 	
6843 6843
 	
6844 6844
 	/**
6845
-	* Gets all arrival airports of the airplanes that have flown over based on an departure airport
6846
-	*
6847
-	* @return Array the airport list
6848
-	*
6849
-	*/
6845
+	 * Gets all arrival airports of the airplanes that have flown over based on an departure airport
6846
+	 *
6847
+	 * @return Array the airport list
6848
+	 *
6849
+	 */
6850 6850
 	public function countAllArrivalAirportsByAirport($airport_icao,$filters = array())
6851 6851
 	{
6852 6852
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6879,11 +6879,11 @@  discard block
 block discarded – undo
6879 6879
 	
6880 6880
 	
6881 6881
 	/**
6882
-	* Gets all arrival airports by country of the airplanes that have flown over based on an airport icao
6883
-	*
6884
-	* @return Array the airport list
6885
-	*
6886
-	*/
6882
+	 * Gets all arrival airports by country of the airplanes that have flown over based on an airport icao
6883
+	 *
6884
+	 * @return Array the airport list
6885
+	 *
6886
+	 */
6887 6887
 	public function countAllArrivalAirportCountriesByAirport($airport_icao,$filters = array())
6888 6888
 	{
6889 6889
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6913,11 +6913,11 @@  discard block
 block discarded – undo
6913 6913
 	
6914 6914
 	
6915 6915
 	/**
6916
-	* Gets all arrival airports of the airplanes that have flown over based on a aircraft manufacturer
6917
-	*
6918
-	* @return Array the airport list
6919
-	*
6920
-	*/
6916
+	 * Gets all arrival airports of the airplanes that have flown over based on a aircraft manufacturer
6917
+	 *
6918
+	 * @return Array the airport list
6919
+	 *
6920
+	 */
6921 6921
 	public function countAllArrivalAirportsByManufacturer($aircraft_manufacturer,$filters = array())
6922 6922
 	{
6923 6923
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6951,11 +6951,11 @@  discard block
 block discarded – undo
6951 6951
 	
6952 6952
 	
6953 6953
 	/**
6954
-	* Gets all arrival airports by country of the airplanes that have flown over based on a aircraft manufacturer
6955
-	*
6956
-	* @return Array the airport list
6957
-	*
6958
-	*/
6954
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a aircraft manufacturer
6955
+	 *
6956
+	 * @return Array the airport list
6957
+	 *
6958
+	 */
6959 6959
 	public function countAllArrivalAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array())
6960 6960
 	{
6961 6961
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6986,11 +6986,11 @@  discard block
 block discarded – undo
6986 6986
 	
6987 6987
 	
6988 6988
 	/**
6989
-	* Gets all arrival airports of the airplanes that have flown over based on a date
6990
-	*
6991
-	* @return Array the airport list
6992
-	*
6993
-	*/
6989
+	 * Gets all arrival airports of the airplanes that have flown over based on a date
6990
+	 *
6991
+	 * @return Array the airport list
6992
+	 *
6993
+	 */
6994 6994
 	public function countAllArrivalAirportsByDate($date,$filters = array())
6995 6995
 	{
6996 6996
 		global $globalTimezone, $globalDBdriver;
@@ -7036,11 +7036,11 @@  discard block
 block discarded – undo
7036 7036
 	
7037 7037
 	
7038 7038
 	/**
7039
-	* Gets all arrival airports by country of the airplanes that have flown over based on a date
7040
-	*
7041
-	* @return Array the airport list
7042
-	*
7043
-	*/
7039
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a date
7040
+	 *
7041
+	 * @return Array the airport list
7042
+	 *
7043
+	 */
7044 7044
 	public function countAllArrivalAirportCountriesByDate($date, $filters = array())
7045 7045
 	{
7046 7046
 		global $globalTimezone, $globalDBdriver;
@@ -7083,11 +7083,11 @@  discard block
 block discarded – undo
7083 7083
 	
7084 7084
 	
7085 7085
 	/**
7086
-	* Gets all arrival airports of the airplanes that have flown over based on a ident/callsign
7087
-	*
7088
-	* @return Array the airport list
7089
-	*
7090
-	*/
7086
+	 * Gets all arrival airports of the airplanes that have flown over based on a ident/callsign
7087
+	 *
7088
+	 * @return Array the airport list
7089
+	 *
7090
+	 */
7091 7091
 	public function countAllArrivalAirportsByIdent($ident,$filters = array())
7092 7092
 	{
7093 7093
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7120,11 +7120,11 @@  discard block
 block discarded – undo
7120 7120
 	
7121 7121
 	
7122 7122
 	/**
7123
-	* Gets all arrival airports by country of the airplanes that have flown over based on a callsign/ident
7124
-	*
7125
-	* @return Array the airport list
7126
-	*
7127
-	*/
7123
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a callsign/ident
7124
+	 *
7125
+	 * @return Array the airport list
7126
+	 *
7127
+	 */
7128 7128
 	public function countAllArrivalAirportCountriesByIdent($ident, $filters = array())
7129 7129
 	{
7130 7130
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7155,11 +7155,11 @@  discard block
 block discarded – undo
7155 7155
 	
7156 7156
 	
7157 7157
 	/**
7158
-	* Gets all arrival airports of the airplanes that have flown over based on a country
7159
-	*
7160
-	* @return Array the airport list
7161
-	*
7162
-	*/
7158
+	 * Gets all arrival airports of the airplanes that have flown over based on a country
7159
+	 *
7160
+	 * @return Array the airport list
7161
+	 *
7162
+	 */
7163 7163
 	public function countAllArrivalAirportsByCountry($country,$filters = array())
7164 7164
 	{
7165 7165
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7192,11 +7192,11 @@  discard block
 block discarded – undo
7192 7192
 	
7193 7193
 	
7194 7194
 	/**
7195
-	* Gets all arrival airports by country of the airplanes that have flown over based on a country
7196
-	*
7197
-	* @return Array the airport list
7198
-	*
7199
-	*/
7195
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a country
7196
+	 *
7197
+	 * @return Array the airport list
7198
+	 *
7199
+	 */
7200 7200
 	public function countAllArrivalAirportCountriesByCountry($country,$filters = array())
7201 7201
 	{
7202 7202
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7227,11 +7227,11 @@  discard block
 block discarded – undo
7227 7227
 
7228 7228
 
7229 7229
 	/**
7230
-	* Counts all airport departure countries
7231
-	*
7232
-	* @return Array the airport departure list
7233
-	*
7234
-	*/
7230
+	 * Counts all airport departure countries
7231
+	 *
7232
+	 * @return Array the airport departure list
7233
+	 *
7234
+	 */
7235 7235
 	public function countAllDepartureCountries($filters = array())
7236 7236
 	{
7237 7237
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7261,11 +7261,11 @@  discard block
 block discarded – undo
7261 7261
 	
7262 7262
 	
7263 7263
 	/**
7264
-	* Counts all airport arrival countries
7265
-	*
7266
-	* @return Array the airport arrival list
7267
-	*
7268
-	*/
7264
+	 * Counts all airport arrival countries
7265
+	 *
7266
+	 * @return Array the airport arrival list
7267
+	 *
7268
+	 */
7269 7269
 	public function countAllArrivalCountries($limit = true,$filters = array())
7270 7270
 	{
7271 7271
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7298,11 +7298,11 @@  discard block
 block discarded – undo
7298 7298
 
7299 7299
 
7300 7300
 	/**
7301
-	* Gets all route combinations
7302
-	*
7303
-	* @return Array the route list
7304
-	*
7305
-	*/
7301
+	 * Gets all route combinations
7302
+	 *
7303
+	 * @return Array the route list
7304
+	 *
7305
+	 */
7306 7306
 	public function countAllRoutes($filters = array())
7307 7307
 	{
7308 7308
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7341,11 +7341,11 @@  discard block
 block discarded – undo
7341 7341
 	
7342 7342
 	
7343 7343
 	/**
7344
-	* Gets all route combinations based on an aircraft
7345
-	*
7346
-	* @return Array the route list
7347
-	*
7348
-	*/
7344
+	 * Gets all route combinations based on an aircraft
7345
+	 *
7346
+	 * @return Array the route list
7347
+	 *
7348
+	 */
7349 7349
 	public function countAllRoutesByAircraft($aircraft_icao,$filters = array())
7350 7350
 	{
7351 7351
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7381,11 +7381,11 @@  discard block
 block discarded – undo
7381 7381
 	
7382 7382
 	
7383 7383
 	/**
7384
-	* Gets all route combinations based on an aircraft registration
7385
-	*
7386
-	* @return Array the route list
7387
-	*
7388
-	*/
7384
+	 * Gets all route combinations based on an aircraft registration
7385
+	 *
7386
+	 * @return Array the route list
7387
+	 *
7388
+	 */
7389 7389
 	public function countAllRoutesByRegistration($registration, $filters = array())
7390 7390
 	{
7391 7391
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7423,11 +7423,11 @@  discard block
 block discarded – undo
7423 7423
 	
7424 7424
 	
7425 7425
 	/**
7426
-	* Gets all route combinations based on an airline
7427
-	*
7428
-	* @return Array the route list
7429
-	*
7430
-	*/
7426
+	 * Gets all route combinations based on an airline
7427
+	 *
7428
+	 * @return Array the route list
7429
+	 *
7430
+	 */
7431 7431
 	public function countAllRoutesByAirline($airline_icao, $filters = array())
7432 7432
 	{
7433 7433
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7465,11 +7465,11 @@  discard block
 block discarded – undo
7465 7465
 	
7466 7466
 	
7467 7467
 	/**
7468
-	* Gets all route combinations based on an airport
7469
-	*
7470
-	* @return Array the route list
7471
-	*
7472
-	*/
7468
+	 * Gets all route combinations based on an airport
7469
+	 *
7470
+	 * @return Array the route list
7471
+	 *
7472
+	 */
7473 7473
 	public function countAllRoutesByAirport($airport_icao, $filters = array())
7474 7474
 	{
7475 7475
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7506,11 +7506,11 @@  discard block
 block discarded – undo
7506 7506
 	
7507 7507
 	
7508 7508
 	/**
7509
-	* Gets all route combinations based on an country
7510
-	*
7511
-	* @return Array the route list
7512
-	*
7513
-	*/
7509
+	 * Gets all route combinations based on an country
7510
+	 *
7511
+	 * @return Array the route list
7512
+	 *
7513
+	 */
7514 7514
 	public function countAllRoutesByCountry($country, $filters = array())
7515 7515
 	{
7516 7516
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7546,11 +7546,11 @@  discard block
 block discarded – undo
7546 7546
 
7547 7547
 
7548 7548
 	/**
7549
-	* Gets all route combinations based on an date
7550
-	*
7551
-	* @return Array the route list
7552
-	*
7553
-	*/
7549
+	 * Gets all route combinations based on an date
7550
+	 *
7551
+	 * @return Array the route list
7552
+	 *
7553
+	 */
7554 7554
 	public function countAllRoutesByDate($date, $filters = array())
7555 7555
 	{
7556 7556
 		global $globalTimezone, $globalDBdriver;
@@ -7600,11 +7600,11 @@  discard block
 block discarded – undo
7600 7600
 	
7601 7601
 	
7602 7602
 	/**
7603
-	* Gets all route combinations based on an ident/callsign
7604
-	*
7605
-	* @return Array the route list
7606
-	*
7607
-	*/
7603
+	 * Gets all route combinations based on an ident/callsign
7604
+	 *
7605
+	 * @return Array the route list
7606
+	 *
7607
+	 */
7608 7608
 	public function countAllRoutesByIdent($ident, $filters = array())
7609 7609
 	{
7610 7610
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7641,11 +7641,11 @@  discard block
 block discarded – undo
7641 7641
 	
7642 7642
 	
7643 7643
 	/**
7644
-	* Gets all route combinations based on an manufacturer
7645
-	*
7646
-	* @return Array the route list
7647
-	*
7648
-	*/
7644
+	 * Gets all route combinations based on an manufacturer
7645
+	 *
7646
+	 * @return Array the route list
7647
+	 *
7648
+	 */
7649 7649
 	public function countAllRoutesByManufacturer($aircraft_manufacturer, $filters = array())
7650 7650
 	{
7651 7651
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7683,11 +7683,11 @@  discard block
 block discarded – undo
7683 7683
 	
7684 7684
 	
7685 7685
 	/**
7686
-	* Gets all route combinations with waypoints
7687
-	*
7688
-	* @return Array the route list
7689
-	*
7690
-	*/
7686
+	 * Gets all route combinations with waypoints
7687
+	 *
7688
+	 * @return Array the route list
7689
+	 *
7690
+	 */
7691 7691
 	public function countAllRoutesWithWaypoints($filters = array())
7692 7692
 	{
7693 7693
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7724,11 +7724,11 @@  discard block
 block discarded – undo
7724 7724
 	}
7725 7725
 	
7726 7726
 	/**
7727
-	* Gets all callsigns that have flown over
7728
-	*
7729
-	* @return Array the callsign list
7730
-	*
7731
-	*/
7727
+	 * Gets all callsigns that have flown over
7728
+	 *
7729
+	 * @return Array the callsign list
7730
+	 *
7731
+	 */
7732 7732
 	public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
7733 7733
 	{
7734 7734
 		global $globalDBdriver;
@@ -7766,11 +7766,11 @@  discard block
 block discarded – undo
7766 7766
 	}
7767 7767
 
7768 7768
 	/**
7769
-	* Gets all callsigns that have flown over
7770
-	*
7771
-	* @return Array the callsign list
7772
-	*
7773
-	*/
7769
+	 * Gets all callsigns that have flown over
7770
+	 *
7771
+	 * @return Array the callsign list
7772
+	 *
7773
+	 */
7774 7774
 	public function countAllCallsignsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
7775 7775
 	{
7776 7776
 		global $globalDBdriver;
@@ -7811,11 +7811,11 @@  discard block
 block discarded – undo
7811 7811
 
7812 7812
 
7813 7813
 	/**
7814
-	* Counts all dates
7815
-	*
7816
-	* @return Array the date list
7817
-	*
7818
-	*/
7814
+	 * Counts all dates
7815
+	 *
7816
+	 * @return Array the date list
7817
+	 *
7818
+	 */
7819 7819
 	public function countAllDates($filters = array())
7820 7820
 	{
7821 7821
 		global $globalTimezone, $globalDBdriver;
@@ -7860,11 +7860,11 @@  discard block
 block discarded – undo
7860 7860
 	}
7861 7861
 	
7862 7862
 	/**
7863
-	* Counts all dates
7864
-	*
7865
-	* @return Array the date list
7866
-	*
7867
-	*/
7863
+	 * Counts all dates
7864
+	 *
7865
+	 * @return Array the date list
7866
+	 *
7867
+	 */
7868 7868
 	public function countAllDatesByAirlines($filters = array())
7869 7869
 	{
7870 7870
 		global $globalTimezone, $globalDBdriver;
@@ -7909,11 +7909,11 @@  discard block
 block discarded – undo
7909 7909
 	}	
7910 7910
 	
7911 7911
 	/**
7912
-	* Counts all dates during the last 7 days
7913
-	*
7914
-	* @return Array the date list
7915
-	*
7916
-	*/
7912
+	 * Counts all dates during the last 7 days
7913
+	 *
7914
+	 * @return Array the date list
7915
+	 *
7916
+	 */
7917 7917
 	public function countAllDatesLast7Days($filters = array())
7918 7918
 	{
7919 7919
 		global $globalTimezone, $globalDBdriver;
@@ -7935,7 +7935,7 @@  discard block
 block discarded – undo
7935 7935
 			$query .= " GROUP BY date_name 
7936 7936
 								ORDER BY date_name ASC";
7937 7937
 			$query_data = array(':offset' => $offset);
7938
-    		}
7938
+			}
7939 7939
 		
7940 7940
 		$sth = $this->db->prepare($query);
7941 7941
 		$sth->execute($query_data);
@@ -7955,11 +7955,11 @@  discard block
 block discarded – undo
7955 7955
 	}
7956 7956
 
7957 7957
 	/**
7958
-	* Counts all dates during the last month
7959
-	*
7960
-	* @return Array the date list
7961
-	*
7962
-	*/
7958
+	 * Counts all dates during the last month
7959
+	 *
7960
+	 * @return Array the date list
7961
+	 *
7962
+	 */
7963 7963
 	public function countAllDatesLastMonth($filters = array())
7964 7964
 	{
7965 7965
 		global $globalTimezone, $globalDBdriver;
@@ -7981,7 +7981,7 @@  discard block
 block discarded – undo
7981 7981
 			$query .= " GROUP BY date_name 
7982 7982
 								ORDER BY date_name ASC";
7983 7983
 			$query_data = array(':offset' => $offset);
7984
-    		}
7984
+			}
7985 7985
 		
7986 7986
 		$sth = $this->db->prepare($query);
7987 7987
 		$sth->execute($query_data);
@@ -8002,11 +8002,11 @@  discard block
 block discarded – undo
8002 8002
 
8003 8003
 
8004 8004
 	/**
8005
-	* Counts all dates during the last month
8006
-	*
8007
-	* @return Array the date list
8008
-	*
8009
-	*/
8005
+	 * Counts all dates during the last month
8006
+	 *
8007
+	 * @return Array the date list
8008
+	 *
8009
+	 */
8010 8010
 	public function countAllDatesLastMonthByAirlines($filters = array())
8011 8011
 	{
8012 8012
 		global $globalTimezone, $globalDBdriver;
@@ -8029,7 +8029,7 @@  discard block
 block discarded – undo
8029 8029
 								GROUP BY spotter_output.airline_icao, date_name 
8030 8030
 								ORDER BY date_name ASC";
8031 8031
 			$query_data = array(':offset' => $offset);
8032
-    		}
8032
+			}
8033 8033
 		
8034 8034
 		$sth = $this->db->prepare($query);
8035 8035
 		$sth->execute($query_data);
@@ -8051,11 +8051,11 @@  discard block
 block discarded – undo
8051 8051
 	
8052 8052
 
8053 8053
 	/**
8054
-	* Counts all month
8055
-	*
8056
-	* @return Array the month list
8057
-	*
8058
-	*/
8054
+	 * Counts all month
8055
+	 *
8056
+	 * @return Array the month list
8057
+	 *
8058
+	 */
8059 8059
 	public function countAllMonths($filters = array())
8060 8060
 	{
8061 8061
 		global $globalTimezone, $globalDBdriver;
@@ -8097,11 +8097,11 @@  discard block
 block discarded – undo
8097 8097
 	}
8098 8098
 
8099 8099
 	/**
8100
-	* Counts all month
8101
-	*
8102
-	* @return Array the month list
8103
-	*
8104
-	*/
8100
+	 * Counts all month
8101
+	 *
8102
+	 * @return Array the month list
8103
+	 *
8104
+	 */
8105 8105
 	public function countAllMonthsByAirlines($filters = array())
8106 8106
 	{
8107 8107
 		global $globalTimezone, $globalDBdriver;
@@ -8146,11 +8146,11 @@  discard block
 block discarded – undo
8146 8146
 	}
8147 8147
 
8148 8148
 	/**
8149
-	* Counts all military month
8150
-	*
8151
-	* @return Array the month list
8152
-	*
8153
-	*/
8149
+	 * Counts all military month
8150
+	 *
8151
+	 * @return Array the month list
8152
+	 *
8153
+	 */
8154 8154
 	public function countAllMilitaryMonths($filters = array())
8155 8155
 	{
8156 8156
 		global $globalTimezone, $globalDBdriver;
@@ -8191,11 +8191,11 @@  discard block
 block discarded – undo
8191 8191
 	}
8192 8192
 	
8193 8193
 	/**
8194
-	* Counts all month owners
8195
-	*
8196
-	* @return Array the month list
8197
-	*
8198
-	*/
8194
+	 * Counts all month owners
8195
+	 *
8196
+	 * @return Array the month list
8197
+	 *
8198
+	 */
8199 8199
 	public function countAllMonthsOwners($filters = array())
8200 8200
 	{
8201 8201
 		global $globalTimezone, $globalDBdriver;
@@ -8237,11 +8237,11 @@  discard block
 block discarded – undo
8237 8237
 	}
8238 8238
 	
8239 8239
 	/**
8240
-	* Counts all month owners
8241
-	*
8242
-	* @return Array the month list
8243
-	*
8244
-	*/
8240
+	 * Counts all month owners
8241
+	 *
8242
+	 * @return Array the month list
8243
+	 *
8244
+	 */
8245 8245
 	public function countAllMonthsOwnersByAirlines($filters = array())
8246 8246
 	{
8247 8247
 		global $globalTimezone, $globalDBdriver;
@@ -8284,11 +8284,11 @@  discard block
 block discarded – undo
8284 8284
 	}
8285 8285
 
8286 8286
 	/**
8287
-	* Counts all month pilot
8288
-	*
8289
-	* @return Array the month list
8290
-	*
8291
-	*/
8287
+	 * Counts all month pilot
8288
+	 *
8289
+	 * @return Array the month list
8290
+	 *
8291
+	 */
8292 8292
 	public function countAllMonthsPilots($filters = array())
8293 8293
 	{
8294 8294
 		global $globalTimezone, $globalDBdriver;
@@ -8330,11 +8330,11 @@  discard block
 block discarded – undo
8330 8330
 	}
8331 8331
 	
8332 8332
 	/**
8333
-	* Counts all month pilot
8334
-	*
8335
-	* @return Array the month list
8336
-	*
8337
-	*/
8333
+	 * Counts all month pilot
8334
+	 *
8335
+	 * @return Array the month list
8336
+	 *
8337
+	 */
8338 8338
 	public function countAllMonthsPilotsByAirlines($filters = array())
8339 8339
 	{
8340 8340
 		global $globalTimezone, $globalDBdriver;
@@ -8377,11 +8377,11 @@  discard block
 block discarded – undo
8377 8377
 	}
8378 8378
 
8379 8379
 	/**
8380
-	* Counts all month airline
8381
-	*
8382
-	* @return Array the month list
8383
-	*
8384
-	*/
8380
+	 * Counts all month airline
8381
+	 *
8382
+	 * @return Array the month list
8383
+	 *
8384
+	 */
8385 8385
 	public function countAllMonthsAirlines($filters = array())
8386 8386
 	{
8387 8387
 		global $globalTimezone, $globalDBdriver;
@@ -8423,11 +8423,11 @@  discard block
 block discarded – undo
8423 8423
 	}
8424 8424
 	
8425 8425
 	/**
8426
-	* Counts all month aircraft
8427
-	*
8428
-	* @return Array the month list
8429
-	*
8430
-	*/
8426
+	 * Counts all month aircraft
8427
+	 *
8428
+	 * @return Array the month list
8429
+	 *
8430
+	 */
8431 8431
 	public function countAllMonthsAircrafts($filters = array())
8432 8432
 	{
8433 8433
 		global $globalTimezone, $globalDBdriver;
@@ -8470,11 +8470,11 @@  discard block
 block discarded – undo
8470 8470
 	
8471 8471
 
8472 8472
 	/**
8473
-	* Counts all month aircraft
8474
-	*
8475
-	* @return Array the month list
8476
-	*
8477
-	*/
8473
+	 * Counts all month aircraft
8474
+	 *
8475
+	 * @return Array the month list
8476
+	 *
8477
+	 */
8478 8478
 	public function countAllMonthsAircraftsByAirlines($filters = array())
8479 8479
 	{
8480 8480
 		global $globalTimezone, $globalDBdriver;
@@ -8517,11 +8517,11 @@  discard block
 block discarded – undo
8517 8517
 	}
8518 8518
 
8519 8519
 	/**
8520
-	* Counts all month real arrival
8521
-	*
8522
-	* @return Array the month list
8523
-	*
8524
-	*/
8520
+	 * Counts all month real arrival
8521
+	 *
8522
+	 * @return Array the month list
8523
+	 *
8524
+	 */
8525 8525
 	public function countAllMonthsRealArrivals($filters = array())
8526 8526
 	{
8527 8527
 		global $globalTimezone, $globalDBdriver;
@@ -8564,11 +8564,11 @@  discard block
 block discarded – undo
8564 8564
 	
8565 8565
 
8566 8566
 	/**
8567
-	* Counts all month real arrival
8568
-	*
8569
-	* @return Array the month list
8570
-	*
8571
-	*/
8567
+	 * Counts all month real arrival
8568
+	 *
8569
+	 * @return Array the month list
8570
+	 *
8571
+	 */
8572 8572
 	public function countAllMonthsRealArrivalsByAirlines($filters = array())
8573 8573
 	{
8574 8574
 		global $globalTimezone, $globalDBdriver;
@@ -8612,11 +8612,11 @@  discard block
 block discarded – undo
8612 8612
 	
8613 8613
 
8614 8614
 	/**
8615
-	* Counts all dates during the last year
8616
-	*
8617
-	* @return Array the date list
8618
-	*
8619
-	*/
8615
+	 * Counts all dates during the last year
8616
+	 *
8617
+	 * @return Array the date list
8618
+	 *
8619
+	 */
8620 8620
 	public function countAllMonthsLastYear($filters)
8621 8621
 	{
8622 8622
 		global $globalTimezone, $globalDBdriver;
@@ -8638,7 +8638,7 @@  discard block
 block discarded – undo
8638 8638
 			$query .= " GROUP BY year_name, month_name
8639 8639
 								ORDER BY year_name, month_name ASC";
8640 8640
 			$query_data = array(':offset' => $offset);
8641
-    		}
8641
+			}
8642 8642
 		
8643 8643
 		$sth = $this->db->prepare($query);
8644 8644
 		$sth->execute($query_data);
@@ -8661,11 +8661,11 @@  discard block
 block discarded – undo
8661 8661
 	
8662 8662
 	
8663 8663
 	/**
8664
-	* Counts all hours
8665
-	*
8666
-	* @return Array the hour list
8667
-	*
8668
-	*/
8664
+	 * Counts all hours
8665
+	 *
8666
+	 * @return Array the hour list
8667
+	 *
8668
+	 */
8669 8669
 	public function countAllHours($orderby,$filters = array())
8670 8670
 	{
8671 8671
 		global $globalTimezone, $globalDBdriver;
@@ -8726,11 +8726,11 @@  discard block
 block discarded – undo
8726 8726
 	}
8727 8727
 	
8728 8728
 	/**
8729
-	* Counts all hours
8730
-	*
8731
-	* @return Array the hour list
8732
-	*
8733
-	*/
8729
+	 * Counts all hours
8730
+	 *
8731
+	 * @return Array the hour list
8732
+	 *
8733
+	 */
8734 8734
 	public function countAllHoursByAirlines($orderby, $filters = array())
8735 8735
 	{
8736 8736
 		global $globalTimezone, $globalDBdriver;
@@ -8793,11 +8793,11 @@  discard block
 block discarded – undo
8793 8793
 
8794 8794
 
8795 8795
 	/**
8796
-	* Counts all hours by airline
8797
-	*
8798
-	* @return Array the hour list
8799
-	*
8800
-	*/
8796
+	 * Counts all hours by airline
8797
+	 *
8798
+	 * @return Array the hour list
8799
+	 *
8800
+	 */
8801 8801
 	public function countAllHoursByAirline($airline_icao, $filters = array())
8802 8802
 	{
8803 8803
 		global $globalTimezone, $globalDBdriver;
@@ -8843,11 +8843,11 @@  discard block
 block discarded – undo
8843 8843
 	
8844 8844
 	
8845 8845
 	/**
8846
-	* Counts all hours by aircraft
8847
-	*
8848
-	* @return Array the hour list
8849
-	*
8850
-	*/
8846
+	 * Counts all hours by aircraft
8847
+	 *
8848
+	 * @return Array the hour list
8849
+	 *
8850
+	 */
8851 8851
 	public function countAllHoursByAircraft($aircraft_icao, $filters = array())
8852 8852
 	{
8853 8853
 		global $globalTimezone, $globalDBdriver;
@@ -8890,11 +8890,11 @@  discard block
 block discarded – undo
8890 8890
 	
8891 8891
 	
8892 8892
 	/**
8893
-	* Counts all hours by aircraft registration
8894
-	*
8895
-	* @return Array the hour list
8896
-	*
8897
-	*/
8893
+	 * Counts all hours by aircraft registration
8894
+	 *
8895
+	 * @return Array the hour list
8896
+	 *
8897
+	 */
8898 8898
 	public function countAllHoursByRegistration($registration, $filters = array())
8899 8899
 	{
8900 8900
 		global $globalTimezone, $globalDBdriver;
@@ -8937,11 +8937,11 @@  discard block
 block discarded – undo
8937 8937
 	
8938 8938
 	
8939 8939
 	/**
8940
-	* Counts all hours by airport
8941
-	*
8942
-	* @return Array the hour list
8943
-	*
8944
-	*/
8940
+	 * Counts all hours by airport
8941
+	 *
8942
+	 * @return Array the hour list
8943
+	 *
8944
+	 */
8945 8945
 	public function countAllHoursByAirport($airport_icao, $filters = array())
8946 8946
 	{
8947 8947
 		global $globalTimezone, $globalDBdriver;
@@ -8985,11 +8985,11 @@  discard block
 block discarded – undo
8985 8985
 	
8986 8986
 	
8987 8987
 	/**
8988
-	* Counts all hours by manufacturer
8989
-	*
8990
-	* @return Array the hour list
8991
-	*
8992
-	*/
8988
+	 * Counts all hours by manufacturer
8989
+	 *
8990
+	 * @return Array the hour list
8991
+	 *
8992
+	 */
8993 8993
 	public function countAllHoursByManufacturer($aircraft_manufacturer,$filters =array())
8994 8994
 	{
8995 8995
 		global $globalTimezone, $globalDBdriver;
@@ -9033,11 +9033,11 @@  discard block
 block discarded – undo
9033 9033
 	
9034 9034
 	
9035 9035
 	/**
9036
-	* Counts all hours by date
9037
-	*
9038
-	* @return Array the hour list
9039
-	*
9040
-	*/
9036
+	 * Counts all hours by date
9037
+	 *
9038
+	 * @return Array the hour list
9039
+	 *
9040
+	 */
9041 9041
 	public function countAllHoursByDate($date, $filters = array())
9042 9042
 	{
9043 9043
 		global $globalTimezone, $globalDBdriver;
@@ -9081,11 +9081,11 @@  discard block
 block discarded – undo
9081 9081
 	
9082 9082
 	
9083 9083
 	/**
9084
-	* Counts all hours by a ident/callsign
9085
-	*
9086
-	* @return Array the hour list
9087
-	*
9088
-	*/
9084
+	 * Counts all hours by a ident/callsign
9085
+	 *
9086
+	 * @return Array the hour list
9087
+	 *
9088
+	 */
9089 9089
 	public function countAllHoursByIdent($ident, $filters = array())
9090 9090
 	{
9091 9091
 		global $globalTimezone, $globalDBdriver;
@@ -9130,11 +9130,11 @@  discard block
 block discarded – undo
9130 9130
 	
9131 9131
 	
9132 9132
 	/**
9133
-	* Counts all hours by route
9134
-	*
9135
-	* @return Array the hour list
9136
-	*
9137
-	*/
9133
+	 * Counts all hours by route
9134
+	 *
9135
+	 * @return Array the hour list
9136
+	 *
9137
+	 */
9138 9138
 	public function countAllHoursByRoute($departure_airport_icao, $arrival_airport_icao, $filters =array())
9139 9139
 	{
9140 9140
 		global $globalTimezone, $globalDBdriver;
@@ -9178,11 +9178,11 @@  discard block
 block discarded – undo
9178 9178
 	
9179 9179
 	
9180 9180
 	/**
9181
-	* Counts all hours by country
9182
-	*
9183
-	* @return Array the hour list
9184
-	*
9185
-	*/
9181
+	 * Counts all hours by country
9182
+	 *
9183
+	 * @return Array the hour list
9184
+	 *
9185
+	 */
9186 9186
 	public function countAllHoursByCountry($country, $filters = array())
9187 9187
 	{
9188 9188
 		global $globalTimezone, $globalDBdriver;
@@ -9227,11 +9227,11 @@  discard block
 block discarded – undo
9227 9227
 
9228 9228
 
9229 9229
 	/**
9230
-	* Counts all aircraft that have flown over
9231
-	*
9232
-	* @return Integer the number of aircrafts
9233
-	*
9234
-	*/
9230
+	 * Counts all aircraft that have flown over
9231
+	 *
9232
+	 * @return Integer the number of aircrafts
9233
+	 *
9234
+	 */
9235 9235
 	public function countOverallAircrafts($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 flight that really arrival
9247
-	*
9248
-	* @return Integer the number of aircrafts
9249
-	*
9250
-	*/
9246
+	 * Counts all flight that really arrival
9247
+	 *
9248
+	 * @return Integer the number of aircrafts
9249
+	 *
9250
+	 */
9251 9251
 	public function countOverallArrival($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 pilots that have flown over
9264
-	*
9265
-	* @return Integer the number of pilots
9266
-	*
9267
-	*/
9263
+	 * Counts all pilots that have flown over
9264
+	 *
9265
+	 * @return Integer the number of pilots
9266
+	 *
9267
+	 */
9268 9268
 	public function countOverallPilots($filters = array())
9269 9269
 	{
9270 9270
 		$filter_query = $this->getFilter($filters,true,true);
@@ -9276,11 +9276,11 @@  discard block
 block discarded – undo
9276 9276
 	}
9277 9277
 
9278 9278
 	/**
9279
-	* Counts all owners that have flown over
9280
-	*
9281
-	* @return Integer the number of owners
9282
-	*
9283
-	*/
9279
+	 * Counts all owners that have flown over
9280
+	 *
9281
+	 * @return Integer the number of owners
9282
+	 *
9283
+	 */
9284 9284
 	public function countOverallOwners($filters = array())
9285 9285
 	{
9286 9286
 		$filter_query = $this->getFilter($filters,true,true);
@@ -9293,11 +9293,11 @@  discard block
 block discarded – undo
9293 9293
 	
9294 9294
 	
9295 9295
 	/**
9296
-	* Counts all flights that have flown over
9297
-	*
9298
-	* @return Integer the number of flights
9299
-	*
9300
-	*/
9296
+	 * Counts all flights that have flown over
9297
+	 *
9298
+	 * @return Integer the number of flights
9299
+	 *
9300
+	 */
9301 9301
 	public function countOverallFlights($filters = array())
9302 9302
 	{
9303 9303
 		$query  = "SELECT COUNT(spotter_output.spotter_id) AS flight_count  
@@ -9310,11 +9310,11 @@  discard block
 block discarded – undo
9310 9310
 	}
9311 9311
 	
9312 9312
 	/**
9313
-	* Counts all military flights that have flown over
9314
-	*
9315
-	* @return Integer the number of flights
9316
-	*
9317
-	*/
9313
+	 * Counts all military flights that have flown over
9314
+	 *
9315
+	 * @return Integer the number of flights
9316
+	 *
9317
+	 */
9318 9318
 	public function countOverallMilitaryFlights($filters = array())
9319 9319
 	{
9320 9320
 		$filter_query = $this->getFilter($filters,true,true);
@@ -9329,11 +9329,11 @@  discard block
 block discarded – undo
9329 9329
 	
9330 9330
 	
9331 9331
 	/**
9332
-	* Counts all airlines that have flown over
9333
-	*
9334
-	* @return Integer the number of airlines
9335
-	*
9336
-	*/
9332
+	 * Counts all airlines that have flown over
9333
+	 *
9334
+	 * @return Integer the number of airlines
9335
+	 *
9336
+	 */
9337 9337
 	public function countOverallAirlines($filters = array())
9338 9338
 	{
9339 9339
 		$query  = "SELECT COUNT(DISTINCT spotter_output.airline_name) AS airline_count 
@@ -9347,11 +9347,11 @@  discard block
 block discarded – undo
9347 9347
 
9348 9348
   
9349 9349
 	/**
9350
-	* Counts all hours of today
9351
-	*
9352
-	* @return Array the hour list
9353
-	*
9354
-	*/
9350
+	 * Counts all hours of today
9351
+	 *
9352
+	 * @return Array the hour list
9353
+	 *
9354
+	 */
9355 9355
 	public function countAllHoursFromToday($filters = array())
9356 9356
 	{
9357 9357
 		global $globalTimezone, $globalDBdriver;
@@ -9391,11 +9391,11 @@  discard block
 block discarded – undo
9391 9391
 	}
9392 9392
     
9393 9393
 	/**
9394
-	* Gets all the spotter information based on calculated upcoming flights
9395
-	*
9396
-	* @return Array the spotter information
9397
-	*
9398
-	*/
9394
+	 * Gets all the spotter information based on calculated upcoming flights
9395
+	 *
9396
+	 * @return Array the spotter information
9397
+	 *
9398
+	 */
9399 9399
 	public function getUpcomingFlights($limit = '', $sort = '', $filters = array())
9400 9400
 	{
9401 9401
 		global $global_query, $globalDBdriver, $globalTimezone;
@@ -9470,12 +9470,12 @@  discard block
 block discarded – undo
9470 9470
 	}
9471 9471
     
9472 9472
     
9473
-     /**
9474
-	* Gets the Barrie Spotter ID based on the FlightAware ID
9475
-	*
9476
-	* @return Integer the Barrie Spotter ID
9473
+	 /**
9474
+	  * Gets the Barrie Spotter ID based on the FlightAware ID
9475
+	  *
9476
+	  * @return Integer the Barrie Spotter ID
9477 9477
 q	*
9478
-	*/
9478
+	  */
9479 9479
 	public function getSpotterIDBasedOnFlightAwareID($flightaware_id)
9480 9480
 	{
9481 9481
 		$flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING);
@@ -9496,13 +9496,13 @@  discard block
 block discarded – undo
9496 9496
   
9497 9497
  
9498 9498
 	/**
9499
-	* Parses a date string
9500
-	*
9501
-	* @param String $dateString the date string
9502
-	* @param String $timezone the timezone of a user
9503
-	* @return Array the time information
9504
-	*
9505
-	*/
9499
+	 * Parses a date string
9500
+	 *
9501
+	 * @param String $dateString the date string
9502
+	 * @param String $timezone the timezone of a user
9503
+	 * @return Array the time information
9504
+	 *
9505
+	 */
9506 9506
 	public function parseDateString($dateString, $timezone = '')
9507 9507
 	{
9508 9508
 		$time_array = array();
@@ -9538,12 +9538,12 @@  discard block
 block discarded – undo
9538 9538
 	
9539 9539
 	
9540 9540
 	/**
9541
-	* Parses the direction degrees to working
9542
-	*
9543
-	* @param Float $direction the direction in degrees
9544
-	* @return Array the direction information
9545
-	*
9546
-	*/
9541
+	 * Parses the direction degrees to working
9542
+	 *
9543
+	 * @param Float $direction the direction in degrees
9544
+	 * @return Array the direction information
9545
+	 *
9546
+	 */
9547 9547
 	public function parseDirection($direction = 0)
9548 9548
 	{
9549 9549
 		if ($direction == '') $direction = 0;
@@ -9622,12 +9622,12 @@  discard block
 block discarded – undo
9622 9622
 	
9623 9623
 	
9624 9624
 	/**
9625
-	* Gets the aircraft registration
9626
-	*
9627
-	* @param String $flightaware_id the flight aware id
9628
-	* @return String the aircraft registration
9629
-	*
9630
-	*/
9625
+	 * Gets the aircraft registration
9626
+	 *
9627
+	 * @param String $flightaware_id the flight aware id
9628
+	 * @return String the aircraft registration
9629
+	 *
9630
+	 */
9631 9631
 	
9632 9632
 	public function getAircraftRegistration($flightaware_id)
9633 9633
 	{
@@ -9656,12 +9656,12 @@  discard block
 block discarded – undo
9656 9656
 
9657 9657
 
9658 9658
 	/**
9659
-	* Gets the aircraft registration from ModeS
9660
-	*
9661
-	* @param String $aircraft_modes the flight ModeS in hex
9662
-	* @return String the aircraft registration
9663
-	*
9664
-	*/
9659
+	 * Gets the aircraft registration from ModeS
9660
+	 *
9661
+	 * @param String $aircraft_modes the flight ModeS in hex
9662
+	 * @return String the aircraft registration
9663
+	 *
9664
+	 */
9665 9665
 	public function getAircraftRegistrationBymodeS($aircraft_modes)
9666 9666
 	{
9667 9667
 		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
@@ -9674,19 +9674,19 @@  discard block
 block discarded – undo
9674 9674
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
9675 9675
 		$sth->closeCursor();
9676 9676
 		if (count($row) > 0) {
9677
-		    //return $row['Registration'];
9678
-		    return $row['registration'];
9677
+			//return $row['Registration'];
9678
+			return $row['registration'];
9679 9679
 		} else return '';
9680 9680
 	
9681 9681
 	}
9682 9682
 
9683 9683
 	/**
9684
-	* Gets the aircraft type from ModeS
9685
-	*
9686
-	* @param String $aircraft_modes the flight ModeS in hex
9687
-	* @return String the aircraft type
9688
-	*
9689
-	*/
9684
+	 * Gets the aircraft type from ModeS
9685
+	 *
9686
+	 * @param String $aircraft_modes the flight ModeS in hex
9687
+	 * @return String the aircraft type
9688
+	 *
9689
+	 */
9690 9690
 	public function getAircraftTypeBymodeS($aircraft_modes)
9691 9691
 	{
9692 9692
 		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
@@ -9699,19 +9699,19 @@  discard block
 block discarded – undo
9699 9699
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
9700 9700
 		$sth->closeCursor();
9701 9701
 		if (count($row) > 0) {
9702
-		    if ($row['type_flight'] == null) return '';
9703
-		    else return $row['type_flight'];
9702
+			if ($row['type_flight'] == null) return '';
9703
+			else return $row['type_flight'];
9704 9704
 		} else return '';
9705 9705
 	
9706 9706
 	}
9707 9707
 
9708 9708
 	/**
9709
-	* Gets Country from latitude/longitude
9710
-	*
9711
-	* @param Float $latitude latitute of the flight
9712
-	* @param Float $longitude longitute of the flight
9713
-	* @return String the countrie
9714
-	*/
9709
+	 * Gets Country from latitude/longitude
9710
+	 *
9711
+	 * @param Float $latitude latitute of the flight
9712
+	 * @param Float $longitude longitute of the flight
9713
+	 * @return String the countrie
9714
+	 */
9715 9715
 	public function getCountryFromLatitudeLongitude($latitude,$longitude)
9716 9716
 	{
9717 9717
 		global $globalDBdriver, $globalDebug;
@@ -9748,11 +9748,11 @@  discard block
 block discarded – undo
9748 9748
 	}
9749 9749
 
9750 9750
 	/**
9751
-	* Gets Country from iso2
9752
-	*
9753
-	* @param String $iso2 ISO2 country code
9754
-	* @return String the countrie
9755
-	*/
9751
+	 * Gets Country from iso2
9752
+	 *
9753
+	 * @param String $iso2 ISO2 country code
9754
+	 * @return String the countrie
9755
+	 */
9756 9756
 	public function getCountryFromISO2($iso2)
9757 9757
 	{
9758 9758
 		global $globalDBdriver, $globalDebug;
@@ -9780,12 +9780,12 @@  discard block
 block discarded – undo
9780 9780
 	}
9781 9781
 
9782 9782
 	/**
9783
-	* converts the registration code using the country prefix
9784
-	*
9785
-	* @param String $registration the aircraft registration
9786
-	* @return String the aircraft registration
9787
-	*
9788
-	*/
9783
+	 * converts the registration code using the country prefix
9784
+	 *
9785
+	 * @param String $registration the aircraft registration
9786
+	 * @return String the aircraft registration
9787
+	 *
9788
+	 */
9789 9789
 	public function convertAircraftRegistration($registration)
9790 9790
 	{
9791 9791
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -9837,12 +9837,12 @@  discard block
 block discarded – undo
9837 9837
 	}
9838 9838
 
9839 9839
 	/**
9840
-	* Country from the registration code
9841
-	*
9842
-	* @param String $registration the aircraft registration
9843
-	* @return String the country
9844
-	*
9845
-	*/
9840
+	 * Country from the registration code
9841
+	 *
9842
+	 * @param String $registration the aircraft registration
9843
+	 * @return String the country
9844
+	 *
9845
+	 */
9846 9846
 	public function countryFromAircraftRegistration($registration)
9847 9847
 	{
9848 9848
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -9861,8 +9861,8 @@  discard block
 block discarded – undo
9861 9861
 				$country = $row['country'];
9862 9862
 			}
9863 9863
 		} else {
9864
-    			$registration_1 = substr($registration, 0, 1);
9865
-		        $registration_2 = substr($registration, 0, 2);
9864
+				$registration_1 = substr($registration, 0, 1);
9865
+				$registration_2 = substr($registration, 0, 2);
9866 9866
 
9867 9867
 			$country = '';
9868 9868
 			//first get the prefix based on two characters
@@ -9898,12 +9898,12 @@  discard block
 block discarded – undo
9898 9898
 	}
9899 9899
 
9900 9900
 	/**
9901
-	* Country from the registration code
9902
-	*
9903
-	* @param String $registration the aircraft registration
9904
-	* @return String the country
9905
-	*
9906
-	*/
9901
+	 * Country from the registration code
9902
+	 *
9903
+	 * @param String $registration the aircraft registration
9904
+	 * @return String the country
9905
+	 *
9906
+	 */
9907 9907
 	public function countryFromAircraftRegistrationCode($registration)
9908 9908
 	{
9909 9909
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -9920,11 +9920,11 @@  discard block
 block discarded – undo
9920 9920
 	}
9921 9921
 	
9922 9922
 	/**
9923
-	* Set a new highlight value for a flight
9924
-	*
9925
-	* @param String $flightaware_id flightaware_id from spotter_output table
9926
-	* @param String $highlight New highlight value
9927
-	*/
9923
+	 * Set a new highlight value for a flight
9924
+	 *
9925
+	 * @param String $flightaware_id flightaware_id from spotter_output table
9926
+	 * @param String $highlight New highlight value
9927
+	 */
9928 9928
 	public function setHighlightFlight($flightaware_id,$highlight) {
9929 9929
 		
9930 9930
 		$query  = "UPDATE spotter_output SET highlight = :highlight WHERE flightaware_id = :flightaware_id";
@@ -9933,12 +9933,12 @@  discard block
 block discarded – undo
9933 9933
 	}
9934 9934
 	
9935 9935
 	/**
9936
-	* Gets the short url from bit.ly
9937
-	*
9938
-	* @param String $url the full url
9939
-	* @return String the bit.ly url
9940
-	*
9941
-	*/
9936
+	 * Gets the short url from bit.ly
9937
+	 *
9938
+	 * @param String $url the full url
9939
+	 * @return String the bit.ly url
9940
+	 *
9941
+	 */
9942 9942
 	public function getBitlyURL($url)
9943 9943
 	{
9944 9944
 		global $globalBitlyAccessToken;
@@ -10227,11 +10227,11 @@  discard block
 block discarded – undo
10227 10227
 			$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 
10228 10228
 	                      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)) 
10229 10229
 	                      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;";
10230
-                } else {
10230
+				} else {
10231 10231
 			$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 
10232 10232
 	                      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)) 
10233 10233
 	                      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;";
10234
-    		}
10234
+			}
10235 10235
 		$sth = $this->db->prepare($query);
10236 10236
 		$sth->execute();
10237 10237
 		return $sth->fetchAll(PDO::FETCH_ASSOC);
Please login to merge, or discard this patch.
require/class.ATC.php 1 patch
Indentation   +73 added lines, -73 removed lines patch added patch discarded remove patch
@@ -10,100 +10,100 @@
 block discarded – undo
10 10
 	}
11 11
 	
12 12
 	
13
-    /**
14
-    * Get SQL query part for filter used
15
-    * @param Array $filter the filter
16
-    * @return Array the SQL part
17
-    */
18
-    public function getFilter($filter = array(),$where = false,$and = false) {
13
+	/**
14
+	 * Get SQL query part for filter used
15
+	 * @param Array $filter the filter
16
+	 * @return Array the SQL part
17
+	 */
18
+	public function getFilter($filter = array(),$where = false,$and = false) {
19 19
 	global $globalFilter, $globalStatsFilters, $globalFilterName;
20 20
 	if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) {
21
-	    if (isset($globalStatsFilters[$globalFilterName][0]['source'])) {
21
+		if (isset($globalStatsFilters[$globalFilterName][0]['source'])) {
22 22
 		foreach($globalStatsFilters[$globalFilterName] as $source) {
23 23
 			if (isset($source['source'])) $filter['source'][] = $source['source'];
24 24
 		}
25
-	    } else {
25
+		} else {
26 26
 		$filter = $globalStatsFilters[$globalFilterName];
27
-	    }
27
+		}
28 28
 	}
29 29
 	if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter);
30 30
 	$filter_query_join = '';
31 31
 	$filter_query_where = '';
32 32
 	if (isset($filter['source']) && !empty($filter['source'])) {
33
-	    $filter_query_where = " WHERE format_source IN ('".implode("','",$filter['source'])."')";
33
+		$filter_query_where = " WHERE format_source IN ('".implode("','",$filter['source'])."')";
34 34
 	}
35 35
 	if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
36 36
 	elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND';
37 37
 	$filter_query = $filter_query_join.$filter_query_where;
38 38
 	return $filter_query;
39
-    }
39
+	}
40 40
 
41
-       public function getAll() {
42
-    		$filter_query = $this->getFilter(array());
43
-                $query = "SELECT * FROM atc".$filter_query;
44
-                $query_values = array();
45
-                 try {
46
-                        $sth = $this->db->prepare($query);
47
-                        $sth->execute($query_values);
48
-                } catch(PDOException $e) {
49
-                        return "error : ".$e->getMessage();
50
-                }
51
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
52
-                return $all;
53
-        }
41
+	   public function getAll() {
42
+			$filter_query = $this->getFilter(array());
43
+				$query = "SELECT * FROM atc".$filter_query;
44
+				$query_values = array();
45
+				 try {
46
+						$sth = $this->db->prepare($query);
47
+						$sth->execute($query_values);
48
+				} catch(PDOException $e) {
49
+						return "error : ".$e->getMessage();
50
+				}
51
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
52
+				return $all;
53
+		}
54 54
 
55
-       public function add($ident,$frequency,$latitude,$longitude,$range,$info,$date,$type = '',$ivao_id = '',$ivao_name = '',$format_source = '',$source_name = '') {
56
-    		$info = preg_replace('/[^(\x20-\x7F)]*/','',$info);
57
-    		$info = str_replace('^','<br />',$info);
58
-    		$info = str_replace('&amp;sect;','',$info);
59
-    		$info = str_replace('"','',$info);
60
-    		if ($type == '') $type = NULL;
61
-                $query = "INSERT INTO atc (ident,frequency,latitude,longitude,atc_range,info,atc_lastseen,type,ivao_id,ivao_name,format_source,source_name) VALUES (:ident,:frequency,:latitude,:longitude,:range,:info,:date,:type,:ivao_id,:ivao_name,:format_source,:source_name)";
62
-                $query_values = array(':ident' => $ident,':frequency' => $frequency,':latitude' => $latitude,':longitude' => $longitude,':range' => $range,':info' => $info,':date' => $date,':ivao_id' => $ivao_id,':ivao_name' => $ivao_name, ':type' => $type,':format_source' => $format_source,':source_name' => $source_name);
63
-                 try {
64
-                        $sth = $this->db->prepare($query);
65
-                        $sth->execute($query_values);
66
-                } catch(PDOException $e) {
67
-                        return "error : ".$e->getMessage();
68
-                }
69
-        }
55
+	   public function add($ident,$frequency,$latitude,$longitude,$range,$info,$date,$type = '',$ivao_id = '',$ivao_name = '',$format_source = '',$source_name = '') {
56
+			$info = preg_replace('/[^(\x20-\x7F)]*/','',$info);
57
+			$info = str_replace('^','<br />',$info);
58
+			$info = str_replace('&amp;sect;','',$info);
59
+			$info = str_replace('"','',$info);
60
+			if ($type == '') $type = NULL;
61
+				$query = "INSERT INTO atc (ident,frequency,latitude,longitude,atc_range,info,atc_lastseen,type,ivao_id,ivao_name,format_source,source_name) VALUES (:ident,:frequency,:latitude,:longitude,:range,:info,:date,:type,:ivao_id,:ivao_name,:format_source,:source_name)";
62
+				$query_values = array(':ident' => $ident,':frequency' => $frequency,':latitude' => $latitude,':longitude' => $longitude,':range' => $range,':info' => $info,':date' => $date,':ivao_id' => $ivao_id,':ivao_name' => $ivao_name, ':type' => $type,':format_source' => $format_source,':source_name' => $source_name);
63
+				 try {
64
+						$sth = $this->db->prepare($query);
65
+						$sth->execute($query_values);
66
+				} catch(PDOException $e) {
67
+						return "error : ".$e->getMessage();
68
+				}
69
+		}
70 70
 
71
-       public function deleteById($id) {
72
-                $query = "DELETE FROM atc WHERE atc_id = :id";
73
-                $query_values = array(':id' => $id);
74
-                 try {
75
-                        $sth = $this->db->prepare($query);
76
-                        $sth->execute($query_values);
77
-                } catch(PDOException $e) {
78
-                        return "error : ".$e->getMessage();
79
-                }
80
-        }
71
+	   public function deleteById($id) {
72
+				$query = "DELETE FROM atc WHERE atc_id = :id";
73
+				$query_values = array(':id' => $id);
74
+				 try {
75
+						$sth = $this->db->prepare($query);
76
+						$sth->execute($query_values);
77
+				} catch(PDOException $e) {
78
+						return "error : ".$e->getMessage();
79
+				}
80
+		}
81 81
 
82
-       public function deleteAll() {
83
-                $query = "DELETE FROM atc";
84
-                $query_values = array();
85
-                 try {
86
-                        $sth = $this->db->prepare($query);
87
-                        $sth->execute($query_values);
88
-                } catch(PDOException $e) {
89
-                        return "error : ".$e->getMessage();
90
-                }
91
-        }
82
+	   public function deleteAll() {
83
+				$query = "DELETE FROM atc";
84
+				$query_values = array();
85
+				 try {
86
+						$sth = $this->db->prepare($query);
87
+						$sth->execute($query_values);
88
+				} catch(PDOException $e) {
89
+						return "error : ".$e->getMessage();
90
+				}
91
+		}
92 92
 
93 93
 	public function deleteOldATC() {
94
-                global $globalDBdriver;
95
-                if ($globalDBdriver == 'mysql') {
96
-                        $query  = "DELETE FROM atc WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) >= atc.atc_lastseen";
97
-                } else {
98
-                        $query  = "DELETE FROM atc WHERE NOW() AT TIME ZONE 'UTC' - '1 HOUR'->INTERVAL >= atc.atc_lastseen";
99
-                }
100
-                try {
101
-                        $sth = $this->db->prepare($query);
102
-                        $sth->execute();
103
-                } catch(PDOException $e) {
104
-                        return "error";
105
-                }
106
-                return "success";
107
-        }
94
+				global $globalDBdriver;
95
+				if ($globalDBdriver == 'mysql') {
96
+						$query  = "DELETE FROM atc WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) >= atc.atc_lastseen";
97
+				} else {
98
+						$query  = "DELETE FROM atc WHERE NOW() AT TIME ZONE 'UTC' - '1 HOUR'->INTERVAL >= atc.atc_lastseen";
99
+				}
100
+				try {
101
+						$sth = $this->db->prepare($query);
102
+						$sth->execute();
103
+				} catch(PDOException $e) {
104
+						return "error";
105
+				}
106
+				return "success";
107
+		}
108 108
 }
109 109
 ?>
110 110
\ No newline at end of file
Please login to merge, or discard this patch.