Completed
Push — master ( 36cc69...ef15cd )
by Yannick
07:23
created
install/install_db.php 1 patch
Indentation   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -1,30 +1,30 @@
 block discarded – undo
1 1
 #!/usr/bin/php
2 2
 <?php
3
-    require_once('../require/settings.php');
4
-    if ($globalInstalled) {
5
-        echo '$globalInstalled must be set to FALSE in require/settings.php';
6
-        exit;
7
-    }
8
-    require('class.create_db.php');
9
-    echo "Create and import all tables...";
10
-    create_db::import_all_db('../db/');
11
-    echo "Done !\n";
3
+	require_once('../require/settings.php');
4
+	if ($globalInstalled) {
5
+		echo '$globalInstalled must be set to FALSE in require/settings.php';
6
+		exit;
7
+	}
8
+	require('class.create_db.php');
9
+	echo "Create and import all tables...";
10
+	create_db::import_all_db('../db/');
11
+	echo "Done !\n";
12 12
 
13
-    require('class.update_db.php');
14
-    echo "Populate all tables...\n";
15
-    update_db::update_all();
16
-    echo "\nInstall waypoints...(VERY slow!)";
17
-    update_db::update_waypoints();
18
-    echo "Done !\n";
19
-    echo "Install airspace...";
20
-    update_db::update_airspace();
21
-    echo "Done !\n";
22
-    echo 'All is now installed ! Thanks'."\n";
23
-    if ($globalSBS1) {
24
-            echo 'You need to run cron-sbs.php as a daemon. You can use init script in the install/init directory.'."\n";
25
-    }
26
-    if ($globalACARS) {
27
-            echo 'You need to run cron-acars.php as a daemon. You can use init script in the install/init directory.'."\n";
28
-    }
13
+	require('class.update_db.php');
14
+	echo "Populate all tables...\n";
15
+	update_db::update_all();
16
+	echo "\nInstall waypoints...(VERY slow!)";
17
+	update_db::update_waypoints();
18
+	echo "Done !\n";
19
+	echo "Install airspace...";
20
+	update_db::update_airspace();
21
+	echo "Done !\n";
22
+	echo 'All is now installed ! Thanks'."\n";
23
+	if ($globalSBS1) {
24
+			echo 'You need to run cron-sbs.php as a daemon. You can use init script in the install/init directory.'."\n";
25
+	}
26
+	if ($globalACARS) {
27
+			echo 'You need to run cron-acars.php as a daemon. You can use init script in the install/init directory.'."\n";
28
+	}
29 29
     
30 30
 ?>
31 31
\ No newline at end of file
Please login to merge, or discard this patch.
install/populate_all.php 1 patch
Indentation   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -1,37 +1,37 @@
 block discarded – undo
1 1
 #!/usr/bin/php
2 2
 <?php
