Completed
Push — master ( 39e860...0f5d36 )
by Yannick
05:38
created
airport-statistics-registration.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -4,8 +4,8 @@
 block discarded – undo
4 4
 require_once('require/class.Stats.php');
5 5
 require_once('require/class.Language.php');
6 6
 if (!isset($_GET['airport'])) {
7
-        header('Location: '.$globalURL.'/airport');
8
-        die();
7
+		header('Location: '.$globalURL.'/airport');
8
+		die();
9 9
 }
10 10
 $airport = filter_input(INPUT_GET,'airport',FILTER_SANITIZE_STRING);
11 11
 $Spotter = new Spotter();
Please login to merge, or discard this patch.
airline-statistics-route.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -4,8 +4,8 @@
 block discarded – undo
4 4
 require_once('require/class.Stats.php');
5 5
 require_once('require/class.Language.php');
6 6
 if (!isset($_GET['airline'])) {
7
-        header('Location: '.$globalURL.'/airline');
8
-        die();
7
+		header('Location: '.$globalURL.'/airline');
8
+		die();
9 9
 }
10 10
 $airline = filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING);
11 11
 $Spotter = new Spotter();
Please login to merge, or discard this patch.
manufacturer-statistics-departure-airport.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -4,8 +4,8 @@
 block discarded – undo
4 4
 require_once('require/class.Stats.php');
5 5
 require_once('require/class.Language.php');
6 6
 if (!isset($_GET['aircraft_manufacturer'])) {
7
-        header('Location: '.$globalURL.'/manufacturer');
8
-        die();
7
+		header('Location: '.$globalURL.'/manufacturer');
8
+		die();
9 9
 }
10 10
 $Spotter = new Spotter();
11 11
 $manufacturer = ucwords(str_replace("-", " ", filter_input(INPUT_GET,'aircraft_manufacturer',FILTER_SANITIZE_STRING)));
Please login to merge, or discard this patch.
manufacturer-statistics-airline-country.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -4,8 +4,8 @@
 block discarded – undo
4 4
 require_once('require/class.Stats.php');
5 5
 require_once('require/class.Language.php');
6 6
 if (!isset($_GET['aircraft_manufacturer'])) {
7
-        header('Location: '.$globalURL.'/manufacturer');
8
-        die();
7
+		header('Location: '.$globalURL.'/manufacturer');
8
+		die();
9 9
 }
10 10
 $Spotter = new Spotter();
11 11
 $manufacturer = ucwords(str_replace("-", " ", filter_input(INPUT_GET,'aircraft_manufacturer',FILTER_SANITIZE_STRING)));
Please login to merge, or discard this patch.
require/class.Accident.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -23,12 +23,12 @@
 block discarded – undo
23 23
 	}
24 24
 	
25 25
 	/**
26
-	* Get Accidents data from DB
27
-	* @param String $limit Limit
28
-	* @param String $type Set type accident or incident
29
-	* @param String $date get data for a date
30
-	* @return Array Return Accidents data in array
31
-	*/
26
+	 * Get Accidents data from DB
27
+	 * @param String $limit Limit
28
+	 * @param String $type Set type accident or incident
29
+	 * @param String $date get data for a date
30
+	 * @return Array Return Accidents data in array
31
+	 */
32 32
 	public function getAccidentData($limit = '',$type = '',$date = '') {
33 33
 		global $globalURL, $globalDBdriver;
34 34
 		$Image = new Image($this->db);
Please login to merge, or discard this patch.
table-output.php 1 patch
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -390,17 +390,17 @@  discard block
 block discarded – undo
390 390
 				else {
391 391
 					$planespotter_url_array = explode("_", $spotter_item['image']);
392 392
 					$planespotter_id = str_replace(".jpg", "", $planespotter_url_array[1]);
393
-                                        $image_src = 'https://www.planespotters.net/Aviation_Photos/photo.show?id='.$planespotter_id;
393
+										$image_src = 'https://www.planespotters.net/Aviation_Photos/photo.show?id='.$planespotter_id;
394 394
 				}
395 395
 				if (isset($spotter_item['airline_name'])) {
396 396
 					print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['airline_name'].'" alt="'.$spotter_item['registration'].' - '.$spotter_item['airline_name'].'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Airline:").' '.$spotter_item['airline_name'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">&copy; '.$spotter_item['image_copyright'].'</div>';
397 397
 				} else {
398 398
 					print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '._("Not available").'" alt="'.$spotter_item['registration'].' - '._("Not available").'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Airline:").' '._("Not available").'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">&copy; '.$spotter_item['image_copyright'].'</div>';
399 399
 				}
400
-                        } else {
401
-                    		if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') {
402
-                    		$image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']);
403
-                    		} else 	$image_thumbnail = $spotter_item['image_thumbnail'];
400
+						} else {
401
+							if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') {
402
+							$image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']);
403
+							} else 	$image_thumbnail = $spotter_item['image_thumbnail'];
404 404
 				if (isset($spotter_item['airline_name'])) {
405 405
 					print '<img src="'.$image_thumbnail.'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['airline_name'].'" alt="'.$spotter_item['registration'].' - '.$spotter_item['airline_name'].'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Airline:").' '.$spotter_item['airline_name'].'" data-html="true" width="100px" />'."\n".'<div class="thumbnail-copyright">&copy; '.$spotter_item['image_copyright'].'</div>';
406 406
 				} else {
@@ -415,7 +415,7 @@  discard block
 block discarded – undo
415 415
 		}
416 416
 	} elseif(strtolower($current_page) != "currently" && strtolower($current_page) != "upcoming" && strtolower($current_page) != "acars-latest" && strtolower($current_page) != "acars-archive" && strtolower($current_page) != "accident-latest" && strtolower($current_page) != "incident-latest" && strtolower($current_page) != "accident-detailed" && strtolower($current_page) != "incident-detailed"){
417 417
 		if (!isset($spotter_item['squawk']) || $spotter_item['squawk'] == 0) {
418
-		    $spotter_item['squawk'] = '-';
418
+			$spotter_item['squawk'] = '-';
419 419
 		}
420 420
 		if ($spotter_item['image_thumbnail'] != "")
421 421
 		{
@@ -426,7 +426,7 @@  discard block
 block discarded – undo
426 426
 				else {
427 427
 					$planespotter_url_array = explode("_", $spotter_array[0]['image']);
428 428
 					$planespotter_id = str_replace(".jpg", "", $planespotter_url_array[1]);
429
-                                        $image_src = 'https://www.planespotters.net/Aviation_Photos/photo.show?id='.$planespotter_id;
429
+										$image_src = 'https://www.planespotters.net/Aviation_Photos/photo.show?id='.$planespotter_id;
430 430
 				}
431 431
 				if (!isset($spotter_item['airline_name']) && isset($spotter_item['aircraft_name'])) {
432 432
 					print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '._("Not available").'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">&copy; '.$spotter_item['image_copyright'].'</div>';
@@ -438,9 +438,9 @@  discard block
 block discarded – undo
438 438
 					print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '.$spotter_item['airline_name'].'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '.$spotter_item['airline_name'].'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '.$spotter_item['airline_name'].'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">&copy; '.$spotter_item['image_copyright'].'</div>';
439 439
 				}
440 440
 			} else {
441
-                    		if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') {
442
-                    		$image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']);
443
-                    		} else 	$image_thumbnail = $spotter_item['image_thumbnail'];
441
+							if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') {
442
+							$image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']);
443
+							} else 	$image_thumbnail = $spotter_item['image_thumbnail'];
444 444
 				if (!isset($spotter_item['airline_name']) && isset($spotter_item['aircraft_name'])) {
445 445
 					print '<a href="'.$globalURL.'/flightid/'.$spotter_item['spotter_id'].'"><img src="'.$image_thumbnail.'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '._("Not available").'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">&copy; '.$spotter_item['image_copyright'].'</div>';
446 446
 				} elseif (!isset($spotter_item['aircraft_name']) && isset($spotter_item['airline_name'])) {
@@ -454,7 +454,7 @@  discard block
 block discarded – undo
454 454
 			print '</td>'."\n";
455 455
 		} else {
456 456
 			print '<td class="aircraft_thumbnail">'."\n";
457
-       //   	 	print '<a href="'.$globalURL.'/flightid/'.$spotter_item['spotter_id'].'"><img src="'.$globalURL.'/images/placeholder_thumb.png" alt="Click to see more information about this flight" title="Click to see more information about this flight" width="100px" /></a>';
457
+	   //   	 	print '<a href="'.$globalURL.'/flightid/'.$spotter_item['spotter_id'].'"><img src="'.$globalURL.'/images/placeholder_thumb.png" alt="Click to see more information about this flight" title="Click to see more information about this flight" width="100px" /></a>';
458 458
 	//}
459 459
 			if (!isset($spotter_item['airline_name']) && !isset($spotter_item['aircraft_name'])) {
460 460
 				print '<a href="'.$globalURL.'/flightid/'.$spotter_item['spotter_id'].'"><img src="'.$globalURL.'/images/placeholder_thumb.png" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' '._("Not available").' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '._("Not available").'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n";
@@ -559,13 +559,13 @@  discard block
 block discarded – undo
559 559
 				$distance = $Spotter->getAirportDistance($spotter_item['departure_airport'],$latitude,$longitude);
560 560
 			} else $distance = '';
561 561
 			if ($distance != '') {
562
-			    if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) {
563
-				    echo '<br/><i>'.round($distance*0.539957).' nm</i>';
564
-			    } elseif ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) {
565
-				    echo '<br/><i>'.round($distance*0.621371).' mi</i>';
566
-			    } elseif ((!isset($_COOKIE['unitdistance']) && ((isset($globalUnitDistance) && $globalUnitDistance == 'km') || !isset($globalUnitDistance))) || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'km')) {
567
-				    echo '<br/><i>'.$distance.' km</i>';
568
-			    }
562
+				if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) {
563
+					echo '<br/><i>'.round($distance*0.539957).' nm</i>';
564
+				} elseif ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) {
565
+					echo '<br/><i>'.round($distance*0.621371).' mi</i>';
566
+				} elseif ((!isset($_COOKIE['unitdistance']) && ((isset($globalUnitDistance) && $globalUnitDistance == 'km') || !isset($globalUnitDistance))) || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'km')) {
567
+					echo '<br/><i>'.$distance.' km</i>';
568
+				}
569 569
 			}
570 570
 		}
571 571
 		print '</td>'."\n";
Please login to merge, or discard this patch.
install/class.update_db.php 1 patch
Indentation   +432 added lines, -432 removed lines patch added patch discarded remove patch
@@ -75,38 +75,38 @@  discard block
 block discarded – undo
