Completed
Push — master ( 5bdcfd...873309 )
by Yannick
06:25
created
live-geojson.php 1 patch
Spacing   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -54,23 +54,23 @@  discard block
 block discarded – undo
54 54
 $min = true;
55 55
 $allhistory = false;
56 56
 $filter['source'] = array();
57
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt'));
58
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup'));
59
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars'));
60
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs'));
61
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs'));
62
-if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING);
63
-if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING);
64
-if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING);
65
-if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING);
66
-if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING);
57
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'], array('vatsimtxt'));
58
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'], array('whazzup'));
59
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'], array('phpvmacars'));
60
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'], array('sbs'));
61
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'], array('aprs'));
62
+if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'], FILTER_SANITIZE_STRING);
63
+if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',', $_COOKIE['filter_Airlines']), FILTER_SANITIZE_STRING);
64
+if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',', $_COOKIE['filter_Sources']), FILTER_SANITIZE_STRING);
65
+if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'], FILTER_SANITIZE_STRING);
66
+if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'], FILTER_SANITIZE_STRING);
67 67
 
68 68
 if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) {
69 69
 	$min = true;
70 70
 } else $min = false;
71 71
 
72 72
 if (isset($_GET['ident'])) {
73
-	$ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING);
73
+	$ident = filter_input(INPUT_GET, 'ident', FILTER_SANITIZE_STRING);
74 74
 	if ($tracker) {
75 75
 		$spotter_array = $TrackerLive->getLastLiveTrackerDataByIdent($ident);
76 76
 	} elseif ($marine) {
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 	}
85 85
 	$allhistory = true;
86 86
 } elseif (isset($_GET['flightaware_id'])) {
87
-	$flightaware_id = filter_input(INPUT_GET,'flightaware_id',FILTER_SANITIZE_STRING);
87
+	$flightaware_id = filter_input(INPUT_GET, 'flightaware_id', FILTER_SANITIZE_STRING);
88 88
 	$spotter_array = $SpotterLive->getLastLiveSpotterDataById($flightaware_id);
89 89
 	if (empty($spotter_array)) {
90 90
 		$from_archive = true;
@@ -92,22 +92,22 @@  discard block
 block discarded – undo
92 92
 	}
93 93
 	$allhistory = true;
94 94
 } elseif (isset($_GET['famtrack_id'])) {
95
-	$famtrack_id = filter_input(INPUT_GET,'famtrack_id',FILTER_SANITIZE_STRING);
95
+	$famtrack_id = filter_input(INPUT_GET, 'famtrack_id', FILTER_SANITIZE_STRING);
96 96
 	$spotter_array = $TrackerLive->getLastLiveTrackerDataById($famtrack_id);
97 97
 	$allhistory = true;
98 98
 } elseif (isset($_GET['fammarine_id'])) {
99
-	$fammarine_id = filter_input(INPUT_GET,'fammarine_id',FILTER_SANITIZE_STRING);
99
+	$fammarine_id = filter_input(INPUT_GET, 'fammarine_id', FILTER_SANITIZE_STRING);
100 100
 	$spotter_array = $MarineLive->getLastLiveMarineDataById($fammarine_id);
101 101
 	$allhistory = true;
102 102
 } elseif (isset($_GET['coord']) && (!isset($globalMapPopup) || $globalMapPopup || (isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true'))) {
103 103
 //if (isset($_GET['coord'])) {
104
-	$coord = explode(',',$_GET['coord']);
104
+	$coord = explode(',', $_GET['coord']);
105 105
 	if ($tracker) {
106
-		$spotter_array = $TrackerLive->getLiveTrackerDatabyCoord($coord,$filter);
106
+		$spotter_array = $TrackerLive->getLiveTrackerDatabyCoord($coord, $filter);
107 107
 	} elseif ($marine) {
108
-		$spotter_array = $MarineLive->getLiveMarineDatabyCoord($coord,$filter);
108
+		$spotter_array = $MarineLive->getLiveMarineDatabyCoord($coord, $filter);
109 109
 	} else {
110
-		$spotter_array = $SpotterLive->getLiveSpotterDatabyCoord($coord,$filter);
110
+		$spotter_array = $SpotterLive->getLiveSpotterDatabyCoord($coord, $filter);
111 111
 	}
112 112
 
113 113
 #} elseif (isset($globalMapPopup) && !$globalMapPopup) {
@@ -115,12 +115,12 @@  discard block
 block discarded – undo
115 115
 	$from_archive = true;
116 116
 //	$begindate = filter_input(INPUT_GET,'begindate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~')));
117 117
 //	$enddate = filter_input(INPUT_GET,'enddate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~')));
118
-	$begindate = filter_input(INPUT_GET,'begindate',FILTER_SANITIZE_NUMBER_INT);
119
-	$enddate = filter_input(INPUT_GET,'enddate',FILTER_SANITIZE_NUMBER_INT);
120
-	$archivespeed = filter_input(INPUT_GET,'speed',FILTER_SANITIZE_NUMBER_INT);
121
-	$begindate = date('Y-m-d H:i:s',$begindate);
122
-	$enddate = date('Y-m-d H:i:s',$enddate);
123
-	$spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate,$enddate,$filter);
118
+	$begindate = filter_input(INPUT_GET, 'begindate', FILTER_SANITIZE_NUMBER_INT);
119
+	$enddate = filter_input(INPUT_GET, 'enddate', FILTER_SANITIZE_NUMBER_INT);
120
+	$archivespeed = filter_input(INPUT_GET, 'speed', FILTER_SANITIZE_NUMBER_INT);
121
+	$begindate = date('Y-m-d H:i:s', $begindate);
122
+	$enddate = date('Y-m-d H:i:s', $enddate);
123
+	$spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate, $enddate, $filter);
124 124
 } elseif ($min) {
125 125
 	if ($tracker) {
126 126
 		$spotter_array = $TrackerLive->getMinLiveTrackerData($filter);
@@ -132,11 +132,11 @@  discard block
 block discarded – undo
132 132
 #	$min = true;
133 133
 } else {
134 134
 	if ($tracker) {
135
-		$spotter_array = $TrackerLive->getLiveTrackerData('','',$filter);
135
+		$spotter_array = $TrackerLive->getLiveTrackerData('', '', $filter);
136 136
 	} elseif ($marine) {
137
-		$spotter_array = $marineLive->getLiveMarineData('','',$filter);
137
+		$spotter_array = $marineLive->getLiveMarineData('', '', $filter);
138 138
 	} else {
139
-		$spotter_array = $SpotterLive->getLiveSpotterData('','',$filter);
139
+		$spotter_array = $SpotterLive->getLiveSpotterData('', '', $filter);
140 140
 	}
141 141
 }
142 142
 
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
 	if ($flightcnt == '') $flightcnt = 0;
153 153
 } else $flightcnt = 0;
154 154
 
155
-$sqltime = round(microtime(true)-$begintime,2);
155
+$sqltime = round(microtime(true) - $begintime, 2);
156 156
 
157 157
 if ((!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation == FALSE) || (isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'false')) $usenextlatlon = false;
158 158
 else $usenextlatlon = true;
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
 		if (!empty($spotter_array) && is_array($spotter_array))
170 170
 		{
171 171
 			$output .= '"features": [';
172
-			foreach($spotter_array as $spotter_item)
172
+			foreach ($spotter_array as $spotter_item)
173 173
 			{
174 174
 				$j++;
175 175
 				date_default_timezone_set('UTC');
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
 						if (isset($spotter_item['registration'])) $output .= '"registration": "'.$spotter_item['registration'].'",';
235 235
 						if (isset($spotter_item['aircraft_name']) && isset($spotter_item['aircraft_type'])) {
236 236
 							$output .= '"aircraft_name": "'.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')",';
237
-							$output .= '"aircraft_wiki": "http://'.strtolower($globalLanguage).'.wikipedia.org/wiki/'.urlencode(str_replace(' ','_',$spotter_item['aircraft_name'])).'",';
237
+							$output .= '"aircraft_wiki": "http://'.strtolower($globalLanguage).'.wikipedia.org/wiki/'.urlencode(str_replace(' ', '_', $spotter_item['aircraft_name'])).'",';
238 238
 						} elseif (isset($spotter_item['aircraft_type'])) {
239 239
 							$output .= '"aircraft_name": "NA ('.$spotter_item['aircraft_type'].')",';
240 240
 						} elseif (!$min) {
@@ -374,16 +374,16 @@  discard block
 block discarded – undo
374 374
 						else $output .= '"heading": "'.$spotter_item['heading'].'",';
375 375
 						
376 376
 						if (isset($archivespeed)) {
377
-							$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$spotter_item['heading'],$archivespeed);
377
+							$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $spotter_item['heading'], $archivespeed);
378 378
 							$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
379 379
 						} elseif ($usenextlatlon) {
380
-							$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$spotter_item['heading']);
380
+							$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $spotter_item['heading']);
381 381
 							$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
382 382
 						}
383 383
 
384 384
 						if (!$min) $output .= '"image": "'.$image.'",';
385 385
 						if (isset($spotter_item['image_copyright']) && $spotter_item['image_copyright'] != '') {
386
-							$output .= '"image_copyright": "'.str_replace('"',"'",trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$spotter_item['image_copyright']))).'",';
386
+							$output .= '"image_copyright": "'.str_replace('"', "'", trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '', $spotter_item['image_copyright']))).'",';
387 387
 						}
388 388
 						if (isset($spotter_item['image_source_website'])) {
389 389
 							$output .= '"image_source_website": "'.urlencode($spotter_item['image_source_website']).'",';
@@ -405,7 +405,7 @@  discard block
 block discarded – undo
405 405
 							$output .= '"waypoints": "'.$spotter_item['waypoints'].'",';
406 406
 						}
407 407
 						if (isset($spotter_item['acars'])) {
408
-							$output .= '"acars": "'.trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"), '<br />',$spotter_item['acars']['message'])).'",';
408
+							$output .= '"acars": "'.trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '<br />', $spotter_item['acars']['message'])).'",';
409 409
 						}
410 410
 						// type when not aircraft ?
411 411
 						if (isset($spotter_item['type'])) {
@@ -483,7 +483,7 @@  discard block
 block discarded – undo
483 483
                 
484 484
 			}
485 485
 */
486
-				$history = filter_input(INPUT_GET,'history',FILTER_SANITIZE_STRING);
486
+				$history = filter_input(INPUT_GET, 'history', FILTER_SANITIZE_STRING);
487 487
 				if ($history == '' && isset($_COOKIE['history'])) $history = $_COOKIE['history'];
488 488
 				
489 489
 				if ((isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true') 
@@ -517,9 +517,9 @@  discard block
 block discarded – undo
517 517
 						    else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": [';
518 518
 						}
519 519
 						$output_history .= '[';
520
-						$output_history .=  $spotter_history['longitude'].', ';
521
-						$output_history .=  $spotter_history['latitude'].', ';
522
-						$output_history .=  $spotter_history['altitude']*30.48;
520
+						$output_history .= $spotter_history['longitude'].', ';
521
+						$output_history .= $spotter_history['latitude'].', ';
522
+						$output_history .= $spotter_history['altitude']*30.48;
523 523
 						$output_history .= '],';
524 524
 						$prev_alt = $alt;
525 525
 					} else {
@@ -528,8 +528,8 @@  discard block
 block discarded – undo
528 528
 							else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history"},"geometry": {"type": "LineString","coordinates": [';
529 529
 						} else $d = true;
530 530
 						$output_history .= '[';
531
-						$output_history .=  $spotter_history['longitude'].', ';
532
-						$output_history .=  $spotter_history['latitude'];
531
+						$output_history .= $spotter_history['longitude'].', ';
532
+						$output_history .= $spotter_history['latitude'];
533 533
 						$output_history .= '],';
534 534
 					}
535 535
 				    //}
@@ -569,7 +569,7 @@  discard block
 block discarded – undo
569 569
 			$output  = substr($output, 0, -1);
570 570
 			$output .= ']';
571 571
 			$output .= ',"initial_sqltime": "'.$sqltime.'",';
572
-			$output .= '"totaltime": "'.round(microtime(true)-$begintime,2).'",';
572
+			$output .= '"totaltime": "'.round(microtime(true) - $begintime, 2).'",';
573 573
 			if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",';
574 574
 			$output .= '"fc": "'.$j.'"';
575 575
 		} else {
Please login to merge, or discard this patch.
install/index.php 1 patch
Spacing   +210 added lines, -210 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
 require_once(dirname(__FILE__).'/class.create_db.php');
11 11
 require_once(dirname(__FILE__).'/class.update_schema.php');
12 12
 require_once(dirname(__FILE__).'/class.settings.php');
13
-$title="Install";
13
+$title = "Install";
14 14
 require(dirname(__FILE__).'/../require/settings.php');
15 15
 require(dirname(__FILE__).'/header.php');
16 16
 
@@ -69,8 +69,8 @@  discard block
 block discarded – undo
69 69
 if (!extension_loaded('curl')) {
70 70
 	$error[] = "Curl is not loaded.";
71 71
 }
72
-if(function_exists('apache_get_modules') ){
73
-	if(!in_array('mod_rewrite',apache_get_modules())) {
72
+if (function_exists('apache_get_modules')) {
73
+	if (!in_array('mod_rewrite', apache_get_modules())) {
74 74
 		$error[] = "mod_rewrite is not available.";
75 75
 	}
76 76
 /*
@@ -86,8 +86,8 @@  discard block
 block discarded – undo
86 86
 print '<div class="info column"><p><strong>If you use MySQL or MariaDB, check that <i>max_allowed_packet</i> >= 8M, else import of some table can fail.</strong></p></div>';
87 87
 if (isset($_SERVER['REQUEST_SCHEME']) && isset($_SERVER['SERVER_NAME']) && isset($_SERVER['SERVER_PORT']) && isset($_SERVER['REQUEST_URI'])) {
88 88
 	if (function_exists('get_headers')) {
89
-		$check_header = @get_headers($_SERVER['REQUEST_SCHEME'].'://'.$_SERVER["SERVER_NAME"].':'.$_SERVER["SERVER_PORT"].str_replace('install/','search',str_replace('index.php',$_SERVER["REQUEST_URI"])));
90
-		if (isset($check_header[0]) && !stripos($check_header[0],"200 OK")) {
89
+		$check_header = @get_headers($_SERVER['REQUEST_SCHEME'].'://'.$_SERVER["SERVER_NAME"].':'.$_SERVER["SERVER_PORT"].str_replace('install/', 'search', str_replace('index.php', $_SERVER["REQUEST_URI"])));
90
+		if (isset($check_header[0]) && !stripos($check_header[0], "200 OK")) {
91 91
 			print '<div class="info column"><p><strong>Check your configuration, rewrite don\'t seems to work.</strong></p></div>';
92 92
 		}
93 93
 	}
@@ -438,13 +438,13 @@  discard block
 block discarded – undo
438 438
 ?>
439 439
 							<tr>
440 440
 								<?php
441
-								    if (filter_var($source['host'],FILTER_VALIDATE_URL)) {
441
+								    if (filter_var($source['host'], FILTER_VALIDATE_URL)) {
442 442
 								?>
443 443
 								<td><input type="text" name="host[]" id="host" value="<?php print $source['host']; ?>" /></td>
444 444
 								<td><input type="number" name="port[]" id="port" value="<?php print $source['port']; ?>" /></td>
445 445
 								<?php
446 446
 								    } else {
447
-									$hostport = explode(':',$source['host']);
447
+									$hostport = explode(':', $source['host']);
448 448
 									if (isset($hostport[1])) {
449 449
 										$host = $hostport[0];
450 450
 										$port = $hostport[1];
@@ -780,7 +780,7 @@  discard block
 block discarded – undo
780 780
 			<br />
781 781
 			<p>
782 782
 				<label for="aircraftsize">Size of aircraft icon on map (default to 30px if zoom > 7 else 15px), empty to default</label>
783
-				<input type="number" name="aircraftsize" id="aircraftsize" value="<?php if (isset($globalAircraftSize)) echo $globalAircraftSize;?>" />
783
+				<input type="number" name="aircraftsize" id="aircraftsize" value="<?php if (isset($globalAircraftSize)) echo $globalAircraftSize; ?>" />
784 784
 			</p>
785 785
 			<br />
786 786
 			<p>
@@ -826,14 +826,14 @@  discard block
 block discarded – undo
826 826
 $error = '';
827 827
 
828 828
 if (isset($_POST['dbtype'])) {
829
-	$dbtype = filter_input(INPUT_POST,'dbtype',FILTER_SANITIZE_STRING);
830
-	$dbroot = filter_input(INPUT_POST,'dbroot',FILTER_SANITIZE_STRING);
831
-	$dbrootpass = filter_input(INPUT_POST,'dbrootpass',FILTER_SANITIZE_STRING);
832
-	$dbname = filter_input(INPUT_POST,'dbname',FILTER_SANITIZE_STRING);
833
-	$dbuser = filter_input(INPUT_POST,'dbuser',FILTER_SANITIZE_STRING);
834
-	$dbuserpass = filter_input(INPUT_POST,'dbuserpass',FILTER_SANITIZE_STRING);
835
-	$dbhost = filter_input(INPUT_POST,'dbhost',FILTER_SANITIZE_STRING);
836
-	$dbport = filter_input(INPUT_POST,'dbport',FILTER_SANITIZE_STRING);
829
+	$dbtype = filter_input(INPUT_POST, 'dbtype', FILTER_SANITIZE_STRING);
830
+	$dbroot = filter_input(INPUT_POST, 'dbroot', FILTER_SANITIZE_STRING);
831
+	$dbrootpass = filter_input(INPUT_POST, 'dbrootpass', FILTER_SANITIZE_STRING);
832
+	$dbname = filter_input(INPUT_POST, 'dbname', FILTER_SANITIZE_STRING);
833
+	$dbuser = filter_input(INPUT_POST, 'dbuser', FILTER_SANITIZE_STRING);
834
+	$dbuserpass = filter_input(INPUT_POST, 'dbuserpass', FILTER_SANITIZE_STRING);
835
+	$dbhost = filter_input(INPUT_POST, 'dbhost', FILTER_SANITIZE_STRING);
836
+	$dbport = filter_input(INPUT_POST, 'dbport', FILTER_SANITIZE_STRING);
837 837
 
838 838
 	if ($dbtype == 'mysql' && !extension_loaded('pdo_mysql')) $error .= 'Mysql driver for PDO must be loaded';
839 839
 	if ($dbtype == 'pgsql' && !extension_loaded('pdo_pgsql')) $error .= 'PosgreSQL driver for PDO must be loaded';
@@ -853,48 +853,48 @@  discard block
 block discarded – undo
853 853
 	} else $settings = array_merge($settings,array('globalDBdriver' => $dbtype,'globalDBhost' => $dbhost,'globalDBuser' => $dbuser,'globalDBport' => $dbport,'globalDBpass' => $dbuserpass,'globalDBname' => $dbname));
854 854
 	*/
855 855
 	
856
-	$settings = array_merge($settings,array('globalDBdriver' => $dbtype,'globalDBhost' => $dbhost,'globalDBuser' => $dbuser,'globalDBport' => $dbport,'globalDBpass' => $dbuserpass,'globalDBname' => $dbname));
856
+	$settings = array_merge($settings, array('globalDBdriver' => $dbtype, 'globalDBhost' => $dbhost, 'globalDBuser' => $dbuser, 'globalDBport' => $dbport, 'globalDBpass' => $dbuserpass, 'globalDBname' => $dbname));
857 857
 
858
-	$sitename = filter_input(INPUT_POST,'sitename',FILTER_SANITIZE_STRING);
859
-	$siteurl = filter_input(INPUT_POST,'siteurl',FILTER_SANITIZE_STRING);
860
-	$timezone = filter_input(INPUT_POST,'timezone',FILTER_SANITIZE_STRING);
861
-	$language = filter_input(INPUT_POST,'language',FILTER_SANITIZE_STRING);
862
-	$settings = array_merge($settings,array('globalName' => $sitename,'globalURL' => $siteurl, 'globalTimezone' => $timezone,'globalLanguage' => $language));
858
+	$sitename = filter_input(INPUT_POST, 'sitename', FILTER_SANITIZE_STRING);
859
+	$siteurl = filter_input(INPUT_POST, 'siteurl', FILTER_SANITIZE_STRING);
860
+	$timezone = filter_input(INPUT_POST, 'timezone', FILTER_SANITIZE_STRING);
861
+	$language = filter_input(INPUT_POST, 'language', FILTER_SANITIZE_STRING);
862
+	$settings = array_merge($settings, array('globalName' => $sitename, 'globalURL' => $siteurl, 'globalTimezone' => $timezone, 'globalLanguage' => $language));
863 863
 
864
-	$mapprovider = filter_input(INPUT_POST,'mapprovider',FILTER_SANITIZE_STRING);
865
-	$mapboxid = filter_input(INPUT_POST,'mapboxid',FILTER_SANITIZE_STRING);
866
-	$mapboxtoken = filter_input(INPUT_POST,'mapboxtoken',FILTER_SANITIZE_STRING);
867
-	$googlekey = filter_input(INPUT_POST,'googlekey',FILTER_SANITIZE_STRING);
868
-	$bingkey = filter_input(INPUT_POST,'bingkey',FILTER_SANITIZE_STRING);
869
-	$mapquestkey = filter_input(INPUT_POST,'mapquestkey',FILTER_SANITIZE_STRING);
870
-	$hereappid = filter_input(INPUT_POST,'hereappid',FILTER_SANITIZE_STRING);
871
-	$hereappcode = filter_input(INPUT_POST,'hereappcode',FILTER_SANITIZE_STRING);
872
-	$settings = array_merge($settings,array('globalMapProvider' => $mapprovider,'globalMapboxId' => $mapboxid,'globalMapboxToken' => $mapboxtoken,'globalGoogleAPIKey' => $googlekey,'globalBingMapKey' => $bingkey,'globalHereappID' => $hereappid,'globalHereappCode' => $hereappcode,'globalMapQuestKey' => $mapquestkey));
864
+	$mapprovider = filter_input(INPUT_POST, 'mapprovider', FILTER_SANITIZE_STRING);
865
+	$mapboxid = filter_input(INPUT_POST, 'mapboxid', FILTER_SANITIZE_STRING);
866
+	$mapboxtoken = filter_input(INPUT_POST, 'mapboxtoken', FILTER_SANITIZE_STRING);
867
+	$googlekey = filter_input(INPUT_POST, 'googlekey', FILTER_SANITIZE_STRING);
868
+	$bingkey = filter_input(INPUT_POST, 'bingkey', FILTER_SANITIZE_STRING);
869
+	$mapquestkey = filter_input(INPUT_POST, 'mapquestkey', FILTER_SANITIZE_STRING);
870
+	$hereappid = filter_input(INPUT_POST, 'hereappid', FILTER_SANITIZE_STRING);
871
+	$hereappcode = filter_input(INPUT_POST, 'hereappcode', FILTER_SANITIZE_STRING);
872
+	$settings = array_merge($settings, array('globalMapProvider' => $mapprovider, 'globalMapboxId' => $mapboxid, 'globalMapboxToken' => $mapboxtoken, 'globalGoogleAPIKey' => $googlekey, 'globalBingMapKey' => $bingkey, 'globalHereappID' => $hereappid, 'globalHereappCode' => $hereappcode, 'globalMapQuestKey' => $mapquestkey));
873 873
 	
874
-	$latitudemax = filter_input(INPUT_POST,'latitudemax',FILTER_SANITIZE_STRING);
875
-	$latitudemin = filter_input(INPUT_POST,'latitudemin',FILTER_SANITIZE_STRING);
876
-	$longitudemax = filter_input(INPUT_POST,'longitudemax',FILTER_SANITIZE_STRING);
877
-	$longitudemin = filter_input(INPUT_POST,'longitudemin',FILTER_SANITIZE_STRING);
878
-	$livezoom = filter_input(INPUT_POST,'livezoom',FILTER_SANITIZE_NUMBER_INT);
879
-	$settings = array_merge($settings,array('globalLatitudeMax' => $latitudemax,'globalLatitudeMin' => $latitudemin,'globalLongitudeMax' => $longitudemax,'globalLongitudeMin' => $longitudemin,'globalLiveZoom' => $livezoom));
874
+	$latitudemax = filter_input(INPUT_POST, 'latitudemax', FILTER_SANITIZE_STRING);
875
+	$latitudemin = filter_input(INPUT_POST, 'latitudemin', FILTER_SANITIZE_STRING);
876
+	$longitudemax = filter_input(INPUT_POST, 'longitudemax', FILTER_SANITIZE_STRING);
877
+	$longitudemin = filter_input(INPUT_POST, 'longitudemin', FILTER_SANITIZE_STRING);
878
+	$livezoom = filter_input(INPUT_POST, 'livezoom', FILTER_SANITIZE_NUMBER_INT);
879
+	$settings = array_merge($settings, array('globalLatitudeMax' => $latitudemax, 'globalLatitudeMin' => $latitudemin, 'globalLongitudeMax' => $longitudemax, 'globalLongitudeMin' => $longitudemin, 'globalLiveZoom' => $livezoom));
880 880
 
881
-	$squawk_country = filter_input(INPUT_POST,'squawk_country',FILTER_SANITIZE_STRING);
882
-	$settings = array_merge($settings,array('globalSquawkCountry' => $squawk_country));
881
+	$squawk_country = filter_input(INPUT_POST, 'squawk_country', FILTER_SANITIZE_STRING);
882
+	$settings = array_merge($settings, array('globalSquawkCountry' => $squawk_country));
883 883
 
884
-	$latitudecenter = filter_input(INPUT_POST,'latitudecenter',FILTER_SANITIZE_STRING);
885
-	$longitudecenter = filter_input(INPUT_POST,'longitudecenter',FILTER_SANITIZE_STRING);
886
-	$settings = array_merge($settings,array('globalCenterLatitude' => $latitudecenter,'globalCenterLongitude' => $longitudecenter));
884
+	$latitudecenter = filter_input(INPUT_POST, 'latitudecenter', FILTER_SANITIZE_STRING);
885
+	$longitudecenter = filter_input(INPUT_POST, 'longitudecenter', FILTER_SANITIZE_STRING);
886
+	$settings = array_merge($settings, array('globalCenterLatitude' => $latitudecenter, 'globalCenterLongitude' => $longitudecenter));
887 887
 
888
-	$acars = filter_input(INPUT_POST,'acars',FILTER_SANITIZE_STRING);
888
+	$acars = filter_input(INPUT_POST, 'acars', FILTER_SANITIZE_STRING);
889 889
 	if ($acars == 'acars') {
890
-		$settings = array_merge($settings,array('globalACARS' => 'TRUE'));
890
+		$settings = array_merge($settings, array('globalACARS' => 'TRUE'));
891 891
 	} else {
892
-		$settings = array_merge($settings,array('globalACARS' => 'FALSE'));
892
+		$settings = array_merge($settings, array('globalACARS' => 'FALSE'));
893 893
 	}
894 894
 
895
-	$flightawareusername = filter_input(INPUT_POST,'flightawareusername',FILTER_SANITIZE_STRING);
896
-	$flightawarepassword = filter_input(INPUT_POST,'flightawarepassword',FILTER_SANITIZE_STRING);
897
-	$settings = array_merge($settings,array('globalFlightAwareUsername' => $flightawareusername,'globalFlightAwarePassword' => $flightawarepassword));
895
+	$flightawareusername = filter_input(INPUT_POST, 'flightawareusername', FILTER_SANITIZE_STRING);
896
+	$flightawarepassword = filter_input(INPUT_POST, 'flightawarepassword', FILTER_SANITIZE_STRING);
897
+	$settings = array_merge($settings, array('globalFlightAwareUsername' => $flightawareusername, 'globalFlightAwarePassword' => $flightawarepassword));
898 898
 	
899 899
 	$source_name = $_POST['source_name'];
900 900
 	$source_latitude = $_POST['source_latitude'];
@@ -908,8 +908,8 @@  discard block
 block discarded – undo
908 908
 	
909 909
 	$sources = array();
910 910
 	foreach ($source_name as $keys => $name) {
911
-	    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]);
912
-	    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]);
911
+	    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]);
912
+	    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]);
913 913
 	}
914 914
 	if (count($sources) > 0) $_SESSION['sources'] = $sources;
915 915
 
@@ -922,23 +922,23 @@  discard block
 block discarded – undo
922 922
 	$sbsurl = $_POST['sbsurl'];
923 923
 	*/
924 924
 
925
-	$globalvatsim = filter_input(INPUT_POST,'globalvatsim',FILTER_SANITIZE_STRING);
926
-	$globalivao = filter_input(INPUT_POST,'globalivao',FILTER_SANITIZE_STRING);
927
-	$globalphpvms = filter_input(INPUT_POST,'globalphpvms',FILTER_SANITIZE_STRING);
928
-	$globalvam = filter_input(INPUT_POST,'globalvam',FILTER_SANITIZE_STRING);
929
-	$globalsbs = filter_input(INPUT_POST,'globalsbs',FILTER_SANITIZE_STRING);
930
-	$globalaprs = filter_input(INPUT_POST,'globalaprs',FILTER_SANITIZE_STRING);
931
-	$datasource = filter_input(INPUT_POST,'datasource',FILTER_SANITIZE_STRING);
925
+	$globalvatsim = filter_input(INPUT_POST, 'globalvatsim', FILTER_SANITIZE_STRING);
926
+	$globalivao = filter_input(INPUT_POST, 'globalivao', FILTER_SANITIZE_STRING);
927
+	$globalphpvms = filter_input(INPUT_POST, 'globalphpvms', FILTER_SANITIZE_STRING);
928
+	$globalvam = filter_input(INPUT_POST, 'globalvam', FILTER_SANITIZE_STRING);
929
+	$globalsbs = filter_input(INPUT_POST, 'globalsbs', FILTER_SANITIZE_STRING);
930
+	$globalaprs = filter_input(INPUT_POST, 'globalaprs', FILTER_SANITIZE_STRING);
931
+	$datasource = filter_input(INPUT_POST, 'datasource', FILTER_SANITIZE_STRING);
932 932
 
933
-	$globalaircraft = filter_input(INPUT_POST,'globalaircraft',FILTER_SANITIZE_STRING);
934
-	if ($globalaircraft == 'aircraft') $settings = array_merge($settings,array('globalAircraft' => 'TRUE'));
935
-	else $settings = array_merge($settings,array('globalAircraft' => 'FALSE'));
936
-	$globaltracker = filter_input(INPUT_POST,'globaltracker',FILTER_SANITIZE_STRING);
937
-	if ($globaltracker == 'tracker') $settings = array_merge($settings,array('globalTracker' => 'TRUE'));
938
-	else $settings = array_merge($settings,array('globalTracker' => 'FALSE'));
939
-	$globalmarine = filter_input(INPUT_POST,'globalmarine',FILTER_SANITIZE_STRING);
940
-	if ($globalmarine == 'marine') $settings = array_merge($settings,array('globalMarine' => 'TRUE'));
941
-	else $settings = array_merge($settings,array('globalMarine' => 'FALSE'));
933
+	$globalaircraft = filter_input(INPUT_POST, 'globalaircraft', FILTER_SANITIZE_STRING);
934
+	if ($globalaircraft == 'aircraft') $settings = array_merge($settings, array('globalAircraft' => 'TRUE'));
935
+	else $settings = array_merge($settings, array('globalAircraft' => 'FALSE'));
936
+	$globaltracker = filter_input(INPUT_POST, 'globaltracker', FILTER_SANITIZE_STRING);
937
+	if ($globaltracker == 'tracker') $settings = array_merge($settings, array('globalTracker' => 'TRUE'));
938
+	else $settings = array_merge($settings, array('globalTracker' => 'FALSE'));
939
+	$globalmarine = filter_input(INPUT_POST, 'globalmarine', FILTER_SANITIZE_STRING);
940
+	if ($globalmarine == 'marine') $settings = array_merge($settings, array('globalMarine' => 'TRUE'));
941
+	else $settings = array_merge($settings, array('globalMarine' => 'FALSE'));
942 942
 
943 943
 /*	
944 944
 	$globalSBS1Hosts = array();
@@ -954,7 +954,7 @@  discard block
 block discarded – undo
954 954
 	}
955 955
 	$settings = array_merge($settings,array('globalSBS1Hosts' => $globalSBS1Hosts));
956 956
 */
957
-	$settings_comment = array_merge($settings_comment,array('globalSBS1Hosts'));
957
+	$settings_comment = array_merge($settings_comment, array('globalSBS1Hosts'));
958 958
 	$host = $_POST['host'];
959 959
 	$port = $_POST['port'];
960 960
 	$name = $_POST['name'];
@@ -965,96 +965,96 @@  discard block
 block discarded – undo
965 965
 	foreach ($host as $key => $h) {
966 966
 		if (isset($sourcestats[$key]) && $sourcestats[$key] == 1) $cov = 'TRUE';
967 967
 		else $cov = 'FALSE';
968
-		if ($h != '') $gSources[] = array('host' => $h, 'port' => $port[$key],'name' => $name[$key],'format' => $format[$key],'sourcestats' => $cov);
968
+		if ($h != '') $gSources[] = array('host' => $h, 'port' => $port[$key], 'name' => $name[$key], 'format' => $format[$key], 'sourcestats' => $cov);
969 969
 	}
970
-	$settings = array_merge($settings,array('globalSources' => $gSources));
970
+	$settings = array_merge($settings, array('globalSources' => $gSources));
971 971
 
972 972
 /*
973 973
 	$sbstimeout = filter_input(INPUT_POST,'sbstimeout',FILTER_SANITIZE_NUMBER_INT);
974 974
 	$settings = array_merge($settings,array('globalSourcesTimeOut' => $sbstimeout));
975 975
 */
976
-	$acarshost = filter_input(INPUT_POST,'acarshost',FILTER_SANITIZE_STRING);
977
-	$acarsport = filter_input(INPUT_POST,'acarsport',FILTER_SANITIZE_NUMBER_INT);
978
-	$settings = array_merge($settings,array('globalACARSHost' => $acarshost,'globalACARSPort' => $acarsport));
976
+	$acarshost = filter_input(INPUT_POST, 'acarshost', FILTER_SANITIZE_STRING);
977
+	$acarsport = filter_input(INPUT_POST, 'acarsport', FILTER_SANITIZE_NUMBER_INT);
978
+	$settings = array_merge($settings, array('globalACARSHost' => $acarshost, 'globalACARSPort' => $acarsport));
979 979
 
980
-	$bitly = filter_input(INPUT_POST,'bitly',FILTER_SANITIZE_STRING);
981
-	$settings = array_merge($settings,array('globalBitlyAccessToken' => $bitly));
980
+	$bitly = filter_input(INPUT_POST, 'bitly', FILTER_SANITIZE_STRING);
981
+	$settings = array_merge($settings, array('globalBitlyAccessToken' => $bitly));
982 982
 
983
-	$notamsource = filter_input(INPUT_POST,'notamsource',FILTER_SANITIZE_STRING);
984
-	$settings = array_merge($settings,array('globalNOTAMSource' => $notamsource));
985
-	$metarsource = filter_input(INPUT_POST,'metarsource',FILTER_SANITIZE_STRING);
986
-	$settings = array_merge($settings,array('globalMETARurl' => $metarsource));
983
+	$notamsource = filter_input(INPUT_POST, 'notamsource', FILTER_SANITIZE_STRING);
984
+	$settings = array_merge($settings, array('globalNOTAMSource' => $notamsource));
985
+	$metarsource = filter_input(INPUT_POST, 'metarsource', FILTER_SANITIZE_STRING);
986
+	$settings = array_merge($settings, array('globalMETARurl' => $metarsource));
987 987
 
988
-	$zoilatitude = filter_input(INPUT_POST,'zoilatitude',FILTER_SANITIZE_STRING);
989
-	$zoilongitude = filter_input(INPUT_POST,'zoilongitude',FILTER_SANITIZE_STRING);
990
-	$zoidistance = filter_input(INPUT_POST,'zoidistance',FILTER_SANITIZE_NUMBER_INT);
988
+	$zoilatitude = filter_input(INPUT_POST, 'zoilatitude', FILTER_SANITIZE_STRING);
989
+	$zoilongitude = filter_input(INPUT_POST, 'zoilongitude', FILTER_SANITIZE_STRING);
990
+	$zoidistance = filter_input(INPUT_POST, 'zoidistance', FILTER_SANITIZE_NUMBER_INT);
991 991
 	if ($zoilatitude != '' && $zoilongitude != '' && $zoidistance != '') {
992
-		$settings = array_merge($settings,array('globalDistanceIgnore' => array('latitude' => $zoilatitude,'longitude' => $zoilongitude,'distance' => $zoidistance)));
993
-	} else $settings = array_merge($settings,array('globalDistanceIgnore' => array()));
992
+		$settings = array_merge($settings, array('globalDistanceIgnore' => array('latitude' => $zoilatitude, 'longitude' => $zoilongitude, 'distance' => $zoidistance)));
993
+	} else $settings = array_merge($settings, array('globalDistanceIgnore' => array()));
994 994
 
995
-	$refresh = filter_input(INPUT_POST,'refresh',FILTER_SANITIZE_NUMBER_INT);
996
-	$settings = array_merge($settings,array('globalLiveInterval' => $refresh));
997
-	$maprefresh = filter_input(INPUT_POST,'maprefresh',FILTER_SANITIZE_NUMBER_INT);
998
-	$settings = array_merge($settings,array('globalMapRefresh' => $maprefresh));
999
-	$mapidle = filter_input(INPUT_POST,'mapidle',FILTER_SANITIZE_NUMBER_INT);
1000
-	$settings = array_merge($settings,array('globalMapIdleTimeout' => $mapidle));
1001
-	$closestmindist = filter_input(INPUT_POST,'closestmindist',FILTER_SANITIZE_NUMBER_INT);
1002
-	$settings = array_merge($settings,array('globalClosestMinDist' => $closestmindist));
995
+	$refresh = filter_input(INPUT_POST, 'refresh', FILTER_SANITIZE_NUMBER_INT);
996
+	$settings = array_merge($settings, array('globalLiveInterval' => $refresh));
997
+	$maprefresh = filter_input(INPUT_POST, 'maprefresh', FILTER_SANITIZE_NUMBER_INT);
998
+	$settings = array_merge($settings, array('globalMapRefresh' => $maprefresh));
999
+	$mapidle = filter_input(INPUT_POST, 'mapidle', FILTER_SANITIZE_NUMBER_INT);
1000
+	$settings = array_merge($settings, array('globalMapIdleTimeout' => $mapidle));
1001
+	$closestmindist = filter_input(INPUT_POST, 'closestmindist', FILTER_SANITIZE_NUMBER_INT);
1002
+	$settings = array_merge($settings, array('globalClosestMinDist' => $closestmindist));
1003 1003
 