3
-    require_once('../require/settings.php');
4
-    if ($globalInstalled) {
5
-        echo '$globalInstalled must be set to FALSE in require/settings.php';
6
-        exit;
7
-    }
8
-    require('class.update_db.php');
9
-    echo "Populate all tables...\n";
10
-    update_db::update_all();
11
-    echo "\nInstall waypoints...(VERY slow!)";
12
-    update_db::update_waypoints();
13
-    echo "Done !\n";
14
-    echo "Install airspace...";
15
-    update_db::update_airspace();
16
-    echo "Done !\n";
17
-    echo "Install countries...";
18
-    update_db::update_countries();
19
-    echo "Done !\n";
20
-    if (isset($globalOwner) && $globalOwner) {
3
+	require_once('../require/settings.php');
4
+	if ($globalInstalled) {
5
+		echo '$globalInstalled must be set to FALSE in require/settings.php';
6
+		exit;
7
+	}
8
+	require('class.update_db.php');
9
+	echo "Populate all tables...\n";
10
+	update_db::update_all();
11
+	echo "\nInstall waypoints...(VERY slow!)";
12
+	update_db::update_waypoints();
13
+	echo "Done !\n";
14
+	echo "Install airspace...";
15
+	update_db::update_airspace();
16
+	echo "Done !\n";
17
+	echo "Install countries...";
18
+	update_db::update_countries();
19
+	echo "Done !\n";
20
+	if (isset($globalOwner) && $globalOwner) {
21 21
 	echo "Install private owners...";
22 22
 	update_db::update_owner();
23
-        echo "Done !\n";
24
-    }
25
-    /*
23
+		echo "Done !\n";
24
+	}
25
+	/*
26 26
     if (isset($globalIVAO) && $globalIVAO) {
27 27
         echo "Install IVAO airlines and logos...";
28 28
         update_db::update_IVAO();
29 29
 	echo "Done !\n";
30 30
     }
31 31
     */
32
-    if (isset($globalNOTAM) && $globalNOTAM && isset($globalNOTAMSource) && $globalNOTAMSource != '') {
32
+	if (isset($globalNOTAM) && $globalNOTAM && isset($globalNOTAMSource) && $globalNOTAMSource != '') {
33 33
 	echo "Install NOTAM from notaminfo.com...";
34
-        update_db:update_notam();
35
-        echo "Done !\n";
36
-    }
34
+		update_db:update_notam();
35
+		echo "Done !\n";
36
+	}
37 37
 ?>
38 38
\ No newline at end of file
Please login to merge, or discard this patch.
install/populate_ivao.php 1 patch
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -1,23 +1,23 @@
 block discarded – undo
1 1
 #!/usr/bin/php
2 2
 <?php
3
-    require_once('../require/settings.php');
4
-    if ($globalInstalled) {
5
-        echo '$globalInstalled must be set to FALSE in require/settings.php';
6
-        exit;
7
-    }
8
-    require('class.update_db.php');
9
-    if (isset($globalVATSIM) && $globalVATSIM) {
3
+	require_once('../require/settings.php');
4
+	if ($globalInstalled) {
5
+		echo '$globalInstalled must be set to FALSE in require/settings.php';
6
+		exit;
7
+	}
8
+	require('class.update_db.php');
9
+	if (isset($globalVATSIM) && $globalVATSIM) {
10 10
 	echo "Install VATSIM airlines...";
11 11
 	update_db::update_vatsim();
12 12
 	echo "Done !\n";
13
-    }
14
-    if (isset($globalIVAO) && $globalIVAO) {
13
+	}
14
+	if (isset($globalIVAO) && $globalIVAO) {
15 15
 	if (!file_exists('tmp/ivae_feb2013.zip')) {
16 16
 		echo "You have to download the file ivae_feb2013.zip from https://www.ivao.aero/softdev/mirrors.asp?software=IvAeDataUp and put it in install/tmp directory";
17 17
 	} else {
18
-	        echo "Install IVAO airlines and logos...";
19
-	        update_db::update_IVAO();
18
+			echo "Install IVAO airlines and logos...";
19
+			update_db::update_IVAO();
20 20
 		echo "Done !\n";
21 21
 	}
22
-    }
22
+	}
23 23
 ?>
24 24
\ No newline at end of file
Please login to merge, or discard this patch.
install/header.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 <meta property="og:site_name" content="<?php print $globalName; ?>"/>
40 40
 
41 41
 <?php
42
-    if (!isset($_SESSION['install']) && !$globalInstalled) {
42
+	if (!isset($_SESSION['install']) && !$globalInstalled) {
43 43
 ?>
44 44
 <script language="JavaScript" type="text/javascript">
45 45
     function datasource_js() {
@@ -120,22 +120,22 @@  discard block
 block discarded – undo
120 120
     }
121 121
 </script>
122 122
 <?php
123
-    }
123
+	}
124 124
 ?>
125 125
 
126 126
 </head>
127 127
 
128 128
 <?php
129
-    if (!isset($_SESSION['install']) && !$globalInstalled) {
129
+	if (!isset($_SESSION['install']) && !$globalInstalled) {
130 130
 ?>
131 131
 
132 132
 <body class="page-<?php print strtolower($current_page); ?>" onload="datasource_js(); metarcycle_js(); create_database_js(); daemon_js(); schedule_js()">
133 133
 <?php
134
-    } else {
134
+	} else {
135 135
 ?>
136 136
     <body class="page-<?php print strtolower($current_page); ?>">
137 137
 <?php
138
-    }
138
+	}
139 139
 ?>
140 140
 <div class="navbar navbar-fixed-top" role="navigation">
141 141
   <div class="container">
@@ -154,12 +154,12 @@  discard block
 block discarded – undo
154 154
 
155 155
 <?php
156 156
 if (isset($top_header)) {
157
-    if ($top_header != "")
158
-    {
157
+	if ($top_header != "")
158
+	{
159 159
 	print '<div class="top-header container clear" role="main">';
160 160
 		print '<img src="../images/'.$top_header.'" alt="'.$title.'" title="'.$title.'" />';
161 161
 	print '</div>';
162
-    }
162
+	}
163 163
 }
164 164
 ?>
165 165
 
Please login to merge, or discard this patch.
install/class.create_db.php 1 patch
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -6,27 +6,27 @@  discard block
 block discarded – undo
6 6
 	public static function import_file($filename) {
7 7
 		$filename = filter_var($filename,FILTER_SANITIZE_STRING);
8 8
 		$Connection = new Connection();
9
-                //Connection::$db->beginTransaction();
10
-                 $templine = '';
11
-                 $lines = file($filename);
12
-                 foreach ($lines as $line)
13
-                 {
14
-                	if (substr($line,0,2) == '--' || $line == '') continue;
15
-                	$templine .= $line;
16
-                	if (substr(trim($line), -1,1) == ';')
17
-                	{
18
-                		try {
19
-                			$sth = $Connection->db->prepare($templine);
9
+				//Connection::$db->beginTransaction();
10
+				 $templine = '';
11
+				 $lines = file($filename);
12
+				 foreach ($lines as $line)
13
+				 {
14
+					if (substr($line,0,2) == '--' || $line == '') continue;
15
+					$templine .= $line;
16
+					if (substr(trim($line), -1,1) == ';')
17
+					{
18
+						try {
19
+							$sth = $Connection->db->prepare($templine);
20 20
 					$sth->execute();
21
-                    		} catch(PDOException $e) {
21
+							} catch(PDOException $e) {
22 22
 					return "error (import ".$filename.") : ".$e->getMessage()."\n";
23
-                    		}
24
-                		$templine = '';
25
-                	}
23
+							}
24
+						$templine = '';
25
+					}
26 26
 		}
27
-                //Connection::$db->commit();
28
-                $Connection->db = null;
29
-                return '';
27
+				//Connection::$db->commit();
28
+				$Connection->db = null;
29
+				return '';
30 30
 	}
31 31
 
32 32
 	public static function import_all_db($directory) {
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 		//foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($directory)) as $filename)
36 36
 		while(false !== ($filename = readdir($dh)))
37 37
 		{
38
-		    if (preg_match('/\.sql$/',$filename)) $error .= create_db::import_file($directory.$filename);
38
+			if (preg_match('/\.sql$/',$filename)) $error .= create_db::import_file($directory.$filename);
39 39
 		}
40 40
 		return $error;
41 41
 	}
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 		$host = filter_var($host,FILTER_SANITIZE_STRING);
51 51
 		// Dirty hack
52 52
 		if ($host != 'localhost' && $host != '127.0.0.1') {
53
-		    $grantright = $_SERVER['SERVER_ADDR'];
53
+			$grantright = $_SERVER['SERVER_ADDR'];
54 54
 		} else $grantright = 'localhost';
55 55
 		try {
56 56
 			$dbh = new PDO($db_type.':host='.$host,$root,$root_pass);
Please login to merge, or discard this patch.
install/index.php 1 patch
Indentation   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 	}
86 86
 	print '</ul>You <strong>must</strong> add these modules.</div>';
87 87
 	require('../footer.php');
88
-        exit;
88
+		exit;
89 89
 }
90 90
 
91 91
 if (!isset($_SESSION['install']) && !isset($_POST['dbtype']) && (count($error) == 0)) {
@@ -287,14 +287,14 @@  discard block
 block discarded – undo
287 287
 					<th>Source name</th>
288 288
 				</tr>
289 289
 		<?php
290
-		    require_once(dirname(__FILE__).'/../require/class.Connection.php');
291
-		    $Connection = new Connection();
292
-		    if ($Connection->db != NULL) {
290
+			require_once(dirname(__FILE__).'/../require/class.Connection.php');
291
+			$Connection = new Connection();
292
+			if ($Connection->db != NULL) {
293 293
 			if ($Connection->tableExists('source_location')) {
294
-			    require_once(dirname(__FILE__).'/../require/class.Source.php');
295
-			    $Source = new Source();
296
-			    $alllocations = $Source->getAllLocationInfo();
297
-			    foreach ($alllocations as $location) {
294
+				require_once(dirname(__FILE__).'/../require/class.Source.php');
295
+				$Source = new Source();
296
+				$alllocations = $Source->getAllLocationInfo();
297
+				foreach ($alllocations as $location) {
298 298
 		?>
299 299
 				<tr>
300 300
 	    				<input type="hidden" name="source_id[]" value="<?php print $location['id']; ?>" />
@@ -308,9 +308,9 @@  discard block
 block discarded – undo
308 308
 				</tr>
309 309
 		
310 310
 		<?php
311
-			    }
311
+				}
312
+			}
312 313
 			}
313
-		    }
314 314
 		?>
315 315
 
316 316
 				<tr>
@@ -495,12 +495,12 @@  discard block
 block discarded – undo
495 495
 ?>
496 496
 							<tr>
497 497
 								<?php
498
-								    if (filter_var($source['host'],FILTER_VALIDATE_URL)) {
498
+									if (filter_var($source['host'],FILTER_VALIDATE_URL)) {
499 499
 								?>
500 500
 								<td><input type="text" name="host[]" id="host" value="<?php print $source['host']; ?>" /></td>
501 501
 								<td><input type="number" name="port[]" id="port" value="<?php print $source['port']; ?>" /></td>
502 502
 								<?php
503
-								    } else {
503
+									} else {
504 504
 									$hostport = explode(':',$source['host']);
505 505
 									if (isset($hostport[1])) {
506 506
 										$host = $hostport[0];
@@ -513,7 +513,7 @@  discard block
 block discarded – undo
513 513
 								<td><input type="text" name="host[]" id="host" value="<?php print $host; ?>" /></td>
514 514
 								<td><input type="number" name="port[]" id="port" value="<?php print $port; ?>" /></td>
515 515
 								<?php
516
-								    }
516
+									}
517 517
 								?>
518 518
 								<td>
519 519
 									<select name="format[]" id="format">
@@ -788,7 +788,7 @@  discard block
 block discarded – undo
788 788
 			<br />
789 789
 			<p>
790 790
 			<?php 
791
-			    if (extension_loaded('gd') && function_exists('gd_info')) {
791
+				if (extension_loaded('gd') && function_exists('gd_info')) {
792 792
 			?>
793 793
 				<label for="aircrafticoncolor">Color of aircraft icon on map</label>
794 794
 				<input type="color" name="aircrafticoncolor" id="aircrafticoncolor" value="#<?php if (isset($globalAircraftIconColor)) echo $globalAircraftIconColor; else echo '1a3151'; ?>" />
@@ -798,11 +798,11 @@  discard block
 block discarded – undo
798 798
 				<b>The directory cache is not writable, aircraft icon will not be cached</b>
799 799
 			<?php
800 800
 				}
801
-			    } else {
801
+				} else {
802 802
 			?>
803 803
 				<b>PHP GD is not installed, you can t change color of aircraft icon on map</b>
804 804
 			<?php
805
-			    }
805
+				}
806 806
 			?>
807 807
 			</p>
808 808
 			<br />
@@ -821,7 +821,7 @@  discard block
 block discarded – undo
821 821
 	</p>
822 822
 <?php
823 823
 	require('../footer.php');
824
-        exit;
824
+		exit;
825 825
 }
826 826
 	
827 827
 $settings = array();
@@ -904,8 +904,8 @@  discard block
 block discarded – undo
904 904
 	
905 905
 	$sources = array();
906 906
 	foreach ($source_name as $keys => $name) {
907
-	    if (isset($source_id[$keys])) $sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'id' => $source_id[$keys],'source' => $source_ref[$keys]);
908
-	    else $sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'source' => $source_ref[$keys]);
907
+		if (isset($source_id[$keys])) $sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'id' => $source_id[$keys],'source' => $source_ref[$keys]);
908
+		else $sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'source' => $source_ref[$keys]);
909 909
 	}
910 910
 	if (count($sources) > 0) $_SESSION['sources'] = $sources;
911 911
 
@@ -1157,14 +1157,14 @@  discard block
 block discarded – undo
1157 1157
 
1158 1158
 	// Set some defaults values...
1159 1159
 	if (!isset($globalAircraftImageSources)) {
1160
-	    $globalAircraftImageSources = array('ivaomtl','wikimedia','airportdata','deviantart','flickr','bing','jetphotos','planepictures','planespotters');
1161
-	    $settings = array_merge($settings,array('globalAircraftImageSources' => $globalAircraftImageSources));
1160
+		$globalAircraftImageSources = array('ivaomtl','wikimedia','airportdata','deviantart','flickr','bing','jetphotos','planepictures','planespotters');
1161
+		$settings = array_merge($settings,array('globalAircraftImageSources' => $globalAircraftImageSources));
1162 1162
 	}
1163 1163
 