75 75
 		try {
76 76
 			//$Connection = new Connection();
77 77
 			$sth = $Connection->db->prepare($query);
78
-                        $sth->execute(array(':source' => $database_file));
79
-                } catch(PDOException $e) {
80
-                        return "error : ".$e->getMessage();
81
-                }
78
+						$sth->execute(array(':source' => $database_file));
79
+				} catch(PDOException $e) {
80
+						return "error : ".$e->getMessage();
81
+				}
82 82
 
83
-    		if ($globalDebug) echo " - Add routes to DB -";
84
-    		update_db::connect_sqlite($database_file);
83
+			if ($globalDebug) echo " - Add routes to DB -";
84
+			update_db::connect_sqlite($database_file);
85 85
 		//$query = 'select Route.RouteID, Route.callsign, operator.Icao AS operator_icao, FromAir.Icao AS FromAirportIcao, ToAir.Icao AS ToAirportIcao from Route inner join operator ON Route.operatorId = operator.operatorId LEFT JOIN Airport AS FromAir ON route.FromAirportId = FromAir.AirportId LEFT JOIN Airport AS ToAir ON ToAir.AirportID = route.ToAirportID';
86 86
 		$query = "select Route.RouteID, Route.callsign, operator.Icao AS operator_icao, FromAir.Icao AS FromAirportIcao, ToAir.Icao AS ToAirportIcao, rstp.allstop AS AllStop from Route inner join operator ON Route.operatorId = operator.operatorId LEFT JOIN Airport AS FromAir ON route.FromAirportId = FromAir.AirportId LEFT JOIN Airport AS ToAir ON ToAir.AirportID = route.ToAirportID LEFT JOIN (select RouteId,GROUP_CONCAT(icao,' ') as allstop from routestop left join Airport as air ON routestop.AirportId = air.AirportID group by RouteID) AS rstp ON Route.RouteID = rstp.RouteID";
87 87
 		try {
88
-                        $sth = update_db::$db_sqlite->prepare($query);
89
-                        $sth->execute();
90
-                } catch(PDOException $e) {
91
-                        return "error : ".$e->getMessage();
92
-                }
88
+						$sth = update_db::$db_sqlite->prepare($query);
89
+						$sth->execute();
90
+				} catch(PDOException $e) {
91
+						return "error : ".$e->getMessage();
92
+				}
93 93
 		//$query_dest = 'INSERT INTO routes (`RouteID`,`CallSign`,`Operator_ICAO`,`FromAirport_ICAO`,`ToAirport_ICAO`,`RouteStop`,`Source`) VALUES (:RouteID, :CallSign, :Operator_ICAO, :FromAirport_ICAO, :ToAirport_ICAO, :routestop, :source)';
94 94
 		$query_dest = 'INSERT INTO routes (CallSign,Operator_ICAO,FromAirport_ICAO,ToAirport_ICAO,RouteStop,Source) VALUES (:CallSign, :Operator_ICAO, :FromAirport_ICAO, :ToAirport_ICAO, :routestop, :source)';
95 95
 		$Connection = new Connection();
96 96
 		$sth_dest = $Connection->db->prepare($query_dest);
97 97
 		try {
98 98
 			if ($globalTransaction) $Connection->db->beginTransaction();
99
-            		while ($values = $sth->fetch(PDO::FETCH_ASSOC)) {
99
+					while ($values = $sth->fetch(PDO::FETCH_ASSOC)) {
100 100
 				//$query_dest_values = array(':RouteID' => $values['RouteId'],':CallSign' => $values['Callsign'],':Operator_ICAO' => $values['operator_icao'],':FromAirport_ICAO' => $values['FromAirportIcao'],':ToAirport_ICAO' => $values['ToAirportIcao'],':routestop' => $values['AllStop'],':source' => $database_file);
101 101
 				$query_dest_values = array(':CallSign' => $values['Callsign'],':Operator_ICAO' => $values['operator_icao'],':FromAirport_ICAO' => $values['FromAirportIcao'],':ToAirport_ICAO' => $values['ToAirportIcao'],':routestop' => $values['AllStop'],':source' => $database_file);
102 102
 				$sth_dest->execute($query_dest_values);
103
-            		}
103
+					}
104 104
 			if ($globalTransaction) $Connection->db->commit();
105 105
 		} catch(PDOException $e) {
106 106
 			if ($globalTransaction) $Connection->db->rollBack(); 
107 107
 			return "error : ".$e->getMessage();
108 108
 		}
109
-                return '';
109
+				return '';
110 110
 	}
111 111
 	public static function retrieve_route_oneworld($database_file) {
112 112
 		global $globalDebug, $globalTransaction;
@@ -117,12 +117,12 @@  discard block
 block discarded – undo
117 117
 		try {
118 118
 			//$Connection = new Connection();
119 119
 			$sth = $Connection->db->prepare($query);
120
-                        $sth->execute(array(':source' => 'oneworld'));
121
-                } catch(PDOException $e) {
122
-                        return "error : ".$e->getMessage();
123
-                }
120
+						$sth->execute(array(':source' => 'oneworld'));
121
+				} catch(PDOException $e) {
122
+						return "error : ".$e->getMessage();
123
+				}
124 124
 
125
-    		if ($globalDebug) echo " - Add routes to DB -";
125
+			if ($globalDebug) echo " - Add routes to DB -";
126 126
 		require_once(dirname(__FILE__).'/../require/class.Spotter.php');
127 127
 		$Spotter = new Spotter();
128 128
 		if ($fh = fopen($database_file,"r")) {
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 			}
147 147
 			if ($globalTransaction) $Connection->db->commit();
148 148
 		}
149
-                return '';
149
+				return '';
150 150
 	}
151 151
 	
152 152
 	public static function retrieve_route_skyteam($database_file) {
@@ -158,12 +158,12 @@  discard block
 block discarded – undo
158 158
 		try {
159 159
 			//$Connection = new Connection();
160 160
 			$sth = $Connection->db->prepare($query);
161
-                        $sth->execute(array(':source' => 'skyteam'));
162
-                } catch(PDOException $e) {
163
-                        return "error : ".$e->getMessage();
164
-                }
161
+						$sth->execute(array(':source' => 'skyteam'));
162
+				} catch(PDOException $e) {
163
+						return "error : ".$e->getMessage();
164
+				}
165 165
 
166
-    		if ($globalDebug) echo " - Add routes to DB -";
166
+			if ($globalDebug) echo " - Add routes to DB -";
167 167
 
168 168
 		require_once(dirname(__FILE__).'/../require/class.Spotter.php');
169 169
 		$Spotter = new Spotter();
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
 				return "error : ".$e->getMessage();
190 190
 			}
191 191
 		}
192
-                return '';
192
+				return '';
193 193
 	}
194 194
 	public static function retrieve_modes_sqlite_to_dest($database_file) {
195 195
 		global $globalTransaction;
@@ -198,27 +198,27 @@  discard block
 block discarded – undo
198 198
 		try {
199 199
 			$Connection = new Connection();
200 200
 			$sth = $Connection->db->prepare($query);
201
-                        $sth->execute(array(':source' => $database_file));
202
-                } catch(PDOException $e) {
203
-                        return "error : ".$e->getMessage();
204
-                }
201
+						$sth->execute(array(':source' => $database_file));
202
+				} catch(PDOException $e) {
203
+						return "error : ".$e->getMessage();
204
+				}
205 205
 		$query = "DELETE FROM aircraft_owner WHERE Source = '' OR Source IS NULL OR Source = :source";
206 206
 		try {
207 207
 			$Connection = new Connection();
208 208
 			$sth = $Connection->db->prepare($query);
209
-                        $sth->execute(array(':source' => $database_file));
210
-                } catch(PDOException $e) {
211
-                        return "error : ".$e->getMessage();
212
-                }
209
+						$sth->execute(array(':source' => $database_file));
210
+				} catch(PDOException $e) {
211
+						return "error : ".$e->getMessage();
212
+				}
213 213
 
214
-    		update_db::connect_sqlite($database_file);
214
+			update_db::connect_sqlite($database_file);
215 215
 		$query = 'select * from Aircraft';
216 216
 		try {
217
-                        $sth = update_db::$db_sqlite->prepare($query);
218
-                        $sth->execute();
219
-                } catch(PDOException $e) {
220
-                        return "error : ".$e->getMessage();
221
-                }
217
+						$sth = update_db::$db_sqlite->prepare($query);
218
+						$sth->execute();
219
+				} catch(PDOException $e) {
220
+						return "error : ".$e->getMessage();
221
+				}
222 222
 		//$query_dest = 'INSERT INTO aircraft_modes (`AircraftID`,`FirstCreated`,`LastModified`, `ModeS`,`ModeSCountry`,`Registration`,`ICAOTypeCode`,`SerialNo`, `OperatorFlagCode`, `Manufacturer`, `Type`, `FirstRegDate`, `CurrentRegDate`, `Country`, `PreviousID`, `DeRegDate`, `Status`, `PopularName`,`GenericName`,`AircraftClass`, `Engines`, `OwnershipStatus`,`RegisteredOwners`,`MTOW`, `TotalHours`, `YearBuilt`, `CofACategory`, `CofAExpiry`, `UserNotes`, `Interested`, `UserTag`, `InfoUrl`, `PictureUrl1`, `PictureUrl2`, `PictureUrl3`, `UserBool1`, `UserBool2`, `UserBool3`, `UserBool4`, `UserBool5`, `UserString1`, `UserString2`, `UserString3`, `UserString4`, `UserString5`, `UserInt1`, `UserInt2`, `UserInt3`, `UserInt4`, `UserInt5`) VALUES (:AircraftID,:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:SerialNo, :OperatorFlagCode, :Manufacturer, :Type, :FirstRegDate, :CurrentRegDate, :Country, :PreviousID, :DeRegDate, :Status, :PopularName,:GenericName,:AircraftClass, :Engines, :OwnershipStatus,:RegisteredOwners,:MTOW, :TotalHours,:YearBuilt, :CofACategory, :CofAExpiry, :UserNotes, :Interested, :UserTag, :InfoUrl, :PictureUrl1, :PictureUrl2, :PictureUrl3, :UserBool1, :UserBool2, :UserBool3, :UserBool4, :UserBool5, :UserString1, :UserString2, :UserString3, :UserString4, :UserString5, :UserInt1, :UserInt2, :UserInt3, :UserInt4, :UserInt5)';
223 223
 		$query_dest = 'INSERT INTO aircraft_modes (LastModified, ModeS,ModeSCountry,Registration,ICAOTypeCode,type_flight,Source) VALUES (:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:type,:source)';
