Completed
Push — master ( 0a71c8...58eab4 )
by Yannick
38:44
created
install/class.update_db.php 1 patch
Indentation   +383 added lines, -383 removed lines patch added patch discarded remove patch
@@ -85,38 +85,38 @@  discard block
 block discarded – undo
85 85
 		try {
86 86
 			//$Connection = new Connection();
87 87
 			$sth = $Connection->db->prepare($query);
88
-                        $sth->execute(array(':source' => $database_file));
89
-                } catch(PDOException $e) {
90
-                        return "error : ".$e->getMessage();
91
-                }
88
+						$sth->execute(array(':source' => $database_file));
89
+				} catch(PDOException $e) {
90
+						return "error : ".$e->getMessage();
91
+				}
92 92
 
93
-    		if ($globalDebug) echo " - Add routes to DB -";
94
-    		update_db::connect_sqlite($database_file);
93
+			if ($globalDebug) echo " - Add routes to DB -";
94
+			update_db::connect_sqlite($database_file);
95 95
 		//$query = 'select Route.RouteID, Route.callsign, operator.Icao AS operator_icao, FromAir.Icao AS FromAirportIcao, ToAir.Icao AS ToAirportIcao from Route inner join operator ON Route.operatorId = operator.operatorId LEFT JOIN Airport AS FromAir ON route.FromAirportId = FromAir.AirportId LEFT JOIN Airport AS ToAir ON ToAir.AirportID = route.ToAirportID';
96 96
 		$query = "select Route.RouteID, Route.callsign, operator.Icao AS operator_icao, FromAir.Icao AS FromAirportIcao, ToAir.Icao AS ToAirportIcao, rstp.allstop AS AllStop from Route inner join operator ON Route.operatorId = operator.operatorId LEFT JOIN Airport AS FromAir ON route.FromAirportId = FromAir.AirportId LEFT JOIN Airport AS ToAir ON ToAir.AirportID = route.ToAirportID LEFT JOIN (select RouteId,GROUP_CONCAT(icao,' ') as allstop from routestop left join Airport as air ON routestop.AirportId = air.AirportID group by RouteID) AS rstp ON Route.RouteID = rstp.RouteID";
97 97
 		try {
98
-                        $sth = update_db::$db_sqlite->prepare($query);
99
-                        $sth->execute();
100
-                } catch(PDOException $e) {
101
-                        return "error : ".$e->getMessage();
102
-                }
98
+						$sth = update_db::$db_sqlite->prepare($query);
99
+						$sth->execute();
100
+				} catch(PDOException $e) {
101
+						return "error : ".$e->getMessage();
102
+				}
103 103
 		//$query_dest = 'INSERT INTO routes (`RouteID`,`CallSign`,`Operator_ICAO`,`FromAirport_ICAO`,`ToAirport_ICAO`,`RouteStop`,`Source`) VALUES (:RouteID, :CallSign, :Operator_ICAO, :FromAirport_ICAO, :ToAirport_ICAO, :routestop, :source)';
104 104
 		$query_dest = 'INSERT INTO routes (CallSign,Operator_ICAO,FromAirport_ICAO,ToAirport_ICAO,RouteStop,Source) VALUES (:CallSign, :Operator_ICAO, :FromAirport_ICAO, :ToAirport_ICAO, :routestop, :source)';
105 105
 		$Connection = new Connection();
106 106
 		$sth_dest = $Connection->db->prepare($query_dest);
107 107
 		try {
108 108
 			if ($globalTransaction) $Connection->db->beginTransaction();
109
-            		while ($values = $sth->fetch(PDO::FETCH_ASSOC)) {
109
+					while ($values = $sth->fetch(PDO::FETCH_ASSOC)) {
110 110
 				//$query_dest_values = array(':RouteID' => $values['RouteId'],':CallSign' => $values['Callsign'],':Operator_ICAO' => $values['operator_icao'],':FromAirport_ICAO' => $values['FromAirportIcao'],':ToAirport_ICAO' => $values['ToAirportIcao'],':routestop' => $values['AllStop'],':source' => $database_file);
111 111
 				$query_dest_values = array(':CallSign' => $values['Callsign'],':Operator_ICAO' => $values['operator_icao'],':FromAirport_ICAO' => $values['FromAirportIcao'],':ToAirport_ICAO' => $values['ToAirportIcao'],':routestop' => $values['AllStop'],':source' => $database_file);
112 112
 				$sth_dest->execute($query_dest_values);
113
-            		}
113
+					}
114 114
 			if ($globalTransaction) $Connection->db->commit();
115 115
 		} catch(PDOException $e) {
116 116
 			if ($globalTransaction) $Connection->db->rollBack(); 
117 117
 			return "error : ".$e->getMessage();
118 118
 		}
119
-                return '';
119
+				return '';
120 120
 	}
121 121
 	public static function retrieve_route_oneworld($database_file) {
122 122
 		global $globalDebug, $globalTransaction;
@@ -127,12 +127,12 @@  discard block
 block discarded – undo
127 127
 		try {
128 128
 			//$Connection = new Connection();
129 129
 			$sth = $Connection->db->prepare($query);
130
-                        $sth->execute(array(':source' => 'oneworld'));
131
-                } catch(PDOException $e) {
132
-                        return "error : ".$e->getMessage();
133
-                }
130
+						$sth->execute(array(':source' => 'oneworld'));
131
+				} catch(PDOException $e) {
132
+						return "error : ".$e->getMessage();
133
+				}
134 134
 
135
-    		if ($globalDebug) echo " - Add routes to DB -";
135
+			if ($globalDebug) echo " - Add routes to DB -";
136 136
 		require_once(dirname(__FILE__).'/../require/class.Spotter.php');
137 137
 		$Spotter = new Spotter();
138 138
 		if ($fh = fopen($database_file,"r")) {
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
 			}
157 157
 			if ($globalTransaction) $Connection->db->commit();
158 158
 		}
159
-                return '';
159
+				return '';
160 160
 	}
161 161
 	
162 162
 	public static function retrieve_route_skyteam($database_file) {
@@ -168,12 +168,12 @@  discard block
 block discarded – undo
168 168
 		try {
169 169
 			//$Connection = new Connection();
170 170
 			$sth = $Connection->db->prepare($query);
171
-                        $sth->execute(array(':source' => 'skyteam'));
172
-                } catch(PDOException $e) {
173
-                        return "error : ".$e->getMessage();
174
-                }
171
+						$sth->execute(array(':source' => 'skyteam'));
172
+				} catch(PDOException $e) {
173
+						return "error : ".$e->getMessage();
174
+				}
175 175
 
176
-    		if ($globalDebug) echo " - Add routes to DB -";
176
+			if ($globalDebug) echo " - Add routes to DB -";
177 177
 
178 178
 		require_once(dirname(__FILE__).'/../require/class.Spotter.php');
179 179
 		$Spotter = new Spotter();
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
 				return "error : ".$e->getMessage();
200 200
 			}
201 201
 		}
202
-                return '';
202
+				return '';
203 203
 	}
204 204
 	public static function retrieve_modes_sqlite_to_dest($database_file) {
205 205
 		global $globalTransaction;
@@ -208,27 +208,27 @@  discard block
 block discarded – undo
208 208
 		try {
209 209
 			$Connection = new Connection();
210 210
 			$sth = $Connection->db->prepare($query);
211
-                        $sth->execute(array(':source' => $database_file));
212
-                } catch(PDOException $e) {
213
-                        return "error : ".$e->getMessage();
214
-                }
211
+						$sth->execute(array(':source' => $database_file));
212
+				} catch(PDOException $e) {
213
+						return "error : ".$e->getMessage();
214
+				}
215 215
 		$query = "DELETE FROM aircraft_owner WHERE Source = '' OR Source IS NULL OR Source = :source";
216 216
 		try {
217 217
 			$Connection = new Connection();
218 218
 			$sth = $Connection->db->prepare($query);
219
-                        $sth->execute(array(':source' => $database_file));
220
-                } catch(PDOException $e) {
221
-                        return "error : ".$e->getMessage();
222
-                }
219
+						$sth->execute(array(':source' => $database_file));
220
+				} catch(PDOException $e) {
221
+						return "error : ".$e->getMessage();
222
+				}
223 223
 
224
-    		update_db::connect_sqlite($database_file);
224
+			update_db::connect_sqlite($database_file);
225 225
 		$query = 'select * from Aircraft';
226 226
 		try {
227
-                        $sth = update_db::$db_sqlite->prepare($query);
228
-                        $sth->execute();
229
-                } catch(PDOException $e) {
230
-                        return "error : ".$e->getMessage();
231
-                }
227
+						$sth = update_db::$db_sqlite->prepare($query);
228
+						$sth->execute();
229
+				} catch(PDOException $e) {
230
+						return "error : ".$e->getMessage();
231
+				}
232 232
 		//$query_dest = 'INSERT INTO aircraft_modes (`AircraftID`,`FirstCreated`,`LastModified`, `ModeS`,`ModeSCountry`,`Registration`,`ICAOTypeCode`,`SerialNo`, `OperatorFlagCode`, `Manufacturer`, `Type`, `FirstRegDate`, `CurrentRegDate`, `Country`, `PreviousID`, `DeRegDate`, `Status`, `PopularName`,`GenericName`,`AircraftClass`, `Engines`, `OwnershipStatus`,`RegisteredOwners`,`MTOW`, `TotalHours`, `YearBuilt`, `CofACategory`, `CofAExpiry`, `UserNotes`, `Interested`, `UserTag`, `InfoUrl`, `PictureUrl1`, `PictureUrl2`, `PictureUrl3`, `UserBool1`, `UserBool2`, `UserBool3`, `UserBool4`, `UserBool5`, `UserString1`, `UserString2`, `UserString3`, `UserString4`, `UserString5`, `UserInt1`, `UserInt2`, `UserInt3`, `UserInt4`, `UserInt5`) VALUES (:AircraftID,:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:SerialNo, :OperatorFlagCode, :Manufacturer, :Type, :FirstRegDate, :CurrentRegDate, :Country, :PreviousID, :DeRegDate, :Status, :PopularName,:GenericName,:AircraftClass, :Engines, :OwnershipStatus,:RegisteredOwners,:MTOW, :TotalHours,:YearBuilt, :CofACategory, :CofAExpiry, :UserNotes, :Interested, :UserTag, :InfoUrl, :PictureUrl1, :PictureUrl2, :PictureUrl3, :UserBool1, :UserBool2, :UserBool3, :UserBool4, :UserBool5, :UserString1, :UserString2, :UserString3, :UserString4, :UserString5, :UserInt1, :UserInt2, :UserInt3, :UserInt4, :UserInt5)';
233 233
 		$query_dest = 'INSERT INTO aircraft_modes (LastModified, ModeS,ModeSCountry,Registration,ICAOTypeCode,type_flight,Source) VALUES (:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:type,:source)';
234 234
 		
@@ -239,17 +239,17 @@  discard block
 block discarded – undo
239 239
 		$sth_dest_owner = $Connection->db->prepare($query_dest_owner);
240 240
 		try {
241 241
 			if ($globalTransaction) $Connection->db->beginTransaction();
242
-            		while ($values = $sth->fetch(PDO::FETCH_ASSOC)) {
242
+					while ($values = $sth->fetch(PDO::FETCH_ASSOC)) {
243 243
 			//$query_dest_values = array(':AircraftID' => $values['AircraftID'],':FirstCreated' => $values['FirstCreated'],':LastModified' => $values['LastModified'],':ModeS' => $values['ModeS'],':ModeSCountry' => $values['ModeSCountry'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':SerialNo' => $values['SerialNo'], ':OperatorFlagCode' => $values['OperatorFlagCode'], ':Manufacturer' => $values['Manufacturer'], ':Type' => $values['Type'], ':FirstRegDate' => $values['FirstRegDate'], ':CurrentRegDate' => $values['CurrentRegDate'], ':Country' => $values['Country'], ':PreviousID' => $values['PreviousID'], ':DeRegDate' => $values['DeRegDate'], ':Status' => $values['Status'], ':PopularName' => $values['PopularName'],':GenericName' => $values['GenericName'],':AircraftClass' => $values['AircraftClass'], ':Engines' => $values['Engines'], ':OwnershipStatus' => $values['OwnershipStatus'],':RegisteredOwners' => $values['RegisteredOwners'],':MTOW' => $values['MTOW'], ':TotalHours' => $values['TotalHours'],':YearBuilt' => $values['YearBuilt'], ':CofACategory' => $values['CofACategory'], ':CofAExpiry' => $values['CofAExpiry'], ':UserNotes' => $values['UserNotes'], ':Interested' => $values['Interested'], ':UserTag' => $values['UserTag'], ':InfoUrl' => $values['InfoURL'], ':PictureUrl1' => $values['PictureURL1'], ':PictureUrl2' => $values['PictureURL2'], ':PictureUrl3' => $values['PictureURL3'], ':UserBool1' => $values['UserBool1'], ':UserBool2' => $values['UserBool2'], ':UserBool3' => $values['UserBool3'], ':UserBool4' => $values['UserBool4'], ':UserBool5' => $values['UserBool5'], ':UserString1' => $values['UserString1'], ':UserString2' => $values['UserString2'], ':UserString3' => $values['UserString3'], ':UserString4' => $values['UserString4'], ':UserString5' => $values['UserString5'], ':UserInt1' => $values['UserInt1'], ':UserInt2' => $values['UserInt2'], ':UserInt3' => $values['UserInt3'], ':UserInt4' => $values['UserInt4'], ':UserInt5' => $values['UserInt5']);
244 244
 				if ($values['UserString4'] == 'M') $type = 'military';
245 245
 				else $type = null;
246 246
 				$query_dest_values = array(':LastModified' => $values['LastModified'],':ModeS' => $values['ModeS'],':ModeSCountry' => $values['ModeSCountry'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':source' => $database_file,':type' => $type);
247 247
 				$sth_dest->execute($query_dest_values);
248 248
 				if ($values['RegisteredOwners'] != '' && $values['RegisteredOwners'] != NULL && $values['RegisteredOwners'] != 'Private') {
249
-				    $query_dest_owner_values = array(':registration' => $values['Registration'],':source' => $database_file,':owner' => $values['RegisteredOwners']);
250
-				    $sth_dest_owner->execute($query_dest_owner_values);
249
+					$query_dest_owner_values = array(':registration' => $values['Registration'],':source' => $database_file,':owner' => $values['RegisteredOwners']);
250
+					$sth_dest_owner->execute($query_dest_owner_values);
251 251
 				}
252
-            		}
252
+					}
253 253
 			if ($globalTransaction) $Connection->db->commit();
254 254
 		} catch(PDOException $e) {
255 255
 			return "error : ".$e->getMessage();
@@ -260,10 +260,10 @@  discard block
 block discarded – undo
260 260
 		try {
261 261
 			$Connection = new Connection();
262 262
 			$sth = $Connection->db->prepare($query);
263
-                        $sth->execute(array(':source' => $database_file));
264
-                } catch(PDOException $e) {
265
-                        return "error : ".$e->getMessage();
266
-                }
263
+						$sth->execute(array(':source' => $database_file));
264
+				} catch(PDOException $e) {
265
+						return "error : ".$e->getMessage();
266
+				}
267 267
 		return '';
268 268
 	}
269 269
 
@@ -275,10 +275,10 @@  discard block
 block discarded – undo
275 275
 		try {
276 276
 			$Connection = new Connection();
277 277
 			$sth = $Connection->db->prepare($query);
278
-                        $sth->execute(array(':source' => $database_file));
279
-                } catch(PDOException $e) {
280
-                        return "error : ".$e->getMessage();
281
-                }
278
+						$sth->execute(array(':source' => $database_file));
279
+				} catch(PDOException $e) {
280
+						return "error : ".$e->getMessage();
281
+				}
282 282
 		