1164 1164
 	if (!isset($globalSchedulesSources)) {
1165
-	    $globalSchedulesSources = array('flightmapper','costtotravel','flightradar24','flightaware');
1166
-    	    $settings = array_merge($settings,array('globalSchedulesSources' => $globalSchedulesSources));
1167
-    	}
1165
+		$globalSchedulesSources = array('flightmapper','costtotravel','flightradar24','flightaware');
1166
+			$settings = array_merge($settings,array('globalSchedulesSources' => $globalSchedulesSources));
1167
+		}
1168 1168
 
1169 1169
 	$settings = array_merge($settings,array('globalInstalled' => 'TRUE'));
1170 1170
 
@@ -1198,12 +1198,12 @@  discard block
 block discarded – undo
1198 1198
 	print '<ul><div id="step">';
1199 1199
 	$pop = false;
1200 1200
 	foreach ($_SESSION['done'] as $done) {
1201
-	    print '<li>'.$done.'....<strong>SUCCESS</strong></li>';
1202
-	    if ($done == 'Create database') $pop = true;
1201
+		print '<li>'.$done.'....<strong>SUCCESS</strong></li>';
1202
+		if ($done == 'Create database') $pop = true;
1203 1203
 	}
1204 1204
 	if ($pop) {
1205
-	    sleep(5);
1206
-	    print '<li>Create and import tables....<img src="../images/loading.gif" /></li>';
1205
+		sleep(5);
1206
+		print '<li>Create and import tables....<img src="../images/loading.gif" /></li>';
1207 1207
 	} else print '<li>Update schema if needed....<img src="../images/loading.gif" /></li>';
1208 1208
 	print '</div></ul>';
1209 1209
 	print '<div id="error"></div>';
@@ -1265,7 +1265,7 @@  discard block
 block discarded – undo
1265 1265
 	unset($_COOKIE['install']);
1266 1266
 	print '<div class="info column"><ul>';
1267 1267
 	foreach ($_SESSION['done'] as $done) {
1268
-	    print '<li>'.$done.'....<strong>SUCCESS</strong></li>';
1268
+		print '<li>'.$done.'....<strong>SUCCESS</strong></li>';
1269 1269
 	}
1270 1270
 	print '<li>Reloading page to check all is now ok....<strong>SUCCESS</strong></li>';
1271 1271
 	print '</ul></div>';
Please login to merge, or discard this patch.
install/install-action.php 1 patch
Indentation   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -68,27 +68,27 @@  discard block
 block discarded – undo
68 68
 } else if (isset($_SESSION['install']) && $_SESSION['install'] == 'database_import') {
69 69
 	if (update_schema::check_version(false) == '0') {
70 70
 		if ($globalDBdriver == 'mysql') {
71
-		    $error .= create_db::import_all_db('../db/');
71
+			$error .= create_db::import_all_db('../db/');
72 72
 		} elseif ($globalDBdriver == 'pgsql') {
73
-		    $error .= create_db::import_all_db('../db/pgsql/');
73
+			$error .= create_db::import_all_db('../db/pgsql/');
74 74
 		}
75 75
 		if ($error != '') {
76
-                        $_SESSION['error'] = $error;
76
+						$_SESSION['error'] = $error;
77 77
 		}
78 78
 		$_SESSION['done'] = array_merge($_SESSION['done'],array('Create and import tables'));
79 79
 		if ($globalSBS1 && !$globalIVAO && !$globalVATSIM && !$globalphpVMS) {
80 80
 			$_SESSION['install'] = 'populate';
81 81
 			$_SESSION['next'] = 'Populate aircraft_modes table with externals data for ADS-B';
82 82
 		} else {
83
-		    $_SESSION['install'] = 'sources';
84
-		    $_SESSION['next'] = 'Insert data in source table';
83
+			$_SESSION['install'] = 'sources';
84
+			$_SESSION['next'] = 'Insert data in source table';
85 85
 		}
86 86
 		$result = array('error' => $error,'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']);
87 87
 		print json_encode($result);
88 88
 	} else {
89 89
 		$error .= update_schema::check_version(true);
90 90
 		if ($error != '') {
91
-                        $_SESSION['error'] = $error;
91
+						$_SESSION['error'] = $error;
92 92
 		}
93 93
 		$_SESSION['done'] = array_merge($_SESSION['done'],array('Update schema if needed'));
94 94
 		$_SESSION['install'] = 'sources';
@@ -118,25 +118,25 @@  discard block
 block discarded – undo
118 118
 	$error .= update_db::update_countries();
119 119
 	$_SESSION['done'] = array_merge($_SESSION['done'],array('Populate countries database'));
120 120
 	if (isset($globalNOTAM) && $globalNOTAM && isset($globalNOTAMSource) && $globalNOTAMSource != '') {
121
-	    $_SESSION['install'] = 'notam';
122
-	    $_SESSION['next'] = 'Populate NOTAM table with externals data';
123
-	    $result = array('error' => $error,'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']);
124
-	    print json_encode($result);
121
+		$_SESSION['install'] = 'notam';
122
+		$_SESSION['next'] = 'Populate NOTAM table with externals data';
123
+		$result = array('error' => $error,'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']);
124
+		print json_encode($result);
125 125
 	} elseif (isset($_SESSION['owner']) && $_SESSION['owner'] == 1) {
126
-	    $_SESSION['install'] = 'owner';
127
-	    $_SESSION['next'] = 'Populate owner table with externals data';
128
-	    unset($_SESSION['owner']);
129
-	    $result = array('error' => $error,'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']);
130
-	    print json_encode($result);
126
+		$_SESSION['install'] = 'owner';
127
+		$_SESSION['next'] = 'Populate owner table with externals data';
128
+		unset($_SESSION['owner']);
129
+		$result = array('error' => $error,'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']);
130
+		print json_encode($result);
131 131
 	} else {
132
-	    $_SESSION['install'] = 'sources';
133
-	    $_SESSION['next'] = 'Insert data in source table';
134
-	    $result = array('error' => $error,'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']);
135
-	    print json_encode($result);
132
+		$_SESSION['install'] = 'sources';
133
+		$_SESSION['next'] = 'Insert data in source table';
134
+		$result = array('error' => $error,'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']);
135
+		print json_encode($result);
136 136
 	}
137 137
 } else if (isset($_SESSION['install']) && $_SESSION['install'] == 'populate') {
138 138
 	if (!is_writable('tmp')) {
139
-                $error = 'The directory <i>install/tmp</i> must be writable.';
139
+				$error = 'The directory <i>install/tmp</i> must be writable.';
140 140
 		$result = array('error' => $error,'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']);
141 141
 		print json_encode($result);
142 142
 	} else {
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
 	}
153 153
 } else if (isset($_SESSION['install']) && $_SESSION['install'] == 'populate_flarm') {
154 154
 	if (!is_writable('tmp')) {
155
-                $error = 'The directory <i>install/tmp</i> must be writable.';
155
+				$error = 'The directory <i>install/tmp</i> must be writable.';
156 156
 		$result = array('error' => $error,'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']);
157 157
 		print json_encode($result);
158 158
 	} else {
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
 	}
186 186
 } else if (isset($_SESSION['install']) && $_SESSION['install'] == 'routes') {
187 187
 	if (!is_writable('tmp')) {
188
-                $error = 'The directory <i>install/tmp</i> must be writable.';
188
+				$error = 'The directory <i>install/tmp</i> must be writable.';
189 189
 		$result = array('error' => $error,'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']);
190 190
 		print json_encode($result);
191 191
 	} else {
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
 	}
201 201
 } else if (isset($_SESSION['install']) && $_SESSION['install'] == 'translation') {
202 202
 	if (!is_writable('tmp')) {
203
-                $error = 'The directory <i>install/tmp</i> must be writable.';
203
+				$error = 'The directory <i>install/tmp</i> must be writable.';
204 204
 		$result = array('error' => $error,'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']);
205 205
 		print json_encode($result);
206 206
 	} else {
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
 	}
230 230
 } else if (isset($_SESSION['install']) && $_SESSION['install'] == 'owner') {
231 231
 	if (!is_writable('tmp')) {
232
-                $error = 'The directory <i>install/tmp</i> must be writable.';
232
+				$error = 'The directory <i>install/tmp</i> must be writable.';
233 233
 		$result = array('error' => $error,'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']);
234 234
 		print json_encode($result);
235 235
 	} else {
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
 	}
