Completed
Push — master ( 73f088...7f17b6 )
by Yannick
07:13
created
airport-statistics-departure-airport.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -3,8 +3,8 @@
 block discarded – undo
3 3
 require_once('require/class.Spotter.php');
4 4
 require_once('require/class.Language.php');
5 5
 if (!isset($_GET['airport'])) {
6
-        header('Location: '.$globalURL.'/airport');
7
-        die();
6
+		header('Location: '.$globalURL.'/airport');
7
+		die();
8 8
 }
9 9
 $airport = filter_input(INPUT_GET,'airport',FILTER_SANITIZE_STRING);
10 10
 $Spotter = new Spotter();
Please login to merge, or discard this patch.
flightid-overview.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -89,7 +89,7 @@
 block discarded – undo
89 89
                       function drawChart6() {
90 90
                         var data = google.visualization.arrayToDataTable([
91 91
                             ["Hour","'._("Altitude").'","'._("Speed").'"], ';
92
-                            $altitude_data = '';
92
+							$altitude_data = '';
93 93
 				foreach($all_data as $data)
94 94
 				{
95 95
 					$altitude_data .= '[ "'.date("G:i",strtotime($data['date']." UTC")).'",'.$data['altitude'].','.$data['ground_speed'].'],';
Please login to merge, or discard this patch.
aircraft-statistics-route.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -4,8 +4,8 @@
 block discarded – undo
4 4
 require_once('require/class.Language.php');
5 5
 
6 6
 if (!isset($_GET['aircraft_type'])) {
7
-        header('Location: '.$globalURL.'/aircraft');
8
-        die();
7
+		header('Location: '.$globalURL.'/aircraft');
8
+		die();
9 9
 }
10 10
 $aircraft_type = filter_input(INPUT_GET,'aircraft_type',FILTER_SANITIZE_STRING);
11 11
 $Spotter = new Spotter();
Please login to merge, or discard this patch.
require/class.SpotterImport.php 1 patch
Indentation   +343 added lines, -343 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 = '';
14
-    private $last_delete = '';
15
-    private $stats = array();
16
-    private $tmd = 0;
17
-    private $source_locatioon = array();
18
-    public $db = null;
19
-    public $nb = 0;
20
-
21
-    function __construct($dbc = null) {
12
+	private $all_flights = array();
13
+	private $last_delete_hourly = '';
14
+	private $last_delete = '';
15
+	private $stats = array();
16
+	private $tmd = 0;
17
+	private $source_locatioon = array();
18
+	public $db = null;
19
+	public $nb = 0;
20
+
21
+	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
-    function get_Schedule($id,$ident) {
43
+	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
 	
@@ -58,35 +58,35 @@  discard block
 block discarded – undo
58 58
 	$Translation = new Translation($dbc);
59 59
 	$operator = $Spotter->getOperator($ident);
60 60
 	if ($Schedule->checkSchedule($operator) == 0) {
61
-	    $operator = $Translation->checkTranslation($ident);
62
-	    if ($Schedule->checkSchedule($operator) == 0) {
61
+		$operator = $Translation->checkTranslation($ident);
62
+		if ($Schedule->checkSchedule($operator) == 0) {
63 63
 		$schedule = $Schedule->fetchSchedule($operator);
64 64
 		if (count($schedule) > 0) {
65
-		    if ($globalDebug) echo "-> Schedule info for ".$operator." (".$ident.")\n";
66
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport_time' => $schedule['DepartureTime']));
67
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('arrival_airport_time' => $schedule['ArrivalTime']));
68
-		    // Should also check if route schedule = route from DB
69
-		    if ($schedule['DepartureAirportIATA'] != '') {
65
+			if ($globalDebug) echo "-> Schedule info for ".$operator." (".$ident.")\n";
66
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport_time' => $schedule['DepartureTime']));
67
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('arrival_airport_time' => $schedule['ArrivalTime']));
68
+			// Should also check if route schedule = route from DB
69
+			if ($schedule['DepartureAirportIATA'] != '') {
70 70
 			if ($this->all_flights[$id]['departure_airport'] != $Spotter->getAirportIcao($schedule['DepartureAirportIATA'])) {
71
-			    $airport_icao = $Spotter->getAirportIcao($schedule['DepartureAirportIATA']);
72
-			    if ($airport_icao != '') {
71
+				$airport_icao = $Spotter->getAirportIcao($schedule['DepartureAirportIATA']);
72
+				if ($airport_icao != '') {
73 73
 				$this->all_flights[$id]['departure_airport'] = $airport_icao;
74 74
 				if ($globalDebug) echo "-> Change departure airport to ".$airport_icao." for ".$ident."\n";
75
-			    }
75
+				}
76
+			}
76 77
 			}
77
-		    }
78
-		    if ($schedule['ArrivalAirportIATA'] != '') {
78
+			if ($schedule['ArrivalAirportIATA'] != '') {
79 79
 			if ($this->all_flights[$id]['arrival_airport'] != $Spotter->getAirportIcao($schedule['ArrivalAirportIATA'])) {
80
-			    $airport_icao = $Spotter->getAirportIcao($schedule['ArrivalAirportIATA']);
81
-			    if ($airport_icao != '') {
80
+				$airport_icao = $Spotter->getAirportIcao($schedule['ArrivalAirportIATA']);
81
+				if ($airport_icao != '') {
82 82
 				$this->all_flights[$id]['arrival_airport'] = $airport_icao;
83 83
 				if ($globalDebug) echo "-> Change arrival airport to ".$airport_icao." for ".$ident."\n";
84
-			    }
84
+				}
85
+			}
85 86
 			}
86
-		    }
87
-		    $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']);
87
+			$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
+		}
88 89
 		}
89
-	    }
90 90
 	}
91 91
 	// close connection, at least one way will work ?
92 92
        
@@ -104,90 +104,90 @@  discard block
 block discarded – undo
104 104
 	}
105 105
 	  */
106 106
 	}
107
-    }
107
+	}
108 108
 
109
-    public function checkAll() {
109
+	public function checkAll() {
110 110
 	global $globalDebug;
111 111
 	if ($globalDebug) echo "Update last seen flights data...\n";
112 112
 	foreach ($this->all_flights as $key => $flight) {
113
-	    if (isset($this->all_flights[$key]['id'])) {
113
+		if (isset($this->all_flights[$key]['id'])) {
114 114
 		//echo $this->all_flights[$key]['id'].' - '.$this->all_flights[$key]['latitude'].'  '.$this->all_flights[$key]['longitude']."\n";
115
-    		$Spotter = new Spotter($this->db);
116
-        	$real_arrival = $this->arrival($key);
117
-        	$Spotter->updateLatestSpotterData($this->all_flights[$key]['id'],$this->all_flights[$key]['ident'],$this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$this->all_flights[$key]['altitude'],$this->all_flights[$key]['ground'],$this->all_flights[$key]['speed'],$this->all_flights[$key]['datetime'],$real_arrival['airport_icao'],$real_arrival['airport_time']);
118
-            }
115
+			$Spotter = new Spotter($this->db);
116
+			$real_arrival = $this->arrival($key);
117
+			$Spotter->updateLatestSpotterData($this->all_flights[$key]['id'],$this->all_flights[$key]['ident'],$this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$this->all_flights[$key]['altitude'],$this->all_flights[$key]['ground'],$this->all_flights[$key]['speed'],$this->all_flights[$key]['datetime'],$real_arrival['airport_icao'],$real_arrival['airport_time']);
118
+			}
119
+	}
119 120
 	}
120
-    }
121 121
 