1004
-	$aircraftsize = filter_input(INPUT_POST,'aircraftsize',FILTER_SANITIZE_NUMBER_INT);
1005
-	$settings = array_merge($settings,array('globalAircraftSize' => $aircraftsize));
1004
+	$aircraftsize = filter_input(INPUT_POST, 'aircraftsize', FILTER_SANITIZE_NUMBER_INT);
1005
+	$settings = array_merge($settings, array('globalAircraftSize' => $aircraftsize));
1006 1006
 
1007
-	$archivemonths = filter_input(INPUT_POST,'archivemonths',FILTER_SANITIZE_NUMBER_INT);
1008
-	$settings = array_merge($settings,array('globalArchiveMonths' => $archivemonths));
1007
+	$archivemonths = filter_input(INPUT_POST, 'archivemonths', FILTER_SANITIZE_NUMBER_INT);
1008
+	$settings = array_merge($settings, array('globalArchiveMonths' => $archivemonths));
1009 1009
 	
1010
-	$archiveyear = filter_input(INPUT_POST,'archiveyear',FILTER_SANITIZE_STRING);
1010
+	$archiveyear = filter_input(INPUT_POST, 'archiveyear', FILTER_SANITIZE_STRING);
1011 1011
 	if ($archiveyear == "archiveyear") {
1012
-		$settings = array_merge($settings,array('globalArchiveYear' => 'TRUE'));
1012
+		$settings = array_merge($settings, array('globalArchiveYear' => 'TRUE'));
1013 1013
 	} else {
1014
-		$settings = array_merge($settings,array('globalArchiveYear' => 'FALSE'));
1014
+		$settings = array_merge($settings, array('globalArchiveYear' => 'FALSE'));
1015 1015
 	}
1016
-	$archivekeepmonths = filter_input(INPUT_POST,'archivekeepmonths',FILTER_SANITIZE_NUMBER_INT);
1017
-	$settings = array_merge($settings,array('globalArchiveKeepMonths' => $archivekeepmonths));
1018
-	$archivekeeptrackmonths = filter_input(INPUT_POST,'archivekeeptrackmonths',FILTER_SANITIZE_NUMBER_INT);
1019
-	$settings = array_merge($settings,array('globalArchiveKeepTrackMonths' => $archivekeeptrackmonths));
1016
+	$archivekeepmonths = filter_input(INPUT_POST, 'archivekeepmonths', FILTER_SANITIZE_NUMBER_INT);
1017
+	$settings = array_merge($settings, array('globalArchiveKeepMonths' => $archivekeepmonths));
1018
+	$archivekeeptrackmonths = filter_input(INPUT_POST, 'archivekeeptrackmonths', FILTER_SANITIZE_NUMBER_INT);
1019
+	$settings = array_merge($settings, array('globalArchiveKeepTrackMonths' => $archivekeeptrackmonths));
1020 1020
 
1021
-	$britishairways = filter_input(INPUT_POST,'britishairways',FILTER_SANITIZE_STRING);
1022
-	$settings = array_merge($settings,array('globalBritishAirwaysKey' => $britishairways));
1023
-	$transavia = filter_input(INPUT_POST,'transavia',FILTER_SANITIZE_STRING);
1024
-	$settings = array_merge($settings,array('globalTransaviaKey' => $transavia));
1021
+	$britishairways = filter_input(INPUT_POST, 'britishairways', FILTER_SANITIZE_STRING);
1022
+	$settings = array_merge($settings, array('globalBritishAirwaysKey' => $britishairways));
1023
+	$transavia = filter_input(INPUT_POST, 'transavia', FILTER_SANITIZE_STRING);
1024
+	$settings = array_merge($settings, array('globalTransaviaKey' => $transavia));
1025 1025
 
1026
-	$lufthansakey = filter_input(INPUT_POST,'lufthansakey',FILTER_SANITIZE_STRING);
1027
-	$lufthansasecret = filter_input(INPUT_POST,'lufthansasecret',FILTER_SANITIZE_STRING);
1028
-	$settings = array_merge($settings,array('globalLufthansaKey' => array('key' => $lufthansakey,'secret' => $lufthansasecret)));
1026
+	$lufthansakey = filter_input(INPUT_POST, 'lufthansakey', FILTER_SANITIZE_STRING);
1027
+	$lufthansasecret = filter_input(INPUT_POST, 'lufthansasecret', FILTER_SANITIZE_STRING);
1028
+	$settings = array_merge($settings, array('globalLufthansaKey' => array('key' => $lufthansakey, 'secret' => $lufthansasecret)));
1029 1029
 
1030 1030
 	// Create in settings.php keys not yet configurable if not already here
1031 1031
 	//if (!isset($globalImageBingKey)) $settings = array_merge($settings,array('globalImageBingKey' => ''));
1032
-	if (!isset($globalDebug)) $settings = array_merge($settings,array('globalDebug' => 'TRUE'));
1032
+	if (!isset($globalDebug)) $settings = array_merge($settings, array('globalDebug' => 'TRUE'));
1033 1033
 
1034
-	$resetyearstats = filter_input(INPUT_POST,'resetyearstats',FILTER_SANITIZE_STRING);
1034
+	$resetyearstats = filter_input(INPUT_POST, 'resetyearstats', FILTER_SANITIZE_STRING);
1035 1035
 	if ($resetyearstats == 'resetyearstats') {
1036
-		$settings = array_merge($settings,array('globalDeleteLastYearStats' => 'TRUE'));
1036
+		$settings = array_merge($settings, array('globalDeleteLastYearStats' => 'TRUE'));
1037 1037
 	} else {
1038
-		$settings = array_merge($settings,array('globalDeleteLastYearStats' => 'FALSE'));
1038
+		$settings = array_merge($settings, array('globalDeleteLastYearStats' => 'FALSE'));
1039 1039
 	}
1040 1040
 
1041
-	$archive = filter_input(INPUT_POST,'archive',FILTER_SANITIZE_STRING);
1041
+	$archive = filter_input(INPUT_POST, 'archive', FILTER_SANITIZE_STRING);
1042 1042
 	if ($archive == 'archive') {
1043
-		$settings = array_merge($settings,array('globalArchive' => 'TRUE'));
1043
+		$settings = array_merge($settings, array('globalArchive' => 'TRUE'));
1044 1044
 	} else {
1045
-		$settings = array_merge($settings,array('globalArchive' => 'FALSE'));
1045
+		$settings = array_merge($settings, array('globalArchive' => 'FALSE'));
1046 1046
 	}
1047
-	$daemon = filter_input(INPUT_POST,'daemon',FILTER_SANITIZE_STRING);
1047
+	$daemon = filter_input(INPUT_POST, 'daemon', FILTER_SANITIZE_STRING);
1048 1048
 	if ($daemon == 'daemon') {
1049
-		$settings = array_merge($settings,array('globalDaemon' => 'TRUE'));
1049
+		$settings = array_merge($settings, array('globalDaemon' => 'TRUE'));
1050 1050
 	} else {
1051
-		$settings = array_merge($settings,array('globalDaemon' => 'FALSE'));
1051
+		$settings = array_merge($settings, array('globalDaemon' => 'FALSE'));
1052 1052
 	}
1053
-	$schedules = filter_input(INPUT_POST,'schedules',FILTER_SANITIZE_STRING);
1053
+	$schedules = filter_input(INPUT_POST, 'schedules', FILTER_SANITIZE_STRING);
1054 1054
 	if ($schedules == 'schedules') {
1055
-		$settings = array_merge($settings,array('globalSchedulesFetch' => 'TRUE'));
1055
+		$settings = array_merge($settings, array('globalSchedulesFetch' => 'TRUE'));
1056 1056
 	} else {
1057
-		$settings = array_merge($settings,array('globalSchedulesFetch' => 'FALSE'));
1057
+		$settings = array_merge($settings, array('globalSchedulesFetch' => 'FALSE'));
1058 1058
 	}
1059 1059
 
1060 1060
 /*
@@ -1065,177 +1065,177 @@  discard block
 block discarded – undo
1065 1065
 		$settings = array_merge($settings,array('globalFlightAware' => 'FALSE','globalSBS1' => 'TRUE'));
1066 1066
 	}
1067 1067
 */
1068
-	$settings = array_merge($settings,array('globalFlightAware' => 'FALSE'));
1069
-	if ($globalsbs == 'sbs') $settings = array_merge($settings,array('globalSBS1' => 'TRUE'));
1070
-	else $settings = array_merge($settings,array('globalSBS1' => 'FALSE'));
1071
-	if ($globalaprs == 'aprs') $settings = array_merge($settings,array('globalAPRS' => 'TRUE'));
1072
-	else $settings = array_merge($settings,array('globalAPRS' => 'FALSE'));
1068
+	$settings = array_merge($settings, array('globalFlightAware' => 'FALSE'));
1069
+	if ($globalsbs == 'sbs') $settings = array_merge($settings, array('globalSBS1' => 'TRUE'));
1070
+	else $settings = array_merge($settings, array('globalSBS1' => 'FALSE'));
1071
+	if ($globalaprs == 'aprs') $settings = array_merge($settings, array('globalAPRS' => 'TRUE'));
1072
+	else $settings = array_merge($settings, array('globalAPRS' => 'FALSE'));
1073 1073
 	if ($globalivao == 'ivao') {
1074 1074
 		//$settings = array_merge($settings,array('globalIVAO' => 'TRUE','globalVATSIM' => 'FALSE'));
1075
-		$settings = array_merge($settings,array('globalIVAO' => 'TRUE'));
1076
-	} else $settings = array_merge($settings,array('globalIVAO' => 'FALSE'));
1075
+		$settings = array_merge($settings, array('globalIVAO' => 'TRUE'));
1076
+	} else $settings = array_merge($settings, array('globalIVAO' => 'FALSE'));
1077 1077
 	if ($globalvatsim == 'vatsim') {
1078 1078
 		//$settings = array_merge($settings,array('globalVATSIM' => 'TRUE','globalIVAO' => 'FALSE'));
1079
-		$settings = array_merge($settings,array('globalVATSIM' => 'TRUE'));
1080
-	} else $settings = array_merge($settings,array('globalVATSIM' => 'FALSE'));
1079
+		$settings = array_merge($settings, array('globalVATSIM' => 'TRUE'));
1080
+	} else $settings = array_merge($settings, array('globalVATSIM' => 'FALSE'));
1081 1081
 	if ($globalphpvms == 'phpvms') {
1082
-		$settings = array_merge($settings,array('globalphpVMS' => 'TRUE'));
1083
-	} else $settings = array_merge($settings,array('globalphpVMS' => 'FALSE'));
1082
+		$settings = array_merge($settings, array('globalphpVMS' => 'TRUE'));
1083
+	} else $settings = array_merge($settings, array('globalphpVMS' => 'FALSE'));
1084 1084
 	if ($globalvam == 'vam') {
1085
-		$settings = array_merge($settings,array('globalVAM' => 'TRUE'));
1086
-	} else $settings = array_merge($settings,array('globalVAM' => 'FALSE'));
1085
+		$settings = array_merge($settings, array('globalVAM' => 'TRUE'));
1086
+	} else $settings = array_merge($settings, array('globalVAM' => 'FALSE'));
1087 1087
 	if ($globalvatsim == 'vatsim' || $globalivao == 'ivao' || $globalphpvms == 'phpvms') {
1088
-		$settings = array_merge($settings,array('globalSchedulesFetch' => 'FALSE','globalTranslationFetch' => 'FALSE'));
1089
-	} else $settings = array_merge($settings,array('globalSchedulesFetch' => 'TRUE','globalTranslationFetch' => 'TRUE'));
1088
+		$settings = array_merge($settings, array('globalSchedulesFetch' => 'FALSE', 'globalTranslationFetch' => 'FALSE'));
1089
+	} else $settings = array_merge($settings, array('globalSchedulesFetch' => 'TRUE', 'globalTranslationFetch' => 'TRUE'));
1090 1090
 	
1091 1091
 
1092 1092
 
1093
-	$notam = filter_input(INPUT_POST,'notam',FILTER_SANITIZE_STRING);
1093
+	$notam = filter_input(INPUT_POST, 'notam', FILTER_SANITIZE_STRING);
1094 1094
 	if ($notam == 'notam') {
1095
-		$settings = array_merge($settings,array('globalNOTAM' => 'TRUE'));
1095
+		$settings = array_merge($settings, array('globalNOTAM' => 'TRUE'));
1096 1096
 	} else {
1097
-		$settings = array_merge($settings,array('globalNOTAM' => 'FALSE'));
1097
+		$settings = array_merge($settings, array('globalNOTAM' => 'FALSE'));
1098 1098
 	}
1099
-	$owner = filter_input(INPUT_POST,'owner',FILTER_SANITIZE_STRING);
1099
+	$owner = filter_input(INPUT_POST, 'owner', FILTER_SANITIZE_STRING);
1100 1100
 	if ($owner == 'owner') {
1101
-		$settings = array_merge($settings,array('globalOwner' => 'TRUE'));
1101
+		$settings = array_merge($settings, array('globalOwner' => 'TRUE'));
1102 1102
 	} else {
1103
-		$settings = array_merge($settings,array('globalOwner' => 'FALSE'));
1103
+		$settings = array_merge($settings, array('globalOwner' => 'FALSE'));
1104 1104
 	}
1105
-	$map3d = filter_input(INPUT_POST,'map3d',FILTER_SANITIZE_STRING);
1105
+	$map3d = filter_input(INPUT_POST, 'map3d', FILTER_SANITIZE_STRING);
1106 1106
 	if ($map3d == 'map3d') {
1107
-		$settings = array_merge($settings,array('globalMap3D' => 'TRUE'));
1107
+		$settings = array_merge($settings, array('globalMap3D' => 'TRUE'));
1108 1108
 	} else {
1109
-		$settings = array_merge($settings,array('globalMap3D' => 'FALSE'));
1109
+		$settings = array_merge($settings, array('globalMap3D' => 'FALSE'));
1110 1110
 	}
1111
-	$crash = filter_input(INPUT_POST,'crash',FILTER_SANITIZE_STRING);
1111
+	$crash = filter_input(INPUT_POST, 'crash', FILTER_SANITIZE_STRING);
1112 1112
 	if ($crash == 'crash') {
1113
-		$settings = array_merge($settings,array('globalAccidents' => 'TRUE'));
1113
+		$settings = array_merge($settings, array('globalAccidents' => 'TRUE'));
1114 1114
 	} else {
1115
-		$settings = array_merge($settings,array('globalAccidents' => 'FALSE'));
1115
+		$settings = array_merge($settings, array('globalAccidents' => 'FALSE'));
1116 1116
 	}
1117
-	$mapsatellites = filter_input(INPUT_POST,'mapsatellites',FILTER_SANITIZE_STRING);
1117
+	$mapsatellites = filter_input(INPUT_POST, 'mapsatellites', FILTER_SANITIZE_STRING);
1118 1118
 	if ($mapsatellites == 'mapsatellites') {
1119
-		$settings = array_merge($settings,array('globalMapSatellites' => 'TRUE'));
1119
+		$settings = array_merge($settings, array('globalMapSatellites' => 'TRUE'));
1120 1120
 	} else {
1121
-		$settings = array_merge($settings,array('globalMapSatellites' => 'FALSE'));
1121
+		$settings = array_merge($settings, array('globalMapSatellites' => 'FALSE'));
1122 1122
 	}
1123
-	$map3ddefault = filter_input(INPUT_POST,'map3ddefault',FILTER_SANITIZE_STRING);
1123
+	$map3ddefault = filter_input(INPUT_POST, 'map3ddefault', FILTER_SANITIZE_STRING);
1124 1124
 	if ($map3ddefault == 'map3ddefault') {
1125
-		$settings = array_merge($settings,array('globalMap3Ddefault' => 'TRUE'));
1125
+		$settings = array_merge($settings, array('globalMap3Ddefault' => 'TRUE'));
1126 1126
 	} else {
1127
-		$settings = array_merge($settings,array('globalMap3Ddefault' => 'FALSE'));
1127
+		$settings = array_merge($settings, array('globalMap3Ddefault' => 'FALSE'));
1128 1128
 	}
1129
-	$translate = filter_input(INPUT_POST,'translate',FILTER_SANITIZE_STRING);
1129
+	$translate = filter_input(INPUT_POST, 'translate', FILTER_SANITIZE_STRING);
1130 1130
 	if ($translate == 'translate') {
1131
-		$settings = array_merge($settings,array('globalTranslate' => 'TRUE'));
1131
+		$settings = array_merge($settings, array('globalTranslate' => 'TRUE'));
1132 1132
 	} else {
1133
-		$settings = array_merge($settings,array('globalTranslate' => 'FALSE'));
1133
+		$settings = array_merge($settings, array('globalTranslate' => 'FALSE'));
1134 1134
 	}
1135
-	$realairlines = filter_input(INPUT_POST,'realairlines',FILTER_SANITIZE_STRING);
1135
+	$realairlines = filter_input(INPUT_POST, 'realairlines', FILTER_SANITIZE_STRING);
1136 1136
 	if ($realairlines == 'realairlines') {
1137
-		$settings = array_merge($settings,array('globalUseRealAirlines' => 'TRUE'));
1137
+		$settings = array_merge($settings, array('globalUseRealAirlines' => 'TRUE'));
1138 1138
 	} else {
1139
-		$settings = array_merge($settings,array('globalUseRealAirlines' => 'FALSE'));
1139
+		$settings = array_merge($settings, array('globalUseRealAirlines' => 'FALSE'));
1140 1140
 	}
1141
-	$estimation = filter_input(INPUT_POST,'estimation',FILTER_SANITIZE_STRING);
1141
+	$estimation = filter_input(INPUT_POST, 'estimation', FILTER_SANITIZE_STRING);
1142 1142
 	if ($estimation == 'estimation') {
1143
-		$settings = array_merge($settings,array('globalMapEstimation' => 'TRUE'));
1143
+		$settings = array_merge($settings, array('globalMapEstimation' => 'TRUE'));
1144 1144
 	} else {
1145
-		$settings = array_merge($settings,array('globalMapEstimation' => 'FALSE'));
1145
+		$settings = array_merge($settings, array('globalMapEstimation' => 'FALSE'));
1146 1146
 	}
1147
-	$metar = filter_input(INPUT_POST,'metar',FILTER_SANITIZE_STRING);
1147
+	$metar = filter_input(INPUT_POST, 'metar', FILTER_SANITIZE_STRING);
1148 1148
 	if ($metar == 'metar') {
1149
-		$settings = array_merge($settings,array('globalMETAR' => 'TRUE'));
1149
+		$settings = array_merge($settings, array('globalMETAR' => 'TRUE'));
1150 1150
 	} else {
1151
-		$settings = array_merge($settings,array('globalMETAR' => 'FALSE'));
1151
+		$settings = array_merge($settings, array('globalMETAR' => 'FALSE'));
1152 1152
 	}
1153
-	$metarcycle = filter_input(INPUT_POST,'metarcycle',FILTER_SANITIZE_STRING);
1153
+	$metarcycle = filter_input(INPUT_POST, 'metarcycle', FILTER_SANITIZE_STRING);
1154 1154
 	if ($metarcycle == 'metarcycle') {
1155
-		$settings = array_merge($settings,array('globalMETARcycle' => 'TRUE'));
1155
+		$settings = array_merge($settings, array('globalMETARcycle' => 'TRUE'));
1156 1156
 	} else {
1157
-		$settings = array_merge($settings,array('globalMETARcycle' => 'FALSE'));
1157
+		$settings = array_merge($settings, array('globalMETARcycle' => 'FALSE'));
1158 1158
 	}
1159
-	$fork = filter_input(INPUT_POST,'fork',FILTER_SANITIZE_STRING);
1159
+	$fork = filter_input(INPUT_POST, 'fork', FILTER_SANITIZE_STRING);
1160 1160
 	if ($fork == 'fork') {
1161
-		$settings = array_merge($settings,array('globalFork' => 'TRUE'));
1161
+		$settings = array_merge($settings, array('globalFork' => 'TRUE'));
1162 1162
 	} else {
1163
-		$settings = array_merge($settings,array('globalFork' => 'FALSE'));
1163
+		$settings = array_merge($settings, array('globalFork' => 'FALSE'));
1164 1164
 	}
1165 1165
 
1166
-	$colormap = filter_input(INPUT_POST,'colormap',FILTER_SANITIZE_STRING);
1166
+	$colormap = filter_input(INPUT_POST, 'colormap', FILTER_SANITIZE_STRING);
1167 1167
 	if ($colormap == 'colormap') {
1168
-		$settings = array_merge($settings,array('globalMapAltitudeColor' => 'TRUE'));
1168
+		$settings = array_merge($settings, array('globalMapAltitudeColor' => 'TRUE'));
1169 1169
 	} else {
1170
-		$settings = array_merge($settings,array('globalMapAltitudeColor' => 'FALSE'));
1170
+		$settings = array_merge($settings, array('globalMapAltitudeColor' => 'FALSE'));
1171 1171
 	}
1172 1172
 	
1173 1173
 	if (isset($_POST['aircrafticoncolor'])) {
1174
-		$aircrafticoncolor = filter_input(INPUT_POST,'aircrafticoncolor',FILTER_SANITIZE_STRING);
1175
-		$settings = array_merge($settings,array('globalAircraftIconColor' => substr($aircrafticoncolor,1)));
1174
+		$aircrafticoncolor = filter_input(INPUT_POST, 'aircrafticoncolor', FILTER_SANITIZE_STRING);
1175
+		$settings = array_merge($settings, array('globalAircraftIconColor' => substr($aircrafticoncolor, 1)));
1176 1176
 	}
1177 1177
 
1178
-	$airportzoom = filter_input(INPUT_POST,'airportzoom',FILTER_SANITIZE_NUMBER_INT);
1179
-	$settings = array_merge($settings,array('globalAirportZoom' => $airportzoom));
1178
+	$airportzoom = filter_input(INPUT_POST, 'airportzoom', FILTER_SANITIZE_NUMBER_INT);
1179
+	$settings = array_merge($settings, array('globalAirportZoom' => $airportzoom));
1180 1180
 
1181
-	$unitdistance = filter_input(INPUT_POST,'unitdistance',FILTER_SANITIZE_STRING);
1182
-	$settings = array_merge($settings,array('globalUnitDistance' => $unitdistance));
1183
-	$unitaltitude = filter_input(INPUT_POST,'unitaltitude',FILTER_SANITIZE_STRING);
1184
-	$settings = array_merge($settings,array('globalUnitAltitude' => $unitaltitude));
1185
-	$unitspeed = filter_input(INPUT_POST,'unitspeed',FILTER_SANITIZE_STRING);
1186
-	$settings = array_merge($settings,array('globalUnitSpeed' => $unitspeed));
1181
+	$unitdistance = filter_input(INPUT_POST, 'unitdistance', FILTER_SANITIZE_STRING);
1182
+	$settings = array_merge($settings, array('globalUnitDistance' => $unitdistance));
1183
+	$unitaltitude = filter_input(INPUT_POST, 'unitaltitude', FILTER_SANITIZE_STRING);
1184
+	$settings = array_merge($settings, array('globalUnitAltitude' => $unitaltitude));
1185
+	$unitspeed = filter_input(INPUT_POST, 'unitspeed', FILTER_SANITIZE_STRING);
1186
+	$settings = array_merge($settings, array('globalUnitSpeed' => $unitspeed));
1187 1187
 
1188
-	$mappopup = filter_input(INPUT_POST,'mappopup',FILTER_SANITIZE_STRING);
1188
+	$mappopup = filter_input(INPUT_POST, 'mappopup', FILTER_SANITIZE_STRING);
1189 1189
 	if ($mappopup == 'mappopup') {
1190
-		$settings = array_merge($settings,array('globalMapPopup' => 'TRUE'));
1190
+		$settings = array_merge($settings, array('globalMapPopup' => 'TRUE'));
1191 1191
 	} else {
1192
-		$settings = array_merge($settings,array('globalMapPopup' => 'FALSE'));
1192
+		$settings = array_merge($settings, array('globalMapPopup' => 'FALSE'));
1193 1193
 	}
1194
-	$airportpopup = filter_input(INPUT_POST,'airportpopup',FILTER_SANITIZE_STRING);
1194
+	$airportpopup = filter_input(INPUT_POST, 'airportpopup', FILTER_SANITIZE_STRING);
1195 1195
 	if ($airportpopup == 'airportpopup') {
1196
-		$settings = array_merge($settings,array('globalAirportPopup' => 'TRUE'));
1196
+		$settings = array_merge($settings, array('globalAirportPopup' => 'TRUE'));
1197 1197
 	} else {
1198
-		$settings = array_merge($settings,array('globalAirportPopup' => 'FALSE'));
1198
+		$settings = array_merge($settings, array('globalAirportPopup' => 'FALSE'));
1199 1199
 	}
1200
-	$maphistory = filter_input(INPUT_POST,'maphistory',FILTER_SANITIZE_STRING);
1200
+	$maphistory = filter_input(INPUT_POST, 'maphistory', FILTER_SANITIZE_STRING);
1201 1201
 	if ($maphistory == 'maphistory') {
1202
-		$settings = array_merge($settings,array('globalMapHistory' => 'TRUE'));
1202
+		$settings = array_merge($settings, array('globalMapHistory' => 'TRUE'));
1203 1203
 	} else {
1204
-		$settings = array_merge($settings,array('globalMapHistory' => 'FALSE'));
1204
+		$settings = array_merge($settings, array('globalMapHistory' => 'FALSE'));
1205 1205
 	}
1206
-	$flightroute = filter_input(INPUT_POST,'flightroute',FILTER_SANITIZE_STRING);
1206
+	$flightroute = filter_input(INPUT_POST, 'flightroute', FILTER_SANITIZE_STRING);
1207 1207
 	if ($flightroute == 'flightroute') {
1208
-		$settings = array_merge($settings,array('globalMapRoute' => 'TRUE'));
1208
+		$settings = array_merge($settings, array('globalMapRoute' => 'TRUE'));
1209 1209
 	} else {
1210
-		$settings = array_merge($settings,array('globalMapRoute' => 'FALSE'));
1210
+		$settings = array_merge($settings, array('globalMapRoute' => 'FALSE'));
1211 1211
 	}
1212
-	$allflights = filter_input(INPUT_POST,'allflights',FILTER_SANITIZE_STRING);
1212
+	$allflights = filter_input(INPUT_POST, 'allflights', FILTER_SANITIZE_STRING);
1213 1213
 	if ($allflights == 'allflights') {
1214
-		$settings = array_merge($settings,array('globalAllFlights' => 'TRUE'));
1214
+		$settings = array_merge($settings, array('globalAllFlights' => 'TRUE'));
1215 1215
 	} else {
1216
-		$settings = array_merge($settings,array('globalAllFlights' => 'FALSE'));
1216
+		$settings = array_merge($settings, array('globalAllFlights' => 'FALSE'));
1217 1217
 	}
1218
-	$waypoints = filter_input(INPUT_POST,'waypoints',FILTER_SANITIZE_STRING);
1218
+	$waypoints = filter_input(INPUT_POST, 'waypoints', FILTER_SANITIZE_STRING);
1219 1219
 	if ($waypoints == 'waypoints') {
1220
-		$settings = array_merge($settings,array('globalWaypoints' => 'TRUE'));
1220
+		$settings = array_merge($settings, array('globalWaypoints' => 'TRUE'));
1221 1221
 	} else {
1222
-		$settings = array_merge($settings,array('globalWaypoints' => 'FALSE'));
1222
+		$settings = array_merge($settings, array('globalWaypoints' => 'FALSE'));
1223 1223
 	}
1224 1224
 
1225
-	if (!isset($globalTransaction)) $settings = array_merge($settings,array('globalTransaction' => 'TRUE'));
1225
+	if (!isset($globalTransaction)) $settings = array_merge($settings, array('globalTransaction' => 'TRUE'));
1226 1226
 
1227 1227
 	// Set some defaults values...
1228 1228
 	if (!isset($globalAircraftImageSources)) {
1229
-	    $globalAircraftImageSources = array('ivaomtl','wikimedia','airportdata','deviantart','flickr','bing','jetphotos','planepictures','planespotters');
1230
-	    $settings = array_merge($settings,array('globalAircraftImageSources' => $globalAircraftImageSources));
1229
+	    $globalAircraftImageSources = array('ivaomtl', 'wikimedia', 'airportdata', 'deviantart', 'flickr', 'bing', 'jetphotos', 'planepictures', 'planespotters');
1230
+	    $settings = array_merge($settings, array('globalAircraftImageSources' => $globalAircraftImageSources));
1231 1231
 	}
1232 1232
 
1233 1233
 	if (!isset($globalSchedulesSources)) {
1234
-	    $globalSchedulesSources = array('flightmapper','costtotravel','flightradar24','flightaware');
1235
-    	    $settings = array_merge($settings,array('globalSchedulesSources' => $globalSchedulesSources));
1234
+	    $globalSchedulesSources = array('flightmapper', 'costtotravel', 'flightradar24', 'flightaware');
1235
+    	    $settings = array_merge($settings, array('globalSchedulesSources' => $globalSchedulesSources));
1236 1236
     	}
1237 1237
 
1238
-	$settings = array_merge($settings,array('globalInstalled' => 'TRUE'));
1238
+	$settings = array_merge($settings, array('globalInstalled' => 'TRUE'));
1239 1239
 
1240 1240
 	if ($error == '') settings::modify_settings($settings);
1241 1241
 	if ($error == '') settings::comment_settings($settings_comment);
Please login to merge, or discard this patch.
marine-data.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -9,11 +9,11 @@  discard block
 block discarded – undo
9 9
 
10 10
 $from_archive = false;
11 11
 if (isset($_GET['ident'])) {
12
-	$ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING);
12
+	$ident = filter_input(INPUT_GET, 'ident', FILTER_SANITIZE_STRING);
13 13
 	if (isset($_GET['currenttime'])) {
14
-		$currenttime = filter_input(INPUT_GET,'currenttime',FILTER_SANITIZE_NUMBER_INT);
14
+		$currenttime = filter_input(INPUT_GET, 'currenttime', FILTER_SANITIZE_NUMBER_INT);
15 15
 		$currenttime = round($currenttime/1000);
16
-		$spotter_array = $MarineLive->getDateLiveMarineDataByIdent($ident,$currenttime);
16
+		$spotter_array = $MarineLive->getDateLiveMarineDataByIdent($ident, $currenttime);
17 17
 		/*
18 18
 		if (empty($spotter_array)) {
19 19
 			$from_archive = true;
@@ -31,11 +31,11 @@  discard block
 block discarded – undo
31 31
 	}
32 32
 }
33 33
 if (isset($_GET['fammarine_id'])) {
34
-	$fammarine_id = filter_input(INPUT_GET,'fammarine_id',FILTER_SANITIZE_STRING);
34
+	$fammarine_id = filter_input(INPUT_GET, 'fammarine_id', FILTER_SANITIZE_STRING);
35 35
 	if (isset($_GET['currenttime'])) {
36
-		$currenttime = filter_input(INPUT_GET,'currenttime',FILTER_SANITIZE_NUMBER_INT);
36
+		$currenttime = filter_input(INPUT_GET, 'currenttime', FILTER_SANITIZE_NUMBER_INT);
37 37
 		$currenttime = round($currenttime/1000);
38
-		$spotter_array = $MarineLive->getDateLiveMarineDataById($fammarine_id,$currenttime);
38
+		$spotter_array = $MarineLive->getDateLiveMarineDataById($fammarine_id, $currenttime);
39 39
 		/*
40 40
 		if (empty($spotter_array)) {
41 41
 			$from_archive = true;
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 if (isset($spotter_item['image_thumbnail']) && $spotter_item['image_thumbnail'] != "")
63 63
 {
64 64
 	if ($spotter_item['image_source'] == 'flickr' || $spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart') {
65
-		$image = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']);
65
+		$image = preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']);
66 66
 	} else $image = $spotter_item['image_thumbnail'];
67 67
 
68 68
 }
Please login to merge, or discard this patch.
require/class.Tracker.php 1 patch
Spacing   +139 added lines, -139 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
4 4
 require_once(dirname(__FILE__).'/class.Image.php');
5 5
 $global_query = "SELECT tracker_output.* FROM tracker_output";
6 6
 
7
-class Tracker{
7
+class Tracker {
8 8
 	public $db;
9 9
 	
10 10
 	public function __construct($dbc = null) {
@@ -18,33 +18,33 @@  discard block
 block discarded – undo
18 18
 	* @return Array the SQL part
19 19
 	*/
20 20
 	
21
-	public function getFilter($filter = array(),$where = false,$and = false) {
21
+	public function getFilter($filter = array(), $where = false, $and = false) {
22 22
 		global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver;
23 23
 		$filters = array();
24 24
 		if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) {
25 25
 			if (isset($globalStatsFilters[$globalFilterName][0]['source'])) {
26 26
 				$filters = $globalStatsFilters[$globalFilterName];
27 27
 			} else {
28
-				$filter = array_merge($filter,$globalStatsFilters[$globalFilterName]);
28
+				$filter = array_merge($filter, $globalStatsFilters[$globalFilterName]);
29 29
 			}
30 30
 		}
31 31
 		if (isset($filter[0]['source'])) {
32
-			$filters = array_merge($filters,$filter);
32
+			$filters = array_merge($filters, $filter);
33 33
 		}
34
-		if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter);
34
+		if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter);
35 35
 		$filter_query_join = '';
36 36
 		$filter_query_where = '';