245 245
 } else if (isset($_SESSION['install']) && $_SESSION['install'] == 'notam') {
246 246
 	if (!is_writable('tmp')) {
247
-                $error = 'The directory <i>install/tmp</i> must be writable.';
247
+				$error = 'The directory <i>install/tmp</i> must be writable.';
248 248
 		$result = array('error' => $error,'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']);
249 249
 		print json_encode($result);
250 250
 	} else {
@@ -296,17 +296,17 @@  discard block
 block discarded – undo
296 296
 */
297 297
 } else if (isset($_SESSION['install']) && $_SESSION['install'] == 'sources') {
298 298
 	if (isset($_SESSION['sources']) && count($_SESSION['sources']) > 0) {
299
-	    $sources = $_SESSION['sources'];
299
+		$sources = $_SESSION['sources'];
300 300
 
301
-	    include_once('../require/class.Source.php');
302
-	    $globalDebug = FALSE;
303
-	    $Source = new Source();
304
-	    $Source->deleteAllLocation();
305
-	    foreach ($sources as $src) {
301
+		include_once('../require/class.Source.php');
302
+		$globalDebug = FALSE;
303
+		$Source = new Source();
304
+		$Source->deleteAllLocation();
305
+		foreach ($sources as $src) {
306 306
 		if (isset($src['latitude']) && $src['latitude'] != '') $Source->addLocation($src['name'],$src['latitude'],$src['longitude'],$src['altitude'],$src['city'],$src['country'],$src['source'],'antenna.png');
307
-	    }
308
-	    $_SESSION['done'] = array_merge($_SESSION['done'],array('Insert data in source table'));
309
-	    unset($_SESSION['sources']);
307
+		}
308
+		$_SESSION['done'] = array_merge($_SESSION['done'],array('Insert data in source table'));
309
+		unset($_SESSION['sources']);
310 310
 	}
311 311
 	/*
312 312
 	if (isset($globalIVAO) && $globalIVAO) $_SESSION['install'] = 'ivao';
Please login to merge, or discard this patch.
install/update_arrival_airport.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -4,13 +4,13 @@
 block discarded – undo
4 4
  *    This Script will try to find all real arrival airports for all flights in DB
5 5
  *
6 6
 */
7
-    require_once('../require/settings.php');
8
-    if ($globalInstalled) {
9
-        echo '$globalInstalled must be set to FALSE in require/settings.php';
10
-        exit;
11
-    }
12
-    require('../require/class.Spotter.php');
13
-    $Spotter = new Spotter();
14
-    $Spotter->updateArrivalAirports();
7
+	require_once('../require/settings.php');
8
+	if ($globalInstalled) {
9
+		echo '$globalInstalled must be set to FALSE in require/settings.php';
10
+		exit;
11
+	}
12
+	require('../require/class.Spotter.php');
13
+	$Spotter = new Spotter();
14
+	$Spotter->updateArrivalAirports();
15 15
 
16 16
 ?>
17 17
\ No newline at end of file
Please login to merge, or discard this patch.
install/class.update_db.php 1 patch
Indentation   +305 added lines, -305 removed lines patch added patch discarded remove patch
@@ -70,38 +70,38 @@  discard block
 block discarded – undo
70 70
 		try {
71 71
 			//$Connection = new Connection();
72 72
 			$sth = $Connection->db->prepare($query);
73
-                        $sth->execute(array(':source' => $database_file));
74
-                } catch(PDOException $e) {
75
-                        return "error : ".$e->getMessage();
76
-                }
73
+						$sth->execute(array(':source' => $database_file));
74
+				} catch(PDOException $e) {
75
+						return "error : ".$e->getMessage();
76
+				}
77 77
 
78
-    		if ($globalDebug) echo " - Add routes to DB -";
79
-    		update_db::connect_sqlite($database_file);
78
+			if ($globalDebug) echo " - Add routes to DB -";
79
+			update_db::connect_sqlite($database_file);
80 80
 		//$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';
81 81
 		$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";
82 82
 		try {
83
-                        $sth = update_db::$db_sqlite->prepare($query);
84
-                        $sth->execute();
85
-                } catch(PDOException $e) {
86
-                        return "error : ".$e->getMessage();
87
-                }
83
+						$sth = update_db::$db_sqlite->prepare($query);
84
+						$sth->execute();
85
+				} catch(PDOException $e) {
86
+						return "error : ".$e->getMessage();
87
+				}
88 88
 		//$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)';
89 89
 		$query_dest = 'INSERT INTO routes (CallSign,Operator_ICAO,FromAirport_ICAO,ToAirport_ICAO,RouteStop,Source) VALUES (:CallSign, :Operator_ICAO, :FromAirport_ICAO, :ToAirport_ICAO, :routestop, :source)';
90 90
 		$Connection = new Connection();
91 91
 		$sth_dest = $Connection->db->prepare($query_dest);
92 92
 		try {
93 93
 			if ($globalTransaction) $Connection->db->beginTransaction();
94
-            		while ($values = $sth->fetch(PDO::FETCH_ASSOC)) {
94
+					while ($values = $sth->fetch(PDO::FETCH_ASSOC)) {
95 95
 				//$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);
96 96
 				$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);
97 97
 				$sth_dest->execute($query_dest_values);
98
-            		}
98
+					}
99 99
 			if ($globalTransaction) $Connection->db->commit();
100 100
 		} catch(PDOException $e) {
101 101
 			if ($globalTransaction) $Connection->db->rollBack(); 
102 102
 			return "error : ".$e->getMessage();
103 103
 		}
104
-                return '';
104
+				return '';
105 105
 	}
106 106
 	public static function retrieve_modes_sqlite_to_dest($database_file) {
107 107
 		global $globalTransaction;
@@ -110,27 +110,27 @@  discard block
 block discarded – undo
110 110
 		try {
111 111
 			$Connection = new Connection();
112 112
 			$sth = $Connection->db->prepare($query);
113
-                        $sth->execute(array(':source' => $database_file));
114
-                } catch(PDOException $e) {
115
-                        return "error : ".$e->getMessage();
116
-                }
113
+						$sth->execute(array(':source' => $database_file));
114
+				} catch(PDOException $e) {
115
+						return "error : ".$e->getMessage();
116
+				}
117 117
 		$query = "DELETE FROM aircraft_owner WHERE Source = '' OR Source IS NULL OR Source = :source";
118 118
 		try {
119 119
 			$Connection = new Connection();
120 120
 			$sth = $Connection->db->prepare($query);
121
-                        $sth->execute(array(':source' => $database_file));
122
-                } catch(PDOException $e) {
123
-                        return "error : ".$e->getMessage();
124
-                }
121
+						$sth->execute(array(':source' => $database_file));
122
+				} catch(PDOException $e) {
123
+						return "error : ".$e->getMessage();
124
+				}
125 125
 
126
-    		update_db::connect_sqlite($database_file);
126
+			update_db::connect_sqlite($database_file);
127 127
 		$query = 'select * from Aircraft';
128 128
 		try {
129
-                        $sth = update_db::$db_sqlite->prepare($query);
130
-                        $sth->execute();
131
-                } catch(PDOException $e) {
132
-                        return "error : ".$e->getMessage();
133
-                }
129
+						$sth = update_db::$db_sqlite->prepare($query);
130
+						$sth->execute();
131
+				} catch(PDOException $e) {
132
+						return "error : ".$e->getMessage();
133
+				}
134 134
 		//$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)';
135 135
 		$query_dest = 'INSERT INTO aircraft_modes (LastModified, ModeS,ModeSCountry,Registration,ICAOTypeCode,type_flight,Source) VALUES (:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:type,:source)';
136 136
 		
@@ -141,17 +141,17 @@  discard block
 block discarded – undo
141 141
 		$sth_dest_owner = $Connection->db->prepare($query_dest_owner);
142 142
 		try {
143 143
 			if ($globalTransaction) $Connection->db->beginTransaction();
144
-            		while ($values = $sth->fetch(PDO::FETCH_ASSOC)) {
144
+					while ($values = $sth->fetch(PDO::FETCH_ASSOC)) {
145 145
 			//$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']);
146 146
 				if ($values['UserString4'] == 'M') $type = 'military';
147 147
 				else $type = null;
148 148
 				$query_dest_values = array(':LastModified' => $values['LastModified'],':ModeS' => $values['ModeS'],':ModeSCountry' => $values['ModeSCountry'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':source' => $database_file,':type' => $type);
149 149
 				$sth_dest->execute($query_dest_values);
150 150
 				if ($values['RegisteredOwners'] != '' && $values['RegisteredOwners'] != NULL && $values['RegisteredOwners'] != 'Private') {
151
-				    $query_dest_owner_values = array(':registration' => $values['Registration'],':source' => $database_file,':owner' => $values['RegisteredOwners']);
152
-				    $sth_dest_owner->execute($query_dest_owner_values);
151
+					$query_dest_owner_values = array(':registration' => $values['Registration'],':source' => $database_file,':owner' => $values['RegisteredOwners']);
152
+					$sth_dest_owner->execute($query_dest_owner_values);
153 153
 				}
154
-            		}
154
+					}
155 155
 			if ($globalTransaction) $Connection->db->commit();
156 156
 		} catch(PDOException $e) {
157 157
 			return "error : ".$e->getMessage();
@@ -161,10 +161,10 @@  discard block
 block discarded – undo
161 161
 		try {
162 162
 			$Connection = new Connection();
163 163
 			$sth = $Connection->db->prepare($query);
164
-                        $sth->execute(array(':source' => $database_file));
165
-                } catch(PDOException $e) {
166
-                        return "error : ".$e->getMessage();
167
-                }
164
+						$sth->execute(array(':source' => $database_file));
165
+				} catch(PDOException $e) {
166
+						return "error : ".$e->getMessage();
167
+				}
168 168
 		return '';
169 169
 	}