122
-    public function arrival($key) {
122
+	public function arrival($key) {
123 123
 	global $globalClosestMinDist, $globalDebug;
124 124
 	$Spotter = new Spotter($this->db);
125
-        $airport_icao = '';
126
-        $airport_time = '';
127
-        if (!isset($globalClosestMinDist) || $globalClosestMinDist == '') $globalClosestMinDist = 50;
125
+		$airport_icao = '';
126
+		$airport_time = '';
127
+		if (!isset($globalClosestMinDist) || $globalClosestMinDist == '') $globalClosestMinDist = 50;
128 128
 	if ($this->all_flights[$key]['latitude'] != '' && $this->all_flights[$key]['longitude'] != '') {
129
-	    $closestAirports = $Spotter->closestAirports($this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$globalClosestMinDist);
130
-    	    if (isset($closestAirports[0])) {
131
-        	if (isset($this->all_flights[$key]['arrival_airport']) && $this->all_flights[$key]['arrival_airport'] == $closestAirports[0]['icao']) {
132
-        	    $airport_icao = $closestAirports[0]['icao'];
133
-        	    $airport_time = $this->all_flights[$key]['datetime'];
134
-        	    if ($globalDebug) echo "---++ Find arrival airport. airport_icao : ".$airport_icao."\n";
135
-        	} elseif (count($closestAirports > 1) && isset($this->all_flights[$key]['arrival_airport']) && $this->all_flights[$key]['arrival_airport'] != '') {
136
-        	    foreach ($closestAirports as $airport) {
137
-        		if ($this->all_flights[$key]['arrival_airport'] == $airport['icao']) {
138
-        		    $airport_icao = $airport['icao'];
139
-        		    $airport_time = $this->all_flights[$key]['datetime'];
140
-        		    if ($globalDebug) echo "---++ Find arrival airport. airport_icao : ".$airport_icao."\n";
141
-        		    break;
142
-        		}
143
-        	    }
144
-        	} 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))) {
145
-        		$airport_icao = $closestAirports[0]['icao'];
146
-        		$airport_time = $this->all_flights[$key]['datetime'];
147
-        	} else {
148
-        		if ($globalDebug) echo "----- Can't find arrival airport. Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.$this->all_flights[$key]['altitude_real']."\n";
149
-        	}
150
-    	    } else {
151
-    		    if ($globalDebug) echo "----- No Airport near last coord. Latitude : ".$this->all_flights[$key]['latitude'].' - Longitude : '.$this->all_flights[$key]['longitude'].' - MinDist : '.$globalClosestMinDist."\n";
152
-    	    }
153
-
154
-        } else {
155
-        	if ($globalDebug) echo "---- No latitude or longitude. Ident : ".$this->all_flights[$key]['ident']."\n";
156
-        }
157
-        return array('airport_icao' => $airport_icao,'airport_time' => $airport_time);
158
-    }
159
-
160
-
161
-
162
-    function del() {
129
+		$closestAirports = $Spotter->closestAirports($this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$globalClosestMinDist);
130
+			if (isset($closestAirports[0])) {
131
+			if (isset($this->all_flights[$key]['arrival_airport']) && $this->all_flights[$key]['arrival_airport'] == $closestAirports[0]['icao']) {
132
+				$airport_icao = $closestAirports[0]['icao'];
133
+				$airport_time = $this->all_flights[$key]['datetime'];
134
+				if ($globalDebug) echo "---++ Find arrival airport. airport_icao : ".$airport_icao."\n";
135
+			} elseif (count($closestAirports > 1) && isset($this->all_flights[$key]['arrival_airport']) && $this->all_flights[$key]['arrival_airport'] != '') {
136
+				foreach ($closestAirports as $airport) {
137
+				if ($this->all_flights[$key]['arrival_airport'] == $airport['icao']) {
138
+					$airport_icao = $airport['icao'];
139
+					$airport_time = $this->all_flights[$key]['datetime'];
140
+					if ($globalDebug) echo "---++ Find arrival airport. airport_icao : ".$airport_icao."\n";
141
+					break;
142
+				}
143
+				}
144
+			} 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))) {
145
+				$airport_icao = $closestAirports[0]['icao'];
146
+				$airport_time = $this->all_flights[$key]['datetime'];
147
+			} else {
148
+				if ($globalDebug) echo "----- Can't find arrival airport. Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.$this->all_flights[$key]['altitude_real']."\n";
149
+			}
150
+			} else {
151
+				if ($globalDebug) echo "----- No Airport near last coord. Latitude : ".$this->all_flights[$key]['latitude'].' - Longitude : '.$this->all_flights[$key]['longitude'].' - MinDist : '.$globalClosestMinDist."\n";
152
+			}
153
+
154
+		} else {
155
+			if ($globalDebug) echo "---- No latitude or longitude. Ident : ".$this->all_flights[$key]['ident']."\n";
156
+		}
157
+		return array('airport_icao' => $airport_icao,'airport_time' => $airport_time);
158
+	}
159
+
160
+
161
+
162
+	function del() {
163 163
 	global $globalDebug;
164 164
 	// Delete old infos
165 165
 	foreach ($this->all_flights as $key => $flight) {
166
-    	    if (isset($flight['lastupdate'])) {
167
-        	if ($flight['lastupdate'] < (time()-3000)) {
168
-            	    if (isset($this->all_flights[$key]['id'])) {
169
-            		if ($globalDebug) echo "--- Delete old values with id ".$this->all_flights[$key]['id']."\n";
166
+			if (isset($flight['lastupdate'])) {
167
+			if ($flight['lastupdate'] < (time()-3000)) {
168
+					if (isset($this->all_flights[$key]['id'])) {
169
+					if ($globalDebug) echo "--- Delete old values with id ".$this->all_flights[$key]['id']."\n";
170 170
 			/*
171 171
 			$SpotterLive = new SpotterLive();
172 172
             		$SpotterLive->deleteLiveSpotterDataById($this->all_flights[$key]['id']);
173 173
 			$SpotterLive->db = null;
174 174
 			*/
175
-            		$real_arrival = $this->arrival($key);
176
-            		$Spotter = new Spotter($this->db);
177
-            		if ($this->all_flights[$key]['latitude'] != '' && $this->all_flights[$key]['longitude'] != '') {
175
+					$real_arrival = $this->arrival($key);
176
+					$Spotter = new Spotter($this->db);
177
+					if ($this->all_flights[$key]['latitude'] != '' && $this->all_flights[$key]['longitude'] != '') {
178 178
 				$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']);
179 179
 				if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n";
180 180
 			}
181 181
 			// Put in archive
182 182
 //			$Spotter->db = null;
183
-            	    }
184
-            	    unset($this->all_flights[$key]);
185
-    	        }
186
-	    }
187
-        }
188
-    }
189
-
190
-    function add($line) {
183
+					}
184
+					unset($this->all_flights[$key]);
185
+				}
186
+		}
187
+		}
188
+	}
189
+
190
+	function add($line) {
191 191
 	global $globalPilotIdAccept, $globalAirportAccept, $globalAirlineAccept, $globalAirlineIgnore, $globalAirportIgnore, $globalFork, $globalDistanceIgnore, $globalDaemon, $globalSBSupdate, $globalDebug, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalCoordMinChange, $globalDebugTimeElapsed, $globalCenterLatitude, $globalCenterLongitude, $globalBeta;
192 192
 	//if (!isset($globalDebugTimeElapsed) || $globalDebugTimeElapsed == '') $globalDebugTimeElapsed = FALSE;
193 193
 	if (!isset($globalCoordMinChange) || $globalCoordMinChange == '') $globalCoordMinChange = '0.02';
@@ -212,18 +212,18 @@  discard block
 block discarded – undo
212 212
 	
213 213
 	// SBS format is CSV format
214 214
 	if(is_array($line) && isset($line['hex'])) {
215
-	    //print_r($line);
216
-  	    if ($line['hex'] != '' && $line['hex'] != '00000' && $line['hex'] != '000000' && $line['hex'] != '111111' && ctype_xdigit($line['hex']) && strlen($line['hex']) === 6) {
215
+		//print_r($line);
216
+  		if ($line['hex'] != '' && $line['hex'] != '00000' && $line['hex'] != '000000' && $line['hex'] != '111111' && ctype_xdigit($line['hex']) && strlen($line['hex']) === 6) {
217 217
 
218 218
 		// Increment message number
219 219
 		if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE) {
220
-		    $current_date = date('Y-m-d');
221
-		    $source = $line['source_name'];
222
-		    if ($source == '' || $line['format_source'] == 'aprs') $source = $line['format_source'];
223
-		    if (!isset($this->stats[$current_date][$source]['msg'])) {
224
-		    	$this->stats[$current_date][$source]['msg']['date'] = time();
225
-		    	$this->stats[$current_date][$source]['msg']['nb'] = 1;
226
-		    } else $this->stats[$current_date][$source]['msg']['nb'] += 1;
220
+			$current_date = date('Y-m-d');
221
+			$source = $line['source_name'];
222
+			if ($source == '' || $line['format_source'] == 'aprs') $source = $line['format_source'];
223
+			if (!isset($this->stats[$current_date][$source]['msg'])) {
224
+				$this->stats[$current_date][$source]['msg']['date'] = time();
225
+				$this->stats[$current_date][$source]['msg']['nb'] = 1;
226
+			} else $this->stats[$current_date][$source]['msg']['nb'] += 1;
227 227
 		}
228 228
 		
229 229
 		/*
@@ -239,16 +239,16 @@  discard block
 block discarded – undo
239 239
 		//$this->db = $dbc;
240 240
 
241 241
 		$hex = trim($line['hex']);
242
-	        $id = trim($line['hex']);
242
+			$id = trim($line['hex']);
243 243
 		
244 244
 		//print_r($this->all_flights);
245 245
 		if (!isset($this->all_flights[$id]['hex'])) {
246
-		    $this->all_flights[$id] = array('hex' => $hex);
247
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0));
248
-		    //if (isset($line['datetime']) && preg_match('/^(\d{4}(?:\-\d{2}){2} \d{2}(?:\:\d{2}){2})$/',$line['datetime'])) {
246
+			$this->all_flights[$id] = array('hex' => $hex);
247
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0));
248
+			//if (isset($line['datetime']) && preg_match('/^(\d{4}(?:\-\d{2}){2} \d{2}(?:\:\d{2}){2})$/',$line['datetime'])) {
249 249
 			//$this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => $line['datetime']));
250
-		    //} else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => date('Y-m-d H:i:s')));
251
-		    if (!isset($line['aircraft_icao']) || $line['aircraft_icao'] == '????') {
250
+			//} else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => date('Y-m-d H:i:s')));
251
+			if (!isset($line['aircraft_icao']) || $line['aircraft_icao'] == '????') {
252 252
 
253 253
 			$timeelapsed = microtime(true);
254 254
 			$Spotter = new Spotter($this->db);
@@ -257,30 +257,30 @@  discard block
 block discarded – undo
257 257
 			if ($globalDebugTimeElapsed) echo 'Time elapsed for update getallaircrattype : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
258 258
 
259 259
 			if ($aircraft_icao == '' && isset($line['aircraft_type'])) {
260
-			    if ($line['aircraft_type'] == 'PARA_GLIDER') $aircraft_icao = 'GLID';
261
-			    elseif ($line['aircraft_type'] == 'HELICOPTER_ROTORCRAFT') $aircraft_icao = 'UHEL';
262
-			    elseif ($line['aircraft_type'] == 'TOW_PLANE') $aircraft_icao = 'TOWPLANE';
263
-			    elseif ($line['aircraft_type'] == 'POWERED_AIRCRAFT') $aircraft_icao = 'POWAIRC';
260
+				if ($line['aircraft_type'] == 'PARA_GLIDER') $aircraft_icao = 'GLID';
261
+				elseif ($line['aircraft_type'] == 'HELICOPTER_ROTORCRAFT') $aircraft_icao = 'UHEL';
262
+				elseif ($line['aircraft_type'] == 'TOW_PLANE') $aircraft_icao = 'TOWPLANE';
263
+				elseif ($line['aircraft_type'] == 'POWERED_AIRCRAFT') $aircraft_icao = 'POWAIRC';
264 264
 			}
265 265
 			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $aircraft_icao));
266
-		    } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $line['aircraft_icao']));
267
-		    $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' => false));
268
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('lastupdate' => time()));
269
-		    if (!isset($line['id'])) {
266
+			} else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $line['aircraft_icao']));
267
+			$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' => false));
268
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('lastupdate' => time()));
269
+			if (!isset($line['id'])) {
270 270
 			if (!isset($globalDaemon)) $globalDaemon = TRUE;
271 271
 //			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')));
272 272
 //			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')));
273 273
 			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')));
274
-		        //else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident']));
275
-		     } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id']));
274
+				//else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident']));
275
+			 } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id']));
276 276
 
277
-		    if ($globalDebug) echo "*********** New aircraft hex : ".$hex." ***********\n";
277
+			if ($globalDebug) echo "*********** New aircraft hex : ".$hex." ***********\n";
278 278
 		}
279 279
 		
280 280
 		if (isset($line['datetime']) && preg_match('/^(\d{4}(?:\-\d{2}){2} \d{2}(?:\:\d{2}){2})$/',$line['datetime'])) {
281
-		    if (!isset($this->all_flights[$id]['datetime']) || strtotime($line['datetime']) >= strtotime($this->all_flights[$id]['datetime'])) {
281
+			if (!isset($this->all_flights[$id]['datetime']) || strtotime($line['datetime']) >= strtotime($this->all_flights[$id]['datetime'])) {
282 282
 			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => $line['datetime']));
283
-		    } else {
283
+			} else {
284 284
 				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";
285 285
 				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";
286 286
 				/*
@@ -289,32 +289,32 @@  discard block
 block discarded – undo
289 289
 				print_r($line);
290 290
 				*/
291 291
 				return '';
292
-		    }
292
+			}
293 293
 		} else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => date('Y-m-d H:i:s')));
294 294
 
295 295
 		if (isset($line['registration']) && $line['registration'] != '' && $line['registration'] != 'z.NO-REG') {
296
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('registration' => $line['registration']));
296
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('registration' => $line['registration']));
297 297
 		}
298 298
 		if (isset($line['waypoints']) && $line['waypoints'] != '') {
299
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('waypoints' => $line['waypoints']));
299
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('waypoints' => $line['waypoints']));
300 300
 		}
301 301
 		if (isset($line['pilot_id']) && $line['pilot_id'] != '') {
302
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('pilot_id' => $line['pilot_id']));
302
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('pilot_id' => $line['pilot_id']));
303 303
 		}
304 304
 		if (isset($line['pilot_name']) && $line['pilot_name'] != '') {
305
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('pilot_name' => $line['pilot_name']));
305
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('pilot_name' => $line['pilot_name']));
306 306
 		}
307 307
  
308 308
 		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'])) {
309
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => trim($line['ident'])));
310
-		    if ($this->all_flights[$id]['addedSpotter'] == 1) {
309
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => trim($line['ident'])));
310
+			if ($this->all_flights[$id]['addedSpotter'] == 1) {
311 311
 			$timeelapsed = microtime(true);
312
-            		$Spotter = new Spotter($this->db);
313
-            		$result = $Spotter->updateIdentSpotterData($this->all_flights[$id]['id'],$this->all_flights[$id]['ident']);
312
+					$Spotter = new Spotter($this->db);
313
+					$result = $Spotter->updateIdentSpotterData($this->all_flights[$id]['id'],$this->all_flights[$id]['ident']);
314 314
 			if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n";
315 315
 			$Spotter->db = null;
316 316
 			if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
317
-		    }
317
+			}
318 318
 
319 319
 /*
320 320
 		    if (!isset($line['id'])) {
@@ -324,26 +324,26 @@  discard block
 block discarded – undo
324 324
 		        else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident']));
325 325
 		     } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id']));
326 326
   */
327
-		    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']));
327
+			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']));
328 328
 