224 224
 		
@@ -229,17 +229,17 @@  discard block
 block discarded – undo
229 229
 		$sth_dest_owner = $Connection->db->prepare($query_dest_owner);
230 230
 		try {
231 231
 			if ($globalTransaction) $Connection->db->beginTransaction();
232
-            		while ($values = $sth->fetch(PDO::FETCH_ASSOC)) {
232
+					while ($values = $sth->fetch(PDO::FETCH_ASSOC)) {
233 233
 			//$query_dest_values = array(':AircraftID' => $values['AircraftID'],':FirstCreated' => $values['FirstCreated'],':LastModified' => $values['LastModified'],':ModeS' => $values['ModeS'],':ModeSCountry' => $values['ModeSCountry'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':SerialNo' => $values['SerialNo'], ':OperatorFlagCode' => $values['OperatorFlagCode'], ':Manufacturer' => $values['Manufacturer'], ':Type' => $values['Type'], ':FirstRegDate' => $values['FirstRegDate'], ':CurrentRegDate' => $values['CurrentRegDate'], ':Country' => $values['Country'], ':PreviousID' => $values['PreviousID'], ':DeRegDate' => $values['DeRegDate'], ':Status' => $values['Status'], ':PopularName' => $values['PopularName'],':GenericName' => $values['GenericName'],':AircraftClass' => $values['AircraftClass'], ':Engines' => $values['Engines'], ':OwnershipStatus' => $values['OwnershipStatus'],':RegisteredOwners' => $values['RegisteredOwners'],':MTOW' => $values['MTOW'], ':TotalHours' => $values['TotalHours'],':YearBuilt' => $values['YearBuilt'], ':CofACategory' => $values['CofACategory'], ':CofAExpiry' => $values['CofAExpiry'], ':UserNotes' => $values['UserNotes'], ':Interested' => $values['Interested'], ':UserTag' => $values['UserTag'], ':InfoUrl' => $values['InfoURL'], ':PictureUrl1' => $values['PictureURL1'], ':PictureUrl2' => $values['PictureURL2'], ':PictureUrl3' => $values['PictureURL3'], ':UserBool1' => $values['UserBool1'], ':UserBool2' => $values['UserBool2'], ':UserBool3' => $values['UserBool3'], ':UserBool4' => $values['UserBool4'], ':UserBool5' => $values['UserBool5'], ':UserString1' => $values['UserString1'], ':UserString2' => $values['UserString2'], ':UserString3' => $values['UserString3'], ':UserString4' => $values['UserString4'], ':UserString5' => $values['UserString5'], ':UserInt1' => $values['UserInt1'], ':UserInt2' => $values['UserInt2'], ':UserInt3' => $values['UserInt3'], ':UserInt4' => $values['UserInt4'], ':UserInt5' => $values['UserInt5']);
234 234
 				if ($values['UserString4'] == 'M') $type = 'military';
235 235
 				else $type = null;
236 236
 				$query_dest_values = array(':LastModified' => $values['LastModified'],':ModeS' => $values['ModeS'],':ModeSCountry' => $values['ModeSCountry'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':source' => $database_file,':type' => $type);
237 237
 				$sth_dest->execute($query_dest_values);
238 238
 				if ($values['RegisteredOwners'] != '' && $values['RegisteredOwners'] != NULL && $values['RegisteredOwners'] != 'Private') {
239
-				    $query_dest_owner_values = array(':registration' => $values['Registration'],':source' => $database_file,':owner' => $values['RegisteredOwners']);
240
-				    $sth_dest_owner->execute($query_dest_owner_values);
239
+					$query_dest_owner_values = array(':registration' => $values['Registration'],':source' => $database_file,':owner' => $values['RegisteredOwners']);
240
+					$sth_dest_owner->execute($query_dest_owner_values);
241 241
 				}
242
-            		}
242
+					}
243 243
 			if ($globalTransaction) $Connection->db->commit();
244 244
 		} catch(PDOException $e) {
245 245
 			return "error : ".$e->getMessage();
@@ -250,10 +250,10 @@  discard block
 block discarded – undo
250 250
 		try {
251 251
 			$Connection = new Connection();
252 252
 			$sth = $Connection->db->prepare($query);
253
-                        $sth->execute(array(':source' => $database_file));
254
-                } catch(PDOException $e) {
255
-                        return "error : ".$e->getMessage();
256
-                }
253
+						$sth->execute(array(':source' => $database_file));
254
+				} catch(PDOException $e) {
255
+						return "error : ".$e->getMessage();
256
+				}
257 257
 		return '';
258 258
 	}
259 259
 
@@ -265,10 +265,10 @@  discard block
 block discarded – undo
265 265
 		try {
266 266
 			$Connection = new Connection();
267 267
 			$sth = $Connection->db->prepare($query);
268
-                        $sth->execute(array(':source' => $database_file));
269
-                } catch(PDOException $e) {
270
-                        return "error : ".$e->getMessage();
271
-                }
268
+						$sth->execute(array(':source' => $database_file));
269
+				} catch(PDOException $e) {
270
+						return "error : ".$e->getMessage();
271
+				}
272 272
 		