170 170
 
@@ -176,10 +176,10 @@  discard block
 block discarded – undo
176 176
 		try {
177 177
 			$Connection = new Connection();
178 178
 			$sth = $Connection->db->prepare($query);
179
-                        $sth->execute(array(':source' => $database_file));
180
-                } catch(PDOException $e) {
181
-                        return "error : ".$e->getMessage();
182
-                }
179
+						$sth->execute(array(':source' => $database_file));
180
+				} catch(PDOException $e) {
181
+						return "error : ".$e->getMessage();
182
+				}
183 183
 		
184 184
 		if ($fh = fopen($database_file,"r")) {
185 185
 			//$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)';
@@ -189,25 +189,25 @@  discard block
 block discarded – undo
189 189
 			$sth_dest = $Connection->db->prepare($query_dest);
190 190
 			try {
191 191
 				if ($globalTransaction) $Connection->db->beginTransaction();
192
-            			while (!feof($fh)) {
193
-            				$line = $Common->hex2str(fgets($fh,9999));
192
+						while (!feof($fh)) {
193
+							$line = $Common->hex2str(fgets($fh,9999));
194 194
 					//FFFFFF                     RIDEAU VALLEY SOARINGASW-20               C-FBKN MZ 123.400
195
-            				$values['ModeS'] = substr($line,0,6);
196
-            				$values['Registration'] = trim(substr($line,69,6));
197
-            				$aircraft_name = trim(substr($line,48,6));
198
-            				// Check if we can find ICAO, else set it to GLID
199
-            				$aircraft_name_split = explode(' ',$aircraft_name);
200
-            				$search_more = '';
201
-            				if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'";
202
-            				$query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more;
203
-            				$sth_search = $Connection->db->prepare($query_search);
195
+							$values['ModeS'] = substr($line,0,6);
196
+							$values['Registration'] = trim(substr($line,69,6));
197
+							$aircraft_name = trim(substr($line,48,6));
198
+							// Check if we can find ICAO, else set it to GLID
199
+							$aircraft_name_split = explode(' ',$aircraft_name);
200
+							$search_more = '';
201
+							if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'";
202
+							$query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more;
203
+							$sth_search = $Connection->db->prepare($query_search);
204 204
 					try {
205
-                                    		$sth_search->execute();
206
-	            				$result = $sth_search->fetch(PDO::FETCH_ASSOC);
207
-	            				//if (count($result) > 0) {
208
-	            				if (isset($result['icao']) && $result['icao'] != '') {
209
-	            				    $values['ICAOTypeCode'] = $result['icao'];
210
-	            				} 
205
+											$sth_search->execute();
206
+								$result = $sth_search->fetch(PDO::FETCH_ASSOC);
207
+								//if (count($result) > 0) {
208
+								if (isset($result['icao']) && $result['icao'] != '') {
209
+									$values['ICAOTypeCode'] = $result['icao'];
210
+								} 
211 211
 					} catch(PDOException $e) {
212 212
 						return "error : ".$e->getMessage();
213 213
 					}
@@ -230,10 +230,10 @@  discard block
 block discarded – undo
230 230
 		try {
231 231
 			$Connection = new Connection();
232 232
 			$sth = $Connection->db->prepare($query);
233
-                        $sth->execute(array(':source' => $database_file));
234
-                } catch(PDOException $e) {
235
-                        return "error : ".$e->getMessage();
236
-                }
233
+						$sth->execute(array(':source' => $database_file));
234
+				} catch(PDOException $e) {
235
+						return "error : ".$e->getMessage();
236
+				}
237 237
 		return '';
238 238
 	}
239 239
 
@@ -244,10 +244,10 @@  discard block
 block discarded – undo
244 244
 		try {
245 245
 			$Connection = new Connection();
246 246
 			$sth = $Connection->db->prepare($query);
247
-                        $sth->execute(array(':source' => $database_file));
248
-                } catch(PDOException $e) {
249
-                        return "error : ".$e->getMessage();
250
-                }
247
+						$sth->execute(array(':source' => $database_file));
248
+				} catch(PDOException $e) {
249
+						return "error : ".$e->getMessage();
250
+				}
251 251
 		
252 252
 		if ($fh = fopen($database_file,"r")) {
253 253
 			//$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)';
@@ -258,24 +258,24 @@  discard block
 block discarded – undo
258 258
 			try {
259 259
 				if ($globalTransaction) $Connection->db->beginTransaction();
260 260
 				$tmp = fgetcsv($fh,9999,',',"'");
261
-            			while (!feof($fh)) {
262
-            				$line = fgetcsv($fh,9999,',',"'");
261
+						while (!feof($fh)) {
262
+							$line = fgetcsv($fh,9999,',',"'");
263 263
             				
264 264
 					//FFFFFF                     RIDEAU VALLEY SOARINGASW-20               C-FBKN MZ 123.400
265 265
 					//print_r($line);
266
-            				$values['ModeS'] = $line[1];
267
-            				$values['Registration'] = $line[3];
268
-            				$aircraft_name = $line[2];
269
-            				// Check if we can find ICAO, else set it to GLID
270
-            				$aircraft_name_split = explode(' ',$aircraft_name);
271
-            				$search_more = '';
272
-            				if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'";
273
-            				$query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more;
274
-            				$sth_search = $Connection->db->prepare($query_search);
266
+							$values['ModeS'] = $line[1];
267
+							$values['Registration'] = $line[3];
268
+							$aircraft_name = $line[2];
269
+							// Check if we can find ICAO, else set it to GLID
270
+							$aircraft_name_split = explode(' ',$aircraft_name);
271
+							$search_more = '';
272
+							if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'";
273
+							$query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more;
274
+							$sth_search = $Connection->db->prepare($query_search);
275 275
 					try {
276
-                                    		$sth_search->execute();
277
-	            				$result = $sth_search->fetch(PDO::FETCH_ASSOC);
278
-	            				if (isset($result['icao']) && $result['icao'] != '') $values['ICAOTypeCode'] = $result['icao'];
276
+											$sth_search->execute();
277
+								$result = $sth_search->fetch(PDO::FETCH_ASSOC);
278
+								if (isset($result['icao']) && $result['icao'] != '') $values['ICAOTypeCode'] = $result['icao'];
279 279
 					} catch(PDOException $e) {
280 280
 						return "error : ".$e->getMessage();
281 281
 					}
@@ -298,10 +298,10 @@  discard block
 block discarded – undo
298 298
 		try {
299 299
 			$Connection = new Connection();
300 300
 			$sth = $Connection->db->prepare($query);
301
-                        $sth->execute(array(':source' => $database_file));
302
-                } catch(PDOException $e) {
303
-                        return "error : ".$e->getMessage();
304
-                }
301
+						$sth->execute(array(':source' => $database_file));
302
+				} catch(PDOException $e) {
303
+						return "error : ".$e->getMessage();
304
+				}
305 305
 		return '';
306 306
 	}
307 307
 
@@ -312,10 +312,10 @@  discard block
 block discarded – undo
312 312
 		try {
313 313
 			$Connection = new Connection();
314 314
 			$sth = $Connection->db->prepare($query);
315
-                        $sth->execute(array(':source' => $database_file));
316
-                } catch(PDOException $e) {
317
-                        return "error : ".$e->getMessage();
318
-                }
315
+						$sth->execute(array(':source' => $database_file));
316
+				} catch(PDOException $e) {
317
+						return "error : ".$e->getMessage();
318
+				}
319 319
 		
320 320
 		if ($fh = fopen($database_file,"r")) {
321 321
 			//$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)';
@@ -326,94 +326,94 @@  discard block
 block discarded – undo
326 326
 			try {
327 327
 				if ($globalTransaction) $Connection->db->beginTransaction();
328 328
 				$tmp = fgetcsv($fh,9999,',','"');
329
-            			while (!feof($fh)) {
330
-            				$line = fgetcsv($fh,9999,',','"');
331
-            				//print_r($line);
332
-            				if ($country == 'F') {
333
-            				    $values['registration'] = $line[0];
334
-            				    $values['base'] = $line[4];
335
-            				    $values['owner'] = $line[5];
336
-            				    if ($line[6] == '') $values['date_first_reg'] = '';
337
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6]));
338
-					    $values['cancel'] = $line[7];
329
+						while (!feof($fh)) {
330
+							$line = fgetcsv($fh,9999,',','"');
331
+							//print_r($line);
332
+							if ($country == 'F') {
333
+								$values['registration'] = $line[0];
334
+								$values['base'] = $line[4];
335
+								$values['owner'] = $line[5];
336
+								if ($line[6] == '') $values['date_first_reg'] = '';
337
+						else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6]));
338
+						$values['cancel'] = $line[7];
339 339
 					} elseif ($country == 'EI') {
340
-					    // TODO : add modeS & reg to aircraft_modes
341
-            				    $values['registration'] = $line[0];
342
-            				    $values['base'] = $line[3];
343
-            				    $values['owner'] = $line[2];
344
-            				    if ($line[1] == '') $values['date_first_reg'] = '';
345
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[1]));
346
-					    $values['cancel'] = '';
340
+						// TODO : add modeS & reg to aircraft_modes
341
+								$values['registration'] = $line[0];
342
+								$values['base'] = $line[3];
343
+								$values['owner'] = $line[2];
344
+								if ($line[1] == '') $values['date_first_reg'] = '';
345
+						else $values['date_first_reg'] = date("Y-m-d",strtotime($line[1]));
346
+						$values['cancel'] = '';
347 347
 					} elseif ($country == 'HB') {
348
-					    // TODO : add modeS & reg to aircraft_modes
349
-            				    $values['registration'] = $line[0];
350
-            				    $values['base'] = null;
351
-            				    $values['owner'] = $line[5];
352
-            				    $values['date_first_reg'] = '';
353
-					    $values['cancel'] = '';
348
+						// TODO : add modeS & reg to aircraft_modes
349
+								$values['registration'] = $line[0];
350
+								$values['base'] = null;
351
+								$values['owner'] = $line[5];
352
+								$values['date_first_reg'] = '';
353
+						$values['cancel'] = '';
354 354
 					} elseif ($country == 'OK') {
355
-					    // TODO : add modeS & reg to aircraft_modes
356
-            				    $values['registration'] = $line[3];
357
-            				    $values['base'] = null;
358
-            				    $values['owner'] = $line[5];
359
-            				    if ($line[18] == '') $values['date_first_reg'] = '';
360
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[18]));
361
-					    $values['cancel'] = '';
355
+						// TODO : add modeS & reg to aircraft_modes
356
+								$values['registration'] = $line[3];
357
+								$values['base'] = null;
358
+								$values['owner'] = $line[5];
359
+								if ($line[18] == '') $values['date_first_reg'] = '';
360
+						else $values['date_first_reg'] = date("Y-m-d",strtotime($line[18]));
361
+						$values['cancel'] = '';
362 362
 					} elseif ($country == 'VH') {
363
-					    // TODO : add modeS & reg to aircraft_modes
364
-            				    $values['registration'] = $line[0];
365
-            				    $values['base'] = null;
366
-            				    $values['owner'] = $line[12];
367
-            				    if ($line[28] == '') $values['date_first_reg'] = '';
368
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[28]));
369
-
370
-					    $values['cancel'] = $line[39];
363
+						// TODO : add modeS & reg to aircraft_modes
364
+								$values['registration'] = $line[0];
365
+								$values['base'] = null;
366
+								$values['owner'] = $line[12];
367
+								if ($line[28] == '') $values['date_first_reg'] = '';
368
+						else $values['date_first_reg'] = date("Y-m-d",strtotime($line[28]));
369
+
370
+						$values['cancel'] = $line[39];
371 371
 					} elseif ($country == 'OE' || $country == '9A' || $country == 'VP' || $country == 'LX' || $country == 'P2' || $country == 'HC') {
372
-            				    $values['registration'] = $line[0];
373
-            				    $values['base'] = null;
374
-            				    $values['owner'] = $line[4];
375
-            				    $values['date_first_reg'] = null;
376
-					    $values['cancel'] = '';
372
+								$values['registration'] = $line[0];
373
+								$values['base'] = null;
374
+								$values['owner'] = $line[4];
375
+								$values['date_first_reg'] = null;
376
+						$values['cancel'] = '';
377 377
 					} elseif ($country == 'CC') {
378
-            				    $values['registration'] = $line[0];
379
-            				    $values['base'] = null;
380
-            				    $values['owner'] = $line[6];
381
-            				    $values['date_first_reg'] = null;
382
-					    $values['cancel'] = '';
378
+								$values['registration'] = $line[0];
379
+								$values['base'] = null;
380
+								$values['owner'] = $line[6];
381
+								$values['date_first_reg'] = null;
382
+						$values['cancel'] = '';
383 383
 					} elseif ($country == 'HJ') {
384
-            				    $values['registration'] = $line[0];
385
-            				    $values['base'] = null;
386
-            				    $values['owner'] = $line[8];
387
-            				    if ($line[7] == '') $values['date_first_reg'] = '';
388
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7]));
389
-					    $values['cancel'] = '';
384
+								$values['registration'] = $line[0];
385
+								$values['base'] = null;
386
+								$values['owner'] = $line[8];
387
+								if ($line[7] == '') $values['date_first_reg'] = '';
388
+						else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7]));
389
+						$values['cancel'] = '';
390 390
 					} elseif ($country == 'PP') {
391
-            				    $values['registration'] = $line[0];
392
-            				    $values['base'] = null;
393
-            				    $values['owner'] = $line[4];
394
-            				    if ($line[6] == '') $values['date_first_reg'] = '';
395
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6]));
396
-					    $values['cancel'] = $line[7];
391
+								$values['registration'] = $line[0];
392
+								$values['base'] = null;
393
+								$values['owner'] = $line[4];
394
+								if ($line[6] == '') $values['date_first_reg'] = '';
395
+						else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6]));
396
+						$values['cancel'] = $line[7];
397 397
 					} elseif ($country == 'E7') {
398
-            				    $values['registration'] = $line[0];
399
-            				    $values['base'] = null;
400
-            				    $values['owner'] = $line[4];
401
-            				    if ($line[5] == '') $values['date_first_reg'] = '';
402
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[5]));
403
-					    $values['cancel'] = '';
398
+								$values['registration'] = $line[0];
399
+								$values['base'] = null;
400
+								$values['owner'] = $line[4];
401
+								if ($line[5] == '') $values['date_first_reg'] = '';
402
+						else $values['date_first_reg'] = date("Y-m-d",strtotime($line[5]));
403
+						$values['cancel'] = '';
404 404
 					} elseif ($country == '8Q') {
405
-            				    $values['registration'] = $line[0];
406
-            				    $values['base'] = null;
407
-            				    $values['owner'] = $line[3];
408
-            				    if ($line[7] == '') $values['date_first_reg'] = '';
409
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7]));
410
-					    $values['cancel'] = '';
405
+								$values['registration'] = $line[0];
406
+								$values['base'] = null;
407
+								$values['owner'] = $line[3];
408
+								if ($line[7] == '') $values['date_first_reg'] = '';
409
+						else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7]));
410
+						$values['cancel'] = '';
411 411
 					} elseif ($country == 'ZK' || $country == 'OM' || $country == 'TF') {
412
-            				    $values['registration'] = $line[0];
413
-            				    $values['base'] = null;
414
-            				    $values['owner'] = $line[3];
415
-            				    $values['date_first_reg'] = '';
416
-					    $values['cancel'] = '';
412
+								$values['registration'] = $line[0];
413
+								$values['base'] = null;
414
+								$values['owner'] = $line[3];
415
+								$values['date_first_reg'] = '';
416
+						$values['cancel'] = '';
417 417
 					}