283 283
 		if ($fh = fopen($database_file,"r")) {
284 284
 			//$query_dest = 'INSERT INTO aircraft_modes (`AircraftID`,`FirstCreated`,`LastModified`, `ModeS`,`ModeSCountry`,`Registration`,`ICAOTypeCode`,`SerialNo`, `OperatorFlagCode`, `Manufacturer`, `Type`, `FirstRegDate`, `CurrentRegDate`, `Country`, `PreviousID`, `DeRegDate`, `Status`, `PopularName`,`GenericName`,`AircraftClass`, `Engines`, `OwnershipStatus`,`RegisteredOwners`,`MTOW`, `TotalHours`, `YearBuilt`, `CofACategory`, `CofAExpiry`, `UserNotes`, `Interested`, `UserTag`, `InfoUrl`, `PictureUrl1`, `PictureUrl2`, `PictureUrl3`, `UserBool1`, `UserBool2`, `UserBool3`, `UserBool4`, `UserBool5`, `UserString1`, `UserString2`, `UserString3`, `UserString4`, `UserString5`, `UserInt1`, `UserInt2`, `UserInt3`, `UserInt4`, `UserInt5`) VALUES (:AircraftID,:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:SerialNo, :OperatorFlagCode, :Manufacturer, :Type, :FirstRegDate, :CurrentRegDate, :Country, :PreviousID, :DeRegDate, :Status, :PopularName,:GenericName,:AircraftClass, :Engines, :OwnershipStatus,:RegisteredOwners,:MTOW, :TotalHours,:YearBuilt, :CofACategory, :CofAExpiry, :UserNotes, :Interested, :UserTag, :InfoUrl, :PictureUrl1, :PictureUrl2, :PictureUrl3, :UserBool1, :UserBool2, :UserBool3, :UserBool4, :UserBool5, :UserString1, :UserString2, :UserString3, :UserString4, :UserString5, :UserInt1, :UserInt2, :UserInt3, :UserInt4, :UserInt5)';
@@ -288,26 +288,26 @@  discard block
 block discarded – undo
288 288
 			$sth_dest = $Connection->db->prepare($query_dest);
289 289
 			try {
290 290
 				if ($globalTransaction) $Connection->db->beginTransaction();
291
-            			while (!feof($fh)) {
292
-            				$values = array();
293
-            				$line = $Common->hex2str(fgets($fh,9999));
291
+						while (!feof($fh)) {
292
+							$values = array();
293
+							$line = $Common->hex2str(fgets($fh,9999));
294 294
 					//FFFFFF                     RIDEAU VALLEY SOARINGASW-20               C-FBKN MZ 123.400
295
-            				$values['ModeS'] = substr($line,0,6);
296
-            				$values['Registration'] = trim(substr($line,69,6));
297
-            				$aircraft_name = trim(substr($line,48,6));
298
-            				// Check if we can find ICAO, else set it to GLID
299
-            				$aircraft_name_split = explode(' ',$aircraft_name);
300
-            				$search_more = '';
301
-            				if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'";
302
-            				$query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more;
303
-            				$sth_search = $Connection->db->prepare($query_search);
295
+							$values['ModeS'] = substr($line,0,6);
296
+							$values['Registration'] = trim(substr($line,69,6));
297
+							$aircraft_name = trim(substr($line,48,6));
298
+							// Check if we can find ICAO, else set it to GLID
299
+							$aircraft_name_split = explode(' ',$aircraft_name);
300
+							$search_more = '';
301
+							if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'";
302
+							$query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more;
303
+							$sth_search = $Connection->db->prepare($query_search);
304 304
 					try {
305
-                                    		$sth_search->execute();
306
-	            				$result = $sth_search->fetch(PDO::FETCH_ASSOC);
307
-	            				//if (count($result) > 0) {
308
-	            				if (isset($result['icao']) && $result['icao'] != '') {
309
-	            				    $values['ICAOTypeCode'] = $result['icao'];
310
-	            				} 
305
+											$sth_search->execute();
306
+								$result = $sth_search->fetch(PDO::FETCH_ASSOC);
307
+								//if (count($result) > 0) {
308
+								if (isset($result['icao']) && $result['icao'] != '') {
309
+									$values['ICAOTypeCode'] = $result['icao'];
310
+								} 
311 311
 					} catch(PDOException $e) {
312 312
 						return "error : ".$e->getMessage();
313 313
 					}
@@ -330,10 +330,10 @@  discard block
 block discarded – undo
330 330
 		try {
331 331
 			$Connection = new Connection();
332 332
 			$sth = $Connection->db->prepare($query);
333
-                        $sth->execute(array(':source' => $database_file));
334
-                } catch(PDOException $e) {
335
-                        return "error : ".$e->getMessage();
336
-                }
333
+						$sth->execute(array(':source' => $database_file));
334
+				} catch(PDOException $e) {
335
+						return "error : ".$e->getMessage();
336
+				}
337 337
 		return '';
338 338
 	}
339 339
 
@@ -344,10 +344,10 @@  discard block
 block discarded – undo
344 344
 		try {
345 345
 			$Connection = new Connection();
346 346
 			$sth = $Connection->db->prepare($query);
347
-                        $sth->execute(array(':source' => $database_file));
348
-                } catch(PDOException $e) {
349
-                        return "error : ".$e->getMessage();
350
-                }
347
+						$sth->execute(array(':source' => $database_file));
348
+				} catch(PDOException $e) {
349
+						return "error : ".$e->getMessage();
350
+				}
351 351
 		
352 352
 		if ($fh = fopen($database_file,"r")) {
353 353
 			//$query_dest = 'INSERT INTO aircraft_modes (`AircraftID`,`FirstCreated`,`LastModified`, `ModeS`,`ModeSCountry`,`Registration`,`ICAOTypeCode`,`SerialNo`, `OperatorFlagCode`, `Manufacturer`, `Type`, `FirstRegDate`, `CurrentRegDate`, `Country`, `PreviousID`, `DeRegDate`, `Status`, `PopularName`,`GenericName`,`AircraftClass`, `Engines`, `OwnershipStatus`,`RegisteredOwners`,`MTOW`, `TotalHours`, `YearBuilt`, `CofACategory`, `CofAExpiry`, `UserNotes`, `Interested`, `UserTag`, `InfoUrl`, `PictureUrl1`, `PictureUrl2`, `PictureUrl3`, `UserBool1`, `UserBool2`, `UserBool3`, `UserBool4`, `UserBool5`, `UserString1`, `UserString2`, `UserString3`, `UserString4`, `UserString5`, `UserInt1`, `UserInt2`, `UserInt3`, `UserInt4`, `UserInt5`) VALUES (:AircraftID,:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:SerialNo, :OperatorFlagCode, :Manufacturer, :Type, :FirstRegDate, :CurrentRegDate, :Country, :PreviousID, :DeRegDate, :Status, :PopularName,:GenericName,:AircraftClass, :Engines, :OwnershipStatus,:RegisteredOwners,:MTOW, :TotalHours,:YearBuilt, :CofACategory, :CofAExpiry, :UserNotes, :Interested, :UserTag, :InfoUrl, :PictureUrl1, :PictureUrl2, :PictureUrl3, :UserBool1, :UserBool2, :UserBool3, :UserBool4, :UserBool5, :UserString1, :UserString2, :UserString3, :UserString4, :UserString5, :UserInt1, :UserInt2, :UserInt3, :UserInt4, :UserInt5)';
@@ -358,25 +358,25 @@  discard block
 block discarded – undo
358 358
 			try {
359 359
 				if ($globalTransaction) $Connection->db->beginTransaction();
360 360
 				$tmp = fgetcsv($fh,9999,',',"'");
361
-            			while (!feof($fh)) {
362
-            				$line = fgetcsv($fh,9999,',',"'");
361
+						while (!feof($fh)) {
362
+							$line = fgetcsv($fh,9999,',',"'");
363 363
             				
364 364
 					//FFFFFF                     RIDEAU VALLEY SOARINGASW-20               C-FBKN MZ 123.400
365 365
 					//print_r($line);
366
-            				$values['ModeS'] = $line[1];
367
-            				$values['Registration'] = $line[3];
368
-            				$values['ICAOTypeCode'] = '';
369
-            				$aircraft_name = $line[2];
370
-            				// Check if we can find ICAO, else set it to GLID
371
-            				$aircraft_name_split = explode(' ',$aircraft_name);
372
-            				$search_more = '';
373
-            				if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'";
374
-            				$query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more;
375
-            				$sth_search = $Connection->db->prepare($query_search);
366
+							$values['ModeS'] = $line[1];
367
+							$values['Registration'] = $line[3];
368
+							$values['ICAOTypeCode'] = '';
369
+							$aircraft_name = $line[2];
370
+							// Check if we can find ICAO, else set it to GLID
371
+							$aircraft_name_split = explode(' ',$aircraft_name);
372
+							$search_more = '';
373
+							if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'";
374
+							$query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more;
375
+							$sth_search = $Connection->db->prepare($query_search);
376 376
 					try {
377
-                                    		$sth_search->execute();
378
-	            				$result = $sth_search->fetch(PDO::FETCH_ASSOC);
379
-	            				if (isset($result['icao']) && $result['icao'] != '') $values['ICAOTypeCode'] = $result['icao'];
377
+											$sth_search->execute();
378
+								$result = $sth_search->fetch(PDO::FETCH_ASSOC);
379
+								if (isset($result['icao']) && $result['icao'] != '') $values['ICAOTypeCode'] = $result['icao'];
380 380
 					} catch(PDOException $e) {
381 381
 						return "error : ".$e->getMessage();
382 382
 					}
@@ -399,10 +399,10 @@  discard block
 block discarded – undo
399 399
 		try {
400 400
 			$Connection = new Connection();
401 401
 			$sth = $Connection->db->prepare($query);
402
-                        $sth->execute(array(':source' => $database_file));
403
-                } catch(PDOException $e) {
404
-                        return "error : ".$e->getMessage();
405
-                }
402
+						$sth->execute(array(':source' => $database_file));
403
+				} catch(PDOException $e) {
404
+						return "error : ".$e->getMessage();
405
+				}
406 406
 		return '';
407 407
 	}
408 408
 
@@ -413,16 +413,16 @@  discard block
 block discarded – undo
413 413
 		try {
414 414
 			$Connection = new Connection();
415 415
 			$sth = $Connection->db->prepare($query);
416
-                        $sth->execute(array(':source' => $database_file));
417
-                } catch(PDOException $e) {
418
-                        return "error : ".$e->getMessage();
419
-                }
416
+						$sth->execute(array(':source' => $database_file));
417
+				} catch(PDOException $e) {
418
+						return "error : ".$e->getMessage();
419
+				}
420 420
 		require_once(dirname(__FILE__).'/../require/class.Spotter.php');
421 421
 		$Spotter = new Spotter();
422 422
 		if ($fh = fopen($database_file,"r")) {
423 423
 			//$query_dest = 'INSERT INTO aircraft_modes (`AircraftID`,`FirstCreated`,`LastModified`, `ModeS`,`ModeSCountry`,`Registration`,`ICAOTypeCode`,`SerialNo`, `OperatorFlagCode`, `Manufacturer`, `Type`, `FirstRegDate`, `CurrentRegDate`, `Country`, `PreviousID`, `DeRegDate`, `Status`, `PopularName`,`GenericName`,`AircraftClass`, `Engines`, `OwnershipStatus`,`RegisteredOwners`,`MTOW`, `TotalHours`, `YearBuilt`, `CofACategory`, `CofAExpiry`, `UserNotes`, `Interested`, `UserTag`, `InfoUrl`, `PictureUrl1`, `PictureUrl2`, `PictureUrl3`, `UserBool1`, `UserBool2`, `UserBool3`, `UserBool4`, `UserBool5`, `UserString1`, `UserString2`, `UserString3`, `UserString4`, `UserString5`, `UserInt1`, `UserInt2`, `UserInt3`, `UserInt4`, `UserInt5`) VALUES (:AircraftID,:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:SerialNo, :OperatorFlagCode, :Manufacturer, :Type, :FirstRegDate, :CurrentRegDate, :Country, :PreviousID, :DeRegDate, :Status, :PopularName,:GenericName,:AircraftClass, :Engines, :OwnershipStatus,:RegisteredOwners,:MTOW, :TotalHours,:YearBuilt, :CofACategory, :CofAExpiry, :UserNotes, :Interested, :UserTag, :InfoUrl, :PictureUrl1, :PictureUrl2, :PictureUrl3, :UserBool1, :UserBool2, :UserBool3, :UserBool4, :UserBool5, :UserString1, :UserString2, :UserString3, :UserString4, :UserString5, :UserInt1, :UserInt2, :UserInt3, :UserInt4, :UserInt5)';
424 424
 			$query_dest = 'INSERT INTO aircraft_owner (registration,base,owner,date_first_reg,Source) VALUES (:registration,:base,:owner,:date_first_reg,:source)';
425
-		        $query_modes = 'INSERT INTO aircraft_modes (ModeS,ModeSCountry,Registration,ICAOTypeCode,Source) VALUES (:modes,:modescountry,:registration,:icaotypecode,:source)';
425
+				$query_modes = 'INSERT INTO aircraft_modes (ModeS,ModeSCountry,Registration,ICAOTypeCode,Source) VALUES (:modes,:modescountry,:registration,:icaotypecode,:source)';
426 426
 		        
427 427
 			$Connection = new Connection();
428 428
 			$sth_dest = $Connection->db->prepare($query_dest);
@@ -430,126 +430,126 @@  discard block
 block discarded – undo
430 430
 			try {
431 431
 				if ($globalTransaction) $Connection->db->beginTransaction();
432 432
 				$tmp = fgetcsv($fh,9999,',','"');
433
-            			while (!feof($fh)) {
434
-            				$line = fgetcsv($fh,9999,',','"');
435
-            				$values = array();
436
-            				//print_r($line);
437
-            				if ($country == 'F') {
438
-            				    $values['registration'] = $line[0];
439
-            				    $values['base'] = $line[4];
440
-            				    $values['owner'] = $line[5];
441
-            				    if ($line[6] == '') $values['date_first_reg'] = null;
442
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6]));
443
-					    $values['cancel'] = $line[7];
433
+						while (!feof($fh)) {
434
+							$line = fgetcsv($fh,9999,',','"');
435
+							$values = array();
436
+							//print_r($line);
437
+							if ($country == 'F') {
438
+								$values['registration'] = $line[0];
439
+								$values['base'] = $line[4];
440
+								$values['owner'] = $line[5];
441
+								if ($line[6] == '') $values['date_first_reg'] = null;
442
+						else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6]));
443
+						$values['cancel'] = $line[7];
444 444
 					} elseif ($country == 'EI') {
445
-					    // TODO : add modeS & reg to aircraft_modes
446
-            				    $values['registration'] = $line[0];
447
-            				    $values['base'] = $line[3];
448
-            				    $values['owner'] = $line[2];
449
-            				    if ($line[1] == '') $values['date_first_reg'] = null;
450
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[1]));
451
-					    $values['cancel'] = '';
452
-					    $values['modes'] = $line[7];
453
-					    $values['icao'] = $line[8];
445
+						// TODO : add modeS & reg to aircraft_modes
446
+								$values['registration'] = $line[0];
447
+								$values['base'] = $line[3];
448
+								$values['owner'] = $line[2];
449
+								if ($line[1] == '') $values['date_first_reg'] = null;
450
+						else $values['date_first_reg'] = date("Y-m-d",strtotime($line[1]));
451
+						$values['cancel'] = '';
452
+						$values['modes'] = $line[7];
453
+						$values['icao'] = $line[8];
454 454
 					    
455 455
 					} elseif ($country == 'HB') {
456
-					    // TODO : add modeS & reg to aircraft_modes
457
-            				    $values['registration'] = $line[0];
458
-            				    $values['base'] = null;
459
-            				    $values['owner'] = $line[5];
460
-            				    $values['date_first_reg'] = null;
461
-					    $values['cancel'] = '';
462
-					    $values['modes'] = $line[4];
463
-					    $values['icao'] = $line[7];
456
+						// TODO : add modeS & reg to aircraft_modes
457
+								$values['registration'] = $line[0];
458
+								$values['base'] = null;
459
+								$values['owner'] = $line[5];
460
+								$values['date_first_reg'] = null;
461
+						$values['cancel'] = '';
462
+						$values['modes'] = $line[4];
463
+						$values['icao'] = $line[7];
464 464
 					} elseif ($country == 'OK') {
465
-					    // TODO : add modeS & reg to aircraft_modes
466
-            				    $values['registration'] = $line[3];
467
-            				    $values['base'] = null;
468
-            				    $values['owner'] = $line[5];
469
-            				    if ($line[18] == '') $values['date_first_reg'] = null;
470
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[18]));
471
-					    $values['cancel'] = '';
465
+						// TODO : add modeS & reg to aircraft_modes
466
+								$values['registration'] = $line[3];
467
+								$values['base'] = null;
468
+								$values['owner'] = $line[5];
469
+								if ($line[18] == '') $values['date_first_reg'] = null;
470
+						else $values['date_first_reg'] = date("Y-m-d",strtotime($line[18]));
471
+						$values['cancel'] = '';
472 472
 					} elseif ($country == 'VH') {
473
-					    // TODO : add modeS & reg to aircraft_modes
474
-            				    $values['registration'] = $line[0];
475
-            				    $values['base'] = null;
476
-            				    $values['owner'] = $line[12];
477
-            				    if ($line[28] == '') $values['date_first_reg'] = null;
478
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[28]));
479
-
480
-					    $values['cancel'] = $line[39];
473
+						// TODO : add modeS & reg to aircraft_modes
474
+								$values['registration'] = $line[0];
475
+								$values['base'] = null;
476
+								$values['owner'] = $line[12];
477
+								if ($line[28] == '') $values['date_first_reg'] = null;
478
+						else $values['date_first_reg'] = date("Y-m-d",strtotime($line[28]));
479
+
480
+						$values['cancel'] = $line[39];
481 481
 					} elseif ($country == 'OE' || $country == '9A' || $country == 'VP' || $country == 'LX' || $country == 'P2' || $country == 'HC') {
482
-            				    $values['registration'] = $line[0];
483
-            				    $values['base'] = null;
484
-            				    $values['owner'] = $line[4];
485
-            				    $values['date_first_reg'] = null;
486
-					    $values['cancel'] = '';
482
+								$values['registration'] = $line[0];
483
+								$values['base'] = null;
484
+								$values['owner'] = $line[4];
485
+								$values['date_first_reg'] = null;
486
+						$values['cancel'] = '';
487 487
 					} elseif ($country == 'CC') {
488
-            				    $values['registration'] = $line[0];
489
-            				    $values['base'] = null;
490
-            				    $values['owner'] = $line[6];
491
-            				    $values['date_first_reg'] = null;
492
-					    $values['cancel'] = '';
488
+								$values['registration'] = $line[0];
489
+								$values['base'] = null;
490
+								$values['owner'] = $line[6];
491
+								$values['date_first_reg'] = null;
492
+						$values['cancel'] = '';
493 493
 					} elseif ($country == 'HJ') {
494
-            				    $values['registration'] = $line[0];
495
-            				    $values['base'] = null;
496
-            				    $values['owner'] = $line[8];
497
-            				    if ($line[7] == '') $values['date_first_reg'] = null;
498
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7]));
499
-					    $values['cancel'] = '';
494
+								$values['registration'] = $line[0];
495
+								$values['base'] = null;
496
+								$values['owner'] = $line[8];
497
+								if ($line[7] == '') $values['date_first_reg'] = null;
498
+						else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7]));
499
+						$values['cancel'] = '';
500 500
 					} elseif ($country == 'PP') {
501
-            				    $values['registration'] = $line[0];
502
-            				    $values['base'] = null;
503
-            				    $values['owner'] = $line[4];
504
-            				    if ($line[6] == '') $values['date_first_reg'] = null;
505
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6]));
506
-					    $values['cancel'] = $line[7];
501
+								$values['registration'] = $line[0];
502
+								$values['base'] = null;
503
+								$values['owner'] = $line[4];
504
+								if ($line[6] == '') $values['date_first_reg'] = null;
505
+						else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6]));
506
+						$values['cancel'] = $line[7];
507 507
 					} elseif ($country == 'E7') {
508
-            				    $values['registration'] = $line[0];
509
-            				    $values['base'] = null;
510
-            				    $values['owner'] = $line[4];
511
-            				    if ($line[5] == '') $values['date_first_reg'] = null;
512
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[5]));
513
-					    $values['cancel'] = '';
508
+								$values['registration'] = $line[0];
509
+								$values['base'] = null;
510
+								$values['owner'] = $line[4];
511
+								if ($line[5] == '') $values['date_first_reg'] = null;
512
+						else $values['date_first_reg'] = date("Y-m-d",strtotime($line[5]));
513
+						$values['cancel'] = '';
514 514
 					} elseif ($country == '8Q') {
515
-            				    $values['registration'] = $line[0];
516
-            				    $values['base'] = null;
517
-            				    $values['owner'] = $line[3];
518
-            				    if ($line[7] == '') $values['date_first_reg'] = null;
519
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7]));
520
-					    $values['cancel'] = '';
515
+								$values['registration'] = $line[0];
516
+								$values['base'] = null;
517
+								$values['owner'] = $line[3];
518
+								if ($line[7] == '') $values['date_first_reg'] = null;
519
+						else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7]));
520
+						$values['cancel'] = '';
521 521
 					} elseif ($country == 'ZK') {
522
-            				    $values['registration'] = $line[0];
523
-            				    $values['base'] = null;
524
-            				    $values['owner'] = $line[3];
525
-            				    $values['date_first_reg'] = null;
526
-					    $values['cancel'] = '';
527
-					    $values['modes'] = $line[5];
528
-					    $values['icao'] = $line[9];
522
+								$values['registration'] = $line[0];
523
+								$values['base'] = null;
524
+								$values['owner'] = $line[3];
525
+								$values['date_first_reg'] = null;
526
+						$values['cancel'] = '';
527
+						$values['modes'] = $line[5];
528
+						$values['icao'] = $line[9];
529 529
 					} elseif ($country == 'M') {
530
-            				    $values['registration'] = $line[0];
531
-            				    $values['base'] = null;
532
-            				    $values['owner'] = $line[6];
533
-            				    $values['date_first_reg'] = date("Y-m-d",strtotime($line[5]));
534
-					    $values['cancel'] = date("Y-m-d",strtotime($line[8]));
535
-					    $values['modes'] = $line[4];
536
-					    $values['icao'] = $line[10];
530
+								$values['registration'] = $line[0];
531
+								$values['base'] = null;
532
+								$values['owner'] = $line[6];
533
+								$values['date_first_reg'] = date("Y-m-d",strtotime($line[5]));
534
+						$values['cancel'] = date("Y-m-d",strtotime($line[8]));
535
+						$values['modes'] = $line[4];
536
+						$values['icao'] = $line[10];
537 537
 					} elseif ($country == 'OY') {
538
-            				    $values['registration'] = $line[0];
539
-            				    $values['date_first_reg'] = date("Y-m-d",strtotime($line[4]));
540
-					    $values['modes'] = $line[5];
541
-					    $values['icao'] = $line[6];
538
+								$values['registration'] = $line[0];
539
+								$values['date_first_reg'] = date("Y-m-d",strtotime($line[4]));
540
+						$values['modes'] = $line[5];
541
+						$values['icao'] = $line[6];
542 542
 					} elseif ($country == 'PH') {
543
-            				    $values['registration'] = $line[0];
544
-            				    $values['date_first_reg'] = date("Y-m-d",strtotime($line[3]));
545
-					    $values['modes'] = $line[4];
546
-					    $values['icao'] = $line[5];
543
+								$values['registration'] = $line[0];
544
+								$values['date_first_reg'] = date("Y-m-d",strtotime($line[3]));
545
+						$values['modes'] = $line[4];
546
+						$values['icao'] = $line[5];
547 547
 					} elseif ($country == 'OM' || $country == 'TF') {
548
-            				    $values['registration'] = $line[0];
549
-            				    $values['base'] = null;
550
-            				    $values['owner'] = $line[3];
551
-            				    $values['date_first_reg'] = null;
552
-					    $values['cancel'] = '';
548
+								$values['registration'] = $line[0];
549
+								$values['base'] = null;
550
+								$values['owner'] = $line[3];
551
+								$values['date_first_reg'] = null;
552
+						$values['cancel'] = '';
553 553
 					}