273 273
 		if ($fh = fopen($database_file,"r")) {
274 274
 			//$query_dest = 'INSERT INTO aircraft_modes (`AircraftID`,`FirstCreated`,`LastModified`, `ModeS`,`ModeSCountry`,`Registration`,`ICAOTypeCode`,`SerialNo`, `OperatorFlagCode`, `Manufacturer`, `Type`, `FirstRegDate`, `CurrentRegDate`, `Country`, `PreviousID`, `DeRegDate`, `Status`, `PopularName`,`GenericName`,`AircraftClass`, `Engines`, `OwnershipStatus`,`RegisteredOwners`,`MTOW`, `TotalHours`, `YearBuilt`, `CofACategory`, `CofAExpiry`, `UserNotes`, `Interested`, `UserTag`, `InfoUrl`, `PictureUrl1`, `PictureUrl2`, `PictureUrl3`, `UserBool1`, `UserBool2`, `UserBool3`, `UserBool4`, `UserBool5`, `UserString1`, `UserString2`, `UserString3`, `UserString4`, `UserString5`, `UserInt1`, `UserInt2`, `UserInt3`, `UserInt4`, `UserInt5`) VALUES (:AircraftID,:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:SerialNo, :OperatorFlagCode, :Manufacturer, :Type, :FirstRegDate, :CurrentRegDate, :Country, :PreviousID, :DeRegDate, :Status, :PopularName,:GenericName,:AircraftClass, :Engines, :OwnershipStatus,:RegisteredOwners,:MTOW, :TotalHours,:YearBuilt, :CofACategory, :CofAExpiry, :UserNotes, :Interested, :UserTag, :InfoUrl, :PictureUrl1, :PictureUrl2, :PictureUrl3, :UserBool1, :UserBool2, :UserBool3, :UserBool4, :UserBool5, :UserString1, :UserString2, :UserString3, :UserString4, :UserString5, :UserInt1, :UserInt2, :UserInt3, :UserInt4, :UserInt5)';
@@ -278,26 +278,26 @@  discard block
 block discarded – undo
278 278
 			$sth_dest = $Connection->db->prepare($query_dest);
279 279
 			try {
280 280
 				if ($globalTransaction) $Connection->db->beginTransaction();
281
-            			while (!feof($fh)) {
282
-            				$values = array();
283
-            				$line = $Common->hex2str(fgets($fh,9999));
281
+						while (!feof($fh)) {
282
+							$values = array();
283
+							$line = $Common->hex2str(fgets($fh,9999));
284 284
 					//FFFFFF                     RIDEAU VALLEY SOARINGASW-20               C-FBKN MZ 123.400
285
-            				$values['ModeS'] = substr($line,0,6);
286
-            				$values['Registration'] = trim(substr($line,69,6));
287
-            				$aircraft_name = trim(substr($line,48,6));
288
-            				// Check if we can find ICAO, else set it to GLID
289
-            				$aircraft_name_split = explode(' ',$aircraft_name);
290
-            				$search_more = '';
291
-            				if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'";
292
-            				$query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more;
293
-            				$sth_search = $Connection->db->prepare($query_search);
285
+							$values['ModeS'] = substr($line,0,6);
286
+							$values['Registration'] = trim(substr($line,69,6));
287
+							$aircraft_name = trim(substr($line,48,6));
288
+							// Check if we can find ICAO, else set it to GLID
289
+							$aircraft_name_split = explode(' ',$aircraft_name);
290
+							$search_more = '';
291
+							if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'";
292
+							$query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more;
293
+							$sth_search = $Connection->db->prepare($query_search);
294 294
 					try {
295
-                                    		$sth_search->execute();
296
-	            				$result = $sth_search->fetch(PDO::FETCH_ASSOC);
297
-	            				//if (count($result) > 0) {
298
-	            				if (isset($result['icao']) && $result['icao'] != '') {
299
-	            				    $values['ICAOTypeCode'] = $result['icao'];
300
-	            				} 
295
+											$sth_search->execute();
296
+								$result = $sth_search->fetch(PDO::FETCH_ASSOC);
297
+								//if (count($result) > 0) {
298
+								if (isset($result['icao']) && $result['icao'] != '') {
299
+									$values['ICAOTypeCode'] = $result['icao'];
300
+								} 
301 301
 					} catch(PDOException $e) {
302 302
 						return "error : ".$e->getMessage();
303 303
 					}
@@ -320,10 +320,10 @@  discard block
 block discarded – undo
320 320
 		try {
321 321
 			$Connection = new Connection();
322 322
 			$sth = $Connection->db->prepare($query);
323
-                        $sth->execute(array(':source' => $database_file));
324
-                } catch(PDOException $e) {
325
-                        return "error : ".$e->getMessage();
326
-                }
323
+						$sth->execute(array(':source' => $database_file));
324
+				} catch(PDOException $e) {
325
+						return "error : ".$e->getMessage();
326
+				}
327 327
 		return '';
328 328
 	}
329 329
 
@@ -334,10 +334,10 @@  discard block
 block discarded – undo
334 334
 		try {
335 335
 			$Connection = new Connection();
336 336
 			$sth = $Connection->db->prepare($query);
337
-                        $sth->execute(array(':source' => $database_file));
338
-                } catch(PDOException $e) {
339
-                        return "error : ".$e->getMessage();
340
-                }
337
+						$sth->execute(array(':source' => $database_file));
338
+				} catch(PDOException $e) {
339
+						return "error : ".$e->getMessage();
340
+				}
341 341
 		
342 342
 		if ($fh = fopen($database_file,"r")) {
343 343
 			//$query_dest = 'INSERT INTO aircraft_modes (`AircraftID`,`FirstCreated`,`LastModified`, `ModeS`,`ModeSCountry`,`Registration`,`ICAOTypeCode`,`SerialNo`, `OperatorFlagCode`, `Manufacturer`, `Type`, `FirstRegDate`, `CurrentRegDate`, `Country`, `PreviousID`, `DeRegDate`, `Status`, `PopularName`,`GenericName`,`AircraftClass`, `Engines`, `OwnershipStatus`,`RegisteredOwners`,`MTOW`, `TotalHours`, `YearBuilt`, `CofACategory`, `CofAExpiry`, `UserNotes`, `Interested`, `UserTag`, `InfoUrl`, `PictureUrl1`, `PictureUrl2`, `PictureUrl3`, `UserBool1`, `UserBool2`, `UserBool3`, `UserBool4`, `UserBool5`, `UserString1`, `UserString2`, `UserString3`, `UserString4`, `UserString5`, `UserInt1`, `UserInt2`, `UserInt3`, `UserInt4`, `UserInt5`) VALUES (:AircraftID,:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:SerialNo, :OperatorFlagCode, :Manufacturer, :Type, :FirstRegDate, :CurrentRegDate, :Country, :PreviousID, :DeRegDate, :Status, :PopularName,:GenericName,:AircraftClass, :Engines, :OwnershipStatus,:RegisteredOwners,:MTOW, :TotalHours,:YearBuilt, :CofACategory, :CofAExpiry, :UserNotes, :Interested, :UserTag, :InfoUrl, :PictureUrl1, :PictureUrl2, :PictureUrl3, :UserBool1, :UserBool2, :UserBool3, :UserBool4, :UserBool5, :UserString1, :UserString2, :UserString3, :UserString4, :UserString5, :UserInt1, :UserInt2, :UserInt3, :UserInt4, :UserInt5)';
@@ -348,24 +348,24 @@  discard block
 block discarded – undo
348 348
 			try {
349 349
 				if ($globalTransaction) $Connection->db->beginTransaction();
350 350
 				$tmp = fgetcsv($fh,9999,',',"'");
351
-            			while (!feof($fh)) {
352
-            				$line = fgetcsv($fh,9999,',',"'");
351
+						while (!feof($fh)) {
352
+							$line = fgetcsv($fh,9999,',',"'");
353 353
             				
354 354
 					//FFFFFF                     RIDEAU VALLEY SOARINGASW-20               C-FBKN MZ 123.400
355 355
 					//print_r($line);
356
-            				$values['ModeS'] = $line[1];
357
-            				$values['Registration'] = $line[3];
358
-            				$aircraft_name = $line[2];
359
-            				// Check if we can find ICAO, else set it to GLID
360
-            				$aircraft_name_split = explode(' ',$aircraft_name);
361
-            				$search_more = '';
362
-            				if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'";
363
-            				$query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more;
364
-            				$sth_search = $Connection->db->prepare($query_search);
356
+							$values['ModeS'] = $line[1];
357
+							$values['Registration'] = $line[3];
358
+							$aircraft_name = $line[2];
359
+							// Check if we can find ICAO, else set it to GLID
360
+							$aircraft_name_split = explode(' ',$aircraft_name);
361
+							$search_more = '';
362
+							if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'";
363
+							$query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more;
364
+							$sth_search = $Connection->db->prepare($query_search);
365 365
 					try {
366
-                                    		$sth_search->execute();
367
-	            				$result = $sth_search->fetch(PDO::FETCH_ASSOC);
368
-	            				if (isset($result['icao']) && $result['icao'] != '') $values['ICAOTypeCode'] = $result['icao'];
366
+											$sth_search->execute();
367
+								$result = $sth_search->fetch(PDO::FETCH_ASSOC);
368
+								if (isset($result['icao']) && $result['icao'] != '') $values['ICAOTypeCode'] = $result['icao'];
369 369
 					} catch(PDOException $e) {
370 370
 						return "error : ".$e->getMessage();
371 371
 					}
@@ -388,10 +388,10 @@  discard block
 block discarded – undo
388 388
 		try {
389 389
 			$Connection = new Connection();
390 390
 			$sth = $Connection->db->prepare($query);
391
-                        $sth->execute(array(':source' => $database_file));
392
-                } catch(PDOException $e) {
393
-                        return "error : ".$e->getMessage();
394
-                }
391
+						$sth->execute(array(':source' => $database_file));
392
+				} catch(PDOException $e) {
393
+						return "error : ".$e->getMessage();
394
+				}
395 395
 		return '';
396 396
 	}
397 397
 
@@ -402,16 +402,16 @@  discard block
 block discarded – undo
402 402
 		try {
403 403
 			$Connection = new Connection();
404 404
 			$sth = $Connection->db->prepare($query);
405
-                        $sth->execute(array(':source' => $database_file));
406
-                } catch(PDOException $e) {
407
-                        return "error : ".$e->getMessage();
408
-                }
405
+						$sth->execute(array(':source' => $database_file));
406
+				} catch(PDOException $e) {
407
+						return "error : ".$e->getMessage();
408
+				}
409 409
 		require_once(dirname(__FILE__).'/../require/class.Spotter.php');
410 410
 		$Spotter = new Spotter();
411 411
 		if ($fh = fopen($database_file,"r")) {
412 412
 			//$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)';
413 413
 			$query_dest = 'INSERT INTO aircraft_owner (registration,base,owner,date_first_reg,Source) VALUES (:registration,:base,:owner,:date_first_reg,:source)';
414
-		        $query_modes = 'INSERT INTO aircraft_modes (ModeS,ModeSCountry,Registration,ICAOTypeCode,Source) VALUES (:modes,:modescountry,:registration,:icaotypecode,:source)';
414
+				$query_modes = 'INSERT INTO aircraft_modes (ModeS,ModeSCountry,Registration,ICAOTypeCode,Source) VALUES (:modes,:modescountry,:registration,:icaotypecode,:source)';
415 415
 		        
416 416
 			$Connection = new Connection();
417 417
 			$sth_dest = $Connection->db->prepare($query_dest);
@@ -419,126 +419,126 @@  discard block
 block discarded – undo
419 419
 			try {
420 420
 				if ($globalTransaction) $Connection->db->beginTransaction();
421 421
 				$tmp = fgetcsv($fh,9999,',','"');
422
-            			while (!feof($fh)) {
423
-            				$line = fgetcsv($fh,9999,',','"');
424
-            				$values = array();
425
-            				//print_r($line);
426
-            				if ($country == 'F') {
427
-            				    $values['registration'] = $line[0];
428
-            				    $values['base'] = $line[4];
429
-            				    $values['owner'] = $line[5];
430
-            				    if ($line[6] == '') $values['date_first_reg'] = null;
431
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6]));
432
-					    $values['cancel'] = $line[7];
422
+						while (!feof($fh)) {
423
+							$line = fgetcsv($fh,9999,',','"');
424
+							$values = array();
425
+							//print_r($line);
426
+							if ($country == 'F') {
427
+								$values['registration'] = $line[0];
428
+								$values['base'] = $line[4];
429
+								$values['owner'] = $line[5];
430
+								if ($line[6] == '') $values['date_first_reg'] = null;
431
+						else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6]));
432
+						$values['cancel'] = $line[7];
433 433
 					} elseif ($country == 'EI') {
434
-					    // TODO : add modeS & reg to aircraft_modes
435
-            				    $values['registration'] = $line[0];
436
-            				    $values['base'] = $line[3];
437
-            				    $values['owner'] = $line[2];
438
-            				    if ($line[1] == '') $values['date_first_reg'] = null;
439
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[1]));
440
-					    $values['cancel'] = '';
441
-					    $values['modes'] = $line[7];
442
-					    $values['icao'] = $line[8];
434
+						// TODO : add modeS & reg to aircraft_modes
435
+								$values['registration'] = $line[0];
436
+								$values['base'] = $line[3];
437
+								$values['owner'] = $line[2];
438
+								if ($line[1] == '') $values['date_first_reg'] = null;
439
+						else $values['date_first_reg'] = date("Y-m-d",strtotime($line[1]));
440
+						$values['cancel'] = '';
441
+						$values['modes'] = $line[7];
442
+						$values['icao'] = $line[8];
443 443
 					    