329
-		    //$putinarchive = true;
330
-		    if (isset($line['departure_airport_time']) && $line['departure_airport_time'] != 0) {
329
+			//$putinarchive = true;
330
+			if (isset($line['departure_airport_time']) && $line['departure_airport_time'] != 0) {
331 331
 			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport_time' => $line['departure_airport_time']));
332
-		    }
333
-		    if (isset($line['arrival_airport_time']) && $line['arrival_airport_time'] != 0) {
332
+			}
333
+			if (isset($line['arrival_airport_time']) && $line['arrival_airport_time'] != 0) {
334 334
 			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('arrival_airport_time' => $line['arrival_airport_time']));
335
-		    }
336
-		    if (isset($line['departure_airport_icao']) && isset($line['arrival_airport_icao'])) {
337
-		    		$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' => ''));
338
-		    } elseif (isset($line['departure_airport_iata']) && isset($line['arrival_airport_iata'])) {
335
+			}
336
+			if (isset($line['departure_airport_icao']) && isset($line['arrival_airport_icao'])) {
337
+					$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' => ''));
338
+			} elseif (isset($line['departure_airport_iata']) && isset($line['arrival_airport_iata'])) {
339 339
 				$timeelapsed = microtime(true);
340 340
 				$Spotter = new Spotter($this->db);
341 341
 				$line['departure_airport_icao'] = $Spotter->getAirportIcao($line['departure_airport_iata']);
342 342
 				$line['arrival_airport_icao'] = $Spotter->getAirportIcao($line['arrival_airport_iata']);
343
-		    		$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' => ''));
343
+					$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' => ''));
344 344
 				if ($globalDebugTimeElapsed) echo 'Time elapsed for update getAirportICAO : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
345 345
 
346
-		    } elseif (!isset($line['format_source']) || $line['format_source'] != 'aprs') {
346
+			} elseif (!isset($line['format_source']) || $line['format_source'] != 'aprs') {
347 347
 			$timeelapsed = microtime(true);
348 348
 			$Spotter = new Spotter($this->db);
349 349
 			$route = $Spotter->getRouteInfo(trim($line['ident']));
@@ -357,11 +357,11 @@  discard block
 block discarded – undo
357 357
 			if ($globalDebugTimeElapsed) echo 'Time elapsed for update getrouteinfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
358 358
 
359 359
 			if (isset($route['fromairport_icao']) && isset($route['toairport_icao'])) {
360
-			    //if ($route['FromAirport_ICAO'] != $route['ToAirport_ICAO']) {
361
-			    if ($route['fromairport_icao'] != $route['toairport_icao']) {
360
+				//if ($route['FromAirport_ICAO'] != $route['ToAirport_ICAO']) {
361
+				if ($route['fromairport_icao'] != $route['toairport_icao']) {
362 362
 				//    $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']));
363
-		    		$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']));
364
-		    	    }
363
+					$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']));
364
+					}
365 365
 			}
366 366
 			if (!isset($globalFork)) $globalFork = TRUE;
367 367
 			if (!$globalIVAO && !$globalVATSIM && !$globalphpVMS && (!isset($line['format_source']) || $line['format_source'] != 'aprs')) {
@@ -379,33 +379,33 @@  discard block
 block discarded – undo
379 379
 				$this->get_Schedule($id,trim($line['ident']));
380 380
 			//    }
381 381
 			}
382
-		    }
382
+			}
383 383
 		}
384 384
 
385 385
 		if (isset($line['speed']) && $line['speed'] != '') {
386 386
 		//    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed' => $line[12]));
387
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed' => round($line['speed'])));
388
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed_fromsrc' => true));
389
-		    //$dataFound = true;
387
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed' => round($line['speed'])));
388
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed_fromsrc' => true));
389
+			//$dataFound = true;
390 390
 		} 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'])) {
391
-		    $distance = $Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m');
392
-		    if ($distance > 1000 && $distance < 10000) {
393
-		    // use datetime
391
+			$distance = $Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m');
392
+			if ($distance > 1000 && $distance < 10000) {
393
+			// use datetime
394 394
 			$speed = $distance/(time() - $this->all_flights[$id]['time_last_coord']);
395 395
 			$speed = $speed*3.6;
396 396
 			if ($speed < 1000) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed' => round($speed)));
397 397
   			if ($globalDebug) echo "ø Calculated Speed for ".$this->all_flights[$id]['hex']." : ".$speed." - distance : ".$distance."\n";
398
-		    }
398
+			}
399 399
 		}
400 400
 
401 401
 
402 402
 
403
-	        if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '') {
404
-	    	    if (isset($this->all_flights[$id]['time_last_coord'])) $timediff = round(time()-$this->all_flights[$id]['time_last_coord']);
405
-	    	    else unset($timediff);
406
-	    	    if ($this->tmd > 5 || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || !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')))) {
403
+			if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '') {
404
+				if (isset($this->all_flights[$id]['time_last_coord'])) $timediff = round(time()-$this->all_flights[$id]['time_last_coord']);
405
+				else unset($timediff);
406
+				if ($this->tmd > 5 || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || !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')))) {
407 407
 			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'])) {
408
-			    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'])) {
408
+				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'])) {
409 409
 				$this->all_flights[$id]['archive_latitude'] = $line['latitude'];
410 410
 				$this->all_flights[$id]['archive_longitude'] = $line['longitude'];
411 411
 				$this->all_flights[$id]['putinarchive'] = true;
@@ -421,21 +421,21 @@  discard block
 block discarded – undo
421 421
 				$this->tmd = 0;
422 422
 				//echo 'FOUND : '.$this->all_flights[$id]['over_country'].' ---------------'."\n";
423 423
 				//$putinarchive = true;
424
-			    } else {
425
-			    /*
424
+				} else {
425
+				/*
426 426
 				echo '//////// checkLine FALSE'."\n";
427 427
 				echo 'Check DATA : '.$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']."\n";
428 428
 			    */
429
-			    }
429
+				}
430 430
 			}
431 431
 
432 432
 			if (isset($line['latitude']) && $line['latitude'] != '' && $line['latitude'] != 0 && $line['latitude'] < 91 && $line['latitude'] > -90) {
433
-			    //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
+				//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) {
434 434
 				if (!isset($this->all_flights[$id]['archive_latitude'])) $this->all_flights[$id]['archive_latitude'] = $line['latitude'];
435 435
 				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') {
436
-				    $this->all_flights[$id]['livedb_latitude'] = $line['latitude'];
437
-				    $dataFound = true;
438
-				    $this->all_flights[$id]['time_last_coord'] = time();
436
+					$this->all_flights[$id]['livedb_latitude'] = $line['latitude'];
437
+					$dataFound = true;
438
+					$this->all_flights[$id]['time_last_coord'] = time();
439 439
 				}
440 440
 				// elseif ($globalDebug) echo '!*!*! Ignore data, too close to previous one'."\n";
441 441
 				$this->all_flights[$id] = array_merge($this->all_flights[$id],array('latitude' => $line['latitude']));
@@ -446,20 +446,20 @@  discard block
 block discarded – undo
446 446
 				    //$putinarchive = true;
447 447
 				}
448 448
 				*/
449
-			    /*
449
+				/*
450 450
 			    } elseif (isset($this->all_flights[$id]['latitude'])) {
451 451
 				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";
452 452
 			    }
453 453
 			    */
454 454
 			}
455 455
 			if (isset($line['longitude']) && $line['longitude'] != '' && $line['longitude'] != 0 && $line['longitude'] < 360 && $line['longitude'] > -180) {
456
-			    if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360;
457
-			    //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) {
456
+				if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360;
457
+				//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) {
458 458
 				if (!isset($this->all_flights[$id]['archive_longitude'])) $this->all_flights[$id]['archive_longitude'] = $line['longitude'];
459 459
 				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') {
460
-				    $this->all_flights[$id]['livedb_longitude'] = $line['longitude'];
461
-				    $dataFound = true;
462
-				    $this->all_flights[$id]['time_last_coord'] = time();
460
+					$this->all_flights[$id]['livedb_longitude'] = $line['longitude'];
461
+					$dataFound = true;
462
+					$this->all_flights[$id]['time_last_coord'] = time();
463 463
 				}
464 464
 				// elseif ($globalDebug) echo '!*!*! Ignore data, too close to previous one'."\n";
465 465
 				$this->all_flights[$id] = array_merge($this->all_flights[$id],array('longitude' => $line['longitude']));
@@ -477,49 +477,49 @@  discard block
 block discarded – undo
477 477
 			    */
478 478
 			}
479 479
 
480
-		    } else if ($globalDebug && $timediff > 20) {
480
+			} else if ($globalDebug && $timediff > 20) {
481 481
 			$this->tmd = $this->tmd + 1;
482 482
 			echo '!!! Too much distance in short time... for '.$this->all_flights[$id]['ident']."\n";
483 483
 			echo 'Time : '.$timediff.'s - Distance : '.$Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m')."m -";
484 484
 			echo 'Speed : '.(($Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m')/$timediff)*3.6)." km/h - ";
485 485
 			echo 'Lat : '.$line['latitude'].' - long : '.$line['longitude'].' - prev lat : '.$this->all_flights[$id]['latitude'].' - prev long : '.$this->all_flights[$id]['longitude']." \n";
486
-		    }
486
+			}
487 487
 		}
488 488
 		if (isset($line['verticalrate']) && $line['verticalrate'] != '') {
489
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('verticalrate' => $line['verticalrate']));
490
-		    //$dataFound = true;
489
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('verticalrate' => $line['verticalrate']));
490
+			//$dataFound = true;
491 491
 		}
492 492
 		if (isset($line['format_source']) && $line['format_source'] != '') {
493
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('format_source' => $line['format_source']));
493
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('format_source' => $line['format_source']));
494 494
 		}
495 495
 		if (isset($line['source_name']) && $line['source_name'] != '') {
496
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('source_name' => $line['source_name']));
496
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('source_name' => $line['source_name']));
497 497
 		}
498 498
 		if (isset($line['emergency']) && $line['emergency'] != '') {
499
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('emergency' => $line['emergency']));
500
-		    //$dataFound = true;
499
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('emergency' => $line['emergency']));
500
+			//$dataFound = true;
501 501
 		}
502 502
 		if (isset($line['ground']) && $line['ground'] != '') {
503
-		    if (isset($this->all_flights[$id]['ground']) && $this->all_flights[$id]['ground'] == 1 && $line['ground'] == 0) {
503
+			if (isset($this->all_flights[$id]['ground']) && $this->all_flights[$id]['ground'] == 1 && $line['ground'] == 0) {
504 504
 			// Here we force archive of flight because after ground it's a new one (or should be)
505 505
 			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0));
506 506
 			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('forcenew' => 1));
507 507
 			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')));
508
-		        elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id']));
508
+				elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id']));
509 509
 			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']));
510
-		    }
511
-		    if ($line['ground'] != 1) $line['ground'] = 0;
512
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ground' => $line['ground']));
513
-		    //$dataFound = true;
510
+			}
511
+			if ($line['ground'] != 1) $line['ground'] = 0;
512
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('ground' => $line['ground']));
513
+			//$dataFound = true;
514 514
 		}