418 418
 					if ($values['cancel'] == '' && $values['registration'] != null) {
419 419
 						$query_dest_values = array(':registration' => $values['registration'],':base' => $values['base'],':date_first_reg' => $values['date_first_reg'],':owner' => $values['owner'],':source' => $database_file);
@@ -535,20 +535,20 @@  discard block
 block discarded – undo
535 535
 		try {
536 536
 			$Connection = new Connection();
537 537
 			$sth = $Connection->db->prepare($query);
538
-                        $sth->execute();
539
-                } catch(PDOException $e) {
540
-                        return "error : ".$e->getMessage();
541
-                }
538
+						$sth->execute();
539
+				} catch(PDOException $e) {
540
+						return "error : ".$e->getMessage();
541
+				}
542 542
 
543 543
 
544 544
 		$query = 'ALTER TABLE airport DROP INDEX icaoidx';
545 545
 		try {
546 546
 			$Connection = new Connection();
547 547
 			$sth = $Connection->db->prepare($query);
548
-                        $sth->execute();
549
-                } catch(PDOException $e) {
550
-                        return "error : ".$e->getMessage();
551
-                }
548
+						$sth->execute();
549
+				} catch(PDOException $e) {
550
+						return "error : ".$e->getMessage();
551
+				}
552 552
 
553 553
 		$query_dest = "INSERT INTO airport (`airport_id`,`name`,`city`,`country`,`iata`,`icao`,`latitude`,`longitude`,`altitude`,`type`,`home_link`,`wikipedia_link`,`image_thumb`,`image`)
554 554
 		    VALUES (:airport_id, :name, :city, :country, :iata, :icao, :latitude, :longitude, :altitude, :type, :home_link, :wikipedia_link, :image_thumb, :image)";
@@ -614,10 +614,10 @@  discard block
 block discarded – undo