554 554
 					if (isset($values['cancel']) && $values['cancel'] == '' && $values['registration'] != null && isset($values['owner'])) {
555 555
 						$query_dest_values = array(':registration' => $values['registration'],':base' => $values['base'],':date_first_reg' => $values['date_first_reg'],':owner' => $values['owner'],':source' => $database_file);
@@ -682,7 +682,7 @@  discard block
 block discarded – undo
682 682
                         return "error : ".$e->getMessage();
683 683
                 }
684 684
                 */
685
-                /*
685
+				/*
686 686
 		$query = 'ALTER TABLE airport DROP INDEX icaoidx';
687 687
 		try {
688 688
 			$Connection = new Connection();
@@ -927,10 +927,10 @@  discard block
 block discarded – undo
927 927
 		try {
928 928
 			$Connection = new Connection();
929 929
 			$sth = $Connection->db->prepare($query);
930
-                        $sth->execute(array(':source' => 'translation.csv'));
931
-                } catch(PDOException $e) {
932
-                        return "error : ".$e->getMessage();
933
-                }
930
+						$sth->execute(array(':source' => 'translation.csv'));
931
+				} catch(PDOException $e) {
932
+						return "error : ".$e->getMessage();
933
+				}
934 934
 
935 935
 		
936 936
 		//update_db::unzip($out_file);
@@ -949,21 +949,21 @@  discard block
 block discarded – undo
949 949
 					$data = $row;
950 950
 					$operator = $data[2];
951 951
 					if ($operator != '' && is_numeric(substr(substr($operator, 0, 3), -1, 1))) {
952
-                                                $airline_array = $Spotter->getAllAirlineInfo(substr($operator, 0, 2));
953
-                                                //echo substr($operator, 0, 2)."\n";;
954
-                                                if (count($airline_array) > 0) {
952
+												$airline_array = $Spotter->getAllAirlineInfo(substr($operator, 0, 2));
953
+												//echo substr($operator, 0, 2)."\n";;
954
+												if (count($airline_array) > 0) {
955 955
 							//print_r($airline_array);
956 956
 							$operator = $airline_array[0]['icao'].substr($operator,2);
957
-                                                }
958
-                                        }
957
+												}
958
+										}
959 959
 					
960 960
 					$operator_correct = $data[3];
961 961
 					if ($operator_correct != '' && is_numeric(substr(substr($operator_correct, 0, 3), -1, 1))) {
962
-                                                $airline_array = $Spotter->getAllAirlineInfo(substr($operator_correct, 0, 2));
963
-                                                if (count($airline_array) > 0) {
964
-                                            		$operator_correct = $airline_array[0]['icao'].substr($operator_correct,2);
965
-                                            	}
966
-                                        }
962
+												$airline_array = $Spotter->getAllAirlineInfo(substr($operator_correct, 0, 2));
963
+												if (count($airline_array) > 0) {
964
+													$operator_correct = $airline_array[0]['icao'].substr($operator_correct,2);
965
+												}
966
+										}
967 967
 					$query = 'INSERT INTO translation (Reg,Reg_correct,Operator,Operator_correct,Source) VALUES (:Reg, :Reg_correct, :Operator, :Operator_correct, :source)';
968 968
 					try {
969 969
 						$sth = $Connection->db->prepare($query);
@@ -977,7 +977,7 @@  discard block
 block discarded – undo
977 977
 			//$Connection->db->commit();
978 978
 		}
979 979
 		return '';
980
-        }
980
+		}
981 981
 	
982 982
 	public static function translation_fam() {
983 983
 		global $tmp_dir, $globalTransaction;
@@ -1015,7 +1015,7 @@  discard block
 block discarded – undo
1015 1015
 			//$Connection->db->commit();
1016 1016
 		}
1017 1017
 		return '';
1018
-        }
1018
+		}
1019 1019
 
1020 1020
 	/*
1021 1021
 	* This function use FAA public data.
@@ -1027,19 +1027,19 @@  discard block
 block discarded – undo
1027 1027
 		try {
1028 1028
 			$Connection = new Connection();
1029 1029
 			$sth = $Connection->db->prepare($query);
1030
-                        $sth->execute(array(':source' => 'website_faa'));
1031
-                } catch(PDOException $e) {
1032
-                        return "error : ".$e->getMessage();
1033
-                }
1030
+						$sth->execute(array(':source' => 'website_faa'));
1031
+				} catch(PDOException $e) {
1032
+						return "error : ".$e->getMessage();
1033
+				}
1034 1034
 
1035 1035
 		$query = "DELETE FROM aircraft_owner WHERE Source = '' OR Source = :source";
1036 1036
 		try {
1037 1037
 			$Connection = new Connection();
1038 1038
 			$sth = $Connection->db->prepare($query);
1039
-                        $sth->execute(array(':source' => 'website_faa'));
1040
-                } catch(PDOException $e) {
1041
-                        return "error : ".$e->getMessage();
1042
-                }
1039
+						$sth->execute(array(':source' => 'website_faa'));
1040
+				} catch(PDOException $e) {
1041
+						return "error : ".$e->getMessage();
1042
+				}
1043 1043
 
1044 1044
 		$delimiter = ",";
1045 1045
 		$mfr = array();
@@ -1115,17 +1115,17 @@  discard block
 block discarded – undo
1115 1115
 		}
1116 1116
 		//print_r($mfr);
1117 1117
 		return '';
1118
-        }
1118
+		}
1119 1119
 	public static function modes_fam() {
1120 1120
 		global $tmp_dir, $globalTransaction;
1121 1121
 		$query = "DELETE FROM aircraft_modes WHERE Source = '' OR Source = :source";
1122 1122
 		try {
1123 1123
 			$Connection = new Connection();
1124 1124
 			$sth = $Connection->db->prepare($query);
1125
-                        $sth->execute(array(':source' => 'website_fam'));
1126
-                } catch(PDOException $e) {
1127
-                        return "error : ".$e->getMessage();
1128
-                }
1125
+						$sth->execute(array(':source' => 'website_fam'));
1126
+				} catch(PDOException $e) {
1127
+						return "error : ".$e->getMessage();
1128
+				}
1129 1129
 
1130 1130
 		
1131 1131
 		//update_db::unzip($out_file);
@@ -1155,7 +1155,7 @@  discard block
 block discarded – undo
1155 1155
 			if ($globalTransaction) $Connection->db->commit();
1156 1156
 		}
1157 1157
 		return '';
1158
-        }
1158
+		}
1159 1159
         
1160 1160
 	public static function owner_fam() {
1161 1161
 		global $tmp_dir, $globalTransaction;
@@ -1163,10 +1163,10 @@  discard block
 block discarded – undo
1163 1163
 		try {
1164 1164
 			$Connection = new Connection();
1165 1165
 			$sth = $Connection->db->prepare($query);
1166
-                        $sth->execute(array(':source' => 'website_fam'));
1167
-                } catch(PDOException $e) {
1168
-                        return "error : ".$e->getMessage();
1169
-                }
1166
+						$sth->execute(array(':source' => 'website_fam'));
1167
+				} catch(PDOException $e) {
1168
+						return "error : ".$e->getMessage();
1169
+				}
1170 1170
 
1171 1171
 		$delimiter = "\t";
1172 1172
 		$Connection = new Connection();
@@ -1192,7 +1192,7 @@  discard block
 block discarded – undo
1192 1192
 			if ($globalTransaction) $Connection->db->commit();
1193 1193
 		}
1194 1194
 		return '';
1195
-        }
1195
+		}
1196 1196
 
1197 1197
 	public static function routes_fam() {
1198 1198
 		global $tmp_dir, $globalTransaction, $globalDebug;
@@ -1227,7 +1227,7 @@  discard block
 block discarded – undo
1227 1227
 			if ($globalTransaction) $Connection->db->commit();
1228 1228
 		}
1229 1229
 		return '';
1230
-        }
1230
+		}
1231 1231
 
1232 1232
 	public static function marine_identity_fam() {
1233 1233
 		global $tmp_dir, $globalTransaction;
@@ -1235,10 +1235,10 @@  discard block
 block discarded – undo
1235 1235
 		try {
1236 1236
 			$Connection = new Connection();
1237 1237
 			$sth = $Connection->db->prepare($query);
1238
-                        $sth->execute();
1239
-                } catch(PDOException $e) {
1240
-                        return "error : ".$e->getMessage();
1241
-                }
1238
+						$sth->execute();
1239
+				} catch(PDOException $e) {
1240
+						return "error : ".$e->getMessage();
1241
+				}
1242 1242
 
1243 1243
 		
1244 1244
 		//update_db::unzip($out_file);
@@ -1268,7 +1268,7 @@  discard block
 block discarded – undo
1268 1268
 			if ($globalTransaction) $Connection->db->commit();
1269 1269
 		}
1270 1270
 		return '';
1271
-        }
1271
+		}
1272 1272
 
1273 1273
 	public static function satellite_fam() {
1274 1274
 		global $tmp_dir, $globalTransaction;
@@ -1339,7 +1339,7 @@  discard block
 block discarded – undo
1339 1339
 			if ($globalTransaction) $Connection->db->commit();
1340 1340
 		}
1341 1341
 		return '';
1342
-        }
1342
+		}
1343 1343
 
1344 1344
 	public static function tle($filename,$tletype) {
1345 1345
 		require_once(dirname(__FILE__).'/../require/class.Spotter.php');
@@ -1350,10 +1350,10 @@  discard block
 block discarded – undo
1350 1350
 		try {
1351 1351
 			$Connection = new Connection();
1352 1352
 			$sth = $Connection->db->prepare($query);
1353
-                        $sth->execute(array(':source' => $filename));
1354
-                } catch(PDOException $e) {
1355
-                        return "error : ".$e->getMessage();
1356
-                }
1353
+						$sth->execute(array(':source' => $filename));
1354
+				} catch(PDOException $e) {
1355
+						return "error : ".$e->getMessage();
1356
+				}
1357 1357
 		
1358 1358
 		$Connection = new Connection();
1359 1359
 		if (($handle = fopen($filename, 'r')) !== FALSE)
@@ -1388,7 +1388,7 @@  discard block
 block discarded – undo
1388 1388
 			//$Connection->db->commit();
1389 1389
 		}
1390 1390
 		return '';
1391
-        }
1391
+		}
1392 1392
 
1393 1393
 	public static function satellite_ucsdb($filename) {
1394 1394
 		global $tmp_dir, $globalTransaction;
@@ -1637,11 +1637,11 @@  discard block
 block discarded – undo
1637 1637
 							try {
1638 1638
 								$sth = $Connection->db->prepare($query);
1639 1639
 								$sth->execute(array(
1640
-								    ':name' => $result['name'], ':name_alternate' => '', ':country_un' => '', ':country_owner' => $result['country_owner'], ':owner' => $result['owner'], ':users' => '', ':purpose' => '', ':purpose_detailed' => '', ':orbit' => $result['status'],
1641
-								    ':type' => '', ':longitude_geo' => NULL, ':perigee' => !empty($result['perigee']) ? $result['perigee'] : NULL, ':apogee' => !empty($result['apogee']) ? $result['apogee'] : NULL, ':eccentricity' => NULL, ':inclination' => $result['inclination'],
1642
-								    ':period' => !empty($result['period']) ? $result['period'] : NULL, ':launch_mass' => NULL, ':dry_mass' => NULL, ':power' => NULL, ':launch_date' => $result['launch_date'], ':lifetime' => $result['lifetime'], 
1643
-								    ':contractor' => '',':country_contractor' => '', ':launch_site' => $result['launch_site'], ':launch_vehicule' => '', ':cospar' => $result['cospar'], ':norad' => $result['norad'], ':comments' => '', ':source_orbital' => '', ':sources' => ''
1644
-								    )
1640
+									':name' => $result['name'], ':name_alternate' => '', ':country_un' => '', ':country_owner' => $result['country_owner'], ':owner' => $result['owner'], ':users' => '', ':purpose' => '', ':purpose_detailed' => '', ':orbit' => $result['status'],
1641
+									':type' => '', ':longitude_geo' => NULL, ':perigee' => !empty($result['perigee']) ? $result['perigee'] : NULL, ':apogee' => !empty($result['apogee']) ? $result['apogee'] : NULL, ':eccentricity' => NULL, ':inclination' => $result['inclination'],
1642
+									':period' => !empty($result['period']) ? $result['period'] : NULL, ':launch_mass' => NULL, ':dry_mass' => NULL, ':power' => NULL, ':launch_date' => $result['launch_date'], ':lifetime' => $result['lifetime'], 
1643
+									':contractor' => '',':country_contractor' => '', ':launch_site' => $result['launch_site'], ':launch_vehicule' => '', ':cospar' => $result['cospar'], ':norad' => $result['norad'], ':comments' => '', ':source_orbital' => '', ':sources' => ''
1644
+									)
1645 1645
 								);
1646 1646
 							} catch(PDOException $e) {
1647 1647
 								return "error : ".$e->getMessage();
@@ -1665,13 +1665,13 @@  discard block
 block discarded – undo
1665 1665
 			//$Connection->db->commit();
1666 1666
 		}
1667 1667
 		return '';
1668
-        }
1668
+		}
1669 1669
 
1670 1670
 	/**
1671
-        * Convert a HTML table to an array
1672
-        * @param String $data HTML page
1673
-        * @return Array array of the tables in HTML page
1674
-        */
1671
+	 * Convert a HTML table to an array
1672
+	 * @param String $data HTML page
1673
+	 * @return Array array of the tables in HTML page
1674
+	 */
1675 1675
 /*
1676 1676
         private static function table2array($data) {
1677 1677
                 $html = str_get_html($data);
@@ -1701,11 +1701,11 @@  discard block
 block discarded – undo
1701 1701
                 return(array_filter($tabledata));
1702 1702
         }
1703 1703
 */
1704
-       /**
1705
-        * Get data from form result
1706
-        * @param String $url form URL
1707
-        * @return String the result
1708
-        */
1704
+	   /**
1705
+	    * Get data from form result
1706
+	    * @param String $url form URL
1707
+	    * @return String the result
1708
+	    */
1709 1709
 /*
1710 1710
         private static function getData($url) {
1711 1711
                 $ch = curl_init();
@@ -1798,7 +1798,7 @@  discard block
 block discarded – undo
1798 1798
 			if ($globalTransaction) $Connection->db->commit();
1799 1799
 		}
1800 1800
 		return '';
1801
-        }
1801
+		}
1802 1802
 
1803 1803
 	public static function ivao_airlines($filename) {
1804 1804
 		//require_once(dirname(__FILE__).'/../require/class.Spotter.php');
@@ -1808,10 +1808,10 @@  discard block
 block discarded – undo
1808 1808
 		try {
1809 1809
 			$Connection = new Connection();
1810 1810
 			$sth = $Connection->db->prepare($query);
1811
-                        $sth->execute();
1812
-                } catch(PDOException $e) {
1813
-                        return "error : ".$e->getMessage();
1814
-                }
1811
+						$sth->execute();
1812
+				} catch(PDOException $e) {
1813
+						return "error : ".$e->getMessage();
1814
+				}
1815 1815
 
1816 1816
 		$header = NULL;
1817 1817
 		$delimiter = ':';
@@ -1835,7 +1835,7 @@  discard block
 block discarded – undo
1835 1835
 			if ($globalTransaction) $Connection->db->commit();
1836 1836
 		}
1837 1837
 		return '';
1838
-        }
1838
+		}
1839 1839
 	
1840 1840
 	public static function update_airspace() {
1841 1841
 		global $tmp_dir, $globalDBdriver;
@@ -1845,11 +1845,11 @@  discard block
 block discarded – undo
1845 1845
 			$query = 'DROP TABLE airspace';
1846 1846
 			try {
1847 1847
 				$sth = $Connection->db->prepare($query);
1848
-                    		$sth->execute();
1849
-	                } catch(PDOException $e) {
1848
+							$sth->execute();
1849
+					} catch(PDOException $e) {
1850 1850
 				return "error : ".$e->getMessage();
1851
-	                }
1852
-	        }
1851
+					}
1852
+			}
1853 1853
 
1854 1854
 
1855 1855
 		if ($globalDBdriver == 'mysql') update_db::gunzip('../db/airspace.sql.gz',$tmp_dir.'airspace.sql');
@@ -1909,10 +1909,10 @@  discard block
 block discarded – undo
1909 1909
 			$query = 'DROP TABLE countries';
1910 1910
 			try {
1911 1911
 				$sth = $Connection->db->prepare($query);
1912
-            	        	$sth->execute();
1913
-	                } catch(PDOException $e) {
1914
-    	                	echo "error : ".$e->getMessage();
1915
-	                }
1912
+							$sth->execute();
1913
+					} catch(PDOException $e) {
1914
+							echo "error : ".$e->getMessage();
1915
+					}
1916 1916
 		}
1917 1917
 		if ($globalDBdriver == 'mysql') {
1918 1918
 			update_db::gunzip('../db/countries.sql.gz',$tmp_dir.'countries.sql');
@@ -2712,12 +2712,12 @@  discard block
 block discarded – undo
2712 2712
 		echo $data;
2713 2713
 		*/
2714 2714
 		if (file_exists($tmp_dir.'aircrafts.html')) {
2715
-		    //var_dump(file_get_html($tmp_dir.'aircrafts.html'));
2716
-		    $fh = fopen($tmp_dir.'aircrafts.html',"r");
2717
-		    $result = fread($fh,100000000);
2718
-		    //echo $result;
2719
-		    //var_dump(str_get_html($result));
2720
-		    //print_r(self::table2array($result));
2715
+			//var_dump(file_get_html($tmp_dir.'aircrafts.html'));
2716
+			$fh = fopen($tmp_dir.'aircrafts.html',"r");
2717
+			$result = fread($fh,100000000);
2718
+			//echo $result;
2719
+			//var_dump(str_get_html($result));
2720
+			//print_r(self::table2array($result));
2721 2721
 		}