515 515
 		if (isset($line['squawk']) && $line['squawk'] != '') {
516
-		    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'])) {
517
-			    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk']));
518
-			    $highlight = '';
519
-			    if ($this->all_flights[$id]['squawk'] == '7500') $highlight = 'Squawk 7500 : Hijack at '.date('Y-m-d G:i').' UTC';
520
-			    if ($this->all_flights[$id]['squawk'] == '7600') $highlight = 'Squawk 7600 : Lost Comm (radio failure) at '.date('Y-m-d G:i').' UTC';
521
-			    if ($this->all_flights[$id]['squawk'] == '7700') $highlight = 'Squawk 7700 : Emergency at '.date('Y-m-d G:i').' UTC';
522
-			    if ($highlight != '') {
516
+			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'])) {
517
+				$this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk']));
518
+				$highlight = '';
519
+				if ($this->all_flights[$id]['squawk'] == '7500') $highlight = 'Squawk 7500 : Hijack at '.date('Y-m-d G:i').' UTC';
520
+				if ($this->all_flights[$id]['squawk'] == '7600') $highlight = 'Squawk 7600 : Lost Comm (radio failure) at '.date('Y-m-d G:i').' UTC';
521
+				if ($this->all_flights[$id]['squawk'] == '7700') $highlight = 'Squawk 7700 : Emergency at '.date('Y-m-d G:i').' UTC';
522
+				if ($highlight != '') {
523 523
 				$timeelapsed = microtime(true);
524 524
 				$Spotter = new Spotter($this->db);
525 525
 				$Spotter->setHighlightFlight($this->all_flights[$id]['id'],$highlight);
@@ -529,38 +529,38 @@  discard block
 block discarded – undo
529 529
 				$this->all_flights[$id]['putinarchive'] = true;
530 530
 				//$putinarchive = true;
531 531
 				$highlight = '';
532
-			    }
532
+				}
533 533
 			    
534
-		    } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk']));
535
-		    //$dataFound = true;
534
+			} else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk']));
535
+			//$dataFound = true;
536 536
 		}
537 537
 
538 538
 		if (isset($line['altitude']) && $line['altitude'] != '') {
539
-		    //if (!isset($this->all_flights[$id]['altitude']) || $this->all_flights[$id]['altitude'] == '' || ($this->all_flights[$id]['altitude'] > 0 && $line['altitude'] != 0)) {
539
+			//if (!isset($this->all_flights[$id]['altitude']) || $this->all_flights[$id]['altitude'] == '' || ($this->all_flights[$id]['altitude'] > 0 && $line['altitude'] != 0)) {
540 540
 			if (abs(round($line['altitude']/100)-$this->all_flights[$id]['altitude']) > 2) $this->all_flights[$id]['putinarchive'] = true;
541 541
 			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('altitude' => round($line['altitude']/100)));
542 542
 			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('altitude_real' => $line['altitude']));
543 543
 			//$dataFound = true;
544
-		    //} elseif ($globalDebug) echo "!!! Strange altitude data... not added.\n";
544
+			//} elseif ($globalDebug) echo "!!! Strange altitude data... not added.\n";
545 545
   		}
546 546
 
547 547
 		if (isset($line['noarchive']) && $line['noarchive'] === true) {
548
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('noarchive' => true));
548
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('noarchive' => true));
549 549
 		}
550 550
 		
551 551
 		if (isset($line['heading']) && $line['heading'] != '') {
552
-		    if (abs($this->all_flights[$id]['heading']-round($line['heading'])) > 2) $this->all_flights[$id]['putinarchive'] = true;
553
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => round($line['heading'])));
554
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading_fromsrc' => true));
555
-		    //$dataFound = true;
552
+			if (abs($this->all_flights[$id]['heading']-round($line['heading'])) > 2) $this->all_flights[$id]['putinarchive'] = true;
553
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => round($line['heading'])));
554
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading_fromsrc' => true));
555
+			//$dataFound = true;
556 556
   		} 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']) {
557
-  		    $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']);
558
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => round($heading)));
559
-		    if (abs($this->all_flights[$id]['heading']-round($heading)) > 2) $this->all_flights[$id]['putinarchive'] = true;
560
-  		    if ($globalDebug) echo "ø Calculated Heading for ".$this->all_flights[$id]['hex']." : ".$heading."\n";
557
+  			$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']);
558
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => round($heading)));
559
+			if (abs($this->all_flights[$id]['heading']-round($heading)) > 2) $this->all_flights[$id]['putinarchive'] = true;
560
+  			if ($globalDebug) echo "ø Calculated Heading for ".$this->all_flights[$id]['hex']." : ".$heading."\n";
561 561
   		} elseif (isset($this->all_flights[$id]['format_source']) && $this->all_flights[$id]['format_source'] == 'ACARS') {
562
-  		    // If not enough messages and ACARS set heading to 0
563
-  		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => 0));
562
+  			// If not enough messages and ACARS set heading to 0
563
+  			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => 0));
564 564
   		}
565 565
 		if (isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalSourcesupdate) $dataFound = false;
566 566
 		elseif (isset($globalSBS1update) && $globalSBS1update != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalSBS1update) $dataFound = false;
@@ -570,118 +570,118 @@  discard block
 block discarded – undo
570 570
 		//if (time()-$this->all_flights[$id]['lastupdate'] > 30 && $dataFound == true && $this->all_flights[$id]['ident'] != '' && $this->all_flights[$id]['latitude'] != '' && $this->all_flights[$id]['longitude'] != '') {
571 571
 		//if ($dataFound == true && isset($this->all_flights[$id]['hex']) && $this->all_flights[$id]['ident'] != '' && $this->all_flights[$id]['latitude'] != '' && $this->all_flights[$id]['longitude'] != '') {
572 572
 		if ($dataFound === true && isset($this->all_flights[$id]['hex']) && $this->all_flights[$id]['heading'] != '' && $this->all_flights[$id]['latitude'] != '' && $this->all_flights[$id]['longitude'] != '') {
573
-		    $this->all_flights[$id]['lastupdate'] = time();
574
-		    if ($this->all_flights[$id]['addedSpotter'] == 0) {
575
-		        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'])) {
576
-			    //print_r($this->all_flights);
577
-			    //echo $this->all_flights[$id]['id'].' - '.$this->all_flights[$id]['addedSpotter']."\n";
578
-			    //$last_hour_ident = Spotter->getIdentFromLastHour($this->all_flights[$id]['ident']);
579
-			    if (!isset($this->all_flights[$id]['forcenew']) || $this->all_flights[$id]['forcenew'] == 0) {
573
+			$this->all_flights[$id]['lastupdate'] = time();
574
+			if ($this->all_flights[$id]['addedSpotter'] == 0) {
575
+				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'])) {
576
+				//print_r($this->all_flights);
577
+				//echo $this->all_flights[$id]['id'].' - '.$this->all_flights[$id]['addedSpotter']."\n";
578
+				//$last_hour_ident = Spotter->getIdentFromLastHour($this->all_flights[$id]['ident']);
579
+				if (!isset($this->all_flights[$id]['forcenew']) || $this->all_flights[$id]['forcenew'] == 0) {
580 580
 				if ($globalDebug) echo "Check if aircraft is already in DB...";
581 581
 				$timeelapsed = microtime(true);
582 582
 				$SpotterLive = new SpotterLive($this->db);
583 583
 				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')) {
584
-				    $recent_ident = $SpotterLive->checkModeSRecent($this->all_flights[$id]['hex']);
585
-				    if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkModeSRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
584
+					$recent_ident = $SpotterLive->checkModeSRecent($this->all_flights[$id]['hex']);
585
+					if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkModeSRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
586 586
 
587 587
 				} elseif (isset($this->all_flights[$id]['ident']) && $this->all_flights[$id]['ident'] != '') {
588
-				    $recent_ident = $SpotterLive->checkIdentRecent($this->all_flights[$id]['ident']);
589
-				    if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
588
+					$recent_ident = $SpotterLive->checkIdentRecent($this->all_flights[$id]['ident']);
589
+					if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
590 590
 
591 591
 				} else $recent_ident = '';
592 592
 				$SpotterLive->db=null;
593 593
 
594 594
 				if ($globalDebug && $recent_ident == '') echo " Not in DB.\n";
595 595
 				elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n";
596
-			    } else {
596
+				} else {
597 597
 				$recent_ident = '';
598 598
 				$this->all_flights[$id] = array_merge($this->all_flights[$id],array('forcenew' => 0));
599
-			    }
600
-			    //if there was no aircraft with the same callsign within the last hour and go post it into the archive
601
-			    if($recent_ident == "")
602
-			    {
599
+				}
600
+				//if there was no aircraft with the same callsign within the last hour and go post it into the archive
601
+				if($recent_ident == "")
602
+				{
603 603
 				if ($globalDebug) echo "\o/ Add ".$this->all_flights[$id]['ident']." in archive DB : ";
604 604
 				if ($this->all_flights[$id]['departure_airport'] == "") { $this->all_flights[$id]['departure_airport'] = "NA"; }
605 605
 				if ($this->all_flights[$id]['arrival_airport'] == "") { $this->all_flights[$id]['arrival_airport'] = "NA"; }
606 606
 				//adds the spotter data for the archive
607 607
 				$ignoreImport = false;
608 608
 				foreach($globalAirportIgnore as $airportIgnore) {
609
-				    if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) {
609
+					if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) {
610 610
 					$ignoreImport = true;
611
-				    }
611
+					}
612 612
 				}
613 613
 				if (count($globalAirportAccept) > 0) {
614
-				    $ignoreImport = true;
615
-				    foreach($globalAirportIgnore as $airportIgnore) {
614
+					$ignoreImport = true;
615
+					foreach($globalAirportIgnore as $airportIgnore) {
616 616
 					if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) {
617
-					    $ignoreImport = false;
617
+						$ignoreImport = false;
618
+					}
618 619
 					}
619
-				    }
620 620
 				}
621 621
 				if (isset($globalAirlineIgnore) && is_array($globalAirlineIgnore)) {
622
-				    foreach($globalAirlineIgnore as $airlineIgnore) {
622
+					foreach($globalAirlineIgnore as $airlineIgnore) {
623 623
 					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)) {
624
-					    $ignoreImport = true;
624
+						$ignoreImport = true;
625
+					}
625 626
 					}
626
-				    }
627 627
 				}
628 628
 				if (isset($globalAirlineAccept) && count($globalAirlineAccept) > 0) {
629
-				    $ignoreImport = true;
630
-				    foreach($globalAirlineAccept as $airlineAccept) {
629
+					$ignoreImport = true;
630
+					foreach($globalAirlineAccept as $airlineAccept) {
631 631
 					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)) {
632
-					    $ignoreImport = false;
632
+						$ignoreImport = false;
633
+					}
633 634
 					}
634
-				    }
635 635
 				}
636 636
 				if (isset($globalPilotIdAccept) && count($globalPilotIdAccept) > 0) {
637
-				    $ignoreImport = true;
638
-				    foreach($globalPilotIdAccept as $pilotIdAccept) {
637
+					$ignoreImport = true;
638
+					foreach($globalPilotIdAccept as $pilotIdAccept) {
639 639
 					if ($this->all_flights[$id]['pilot_id'] == $pilotIdAccept) {
640
-					    $ignoreImport = false;
640
+						$ignoreImport = false;
641
+					}
641 642
 					}
642
-				    }
643 643
 				}
644 644
 				