614 614
 		try {
615 615
 			$Connection = new Connection();
616 616
 			$sth = $Connection->db->prepare($query);
617
-                        $sth->execute();
618
-                } catch(PDOException $e) {
619
-                        return "error : ".$e->getMessage();
620
-                }
617
+						$sth->execute();
618
+				} catch(PDOException $e) {
619
+						return "error : ".$e->getMessage();
620
+				}
621 621
 
622 622
 
623 623
 		if ($globalDebug) echo "Insert Not available Airport...\n";
@@ -627,10 +627,10 @@  discard block
 block discarded – undo
627 627
 		try {
628 628
 			$Connection = new Connection();
629 629
 			$sth = $Connection->db->prepare($query);
630
-                        $sth->execute($query_values);
631
-                } catch(PDOException $e) {
632
-                        return "error : ".$e->getMessage();
633
-                }
630
+						$sth->execute($query_values);
631
+				} catch(PDOException $e) {
632
+						return "error : ".$e->getMessage();
633
+				}
634 634
 		$i++;
635 635
 /*
636 636
 		$query = 'DELETE FROM airport WHERE airport_id IN (SELECT * FROM (SELECT min(a.airport_id) FROM airport a GROUP BY a.icao) x)';
@@ -744,7 +744,7 @@  discard block
 block discarded – undo
744 744
 
745 745
 
746 746
 
747
-                return "success";
747
+				return "success";
748 748
 	}
749 749
 	
750 750
 	public static function translation() {
@@ -760,10 +760,10 @@  discard block
 block discarded – undo
760 760
 		try {
761 761
 			$Connection = new Connection();
762 762
 			$sth = $Connection->db->prepare($query);
763
-                        $sth->execute(array(':source' => 'translation.csv'));
764
-                } catch(PDOException $e) {
765
-                        return "error : ".$e->getMessage();
766
-                }
763
+						$sth->execute(array(':source' => 'translation.csv'));
764
+				} catch(PDOException $e) {
765
+						return "error : ".$e->getMessage();
766
+				}
767 767
 
768 768
 		
769 769
 		//update_db::unzip($out_file);
@@ -782,21 +782,21 @@  discard block
 block discarded – undo
782 782
 					$data = $row;
783 783
 					$operator = $data[2];
784 784
 					if ($operator != '' && is_numeric(substr(substr($operator, 0, 3), -1, 1))) {
785
-                                                $airline_array = $Spotter->getAllAirlineInfo(substr($operator, 0, 2));
786
-                                                //echo substr($operator, 0, 2)."\n";;
787
-                                                if (count($airline_array) > 0) {
785
+												$airline_array = $Spotter->getAllAirlineInfo(substr($operator, 0, 2));
786
+												//echo substr($operator, 0, 2)."\n";;
787
+												if (count($airline_array) > 0) {
788 788
 							//print_r($airline_array);
789 789
 							$operator = $airline_array[0]['icao'].substr($operator,2);
790
-                                                }
791
-                                        }
790
+												}
791
+										}
792 792
 					
793 793
 					$operator_correct = $data[3];
794 794
 					if ($operator_correct != '' && is_numeric(substr(substr($operator_correct, 0, 3), -1, 1))) {
795
-                                                $airline_array = $Spotter->getAllAirlineInfo(substr($operator_correct, 0, 2));
796
-                                                if (count($airline_array) > 0) {
797
-                                            		$operator_correct = $airline_array[0]['icao'].substr($operator_correct,2);
798
-                                            	}
799
-                                        }
795
+												$airline_array = $Spotter->getAllAirlineInfo(substr($operator_correct, 0, 2));
796
+												if (count($airline_array) > 0) {
797
+													$operator_correct = $airline_array[0]['icao'].substr($operator_correct,2);
798
+												}
799
+										}
800 800
 					$query = 'INSERT INTO translation (Reg,Reg_correct,Operator,Operator_correct,Source) VALUES (:Reg, :Reg_correct, :Operator, :Operator_correct, :source)';
801 801
 					try {
802 802
 						$sth = $Connection->db->prepare($query);
@@ -810,7 +810,7 @@  discard block
 block discarded – undo
810 810
 			//$Connection->db->commit();
811 811
 		}
812 812
 		return '';
813
-        }
813
+		}
814 814
 	
815 815
 	public static function translation_fam() {
816 816
 		require_once(dirname(__FILE__).'/../require/class.Spotter.php');
@@ -820,10 +820,10 @@  discard block
 block discarded – undo
820 820
 		try {
821 821
 			$Connection = new Connection();
822 822
 			$sth = $Connection->db->prepare($query);
823
-                        $sth->execute(array(':source' => 'website_fam'));
824
-                } catch(PDOException $e) {
825
-                        return "error : ".$e->getMessage();
826
-                }
823
+						$sth->execute(array(':source' => 'website_fam'));
824
+				} catch(PDOException $e) {
825
+						return "error : ".$e->getMessage();
826
+				}
827 827
 
828 828
 		
829 829
 		//update_db::unzip($out_file);
@@ -852,54 +852,54 @@  discard block
 block discarded – undo
852 852
 			//$Connection->db->commit();
853 853
 		}
854 854
 		return '';
855
-        }
855
+		}
856 856
 
857 857
 	/**
858
-        * Convert a HTML table to an array
859
-        * @param String $data HTML page
860
-        * @return Array array of the tables in HTML page
861
-        */
862
-        private static function table2array($data) {
863
-                $html = str_get_html($data);
864
-                $tabledata=array();
865
-                foreach($html->find('tr') as $element)
866
-                {
867
-                        $td = array();
868
-                        foreach( $element->find('th') as $row)
869
-                        {
870
-                                $td [] = trim($row->plaintext);
871
-                        }
872
-                        $td=array_filter($td);
873
-                        $tabledata[] = $td;
874
-
875
-                        $td = array();
876
-                        $tdi = array();
877
-                        foreach( $element->find('td') as $row)
878
-                        {
879
-                                $td [] = trim($row->plaintext);
880
-                                $tdi [] = trim($row->innertext);
881
-                        }
882
-                        $td=array_filter($td);
883
-                        $tdi=array_filter($tdi);
884
-                    //    $tabledata[]=array_merge($td,$tdi);
885
-                        $tabledata[]=$td;
886
-                }
887
-                return(array_filter($tabledata));
888
-        }
889
-
890
-       /**
891
-        * Get data from form result
892
-        * @param String $url form URL
893
-        * @return String the result
894
-        */
895
-        private static function getData($url) {
896
-                $ch = curl_init();
897
-                curl_setopt($ch, CURLOPT_URL, $url);
898
-                curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
899
-                curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
900
-                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');
901
-                return curl_exec($ch);
902
-        }
858
+	 * Convert a HTML table to an array
859
+	 * @param String $data HTML page
860
+	 * @return Array array of the tables in HTML page
861
+	 */
862
+		private static function table2array($data) {
863
+				$html = str_get_html($data);
864
+				$tabledata=array();
865
+				foreach($html->find('tr') as $element)
866
+				{
867
+						$td = array();
868
+						foreach( $element->find('th') as $row)
869
+						{
870
+								$td [] = trim($row->plaintext);
871
+						}
872
+						$td=array_filter($td);
873
+						$tabledata[] = $td;
874
+
875
+						$td = array();
876
+						$tdi = array();
877
+						foreach( $element->find('td') as $row)
878
+						{
879
+								$td [] = trim($row->plaintext);
880
+								$tdi [] = trim($row->innertext);
881
+						}
882
+						$td=array_filter($td);
883
+						$tdi=array_filter($tdi);
884
+					//    $tabledata[]=array_merge($td,$tdi);
885
+						$tabledata[]=$td;
886
+				}
887
+				return(array_filter($tabledata));
888
+		}
889
+
890
+	   /**
891
+	    * Get data from form result
892
+	    * @param String $url form URL
893
+	    * @return String the result
894
+	    */
895
+		private static function getData($url) {
896
+				$ch = curl_init();
897
+				curl_setopt($ch, CURLOPT_URL, $url);
898
+				curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
899
+				curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
900
+				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');
901
+				return curl_exec($ch);
902
+		}
903 903
 /*
904 904
 	public static function waypoints() {
905 905
 		$data = update_db::getData('http://www.fallingrain.com/world/FR/waypoints.html');
@@ -949,10 +949,10 @@  discard block
 block discarded – undo
949 949
 		try {
950 950
 			$Connection = new Connection();
951 951
 			$sth = $Connection->db->prepare($query);
952
-                        $sth->execute();
953
-                } catch(PDOException $e) {
954
-                        return "error : ".$e->getMessage();
955
-                }
952
+						$sth->execute();
953
+				} catch(PDOException $e) {
954
+						return "error : ".$e->getMessage();
955
+				}
956 956
 
957 957
 		
958 958
 		//update_db::unzip($out_file);
@@ -991,7 +991,7 @@  discard block
 block discarded – undo
991 991
 			if ($globalTransaction) $Connection->db->commit();
992 992
 		}
993 993
 		return '';
994
-        }
994
+		}
995 995
 
996 996
 	public static function ivao_airlines($filename) {
997 997
 		//require_once(dirname(__FILE__).'/../require/class.Spotter.php');
@@ -1000,10 +1000,10 @@  discard block
 block discarded – undo
1000 1000
 		try {
1001 1001
 			$Connection = new Connection();
1002 1002
 			$sth = $Connection->db->prepare($query);
1003
-                        $sth->execute();
1004
-                } catch(PDOException $e) {
1005
-                        return "error : ".$e->getMessage();
1006
-                }
1003
+						$sth->execute();
1004
+				} catch(PDOException $e) {
1005
+						return "error : ".$e->getMessage();
1006
+				}
1007 1007
 
1008 1008
 		$header = NULL;
1009 1009
 		$delimiter = ':';
@@ -1027,7 +1027,7 @@  discard block
 block discarded – undo
1027 1027
 			if ($globalTransaction) $Connection->db->commit();
1028 1028
 		}
1029 1029
 		return '';
1030
-        }
1030
+		}
1031 1031
 	
1032 1032
 	public static function update_airspace() {
1033 1033
 		global $tmp_dir, $globalDBdriver;
@@ -1053,10 +1053,10 @@  discard block
 block discarded – undo
1053 1053
 			$query = 'DROP TABLE countries';
1054 1054
 			try {
1055 1055
 				$sth = $Connection->db->prepare($query);
1056
-            	        	$sth->execute();
1057
-	                } catch(PDOException $e) {
1058
-    	                	echo "error : ".$e->getMessage();
1059
-	                }
1056
+							$sth->execute();
1057
+					} catch(PDOException $e) {
1058
+							echo "error : ".$e->getMessage();
1059
+					}
1060 1060
 		}
1061 1061
 		if ($globalDBdriver == 'mysql') {
1062 1062
 			update_db::gunzip('../db/countries.sql.gz',$tmp_dir.'countries.sql');
@@ -1401,12 +1401,12 @@  discard block
 block discarded – undo
1401 1401
 		echo $data;
1402 1402
 		*/