2722 2722
 
2723 2723
 	}
@@ -2731,10 +2731,10 @@  discard block
 block discarded – undo
2731 2731
 		try {
2732 2732
 			$Connection = new Connection();
2733 2733
 			$sth = $Connection->db->prepare($query);
2734
-                        $sth->execute();
2735
-                } catch(PDOException $e) {
2736
-                        return "error : ".$e->getMessage();
2737
-                }
2734
+						$sth->execute();
2735
+				} catch(PDOException $e) {
2736
+						return "error : ".$e->getMessage();
2737
+				}
2738 2738
 
2739 2739
 		$error = '';
2740 2740
 		if ($globalDebug) echo "Notam : Download...";
@@ -2790,8 +2790,8 @@  discard block
 block discarded – undo
2790 2790
 					$data['date_end'] = date("Y-m-d H:i:s",strtotime($to));
2791 2791
 					$data['permanent'] = 0;
2792 2792
 				} else {
2793
-				    $data['date_end'] = NULL;
2794
-				    $data['permanent'] = 1;
2793
+					$data['date_end'] = NULL;
2794
+					$data['permanent'] = 1;
2795 2795
 				}
2796 2796
 				$data['full_notam'] = $notam['title'].'<br>'.$notam['description'];
2797 2797
 				$NOTAM = new NOTAM();
@@ -2865,13 +2865,13 @@  discard block
 block discarded – undo
2865 2865
 		try {
2866 2866
 			$Connection = new Connection();
2867 2867
 			$sth = $Connection->db->prepare($query);
2868
-                        $sth->execute();
2869
-                } catch(PDOException $e) {
2870
-                        return "error : ".$e->getMessage();
2871
-                }
2872
-                $row = $sth->fetch(PDO::FETCH_ASSOC);
2873
-                if ($row['nb'] > 0) return false;
2874
-                else return true;
2868
+						$sth->execute();
2869
+				} catch(PDOException $e) {
2870
+						return "error : ".$e->getMessage();
2871
+				}
2872
+				$row = $sth->fetch(PDO::FETCH_ASSOC);
2873
+				if ($row['nb'] > 0) return false;
2874
+				else return true;
2875 2875
 	}
2876 2876
 
2877 2877
 	public static function insert_last_update() {
@@ -2880,10 +2880,10 @@  discard block
 block discarded – undo
2880 2880
 		try {
2881 2881
 			$Connection = new Connection();
2882 2882
 			$sth = $Connection->db->prepare($query);
2883
-                        $sth->execute();
2884
-                } catch(PDOException $e) {
2885
-                        return "error : ".$e->getMessage();
2886
-                }
2883
+						$sth->execute();
2884
+				} catch(PDOException $e) {
2885
+						return "error : ".$e->getMessage();
2886
+				}
2887 2887
 	}
2888 2888
 
2889 2889
 	public static function check_airspace_version($version) {
@@ -2891,13 +2891,13 @@  discard block
 block discarded – undo
2891 2891
 		try {
2892 2892
 			$Connection = new Connection();
2893 2893
 			$sth = $Connection->db->prepare($query);
2894
-                        $sth->execute(array(':version' => $version));
2895
-                } catch(PDOException $e) {
2896
-                        return "error : ".$e->getMessage();
2897
-                }
2898
-                $row = $sth->fetch(PDO::FETCH_ASSOC);
2899
-                if ($row['nb'] > 0) return true;
2900
-                else return false;
2894
+						$sth->execute(array(':version' => $version));
2895
+				} catch(PDOException $e) {
2896
+						return "error : ".$e->getMessage();
2897
+				}
2898
+				$row = $sth->fetch(PDO::FETCH_ASSOC);
2899
+				if ($row['nb'] > 0) return true;
2900
+				else return false;
2901 2901
 	}
2902 2902
 
2903 2903
 	public static function check_geoid_version($version) {
@@ -2905,13 +2905,13 @@  discard block
 block discarded – undo
2905 2905
 		try {
2906 2906
 			$Connection = new Connection();
2907 2907
 			$sth = $Connection->db->prepare($query);
2908
-                        $sth->execute(array(':version' => $version));
2909
-                } catch(PDOException $e) {
2910
-                        return "error : ".$e->getMessage();
2911
-                }
2912
-                $row = $sth->fetch(PDO::FETCH_ASSOC);
2913
-                if ($row['nb'] > 0) return true;
2914
-                else return false;
2908
+						$sth->execute(array(':version' => $version));
2909
+				} catch(PDOException $e) {
2910
+						return "error : ".$e->getMessage();
2911
+				}
2912
+				$row = $sth->fetch(PDO::FETCH_ASSOC);
2913
+				if ($row['nb'] > 0) return true;
2914
+				else return false;
2915 2915
 	}
2916 2916
 
2917 2917
 	public static function check_marine_identity_version($version) {
@@ -2961,10 +2961,10 @@  discard block
 block discarded – undo
2961 2961
 		try {
2962 2962
 			$Connection = new Connection();
2963 2963
 			$sth = $Connection->db->prepare($query);
2964
-                        $sth->execute(array(':version' => $version));
2965
-                } catch(PDOException $e) {
2966
-                        return "error : ".$e->getMessage();
2967
-                }
2964
+						$sth->execute(array(':version' => $version));
2965
+				} catch(PDOException $e) {
2966
+						return "error : ".$e->getMessage();
2967
+				}
2968 2968
 	}
2969 2969
 
2970 2970
 	public static function insert_marine_identity_version($version) {
@@ -3001,13 +3001,13 @@  discard block
 block discarded – undo
3001 3001
 		try {
3002 3002
 			$Connection = new Connection();
3003 3003
 			$sth = $Connection->db->prepare($query);
3004
-                        $sth->execute();
3005
-                } catch(PDOException $e) {
3006
-                        return "error : ".$e->getMessage();
3007
-                }
3008
-                $row = $sth->fetch(PDO::FETCH_ASSOC);
3009
-                if ($row['nb'] > 0) return false;
3010
-                else return true;
3004
+						$sth->execute();
3005
+				} catch(PDOException $e) {
3006
+						return "error : ".$e->getMessage();
3007
+				}
3008
+				$row = $sth->fetch(PDO::FETCH_ASSOC);
3009
+				if ($row['nb'] > 0) return false;
3010
+				else return true;
3011 3011
 	}
3012 3012
 
3013 3013
 	public static function insert_last_notam_update() {
@@ -3016,10 +3016,10 @@  discard block
 block discarded – undo
3016 3016
 		try {
3017 3017
 			$Connection = new Connection();
3018 3018
 			$sth = $Connection->db->prepare($query);
3019
-                        $sth->execute();
3020
-                } catch(PDOException $e) {
3021
-                        return "error : ".$e->getMessage();
3022
-                }
3019
+						$sth->execute();
3020
+				} catch(PDOException $e) {
3021
+						return "error : ".$e->getMessage();
3022
+				}
3023 3023
 	}
3024 3024
 
3025 3025
 	public static function check_last_airspace_update() {
@@ -3032,13 +3032,13 @@  discard block
 block discarded – undo
3032 3032
 		try {
3033 3033
 			$Connection = new Connection();
3034 3034
 			$sth = $Connection->db->prepare($query);
3035
-                        $sth->execute();
3036
-                } catch(PDOException $e) {
3037
-                        return "error : ".$e->getMessage();
3038
-                }
3039
-                $row = $sth->fetch(PDO::FETCH_ASSOC);
3040
-                if ($row['nb'] > 0) return false;
3041
-                else return true;
3035
+						$sth->execute();
3036
+				} catch(PDOException $e) {
3037
+						return "error : ".$e->getMessage();
3038
+				}
3039
+				$row = $sth->fetch(PDO::FETCH_ASSOC);
3040
+				if ($row['nb'] > 0) return false;
3041
+				else return true;
3042 3042
 	}
3043 3043
 
3044 3044
 	public static function insert_last_airspace_update() {
@@ -3047,10 +3047,10 @@  discard block
 block discarded – undo
3047 3047
 		try {
3048 3048
 			$Connection = new Connection();
3049 3049
 			$sth = $Connection->db->prepare($query);
3050
-                        $sth->execute();
3051
-                } catch(PDOException $e) {
3052
-                        return "error : ".$e->getMessage();
3053
-                }
3050
+						$sth->execute();
3051
+				} catch(PDOException $e) {
3052
+						return "error : ".$e->getMessage();
3053
+				}
3054 3054
 	}
3055 3055
 
3056 3056
 	public static function check_last_geoid_update() {
@@ -3063,13 +3063,13 @@  discard block
 block discarded – undo
3063 3063
 		try {
3064 3064
 			$Connection = new Connection();
3065 3065
 			$sth = $Connection->db->prepare($query);
3066
-                        $sth->execute();
3067
-                } catch(PDOException $e) {
3068
-                        return "error : ".$e->getMessage();
3069
-                }
3070
-                $row = $sth->fetch(PDO::FETCH_ASSOC);
3071
-                if ($row['nb'] > 0) return false;
3072
-                else return true;
3066
+						$sth->execute();
3067
+				} catch(PDOException $e) {
3068
+						return "error : ".$e->getMessage();
3069
+				}
3070
+				$row = $sth->fetch(PDO::FETCH_ASSOC);
3071
+				if ($row['nb'] > 0) return false;
3072
+				else return true;
3073 3073
 	}
3074 3074
 
3075 3075
 	public static function insert_last_geoid_update() {
@@ -3078,10 +3078,10 @@  discard block
 block discarded – undo
3078 3078
 		try {
3079 3079
 			$Connection = new Connection();
3080 3080
 			$sth = $Connection->db->prepare($query);
3081
-                        $sth->execute();
3082
-                } catch(PDOException $e) {
3083
-                        return "error : ".$e->getMessage();
3084
-                }
3081
+						$sth->execute();
3082
+				} catch(PDOException $e) {
3083
+						return "error : ".$e->getMessage();
3084
+				}
3085 3085
 	}
3086 3086
 
3087 3087
 	public static function check_last_owner_update() {
@@ -3094,13 +3094,13 @@  discard block
 block discarded – undo
3094 3094
 		try {
3095 3095
 			$Connection = new Connection();
3096 3096
 			$sth = $Connection->db->prepare($query);
3097
-                        $sth->execute();
3098
-                } catch(PDOException $e) {
3099
-                        return "error : ".$e->getMessage();
3100
-                }
3101
-                $row = $sth->fetch(PDO::FETCH_ASSOC);
3102
-                if ($row['nb'] > 0) return false;
3103
-                else return true;
3097
+						$sth->execute();
3098
+				} catch(PDOException $e) {
3099
+						return "error : ".$e->getMessage();
3100
+				}
3101
+				$row = $sth->fetch(PDO::FETCH_ASSOC);
3102
+				if ($row['nb'] > 0) return false;
3103
+				else return true;
3104 3104
 	}
3105 3105
 
3106 3106
 	public static function insert_last_owner_update() {
@@ -3109,10 +3109,10 @@  discard block
 block discarded – undo
3109 3109
 		try {
3110 3110
 			$Connection = new Connection();
3111 3111
 			$sth = $Connection->db->prepare($query);
3112
-                        $sth->execute();
3113
-                } catch(PDOException $e) {
3114
-                        return "error : ".$e->getMessage();
3115
-                }
3112
+						$sth->execute();
3113
+				} catch(PDOException $e) {
3114
+						return "error : ".$e->getMessage();
3115
+				}
3116 3116
 	}
3117 3117
 	public static function check_last_schedules_update() {
3118 3118
 		global $globalDBdriver;
@@ -3124,13 +3124,13 @@  discard block
 block discarded – undo
3124 3124
 		try {
3125 3125
 			$Connection = new Connection();
3126 3126
 			$sth = $Connection->db->prepare($query);
3127
-                        $sth->execute();
3128
-                } catch(PDOException $e) {
3129
-                        return "error : ".$e->getMessage();
3130
-                }
3131
-                $row = $sth->fetch(PDO::FETCH_ASSOC);
3132
-                if ($row['nb'] > 0) return false;
3133
-                else return true;
3127
+						$sth->execute();
3128
+				} catch(PDOException $e) {
3129
+						return "error : ".$e->getMessage();
3130
+				}
3131
+				$row = $sth->fetch(PDO::FETCH_ASSOC);
3132
+				if ($row['nb'] > 0) return false;
3133
+				else return true;
3134 3134
 	}
3135 3135
 
3136 3136
 	public static function insert_last_schedules_update() {
@@ -3310,10 +3310,10 @@  discard block
 block discarded – undo
3310 3310
 		try {
3311 3311
 			$Connection = new Connection();
3312 3312
 			$sth = $Connection->db->prepare($query);
3313
-                        $sth->execute();
3314
-                } catch(PDOException $e) {
3315
-                        return "error : ".$e->getMessage();
3316
-                }
3313
+						$sth->execute();
3314
+				} catch(PDOException $e) {
3315
+						return "error : ".$e->getMessage();
3316
+				}
3317 3317
 	}
3318 3318
 	public static function delete_duplicateowner() {
3319 3319
 		global $globalDBdriver;
@@ -3325,10 +3325,10 @@  discard block
 block discarded – undo
3325 3325
 		try {
3326 3326
 			$Connection = new Connection();
3327 3327
 			$sth = $Connection->db->prepare($query);
3328
-                        $sth->execute();
3329
-                } catch(PDOException $e) {
3330
-                        return "error : ".$e->getMessage();
3331
-                }
3328
+						$sth->execute();
3329
+				} catch(PDOException $e) {
3330
+						return "error : ".$e->getMessage();
3331
+				}
3332 3332
 	}
3333 3333
 	
3334 3334
 	public static function update_all() {
Please login to merge, or discard this patch.
require/class.SpotterLive.php 1 patch
Indentation   +201 added lines, -201 removed lines patch added patch discarded remove patch
@@ -13,10 +13,10 @@  discard block
 block discarded – undo
13 13
 
14 14
 
15 15
 	/**
16
-	* Get SQL query part for filter used
17
-	* @param Array $filter the filter
18
-	* @return Array the SQL part
19
-	*/
16
+	 * Get SQL query part for filter used
17
+	 * @param Array $filter the filter
18
+	 * @return Array the SQL part
19
+	 */
20 20
 	public function getFilter($filter = array(),$where = false,$and = false) {
21 21
 		global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver;
22 22
 		$filters = array();
@@ -129,11 +129,11 @@  discard block
 block discarded – undo
129 129
 	}
130 130
 
131 131
 	/**
132
-	* Gets all the spotter information based on the latest data entry
133
-	*
134
-	* @return Array the spotter information
135
-	*
136
-	*/
132
+	 * Gets all the spotter information based on the latest data entry
133
+	 *
134
+	 * @return Array the spotter information
135
+	 *
136
+	 */
137 137
 	public function getLiveSpotterData($limit = '', $sort = '', $filter = array())
138 138
 	{
139 139
 		global $globalDBdriver, $globalLiveInterval;
@@ -176,11 +176,11 @@  discard block
 block discarded – undo
176 176
 	}
177 177
 
178 178
 	/**
179
-	* Gets Minimal Live Spotter data
180
-	*
181
-	* @return Array the spotter information
182
-	*
183
-	*/
179
+	 * Gets Minimal Live Spotter data
180
+	 *
181
+	 * @return Array the spotter information
182
+	 *
183
+	 */
184 184
 	public function getMinLiveSpotterData($filter = array())
185 185
 	{
186 186
 		global $globalDBdriver, $globalLiveInterval, $globalArchive;
@@ -217,11 +217,11 @@  discard block
 block discarded – undo
217 217
 	}
218 218
 
219 219
 	/**
220
-	* Gets Minimal Live Spotter data since xx seconds
221
-	*
222
-	* @return Array the spotter information
223
-	*
224
-	*/
220
+	 * Gets Minimal Live Spotter data since xx seconds
221
+	 *
222
+	 * @return Array the spotter information
223
+	 *
224
+	 */
225 225
 	public function getMinLastLiveSpotterData($coord = array(),$filter = array(), $limit = false)
226 226
 	{
227 227
 		global $globalDBdriver, $globalLiveInterval, $globalArchive, $globalMap3DAircraftsLimit;
@@ -302,11 +302,11 @@  discard block
 block discarded – undo
302 302
 	}
303 303
 
304 304
 	/**
305
-	* Gets number of latest data entry
306
-	*
307
-	* @return String number of entry
308
-	*
309
-	*/
305
+	 * Gets number of latest data entry
306
+	 *
307
+	 * @return String number of entry
308
+	 *
309
+	 */
310 310
 	public function getLiveSpotterCount($filter = array())
311 311
 	{
312 312
 		global $globalDBdriver, $globalLiveInterval;
@@ -333,11 +333,11 @@  discard block
 block discarded – undo
333 333
 	}
334 334
 
335 335
 	/**
336
-	* Gets all the spotter information based on the latest data entry and coord
337
-	*
338
-	* @return Array the spotter information
339
-	*
340
-	*/
336
+	 * Gets all the spotter information based on the latest data entry and coord
337
+	 *
338
+	 * @return Array the spotter information
339
+	 *
340
+	 */
341 341
 	public function getLiveSpotterDatabyCoord($coord, $filter = array())
342 342
 	{
343 343
 		global $globalDBdriver, $globalLiveInterval;
@@ -362,11 +362,11 @@  discard block
 block discarded – undo
362 362
 	}
363 363
 
364 364
 	/**
365
-	* Gets all the spotter information based on the latest data entry and coord
366
-	*
367
-	* @return Array the spotter information
368
-	*
369
-	*/
365
+	 * Gets all the spotter information based on the latest data entry and coord
366
+	 *
367
+	 * @return Array the spotter information
368
+	 *
369
+	 */
370 370
 	public function getMinLiveSpotterDatabyCoord($coord, $filter = array())
371 371
 	{
372 372
 		global $globalDBdriver, $globalLiveInterval, $globalArchive;
@@ -431,11 +431,11 @@  discard block
 block discarded – undo
431 431
 	}
432 432
 
433 433
 	/**
434
-	* Gets all the spotter information based on a user's latitude and longitude
435
-	*
436
-	* @return Array the spotter information
437
-	*
438
-	*/
434
+	 * Gets all the spotter information based on a user's latitude and longitude
435
+	 *
436
+	 * @return Array the spotter information
437
+	 *
438
+	 */
439 439
 	public function getLatestSpotterForLayar($lat, $lng, $radius, $interval)
440 440
 	{
441 441
 		$Spotter = new Spotter($this->db);
@@ -445,98 +445,98 @@  discard block
 block discarded – undo
445 445
 				return false;
446 446
 			}
447 447
 		}
448
-        if ($lng != '')
449
-                {
450
-                        if (!is_numeric($lng))
451
-                        {
452
-                                return false;
453
-                        }
454
-                }
455
-
456
-                if ($radius != '')
457
-                {
458
-                        if (!is_numeric($radius))
459
-                        {
460
-                                return false;
461
-                        }
462
-                }
448
+		if ($lng != '')
449
+				{
450
+						if (!is_numeric($lng))
451
+						{
452
+								return false;
453
+						}
454
+				}
455
+
456
+				if ($radius != '')
457
+				{
458
+						if (!is_numeric($radius))
459
+						{
460
+								return false;
461
+						}
462
+				}
463 463
 		$additional_query = '';