645 645
 				if (!$ignoreImport) {
646
-				    $highlight = '';
647
-				    if ($this->all_flights[$id]['squawk'] == '7500') $highlight = 'Squawk 7500 : Hijack';
648
-				    if ($this->all_flights[$id]['squawk'] == '7600') $highlight = 'Squawk 7600 : Lost Comm (radio failure)';
649
-				    if ($this->all_flights[$id]['squawk'] == '7700') $highlight = 'Squawk 7700 : Emergency';
650
-				    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')));
651
-				    $timeelapsed = microtime(true);
652
-				    $Spotter = new Spotter($this->db);
653
-				    $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']);
654
-				    $Spotter->db = null;
655
-				    if ($globalDebug && isset($result)) echo $result."\n";
656
-				    if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
646
+					$highlight = '';
647
+					if ($this->all_flights[$id]['squawk'] == '7500') $highlight = 'Squawk 7500 : Hijack';
648
+					if ($this->all_flights[$id]['squawk'] == '7600') $highlight = 'Squawk 7600 : Lost Comm (radio failure)';
649
+					if ($this->all_flights[$id]['squawk'] == '7700') $highlight = 'Squawk 7700 : Emergency';
650
+					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')));
651
+					$timeelapsed = microtime(true);
652
+					$Spotter = new Spotter($this->db);
653
+					$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']);
654
+					$Spotter->db = null;
655
+					if ($globalDebug && isset($result)) echo $result."\n";
656
+					if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
657 657
 				    
658
-				    // Add source stat in DB
659
-				    $Stats = new Stats($this->db);
660
-				    if (!empty($this->stats)) {
658
+					// Add source stat in DB
659
+					$Stats = new Stats($this->db);
660
+					if (!empty($this->stats)) {
661 661
 					if ($globalDebug) echo 'Add source stats : ';
662
-				        foreach($this->stats as $date => $data) {
663
-					    foreach($data as $source => $sourced) {
664
-					        //print_r($sourced);
665
-				    	        if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar',$date);
666
-				    	        if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist',$date);
667
-				    		if (isset($sourced['msg'])) {
668
-				    		    if (time() - $sourced['msg']['date'] > 10) {
669
-				    		        $nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date']));
670
-				    		        echo $Stats->addStatSource($nbmsg,$source,'msg',$date);
671
-			    			        unset($this->stats[$date][$source]['msg']);
672
-			    			    }
673
-			    			}
674
-			    		    }
675
-			    		    if ($date != date('Y-m-d')) {
676
-			    			unset($this->stats[$date]);
677
-			    		    }
678
-				    	}
679
-				    	if ($globalDebug) echo 'Done'."\n";
680
-
681
-				    }
682
-				    $Stats->db = null;
662
+						foreach($this->stats as $date => $data) {
663
+						foreach($data as $source => $sourced) {
664
+							//print_r($sourced);
665
+								if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar',$date);
666
+								if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist',$date);
667
+							if (isset($sourced['msg'])) {
668
+								if (time() - $sourced['msg']['date'] > 10) {
669
+									$nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date']));
670
+									echo $Stats->addStatSource($nbmsg,$source,'msg',$date);
671
+									unset($this->stats[$date][$source]['msg']);
672
+								}
673
+							}
674
+							}
675
+							if ($date != date('Y-m-d')) {
676
+							unset($this->stats[$date]);
677
+							}
678
+						}
679
+						if ($globalDebug) echo 'Done'."\n";
680
+
681
+					}
682
+					$Stats->db = null;
683 683
 				    
684
-				    $this->del();
684
+					$this->del();
685 685
 				} elseif ($globalDebug) echo 'Ignore data'."\n";
686 686
 				$ignoreImport = false;
687 687
 				$this->all_flights[$id]['addedSpotter'] = 1;
@@ -699,18 +699,18 @@  discard block
 block discarded – undo
699 699
 			*/
700 700
 			//SpotterLive->deleteLiveSpotterDataByIdent($this->all_flights[$id]['ident']);
701 701
 				if ($this->last_delete == '' || time() - $this->last_delete > 1800) {
702
-				    if ($globalDebug) echo "---- Deleting Live Spotter data older than 9 hours...";
703
-				    //SpotterLive->deleteLiveSpotterDataNotUpdated();
704
-				    $SpotterLive = new SpotterLive($this->db);
705
-				    $SpotterLive->deleteLiveSpotterData();
706
-				    $SpotterLive->db=null;
707
-				    if ($globalDebug) echo " Done\n";
708
-				    $this->last_delete = time();
702
+					if ($globalDebug) echo "---- Deleting Live Spotter data older than 9 hours...";
703
+					//SpotterLive->deleteLiveSpotterDataNotUpdated();
704
+					$SpotterLive = new SpotterLive($this->db);
705
+					$SpotterLive->deleteLiveSpotterData();
706
+					$SpotterLive->db=null;
707
+					if ($globalDebug) echo " Done\n";
708
+					$this->last_delete = time();
709 709
 				}
710
-			    } else {
710
+				} else {
711 711
 				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')) {
712
-				    $this->all_flights[$id]['id'] = $recent_ident;
713
-				    $this->all_flights[$id]['addedSpotter'] = 1;
712
+					$this->all_flights[$id]['id'] = $recent_ident;
713
+					$this->all_flights[$id]['addedSpotter'] = 1;
714 714
 				}
715 715
 				if (isset($globalDaemon) && !$globalDaemon) {
716 716
 					$Spotter = new Spotter($this->db);
@@ -718,14 +718,14 @@  discard block
 block discarded – undo
718 718
 					$Spotter->db = null;
719 719
 				}
720 720
 				
721
-			    }
721
+				}
722
+			}
722 723
 			}
723
-		    }
724
-		    //adds the spotter LIVE data
725
-		    //SpotterLive->addLiveSpotterData($flightaware_id, $ident, $aircraft_type, $departure_airport, $arrival_airport, $latitude, $longitude, $waypoints, $altitude, $heading, $groundspeed);
726
-		    //echo "\nAdd in Live !! \n";
727
-		    //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";
728
-		    if ($globalDebug) {
724
+			//adds the spotter LIVE data
725
+			//SpotterLive->addLiveSpotterData($flightaware_id, $ident, $aircraft_type, $departure_airport, $arrival_airport, $latitude, $longitude, $waypoints, $altitude, $heading, $groundspeed);
726
+			//echo "\nAdd in Live !! \n";
727
+			//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";
728
+			if ($globalDebug) {
729 729
 			if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) {
730 730
 				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";
731 731
 				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";
@@ -733,49 +733,49 @@  discard block
 block discarded – undo
733 733
 				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";
734 734
 				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";
735 735
 			}
736
-		    }
737
-		    $ignoreImport = false;
738
-		    if ($this->all_flights[$id]['departure_airport'] == "") { $this->all_flights[$id]['departure_airport'] = "NA"; }
739
-		    if ($this->all_flights[$id]['arrival_airport'] == "") { $this->all_flights[$id]['arrival_airport'] = "NA"; }
736
+			}
737
+			$ignoreImport = false;
738
+			if ($this->all_flights[$id]['departure_airport'] == "") { $this->all_flights[$id]['departure_airport'] = "NA"; }
739
+			if ($this->all_flights[$id]['arrival_airport'] == "") { $this->all_flights[$id]['arrival_airport'] = "NA"; }
740 740
 
741
-		    foreach($globalAirportIgnore as $airportIgnore) {
742
-		        if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) {
743
-			    $ignoreImport = true;
741
+			foreach($globalAirportIgnore as $airportIgnore) {
742
+				if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) {
743
+				$ignoreImport = true;
744
+			}
744 745
 			}
745
-		    }
746
-		    if (count($globalAirportAccept) > 0) {
747
-		        $ignoreImport = true;
748
-		        foreach($globalAirportIgnore as $airportIgnore) {
749
-			    if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) {
746
+			if (count($globalAirportAccept) > 0) {
747
+				$ignoreImport = true;
748
+				foreach($globalAirportIgnore as $airportIgnore) {
749
+				if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) {
750 750
 				$ignoreImport = false;
751
-			    }
751
+				}
752
+			}
752 753
 			}
753
-		    }
754
-		    if (isset($globalAirlineIgnore) && is_array($globalAirlineIgnore)) {
754
+			if (isset($globalAirlineIgnore) && is_array($globalAirlineIgnore)) {
755 755
 			foreach($globalAirlineIgnore as $airlineIgnore) {
756
-			    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)) {
756
+				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)) {
757 757
 				$ignoreImport = true;
758
-			    }
758
+				}
759
+			}
759 760
 			}
760
-		    }
761
-		    if (isset($globalAirlineAccept) && count($globalAirlineAccept) > 0) {
761
+			if (isset($globalAirlineAccept) && count($globalAirlineAccept) > 0) {
762 762
 			$ignoreImport = true;
763 763
 			foreach($globalAirlineAccept as $airlineAccept) {
764
-			    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)) {
764
+				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)) {
765 765
 				$ignoreImport = false;
766
-			    }
766
+				}
767 767
 			}
768
-		    }
769
-		    if (isset($globalPilotIdAccept) && count($globalPilotIdAccept) > 0) {
768
+			}
769
+			if (isset($globalPilotIdAccept) && count($globalPilotIdAccept) > 0) {
770 770
 			$ignoreImport = true;
771 771
 			foreach($globalPilotIdAccept as $pilotIdAccept) {
772
-			    if ($this->all_flights[$id]['pilot_id'] == $pilotIdAccept) {
773
-			        $ignoreImport = false;
774
-			    }
772
+				if ($this->all_flights[$id]['pilot_id'] == $pilotIdAccept) {
773
+					$ignoreImport = false;
774
+				}
775
+			}
775 776
 			}
776
-		    }
777 777
 
778
-		    if (!$ignoreImport) {
778
+			if (!$ignoreImport) {
779 779
 			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'])) {
780 780
 				if ($globalDebug) echo "\o/ Add ".$this->all_flights[$id]['ident']." from ".$this->all_flights[$id]['format_source']." in Live DB : ";
781 781
 				$timeelapsed = microtime(true);
@@ -813,7 +813,7 @@  discard block
 block discarded – undo
813 813
 					if ($stats_heading == 16) $stats_heading = 0;
814 814
 					if (!isset($this->stats[$current_date][$source]['polar'][1])) {
815 815
 						for ($i=0;$i<=15;$i++) {
816
-						    $this->stats[$current_date][$source]['polar'][$i] = 0;
816
+							$this->stats[$current_date][$source]['polar'][$i] = 0;
817 817
 						}
818 818
 						$this->stats[$current_date][$source]['polar'][$stats_heading] = $stats_distance;
819 819
 					} else {
@@ -826,11 +826,11 @@  discard block
 block discarded – undo
826 826
 					//var_dump($this->stats);
827 827
 					if (!isset($this->stats[$current_date][$source]['hist'][$distance])) {
828 828
 						if (isset($this->stats[$current_date][$source]['hist'][0])) {
829
-						    end($this->stats[$current_date][$source]['hist']);
830
-						    $mini = key($this->stats[$current_date][$source]['hist'])+10;
829
+							end($this->stats[$current_date][$source]['hist']);
830
+							$mini = key($this->stats[$current_date][$source]['hist'])+10;
831 831
 						} else $mini = 0;
832 832
 						for ($i=$mini;$i<=$distance;$i+=10) {
833
-						    $this->stats[$current_date][$source]['hist'][$i] = 0;
833
+							$this->stats[$current_date][$source]['hist'][$i] = 0;
834 834
 						}
835 835
 						$this->stats[$current_date][$source]['hist'][$distance] = 1;
836 836
 					} else {
@@ -847,22 +847,22 @@  discard block
 block discarded – undo
847 847
 			
848 848
 			
849 849
 			if ($this->last_delete_hourly == '' || time() - $this->last_delete_hourly > 900) {
850
-			    if ($globalDebug) echo "---- Deleting Live Spotter data Not updated since 2 hour...";
851
-			    $SpotterLive = new SpotterLive($this->db);
852
-			    $SpotterLive->deleteLiveSpotterDataNotUpdated();
853
-			    $SpotterLive->db = null;
854
-			    //SpotterLive->deleteLiveSpotterData();
855
-			    if ($globalDebug) echo " Done\n";
856
-			    $this->last_delete_hourly = time();
850
+				if ($globalDebug) echo "---- Deleting Live Spotter data Not updated since 2 hour...";
851
+				$SpotterLive = new SpotterLive($this->db);
852
+				$SpotterLive->deleteLiveSpotterDataNotUpdated();
853
+				$SpotterLive->db = null;
854
+				//SpotterLive->deleteLiveSpotterData();
855
+				if ($globalDebug) echo " Done\n";
856
+				$this->last_delete_hourly = time();
857 857
 			}
858 858
 			
859
-		    }
860
-		    $ignoreImport = false;
859
+			}
860
+			$ignoreImport = false;
861 861
 		}
862 862
 		//if (function_exists('pcntl_fork') && $globalFork) pcntl_signal(SIGCHLD, SIG_IGN);
863 863
 		if ($send) return $this->all_flights[$id];
864
-	    }
864
+		}
865
+	}
865 866
 	}