444 444
 					} elseif ($country == 'HB') {
445
-					    // TODO : add modeS & reg to aircraft_modes
446
-            				    $values['registration'] = $line[0];
447
-            				    $values['base'] = null;
448
-            				    $values['owner'] = $line[5];
449
-            				    $values['date_first_reg'] = null;
450
-					    $values['cancel'] = '';
451
-					    $values['modes'] = $line[4];
452
-					    $values['icao'] = $line[7];
445
+						// TODO : add modeS & reg to aircraft_modes
446
+								$values['registration'] = $line[0];
447
+								$values['base'] = null;
448
+								$values['owner'] = $line[5];
449
+								$values['date_first_reg'] = null;
450
+						$values['cancel'] = '';
451
+						$values['modes'] = $line[4];
452
+						$values['icao'] = $line[7];
453 453
 					} elseif ($country == 'OK') {
454
-					    // TODO : add modeS & reg to aircraft_modes
455
-            				    $values['registration'] = $line[3];
456
-            				    $values['base'] = null;
457
-            				    $values['owner'] = $line[5];
458
-            				    if ($line[18] == '') $values['date_first_reg'] = null;
459
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[18]));
460
-					    $values['cancel'] = '';
454
+						// TODO : add modeS & reg to aircraft_modes
455
+								$values['registration'] = $line[3];
456
+								$values['base'] = null;
457
+								$values['owner'] = $line[5];
458
+								if ($line[18] == '') $values['date_first_reg'] = null;
459
+						else $values['date_first_reg'] = date("Y-m-d",strtotime($line[18]));
460
+						$values['cancel'] = '';
461 461
 					} elseif ($country == 'VH') {
462
-					    // TODO : add modeS & reg to aircraft_modes
463
-            				    $values['registration'] = $line[0];
464
-            				    $values['base'] = null;
465
-            				    $values['owner'] = $line[12];
466
-            				    if ($line[28] == '') $values['date_first_reg'] = null;
467
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[28]));
468
-
469
-					    $values['cancel'] = $line[39];
462
+						// TODO : add modeS & reg to aircraft_modes
463
+								$values['registration'] = $line[0];
464
+								$values['base'] = null;
465
+								$values['owner'] = $line[12];
466
+								if ($line[28] == '') $values['date_first_reg'] = null;
467
+						else $values['date_first_reg'] = date("Y-m-d",strtotime($line[28]));
468
+
469
+						$values['cancel'] = $line[39];
470 470
 					} elseif ($country == 'OE' || $country == '9A' || $country == 'VP' || $country == 'LX' || $country == 'P2' || $country == 'HC') {
471
-            				    $values['registration'] = $line[0];
472
-            				    $values['base'] = null;
473
-            				    $values['owner'] = $line[4];
474
-            				    $values['date_first_reg'] = null;
475
-					    $values['cancel'] = '';
471
+								$values['registration'] = $line[0];
472
+								$values['base'] = null;
473
+								$values['owner'] = $line[4];
474
+								$values['date_first_reg'] = null;
475
+						$values['cancel'] = '';
476 476
 					} elseif ($country == 'CC') {
477
-            				    $values['registration'] = $line[0];
478
-            				    $values['base'] = null;
479
-            				    $values['owner'] = $line[6];
480
-            				    $values['date_first_reg'] = null;
481
-					    $values['cancel'] = '';
477
+								$values['registration'] = $line[0];
478
+								$values['base'] = null;
479
+								$values['owner'] = $line[6];
480
+								$values['date_first_reg'] = null;
481
+						$values['cancel'] = '';
482 482
 					} elseif ($country == 'HJ') {
483
-            				    $values['registration'] = $line[0];
484
-            				    $values['base'] = null;
485
-            				    $values['owner'] = $line[8];
486
-            				    if ($line[7] == '') $values['date_first_reg'] = null;
487
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7]));
488
-					    $values['cancel'] = '';
483
+								$values['registration'] = $line[0];
484
+								$values['base'] = null;
485
+								$values['owner'] = $line[8];
486
+								if ($line[7] == '') $values['date_first_reg'] = null;
487
+						else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7]));
488
+						$values['cancel'] = '';
489 489
 					} elseif ($country == 'PP') {
490
-            				    $values['registration'] = $line[0];
491
-            				    $values['base'] = null;
492
-            				    $values['owner'] = $line[4];
493
-            				    if ($line[6] == '') $values['date_first_reg'] = null;
494
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6]));
495
-					    $values['cancel'] = $line[7];
490
+								$values['registration'] = $line[0];
491
+								$values['base'] = null;
492
+								$values['owner'] = $line[4];
493
+								if ($line[6] == '') $values['date_first_reg'] = null;
494
+						else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6]));
495
+						$values['cancel'] = $line[7];
496 496
 					} elseif ($country == 'E7') {
497
-            				    $values['registration'] = $line[0];
498
-            				    $values['base'] = null;
499
-            				    $values['owner'] = $line[4];
500
-            				    if ($line[5] == '') $values['date_first_reg'] = null;
501
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[5]));
502
-					    $values['cancel'] = '';
497
+								$values['registration'] = $line[0];
498
+								$values['base'] = null;
499
+								$values['owner'] = $line[4];
500
+								if ($line[5] == '') $values['date_first_reg'] = null;
501
+						else $values['date_first_reg'] = date("Y-m-d",strtotime($line[5]));
502
+						$values['cancel'] = '';
503 503
 					} elseif ($country == '8Q') {
504
-            				    $values['registration'] = $line[0];
505
-            				    $values['base'] = null;
506
-            				    $values['owner'] = $line[3];
507
-            				    if ($line[7] == '') $values['date_first_reg'] = null;
508
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7]));
509
-					    $values['cancel'] = '';
504
+								$values['registration'] = $line[0];
505
+								$values['base'] = null;
506
+								$values['owner'] = $line[3];
507
+								if ($line[7] == '') $values['date_first_reg'] = null;
508
+						else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7]));
509
+						$values['cancel'] = '';
510 510
 					} elseif ($country == 'ZK') {
511
-            				    $values['registration'] = $line[0];
512
-            				    $values['base'] = null;
513
-            				    $values['owner'] = $line[3];
514
-            				    $values['date_first_reg'] = null;
515
-					    $values['cancel'] = '';
516
-					    $values['modes'] = $line[5];
517
-					    $values['icao'] = $line[9];
511
+								$values['registration'] = $line[0];
512
+								$values['base'] = null;
513
+								$values['owner'] = $line[3];
514
+								$values['date_first_reg'] = null;
515
+						$values['cancel'] = '';
516
+						$values['modes'] = $line[5];
517
+						$values['icao'] = $line[9];
518 518
 					} elseif ($country == 'M') {
519
-            				    $values['registration'] = $line[0];
520
-            				    $values['base'] = null;
521
-            				    $values['owner'] = $line[6];
522
-            				    $values['date_first_reg'] = date("Y-m-d",strtotime($line[5]));
523
-					    $values['cancel'] = date("Y-m-d",strtotime($line[8]));
524
-					    $values['modes'] = $line[4];
525
-					    $values['icao'] = $line[10];
519
+								$values['registration'] = $line[0];
520
+								$values['base'] = null;
521
+								$values['owner'] = $line[6];
522
+								$values['date_first_reg'] = date("Y-m-d",strtotime($line[5]));
523
+						$values['cancel'] = date("Y-m-d",strtotime($line[8]));
524
+						$values['modes'] = $line[4];
525
+						$values['icao'] = $line[10];
526 526
 					} elseif ($country == 'OY') {
527
-            				    $values['registration'] = $line[0];
528
-            				    $values['date_first_reg'] = date("Y-m-d",strtotime($line[4]));
529
-					    $values['modes'] = $line[5];
530
-					    $values['icao'] = $line[6];
527
+								$values['registration'] = $line[0];
528
+								$values['date_first_reg'] = date("Y-m-d",strtotime($line[4]));
529
+						$values['modes'] = $line[5];
530
+						$values['icao'] = $line[6];
531 531
 					} elseif ($country == 'PH') {
532
-            				    $values['registration'] = $line[0];
533
-            				    $values['date_first_reg'] = date("Y-m-d",strtotime($line[3]));
534
-					    $values['modes'] = $line[4];
535
-					    $values['icao'] = $line[5];
532
+								$values['registration'] = $line[0];
533
+								$values['date_first_reg'] = date("Y-m-d",strtotime($line[3]));
534
+						$values['modes'] = $line[4];
535
+						$values['icao'] = $line[5];
536 536
 					} elseif ($country == 'OM' || $country == 'TF') {
537
-            				    $values['registration'] = $line[0];
538
-            				    $values['base'] = null;
539
-            				    $values['owner'] = $line[3];
540
-            				    $values['date_first_reg'] = null;
541
-					    $values['cancel'] = '';
537
+								$values['registration'] = $line[0];
538
+								$values['base'] = null;
539
+								$values['owner'] = $line[3];
540
+								$values['date_first_reg'] = null;
541
+						$values['cancel'] = '';
542 542
 					}
543 543
 					if (isset($values['cancel']) && $values['cancel'] == '' && $values['registration'] != null && isset($values['owner'])) {
544 544
 						$query_dest_values = array(':registration' => $values['registration'],':base' => $values['base'],':date_first_reg' => $values['date_first_reg'],':owner' => $values['owner'],':source' => $database_file);
@@ -665,20 +665,20 @@  discard block
 block discarded – undo
665 665
 		try {
666 666
 			$Connection = new Connection();
667 667
 			$sth = $Connection->db->prepare($query);
668
-                        $sth->execute();
669
-                } catch(PDOException $e) {
670
-                        return "error : ".$e->getMessage();
671
-                }
668
+						$sth->execute();
669
+				} catch(PDOException $e) {
670
+						return "error : ".$e->getMessage();
671
+				}
672 672
 
673 673
 
674 674
 		$query = 'ALTER TABLE airport DROP INDEX icaoidx';
675 675
 		try {
676 676
 			$Connection = new Connection();
677 677
 			$sth = $Connection->db->prepare($query);
678
-                        $sth->execute();
679
-                } catch(PDOException $e) {
680
-                        return "error : ".$e->getMessage();
681
-                }
678
+						$sth->execute();
679
+				} catch(PDOException $e) {
680
+						return "error : ".$e->getMessage();
681
+				}
682 682
 
683 683
 		$query_dest = "INSERT INTO airport (`airport_id`,`name`,`city`,`country`,`iata`,`icao`,`latitude`,`longitude`,`altitude`,`type`,`home_link`,`wikipedia_link`,`image_thumb`,`image`)
684 684
 		    VALUES (:airport_id, :name, :city, :country, :iata, :icao, :latitude, :longitude, :altitude, :type, :home_link, :wikipedia_link, :image_thumb, :image)";
@@ -744,10 +744,10 @@  discard block
 block discarded – undo
744 744
 		try {
745 745
 			$Connection = new Connection();
746 746
 			$sth = $Connection->db->prepare($query);
747
-                        $sth->execute();
748
-                } catch(PDOException $e) {
749
-                        return "error : ".$e->getMessage();
750
-                }
747
+						$sth->execute();
748
+				} catch(PDOException $e) {
749
+						return "error : ".$e->getMessage();
750
+				}
751 751
 
752 752
 
753 753
 		if ($globalDebug) echo "Insert Not available Airport...\n";
@@ -757,10 +757,10 @@  discard block
 block discarded – undo
757 757
 		try {
758 758
 			$Connection = new Connection();
759 759
 			$sth = $Connection->db->prepare($query);
760
-                        $sth->execute($query_values);
761
-                } catch(PDOException $e) {
762
-                        return "error : ".$e->getMessage();
763
-                }
760
+						$sth->execute($query_values);
761
+				} catch(PDOException $e) {
762
+						return "error : ".$e->getMessage();
763
+				}
764 764
 		$i++;