464
-        if ($interval != '')
465
-                {
466
-                        if (!is_string($interval))
467
-                        {
468
-                                //$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';
469
-			        return false;
470
-                        } else {
471
-                if ($interval == '1m')
472
-                {
473
-                    $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';
474
-                } else if ($interval == '15m'){
475
-                    $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= spotter_live.date ';
476
-                } 
477
-            }
478
-                } else {
479
-         $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';   
480
-        }
481
-
482
-                $query  = "SELECT spotter_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_live 
464
+		if ($interval != '')
465
+				{
466
+						if (!is_string($interval))
467
+						{
468
+								//$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';
469
+					return false;
470
+						} else {
471
+				if ($interval == '1m')
472
+				{
473
+					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';
474
+				} else if ($interval == '15m'){
475
+					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= spotter_live.date ';
476
+				} 
477
+			}
478
+				} else {
479
+		 $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';   
480
+		}
481
+
482
+				$query  = "SELECT spotter_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_live 
483 483
                    WHERE spotter_live.latitude <> '' 
484 484
                                    AND spotter_live.longitude <> '' 
485 485
                    ".$additional_query."
486 486
                    HAVING distance < :radius  
487 487
                                    ORDER BY distance";
488 488
 
489
-                $spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius));
489
+				$spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius));
490 490
 
491
-                return $spotter_array;
492
-        }
491
+				return $spotter_array;
492
+		}
493 493
 
494 494
     
495
-        /**
496
-	* Gets all the spotter information based on a particular callsign
497
-	*
498
-	* @return Array the spotter information
499
-	*
500
-	*/
495
+		/**
496
+		 * Gets all the spotter information based on a particular callsign
497
+		 *
498
+		 * @return Array the spotter information
499
+		 *
500
+		 */
501 501
 	public function getLastLiveSpotterDataByIdent($ident)
502 502
 	{
503 503
 		$Spotter = new Spotter($this->db);
504 504
 		date_default_timezone_set('UTC');
505 505
 
506 506
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
507
-                $query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
507
+				$query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
508 508
 
509 509
 		$spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident),'',true);
510 510
 
511 511
 		return $spotter_array;
512 512
 	}
513 513
 
514
-        /**
515
-	* Gets all the spotter information based on a particular callsign
516
-	*
517
-	* @return Array the spotter information
518
-	*
519
-	*/
514
+		/**
515
+		 * Gets all the spotter information based on a particular callsign
516
+		 *
517
+		 * @return Array the spotter information
518
+		 *
519
+		 */
520 520
 	public function getDateLiveSpotterDataByIdent($ident,$date)
521 521
 	{
522 522
 		$Spotter = new Spotter($this->db);
523 523
 		date_default_timezone_set('UTC');
524 524
 
525 525
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
526
-                $query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
526
+				$query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
527 527
 
528
-                $date = date('c',$date);
528
+				$date = date('c',$date);
529 529
 		$spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident,':date' => $date));
530 530
 
531 531
 		return $spotter_array;
532 532
 	}
533 533
 
534
-        /**
535
-	* Gets last spotter information based on a particular callsign
536
-	*
537
-	* @return Array the spotter information
538
-	*
539
-	*/
534
+		/**
535
+		 * Gets last spotter information based on a particular callsign
536
+		 *
537
+		 * @return Array the spotter information
538
+		 *
539
+		 */
540 540
 	public function getLastLiveSpotterDataById($id)
541 541
 	{
542 542
 		$Spotter = new Spotter($this->db);
@@ -547,12 +547,12 @@  discard block
 block discarded – undo
547 547
 		return $spotter_array;
548 548
 	}
549 549
 
550
-        /**
551
-	* Gets last spotter information based on a particular callsign
552
-	*
553
-	* @return Array the spotter information
554
-	*
555
-	*/
550
+		/**
551
+		 * Gets last spotter information based on a particular callsign
552
+		 *
553
+		 * @return Array the spotter information
554
+		 *
555
+		 */
556 556
 	public function getDateLiveSpotterDataById($id,$date)
557 557
 	{
558 558
 		$Spotter = new Spotter($this->db);
@@ -565,21 +565,21 @@  discard block
 block discarded – undo
565 565
 		return $spotter_array;
566 566
 	}
567 567
 
568
-        /**
569
-	* Gets altitude information based on a particular callsign
570
-	*
571
-	* @return Array the spotter information
572
-	*
573
-	*/
568
+		/**
569
+		 * Gets altitude information based on a particular callsign
570
+		 *
571
+		 * @return Array the spotter information
572
+		 *
573
+		 */
574 574
 	public function getAltitudeLiveSpotterDataByIdent($ident)