866
-    }
867 867
 }
868 868
 ?>
Please login to merge, or discard this patch.
require/class.Scheduler.php 1 patch
Indentation   +164 added lines, -164 removed lines patch added patch discarded remove patch
@@ -8,29 +8,29 @@  discard block
 block discarded – undo
8 8
 
9 9
 class Schedule {
10 10
 	protected $cookies = array();
11
-        public $db;
11
+		public $db;
12 12
 	function __construct($dbc = null) {
13 13
 		$Connection = new Connection($dbc);
14 14
 		$this->db = $Connection->db;
15
-        }
15
+		}
16 16
 	
17 17
 	/**
18
-	* Add schedule data to database
19
-	* @param String $ident aircraft ident
20
-	* @param String $departure_airport_icao departure airport icao
21
-	* @param String $departure_airport_time departure airport time
22
-	* @param String $arrival_airport_icao arrival airport icao
23
-	* @param String $arrival_airport_time arrival airport time
18
+	 * Add schedule data to database
19
+	 * @param String $ident aircraft ident
20
+	 * @param String $departure_airport_icao departure airport icao
21
+	 * @param String $departure_airport_time departure airport time
22
+	 * @param String $arrival_airport_icao arrival airport icao
23
+	 * @param String $arrival_airport_time arrival airport time
24 24
 	/ @param String $source source of data
25
-	*/
25
+	 */
26 26
 	
27 27
 	public function addSchedule($ident,$departure_airport_icao,$departure_airport_time,$arrival_airport_icao,$arrival_airport_time,$source = 'website') {
28 28
 		date_default_timezone_set('UTC');
29 29
 		$date = date("Y-m-d H:i:s",time());
30
-	        //if ($departure_airport_time == '' && $arrival_airport_time == '') exit;
31
-	        //$query = "SELECT COUNT(*) FROM schedule WHERE ident = :ident";
32
-	        $query = "SELECT COUNT(*) FROM routes WHERE CallSign = :ident";
33
-	        $query_values = array(':ident' => $ident);
30
+			//if ($departure_airport_time == '' && $arrival_airport_time == '') exit;
31
+			//$query = "SELECT COUNT(*) FROM schedule WHERE ident = :ident";
32
+			$query = "SELECT COUNT(*) FROM routes WHERE CallSign = :ident";
33
+			$query_values = array(':ident' => $ident);
34 34
 		 try {
35 35
 			$sth = $this->db->prepare($query);
36 36
 			$sth->execute($query_values);
@@ -39,18 +39,18 @@  discard block
 block discarded – undo
39 39
 		}
40 40
 		if ($sth->fetchColumn() > 0) {
41 41
 			if ($departure_airport_time == '' && $arrival_airport_time == '') {
42
-			    $query = "SELECT COUNT(*) FROM routes WHERE CallSign = :ident AND FromAirport_ICAO = :departure_airport_icao AND ToAirport_ICAO = :arrival_airport_icao";
43
-			    $query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao);
42
+				$query = "SELECT COUNT(*) FROM routes WHERE CallSign = :ident AND FromAirport_ICAO = :departure_airport_icao AND ToAirport_ICAO = :arrival_airport_icao";
43
+				$query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao);
44 44
 			} elseif ($arrival_airport_time == '') {
45
-			    $query = "SELECT COUNT(*) FROM routes WHERE CallSign = :ident AND FromAirport_ICAO = :departure_airport_icao AND FromAirport_Time = :departure_airport_time AND ToAirport_ICAO = :arrival_airport_icao";
46
-			    $query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':departure_airport_time' => $departure_airport_time,':arrival_airport_icao' => $arrival_airport_icao);
45
+				$query = "SELECT COUNT(*) FROM routes WHERE CallSign = :ident AND FromAirport_ICAO = :departure_airport_icao AND FromAirport_Time = :departure_airport_time AND ToAirport_ICAO = :arrival_airport_icao";
46
+				$query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':departure_airport_time' => $departure_airport_time,':arrival_airport_icao' => $arrival_airport_icao);
47 47
 			} elseif ($departure_airport_time == '') {
48
-			    $query = "SELECT COUNT(*) FROM routes WHERE CallSign = :ident AND FromAirport_ICAO = :departure_airport_icao AND ToAirport_ICAO = :arrival_airport_icao AND ToAirport_Time = :arrival_airport_time";
49
-			    $query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_time' => $arrival_airport_time);
48
+				$query = "SELECT COUNT(*) FROM routes WHERE CallSign = :ident AND FromAirport_ICAO = :departure_airport_icao AND ToAirport_ICAO = :arrival_airport_icao AND ToAirport_Time = :arrival_airport_time";
49
+				$query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_time' => $arrival_airport_time);
50 50
 			} else {
51
-			    //$query = "SELECT COUNT(*) FROM schedule WHERE ident = :ident AND departure_airport_icao = :departure_airport_icao AND departure_airport_time = :departure_airport_time AND arrival_airport_icao = :arrival_airport_icao AND arrival_airport_time = :arrival_airport_time";
52
-			    $query = "SELECT COUNT(*) FROM routes WHERE CallSign = :ident AND FromAirport_ICAO = :departure_airport_icao AND FromAirport_Time = :departure_airport_time AND ToAirport_ICAO = :arrival_airport_icao AND ToAirport_Time = :arrival_airport_time";
53
-			    $query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':departure_airport_time' => $departure_airport_time,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_time' => $arrival_airport_time);
51
+				//$query = "SELECT COUNT(*) FROM schedule WHERE ident = :ident AND departure_airport_icao = :departure_airport_icao AND departure_airport_time = :departure_airport_time AND arrival_airport_icao = :arrival_airport_icao AND arrival_airport_time = :arrival_airport_time";
52
+				$query = "SELECT COUNT(*) FROM routes WHERE CallSign = :ident AND FromAirport_ICAO = :departure_airport_icao AND FromAirport_Time = :departure_airport_time AND ToAirport_ICAO = :arrival_airport_icao AND ToAirport_Time = :arrival_airport_time";
53
+				$query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':departure_airport_time' => $departure_airport_time,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_time' => $arrival_airport_time);
54 54
 			}
55 55
 			try {
56 56
 				$sth = $this->db->prepare($query);
@@ -61,17 +61,17 @@  discard block
 block discarded – undo
61 61
 			if ($sth->fetchColumn() == 0) {
62 62
 				//$query = 'UPDATE schedule SET departure_airport_icao = :departure_airport_icao, departure_airport_time = :departure_airport_time, arrival_airport_icao = :arrival_airport_icao, arrival_airport_time = :arrival_airport_time, date_modified = :date, source = :source WHERE ident = :ident';
63 63
 				if ($departure_airport_time == '' && $arrival_airport_time == '') {
64
-                            	    $query = 'UPDATE routes SET FromAirport_ICAO = :departure_airport_icao, ToAirport_ICAO = :arrival_airport_icao, date_modified = :date, Source = :source WHERE CallSign = :ident';
65
-				    $query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao, ':date' => $date, ':source' => $source);
64
+									$query = 'UPDATE routes SET FromAirport_ICAO = :departure_airport_icao, ToAirport_ICAO = :arrival_airport_icao, date_modified = :date, Source = :source WHERE CallSign = :ident';
65
+					$query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao, ':date' => $date, ':source' => $source);
66 66
 				} elseif ($arrival_airport_time == '') {
67
-                            	    $query = 'UPDATE routes SET FromAirport_ICAO = :departure_airport_icao, FromAiport_Time = :departure_airport_time, ToAirport_ICAO = :arrival_airport_icao, date_modified = :date, Source = :source WHERE CallSign = :ident';
68
-				    $query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':departure_airport_time' => $departure_airport_time,':arrival_airport_icao' => $arrival_airport_icao, ':date' => $date, ':source' => $source);
67
+									$query = 'UPDATE routes SET FromAirport_ICAO = :departure_airport_icao, FromAiport_Time = :departure_airport_time, ToAirport_ICAO = :arrival_airport_icao, date_modified = :date, Source = :source WHERE CallSign = :ident';
68
+					$query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':departure_airport_time' => $departure_airport_time,':arrival_airport_icao' => $arrival_airport_icao, ':date' => $date, ':source' => $source);
69 69
 				} elseif ($departure_airport_time == '') {
70
-                            	    $query = 'UPDATE routes SET FromAirport_ICAO = :departure_airport_icao, ToAirport_ICAO = :arrival_airport_icao, ToAirport_Time = :arrival_airport_time, date_modified = :date, Source = :source WHERE CallSign = :ident';
71
-				    $query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_time' => $arrival_airport_time, ':date' => $date, ':source' => $source);
70
+									$query = 'UPDATE routes SET FromAirport_ICAO = :departure_airport_icao, ToAirport_ICAO = :arrival_airport_icao, ToAirport_Time = :arrival_airport_time, date_modified = :date, Source = :source WHERE CallSign = :ident';
71
+					$query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_time' => $arrival_airport_time, ':date' => $date, ':source' => $source);
72 72
 				} else {
73
-                            	    $query = 'UPDATE routes SET FromAirport_ICAO = :departure_airport_icao, FromAiport_Time = :departure_airport_time, ToAirport_ICAO = :arrival_airport_icao, ToAirport_Time = :arrival_airport_time, date_modified = :date, Source = :source WHERE CallSign = :ident';
74
-				    $query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':departure_airport_time' => $departure_airport_time,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_time' => $arrival_airport_time, ':date' => $date, ':source' => $source);
73
+									$query = 'UPDATE routes SET FromAirport_ICAO = :departure_airport_icao, FromAiport_Time = :departure_airport_time, ToAirport_ICAO = :arrival_airport_icao, ToAirport_Time = :arrival_airport_time, date_modified = :date, Source = :source WHERE CallSign = :ident';
74
+					$query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':departure_airport_time' => $departure_airport_time,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_time' => $arrival_airport_time, ':date' => $date, ':source' => $source);
75 75
 				}
76 76
 				 try {
77 77
 					$sth = $this->db->prepare($query);
@@ -104,15 +104,15 @@  discard block
 block discarded – undo
104 104
 	}
105 105
 