765 765
 /*
766 766
 		$query = 'DELETE FROM airport WHERE airport_id IN (SELECT * FROM (SELECT min(a.airport_id) FROM airport a GROUP BY a.icao) x)';
@@ -874,7 +874,7 @@  discard block
 block discarded – undo
874 874
 
875 875
 
876 876
 
877
-                return "success";
877
+				return "success";
878 878
 	}
879 879
 	
880 880
 	public static function translation() {
@@ -890,10 +890,10 @@  discard block
 block discarded – undo
890 890
 		try {
891 891
 			$Connection = new Connection();
892 892
 			$sth = $Connection->db->prepare($query);
893
-                        $sth->execute(array(':source' => 'translation.csv'));
894
-                } catch(PDOException $e) {
895
-                        return "error : ".$e->getMessage();
896
-                }
893
+						$sth->execute(array(':source' => 'translation.csv'));
894
+				} catch(PDOException $e) {
895
+						return "error : ".$e->getMessage();
896
+				}
897 897
 
898 898
 		
899 899
 		//update_db::unzip($out_file);
@@ -912,21 +912,21 @@  discard block
 block discarded – undo
912 912
 					$data = $row;
913 913
 					$operator = $data[2];
914 914
 					if ($operator != '' && is_numeric(substr(substr($operator, 0, 3), -1, 1))) {
915
-                                                $airline_array = $Spotter->getAllAirlineInfo(substr($operator, 0, 2));
916
-                                                //echo substr($operator, 0, 2)."\n";;
917
-                                                if (count($airline_array) > 0) {
915
+												$airline_array = $Spotter->getAllAirlineInfo(substr($operator, 0, 2));
916
+												//echo substr($operator, 0, 2)."\n";;
917
+												if (count($airline_array) > 0) {
918 918
 							//print_r($airline_array);
919 919
 							$operator = $airline_array[0]['icao'].substr($operator,2);
920
-                                                }
921
-                                        }
920
+												}
921
+										}
922 922
 					
923 923
 					$operator_correct = $data[3];
924 924
 					if ($operator_correct != '' && is_numeric(substr(substr($operator_correct, 0, 3), -1, 1))) {
925
-                                                $airline_array = $Spotter->getAllAirlineInfo(substr($operator_correct, 0, 2));
926
-                                                if (count($airline_array) > 0) {
927
-                                            		$operator_correct = $airline_array[0]['icao'].substr($operator_correct,2);
928
-                                            	}
929
-                                        }
925
+												$airline_array = $Spotter->getAllAirlineInfo(substr($operator_correct, 0, 2));
926
+												if (count($airline_array) > 0) {
927
+													$operator_correct = $airline_array[0]['icao'].substr($operator_correct,2);
928
+												}
929
+										}
930 930
 					$query = 'INSERT INTO translation (Reg,Reg_correct,Operator,Operator_correct,Source) VALUES (:Reg, :Reg_correct, :Operator, :Operator_correct, :source)';
931 931
 					try {
932 932
 						$sth = $Connection->db->prepare($query);
@@ -940,7 +940,7 @@  discard block
 block discarded – undo
940 940
 			//$Connection->db->commit();
941 941
 		}
942 942
 		return '';
943
-        }
943
+		}
944 944
 	
945 945
 	public static function translation_fam() {
946 946
 		require_once(dirname(__FILE__).'/../require/class.Spotter.php');
@@ -950,10 +950,10 @@  discard block
 block discarded – undo
950 950
 		try {
951 951
 			$Connection = new Connection();
952 952
 			$sth = $Connection->db->prepare($query);
953
-                        $sth->execute(array(':source' => 'website_fam'));
954
-                } catch(PDOException $e) {
955
-                        return "error : ".$e->getMessage();
956
-                }
953
+						$sth->execute(array(':source' => 'website_fam'));
954
+				} catch(PDOException $e) {
955
+						return "error : ".$e->getMessage();
956
+				}
957 957
 
958 958
 		
959 959
 		//update_db::unzip($out_file);
@@ -982,7 +982,7 @@  discard block
 block discarded – undo
982 982
 			//$Connection->db->commit();
983 983
 		}
984 984
 		return '';
985
-        }
985
+		}
986 986
 
987 987
 	/*
988 988
 	* This function use FAA public data.
@@ -994,19 +994,19 @@  discard block
 block discarded – undo
994 994
 		try {
995 995
 			$Connection = new Connection();
996 996
 			$sth = $Connection->db->prepare($query);
997
-                        $sth->execute(array(':source' => 'website_faa'));
998
-                } catch(PDOException $e) {
999
-                        return "error : ".$e->getMessage();
1000
-                }
997
+						$sth->execute(array(':source' => 'website_faa'));
998
+				} catch(PDOException $e) {
999
+						return "error : ".$e->getMessage();
1000
+				}
1001 1001
 
1002 1002
 		$query = "DELETE FROM aircraft_owner WHERE Source = '' OR Source = :source";
1003 1003
 		try {
1004 1004
 			$Connection = new Connection();
1005 1005
 			$sth = $Connection->db->prepare($query);
1006
-                        $sth->execute(array(':source' => 'website_faa'));
1007
-                } catch(PDOException $e) {
1008
-                        return "error : ".$e->getMessage();
1009
-                }
1006
+						$sth->execute(array(':source' => 'website_faa'));
1007
+				} catch(PDOException $e) {
1008
+						return "error : ".$e->getMessage();
1009
+				}
1010 1010
 
1011 1011
 		$delimiter = ",";
1012 1012
 		$mfr = array();
@@ -1082,17 +1082,17 @@  discard block
 block discarded – undo
1082 1082
 		}
1083 1083
 		print_r($mfr);
1084 1084
 		return '';
1085
-        }
1085
+		}
1086 1086
 	public static function modes_fam() {
1087 1087
 		global $tmp_dir, $globalTransaction;
1088 1088
 		$query = "DELETE FROM aircraft_modes WHERE Source = '' OR Source = :source";
1089 1089
 		try {
1090 1090
 			$Connection = new Connection();
1091 1091
 			$sth = $Connection->db->prepare($query);
1092
-                        $sth->execute(array(':source' => 'website_fam'));
1093
-                } catch(PDOException $e) {
1094
-                        return "error : ".$e->getMessage();
1095
-                }
1092
+						$sth->execute(array(':source' => 'website_fam'));
1093
+				} catch(PDOException $e) {
1094
+						return "error : ".$e->getMessage();
1095
+				}
1096 1096
 
1097 1097
 		
1098 1098
 		//update_db::unzip($out_file);
@@ -1122,7 +1122,7 @@  discard block
 block discarded – undo
1122 1122
 			if ($globalTransaction) $Connection->db->commit();
1123 1123
 		}
1124 1124
 		return '';
1125
-        }
1125
+		}
1126 1126
         
1127 1127
 	public static function owner_fam() {
1128 1128
 		global $tmp_dir, $globalTransaction;
@@ -1130,10 +1130,10 @@  discard block
 block discarded – undo
1130 1130
 		try {
1131 1131
 			$Connection = new Connection();
1132 1132
 			$sth = $Connection->db->prepare($query);
1133
-                        $sth->execute(array(':source' => 'website_fam'));
1134
-                } catch(PDOException $e) {
1135
-                        return "error : ".$e->getMessage();
1136
-                }
1133
+						$sth->execute(array(':source' => 'website_fam'));
1134
+				} catch(PDOException $e) {
1135
+						return "error : ".$e->getMessage();
1136
+				}
1137 1137
 
1138 1138
 		$delimiter = "\t";
1139 1139
 		$Connection = new Connection();
@@ -1159,7 +1159,7 @@  discard block
 block discarded – undo
1159 1159
 			if ($globalTransaction) $Connection->db->commit();
1160 1160
 		}
1161 1161
 		return '';
1162
-        }
1162
+		}
1163 1163
 
1164 1164
 	public static function routes_fam() {
1165 1165
 		global $tmp_dir, $globalTransaction;
@@ -1167,10 +1167,10 @@  discard block
 block discarded – undo
1167 1167
 		try {
1168 1168
 			$Connection = new Connection();
1169 1169
 			$sth = $Connection->db->prepare($query);
1170
-                        $sth->execute(array(':source' => 'website_fam'));
1171
-                } catch(PDOException $e) {
1172
-                        return "error : ".$e->getMessage();
1173
-                }
1170
+						$sth->execute(array(':source' => 'website_fam'));
1171
+				} catch(PDOException $e) {
1172
+						return "error : ".$e->getMessage();
1173
+				}
1174 1174
 
1175 1175
 		
1176 1176
 		//update_db::unzip($out_file);
@@ -1199,7 +1199,7 @@  discard block
 block discarded – undo
1199 1199
 			if ($globalTransaction) $Connection->db->commit();
1200 1200
 		}
1201 1201
 		return '';
1202
-        }
1202
+		}
1203 1203
 
1204 1204
 	public static function banned_fam() {
1205 1205
 		global $tmp_dir, $globalTransaction;
@@ -1233,7 +1233,7 @@  discard block
 block discarded – undo
1233 1233
 			if ($globalTransaction) $Connection->db->commit();
1234 1234
 		}
1235 1235
 		return '';
1236
-        }
1236
+		}
1237 1237
 
1238 1238
 	public static function tle($filename,$tletype) {
1239 1239
 		require_once(dirname(__FILE__).'/../require/class.Spotter.php');
@@ -1244,10 +1244,10 @@  discard block
 block discarded – undo
1244 1244
 		try {
1245 1245
 			$Connection = new Connection();
1246 1246
 			$sth = $Connection->db->prepare($query);
1247
-                        $sth->execute(array(':source' => $filename));
1248
-                } catch(PDOException $e) {
1249
-                        return "error : ".$e->getMessage();
1250
-                }
1247
+						$sth->execute(array(':source' => $filename));
1248
+				} catch(PDOException $e) {
1249
+						return "error : ".$e->getMessage();
1250
+				}
1251 1251
 		
1252 1252
 		$Connection = new Connection();
1253 1253
 		if (($handle = fopen($filename, 'r')) !== FALSE)
@@ -1282,54 +1282,54 @@  discard block
 block discarded – undo
1282 1282
 			//$Connection->db->commit();
1283 1283
 		}
1284 1284
 		return '';
1285
-        }
1285
+		}
1286 1286
 
1287 1287
 	/**
1288
-        * Convert a HTML table to an array
1289
-        * @param String $data HTML page
1290
-        * @return Array array of the tables in HTML page
1291
-        */
1292
-        private static function table2array($data) {
1293
-                $html = str_get_html($data);
1294
-                $tabledata=array();
1295
-                foreach($html->find('tr') as $element)
1296
-                {
1297
-                        $td = array();
1298
-                        foreach( $element->find('th') as $row)
1299
-                        {
1300
-                                $td [] = trim($row->plaintext);
1301
-                        }
1302
-                        $td=array_filter($td);
1303
-                        $tabledata[] = $td;
1304
-
1305
-                        $td = array();
1306
-                        $tdi = array();
1307
-                        foreach( $element->find('td') as $row)
1308
-                        {
1309
-                                $td [] = trim($row->plaintext);
1310
-                                $tdi [] = trim($row->innertext);
1311
-                        }
1312
-                        $td=array_filter($td);
1313
-                        $tdi=array_filter($tdi);
1314
-                    //    $tabledata[]=array_merge($td,$tdi);
1315
-                        $tabledata[]=$td;
1316
-                }
1317
-                return(array_filter($tabledata));
1318
-        }
1319
-
1320
-       /**
1321
-        * Get data from form result
1322
-        * @param String $url form URL
1323
-        * @return String the result
1324
-        */
1325
-        private static function getData($url) {
1326
-                $ch = curl_init();
1327
-                curl_setopt($ch, CURLOPT_URL, $url);
1328
-                curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
1329
-                curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
1330
-                curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.2) Gecko/20090729 Firefox/3.5.2 GTB5');
1331
-                return curl_exec($ch);
1332
-        }
1288
+	 * Convert a HTML table to an array
1289
+	 * @param String $data HTML page
1290
+	 * @return Array array of the tables in HTML page
1291
+	 */
1292
+		private static function table2array($data) {
1293
+				$html = str_get_html($data);
1294
+				$tabledata=array();
1295
+				foreach($html->find('tr') as $element)
1296
+				{
1297
+						$td = array();
1298
+						foreach( $element->find('th') as $row)
1299
+						{
1300
+								$td [] = trim($row->plaintext);
1301
+						}
1302
+						$td=array_filter($td);
1303
+						$tabledata[] = $td;
1304
+
1305
+						$td = array();
1306
+						$tdi = array();
1307
+						foreach( $element->find('td') as $row)
1308
+						{
1309
+								$td [] = trim($row->plaintext);
1310
+								$tdi [] = trim($row->innertext);
1311
+						}
1312
+						$td=array_filter($td);
1313
+						$tdi=array_filter($tdi);
1314
+					//    $tabledata[]=array_merge($td,$tdi);
1315
+						$tabledata[]=$td;
1316
+				}
1317
+				return(array_filter($tabledata));
1318
+		}
1319
+
1320
+	   /**
1321
+	    * Get data from form result
1322
+	    * @param String $url form URL
1323
+	    * @return String the result
1324
+	    */
1325
+		private static function getData($url) {
1326
+				$ch = curl_init();
1327
+				curl_setopt($ch, CURLOPT_URL, $url);
1328
+				curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
1329
+				curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
1330
+				curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.2) Gecko/20090729 Firefox/3.5.2 GTB5');
1331
+				return curl_exec($ch);
1332
+		}
1333 1333
 /*
1334 1334
 	public static function waypoints() {
1335 1335
 		$data = update_db::getData('http://www.fallingrain.com/world/FR/waypoints.html');
@@ -1412,7 +1412,7 @@  discard block
 block discarded – undo
1412 1412
 			if ($globalTransaction) $Connection->db->commit();
1413 1413
 		}
1414 1414
 		return '';
1415
-        }
1415
+		}
1416 1416
 
1417 1417
 	public static function ivao_airlines($filename) {
1418 1418
 		//require_once(dirname(__FILE__).'/../require/class.Spotter.php');
@@ -1422,10 +1422,10 @@  discard block
 block discarded – undo
1422 1422
 		try {
1423 1423
 			$Connection = new Connection();
1424 1424
 			$sth = $Connection->db->prepare($query);
1425
-                        $sth->execute();
1426
-                } catch(PDOException $e) {
1427
-                        return "error : ".$e->getMessage();
1428
-                }
1425
+						$sth->execute();
1426
+				} catch(PDOException $e) {
1427
+						return "error : ".$e->getMessage();
1428
+				}
1429 1429
 
1430 1430
 		$header = NULL;
1431 1431
 		$delimiter = ':';
@@ -1449,7 +1449,7 @@  discard block
 block discarded – undo
1449 1449
 			if ($globalTransaction) $Connection->db->commit();
1450 1450
 		}
1451 1451
 		return '';
1452
-        }
1452
+		}
1453 1453
 	
1454 1454
 	public static function update_airspace() {
1455 1455
 		global $tmp_dir, $globalDBdriver;
@@ -1459,11 +1459,11 @@  discard block
 block discarded – undo
1459 1459
 			$query = 'DROP TABLE airspace';
1460 1460
 			try {
1461 1461
 				$sth = $Connection->db->prepare($query);
1462
-                    		$sth->execute();
1463
-	                } catch(PDOException $e) {
1462
+							$sth->execute();
1463
+					} catch(PDOException $e) {
1464 1464
 				return "error : ".$e->getMessage();
1465
-	                }
1466
-	        }
1465
+					}
1466
+			}
1467 1467
 
1468 1468
 
1469 1469
 		if ($globalDBdriver == 'mysql') update_db::gunzip('../db/airspace.sql.gz',$tmp_dir.'airspace.sql');
@@ -1518,10 +1518,10 @@  discard block
 block discarded – undo
1518 1518
 			$query = 'DROP TABLE countries';
1519 1519
 			try {
1520 1520
 				$sth = $Connection->db->prepare($query);
1521
-            	        	$sth->execute();
1522
-	                } catch(PDOException $e) {
1523
-    	                	echo "error : ".$e->getMessage();
1524
-	                }
1521
+							$sth->execute();
1522
+					} catch(PDOException $e) {
1523
+							echo "error : ".$e->getMessage();
1524
+					}
1525 1525
 		}
1526 1526
 		if ($globalDBdriver == 'mysql') {
1527 1527
 			update_db::gunzip('../db/countries.sql.gz',$tmp_dir.'countries.sql');
@@ -2025,11 +2025,11 @@  discard block
 block discarded – undo
2025 2025
 						$query = 'DROP TABLE airspace';
2026 2026
 						try {
2027 2027
 							$sth = $Connection->db->prepare($query);
2028
-    	    	    					$sth->execute();
2029
-			            		} catch(PDOException $e) {
2028
+										$sth->execute();
2029
+								} catch(PDOException $e) {
2030 2030
 							return "error : ".$e->getMessage();
2031
-		            			}
2032
-		    			}
2031
+								}
2032
+						}
2033 2033
 					$error = create_db::import_file($tmp_dir.'airspace.sql');
2034 2034
 					update_db::insert_airspace_version($airspace_md5);
2035 2035
 				} else $error = "File ".$tmp_dir.'airpsace.sql.gz'." doesn't exist. Download failed.";
@@ -2149,12 +2149,12 @@  discard block
 block discarded – undo
2149 2149
 		echo $data;
2150 2150
 		*/