1403 1403
 		if (file_exists($tmp_dir.'aircrafts.html')) {
1404
-		    var_dump(file_get_html($tmp_dir.'aircrafts.html'));
1405
-		    $fh = fopen($tmp_dir.'aircrafts.html',"r");
1406
-		    $result = fread($fh,100000000);
1407
-		    //echo $result;
1408
-		    var_dump(str_get_html($result));
1409
-		    //print_r(self::table2array($result));
1404
+			var_dump(file_get_html($tmp_dir.'aircrafts.html'));
1405
+			$fh = fopen($tmp_dir.'aircrafts.html',"r");
1406
+			$result = fread($fh,100000000);
1407
+			//echo $result;
1408
+			var_dump(str_get_html($result));
1409
+			//print_r(self::table2array($result));
1410 1410
 		}
1411 1411
 
1412 1412
 	}
@@ -1420,10 +1420,10 @@  discard block
 block discarded – undo
1420 1420
 		try {
1421 1421
 			$Connection = new Connection();
1422 1422
 			$sth = $Connection->db->prepare($query);
1423
-                        $sth->execute();
1424
-                } catch(PDOException $e) {
1425
-                        return "error : ".$e->getMessage();
1426
-                }
1423
+						$sth->execute();
1424
+				} catch(PDOException $e) {
1425
+						return "error : ".$e->getMessage();
1426
+				}
1427 1427
 
1428 1428
 		$error = '';
1429 1429
 		if ($globalDebug) echo "Notam : Download...";
@@ -1479,8 +1479,8 @@  discard block
 block discarded – undo
1479 1479
 					$data['date_end'] = date("Y-m-d H:i:s",strtotime($to));
1480 1480
 					$data['permanent'] = 0;
1481 1481
 				} else {
1482
-				    $data['date_end'] = NULL;
1483
-				    $data['permanent'] = 1;
1482
+					$data['date_end'] = NULL;
1483
+					$data['permanent'] = 1;
1484 1484
 				}
1485 1485
 				$data['full_notam'] = $notam['title'].'<br>'.$notam['description'];
1486 1486
 				$NOTAM = new NOTAM();
@@ -1504,13 +1504,13 @@  discard block
 block discarded – undo
1504 1504
 		try {
1505 1505
 			$Connection = new Connection();
1506 1506
 			$sth = $Connection->db->prepare($query);
1507
-                        $sth->execute();
1508
-                } catch(PDOException $e) {
1509
-                        return "error : ".$e->getMessage();
1510
-                }
1511
-                $row = $sth->fetch(PDO::FETCH_ASSOC);
1512
-                if ($row['nb'] > 0) return false;
1513
-                else return true;
1507
+						$sth->execute();
1508
+				} catch(PDOException $e) {
1509
+						return "error : ".$e->getMessage();
1510
+				}
1511
+				$row = $sth->fetch(PDO::FETCH_ASSOC);
1512
+				if ($row['nb'] > 0) return false;
1513
+				else return true;
1514 1514
 	}
1515 1515
 
1516 1516
 	public static function insert_last_update() {
@@ -1519,10 +1519,10 @@  discard block
 block discarded – undo
1519 1519
 		try {
1520 1520
 			$Connection = new Connection();
1521 1521
 			$sth = $Connection->db->prepare($query);
1522
-                        $sth->execute();
1523
-                } catch(PDOException $e) {
1524
-                        return "error : ".$e->getMessage();
1525
-                }
1522
+						$sth->execute();
1523
+				} catch(PDOException $e) {
1524
+						return "error : ".$e->getMessage();
1525
+				}
1526 1526
 	}
1527 1527
 
1528 1528
 	public static function check_last_notam_update() {
@@ -1535,13 +1535,13 @@  discard block
 block discarded – undo
1535 1535
 		try {
1536 1536
 			$Connection = new Connection();
1537 1537
 			$sth = $Connection->db->prepare($query);
1538
-                        $sth->execute();
1539
-                } catch(PDOException $e) {
1540
-                        return "error : ".$e->getMessage();
1541
-                }
1542
-                $row = $sth->fetch(PDO::FETCH_ASSOC);
1543
-                if ($row['nb'] > 0) return false;
1544
-                else return true;
1538
+						$sth->execute();
1539
+				} catch(PDOException $e) {
1540
+						return "error : ".$e->getMessage();
1541
+				}
1542
+				$row = $sth->fetch(PDO::FETCH_ASSOC);
1543
+				if ($row['nb'] > 0) return false;
1544
+				else return true;
1545 1545
 	}
1546 1546
 
1547 1547
 	public static function insert_last_notam_update() {
@@ -1550,10 +1550,10 @@  discard block
 block discarded – undo
1550 1550
 		try {
1551 1551
 			$Connection = new Connection();
1552 1552
 			$sth = $Connection->db->prepare($query);
1553
-                        $sth->execute();
1554
-                } catch(PDOException $e) {
1555
-                        return "error : ".$e->getMessage();
1556
-                }
1553
+						$sth->execute();
1554
+				} catch(PDOException $e) {
1555
+						return "error : ".$e->getMessage();
1556
+				}
1557 1557
 	}
1558 1558
 
1559 1559
 	public static function check_last_owner_update() {
@@ -1566,13 +1566,13 @@  discard block
 block discarded – undo
1566 1566
 		try {
1567 1567
 			$Connection = new Connection();
1568 1568
 			$sth = $Connection->db->prepare($query);
1569
-                        $sth->execute();
1570
-                } catch(PDOException $e) {
1571
-                        return "error : ".$e->getMessage();
1572
-                }
1573
-                $row = $sth->fetch(PDO::FETCH_ASSOC);
1574
-                if ($row['nb'] > 0) return false;
1575
-                else return true;
1569
+						$sth->execute();
1570
+				} catch(PDOException $e) {
1571
+						return "error : ".$e->getMessage();
1572
+				}
1573
+				$row = $sth->fetch(PDO::FETCH_ASSOC);
1574
+				if ($row['nb'] > 0) return false;
1575
+				else return true;
1576 1576
 	}
1577 1577
 
1578 1578
 	public static function insert_last_owner_update() {
@@ -1581,10 +1581,10 @@  discard block
 block discarded – undo
1581 1581
 		try {
1582 1582
 			$Connection = new Connection();
1583 1583
 			$sth = $Connection->db->prepare($query);
1584
-                        $sth->execute();
1585
-                } catch(PDOException $e) {
1586
-                        return "error : ".$e->getMessage();
1587
-                }
1584
+						$sth->execute();
1585
+				} catch(PDOException $e) {
1586
+						return "error : ".$e->getMessage();
1587
+				}
1588 1588
 	}
1589 1589
 	
1590 1590
 	public static function update_all() {
Please login to merge, or discard this patch.