106 106
 	public function getSchedule($ident) {
107
-	        $Translation = new Translation($this->db);
108
-	        $operator = $Translation->checkTranslation($ident,false);
109
-	        if ($ident != $operator) {
110
-	    		$query = "SELECT FromAirport_ICAO as departure_airport_icao, ToAirport_ICAO as arrival_airport_icao, FromAirport_Time as departure_airport_time, ToAirport_Time as arrival_airport_time FROM routes WHERE CallSign = :operator OR CallSign = :ident LIMIT 1";
111
-	    		$query_values = array(':ident' => $ident,'operator' => $operator);
112
-	    	} else {
113
-		        $query = "SELECT FromAirport_ICAO as departure_airport_icao, ToAirport_ICAO as arrival_airport_icao, FromAirport_Time as departure_airport_time, ToAirport_Time as arrival_airport_time FROM routes WHERE CallSign = :ident LIMIT 1";
114
-	    		$query_values = array(':ident' => $ident);
115
-	    	}
107
+			$Translation = new Translation($this->db);
108
+			$operator = $Translation->checkTranslation($ident,false);
109
+			if ($ident != $operator) {
110
+				$query = "SELECT FromAirport_ICAO as departure_airport_icao, ToAirport_ICAO as arrival_airport_icao, FromAirport_Time as departure_airport_time, ToAirport_Time as arrival_airport_time FROM routes WHERE CallSign = :operator OR CallSign = :ident LIMIT 1";
111
+				$query_values = array(':ident' => $ident,'operator' => $operator);
112
+			} else {
113
+				$query = "SELECT FromAirport_ICAO as departure_airport_icao, ToAirport_ICAO as arrival_airport_icao, FromAirport_Time as departure_airport_time, ToAirport_Time as arrival_airport_time FROM routes WHERE CallSign = :ident LIMIT 1";
114
+				$query_values = array(':ident' => $ident);
115
+			}
116 116
 		 try {
117 117
 			$sth = $this->db->prepare($query);
118 118
 			$sth->execute($query_values);
@@ -127,15 +127,15 @@  discard block
 block discarded – undo
127 127
 
128 128
 	public function checkSchedule($ident) {
129 129
 		global $globalDBdriver;
130
-	        //$query = "SELECT COUNT(*) as nb FROM schedule WHERE ident = :ident AND date_added > DATE_SUB(CURDATE(), INTERVAL 8 DAY) - 8 LIMIT 1";
131
-	        if ($globalDBdriver == 'mysql') {
130
+			//$query = "SELECT COUNT(*) as nb FROM schedule WHERE ident = :ident AND date_added > DATE_SUB(CURDATE(), INTERVAL 8 DAY) - 8 LIMIT 1";
131
+			if ($globalDBdriver == 'mysql') {
132 132
 			$query = "SELECT COUNT(*) as nb FROM routes WHERE CallSign = :ident AND ((date_added BETWEEN DATE(DATE_SUB(CURDATE(), INTERVAL 15 DAY)) AND DATE(NOW()) and date_modified IS NULL) OR (date_modified BETWEEN DATE(DATE_SUB(CURDATE(), INTERVAL 15 DAY)) AND DATE(NOW()))) LIMIT 1";
133 133
 		} else {
134 134
 			$query = "SELECT COUNT(*) as nb FROM routes WHERE CallSign = :ident 
135 135
 			AND ((date_added::timestamp BETWEEN CURRENT_TIMESTAMP - INTERVAL '15 DAYS' AND CURRENT_TIMESTAMP) and date_modified::timestamp IS NULL)
136 136
 			     OR (date_modified::timestamp BETWEEN CURRENT_TIMESTAMP - INTERVAL '15 DAYS' AND CURRENT_TIMESTAMP) LIMIT 1";
137 137
 		}
138
-	        $query_values = array(':ident' => $ident);
138
+			$query_values = array(':ident' => $ident);
139 139
 		 try {
140 140
 			$sth = $this->db->prepare($query);
141 141
 			$sth->execute($query_values);
@@ -147,12 +147,12 @@  discard block
 block discarded – undo
147 147
 	}
148 148
 
149 149
 	/**
150
-	* Get flight info from Air France
151
-	* @param String $callsign The callsign
152
-	* @param String $date date we want flight number info
153
-	* @param String $carrier IATA code
154
-	* @return Flight departure and arrival airports and time
155
-	*/
150
+	 * Get flight info from Air France
151
+	 * @param String $callsign The callsign
152
+	 * @param String $date date we want flight number info
153
+	 * @param String $carrier IATA code
154
+	 * @return Flight departure and arrival airports and time
155
+	 */
156 156
 	private function getAirFrance($callsign, $date = 'NOW',$carrier = 'AF') {
157 157
 		$Common = new Common();
158 158
 		$check_date = new Datetime($date);
@@ -188,11 +188,11 @@  discard block
 block discarded – undo
188 188
 	}
189 189
 
190 190
 	/**
191
-	* Get flight info from EasyJet
192
-	* @param String $callsign The callsign
193
-	* @param String $date date we want flight number info
194
-	* @return Flight departure and arrival airports and time
195
-	*/
191
+	 * Get flight info from EasyJet
192
+	 * @param String $callsign The callsign
193
+	 * @param String $date date we want flight number info
194
+	 * @return Flight departure and arrival airports and time
195
+	 */
196 196
 	private function getEasyJet($callsign, $date = 'NOW') {
197 197
 		global $globalTimezone;
198 198
 		$Common = new Common();
@@ -216,10 +216,10 @@  discard block
 block discarded – undo
216 216
 	}
217 217
 
218 218
 	/**
219
-	* Get flight info from Ryanair
220
-	* @param String $callsign The callsign
221
-	* @return Flight departure and arrival airports and time
222
-	*/
219
+	 * Get flight info from Ryanair
220
+	 * @param String $callsign The callsign
221
+	 * @return Flight departure and arrival airports and time
222
+	 */
223 223
 	private function getRyanair($callsign) {
224 224
 		$Common = new Common();
225 225
 		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
@@ -242,10 +242,10 @@  discard block
 block discarded – undo
242 242
 	}
243 243
 
244 244
 	/**
245
-	* Get flight info from Swiss
246
-	* @param String $callsign The callsign
247
-	* @return Flight departure and arrival airports and time
248
-	*/
245
+	 * Get flight info from Swiss
246
+	 * @param String $callsign The callsign
247
+	 * @return Flight departure and arrival airports and time
248
+	 */
249 249
 	private function getSwiss($callsign) {
250 250
 		$Common = new Common();
251 251
 		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
@@ -272,11 +272,11 @@  discard block
 block discarded – undo
272 272
 	}
273 273
 	
274 274
 	/**
275
-	* Get flight info from British Airways API
276
-	* @param String $callsign The callsign
277
-	* @param String $date date we want flight number info
278
-	* @return Flight departure and arrival airports and time
279
-	*/
275
+	 * Get flight info from British Airways API
276
+	 * @param String $callsign The callsign
277
+	 * @param String $date date we want flight number info
278
+	 * @return Flight departure and arrival airports and time
279
+	 */
280 280
 	public function getBritishAirways($callsign, $date = 'NOW') {
281 281
 		global $globalBritishAirwaysKey;
282 282
 		$Common = new Common();
@@ -300,11 +300,11 @@  discard block
 block discarded – undo
300 300
 	}
301 301
 
302 302
 	/**
303
-	* Get flight info from Lutfhansa API
304
-	* @param String $callsign The callsign
305
-	* @param String $date date we want flight number info
306
-	* @return Flight departure and arrival airports and time
307
-	*/
303
+	 * Get flight info from Lutfhansa API
304
+	 * @param String $callsign The callsign
305
+	 * @param String $date date we want flight number info
306
+	 * @return Flight departure and arrival airports and time
307
+	 */
308 308
 	public function getLufthansa($callsign, $date = 'NOW') {
309 309
 		global $globalLufthansaKey;
310 310
 		$Common = new Common();
@@ -334,11 +334,11 @@  discard block
 block discarded – undo
334 334
 	}
335 335
 
336 336
 	/**
337
-	* Get flight info from Transavia API
338
-	* @param String $callsign The callsign
339
-	* @param String $date date we want flight number info
340
-	* @return Flight departure and arrival airports and time
341
-	*/
337
+	 * Get flight info from Transavia API
338
+	 * @param String $callsign The callsign
339
+	 * @param String $date date we want flight number info
340
+	 * @return Flight departure and arrival airports and time
341
+	 */
342 342
 	private function getTransavia($callsign, $date = 'NOW') {
343 343
 		global $globalTransaviaKey;
344 344
 		$Common = new Common();
@@ -362,10 +362,10 @@  discard block
 block discarded – undo
362 362
 	}
363 363
 
364 364
 	/**
365
-	* Get flight info from Tunisair
366
-	* @param String $callsign The callsign
367
-	* @return Flight departure and arrival airports and time
368
-	*/
365
+	 * Get flight info from Tunisair
366
+	 * @param String $callsign The callsign
367
+	 * @return Flight departure and arrival airports and time
368
+	 */
369 369
 	private function getTunisair($callsign) {
370 370
 		$Common = new Common();
371 371
 		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
@@ -382,10 +382,10 @@  discard block
 block discarded – undo
382 382
 	}
383 383
 
384 384
 	/**
385
-	* Get flight info from Vueling
386
-	* @param String $callsign The callsign
387
-	* @return Flight departure and arrival airports and time
388
-	*/
385
+	 * Get flight info from Vueling
386
+	 * @param String $callsign The callsign
387
+	 * @return Flight departure and arrival airports and time
388
+	 */
389 389
 	private function getVueling($callsign) {
390 390
 		$Common = new Common();
391 391
 		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
@@ -408,11 +408,11 @@  discard block
 block discarded – undo
408 408
 	}
409 409
 
410 410
 	/**
411
-	* Get flight info from Iberia
412
-	* @param String $callsign The callsign
413
-	* @param String $date date we want flight number info
414
-	* @return Flight departure and arrival airports and time
415
-	*/
411
+	 * Get flight info from Iberia
412
+	 * @param String $callsign The callsign
413
+	 * @param String $date date we want flight number info
414
+	 * @return Flight departure and arrival airports and time
415
+	 */
416 416
 	private function getIberia($callsign, $date = 'NOW') {
417 417
 		$Common = new Common();
418 418
 		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
@@ -442,11 +442,11 @@  discard block
 block discarded – undo
442 442
 	}
443 443
 
444 444
 	/**
445
-	* Get flight info from Star Alliance
446
-	* @param String $callsign The callsign
447
-	* @param String $date date we want flight number info
448
-	* @return Flight departure and arrival airports and time
449
-	*/
445
+	 * Get flight info from Star Alliance
446
+	 * @param String $callsign The callsign
447
+	 * @param String $date date we want flight number info
448
+	 * @return Flight departure and arrival airports and time
449
+	 */
450 450
 	private function getStarAlliance($callsign, $date = 'NOW',$carrier = '') {
451 451
 		$Common = new Common();
452 452
 		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
@@ -476,11 +476,11 @@  discard block
 block discarded – undo
476 476
 	}
477 477
 
478 478
 	/**
479
-	* Get flight info from Alitalia
480
-	* @param String $callsign The callsign
481
-	* @param String $date date we want flight number info
482
-	* @return Flight departure and arrival airports and time
483
-	*/
479
+	 * Get flight info from Alitalia
480
+	 * @param String $callsign The callsign
481
+	 * @param String $date date we want flight number info
482
+	 * @return Flight departure and arrival airports and time
483
+	 */
484 484
 	private function getAlitalia($callsign, $date = 'NOW') {
485 485
 		$Common = new Common();
486 486
 		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
@@ -499,11 +499,11 @@  discard block
 block discarded – undo
499 499
 	}
500 500
 
501 501
 	/**
502
-	* Get flight info from Brussels airlines
503
-	* @param String $callsign The callsign
504
-	* @param String $date date we want flight number info
505
-	* @return Flight departure and arrival airports and time
506
-	*/
502
+	 * Get flight info from Brussels airlines
503
+	 * @param String $callsign The callsign
504
+	 * @param String $date date we want flight number info
505
+	 * @return Flight departure and arrival airports and time
506
+	 */
507 507
 	private function getBrussels($callsign, $date = 'NOW') {
508 508
 		$Common = new Common();
509 509
 		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
@@ -513,24 +513,24 @@  discard block
 block discarded – undo
513 513
 		if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array();
514 514
 		$data = $Common->getData($url);
515 515
 		if ($data != '') {
516
-		    //echo $data;
517
-		    $parsed_json = json_decode($data);
518
-		    if (isset($parsed_json[0]->FromAirportCode)) {
516
+			//echo $data;
517
+			$parsed_json = json_decode($data);
518
+			if (isset($parsed_json[0]->FromAirportCode)) {
519 519
 			$DepartureAirportIata = $parsed_json[0]->FromAirportCode;
520 520
 			$ArrivalAirportIata = $parsed_json[0]->ToAirportCode;
521 521
 			$departureTime = date('H:i',strtotime($parsed_json[0]->ScheduledDepatureDate));
522 522
 			$arrivalTime = date('H:i',strtotime($parsed_json[0]->ScheduledArrivalDate));
523 523
 			return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_brussels');
524
-		    }
524
+			}
525 525
 		}
526 526
 	}
527 527
 
528 528
 	/**
529
-	* Get flight info from FlightRadar24
530
-	* @param String $callsign The callsign
531
-	* @param String $date date we want flight number info
532
-	* @return Flight departure and arrival airports and time
533
-	*/
529
+	 * Get flight info from FlightRadar24
530
+	 * @param String $callsign The callsign
531
+	 * @param String $date date we want flight number info
532
+	 * @return Flight departure and arrival airports and time
533
+	 */
534 534
 /*
535 535
 	public function getFlightRadar24($callsign, $date = 'NOW') {
536 536
 		$Common = new Common();
@@ -559,11 +559,11 @@  discard block
 block discarded – undo
559 559
 	}
560 560
   */
561 561
 	/**
562
-	* Get flight info from Lufthansa
563
-	* @param String $callsign The callsign
564
-	* @param String $date date we want flight number info
565
-	* @return Flight departure and arrival airports and time
566
-	*/
562
+	 * Get flight info from Lufthansa
563
+	 * @param String $callsign The callsign
564
+	 * @param String $date date we want flight number info
565
+	 * @return Flight departure and arrival airports and time
566
+	 */
567 567
 
568 568
 /*	private function getLufthansa($callsign, $date = 'NOW') {
569 569
 		$Common = new Common();
@@ -591,11 +591,11 @@  discard block
 block discarded – undo
591 591
 	}
592 592
   */
593 593
 	/**
594
-	* Get flight info from flytap
595
-	* @param String $callsign The callsign
596
-	* @param String $date date we want flight number info
597
-	* @return Flight departure and arrival airports and time
598
-	*/
594
+	 * Get flight info from flytap
595
+	 * @param String $callsign The callsign
596
+	 * @param String $date date we want flight number info
597
+	 * @return Flight departure and arrival airports and time
598
+	 */
599 599
 	private function getFlyTap($callsign, $date = 'NOW') {
600 600
 		$Common = new Common();
601 601
 		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
@@ -618,11 +618,11 @@  discard block
 block discarded – undo
618 618
 	}
619 619
 
620 620
 	/**
621
-	* Get flight info from flightmapper
622
-	* @param String $callsign The callsign
623
-	* @param String $date date we want flight number info
624
-	* @return Flight departure and arrival airports and time
625
-	*/
621
+	 * Get flight info from flightmapper
622
+	 * @param String $callsign The callsign
623
+	 * @param String $date date we want flight number info
624
+	 * @return Flight departure and arrival airports and time
625
+	 */
626 626
 	public function getFlightMapper($callsign, $date = 'NOW') {
627 627
 		$Common = new Common();
628 628
 		if (!is_numeric(substr($callsign, 0, 3)))
@@ -644,11 +644,11 @@  discard block
 block discarded – undo
644 644
 				$sched = $table[5][0];
645 645
 				$n = sscanf($sched,'%*s %5[0-9:] %*[^()] (%3[A-Z]) %5[0-9:] %*[^()] (%3[A-Z])',$dhour,$darr,$ahour,$aarr);
646 646
 				if ($n == 7) {
647
-				    $departureTime = $dhour;
648
-				    $arrivalTime = $ahour;
649
-				    $DepartureAirportIata = str_replace(array('(',')'),'',$darr);
650
-				    $ArrivalAirportIata = str_replace(array('(',')'),'',$aarr);
651
-				    return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_flightmapper');
647
+					$departureTime = $dhour;
648
+					$arrivalTime = $ahour;
649
+					$DepartureAirportIata = str_replace(array('(',')'),'',$darr);
650
+					$ArrivalAirportIata = str_replace(array('(',')'),'',$aarr);
651
+					return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_flightmapper');
652 652
 				}
653 653
 			}
654 654
 		}
@@ -656,11 +656,11 @@  discard block
 block discarded – undo
656 656
 	}
657 657
 
658 658
 	/**
659
-	* Get flight info from flightaware
660
-	* @param String $callsign The callsign
661
-	* @param String $date date we want flight number info
662
-	* @return Flight departure and arrival airports and time
663
-	*/
659
+	 * Get flight info from flightaware
660
+	 * @param String $callsign The callsign
661
+	 * @param String $date date we want flight number info
662
+	 * @return Flight departure and arrival airports and time
663
+	 */
664 664
 	public function getFlightAware($callsign, $date = 'NOW') {
665 665
 		$Common = new Common();
666 666
 		if (!is_numeric(substr($callsign, 0, 3)))
@@ -691,11 +691,11 @@  discard block
 block discarded – undo
691 691
 	}
692 692
 
693 693
 	/**
694
-	* Get flight info from CostToTravel
695
-	* @param String $callsign The callsign
696
-	* @param String $date date we want flight number info
697
-	* @return Flight departure and arrival airports and time
698
-	*/
694
+	 * Get flight info from CostToTravel
695
+	 * @param String $callsign The callsign
696
+	 * @param String $date date we want flight number info
697
+	 * @return Flight departure and arrival airports and time
698
+	 */
699 699
 	public function getCostToTravel($callsign, $date = 'NOW') {
700 700
 		$Common = new Common();
701 701
 		$url= "http://www.costtotravel.com/flight-number/".$callsign;
@@ -717,11 +717,11 @@  discard block
 block discarded – undo
717 717
 	}
718 718
 
719 719
 	/**
720
-	* Get flight info from Air Canada
721
-	* @param String $callsign The callsign
722
-	* @param String $date date we want flight number info
723
-	* @return Flight departure and arrival airports and time
724
-	*/
720
+	 * Get flight info from Air Canada
721
+	 * @param String $callsign The callsign
722
+	 * @param String $date date we want flight number info
723
+	 * @return Flight departure and arrival airports and time
724
+	 */
725 725
 	private function getAirCanada($callsign,$date = 'NOW') {
726 726
 		$Common = new Common();
727 727
 		date_default_timezone_set('UTC');
@@ -745,11 +745,11 @@  discard block
 block discarded – undo
745 745
 	}
746 746
 
747 747
 	/**
748
-	* Get flight info from Vietnam Airlines
749
-	* @param String $callsign The callsign
750
-	* @param String $date date we want flight number info
751
-	* @return Flight departure and arrival airports and time
752
-	*/
748
+	 * Get flight info from Vietnam Airlines
749
+	 * @param String $callsign The callsign
750
+	 * @param String $date date we want flight number info
751
+	 * @return Flight departure and arrival airports and time
752
+	 */
753 753
 	private function getVietnamAirlines($callsign, $date = 'NOW') {
754 754
 		$Common = new Common();
755 755
 		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
@@ -771,12 +771,12 @@  discard block
 block discarded – undo
771 771
 	}
772 772
 
773 773
 	/**
774
-	* Get flight info from Air Berlin
775
-	* @param String $callsign The callsign
776
-	* @param String $date date we want flight number info
777
-	* @param String $carrier IATA code
778
-	* @return Flight departure and arrival airports and time
779
-	*/
774
+	 * Get flight info from Air Berlin
775
+	 * @param String $callsign The callsign
776
+	 * @param String $date date we want flight number info
777
+	 * @param String $carrier IATA code
778
+	 * @return Flight departure and arrival airports and time
779
+	 */
780 780
 	private function getAirBerlin($callsign, $date = 'NOW', $carrier = 'AB') {
781 781
 		$Common = new Common();
782 782
 		date_default_timezone_set('UTC');
@@ -805,11 +805,11 @@  discard block
 block discarded – undo
805 805
 			$table = $Common->table2array($data);
806 806
 			$flight = $table;
807 807
 			if (isset($flight[5][4])) {
808
-			    $arrivalTime = $flight[5][4];
809
-			    $arrivalAirport = $flight[5][3];
808
+				$arrivalTime = $flight[5][4];
809
+				$arrivalAirport = $flight[5][3];
810 810
 			} else {
811
-			    $arrivalTime = '';
812
-			    $arrivalAirport = '';
811
+				$arrivalTime = '';
812
+				$arrivalAirport = '';
813 813
 			}
814 814
 		}
815 815
 		$url = 'http://www.airberlin.com/en-US/site/json/suggestAirport.php?searchfor=departures&searchflightid=0&departures%5B%5D=&suggestsource%5B0%5D=activeairports&withcountries=0&withoutroutings=0&promotion%5Bid%5D=&promotion%5Btype%5D=&routesource%5B0%5D=airberlin&routesource%5B1%5D=partner';
@@ -1091,7 +1091,7 @@  discard block
 block discarded – undo
1091 1091
 					}
1092 1092
 			}