2151 2151
 		if (file_exists($tmp_dir.'aircrafts.html')) {
2152
-		    //var_dump(file_get_html($tmp_dir.'aircrafts.html'));
2153
-		    $fh = fopen($tmp_dir.'aircrafts.html',"r");
2154
-		    $result = fread($fh,100000000);
2155
-		    //echo $result;
2156
-		    //var_dump(str_get_html($result));
2157
-		    //print_r(self::table2array($result));
2152
+			//var_dump(file_get_html($tmp_dir.'aircrafts.html'));
2153
+			$fh = fopen($tmp_dir.'aircrafts.html',"r");
2154
+			$result = fread($fh,100000000);
2155
+			//echo $result;
2156
+			//var_dump(str_get_html($result));
2157
+			//print_r(self::table2array($result));
2158 2158
 		}
2159 2159
 
2160 2160
 	}
@@ -2168,10 +2168,10 @@  discard block
 block discarded – undo
2168 2168
 		try {
2169 2169
 			$Connection = new Connection();
2170 2170
 			$sth = $Connection->db->prepare($query);
2171
-                        $sth->execute();
2172
-                } catch(PDOException $e) {
2173
-                        return "error : ".$e->getMessage();
2174
-                }
2171
+						$sth->execute();
2172
+				} catch(PDOException $e) {
2173
+						return "error : ".$e->getMessage();
2174
+				}
2175 2175
 
2176 2176
 		$error = '';
2177 2177
 		if ($globalDebug) echo "Notam : Download...";
@@ -2227,8 +2227,8 @@  discard block
 block discarded – undo
2227 2227
 					$data['date_end'] = date("Y-m-d H:i:s",strtotime($to));
2228 2228
 					$data['permanent'] = 0;
2229 2229
 				} else {
2230
-				    $data['date_end'] = NULL;
2231
-				    $data['permanent'] = 1;
2230
+					$data['date_end'] = NULL;
2231
+					$data['permanent'] = 1;
2232 2232
 				}
2233 2233
 				$data['full_notam'] = $notam['title'].'<br>'.$notam['description'];
2234 2234
 				$NOTAM = new NOTAM();
@@ -2302,13 +2302,13 @@  discard block
 block discarded – undo
2302 2302
 		try {
2303 2303
 			$Connection = new Connection();
2304 2304
 			$sth = $Connection->db->prepare($query);
2305
-                        $sth->execute();
2306
-                } catch(PDOException $e) {
2307
-                        return "error : ".$e->getMessage();
2308
-                }
2309
-                $row = $sth->fetch(PDO::FETCH_ASSOC);
2310
-                if ($row['nb'] > 0) return false;
2311
-                else return true;
2305
+						$sth->execute();
2306
+				} catch(PDOException $e) {
2307
+						return "error : ".$e->getMessage();
2308
+				}
2309
+				$row = $sth->fetch(PDO::FETCH_ASSOC);
2310
+				if ($row['nb'] > 0) return false;
2311
+				else return true;
2312 2312
 	}
2313 2313
 
2314 2314
 	public static function insert_last_update() {
@@ -2317,10 +2317,10 @@  discard block
 block discarded – undo
2317 2317
 		try {
2318 2318
 			$Connection = new Connection();
2319 2319
 			$sth = $Connection->db->prepare($query);
2320
-                        $sth->execute();
2321
-                } catch(PDOException $e) {
2322
-                        return "error : ".$e->getMessage();
2323
-                }
2320
+						$sth->execute();
2321
+				} catch(PDOException $e) {
2322
+						return "error : ".$e->getMessage();
2323
+				}
2324 2324
 	}
2325 2325
 
2326 2326
 	public static function check_airspace_version($version) {
@@ -2328,13 +2328,13 @@  discard block
 block discarded – undo
2328 2328
 		try {
2329 2329
 			$Connection = new Connection();
2330 2330
 			$sth = $Connection->db->prepare($query);
2331
-                        $sth->execute(array(':version' => $version));
2332
-                } catch(PDOException $e) {
2333
-                        return "error : ".$e->getMessage();
2334
-                }
2335
-                $row = $sth->fetch(PDO::FETCH_ASSOC);
2336
-                if ($row['nb'] > 0) return true;
2337
-                else return false;
2331
+						$sth->execute(array(':version' => $version));
2332
+				} catch(PDOException $e) {
2333
+						return "error : ".$e->getMessage();
2334
+				}
2335
+				$row = $sth->fetch(PDO::FETCH_ASSOC);
2336
+				if ($row['nb'] > 0) return true;
2337
+				else return false;
2338 2338
 	}
2339 2339
 
2340 2340
 
@@ -2344,10 +2344,10 @@  discard block
 block discarded – undo