37
-		foreach($filters as $flt) {
37
+		foreach ($filters as $flt) {
38 38
 			if (isset($flt['idents']) && !empty($flt['idents'])) {
39 39
 				if (isset($flt['source'])) {
40
-					$filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_output WHERE tracker_output.ident IN ('".implode("','",$flt['idents'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) spfi ON spfi.famtrackid = tracker_output.famtrackid";
40
+					$filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_output WHERE tracker_output.ident IN ('".implode("','", $flt['idents'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) spfi ON spfi.famtrackid = tracker_output.famtrackid";
41 41
 				} else {
42
-					$filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_output WHERE tracker_output.ident IN ('".implode("','",$flt['idents'])."')) spfi ON spfi.famtrackid = tracker_output.famtrackid";
42
+					$filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_output WHERE tracker_output.ident IN ('".implode("','", $flt['idents'])."')) spfi ON spfi.famtrackid = tracker_output.famtrackid";
43 43
 				}
44 44
 			}
45 45
 		}
46 46
 		if (isset($filter['source']) && !empty($filter['source'])) {
47
-			$filter_query_where .= " AND format_source IN ('".implode("','",$filter['source'])."')";
47
+			$filter_query_where .= " AND format_source IN ('".implode("','", $filter['source'])."')";
48 48
 		}
49 49
 		if (isset($filter['ident']) && !empty($filter['ident'])) {
50 50
 			$filter_query_where .= " AND ident = '".$filter['ident']."'";
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
74 74
 		elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND';
75 75
 		if ($filter_query_where != '') {
76
-			$filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where);
76
+			$filter_query_where = preg_replace('/^ AND/', ' WHERE', $filter_query_where);
77 77
 		}
78 78
 		$filter_query = $filter_query_join.$filter_query_where;
79 79
 		return $filter_query;
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
 	* @return Array the spotter information
89 89
 	*
90 90
 	*/
91
-	public function getDataFromDB($query, $params = array(), $limitQuery = '',$schedules = false)
91
+	public function getDataFromDB($query, $params = array(), $limitQuery = '', $schedules = false)
92 92
 	{
93 93
 		date_default_timezone_set('UTC');
94 94
 		if (!is_string($query))
@@ -108,13 +108,13 @@  discard block
 block discarded – undo
108 108
 			$sth = $this->db->prepare($query.$limitQuery);
109 109
 			$sth->execute($params);
110 110
 		} catch (PDOException $e) {
111
-			printf("Invalid query : %s\nWhole query: %s\n",$e->getMessage(), $query.$limitQuery);
111
+			printf("Invalid query : %s\nWhole query: %s\n", $e->getMessage(), $query.$limitQuery);
112 112
 			exit();
113 113
 		}
114 114
 		
115 115
 		$num_rows = 0;
116 116
 		$spotter_array = array();
117
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
117
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
118 118
 		{
119 119
 			$num_rows++;
120 120
 			$temp_array = array();
@@ -170,17 +170,17 @@  discard block
 block discarded – undo
170 170
 				{
171 171
 					$temp_array['date'] = "about ".$dateArray['hours']." hours ago";
172 172
 				} else {
173
-					$temp_array['date'] = date("M j Y, g:i a",strtotime($row['date']." UTC"));
173
+					$temp_array['date'] = date("M j Y, g:i a", strtotime($row['date']." UTC"));
174 174
 				}
175 175
 				$temp_array['date_minutes_past'] = $dateArray['minutes'];
176
-				$temp_array['date_iso_8601'] = date("c",strtotime($row['date']." UTC"));
177
-				$temp_array['date_rfc_2822'] = date("r",strtotime($row['date']." UTC"));
176
+				$temp_array['date_iso_8601'] = date("c", strtotime($row['date']." UTC"));
177
+				$temp_array['date_rfc_2822'] = date("r", strtotime($row['date']." UTC"));
178 178
 				$temp_array['date_unix'] = strtotime($row['date']." UTC");
179 179
 				if (isset($row['last_seen']) && $row['last_seen'] != '') {
180 180
 					if (strtotime($row['last_seen']) > strtotime($row['date'])) {
181 181
 						$temp_array['duration'] = strtotime($row['last_seen']) - strtotime($row['date']);
182
-						$temp_array['last_seen_date_iso_8601'] = date("c",strtotime($row['last_seen']." UTC"));
183
-						$temp_array['last_seen_date_rfc_2822'] = date("r",strtotime($row['last_seen']." UTC"));
182
+						$temp_array['last_seen_date_iso_8601'] = date("c", strtotime($row['last_seen']." UTC"));
183
+						$temp_array['last_seen_date_rfc_2822'] = date("r", strtotime($row['last_seen']." UTC"));
184 184
 						$temp_array['last_seen_date_unix'] = strtotime($row['last_seen']." UTC");
185 185
 					}
186 186
 				}
@@ -217,8 +217,8 @@  discard block
 block discarded – undo
217 217
 		{
218 218
 			$limit_array = explode(",", $limit);
219 219
 			
220
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
221
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
220
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
221
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
222 222
 			
223 223
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
224 224
 			{
@@ -235,9 +235,9 @@  discard block
 block discarded – undo
235 235
 			$orderby_query = " ORDER BY tracker_output.date DESC";
236 236
 		}
237 237
 
238
-		$query  = $global_query.$filter_query." ".$orderby_query;
238
+		$query = $global_query.$filter_query." ".$orderby_query;
239 239
 
240
-		$spotter_array = $this->getDataFromDB($query, array(),$limit_query,true);
240
+		$spotter_array = $this->getDataFromDB($query, array(), $limit_query, true);
241 241
 
242 242
 		return $spotter_array;
243 243
 	}
@@ -256,8 +256,8 @@  discard block
 block discarded – undo
256 256
 		if ($id == '') return array();
257 257
 		$additional_query = "tracker_output.famtrackid = :id";
258 258
 		$query_values = array(':id' => $id);
259
-		$query  = $global_query." WHERE ".$additional_query." ";
260
-		$spotter_array = $this->getDataFromDB($query,$query_values);
259
+		$query = $global_query." WHERE ".$additional_query." ";
260
+		$spotter_array = $this->getDataFromDB($query, $query_values);
261 261
 		return $spotter_array;
262 262
 	}
263 263
 
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
 		$query_values = array();
277 277
 		$limit_query = '';
278 278
 		$additional_query = '';
279
-		$filter_query = $this->getFilter($filter,true,true);
279
+		$filter_query = $this->getFilter($filter, true, true);
280 280
 		if ($ident != "")
281 281
 		{
282 282
 			if (!is_string($ident))
@@ -292,8 +292,8 @@  discard block
 block discarded – undo
292 292
 		{
293 293
 			$limit_array = explode(",", $limit);
294 294
 			
295
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
296
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
295
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
296
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
297 297
 			
298 298
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
299 299
 			{
@@ -317,7 +317,7 @@  discard block
 block discarded – undo
317 317
 		return $spotter_array;
318 318
 	}
319 319
 	
320
-	public function getSpotterDataByDate($date = '', $limit = '', $sort = '',$filter = array())
320
+	public function getSpotterDataByDate($date = '', $limit = '', $sort = '', $filter = array())
321 321
 	{
322 322
 		global $global_query, $globalTimezone, $globalDBdriver;
323 323
 		
@@ -325,7 +325,7 @@  discard block
 block discarded – undo
325 325
 		$limit_query = '';
326 326
 		$additional_query = '';
327 327
 
328
-		$filter_query = $this->getFilter($filter,true,true);
328
+		$filter_query = $this->getFilter($filter, true, true);
329 329
 		
330 330
 		if ($date != "")
331 331
 		{
@@ -351,8 +351,8 @@  discard block
 block discarded – undo
351 351
 		{
352 352
 			$limit_array = explode(",", $limit);
353 353
 			
354
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
355
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
354
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
355
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
356 356
 			
357 357
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
358 358
 			{
@@ -383,11 +383,11 @@  discard block
 block discarded – undo
383 383
 	* @return Array list of source name
384 384
 	*
385 385
 	*/
386
-	public function getAllSourceName($type = '',$filters = array())
386
+	public function getAllSourceName($type = '', $filters = array())
387 387
 	{
388
-		$filter_query = $this->getFilter($filters,true,true);
388
+		$filter_query = $this->getFilter($filters, true, true);
389 389
 		$query_values = array();
390
-		$query  = "SELECT DISTINCT tracker_output.source_name 
390
+		$query = "SELECT DISTINCT tracker_output.source_name 
391 391
 				FROM tracker_output".$filter_query." tracker_output.source_name <> ''";
392 392
 		if ($type != '') {
393 393
 			$query_values = array(':type' => $type);
@@ -402,7 +402,7 @@  discard block
 block discarded – undo
402 402
 		$source_array = array();
403 403
 		$temp_array = array();
404 404
 		
405
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
405
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
406 406
 		{
407 407
 			$temp_array['source_name'] = $row['source_name'];
408 408
 			$source_array[] = $temp_array;
@@ -419,8 +419,8 @@  discard block
 block discarded – undo
419 419
 	*/
420 420
 	public function getAllIdents($filters = array())
421 421
 	{
422
-		$filter_query = $this->getFilter($filters,true,true);
423
-		$query  = "SELECT DISTINCT tracker_output.ident
422
+		$filter_query = $this->getFilter($filters, true, true);
423
+		$query = "SELECT DISTINCT tracker_output.ident
424 424
 								FROM tracker_output".$filter_query." tracker_output.ident <> '' 
425 425
 								ORDER BY tracker_output.date ASC LIMIT 700 OFFSET 0";
426 426
 
@@ -430,7 +430,7 @@  discard block
 block discarded – undo
430 430
 		$ident_array = array();
431 431
 		$temp_array = array();
432 432
 		
433
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
433
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
434 434
 		{
435 435
 			$temp_array['ident'] = $row['ident'];
436 436
 			$ident_array[] = $temp_array;
@@ -455,12 +455,12 @@  discard block
 block discarded – undo
455 455
 		} else $offset = '+00:00';
456 456
 
457 457
 		if ($globalDBdriver == 'mysql') {
458
-			$query  = "SELECT DISTINCT DATE(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) as date
458
+			$query = "SELECT DISTINCT DATE(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) as date
459 459
 								FROM tracker_output
460 460
 								WHERE tracker_output.date <> '' 
461 461
 								ORDER BY tracker_output.date ASC LIMIT 0,200";
462 462
 		} else {
463
-			$query  = "SELECT DISTINCT to_char(tracker_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') as date
463
+			$query = "SELECT DISTINCT to_char(tracker_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') as date
464 464
 								FROM tracker_output
465 465
 								WHERE tracker_output.date <> '' 
466 466
 								ORDER BY tracker_output.date ASC LIMIT 0,200";
@@ -472,7 +472,7 @@  discard block
 block discarded – undo
472 472
 		$date_array = array();
473 473
 		$temp_array = array();
474 474
 		
475
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
475
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
476 476
 		{
477 477
 			$temp_array['date'] = $row['date'];
478 478
 
@@ -491,11 +491,11 @@  discard block
 block discarded – undo
491 491
 	* @return String success or false
492 492
 	*
493 493
 	*/	
494
-	public function updateIdentTrackerData($famtrackid = '', $ident = '',$fromsource = NULL)
494
+	public function updateIdentTrackerData($famtrackid = '', $ident = '', $fromsource = NULL)
495 495
 	{
496 496
 
497 497
 		$query = 'UPDATE tracker_output SET ident = :ident WHERE famtrackid = :famtrackid';
498
-                $query_values = array(':famtrackid' => $famtrackid,':ident' => $ident);
498
+                $query_values = array(':famtrackid' => $famtrackid, ':ident' => $ident);
499 499
 
500 500
 		try {
501 501
 			$sth = $this->db->prepare($query);
@@ -519,7 +519,7 @@  discard block
 block discarded – undo
519 519
 	public function updateLatestTrackerData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $groundspeed = NULL, $date = '')
520 520
 	{
521 521
 		$query = 'UPDATE tracker_output SET ident = :ident, last_latitude = :last_latitude, last_longitude = :last_longitude, last_altitude = :last_altitude, last_seen = :last_seen, last_ground_speed = :last_ground_speed WHERE famtrackid = :famtrackid';
522
-                $query_values = array(':famtrackid' => $famtrackid,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_altitude' => $altitude,':last_ground_speed' => $groundspeed,':last_seen' => $date,':ident' => $ident);
522
+                $query_values = array(':famtrackid' => $famtrackid, ':last_latitude' => $latitude, ':last_longitude' => $longitude, ':last_altitude' => $altitude, ':last_ground_speed' => $groundspeed, ':last_seen' => $date, ':ident' => $ident);
523 523
 
524 524
 		try {
525 525
 			$sth = $this->db->prepare($query);
@@ -559,7 +559,7 @@  discard block
 block discarded – undo
559 559
 	* @param String $verticalrate vertival rate of flight
560 560
 	* @return String success or false
561 561
 	*/
562
-	public function addTrackerData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $comment = '', $type = '',$format_source = '', $source_name = '')
562
+	public function addTrackerData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $comment = '', $type = '', $format_source = '', $source_name = '')
563 563
 	{
564 564
 		global $globalURL;
565 565
 		
@@ -627,21 +627,21 @@  discard block
 block discarded – undo
627 627
 		}
628 628
 
629 629
     
630
-		if ($date == "" || strtotime($date) < time()-20*60)
630
+		if ($date == "" || strtotime($date) < time() - 20*60)
631 631
 		{
632 632
 			$date = date("Y-m-d H:i:s", time());
633 633
 		}
634 634
 
635
-		$famtrackid = filter_var($famtrackid,FILTER_SANITIZE_STRING);
636
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
637
-		$latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
638
-		$longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
639
-		$altitude = filter_var($altitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
640
-		$heading = filter_var($heading,FILTER_SANITIZE_NUMBER_INT);
641
-		$groundspeed = filter_var($groundspeed,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
642
-		$format_source = filter_var($format_source,FILTER_SANITIZE_STRING);
643
-		$comment = filter_var($comment,FILTER_SANITIZE_STRING);
644
-		$type = filter_var($type,FILTER_SANITIZE_STRING);
635
+		$famtrackid = filter_var($famtrackid, FILTER_SANITIZE_STRING);
636
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
637
+		$latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
638
+		$longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
639
+		$altitude = filter_var($altitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
640
+		$heading = filter_var($heading, FILTER_SANITIZE_NUMBER_INT);
641
+		$groundspeed = filter_var($groundspeed, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
642
+		$format_source = filter_var($format_source, FILTER_SANITIZE_STRING);
643
+		$comment = filter_var($comment, FILTER_SANITIZE_STRING);
644
+		$type = filter_var($type, FILTER_SANITIZE_STRING);
645 645
 	
646 646
                 if ($latitude == '' && $longitude == '') {
647 647
             		$latitude = 0;
@@ -649,10 +649,10 @@  discard block
 block discarded – undo
649 649
             	}
650 650
                 if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
651 651
                 if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
652
-                $query  = "INSERT INTO tracker_output (famtrackid, ident, latitude, longitude, altitude, heading, ground_speed, date, format_source, source_name, comment, type) 
652
+                $query = "INSERT INTO tracker_output (famtrackid, ident, latitude, longitude, altitude, heading, ground_speed, date, format_source, source_name, comment, type) 
653 653
                 VALUES (:famtrackid,:ident,:latitude,:longitude,:altitude,:heading,:speed,:date,:format_source, :source_name,:comment,:type)";
654 654
 
655
-                $query_values = array(':famtrackid' => $famtrackid,':ident' => $ident,':latitude' => $latitude,':longitude' => $longitude,':altitude' => $altitude,':heading' => $heading,':speed' => $groundspeed,':date' => $date,':format_source' => $format_source, ':source_name' => $source_name,':comment' => $comment,':type' => $type);
655
+                $query_values = array(':famtrackid' => $famtrackid, ':ident' => $ident, ':latitude' => $latitude, ':longitude' => $longitude, ':altitude' => $altitude, ':heading' => $heading, ':speed' => $groundspeed, ':date' => $date, ':format_source' => $format_source, ':source_name' => $source_name, ':comment' => $comment, ':type' => $type);
656 656
 
657 657
 		try {
658 658
 		        
@@ -678,13 +678,13 @@  discard block
 block discarded – undo
678 678
 	{
679 679
 		global $globalDBdriver, $globalTimezone;
680 680
 		if ($globalDBdriver == 'mysql') {
681
-			$query  = "SELECT tracker_output.ident FROM tracker_output 
681
+			$query = "SELECT tracker_output.ident FROM tracker_output 
682 682
 								WHERE tracker_output.ident = :ident 
683 683
 								AND tracker_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) 
684 684
 								AND tracker_output.date < UTC_TIMESTAMP()";
685 685
 			$query_data = array(':ident' => $ident);
686 686
 		} else {
687
-			$query  = "SELECT tracker_output.ident FROM tracker_output 
687
+			$query = "SELECT tracker_output.ident FROM tracker_output 
688 688
 								WHERE tracker_output.ident = :ident 
689 689
 								AND tracker_output.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS'
690 690
 								AND tracker_output.date < now() AT TIME ZONE 'UTC'";
@@ -693,8 +693,8 @@  discard block
 block discarded – undo
693 693
 		
694 694
 		$sth = $this->db->prepare($query);
695 695
 		$sth->execute($query_data);
696
-    		$ident_result='';
697
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
696
+    		$ident_result = '';
697
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
698 698
 		{
699 699
 			$ident_result = $row['ident'];
700 700
 		}
@@ -720,8 +720,8 @@  discard block
 block discarded – undo
720 720
 				return false;
721 721
 			} else {
722 722
 				$q_array = explode(" ", $q);
723
-				foreach ($q_array as $q_item){
724
-					$q_item = filter_var($q_item,FILTER_SANITIZE_STRING);
723
+				foreach ($q_array as $q_item) {
724
+					$q_item = filter_var($q_item, FILTER_SANITIZE_STRING);
725 725
 					$additional_query .= " AND (";
726 726
 					$additional_query .= "(tracker_output.ident like '%".$q_item."%')";
727 727
 					$additional_query .= ")";
@@ -729,11 +729,11 @@  discard block
 block discarded – undo
729 729
 			}
730 730
 		}
731 731
 		if ($globalDBdriver == 'mysql') {
732
-			$query  = "SELECT tracker_output.* FROM tracker_output 
732
+			$query = "SELECT tracker_output.* FROM tracker_output 
733 733
 				WHERE tracker_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 20 SECOND) ".$additional_query." 
734 734
 				AND tracker_output.date < UTC_TIMESTAMP()";
735 735
 		} else {
736
-			$query  = "SELECT tracker_output.* FROM tracker_output 
736
+			$query = "SELECT tracker_output.* FROM tracker_output 
737 737
 				WHERE tracker_output.date::timestamp >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '20 SECONDS' ".$additional_query." 
738 738
 				AND tracker_output.date::timestamp < CURRENT_TIMESTAMP AT TIME ZONE 'UTC'";
739 739
 		}
@@ -806,11 +806,11 @@  discard block
 block discarded – undo
806 806
 	* @return Array the callsign list
807 807
 	*
808 808
 	*/
809
-	public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '', $month = '', $day = '')
809
+	public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '')
810 810
 	{
811 811
 		global $globalDBdriver;
812
-		$filter_query = $this->getFilter($filters,true,true);
813
-		$query  = "SELECT DISTINCT tracker_output.ident, COUNT(tracker_output.ident) AS callsign_icao_count 
812
+		$filter_query = $this->getFilter($filters, true, true);
813
+		$query = "SELECT DISTINCT tracker_output.ident, COUNT(tracker_output.ident) AS callsign_icao_count 
814 814
                     FROM tracker_output".$filter_query." tracker_output.ident <> ''";
815 815
 		 if ($olderthanmonths > 0) {
816 816
 			if ($globalDBdriver == 'mysql') $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)';
@@ -824,28 +824,28 @@  discard block
 block discarded – undo
824 824
 		if ($year != '') {
825 825
 			if ($globalDBdriver == 'mysql') {
826 826
 				$query .= " AND YEAR(tracker_output.date) = :year";
827
-				$query_values = array_merge($query_values,array(':year' => $year));
827
+				$query_values = array_merge($query_values, array(':year' => $year));
828 828
 			} else {
829 829
 				$query .= " AND EXTRACT(YEAR FROM tracker_output.date) = :year";
830
-				$query_values = array_merge($query_values,array(':year' => $year));
830
+				$query_values = array_merge($query_values, array(':year' => $year));
831 831
 			}
832 832
 		}
833 833
 		if ($month != '') {
834 834
 			if ($globalDBdriver == 'mysql') {
835 835
 				$query .= " AND MONTH(tracker_output.date) = :month";
836
-				$query_values = array_merge($query_values,array(':month' => $month));
836
+				$query_values = array_merge($query_values, array(':month' => $month));
837 837
 			} else {
838 838
 				$query .= " AND EXTRACT(MONTH FROM tracker_output.date) = :month";
839
-				$query_values = array_merge($query_values,array(':month' => $month));
839
+				$query_values = array_merge($query_values, array(':month' => $month));
840 840
 			}
841 841
 		}
842 842
 		if ($day != '') {
843 843
 			if ($globalDBdriver == 'mysql') {
844 844
 				$query .= " AND DAY(tracker_output.date) = :day";
845
-				$query_values = array_merge($query_values,array(':day' => $day));
845
+				$query_values = array_merge($query_values, array(':day' => $day));
846 846
 			} else {
847 847
 				$query .= " AND EXTRACT(DAY FROM tracker_output.date) = :day";
848
-				$query_values = array_merge($query_values,array(':day' => $day));
848
+				$query_values = array_merge($query_values, array(':day' => $day));
849 849
 			}
850 850
 		}
851 851
 		$query .= " GROUP BY tracker_output.ident ORDER BY callsign_icao_count DESC";
@@ -857,7 +857,7 @@  discard block
 block discarded – undo
857 857
 		$callsign_array = array();
858 858
 		$temp_array = array();
859 859
         
860
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
860
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
861 861
 		{
862 862
 			$temp_array['callsign_icao'] = $row['ident'];
863 863
 			$temp_array['airline_name'] = $row['airline_name'];
@@ -909,7 +909,7 @@  discard block
 block discarded – undo
909 909
 		$date_array = array();
910 910
 		$temp_array = array();
911 911
         
912
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
912
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
913 913
 		{
914 914
 			$temp_array['date_name'] = $row['date_name'];
915 915
 			$temp_array['date_count'] = $row['date_count'];
@@ -935,7 +935,7 @@  discard block
 block discarded – undo
935 935
 			$datetime = new DateTime();
936 936
 			$offset = $datetime->format('P');
937 937
 		} else $offset = '+00:00';
938
-		$filter_query = $this->getFilter($filters,true,true);
938
+		$filter_query = $this->getFilter($filters, true, true);
939 939
 		if ($globalDBdriver == 'mysql') {
940 940
 			$query  = "SELECT DATE(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
941 941
 								FROM tracker_output".$filter_query." tracker_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY)";
@@ -956,7 +956,7 @@  discard block
 block discarded – undo
956 956
 		$date_array = array();
957 957
 		$temp_array = array();
958 958
         
959
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
959
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
960 960
 		{
961 961
 			$temp_array['date_name'] = $row['date_name'];
962 962
 			$temp_array['date_count'] = $row['date_count'];
@@ -981,7 +981,7 @@  discard block
 block discarded – undo
981 981
 			$datetime = new DateTime();
982 982
 			$offset = $datetime->format('P');
983 983
 		} else $offset = '+00:00';
984
-		$filter_query = $this->getFilter($filters,true,true);
984
+		$filter_query = $this->getFilter($filters, true, true);
985 985
 		if ($globalDBdriver == 'mysql') {
986 986
 			$query  = "SELECT DATE(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
987 987
 								FROM tracker_output".$filter_query." tracker_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MONTH)";
@@ -1002,7 +1002,7 @@  discard block
 block discarded – undo
1002 1002
 		$date_array = array();
1003 1003
 		$temp_array = array();
1004 1004
         
1005
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
1005
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
1006 1006
 		{
1007 1007
 			$temp_array['date_name'] = $row['date_name'];
1008 1008
 			$temp_array['date_count'] = $row['date_count'];
@@ -1049,7 +1049,7 @@  discard block
 block discarded – undo
1049 1049
 		$date_array = array();
1050 1050
 		$temp_array = array();
1051 1051
         
1052
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
1052
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
1053 1053
 		{
1054 1054
 			$temp_array['month_name'] = $row['month_name'];
1055 1055
 			$temp_array['year_name'] = $row['year_name'];
@@ -1078,7 +1078,7 @@  discard block
 block discarded – undo
1078 1078
 			$datetime = new DateTime();
1079 1079
 			$offset = $datetime->format('P');
1080 1080
 		} else $offset = '+00:00';
1081
-		$filter_query = $this->getFilter($filters,true,true);
1081
+		$filter_query = $this->getFilter($filters, true, true);
1082 1082
 		if ($globalDBdriver == 'mysql') {
1083 1083
 			$query  = "SELECT MONTH(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS month_name, YEAR(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS year_name, count(*) as date_count
1084 1084
 								FROM tracker_output".$filter_query." tracker_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 YEAR)";
@@ -1099,7 +1099,7 @@  discard block
 block discarded – undo
1099 1099
 		$date_array = array();
1100 1100
 		$temp_array = array();
1101 1101
         
1102
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
1102
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
1103 1103
 		{
1104 1104
 			$temp_array['year_name'] = $row['year_name'];
1105 1105
 			$temp_array['month_name'] = $row['month_name'];
@@ -1119,7 +1119,7 @@  discard block
 block discarded – undo
1119 1119
 	* @return Array the hour list
1120 1120
 	*
1121 1121
 	*/
1122
-	public function countAllHours($orderby,$filters = array())
1122
+	public function countAllHours($orderby, $filters = array())
1123 1123
 	{
1124 1124
 		global $globalTimezone, $globalDBdriver;
1125 1125
 		if ($globalTimezone != '') {
@@ -1167,7 +1167,7 @@  discard block
 block discarded – undo
1167 1167
 		$hour_array = array();
1168 1168
 		$temp_array = array();
1169 1169
         
1170
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
1170
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
1171 1171
 		{
1172 1172
 			$temp_array['hour_name'] = $row['hour_name'];
1173 1173
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -1189,8 +1189,8 @@  discard block
 block discarded – undo
1189 1189
 	public function countAllHoursByDate($date, $filters = array())
1190 1190
 	{
1191 1191
 		global $globalTimezone, $globalDBdriver;
1192
-		$filter_query = $this->getFilter($filters,true,true);
1193
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
1192
+		$filter_query = $this->getFilter($filters, true, true);
1193
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
1194 1194
 		if ($globalTimezone != '') {
1195 1195
 			date_default_timezone_set($globalTimezone);
1196 1196
 			$datetime = new DateTime($date);
@@ -1198,12 +1198,12 @@  discard block
 block discarded – undo
1198 1198
 		} else $offset = '+00:00';
1199 1199
 
1200 1200
 		if ($globalDBdriver == 'mysql') {
1201
-			$query  = "SELECT HOUR(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
1201
+			$query = "SELECT HOUR(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
1202 1202
 								FROM tracker_output".$filter_query." DATE(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) = :date
1203 1203
 								GROUP BY hour_name 
1204 1204
 								ORDER BY hour_name ASC";
1205 1205
 		} else {
1206
-			$query  = "SELECT EXTRACT(HOUR FROM tracker_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
1206
+			$query = "SELECT EXTRACT(HOUR FROM tracker_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
1207 1207
 								FROM tracker_output".$filter_query." to_char(tracker_output.date AT TIME ZONE INTERVAL :offset, 'YYYY-mm-dd') = :date
1208 1208
 								GROUP BY hour_name 
1209 1209
 								ORDER BY hour_name ASC";
@@ -1215,7 +1215,7 @@  discard block
 block discarded – undo
1215 1215
 		$hour_array = array();
1216 1216
 		$temp_array = array();
1217 1217
         
1218
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
1218
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
1219 1219
 		{
1220 1220
 			$temp_array['hour_name'] = $row['hour_name'];
1221 1221
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -1237,8 +1237,8 @@  discard block
 block discarded – undo
1237 1237
 	public function countAllHoursByIdent($ident, $filters = array())
1238 1238
 	{
1239 1239
 		global $globalTimezone, $globalDBdriver;
1240
-		$filter_query = $this->getFilter($filters,true,true);
1241
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
1240
+		$filter_query = $this->getFilter($filters, true, true);
1241
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
1242 1242
 		if ($globalTimezone != '') {
1243 1243
 			date_default_timezone_set($globalTimezone);
1244 1244
 			$datetime = new DateTime();
@@ -1246,12 +1246,12 @@  discard block
 block discarded – undo
1246 1246
 		} else $offset = '+00:00';
1247 1247
 
1248 1248
 		if ($globalDBdriver == 'mysql') {
1249
-			$query  = "SELECT HOUR(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
1249
+			$query = "SELECT HOUR(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
1250 1250
 								FROM tracker_output".$filter_query." tracker_output.ident = :ident 
1251 1251
 								GROUP BY hour_name 
1252 1252
 								ORDER BY hour_name ASC";
1253 1253
 		} else {
1254
-			$query  = "SELECT EXTRACT(HOUR FROM tracker_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
1254
+			$query = "SELECT EXTRACT(HOUR FROM tracker_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
1255 1255
 								FROM tracker_output".$filter_query." tracker_output.ident = :ident 
1256 1256
 								GROUP BY hour_name 
1257 1257
 								ORDER BY hour_name ASC";
@@ -1259,12 +1259,12 @@  discard block
 block discarded – undo
1259 1259
       
1260 1260
 		
1261 1261
 		$sth = $this->db->prepare($query);
1262
-		$sth->execute(array(':ident' => $ident,':offset' => $offset));
1262
+		$sth->execute(array(':ident' => $ident, ':offset' => $offset));
1263 1263
       
1264 1264
 		$hour_array = array();
1265 1265
 		$temp_array = array();
1266 1266
         
1267
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
1267
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
1268 1268
 		{
1269 1269
 			$temp_array['hour_name'] = $row['hour_name'];
1270 1270
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -1283,32 +1283,32 @@  discard block
 block discarded – undo
1283 1283
 	* @return Integer the number of flights
1284 1284
 	*
1285 1285
 	*/
1286
-	public function countOverallTracked($filters = array(),$year = '',$month = '')
1286
+	public function countOverallTracked($filters = array(), $year = '', $month = '')
1287 1287
 	{
1288 1288
 		global $globalDBdriver;
1289
-		$queryi  = "SELECT COUNT(tracker_output.tracker_id) AS flight_count FROM tracker_output";
1289
+		$queryi = "SELECT COUNT(tracker_output.tracker_id) AS flight_count FROM tracker_output";
1290 1290
 		$query_values = array();
1291 1291
 		$query = '';
1292 1292
 		if ($year != '') {
1293 1293
 			if ($globalDBdriver == 'mysql') {
1294 1294
 				$query .= " AND YEAR(tracker_output.date) = :year";
1295
-				$query_values = array_merge($query_values,array(':year' => $year));
1295
+				$query_values = array_merge($query_values, array(':year' => $year));
1296 1296
 			} else {
1297 1297
 				$query .= " AND EXTRACT(YEAR FROM tracker_output.date) = :year";
1298
-				$query_values = array_merge($query_values,array(':year' => $year));
1298
+				$query_values = array_merge($query_values, array(':year' => $year));
1299 1299
 			}
1300 1300
 		}
1301 1301
 		if ($month != '') {
1302 1302
 			if ($globalDBdriver == 'mysql') {
1303 1303
 				$query .= " AND MONTH(tracker_output.date) = :month";
1304
-				$query_values = array_merge($query_values,array(':month' => $month));
1304
+				$query_values = array_merge($query_values, array(':month' => $month));
1305 1305
 			} else {
1306 1306
 				$query .= " AND EXTRACT(MONTH FROM tracker_output.date) = :month";
1307
-				$query_values = array_merge($query_values,array(':month' => $month));
1307
+				$query_values = array_merge($query_values, array(':month' => $month));
1308 1308
 			}
1309 1309
 		}
1310 1310
 		if (empty($query_values)) $queryi .= $this->getFilter($filters);
1311
-		else $queryi .= $this->getFilter($filters,true,true).substr($query,4);
1311
+		else $queryi .= $this->getFilter($filters, true, true).substr($query, 4);
1312 1312
 		
1313 1313
 		$sth = $this->db->prepare($queryi);
1314 1314
 		$sth->execute($query_values);
@@ -1325,7 +1325,7 @@  discard block
 block discarded – undo
1325 1325
 	public function countAllHoursFromToday($filters = array())
1326 1326
 	{
1327 1327
 		global $globalTimezone, $globalDBdriver;
1328
-		$filter_query = $this->getFilter($filters,true,true);
1328
+		$filter_query = $this->getFilter($filters, true, true);
1329 1329
 		if ($globalTimezone != '') {
1330 1330
 			date_default_timezone_set($globalTimezone);
1331 1331
 			$datetime = new DateTime();
@@ -1333,12 +1333,12 @@  discard block
 block discarded – undo
1333 1333
 		} else $offset = '+00:00';
1334 1334
 
1335 1335
 		if ($globalDBdriver == 'mysql') {
1336
-			$query  = "SELECT HOUR(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
1336
+			$query = "SELECT HOUR(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
1337 1337
 								FROM tracker_output".$filter_query." DATE(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) = CURDATE()
1338 1338
 								GROUP BY hour_name 
1339 1339
 								ORDER BY hour_name ASC";
1340 1340
 		} else {
1341
-			$query  = "SELECT EXTRACT(HOUR FROM tracker_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
1341
+			$query = "SELECT EXTRACT(HOUR FROM tracker_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
1342 1342
 								FROM tracker_output".$filter_query." to_char(tracker_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = CAST(NOW() AS date)
1343 1343
 								GROUP BY hour_name 
1344 1344
 								ORDER BY hour_name ASC";
@@ -1350,7 +1350,7 @@  discard block
 block discarded – undo
1350 1350
 		$hour_array = array();
1351 1351
 		$temp_array = array();
1352 1352
         
1353
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
1353
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
1354 1354
 		{
1355 1355
 			$temp_array['hour_name'] = $row['hour_name'];
1356 1356
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -1369,9 +1369,9 @@  discard block
 block discarded – undo
1369 1369
 	*/
1370 1370
 	public function getTrackerIDBasedOnFamTrackID($famtrackid)
1371 1371
 	{
1372
-		$famtrackid = filter_var($famtrackid,FILTER_SANITIZE_STRING);
1372
+		$famtrackid = filter_var($famtrackid, FILTER_SANITIZE_STRING);
1373 1373
 
1374
-		$query  = "SELECT tracker_output.tracker_id
1374
+		$query = "SELECT tracker_output.tracker_id
1375 1375
 				FROM tracker_output 
1376 1376
 				WHERE tracker_output.famtrackid = '".$famtrackid."'";
1377 1377
         
@@ -1379,7 +1379,7 @@  discard block
 block discarded – undo
1379 1379
 		$sth = $this->db->prepare($query);
1380 1380
 		$sth->execute();
1381 1381
 
1382
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
1382
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
1383 1383
 		{
1384 1384
 			return $row['tracker_id'];
1385 1385
 		}
@@ -1404,23 +1404,23 @@  discard block
 block discarded – undo
1404 1404
 		}
1405 1405
 		
1406 1406
 		$current_date = date("Y-m-d H:i:s");
1407
-		$date = date("Y-m-d H:i:s",strtotime($dateString." UTC"));
1407
+		$date = date("Y-m-d H:i:s", strtotime($dateString." UTC"));
1408 1408
 		
1409 1409
 		$diff = abs(strtotime($current_date) - strtotime($date));
1410 1410
 
1411
-		$time_array['years'] = floor($diff / (365*60*60*24)); 
1411
+		$time_array['years'] = floor($diff/(365*60*60*24)); 
1412 1412
 		$years = $time_array['years'];
1413 1413
 		
1414
-		$time_array['months'] = floor(($diff - $years * 365*60*60*24) / (30*60*60*24));
1414
+		$time_array['months'] = floor(($diff - $years*365*60*60*24)/(30*60*60*24));
1415 1415
 		$months = $time_array['months'];
1416 1416
 		
1417
-		$time_array['days'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24)/ (60*60*24));
1417
+		$time_array['days'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24)/(60*60*24));
1418 1418
 		$days = $time_array['days'];
1419
-		$time_array['hours'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24)/ (60*60));
1419
+		$time_array['hours'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24)/(60*60));
1420 1420
 		$hours = $time_array['hours'];
1421
-		$time_array['minutes'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60)/ 60);
1421
+		$time_array['minutes'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60)/60);
1422 1422
 		$minutes = $time_array['minutes'];
1423
-		$time_array['seconds'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60 - $minutes*60));  
1423
+		$time_array['seconds'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60 - $minutes*60));  
1424 1424
 		
1425 1425
 		return $time_array;
1426 1426
 	}
@@ -1443,63 +1443,63 @@  discard block
 block discarded – undo
1443 1443
 			$temp_array['direction_degree'] = $direction;
1444 1444
 			$temp_array['direction_shortname'] = "N";
1445 1445
 			$temp_array['direction_fullname'] = "North";
1446
-		} elseif ($direction >= 22.5 && $direction < 45){
1446
+		} elseif ($direction >= 22.5 && $direction < 45) {
1447 1447
 			$temp_array['direction_degree'] = $direction;
1448 1448
 			$temp_array['direction_shortname'] = "NNE";
1449 1449
 			$temp_array['direction_fullname'] = "North-Northeast";
1450
-		} elseif ($direction >= 45 && $direction < 67.5){
1450
+		} elseif ($direction >= 45 && $direction < 67.5) {
1451 1451
 			$temp_array['direction_degree'] = $direction;
1452 1452
 			$temp_array['direction_shortname'] = "NE";
1453 1453
 			$temp_array['direction_fullname'] = "Northeast";
1454
-		} elseif ($direction >= 67.5 && $direction < 90){
1454
+		} elseif ($direction >= 67.5 && $direction < 90) {
1455 1455
 			$temp_array['direction_degree'] = $direction;
1456 1456
 			$temp_array['direction_shortname'] = "ENE";
1457 1457
 			$temp_array['direction_fullname'] = "East-Northeast";
1458
-		} elseif ($direction >= 90 && $direction < 112.5){
1458
+		} elseif ($direction >= 90 && $direction < 112.5) {
1459 1459
 			$temp_array['direction_degree'] = $direction;
1460 1460
 			$temp_array['direction_shortname'] = "E";
1461 1461
 			$temp_array['direction_fullname'] = "East";
1462
-		} elseif ($direction >= 112.5 && $direction < 135){
1462
+		} elseif ($direction >= 112.5 && $direction < 135) {
1463 1463
 			$temp_array['direction_degree'] = $direction;
1464 1464
 			$temp_array['direction_shortname'] = "ESE";
1465 1465
 			$temp_array['direction_fullname'] = "East-Southeast";
1466
-		} elseif ($direction >= 135 && $direction < 157.5){
1466
+		} elseif ($direction >= 135 && $direction < 157.5) {
1467 1467
 			$temp_array['direction_degree'] = $direction;
1468 1468
 			$temp_array['direction_shortname'] = "SE";
1469 1469
 			$temp_array['direction_fullname'] = "Southeast";
1470
-		} elseif ($direction >= 157.5 && $direction < 180){
1470
+		} elseif ($direction >= 157.5 && $direction < 180) {
1471 1471
 			$temp_array['direction_degree'] = $direction;
1472 1472
 			$temp_array['direction_shortname'] = "SSE";
1473 1473
 			$temp_array['direction_fullname'] = "South-Southeast";
1474
-		} elseif ($direction >= 180 && $direction < 202.5){
1474
+		} elseif ($direction >= 180 && $direction < 202.5) {
1475 1475
 			$temp_array['direction_degree'] = $direction;
1476 1476
 			$temp_array['direction_shortname'] = "S";
1477 1477
 			$temp_array['direction_fullname'] = "South";
1478
-		} elseif ($direction >= 202.5 && $direction < 225){
1478
+		} elseif ($direction >= 202.5 && $direction < 225) {
1479 1479
 			$temp_array['direction_degree'] = $direction;
1480 1480
 			$temp_array['direction_shortname'] = "SSW";
1481 1481
 			$temp_array['direction_fullname'] = "South-Southwest";
1482
-		} elseif ($direction >= 225 && $direction < 247.5){
1482
+		} elseif ($direction >= 225 && $direction < 247.5) {
1483 1483
 			$temp_array['direction_degree'] = $direction;
1484 1484
 			$temp_array['direction_shortname'] = "SW";
1485 1485
 			$temp_array['direction_fullname'] = "Southwest";
1486
-		} elseif ($direction >= 247.5 && $direction < 270){
1486
+		} elseif ($direction >= 247.5 && $direction < 270) {
1487 1487
 			$temp_array['direction_degree'] = $direction;
1488 1488
 			$temp_array['direction_shortname'] = "WSW";
1489 1489
 			$temp_array['direction_fullname'] = "West-Southwest";
1490
-		} elseif ($direction >= 270 && $direction < 292.5){
1490
+		} elseif ($direction >= 270 && $direction < 292.5) {
1491 1491
 			$temp_array['direction_degree'] = $direction;
1492 1492
 			$temp_array['direction_shortname'] = "W";
1493 1493
 			$temp_array['direction_fullname'] = "West";
1494
-		} elseif ($direction >= 292.5 && $direction < 315){
1494
+		} elseif ($direction >= 292.5 && $direction < 315) {
1495 1495
 			$temp_array['direction_degree'] = $direction;
1496 1496
 			$temp_array['direction_shortname'] = "WNW";
1497 1497
 			$temp_array['direction_fullname'] = "West-Northwest";
1498
-		} elseif ($direction >= 315 && $direction < 337.5){
1498
+		} elseif ($direction >= 315 && $direction < 337.5) {
1499 1499
 			$temp_array['direction_degree'] = $direction;
1500 1500
 			$temp_array['direction_shortname'] = "NW";
1501 1501
 			$temp_array['direction_fullname'] = "Northwest";
1502
-		} elseif ($direction >= 337.5 && $direction < 360){
1502
+		} elseif ($direction >= 337.5 && $direction < 360) {
1503 1503
 			$temp_array['direction_degree'] = $direction;
1504 1504
 			$temp_array['direction_shortname'] = "NNW";
1505 1505
 			$temp_array['direction_fullname'] = "North-Northwest";
@@ -1516,11 +1516,11 @@  discard block
 block discarded – undo
1516 1516
 	* @param Float $longitude longitute of the flight
1517 1517
 	* @return String the countrie
1518 1518
 	*/
1519
-	public function getCountryFromLatitudeLongitude($latitude,$longitude)
1519
+	public function getCountryFromLatitudeLongitude($latitude, $longitude)
1520 1520
 	{
1521 1521
 		global $globalDBdriver, $globalDebug;
1522
-		$latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1523
-		$longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1522
+		$latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1523
+		$longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1524 1524
 	
1525 1525
 		$Connection = new Connection($this->db);
1526 1526
 		if (!$Connection->tableExists('countries')) return '';
@@ -1560,7 +1560,7 @@  discard block
 block discarded – undo
1560 1560
 	public function getCountryFromISO2($iso2)
1561 1561
 	{
1562 1562
 		global $globalDBdriver, $globalDebug;
1563
-		$iso2 = filter_var($iso2,FILTER_SANITIZE_STRING);
1563
+		$iso2 = filter_var($iso2, FILTER_SANITIZE_STRING);
1564 1564
 	
1565 1565
 		$Connection = new Connection($this->db);
1566 1566
 		if (!$Connection->tableExists('countries')) return '';
@@ -1608,7 +1608,7 @@  discard block
 block discarded – undo
1608 1608
 		
1609 1609
 		$bitly_data = json_decode($bitly_data);
1610 1610
 		$bitly_url = '';
1611
-		if ($bitly_data->status_txt = "OK"){
1611
+		if ($bitly_data->status_txt = "OK") {
1612 1612
 			$bitly_url = $bitly_data->data->url;
1613 1613
 		}
1614 1614
 
@@ -1618,7 +1618,7 @@  discard block
 block discarded – undo
1618 1618
 
1619 1619
 	public function getOrderBy()
1620 1620
 	{
1621
-		$orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY tracker_output.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY tracker_output.aircraft_icao DESC"),"manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY tracker_output.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY tracker_output.aircraft_manufacturer DESC"),"airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY tracker_output.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY tracker_output.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY tracker_output.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY tracker_output.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY tracker_output.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY tracker_output.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY tracker_output.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY tracker_output.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY tracker_output.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY tracker_output.date DESC"),"distance_asc" => array("key" => "distance_asc","value" => "Distance - ASC","sql" => "ORDER BY distance ASC"),"distance_desc" => array("key" => "distance_desc","value" => "Distance - DESC","sql" => "ORDER BY distance DESC"));
1621
+		$orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY tracker_output.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY tracker_output.aircraft_icao DESC"), "manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY tracker_output.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY tracker_output.aircraft_manufacturer DESC"), "airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY tracker_output.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY tracker_output.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY tracker_output.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY tracker_output.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY tracker_output.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY tracker_output.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY tracker_output.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY tracker_output.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY tracker_output.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY tracker_output.date DESC"), "distance_asc" => array("key" => "distance_asc", "value" => "Distance - ASC", "sql" => "ORDER BY distance ASC"), "distance_desc" => array("key" => "distance_desc", "value" => "Distance - DESC", "sql" => "ORDER BY distance DESC"));
1622 1622
 		
1623 1623
 		return $orderby;
1624 1624
 		
Please login to merge, or discard this patch.
require/class.TrackerLive.php 1 patch
Spacing   +92 added lines, -92 removed lines patch added patch discarded remove patch
@@ -16,33 +16,33 @@  discard block
 block discarded – undo
16 16
 	* @param Array $filter the filter
17 17
 	* @return Array the SQL part
18 18
 	*/
19
-	public function getFilter($filter = array(),$where = false,$and = false) {
19
+	public function getFilter($filter = array(), $where = false, $and = false) {
20 20
 		global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver;
21 21
 		$filters = array();
22 22
 		if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) {
23 23
 			if (isset($globalStatsFilters[$globalFilterName][0]['source'])) {
24 24
 				$filters = $globalStatsFilters[$globalFilterName];
25 25
 			} else {
26
-				$filter = array_merge($filter,$globalStatsFilters[$globalFilterName]);
26
+				$filter = array_merge($filter, $globalStatsFilters[$globalFilterName]);
27 27
 			}
28 28
 		}
29 29
 		if (isset($filter[0]['source'])) {
30
-			$filters = array_merge($filters,$filter);
30
+			$filters = array_merge($filters, $filter);
31 31
 		}
32
-		if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter);
32
+		if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter);
33 33
 		$filter_query_join = '';
34 34
 		$filter_query_where = '';
35
-		foreach($filters as $flt) {
35
+		foreach ($filters as $flt) {
36 36
 			if (isset($flt['idents']) && !empty($flt['idents'])) {
37 37
 				if (isset($flt['source'])) {
38
-					$filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_output WHERE tracker_output.ident IN ('".implode("','",$flt['idents'])."') AND tracker_output.format_source IN ('".implode("','",$flt['source'])."')) spid ON spid.famtrackid = tracker_live.famtrackid";
38
+					$filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_output WHERE tracker_output.ident IN ('".implode("','", $flt['idents'])."') AND tracker_output.format_source IN ('".implode("','", $flt['source'])."')) spid ON spid.famtrackid = tracker_live.famtrackid";
39 39
 				} else {
40
-					$filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_output WHERE tracker_output.ident IN ('".implode("','",$flt['idents'])."')) spid ON spid.famtrackid = tracker_live.famtrackid";
40
+					$filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_output WHERE tracker_output.ident IN ('".implode("','", $flt['idents'])."')) spid ON spid.famtrackid = tracker_live.famtrackid";
41 41
 				}
42 42
 			}
43 43
 		}
44 44
 		if (isset($filter['source']) && !empty($filter['source'])) {
45
-			$filter_query_where .= " AND format_source IN ('".implode("','",$filter['source'])."')";
45
+			$filter_query_where .= " AND format_source IN ('".implode("','", $filter['source'])."')";
46 46
 		}
47 47
 		if (isset($filter['ident']) && !empty($filter['ident'])) {
48 48
 			$filter_query_where .= " AND ident = '".$filter['ident']."'";
@@ -71,15 +71,15 @@  discard block
 block discarded – undo
71 71
 					$filter_query_date .= " AND EXTRACT(DAY FROM tracker_output.date) = '".$filter['day']."'";
72 72
 				}
73 73
 			}
74
-			$filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_output".preg_replace('/^ AND/',' WHERE',$filter_query_date).") sd ON sd.famtrackid = tracker_live.famtrackid";
74
+			$filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_output".preg_replace('/^ AND/', ' WHERE', $filter_query_date).") sd ON sd.famtrackid = tracker_live.famtrackid";
75 75
 		}
76 76
 		if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
77
-			$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
77
+			$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')";
78 78
 		}
79 79
 		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
80 80
 		elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND';
81 81
 		if ($filter_query_where != '') {
82
-			$filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where);
82
+			$filter_query_where = preg_replace('/^ AND/', ' WHERE', $filter_query_where);
83 83
 		}
84 84
 		$filter_query = $filter_query_join.$filter_query_where;
85 85
 		return $filter_query;
@@ -102,8 +102,8 @@  discard block
 block discarded – undo
102 102
 		if ($limit != '')
103 103
 		{
104 104
 			$limit_array = explode(',', $limit);
105
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
106
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
105
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
106
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
107 107
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
108 108
 			{
109 109
 				$limit_query = ' LIMIT '.$limit_array[1].' OFFSET '.$limit_array[0];
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 		} else {
127 127
 			$query  = "SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= l.date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate".$filter_query.$orderby_query;
128 128
 		}
129
-		$spotter_array = $Tracker->getDataFromDB($query.$limit_query,array(),'',true);
129
+		$spotter_array = $Tracker->getDataFromDB($query.$limit_query, array(), '', true);
130 130
 
131 131
 		return $spotter_array;
132 132
 	}
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
 		global $globalDBdriver, $globalLiveInterval;
143 143
 		date_default_timezone_set('UTC');
144 144
 
145
-		$filter_query = $this->getFilter($filter,true,true);
145
+		$filter_query = $this->getFilter($filter, true, true);
146 146
 
147 147
 		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
148 148
 		if ($globalDBdriver == 'mysql') {
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
 		try {
161 161
 			$sth = $this->db->prepare($query);
162 162
 			$sth->execute();
163
-		} catch(PDOException $e) {
163
+		} catch (PDOException $e) {
164 164
 			echo $e->getMessage();
165 165
 			die;
166 166
 		}
@@ -180,15 +180,15 @@  discard block
 block discarded – undo
180 180
 		global $globalDBdriver, $globalLiveInterval;
181 181
 		date_default_timezone_set('UTC');
182 182
 
183
-		$filter_query = $this->getFilter($filter,true,true);
183
+		$filter_query = $this->getFilter($filter, true, true);
184 184
 
185 185
 		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
186 186
 		if ($globalDBdriver == 'mysql') {
187
-			$query  = 'SELECT tracker_live.ident, tracker_live.famtrackid,tracker_live.type, tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source 
187
+			$query = 'SELECT tracker_live.ident, tracker_live.famtrackid,tracker_live.type, tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source 
188 188
 			FROM tracker_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= tracker_live.date AND tracker_live.latitude <> '0' AND tracker_live.longitude <> '0' 
189 189
 			ORDER BY tracker_live.famtrackid, tracker_live.date";
190 190
                 } else {
191
-			$query  = "SELECT tracker_live.ident, tracker_live.famtrackid, tracker_live.type,tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source 
191
+			$query = "SELECT tracker_live.ident, tracker_live.famtrackid, tracker_live.type,tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source 
192 192
 			FROM tracker_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= tracker_live.date AND tracker_live.latitude <> '0' AND tracker_live.longitude <> '0' 
193 193
 			ORDER BY tracker_live.famtrackid, tracker_live.date";
194 194
 		}
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
     		try {
197 197
 			$sth = $this->db->prepare($query);
198 198
 			$sth->execute();
199
-		} catch(PDOException $e) {
199
+		} catch (PDOException $e) {
200 200
 			echo $e->getMessage();
201 201
 			die;
202 202
 		}
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
 	public function getLiveTrackerCount($filter = array())
214 214
 	{
215 215
 		global $globalDBdriver, $globalLiveInterval;
216
-		$filter_query = $this->getFilter($filter,true,true);
216
+		$filter_query = $this->getFilter($filter, true, true);
217 217
 
218 218
 		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
219 219
 		if ($globalDBdriver == 'mysql') {
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
 		try {
225 225
 			$sth = $this->db->prepare($query);
226 226
 			$sth->execute();
227
-		} catch(PDOException $e) {
227
+		} catch (PDOException $e) {
228 228
 			echo $e->getMessage();
229 229
 			die;
230 230
 		}
@@ -247,10 +247,10 @@  discard block
 block discarded – undo
247 247
 		$filter_query = $this->getFilter($filter);
248 248
 
249 249
 		if (is_array($coord)) {
250
-			$minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
251
-			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
252
-			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
253
-			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
250
+			$minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
251
+			$minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
252
+			$maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
253
+			$maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
254 254
 		} else return array();
255 255
 		if ($globalDBdriver == 'mysql') {
256 256
 			$query  = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate AND tracker_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND tracker_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.' GROUP BY tracker_live.famtrackid'.$filter_query;
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
                 if ($interval == '1m')
303 303
                 {
304 304
                     $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= tracker_live.date ';
305
-                } else if ($interval == '15m'){
305
+                } else if ($interval == '15m') {
306 306
                     $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= tracker_live.date ';
307 307
                 } 
308 308
             }
@@ -310,14 +310,14 @@  discard block
 block discarded – undo
310 310
          $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= tracker_live.date ';   
311 311
         }
312 312
 
313
-                $query  = "SELECT tracker_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM tracker_live 
313
+                $query = "SELECT tracker_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM tracker_live 
314 314
                    WHERE tracker_live.latitude <> '' 
315 315
                                    AND tracker_live.longitude <> '' 
316 316
                    ".$additional_query."
317 317
                    HAVING distance < :radius  
318 318
                                    ORDER BY distance";
319 319
 
320
-                $spotter_array = $Tracker->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius));
320
+                $spotter_array = $Tracker->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng, ':radius' => $radius));
321 321
 
322 322
                 return $spotter_array;
323 323
         }
@@ -335,9 +335,9 @@  discard block
 block discarded – undo
335 335
 		date_default_timezone_set('UTC');
336 336
 
337 337
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
338
-                $query  = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.ident = :ident GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC';
338
+                $query = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.ident = :ident GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC';
339 339
 
340
-		$spotter_array = $Tracker->getDataFromDB($query,array(':ident' => $ident),'',true);
340
+		$spotter_array = $Tracker->getDataFromDB($query, array(':ident' => $ident), '', true);
341 341
 
342 342
 		return $spotter_array;
343 343
 	}
@@ -348,16 +348,16 @@  discard block
 block discarded – undo
348 348
 	* @return Array the spotter information
349 349
 	*
350 350
 	*/
351
-	public function getDateLiveTrackerDataByIdent($ident,$date)
351
+	public function getDateLiveTrackerDataByIdent($ident, $date)
352 352
 	{
353 353
 		$Tracker = new Tracker($this->db);
354 354
 		date_default_timezone_set('UTC');
355 355
 
356 356
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
357
-                $query  = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC';
357
+                $query = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC';
358 358
 
359
-                $date = date('c',$date);
360
-		$spotter_array = $Tracker->getDataFromDB($query,array(':ident' => $ident,':date' => $date));
359
+                $date = date('c', $date);
360
+		$spotter_array = $Tracker->getDataFromDB($query, array(':ident' => $ident, ':date' => $date));
361 361
 
362 362
 		return $spotter_array;
363 363
 	}
@@ -374,9 +374,9 @@  discard block
 block discarded – undo
374 374
 		date_default_timezone_set('UTC');
375 375
 
376 376
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
377
-                $query  = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.famtrackid = :id GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC';
377
+                $query = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.famtrackid = :id GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC';
378 378
 
379
-		$spotter_array = $Tracker->getDataFromDB($query,array(':id' => $id),'',true);
379
+		$spotter_array = $Tracker->getDataFromDB($query, array(':id' => $id), '', true);
380 380
 
381 381
 		return $spotter_array;
382 382
 	}
@@ -387,15 +387,15 @@  discard block
 block discarded – undo
387 387
 	* @return Array the spotter information
388 388
 	*
389 389
 	*/
390
-	public function getDateLiveTrackerDataById($id,$date)
390
+	public function getDateLiveTrackerDataById($id, $date)
391 391
 	{
392 392
 		$Tracker = new Tracker($this->db);
393 393
 		date_default_timezone_set('UTC');
394 394
 
395 395
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
396
-                $query  = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.famtrackid = :id AND l.date <= :date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC';
397
-                $date = date('c',$date);
398
-		$spotter_array = $Tracker->getDataFromDB($query,array(':id' => $id,':date' => $date),'',true);
396
+                $query = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.famtrackid = :id AND l.date <= :date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC';
397
+                $date = date('c', $date);
398
+		$spotter_array = $Tracker->getDataFromDB($query, array(':id' => $id, ':date' => $date), '', true);
399 399
 
400 400
 		return $spotter_array;
401 401
 	}
@@ -412,13 +412,13 @@  discard block
 block discarded – undo
412 412
 		date_default_timezone_set('UTC');
413 413
 
414 414
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
415
-                $query  = 'SELECT tracker_live.altitude, tracker_live.date FROM tracker_live WHERE tracker_live.ident = :ident';
415
+                $query = 'SELECT tracker_live.altitude, tracker_live.date FROM tracker_live WHERE tracker_live.ident = :ident';
416 416
 
417 417
     		try {
418 418
 			
419 419
 			$sth = $this->db->prepare($query);
420 420
 			$sth->execute(array(':ident' => $ident));
421
-		} catch(PDOException $e) {
421
+		} catch (PDOException $e) {
422 422
 			echo $e->getMessage();
423 423
 			die;
424 424
 		}
@@ -433,7 +433,7 @@  discard block
 block discarded – undo
433 433
 	* @return Array the spotter information
434 434
 	*
435 435
 	*/
436
-	public function getAllLiveTrackerDataById($id,$liveinterval = false)
436
+	public function getAllLiveTrackerDataById($id, $liveinterval = false)
437 437
 	{
438 438
 		global $globalDBdriver, $globalLiveInterval;
439 439
 		date_default_timezone_set('UTC');
@@ -452,7 +452,7 @@  discard block
 block discarded – undo
452 452
 		try {
453 453
 			$sth = $this->db->prepare($query);
454 454
 			$sth->execute(array(':id' => $id));
455
-		} catch(PDOException $e) {
455
+		} catch (PDOException $e) {
456 456
 			echo $e->getMessage();
457 457
 			die;
458 458
 		}
@@ -470,12 +470,12 @@  discard block
 block discarded – undo
470 470
 	{
471 471
 		date_default_timezone_set('UTC');
472 472
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
473
-		$query  = self::$global_query.' WHERE tracker_live.ident = :ident';
473
+		$query = self::$global_query.' WHERE tracker_live.ident = :ident';
474 474
     		try {
475 475
 			
476 476
 			$sth = $this->db->prepare($query);
477 477
 			$sth->execute(array(':ident' => $ident));
478
-		} catch(PDOException $e) {
478
+		} catch (PDOException $e) {
479 479
 			echo $e->getMessage();
480 480
 			die;
481 481
 		}
@@ -505,7 +505,7 @@  discard block
 block discarded – undo
505 505
 			
506 506
 			$sth = $this->db->prepare($query);
507 507
 			$sth->execute();
508
-		} catch(PDOException $e) {
508
+		} catch (PDOException $e) {
509 509
 			return "error";
510 510
 		}
511 511
 
@@ -528,14 +528,14 @@  discard block
 block discarded – undo
528 528
 				
529 529
 				$sth = $this->db->prepare($query);
530 530
 				$sth->execute();
531
-			} catch(PDOException $e) {
531
+			} catch (PDOException $e) {
532 532
 				return "error";
533 533
 			}
534 534
 			$query_delete = 'DELETE FROM tracker_live WHERE famtrackid IN (';
535 535
                         $i = 0;
536
-                        $j =0;
536
+                        $j = 0;
537 537
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
538
-			foreach($all as $row)
538
+			foreach ($all as $row)
539 539
 			{
540 540
 				$i++;
541 541
 				$j++;
@@ -543,9 +543,9 @@  discard block
 block discarded – undo
543 543
 					if ($globalDebug) echo ".";
544 544
 				    	try {
545 545
 						
546
-						$sth = $this->db->prepare(substr($query_delete,0,-1).")");
546
+						$sth = $this->db->prepare(substr($query_delete, 0, -1).")");
547 547
 						$sth->execute();
548
-					} catch(PDOException $e) {
548
+					} catch (PDOException $e) {
549 549
 						return "error";
550 550
 					}
551 551
                                 	$query_delete = 'DELETE FROM tracker_live WHERE famtrackid IN (';
@@ -556,9 +556,9 @@  discard block
 block discarded – undo
556 556
 			if ($i > 0) {
557 557
     				try {
558 558
 					
559
-					$sth = $this->db->prepare(substr($query_delete,0,-1).")");
559
+					$sth = $this->db->prepare(substr($query_delete, 0, -1).")");
560 560
 					$sth->execute();
561
-				} catch(PDOException $e) {
561
+				} catch (PDOException $e) {
562 562
 					return "error";
563 563
 				}
564 564
 			}
@@ -571,7 +571,7 @@  discard block
 block discarded – undo
571 571
 				
572 572
 				$sth = $this->db->prepare($query);
573 573
 				$sth->execute();
574
-			} catch(PDOException $e) {
574
+			} catch (PDOException $e) {
575 575
 				return "error";
576 576
 			}
577 577
 /*			$query_delete = "DELETE FROM tracker_live WHERE famtrackid IN (";
@@ -619,13 +619,13 @@  discard block
 block discarded – undo
619 619
 	public function deleteLiveTrackerDataByIdent($ident)
620 620
 	{
621 621
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
622
-		$query  = 'DELETE FROM tracker_live WHERE ident = :ident';
622
+		$query = 'DELETE FROM tracker_live WHERE ident = :ident';
623 623
         
624 624
     		try {
625 625
 			
626 626
 			$sth = $this->db->prepare($query);
627 627
 			$sth->execute(array(':ident' => $ident));
628
-		} catch(PDOException $e) {
628
+		} catch (PDOException $e) {
629 629
 			return "error";
630 630
 		}
631 631
 
@@ -641,13 +641,13 @@  discard block
 block discarded – undo
641 641
 	public function deleteLiveTrackerDataById($id)
642 642
 	{
643 643
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
644
-		$query  = 'DELETE FROM tracker_live WHERE famtrackid = :id';
644
+		$query = 'DELETE FROM tracker_live WHERE famtrackid = :id';
645 645
         
646 646
     		try {
647 647
 			
648 648
 			$sth = $this->db->prepare($query);
649 649
 			$sth->execute(array(':id' => $id));
650
-		} catch(PDOException $e) {
650
+		} catch (PDOException $e) {
651 651
 			return "error";
652 652
 		}
653 653
 
@@ -665,13 +665,13 @@  discard block
 block discarded – undo
665 665
 	{
666 666
 		global $globalDBdriver, $globalTimezone;
667 667
 		if ($globalDBdriver == 'mysql') {
668
-			$query  = 'SELECT tracker_live.ident FROM tracker_live 
668
+			$query = 'SELECT tracker_live.ident FROM tracker_live 
669 669
 				WHERE tracker_live.ident = :ident 
670 670
 				AND tracker_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) 
671 671
 				AND tracker_live.date < UTC_TIMESTAMP()';
672 672
 			$query_data = array(':ident' => $ident);
673 673
 		} else {
674
-			$query  = "SELECT tracker_live.ident FROM tracker_live 
674
+			$query = "SELECT tracker_live.ident FROM tracker_live 
675 675
 				WHERE tracker_live.ident = :ident 
676 676
 				AND tracker_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS'
677 677
 				AND tracker_live.date < now() AT TIME ZONE 'UTC'";
@@ -680,8 +680,8 @@  discard block
 block discarded – undo
680 680
 		
681 681
 		$sth = $this->db->prepare($query);
682 682
 		$sth->execute($query_data);
683
-		$ident_result='';
684
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
683
+		$ident_result = '';
684
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
685 685
 		{
686 686
 			$ident_result = $row['ident'];
687 687
 		}
@@ -698,13 +698,13 @@  discard block
 block discarded – undo
698 698
 	{
699 699
 		global $globalDBdriver, $globalTimezone;
700 700
 		if ($globalDBdriver == 'mysql') {
701
-			$query  = 'SELECT tracker_live.ident, tracker_live.famtrackid FROM tracker_live 
701
+			$query = 'SELECT tracker_live.ident, tracker_live.famtrackid FROM tracker_live 
702 702
 				WHERE tracker_live.ident = :ident 
703 703
 				AND tracker_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE)'; 
704 704
 //				AND tracker_live.date < UTC_TIMESTAMP()";
705 705
 			$query_data = array(':ident' => $ident);
706 706
 		} else {
707
-			$query  = "SELECT tracker_live.ident, tracker_live.famtrackid FROM tracker_live 
707
+			$query = "SELECT tracker_live.ident, tracker_live.famtrackid FROM tracker_live 
708 708
 				WHERE tracker_live.ident = :ident 
709 709
 				AND tracker_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '30 MINUTES'";
710 710
 //				AND tracker_live.date < now() AT TIME ZONE 'UTC'";
@@ -713,8 +713,8 @@  discard block
 block discarded – undo
713 713
 		
714 714
 		$sth = $this->db->prepare($query);
715 715
 		$sth->execute($query_data);
716
-		$ident_result='';
717
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
716
+		$ident_result = '';
717
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
718 718
 		{
719 719
 			$ident_result = $row['famtrackid'];
720 720
 		}
@@ -731,13 +731,13 @@  discard block
 block discarded – undo
731 731
 	{
732 732
 		global $globalDBdriver, $globalTimezone;
733 733
 		if ($globalDBdriver == 'mysql') {
734
-			$query  = 'SELECT tracker_live.ident, tracker_live.famtrackid FROM tracker_live 
734
+			$query = 'SELECT tracker_live.ident, tracker_live.famtrackid FROM tracker_live 
735 735
 				WHERE tracker_live.famtrackid = :id 
736 736
 				AND tracker_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 10 HOUR)'; 
737 737
 //				AND tracker_live.date < UTC_TIMESTAMP()";
738 738
 			$query_data = array(':id' => $id);
739 739
 		} else {
740
-			$query  = "SELECT tracker_live.ident, tracker_live.famtrackid FROM tracker_live 
740
+			$query = "SELECT tracker_live.ident, tracker_live.famtrackid FROM tracker_live 
741 741
 				WHERE tracker_live.famtrackid = :id 
742 742
 				AND tracker_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '10 HOUR'";
743 743
 //				AND tracker_live.date < now() AT TIME ZONE 'UTC'";
@@ -746,8 +746,8 @@  discard block
 block discarded – undo
746 746
 		
747 747
 		$sth = $this->db->prepare($query);
748 748
 		$sth->execute($query_data);
749
-		$ident_result='';
750
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
749
+		$ident_result = '';
750
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
751 751
 		{
752 752
 			$ident_result = $row['famtrackid'];
753 753
 		}
@@ -765,7 +765,7 @@  discard block
 block discarded – undo
765 765
 	* @return String success or false
766 766
 	*
767 767
 	*/
768
-	public function addLiveTrackerData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $putinarchive = false, $comment = '', $type = '',$noarchive = false,$format_source = '', $source_name = '', $over_country = '')
768
+	public function addLiveTrackerData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $putinarchive = false, $comment = '', $type = '', $noarchive = false, $format_source = '', $source_name = '', $over_country = '')
769 769
 	{
770 770
 		global $globalURL, $globalArchive, $globalDebug;
771 771
 		$Common = new Common();
@@ -824,31 +824,31 @@  discard block
 block discarded – undo
824 824
 		if ($date == '') $date = date("Y-m-d H:i:s", time());
825 825
 
826 826
         
827
-		$famtrackid = filter_var($famtrackid,FILTER_SANITIZE_STRING);
828
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
829
-		$latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
830
-		$longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
831
-		$altitude = filter_var($altitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
832
-		$heading = filter_var($heading,FILTER_SANITIZE_NUMBER_INT);
833
-		$groundspeed = filter_var($groundspeed,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
834
-		$format_source = filter_var($format_source,FILTER_SANITIZE_STRING);
835
-		$source_name = filter_var($source_name,FILTER_SANITIZE_STRING);
836
-		$over_country = filter_var($over_country,FILTER_SANITIZE_STRING);
837
-		$comment = filter_var($comment,FILTER_SANITIZE_STRING);
838
-		$type = filter_var($type,FILTER_SANITIZE_STRING);
839
-
840
-            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
841
-            	if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
827
+		$famtrackid = filter_var($famtrackid, FILTER_SANITIZE_STRING);
828
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
829
+		$latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
830
+		$longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
831
+		$altitude = filter_var($altitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
832
+		$heading = filter_var($heading, FILTER_SANITIZE_NUMBER_INT);
833
+		$groundspeed = filter_var($groundspeed, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
834
+		$format_source = filter_var($format_source, FILTER_SANITIZE_STRING);
835
+		$source_name = filter_var($source_name, FILTER_SANITIZE_STRING);
836
+		$over_country = filter_var($over_country, FILTER_SANITIZE_STRING);
837
+		$comment = filter_var($comment, FILTER_SANITIZE_STRING);
838
+		$type = filter_var($type, FILTER_SANITIZE_STRING);
839
+
840
+            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
841
+            	if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
842 842
             	
843
-		$query  = 'INSERT INTO tracker_live (famtrackid, ident, latitude, longitude, altitude, heading, ground_speed, date, format_source, source_name, over_country, comment, type) 
843
+		$query = 'INSERT INTO tracker_live (famtrackid, ident, latitude, longitude, altitude, heading, ground_speed, date, format_source, source_name, over_country, comment, type) 
844 844
 		VALUES (:famtrackid,:ident,:latitude,:longitude,:altitude,:heading,:groundspeed,:date,:format_source, :source_name, :over_country,:comment,:type)';
845 845
 
846
-		$query_values = array(':famtrackid' => $famtrackid,':ident' => $ident,':latitude' => $latitude,':longitude' => $longitude,':altitude' => $altitude,':heading' => $heading,':groundspeed' => $groundspeed,':date' => $date, ':format_source' => $format_source, ':source_name' => $source_name, ':over_country' => $over_country,':comment' => $comment,':type' => $type);
846
+		$query_values = array(':famtrackid' => $famtrackid, ':ident' => $ident, ':latitude' => $latitude, ':longitude' => $longitude, ':altitude' => $altitude, ':heading' => $heading, ':groundspeed' => $groundspeed, ':date' => $date, ':format_source' => $format_source, ':source_name' => $source_name, ':over_country' => $over_country, ':comment' => $comment, ':type' => $type);
847 847
 		try {
848 848
 			
849 849
 			$sth = $this->db->prepare($query);
850 850
 			$sth->execute($query_values);
851
-                } catch(PDOException $e) {
851
+                } catch (PDOException $e) {
852 852
                 	return "error : ".$e->getMessage();
853 853
                 }
854 854
 		/*
@@ -865,7 +865,7 @@  discard block
 block discarded – undo
865 865
 
866 866
 	public function getOrderBy()
867 867
 	{
868
-		$orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY tracker_live.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY tracker_live.aircraft_icao DESC"),"manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY tracker_live.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY tracker_live.aircraft_manufacturer DESC"),"airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY tracker_live.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY tracker_live.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY tracker_live.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY tracker_live.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY tracker_live.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY tracker_live.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY tracker_live.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY tracker_live.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY tracker_live.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY tracker_live.date DESC"));
868
+		$orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY tracker_live.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY tracker_live.aircraft_icao DESC"), "manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY tracker_live.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY tracker_live.aircraft_manufacturer DESC"), "airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY tracker_live.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY tracker_live.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY tracker_live.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY tracker_live.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY tracker_live.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY tracker_live.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY tracker_live.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY tracker_live.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY tracker_live.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY tracker_live.date DESC"));
869 869
 		return $orderby;
870 870
 	}
871 871
 
Please login to merge, or discard this patch.
require/class.TrackerImport.php 1 patch
Spacing   +61 added lines, -61 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 	    if (isset($this->all_tracked[$key]['id'])) {
50 50
 		//echo $this->all_tracked[$key]['id'].' - '.$this->all_tracked[$key]['latitude'].'  '.$this->all_tracked[$key]['longitude']."\n";
51 51
     		$Tracker = new Tracker($this->db);
52
-        	$Tracker->updateLatestTrackerData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['altitude'],$this->all_tracked[$key]['speed'],$this->all_tracked[$key]['datetime']);
52
+        	$Tracker->updateLatestTrackerData($this->all_tracked[$key]['id'], $this->all_tracked[$key]['ident'], $this->all_tracked[$key]['latitude'], $this->all_tracked[$key]['longitude'], $this->all_tracked[$key]['altitude'], $this->all_tracked[$key]['speed'], $this->all_tracked[$key]['datetime']);
53 53
             }
54 54
 	}
55 55
     }
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 	if ($globalDebug) echo 'Delete old values and update latest data...'."\n";
61 61
 	foreach ($this->all_tracked as $key => $flight) {
62 62
     	    if (isset($flight['lastupdate'])) {
63
-        	if ($flight['lastupdate'] < (time()-3000)) {
63
+        	if ($flight['lastupdate'] < (time() - 3000)) {
64 64
             	    if (isset($this->all_tracked[$key]['id'])) {
65 65
             		if ($globalDebug) echo "--- Delete old values with id ".$this->all_tracked[$key]['id']."\n";
66 66
 			/*
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
             		//$real_arrival = $this->arrival($key);
72 72
             		$Tracker = new Tracker($this->db);
73 73
             		if ($this->all_tracked[$key]['latitude'] != '' && $this->all_tracked[$key]['longitude'] != '') {
74
-				$result = $Tracker->updateLatestTrackerData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['altitude'],$this->all_tracked[$key]['speed']);
74
+				$result = $Tracker->updateLatestTrackerData($this->all_tracked[$key]['id'], $this->all_tracked[$key]['ident'], $this->all_tracked[$key]['latitude'], $this->all_tracked[$key]['longitude'], $this->all_tracked[$key]['altitude'], $this->all_tracked[$key]['speed']);
75 75
 				if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n";
76 76
 			}
77 77
 			// Put in archive
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 	$send = false;
92 92
 	
93 93
 	// SBS format is CSV format
94
-	if(is_array($line) && isset($line['ident'])) {
94
+	if (is_array($line) && isset($line['ident'])) {
95 95
 	    //print_r($line);
96 96
   	    if (isset($line['ident'])) {
97 97
 
@@ -114,19 +114,19 @@  discard block
 block discarded – undo
114 114
 		
115 115
 		if (!isset($this->all_tracked[$id])) {
116 116
 		    $this->all_tracked[$id] = array();
117
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('addedTracker' => 0));
118
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => '','latitude' => '', 'longitude' => '', 'speed' => '', 'altitude' => '', 'heading' => '', 'format_source' => '','source_name' => '','comment'=> '','type' => '','noarchive' => false,'putinarchive' => true,'over_country' => ''));
119
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('lastupdate' => time()));
117
+		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('addedTracker' => 0));
118
+		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('ident' => '', 'latitude' => '', 'longitude' => '', 'speed' => '', 'altitude' => '', 'heading' => '', 'format_source' => '', 'source_name' => '', 'comment'=> '', 'type' => '', 'noarchive' => false, 'putinarchive' => true, 'over_country' => ''));
119
+		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('lastupdate' => time()));
120 120
 		    if (!isset($line['id'])) {
121 121
 			if (!isset($globalDaemon)) $globalDaemon = TRUE;
122
-			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $id.'-'.date('YmdHi')));
123
-		     } else $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $line['id']));
122
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('id' => $id.'-'.date('YmdHi')));
123
+		     } else $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('id' => $line['id']));
124 124
 		    if ($globalAllTracked !== FALSE) $dataFound = true;
125 125
 		}
126 126
 		
127
-		if (isset($line['datetime']) && strtotime($line['datetime']) > time()-20*60) {
127
+		if (isset($line['datetime']) && strtotime($line['datetime']) > time() - 20*60) {
128 128
 		    if (!isset($this->all_tracked[$id]['datetime']) || strtotime($line['datetime']) >= strtotime($this->all_tracked[$id]['datetime'])) {
129
-			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('datetime' => $line['datetime']));
129
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('datetime' => $line['datetime']));
130 130
 		    } else {
131 131
 				if (strtotime($line['datetime']) == strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) echo "!!! Date is the same as previous data for ".$this->all_tracked[$id]['hex']." - format : ".$line['format_source']."\n";
132 132
 				elseif (strtotime($line['datetime']) > strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) echo "!!! Date previous latest data (".$line['datetime']." > ".$this->all_tracked[$id]['datetime'].") !!! for ".$this->all_tracked[$id]['hex']." - format : ".$line['format_source']."\n";
@@ -134,43 +134,43 @@  discard block
 block discarded – undo
134 134
 		    }
135 135
 		} else {
136 136
 			date_default_timezone_set('UTC');
137
-			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('datetime' => date('Y-m-d H:i:s')));
137
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('datetime' => date('Y-m-d H:i:s')));
138 138
 		}
139 139
 
140 140
 		//if (isset($line['ident']) && $line['ident'] != '' && $line['ident'] != '????????' && $line['ident'] != '00000000' && ($this->all_tracked[$id]['ident'] != trim($line['ident'])) && preg_match('/^[a-zA-Z0-9-]+$/', $line['ident'])) {
141 141
 		if (isset($line['ident']) && $line['ident'] != '' && $line['ident'] != '????????' && $line['ident'] != '00000000' && ($this->all_tracked[$id]['ident'] != trim($line['ident']))) {
142
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => trim($line['ident'])));
142
+		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('ident' => trim($line['ident'])));
143 143
 		    if ($this->all_tracked[$id]['addedTracker'] == 1) {
144 144
 			$timeelapsed = microtime(true);
145 145
             		$Tracker = new Tracker($this->db);
146 146
             		$fromsource = NULL;
147
-            		$result = $Tracker->updateIdentTrackerData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['ident'],$fromsource);
147
+            		$result = $Tracker->updateIdentTrackerData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $fromsource);
148 148
 			if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n";
149 149
 			$Tracker->db = null;
150
-			if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
150
+			if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
151 151
 		    }
152
-		    if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident']));
152
+		    if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('id' => $this->all_tracked[$id]['ident']));
153 153
 		}
154 154
 
155 155
 		if (isset($line['speed']) && $line['speed'] != '') {
156
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($line['speed'])));
157
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed_fromsrc' => true));
156
+		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('speed' => round($line['speed'])));
157
+		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('speed_fromsrc' => true));
158 158
 		} else if (!isset($this->all_tracked[$id]['speed_fromsrc']) && isset($this->all_tracked[$id]['time_last_coord']) && $this->all_tracked[$id]['time_last_coord'] != time() && isset($line['latitude']) && isset($line['longitude'])) {
159
-		    $distance = $Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m');
159
+		    $distance = $Common->distance($line['latitude'], $line['longitude'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], 'm');
160 160
 		    if ($distance > 1000 && $distance < 10000) {
161 161
 			$speed = $distance/(time() - $this->all_tracked[$id]['time_last_coord']);
162 162
 			$speed = $speed*3.6;
163
-			if ($speed < 1000) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($speed)));
163
+			if ($speed < 1000) $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('speed' => round($speed)));
164 164
   			if ($globalDebug) echo "ø Calculated Speed for ".$this->all_tracked[$id]['hex']." : ".$speed." - distance : ".$distance."\n";
165 165
 		    }
166 166
 		}
167 167
 
168 168
 	        if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) {
169
-	    	    if (isset($this->all_tracked[$id]['time_last_coord'])) $timediff = round(time()-$this->all_tracked[$id]['time_last_coord']);
169
+	    	    if (isset($this->all_tracked[$id]['time_last_coord'])) $timediff = round(time() - $this->all_tracked[$id]['time_last_coord']);
170 170
 	    	    else unset($timediff);
171
-	    	    if ($this->tmd > 5 || !isset($timediff) || $timediff > 2000 || ($timediff > 30 && isset($this->all_tracked[$id]['latitude']) && isset($this->all_tracked[$id]['longitude']) && $Common->withinThreshold($timediff,$Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')))) {
171
+	    	    if ($this->tmd > 5 || !isset($timediff) || $timediff > 2000 || ($timediff > 30 && isset($this->all_tracked[$id]['latitude']) && isset($this->all_tracked[$id]['longitude']) && $Common->withinThreshold($timediff, $Common->distance($line['latitude'], $line['longitude'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], 'm')))) {
172 172
 			if (isset($this->all_tracked[$id]['archive_latitude']) && isset($this->all_tracked[$id]['archive_longitude']) && isset($this->all_tracked[$id]['livedb_latitude']) && isset($this->all_tracked[$id]['livedb_longitude'])) {
173
-			    if (!$Common->checkLine($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['livedb_latitude'],$this->all_tracked[$id]['livedb_longitude'],$line['latitude'],$line['longitude'])) {
173
+			    if (!$Common->checkLine($this->all_tracked[$id]['archive_latitude'], $this->all_tracked[$id]['archive_longitude'], $this->all_tracked[$id]['livedb_latitude'], $this->all_tracked[$id]['livedb_longitude'], $line['latitude'], $line['longitude'])) {
174 174
 				$this->all_tracked[$id]['archive_latitude'] = $line['latitude'];
175 175
 				$this->all_tracked[$id]['archive_longitude'] = $line['longitude'];
176 176
 				$this->all_tracked[$id]['putinarchive'] = true;
@@ -178,10 +178,10 @@  discard block
 block discarded – undo
178 178
 				if ($globalDebug) echo "\n".' ------- Check Country for '.$this->all_tracked[$id]['ident'].' with latitude : '.$line['latitude'].' and longitude : '.$line['longitude'].'.... ';
179 179
 				$timeelapsed = microtime(true);
180 180
 				$Tracker = new Tracker($this->db);
181
-				$all_country = $Tracker->getCountryFromLatitudeLongitude($line['latitude'],$line['longitude']);
181
+				$all_country = $Tracker->getCountryFromLatitudeLongitude($line['latitude'], $line['longitude']);
182 182
 				if (!empty($all_country)) $this->all_tracked[$id]['over_country'] = $all_country['iso2'];
183 183
 				$Tracker->db = null;
184
-				if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
184
+				if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
185 185
 				$this->tmd = 0;
186 186
 				if ($globalDebug) echo 'FOUND : '.$this->all_tracked[$id]['over_country'].' ---------------'."\n";
187 187
 			    }
@@ -189,73 +189,73 @@  discard block
 block discarded – undo
189 189
 
190 190
 			if (isset($line['latitude']) && $line['latitude'] != '' && $line['latitude'] != 0 && $line['latitude'] < 91 && $line['latitude'] > -90) {
191 191
 				if (!isset($this->all_tracked[$id]['archive_latitude'])) $this->all_tracked[$id]['archive_latitude'] = $line['latitude'];
192
-				if (!isset($this->all_tracked[$id]['livedb_latitude']) || abs($this->all_tracked[$id]['livedb_latitude']-$line['latitude']) > $globalCoordMinChange || $this->all_tracked[$id]['format_source'] == 'aprs') {
192
+				if (!isset($this->all_tracked[$id]['livedb_latitude']) || abs($this->all_tracked[$id]['livedb_latitude'] - $line['latitude']) > $globalCoordMinChange || $this->all_tracked[$id]['format_source'] == 'aprs') {
193 193
 				    $this->all_tracked[$id]['livedb_latitude'] = $line['latitude'];
194 194
 				    $dataFound = true;
195 195
 				    $this->all_tracked[$id]['time_last_coord'] = time();
196 196
 				}
197
-				$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('latitude' => $line['latitude']));
197
+				$this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('latitude' => $line['latitude']));
198 198
 			}
199 199
 			if (isset($line['longitude']) && $line['longitude'] != '' && $line['longitude'] != 0 && $line['longitude'] < 360 && $line['longitude'] > -180) {
200 200
 			    if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360;
201 201
 				if (!isset($this->all_tracked[$id]['archive_longitude'])) $this->all_tracked[$id]['archive_longitude'] = $line['longitude'];
202
-				if (!isset($this->all_tracked[$id]['livedb_longitude']) || abs($this->all_tracked[$id]['livedb_longitude']-$line['longitude']) > $globalCoordMinChange || $this->all_tracked[$id]['format_source'] == 'aprs') {
202
+				if (!isset($this->all_tracked[$id]['livedb_longitude']) || abs($this->all_tracked[$id]['livedb_longitude'] - $line['longitude']) > $globalCoordMinChange || $this->all_tracked[$id]['format_source'] == 'aprs') {
203 203
 				    $this->all_tracked[$id]['livedb_longitude'] = $line['longitude'];
204 204
 				    $dataFound = true;
205 205
 				    $this->all_tracked[$id]['time_last_coord'] = time();
206 206
 				}
207
-				$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('longitude' => $line['longitude']));
207
+				$this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('longitude' => $line['longitude']));
208 208
 			}
209 209
 
210 210
 		    } else if ($globalDebug && $timediff > 20) {
211 211
 			$this->tmd = $this->tmd + 1;
212 212
 			echo '!!! Too much distance in short time... for '.$this->all_tracked[$id]['ident']."\n";
213
-			echo 'Time : '.$timediff.'s - Distance : '.$Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')."m -";
214
-			echo 'Speed : '.(($Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')/$timediff)*3.6)." km/h - ";
213
+			echo 'Time : '.$timediff.'s - Distance : '.$Common->distance($line['latitude'], $line['longitude'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], 'm')."m -";
214
+			echo 'Speed : '.(($Common->distance($line['latitude'], $line['longitude'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], 'm')/$timediff)*3.6)." km/h - ";
215 215
 			echo 'Lat : '.$line['latitude'].' - long : '.$line['longitude'].' - prev lat : '.$this->all_tracked[$id]['latitude'].' - prev long : '.$this->all_tracked[$id]['longitude']." \n";
216 216
 		    }
217 217
 		}
218 218
 		if (isset($line['last_update']) && $line['last_update'] != '') {
219 219
 		    if (isset($this->all_tracked[$id]['last_update']) && $this->all_tracked[$id]['last_update'] != $line['last_update']) $dataFound = true;
220
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('last_update' => $line['last_update']));
220
+		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('last_update' => $line['last_update']));
221 221
 		}
222 222
 		if (isset($line['format_source']) && $line['format_source'] != '') {
223
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('format_source' => $line['format_source']));
223
+		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('format_source' => $line['format_source']));
224 224
 		}
225 225
 		if (isset($line['source_name']) && $line['source_name'] != '') {
226
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('source_name' => $line['source_name']));
226
+		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('source_name' => $line['source_name']));
227 227
 		}
228 228
 		if (isset($line['comment']) && $line['comment'] != '') {
229
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('comment' => $line['comment']));
229
+		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('comment' => $line['comment']));
230 230
 		    //$dataFound = true;
231 231
 		}
232 232
 		if (isset($line['type']) && $line['type'] != '') {
233
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('type' => $line['type']));
233
+		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('type' => $line['type']));
234 234
 		    //$dataFound = true;
235 235
 		}
236 236
 
237 237
 		if (isset($line['altitude']) && $line['altitude'] != '') {
238 238
 		    //if (!isset($this->all_tracked[$id]['altitude']) || $this->all_tracked[$id]['altitude'] == '' || ($this->all_tracked[$id]['altitude'] > 0 && $line['altitude'] != 0)) {
239
-			if (is_int($this->all_tracked[$id]['altitude']) && abs(round($line['altitude']/100)-$this->all_tracked[$id]['altitude']) > 3) $this->all_tracked[$id]['putinarchive'] = true;
240
-			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('altitude' => round($line['altitude']/100)));
241
-			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('altitude_real' => $line['altitude']));
239
+			if (is_int($this->all_tracked[$id]['altitude']) && abs(round($line['altitude']/100) - $this->all_tracked[$id]['altitude']) > 3) $this->all_tracked[$id]['putinarchive'] = true;
240
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('altitude' => round($line['altitude']/100)));
241
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('altitude_real' => $line['altitude']));
242 242
 			//$dataFound = true;
243 243
 		    //} elseif ($globalDebug) echo "!!! Strange altitude data... not added.\n";
244 244
   		}
245 245
 
246 246
 		if (isset($line['noarchive']) && $line['noarchive'] === true) {
247
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('noarchive' => true));
247
+		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('noarchive' => true));
248 248
 		}
249 249
 		
250 250
 		if (isset($line['heading']) && $line['heading'] != '') {
251
-		    if (is_int($this->all_tracked[$id]['heading']) && abs($this->all_tracked[$id]['heading']-round($line['heading'])) > 10) $this->all_tracked[$id]['putinarchive'] = true;
252
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($line['heading'])));
253
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading_fromsrc' => true));
251
+		    if (is_int($this->all_tracked[$id]['heading']) && abs($this->all_tracked[$id]['heading'] - round($line['heading'])) > 10) $this->all_tracked[$id]['putinarchive'] = true;
252
+		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('heading' => round($line['heading'])));
253
+		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('heading_fromsrc' => true));
254 254
 		    //$dataFound = true;
255 255
   		} elseif (!isset($this->all_tracked[$id]['heading_fromsrc']) && isset($this->all_tracked[$id]['archive_latitude']) && $this->all_tracked[$id]['archive_latitude'] != $this->all_tracked[$id]['latitude'] && isset($this->all_tracked[$id]['archive_longitude']) && $this->all_tracked[$id]['archive_longitude'] != $this->all_tracked[$id]['longitude']) {
256
-  		    $heading = $Common->getHeading($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude']);
257
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($heading)));
258
-		    if (abs($this->all_tracked[$id]['heading']-round($heading)) > 10) $this->all_tracked[$id]['putinarchive'] = true;
256
+  		    $heading = $Common->getHeading($this->all_tracked[$id]['archive_latitude'], $this->all_tracked[$id]['archive_longitude'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude']);
257
+		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('heading' => round($heading)));
258
+		    if (abs($this->all_tracked[$id]['heading'] - round($heading)) > 10) $this->all_tracked[$id]['putinarchive'] = true;
259 259
   		    if ($globalDebug) echo "ø Calculated Heading for ".$this->all_tracked[$id]['ident']." : ".$heading."\n";
260 260
   		}
261 261
 		//if (isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_tracked[$id]['lastupdate']) && time()-$this->all_tracked[$id]['lastupdate'] < $globalSourcesupdate) $dataFound = false;
@@ -263,39 +263,39 @@  discard block
 block discarded – undo
263 263
 		if ($dataFound === true && isset($this->all_tracked[$id]['ident'])) {
264 264
 		    $this->all_tracked[$id]['lastupdate'] = time();
265 265
 		    if ($this->all_tracked[$id]['addedTracker'] == 0) {
266
-		        if (!isset($globalDistanceIgnore['latitude']) || $this->all_tracked[$id]['longitude'] == ''  || $this->all_tracked[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) {
266
+		        if (!isset($globalDistanceIgnore['latitude']) || $this->all_tracked[$id]['longitude'] == '' || $this->all_tracked[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $globalDistanceIgnore['latitude'], $globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) {
267 267
 			    if (!isset($this->all_tracked[$id]['forcenew']) || $this->all_tracked[$id]['forcenew'] == 0) {
268 268
 				if ($globalDebug) echo "Check if aircraft is already in DB...";
269 269
 				$timeelapsed = microtime(true);
270 270
 				$TrackerLive = new TrackerLive($this->db);
271 271
 				if (isset($line['id'])) {
272 272
 				    $recent_ident = $TrackerLive->checkIdRecent($line['id']);
273
-				    if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
273
+				    if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
274 274
 				} elseif (isset($this->all_tracked[$id]['ident']) && $this->all_tracked[$id]['ident'] != '') {
275 275
 				    $recent_ident = $TrackerLive->checkIdentRecent($this->all_tracked[$id]['ident']);
276
-				    if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
276
+				    if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
277 277
 				} else $recent_ident = '';
278
-				$TrackerLive->db=null;
278
+				$TrackerLive->db = null;
279 279
 
280 280
 				if ($globalDebug && $recent_ident == '') echo " Not in DB.\n";
281 281
 				elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n";
282 282
 			    } else {
283 283
 				$recent_ident = '';
284
-				$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('forcenew' => 0));
284
+				$this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('forcenew' => 0));
285 285
 			    }
286 286
 			    //if there was no aircraft with the same callsign within the last hour and go post it into the archive
287
-			    if($recent_ident == "")
287
+			    if ($recent_ident == "")
288 288
 			    {
289 289
 				if ($globalDebug) echo "\o/ Add ".$this->all_tracked[$id]['ident']." in archive DB : ";
290 290
 				//adds the spotter data for the archive
291 291
 				    $highlight = '';
292
-				    if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident'].'-'.date('YmdHi')));
292
+				    if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('id' => $this->all_tracked[$id]['ident'].'-'.date('YmdHi')));
293 293
 				    $timeelapsed = microtime(true);
294 294
 				    $Tracker = new Tracker($this->db);
295
-				    $result = $Tracker->addTrackerData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['altitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['comment'],$this->all_tracked[$id]['type'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name']);
295
+				    $result = $Tracker->addTrackerData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['altitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['comment'], $this->all_tracked[$id]['type'], $this->all_tracked[$id]['format_source'], $this->all_tracked[$id]['source_name']);
296 296
 				    $Tracker->db = null;
297 297
 				    if ($globalDebug && isset($result)) echo $result."\n";
298
-				    if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
298
+				    if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
299 299
 				    
300 300
 				    /*
301 301
 				    // Add source stat in DB
@@ -333,7 +333,7 @@  discard block
 block discarded – undo
333 333
 				    //TrackerLive->deleteLiveTrackerDataNotUpdated();
334 334
 				    $TrackerLive = new TrackerLive($this->db);
335 335
 				    $TrackerLive->deleteLiveTrackerData();
336
-				    $TrackerLive->db=null;
336
+				    $TrackerLive->db = null;
337 337
 				    if ($globalDebug) echo " Done\n";
338 338
 				    $this->last_delete = time();
339 339
 				}
@@ -342,7 +342,7 @@  discard block
 block discarded – undo
342 342
 				$this->all_tracked[$id]['addedTracker'] = 1;
343 343
 				if (isset($globalDaemon) && !$globalDaemon) {
344 344
 					$Tracker = new Tracker($this->db);
345
-					$Tracker->updateLatestTrackerData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['ident'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$this->all_tracked[$id]['altitude'],$this->all_tracked[$id]['speed'],$this->all_tracked[$id]['datetime']);
345
+					$Tracker->updateLatestTrackerData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['altitude'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime']);
346 346
 					$Tracker->db = null;
347 347
 				}
348 348
 				
@@ -356,14 +356,14 @@  discard block
 block discarded – undo
356 356
 		    $ignoreImport = false;
357 357
 
358 358
 		    if (!$ignoreImport) {
359
-			if (!isset($globalDistanceIgnore['latitude']) || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) {
359
+			if (!isset($globalDistanceIgnore['latitude']) || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $globalDistanceIgnore['latitude'], $globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) {
360 360
 				if ($globalDebug) echo "\o/ Add ".$this->all_tracked[$id]['ident']." from ".$this->all_tracked[$id]['format_source']." in Live DB : ";
361 361
 				$timeelapsed = microtime(true);
362 362
 				$TrackerLive = new TrackerLive($this->db);
363
-				$result = $TrackerLive->addLiveTrackerData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['altitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'],$this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['putinarchive'],$this->all_tracked[$id]['comment'],$this->all_tracked[$id]['type'],$this->all_tracked[$id]['noarchive'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name'],$this->all_tracked[$id]['over_country']);
363
+				$result = $TrackerLive->addLiveTrackerData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['altitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['putinarchive'], $this->all_tracked[$id]['comment'], $this->all_tracked[$id]['type'], $this->all_tracked[$id]['noarchive'], $this->all_tracked[$id]['format_source'], $this->all_tracked[$id]['source_name'], $this->all_tracked[$id]['over_country']);
364 364
 				$TrackerLive->db = null;
365 365
 				$this->all_tracked[$id]['putinarchive'] = false;
366
-				if ($globalDebugTimeElapsed) echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
366
+				if ($globalDebugTimeElapsed) echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
367 367
 
368 368
 				// Put statistics in $this->stats variable
369 369
 				/*
@@ -422,7 +422,7 @@  discard block
 block discarded – undo
422 422
 				$this->all_tracked[$id]['lastupdate'] = time();
423 423
 				if ($this->all_tracked[$id]['putinarchive']) $send = true;
424 424
 				if ($globalDebug) echo $result."\n";
425
-			} elseif (isset($this->all_tracked[$id]['latitude']) && isset($globalDistanceIgnore['latitude']) && $globalDebug) echo "!! Too far -> Distance : ".$Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude'])."\n";
425
+			} elseif (isset($this->all_tracked[$id]['latitude']) && isset($globalDistanceIgnore['latitude']) && $globalDebug) echo "!! Too far -> Distance : ".$Common->distance($this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $globalDistanceIgnore['latitude'], $globalDistanceIgnore['longitude'])."\n";
426 426
 			//$this->del();
427 427
 			
428 428
 			
Please login to merge, or discard this patch.
tracker-data.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -9,11 +9,11 @@  discard block
 block discarded – undo
9 9
 
10 10
 $from_archive = false;
11 11
 if (isset($_GET['ident'])) {
12
-	$ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING);
12
+	$ident = filter_input(INPUT_GET, 'ident', FILTER_SANITIZE_STRING);
13 13
 	if (isset($_GET['currenttime'])) {
14
-		$currenttime = filter_input(INPUT_GET,'currenttime',FILTER_SANITIZE_NUMBER_INT);
14
+		$currenttime = filter_input(INPUT_GET, 'currenttime', FILTER_SANITIZE_NUMBER_INT);
15 15
 		$currenttime = round($currenttime/1000);
16
-		$spotter_array = $TrackerLive->getDateLiveTrackerDataByIdent($ident,$currenttime);
16
+		$spotter_array = $TrackerLive->getDateLiveTrackerDataByIdent($ident, $currenttime);
17 17
 		/*
18 18
 		if (empty($spotter_array)) {
19 19
 			$from_archive = true;
@@ -31,11 +31,11 @@  discard block
 block discarded – undo
31 31
 	}
32 32
 }
33 33
 if (isset($_GET['famtrackid'])) {
34
-	$famtrackid = filter_input(INPUT_GET,'famtrackid',FILTER_SANITIZE_STRING);
34
+	$famtrackid = filter_input(INPUT_GET, 'famtrackid', FILTER_SANITIZE_STRING);
35 35
 	if (isset($_GET['currenttime'])) {
36
-		$currenttime = filter_input(INPUT_GET,'currenttime',FILTER_SANITIZE_NUMBER_INT);
36
+		$currenttime = filter_input(INPUT_GET, 'currenttime', FILTER_SANITIZE_NUMBER_INT);
37 37
 		$currenttime = round($currenttime/1000);
38
-		$spotter_array = $TrackerLive->getDateLiveTrackerDataById($famtrackid,$currenttime);
38
+		$spotter_array = $TrackerLive->getDateLiveTrackerDataById($famtrackid, $currenttime);
39 39
 		/*
40 40
 		if (empty($spotter_array)) {
41 41
 			$from_archive = true;
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 if (isset($spotter_item['image_thumbnail']) && $spotter_item['image_thumbnail'] != "")
63 63
 {
64 64
 	if ($spotter_item['image_source'] == 'flickr' || $spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart') {
65
-		$image = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']);
65
+		$image = preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']);
66 66
 	} else $image = $spotter_item['image_thumbnail'];
67 67
 
68 68
 }
Please login to merge, or discard this patch.
js/map-tracker.3d.js.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -131,5 +131,5 @@
 block discarded – undo
131 131
 } else {
132 132
 	var clockViewModel = new Cesium.ClockViewModel(viewer.clock);
133 133
 	var animationViewModel = new Cesium.AnimationViewModel(clockViewModel);
134
-	$(".archivebox").html('<h4><?php echo str_replace("'","\'",_("Archive")); ?></h4>' + '<br/><form id="noarchive" method="post"><input type="hidden" name="noarchive" /></form><a href="#" onClick="animationViewModel.playReverseViewModel.command();"><i class="fa fa-play fa-flip-horizontal" aria-hidden="true"></i></a> <a href="#" onClick="'+"document.getElementById('noarchive').submit();"+'"><i class="fa fa-eject" aria-hidden="true"></i></a> <a href="#" onClick="animationViewModel.pauseViewModel.command();"><i class="fa fa-pause" aria-hidden="true"></i></a> <a href="#" onClick="animationViewModel.playForwardViewModel.command();"><i class="fa fa-play" aria-hidden="true"></i></a>');
134
+	$(".archivebox").html('<h4><?php echo str_replace("'", "\'", _("Archive")); ?></h4>' + '<br/><form id="noarchive" method="post"><input type="hidden" name="noarchive" /></form><a href="#" onClick="animationViewModel.playReverseViewModel.command();"><i class="fa fa-play fa-flip-horizontal" aria-hidden="true"></i></a> <a href="#" onClick="'+"document.getElementById('noarchive').submit();"+'"><i class="fa fa-eject" aria-hidden="true"></i></a> <a href="#" onClick="animationViewModel.pauseViewModel.command();"><i class="fa fa-pause" aria-hidden="true"></i></a> <a href="#" onClick="animationViewModel.playForwardViewModel.command();"><i class="fa fa-play" aria-hidden="true"></i></a>');
135 135
 }
Please login to merge, or discard this patch.
install/class.update_db.php 1 patch
Spacing   +296 added lines, -296 removed lines patch added patch discarded remove patch
@@ -24,20 +24,20 @@  discard block
 block discarded – undo
24 24
 		fclose($fp);
25 25
 	}
26 26
 
27
-	public static function gunzip($in_file,$out_file_name = '') {
27
+	public static function gunzip($in_file, $out_file_name = '') {
28 28
 		//echo $in_file.' -> '.$out_file_name."\n";
29 29
 		$buffer_size = 4096; // read 4kb at a time
30 30
 		if ($out_file_name == '') $out_file_name = str_replace('.gz', '', $in_file); 
31 31
 		if ($in_file != '' && file_exists($in_file)) {
32 32
 			// PHP version of Ubuntu use gzopen64 instead of gzopen
33
-			if (function_exists('gzopen')) $file = gzopen($in_file,'rb');
34
-			elseif (function_exists('gzopen64')) $file = gzopen64($in_file,'rb');
33
+			if (function_exists('gzopen')) $file = gzopen($in_file, 'rb');
34
+			elseif (function_exists('gzopen64')) $file = gzopen64($in_file, 'rb');
35 35
 			else {
36 36
 				echo 'gzopen not available';
37 37
 				die;
38 38
 			}
39 39
 			$out_file = fopen($out_file_name, 'wb'); 
40
-			while(!gzeof($file)) {
40
+			while (!gzeof($file)) {
41 41
 				fwrite($out_file, gzread($file, $buffer_size));
42 42
 			}  
43 43
 			fclose($out_file);
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 		try {
62 62
 			self::$db_sqlite = new PDO('sqlite:'.$database);
63 63
 			self::$db_sqlite->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
64
-		} catch(PDOException $e) {
64
+		} catch (PDOException $e) {
65 65
 			return "error : ".$e->getMessage();
66 66
 		}
67 67
 	}
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 			//$Connection = new Connection();
77 77
 			$sth = $Connection->db->prepare($query);
78 78
                         $sth->execute(array(':source' => $database_file));
79
-                } catch(PDOException $e) {
79
+                } catch (PDOException $e) {
80 80
                         return "error : ".$e->getMessage();
81 81
                 }
82 82
 
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 		try {
88 88
                         $sth = update_db::$db_sqlite->prepare($query);
89 89
                         $sth->execute();
90
-                } catch(PDOException $e) {
90
+                } catch (PDOException $e) {
91 91
                         return "error : ".$e->getMessage();
92 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)';
@@ -98,11 +98,11 @@  discard block
 block discarded – undo
98 98
 			if ($globalTransaction) $Connection->db->beginTransaction();
99 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
-				$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);
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
-		} catch(PDOException $e) {
105
+		} catch (PDOException $e) {
106 106
 			if ($globalTransaction) $Connection->db->rollBack(); 
107 107
 			return "error : ".$e->getMessage();
108 108
 		}
@@ -118,26 +118,26 @@  discard block
 block discarded – undo
118 118
 			//$Connection = new Connection();
119 119
 			$sth = $Connection->db->prepare($query);
120 120
                         $sth->execute(array(':source' => 'oneworld'));
121
-                } catch(PDOException $e) {
121
+                } catch (PDOException $e) {
122 122
                         return "error : ".$e->getMessage();
123 123
                 }
124 124
 
125 125
     		if ($globalDebug) echo " - Add routes to DB -";
126 126
 		require_once(dirname(__FILE__).'/../require/class.Spotter.php');
127 127
 		$Spotter = new Spotter();
128
-		if ($fh = fopen($database_file,"r")) {
128
+		if ($fh = fopen($database_file, "r")) {
129 129
 			$query_dest = 'INSERT INTO routes (CallSign,Operator_ICAO,FromAirport_ICAO,FromAirport_Time,ToAirport_ICAO,ToAirport_Time,RouteStop,Source) VALUES (:CallSign, :Operator_ICAO, :FromAirport_ICAO,:FromAirport_Time, :ToAirport_ICAO, :ToAirport_Time,:routestop, :source)';
130 130
 			$Connection = new Connection();
131 131
 			$sth_dest = $Connection->db->prepare($query_dest);
132 132
 			if ($globalTransaction) $Connection->db->beginTransaction();
133 133
 			while (!feof($fh)) {
134
-				$line = fgetcsv($fh,9999,',');
134
+				$line = fgetcsv($fh, 9999, ',');
135 135
 				if ($line[0] != '') {
136 136
 					if (($line[2] == '-' || ($line[2] != '-' && (strtotime($line[2]) > time()))) && ($line[3] == '-' || ($line[3] != '-' && (strtotime($line[3]) < time())))) {
137 137
 						try {
138
-							$query_dest_values = array(':CallSign' => str_replace('*','',$line[7]),':Operator_ICAO' => '',':FromAirport_ICAO' => $Spotter->getAirportICAO($line[0]),':FromAirport_Time' => $line[5],':ToAirport_ICAO' => $Spotter->getAirportICAO($line[1]),':ToAirport_Time' => $line[6],':routestop' => '',':source' => 'oneworld');
138
+							$query_dest_values = array(':CallSign' => str_replace('*', '', $line[7]), ':Operator_ICAO' => '', ':FromAirport_ICAO' => $Spotter->getAirportICAO($line[0]), ':FromAirport_Time' => $line[5], ':ToAirport_ICAO' => $Spotter->getAirportICAO($line[1]), ':ToAirport_Time' => $line[6], ':routestop' => '', ':source' => 'oneworld');
139 139
 							$sth_dest->execute($query_dest_values);
140
-						} catch(PDOException $e) {
140
+						} catch (PDOException $e) {
141 141
 							if ($globalTransaction) $Connection->db->rollBack(); 
142 142
 							return "error : ".$e->getMessage();
143 143
 						}
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
 			//$Connection = new Connection();
160 160
 			$sth = $Connection->db->prepare($query);
161 161
                         $sth->execute(array(':source' => 'skyteam'));
162
-                } catch(PDOException $e) {
162
+                } catch (PDOException $e) {
163 163
                         return "error : ".$e->getMessage();
164 164
                 }
165 165
 
@@ -167,24 +167,24 @@  discard block
 block discarded – undo
167 167
 
168 168
 		require_once(dirname(__FILE__).'/../require/class.Spotter.php');
169 169
 		$Spotter = new Spotter();
170
-		if ($fh = fopen($database_file,"r")) {
170
+		if ($fh = fopen($database_file, "r")) {
171 171
 			$query_dest = 'INSERT INTO routes (CallSign,Operator_ICAO,FromAirport_ICAO,FromAirport_Time,ToAirport_ICAO,ToAirport_Time,RouteStop,Source) VALUES (:CallSign, :Operator_ICAO, :FromAirport_ICAO,:FromAirport_Time, :ToAirport_ICAO, :ToAirport_Time,:routestop, :source)';
172 172
 			$Connection = new Connection();
173 173
 			$sth_dest = $Connection->db->prepare($query_dest);
174 174
 			try {
175 175
 				if ($globalTransaction) $Connection->db->beginTransaction();
176 176
 				while (!feof($fh)) {
177
-					$line = fgetcsv($fh,9999,',');
177
+					$line = fgetcsv($fh, 9999, ',');
178 178
 					if ($line[0] != '') {
179
-						$datebe = explode('  -  ',$line[2]);
179
+						$datebe = explode('  -  ', $line[2]);
180 180
 						if (strtotime($datebe[0]) > time() && strtotime($datebe[1]) < time()) {
181
-							$query_dest_values = array(':CallSign' => str_replace('*','',$line[6]),':Operator_ICAO' => '',':FromAirport_ICAO' => $Spotter->getAirportICAO($line[0]),':FromAirport_Time' => $line[4],':ToAirport_ICAO' => $Spotter->getAirportICAO($line[1]),':ToAirport_Time' => $line[5],':routestop' => '',':source' => 'skyteam');
181
+							$query_dest_values = array(':CallSign' => str_replace('*', '', $line[6]), ':Operator_ICAO' => '', ':FromAirport_ICAO' => $Spotter->getAirportICAO($line[0]), ':FromAirport_Time' => $line[4], ':ToAirport_ICAO' => $Spotter->getAirportICAO($line[1]), ':ToAirport_Time' => $line[5], ':routestop' => '', ':source' => 'skyteam');
182 182
 							$sth_dest->execute($query_dest_values);
183 183
 						}
184 184
 					}
185 185
 				}
186 186
 				if ($globalTransaction) $Connection->db->commit();
187
-			} catch(PDOException $e) {
187
+			} catch (PDOException $e) {
188 188
 				if ($globalTransaction) $Connection->db->rollBack(); 
189 189
 				return "error : ".$e->getMessage();
190 190
 			}
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
 			$Connection = new Connection();
200 200
 			$sth = $Connection->db->prepare($query);
201 201
                         $sth->execute(array(':source' => $database_file));
202
-                } catch(PDOException $e) {
202
+                } catch (PDOException $e) {
203 203
                         return "error : ".$e->getMessage();
204 204
                 }
205 205
 		$query = "DELETE FROM aircraft_owner WHERE Source = '' OR Source IS NULL OR Source = :source";
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
 			$Connection = new Connection();
208 208
 			$sth = $Connection->db->prepare($query);
209 209
                         $sth->execute(array(':source' => $database_file));
210
-                } catch(PDOException $e) {
210
+                } catch (PDOException $e) {
211 211
                         return "error : ".$e->getMessage();
212 212
                 }
213 213
 
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
 		try {
217 217
                         $sth = update_db::$db_sqlite->prepare($query);
218 218
                         $sth->execute();
219
-                } catch(PDOException $e) {
219
+                } catch (PDOException $e) {
220 220
                         return "error : ".$e->getMessage();
221 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)';
@@ -233,15 +233,15 @@  discard block
 block discarded – undo
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
-				$query_dest_values = array(':LastModified' => $values['LastModified'],':ModeS' => $values['ModeS'],':ModeSCountry' => $values['ModeSCountry'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':source' => $database_file,':type' => $type);
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']);
239
+				    $query_dest_owner_values = array(':registration' => $values['Registration'], ':source' => $database_file, ':owner' => $values['RegisteredOwners']);
240 240
 				    $sth_dest_owner->execute($query_dest_owner_values);
241 241
 				}
242 242
             		}
243 243
 			if ($globalTransaction) $Connection->db->commit();
244
-		} catch(PDOException $e) {
244
+		} catch (PDOException $e) {
245 245
 			return "error : ".$e->getMessage();
246 246
 		}
247 247
 
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
 			$Connection = new Connection();
252 252
 			$sth = $Connection->db->prepare($query);
253 253
                         $sth->execute(array(':source' => $database_file));
254
-                } catch(PDOException $e) {
254
+                } catch (PDOException $e) {
255 255
                         return "error : ".$e->getMessage();
256 256
                 }
257 257
 		return '';
@@ -266,11 +266,11 @@  discard block
 block discarded – undo
266 266
 			$Connection = new Connection();
267 267
 			$sth = $Connection->db->prepare($query);
268 268
                         $sth->execute(array(':source' => $database_file));
269
-                } catch(PDOException $e) {
269
+                } catch (PDOException $e) {
270 270
                         return "error : ".$e->getMessage();
271 271
                 }
272 272
 		
273
-		if ($fh = fopen($database_file,"r")) {
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)';
275 275
 			$query_dest = 'INSERT INTO aircraft_modes (ModeS,Registration,ICAOTypeCode,Source,source_type) VALUES (:ModeS,:Registration,:ICAOTypeCode,:source,:source_type)';
276 276
 		
@@ -280,13 +280,13 @@  discard block
 block discarded – undo
280 280
 				if ($globalTransaction) $Connection->db->beginTransaction();
281 281
             			while (!feof($fh)) {
282 282
             				$values = array();
283
-            				$line = $Common->hex2str(fgets($fh,9999));
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));
285
+            				$values['ModeS'] = substr($line, 0, 6);
286
+            				$values['Registration'] = trim(substr($line, 69, 6));
287
+            				$aircraft_name = trim(substr($line, 48, 6));
288 288
             				// Check if we can find ICAO, else set it to GLID
289
-            				$aircraft_name_split = explode(' ',$aircraft_name);
289
+            				$aircraft_name_split = explode(' ', $aircraft_name);
290 290
             				$search_more = '';
291 291
             				if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'";
292 292
             				$query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more;
@@ -298,20 +298,20 @@  discard block
 block discarded – undo
298 298
 	            				if (isset($result['icao']) && $result['icao'] != '') {
299 299
 	            				    $values['ICAOTypeCode'] = $result['icao'];
300 300
 	            				} 
301
-					} catch(PDOException $e) {
301
+					} catch (PDOException $e) {
302 302
 						return "error : ".$e->getMessage();
303 303
 					}
304 304
 					if (!isset($values['ICAOTypeCode'])) $values['ICAOTypeCode'] = 'GLID';
305 305
 					// Add data to db
306 306
 					if ($values['Registration'] != '' && $values['Registration'] != '0000') {
307 307
 						//$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']);
308
-						$query_dest_values = array(':ModeS' => $values['ModeS'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':source' => $database_file,':source_type' => 'flarm');
308
+						$query_dest_values = array(':ModeS' => $values['ModeS'], ':Registration' => $values['Registration'], ':ICAOTypeCode' => $values['ICAOTypeCode'], ':source' => $database_file, ':source_type' => 'flarm');
309 309
 						//print_r($query_dest_values);
310 310
 						$sth_dest->execute($query_dest_values);
311 311
 					}
312 312
 				}
313 313
 				if ($globalTransaction) $Connection->db->commit();
314
-			} catch(PDOException $e) {
314
+			} catch (PDOException $e) {
315 315
 				return "error : ".$e->getMessage();
316 316
 			}
317 317
 		}
@@ -321,7 +321,7 @@  discard block
 block discarded – undo
321 321
 			$Connection = new Connection();
322 322
 			$sth = $Connection->db->prepare($query);
323 323
                         $sth->execute(array(':source' => $database_file));
324
-                } catch(PDOException $e) {
324
+                } catch (PDOException $e) {
325 325
                         return "error : ".$e->getMessage();
326 326
                 }
327 327
 		return '';
@@ -335,11 +335,11 @@  discard block
 block discarded – undo
335 335
 			$Connection = new Connection();
336 336
 			$sth = $Connection->db->prepare($query);
337 337
                         $sth->execute(array(':source' => $database_file));
338
-                } catch(PDOException $e) {
338
+                } catch (PDOException $e) {
339 339
                         return "error : ".$e->getMessage();
340 340
                 }
341 341
 		
342
-		if ($fh = fopen($database_file,"r")) {
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)';
344 344
 			$query_dest = 'INSERT INTO aircraft_modes (LastModified,ModeS,Registration,ICAOTypeCode,Source,source_type) VALUES (:lastmodified,:ModeS,:Registration,:ICAOTypeCode,:source,:source_type)';
345 345
 		
@@ -347,9 +347,9 @@  discard block
 block discarded – undo
347 347
 			$sth_dest = $Connection->db->prepare($query_dest);
348 348
 			try {
349 349
 				if ($globalTransaction) $Connection->db->beginTransaction();
350
-				$tmp = fgetcsv($fh,9999,',',"'");
350
+				$tmp = fgetcsv($fh, 9999, ',', "'");
351 351
             			while (!feof($fh)) {
352
-            				$line = fgetcsv($fh,9999,',',"'");
352
+            				$line = fgetcsv($fh, 9999, ',', "'");
353 353
             				
354 354
 					//FFFFFF                     RIDEAU VALLEY SOARINGASW-20               C-FBKN MZ 123.400
355 355
 					//print_r($line);
@@ -357,7 +357,7 @@  discard block
 block discarded – undo
357 357
             				$values['Registration'] = $line[3];
358 358
             				$aircraft_name = $line[2];
359 359
             				// Check if we can find ICAO, else set it to GLID
360
-            				$aircraft_name_split = explode(' ',$aircraft_name);
360
+            				$aircraft_name_split = explode(' ', $aircraft_name);
361 361
             				$search_more = '';
362 362
             				if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'";
363 363
             				$query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more;
@@ -366,20 +366,20 @@  discard block
 block discarded – undo
366 366
                                     		$sth_search->execute();
367 367
 	            				$result = $sth_search->fetch(PDO::FETCH_ASSOC);
368 368
 	            				if (isset($result['icao']) && $result['icao'] != '') $values['ICAOTypeCode'] = $result['icao'];
369
-					} catch(PDOException $e) {
369
+					} catch (PDOException $e) {
370 370
 						return "error : ".$e->getMessage();
371 371
 					}
372 372
 					//if (!isset($values['ICAOTypeCode'])) $values['ICAOTypeCode'] = 'GLID';
373 373
 					// Add data to db
374 374
 					if ($values['Registration'] != '' && $values['Registration'] != '0000' && $values['ICAOTypeCode'] != '') {
375 375
 						//$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']);
376
-						$query_dest_values = array(':lastmodified' => date('Y-m-d H:m:s'),':ModeS' => $values['ModeS'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':source' => $database_file,':source_type' => 'flarm');
376
+						$query_dest_values = array(':lastmodified' => date('Y-m-d H:m:s'), ':ModeS' => $values['ModeS'], ':Registration' => $values['Registration'], ':ICAOTypeCode' => $values['ICAOTypeCode'], ':source' => $database_file, ':source_type' => 'flarm');
377 377
 						//print_r($query_dest_values);
378 378
 						$sth_dest->execute($query_dest_values);
379 379
 					}
380 380
 				}
381 381
 				if ($globalTransaction) $Connection->db->commit();
382
-			} catch(PDOException $e) {
382
+			} catch (PDOException $e) {
383 383
 				return "error : ".$e->getMessage();
384 384
 			}
385 385
 		}
@@ -389,13 +389,13 @@  discard block
 block discarded – undo
389 389
 			$Connection = new Connection();
390 390
 			$sth = $Connection->db->prepare($query);
391 391
                         $sth->execute(array(':source' => $database_file));
392
-                } catch(PDOException $e) {
392
+                } catch (PDOException $e) {
393 393
                         return "error : ".$e->getMessage();
394 394
                 }
395 395
 		return '';
396 396
 	}
397 397
 
398
-	public static function retrieve_owner($database_file,$country = 'F') {
398
+	public static function retrieve_owner($database_file, $country = 'F') {
399 399
 		global $globalTransaction, $globalMasterSource;
400 400
 		//$query = 'TRUNCATE TABLE aircraft_modes';
401 401
 		$query = "DELETE FROM aircraft_owner WHERE Source = '' OR Source IS NULL OR Source = :source; DELETE FROM aircraft_modes WHERE Source = :source;";
@@ -403,12 +403,12 @@  discard block
 block discarded – undo
403 403
 			$Connection = new Connection();
404 404
 			$sth = $Connection->db->prepare($query);
405 405
                         $sth->execute(array(':source' => $database_file));
406
-                } catch(PDOException $e) {
406
+                } catch (PDOException $e) {
407 407
                         return "error : ".$e->getMessage();
408 408
                 }
409 409
 		require_once(dirname(__FILE__).'/../require/class.Spotter.php');
410 410
 		$Spotter = new Spotter();
411
-		if ($fh = fopen($database_file,"r")) {
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 414
 		        $query_modes = 'INSERT INTO aircraft_modes (ModeS,ModeSCountry,Registration,ICAOTypeCode,Source) VALUES (:modes,:modescountry,:registration,:icaotypecode,:source)';
@@ -418,9 +418,9 @@  discard block
 block discarded – undo
418 418
 			$sth_modes = $Connection->db->prepare($query_modes);
419 419
 			try {
420 420
 				if ($globalTransaction) $Connection->db->beginTransaction();
421
-				$tmp = fgetcsv($fh,9999,',','"');
421
+				$tmp = fgetcsv($fh, 9999, ',', '"');
422 422
             			while (!feof($fh)) {
423
-            				$line = fgetcsv($fh,9999,',','"');
423
+            				$line = fgetcsv($fh, 9999, ',', '"');
424 424
             				$values = array();
425 425
             				//print_r($line);
426 426
             				if ($country == 'F') {
@@ -428,7 +428,7 @@  discard block
 block discarded – undo
428 428
             				    $values['base'] = $line[4];
429 429
             				    $values['owner'] = $line[5];
430 430
             				    if ($line[6] == '') $values['date_first_reg'] = null;
431
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6]));
431
+					    else $values['date_first_reg'] = date("Y-m-d", strtotime($line[6]));
432 432
 					    $values['cancel'] = $line[7];
433 433
 					} elseif ($country == 'EI') {
434 434
 					    // TODO : add modeS & reg to aircraft_modes
@@ -436,7 +436,7 @@  discard block
 block discarded – undo
436 436
             				    $values['base'] = $line[3];
437 437
             				    $values['owner'] = $line[2];
438 438
             				    if ($line[1] == '') $values['date_first_reg'] = null;
439
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[1]));
439
+					    else $values['date_first_reg'] = date("Y-m-d", strtotime($line[1]));
440 440
 					    $values['cancel'] = '';
441 441
 					    $values['modes'] = $line[7];
442 442
 					    $values['icao'] = $line[8];
@@ -456,7 +456,7 @@  discard block
 block discarded – undo
456 456
             				    $values['base'] = null;
457 457
             				    $values['owner'] = $line[5];
458 458
             				    if ($line[18] == '') $values['date_first_reg'] = null;
459
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[18]));
459
+					    else $values['date_first_reg'] = date("Y-m-d", strtotime($line[18]));
460 460
 					    $values['cancel'] = '';
461 461
 					} elseif ($country == 'VH') {
462 462
 					    // TODO : add modeS & reg to aircraft_modes
@@ -464,7 +464,7 @@  discard block
 block discarded – undo
464 464
             				    $values['base'] = null;
465 465
             				    $values['owner'] = $line[12];
466 466
             				    if ($line[28] == '') $values['date_first_reg'] = null;
467
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[28]));
467
+					    else $values['date_first_reg'] = date("Y-m-d", strtotime($line[28]));
468 468
 
469 469
 					    $values['cancel'] = $line[39];
470 470
 					} elseif ($country == 'OE' || $country == '9A' || $country == 'VP' || $country == 'LX' || $country == 'P2' || $country == 'HC') {
@@ -484,28 +484,28 @@  discard block
 block discarded – undo
484 484
             				    $values['base'] = null;
485 485
             				    $values['owner'] = $line[8];
486 486
             				    if ($line[7] == '') $values['date_first_reg'] = null;
487
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7]));
487
+					    else $values['date_first_reg'] = date("Y-m-d", strtotime($line[7]));
488 488
 					    $values['cancel'] = '';
489 489
 					} elseif ($country == 'PP') {
490 490
             				    $values['registration'] = $line[0];
491 491
             				    $values['base'] = null;
492 492
             				    $values['owner'] = $line[4];
493 493
             				    if ($line[6] == '') $values['date_first_reg'] = null;
494
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6]));
494
+					    else $values['date_first_reg'] = date("Y-m-d", strtotime($line[6]));
495 495
 					    $values['cancel'] = $line[7];
496 496
 					} elseif ($country == 'E7') {
497 497
             				    $values['registration'] = $line[0];
498 498
             				    $values['base'] = null;
499 499
             				    $values['owner'] = $line[4];
500 500
             				    if ($line[5] == '') $values['date_first_reg'] = null;
501
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[5]));
501
+					    else $values['date_first_reg'] = date("Y-m-d", strtotime($line[5]));
502 502
 					    $values['cancel'] = '';
503 503
 					} elseif ($country == '8Q') {
504 504
             				    $values['registration'] = $line[0];
505 505
             				    $values['base'] = null;
506 506
             				    $values['owner'] = $line[3];
507 507
             				    if ($line[7] == '') $values['date_first_reg'] = null;
508
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7]));
508
+					    else $values['date_first_reg'] = date("Y-m-d", strtotime($line[7]));
509 509
 					    $values['cancel'] = '';
510 510
 					} elseif ($country == 'ZK') {
511 511
             				    $values['registration'] = $line[0];
@@ -519,18 +519,18 @@  discard block
 block discarded – undo
519 519
             				    $values['registration'] = $line[0];
520 520
             				    $values['base'] = null;
521 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]));
522
+            				    $values['date_first_reg'] = date("Y-m-d", strtotime($line[5]));
523
+					    $values['cancel'] = date("Y-m-d", strtotime($line[8]));
524 524
 					    $values['modes'] = $line[4];
525 525
 					    $values['icao'] = $line[10];
526 526
 					} elseif ($country == 'OY') {
527 527
             				    $values['registration'] = $line[0];
528
-            				    $values['date_first_reg'] = date("Y-m-d",strtotime($line[4]));
528
+            				    $values['date_first_reg'] = date("Y-m-d", strtotime($line[4]));
529 529
 					    $values['modes'] = $line[5];
530 530
 					    $values['icao'] = $line[6];
531 531
 					} elseif ($country == 'PH') {
532 532
             				    $values['registration'] = $line[0];
533
-            				    $values['date_first_reg'] = date("Y-m-d",strtotime($line[3]));
533
+            				    $values['date_first_reg'] = date("Y-m-d", strtotime($line[3]));
534 534
 					    $values['modes'] = $line[4];
535 535
 					    $values['icao'] = $line[5];
536 536
 					} elseif ($country == 'OM' || $country == 'TF') {
@@ -541,17 +541,17 @@  discard block
 block discarded – undo
541 541
 					    $values['cancel'] = '';
542 542
 					}
543 543
 					if (isset($values['cancel']) && $values['cancel'] == '' && $values['registration'] != null && isset($values['owner'])) {
544
-						$query_dest_values = array(':registration' => $values['registration'],':base' => $values['base'],':date_first_reg' => $values['date_first_reg'],':owner' => $values['owner'],':source' => $database_file);
544
+						$query_dest_values = array(':registration' => $values['registration'], ':base' => $values['base'], ':date_first_reg' => $values['date_first_reg'], ':owner' => $values['owner'], ':source' => $database_file);
545 545
 						$sth_dest->execute($query_dest_values);
546 546
 					}
547 547
 					if ($globalMasterSource && $values['registration'] != null && isset($values['modes']) && $values['modes'] != '') {
548 548
 						$modescountry = $Spotter->countryFromAircraftRegistration($values['registration']);
549
-						$query_modes_values = array(':registration' => $values['registration'],':modes' => $values['modes'],':modescountry' => $modescountry,':icaotypecode' => $values['icao'],':source' => $database_file);
549
+						$query_modes_values = array(':registration' => $values['registration'], ':modes' => $values['modes'], ':modescountry' => $modescountry, ':icaotypecode' => $values['icao'], ':source' => $database_file);
550 550
 						$sth_modes->execute($query_modes_values);
551 551
 					}
552 552
 				}
553 553
 				if ($globalTransaction) $Connection->db->commit();
554
-			} catch(PDOException $e) {
554
+			} catch (PDOException $e) {
555 555
 				return "error : ".$e->getMessage();
556 556
 			}
557 557
 		}
@@ -666,7 +666,7 @@  discard block
 block discarded – undo
666 666
 			$Connection = new Connection();
667 667
 			$sth = $Connection->db->prepare($query);
668 668
                         $sth->execute();
669
-                } catch(PDOException $e) {
669
+                } catch (PDOException $e) {
670 670
                         return "error : ".$e->getMessage();
671 671
                 }
672 672
 
@@ -676,7 +676,7 @@  discard block
 block discarded – undo
676 676
 			$Connection = new Connection();
677 677
 			$sth = $Connection->db->prepare($query);
678 678
                         $sth->execute();
679
-                } catch(PDOException $e) {
679
+                } catch (PDOException $e) {
680 680
                         return "error : ".$e->getMessage();
681 681
                 }
682 682
 
@@ -687,7 +687,7 @@  discard block
 block discarded – undo
687 687
 		if ($globalTransaction) $Connection->db->beginTransaction();
688 688
   
689 689
 		$i = 0;
690
-		while($row = sparql_fetch_array($result))
690
+		while ($row = sparql_fetch_array($result))
691 691
 		{
692 692
 			if ($i >= 1) {
693 693
 			//print_r($row);
@@ -707,31 +707,31 @@  discard block
 block discarded – undo
707 707
 				$row['image'] = '';
708 708
 				$row['image_thumb'] = '';
709 709
 			} else {
710
-				$image = str_replace(' ','_',$row['image']);
710
+				$image = str_replace(' ', '_', $row['image']);
711 711
 				$digest = md5($image);
712
-				$folder = $digest[0] . '/' . $digest[0] . $digest[1] . '/' . $image . '/220px-' . $image;
713
-				$row['image_thumb'] = 'http://upload.wikimedia.org/wikipedia/commons/thumb/' . $folder;
714
-				$folder = $digest[0] . '/' . $digest[0] . $digest[1] . '/' . $image;
715
-				$row['image'] = 'http://upload.wikimedia.org/wikipedia/commons/' . $folder;
712
+				$folder = $digest[0].'/'.$digest[0].$digest[1].'/'.$image.'/220px-'.$image;
713
+				$row['image_thumb'] = 'http://upload.wikimedia.org/wikipedia/commons/thumb/'.$folder;
714
+				$folder = $digest[0].'/'.$digest[0].$digest[1].'/'.$image;
715
+				$row['image'] = 'http://upload.wikimedia.org/wikipedia/commons/'.$folder;
716 716
 			}
717 717
 			
718
-			$country = explode('-',$row['country']);
718
+			$country = explode('-', $row['country']);
719 719
 			$row['country'] = $country[0];
720 720
 			
721 721
 			$row['type'] = trim($row['type']);
722
-			if ($row['type'] == 'Military: Naval Auxiliary Air Station' || $row['type'] == 'http://dbpedia.org/resource/Naval_air_station' || $row['type'] == 'Military: Naval Air Station' || $row['type'] == 'Military Northern Fleet' || $row['type'] == 'Military and industrial' || $row['type'] == 'Military: Royal Air Force station' || $row['type'] == 'http://dbpedia.org/resource/Military_airbase' || $row['type'] == 'Military: Naval air station' || preg_match('/air base/i',$row['name'])) {
722
+			if ($row['type'] == 'Military: Naval Auxiliary Air Station' || $row['type'] == 'http://dbpedia.org/resource/Naval_air_station' || $row['type'] == 'Military: Naval Air Station' || $row['type'] == 'Military Northern Fleet' || $row['type'] == 'Military and industrial' || $row['type'] == 'Military: Royal Air Force station' || $row['type'] == 'http://dbpedia.org/resource/Military_airbase' || $row['type'] == 'Military: Naval air station' || preg_match('/air base/i', $row['name'])) {
723 723
 				$row['type'] = 'Military';
724 724
 			} elseif ($row['type'] == 'http://dbpedia.org/resource/Airport' || $row['type'] == 'Civil' || $row['type'] == 'Public use' || $row['type'] == 'Public' || $row['type'] == 'http://dbpedia.org/resource/Civilian' || $row['type'] == 'Public, Civilian' || $row['type'] == 'Public / Military' || $row['type'] == 'Private & Civilian' || $row['type'] == 'Civilian and Military' || $row['type'] == 'Public/military' || $row['type'] == 'Active With Few Facilities' || $row['type'] == '?ivilian' || $row['type'] == 'Civil/Military' || $row['type'] == 'NA' || $row['type'] == 'Public/Military') {
725 725
 				$row['type'] = 'small_airport';
726 726
 			}
727 727
 			
728
-			$row['city'] = urldecode(str_replace('_',' ',str_replace('http://dbpedia.org/resource/','',$row['city'])));
729
-			$query_dest_values = array(':airport_id' => $i, ':name' => $row['name'],':iata' => $row['iata'],':icao' => $row['icao'],':latitude' => $row['latitude'],':longitude' => $row['longitude'],':altitude' => $row['altitude'],':type' => $row['type'],':city' => $row['city'],':country' => $row['country'],':home_link' => $row['homepage'],':wikipedia_link' => $row['wikipedia_page'],':image' => $row['image'],':image_thumb' => $row['image_thumb']);
728
+			$row['city'] = urldecode(str_replace('_', ' ', str_replace('http://dbpedia.org/resource/', '', $row['city'])));
729
+			$query_dest_values = array(':airport_id' => $i, ':name' => $row['name'], ':iata' => $row['iata'], ':icao' => $row['icao'], ':latitude' => $row['latitude'], ':longitude' => $row['longitude'], ':altitude' => $row['altitude'], ':type' => $row['type'], ':city' => $row['city'], ':country' => $row['country'], ':home_link' => $row['homepage'], ':wikipedia_link' => $row['wikipedia_page'], ':image' => $row['image'], ':image_thumb' => $row['image_thumb']);
730 730
 			//print_r($query_dest_values);
731 731
 			
732 732
 			try {
733 733
 				$sth_dest->execute($query_dest_values);
734
-			} catch(PDOException $e) {
734
+			} catch (PDOException $e) {
735 735
 				return "error : ".$e->getMessage();
736 736
 			}
737 737
 			}
@@ -745,7 +745,7 @@  discard block
 block discarded – undo
745 745
 			$Connection = new Connection();
746 746
 			$sth = $Connection->db->prepare($query);
747 747
                         $sth->execute();
748
-                } catch(PDOException $e) {
748
+                } catch (PDOException $e) {
749 749
                         return "error : ".$e->getMessage();
750 750
                 }
751 751
 
@@ -753,12 +753,12 @@  discard block
 block discarded – undo
753 753
 		if ($globalDebug) echo "Insert Not available Airport...\n";
754 754
 		$query = "INSERT INTO airport (`airport_id`,`name`,`city`,`country`,`iata`,`icao`,`latitude`,`longitude`,`altitude`,`type`,`home_link`,`wikipedia_link`,`image`,`image_thumb`)
755 755
 		    VALUES (:airport_id, :name, :city, :country, :iata, :icao, :latitude, :longitude, :altitude, :type, :home_link, :wikipedia_link, :image, :image_thumb)";
756
-		$query_values = array(':airport_id' => $i, ':name' => 'Not available',':iata' => 'NA',':icao' => 'NA',':latitude' => '0',':longitude' => '0',':altitude' => '0',':type' => 'NA',':city' => 'N/A',':country' => 'N/A',':home_link' => '',':wikipedia_link' => '',':image' => '',':image_thumb' => '');
756
+		$query_values = array(':airport_id' => $i, ':name' => 'Not available', ':iata' => 'NA', ':icao' => 'NA', ':latitude' => '0', ':longitude' => '0', ':altitude' => '0', ':type' => 'NA', ':city' => 'N/A', ':country' => 'N/A', ':home_link' => '', ':wikipedia_link' => '', ':image' => '', ':image_thumb' => '');
757 757
 		try {
758 758
 			$Connection = new Connection();
759 759
 			$sth = $Connection->db->prepare($query);
760 760
                         $sth->execute($query_values);
761
-                } catch(PDOException $e) {
761
+                } catch (PDOException $e) {
762 762
                         return "error : ".$e->getMessage();
763 763
                 }
764 764
 		$i++;
@@ -776,7 +776,7 @@  discard block
 block discarded – undo
776 776
 		echo "Download data from ourairports.com...\n";
777 777
 		$delimiter = ',';
778 778
 		$out_file = $tmp_dir.'airports.csv';
779
-		update_db::download('http://ourairports.com/data/airports.csv',$out_file);
779
+		update_db::download('http://ourairports.com/data/airports.csv', $out_file);
780 780
 		if (!file_exists($out_file) || !is_readable($out_file)) return FALSE;
781 781
 		echo "Add data from ourairports.com...\n";
782 782
 
@@ -787,32 +787,32 @@  discard block
 block discarded – undo
787 787
 			//$Connection->db->beginTransaction();
788 788
 			while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE)
789 789
 			{
790
-				if(!$header) $header = $row;
790
+				if (!$header) $header = $row;
791 791
 				else {
792 792
 					$data = array();
793 793
 					$data = array_combine($header, $row);
794 794
 					try {
795 795
 						$sth = $Connection->db->prepare('SELECT COUNT(*) FROM airport WHERE `icao` = :icao');
796 796
 						$sth->execute(array(':icao' => $data['gps_code']));
797
-					} catch(PDOException $e) {
797
+					} catch (PDOException $e) {
798 798
 						return "error : ".$e->getMessage();
799 799
 					}
800 800
 					if ($sth->fetchColumn() > 0) {
801 801
 						$query = 'UPDATE airport SET `type` = :type WHERE icao = :icao';
802 802
 						try {
803 803
 							$sth = $Connection->db->prepare($query);
804
-							$sth->execute(array(':icao' => $data['gps_code'],':type' => $data['type']));
805
-						} catch(PDOException $e) {
804
+							$sth->execute(array(':icao' => $data['gps_code'], ':type' => $data['type']));
805
+						} catch (PDOException $e) {
806 806
 							return "error : ".$e->getMessage();
807 807
 						}
808 808
 					} else {
809 809
 						$query = "INSERT INTO airport (`airport_id`,`name`,`city`,`country`,`iata`,`icao`,`latitude`,`longitude`,`altitude`,`type`,`home_link`,`wikipedia_link`)
810 810
 						    VALUES (:airport_id, :name, :city, :country, :iata, :icao, :latitude, :longitude, :altitude, :type, :home_link, :wikipedia_link)";
811
-						$query_values = array(':airport_id' => $i, ':name' => $data['name'],':iata' => $data['iata_code'],':icao' => $data['gps_code'],':latitude' => $data['latitude_deg'],':longitude' => $data['longitude_deg'],':altitude' => $data['elevation_ft'],':type' => $data['type'],':city' => $data['municipality'],':country' => $data['iso_country'],':home_link' => $data['home_link'],':wikipedia_link' => $data['wikipedia_link']);
811
+						$query_values = array(':airport_id' => $i, ':name' => $data['name'], ':iata' => $data['iata_code'], ':icao' => $data['gps_code'], ':latitude' => $data['latitude_deg'], ':longitude' => $data['longitude_deg'], ':altitude' => $data['elevation_ft'], ':type' => $data['type'], ':city' => $data['municipality'], ':country' => $data['iso_country'], ':home_link' => $data['home_link'], ':wikipedia_link' => $data['wikipedia_link']);
812 812
 						try {
813 813
 							$sth = $Connection->db->prepare($query);
814 814
 							$sth->execute($query_values);
815
-						} catch(PDOException $e) {
815
+						} catch (PDOException $e) {
816 816
 							return "error : ".$e->getMessage();
817 817
 						}
818 818
 						$i++;
@@ -825,7 +825,7 @@  discard block
 block discarded – undo
825 825
 
826 826
 		echo "Download data from another free database...\n";
827 827
 		$out_file = $tmp_dir.'GlobalAirportDatabase.zip';
828
-		update_db::download('http://www.partow.net/downloads/GlobalAirportDatabase.zip',$out_file);
828
+		update_db::download('http://www.partow.net/downloads/GlobalAirportDatabase.zip', $out_file);
829 829
 		if (!file_exists($out_file) || !is_readable($out_file)) return FALSE;
830 830
 		update_db::unzip($out_file);
831 831
 		$header = NULL;
@@ -837,15 +837,15 @@  discard block
 block discarded – undo
837 837
 			//$Connection->db->beginTransaction();
838 838
 			while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE)
839 839
 			{
840
-				if(!$header) $header = $row;
840
+				if (!$header) $header = $row;
841 841
 				else {
842 842
 					$data = $row;
843 843
 
844 844
 					$query = 'UPDATE airport SET `city` = :city, `country` = :country WHERE icao = :icao';
845 845
 					try {
846 846
 						$sth = $Connection->db->prepare($query);
847
-						$sth->execute(array(':icao' => $data[0],':city' => ucwords(strtolower($data[3])),':country' => ucwords(strtolower($data[4]))));
848
-					} catch(PDOException $e) {
847
+						$sth->execute(array(':icao' => $data[0], ':city' => ucwords(strtolower($data[3])), ':country' => ucwords(strtolower($data[4]))));
848
+					} catch (PDOException $e) {
849 849
 						return "error : ".$e->getMessage();
850 850
 					}
851 851
 				}
@@ -859,15 +859,15 @@  discard block
 block discarded – undo
859 859
 		try {
860 860
 			$sth = $Connection->db->prepare("SELECT icao FROM airport WHERE `name` LIKE '%Air Base%'");
861 861
 			$sth->execute();
862
-		} catch(PDOException $e) {
862
+		} catch (PDOException $e) {
863 863
 			return "error : ".$e->getMessage();
864 864
 		}
865 865
 		while ($row = $sth->fetch(PDO::FETCH_ASSOC)) {
866 866
 			$query2 = 'UPDATE airport SET `type` = :type WHERE icao = :icao';
867 867
 			try {
868 868
 				$sth2 = $Connection->db->prepare($query2);
869
-				$sth2->execute(array(':icao' => $row['icao'],':type' => 'military'));
870
-			} catch(PDOException $e) {
869
+				$sth2->execute(array(':icao' => $row['icao'], ':type' => 'military'));
870
+			} catch (PDOException $e) {
871 871
 				return "error : ".$e->getMessage();
872 872
 			}
873 873
 		}
@@ -891,7 +891,7 @@  discard block
 block discarded – undo
891 891
 			$Connection = new Connection();
892 892
 			$sth = $Connection->db->prepare($query);
893 893
                         $sth->execute(array(':source' => 'translation.csv'));
894
-                } catch(PDOException $e) {
894
+                } catch (PDOException $e) {
895 895
                         return "error : ".$e->getMessage();
896 896
                 }
897 897
 
@@ -908,7 +908,7 @@  discard block
 block discarded – undo
908 908
 			while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE)
909 909
 			{
910 910
 				$i++;
911
-				if($i > 12) {
911
+				if ($i > 12) {
912 912
 					$data = $row;
913 913
 					$operator = $data[2];
914 914
 					if ($operator != '' && is_numeric(substr(substr($operator, 0, 3), -1, 1))) {
@@ -916,7 +916,7 @@  discard block
 block discarded – undo
916 916
                                                 //echo substr($operator, 0, 2)."\n";;
917 917
                                                 if (count($airline_array) > 0) {
918 918
 							//print_r($airline_array);
919
-							$operator = $airline_array[0]['icao'].substr($operator,2);
919
+							$operator = $airline_array[0]['icao'].substr($operator, 2);
920 920
                                                 }
921 921
                                         }
922 922
 					
@@ -924,14 +924,14 @@  discard block
 block discarded – undo
924 924
 					if ($operator_correct != '' && is_numeric(substr(substr($operator_correct, 0, 3), -1, 1))) {
925 925
                                                 $airline_array = $Spotter->getAllAirlineInfo(substr($operator_correct, 0, 2));
926 926
                                                 if (count($airline_array) > 0) {
927
-                                            		$operator_correct = $airline_array[0]['icao'].substr($operator_correct,2);
927
+                                            		$operator_correct = $airline_array[0]['icao'].substr($operator_correct, 2);
928 928
                                             	}
929 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);
933
-						$sth->execute(array(':Reg' => $data[0],':Reg_correct' => $data[1],':Operator' => $operator,':Operator_correct' => $operator_correct, ':source' => 'translation.csv'));
934
-					} catch(PDOException $e) {
933
+						$sth->execute(array(':Reg' => $data[0], ':Reg_correct' => $data[1], ':Operator' => $operator, ':Operator_correct' => $operator_correct, ':source' => 'translation.csv'));
934
+					} catch (PDOException $e) {
935 935
 						return "error : ".$e->getMessage();
936 936
 					}
937 937
 				}
@@ -951,7 +951,7 @@  discard block
 block discarded – undo
951 951
 			$Connection = new Connection();
952 952
 			$sth = $Connection->db->prepare($query);
953 953
                         $sth->execute(array(':source' => 'website_fam'));
954
-                } catch(PDOException $e) {
954
+                } catch (PDOException $e) {
955 955
                         return "error : ".$e->getMessage();
956 956
                 }
957 957
 
@@ -971,8 +971,8 @@  discard block
 block discarded – undo
971 971
 					$query = 'INSERT INTO translation (Reg,Reg_correct,Operator,Operator_correct,Source) VALUES (:Reg, :Reg_correct, :Operator, :Operator_correct, :source)';
972 972
 					try {
973 973
 						$sth = $Connection->db->prepare($query);
974
-						$sth->execute(array(':Reg' => $data[0],':Reg_correct' => $data[1],':Operator' => $data[2],':Operator_correct' => $data[3], ':source' => 'website_fam'));
975
-					} catch(PDOException $e) {
974
+						$sth->execute(array(':Reg' => $data[0], ':Reg_correct' => $data[1], ':Operator' => $data[2], ':Operator_correct' => $data[3], ':source' => 'website_fam'));
975
+					} catch (PDOException $e) {
976 976
 						return "error : ".$e->getMessage();
977 977
 					}
978 978
 				}
@@ -995,7 +995,7 @@  discard block
 block discarded – undo
995 995
 			$Connection = new Connection();
996 996
 			$sth = $Connection->db->prepare($query);
997 997
                         $sth->execute(array(':source' => 'website_faa'));
998
-                } catch(PDOException $e) {
998
+                } catch (PDOException $e) {
999 999
                         return "error : ".$e->getMessage();
1000 1000
                 }
1001 1001
 
@@ -1004,7 +1004,7 @@  discard block
 block discarded – undo
1004 1004
 			$Connection = new Connection();
1005 1005
 			$sth = $Connection->db->prepare($query);
1006 1006
                         $sth->execute(array(':source' => 'website_faa'));
1007
-                } catch(PDOException $e) {
1007
+                } catch (PDOException $e) {
1008 1008
                         return "error : ".$e->getMessage();
1009 1009
                 }
1010 1010
 
@@ -1021,8 +1021,8 @@  discard block
 block discarded – undo
1021 1021
 					$query_search = 'SELECT icaotypecode FROM aircraft_modes WHERE registration = :registration AND Source <> :source LIMIT 1';
1022 1022
 					try {
1023 1023
 						$sths = $Connection->db->prepare($query_search);
1024
-						$sths->execute(array(':registration' => 'N'.$data[0],':source' => 'website_faa'));
1025
-					} catch(PDOException $e) {
1024
+						$sths->execute(array(':registration' => 'N'.$data[0], ':source' => 'website_faa'));
1025
+					} catch (PDOException $e) {
1026 1026
 						return "error s : ".$e->getMessage();
1027 1027
 					}
1028 1028
 					$result_search = $sths->fetchAll(PDO::FETCH_ASSOC);
@@ -1035,8 +1035,8 @@  discard block
 block discarded – undo
1035 1035
 							//}
1036 1036
 						try {
1037 1037
 							$sthi = $Connection->db->prepare($queryi);
1038
-							$sthi->execute(array(':mfr' => $data[2],':icao' => $result_search[0]['icaotypecode']));
1039
-						} catch(PDOException $e) {
1038
+							$sthi->execute(array(':mfr' => $data[2], ':icao' => $result_search[0]['icaotypecode']));
1039
+						} catch (PDOException $e) {
1040 1040
 							return "error u : ".$e->getMessage();
1041 1041
 						}
1042 1042
 					} else {
@@ -1044,7 +1044,7 @@  discard block
 block discarded – undo
1044 1044
 						try {
1045 1045
 							$sthsm = $Connection->db->prepare($query_search_mfr);
1046 1046
 							$sthsm->execute(array(':mfr' => $data[2]));
1047
-						} catch(PDOException $e) {
1047
+						} catch (PDOException $e) {
1048 1048
 							return "error mfr : ".$e->getMessage();
1049 1049
 						}
1050 1050
 						$result_search_mfr = $sthsm->fetchAll(PDO::FETCH_ASSOC);
@@ -1054,8 +1054,8 @@  discard block
 block discarded – undo
1054 1054
 							$queryf = 'INSERT INTO aircraft_modes (FirstCreated,LastModified,ModeS,ModeSCountry,Registration,ICAOTypeCode,Source) VALUES (:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:source)';
1055 1055
 							try {
1056 1056
 								$sthf = $Connection->db->prepare($queryf);
1057
-								$sthf->execute(array(':FirstCreated' => $data[16],':LastModified' => $data[15],':ModeS' => $data[33],':ModeSCountry' => $data[14], ':Registration' => 'N'.$data[0],':ICAOTypeCode' => $result_search_mfr[0]['icao'],':source' => 'website_faa'));
1058
-							} catch(PDOException $e) {
1057
+								$sthf->execute(array(':FirstCreated' => $data[16], ':LastModified' => $data[15], ':ModeS' => $data[33], ':ModeSCountry' => $data[14], ':Registration' => 'N'.$data[0], ':ICAOTypeCode' => $result_search_mfr[0]['icao'], ':source' => 'website_faa'));
1058
+							} catch (PDOException $e) {
1059 1059
 								return "error f : ".$e->getMessage();
1060 1060
 							}
1061 1061
 						}
@@ -1065,13 +1065,13 @@  discard block
 block discarded – undo
1065 1065
 						$query = 'INSERT INTO aircraft_owner (registration,base,owner,date_first_reg,Source) VALUES (:registration,:base,:owner,:date_first_reg,:source)';
1066 1066
 						try {
1067 1067
 							$sth = $Connection->db->prepare($query);
1068
-							$sth->execute(array(':registration' => 'N'.$data[0],':base' => $data[9],':owner' => ucwords(strtolower($data[6])),':date_first_reg' => date('Y-m-d',strtotime($data[23])), ':source' => 'website_faa'));
1069
-						} catch(PDOException $e) {
1068
+							$sth->execute(array(':registration' => 'N'.$data[0], ':base' => $data[9], ':owner' => ucwords(strtolower($data[6])), ':date_first_reg' => date('Y-m-d', strtotime($data[23])), ':source' => 'website_faa'));
1069
+						} catch (PDOException $e) {
1070 1070
 							return "error i : ".$e->getMessage();
1071 1071
 						}
1072 1072
 					}
1073 1073
 				}
1074
-				if ($i % 90 == 0) {
1074
+				if ($i%90 == 0) {
1075 1075
 					if ($globalTransaction) $Connection->db->commit();
1076 1076
 					if ($globalTransaction) $Connection->db->beginTransaction();
1077 1077
 				}
@@ -1090,7 +1090,7 @@  discard block
 block discarded – undo
1090 1090
 			$Connection = new Connection();
1091 1091
 			$sth = $Connection->db->prepare($query);
1092 1092
                         $sth->execute(array(':source' => 'website_fam'));
1093
-                } catch(PDOException $e) {
1093
+                } catch (PDOException $e) {
1094 1094
                         return "error : ".$e->getMessage();
1095 1095
                 }
1096 1096
 
@@ -1111,8 +1111,8 @@  discard block
 block discarded – undo
1111 1111
 					$query = 'INSERT INTO aircraft_modes (FirstCreated,LastModified,ModeS,ModeSCountry,Registration,ICAOTypeCode,type_flight,Source) VALUES (:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:type_flight,:source)';
1112 1112
 					try {
1113 1113
 						$sth = $Connection->db->prepare($query);
1114
-						$sth->execute(array(':FirstCreated' => $data[0],':LastModified' => $data[1],':ModeS' => $data[2],':ModeSCountry' => $data[3], ':Registration' => $data[4],':ICAOTypeCode' => $data[5],':type_flight' => $data[6],':source' => 'website_fam'));
1115
-					} catch(PDOException $e) {
1114
+						$sth->execute(array(':FirstCreated' => $data[0], ':LastModified' => $data[1], ':ModeS' => $data[2], ':ModeSCountry' => $data[3], ':Registration' => $data[4], ':ICAOTypeCode' => $data[5], ':type_flight' => $data[6], ':source' => 'website_fam'));
1115
+					} catch (PDOException $e) {
1116 1116
 						return "error : ".$e->getMessage();
1117 1117
 					}
1118 1118
 				}
@@ -1131,7 +1131,7 @@  discard block
 block discarded – undo
1131 1131
 			$Connection = new Connection();
1132 1132
 			$sth = $Connection->db->prepare($query);
1133 1133
                         $sth->execute(array(':source' => 'website_fam'));
1134
-                } catch(PDOException $e) {
1134
+                } catch (PDOException $e) {
1135 1135
                         return "error : ".$e->getMessage();
1136 1136
                 }
1137 1137
 
@@ -1147,8 +1147,8 @@  discard block
 block discarded – undo
1147 1147
 					$query = 'INSERT INTO aircraft_owner (registration,base,owner,date_first_reg,Source) VALUES (:registration,:base,:owner,NULL,:source)';
1148 1148
 					try {
1149 1149
 						$sth = $Connection->db->prepare($query);
1150
-						$sth->execute(array(':registration' => $data[0],':base' => $data[1],':owner' => $data[2], ':source' => 'website_fam'));
1151
-					} catch(PDOException $e) {
1150
+						$sth->execute(array(':registration' => $data[0], ':base' => $data[1], ':owner' => $data[2], ':source' => 'website_fam'));
1151
+					} catch (PDOException $e) {
1152 1152
 						print_r($data);
1153 1153
 						return "error : ".$e->getMessage();
1154 1154
 					}
@@ -1168,7 +1168,7 @@  discard block
 block discarded – undo
1168 1168
 			$Connection = new Connection();
1169 1169
 			$sth = $Connection->db->prepare($query);
1170 1170
                         $sth->execute(array(':source' => 'website_fam'));
1171
-                } catch(PDOException $e) {
1171
+                } catch (PDOException $e) {
1172 1172
                         return "error : ".$e->getMessage();
1173 1173
                 }
1174 1174
 
@@ -1188,8 +1188,8 @@  discard block
 block discarded – undo
1188 1188
 					$query = 'INSERT INTO routes (CallSign,Operator_ICAO,FromAirport_ICAO,FromAirport_Time,ToAirport_ICAO,ToAirport_Time,RouteStop,Source) VALUES (:CallSign,:Operator_ICAO,:FromAirport_ICAO,:FromAirport_Time,:ToAirport_ICAO,:ToAirport_Time,:RouteStop,:source)';
1189 1189
 					try {
1190 1190
 						$sth = $Connection->db->prepare($query);
1191
-						$sth->execute(array(':CallSign' => $data[0],':Operator_ICAO' => $data[1],':FromAirport_ICAO' => $data[2],':FromAirport_Time' => $data[3], ':ToAirport_ICAO' => $data[4],':ToAirport_Time' => $data[5],':RouteStop' => $data[6],':source' => 'website_fam'));
1192
-					} catch(PDOException $e) {
1191
+						$sth->execute(array(':CallSign' => $data[0], ':Operator_ICAO' => $data[1], ':FromAirport_ICAO' => $data[2], ':FromAirport_Time' => $data[3], ':ToAirport_ICAO' => $data[4], ':ToAirport_Time' => $data[5], ':RouteStop' => $data[6], ':source' => 'website_fam'));
1192
+					} catch (PDOException $e) {
1193 1193
 						return "error : ".$e->getMessage();
1194 1194
 					}
1195 1195
 				}
@@ -1208,7 +1208,7 @@  discard block
 block discarded – undo
1208 1208
 			$Connection = new Connection();
1209 1209
 			$sth = $Connection->db->prepare($query);
1210 1210
 			$sth->execute();
1211
-		} catch(PDOException $e) {
1211
+		} catch (PDOException $e) {
1212 1212
 			return "error : ".$e->getMessage();
1213 1213
 		}
1214 1214
 
@@ -1224,7 +1224,7 @@  discard block
 block discarded – undo
1224 1224
 					try {
1225 1225
 						$sth = $Connection->db->prepare($query);
1226 1226
 						$sth->execute(array(':icao' => $icao));
1227
-					} catch(PDOException $e) {
1227
+					} catch (PDOException $e) {
1228 1228
 						return "error : ".$e->getMessage();
1229 1229
 					}
1230 1230
 				}
@@ -1235,7 +1235,7 @@  discard block
 block discarded – undo
1235 1235
 		return '';
1236 1236
         }
1237 1237
 
1238
-	public static function tle($filename,$tletype) {
1238
+	public static function tle($filename, $tletype) {
1239 1239
 		require_once(dirname(__FILE__).'/../require/class.Spotter.php');
1240 1240
 		global $tmp_dir, $globalTransaction;
1241 1241
 		//$Spotter = new Spotter();
@@ -1245,7 +1245,7 @@  discard block
 block discarded – undo
1245 1245
 			$Connection = new Connection();
1246 1246
 			$sth = $Connection->db->prepare($query);
1247 1247
                         $sth->execute(array(':source' => $filename));
1248
-                } catch(PDOException $e) {
1248
+                } catch (PDOException $e) {
1249 1249
                         return "error : ".$e->getMessage();
1250 1250
                 }
1251 1251
 		
@@ -1270,8 +1270,8 @@  discard block
 block discarded – undo
1270 1270
 					$query = 'INSERT INTO tle (tle_name,tle_tle1,tle_tle2,tle_type,tle_source) VALUES (:name, :tle1, :tle2, :type, :source)';
1271 1271
 					try {
1272 1272
 						$sth = $Connection->db->prepare($query);
1273
-						$sth->execute(array(':name' => $dbdata['name'],':tle1' => $dbdata['tle1'],':tle2' => $dbdata['tle2'], ':type' => $tletype,':source' => $filename));
1274
-					} catch(PDOException $e) {
1273
+						$sth->execute(array(':name' => $dbdata['name'], ':tle1' => $dbdata['tle1'], ':tle2' => $dbdata['tle2'], ':type' => $tletype, ':source' => $filename));
1274
+					} catch (PDOException $e) {
1275 1275
 						return "error : ".$e->getMessage();
1276 1276
 					}
1277 1277
 
@@ -1291,28 +1291,28 @@  discard block
 block discarded – undo
1291 1291
         */
1292 1292
         private static function table2array($data) {
1293 1293
                 $html = str_get_html($data);
1294
-                $tabledata=array();
1295
-                foreach($html->find('tr') as $element)
1294
+                $tabledata = array();
1295
+                foreach ($html->find('tr') as $element)
1296 1296
                 {
1297 1297
                         $td = array();
1298
-                        foreach( $element->find('th') as $row)
1298
+                        foreach ($element->find('th') as $row)
1299 1299
                         {
1300 1300
                                 $td [] = trim($row->plaintext);
1301 1301
                         }
1302
-                        $td=array_filter($td);
1302
+                        $td = array_filter($td);
1303 1303
                         $tabledata[] = $td;
1304 1304
 
1305 1305
                         $td = array();
1306 1306
                         $tdi = array();
1307
-                        foreach( $element->find('td') as $row)
1307
+                        foreach ($element->find('td') as $row)
1308 1308
                         {
1309 1309
                                 $td [] = trim($row->plaintext);
1310 1310
                                 $tdi [] = trim($row->innertext);
1311 1311
                         }
1312
-                        $td=array_filter($td);
1313
-                        $tdi=array_filter($tdi);
1312
+                        $td = array_filter($td);
1313
+                        $tdi = array_filter($tdi);
1314 1314
                     //    $tabledata[]=array_merge($td,$tdi);
1315
-                        $tabledata[]=$td;
1315
+                        $tabledata[] = $td;
1316 1316
                 }
1317 1317
                 return(array_filter($tabledata));
1318 1318
         }
@@ -1385,13 +1385,13 @@  discard block
 block discarded – undo
1385 1385
 			while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE)
1386 1386
 			{
1387 1387
 				$i++;
1388
-				if($i > 3 && count($row) > 2) {
1388
+				if ($i > 3 && count($row) > 2) {
1389 1389
 					$data = array_values(array_filter($row));
1390 1390
 					$cntdata = count($data);
1391 1391
 					if ($cntdata > 10) {
1392 1392
 						$value = $data[9];
1393 1393
 						
1394
-						for ($i =10;$i < $cntdata;$i++) {
1394
+						for ($i = 10; $i < $cntdata; $i++) {
1395 1395
 							$value .= ' '.$data[$i];
1396 1396
 						}
1397 1397
 						$data[9] = $value;
@@ -1401,8 +1401,8 @@  discard block
 block discarded – undo
1401 1401
 						$query = 'INSERT INTO waypoints (name_begin,latitude_begin,longitude_begin,name_end,latitude_end,longitude_end,high,base,top,segment_name) VALUES (:name_begin, :latitude_begin, :longitude_begin, :name_end, :latitude_end, :longitude_end, :high, :base, :top, :segment_name)';
1402 1402
 						try {
1403 1403
 							$sth = $Connection->db->prepare($query);
1404
-							$sth->execute(array(':name_begin' => $data[0],':latitude_begin' => $data[1],':longitude_begin' => $data[2],':name_end' => $data[3], ':latitude_end' => $data[4], ':longitude_end' => $data[5], ':high' => $data[6], ':base' => $data[7], ':top' => $data[8], ':segment_name' => $data[9]));
1405
-						} catch(PDOException $e) {
1404
+							$sth->execute(array(':name_begin' => $data[0], ':latitude_begin' => $data[1], ':longitude_begin' => $data[2], ':name_end' => $data[3], ':latitude_end' => $data[4], ':longitude_end' => $data[5], ':high' => $data[6], ':base' => $data[7], ':top' => $data[8], ':segment_name' => $data[9]));
1405
+						} catch (PDOException $e) {
1406 1406
 							return "error : ".$e->getMessage();
1407 1407
 						}
1408 1408
 					}
@@ -1423,7 +1423,7 @@  discard block
 block discarded – undo
1423 1423
 			$Connection = new Connection();
1424 1424
 			$sth = $Connection->db->prepare($query);
1425 1425
                         $sth->execute();
1426
-                } catch(PDOException $e) {
1426
+                } catch (PDOException $e) {
1427 1427
                         return "error : ".$e->getMessage();
1428 1428
                 }
1429 1429
 
@@ -1435,12 +1435,12 @@  discard block
 block discarded – undo
1435 1435
 			if ($globalTransaction) $Connection->db->beginTransaction();
1436 1436
 			while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE)
1437 1437
 			{
1438
-				if(count($row) > 1) {
1438
+				if (count($row) > 1) {
1439 1439
 					$query = "INSERT INTO airlines (name,icao,active,forsource) VALUES (:name, :icao, 'Y','ivao')";
1440 1440
 					try {
1441 1441
 						$sth = $Connection->db->prepare($query);
1442
-						$sth->execute(array(':name' => $row[1],':icao' => $row[0]));
1443
-					} catch(PDOException $e) {
1442
+						$sth->execute(array(':name' => $row[1], ':icao' => $row[0]));
1443
+					} catch (PDOException $e) {
1444 1444
 						return "error : ".$e->getMessage();
1445 1445
 					}
1446 1446
 				}
@@ -1460,21 +1460,21 @@  discard block
 block discarded – undo
1460 1460
 			try {
1461 1461
 				$sth = $Connection->db->prepare($query);
1462 1462
                     		$sth->execute();
1463
-	                } catch(PDOException $e) {
1463
+	                } catch (PDOException $e) {
1464 1464
 				return "error : ".$e->getMessage();
1465 1465
 	                }
1466 1466
 	        }
1467 1467
 
1468 1468
 
1469
-		if ($globalDBdriver == 'mysql') update_db::gunzip('../db/airspace.sql.gz',$tmp_dir.'airspace.sql');
1469
+		if ($globalDBdriver == 'mysql') update_db::gunzip('../db/airspace.sql.gz', $tmp_dir.'airspace.sql');
1470 1470
 		else {
1471
-			update_db::gunzip('../db/pgsql/airspace.sql.gz',$tmp_dir.'airspace.sql');
1471
+			update_db::gunzip('../db/pgsql/airspace.sql.gz', $tmp_dir.'airspace.sql');
1472 1472
 			$query = "CREATE EXTENSION postgis";
1473
-			$Connection = new Connection(null,null,$_SESSION['database_root'],$_SESSION['database_rootpass']);
1473
+			$Connection = new Connection(null, null, $_SESSION['database_root'], $_SESSION['database_rootpass']);
1474 1474
 			try {
1475 1475
 				$sth = $Connection->db->prepare($query);
1476 1476
 				$sth->execute();
1477
-			} catch(PDOException $e) {
1477
+			} catch (PDOException $e) {
1478 1478
 				return "error : ".$e->getMessage();
1479 1479
 			}
1480 1480
 		}
@@ -1487,7 +1487,7 @@  discard block
 block discarded – undo
1487 1487
 		include_once('class.create_db.php');
1488 1488
 		require_once(dirname(__FILE__).'/../require/class.NOTAM.php');
1489 1489
 		if ($globalDebug) echo "NOTAM from FlightAirMap website : Download...";
1490
-		update_db::download('http://data.flightairmap.fr/data/notam.txt.gz',$tmp_dir.'notam.txt.gz');
1490
+		update_db::download('http://data.flightairmap.fr/data/notam.txt.gz', $tmp_dir.'notam.txt.gz');
1491 1491
 		$error = '';
1492 1492
 		if (file_exists($tmp_dir.'notam.txt.gz')) {
1493 1493
 			if ($globalDebug) echo "Gunzip...";
@@ -1519,14 +1519,14 @@  discard block
 block discarded – undo
1519 1519
 			try {
1520 1520
 				$sth = $Connection->db->prepare($query);
1521 1521
             	        	$sth->execute();
1522
-	                } catch(PDOException $e) {
1522
+	                } catch (PDOException $e) {
1523 1523
     	                	echo "error : ".$e->getMessage();
1524 1524
 	                }
1525 1525
 		}
1526 1526
 		if ($globalDBdriver == 'mysql') {
1527
-			update_db::gunzip('../db/countries.sql.gz',$tmp_dir.'countries.sql');
1527
+			update_db::gunzip('../db/countries.sql.gz', $tmp_dir.'countries.sql');
1528 1528
 		} else {
1529
-			update_db::gunzip('../db/pgsql/countries.sql.gz',$tmp_dir.'countries.sql');
1529
+			update_db::gunzip('../db/pgsql/countries.sql.gz', $tmp_dir.'countries.sql');
1530 1530
 		}
1531 1531
 		$error = create_db::import_file($tmp_dir.'countries.sql');
1532 1532
 		return $error;
@@ -1539,7 +1539,7 @@  discard block
 block discarded – undo
1539 1539
 //		update_db::unzip($tmp_dir.'AptNav.zip');
1540 1540
 //		update_db::download('https://gitorious.org/fg/fgdata/raw/e81f8a15424a175a7b715f8f7eb8f4147b802a27:Navaids/awy.dat.gz',$tmp_dir.'awy.dat.gz');
1541 1541
 //		update_db::download('http://sourceforge.net/p/flightgear/fgdata/ci/next/tree/Navaids/awy.dat.gz?format=raw',$tmp_dir.'awy.dat.gz','http://sourceforge.net');
1542
-		update_db::download('http://pkgs.fedoraproject.org/repo/extras/FlightGear-Atlas/awy.dat.gz/f530c9d1c4b31a288ba88dcc8224268b/awy.dat.gz',$tmp_dir.'awy.dat.gz','http://sourceforge.net');
1542
+		update_db::download('http://pkgs.fedoraproject.org/repo/extras/FlightGear-Atlas/awy.dat.gz/f530c9d1c4b31a288ba88dcc8224268b/awy.dat.gz', $tmp_dir.'awy.dat.gz', 'http://sourceforge.net');
1543 1543
 		update_db::gunzip($tmp_dir.'awy.dat.gz');
1544 1544
 		$error = update_db::waypoints($tmp_dir.'awy.dat');
1545 1545
 		return $error;
@@ -1559,7 +1559,7 @@  discard block
 block discarded – undo
1559 1559
 			update_db::ivao_airlines($tmp_dir.'data/airlines.dat');
1560 1560
 			if ($globalDebug) echo "Copy airlines logos to airlines images directory...";
1561 1561
 			if (is_writable(dirname(__FILE__).'/../images/airlines')) {
1562
-				if (!$Common->xcopy($tmp_dir.'logos/',dirname(__FILE__).'/../images/airlines/')) $error = "Failed to copy airlines logo.";
1562
+				if (!$Common->xcopy($tmp_dir.'logos/', dirname(__FILE__).'/../images/airlines/')) $error = "Failed to copy airlines logo.";
1563 1563
 			} else $error = "The directory ".dirname(__FILE__).'/../images/airlines'." must be writable";
1564 1564
 		} else $error = "File ".$tmp_dir.'ivao.zip'." doesn't exist. Download failed.";
1565 1565
 		if ($error != '') {
@@ -1572,7 +1572,7 @@  discard block
 block discarded – undo
1572 1572
 		global $tmp_dir, $globalDebug;
1573 1573
 		$error = '';
1574 1574
 		if ($globalDebug) echo "Routes : Download...";
1575
-		update_db::download('http://www.virtualradarserver.co.uk/Files/StandingData.sqb.gz',$tmp_dir.'StandingData.sqb.gz');
1575
+		update_db::download('http://www.virtualradarserver.co.uk/Files/StandingData.sqb.gz', $tmp_dir.'StandingData.sqb.gz');
1576 1576
 		if (file_exists($tmp_dir.'StandingData.sqb.gz')) {
1577 1577
 			if ($globalDebug) echo "Gunzip...";
1578 1578
 			update_db::gunzip($tmp_dir.'StandingData.sqb.gz');
@@ -1588,7 +1588,7 @@  discard block
 block discarded – undo
1588 1588
 		global $tmp_dir, $globalDebug;
1589 1589
 		$error = '';
1590 1590
 		if ($globalDebug) echo "Schedules Oneworld : Download...";
1591
-		update_db::download('http://data.flightairmap.fr/data/schedules/oneworld.csv.gz',$tmp_dir.'oneworld.csv.gz');
1591
+		update_db::download('http://data.flightairmap.fr/data/schedules/oneworld.csv.gz', $tmp_dir.'oneworld.csv.gz');
1592 1592
 		if (file_exists($tmp_dir.'oneworld.csv.gz')) {
1593 1593
 			if ($globalDebug) echo "Gunzip...";
1594 1594
 			update_db::gunzip($tmp_dir.'oneworld.csv.gz');
@@ -1604,7 +1604,7 @@  discard block
 block discarded – undo
1604 1604
 		global $tmp_dir, $globalDebug;
1605 1605
 		$error = '';
1606 1606
 		if ($globalDebug) echo "Schedules Skyteam : Download...";
1607
-		update_db::download('http://data.flightairmap.fr/data/schedules/skyteam.csv.gz',$tmp_dir.'skyteam.csv.gz');
1607
+		update_db::download('http://data.flightairmap.fr/data/schedules/skyteam.csv.gz', $tmp_dir.'skyteam.csv.gz');
1608 1608
 		if (file_exists($tmp_dir.'skyteam.csv.gz')) {
1609 1609
 			if ($globalDebug) echo "Gunzip...";
1610 1610
 			update_db::gunzip($tmp_dir.'skyteam.csv.gz');
@@ -1632,7 +1632,7 @@  discard block
 block discarded – undo
1632 1632
 */
1633 1633
 		if ($globalDebug) echo "Modes : Download...";
1634 1634
 //		update_db::download('http://planebase.biz/sqb.php?f=basestationall.zip',$tmp_dir.'basestation_latest.zip','http://planebase.biz/bstnsqb');
1635
-		update_db::download('http://data.flightairmap.fr/data/BaseStation.sqb.gz',$tmp_dir.'BaseStation.sqb.gz');
1635
+		update_db::download('http://data.flightairmap.fr/data/BaseStation.sqb.gz', $tmp_dir.'BaseStation.sqb.gz');
1636 1636
 
1637 1637
 //		if (file_exists($tmp_dir.'basestation_latest.zip')) {
1638 1638
 		if (file_exists($tmp_dir.'BaseStation.sqb.gz')) {
@@ -1652,7 +1652,7 @@  discard block
 block discarded – undo
1652 1652
 	public static function update_ModeS_faa() {
1653 1653
 		global $tmp_dir, $globalDebug;
1654 1654
 		if ($globalDebug) echo "Modes FAA: Download...";
1655
-		update_db::download('http://registry.faa.gov/database/ReleasableAircraft.zip',$tmp_dir.'ReleasableAircraft.zip');
1655
+		update_db::download('http://registry.faa.gov/database/ReleasableAircraft.zip', $tmp_dir.'ReleasableAircraft.zip');
1656 1656
 		if (file_exists($tmp_dir.'ReleasableAircraft.zip')) {
1657 1657
 			if ($globalDebug) echo "Unzip...";
1658 1658
 			update_db::unzip($tmp_dir.'ReleasableAircraft.zip');
@@ -1668,7 +1668,7 @@  discard block
 block discarded – undo
1668 1668
 	public static function update_ModeS_flarm() {
1669 1669
 		global $tmp_dir, $globalDebug;
1670 1670
 		if ($globalDebug) echo "Modes Flarmnet: Download...";
1671
-		update_db::download('http://flarmnet.org/files/data.fln',$tmp_dir.'data.fln');
1671
+		update_db::download('http://flarmnet.org/files/data.fln', $tmp_dir.'data.fln');
1672 1672
 		if (file_exists($tmp_dir.'data.fln')) {
1673 1673
 			if ($globalDebug) echo "Add to DB...";
1674 1674
 			$error = update_db::retrieve_modes_flarmnet($tmp_dir.'data.fln');
@@ -1682,7 +1682,7 @@  discard block
 block discarded – undo
1682 1682
 	public static function update_ModeS_ogn() {
1683 1683
 		global $tmp_dir, $globalDebug;
1684 1684
 		if ($globalDebug) echo "Modes OGN: Download...";
1685
-		update_db::download('http://ddb.glidernet.org/download/',$tmp_dir.'ogn.csv');
1685
+		update_db::download('http://ddb.glidernet.org/download/', $tmp_dir.'ogn.csv');
1686 1686
 		if (file_exists($tmp_dir.'ogn.csv')) {
1687 1687
 			if ($globalDebug) echo "Add to DB...";
1688 1688
 			$error = update_db::retrieve_modes_ogn($tmp_dir.'ogn.csv');
@@ -1697,201 +1697,201 @@  discard block
 block discarded – undo
1697 1697
 		global $tmp_dir, $globalDebug, $globalMasterSource;
1698 1698
 		
1699 1699
 		if ($globalDebug) echo "Owner France: Download...";
1700
-		update_db::download('http://antonakis.co.uk/registers/France.txt',$tmp_dir.'owner_f.csv');
1700
+		update_db::download('http://antonakis.co.uk/registers/France.txt', $tmp_dir.'owner_f.csv');
1701 1701
 		if (file_exists($tmp_dir.'owner_f.csv')) {
1702 1702
 			if ($globalDebug) echo "Add to DB...";
1703
-			$error = update_db::retrieve_owner($tmp_dir.'owner_f.csv','F');
1703
+			$error = update_db::retrieve_owner($tmp_dir.'owner_f.csv', 'F');
1704 1704
 		} else $error = "File ".$tmp_dir.'owner_f.csv'." doesn't exist. Download failed.";
1705 1705
 		if ($error != '') {
1706 1706
 			return $error;
1707 1707
 		} elseif ($globalDebug) echo "Done\n";
1708 1708
 		
1709 1709
 		if ($globalDebug) echo "Owner Ireland: Download...";
1710
-		update_db::download('http://antonakis.co.uk/registers/Ireland.txt',$tmp_dir.'owner_ei.csv');
1710
+		update_db::download('http://antonakis.co.uk/registers/Ireland.txt', $tmp_dir.'owner_ei.csv');
1711 1711
 		if (file_exists($tmp_dir.'owner_ei.csv')) {
1712 1712
 			if ($globalDebug) echo "Add to DB...";
1713
-			$error = update_db::retrieve_owner($tmp_dir.'owner_ei.csv','EI');
1713
+			$error = update_db::retrieve_owner($tmp_dir.'owner_ei.csv', 'EI');
1714 1714
 		} else $error = "File ".$tmp_dir.'owner_ei.csv'." doesn't exist. Download failed.";
1715 1715
 		if ($error != '') {
1716 1716
 			return $error;
1717 1717
 		} elseif ($globalDebug) echo "Done\n";
1718 1718
 		if ($globalDebug) echo "Owner Switzerland: Download...";
1719
-		update_db::download('http://antonakis.co.uk/registers/Switzerland.txt',$tmp_dir.'owner_hb.csv');
1719
+		update_db::download('http://antonakis.co.uk/registers/Switzerland.txt', $tmp_dir.'owner_hb.csv');
1720 1720
 		if (file_exists($tmp_dir.'owner_hb.csv')) {
1721 1721
 			if ($globalDebug) echo "Add to DB...";
1722
-			$error = update_db::retrieve_owner($tmp_dir.'owner_hb.csv','HB');
1722
+			$error = update_db::retrieve_owner($tmp_dir.'owner_hb.csv', 'HB');
1723 1723
 		} else $error = "File ".$tmp_dir.'owner_hb.csv'." doesn't exist. Download failed.";
1724 1724
 		if ($error != '') {
1725 1725
 			return $error;
1726 1726
 		} elseif ($globalDebug) echo "Done\n";
1727 1727
 		if ($globalDebug) echo "Owner Czech Republic: Download...";
1728
-		update_db::download('http://antonakis.co.uk/registers/CzechRepublic.txt',$tmp_dir.'owner_ok.csv');
1728
+		update_db::download('http://antonakis.co.uk/registers/CzechRepublic.txt', $tmp_dir.'owner_ok.csv');
1729 1729
 		if (file_exists($tmp_dir.'owner_ok.csv')) {
1730 1730
 			if ($globalDebug) echo "Add to DB...";
1731
-			$error = update_db::retrieve_owner($tmp_dir.'owner_ok.csv','OK');
1731
+			$error = update_db::retrieve_owner($tmp_dir.'owner_ok.csv', 'OK');
1732 1732
 		} else $error = "File ".$tmp_dir.'owner_ok.csv'." doesn't exist. Download failed.";
1733 1733
 		if ($error != '') {
1734 1734
 			return $error;
1735 1735
 		} elseif ($globalDebug) echo "Done\n";
1736 1736
 		if ($globalDebug) echo "Owner Australia: Download...";
1737
-		update_db::download('http://antonakis.co.uk/registers/Australia.txt',$tmp_dir.'owner_vh.csv');
1737
+		update_db::download('http://antonakis.co.uk/registers/Australia.txt', $tmp_dir.'owner_vh.csv');
1738 1738
 		if (file_exists($tmp_dir.'owner_vh.csv')) {
1739 1739
 			if ($globalDebug) echo "Add to DB...";
1740
-			$error = update_db::retrieve_owner($tmp_dir.'owner_vh.csv','VH');
1740
+			$error = update_db::retrieve_owner($tmp_dir.'owner_vh.csv', 'VH');
1741 1741
 		} else $error = "File ".$tmp_dir.'owner_vh.csv'." doesn't exist. Download failed.";
1742 1742
 		if ($error != '') {
1743 1743
 			return $error;
1744 1744
 		} elseif ($globalDebug) echo "Done\n";
1745 1745
 		if ($globalDebug) echo "Owner Austria: Download...";
1746
-		update_db::download('http://antonakis.co.uk/registers/Austria.txt',$tmp_dir.'owner_oe.csv');
1746
+		update_db::download('http://antonakis.co.uk/registers/Austria.txt', $tmp_dir.'owner_oe.csv');
1747 1747
 		if (file_exists($tmp_dir.'owner_oe.csv')) {
1748 1748
 			if ($globalDebug) echo "Add to DB...";
1749
-			$error = update_db::retrieve_owner($tmp_dir.'owner_oe.csv','OE');
1749
+			$error = update_db::retrieve_owner($tmp_dir.'owner_oe.csv', 'OE');
1750 1750
 		} else $error = "File ".$tmp_dir.'owner_oe.csv'." doesn't exist. Download failed.";
1751 1751
 		if ($error != '') {
1752 1752
 			return $error;
1753 1753
 		} elseif ($globalDebug) echo "Done\n";
1754 1754
 		if ($globalDebug) echo "Owner Chile: Download...";
1755
-		update_db::download('http://antonakis.co.uk/registers/Chile.txt',$tmp_dir.'owner_cc.csv');
1755
+		update_db::download('http://antonakis.co.uk/registers/Chile.txt', $tmp_dir.'owner_cc.csv');
1756 1756
 		if (file_exists($tmp_dir.'owner_cc.csv')) {
1757 1757
 			if ($globalDebug) echo "Add to DB...";
1758
-			$error = update_db::retrieve_owner($tmp_dir.'owner_cc.csv','CC');
1758
+			$error = update_db::retrieve_owner($tmp_dir.'owner_cc.csv', 'CC');
1759 1759
 		} else $error = "File ".$tmp_dir.'owner_cc.csv'." doesn't exist. Download failed.";
1760 1760
 		if ($error != '') {
1761 1761
 			return $error;
1762 1762
 		} elseif ($globalDebug) echo "Done\n";
1763 1763
 		if ($globalDebug) echo "Owner Colombia: Download...";
1764
-		update_db::download('http://antonakis.co.uk/registers/Colombia.txt',$tmp_dir.'owner_hj.csv');
1764
+		update_db::download('http://antonakis.co.uk/registers/Colombia.txt', $tmp_dir.'owner_hj.csv');
1765 1765
 		if (file_exists($tmp_dir.'owner_hj.csv')) {
1766 1766
 			if ($globalDebug) echo "Add to DB...";
1767
-			$error = update_db::retrieve_owner($tmp_dir.'owner_hj.csv','HJ');
1767
+			$error = update_db::retrieve_owner($tmp_dir.'owner_hj.csv', 'HJ');
1768 1768
 		} else $error = "File ".$tmp_dir.'owner_hj.csv'." doesn't exist. Download failed.";
1769 1769
 		if ($error != '') {
1770 1770
 			return $error;
1771 1771
 		} elseif ($globalDebug) echo "Done\n";
1772 1772
 		if ($globalDebug) echo "Owner Bosnia Herzegobina: Download...";
1773
-		update_db::download('http://antonakis.co.uk/registers/BosniaHerzegovina.txt',$tmp_dir.'owner_e7.csv');
1773
+		update_db::download('http://antonakis.co.uk/registers/BosniaHerzegovina.txt', $tmp_dir.'owner_e7.csv');
1774 1774
 		if (file_exists($tmp_dir.'owner_e7.csv')) {
1775 1775
 			if ($globalDebug) echo "Add to DB...";
1776
-			$error = update_db::retrieve_owner($tmp_dir.'owner_e7.csv','E7');
1776
+			$error = update_db::retrieve_owner($tmp_dir.'owner_e7.csv', 'E7');
1777 1777
 		} else $error = "File ".$tmp_dir.'owner_e7.csv'." doesn't exist. Download failed.";
1778 1778
 		if ($error != '') {
1779 1779
 			return $error;
1780 1780
 		} elseif ($globalDebug) echo "Done\n";
1781 1781
 		if ($globalDebug) echo "Owner Brazil: Download...";
1782
-		update_db::download('http://antonakis.co.uk/registers/Brazil.txt',$tmp_dir.'owner_pp.csv');
1782
+		update_db::download('http://antonakis.co.uk/registers/Brazil.txt', $tmp_dir.'owner_pp.csv');
1783 1783
 		if (file_exists($tmp_dir.'owner_pp.csv')) {
1784 1784
 			if ($globalDebug) echo "Add to DB...";
1785
-			$error = update_db::retrieve_owner($tmp_dir.'owner_pp.csv','PP');
1785
+			$error = update_db::retrieve_owner($tmp_dir.'owner_pp.csv', 'PP');
1786 1786
 		} else $error = "File ".$tmp_dir.'owner_pp.csv'." doesn't exist. Download failed.";
1787 1787
 		if ($error != '') {
1788 1788
 			return $error;
1789 1789
 		} elseif ($globalDebug) echo "Done\n";
1790 1790
 		if ($globalDebug) echo "Owner Cayman Islands: Download...";
1791
-		update_db::download('http://antonakis.co.uk/registers/CaymanIslands.txt',$tmp_dir.'owner_vp.csv');
1791
+		update_db::download('http://antonakis.co.uk/registers/CaymanIslands.txt', $tmp_dir.'owner_vp.csv');
1792 1792
 		if (file_exists($tmp_dir.'owner_vp.csv')) {
1793 1793
 			if ($globalDebug) echo "Add to DB...";
1794
-			$error = update_db::retrieve_owner($tmp_dir.'owner_vp.csv','VP');
1794
+			$error = update_db::retrieve_owner($tmp_dir.'owner_vp.csv', 'VP');
1795 1795
 		} else $error = "File ".$tmp_dir.'owner_vp.csv'." doesn't exist. Download failed.";
1796 1796
 		if ($error != '') {
1797 1797
 			return $error;
1798 1798
 		} elseif ($globalDebug) echo "Done\n";
1799 1799
 		if ($globalDebug) echo "Owner Croatia: Download...";
1800
-		update_db::download('http://antonakis.co.uk/registers/Croatia.txt',$tmp_dir.'owner_9a.csv');
1800
+		update_db::download('http://antonakis.co.uk/registers/Croatia.txt', $tmp_dir.'owner_9a.csv');
1801 1801
 		if (file_exists($tmp_dir.'owner_9a.csv')) {
1802 1802
 			if ($globalDebug) echo "Add to DB...";
1803
-			$error = update_db::retrieve_owner($tmp_dir.'owner_9a.csv','9A');
1803
+			$error = update_db::retrieve_owner($tmp_dir.'owner_9a.csv', '9A');
1804 1804
 		} else $error = "File ".$tmp_dir.'owner_9a.csv'." doesn't exist. Download failed.";
1805 1805
 		if ($error != '') {
1806 1806
 			return $error;
1807 1807
 		} elseif ($globalDebug) echo "Done\n";
1808 1808
 		if ($globalDebug) echo "Owner Luxembourg: Download...";
1809
-		update_db::download('http://antonakis.co.uk/registers/Luxembourg.txt',$tmp_dir.'owner_lx.csv');
1809
+		update_db::download('http://antonakis.co.uk/registers/Luxembourg.txt', $tmp_dir.'owner_lx.csv');
1810 1810
 		if (file_exists($tmp_dir.'owner_lx.csv')) {
1811 1811
 			if ($globalDebug) echo "Add to DB...";
1812
-			$error = update_db::retrieve_owner($tmp_dir.'owner_lx.csv','LX');
1812
+			$error = update_db::retrieve_owner($tmp_dir.'owner_lx.csv', 'LX');
1813 1813
 		} else $error = "File ".$tmp_dir.'owner_lx.csv'." doesn't exist. Download failed.";
1814 1814
 		if ($error != '') {
1815 1815
 			return $error;
1816 1816
 		} elseif ($globalDebug) echo "Done\n";
1817 1817
 		if ($globalDebug) echo "Owner Maldives: Download...";
1818
-		update_db::download('http://antonakis.co.uk/registers/Maldives.txt',$tmp_dir.'owner_8q.csv');
1818
+		update_db::download('http://antonakis.co.uk/registers/Maldives.txt', $tmp_dir.'owner_8q.csv');
1819 1819
 		if (file_exists($tmp_dir.'owner_8q.csv')) {
1820 1820
 			if ($globalDebug) echo "Add to DB...";
1821
-			$error = update_db::retrieve_owner($tmp_dir.'owner_8q.csv','8Q');
1821
+			$error = update_db::retrieve_owner($tmp_dir.'owner_8q.csv', '8Q');
1822 1822
 		} else $error = "File ".$tmp_dir.'owner_8q.csv'." doesn't exist. Download failed.";
1823 1823
 		if ($error != '') {
1824 1824
 			return $error;
1825 1825
 		} elseif ($globalDebug) echo "Done\n";
1826 1826
 		if ($globalDebug) echo "Owner New Zealand: Download...";
1827
-		update_db::download('http://antonakis.co.uk/registers/NewZealand.txt',$tmp_dir.'owner_zk.csv');
1827
+		update_db::download('http://antonakis.co.uk/registers/NewZealand.txt', $tmp_dir.'owner_zk.csv');
1828 1828
 		if (file_exists($tmp_dir.'owner_zk.csv')) {
1829 1829
 			if ($globalDebug) echo "Add to DB...";
1830
-			$error = update_db::retrieve_owner($tmp_dir.'owner_zk.csv','ZK');
1830
+			$error = update_db::retrieve_owner($tmp_dir.'owner_zk.csv', 'ZK');
1831 1831
 		} else $error = "File ".$tmp_dir.'owner_zk.csv'." doesn't exist. Download failed.";
1832 1832
 		if ($error != '') {
1833 1833
 			return $error;
1834 1834
 		} elseif ($globalDebug) echo "Done\n";
1835 1835
 		if ($globalDebug) echo "Owner Papua New Guinea: Download...";
1836
-		update_db::download('http://antonakis.co.uk/registers/PapuaNewGuinea.txt',$tmp_dir.'owner_p2.csv');
1836
+		update_db::download('http://antonakis.co.uk/registers/PapuaNewGuinea.txt', $tmp_dir.'owner_p2.csv');
1837 1837
 		if (file_exists($tmp_dir.'owner_p2.csv')) {
1838 1838
 			if ($globalDebug) echo "Add to DB...";
1839
-			$error = update_db::retrieve_owner($tmp_dir.'owner_p2.csv','P2');
1839
+			$error = update_db::retrieve_owner($tmp_dir.'owner_p2.csv', 'P2');
1840 1840
 		} else $error = "File ".$tmp_dir.'owner_p2.csv'." doesn't exist. Download failed.";
1841 1841
 		if ($error != '') {
1842 1842
 			return $error;
1843 1843
 		} elseif ($globalDebug) echo "Done\n";
1844 1844
 		if ($globalDebug) echo "Owner Slovakia: Download...";
1845
-		update_db::download('http://antonakis.co.uk/registers/Slovakia.txt',$tmp_dir.'owner_om.csv');
1845
+		update_db::download('http://antonakis.co.uk/registers/Slovakia.txt', $tmp_dir.'owner_om.csv');
1846 1846
 		if (file_exists($tmp_dir.'owner_om.csv')) {
1847 1847
 			if ($globalDebug) echo "Add to DB...";
1848
-			$error = update_db::retrieve_owner($tmp_dir.'owner_om.csv','OM');
1848
+			$error = update_db::retrieve_owner($tmp_dir.'owner_om.csv', 'OM');
1849 1849
 		} else $error = "File ".$tmp_dir.'owner_om.csv'." doesn't exist. Download failed.";
1850 1850
 		if ($error != '') {
1851 1851
 			return $error;
1852 1852
 		} elseif ($globalDebug) echo "Done\n";
1853 1853
 		if ($globalDebug) echo "Owner Ecuador: Download...";
1854
-		update_db::download('http://antonakis.co.uk/registers/Ecuador.txt',$tmp_dir.'owner_hc.csv');
1854
+		update_db::download('http://antonakis.co.uk/registers/Ecuador.txt', $tmp_dir.'owner_hc.csv');
1855 1855
 		if (file_exists($tmp_dir.'owner_hc.csv')) {
1856 1856
 			if ($globalDebug) echo "Add to DB...";
1857
-			$error = update_db::retrieve_owner($tmp_dir.'owner_hc.csv','HC');
1857
+			$error = update_db::retrieve_owner($tmp_dir.'owner_hc.csv', 'HC');
1858 1858
 		} else $error = "File ".$tmp_dir.'owner_hc.csv'." doesn't exist. Download failed.";
1859 1859
 		if ($error != '') {
1860 1860
 			return $error;
1861 1861
 		} elseif ($globalDebug) echo "Done\n";
1862 1862
 		if ($globalDebug) echo "Owner Iceland: Download...";
1863
-		update_db::download('http://antonakis.co.uk/registers/Iceland.txt',$tmp_dir.'owner_tf.csv');
1863
+		update_db::download('http://antonakis.co.uk/registers/Iceland.txt', $tmp_dir.'owner_tf.csv');
1864 1864
 		if (file_exists($tmp_dir.'owner_tf.csv')) {
1865 1865
 			if ($globalDebug) echo "Add to DB...";
1866
-			$error = update_db::retrieve_owner($tmp_dir.'owner_tf.csv','TF');
1866
+			$error = update_db::retrieve_owner($tmp_dir.'owner_tf.csv', 'TF');
1867 1867
 		} else $error = "File ".$tmp_dir.'owner_tf.csv'." doesn't exist. Download failed.";
1868 1868
 		if ($error != '') {
1869 1869
 			return $error;
1870 1870
 		} elseif ($globalDebug) echo "Done\n";
1871 1871
 		if ($globalDebug) echo "Owner Isle of Man: Download...";
1872
-		update_db::download('http://antonakis.co.uk/registers/IsleOfMan.txt',$tmp_dir.'owner_m.csv');
1872
+		update_db::download('http://antonakis.co.uk/registers/IsleOfMan.txt', $tmp_dir.'owner_m.csv');
1873 1873
 		if (file_exists($tmp_dir.'owner_m.csv')) {
1874 1874
 			if ($globalDebug) echo "Add to DB...";
1875
-			$error = update_db::retrieve_owner($tmp_dir.'owner_m.csv','M');
1875
+			$error = update_db::retrieve_owner($tmp_dir.'owner_m.csv', 'M');
1876 1876
 		} else $error = "File ".$tmp_dir.'owner_m.csv'." doesn't exist. Download failed.";
1877 1877
 		if ($error != '') {
1878 1878
 			return $error;
1879 1879
 		} elseif ($globalDebug) echo "Done\n";
1880 1880
 		if ($globalMasterSource) {
1881 1881
 			if ($globalDebug) echo "ModeS Netherlands: Download...";
1882
-			update_db::download('http://antonakis.co.uk/registers/Netherlands.txt',$tmp_dir.'owner_ph.csv');
1882
+			update_db::download('http://antonakis.co.uk/registers/Netherlands.txt', $tmp_dir.'owner_ph.csv');
1883 1883
 			if (file_exists($tmp_dir.'owner_ph.csv')) {
1884 1884
 				if ($globalDebug) echo "Add to DB...";
1885
-				$error = update_db::retrieve_owner($tmp_dir.'owner_ph.csv','PH');
1885
+				$error = update_db::retrieve_owner($tmp_dir.'owner_ph.csv', 'PH');
1886 1886
 			} else $error = "File ".$tmp_dir.'owner_ph.csv'." doesn't exist. Download failed.";
1887 1887
 			if ($error != '') {
1888 1888
 				return $error;
1889 1889
 			} elseif ($globalDebug) echo "Done\n";
1890 1890
 			if ($globalDebug) echo "ModeS Denmark: Download...";
1891
-			update_db::download('http://antonakis.co.uk/registers/Denmark.txt',$tmp_dir.'owner_oy.csv');
1891
+			update_db::download('http://antonakis.co.uk/registers/Denmark.txt', $tmp_dir.'owner_oy.csv');
1892 1892
 			if (file_exists($tmp_dir.'owner_oy.csv')) {
1893 1893
 				if ($globalDebug) echo "Add to DB...";
1894
-				$error = update_db::retrieve_owner($tmp_dir.'owner_oy.csv','OY');
1894
+				$error = update_db::retrieve_owner($tmp_dir.'owner_oy.csv', 'OY');
1895 1895
 			} else $error = "File ".$tmp_dir.'owner_oy.csv'." doesn't exist. Download failed.";
1896 1896
 			if ($error != '') {
1897 1897
 				return $error;
@@ -1904,7 +1904,7 @@  discard block
 block discarded – undo
1904 1904
 		global $tmp_dir, $globalDebug;
1905 1905
 		$error = '';
1906 1906
 		if ($globalDebug) echo "Translation : Download...";
1907
-		update_db::download('http://www.acarsd.org/download/translation.php',$tmp_dir.'translation.zip');
1907
+		update_db::download('http://www.acarsd.org/download/translation.php', $tmp_dir.'translation.zip');
1908 1908
 		if (file_exists($tmp_dir.'translation.zip')) {
1909 1909
 			if ($globalDebug) echo "Unzip...";
1910 1910
 			update_db::unzip($tmp_dir.'translation.zip');
@@ -1920,7 +1920,7 @@  discard block
 block discarded – undo
1920 1920
 	public static function update_translation_fam() {
1921 1921
 		global $tmp_dir, $globalDebug;
1922 1922
 		if ($globalDebug) echo "Translation from FlightAirMap website : Download...";
1923
-		update_db::download('http://data.flightairmap.fr/data/translation.tsv.gz',$tmp_dir.'translation.tsv.gz');
1923
+		update_db::download('http://data.flightairmap.fr/data/translation.tsv.gz', $tmp_dir.'translation.tsv.gz');
1924 1924
 		if (file_exists($tmp_dir.'translation.tsv.gz')) {
1925 1925
 			if ($globalDebug) echo "Gunzip...";
1926 1926
 			update_db::gunzip($tmp_dir.'translation.tsv.gz');
@@ -1935,7 +1935,7 @@  discard block
 block discarded – undo
1935 1935
 	public static function update_ModeS_fam() {
1936 1936
 		global $tmp_dir, $globalDebug;
1937 1937
 		if ($globalDebug) echo "ModeS from FlightAirMap website : Download...";
1938
-		update_db::download('http://data.flightairmap.fr/data/modes.tsv.gz',$tmp_dir.'modes.tsv.gz');
1938
+		update_db::download('http://data.flightairmap.fr/data/modes.tsv.gz', $tmp_dir.'modes.tsv.gz');
1939 1939
 		if (file_exists($tmp_dir.'modes.tsv.gz')) {
1940 1940
 			if ($globalDebug) echo "Gunzip...";
1941 1941
 			update_db::gunzip($tmp_dir.'modes.tsv.gz');
@@ -1951,9 +1951,9 @@  discard block
 block discarded – undo
1951 1951
 		global $tmp_dir, $globalDebug, $globalOwner;
1952 1952
 		if ($globalDebug) echo "owner from FlightAirMap website : Download...";
1953 1953
 		if ($globalOwner === TRUE) {
1954
-			update_db::download('http://data.flightairmap.fr/data/owners_all.tsv.gz',$tmp_dir.'owners.tsv.gz');
1954
+			update_db::download('http://data.flightairmap.fr/data/owners_all.tsv.gz', $tmp_dir.'owners.tsv.gz');
1955 1955
 		} else {
1956
-			update_db::download('http://data.flightairmap.fr/data/owners.tsv.gz',$tmp_dir.'owners.tsv.gz');
1956
+			update_db::download('http://data.flightairmap.fr/data/owners.tsv.gz', $tmp_dir.'owners.tsv.gz');
1957 1957
 		}
1958 1958
 		if (file_exists($tmp_dir.'owners.tsv.gz')) {
1959 1959
 			if ($globalDebug) echo "Gunzip...";
@@ -1969,7 +1969,7 @@  discard block
 block discarded – undo
1969 1969
 	public static function update_routes_fam() {
1970 1970
 		global $tmp_dir, $globalDebug;
1971 1971
 		if ($globalDebug) echo "Routes from FlightAirMap website : Download...";
1972
-		update_db::download('http://data.flightairmap.fr/data/routes.tsv.gz',$tmp_dir.'routes.tsv.gz');
1972
+		update_db::download('http://data.flightairmap.fr/data/routes.tsv.gz', $tmp_dir.'routes.tsv.gz');
1973 1973
 		if (file_exists($tmp_dir.'routes.tsv.gz')) {
1974 1974
 			if ($globalDebug) echo "Gunzip...";
1975 1975
 			update_db::gunzip($tmp_dir.'routes.tsv.gz');
@@ -1984,7 +1984,7 @@  discard block
 block discarded – undo
1984 1984
 	public static function update_banned_fam() {
1985 1985
 		global $tmp_dir, $globalDebug;
1986 1986
 		if ($globalDebug) echo "Banned airlines in Europe from FlightAirMap website : Download...";
1987
-		update_db::download('http://data.flightairmap.fr/data/ban_eu.csv',$tmp_dir.'ban_eu.csv');
1987
+		update_db::download('http://data.flightairmap.fr/data/ban_eu.csv', $tmp_dir.'ban_eu.csv');
1988 1988
 		if (file_exists($tmp_dir.'ban_eu.csv')) {
1989 1989
 			//if ($globalDebug) echo "Gunzip...";
1990 1990
 			//update_db::gunzip($tmp_dir.'ban_ue.csv');
@@ -2003,18 +2003,18 @@  discard block
 block discarded – undo
2003 2003
 		$error = '';
2004 2004
 		if ($globalDebug) echo "Airspace from FlightAirMap website : Download...";
2005 2005
 		if ($globalDBdriver == 'mysql') {
2006
-			update_db::download('http://data.flightairmap.fr/data/airspace_mysql.sql.gz.md5',$tmp_dir.'airspace.sql.gz.md5');
2006
+			update_db::download('http://data.flightairmap.fr/data/airspace_mysql.sql.gz.md5', $tmp_dir.'airspace.sql.gz.md5');
2007 2007
 		} else {
2008
-			update_db::download('http://data.flightairmap.fr/data/airspace_pgsql.sql.gz.md5',$tmp_dir.'airspace.sql.gz.md5');
2008
+			update_db::download('http://data.flightairmap.fr/data/airspace_pgsql.sql.gz.md5', $tmp_dir.'airspace.sql.gz.md5');
2009 2009
 		}
2010 2010
 		if (file_exists($tmp_dir.'airspace.sql.gz.md5')) {
2011
-			$airspace_md5_file = explode(' ',file_get_contents($tmp_dir.'airspace.sql.gz.md5'));
2011
+			$airspace_md5_file = explode(' ', file_get_contents($tmp_dir.'airspace.sql.gz.md5'));
2012 2012
 			$airspace_md5 = $airspace_md5_file[0];
2013 2013
 			if (!update_db::check_airspace_version($airspace_md5)) {
2014 2014
 				if ($globalDBdriver == 'mysql') {
2015
-					update_db::download('http://data.flightairmap.fr/data/airspace_mysql.sql.gz',$tmp_dir.'airspace.sql.gz');
2015
+					update_db::download('http://data.flightairmap.fr/data/airspace_mysql.sql.gz', $tmp_dir.'airspace.sql.gz');
2016 2016
 				} else {
2017
-					update_db::download('http://data.flightairmap.fr/data/airspace_pgsql.sql.gz',$tmp_dir.'airspace.sql.gz');
2017
+					update_db::download('http://data.flightairmap.fr/data/airspace_pgsql.sql.gz', $tmp_dir.'airspace.sql.gz');
2018 2018
 				}
2019 2019
 				if (file_exists($tmp_dir.'airspace.sql.gz')) {
2020 2020
 					if ($globalDebug) echo "Gunzip...";
@@ -2026,7 +2026,7 @@  discard block
 block discarded – undo
2026 2026
 						try {
2027 2027
 							$sth = $Connection->db->prepare($query);
2028 2028
     	    	    					$sth->execute();
2029
-			            		} catch(PDOException $e) {
2029
+			            		} catch (PDOException $e) {
2030 2030
 							return "error : ".$e->getMessage();
2031 2031
 		            			}
2032 2032
 		    			}
@@ -2044,15 +2044,15 @@  discard block
 block discarded – undo
2044 2044
 	public static function update_tle() {
2045 2045
 		global $tmp_dir, $globalDebug;
2046 2046
 		if ($globalDebug) echo "Download TLE : Download...";
2047
-		$alltle = array('stations.txt','gps-ops.txt','glo-ops.txt','galileo.txt','weather.txt','noaa.txt','goes.txt','resource.txt','dmc.txt','tdrss.txt','geo.txt','intelsat.txt','gorizont.txt',
2048
-		'raduga.txt','molniya.txt','iridium.txt','orbcomm.txt','globalstar.txt','amateur.txt','x-comm.txt','other-comm.txt','sbas.txt','nnss.txt','musson.txt','science.txt','geodetic.txt',
2049
-		'engineering.txt','education.txt','military.txt','radar.txt','cubesat.txt','other.txt','tle-new.txt');
2047
+		$alltle = array('stations.txt', 'gps-ops.txt', 'glo-ops.txt', 'galileo.txt', 'weather.txt', 'noaa.txt', 'goes.txt', 'resource.txt', 'dmc.txt', 'tdrss.txt', 'geo.txt', 'intelsat.txt', 'gorizont.txt',
2048
+		'raduga.txt', 'molniya.txt', 'iridium.txt', 'orbcomm.txt', 'globalstar.txt', 'amateur.txt', 'x-comm.txt', 'other-comm.txt', 'sbas.txt', 'nnss.txt', 'musson.txt', 'science.txt', 'geodetic.txt',
2049
+		'engineering.txt', 'education.txt', 'military.txt', 'radar.txt', 'cubesat.txt', 'other.txt', 'tle-new.txt');
2050 2050
 		foreach ($alltle as $filename) {
2051 2051
 			if ($globalDebug) echo "downloading ".$filename.'...';
2052
-			update_db::download('http://celestrak.com/NORAD/elements/'.$filename,$tmp_dir.$filename);
2052
+			update_db::download('http://celestrak.com/NORAD/elements/'.$filename, $tmp_dir.$filename);
2053 2053
 			if (file_exists($tmp_dir.$filename)) {
2054 2054
 				if ($globalDebug) echo "Add to DB ".$filename."...";
2055
-				$error = update_db::tle($tmp_dir.$filename,str_replace('.txt','',$filename));
2055
+				$error = update_db::tle($tmp_dir.$filename, str_replace('.txt', '', $filename));
2056 2056
 			} else $error = "File ".$tmp_dir.$filename." doesn't exist. Download failed.";
2057 2057
 			if ($error != '') {
2058 2058
 				echo $error."\n";
@@ -2065,32 +2065,32 @@  discard block
 block discarded – undo
2065 2065
 		global $tmp_dir, $globalDebug;
2066 2066
 		$error = '';
2067 2067
 		if ($globalDebug) echo "Models from FlightAirMap website : Download...";
2068
-		update_db::download('http://data.flightairmap.fr/data/models/models.md5sum',$tmp_dir.'models.md5sum');
2068
+		update_db::download('http://data.flightairmap.fr/data/models/models.md5sum', $tmp_dir.'models.md5sum');
2069 2069
 		if (file_exists($tmp_dir.'models.md5sum')) {
2070 2070
 			if ($globalDebug) echo "Check files...\n";
2071 2071
 			$newmodelsdb = array();
2072
-			if (($handle = fopen($tmp_dir.'models.md5sum','r')) !== FALSE) {
2073
-				while (($row = fgetcsv($handle,1000," ")) !== FALSE) {
2072
+			if (($handle = fopen($tmp_dir.'models.md5sum', 'r')) !== FALSE) {
2073
+				while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) {
2074 2074
 					$model = trim($row[2]);
2075 2075
 					$newmodelsdb[$model] = trim($row[0]);
2076 2076
 				}
2077 2077
 			}
2078 2078
 			$modelsdb = array();
2079 2079
 			if (file_exists(dirname(__FILE__).'/../models/models.md5sum')) {
2080
-				if (($handle = fopen(dirname(__FILE__).'/../models/models.md5sum','r')) !== FALSE) {
2081
-					while (($row = fgetcsv($handle,1000," ")) !== FALSE) {
2080
+				if (($handle = fopen(dirname(__FILE__).'/../models/models.md5sum', 'r')) !== FALSE) {
2081
+					while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) {
2082 2082
 						$model = trim($row[2]);
2083 2083
 						$modelsdb[$model] = trim($row[0]);
2084 2084
 					}
2085 2085
 				}
2086 2086
 			}
2087
-			$diff = array_diff($newmodelsdb,$modelsdb);
2087
+			$diff = array_diff($newmodelsdb, $modelsdb);
2088 2088
 			foreach ($diff as $key => $value) {
2089 2089
 				if ($globalDebug) echo 'Downloading model '.$key.' ...'."\n";
2090
-				update_db::download('http://data.flightairmap.fr/data/models/'.$key,dirname(__FILE__).'/../models/'.$key);
2090
+				update_db::download('http://data.flightairmap.fr/data/models/'.$key, dirname(__FILE__).'/../models/'.$key);
2091 2091
 				
2092 2092
 			}
2093
-			update_db::download('http://data.flightairmap.fr/data/models/models.md5sum',dirname(__FILE__).'/../models/models.md5sum');
2093
+			update_db::download('http://data.flightairmap.fr/data/models/models.md5sum', dirname(__FILE__).'/../models/models.md5sum');
2094 2094
 		} else $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed.";
2095 2095
 		if ($error != '') {
2096 2096
 			return $error;
@@ -2102,32 +2102,32 @@  discard block
 block discarded – undo
2102 2102
 		global $tmp_dir, $globalDebug;
2103 2103
 		$error = '';
2104 2104
 		if ($globalDebug) echo "Space models from FlightAirMap website : Download...";
2105
-		update_db::download('http://data.flightairmap.fr/data/models/space/space_models.md5sum',$tmp_dir.'space_models.md5sum');
2105
+		update_db::download('http://data.flightairmap.fr/data/models/space/space_models.md5sum', $tmp_dir.'space_models.md5sum');
2106 2106
 		if (file_exists($tmp_dir.'space_models.md5sum')) {
2107 2107
 			if ($globalDebug) echo "Check files...\n";
2108 2108
 			$newmodelsdb = array();
2109
-			if (($handle = fopen($tmp_dir.'space_models.md5sum','r')) !== FALSE) {
2110
-				while (($row = fgetcsv($handle,1000," ")) !== FALSE) {
2109
+			if (($handle = fopen($tmp_dir.'space_models.md5sum', 'r')) !== FALSE) {
2110
+				while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) {
2111 2111
 					$model = trim($row[2]);
2112 2112
 					$newmodelsdb[$model] = trim($row[0]);
2113 2113
 				}
2114 2114
 			}
2115 2115
 			$modelsdb = array();
2116 2116
 			if (file_exists(dirname(__FILE__).'/../models/space/space_models.md5sum')) {
2117
-				if (($handle = fopen(dirname(__FILE__).'/../models/space/space_models.md5sum','r')) !== FALSE) {
2118
-					while (($row = fgetcsv($handle,1000," ")) !== FALSE) {
2117
+				if (($handle = fopen(dirname(__FILE__).'/../models/space/space_models.md5sum', 'r')) !== FALSE) {
2118
+					while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) {
2119 2119
 						$model = trim($row[2]);
2120 2120
 						$modelsdb[$model] = trim($row[0]);
2121 2121
 					}
2122 2122
 				}
2123 2123
 			}
2124
-			$diff = array_diff($newmodelsdb,$modelsdb);
2124
+			$diff = array_diff($newmodelsdb, $modelsdb);
2125 2125
 			foreach ($diff as $key => $value) {
2126 2126
 				if ($globalDebug) echo 'Downloading space model '.$key.' ...'."\n";
2127
-				update_db::download('http://data.flightairmap.fr/data/models/space/'.$key,dirname(__FILE__).'/../models/space/'.$key);
2127
+				update_db::download('http://data.flightairmap.fr/data/models/space/'.$key, dirname(__FILE__).'/../models/space/'.$key);
2128 2128
 				
2129 2129
 			}
2130
-			update_db::download('http://data.flightairmap.fr/data/models/space/space_models.md5sum',dirname(__FILE__).'/../models/space/space_models.md5sum');
2130
+			update_db::download('http://data.flightairmap.fr/data/models/space/space_models.md5sum', dirname(__FILE__).'/../models/space/space_models.md5sum');
2131 2131
 		} else $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed.";
2132 2132
 		if ($error != '') {
2133 2133
 			return $error;
@@ -2139,32 +2139,32 @@  discard block
 block discarded – undo
2139 2139
 		global $tmp_dir, $globalDebug;
2140 2140
 		$error = '';
2141 2141
 		if ($globalDebug) echo "Vehicules models from FlightAirMap website : Download...";
2142
-		update_db::download('http://data.flightairmap.fr/data/models/vehicules/vehicules_models.md5sum',$tmp_dir.'vehicules_models.md5sum');
2142
+		update_db::download('http://data.flightairmap.fr/data/models/vehicules/vehicules_models.md5sum', $tmp_dir.'vehicules_models.md5sum');
2143 2143
 		if (file_exists($tmp_dir.'vehicules_models.md5sum')) {
2144 2144
 			if ($globalDebug) echo "Check files...\n";
2145 2145
 			$newmodelsdb = array();
2146
-			if (($handle = fopen($tmp_dir.'vehicules_models.md5sum','r')) !== FALSE) {
2147
-				while (($row = fgetcsv($handle,1000," ")) !== FALSE) {
2146
+			if (($handle = fopen($tmp_dir.'vehicules_models.md5sum', 'r')) !== FALSE) {
2147
+				while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) {
2148 2148
 					$model = trim($row[2]);
2149 2149
 					$newmodelsdb[$model] = trim($row[0]);
2150 2150
 				}
2151 2151
 			}
2152 2152
 			$modelsdb = array();
2153 2153
 			if (file_exists(dirname(__FILE__).'/../models/vehicules/vehicules_models.md5sum')) {
2154
-				if (($handle = fopen(dirname(__FILE__).'/../models/vehicules/vehicules_models.md5sum','r')) !== FALSE) {
2155
-					while (($row = fgetcsv($handle,1000," ")) !== FALSE) {
2154
+				if (($handle = fopen(dirname(__FILE__).'/../models/vehicules/vehicules_models.md5sum', 'r')) !== FALSE) {
2155
+					while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) {
2156 2156
 						$model = trim($row[2]);
2157 2157
 						$modelsdb[$model] = trim($row[0]);
2158 2158
 					}
2159 2159
 				}
2160 2160
 			}
2161
-			$diff = array_diff($newmodelsdb,$modelsdb);
2161
+			$diff = array_diff($newmodelsdb, $modelsdb);
2162 2162
 			foreach ($diff as $key => $value) {
2163 2163
 				if ($globalDebug) echo 'Downloading vehicules model '.$key.' ...'."\n";
2164
-				update_db::download('http://data.flightairmap.fr/data/models/vehicules/'.$key,dirname(__FILE__).'/../models/vehicules/'.$key);
2164
+				update_db::download('http://data.flightairmap.fr/data/models/vehicules/'.$key, dirname(__FILE__).'/../models/vehicules/'.$key);
2165 2165
 				
2166 2166
 			}
2167
-			update_db::download('http://data.flightairmap.fr/data/models/vehicules/vehicules_models.md5sum',dirname(__FILE__).'/../models/vehicules/vehicules_models.md5sum');
2167
+			update_db::download('http://data.flightairmap.fr/data/models/vehicules/vehicules_models.md5sum', dirname(__FILE__).'/../models/vehicules/vehicules_models.md5sum');
2168 2168
 		} else $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed.";
2169 2169
 		if ($error != '') {
2170 2170
 			return $error;
@@ -2187,8 +2187,8 @@  discard block
 block discarded – undo
2187 2187
 		*/
2188 2188
 		if (file_exists($tmp_dir.'aircrafts.html')) {
2189 2189
 		    //var_dump(file_get_html($tmp_dir.'aircrafts.html'));
2190
-		    $fh = fopen($tmp_dir.'aircrafts.html',"r");
2191
-		    $result = fread($fh,100000000);
2190
+		    $fh = fopen($tmp_dir.'aircrafts.html', "r");
2191
+		    $result = fread($fh, 100000000);
2192 2192
 		    //echo $result;
2193 2193
 		    //var_dump(str_get_html($result));
2194 2194
 		    //print_r(self::table2array($result));
@@ -2206,23 +2206,23 @@  discard block
 block discarded – undo
2206 2206
 			$Connection = new Connection();
2207 2207
 			$sth = $Connection->db->prepare($query);
2208 2208
                         $sth->execute();
2209
-                } catch(PDOException $e) {
2209
+                } catch (PDOException $e) {
2210 2210
                         return "error : ".$e->getMessage();
2211 2211
                 }
2212 2212
 
2213 2213
 		$error = '';
2214 2214
 		if ($globalDebug) echo "Notam : Download...";
2215
-		update_db::download($globalNOTAMSource,$tmp_dir.'notam.rss');
2215
+		update_db::download($globalNOTAMSource, $tmp_dir.'notam.rss');
2216 2216
 		if (file_exists($tmp_dir.'notam.rss')) {
2217
-			$notams = json_decode(json_encode(simplexml_load_file($tmp_dir.'notam.rss')),true);
2217
+			$notams = json_decode(json_encode(simplexml_load_file($tmp_dir.'notam.rss')), true);
2218 2218
 			foreach ($notams['channel']['item'] as $notam) {
2219
-				$title = explode(':',$notam['title']);
2219
+				$title = explode(':', $notam['title']);
2220 2220
 				$data['ref'] = trim($title[0]);
2221 2221
 				unset($title[0]);
2222
-				$data['title'] = trim(implode(':',$title));
2223
-				$description = strip_tags($notam['description'],'<pre>');
2224
-				preg_match(':^(.*?)<pre>:',$description,$match);
2225
-				$q = explode('/',$match[1]);
2222
+				$data['title'] = trim(implode(':', $title));
2223
+				$description = strip_tags($notam['description'], '<pre>');
2224
+				preg_match(':^(.*?)<pre>:', $description, $match);
2225
+				$q = explode('/', $match[1]);
2226 2226
 				$data['fir'] = $q[0];
2227 2227
 				$data['code'] = $q[1];
2228 2228
 				$ifrvfr = $q[2];
@@ -2238,30 +2238,30 @@  discard block
 block discarded – undo
2238 2238
 				$data['lower_limit'] = $q[5];
2239 2239
 				$data['upper_limit'] = $q[6];
2240 2240
 				$latlonrad = $q[7];
2241
-				sscanf($latlonrad,'%4c%c%5c%c%3d',$las,$lac,$lns,$lnc,$radius);
2242
-				$latitude = $Common->convertDec($las,'latitude');
2243
-				$longitude = $Common->convertDec($lns,'longitude');
2241
+				sscanf($latlonrad, '%4c%c%5c%c%3d', $las, $lac, $lns, $lnc, $radius);
2242
+				$latitude = $Common->convertDec($las, 'latitude');
2243
+				$longitude = $Common->convertDec($lns, 'longitude');
2244 2244
 				if ($lac == 'S') $latitude = '-'.$latitude;
2245 2245
 				if ($lnc == 'W') $longitude = '-'.$longitude;
2246 2246
 				$data['center_latitude'] = $latitude;
2247 2247
 				$data['center_longitude'] = $longitude;
2248 2248
 				$data['radius'] = intval($radius);
2249 2249
 				
2250
-				preg_match(':<pre>(.*?)</pre>:',$description,$match);
2250
+				preg_match(':<pre>(.*?)</pre>:', $description, $match);
2251 2251
 				$data['text'] = $match[1];
2252
-				preg_match(':</pre>(.*?)$:',$description,$match);
2252
+				preg_match(':</pre>(.*?)$:', $description, $match);
2253 2253
 				$fromto = $match[1];
2254
-				preg_match('#FROM:(.*?)TO:#',$fromto,$match);
2254
+				preg_match('#FROM:(.*?)TO:#', $fromto, $match);
2255 2255
 				$fromall = trim($match[1]);
2256
-				preg_match('#^(.*?) \((.*?)\)$#',$fromall,$match);
2256
+				preg_match('#^(.*?) \((.*?)\)$#', $fromall, $match);
2257 2257
 				$from = trim($match[1]);
2258
-				$data['date_begin'] = date("Y-m-d H:i:s",strtotime($from));
2259
-				preg_match('#TO:(.*?)$#',$fromto,$match);
2258
+				$data['date_begin'] = date("Y-m-d H:i:s", strtotime($from));
2259
+				preg_match('#TO:(.*?)$#', $fromto, $match);
2260 2260
 				$toall = trim($match[1]);
2261
-				if (!preg_match(':Permanent:',$toall)) {
2262
-					preg_match('#^(.*?) \((.*?)\)#',$toall,$match);
2261
+				if (!preg_match(':Permanent:', $toall)) {
2262
+					preg_match('#^(.*?) \((.*?)\)#', $toall, $match);
2263 2263
 					$to = trim($match[1]);
2264
-					$data['date_end'] = date("Y-m-d H:i:s",strtotime($to));
2264
+					$data['date_end'] = date("Y-m-d H:i:s", strtotime($to));
2265 2265
 					$data['permanent'] = 0;
2266 2266
 				} else {
2267 2267
 				    $data['date_end'] = NULL;
@@ -2269,7 +2269,7 @@  discard block
 block discarded – undo
2269 2269
 				}
2270 2270
 				$data['full_notam'] = $notam['title'].'<br>'.$notam['description'];
2271 2271
 				$NOTAM = new NOTAM();
2272
-				$NOTAM->addNOTAM($data['ref'],$data['title'],'',$data['fir'],$data['code'],'',$data['scope'],$data['lower_limit'],$data['upper_limit'],$data['center_latitude'],$data['center_longitude'],$data['radius'],$data['date_begin'],$data['date_end'],$data['permanent'],$data['text'],$data['full_notam']);
2272
+				$NOTAM->addNOTAM($data['ref'], $data['title'], '', $data['fir'], $data['code'], '', $data['scope'], $data['lower_limit'], $data['upper_limit'], $data['center_latitude'], $data['center_longitude'], $data['radius'], $data['date_begin'], $data['date_end'], $data['permanent'], $data['text'], $data['full_notam']);
2273 2273
 				unset($data);
2274 2274
 			} 
2275 2275
 		} else $error = "File ".$tmp_dir.'notam.rss'." doesn't exist. Download failed.";
@@ -2292,16 +2292,16 @@  discard block
 block discarded – undo
2292 2292
 				$Connection = new Connection();
2293 2293
 				$sth = $Connection->db->prepare($query);
2294 2294
 				$sth->execute();
2295
-			} catch(PDOException $e) {
2295
+			} catch (PDOException $e) {
2296 2296
 				return "error : ".$e->getMessage();
2297 2297
 			}
2298 2298
 		}
2299 2299
 		$Common = new Common();
2300 2300
 		$airspace_lst = $Common->getData('https://raw.githubusercontent.com/XCSoar/xcsoar-data-repository/master/data/airspace.json');
2301
-		$airspace_json = json_decode($airspace_lst,true);
2301
+		$airspace_json = json_decode($airspace_lst, true);
2302 2302
 		foreach ($airspace_json['records'] as $airspace) {
2303 2303
 			if ($globalDebug) echo $airspace['name']."...\n";
2304
-			update_db::download($airspace['uri'],$tmp_dir.$airspace['name']);
2304
+			update_db::download($airspace['uri'], $tmp_dir.$airspace['name']);
2305 2305
 			if (file_exists($tmp_dir.$airspace['name'])) {
2306 2306
 				file_put_contents($tmp_dir.$airspace['name'], utf8_encode(file_get_contents($tmp_dir.$airspace['name'])));
2307 2307
 				//system('recode l9..utf8 '.$tmp_dir.$airspace['name']);
@@ -2323,7 +2323,7 @@  discard block
 block discarded – undo
2323 2323
 				$Connection = new Connection();
2324 2324
 				$sth = $Connection->db->prepare($query);
2325 2325
 				$sth->execute(array(':new' => $new, ':old' => $old));
2326
-			} catch(PDOException $e) {
2326
+			} catch (PDOException $e) {
2327 2327
 				return "error : ".$e->getMessage();
2328 2328
 			}
2329 2329
 		}
@@ -2340,7 +2340,7 @@  discard block
 block discarded – undo
2340 2340
 			$Connection = new Connection();
2341 2341
 			$sth = $Connection->db->prepare($query);
2342 2342
                         $sth->execute();
2343
-                } catch(PDOException $e) {
2343
+                } catch (PDOException $e) {
2344 2344
                         return "error : ".$e->getMessage();
2345 2345
                 }
2346 2346
                 $row = $sth->fetch(PDO::FETCH_ASSOC);
@@ -2355,7 +2355,7 @@  discard block
 block discarded – undo
2355 2355
 			$Connection = new Connection();
2356 2356
 			$sth = $Connection->db->prepare($query);
2357 2357
                         $sth->execute();
2358
-                } catch(PDOException $e) {
2358
+                } catch (PDOException $e) {
2359 2359
                         return "error : ".$e->getMessage();
2360 2360
                 }
2361 2361
 	}
@@ -2366,7 +2366,7 @@  discard block
 block discarded – undo
2366 2366
 			$Connection = new Connection();
2367 2367
 			$sth = $Connection->db->prepare($query);
2368 2368
                         $sth->execute(array(':version' => $version));
2369
-                } catch(PDOException $e) {
2369
+                } catch (PDOException $e) {
2370 2370
                         return "error : ".$e->getMessage();
2371 2371
                 }
2372 2372
                 $row = $sth->fetch(PDO::FETCH_ASSOC);
@@ -2382,7 +2382,7 @@  discard block
 block discarded – undo
2382 2382
 			$Connection = new Connection();
2383 2383
 			$sth = $Connection->db->prepare($query);
2384 2384
                         $sth->execute(array(':version' => $version));
2385
-                } catch(PDOException $e) {
2385
+                } catch (PDOException $e) {
2386 2386
                         return "error : ".$e->getMessage();
2387 2387
                 }
2388 2388
 	}
@@ -2398,7 +2398,7 @@  discard block
 block discarded – undo
2398 2398
 			$Connection = new Connection();
2399 2399
 			$sth = $Connection->db->prepare($query);
2400 2400
                         $sth->execute();
2401
-                } catch(PDOException $e) {
2401
+                } catch (PDOException $e) {
2402 2402
                         return "error : ".$e->getMessage();
2403 2403
                 }
2404 2404
                 $row = $sth->fetch(PDO::FETCH_ASSOC);
@@ -2413,7 +2413,7 @@  discard block
 block discarded – undo
2413 2413
 			$Connection = new Connection();
2414 2414
 			$sth = $Connection->db->prepare($query);
2415 2415
                         $sth->execute();
2416
-                } catch(PDOException $e) {
2416
+                } catch (PDOException $e) {
2417 2417
                         return "error : ".$e->getMessage();
2418 2418
                 }
2419 2419
 	}
@@ -2428,7 +2428,7 @@  discard block
 block discarded – undo
2428 2428
 			$Connection = new Connection();
2429 2429
 			$sth = $Connection->db->prepare($query);
2430 2430
                         $sth->execute();
2431
-                } catch(PDOException $e) {
2431
+                } catch (PDOException $e) {
2432 2432
                         return "error : ".$e->getMessage();
2433 2433
                 }
2434 2434
                 $row = $sth->fetch(PDO::FETCH_ASSOC);
@@ -2443,7 +2443,7 @@  discard block
 block discarded – undo
2443 2443
 			$Connection = new Connection();
2444 2444
 			$sth = $Connection->db->prepare($query);
2445 2445
                         $sth->execute();
2446
-                } catch(PDOException $e) {
2446
+                } catch (PDOException $e) {
2447 2447
                         return "error : ".$e->getMessage();
2448 2448
                 }
2449 2449
 	}
@@ -2459,7 +2459,7 @@  discard block
 block discarded – undo
2459 2459
 			$Connection = new Connection();
2460 2460
 			$sth = $Connection->db->prepare($query);
2461 2461
                         $sth->execute();
2462
-                } catch(PDOException $e) {
2462
+                } catch (PDOException $e) {
2463 2463
                         return "error : ".$e->getMessage();
2464 2464
                 }
2465 2465
                 $row = $sth->fetch(PDO::FETCH_ASSOC);
@@ -2474,7 +2474,7 @@  discard block
 block discarded – undo
2474 2474
 			$Connection = new Connection();
2475 2475
 			$sth = $Connection->db->prepare($query);
2476 2476
                         $sth->execute();
2477
-                } catch(PDOException $e) {
2477
+                } catch (PDOException $e) {
2478 2478
                         return "error : ".$e->getMessage();
2479 2479
                 }
2480 2480
 	}
@@ -2489,7 +2489,7 @@  discard block
 block discarded – undo
2489 2489
 			$Connection = new Connection();
2490 2490
 			$sth = $Connection->db->prepare($query);
2491 2491
                         $sth->execute();
2492
-                } catch(PDOException $e) {
2492
+                } catch (PDOException $e) {
2493 2493
                         return "error : ".$e->getMessage();
2494 2494
                 }
2495 2495
                 $row = $sth->fetch(PDO::FETCH_ASSOC);
@@ -2504,7 +2504,7 @@  discard block
 block discarded – undo
2504 2504
 			$Connection = new Connection();
2505 2505
 			$sth = $Connection->db->prepare($query);
2506 2506
                         $sth->execute();
2507
-                } catch(PDOException $e) {
2507
+                } catch (PDOException $e) {
2508 2508
                         return "error : ".$e->getMessage();
2509 2509
                 }
2510 2510
 	}
@@ -2519,7 +2519,7 @@  discard block
 block discarded – undo
2519 2519
 			$Connection = new Connection();
2520 2520
 			$sth = $Connection->db->prepare($query);
2521 2521
                         $sth->execute();
2522
-                } catch(PDOException $e) {
2522
+                } catch (PDOException $e) {
2523 2523
                         return "error : ".$e->getMessage();
2524 2524
                 }
2525 2525
                 $row = $sth->fetch(PDO::FETCH_ASSOC);
@@ -2534,7 +2534,7 @@  discard block
 block discarded – undo
2534 2534
 			$Connection = new Connection();
2535 2535
 			$sth = $Connection->db->prepare($query);
2536 2536
                         $sth->execute();
2537
-                } catch(PDOException $e) {
2537
+                } catch (PDOException $e) {
2538 2538
                         return "error : ".$e->getMessage();
2539 2539
                 }
2540 2540
 	}
@@ -2549,7 +2549,7 @@  discard block
 block discarded – undo
2549 2549
 			$Connection = new Connection();
2550 2550
 			$sth = $Connection->db->prepare($query);
2551 2551
                         $sth->execute();
2552
-                } catch(PDOException $e) {
2552
+                } catch (PDOException $e) {
2553 2553
                         return "error : ".$e->getMessage();
2554 2554
                 }
2555 2555
 	}
@@ -2564,7 +2564,7 @@  discard block
 block discarded – undo
2564 2564
 			$Connection = new Connection();
2565 2565
 			$sth = $Connection->db->prepare($query);
2566 2566
                         $sth->execute();
2567
-                } catch(PDOException $e) {
2567
+                } catch (PDOException $e) {
2568 2568
                         return "error : ".$e->getMessage();
2569 2569
                 }
2570 2570
 	}
Please login to merge, or discard this patch.