575 575
 	{
576 576
 
577 577
 		date_default_timezone_set('UTC');
578 578
 
579 579
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
580
-                $query  = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident';
580
+				$query  = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident';
581 581
 
582
-    		try {
582
+			try {
583 583
 			
584 584
 			$sth = $this->db->prepare($query);
585 585
 			$sth->execute(array(':ident' => $ident));
@@ -592,12 +592,12 @@  discard block
 block discarded – undo
592 592
 		return $spotter_array;
593 593
 	}
594 594
 
595
-        /**
596
-	* Gets all the spotter information based on a particular id
597
-	*
598
-	* @return Array the spotter information
599
-	*
600
-	*/
595
+		/**
596
+		 * Gets all the spotter information based on a particular id
597
+		 *
598
+		 * @return Array the spotter information
599
+		 *
600
+		 */
601 601
 	public function getAllLiveSpotterDataById($id,$liveinterval = false)
602 602
 	{
603 603
 		global $globalDBdriver, $globalLiveInterval;
@@ -625,18 +625,18 @@  discard block
 block discarded – undo
625 625
 		return $spotter_array;
626 626
 	}
627 627
 
628
-        /**
629
-	* Gets all the spotter information based on a particular ident
630
-	*
631
-	* @return Array the spotter information
632
-	*
633
-	*/
628
+		/**
629
+		 * Gets all the spotter information based on a particular ident
630
+		 *
631
+		 * @return Array the spotter information
632
+		 *
633
+		 */
634 634
 	public function getAllLiveSpotterDataByIdent($ident)
635 635
 	{
636 636
 		date_default_timezone_set('UTC');
637 637
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
638 638
 		$query  = self::$global_query.' WHERE spotter_live.ident = :ident';
639
-    		try {
639
+			try {
640 640
 			
641 641
 			$sth = $this->db->prepare($query);
642 642
 			$sth->execute(array(':ident' => $ident));
@@ -650,23 +650,23 @@  discard block
 block discarded – undo
650 650
 
651 651
 
652 652
 	/**
653
-	* Deletes all info in the table
654
-	*
655
-	* @return String success or false
656
-	*
657
-	*/
653
+	 * Deletes all info in the table
654
+	 *
655
+	 * @return String success or false
656
+	 *
657
+	 */
658 658
 	public function deleteLiveSpotterData()
659 659
 	{
660 660
 		global $globalDBdriver;
661 661
 		if ($globalDBdriver == 'mysql') {
662 662
 			//$query  = "DELETE FROM spotter_live WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE) >= spotter_live.date";
663 663
 			$query  = 'DELETE FROM spotter_live WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 9 HOUR) >= spotter_live.date';
664
-            		//$query  = "DELETE FROM spotter_live WHERE spotter_live.id IN (SELECT spotter_live.id FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) >= spotter_live.date)";
664
+					//$query  = "DELETE FROM spotter_live WHERE spotter_live.id IN (SELECT spotter_live.id FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) >= spotter_live.date)";
665 665
 		} else {
666 666
 			$query  = "DELETE FROM spotter_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' >= spotter_live.date";
667 667
 		}
668 668
         
669
-    		try {
669
+			try {
670 670
 			
671 671
 			$sth = $this->db->prepare($query);
672 672
 			$sth->execute();
@@ -678,18 +678,18 @@  discard block
 block discarded – undo
678 678
 	}
679 679
 
680 680
 	/**
681
-	* Deletes all info in the table for aircraft not seen since 2 HOUR
682
-	*
683
-	* @return String success or false
684
-	*
685
-	*/
681
+	 * Deletes all info in the table for aircraft not seen since 2 HOUR
682
+	 *
683
+	 * @return String success or false
684
+	 *
685
+	 */
686 686
 	public function deleteLiveSpotterDataNotUpdated()
687 687
 	{
688 688
 		global $globalDBdriver, $globalDebug;
689 689
 		if ($globalDBdriver == 'mysql') {
690 690
 			//$query = 'SELECT flightaware_id FROM spotter_live WHERE DATE_SUB(UTC_TIMESTAMP(), INTERVAL 1 HOUR) >= spotter_live.date AND spotter_live.flightaware_id NOT IN (SELECT flightaware_id FROM spotter_live WHERE DATE_SUB(UTC_TIMESTAMP(), INTERVAL 1 HOUR) < spotter_live.date) LIMIT 800 OFFSET 0';
691
-    			$query = "SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT flightaware_id,MAX(date) as max_date FROM spotter_live GROUP BY flightaware_id) s ON s.flightaware_id = spotter_live.flightaware_id AND DATE_SUB(UTC_TIMESTAMP(), INTERVAL 2 HOUR) >= s.max_date LIMIT 2000 OFFSET 0";
692
-    			try {
691
+				$query = "SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT flightaware_id,MAX(date) as max_date FROM spotter_live GROUP BY flightaware_id) s ON s.flightaware_id = spotter_live.flightaware_id AND DATE_SUB(UTC_TIMESTAMP(), INTERVAL 2 HOUR) >= s.max_date LIMIT 2000 OFFSET 0";
692
+				try {
693 693
 				
694 694
 				$sth = $this->db->prepare($query);
695 695
 				$sth->execute();
@@ -697,8 +697,8 @@  discard block
 block discarded – undo
697 697
 				return "error";
698 698
 			}
699 699
 			$query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN (';
700
-                        $i = 0;
701
-                        $j =0;
700
+						$i = 0;
701
+						$j =0;
702 702
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
703 703
 			foreach($all as $row)
704 704
 			{
@@ -706,20 +706,20 @@  discard block
 block discarded – undo
706 706
 				$j++;
707 707
 				if ($j == 30) {
708 708
 					if ($globalDebug) echo ".";
709
-				    	try {
709
+						try {
710 710
 						
711 711
 						$sth = $this->db->prepare(substr($query_delete,0,-1).")");
712 712
 						$sth->execute();
713 713
 					} catch(PDOException $e) {
714 714
 						return "error";
715 715
 					}
716
-                                	$query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN (';
717
-                                	$j = 0;
716
+									$query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN (';
717
+									$j = 0;
718 718
 				}
719 719
 				$query_delete .= "'".$row['flightaware_id']."',";
720 720
 			}
721 721
 			if ($i > 0) {
722
-    				try {
722
+					try {
723 723
 					
724 724
 					$sth = $this->db->prepare(substr($query_delete,0,-1).")");
725 725
 					$sth->execute();
@@ -730,9 +730,9 @@  discard block
 block discarded – undo
730 730
 			return "success";
731 731
 		} elseif ($globalDBdriver == 'pgsql') {
732 732
 			//$query = "SELECT flightaware_id FROM spotter_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' >= spotter_live.date AND spotter_live.flightaware_id NOT IN (SELECT flightaware_id FROM spotter_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' < spotter_live.date) LIMIT 800 OFFSET 0";
733
-    			//$query = "SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT flightaware_id,MAX(date) as max_date FROM spotter_live GROUP BY flightaware_id) s ON s.flightaware_id = spotter_live.flightaware_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0";
734
-    			$query = "DELETE FROM spotter_live WHERE flightaware_id IN (SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT flightaware_id,MAX(date) as max_date FROM spotter_live GROUP BY flightaware_id) s ON s.flightaware_id = spotter_live.flightaware_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 2000 OFFSET 0)";
735
-    			try {
733
+				//$query = "SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT flightaware_id,MAX(date) as max_date FROM spotter_live GROUP BY flightaware_id) s ON s.flightaware_id = spotter_live.flightaware_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0";
734
+				$query = "DELETE FROM spotter_live WHERE flightaware_id IN (SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT flightaware_id,MAX(date) as max_date FROM spotter_live GROUP BY flightaware_id) s ON s.flightaware_id = spotter_live.flightaware_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 2000 OFFSET 0)";
735
+				try {
736 736
 				
737 737
 				$sth = $this->db->prepare($query);
738 738
 				$sth->execute();
@@ -776,17 +776,17 @@  discard block
 block discarded – undo
776 776
 	}
777 777
 
778 778
 	/**
779
-	* Deletes all info in the table for an ident
780
-	*
781
-	* @return String success or false
782
-	*
783
-	*/
779
+	 * Deletes all info in the table for an ident
780
+	 *
781
+	 * @return String success or false
782
+	 *
783
+	 */
784 784
 	public function deleteLiveSpotterDataByIdent($ident)
785 785
 	{
786 786
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
787 787
 		$query  = 'DELETE FROM spotter_live WHERE ident = :ident';
788 788
         
789
-    		try {
789
+			try {
790 790
 			
791 791
 			$sth = $this->db->prepare($query);
792 792
 			$sth->execute(array(':ident' => $ident));
@@ -798,17 +798,17 @@  discard block
 block discarded – undo
798 798
 	}
799 799
 
800 800
 	/**
801
-	* Deletes all info in the table for an id
802
-	*
803
-	* @return String success or false
804
-	*
805
-	*/
801
+	 * Deletes all info in the table for an id
802
+	 *
803
+	 * @return String success or false
804
+	 *
805
+	 */
806 806
 	public function deleteLiveSpotterDataById($id)
807 807
 	{
808 808
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
809 809
 		$query  = 'DELETE FROM spotter_live WHERE flightaware_id = :id';
810 810
         
811
-    		try {
811
+			try {
812 812
 			
813 813
 			$sth = $this->db->prepare($query);
814 814
 			$sth->execute(array(':id' => $id));
@@ -821,11 +821,11 @@  discard block
 block discarded – undo
821 821
 
822 822
 
823 823
 	/**
824
-	* Gets the aircraft ident within the last hour
825
-	*
826
-	* @return String the ident
827
-	*
828
-	*/
824
+	 * Gets the aircraft ident within the last hour
825
+	 *
826
+	 * @return String the ident
827
+	 *
828
+	 */
829 829
 	public function getIdentFromLastHour($ident)
830 830
 	{
831 831
 		global $globalDBdriver, $globalTimezone;
@@ -851,14 +851,14 @@  discard block
 block discarded – undo
851 851
 			$ident_result = $row['ident'];
852 852
 		}
853 853
 		return $ident_result;
854
-        }
854
+		}
855 855
 
856 856
 	/**
857
-	* Check recent aircraft
858
-	*
859
-	* @return String the ident
860
-	*
861
-	*/
857
+	 * Check recent aircraft
858
+	 *
859
+	 * @return String the ident
860
+	 *
861
+	 */
862 862
 	public function checkIdentRecent($ident)
863 863
 	{
864 864
 		global $globalDBdriver, $globalTimezone;
@@ -884,14 +884,14 @@  discard block
 block discarded – undo
884 884
 			$ident_result = $row['flightaware_id'];
885 885
 		}
886 886
 		return $ident_result;
887
-        }
887
+		}
888 888
 
889 889
 	/**
890
-	* Check recent aircraft by id
891
-	*
892
-	* @return String the ident
893
-	*
894
-	*/
890
+	 * Check recent aircraft by id
891
+	 *
892
+	 * @return String the ident
893
+	 *
894
+	 */
895 895
 	public function checkIdRecent($id)
896 896
 	{
897 897
 		global $globalDBdriver, $globalTimezone;
@@ -917,14 +917,14 @@  discard block
 block discarded – undo
917 917
 			$ident_result = $row['flightaware_id'];
918 918
 		}
919 919
 		return $ident_result;
920
-        }
920
+		}
921 921
 
922 922
 	/**
923
-	* Check recent aircraft by ModeS
924
-	*
925
-	* @return String the ModeS
926
-	*
927
-	*/
923
+	 * Check recent aircraft by ModeS
924
+	 *
925
+	 * @return String the ModeS
926
+	 *
927
+	 */
928 928
 	public function checkModeSRecent($modes)
929 929
 	{
930 930
 		global $globalDBdriver, $globalTimezone;
@@ -951,19 +951,19 @@  discard block
 block discarded – undo
951 951
 			$ident_result = $row['flightaware_id'];
952 952
 		}
953 953
 		return $ident_result;
954
-        }
954
+		}
955 955
 
956 956
 	/**
957
-	* Adds a new spotter data
958
-	*
959
-	* @param String $flightaware_id the ID from flightaware
960
-	* @param String $ident the flight ident
961
-	* @param String $aircraft_icao the aircraft type
962
-	* @param String $departure_airport_icao the departure airport
963
-	* @param String $arrival_airport_icao the arrival airport
964
-	* @return String success or false
965
-	*
966
-	*/
957
+	 * Adds a new spotter data
958
+	 *
959
+	 * @param String $flightaware_id the ID from flightaware
960
+	 * @param String $ident the flight ident
961
+	 * @param String $aircraft_icao the aircraft type
962
+	 * @param String $departure_airport_icao the departure airport
963
+	 * @param String $arrival_airport_icao the arrival airport
964
+	 * @return String success or false
965
+	 *
966
+	 */
967 967
 	public function addLiveSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $altitude_real = '',$heading = '', $groundspeed = '', $date = '',$departure_airport_time = '', $arrival_airport_time = '', $squawk = '', $route_stop = '', $ModeS = '', $putinarchive = false,$registration = '',$pilot_id = '', $pilot_name = '', $verticalrate = '', $noarchive = false, $ground = false,$format_source = '', $source_name = '', $over_country = '')
968 968
 	{
969 969
 		global $globalURL, $globalArchive, $globalDebug;
@@ -1106,10 +1106,10 @@  discard block
 block discarded – undo
1106 1106
 		$arrival_airport_country = '';
1107 1107
 		
1108 1108
             	
1109
-            	if ($squawk == '' || $Common->isInteger($squawk) === false ) $squawk = NULL;
1110
-            	if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) $verticalrate = NULL;
1111
-            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
1112
-            	if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
1109
+				if ($squawk == '' || $Common->isInteger($squawk) === false ) $squawk = NULL;
1110
+				if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) $verticalrate = NULL;
1111
+				if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
1112
+				if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
1113 1113
 		
1114 1114
 		$query = '';
1115 1115
 		if ($globalArchive) {
@@ -1130,10 +1130,10 @@  discard block
 block discarded – undo
1130 1130
 			return "error : ".$e->getMessage();
1131 1131
 		}
1132 1132
 		if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) {
1133
-		    if ($globalDebug) echo '(Add to SBS archive : ';
1134
-		    $SpotterArchive = new SpotterArchive($this->db);
1135
-		    $result =  $SpotterArchive->addSpotterArchiveData($flightaware_id, $ident, $registration, $airline_name, $airline_icao, $airline_country, $airline_type, $aircraft_icao, $aircraft_shadow, $aircraft_name, $aircraft_manufacturer, $departure_airport_icao, $departure_airport_name, $departure_airport_city, $departure_airport_country, $departure_airport_time,$arrival_airport_icao, $arrival_airport_name, $arrival_airport_city, $arrival_airport_country, $arrival_airport_time, $route_stop, $date,$latitude, $longitude, $waypoints, $altitude, $altitude_real,$heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name,$verticalrate,$format_source,$source_name, $over_country);
1136
-		    if ($globalDebug) echo $result.')';
1133
+			if ($globalDebug) echo '(Add to SBS archive : ';
1134
+			$SpotterArchive = new SpotterArchive($this->db);
1135
+			$result =  $SpotterArchive->addSpotterArchiveData($flightaware_id, $ident, $registration, $airline_name, $airline_icao, $airline_country, $airline_type, $aircraft_icao, $aircraft_shadow, $aircraft_name, $aircraft_manufacturer, $departure_airport_icao, $departure_airport_name, $departure_airport_city, $departure_airport_country, $departure_airport_time,$arrival_airport_icao, $arrival_airport_name, $arrival_airport_city, $arrival_airport_country, $arrival_airport_time, $route_stop, $date,$latitude, $longitude, $waypoints, $altitude, $altitude_real,$heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name,$verticalrate,$format_source,$source_name, $over_country);
1136
+			if ($globalDebug) echo $result.')';
1137 1137
 		} elseif ($globalDebug && $putinarchive !== true) {
1138 1138
 			echo '(Not adding to archive)';
1139 1139
 		} elseif ($globalDebug && $noarchive === true) {
Please login to merge, or discard this patch.
require/class.TrackerLive.php 1 patch
Indentation   +196 added lines, -196 removed lines patch added patch discarded remove patch
@@ -13,10 +13,10 @@  discard block
 block discarded – undo
13 13
 
14 14
 
15 15
 	/**
16
-	* Get SQL query part for filter used
17
-	* @param Array $filter the filter
18
-	* @return Array the SQL part
19
-	*/
16
+	 * Get SQL query part for filter used
17
+	 * @param Array $filter the filter
18
+	 * @return Array the SQL part
19
+	 */
20 20
 	public function getFilter($filter = array(),$where = false,$and = false) {
21 21
 		global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver;
22 22
 		$filters = array();
@@ -87,11 +87,11 @@  discard block
 block discarded – undo
87 87
 	}
88 88
 
89 89
 	/**
90
-	* Gets all the spotter information based on the latest data entry
91
-	*
92
-	* @return Array the spotter information
93
-	*
94
-	*/
90
+	 * Gets all the spotter information based on the latest data entry
91
+	 *
92
+	 * @return Array the spotter information
93
+	 *
94
+	 */
95 95
 	public function getLiveTrackerData($limit = '', $sort = '', $filter = array())
96 96
 	{
97 97
 		global $globalDBdriver, $globalLiveInterval;
@@ -133,11 +133,11 @@  discard block
 block discarded – undo
133 133
 	}
134 134
 
135 135
 	/**
136
-	* Gets Minimal Live Spotter data
137
-	*
138
-	* @return Array the spotter information
139
-	*
140
-	*/
136
+	 * Gets Minimal Live Spotter data
137
+	 *
138
+	 * @return Array the spotter information
139
+	 *
140
+	 */
141 141
 	public function getMinLiveTrackerData($filter = array())
142 142
 	{
143 143
 		global $globalDBdriver, $globalLiveInterval;
@@ -171,11 +171,11 @@  discard block
 block discarded – undo
171 171
 	}
172 172
 
173 173
 	/**
174
-	* Gets Minimal Live Spotter data since xx seconds
175
-	*
176
-	* @return Array the spotter information
177
-	*
178
-	*/
174
+	 * Gets Minimal Live Spotter data since xx seconds
175
+	 *
176
+	 * @return Array the spotter information
177
+	 *
178
+	 */
179 179
 	public function getMinLastLiveTrackerData($coord,$filter = array(),$limit = false)
180 180
 	{
181 181
 		global $globalDBdriver, $globalLiveInterval, $globalArchive, $globalMap3DTrackersLimit;
@@ -247,11 +247,11 @@  discard block
 block discarded – undo
247 247
 	}
248 248
 
249 249
 	/**
250
-	* Gets number of latest data entry
251
-	*
252
-	* @return String number of entry
253
-	*
254
-	*/
250
+	 * Gets number of latest data entry
251
+	 *
252
+	 * @return String number of entry
253
+	 *
254
+	 */
255 255
 	public function getLiveTrackerCount($filter = array())
256 256
 	{
257 257
 		global $globalDBdriver, $globalLiveInterval;
@@ -276,11 +276,11 @@  discard block
 block discarded – undo
276 276
 	}
277 277
 
278 278
 	/**
279
-	* Gets all the spotter information based on the latest data entry and coord
280
-	*
281
-	* @return Array the spotter information
282
-	*
283
-	*/
279
+	 * Gets all the spotter information based on the latest data entry and coord
280
+	 *
281
+	 * @return Array the spotter information
282
+	 *
283
+	 */
284 284
 	public function getLiveTrackerDatabyCoord($coord, $filter = array())
285 285
 	{
286 286
 		global $globalDBdriver, $globalLiveInterval;
@@ -304,11 +304,11 @@  discard block
 block discarded – undo
304 304
 	}
305 305
 
306 306
 	/**
307
-	* Gets all the spotter information based on the latest data entry and coord
308
-	*
309
-	* @return Array the spotter information
310
-	*
311
-	*/
307
+	 * Gets all the spotter information based on the latest data entry and coord
308
+	 *
309
+	 * @return Array the spotter information
310
+	 *
311
+	 */
312 312
 	public function getMinLiveTrackerDatabyCoord($coord, $filter = array())
313 313
 	{
314 314
 		global $globalDBdriver, $globalLiveInterval;
@@ -335,11 +335,11 @@  discard block
 block discarded – undo
335 335
 	}
336 336
 
337 337
 	/**
338
-	* Gets all the spotter information based on a user's latitude and longitude
339
-	*
340
-	* @return Array the spotter information
341
-	*
342
-	*/
338
+	 * Gets all the spotter information based on a user's latitude and longitude
339
+	 *
340
+	 * @return Array the spotter information
341
+	 *
342
+	 */
343 343
 	public function getLatestTrackerForLayar($lat, $lng, $radius, $interval)
344 344
 	{
345 345
 		$Tracker = new Tracker($this->db);
@@ -352,142 +352,142 @@  discard block
 block discarded – undo
352 352
 		if ($lng != '')
353 353
 		{
354 354
 			if (!is_numeric($lng))
355
-                        {
356
-                                return false;
357
-                        }
358
-                }
359
-
360
-                if ($radius != '')
361
-                {
362
-                        if (!is_numeric($radius))
363
-                        {
364
-                                return false;
365
-                        }
366
-                }
355
+						{
356
+								return false;
357
+						}
358
+				}
359
+
360
+				if ($radius != '')
361
+				{
362
+						if (!is_numeric($radius))
363
+						{
364
+								return false;
365
+						}
366
+				}
367 367
 		$additional_query = '';
368 368
 		if ($interval != '')
369
-                {
370
-                        if (!is_string($interval))
371
-                        {
372
-                                //$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= tracker_live.date ';
373
-			        return false;
374
-                        } else {
375
-                if ($interval == '1m')
376
-                {
377
-                    $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= tracker_live.date ';
378
-                } else if ($interval == '15m'){
379
-                    $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= tracker_live.date ';
380
-                } 
381
-            }
382
-                } else {
383
-         $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= tracker_live.date ';   
384
-        }
385
-
386
-                $query  = "SELECT tracker_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM tracker_live 
369
+				{
370
+						if (!is_string($interval))
371
+						{
372
+								//$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= tracker_live.date ';
373
+					return false;
374
+						} else {
375
+				if ($interval == '1m')
376
+				{
377
+					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= tracker_live.date ';
378
+				} else if ($interval == '15m'){
379
+					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= tracker_live.date ';
380
+				} 
381
+			}
382
+				} else {
383
+		 $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= tracker_live.date ';   
384
+		}
385
+
386
+				$query  = "SELECT tracker_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM tracker_live 
387 387
                    WHERE tracker_live.latitude <> '' 
388 388
                                    AND tracker_live.longitude <> '' 
389 389
                    ".$additional_query."
390 390
                    HAVING distance < :radius  
391 391
                                    ORDER BY distance";
392 392
 
393
-                $spotter_array = $Tracker->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius));
393
+				$spotter_array = $Tracker->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius));
394 394
 
395
-                return $spotter_array;
396
-        }
395
+				return $spotter_array;
396
+		}
397 397
 
398 398
     
399
-        /**
400
-	* Gets all the spotter information based on a particular callsign
401
-	*
402
-	* @return Array the spotter information
403
-	*
404
-	*/
399
+		/**
400
+		 * Gets all the spotter information based on a particular callsign
401
+		 *
402
+		 * @return Array the spotter information
403
+		 *
404
+		 */
405 405
 	public function getLastLiveTrackerDataByIdent($ident)
406 406
 	{
407 407
 		$Tracker = new Tracker($this->db);
408 408
 		date_default_timezone_set('UTC');
409 409
 
410 410
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
411
-                $query  = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.ident = :ident GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC';
411
+				$query  = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.ident = :ident GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC';
412 412
 
413 413
 		$spotter_array = $Tracker->getDataFromDB($query,array(':ident' => $ident),'',true);
414 414
 
415 415
 		return $spotter_array;
416 416
 	}
417 417
 
418
-        /**
419
-	* Gets all the spotter information based on a particular callsign
420
-	*
421
-	* @return Array the spotter information
422
-	*
423
-	*/
418
+		/**
419
+		 * Gets all the spotter information based on a particular callsign
420
+		 *
421
+		 * @return Array the spotter information
422
+		 *
423
+		 */
424 424
 	public function getDateLiveTrackerDataByIdent($ident,$date)
425 425
 	{
426 426
 		$Tracker = new Tracker($this->db);
427 427
 		date_default_timezone_set('UTC');
428 428
 
429 429
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
430
-                $query  = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC';
430
+				$query  = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC';
431 431
 
432
-                $date = date('c',$date);
432
+				$date = date('c',$date);
433 433
 		$spotter_array = $Tracker->getDataFromDB($query,array(':ident' => $ident,':date' => $date));
434 434
 
435 435
 		return $spotter_array;
436 436
 	}
437 437
 
438
-        /**
439
-	* Gets last spotter information based on a particular callsign
440
-	*
441
-	* @return Array the spotter information
442
-	*
443
-	*/
438
+		/**
439
+		 * Gets last spotter information based on a particular callsign
440
+		 *
441
+		 * @return Array the spotter information
442
+		 *
443
+		 */
444 444
 	public function getLastLiveTrackerDataById($id)
445 445
 	{
446 446
 		$Tracker = new Tracker($this->db);
447 447
 		date_default_timezone_set('UTC');
448 448
 
449 449
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
450
-                $query  = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.famtrackid = :id GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC';
450
+				$query  = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.famtrackid = :id GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC';
451 451
 
452 452
 		$spotter_array = $Tracker->getDataFromDB($query,array(':id' => $id),'',true);
453 453
 
454 454
 		return $spotter_array;
455 455
 	}
456 456
 
457
-        /**
458
-	* Gets last spotter information based on a particular callsign
459
-	*
460
-	* @return Array the spotter information
461
-	*
462
-	*/
457
+		/**
458
+		 * Gets last spotter information based on a particular callsign
459
+		 *
460
+		 * @return Array the spotter information
461
+		 *
462
+		 */
463 463
 	public function getDateLiveTrackerDataById($id,$date)
464 464
 	{
465 465
 		$Tracker = new Tracker($this->db);
466 466
 		date_default_timezone_set('UTC');
467 467
 
468 468
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
469
-                $query  = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.famtrackid = :id AND l.date <= :date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC';
470
-                $date = date('c',$date);
469
+				$query  = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.famtrackid = :id AND l.date <= :date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC';
470
+				$date = date('c',$date);
471 471
 		$spotter_array = $Tracker->getDataFromDB($query,array(':id' => $id,':date' => $date),'',true);
472 472
 
473 473
 		return $spotter_array;
474 474
 	}
475 475
 
476
-        /**
477
-	* Gets altitude information based on a particular callsign
478
-	*
479
-	* @return Array the spotter information
480
-	*
481
-	*/
476
+		/**
477
+		 * Gets altitude information based on a particular callsign
478
+		 *
479
+		 * @return Array the spotter information
480
+		 *
481
+		 */
482 482
 	public function getAltitudeLiveTrackerDataByIdent($ident)
483 483
 	{
484 484
 
485 485
 		date_default_timezone_set('UTC');
486 486
 
487 487
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
488
-                $query  = 'SELECT tracker_live.altitude, tracker_live.date FROM tracker_live WHERE tracker_live.ident = :ident';
488
+				$query  = 'SELECT tracker_live.altitude, tracker_live.date FROM tracker_live WHERE tracker_live.ident = :ident';
489 489
 
490
-    		try {
490
+			try {
491 491
 			
492 492
 			$sth = $this->db->prepare($query);
493 493
 			$sth->execute(array(':ident' => $ident));
@@ -500,12 +500,12 @@  discard block
 block discarded – undo
500 500
 		return $spotter_array;
501 501
 	}
502 502
 
503
-        /**
504
-	* Gets all the spotter information based on a particular id
505
-	*
506
-	* @return Array the spotter information
507
-	*
508
-	*/
503
+		/**
504
+		 * Gets all the spotter information based on a particular id
505
+		 *
506
+		 * @return Array the spotter information
507
+		 *
508
+		 */
509 509
 	public function getAllLiveTrackerDataById($id,$liveinterval = false)
510 510
 	{
511 511
 		global $globalDBdriver, $globalLiveInterval;
@@ -533,18 +533,18 @@  discard block
 block discarded – undo
533 533
 		return $spotter_array;
534 534
 	}
535 535
 
536
-        /**
537
-	* Gets all the spotter information based on a particular ident
538
-	*
539
-	* @return Array the spotter information
540
-	*
541
-	*/
536
+		/**
537
+		 * Gets all the spotter information based on a particular ident
538
+		 *
539
+		 * @return Array the spotter information
540
+		 *
541
+		 */
542 542
 	public function getAllLiveTrackerDataByIdent($ident)
543 543
 	{
544 544
 		date_default_timezone_set('UTC');
545 545
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
546 546
 		$query  = self::$global_query.' WHERE tracker_live.ident = :ident';
547
-    		try {
547
+			try {
548 548
 			
549 549
 			$sth = $this->db->prepare($query);
550 550
 			$sth->execute(array(':ident' => $ident));
@@ -558,23 +558,23 @@  discard block
 block discarded – undo
558 558
 
559 559
 
560 560
 	/**
561
-	* Deletes all info in the table
562
-	*
563
-	* @return String success or false
564
-	*
565
-	*/
561
+	 * Deletes all info in the table
562
+	 *
563
+	 * @return String success or false
564
+	 *
565
+	 */
566 566
 	public function deleteLiveTrackerData()
567 567
 	{
568 568
 		global $globalDBdriver;
569 569
 		if ($globalDBdriver == 'mysql') {
570 570
 			//$query  = "DELETE FROM tracker_live WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE) >= tracker_live.date";
571 571
 			$query  = 'DELETE FROM tracker_live WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 9 HOUR) >= tracker_live.date';
572
-            		//$query  = "DELETE FROM tracker_live WHERE tracker_live.id IN (SELECT tracker_live.id FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) >= tracker_live.date)";
572
+					//$query  = "DELETE FROM tracker_live WHERE tracker_live.id IN (SELECT tracker_live.id FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) >= tracker_live.date)";
573 573
 		} else {
574 574
 			$query  = "DELETE FROM tracker_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' >= tracker_live.date";
575 575
 		}
576 576
         
577
-    		try {
577
+			try {
578 578
 			
579 579
 			$sth = $this->db->prepare($query);
580 580
 			$sth->execute();
@@ -586,18 +586,18 @@  discard block
 block discarded – undo
586 586
 	}
587 587
 
588 588
 	/**
589
-	* Deletes all info in the table for aircraft not seen since 2 HOUR
590
-	*
591
-	* @return String success or false
592
-	*
593
-	*/
589
+	 * Deletes all info in the table for aircraft not seen since 2 HOUR
590
+	 *
591
+	 * @return String success or false
592
+	 *
593
+	 */
594 594
 	public function deleteLiveTrackerDataNotUpdated()
595 595
 	{
596 596
 		global $globalDBdriver, $globalDebug;
597 597
 		if ($globalDBdriver == 'mysql') {
598 598
 			//$query = 'SELECT famtrackid FROM tracker_live WHERE DATE_SUB(UTC_TIMESTAMP(), INTERVAL 1 HOUR) >= tracker_live.date AND tracker_live.famtrackid NOT IN (SELECT famtrackid FROM tracker_live WHERE DATE_SUB(UTC_TIMESTAMP(), INTERVAL 1 HOUR) < tracker_live.date) LIMIT 800 OFFSET 0';
599
-    			$query = "SELECT tracker_live.famtrackid FROM tracker_live INNER JOIN (SELECT famtrackid,MAX(date) as max_date FROM tracker_live GROUP BY famtrackid) s ON s.famtrackid = tracker_live.famtrackid AND DATE_SUB(UTC_TIMESTAMP(), INTERVAL 2 HOUR) >= s.max_date LIMIT 1200 OFFSET 0";
600
-    			try {
599
+				$query = "SELECT tracker_live.famtrackid FROM tracker_live INNER JOIN (SELECT famtrackid,MAX(date) as max_date FROM tracker_live GROUP BY famtrackid) s ON s.famtrackid = tracker_live.famtrackid AND DATE_SUB(UTC_TIMESTAMP(), INTERVAL 2 HOUR) >= s.max_date LIMIT 1200 OFFSET 0";
600
+				try {
601 601
 				
602 602
 				$sth = $this->db->prepare($query);
603 603
 				$sth->execute();
@@ -605,8 +605,8 @@  discard block
 block discarded – undo
605 605
 				return "error";
606 606
 			}
607 607
 			$query_delete = 'DELETE FROM tracker_live WHERE famtrackid IN (';
608
-                        $i = 0;
609
-                        $j =0;
608
+						$i = 0;
609
+						$j =0;
610 610
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
611 611
 			foreach($all as $row)
612 612
 			{
@@ -614,20 +614,20 @@  discard block
 block discarded – undo
614 614
 				$j++;
615 615
 				if ($j == 30) {
616 616
 					if ($globalDebug) echo ".";
617
-				    	try {
617
+						try {
618 618
 						
619 619
 						$sth = $this->db->prepare(substr($query_delete,0,-1).")");
620 620
 						$sth->execute();
621 621
 					} catch(PDOException $e) {
622 622
 						return "error";
623 623
 					}
624
-                                	$query_delete = 'DELETE FROM tracker_live WHERE famtrackid IN (';
625
-                                	$j = 0;
624
+									$query_delete = 'DELETE FROM tracker_live WHERE famtrackid IN (';
625
+									$j = 0;
626 626
 				}
627 627
 				$query_delete .= "'".$row['famtrackid']."',";
628 628
 			}
629 629
 			if ($i > 0) {
630
-    				try {
630
+					try {
631 631
 					
632 632
 					$sth = $this->db->prepare(substr($query_delete,0,-1).")");
633 633
 					$sth->execute();
@@ -638,9 +638,9 @@  discard block
 block discarded – undo
638 638
 			return "success";
639 639
 		} elseif ($globalDBdriver == 'pgsql') {
640 640
 			//$query = "SELECT famtrackid FROM tracker_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' >= tracker_live.date AND tracker_live.famtrackid NOT IN (SELECT famtrackid FROM tracker_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' < tracker_live.date) LIMIT 800 OFFSET 0";
641
-    			//$query = "SELECT tracker_live.famtrackid FROM tracker_live INNER JOIN (SELECT famtrackid,MAX(date) as max_date FROM tracker_live GROUP BY famtrackid) s ON s.famtrackid = tracker_live.famtrackid AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0";
642
-    			$query = "DELETE FROM tracker_live WHERE famtrackid IN (SELECT tracker_live.famtrackid FROM tracker_live INNER JOIN (SELECT famtrackid,MAX(date) as max_date FROM tracker_live GROUP BY famtrackid) s ON s.famtrackid = tracker_live.famtrackid AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0)";
643
-    			try {
641
+				//$query = "SELECT tracker_live.famtrackid FROM tracker_live INNER JOIN (SELECT famtrackid,MAX(date) as max_date FROM tracker_live GROUP BY famtrackid) s ON s.famtrackid = tracker_live.famtrackid AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0";
642
+				$query = "DELETE FROM tracker_live WHERE famtrackid IN (SELECT tracker_live.famtrackid FROM tracker_live INNER JOIN (SELECT famtrackid,MAX(date) as max_date FROM tracker_live GROUP BY famtrackid) s ON s.famtrackid = tracker_live.famtrackid AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0)";
643
+				try {
644 644
 				
645 645
 				$sth = $this->db->prepare($query);
646 646
 				$sth->execute();
@@ -684,17 +684,17 @@  discard block
 block discarded – undo
684 684
 	}
685 685
 
686 686
 	/**
687
-	* Deletes all info in the table for an ident
688
-	*
689
-	* @return String success or false
690
-	*
691
-	*/
687
+	 * Deletes all info in the table for an ident
688
+	 *
689
+	 * @return String success or false
690
+	 *
691
+	 */
692 692
 	public function deleteLiveTrackerDataByIdent($ident)
693 693
 	{
694 694
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
695 695
 		$query  = 'DELETE FROM tracker_live WHERE ident = :ident';
696 696
         
697
-    		try {
697
+			try {
698 698
 			
699 699
 			$sth = $this->db->prepare($query);
700 700
 			$sth->execute(array(':ident' => $ident));
@@ -706,17 +706,17 @@  discard block
 block discarded – undo
706 706
 	}
707 707
 
708 708
 	/**
709
-	* Deletes all info in the table for an id
710
-	*
711
-	* @return String success or false
712
-	*
713
-	*/
709
+	 * Deletes all info in the table for an id
710
+	 *
711
+	 * @return String success or false
712
+	 *
713
+	 */
714 714
 	public function deleteLiveTrackerDataById($id)
715 715
 	{
716 716
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
717 717
 		$query  = 'DELETE FROM tracker_live WHERE famtrackid = :id';
718 718
         
719
-    		try {
719
+			try {
720 720
 			
721 721
 			$sth = $this->db->prepare($query);
722 722
 			$sth->execute(array(':id' => $id));
@@ -729,11 +729,11 @@  discard block
 block discarded – undo
729 729
 
730 730
 
731 731
 	/**
732
-	* Gets the aircraft ident within the last hour
733
-	*
734
-	* @return String the ident
735
-	*
736
-	*/
732
+	 * Gets the aircraft ident within the last hour
733
+	 *
734
+	 * @return String the ident
735
+	 *
736
+	 */
737 737
 	public function getIdentFromLastHour($ident)
738 738
 	{
739 739
 		global $globalDBdriver, $globalTimezone;
@@ -759,14 +759,14 @@  discard block
 block discarded – undo
759 759
 			$ident_result = $row['ident'];
760 760
 		}
761 761
 		return $ident_result;
762
-        }
762
+		}
763 763
 
764 764
 	/**
765
-	* Check recent aircraft
766
-	*
767
-	* @return String the ident
768
-	*
769
-	*/
765
+	 * Check recent aircraft
766
+	 *
767
+	 * @return String the ident
768
+	 *
769
+	 */
770 770
 	public function checkIdentRecent($ident)
771 771
 	{
772 772
 		global $globalDBdriver, $globalTimezone;
@@ -792,14 +792,14 @@  discard block
 block discarded – undo
792 792
 			$ident_result = $row['famtrackid'];
793 793
 		}
794 794
 		return $ident_result;
795
-        }
795
+		}
796 796
 
797 797
 	/**
798
-	* Check recent aircraft by id
799
-	*
800
-	* @return String the ident
801
-	*
802
-	*/
798
+	 * Check recent aircraft by id
799
+	 *
800
+	 * @return String the ident
801
+	 *
802
+	 */
803 803
 	public function checkIdRecent($id)
804 804
 	{
805 805
 		global $globalDBdriver, $globalTimezone;
@@ -825,19 +825,19 @@  discard block
 block discarded – undo
825 825
 			$ident_result = $row['famtrackid'];
826 826
 		}
827 827
 		return $ident_result;
828
-        }
828
+		}
829 829
 
830 830
 	/**
831
-	* Adds a new spotter data
832
-	*
833
-	* @param String $famtrackid the ID from flightaware
834
-	* @param String $ident the flight ident
835
-	* @param String $aircraft_icao the aircraft type
836
-	* @param String $departure_airport_icao the departure airport
837
-	* @param String $arrival_airport_icao the arrival airport
838
-	* @return String success or false
839
-	*
840
-	*/
831
+	 * Adds a new spotter data
832
+	 *
833
+	 * @param String $famtrackid the ID from flightaware
834
+	 * @param String $ident the flight ident
835
+	 * @param String $aircraft_icao the aircraft type
836
+	 * @param String $departure_airport_icao the departure airport
837
+	 * @param String $arrival_airport_icao the arrival airport
838
+	 * @return String success or false
839
+	 *
840
+	 */
841 841
 	public function addLiveTrackerData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $putinarchive = false, $comment = '', $type = '',$noarchive = false,$format_source = '', $source_name = '', $over_country = '')
842 842
 	{
843 843
 		global $globalURL, $globalArchive, $globalDebug;
@@ -910,8 +910,8 @@  discard block
 block discarded – undo
910 910
 		$comment = filter_var($comment,FILTER_SANITIZE_STRING);
911 911
 		$type = filter_var($type,FILTER_SANITIZE_STRING);
912 912
 
913
-            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
914
-            	if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
913
+				if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
914
+				if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
915 915
             	
916 916
 		$query = '';
917 917
 		if ($globalArchive) {
@@ -926,18 +926,18 @@  discard block
 block discarded – undo
926 926
 			
927 927
 			$sth = $this->db->prepare($query);
928 928
 			$sth->execute($query_values);
929
-                } catch(PDOException $e) {
930
-                	return "error : ".$e->getMessage();
931
-                }
932
-                /*
929
+				} catch(PDOException $e) {
930
+					return "error : ".$e->getMessage();
931
+				}
932
+				/*
933 933
                 echo 'putinarchive : '.$putinarchive."\n";
934 934
                 echo 'noarchive : '.$noarchive."\n";
935 935
                 */
936 936
 		if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) {
937
-		    if ($globalDebug) echo '(Add to Tracker archive '.$famtrackid.' : ';
938
-		    $TrackerArchive = new TrackerArchive($this->db);
939
-		    $result =  $TrackerArchive->addTrackerArchiveData($famtrackid, $ident,$latitude, $longitude, $altitude, $heading, $groundspeed, $date, $putinarchive, $comment, $type,$noarchive,$format_source, $source_name, $over_country);
940
-		    if ($globalDebug) echo $result.')';
937
+			if ($globalDebug) echo '(Add to Tracker archive '.$famtrackid.' : ';
938
+			$TrackerArchive = new TrackerArchive($this->db);
939
+			$result =  $TrackerArchive->addTrackerArchiveData($famtrackid, $ident,$latitude, $longitude, $altitude, $heading, $groundspeed, $date, $putinarchive, $comment, $type,$noarchive,$format_source, $source_name, $over_country);
940
+			if ($globalDebug) echo $result.')';
941 941
 		}
942 942
 
943 943
 		return "success";
Please login to merge, or discard this patch.
require/class.MarineLive.php 1 patch
Indentation   +188 added lines, -188 removed lines patch added patch discarded remove patch
@@ -13,10 +13,10 @@  discard block
 block discarded – undo
13 13
 
14 14
 
15 15
 	/**
16
-	* Get SQL query part for filter used
17
-	* @param Array $filter the filter
18
-	* @return Array the SQL part
19
-	*/
16
+	 * Get SQL query part for filter used
17
+	 * @param Array $filter the filter
18
+	 * @return Array the SQL part
19
+	 */
20 20
 	public function getFilter($filter = array(),$where = false,$and = false) {
21 21
 		global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver;
22 22
 		$filters = array();
@@ -87,11 +87,11 @@  discard block
 block discarded – undo
87 87
 	}
88 88
 
89 89
 	/**
90
-	* Gets all the spotter information based on the latest data entry
91
-	*
92
-	* @return Array the spotter information
93
-	*
94
-	*/
90
+	 * Gets all the spotter information based on the latest data entry
91
+	 *
92
+	 * @return Array the spotter information
93
+	 *
94
+	 */
95 95
 	public function getLiveMarineData($limit = '', $sort = '', $filter = array())
96 96
 	{
97 97
 		global $globalDBdriver, $globalLiveInterval;
@@ -134,11 +134,11 @@  discard block
 block discarded – undo
134 134
 	}
135 135
 
136 136
 	/**
137
-	* Gets Minimal Live Spotter data
138
-	*
139
-	* @return Array the spotter information
140
-	*
141
-	*/
137
+	 * Gets Minimal Live Spotter data
138
+	 *
139
+	 * @return Array the spotter information
140
+	 *
141
+	 */
142 142
 	public function getMinLiveMarineData($filter = array())
143 143
 	{
144 144
 		global $globalDBdriver, $globalLiveInterval;
@@ -168,11 +168,11 @@  discard block
 block discarded – undo
168 168
 	}
169 169
 
170 170
 	/**
171
-	* Gets Minimal Live Spotter data since xx seconds
172
-	*
173
-	* @return Array the spotter information
174
-	*
175
-	*/
171
+	 * Gets Minimal Live Spotter data since xx seconds
172
+	 *
173
+	 * @return Array the spotter information
174
+	 *
175
+	 */
176 176
 	public function getMinLastLiveMarineData($coord = array(),$filter = array(), $limit = false)
177 177
 	{
178 178
 		global $globalDBdriver, $globalLiveInterval, $globalMap3DMarinesLimit;
@@ -241,11 +241,11 @@  discard block
 block discarded – undo
241 241
 	}
242 242
 
243 243
 	/**
244
-	* Gets number of latest data entry
245
-	*
246
-	* @return String number of entry
247
-	*
248
-	*/
244
+	 * Gets number of latest data entry
245
+	 *
246
+	 * @return String number of entry
247
+	 *
248
+	 */
249 249
 	public function getLiveMarineCount($filter = array())
250 250
 	{
251 251
 		global $globalDBdriver, $globalLiveInterval;
@@ -270,11 +270,11 @@  discard block
 block discarded – undo
270 270
 	}
271 271
 
272 272
 	/**
273
-	* Gets all the spotter information based on the latest data entry and coord
274
-	*
275
-	* @return Array the spotter information
276
-	*
277
-	*/
273
+	 * Gets all the spotter information based on the latest data entry and coord
274
+	 *
275
+	 * @return Array the spotter information
276
+	 *
277
+	 */
278 278
 	public function getLiveMarineDatabyCoord($coord, $filter = array())
279 279
 	{
280 280
 		global $globalDBdriver, $globalLiveInterval;
@@ -298,11 +298,11 @@  discard block
 block discarded – undo
298 298
 	}
299 299
 
300 300
 	/**
301
-	* Gets all the spotter information based on the latest data entry and coord
302
-	*
303
-	* @return Array the spotter information
304
-	*
305
-	*/
301
+	 * Gets all the spotter information based on the latest data entry and coord
302
+	 *
303
+	 * @return Array the spotter information
304
+	 *
305
+	 */
306 306
 	public function getMinLiveMarineDatabyCoord($coord, $filter = array())
307 307
 	{
308 308
 		global $globalDBdriver, $globalLiveInterval;
@@ -330,11 +330,11 @@  discard block
 block discarded – undo
330 330
 	}
331 331
 
332 332
 	/**
333
-	* Gets all the spotter information based on a user's latitude and longitude
334
-	*
335
-	* @return Array the spotter information
336
-	*
337
-	*/
333
+	 * Gets all the spotter information based on a user's latitude and longitude
334
+	 *
335
+	 * @return Array the spotter information
336
+	 *
337
+	 */
338 338
 	public function getLatestMarineForLayar($lat, $lng, $radius, $interval)
339 339
 	{
340 340
 		$Marine = new Marine($this->db);
@@ -347,134 +347,134 @@  discard block
 block discarded – undo
347 347
 		if ($lng != '')
348 348
 		{
349 349
 			if (!is_numeric($lng))
350
-                        {
351
-                                return false;
352
-                        }
353
-                }
354
-
355
-                if ($radius != '')
356
-                {
357
-                        if (!is_numeric($radius))
358
-                        {
359
-                                return false;
360
-                        }
361
-                }
350
+						{
351
+								return false;
352
+						}
353
+				}
354
+
355
+				if ($radius != '')
356
+				{
357
+						if (!is_numeric($radius))
358
+						{
359
+								return false;
360
+						}
361
+				}
362 362
 		$additional_query = '';
363 363
 		if ($interval != '')
364
-                {
365
-                        if (!is_string($interval))
366
-                        {
367
-                                //$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= marine_live.date ';
368
-			        return false;
369
-                        } else {
370
-                if ($interval == '1m')
371
-                {
372
-                    $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= marine_live.date ';
373
-                } else if ($interval == '15m'){
374
-                    $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= marine_live.date ';
375
-                } 
376
-            }
377
-                } else {
378
-         $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= marine_live.date ';   
379
-        }
380
-
381
-                $query  = "SELECT marine_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM marine_live 
364
+				{
365
+						if (!is_string($interval))
366
+						{
367
+								//$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= marine_live.date ';
368
+					return false;
369
+						} else {
370
+				if ($interval == '1m')
371
+				{
372
+					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= marine_live.date ';
373
+				} else if ($interval == '15m'){
374
+					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= marine_live.date ';
375
+				} 
376
+			}
377
+				} else {
378
+		 $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= marine_live.date ';   
379
+		}
380
+
381
+				$query  = "SELECT marine_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM marine_live 
382 382
                    WHERE marine_live.latitude <> '' 
383 383
                                    AND marine_live.longitude <> '' 
384 384
                    ".$additional_query."
385 385
                    HAVING distance < :radius  
386 386
                                    ORDER BY distance";
387 387
 
388
-                $spotter_array = $Marine->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius));
388
+				$spotter_array = $Marine->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius));
389 389
 
390
-                return $spotter_array;
391
-        }
390
+				return $spotter_array;
391
+		}
392 392
 
393 393
     
394
-        /**
395
-	* Gets all the spotter information based on a particular callsign
396
-	*
397
-	* @return Array the spotter information
398
-	*
399
-	*/
394
+		/**
395
+		 * Gets all the spotter information based on a particular callsign
396
+		 *
397
+		 * @return Array the spotter information
398
+		 *
399
+		 */
400 400
 	public function getLastLiveMarineDataByIdent($ident)
401 401
 	{
402 402
 		$Marine = new Marine($this->db);
403 403
 		date_default_timezone_set('UTC');
404 404
 
405 405
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
406
-                $query  = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.ident = :ident GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC';
406
+				$query  = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.ident = :ident GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC';
407 407
 
408 408
 		$spotter_array = $Marine->getDataFromDB($query,array(':ident' => $ident),'',true);
409 409
 
410 410
 		return $spotter_array;
411 411
 	}
412 412
 
413
-        /**
414
-	* Gets all the spotter information based on a particular callsign
415
-	*
416
-	* @return Array the spotter information
417
-	*
418
-	*/
413
+		/**
414
+		 * Gets all the spotter information based on a particular callsign
415
+		 *
416
+		 * @return Array the spotter information
417
+		 *
418
+		 */
419 419
 	public function getDateLiveMarineDataByIdent($ident,$date)
420 420
 	{
421 421
 		$Marine = new Marine($this->db);
422 422
 		date_default_timezone_set('UTC');
423 423
 
424 424
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
425
-                $query  = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC';
425
+				$query  = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC';
426 426
 
427
-                $date = date('c',$date);
427
+				$date = date('c',$date);
428 428
 		$spotter_array = $Marine->getDataFromDB($query,array(':ident' => $ident,':date' => $date));
429 429
 
430 430
 		return $spotter_array;
431 431
 	}
432 432
 
433
-        /**
434
-	* Gets last spotter information based on a particular callsign
435
-	*
436
-	* @return Array the spotter information
437
-	*
438
-	*/
433
+		/**
434
+		 * Gets last spotter information based on a particular callsign
435
+		 *
436
+		 * @return Array the spotter information
437
+		 *
438
+		 */
439 439
 	public function getLastLiveMarineDataById($id)
440 440
 	{
441 441
 		$Marine = new Marine($this->db);
442 442
 		date_default_timezone_set('UTC');
443 443
 
444 444
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
445
-                $query  = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.fammarine_id = :id GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC';
445
+				$query  = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.fammarine_id = :id GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC';
446 446
 
447 447
 		$spotter_array = $Marine->getDataFromDB($query,array(':id' => $id),'',true);
448 448
 
449 449
 		return $spotter_array;
450 450
 	}
451 451
 
452
-        /**
453
-	* Gets last spotter information based on a particular callsign
454
-	*
455
-	* @return Array the spotter information
456
-	*
457
-	*/
452
+		/**
453
+		 * Gets last spotter information based on a particular callsign
454
+		 *
455
+		 * @return Array the spotter information
456
+		 *
457
+		 */
458 458
 	public function getDateLiveMarineDataById($id,$date)
459 459
 	{
460 460
 		$Marine = new Marine($this->db);
461 461
 		date_default_timezone_set('UTC');
462 462
 
463 463
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
464
-                $query  = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.fammarine_id = :id AND l.date <= :date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC';
465
-                $date = date('c',$date);
464
+				$query  = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.fammarine_id = :id AND l.date <= :date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC';
465
+				$date = date('c',$date);
466 466
 		$spotter_array = $Marine->getDataFromDB($query,array(':id' => $id,':date' => $date),'',true);
467 467
 
468 468
 		return $spotter_array;
469 469
 	}
470 470
 
471 471
 
472
-        /**
473
-	* Gets all the spotter information based on a particular id
474
-	*
475
-	* @return Array the spotter information
476
-	*
477
-	*/
472
+		/**
473
+		 * Gets all the spotter information based on a particular id
474
+		 *
475
+		 * @return Array the spotter information
476
+		 *
477
+		 */
478 478
 	public function getAllLiveMarineDataById($id,$liveinterval = false)
479 479
 	{
480 480
 		global $globalDBdriver, $globalLiveInterval;
@@ -502,18 +502,18 @@  discard block
 block discarded – undo
502 502
 		return $spotter_array;
503 503
 	}
504 504
 
505
-        /**
506
-	* Gets all the spotter information based on a particular ident
507
-	*
508
-	* @return Array the spotter information
509
-	*
510
-	*/
505
+		/**
506
+		 * Gets all the spotter information based on a particular ident
507
+		 *
508
+		 * @return Array the spotter information
509
+		 *
510
+		 */
511 511
 	public function getAllLiveMarineDataByIdent($ident)
512 512
 	{
513 513
 		date_default_timezone_set('UTC');
514 514
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
515 515
 		$query  = self::$global_query.' WHERE marine_live.ident = :ident';
516
-    		try {
516
+			try {
517 517
 			
518 518
 			$sth = $this->db->prepare($query);
519 519
 			$sth->execute(array(':ident' => $ident));
@@ -527,23 +527,23 @@  discard block
 block discarded – undo
527 527
 
528 528
 
529 529
 	/**
530
-	* Deletes all info in the table
531
-	*
532
-	* @return String success or false
533
-	*
534
-	*/
530
+	 * Deletes all info in the table
531
+	 *
532
+	 * @return String success or false
533
+	 *
534
+	 */
535 535
 	public function deleteLiveMarineData()
536 536
 	{
537 537
 		global $globalDBdriver;
538 538
 		if ($globalDBdriver == 'mysql') {
539 539
 			//$query  = "DELETE FROM marine_live WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE) >= marine_live.date";
540 540
 			$query  = 'DELETE FROM marine_live WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 9 HOUR) >= marine_live.date';
541
-            		//$query  = "DELETE FROM marine_live WHERE marine_live.id IN (SELECT marine_live.id FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) >= marine_live.date)";
541
+					//$query  = "DELETE FROM marine_live WHERE marine_live.id IN (SELECT marine_live.id FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) >= marine_live.date)";
542 542
 		} else {
543 543
 			$query  = "DELETE FROM marine_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' >= marine_live.date";
544 544
 		}
545 545
         
546
-    		try {
546
+			try {
547 547
 			
548 548
 			$sth = $this->db->prepare($query);
549 549
 			$sth->execute();
@@ -555,18 +555,18 @@  discard block
 block discarded – undo
555 555
 	}
556 556
 
557 557
 	/**
558
-	* Deletes all info in the table for aircraft not seen since 2 HOUR
559
-	*
560
-	* @return String success or false
561
-	*
562
-	*/
558
+	 * Deletes all info in the table for aircraft not seen since 2 HOUR
559
+	 *
560
+	 * @return String success or false
561
+	 *
562
+	 */
563 563
 	public function deleteLiveMarineDataNotUpdated()
564 564
 	{
565 565
 		global $globalDBdriver, $globalDebug;
566 566
 		if ($globalDBdriver == 'mysql') {
567 567
 			//$query = 'SELECT fammarine_id FROM marine_live WHERE DATE_SUB(UTC_TIMESTAMP(), INTERVAL 1 HOUR) >= marine_live.date AND marine_live.fammarine_id NOT IN (SELECT fammarine_id FROM marine_live WHERE DATE_SUB(UTC_TIMESTAMP(), INTERVAL 1 HOUR) < marine_live.date) LIMIT 800 OFFSET 0';
568
-    			$query = "SELECT marine_live.fammarine_id FROM marine_live INNER JOIN (SELECT fammarine_id,MAX(date) as max_date FROM marine_live GROUP BY fammarine_id) s ON s.fammarine_id = marine_live.fammarine_id AND DATE_SUB(UTC_TIMESTAMP(), INTERVAL 2 HOUR) >= s.max_date LIMIT 1200 OFFSET 0";
569
-    			try {
568
+				$query = "SELECT marine_live.fammarine_id FROM marine_live INNER JOIN (SELECT fammarine_id,MAX(date) as max_date FROM marine_live GROUP BY fammarine_id) s ON s.fammarine_id = marine_live.fammarine_id AND DATE_SUB(UTC_TIMESTAMP(), INTERVAL 2 HOUR) >= s.max_date LIMIT 1200 OFFSET 0";
569
+				try {
570 570
 				
571 571
 				$sth = $this->db->prepare($query);
572 572
 				$sth->execute();
@@ -574,8 +574,8 @@  discard block
 block discarded – undo
574 574
 				return "error";
575 575
 			}
576 576
 			$query_delete = 'DELETE FROM marine_live WHERE fammarine_id IN (';
577
-                        $i = 0;
578
-                        $j =0;
577
+						$i = 0;
578
+						$j =0;
579 579
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
580 580
 			foreach($all as $row)
581 581
 			{
@@ -583,20 +583,20 @@  discard block
 block discarded – undo
583 583
 				$j++;
584 584
 				if ($j == 30) {
585 585
 					if ($globalDebug) echo ".";
586
-				    	try {
586
+						try {
587 587
 						
588 588
 						$sth = $this->db->prepare(substr($query_delete,0,-1).")");
589 589
 						$sth->execute();
590 590
 					} catch(PDOException $e) {
591 591
 						return "error";
592 592
 					}
593
-                                	$query_delete = 'DELETE FROM marine_live WHERE fammarine_id IN (';
594
-                                	$j = 0;
593
+									$query_delete = 'DELETE FROM marine_live WHERE fammarine_id IN (';
594
+									$j = 0;
595 595
 				}
596 596
 				$query_delete .= "'".$row['fammarine_id']."',";
597 597
 			}
598 598
 			if ($i > 0) {
599
-    				try {
599
+					try {
600 600
 					
601 601
 					$sth = $this->db->prepare(substr($query_delete,0,-1).")");
602 602
 					$sth->execute();
@@ -607,9 +607,9 @@  discard block
 block discarded – undo
607 607
 			return "success";
608 608
 		} elseif ($globalDBdriver == 'pgsql') {
609 609
 			//$query = "SELECT fammarine_id FROM marine_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' >= marine_live.date AND marine_live.fammarine_id NOT IN (SELECT fammarine_id FROM marine_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' < marine_live.date) LIMIT 800 OFFSET 0";
610
-    			//$query = "SELECT marine_live.fammarine_id FROM marine_live INNER JOIN (SELECT fammarine_id,MAX(date) as max_date FROM marine_live GROUP BY fammarine_id) s ON s.fammarine_id = marine_live.fammarine_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0";
611
-    			$query = "DELETE FROM marine_live WHERE fammarine_id IN (SELECT marine_live.fammarine_id FROM marine_live INNER JOIN (SELECT fammarine_id,MAX(date) as max_date FROM marine_live GROUP BY fammarine_id) s ON s.fammarine_id = marine_live.fammarine_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0)";
612
-    			try {
610
+				//$query = "SELECT marine_live.fammarine_id FROM marine_live INNER JOIN (SELECT fammarine_id,MAX(date) as max_date FROM marine_live GROUP BY fammarine_id) s ON s.fammarine_id = marine_live.fammarine_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0";
611
+				$query = "DELETE FROM marine_live WHERE fammarine_id IN (SELECT marine_live.fammarine_id FROM marine_live INNER JOIN (SELECT fammarine_id,MAX(date) as max_date FROM marine_live GROUP BY fammarine_id) s ON s.fammarine_id = marine_live.fammarine_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0)";
612
+				try {
613 613
 				
614 614
 				$sth = $this->db->prepare($query);
615 615
 				$sth->execute();
@@ -653,17 +653,17 @@  discard block
 block discarded – undo
653 653
 	}
654 654
 
655 655
 	/**
656
-	* Deletes all info in the table for an ident
657
-	*
658
-	* @return String success or false
659
-	*
660
-	*/
656
+	 * Deletes all info in the table for an ident
657
+	 *
658
+	 * @return String success or false
659
+	 *
660
+	 */
661 661
 	public function deleteLiveMarineDataByIdent($ident)
662 662
 	{
663 663
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
664 664
 		$query  = 'DELETE FROM marine_live WHERE ident = :ident';
665 665
         
666
-    		try {
666
+			try {
667 667
 			
668 668
 			$sth = $this->db->prepare($query);
669 669
 			$sth->execute(array(':ident' => $ident));
@@ -675,17 +675,17 @@  discard block
 block discarded – undo
675 675
 	}
676 676
 
677 677
 	/**
678
-	* Deletes all info in the table for an id
679
-	*
680
-	* @return String success or false
681
-	*
682
-	*/
678
+	 * Deletes all info in the table for an id
679
+	 *
680
+	 * @return String success or false
681
+	 *
682
+	 */
683 683
 	public function deleteLiveMarineDataById($id)
684 684
 	{
685 685
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
686 686
 		$query  = 'DELETE FROM marine_live WHERE fammarine_id = :id';
687 687
         
688
-    		try {
688
+			try {
689 689
 			
690 690
 			$sth = $this->db->prepare($query);
691 691
 			$sth->execute(array(':id' => $id));
@@ -698,11 +698,11 @@  discard block
 block discarded – undo
698 698
 
699 699
 
700 700
 	/**
701
-	* Gets the aircraft ident within the last hour
702
-	*
703
-	* @return String the ident
704
-	*
705
-	*/
701
+	 * Gets the aircraft ident within the last hour
702
+	 *
703
+	 * @return String the ident
704
+	 *
705
+	 */
706 706
 	public function getIdentFromLastHour($ident)
707 707
 	{
708 708
 		global $globalDBdriver, $globalTimezone;
@@ -728,14 +728,14 @@  discard block
 block discarded – undo
728 728
 			$ident_result = $row['ident'];
729 729
 		}
730 730
 		return $ident_result;
731
-        }
731
+		}
732 732
 
733 733
 	/**
734
-	* Check recent aircraft
735
-	*
736
-	* @return String the ident
737
-	*
738
-	*/
734
+	 * Check recent aircraft
735
+	 *
736
+	 * @return String the ident
737
+	 *
738
+	 */
739 739
 	public function checkIdentRecent($ident)
740 740
 	{
741 741
 		global $globalDBdriver, $globalTimezone;
@@ -761,14 +761,14 @@  discard block
 block discarded – undo
761 761
 			$ident_result = $row['fammarine_id'];
762 762
 		}
763 763
 		return $ident_result;
764
-        }
764
+		}
765 765
 
766 766
 	/**
767
-	* Check recent aircraft by id
768
-	*
769
-	* @return String the ident
770
-	*
771
-	*/
767
+	 * Check recent aircraft by id
768
+	 *
769
+	 * @return String the ident
770
+	 *
771
+	 */
772 772
 	public function checkIdRecent($id)
773 773
 	{
774 774
 		global $globalDBdriver, $globalTimezone;
@@ -794,14 +794,14 @@  discard block
 block discarded – undo
794 794
 			$ident_result = $row['fammarine_id'];
795 795
 		}
796 796
 		return $ident_result;
797
-        }
797
+		}
798 798
 
799 799
 	/**
800
-	* Check recent aircraft by mmsi
801
-	*
802
-	* @return String the ident
803
-	*
804
-	*/
800
+	 * Check recent aircraft by mmsi
801
+	 *
802
+	 * @return String the ident
803
+	 *
804
+	 */
805 805
 	public function checkMMSIRecent($mmsi)
806 806
 	{
807 807
 		global $globalDBdriver, $globalTimezone;
@@ -827,19 +827,19 @@  discard block
 block discarded – undo
827 827
 			$ident_result = $row['fammarine_id'];
828 828
 		}
829 829
 		return $ident_result;
830
-        }
830
+		}
831 831
 
832 832
 	/**
833
-	* Adds a new spotter data
834
-	*
835
-	* @param String $fammarine_id the ID from flightaware
836
-	* @param String $ident the flight ident
837
-	* @param String $aircraft_icao the aircraft type
838
-	* @param String $departure_airport_icao the departure airport
839
-	* @param String $arrival_airport_icao the arrival airport
840
-	* @return String success or false
841
-	*
842
-	*/
833
+	 * Adds a new spotter data
834
+	 *
835
+	 * @param String $fammarine_id the ID from flightaware
836
+	 * @param String $ident the flight ident
837
+	 * @param String $aircraft_icao the aircraft type
838
+	 * @param String $departure_airport_icao the departure airport
839
+	 * @param String $arrival_airport_icao the arrival airport
840
+	 * @return String success or false
841
+	 *
842
+	 */
843 843
 	public function addLiveMarineData($fammarine_id = '', $ident = '', $latitude = '', $longitude = '', $heading = '', $groundspeed = '', $date = '', $putinarchive = false, $mmsi = '',$type = '',$typeid = '',$imo = '', $callsign = '',$arrival_code = '',$arrival_date = '',$status = '',$statusid = '',$noarchive = false,$format_source = '', $source_name = '', $over_country = '')
844 844
 	{
845 845
 		global $globalURL, $globalArchive, $globalDebug;
@@ -910,10 +910,10 @@  discard block
 block discarded – undo
910 910
 		$arrival_date = filter_var($arrival_date,FILTER_SANITIZE_STRING);
911 911
 		
912 912
 
913
-            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
914
-            	if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
915
-            	if ($arrival_date == '') $arrival_date = NULL;
916
-            	$query = '';
913
+				if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
914
+				if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
915
+				if ($arrival_date == '') $arrival_date = NULL;
916
+				$query = '';
917 917
 		if ($globalArchive) {
918 918
 			if ($globalDebug) echo '-- Delete previous data -- ';
919 919
 			$query .= 'DELETE FROM marine_live WHERE fammarine_id = :fammarine_id;';
Please login to merge, or discard this patch.
js/map-aircraft.3d.js.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -209,21 +209,21 @@  discard block
 block discarded – undo
209 209
 			var entityid = entity.id;
210 210
 			var lastupdateentity = entity.properties.valueOf('lastupdate')._lastupdate._value;
211 211
 			<?php 
212
-			    if (isset($globalMapUseBbox) && $globalMapUseBbox) {
212
+				if (isset($globalMapUseBbox) && $globalMapUseBbox) {
213 213
 			?>
214 214
 			if (lastupdateentity != lastupdate) {
215 215
 				viewer.dataSources.get(dsn).entities.remove(entity);
216 216
 				czmlds.entities.removeById(entityid);
217 217
 			}
218 218
 			<?php
219
-			    } else {
219
+				} else {
220 220
 			?>
221 221
 			if (parseInt(lastupdateentity) < Math.floor(Date.now()-<?php if (isset($globalMapRefresh)) print $globalMapRefresh*2000; else print '60000'; ?>)) {
222 222
 				viewer.dataSources.get(dsn).entities.remove(entity);
223 223
 				czmlds.entities.removeById(entityid);
224 224
 			}
225 225
 			<?php
226
-			    }
226
+				}
227 227
 			?>
228 228
 		}
229 229
 	}
@@ -629,12 +629,12 @@  discard block
 block discarded – undo
629 629
 	update_airportsLayer();
630 630
 }
631 631
 <?php
632
-    if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM)) {
632
+	if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM)) {
633 633
 ?>
634 634
 update_atcLayer();
635 635
 setInterval(function(){update_atcLayer()},<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000*2; else print '60000'; ?>);
636 636
 <?php
637
-    }
637
+	}
638 638
 ?>
639 639
 
640 640
 function iconColor(color) {
Please login to merge, or discard this patch.
js/map-marine.3d.js.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -38,20 +38,20 @@  discard block
 block discarded – undo
38 38
 			var entityid = entity.id;
39 39
 			var lastupdateentity = entity.properties.valueOf('lastupdate')._lastupdate._value;
40 40
 			<?php 
41
-			    if (isset($globalMapUseBbox) && $globalMapUseBbox) {
41
+				if (isset($globalMapUseBbox) && $globalMapUseBbox) {
42 42
 			?>
43 43
 			if (lastupdateentity != lastupdatemarine) {
44 44
 				viewer.dataSources.get(dsn).entities.remove(entity);
45 45
 				czmldsmarine.entities.removeById(entityid);
46 46
 			}
47 47
 			<?php
48
-			    } else {
48
+				} else {
49 49
 			?>
50 50
 			if (parseInt(lastupdateentity) < Math.floor(Date.now()-<?php if (isset($globalMapRefresh)) print $globalMapRefresh*2000; else print '60000'; ?>)) {
51 51
 				viewer.dataSources.get(dsn).entities.remove(entity);
52 52
 			}
53 53
 			<?php
54
-			    }
54
+				}
55 55
 			?>
56 56
 		}
57 57
 	}
@@ -73,15 +73,15 @@  discard block
 block discarded – undo
73 73
 function updateMarineData() {
74 74
 	lastupdatemarine = Date.now();
75 75
 <?php
76
-    if (isset($globalMapUseBbox) && $globalMapUseBbox) {
76
+	if (isset($globalMapUseBbox) && $globalMapUseBbox) {
77 77
 ?>
78 78
 	var livemarinedata = czmldsmarine.process('<?php print $globalURL; ?>/live-czml.php?marine&coord='+bbox()+'&update=' + lastupdatemarine);
79 79
 <?php
80
-    } else {
80
+	} else {
81 81
 ?>
82 82
 	var livemarinedata = czmldsmarine.process('<?php print $globalURL; ?>/live-czml.php?marine&update=' + lastupdatemarine);
83 83
 <?php
84
-    }
84
+	}
85 85
 ?>
86 86
 	livemarinedata.then(function (data) { 
87 87
 		displayMarineData(data);
Please login to merge, or discard this patch.
js/map-tracker.3d.js.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -81,21 +81,21 @@  discard block
 block discarded – undo
81 81
 			var entityid = entity.id;
82 82
 			var lastupdateentity = entity.properties.valueOf('lastupdate')._lastupdate._value;
83 83
 			<?php 
84
-			    if (isset($globalMapUseBbox) && $globalMapUseBbox) {
84
+				if (isset($globalMapUseBbox) && $globalMapUseBbox) {
85 85
 			?>
86 86
 			if (lastupdateentity != lastupdatetracker) {
87 87
 				viewer.dataSources.get(dsn).entities.remove(entity);
88 88
 				czmldstracker.entities.removeById(entityid);
89 89
 			}
90 90
 			<?php
91
-			    } else {
91
+				} else {
92 92
 			?>
93 93
 			if (parseInt(lastupdateentity) < Math.floor(Date.now()-<?php if (isset($globalMapRefresh)) print $globalMapRefresh*2000; else print '60000'; ?>)) {
94 94
 				viewer.dataSources.get(dsn).entities.remove(entity);
95 95
 				czmldstracker.entities.removeById(entityid);
96 96
 			}
97 97
 			<?php
98
-			    }
98
+				}
99 99
 			?>
100 100
 		}
101 101
 	}
@@ -116,15 +116,15 @@  discard block
 block discarded – undo
116 116
 function updateTrackerData() {
117 117
 	lastupdatetracker = Date.now();
118 118
 <?php
119
-    if (isset($globalMapUseBbox) && $globalMapUseBbox) {
119
+	if (isset($globalMapUseBbox) && $globalMapUseBbox) {
120 120
 ?>
121 121
 	var livetrackerdata = czmldstracker.process('<?php print $globalURL; ?>/live-czml.php?tracker&coord='+bbox()+'&update=' + lastupdatetracker);
122 122
 <?php
123
-    } else {
123
+	} else {
124 124
 ?>
125 125
 	var livetrackerdata = czmldstracker.process('<?php print $globalURL; ?>/live-czml.php?tracker&update=' + lastupdatetracker);
126 126
 <?php
127
-    }
127
+	}
128 128
 ?>  
129 129
 	livetrackerdata.then(function (data) { 
130 130
 		displayTrackerData(data);
Please login to merge, or discard this patch.