2344 2344
 		try {
2345 2345
 			$Connection = new Connection();
2346 2346
 			$sth = $Connection->db->prepare($query);
2347
-                        $sth->execute(array(':version' => $version));
2348
-                } catch(PDOException $e) {
2349
-                        return "error : ".$e->getMessage();
2350
-                }
2347
+						$sth->execute(array(':version' => $version));
2348
+				} catch(PDOException $e) {
2349
+						return "error : ".$e->getMessage();
2350
+				}
2351 2351
 	}
2352 2352
 
2353 2353
 	public static function check_last_notam_update() {
@@ -2360,13 +2360,13 @@  discard block
 block discarded – undo
2360 2360
 		try {
2361 2361
 			$Connection = new Connection();
2362 2362
 			$sth = $Connection->db->prepare($query);
2363
-                        $sth->execute();
2364
-                } catch(PDOException $e) {
2365
-                        return "error : ".$e->getMessage();
2366
-                }
2367
-                $row = $sth->fetch(PDO::FETCH_ASSOC);
2368
-                if ($row['nb'] > 0) return false;
2369
-                else return true;
2363
+						$sth->execute();
2364
+				} catch(PDOException $e) {
2365
+						return "error : ".$e->getMessage();
2366
+				}
2367
+				$row = $sth->fetch(PDO::FETCH_ASSOC);
2368
+				if ($row['nb'] > 0) return false;
2369
+				else return true;
2370 2370
 	}
2371 2371
 
2372 2372
 	public static function insert_last_notam_update() {
@@ -2375,10 +2375,10 @@  discard block
 block discarded – undo
2375 2375
 		try {
2376 2376
 			$Connection = new Connection();
2377 2377
 			$sth = $Connection->db->prepare($query);
2378
-                        $sth->execute();
2379
-                } catch(PDOException $e) {
2380
-                        return "error : ".$e->getMessage();
2381
-                }
2378
+						$sth->execute();
2379
+				} catch(PDOException $e) {
2380
+						return "error : ".$e->getMessage();
2381
+				}
2382 2382
 	}
2383 2383
 	public static function check_last_airspace_update() {
2384 2384
 		global $globalDBdriver;
@@ -2390,13 +2390,13 @@  discard block
 block discarded – undo
2390 2390
 		try {
2391 2391
 			$Connection = new Connection();
2392 2392
 			$sth = $Connection->db->prepare($query);
2393
-                        $sth->execute();
2394
-                } catch(PDOException $e) {
2395
-                        return "error : ".$e->getMessage();
2396
-                }
2397
-                $row = $sth->fetch(PDO::FETCH_ASSOC);
2398
-                if ($row['nb'] > 0) return false;
2399
-                else return true;
2393
+						$sth->execute();
2394
+				} catch(PDOException $e) {
2395
+						return "error : ".$e->getMessage();
2396
+				}
2397
+				$row = $sth->fetch(PDO::FETCH_ASSOC);
2398
+				if ($row['nb'] > 0) return false;
2399
+				else return true;
2400 2400
 	}
2401 2401
 
2402 2402
 	public static function insert_last_airspace_update() {
@@ -2405,10 +2405,10 @@  discard block
 block discarded – undo
2405 2405
 		try {
2406 2406
 			$Connection = new Connection();
2407 2407
 			$sth = $Connection->db->prepare($query);
2408
-                        $sth->execute();
2409
-                } catch(PDOException $e) {
2410
-                        return "error : ".$e->getMessage();
2411
-                }
2408
+						$sth->execute();
2409
+				} catch(PDOException $e) {
2410
+						return "error : ".$e->getMessage();
2411
+				}
2412 2412
 	}
2413 2413
 
2414 2414
 	public static function check_last_owner_update() {
@@ -2421,13 +2421,13 @@  discard block
 block discarded – undo
2421 2421
 		try {
2422 2422
 			$Connection = new Connection();
2423 2423
 			$sth = $Connection->db->prepare($query);
2424
-                        $sth->execute();
2425
-                } catch(PDOException $e) {
2426
-                        return "error : ".$e->getMessage();
2427
-                }
2428
-                $row = $sth->fetch(PDO::FETCH_ASSOC);
2429
-                if ($row['nb'] > 0) return false;
2430
-                else return true;
2424
+						$sth->execute();
2425
+				} catch(PDOException $e) {
2426
+						return "error : ".$e->getMessage();
2427
+				}
2428
+				$row = $sth->fetch(PDO::FETCH_ASSOC);
2429
+				if ($row['nb'] > 0) return false;
2430
+				else return true;
2431 2431
 	}
2432 2432
 
2433 2433
 	public static function insert_last_owner_update() {
@@ -2436,10 +2436,10 @@  discard block
 block discarded – undo
2436 2436
 		try {
2437 2437
 			$Connection = new Connection();
2438 2438
 			$sth = $Connection->db->prepare($query);
2439
-                        $sth->execute();
2440
-                } catch(PDOException $e) {
2441
-                        return "error : ".$e->getMessage();
2442
-                }
2439
+						$sth->execute();
2440
+				} catch(PDOException $e) {
2441
+						return "error : ".$e->getMessage();
2442
+				}
2443 2443
 	}
2444 2444
 	public static function check_last_schedules_update() {
2445 2445
 		global $globalDBdriver;
@@ -2451,13 +2451,13 @@  discard block
 block discarded – undo
2451 2451
 		try {
2452 2452
 			$Connection = new Connection();
2453 2453
 			$sth = $Connection->db->prepare($query);
2454
-                        $sth->execute();
2455
-                } catch(PDOException $e) {
2456
-                        return "error : ".$e->getMessage();
2457
-                }
2458
-                $row = $sth->fetch(PDO::FETCH_ASSOC);
2459
-                if ($row['nb'] > 0) return false;
2460
-                else return true;
2454
+						$sth->execute();
2455
+				} catch(PDOException $e) {
2456
+						return "error : ".$e->getMessage();
2457
+				}
2458
+				$row = $sth->fetch(PDO::FETCH_ASSOC);
2459
+				if ($row['nb'] > 0) return false;
2460
+				else return true;
2461 2461
 	}
2462 2462
 
2463 2463
 	public static function insert_last_schedules_update() {
@@ -2466,10 +2466,10 @@  discard block
 block discarded – undo
2466 2466
 		try {
2467 2467
 			$Connection = new Connection();
2468 2468
 			$sth = $Connection->db->prepare($query);
2469
-                        $sth->execute();
2470
-                } catch(PDOException $e) {
2471
-                        return "error : ".$e->getMessage();
2472
-                }
2469
+						$sth->execute();
2470
+				} catch(PDOException $e) {
2471
+						return "error : ".$e->getMessage();
2472
+				}
2473 2473
 	}
2474 2474
 	public static function check_last_tle_update() {
2475 2475
 		global $globalDBdriver;
@@ -2481,13 +2481,13 @@  discard block
 block discarded – undo
2481 2481
 		try {
2482 2482
 			$Connection = new Connection();
2483 2483
 			$sth = $Connection->db->prepare($query);
2484
-                        $sth->execute();
2485
-                } catch(PDOException $e) {
2486
-                        return "error : ".$e->getMessage();
2487
-                }
2488
-                $row = $sth->fetch(PDO::FETCH_ASSOC);
2489
-                if ($row['nb'] > 0) return false;
2490
-                else return true;
2484
+						$sth->execute();
2485
+				} catch(PDOException $e) {
2486
+						return "error : ".$e->getMessage();
2487
+				}
2488
+				$row = $sth->fetch(PDO::FETCH_ASSOC);
2489
+				if ($row['nb'] > 0) return false;
2490
+				else return true;
2491 2491
 	}
2492 2492
 
2493 2493
 	public static function insert_last_tle_update() {
@@ -2496,10 +2496,10 @@  discard block
 block discarded – undo
2496 2496
 		try {
2497 2497
 			$Connection = new Connection();
2498 2498
 			$sth = $Connection->db->prepare($query);
2499
-                        $sth->execute();
2500
-                } catch(PDOException $e) {
2501
-                        return "error : ".$e->getMessage();
2502
-                }
2499
+						$sth->execute();
2500
+				} catch(PDOException $e) {
2501
+						return "error : ".$e->getMessage();
2502
+				}
2503 2503
 	}
2504 2504
 	public static function delete_duplicatemodes() {
2505 2505
 		global $globalDBdriver;
@@ -2511,10 +2511,10 @@  discard block
 block discarded – undo
2511 2511
 		try {
2512 2512
 			$Connection = new Connection();
2513 2513
 			$sth = $Connection->db->prepare($query);
2514
-                        $sth->execute();
2515
-                } catch(PDOException $e) {
2516
-                        return "error : ".$e->getMessage();
2517
-                }
2514
+						$sth->execute();
2515
+				} catch(PDOException $e) {
2516
+						return "error : ".$e->getMessage();
2517
+				}
2518 2518
 	}
2519 2519
 	public static function delete_duplicateowner() {
2520 2520
 		global $globalDBdriver;
@@ -2526,10 +2526,10 @@  discard block
 block discarded – undo
2526 2526
 		try {
2527 2527
 			$Connection = new Connection();
2528 2528
 			$sth = $Connection->db->prepare($query);
2529
-                        $sth->execute();
2530
-                } catch(PDOException $e) {
2531
-                        return "error : ".$e->getMessage();
2532
-                }
2529
+						$sth->execute();
2530
+				} catch(PDOException $e) {
2531
+						return "error : ".$e->getMessage();
2532
+				}
2533 2533
 	}
2534 2534
 	
2535 2535
 	public static function update_all() {
Please login to merge, or discard this patch.
owner-statistics-aircraft.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -3,8 +3,8 @@
 block discarded – undo
3 3
 require_once('require/class.Spotter.php');
4 4
 require_once('require/class.Language.php');
5 5
 if (!isset($_GET['owner'])) {
6
-        header('Location: '.$globalURL.'/owner');
7
-        die();
6
+		header('Location: '.$globalURL.'/owner');
7
+		die();
8 8
 }
9 9
 $Spotter = new Spotter();
10 10
 $sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING);
Please login to merge, or discard this patch.
pilot-statistics-time.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -3,8 +3,8 @@
 block discarded – undo
3 3
 require_once('require/class.Spotter.php');
4 4
 require_once('require/class.Language.php');
5 5
 if (!isset($_GET['pilot'])) {
6
-        header('Location: '.$globalURL.'/pilot');
7
-        die();
6
+		header('Location: '.$globalURL.'/pilot');
7
+		die();
8 8
 }
9 9
 $Spotter = new Spotter();
10 10
 $sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING);
Please login to merge, or discard this patch.