1093 1093
 		}
1094
-	        return array();
1094
+			return array();
1095 1095
 	}
1096 1096
 }
1097 1097
 
Please login to merge, or discard this patch.
install/libs/simple_html_dom.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -824,11 +824,11 @@
 block discarded – undo
824 824
 	}
825 825
 
826 826
 	/**
827
-	* Returns true if $string is valid UTF-8 and false otherwise.
828
-	*
829
-	* @param mixed $str String to be tested
830
-	* @return boolean
831
-	*/
827
+	 * Returns true if $string is valid UTF-8 and false otherwise.
828
+	 *
829
+	 * @param mixed $str String to be tested
830
+	 * @return boolean
831
+	 */
832 832
 	static function is_utf8($str)
833 833
 	{
834 834
 		$c=0; $b=0;
Please login to merge, or discard this patch.
manufacturer-statistics-departure-airport-country.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -3,8 +3,8 @@
 block discarded – undo
3 3
 require_once('require/class.Spotter.php');
4 4
 require_once('require/class.Language.php');
5 5
 if (!isset($_GET['aircraft_manufacturer'])) {
6
-        header('Location: '.$globalURL.'/manufacturer');
7
-        die();
6
+		header('Location: '.$globalURL.'/manufacturer');
7
+		die();
8 8
 }
9 9
 $Spotter = new Spotter();
10 10
 $manufacturer = ucwords(str_replace("-", " ", filter_input(INPUT_GET,'aircraft_manufacturer',FILTER_SANITIZE_STRING)));
Please login to merge, or discard this patch.
airport-statistics-arrival-airport.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -3,8 +3,8 @@
 block discarded – undo
3 3
 require_once('require/class.Spotter.php');
4 4
 require_once('require/class.Language.php');
5 5
 if (!isset($_GET['airport'])) {
6
-        header('Location: '.$globalURL.'/airport');
7
-        die();
6
+		header('Location: '.$globalURL.'/airport');
7
+		die();
8 8
 }
9 9
 $airport = filter_input(INPUT_GET,'airport',FILTER_SANITIZE_STRING);
10 10
 $Spotter = new Spotter();
Please login to merge, or discard this patch.
manufacturer-statistics-aircraft.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -3,8 +3,8 @@
 block discarded – undo
3 3
 require_once('require/class.Spotter.php');
4 4
 require_once('require/class.Language.php');
5 5
 if (!isset($_GET['aircraft_manufacturer'])) {
6
-        header('Location: '.$globalURL.'/manufacturer');
7
-        die();
6
+		header('Location: '.$globalURL.'/manufacturer');
7
+		die();
8 8
 }
9 9
 $Spotter = new Spotter();
10 10
 $manufacturer = ucwords(str_replace("-", " ", filter_input(INPUT_GET,'aircraft_manufacturer',FILTER_SANITIZE_STRING)));
Please login to merge, or discard this patch.