Completed
Push — master ( d1c288...d0d974 )
by Yannick
08:03
created
live-geojson.php 2 patches
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -25,23 +25,23 @@  discard block
 block discarded – undo
25 25
 $min = true;
26 26
 $allhistory = false;
27 27
 $filter['source'] = array();
28
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt'));
29
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup'));
30
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars'));
31
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs'));
32
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs'));
33
-if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING);
34
-if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING);
35
-if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING);
36
-if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING);
37
-if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING);
28
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'], array('vatsimtxt'));
29
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'], array('whazzup'));
30
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'], array('phpvmacars'));
31
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'], array('sbs'));
32
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'], array('aprs'));
33
+if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'], FILTER_SANITIZE_STRING);
34
+if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',', $_COOKIE['filter_Airlines']), FILTER_SANITIZE_STRING);
35
+if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',', $_COOKIE['filter_Sources']), FILTER_SANITIZE_STRING);
36
+if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'], FILTER_SANITIZE_STRING);
37
+if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'], FILTER_SANITIZE_STRING);
38 38
 
39 39
 if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) {
40 40
 	$min = true;
41 41
 } else $min = false;
42 42
 
43 43
 if (isset($_GET['ident'])) {
44
-	$ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING);
44
+	$ident = filter_input(INPUT_GET, 'ident', FILTER_SANITIZE_STRING);
45 45
 	$spotter_array = $SpotterLive->getLastLiveSpotterDataByIdent($ident);
46 46
 	if (empty($spotter_array)) {
47 47
 		$from_archive = true;
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 	}
50 50
 	$allhistory = true;
51 51
 } elseif (isset($_GET['flightaware_id'])) {
52
-	$flightaware_id = filter_input(INPUT_GET,'flightaware_id',FILTER_SANITIZE_STRING);
52
+	$flightaware_id = filter_input(INPUT_GET, 'flightaware_id', FILTER_SANITIZE_STRING);
53 53
 	$spotter_array = $SpotterLive->getLastLiveSpotterDataById($flightaware_id);
54 54
 	if (empty($spotter_array)) {
55 55
 		$from_archive = true;
@@ -58,25 +58,25 @@  discard block
 block discarded – undo
58 58
 	$allhistory = true;
59 59
 } elseif (isset($_GET['coord']) && (!isset($globalMapPopup) || $globalMapPopup || (isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true'))) {
60 60
 //if (isset($_GET['coord'])) {
61
-	$coord = explode(',',$_GET['coord']);
62
-	$spotter_array = $SpotterLive->getLiveSpotterDatabyCoord($coord,$filter);
61
+	$coord = explode(',', $_GET['coord']);
62
+	$spotter_array = $SpotterLive->getLiveSpotterDatabyCoord($coord, $filter);
63 63
 
64 64
 #} elseif (isset($globalMapPopup) && !$globalMapPopup) {
65 65
 } elseif (isset($_GET['archive']) && isset($_GET['begindate']) && isset($_GET['enddate']) && isset($_GET['speed'])) {
66 66
 	$from_archive = true;
67 67
 //	$begindate = filter_input(INPUT_GET,'begindate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~')));
68 68
 //	$enddate = filter_input(INPUT_GET,'enddate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~')));
69
-	$begindate = filter_input(INPUT_GET,'begindate',FILTER_SANITIZE_NUMBER_INT);
70
-	$enddate = filter_input(INPUT_GET,'enddate',FILTER_SANITIZE_NUMBER_INT);
71
-	$archivespeed = filter_input(INPUT_GET,'speed',FILTER_SANITIZE_NUMBER_INT);
72
-	$begindate = date('Y-m-d H:i:s',$begindate);
73
-	$enddate = date('Y-m-d H:i:s',$enddate);
74
-	$spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate,$enddate,$filter);
69
+	$begindate = filter_input(INPUT_GET, 'begindate', FILTER_SANITIZE_NUMBER_INT);
70
+	$enddate = filter_input(INPUT_GET, 'enddate', FILTER_SANITIZE_NUMBER_INT);
71
+	$archivespeed = filter_input(INPUT_GET, 'speed', FILTER_SANITIZE_NUMBER_INT);
72
+	$begindate = date('Y-m-d H:i:s', $begindate);
73
+	$enddate = date('Y-m-d H:i:s', $enddate);
74
+	$spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate, $enddate, $filter);
75 75
 } elseif ($min) {
76 76
 	$spotter_array = $SpotterLive->getMinLiveSpotterData($filter);
77 77
 #	$min = true;
78 78
 } else {
79
-	$spotter_array = $SpotterLive->getLiveSpotterData('','',$filter);
79
+	$spotter_array = $SpotterLive->getLiveSpotterData('', '', $filter);
80 80
 }
81 81
 
82 82
 if (!empty($spotter_array)) {
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 	if ($flightcnt == '') $flightcnt = 0;
92 92
 } else $flightcnt = 0;
93 93
 
94
-$sqltime = round(microtime(true)-$begintime,2);
94
+$sqltime = round(microtime(true) - $begintime, 2);
95 95
 
96 96
 if ((!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation == FALSE) || (isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'false')) $usenextlatlon = false;
97 97
 else $usenextlatlon = true;
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 		if (!empty($spotter_array) && is_array($spotter_array))
109 109
 		{
110 110
 			$output .= '"features": [';
111
-			foreach($spotter_array as $spotter_item)
111
+			foreach ($spotter_array as $spotter_item)
112 112
 			{
113 113
 				$j++;
114 114
 				date_default_timezone_set('UTC');
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
 						if (isset($spotter_item['registration'])) $output .= '"registration": "'.$spotter_item['registration'].'",';
160 160
 						if (isset($spotter_item['aircraft_name']) && isset($spotter_item['aircraft_type'])) {
161 161
 							$output .= '"aircraft_name": "'.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')",';
162
-							$output .= '"aircraft_wiki": "http://'.strtolower($globalLanguage).'.wikipedia.org/wiki/'.urlencode(str_replace(' ','_',$spotter_item['aircraft_name'])).'",';
162
+							$output .= '"aircraft_wiki": "http://'.strtolower($globalLanguage).'.wikipedia.org/wiki/'.urlencode(str_replace(' ', '_', $spotter_item['aircraft_name'])).'",';
163 163
 						} elseif (isset($spotter_item['aircraft_type'])) {
164 164
 							$output .= '"aircraft_name": "NA ('.$spotter_item['aircraft_type'].')",';
165 165
 						} elseif (!$min) {
@@ -233,16 +233,16 @@  discard block
 block discarded – undo
233 233
 						else $output .= '"heading": "'.$spotter_item['heading'].'",';
234 234
 						
235 235
 						if (isset($archivespeed)) {
236
-							$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$spotter_item['heading'],$archivespeed);
236
+							$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $spotter_item['heading'], $archivespeed);
237 237
 							$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
238 238
 						} elseif ($usenextlatlon) {
239
-							$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$spotter_item['heading']);
239
+							$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $spotter_item['heading']);
240 240
 							$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
241 241
 						}
242 242
 
243 243
 						if (!$min) $output .= '"image": "'.$image.'",';
244 244
 						if (isset($spotter_item['image_copyright']) && $spotter_item['image_copyright'] != '') {
245
-							$output .= '"image_copyright": "'.str_replace('"',"'",trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$spotter_item['image_copyright']))).'",';
245
+							$output .= '"image_copyright": "'.str_replace('"', "'", trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '', $spotter_item['image_copyright']))).'",';
246 246
 						}
247 247
 						if (isset($spotter_item['image_source_website'])) {
248 248
 							$output .= '"image_source_website": "'.urlencode($spotter_item['image_source_website']).'",';
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
 							$output .= '"waypoints": "'.$spotter_item['waypoints'].'",';
265 265
 						}
266 266
 						if (isset($spotter_item['acars'])) {
267
-							$output .= '"acars": "'.trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"), '<br />',$spotter_item['acars']['message'])).'",';
267
+							$output .= '"acars": "'.trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '<br />', $spotter_item['acars']['message'])).'",';
268 268
 						}
269 269
 						// type when not aircraft ?
270 270
 						if ($compress) $output .= '"t": "aircraft"';
@@ -334,7 +334,7 @@  discard block
 block discarded – undo
334 334
                 
335 335
 			}
336 336
 */
337
-				$history = filter_input(INPUT_GET,'history',FILTER_SANITIZE_STRING);
337
+				$history = filter_input(INPUT_GET, 'history', FILTER_SANITIZE_STRING);
338 338
 				if ($history == '' && isset($_COOKIE['history'])) $history = $_COOKIE['history'];
339 339
 				
340 340
 				if ((isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true') 
@@ -361,9 +361,9 @@  discard block
 block discarded – undo
361 361
 					    else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": [';
362 362
 					}
363 363
 					$output_history .= '[';
364
-					$output_history .=  $spotter_history['longitude'].', ';
365
-					$output_history .=  $spotter_history['latitude'].', ';
366
-					$output_history .=  $spotter_history['altitude']*30.48;
364
+					$output_history .= $spotter_history['longitude'].', ';
365
+					$output_history .= $spotter_history['latitude'].', ';
366
+					$output_history .= $spotter_history['altitude']*30.48;
367 367
 					$output_history .= '],';
368 368
 					$prev_alt = $alt;
369 369
 				    //}
@@ -403,7 +403,7 @@  discard block
 block discarded – undo
403 403
 			$output  = substr($output, 0, -1);
404 404
 			$output .= ']';
405 405
 			$output .= ',"initial_sqltime": "'.$sqltime.'",';
406
-			$output .= '"totaltime": "'.round(microtime(true)-$begintime,2).'",';
406
+			$output .= '"totaltime": "'.round(microtime(true) - $begintime, 2).'",';
407 407
 			if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",';
408 408
 			$output .= '"fc": "'.$j.'"';
409 409
 		} else {
Please login to merge, or discard this patch.
Braces   +142 added lines, -55 removed lines patch added patch discarded remove patch
@@ -18,27 +18,52 @@  discard block
 block discarded – undo
18 18
 }
19 19
 header('Content-Type: text/javascript');
20 20
 
21
-if (!isset($globalJsonCompress)) $compress = true;
22
-else $compress = $globalJsonCompress;
21
+if (!isset($globalJsonCompress)) {
22
+	$compress = true;
23
+} else {
24
+	$compress = $globalJsonCompress;
25
+}
23 26
 
24 27
 $from_archive = false;
25 28
 $min = true;
26 29
 $allhistory = false;
27 30
 $filter['source'] = array();
28
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt'));
29
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup'));
30
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars'));
31
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs'));
32
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs'));
33
-if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING);
34
-if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING);
35
-if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING);
36
-if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING);
37
-if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING);
31
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') {
32
+	$filter['source'] = array_merge($filter['source'],array('vatsimtxt'));
33
+}
34
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') {
35
+	$filter['source'] = array_merge($filter['source'],array('whazzup'));
36
+}
37
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') {
38
+	$filter['source'] = array_merge($filter['source'],array('phpvmacars'));
39
+}
40
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') {
41
+	$filter['source'] = array_merge($filter['source'],array('sbs'));
42
+}
43
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') {
44
+	$filter['source'] = array_merge($filter['source'],array('aprs'));
45
+}
46
+if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') {
47
+	$filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING);
48
+}
49
+if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') {
50
+	$filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING);
51
+}
52
+if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') {
53
+	$filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING);
54
+}
55
+if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') {
56
+	$filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING);
57
+}
58
+if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') {
59
+	$filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING);
60
+}
38 61
 
39 62
 if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) {
40 63
 	$min = true;
41
-} else $min = false;
64
+} else {
65
+	$min = false;
66
+}
42 67
 
43 68
 if (isset($_GET['ident'])) {
44 69
 	$ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING);
@@ -88,20 +113,30 @@  discard block
 block discarded – undo
88 113
 	}
89 114
 */
90 115
 	$flightcnt = count($spotter_array);
91
-	if ($flightcnt == '') $flightcnt = 0;
92
-} else $flightcnt = 0;
116
+	if ($flightcnt == '') {
117
+		$flightcnt = 0;
118
+	}
119
+	} else {
120
+	$flightcnt = 0;
121
+}
93 122
 
94 123
 $sqltime = round(microtime(true)-$begintime,2);
95 124
 
96
-if ((!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation == FALSE) || (isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'false')) $usenextlatlon = false;
97
-else $usenextlatlon = true;
125
+if ((!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation == FALSE) || (isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'false')) {
126
+	$usenextlatlon = false;
127
+} else {
128
+	$usenextlatlon = true;
129
+}
98 130
 $j = 0;
99 131
 $prev_flightaware_id = '';
100 132
 $aircrafts_shadow = array();
101 133
 $output = '{';
102 134
 	$output .= '"type": "FeatureCollection",';
103
-		if ($min) $output .= '"minimal": "true",';
104
-		else $output .= '"minimal": "false",';
135
+		if ($min) {
136
+			$output .= '"minimal": "true",';
137
+		} else {
138
+			$output .= '"minimal": "false",';
139
+		}
105 140
 		$output .= '"fc": "'.$flightcnt.'",';
106 141
 		$output .= '"sqt": "'.$sqltime.'",';
107 142
 
@@ -138,11 +173,16 @@  discard block
 block discarded – undo
138 173
 						//$output .= '"sqt": "'.$sqltime.'",';
139 174
 						$output .= '"id": "'.$spotter_item['flightaware_id'].'",';
140 175
 						$output .= '"properties": {';
141
-							if ($compress) $output .= '"fi": "'.$spotter_item['flightaware_id'].'",';
142
-							else $output .= '"flightaware_id": "'.$spotter_item['flightaware_id'].'",';
176
+							if ($compress) {
177
+								$output .= '"fi": "'.$spotter_item['flightaware_id'].'",';
178
+							} else {
179
+								$output .= '"flightaware_id": "'.$spotter_item['flightaware_id'].'",';
180
+							}
143 181
 							$output .= '"fc": "'.$flightcnt.'",';
144 182
 							$output .= '"sqt": "'.$sqltime.'",';
145
-							if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",';
183
+							if (isset($begindate)) {
184
+								$output .= '"archive_date": "'.$begindate.'",';
185
+							}
146 186
 
147 187
 /*
148 188
 							if ($min) $output .= '"minimal": "true",';
@@ -150,13 +190,21 @@  discard block
 block discarded – undo
150 190
 */
151 191
 							//$output .= '"fc": "'.$spotter_item['nb'].'",';
152 192
 						if (isset($spotter_item['ident']) && $spotter_item['ident'] != '') {
153
-							if ($compress) $output .= '"c": "'.$spotter_item['ident'].'",';
154
-							else $output .= '"callsign": "'.$spotter_item['ident'].'",';
193
+							if ($compress) {
194
+								$output .= '"c": "'.$spotter_item['ident'].'",';
195
+							} else {
196
+								$output .= '"callsign": "'.$spotter_item['ident'].'",';
197
+							}
155 198
 						} else {
156
-							if ($compress) $output .= '"c": "NA",';
157
-							else $output .= '"callsign": "NA",';
199
+							if ($compress) {
200
+								$output .= '"c": "NA",';
201
+							} else {
202
+								$output .= '"callsign": "NA",';
203
+							}
204
+						}
205
+						if (isset($spotter_item['registration'])) {
206
+							$output .= '"registration": "'.$spotter_item['registration'].'",';
158 207
 						}
159
-						if (isset($spotter_item['registration'])) $output .= '"registration": "'.$spotter_item['registration'].'",';
160 208
 						if (isset($spotter_item['aircraft_name']) && isset($spotter_item['aircraft_type'])) {
161 209
 							$output .= '"aircraft_name": "'.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')",';
162 210
 							$output .= '"aircraft_wiki": "http://'.strtolower($globalLanguage).'.wikipedia.org/wiki/'.urlencode(str_replace(' ','_',$spotter_item['aircraft_name'])).'",';
@@ -169,25 +217,37 @@  discard block
 block discarded – undo
169 217
 							$output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",';
170 218
 						}
171 219
 						if (!isset($spotter_item['aircraft_shadow'])) {
172
-							if (!isset($spotter_item['aircraft_icao']) || $spotter_item['aircraft_icao'] == '') $spotter_item['aircraft_shadow'] = '';
173
-							else {
220
+							if (!isset($spotter_item['aircraft_icao']) || $spotter_item['aircraft_icao'] == '') {
221
+								$spotter_item['aircraft_shadow'] = '';
222
+							} else {
174 223
 								$aircraft_icao = $spotter_item['aircraft_icao'];
175
-								if (isset($aircrafts_shadow[$aircraft_icao])) $spotter_item['aircraft_shadow'] = $aircrafts_shadow[$aircraft_icao];
176
-								else {
224
+								if (isset($aircrafts_shadow[$aircraft_icao])) {
225
+									$spotter_item['aircraft_shadow'] = $aircrafts_shadow[$aircraft_icao];
226
+								} else {
177 227
 									$aircraft_info = $Spotter->getAllAircraftInfo($spotter_item['aircraft_icao']);
178
-									if (count($aircraft_info) > 0) $spotter_item['aircraft_shadow'] = $aircraft_info[0]['aircraft_shadow'];
179
-									elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') $spotter_item['aircraft_shadow'] = 'PA18.png';
180
-									else $spotter_item['aircraft_shadow'] = '';
228
+									if (count($aircraft_info) > 0) {
229
+										$spotter_item['aircraft_shadow'] = $aircraft_info[0]['aircraft_shadow'];
230
+									} elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') {
231
+										$spotter_item['aircraft_shadow'] = 'PA18.png';
232
+									} else {
233
+										$spotter_item['aircraft_shadow'] = '';
234
+									}
181 235
 									$aircrafts_shadow[$aircraft_icao] = $spotter_item['aircraft_shadow'];
182 236
 								}
183 237
 							}
184 238
 						}
185 239
 						if ($spotter_item['aircraft_shadow'] == '') {
186
-							if ($compress) $output .= '"as": "default.png",';
187
-							else $output .= '"aircraft_shadow": "default.png",';
240
+							if ($compress) {
241
+								$output .= '"as": "default.png",';
242
+							} else {
243
+								$output .= '"aircraft_shadow": "default.png",';
244
+							}
188 245
 						} else {
189
-							if ($compress) $output .= '"as": "'.$spotter_item['aircraft_shadow'].'",';
190
-							else $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",';
246
+							if ($compress) {
247
+								$output .= '"as": "'.$spotter_item['aircraft_shadow'].'",';
248
+							} else {
249
+								$output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",';
250
+							}
191 251
 						}
192 252
 						if (isset($spotter_item['airline_name'])) {
193 253
 							$output .= '"airline_name": "'.$spotter_item['airline_name'].'",';
@@ -195,8 +255,11 @@  discard block
 block discarded – undo
195 255
 							$output .= '"airline_name": "NA",';
196 256
 						}
197 257
 						if (isset($spotter_item['departure_airport'])) {
198
-							if ($compress) $output .= '"dac": "'.$spotter_item['departure_airport'].'",';
199
-							else $output .= '"departure_airport_code": "'.$spotter_item['departure_airport'].'",';
258
+							if ($compress) {
259
+								$output .= '"dac": "'.$spotter_item['departure_airport'].'",';
260
+							} else {
261
+								$output .= '"departure_airport_code": "'.$spotter_item['departure_airport'].'",';
262
+							}
200 263
 						}
201 264
 						if (isset($spotter_item['departure_airport_city'])) {
202 265
 							$output .= '"departure_airport": "'.$spotter_item['departure_airport_city'].', '.$spotter_item['departure_airport_country'].'",';
@@ -208,8 +271,11 @@  discard block
 block discarded – undo
208 271
 							$output .= '"arrival_airport_time": "'.$spotter_item['arrival_airport_time'].'",';
209 272
 						}
210 273
 						if (isset($spotter_item['arrival_airport'])) {
211
-							if ($compress) $output .= '"aac": "'.$spotter_item['arrival_airport'].'",';
212
-							else $output .= '"arrival_airport_code": "'.$spotter_item['arrival_airport'].'",';
274
+							if ($compress) {
275
+								$output .= '"aac": "'.$spotter_item['arrival_airport'].'",';
276
+							} else {
277
+								$output .= '"arrival_airport_code": "'.$spotter_item['arrival_airport'].'",';
278
+							}
213 279
 						}
214 280
 						if (isset($spotter_item['arrival_airport_city'])) {
215 281
 							$output .= '"arrival_airport": "'.$spotter_item['arrival_airport_city'].', '.$spotter_item['arrival_airport_country'].'",';
@@ -227,10 +293,16 @@  discard block
 block discarded – undo
227 293
 							$output .= '"ground_speed": "'.$spotter_item['ground_speed'].'",';
228 294
 						}
229 295
 						
230
-						if ($compress) $output .= '"a": "'.$spotter_item['altitude'].'",';
231
-						else $output .= '"altitude": "'.$spotter_item['altitude'].'",';
232
-						if ($compress)$output .= '"h": "'.$spotter_item['heading'].'",';
233
-						else $output .= '"heading": "'.$spotter_item['heading'].'",';
296
+						if ($compress) {
297
+							$output .= '"a": "'.$spotter_item['altitude'].'",';
298
+						} else {
299
+							$output .= '"altitude": "'.$spotter_item['altitude'].'",';
300
+						}
301
+						if ($compress) {
302
+							$output .= '"h": "'.$spotter_item['heading'].'",';
303
+						} else {
304
+							$output .= '"heading": "'.$spotter_item['heading'].'",';
305
+						}
234 306
 						
235 307
 						if (isset($archivespeed)) {
236 308
 							$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$spotter_item['heading'],$archivespeed);
@@ -240,7 +312,9 @@  discard block
 block discarded – undo
240 312
 							$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
241 313
 						}
242 314
 
243
-						if (!$min) $output .= '"image": "'.$image.'",';
315
+						if (!$min) {
316
+							$output .= '"image": "'.$image.'",';
317
+						}
244 318
 						if (isset($spotter_item['image_copyright']) && $spotter_item['image_copyright'] != '') {
245 319
 							$output .= '"image_copyright": "'.str_replace('"',"'",trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$spotter_item['image_copyright']))).'",';
246 320
 						}
@@ -248,8 +322,11 @@  discard block
 block discarded – undo
248 322
 							$output .= '"image_source_website": "'.urlencode($spotter_item['image_source_website']).'",';
249 323
 						}
250 324
 						if (isset($spotter_item['squawk'])) {
251
-							if ($compress) $output .= '"sq": "'.$spotter_item['squawk'].'",';
252
-							else $output .= '"squawk": "'.$spotter_item['squawk'].'",';
325
+							if ($compress) {
326
+								$output .= '"sq": "'.$spotter_item['squawk'].'",';
327
+							} else {
328
+								$output .= '"squawk": "'.$spotter_item['squawk'].'",';
329
+							}
253 330
 						}
254 331
 						if (isset($spotter_item['squawk_usage'])) {
255 332
 							$output .= '"squawk_usage": "'.$spotter_item['squawk_usage'].'",';
@@ -267,8 +344,11 @@  discard block
 block discarded – undo
267 344
 							$output .= '"acars": "'.trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"), '<br />',$spotter_item['acars']['message'])).'",';
268 345
 						}
269 346
 						// type when not aircraft ?
270
-						if ($compress) $output .= '"t": "aircraft"';
271
-						else $output .= '"type": "aircraft"';
347
+						if ($compress) {
348
+							$output .= '"t": "aircraft"';
349
+						} else {
350
+							$output .= '"type": "aircraft"';
351
+						}
272 352
 						$output .= '},';
273 353
 						$output .= '"geometry": {';
274 354
 							$output .= '"type": "Point",';
@@ -335,7 +415,9 @@  discard block
 block discarded – undo
335 415
 			}
336 416
 */
337 417
 				$history = filter_input(INPUT_GET,'history',FILTER_SANITIZE_STRING);
338
-				if ($history == '' && isset($_COOKIE['history'])) $history = $_COOKIE['history'];
418
+				if ($history == '' && isset($_COOKIE['history'])) {
419
+					$history = $_COOKIE['history'];
420
+				}
339 421
 				
340 422
 				if ((isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true') 
341 423
 				|| (!isset($_COOKIE['flightpath']) 
@@ -357,8 +439,11 @@  discard block
 block discarded – undo
357 439
 						$output_history .= ']}},';
358 440
 						$output .= $output_history;
359 441
 					    }
360
-					    if ($compress) $output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history","a": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": [';
361
-					    else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": [';
442
+					    if ($compress) {
443
+					    	$output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history","a": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": [';
444
+					    } else {
445
+					    	$output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": [';
446
+					    }
362 447
 					}
363 448
 					$output_history .= '[';
364 449
 					$output_history .=  $spotter_history['longitude'].', ';
@@ -404,7 +489,9 @@  discard block
 block discarded – undo
404 489
 			$output .= ']';
405 490
 			$output .= ',"initial_sqltime": "'.$sqltime.'",';
406 491
 			$output .= '"totaltime": "'.round(microtime(true)-$begintime,2).'",';
407
-			if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",';
492
+			if (isset($begindate)) {
493
+				$output .= '"archive_date": "'.$begindate.'",';
494
+			}
408 495
 			$output .= '"fc": "'.$j.'"';
409 496
 		} else {
410 497
 			$output .= '"features": ';
Please login to merge, or discard this patch.
install/class.update_schema.php 3 patches
Indentation   +590 added lines, -590 removed lines patch added patch discarded remove patch
@@ -8,18 +8,18 @@  discard block
 block discarded – undo
8 8
 class update_schema {
9 9
 
10 10
 	public static function update_schedule() {
11
-	    $Connection = new Connection();
12
-	    $Schedule = new Schedule();
13
-	    $query = "SELECT * FROM schedule";
14
-            try {
15
-            	$sth = $Connection->db->prepare($query);
11
+		$Connection = new Connection();
12
+		$Schedule = new Schedule();
13
+		$query = "SELECT * FROM schedule";
14
+			try {
15
+				$sth = $Connection->db->prepare($query);
16 16
 		$sth->execute();
17
-    	    } catch(PDOException $e) {
17
+			} catch(PDOException $e) {
18 18
 		return "error : ".$e->getMessage()."\n";
19
-    	    }
20
-    	    while ($row = $sth->fetch(PDO::FETCH_ASSOC)) {
21
-    		$Schedule->addSchedule($row['ident'],$row['departure_airport_icao'],$row['departure_airport_time'],$row['arrival_airport_icao'],$row['arrival_airport_time']);
22
-    	    }
19
+			}
20
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC)) {
21
+			$Schedule->addSchedule($row['ident'],$row['departure_airport_icao'],$row['departure_airport_time'],$row['arrival_airport_icao'],$row['arrival_airport_time']);
22
+			}
23 23
 	
24 24
 	}
25 25
 /*
@@ -43,198 +43,198 @@  discard block
 block discarded – undo
43 43
     	}
44 44
 */	
45 45
 	private static function update_from_1() {
46
-    		$Connection = new Connection();
47
-    		// Add new column to routes table
48
-    		//$query = "ALTER TABLE `routes` ADD `FromAirport_Time` VARCHAR(10),`ToAirport_Time` VARCHAR(10),`Source` VARCHAR(255),`date_added` DATETIME DEFAULT CURRENT TIMESTAMP,`date_modified` DATETIME,`date_lastseen` DATETIME";
46
+			$Connection = new Connection();
47
+			// Add new column to routes table
48
+			//$query = "ALTER TABLE `routes` ADD `FromAirport_Time` VARCHAR(10),`ToAirport_Time` VARCHAR(10),`Source` VARCHAR(255),`date_added` DATETIME DEFAULT CURRENT TIMESTAMP,`date_modified` DATETIME,`date_lastseen` DATETIME";
49 49
 		$query = "ALTER TABLE `routes` ADD `FromAirport_Time` VARCHAR(10) NULL , ADD `ToAirport_Time` VARCHAR(10) NULL , ADD `Source` VARCHAR(255) NULL, ADD `date_added` timestamp DEFAULT CURRENT_TIMESTAMP, ADD `date_modified` timestamp NULL, ADD `date_lastseen` timestamp NULL";
50
-        	try {
51
-            	    $sth = $Connection->db->prepare($query);
52
-		    $sth->execute();
53
-    		} catch(PDOException $e) {
54
-		    return "error (add new columns to routes table) : ".$e->getMessage()."\n";
55
-    		}
56
-    		// Copy schedules data to routes table
57
-    		self::update_schedule();
58
-    		// Delete schedule table
50
+			try {
51
+					$sth = $Connection->db->prepare($query);
52
+			$sth->execute();
53
+			} catch(PDOException $e) {
54
+			return "error (add new columns to routes table) : ".$e->getMessage()."\n";
55
+			}
56
+			// Copy schedules data to routes table
57
+			self::update_schedule();
58
+			// Delete schedule table
59 59
 		$query = "DROP TABLE `schedule`";
60
-        	try {
61
-            	    $sth = $Connection->db->prepare($query);
62
-		    $sth->execute();
63
-    		} catch(PDOException $e) {
64
-		    return "error (delete schedule table) : ".$e->getMessage()."\n";
65
-    		}
66
-    		// Add source column
67
-    		$query = "ALTER TABLE `aircraft_modes` ADD `Source` VARCHAR(255) NULL";
68
-    		try {
69
-            	    $sth = $Connection->db->prepare($query);
70
-		    $sth->execute();
71
-    		} catch(PDOException $e) {
72
-		    return "error (add source column to aircraft_modes) : ".$e->getMessage()."\n";
73
-    		}
60
+			try {
61
+					$sth = $Connection->db->prepare($query);
62
+			$sth->execute();
63
+			} catch(PDOException $e) {
64
+			return "error (delete schedule table) : ".$e->getMessage()."\n";
65
+			}
66
+			// Add source column
67
+			$query = "ALTER TABLE `aircraft_modes` ADD `Source` VARCHAR(255) NULL";
68
+			try {
69
+					$sth = $Connection->db->prepare($query);
70
+			$sth->execute();
71
+			} catch(PDOException $e) {
72
+			return "error (add source column to aircraft_modes) : ".$e->getMessage()."\n";
73
+			}
74 74
 		// Delete unused column
75 75
 		$query = "ALTER TABLE `aircraft_modes`  DROP `SerialNo`,  DROP `OperatorFlagCode`,  DROP `Manufacturer`,  DROP `Type`,  DROP `FirstRegDate`,  DROP `CurrentRegDate`,  DROP `Country`,  DROP `PreviousID`,  DROP `DeRegDate`,  DROP `Status`,  DROP `PopularName`,  DROP `GenericName`,  DROP `AircraftClass`,  DROP `Engines`,  DROP `OwnershipStatus`,  DROP `RegisteredOwners`,  DROP `MTOW`,  DROP `TotalHours`,  DROP `YearBuilt`,  DROP `CofACategory`,  DROP `CofAExpiry`,  DROP `UserNotes`,  DROP `Interested`,  DROP `UserTag`,  DROP `InfoUrl`,  DROP `PictureUrl1`,  DROP `PictureUrl2`,  DROP `PictureUrl3`,  DROP `UserBool1`,  DROP `UserBool2`,  DROP `UserBool3`,  DROP `UserBool4`,  DROP `UserBool5`,  DROP `UserString1`,  DROP `UserString2`,  DROP `UserString3`,  DROP `UserString4`,  DROP `UserString5`,  DROP `UserInt1`,  DROP `UserInt2`,  DROP `UserInt3`,  DROP `UserInt4`,  DROP `UserInt5`";
76
-    		try {
77
-            	    $sth = $Connection->db->prepare($query);
78
-		    $sth->execute();
79
-    		} catch(PDOException $e) {
80
-		    return "error (Delete unused column of aircraft_modes) : ".$e->getMessage()."\n";
81
-    		}
76
+			try {
77
+					$sth = $Connection->db->prepare($query);
78
+			$sth->execute();
79
+			} catch(PDOException $e) {
80
+			return "error (Delete unused column of aircraft_modes) : ".$e->getMessage()."\n";
81
+			}
82 82
 		// Add ModeS column
83 83
 		$query = "ALTER TABLE `spotter_output`  ADD `ModeS` VARCHAR(255) NULL";
84
-    		try {
85
-            	    $sth = $Connection->db->prepare($query);
86
-		    $sth->execute();
87
-    		} catch(PDOException $e) {
88
-		    return "error (Add ModeS column in spotter_output) : ".$e->getMessage()."\n";
89
-    		}
84
+			try {
85
+					$sth = $Connection->db->prepare($query);
86
+			$sth->execute();
87
+			} catch(PDOException $e) {
88
+			return "error (Add ModeS column in spotter_output) : ".$e->getMessage()."\n";
89
+			}
90 90
 		$query = "ALTER TABLE `spotter_live`  ADD `ModeS` VARCHAR(255)";
91
-    		try {
92
-            	    $sth = $Connection->db->prepare($query);
93
-		    $sth->execute();
94
-    		} catch(PDOException $e) {
95
-		    return "error (Add ModeS column in spotter_live) : ".$e->getMessage()."\n";
96
-    		}
97
-    		// Add auto_increment for aircraft_modes
98
-    		$query = "ALTER TABLE `aircraft_modes` CHANGE `AircraftID` `AircraftID` INT(11) NOT NULL AUTO_INCREMENT";
99
-    		try {
100
-            	    $sth = $Connection->db->prepare($query);
101
-		    $sth->execute();
102
-    		} catch(PDOException $e) {
103
-		    return "error (Add Auto increment in aircraft_modes) : ".$e->getMessage()."\n";
104
-    		}
105
-    		$error = '';
91
+			try {
92
+					$sth = $Connection->db->prepare($query);
93
+			$sth->execute();
94
+			} catch(PDOException $e) {
95
+			return "error (Add ModeS column in spotter_live) : ".$e->getMessage()."\n";
96
+			}
97
+			// Add auto_increment for aircraft_modes
98
+			$query = "ALTER TABLE `aircraft_modes` CHANGE `AircraftID` `AircraftID` INT(11) NOT NULL AUTO_INCREMENT";
99
+			try {
100
+					$sth = $Connection->db->prepare($query);
101
+			$sth->execute();
102
+			} catch(PDOException $e) {
103
+			return "error (Add Auto increment in aircraft_modes) : ".$e->getMessage()."\n";
104
+			}
105
+			$error = '';
106 106
 		$error .= create_db::import_file('../db/acars_live.sql');
107 107
 		$error .= create_db::import_file('../db/config.sql');
108 108
 		// Update schema_version to 2
109 109
 		$query = "UPDATE `config` SET `value` = '2' WHERE `name` = 'schema_version'";
110
-        	try {
111
-            	    $sth = $Connection->db->prepare($query);
112
-		    $sth->execute();
113
-    		} catch(PDOException $e) {
114
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
115
-    		}
110
+			try {
111
+					$sth = $Connection->db->prepare($query);
112
+			$sth->execute();
113
+			} catch(PDOException $e) {
114
+			return "error (update schema_version) : ".$e->getMessage()."\n";
115
+			}
116 116
 		return $error;
117
-        }
117
+		}
118 118
 
119 119
 	private static function update_from_2() {
120
-    		$Connection = new Connection();
121
-    		// Add new column decode to acars_live table
120
+			$Connection = new Connection();
121
+			// Add new column decode to acars_live table
122 122
 		$query = "ALTER TABLE `acars_live` ADD `decode` TEXT";
123
-        	try {
124
-            	    $sth = $Connection->db->prepare($query);
125
-		    $sth->execute();
126
-    		} catch(PDOException $e) {
127
-		    return "error (add new columns to routes table) : ".$e->getMessage()."\n";
128
-    		}
129
-    		$error = '';
130
-    		// Create table acars_archive
123
+			try {
124
+					$sth = $Connection->db->prepare($query);
125
+			$sth->execute();
126
+			} catch(PDOException $e) {
127
+			return "error (add new columns to routes table) : ".$e->getMessage()."\n";
128
+			}
129
+			$error = '';
130
+			// Create table acars_archive
131 131
 		$error .= create_db::import_file('../db/acars_archive.sql');
132 132
 		// Update schema_version to 3
133 133
 		$query = "UPDATE `config` SET `value` = '3' WHERE `name` = 'schema_version'";
134
-        	try {
135
-            	    $sth = $Connection->db->prepare($query);
136
-		    $sth->execute();
137
-    		} catch(PDOException $e) {
138
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
139
-    		}
134
+			try {
135
+					$sth = $Connection->db->prepare($query);
136
+			$sth->execute();
137
+			} catch(PDOException $e) {
138
+			return "error (update schema_version) : ".$e->getMessage()."\n";
139
+			}
140 140
 		return $error;
141 141
 	}
142 142
 
143 143
 	private static function update_from_3() {
144
-    		$Connection = new Connection();
145
-    		// Add default CURRENT_TIMESTAMP to aircraft_modes column FirstCreated
144
+			$Connection = new Connection();
145
+			// Add default CURRENT_TIMESTAMP to aircraft_modes column FirstCreated
146 146
 		$query = "ALTER TABLE `aircraft_modes` CHANGE `FirstCreated` `FirstCreated` timestamp DEFAULT CURRENT_TIMESTAMP";
147
-        	try {
148
-            	    $sth = $Connection->db->prepare($query);
149
-		    $sth->execute();
150
-    		} catch(PDOException $e) {
151
-		    return "error (add new columns to aircraft_modes) : ".$e->getMessage()."\n";
152
-    		}
153
-    		// Add image_source_website column to spotter_image
147
+			try {
148
+					$sth = $Connection->db->prepare($query);
149
+			$sth->execute();
150
+			} catch(PDOException $e) {
151
+			return "error (add new columns to aircraft_modes) : ".$e->getMessage()."\n";
152
+			}
153
+			// Add image_source_website column to spotter_image
154 154
 		$query = "ALTER TABLE `spotter_image` ADD `image_source_website` VARCHAR(999) NULL";
155
-        	try {
156
-            	    $sth = $Connection->db->prepare($query);
157
-		    $sth->execute();
158
-    		} catch(PDOException $e) {
159
-		    return "error (add new columns to spotter_image) : ".$e->getMessage()."\n";
160
-    		}
161
-    		$error = '';
155
+			try {
156
+					$sth = $Connection->db->prepare($query);
157
+			$sth->execute();
158
+			} catch(PDOException $e) {
159
+			return "error (add new columns to spotter_image) : ".$e->getMessage()."\n";
160
+			}
161
+			$error = '';
162 162
 		// Update schema_version to 4
163 163
 		$query = "UPDATE `config` SET `value` = '4' WHERE `name` = 'schema_version'";
164
-        	try {
165
-            	    $sth = $Connection->db->prepare($query);
166
-		    $sth->execute();
167
-    		} catch(PDOException $e) {
168
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
169
-    		}
164
+			try {
165
+					$sth = $Connection->db->prepare($query);
166
+			$sth->execute();
167
+			} catch(PDOException $e) {
168
+			return "error (update schema_version) : ".$e->getMessage()."\n";
169
+			}
170 170
 		return $error;
171 171
 	}
172 172
 	
173 173
 	private static function update_from_4() {
174
-    		$Connection = new Connection();
174
+			$Connection = new Connection();
175 175
 	
176
-    		$error = '';
177
-    		// Create table acars_label
176
+			$error = '';
177
+			// Create table acars_label
178 178
 		$error .= create_db::import_file('../db/acars_label.sql');
179 179
 		if ($error == '') {
180
-		    // Update schema_version to 5
181
-		    $query = "UPDATE `config` SET `value` = '5' WHERE `name` = 'schema_version'";
182
-        	    try {
183
-            		$sth = $Connection->db->prepare($query);
180
+			// Update schema_version to 5
181
+			$query = "UPDATE `config` SET `value` = '5' WHERE `name` = 'schema_version'";
182
+				try {
183
+					$sth = $Connection->db->prepare($query);
184 184
 			$sth->execute();
185
-    		    } catch(PDOException $e) {
185
+				} catch(PDOException $e) {
186 186
 			return "error (update schema_version) : ".$e->getMessage()."\n";
187
-    		    }
188
-    		}
187
+				}
188
+			}
189 189
 		return $error;
190 190
 	}
191 191
 
192 192
 	private static function update_from_5() {
193
-    		$Connection = new Connection();
194
-    		// Add columns to translation
193
+			$Connection = new Connection();
194
+			// Add columns to translation
195 195
 		$query = "ALTER TABLE `translation` ADD `Source` VARCHAR(255) NULL, ADD `date_added` timestamp DEFAULT CURRENT_TIMESTAMP , ADD `date_modified` timestamp DEFAULT CURRENT_TIMESTAMP ;";
196
-        	try {
197
-            	    $sth = $Connection->db->prepare($query);
198
-		    $sth->execute();
199
-    		} catch(PDOException $e) {
200
-		    return "error (add new columns to translation) : ".$e->getMessage()."\n";
201
-    		}
202
-    		// Add aircraft_shadow column to aircraft
203
-    		$query = "ALTER TABLE `aircraft` ADD `aircraft_shadow` VARCHAR(255) NULL";
204
-        	try {
205
-            	    $sth = $Connection->db->prepare($query);
206
-		    $sth->execute();
207
-    		} catch(PDOException $e) {
208
-		    return "error (add new column to aircraft) : ".$e->getMessage()."\n";
209
-    		}
210
-    		// Add aircraft_shadow column to spotter_live
211
-    		$query = "ALTER TABLE `spotter_live` ADD `aircraft_shadow` VARCHAR(255) NULL";
212
-        	try {
213
-            	    $sth = $Connection->db->prepare($query);
214
-		    $sth->execute();
215
-    		} catch(PDOException $e) {
216
-		    return "error (add new column to spotter_live) : ".$e->getMessage()."\n";
217
-    		}
218
-    		$error = '';
219
-    		// Update table aircraft
196
+			try {
197
+					$sth = $Connection->db->prepare($query);
198
+			$sth->execute();
199
+			} catch(PDOException $e) {
200
+			return "error (add new columns to translation) : ".$e->getMessage()."\n";
201
+			}
202
+			// Add aircraft_shadow column to aircraft
203
+			$query = "ALTER TABLE `aircraft` ADD `aircraft_shadow` VARCHAR(255) NULL";
204
+			try {
205
+					$sth = $Connection->db->prepare($query);
206
+			$sth->execute();
207
+			} catch(PDOException $e) {
208
+			return "error (add new column to aircraft) : ".$e->getMessage()."\n";
209
+			}
210
+			// Add aircraft_shadow column to spotter_live
211
+			$query = "ALTER TABLE `spotter_live` ADD `aircraft_shadow` VARCHAR(255) NULL";
212
+			try {
213
+					$sth = $Connection->db->prepare($query);
214
+			$sth->execute();
215
+			} catch(PDOException $e) {
216
+			return "error (add new column to spotter_live) : ".$e->getMessage()."\n";
217
+			}
218
+			$error = '';
219
+			// Update table aircraft
220 220
 		$error .= create_db::import_file('../db/aircraft.sql');
221 221
 		$error .= create_db::import_file('../db/spotter_archive.sql');
222 222
 
223 223
 		// Update schema_version to 6
224 224
 		$query = "UPDATE `config` SET `value` = '6' WHERE `name` = 'schema_version'";
225
-        	try {
226
-            	    $sth = $Connection->db->prepare($query);
227
-		    $sth->execute();
228
-    		} catch(PDOException $e) {
229
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
230
-    		}
225
+			try {
226
+					$sth = $Connection->db->prepare($query);
227
+			$sth->execute();
228
+			} catch(PDOException $e) {
229
+			return "error (update schema_version) : ".$e->getMessage()."\n";
230
+			}
231 231
 		return $error;
232 232
 	}
233 233
 
234 234
 	private static function update_from_6() {
235
-    		$Connection = new Connection();
236
-    		if (!$Connection->indexExists('spotter_output','flightaware_id')) {
237
-    		    $query = "ALTER TABLE spotter_output ADD INDEX(flightaware_id);
235
+			$Connection = new Connection();
236
+			if (!$Connection->indexExists('spotter_output','flightaware_id')) {
237
+				$query = "ALTER TABLE spotter_output ADD INDEX(flightaware_id);
238 238
 			ALTER TABLE spotter_output ADD INDEX(date);
239 239
 			ALTER TABLE spotter_output ADD INDEX(ident);
240 240
 			ALTER TABLE spotter_live ADD INDEX(flightaware_id);
@@ -247,147 +247,147 @@  discard block
 block discarded – undo
247 247
 			ALTER TABLE aircraft ADD INDEX(icao);
248 248
 			ALTER TABLE airport ADD INDEX(icao);
249 249
 			ALTER TABLE translation ADD INDEX(Operator);";
250
-        	    try {
251
-            		$sth = $Connection->db->prepare($query);
250
+				try {
251
+					$sth = $Connection->db->prepare($query);
252 252
 			$sth->execute();
253
-    		    } catch(PDOException $e) {
253
+				} catch(PDOException $e) {
254 254
 			return "error (add some indexes) : ".$e->getMessage()."\n";
255
-    		    }
256
-    		}
257
-    		$error = '';
258
-    		// Update table countries
259
-    		if ($Connection->tableExists('airspace')) {
260
-    		    $error .= update_db::update_countries();
261
-		    if ($error != '') return $error;
255
+				}
256
+			}
257
+			$error = '';
258
+			// Update table countries
259
+			if ($Connection->tableExists('airspace')) {
260
+				$error .= update_db::update_countries();
261
+			if ($error != '') return $error;
262 262
 		}
263 263
 		// Update schema_version to 7
264 264
 		$query = "UPDATE `config` SET `value` = '7' WHERE `name` = 'schema_version'";
265
-        	try {
266
-            	    $sth = $Connection->db->prepare($query);
267
-		    $sth->execute();
268
-    		} catch(PDOException $e) {
269
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
270
-    		}
265
+			try {
266
+					$sth = $Connection->db->prepare($query);
267
+			$sth->execute();
268
+			} catch(PDOException $e) {
269
+			return "error (update schema_version) : ".$e->getMessage()."\n";
270
+			}
271 271
 		return $error;
272
-    	}
272
+		}
273 273
 
274 274
 	private static function update_from_7() {
275 275
 		global $globalDBname, $globalDBdriver;
276
-    		$Connection = new Connection();
277
-    		$query="ALTER TABLE spotter_live ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL;
276
+			$Connection = new Connection();
277
+			$query="ALTER TABLE spotter_live ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL;
278 278
     			ALTER TABLE spotter_output ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL;";
279
-        	try {
280
-            	    $sth = $Connection->db->prepare($query);
281
-		    $sth->execute();
282
-    		} catch(PDOException $e) {
283
-		    return "error (add pilot column to spotter_live and spotter_output) : ".$e->getMessage()."\n";
284
-    		}
285
-    		if ($globalDBdriver == 'mysql') {
286
-    		    $query = "SELECT ENGINE FROM information_schema.TABLES where TABLE_SCHEMA = '".$globalDBname."' AND TABLE_NAME = 'spotter_archive'";
287
-		    try {
288
-            		$sth = $Connection->db->prepare($query);
279
+			try {
280
+					$sth = $Connection->db->prepare($query);
281
+			$sth->execute();
282
+			} catch(PDOException $e) {
283
+			return "error (add pilot column to spotter_live and spotter_output) : ".$e->getMessage()."\n";
284
+			}
285
+			if ($globalDBdriver == 'mysql') {
286
+				$query = "SELECT ENGINE FROM information_schema.TABLES where TABLE_SCHEMA = '".$globalDBname."' AND TABLE_NAME = 'spotter_archive'";
287
+			try {
288
+					$sth = $Connection->db->prepare($query);
289 289
 			$sth->execute();
290
-    		    } catch(PDOException $e) {
290
+				} catch(PDOException $e) {
291 291
 			return "error (problem when select engine for spotter_engine) : ".$e->getMessage()."\n";
292
-    		    }
293
-    		    $row = $sth->fetch(PDO::FETCH_ASSOC);
294
-    		    if ($row['engine'] == 'ARCHIVE') {
292
+				}
293
+				$row = $sth->fetch(PDO::FETCH_ASSOC);
294
+				if ($row['engine'] == 'ARCHIVE') {
295 295
 			$query = "CREATE TABLE copy LIKE spotter_archive; 
296 296
 				ALTER TABLE copy ENGINE=ARCHIVE;
297 297
 				ALTER TABLE copy ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL;
298 298
 				INSERT INTO copy SELECT *, '' as pilot_name, '' as pilot_id FROM spotter_archive ORDER BY `spotter_archive_id`;
299 299
 				DROP TABLE spotter_archive;
300 300
 				RENAME TABLE copy TO spotter_archive;";
301
-            	    } else {
302
-    			$query="ALTER TABLE spotter_archive ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL";
303
-            	    }
304
-                } else {
305
-    		    $query="ALTER TABLE spotter_archive ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL";
306
-                }
307
-        	try {
308
-            	    $sth = $Connection->db->prepare($query);
309
-		    $sth->execute();
310
-    		} catch(PDOException $e) {
311
-		    return "error (add pilot column to spotter_archive) : ".$e->getMessage()."\n";
312
-    		}
301
+					} else {
302
+				$query="ALTER TABLE spotter_archive ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL";
303
+					}
304
+				} else {
305
+				$query="ALTER TABLE spotter_archive ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL";
306
+				}
307
+			try {
308
+					$sth = $Connection->db->prepare($query);
309
+			$sth->execute();
310
+			} catch(PDOException $e) {
311
+			return "error (add pilot column to spotter_archive) : ".$e->getMessage()."\n";
312
+			}
313 313
 
314
-    		$error = '';
315
-    		// Update table aircraft
314
+			$error = '';
315
+			// Update table aircraft
316 316
 		$error .= create_db::import_file('../db/source_location.sql');
317 317
 		if ($error != '') return $error;
318 318
 		// Update schema_version to 6
319 319
 		$query = "UPDATE `config` SET `value` = '8' WHERE `name` = 'schema_version'";
320
-        	try {
321
-            	    $sth = $Connection->db->prepare($query);
322
-		    $sth->execute();
323
-    		} catch(PDOException $e) {
324
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
325
-    		}
320
+			try {
321
+					$sth = $Connection->db->prepare($query);
322
+			$sth->execute();
323
+			} catch(PDOException $e) {
324
+			return "error (update schema_version) : ".$e->getMessage()."\n";
325
+			}
326 326
 		return $error;
327 327
 	}
328 328
 
329 329
 	private static function update_from_8() {
330
-    		$Connection = new Connection();
331
-    		$error = '';
332
-    		// Update table aircraft
330
+			$Connection = new Connection();
331
+			$error = '';
332
+			// Update table aircraft
333 333
 		$error .= create_db::import_file('../db/notam.sql');
334 334
 		if ($error != '') return $error;
335 335
 		$query = "DELETE FROM config WHERE name = 'last_update_db';
336 336
                         INSERT INTO config (name,value) VALUES ('last_update_db',NOW());
337 337
                         DELETE FROM config WHERE name = 'last_update_notam_db';
338 338
                         INSERT INTO config (name,value) VALUES ('last_update_notam_db',NOW());";
339
-        	try {
340
-            	    $sth = $Connection->db->prepare($query);
341
-		    $sth->execute();
342
-    		} catch(PDOException $e) {
343
-		    return "error (insert last_update values) : ".$e->getMessage()."\n";
344
-    		}
339
+			try {
340
+					$sth = $Connection->db->prepare($query);
341
+			$sth->execute();
342
+			} catch(PDOException $e) {
343
+			return "error (insert last_update values) : ".$e->getMessage()."\n";
344
+			}
345 345
 		$query = "UPDATE `config` SET `value` = '9' WHERE `name` = 'schema_version'";
346
-        	try {
347
-            	    $sth = $Connection->db->prepare($query);
348
-		    $sth->execute();
349
-    		} catch(PDOException $e) {
350
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
351
-    		}
346
+			try {
347
+					$sth = $Connection->db->prepare($query);
348
+			$sth->execute();
349
+			} catch(PDOException $e) {
350
+			return "error (update schema_version) : ".$e->getMessage()."\n";
351
+			}
352 352
 		return $error;
353 353
 	}
354 354
 
355 355
 	private static function update_from_9() {
356
-    		$Connection = new Connection();
357
-    		$query="ALTER TABLE spotter_live ADD verticalrate INT(11) NULL;
356
+			$Connection = new Connection();
357
+			$query="ALTER TABLE spotter_live ADD verticalrate INT(11) NULL;
358 358
     			ALTER TABLE spotter_output ADD verticalrate INT(11) NULL;";
359
-        	try {
360
-            	    $sth = $Connection->db->prepare($query);
361
-		    $sth->execute();
362
-    		} catch(PDOException $e) {
363
-		    return "error (add verticalrate column to spotter_live and spotter_output) : ".$e->getMessage()."\n";
364
-    		}
359
+			try {
360
+					$sth = $Connection->db->prepare($query);
361
+			$sth->execute();
362
+			} catch(PDOException $e) {
363
+			return "error (add verticalrate column to spotter_live and spotter_output) : ".$e->getMessage()."\n";
364
+			}
365 365
 		$error = '';
366
-    		// Update table atc
366
+			// Update table atc
367 367
 		$error .= create_db::import_file('../db/atc.sql');
368 368
 		if ($error != '') return $error;
369 369
 		
370 370
 		$query = "UPDATE `config` SET `value` = '10' WHERE `name` = 'schema_version'";
371
-        	try {
372
-            	    $sth = $Connection->db->prepare($query);
373
-		    $sth->execute();
374
-    		} catch(PDOException $e) {
375
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
376
-    		}
371
+			try {
372
+					$sth = $Connection->db->prepare($query);
373
+			$sth->execute();
374
+			} catch(PDOException $e) {
375
+			return "error (update schema_version) : ".$e->getMessage()."\n";
376
+			}
377 377
 		return $error;
378 378
 	}
379 379
 
380 380
 	private static function update_from_10() {
381
-    		$Connection = new Connection();
382
-    		$query="ALTER TABLE atc CHANGE `type` `type` ENUM('Observer','Flight Information','Delivery','Tower','Approach','ACC','Departure','Ground','Flight Service Station','Control Radar or Centre') CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL";
383
-        	try {
384
-            	    $sth = $Connection->db->prepare($query);
385
-		    $sth->execute();
386
-    		} catch(PDOException $e) {
387
-		    return "error (add new enum to ATC table) : ".$e->getMessage()."\n";
388
-    		}
381
+			$Connection = new Connection();
382
+			$query="ALTER TABLE atc CHANGE `type` `type` ENUM('Observer','Flight Information','Delivery','Tower','Approach','ACC','Departure','Ground','Flight Service Station','Control Radar or Centre') CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL";
383
+			try {
384
+					$sth = $Connection->db->prepare($query);
385
+			$sth->execute();
386
+			} catch(PDOException $e) {
387
+			return "error (add new enum to ATC table) : ".$e->getMessage()."\n";
388
+			}
389 389
 		$error = '';
390
-    		// Add tables
390
+			// Add tables
391 391
 		$error .= create_db::import_file('../db/aircraft_owner.sql');
392 392
 		if ($error != '') return $error;
393 393
 		$error .= create_db::import_file('../db/metar.sql');
@@ -398,76 +398,76 @@  discard block
 block discarded – undo
398 398
 		if ($error != '') return $error;
399 399
 		
400 400
 		$query = "UPDATE `config` SET `value` = '11' WHERE `name` = 'schema_version'";
401
-        	try {
402
-            	    $sth = $Connection->db->prepare($query);
403
-		    $sth->execute();
404
-    		} catch(PDOException $e) {
405
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
406
-    		}
401
+			try {
402
+					$sth = $Connection->db->prepare($query);
403
+			$sth->execute();
404
+			} catch(PDOException $e) {
405
+			return "error (update schema_version) : ".$e->getMessage()."\n";
406
+			}
407 407
 		return $error;
408 408
 	}
409 409
 
410 410
 	private static function update_from_11() {
411 411
 		global $globalDBdriver, $globalDBname;
412
-    		$Connection = new Connection();
413
-    		$query="ALTER TABLE spotter_output ADD owner_name VARCHAR(255) NULL DEFAULT NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE, ADD last_ground BOOLEAN NOT NULL DEFAULT FALSE, ADD last_seen DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, ADD last_latitude FLOAT NULL, ADD last_longitude FLOAT NULL, ADD last_altitude INT(11) NULL, ADD last_ground_speed INT(11), ADD real_arrival_airport_icao VARCHAR(999), ADD real_arrival_airport_time VARCHAR(20),ADD real_departure_airport_icao VARCHAR(999), ADD real_departure_airport_time VARCHAR(20)";
414
-        	try {
415
-            	    $sth = $Connection->db->prepare($query);
416
-		    $sth->execute();
417
-    		} catch(PDOException $e) {
418
-		    return "error (add owner_name & format_source column to spotter_output) : ".$e->getMessage()."\n";
419
-    		}
420
-    		$query="ALTER TABLE spotter_live ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE";
421
-        	try {
422
-            	    $sth = $Connection->db->prepare($query);
423
-		    $sth->execute();
424
-    		} catch(PDOException $e) {
425
-		    return "error (format_source column to spotter_live) : ".$e->getMessage()."\n";
426
-    		}
427
-    		if ($globalDBdriver == 'mysql') {
428
-    		    $query = "SELECT ENGINE FROM information_schema.TABLES where TABLE_SCHEMA = '".$globalDBname."' AND TABLE_NAME = 'spotter_archive'";
429
-		    try {
430
-            		$sth = $Connection->db->prepare($query);
412
+			$Connection = new Connection();
413
+			$query="ALTER TABLE spotter_output ADD owner_name VARCHAR(255) NULL DEFAULT NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE, ADD last_ground BOOLEAN NOT NULL DEFAULT FALSE, ADD last_seen DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, ADD last_latitude FLOAT NULL, ADD last_longitude FLOAT NULL, ADD last_altitude INT(11) NULL, ADD last_ground_speed INT(11), ADD real_arrival_airport_icao VARCHAR(999), ADD real_arrival_airport_time VARCHAR(20),ADD real_departure_airport_icao VARCHAR(999), ADD real_departure_airport_time VARCHAR(20)";
414
+			try {
415
+					$sth = $Connection->db->prepare($query);
431 416
 			$sth->execute();
432
-    		    } catch(PDOException $e) {
417
+			} catch(PDOException $e) {
418
+			return "error (add owner_name & format_source column to spotter_output) : ".$e->getMessage()."\n";
419
+			}
420
+			$query="ALTER TABLE spotter_live ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE";
421
+			try {
422
+					$sth = $Connection->db->prepare($query);
423
+			$sth->execute();
424
+			} catch(PDOException $e) {
425
+			return "error (format_source column to spotter_live) : ".$e->getMessage()."\n";
426
+			}
427
+			if ($globalDBdriver == 'mysql') {
428
+				$query = "SELECT ENGINE FROM information_schema.TABLES where TABLE_SCHEMA = '".$globalDBname."' AND TABLE_NAME = 'spotter_archive'";
429
+			try {
430
+					$sth = $Connection->db->prepare($query);
431
+			$sth->execute();
432
+				} catch(PDOException $e) {
433 433
 			return "error (problem when select engine for spotter_engine) : ".$e->getMessage()."\n";
434
-    		    }
435
-    		    $row = $sth->fetch(PDO::FETCH_ASSOC);
436
-    		    if ($row['engine'] == 'ARCHIVE') {
434
+				}
435
+				$row = $sth->fetch(PDO::FETCH_ASSOC);
436
+				if ($row['engine'] == 'ARCHIVE') {
437 437
 			$query = "CREATE TABLE copy LIKE spotter_archive; 
438 438
 				ALTER TABLE copy ENGINE=ARCHIVE;
439 439
 				ALTER TABLE copy ADD verticalrate INT(11) NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE;
440 440
 				INSERT INTO copy SELECT *, '' as verticalrate, '' as format_source, '0' as ground FROM spotter_archive ORDER BY `spotter_archive_id`;
441 441
 				DROP TABLE spotter_archive;
442 442
 				RENAME TABLE copy TO spotter_archive;";
443
-            	    } else {
444
-    			$query="ALTER TABLE spotter_archive ADD verticalrate INT(11) NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE";
445
-            	    }
446
-                } else {
447
-    		    $query="ALTER TABLE spotter_archive ADD verticalrate INT(11) NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE";
448
-                }
449
-        	try {
450
-            	    $sth = $Connection->db->prepare($query);
451
-		    $sth->execute();
452
-    		} catch(PDOException $e) {
453
-		    return "error (add columns to spotter_archive) : ".$e->getMessage()."\n";
454
-    		}
443
+					} else {
444
+				$query="ALTER TABLE spotter_archive ADD verticalrate INT(11) NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE";
445
+					}
446
+				} else {
447
+				$query="ALTER TABLE spotter_archive ADD verticalrate INT(11) NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE";
448
+				}
449
+			try {
450
+					$sth = $Connection->db->prepare($query);
451
+			$sth->execute();
452
+			} catch(PDOException $e) {
453
+			return "error (add columns to spotter_archive) : ".$e->getMessage()."\n";
454
+			}
455 455
 
456 456
 		$error = '';
457 457
 		
458 458
 		$query = "UPDATE `config` SET `value` = '12' WHERE `name` = 'schema_version'";
459
-        	try {
460
-            	    $sth = $Connection->db->prepare($query);
461
-		    $sth->execute();
462
-    		} catch(PDOException $e) {
463
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
464
-    		}
459
+			try {
460
+					$sth = $Connection->db->prepare($query);
461
+			$sth->execute();
462
+			} catch(PDOException $e) {
463
+			return "error (update schema_version) : ".$e->getMessage()."\n";
464
+			}
465 465
 		return $error;
466 466
 	}
467 467
 	private static function update_from_12() {
468
-    		$Connection = new Connection();
468
+			$Connection = new Connection();
469 469
 		$error = '';
470
-    		// Add tables
470
+			// Add tables
471 471
 		$error .= create_db::import_file('../db/stats.sql');
472 472
 		if ($error != '') return $error;
473 473
 		$error .= create_db::import_file('../db/stats_aircraft.sql');
@@ -484,166 +484,166 @@  discard block
 block discarded – undo
484 484
 		if ($error != '') return $error;
485 485
 		
486 486
 		$query = "UPDATE `config` SET `value` = '13' WHERE `name` = 'schema_version'";
487
-        	try {
488
-            	    $sth = $Connection->db->prepare($query);
489
-		    $sth->execute();
490
-    		} catch(PDOException $e) {
491
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
492
-    		}
487
+			try {
488
+					$sth = $Connection->db->prepare($query);
489
+			$sth->execute();
490
+			} catch(PDOException $e) {
491
+			return "error (update schema_version) : ".$e->getMessage()."\n";
492
+			}
493 493
 		return $error;
494 494
 	}
495 495
 
496 496
 	private static function update_from_13() {
497
-    		$Connection = new Connection();
498
-    		if (!$Connection->checkColumnName('spotter_archive_output','real_departure_airport_icao')) {
499
-    			$query="ALTER TABLE spotter_archive_output ADD real_departure_airport_icao VARCHAR(20), ADD real_departure_airport_time VARCHAR(20)";
497
+			$Connection = new Connection();
498
+			if (!$Connection->checkColumnName('spotter_archive_output','real_departure_airport_icao')) {
499
+				$query="ALTER TABLE spotter_archive_output ADD real_departure_airport_icao VARCHAR(20), ADD real_departure_airport_time VARCHAR(20)";
500 500
 			try {
501 501
 				$sth = $Connection->db->prepare($query);
502 502
 				$sth->execute();
503
-	    		} catch(PDOException $e) {
503
+				} catch(PDOException $e) {
504 504
 				return "error (update spotter_archive_output) : ".$e->getMessage()."\n";
505
-    			}
505
+				}
506 506
 		}
507
-    		$error = '';
507
+			$error = '';
508 508
 		$query = "UPDATE `config` SET `value` = '14' WHERE `name` = 'schema_version'";
509
-        	try {
510
-            	    $sth = $Connection->db->prepare($query);
511
-		    $sth->execute();
512
-    		} catch(PDOException $e) {
513
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
514
-    		}
509
+			try {
510
+					$sth = $Connection->db->prepare($query);
511
+			$sth->execute();
512
+			} catch(PDOException $e) {
513
+			return "error (update schema_version) : ".$e->getMessage()."\n";
514
+			}
515 515
 		return $error;
516 516
 	}
517 517
 
518 518
 	private static function update_from_14() {
519
-    		$Connection = new Connection();
519
+			$Connection = new Connection();
520 520
 		$error = '';
521
-    		// Add tables
522
-    		if (!$Connection->tableExists('stats_flight')) {
521
+			// Add tables
522
+			if (!$Connection->tableExists('stats_flight')) {
523 523
 			$error .= create_db::import_file('../db/stats_flight.sql');
524 524
 			if ($error != '') return $error;
525 525
 		}
526 526
 		$query = "UPDATE `config` SET `value` = '15' WHERE `name` = 'schema_version'";
527
-        	try {
528
-            	    $sth = $Connection->db->prepare($query);
529
-		    $sth->execute();
530
-    		} catch(PDOException $e) {
531
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
532
-    		}
527
+			try {
528
+					$sth = $Connection->db->prepare($query);
529
+			$sth->execute();
530
+			} catch(PDOException $e) {
531
+			return "error (update schema_version) : ".$e->getMessage()."\n";
532
+			}
533 533
 		return $error;
534 534
 	}
535 535
 
536 536
 
537 537
 	private static function update_from_15() {
538
-    		$Connection = new Connection();
538
+			$Connection = new Connection();
539 539
 		$error = '';
540
-    		// Add tables
541
-    		$query="ALTER TABLE `stats` CHANGE `stats_date` `stats_date` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP";
542
-        	try {
543
-            	    $sth = $Connection->db->prepare($query);
544
-		    $sth->execute();
545
-    		} catch(PDOException $e) {
546
-		    return "error (update stats) : ".$e->getMessage()."\n";
547
-    		}
540
+			// Add tables
541
+			$query="ALTER TABLE `stats` CHANGE `stats_date` `stats_date` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP";
542
+			try {
543
+					$sth = $Connection->db->prepare($query);
544
+			$sth->execute();
545
+			} catch(PDOException $e) {
546
+			return "error (update stats) : ".$e->getMessage()."\n";
547
+			}
548 548
 		if ($error != '') return $error;
549 549
 		$query = "UPDATE `config` SET `value` = '16' WHERE `name` = 'schema_version'";
550
-        	try {
551
-            	    $sth = $Connection->db->prepare($query);
552
-		    $sth->execute();
553
-    		} catch(PDOException $e) {
554
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
555
-    		}
550
+			try {
551
+					$sth = $Connection->db->prepare($query);
552
+			$sth->execute();
553
+			} catch(PDOException $e) {
554
+			return "error (update schema_version) : ".$e->getMessage()."\n";
555
+			}
556 556
 		return $error;
557 557
 	}
558 558
 
559 559
 	private static function update_from_16() {
560
-    		$Connection = new Connection();
560
+			$Connection = new Connection();
561 561
 		$error = '';
562
-    		// Add tables
563
-    		if (!$Connection->tableExists('stats_registration')) {
562
+			// Add tables
563
+			if (!$Connection->tableExists('stats_registration')) {
564 564
 			$error .= create_db::import_file('../db/stats_registration.sql');
565 565
 		}
566
-    		if (!$Connection->tableExists('stats_callsign')) {
566
+			if (!$Connection->tableExists('stats_callsign')) {
567 567
 			$error .= create_db::import_file('../db/stats_callsign.sql');
568 568
 		}
569 569
 		if ($error != '') return $error;
570 570
 		$query = "UPDATE `config` SET `value` = '17' WHERE `name` = 'schema_version'";
571
-        	try {
572
-            	    $sth = $Connection->db->prepare($query);
573
-		    $sth->execute();
574
-    		} catch(PDOException $e) {
575
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
576
-    		}
571
+			try {
572
+					$sth = $Connection->db->prepare($query);
573
+			$sth->execute();
574
+			} catch(PDOException $e) {
575
+			return "error (update schema_version) : ".$e->getMessage()."\n";
576
+			}
577 577
 		return $error;
578 578
 	}
579 579
 
580 580
 	private static function update_from_17() {
581
-    		$Connection = new Connection();
581
+			$Connection = new Connection();
582 582
 		$error = '';
583
-    		// Add tables
584
-    		if (!$Connection->tableExists('stats_country')) {
583
+			// Add tables
584
+			if (!$Connection->tableExists('stats_country')) {
585 585
 			$error .= create_db::import_file('../db/stats_country.sql');
586 586
 		}
587 587
 		if ($error != '') return $error;
588 588
 		$query = "UPDATE `config` SET `value` = '18' WHERE `name` = 'schema_version'";
589
-        	try {
590
-            	    $sth = $Connection->db->prepare($query);
591
-		    $sth->execute();
592
-    		} catch(PDOException $e) {
593
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
594
-    		}
589
+			try {
590
+					$sth = $Connection->db->prepare($query);
591
+			$sth->execute();
592
+			} catch(PDOException $e) {
593
+			return "error (update schema_version) : ".$e->getMessage()."\n";
594
+			}
595 595
 		return $error;
596 596
 	}
597 597
 	private static function update_from_18() {
598
-    		$Connection = new Connection();
598
+			$Connection = new Connection();
599 599
 		$error = '';
600
-    		// Modify stats_airport table
601
-    		if (!$Connection->checkColumnName('stats_airport','airport_name')) {
602
-    			$query = "ALTER TABLE `stats_airport` ADD `stats_type` VARCHAR(50) NOT NULL DEFAULT 'yearly', ADD `airport_name` VARCHAR(255) NOT NULL, ADD `date` DATE NULL DEFAULT NULL, DROP INDEX `airport_icao`, ADD UNIQUE `airport_icao` (`airport_icao`, `type`, `date`)";
603
-    	        	try {
604
-	            	    $sth = $Connection->db->prepare($query);
605
-			    $sth->execute();
606
-    			} catch(PDOException $e) {
607
-			    return "error (update stats) : ".$e->getMessage()."\n";
608
-    			}
609
-    		}
600
+			// Modify stats_airport table
601
+			if (!$Connection->checkColumnName('stats_airport','airport_name')) {
602
+				$query = "ALTER TABLE `stats_airport` ADD `stats_type` VARCHAR(50) NOT NULL DEFAULT 'yearly', ADD `airport_name` VARCHAR(255) NOT NULL, ADD `date` DATE NULL DEFAULT NULL, DROP INDEX `airport_icao`, ADD UNIQUE `airport_icao` (`airport_icao`, `type`, `date`)";
603
+					try {
604
+						$sth = $Connection->db->prepare($query);
605
+				$sth->execute();
606
+				} catch(PDOException $e) {
607
+				return "error (update stats) : ".$e->getMessage()."\n";
608
+				}
609
+			}
610 610
 		if ($error != '') return $error;
611 611
 		$query = "UPDATE `config` SET `value` = '19' WHERE `name` = 'schema_version'";
612
-        	try {
613
-            	    $sth = $Connection->db->prepare($query);
614
-		    $sth->execute();
615
-    		} catch(PDOException $e) {
616
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
617
-    		}
612
+			try {
613
+					$sth = $Connection->db->prepare($query);
614
+			$sth->execute();
615
+			} catch(PDOException $e) {
616
+			return "error (update schema_version) : ".$e->getMessage()."\n";
617
+			}
618 618
 		return $error;
619 619
 	}
620 620
 
621 621
 	private static function update_from_19() {
622
-    		$Connection = new Connection();
622
+			$Connection = new Connection();
623 623
 		$error = '';
624
-    		// Update airport table
624
+			// Update airport table
625 625
 		$error .= create_db::import_file('../db/airport.sql');
626 626
 		if ($error != '') return 'Import airport.sql : '.$error;
627 627
 		// Remove primary key on Spotter_Archive
628 628
 		$query = "alter table spotter_archive drop spotter_archive_id";
629
-        	try {
630
-            	    $sth = $Connection->db->prepare($query);
631
-		    $sth->execute();
632
-    		} catch(PDOException $e) {
633
-		    return "error (remove primary key on spotter_archive) : ".$e->getMessage()."\n";
634
-    		}
629
+			try {
630
+					$sth = $Connection->db->prepare($query);
631
+			$sth->execute();
632
+			} catch(PDOException $e) {
633
+			return "error (remove primary key on spotter_archive) : ".$e->getMessage()."\n";
634
+			}
635 635
 		$query = "alter table spotter_archive add spotter_archive_id INT(11)";
636
-        	try {
637
-            	    $sth = $Connection->db->prepare($query);
638
-		    $sth->execute();
639
-    		} catch(PDOException $e) {
640
-		    return "error (add id again on spotter_archive) : ".$e->getMessage()."\n";
641
-    		}
636
+			try {
637
+					$sth = $Connection->db->prepare($query);
638
+			$sth->execute();
639
+			} catch(PDOException $e) {
640
+			return "error (add id again on spotter_archive) : ".$e->getMessage()."\n";
641
+			}
642 642
 		if (!$Connection->checkColumnName('spotter_archive','over_country')) {
643 643
 			// Add column over_country
644
-    			$query = "ALTER TABLE `spotter_archive` ADD `over_country` VARCHAR(5) NULL DEFAULT NULL";
644
+				$query = "ALTER TABLE `spotter_archive` ADD `over_country` VARCHAR(5) NULL DEFAULT NULL";
645 645
 			try {
646
-            			$sth = $Connection->db->prepare($query);
646
+						$sth = $Connection->db->prepare($query);
647 647
 				$sth->execute();
648 648
 			} catch(PDOException $e) {
649 649
 				return "error (add over_country) : ".$e->getMessage()."\n";
@@ -651,9 +651,9 @@  discard block
 block discarded – undo
651 651
 		}
652 652
 		if (!$Connection->checkColumnName('spotter_live','over_country')) {
653 653
 			// Add column over_country
654
-    			$query = "ALTER TABLE `spotter_live` ADD `over_country` VARCHAR(5) NULL DEFAULT NULL";
654
+				$query = "ALTER TABLE `spotter_live` ADD `over_country` VARCHAR(5) NULL DEFAULT NULL";
655 655
 			try {
656
-            			$sth = $Connection->db->prepare($query);
656
+						$sth = $Connection->db->prepare($query);
657 657
 				$sth->execute();
658 658
 			} catch(PDOException $e) {
659 659
 				return "error (add over_country) : ".$e->getMessage()."\n";
@@ -661,74 +661,74 @@  discard block
 block discarded – undo
661 661
 		}
662 662
 		if (!$Connection->checkColumnName('spotter_output','source_name')) {
663 663
 			// Add source_name to spotter_output, spotter_live, spotter_archive, spotter_archive_output
664
-    			$query = "ALTER TABLE `spotter_output` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`";
664
+				$query = "ALTER TABLE `spotter_output` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`";
665 665
 			try {
666 666
 				$sth = $Connection->db->prepare($query);
667 667
 				$sth->execute();
668 668
 			} catch(PDOException $e) {
669 669
 				return "error (add source_name column) : ".$e->getMessage()."\n";
670
-    			}
671
-    		}
670
+				}
671
+			}
672 672
 		if (!$Connection->checkColumnName('spotter_live','source_name')) {
673 673
 			// Add source_name to spotter_output, spotter_live, spotter_archive, spotter_archive_output
674
-    			$query = "ALTER TABLE `spotter_live` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`";
674
+				$query = "ALTER TABLE `spotter_live` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`";
675 675
 			try {
676 676
 				$sth = $Connection->db->prepare($query);
677 677
 				$sth->execute();
678 678
 			} catch(PDOException $e) {
679 679
 				return "error (add source_name column) : ".$e->getMessage()."\n";
680
-    			}
681
-    		}
680
+				}
681
+			}
682 682
 		if (!$Connection->checkColumnName('spotter_archive_output','source_name')) {
683 683
 			// Add source_name to spotter_output, spotter_live, spotter_archive, spotter_archive_output
684
-    			$query = "ALTER TABLE `spotter_archive_output` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`";
684
+				$query = "ALTER TABLE `spotter_archive_output` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`";
685 685
 			try {
686 686
 				$sth = $Connection->db->prepare($query);
687 687
 				$sth->execute();
688 688
 			} catch(PDOException $e) {
689 689
 				return "error (add source_name column) : ".$e->getMessage()."\n";
690
-    			}
691
-    		}
690
+				}
691
+			}
692 692
 		if (!$Connection->checkColumnName('spotter_archive','source_name')) {
693 693
 			// Add source_name to spotter_output, spotter_live, spotter_archive, spotter_archive_output
694
-    			$query = "ALTER TABLE `spotter_archive` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`;";
694
+				$query = "ALTER TABLE `spotter_archive` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`;";
695 695
 			try {
696 696
 				$sth = $Connection->db->prepare($query);
697 697
 				$sth->execute();
698 698
 			} catch(PDOException $e) {
699 699
 				return "error (add source_name column) : ".$e->getMessage()."\n";
700
-    			}
701
-    		}
700
+				}
701
+			}
702 702
 		if ($error != '') return $error;
703 703
 		$query = "UPDATE `config` SET `value` = '20' WHERE `name` = 'schema_version'";
704
-        	try {
705
-            	    $sth = $Connection->db->prepare($query);
706
-		    $sth->execute();
707
-    		} catch(PDOException $e) {
708
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
709
-    		}
704
+			try {
705
+					$sth = $Connection->db->prepare($query);
706
+			$sth->execute();
707
+			} catch(PDOException $e) {
708
+			return "error (update schema_version) : ".$e->getMessage()."\n";
709
+			}
710 710
 		return $error;
711 711
 	}
712 712
 
713 713
 	private static function update_from_20() {
714 714
 		global $globalIVAO, $globalVATSIM, $globalphpVMS;
715
-    		$Connection = new Connection();
715
+			$Connection = new Connection();
716 716
 		$error = '';
717
-    		// Update airline table
718
-    		if (!$globalIVAO && !$globalVATSIM && !$globalphpVMS) {
717
+			// Update airline table
718
+			if (!$globalIVAO && !$globalVATSIM && !$globalphpVMS) {
719 719
 			$error .= create_db::import_file('../db/airlines.sql');
720 720
 			if ($error != '') return 'Import airlines.sql : '.$error;
721 721
 		}
722 722
 		if (!$Connection->checkColumnName('aircraft_modes','type_flight')) {
723 723
 			// Add column over_country
724
-    			$query = "ALTER TABLE `aircraft_modes` ADD `type_flight` VARCHAR(50) NULL DEFAULT NULL;";
725
-        		try {
724
+				$query = "ALTER TABLE `aircraft_modes` ADD `type_flight` VARCHAR(50) NULL DEFAULT NULL;";
725
+				try {
726 726
 				$sth = $Connection->db->prepare($query);
727 727
 				$sth->execute();
728 728
 			} catch(PDOException $e) {
729 729
 				return "error (add over_country) : ".$e->getMessage()."\n";
730
-    			}
731
-    		}
730
+				}
731
+			}
732 732
 		if ($error != '') return $error;
733 733
 		/*
734 734
     		if (!$globalIVAO && !$globalVATSIM && !$globalphpVMS) {
@@ -738,12 +738,12 @@  discard block
 block discarded – undo
738 738
 		}
739 739
 		*/
740 740
 		$query = "UPDATE `config` SET `value` = '21' WHERE `name` = 'schema_version'";
741
-        	try {
742
-            	    $sth = $Connection->db->prepare($query);
743
-		    $sth->execute();
744
-    		} catch(PDOException $e) {
745
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
746
-    		}
741
+			try {
742
+					$sth = $Connection->db->prepare($query);
743
+			$sth->execute();
744
+			} catch(PDOException $e) {
745
+			return "error (update schema_version) : ".$e->getMessage()."\n";
746
+			}
747 747
 		return $error;
748 748
 	}
749 749
 
@@ -762,35 +762,35 @@  discard block
 block discarded – undo
762 762
 			if ($error != '') return $error;
763 763
 		}
764 764
 		$query = "UPDATE `config` SET `value` = '22' WHERE `name` = 'schema_version'";
765
-        	try {
766
-            	    $sth = $Connection->db->prepare($query);
767
-		    $sth->execute();
768
-    		} catch(PDOException $e) {
769
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
770
-    		}
765
+			try {
766
+					$sth = $Connection->db->prepare($query);
767
+			$sth->execute();
768
+			} catch(PDOException $e) {
769
+			return "error (update schema_version) : ".$e->getMessage()."\n";
770
+			}
771 771
 		return $error;
772 772
 	}
773 773
 
774 774
 	private static function update_from_22() {
775 775
 		global $globalDBdriver;
776
-    		$Connection = new Connection();
776
+			$Connection = new Connection();
777 777
 		$error = '';
778 778
 		// Add table stats polar
779
-    		if (!$Connection->tableExists('stats_source')) {
779
+			if (!$Connection->tableExists('stats_source')) {
780 780
 			if ($globalDBdriver == 'mysql') {
781
-    				$error .= create_db::import_file('../db/stats_source.sql');
781
+					$error .= create_db::import_file('../db/stats_source.sql');
782 782
 			} else {
783 783
 				$error .= create_db::import_file('../db/pgsql/stats_source.sql');
784 784
 			}
785 785
 			if ($error != '') return $error;
786 786
 		}
787 787
 		$query = "UPDATE config SET value = '23' WHERE name = 'schema_version'";
788
-        	try {
789
-            	    $sth = $Connection->db->prepare($query);
790
-		    $sth->execute();
791
-    		} catch(PDOException $e) {
792
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
793
-    		}
788
+			try {
789
+					$sth = $Connection->db->prepare($query);
790
+			$sth->execute();
791
+			} catch(PDOException $e) {
792
+			return "error (update schema_version) : ".$e->getMessage()."\n";
793
+			}
794 794
 		return $error;
795 795
 	}
796 796
 
@@ -821,14 +821,14 @@  discard block
 block discarded – undo
821 821
 		}
822 822
 		if (!$Connection->checkColumnName('stats_aircraft','aircraft_manufacturer')) {
823 823
 			// Add aircraft_manufacturer to stats_aircraft
824
-    			$query = "ALTER TABLE stats_aircraft ADD aircraft_manufacturer VARCHAR(255) NULL";
824
+				$query = "ALTER TABLE stats_aircraft ADD aircraft_manufacturer VARCHAR(255) NULL";
825 825
 			try {
826 826
 				$sth = $Connection->db->prepare($query);
827 827
 				$sth->execute();
828 828
 			} catch(PDOException $e) {
829 829
 				return "error (add aircraft_manufacturer column) : ".$e->getMessage()."\n";
830
-    			}
831
-    		}
830
+				}
831
+			}
832 832
 		
833 833
 		$query = "UPDATE config SET value = '24' WHERE name = 'schema_version'";
834 834
 		try {
@@ -1176,7 +1176,7 @@  discard block
 block discarded – undo
1176 1176
 			} catch(PDOException $e) {
1177 1177
 				return "error (add index latitude,longitude on spotter_live) : ".$e->getMessage()."\n";
1178 1178
 			}
1179
-                }
1179
+				}
1180 1180
 		if (!$Connection->checkColumnName('aircraft','mfr')) {
1181 1181
 			// Add mfr to aircraft
1182 1182
 			$query = "ALTER TABLE aircraft ADD mfr VARCHAR(255) NULL";
@@ -1250,7 +1250,7 @@  discard block
 block discarded – undo
1250 1250
 			} catch(PDOException $e) {
1251 1251
 				return "error (add index ref on notam) : ".$e->getMessage()."\n";
1252 1252
 			}
1253
-                }
1253
+				}
1254 1254
 		if (!$Connection->indexExists('accidents','registration_idx')) {
1255 1255
 			// Add index key
1256 1256
 			$query = "create index registration_idx on accidents (registration)";
@@ -1260,7 +1260,7 @@  discard block
 block discarded – undo
1260 1260
 			} catch(PDOException $e) {
1261 1261
 				return "error (add index registration on accidents) : ".$e->getMessage()."\n";
1262 1262
 			}
1263
-                }
1263
+				}
1264 1264
 		if (!$Connection->indexExists('accidents','rdts')) {
1265 1265
 			// Add index key
1266 1266
 			$query = "create index rdts on accidents (registration,date,type,source)";
@@ -1270,7 +1270,7 @@  discard block
 block discarded – undo
1270 1270
 			} catch(PDOException $e) {
1271 1271
 				return "error (add index registration, date, type & source on accidents) : ".$e->getMessage()."\n";
1272 1272
 			}
1273
-                }
1273
+				}
1274 1274
 
1275 1275
 		$query = "UPDATE config SET value = '31' WHERE name = 'schema_version'";
1276 1276
 		try {
@@ -1360,157 +1360,157 @@  discard block
 block discarded – undo
1360 1360
 	}
1361 1361
 
1362 1362
 
1363
-    	public static function check_version($update = false) {
1364
-    	    global $globalDBname;
1365
-    	    $version = 0;
1366
-    	    $Connection = new Connection();
1367
-    	    if ($Connection->tableExists('aircraft')) {
1368
-    		if (!$Connection->tableExists('config')) {
1369
-    		    $version = '1';
1370
-    		    if ($update) return self::update_from_1();
1371
-    		    else return $version;
1363
+		public static function check_version($update = false) {
1364
+			global $globalDBname;
1365
+			$version = 0;
1366
+			$Connection = new Connection();
1367
+			if ($Connection->tableExists('aircraft')) {
1368
+			if (!$Connection->tableExists('config')) {
1369
+				$version = '1';
1370
+				if ($update) return self::update_from_1();
1371
+				else return $version;
1372 1372
 		} else {
1373
-    		    $Connection = new Connection();
1374
-		    $query = "SELECT value FROM config WHERE name = 'schema_version' LIMIT 1";
1375
-		    try {
1376
-            		$sth = $Connection->db->prepare($query);
1377
-		        $sth->execute();
1378
-		    } catch(PDOException $e) {
1373
+				$Connection = new Connection();
1374
+			$query = "SELECT value FROM config WHERE name = 'schema_version' LIMIT 1";
1375
+			try {
1376
+					$sth = $Connection->db->prepare($query);
1377
+				$sth->execute();
1378
+			} catch(PDOException $e) {
1379 1379
 			return "error : ".$e->getMessage()."\n";
1380
-    		    }
1381
-    		    $result = $sth->fetch(PDO::FETCH_ASSOC);
1382
-    		    if ($update) {
1383
-    			if ($result['value'] == '2') {
1384
-    			    $error = self::update_from_2();
1385
-    			    if ($error != '') return $error;
1386
-    			    else return self::check_version(true);
1387
-    			} elseif ($result['value'] == '3') {
1388
-    			    $error = self::update_from_3();
1389
-    			    if ($error != '') return $error;
1390
-    			    else return self::check_version(true);
1391
-    			} elseif ($result['value'] == '4') {
1392
-    			    $error = self::update_from_4();
1393
-    			    if ($error != '') return $error;
1394
-    			    else return self::check_version(true);
1395
-    			} elseif ($result['value'] == '5') {
1396
-    			    $error = self::update_from_5();
1397
-    			    if ($error != '') return $error;
1398
-    			    else return self::check_version(true);
1399
-    			} elseif ($result['value'] == '6') {
1400
-    			    $error = self::update_from_6();
1401
-    			    if ($error != '') return $error;
1402
-    			    else return self::check_version(true);
1403
-    			} elseif ($result['value'] == '7') {
1404
-    			    $error = self::update_from_7();
1405
-    			    if ($error != '') return $error;
1406
-    			    else return self::check_version(true);
1407
-    			} elseif ($result['value'] == '8') {
1408
-    			    $error = self::update_from_8();
1409
-    			    if ($error != '') return $error;
1410
-    			    else return self::check_version(true);
1411
-    			} elseif ($result['value'] == '9') {
1412
-    			    $error = self::update_from_9();
1413
-    			    if ($error != '') return $error;
1414
-    			    else return self::check_version(true);
1415
-    			} elseif ($result['value'] == '10') {
1416
-    			    $error = self::update_from_10();
1417
-    			    if ($error != '') return $error;
1418
-    			    else return self::check_version(true);
1419
-    			} elseif ($result['value'] == '11') {
1420
-    			    $error = self::update_from_11();
1421
-    			    if ($error != '') return $error;
1422
-    			    else return self::check_version(true);
1423
-    			} elseif ($result['value'] == '12') {
1424
-    			    $error = self::update_from_12();
1425
-    			    if ($error != '') return $error;
1426
-    			    else return self::check_version(true);
1427
-    			} elseif ($result['value'] == '13') {
1428
-    			    $error = self::update_from_13();
1429
-    			    if ($error != '') return $error;
1430
-    			    else return self::check_version(true);
1431
-    			} elseif ($result['value'] == '14') {
1432
-    			    $error = self::update_from_14();
1433
-    			    if ($error != '') return $error;
1434
-    			    else return self::check_version(true);
1435
-    			} elseif ($result['value'] == '15') {
1436
-    			    $error = self::update_from_15();
1437
-    			    if ($error != '') return $error;
1438
-    			    else return self::check_version(true);
1439
-    			} elseif ($result['value'] == '16') {
1440
-    			    $error = self::update_from_16();
1441
-    			    if ($error != '') return $error;
1442
-    			    else return self::check_version(true);
1443
-    			} elseif ($result['value'] == '17') {
1444
-    			    $error = self::update_from_17();
1445
-    			    if ($error != '') return $error;
1446
-    			    else return self::check_version(true);
1447
-    			} elseif ($result['value'] == '18') {
1448
-    			    $error = self::update_from_18();
1449
-    			    if ($error != '') return $error;
1450
-    			    else return self::check_version(true);
1451
-    			} elseif ($result['value'] == '19') {
1452
-    			    $error = self::update_from_19();
1453
-    			    if ($error != '') return $error;
1454
-    			    else return self::check_version(true);
1455
-    			} elseif ($result['value'] == '20') {
1456
-    			    $error = self::update_from_20();
1457
-    			    if ($error != '') return $error;
1458
-    			    else return self::check_version(true);
1459
-    			} elseif ($result['value'] == '21') {
1460
-    			    $error = self::update_from_21();
1461
-    			    if ($error != '') return $error;
1462
-    			    else return self::check_version(true);
1463
-    			} elseif ($result['value'] == '22') {
1464
-    			    $error = self::update_from_22();
1465
-    			    if ($error != '') return $error;
1466
-    			    else return self::check_version(true);
1467
-    			} elseif ($result['value'] == '23') {
1468
-    			    $error = self::update_from_23();
1469
-    			    if ($error != '') return $error;
1470
-    			    else return self::check_version(true);
1471
-    			} elseif ($result['value'] == '24') {
1472
-    			    $error = self::update_from_24();
1473
-    			    if ($error != '') return $error;
1474
-    			    else return self::check_version(true);
1475
-    			} elseif ($result['value'] == '25') {
1476
-    			    $error = self::update_from_25();
1477
-    			    if ($error != '') return $error;
1478
-    			    else return self::check_version(true);
1479
-    			} elseif ($result['value'] == '26') {
1480
-    			    $error = self::update_from_26();
1481
-    			    if ($error != '') return $error;
1482
-    			    else return self::check_version(true);
1483
-    			} elseif ($result['value'] == '27') {
1484
-    			    $error = self::update_from_27();
1485
-    			    if ($error != '') return $error;
1486
-    			    else return self::check_version(true);
1487
-    			} elseif ($result['value'] == '28') {
1488
-    			    $error = self::update_from_28();
1489
-    			    if ($error != '') return $error;
1490
-    			    else return self::check_version(true);
1491
-    			} elseif ($result['value'] == '29') {
1492
-    			    $error = self::update_from_29();
1493
-    			    if ($error != '') return $error;
1494
-    			    else return self::check_version(true);
1495
-    			} elseif ($result['value'] == '30') {
1496
-    			    $error = self::update_from_30();
1497
-    			    if ($error != '') return $error;
1498
-    			    else return self::check_version(true);
1499
-    			} elseif ($result['value'] == '31') {
1500
-    			    $error = self::update_from_31();
1501
-    			    if ($error != '') return $error;
1502
-    			    else return self::check_version(true);
1503
-    			} elseif ($result['value'] == '32') {
1504
-    			    $error = self::update_from_32();
1505
-    			    if ($error != '') return $error;
1506
-    			    else return self::check_version(true);
1507
-    			} else return '';
1508
-    		    }
1509
-    		    else return $result['value'];
1380
+				}
1381
+				$result = $sth->fetch(PDO::FETCH_ASSOC);
1382
+				if ($update) {
1383
+				if ($result['value'] == '2') {
1384
+					$error = self::update_from_2();
1385
+					if ($error != '') return $error;
1386
+					else return self::check_version(true);
1387
+				} elseif ($result['value'] == '3') {
1388
+					$error = self::update_from_3();
1389
+					if ($error != '') return $error;
1390
+					else return self::check_version(true);
1391
+				} elseif ($result['value'] == '4') {
1392
+					$error = self::update_from_4();
1393
+					if ($error != '') return $error;
1394
+					else return self::check_version(true);
1395
+				} elseif ($result['value'] == '5') {
1396
+					$error = self::update_from_5();
1397
+					if ($error != '') return $error;
1398
+					else return self::check_version(true);
1399
+				} elseif ($result['value'] == '6') {
1400
+					$error = self::update_from_6();
1401
+					if ($error != '') return $error;
1402
+					else return self::check_version(true);
1403
+				} elseif ($result['value'] == '7') {
1404
+					$error = self::update_from_7();
1405
+					if ($error != '') return $error;
1406
+					else return self::check_version(true);
1407
+				} elseif ($result['value'] == '8') {
1408
+					$error = self::update_from_8();
1409
+					if ($error != '') return $error;
1410
+					else return self::check_version(true);
1411
+				} elseif ($result['value'] == '9') {
1412
+					$error = self::update_from_9();
1413
+					if ($error != '') return $error;
1414
+					else return self::check_version(true);
1415
+				} elseif ($result['value'] == '10') {
1416
+					$error = self::update_from_10();
1417
+					if ($error != '') return $error;
1418
+					else return self::check_version(true);
1419
+				} elseif ($result['value'] == '11') {
1420
+					$error = self::update_from_11();
1421
+					if ($error != '') return $error;
1422
+					else return self::check_version(true);
1423
+				} elseif ($result['value'] == '12') {
1424
+					$error = self::update_from_12();
1425
+					if ($error != '') return $error;
1426
+					else return self::check_version(true);
1427
+				} elseif ($result['value'] == '13') {
1428
+					$error = self::update_from_13();
1429
+					if ($error != '') return $error;
1430
+					else return self::check_version(true);
1431
+				} elseif ($result['value'] == '14') {
1432
+					$error = self::update_from_14();
1433
+					if ($error != '') return $error;
1434
+					else return self::check_version(true);
1435
+				} elseif ($result['value'] == '15') {
1436
+					$error = self::update_from_15();
1437
+					if ($error != '') return $error;
1438
+					else return self::check_version(true);
1439
+				} elseif ($result['value'] == '16') {
1440
+					$error = self::update_from_16();
1441
+					if ($error != '') return $error;
1442
+					else return self::check_version(true);
1443
+				} elseif ($result['value'] == '17') {
1444
+					$error = self::update_from_17();
1445
+					if ($error != '') return $error;
1446
+					else return self::check_version(true);
1447
+				} elseif ($result['value'] == '18') {
1448
+					$error = self::update_from_18();
1449
+					if ($error != '') return $error;
1450
+					else return self::check_version(true);
1451
+				} elseif ($result['value'] == '19') {
1452
+					$error = self::update_from_19();
1453
+					if ($error != '') return $error;
1454
+					else return self::check_version(true);
1455
+				} elseif ($result['value'] == '20') {
1456
+					$error = self::update_from_20();
1457
+					if ($error != '') return $error;
1458
+					else return self::check_version(true);
1459
+				} elseif ($result['value'] == '21') {
1460
+					$error = self::update_from_21();
1461
+					if ($error != '') return $error;
1462
+					else return self::check_version(true);
1463
+				} elseif ($result['value'] == '22') {
1464
+					$error = self::update_from_22();
1465
+					if ($error != '') return $error;
1466
+					else return self::check_version(true);
1467
+				} elseif ($result['value'] == '23') {
1468
+					$error = self::update_from_23();
1469
+					if ($error != '') return $error;
1470
+					else return self::check_version(true);
1471
+				} elseif ($result['value'] == '24') {
1472
+					$error = self::update_from_24();
1473
+					if ($error != '') return $error;
1474
+					else return self::check_version(true);
1475
+				} elseif ($result['value'] == '25') {
1476
+					$error = self::update_from_25();
1477
+					if ($error != '') return $error;
1478
+					else return self::check_version(true);
1479
+				} elseif ($result['value'] == '26') {
1480
+					$error = self::update_from_26();
1481
+					if ($error != '') return $error;
1482
+					else return self::check_version(true);
1483
+				} elseif ($result['value'] == '27') {
1484
+					$error = self::update_from_27();
1485
+					if ($error != '') return $error;
1486
+					else return self::check_version(true);
1487
+				} elseif ($result['value'] == '28') {
1488
+					$error = self::update_from_28();
1489
+					if ($error != '') return $error;
1490
+					else return self::check_version(true);
1491
+				} elseif ($result['value'] == '29') {
1492
+					$error = self::update_from_29();
1493
+					if ($error != '') return $error;
1494
+					else return self::check_version(true);
1495
+				} elseif ($result['value'] == '30') {
1496
+					$error = self::update_from_30();
1497
+					if ($error != '') return $error;
1498
+					else return self::check_version(true);
1499
+				} elseif ($result['value'] == '31') {
1500
+					$error = self::update_from_31();
1501
+					if ($error != '') return $error;
1502
+					else return self::check_version(true);
1503
+				} elseif ($result['value'] == '32') {
1504
+					$error = self::update_from_32();
1505
+					if ($error != '') return $error;
1506
+					else return self::check_version(true);
1507
+				} else return '';
1508
+				}
1509
+				else return $result['value'];
1510 1510
 		}
1511 1511
 		
1512
-	    } else return $version;
1513
-    	}
1512
+		} else return $version;
1513
+		}
1514 1514
     	
1515 1515
 }
1516 1516
 //echo update_schema::check_version();
Please login to merge, or discard this patch.
Spacing   +153 added lines, -153 removed lines patch added patch discarded remove patch
@@ -14,11 +14,11 @@  discard block
 block discarded – undo
14 14
             try {
15 15
             	$sth = $Connection->db->prepare($query);
16 16
 		$sth->execute();
17
-    	    } catch(PDOException $e) {
17
+    	    } catch (PDOException $e) {
18 18
 		return "error : ".$e->getMessage()."\n";
19 19
     	    }
20 20
     	    while ($row = $sth->fetch(PDO::FETCH_ASSOC)) {
21
-    		$Schedule->addSchedule($row['ident'],$row['departure_airport_icao'],$row['departure_airport_time'],$row['arrival_airport_icao'],$row['arrival_airport_time']);
21
+    		$Schedule->addSchedule($row['ident'], $row['departure_airport_icao'], $row['departure_airport_time'], $row['arrival_airport_icao'], $row['arrival_airport_time']);
22 22
     	    }
23 23
 	
24 24
 	}
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
         	try {
51 51
             	    $sth = $Connection->db->prepare($query);
52 52
 		    $sth->execute();
53
-    		} catch(PDOException $e) {
53
+    		} catch (PDOException $e) {
54 54
 		    return "error (add new columns to routes table) : ".$e->getMessage()."\n";
55 55
     		}
56 56
     		// Copy schedules data to routes table
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
         	try {
61 61
             	    $sth = $Connection->db->prepare($query);
62 62
 		    $sth->execute();
63
-    		} catch(PDOException $e) {
63
+    		} catch (PDOException $e) {
64 64
 		    return "error (delete schedule table) : ".$e->getMessage()."\n";
65 65
     		}
66 66
     		// Add source column
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
     		try {
69 69
             	    $sth = $Connection->db->prepare($query);
70 70
 		    $sth->execute();
71
-    		} catch(PDOException $e) {
71
+    		} catch (PDOException $e) {
72 72
 		    return "error (add source column to aircraft_modes) : ".$e->getMessage()."\n";
73 73
     		}
74 74
 		// Delete unused column
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
     		try {
77 77
             	    $sth = $Connection->db->prepare($query);
78 78
 		    $sth->execute();
79
-    		} catch(PDOException $e) {
79
+    		} catch (PDOException $e) {
80 80
 		    return "error (Delete unused column of aircraft_modes) : ".$e->getMessage()."\n";
81 81
     		}
82 82
 		// Add ModeS column
@@ -84,14 +84,14 @@  discard block
 block discarded – undo
84 84
     		try {
85 85
             	    $sth = $Connection->db->prepare($query);
86 86
 		    $sth->execute();
87
-    		} catch(PDOException $e) {
87
+    		} catch (PDOException $e) {
88 88
 		    return "error (Add ModeS column in spotter_output) : ".$e->getMessage()."\n";
89 89
     		}
90 90
 		$query = "ALTER TABLE `spotter_live`  ADD `ModeS` VARCHAR(255)";
91 91
     		try {
92 92
             	    $sth = $Connection->db->prepare($query);
93 93
 		    $sth->execute();
94
-    		} catch(PDOException $e) {
94
+    		} catch (PDOException $e) {
95 95
 		    return "error (Add ModeS column in spotter_live) : ".$e->getMessage()."\n";
96 96
     		}
97 97
     		// Add auto_increment for aircraft_modes
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
     		try {
100 100
             	    $sth = $Connection->db->prepare($query);
101 101
 		    $sth->execute();
102
-    		} catch(PDOException $e) {
102
+    		} catch (PDOException $e) {
103 103
 		    return "error (Add Auto increment in aircraft_modes) : ".$e->getMessage()."\n";
104 104
     		}
105 105
     		$error = '';
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
         	try {
111 111
             	    $sth = $Connection->db->prepare($query);
112 112
 		    $sth->execute();
113
-    		} catch(PDOException $e) {
113
+    		} catch (PDOException $e) {
114 114
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
115 115
     		}
116 116
 		return $error;
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
         	try {
124 124
             	    $sth = $Connection->db->prepare($query);
125 125
 		    $sth->execute();
126
-    		} catch(PDOException $e) {
126
+    		} catch (PDOException $e) {
127 127
 		    return "error (add new columns to routes table) : ".$e->getMessage()."\n";
128 128
     		}
129 129
     		$error = '';
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
         	try {
135 135
             	    $sth = $Connection->db->prepare($query);
136 136
 		    $sth->execute();
137
-    		} catch(PDOException $e) {
137
+    		} catch (PDOException $e) {
138 138
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
139 139
     		}
140 140
 		return $error;
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
         	try {
148 148
             	    $sth = $Connection->db->prepare($query);
149 149
 		    $sth->execute();
150
-    		} catch(PDOException $e) {
150
+    		} catch (PDOException $e) {
151 151
 		    return "error (add new columns to aircraft_modes) : ".$e->getMessage()."\n";
152 152
     		}
153 153
     		// Add image_source_website column to spotter_image
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
         	try {
156 156
             	    $sth = $Connection->db->prepare($query);
157 157
 		    $sth->execute();
158
-    		} catch(PDOException $e) {
158
+    		} catch (PDOException $e) {
159 159
 		    return "error (add new columns to spotter_image) : ".$e->getMessage()."\n";
160 160
     		}
161 161
     		$error = '';
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
         	try {
165 165
             	    $sth = $Connection->db->prepare($query);
166 166
 		    $sth->execute();
167
-    		} catch(PDOException $e) {
167
+    		} catch (PDOException $e) {
168 168
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
169 169
     		}
170 170
 		return $error;
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
         	    try {
183 183
             		$sth = $Connection->db->prepare($query);
184 184
 			$sth->execute();
185
-    		    } catch(PDOException $e) {
185
+    		    } catch (PDOException $e) {
186 186
 			return "error (update schema_version) : ".$e->getMessage()."\n";
187 187
     		    }
188 188
     		}
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
         	try {
197 197
             	    $sth = $Connection->db->prepare($query);
198 198
 		    $sth->execute();
199
-    		} catch(PDOException $e) {
199
+    		} catch (PDOException $e) {
200 200
 		    return "error (add new columns to translation) : ".$e->getMessage()."\n";
201 201
     		}
202 202
     		// Add aircraft_shadow column to aircraft
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
         	try {
205 205
             	    $sth = $Connection->db->prepare($query);
206 206
 		    $sth->execute();
207
-    		} catch(PDOException $e) {
207
+    		} catch (PDOException $e) {
208 208
 		    return "error (add new column to aircraft) : ".$e->getMessage()."\n";
209 209
     		}
210 210
     		// Add aircraft_shadow column to spotter_live
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
         	try {
213 213
             	    $sth = $Connection->db->prepare($query);
214 214
 		    $sth->execute();
215
-    		} catch(PDOException $e) {
215
+    		} catch (PDOException $e) {
216 216
 		    return "error (add new column to spotter_live) : ".$e->getMessage()."\n";
217 217
     		}
218 218
     		$error = '';
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
         	try {
226 226
             	    $sth = $Connection->db->prepare($query);
227 227
 		    $sth->execute();
228
-    		} catch(PDOException $e) {
228
+    		} catch (PDOException $e) {
229 229
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
230 230
     		}
231 231
 		return $error;
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
 
234 234
 	private static function update_from_6() {
235 235
     		$Connection = new Connection();
236
-    		if (!$Connection->indexExists('spotter_output','flightaware_id')) {
236
+    		if (!$Connection->indexExists('spotter_output', 'flightaware_id')) {
237 237
     		    $query = "ALTER TABLE spotter_output ADD INDEX(flightaware_id);
238 238
 			ALTER TABLE spotter_output ADD INDEX(date);
239 239
 			ALTER TABLE spotter_output ADD INDEX(ident);
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
         	    try {
251 251
             		$sth = $Connection->db->prepare($query);
252 252
 			$sth->execute();
253
-    		    } catch(PDOException $e) {
253
+    		    } catch (PDOException $e) {
254 254
 			return "error (add some indexes) : ".$e->getMessage()."\n";
255 255
     		    }
256 256
     		}
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
         	try {
266 266
             	    $sth = $Connection->db->prepare($query);
267 267
 		    $sth->execute();
268
-    		} catch(PDOException $e) {
268
+    		} catch (PDOException $e) {
269 269
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
270 270
     		}
271 271
 		return $error;
@@ -274,12 +274,12 @@  discard block
 block discarded – undo
274 274
 	private static function update_from_7() {
275 275
 		global $globalDBname, $globalDBdriver;
276 276
     		$Connection = new Connection();
277
-    		$query="ALTER TABLE spotter_live ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL;
277
+    		$query = "ALTER TABLE spotter_live ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL;
278 278
     			ALTER TABLE spotter_output ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL;";
279 279
         	try {
280 280
             	    $sth = $Connection->db->prepare($query);
281 281
 		    $sth->execute();
282
-    		} catch(PDOException $e) {
282
+    		} catch (PDOException $e) {
283 283
 		    return "error (add pilot column to spotter_live and spotter_output) : ".$e->getMessage()."\n";
284 284
     		}
285 285
     		if ($globalDBdriver == 'mysql') {
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
 		    try {
288 288
             		$sth = $Connection->db->prepare($query);
289 289
 			$sth->execute();
290
-    		    } catch(PDOException $e) {
290
+    		    } catch (PDOException $e) {
291 291
 			return "error (problem when select engine for spotter_engine) : ".$e->getMessage()."\n";
292 292
     		    }
293 293
     		    $row = $sth->fetch(PDO::FETCH_ASSOC);
@@ -299,15 +299,15 @@  discard block
 block discarded – undo
299 299
 				DROP TABLE spotter_archive;
300 300
 				RENAME TABLE copy TO spotter_archive;";
301 301
             	    } else {
302
-    			$query="ALTER TABLE spotter_archive ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL";
302
+    			$query = "ALTER TABLE spotter_archive ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL";
303 303
             	    }
304 304
                 } else {
305
-    		    $query="ALTER TABLE spotter_archive ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL";
305
+    		    $query = "ALTER TABLE spotter_archive ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL";
306 306
                 }
307 307
         	try {
308 308
             	    $sth = $Connection->db->prepare($query);
309 309
 		    $sth->execute();
310
-    		} catch(PDOException $e) {
310
+    		} catch (PDOException $e) {
311 311
 		    return "error (add pilot column to spotter_archive) : ".$e->getMessage()."\n";
312 312
     		}
313 313
 
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
         	try {
321 321
             	    $sth = $Connection->db->prepare($query);
322 322
 		    $sth->execute();
323
-    		} catch(PDOException $e) {
323
+    		} catch (PDOException $e) {
324 324
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
325 325
     		}
326 326
 		return $error;
@@ -339,14 +339,14 @@  discard block
 block discarded – undo
339 339
         	try {
340 340
             	    $sth = $Connection->db->prepare($query);
341 341
 		    $sth->execute();
342
-    		} catch(PDOException $e) {
342
+    		} catch (PDOException $e) {
343 343
 		    return "error (insert last_update values) : ".$e->getMessage()."\n";
344 344
     		}
345 345
 		$query = "UPDATE `config` SET `value` = '9' WHERE `name` = 'schema_version'";
346 346
         	try {
347 347
             	    $sth = $Connection->db->prepare($query);
348 348
 		    $sth->execute();
349
-    		} catch(PDOException $e) {
349
+    		} catch (PDOException $e) {
350 350
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
351 351
     		}
352 352
 		return $error;
@@ -354,12 +354,12 @@  discard block
 block discarded – undo
354 354
 
355 355
 	private static function update_from_9() {
356 356
     		$Connection = new Connection();
357
-    		$query="ALTER TABLE spotter_live ADD verticalrate INT(11) NULL;
357
+    		$query = "ALTER TABLE spotter_live ADD verticalrate INT(11) NULL;
358 358
     			ALTER TABLE spotter_output ADD verticalrate INT(11) NULL;";
359 359
         	try {
360 360
             	    $sth = $Connection->db->prepare($query);
361 361
 		    $sth->execute();
362
-    		} catch(PDOException $e) {
362
+    		} catch (PDOException $e) {
363 363
 		    return "error (add verticalrate column to spotter_live and spotter_output) : ".$e->getMessage()."\n";
364 364
     		}
365 365
 		$error = '';
@@ -371,7 +371,7 @@  discard block
 block discarded – undo
371 371
         	try {
372 372
             	    $sth = $Connection->db->prepare($query);
373 373
 		    $sth->execute();
374
-    		} catch(PDOException $e) {
374
+    		} catch (PDOException $e) {
375 375
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
376 376
     		}
377 377
 		return $error;
@@ -379,11 +379,11 @@  discard block
 block discarded – undo
379 379
 
380 380
 	private static function update_from_10() {
381 381
     		$Connection = new Connection();
382
-    		$query="ALTER TABLE atc CHANGE `type` `type` ENUM('Observer','Flight Information','Delivery','Tower','Approach','ACC','Departure','Ground','Flight Service Station','Control Radar or Centre') CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL";
382
+    		$query = "ALTER TABLE atc CHANGE `type` `type` ENUM('Observer','Flight Information','Delivery','Tower','Approach','ACC','Departure','Ground','Flight Service Station','Control Radar or Centre') CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL";
383 383
         	try {
384 384
             	    $sth = $Connection->db->prepare($query);
385 385
 		    $sth->execute();
386
-    		} catch(PDOException $e) {
386
+    		} catch (PDOException $e) {
387 387
 		    return "error (add new enum to ATC table) : ".$e->getMessage()."\n";
388 388
     		}
389 389
 		$error = '';
@@ -401,7 +401,7 @@  discard block
 block discarded – undo
401 401
         	try {
402 402
             	    $sth = $Connection->db->prepare($query);
403 403
 		    $sth->execute();
404
-    		} catch(PDOException $e) {
404
+    		} catch (PDOException $e) {
405 405
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
406 406
     		}
407 407
 		return $error;
@@ -410,18 +410,18 @@  discard block
 block discarded – undo
410 410
 	private static function update_from_11() {
411 411
 		global $globalDBdriver, $globalDBname;
412 412
     		$Connection = new Connection();
413
-    		$query="ALTER TABLE spotter_output ADD owner_name VARCHAR(255) NULL DEFAULT NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE, ADD last_ground BOOLEAN NOT NULL DEFAULT FALSE, ADD last_seen DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, ADD last_latitude FLOAT NULL, ADD last_longitude FLOAT NULL, ADD last_altitude INT(11) NULL, ADD last_ground_speed INT(11), ADD real_arrival_airport_icao VARCHAR(999), ADD real_arrival_airport_time VARCHAR(20),ADD real_departure_airport_icao VARCHAR(999), ADD real_departure_airport_time VARCHAR(20)";
413
+    		$query = "ALTER TABLE spotter_output ADD owner_name VARCHAR(255) NULL DEFAULT NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE, ADD last_ground BOOLEAN NOT NULL DEFAULT FALSE, ADD last_seen DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, ADD last_latitude FLOAT NULL, ADD last_longitude FLOAT NULL, ADD last_altitude INT(11) NULL, ADD last_ground_speed INT(11), ADD real_arrival_airport_icao VARCHAR(999), ADD real_arrival_airport_time VARCHAR(20),ADD real_departure_airport_icao VARCHAR(999), ADD real_departure_airport_time VARCHAR(20)";
414 414
         	try {
415 415
             	    $sth = $Connection->db->prepare($query);
416 416
 		    $sth->execute();
417
-    		} catch(PDOException $e) {
417
+    		} catch (PDOException $e) {
418 418
 		    return "error (add owner_name & format_source column to spotter_output) : ".$e->getMessage()."\n";
419 419
     		}
420
-    		$query="ALTER TABLE spotter_live ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE";
420
+    		$query = "ALTER TABLE spotter_live ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE";
421 421
         	try {
422 422
             	    $sth = $Connection->db->prepare($query);
423 423
 		    $sth->execute();
424
-    		} catch(PDOException $e) {
424
+    		} catch (PDOException $e) {
425 425
 		    return "error (format_source column to spotter_live) : ".$e->getMessage()."\n";
426 426
     		}
427 427
     		if ($globalDBdriver == 'mysql') {
@@ -429,7 +429,7 @@  discard block
 block discarded – undo
429 429
 		    try {
430 430
             		$sth = $Connection->db->prepare($query);
431 431
 			$sth->execute();
432
-    		    } catch(PDOException $e) {
432
+    		    } catch (PDOException $e) {
433 433
 			return "error (problem when select engine for spotter_engine) : ".$e->getMessage()."\n";
434 434
     		    }
435 435
     		    $row = $sth->fetch(PDO::FETCH_ASSOC);
@@ -441,15 +441,15 @@  discard block
 block discarded – undo
441 441
 				DROP TABLE spotter_archive;
442 442
 				RENAME TABLE copy TO spotter_archive;";
443 443
             	    } else {
444
-    			$query="ALTER TABLE spotter_archive ADD verticalrate INT(11) NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE";
444
+    			$query = "ALTER TABLE spotter_archive ADD verticalrate INT(11) NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE";
445 445
             	    }
446 446
                 } else {
447
-    		    $query="ALTER TABLE spotter_archive ADD verticalrate INT(11) NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE";
447
+    		    $query = "ALTER TABLE spotter_archive ADD verticalrate INT(11) NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE";
448 448
                 }
449 449
         	try {
450 450
             	    $sth = $Connection->db->prepare($query);
451 451
 		    $sth->execute();
452
-    		} catch(PDOException $e) {
452
+    		} catch (PDOException $e) {
453 453
 		    return "error (add columns to spotter_archive) : ".$e->getMessage()."\n";
454 454
     		}
455 455
 
@@ -459,7 +459,7 @@  discard block
 block discarded – undo
459 459
         	try {
460 460
             	    $sth = $Connection->db->prepare($query);
461 461
 		    $sth->execute();
462
-    		} catch(PDOException $e) {
462
+    		} catch (PDOException $e) {
463 463
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
464 464
     		}
465 465
 		return $error;
@@ -487,7 +487,7 @@  discard block
 block discarded – undo
487 487
         	try {
488 488
             	    $sth = $Connection->db->prepare($query);
489 489
 		    $sth->execute();
490
-    		} catch(PDOException $e) {
490
+    		} catch (PDOException $e) {
491 491
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
492 492
     		}
493 493
 		return $error;
@@ -495,12 +495,12 @@  discard block
 block discarded – undo
495 495
 
496 496
 	private static function update_from_13() {
497 497
     		$Connection = new Connection();
498
-    		if (!$Connection->checkColumnName('spotter_archive_output','real_departure_airport_icao')) {
499
-    			$query="ALTER TABLE spotter_archive_output ADD real_departure_airport_icao VARCHAR(20), ADD real_departure_airport_time VARCHAR(20)";
498
+    		if (!$Connection->checkColumnName('spotter_archive_output', 'real_departure_airport_icao')) {
499
+    			$query = "ALTER TABLE spotter_archive_output ADD real_departure_airport_icao VARCHAR(20), ADD real_departure_airport_time VARCHAR(20)";
500 500
 			try {
501 501
 				$sth = $Connection->db->prepare($query);
502 502
 				$sth->execute();
503
-	    		} catch(PDOException $e) {
503
+	    		} catch (PDOException $e) {
504 504
 				return "error (update spotter_archive_output) : ".$e->getMessage()."\n";
505 505
     			}
506 506
 		}
@@ -509,7 +509,7 @@  discard block
 block discarded – undo
509 509
         	try {
510 510
             	    $sth = $Connection->db->prepare($query);
511 511
 		    $sth->execute();
512
-    		} catch(PDOException $e) {
512
+    		} catch (PDOException $e) {
513 513
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
514 514
     		}
515 515
 		return $error;
@@ -527,7 +527,7 @@  discard block
 block discarded – undo
527 527
         	try {
528 528
             	    $sth = $Connection->db->prepare($query);
529 529
 		    $sth->execute();
530
-    		} catch(PDOException $e) {
530
+    		} catch (PDOException $e) {
531 531
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
532 532
     		}
533 533
 		return $error;
@@ -538,11 +538,11 @@  discard block
 block discarded – undo
538 538
     		$Connection = new Connection();
539 539
 		$error = '';
540 540
     		// Add tables
541
-    		$query="ALTER TABLE `stats` CHANGE `stats_date` `stats_date` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP";
541
+    		$query = "ALTER TABLE `stats` CHANGE `stats_date` `stats_date` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP";
542 542
         	try {
543 543
             	    $sth = $Connection->db->prepare($query);
544 544
 		    $sth->execute();
545
-    		} catch(PDOException $e) {
545
+    		} catch (PDOException $e) {
546 546
 		    return "error (update stats) : ".$e->getMessage()."\n";
547 547
     		}
548 548
 		if ($error != '') return $error;
@@ -550,7 +550,7 @@  discard block
 block discarded – undo
550 550
         	try {
551 551
             	    $sth = $Connection->db->prepare($query);
552 552
 		    $sth->execute();
553
-    		} catch(PDOException $e) {
553
+    		} catch (PDOException $e) {
554 554
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
555 555
     		}
556 556
 		return $error;
@@ -571,7 +571,7 @@  discard block
 block discarded – undo
571 571
         	try {
572 572
             	    $sth = $Connection->db->prepare($query);
573 573
 		    $sth->execute();
574
-    		} catch(PDOException $e) {
574
+    		} catch (PDOException $e) {
575 575
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
576 576
     		}
577 577
 		return $error;
@@ -589,7 +589,7 @@  discard block
 block discarded – undo
589 589
         	try {
590 590
             	    $sth = $Connection->db->prepare($query);
591 591
 		    $sth->execute();
592
-    		} catch(PDOException $e) {
592
+    		} catch (PDOException $e) {
593 593
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
594 594
     		}
595 595
 		return $error;
@@ -598,12 +598,12 @@  discard block
 block discarded – undo
598 598
     		$Connection = new Connection();
599 599
 		$error = '';
600 600
     		// Modify stats_airport table
601
-    		if (!$Connection->checkColumnName('stats_airport','airport_name')) {
601
+    		if (!$Connection->checkColumnName('stats_airport', 'airport_name')) {
602 602
     			$query = "ALTER TABLE `stats_airport` ADD `stats_type` VARCHAR(50) NOT NULL DEFAULT 'yearly', ADD `airport_name` VARCHAR(255) NOT NULL, ADD `date` DATE NULL DEFAULT NULL, DROP INDEX `airport_icao`, ADD UNIQUE `airport_icao` (`airport_icao`, `type`, `date`)";
603 603
     	        	try {
604 604
 	            	    $sth = $Connection->db->prepare($query);
605 605
 			    $sth->execute();
606
-    			} catch(PDOException $e) {
606
+    			} catch (PDOException $e) {
607 607
 			    return "error (update stats) : ".$e->getMessage()."\n";
608 608
     			}
609 609
     		}
@@ -612,7 +612,7 @@  discard block
 block discarded – undo
612 612
         	try {
613 613
             	    $sth = $Connection->db->prepare($query);
614 614
 		    $sth->execute();
615
-    		} catch(PDOException $e) {
615
+    		} catch (PDOException $e) {
616 616
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
617 617
     		}
618 618
 		return $error;
@@ -629,73 +629,73 @@  discard block
 block discarded – undo
629 629
         	try {
630 630
             	    $sth = $Connection->db->prepare($query);
631 631
 		    $sth->execute();
632
-    		} catch(PDOException $e) {
632
+    		} catch (PDOException $e) {
633 633
 		    return "error (remove primary key on spotter_archive) : ".$e->getMessage()."\n";
634 634
     		}
635 635
 		$query = "alter table spotter_archive add spotter_archive_id INT(11)";
636 636
         	try {
637 637
             	    $sth = $Connection->db->prepare($query);
638 638
 		    $sth->execute();
639
-    		} catch(PDOException $e) {
639
+    		} catch (PDOException $e) {
640 640
 		    return "error (add id again on spotter_archive) : ".$e->getMessage()."\n";
641 641
     		}
642
-		if (!$Connection->checkColumnName('spotter_archive','over_country')) {
642
+		if (!$Connection->checkColumnName('spotter_archive', 'over_country')) {
643 643
 			// Add column over_country
644 644
     			$query = "ALTER TABLE `spotter_archive` ADD `over_country` VARCHAR(5) NULL DEFAULT NULL";
645 645
 			try {
646 646
             			$sth = $Connection->db->prepare($query);
647 647
 				$sth->execute();
648
-			} catch(PDOException $e) {
648
+			} catch (PDOException $e) {
649 649
 				return "error (add over_country) : ".$e->getMessage()."\n";
650 650
 			}
651 651
 		}
652
-		if (!$Connection->checkColumnName('spotter_live','over_country')) {
652
+		if (!$Connection->checkColumnName('spotter_live', 'over_country')) {
653 653
 			// Add column over_country
654 654
     			$query = "ALTER TABLE `spotter_live` ADD `over_country` VARCHAR(5) NULL DEFAULT NULL";
655 655
 			try {
656 656
             			$sth = $Connection->db->prepare($query);
657 657
 				$sth->execute();
658
-			} catch(PDOException $e) {
658
+			} catch (PDOException $e) {
659 659
 				return "error (add over_country) : ".$e->getMessage()."\n";
660 660
 			}
661 661
 		}
662
-		if (!$Connection->checkColumnName('spotter_output','source_name')) {
662
+		if (!$Connection->checkColumnName('spotter_output', 'source_name')) {
663 663
 			// Add source_name to spotter_output, spotter_live, spotter_archive, spotter_archive_output
664 664
     			$query = "ALTER TABLE `spotter_output` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`";
665 665
 			try {
666 666
 				$sth = $Connection->db->prepare($query);
667 667
 				$sth->execute();
668
-			} catch(PDOException $e) {
668
+			} catch (PDOException $e) {
669 669
 				return "error (add source_name column) : ".$e->getMessage()."\n";
670 670
     			}
671 671
     		}
672
-		if (!$Connection->checkColumnName('spotter_live','source_name')) {
672
+		if (!$Connection->checkColumnName('spotter_live', 'source_name')) {
673 673
 			// Add source_name to spotter_output, spotter_live, spotter_archive, spotter_archive_output
674 674
     			$query = "ALTER TABLE `spotter_live` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`";
675 675
 			try {
676 676
 				$sth = $Connection->db->prepare($query);
677 677
 				$sth->execute();
678
-			} catch(PDOException $e) {
678
+			} catch (PDOException $e) {
679 679
 				return "error (add source_name column) : ".$e->getMessage()."\n";
680 680
     			}
681 681
     		}
682
-		if (!$Connection->checkColumnName('spotter_archive_output','source_name')) {
682
+		if (!$Connection->checkColumnName('spotter_archive_output', 'source_name')) {
683 683
 			// Add source_name to spotter_output, spotter_live, spotter_archive, spotter_archive_output
684 684
     			$query = "ALTER TABLE `spotter_archive_output` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`";
685 685
 			try {
686 686
 				$sth = $Connection->db->prepare($query);
687 687
 				$sth->execute();
688
-			} catch(PDOException $e) {
688
+			} catch (PDOException $e) {
689 689
 				return "error (add source_name column) : ".$e->getMessage()."\n";
690 690
     			}
691 691
     		}
692
-		if (!$Connection->checkColumnName('spotter_archive','source_name')) {
692
+		if (!$Connection->checkColumnName('spotter_archive', 'source_name')) {
693 693
 			// Add source_name to spotter_output, spotter_live, spotter_archive, spotter_archive_output
694 694
     			$query = "ALTER TABLE `spotter_archive` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`;";
695 695
 			try {
696 696
 				$sth = $Connection->db->prepare($query);
697 697
 				$sth->execute();
698
-			} catch(PDOException $e) {
698
+			} catch (PDOException $e) {
699 699
 				return "error (add source_name column) : ".$e->getMessage()."\n";
700 700
     			}
701 701
     		}
@@ -704,7 +704,7 @@  discard block
 block discarded – undo
704 704
         	try {
705 705
             	    $sth = $Connection->db->prepare($query);
706 706
 		    $sth->execute();
707
-    		} catch(PDOException $e) {
707
+    		} catch (PDOException $e) {
708 708
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
709 709
     		}
710 710
 		return $error;
@@ -719,13 +719,13 @@  discard block
 block discarded – undo
719 719
 			$error .= create_db::import_file('../db/airlines.sql');
720 720
 			if ($error != '') return 'Import airlines.sql : '.$error;
721 721
 		}
722
-		if (!$Connection->checkColumnName('aircraft_modes','type_flight')) {
722
+		if (!$Connection->checkColumnName('aircraft_modes', 'type_flight')) {
723 723
 			// Add column over_country
724 724
     			$query = "ALTER TABLE `aircraft_modes` ADD `type_flight` VARCHAR(50) NULL DEFAULT NULL;";
725 725
         		try {
726 726
 				$sth = $Connection->db->prepare($query);
727 727
 				$sth->execute();
728
-			} catch(PDOException $e) {
728
+			} catch (PDOException $e) {
729 729
 				return "error (add over_country) : ".$e->getMessage()."\n";
730 730
     			}
731 731
     		}
@@ -741,7 +741,7 @@  discard block
 block discarded – undo
741 741
         	try {
742 742
             	    $sth = $Connection->db->prepare($query);
743 743
 		    $sth->execute();
744
-    		} catch(PDOException $e) {
744
+    		} catch (PDOException $e) {
745 745
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
746 746
     		}
747 747
 		return $error;
@@ -750,13 +750,13 @@  discard block
 block discarded – undo
750 750
 	private static function update_from_21() {
751 751
 		$Connection = new Connection();
752 752
 		$error = '';
753
-		if (!$Connection->checkColumnName('stats_airport','stats_type')) {
753
+		if (!$Connection->checkColumnName('stats_airport', 'stats_type')) {
754 754
 			// Rename type to stats_type
755 755
 			$query = "ALTER TABLE `stats_airport` CHANGE `type` `stats_type` VARCHAR(50);ALTER TABLE `stats` CHANGE `type` `stats_type` VARCHAR(50);ALTER TABLE `stats_flight` CHANGE `type` `stats_type` VARCHAR(50);";
756 756
 			try {
757 757
 				$sth = $Connection->db->prepare($query);
758 758
 				$sth->execute();
759
-			} catch(PDOException $e) {
759
+			} catch (PDOException $e) {
760 760
 				return "error (rename type to stats_type on stats*) : ".$e->getMessage()."\n";
761 761
 			}
762 762
 			if ($error != '') return $error;
@@ -765,7 +765,7 @@  discard block
 block discarded – undo
765 765
         	try {
766 766
             	    $sth = $Connection->db->prepare($query);
767 767
 		    $sth->execute();
768
-    		} catch(PDOException $e) {
768
+    		} catch (PDOException $e) {
769 769
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
770 770
     		}
771 771
 		return $error;
@@ -788,7 +788,7 @@  discard block
 block discarded – undo
788 788
         	try {
789 789
             	    $sth = $Connection->db->prepare($query);
790 790
 		    $sth->execute();
791
-    		} catch(PDOException $e) {
791
+    		} catch (PDOException $e) {
792 792
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
793 793
     		}
794 794
 		return $error;
@@ -815,17 +815,17 @@  discard block
 block discarded – undo
815 815
 			try {
816 816
 				$sth = $Connection->db->prepare($query);
817 817
 				$sth->execute();
818
-			} catch(PDOException $e) {
818
+			} catch (PDOException $e) {
819 819
 				return "error (create index on spotter_archive) : ".$e->getMessage()."\n";
820 820
 			}
821 821
 		}
822
-		if (!$Connection->checkColumnName('stats_aircraft','aircraft_manufacturer')) {
822
+		if (!$Connection->checkColumnName('stats_aircraft', 'aircraft_manufacturer')) {
823 823
 			// Add aircraft_manufacturer to stats_aircraft
824 824
     			$query = "ALTER TABLE stats_aircraft ADD aircraft_manufacturer VARCHAR(255) NULL";
825 825
 			try {
826 826
 				$sth = $Connection->db->prepare($query);
827 827
 				$sth->execute();
828
-			} catch(PDOException $e) {
828
+			} catch (PDOException $e) {
829 829
 				return "error (add aircraft_manufacturer column) : ".$e->getMessage()."\n";
830 830
     			}
831 831
     		}
@@ -834,7 +834,7 @@  discard block
 block discarded – undo
834 834
 		try {
835 835
 			$sth = $Connection->db->prepare($query);
836 836
 			$sth->execute();
837
-		} catch(PDOException $e) {
837
+		} catch (PDOException $e) {
838 838
 			return "error (update schema_version) : ".$e->getMessage()."\n";
839 839
 		}
840 840
 		return $error;
@@ -850,23 +850,23 @@  discard block
 block discarded – undo
850 850
 			$error .= create_db::import_file('../db/pgsql/airlines.sql');
851 851
 		}
852 852
 		if ($error != '') return 'Import airlines.sql : '.$error;
853
-		if (!$Connection->checkColumnName('airlines','forsource')) {
853
+		if (!$Connection->checkColumnName('airlines', 'forsource')) {
854 854
 			// Add forsource to airlines
855 855
 			$query = "ALTER TABLE airlines ADD forsource VARCHAR(255) NULL DEFAULT NULL";
856 856
 			try {
857 857
 				$sth = $Connection->db->prepare($query);
858 858
 				$sth->execute();
859
-			} catch(PDOException $e) {
859
+			} catch (PDOException $e) {
860 860
 				return "error (add forsource column) : ".$e->getMessage()."\n";
861 861
 			}
862 862
 		}
863
-		if (!$Connection->checkColumnName('stats_aircraft','stats_airline')) {
863
+		if (!$Connection->checkColumnName('stats_aircraft', 'stats_airline')) {
864 864
 			// Add forsource to airlines
865 865
 			$query = "ALTER TABLE stats_aircraft ADD stats_airline VARCHAR(255) NULL DEFAULT '', ADD filter_name VARCHAR(255) NULL DEFAULT ''";
866 866
 			try {
867 867
 				$sth = $Connection->db->prepare($query);
868 868
 				$sth->execute();
869
-			} catch(PDOException $e) {
869
+			} catch (PDOException $e) {
870 870
 				return "error (add stats_airline & filter_name column in stats_aircraft) : ".$e->getMessage()."\n";
871 871
 			}
872 872
 			// Add unique key
@@ -878,17 +878,17 @@  discard block
 block discarded – undo
878 878
 			try {
879 879
 				$sth = $Connection->db->prepare($query);
880 880
 				$sth->execute();
881
-			} catch(PDOException $e) {
881
+			} catch (PDOException $e) {
882 882
 				return "error (add unique key in stats_aircraft) : ".$e->getMessage()."\n";
883 883
 			}
884 884
 		}
885
-		if (!$Connection->checkColumnName('stats_airport','stats_airline')) {
885
+		if (!$Connection->checkColumnName('stats_airport', 'stats_airline')) {
886 886
 			// Add forsource to airlines
887 887
 			$query = "ALTER TABLE stats_airport ADD stats_airline VARCHAR(255) NULL DEFAULT '', ADD filter_name VARCHAR(255) NULL DEFAULT ''";
888 888
 			try {
889 889
 				$sth = $Connection->db->prepare($query);
890 890
 				$sth->execute();
891
-			} catch(PDOException $e) {
891
+			} catch (PDOException $e) {
892 892
 				return "error (add filter_name column in stats_airport) : ".$e->getMessage()."\n";
893 893
 			}
894 894
 			// Add unique key
@@ -900,17 +900,17 @@  discard block
 block discarded – undo
900 900
 			try {
901 901
 				$sth = $Connection->db->prepare($query);
902 902
 				$sth->execute();
903
-			} catch(PDOException $e) {
903
+			} catch (PDOException $e) {
904 904
 				return "error (add unique key in stats_airport) : ".$e->getMessage()."\n";
905 905
 			}
906 906
 		}
907
-		if (!$Connection->checkColumnName('stats_country','stats_airline')) {
907
+		if (!$Connection->checkColumnName('stats_country', 'stats_airline')) {
908 908
 			// Add forsource to airlines
909 909
 			$query = "ALTER TABLE stats_country ADD stats_airline VARCHAR(255) NULL DEFAULT '', ADD filter_name VARCHAR(255) NULL DEFAULT ''";
910 910
 			try {
911 911
 				$sth = $Connection->db->prepare($query);
912 912
 				$sth->execute();
913
-			} catch(PDOException $e) {
913
+			} catch (PDOException $e) {
914 914
 				return "error (add stats_airline & filter_name column in stats_country) : ".$e->getMessage()."\n";
915 915
 			}
916 916
 			// Add unique key
@@ -922,36 +922,36 @@  discard block
 block discarded – undo
922 922
 			try {
923 923
 				$sth = $Connection->db->prepare($query);
924 924
 				$sth->execute();
925
-			} catch(PDOException $e) {
925
+			} catch (PDOException $e) {
926 926
 				return "error (add unique key in stats_airline) : ".$e->getMessage()."\n";
927 927
 			}
928 928
 		}
929
-		if (!$Connection->checkColumnName('stats_flight','stats_airline')) {
929
+		if (!$Connection->checkColumnName('stats_flight', 'stats_airline')) {
930 930
 			// Add forsource to airlines
931 931
 			$query = "ALTER TABLE stats_flight ADD stats_airline VARCHAR(255) NULL DEFAULT '', ADD filter_name VARCHAR(255) NULL DEFAULT ''";
932 932
 			try {
933 933
 				$sth = $Connection->db->prepare($query);
934 934
 				$sth->execute();
935
-			} catch(PDOException $e) {
935
+			} catch (PDOException $e) {
936 936
 				return "error (add stats_airline & filter_name column in stats_flight) : ".$e->getMessage()."\n";
937 937
 			}
938 938
 		}
939
-		if (!$Connection->checkColumnName('stats','stats_airline')) {
939
+		if (!$Connection->checkColumnName('stats', 'stats_airline')) {
940 940
 			// Add forsource to airlines
941 941
 			$query = "ALTER TABLE stats ADD stats_airline VARCHAR(255) NULL DEFAULT '', ADD filter_name VARCHAR(255) NULL DEFAULT ''";
942 942
 			try {
943 943
 				$sth = $Connection->db->prepare($query);
944 944
 				$sth->execute();
945
-			} catch(PDOException $e) {
945
+			} catch (PDOException $e) {
946 946
 				return "error (add stats_airline & filter_name column in stats) : ".$e->getMessage()."\n";
947 947
 			}
948
-			if ($globalDBdriver == 'mysql' && $Connection->indexExists('stats','type')) {
948
+			if ($globalDBdriver == 'mysql' && $Connection->indexExists('stats', 'type')) {
949 949
 				// Add unique key
950 950
 				$query = "drop index type on stats;ALTER TABLE stats ADD UNIQUE stats_type (stats_type,stats_date,stats_airline,filter_name);";
951 951
 				try {
952 952
 					$sth = $Connection->db->prepare($query);
953 953
 					$sth->execute();
954
-				} catch(PDOException $e) {
954
+				} catch (PDOException $e) {
955 955
 					return "error (add unique key in stats) : ".$e->getMessage()."\n";
956 956
 				}
957 957
 			} else {
@@ -964,18 +964,18 @@  discard block
 block discarded – undo
964 964
 				try {
965 965
 					$sth = $Connection->db->prepare($query);
966 966
 					$sth->execute();
967
-				} catch(PDOException $e) {
967
+				} catch (PDOException $e) {
968 968
 					return "error (add unique key in stats) : ".$e->getMessage()."\n";
969 969
 				}
970 970
 			}
971 971
 		}
972
-		if (!$Connection->checkColumnName('stats_registration','stats_airline')) {
972
+		if (!$Connection->checkColumnName('stats_registration', 'stats_airline')) {
973 973
 			// Add forsource to airlines
974 974
 			$query = "ALTER TABLE stats_registration ADD stats_airline VARCHAR(255) NULL DEFAULT '', ADD filter_name VARCHAR(255) NULL DEFAULT ''";
975 975
 			try {
976 976
 				$sth = $Connection->db->prepare($query);
977 977
 				$sth->execute();
978
-			} catch(PDOException $e) {
978
+			} catch (PDOException $e) {
979 979
 				return "error (add stats_airline & filter_name column in stats_registration) : ".$e->getMessage()."\n";
980 980
 			}
981 981
 			// Add unique key
@@ -987,17 +987,17 @@  discard block
 block discarded – undo
987 987
 			try {
988 988
 				$sth = $Connection->db->prepare($query);
989 989
 				$sth->execute();
990
-			} catch(PDOException $e) {
990
+			} catch (PDOException $e) {
991 991
 				return "error (add unique key in stats_registration) : ".$e->getMessage()."\n";
992 992
 			}
993 993
 		}
994
-		if (!$Connection->checkColumnName('stats_callsign','filter_name')) {
994
+		if (!$Connection->checkColumnName('stats_callsign', 'filter_name')) {
995 995
 			// Add forsource to airlines
996 996
 			$query = "ALTER TABLE stats_callsign ADD filter_name VARCHAR(255) NULL DEFAULT ''";
997 997
 			try {
998 998
 				$sth = $Connection->db->prepare($query);
999 999
 				$sth->execute();
1000
-			} catch(PDOException $e) {
1000
+			} catch (PDOException $e) {
1001 1001
 				return "error (add filter_name column in stats_callsign) : ".$e->getMessage()."\n";
1002 1002
 			}
1003 1003
 			// Add unique key
@@ -1009,17 +1009,17 @@  discard block
 block discarded – undo
1009 1009
 			try {
1010 1010
 				$sth = $Connection->db->prepare($query);
1011 1011
 				$sth->execute();
1012
-			} catch(PDOException $e) {
1012
+			} catch (PDOException $e) {
1013 1013
 				return "error (add unique key in stats_callsign) : ".$e->getMessage()."\n";
1014 1014
 			}
1015 1015
 		}
1016
-		if (!$Connection->checkColumnName('stats_airline','filter_name')) {
1016
+		if (!$Connection->checkColumnName('stats_airline', 'filter_name')) {
1017 1017
 			// Add forsource to airlines
1018 1018
 			$query = "ALTER TABLE stats_airline ADD filter_name VARCHAR(255) NULL DEFAULT ''";
1019 1019
 			try {
1020 1020
 				$sth = $Connection->db->prepare($query);
1021 1021
 				$sth->execute();
1022
-			} catch(PDOException $e) {
1022
+			} catch (PDOException $e) {
1023 1023
 				return "error (add filter_name column in stats_airline) : ".$e->getMessage()."\n";
1024 1024
 			}
1025 1025
 			// Add unique key
@@ -1031,7 +1031,7 @@  discard block
 block discarded – undo
1031 1031
 			try {
1032 1032
 				$sth = $Connection->db->prepare($query);
1033 1033
 				$sth->execute();
1034
-			} catch(PDOException $e) {
1034
+			} catch (PDOException $e) {
1035 1035
 				return "error (add unique key in stats_callsign) : ".$e->getMessage()."\n";
1036 1036
 			}
1037 1037
 		}
@@ -1040,7 +1040,7 @@  discard block
 block discarded – undo
1040 1040
 		try {
1041 1041
 			$sth = $Connection->db->prepare($query);
1042 1042
 			$sth->execute();
1043
-		} catch(PDOException $e) {
1043
+		} catch (PDOException $e) {
1044 1044
 			return "error (update schema_version) : ".$e->getMessage()."\n";
1045 1045
 		}
1046 1046
 		return $error;
@@ -1050,13 +1050,13 @@  discard block
 block discarded – undo
1050 1050
 		global $globalDBdriver;
1051 1051
 		$Connection = new Connection();
1052 1052
 		$error = '';
1053
-		if (!$Connection->checkColumnName('stats_owner','stats_airline')) {
1053
+		if (!$Connection->checkColumnName('stats_owner', 'stats_airline')) {
1054 1054
 			// Add forsource to airlines
1055 1055
 			$query = "ALTER TABLE stats_owner ADD stats_airline VARCHAR(255) NULL DEFAULT '', ADD filter_name VARCHAR(255) NULL DEFAULT ''";
1056 1056
 			try {
1057 1057
 				$sth = $Connection->db->prepare($query);
1058 1058
 				$sth->execute();
1059
-			} catch(PDOException $e) {
1059
+			} catch (PDOException $e) {
1060 1060
 				return "error (add stats_airline & filter_name column in stats_owner) : ".$e->getMessage()."\n";
1061 1061
 			}
1062 1062
 			// Add unique key
@@ -1068,17 +1068,17 @@  discard block
 block discarded – undo
1068 1068
 			try {
1069 1069
 				$sth = $Connection->db->prepare($query);
1070 1070
 				$sth->execute();
1071
-			} catch(PDOException $e) {
1071
+			} catch (PDOException $e) {
1072 1072
 				return "error (add unique key in stats_owner) : ".$e->getMessage()."\n";
1073 1073
 			}
1074 1074
 		}
1075
-		if (!$Connection->checkColumnName('stats_pilot','stats_airline')) {
1075
+		if (!$Connection->checkColumnName('stats_pilot', 'stats_airline')) {
1076 1076
 			// Add forsource to airlines
1077 1077
 			$query = "ALTER TABLE stats_pilot ADD stats_airline VARCHAR(255) NULL DEFAULT '', ADD filter_name VARCHAR(255) NULL DEFAULT ''";
1078 1078
 			try {
1079 1079
 				$sth = $Connection->db->prepare($query);
1080 1080
 				$sth->execute();
1081
-			} catch(PDOException $e) {
1081
+			} catch (PDOException $e) {
1082 1082
 				return "error (add stats_airline & filter_name column in stats_pilot) : ".$e->getMessage()."\n";
1083 1083
 			}
1084 1084
 			// Add unique key
@@ -1090,7 +1090,7 @@  discard block
 block discarded – undo
1090 1090
 			try {
1091 1091
 				$sth = $Connection->db->prepare($query);
1092 1092
 				$sth->execute();
1093
-			} catch(PDOException $e) {
1093
+			} catch (PDOException $e) {
1094 1094
 				return "error (add unique key in stats_pilot) : ".$e->getMessage()."\n";
1095 1095
 			}
1096 1096
 		}
@@ -1098,7 +1098,7 @@  discard block
 block discarded – undo
1098 1098
 		try {
1099 1099
 			$sth = $Connection->db->prepare($query);
1100 1100
 			$sth->execute();
1101
-		} catch(PDOException $e) {
1101
+		} catch (PDOException $e) {
1102 1102
 			return "error (update schema_version) : ".$e->getMessage()."\n";
1103 1103
 		}
1104 1104
 		return $error;
@@ -1108,12 +1108,12 @@  discard block
 block discarded – undo
1108 1108
 		global $globalDBdriver;
1109 1109
 		$Connection = new Connection();
1110 1110
 		$error = '';
1111
-		if (!$Connection->checkColumnName('atc','format_source')) {
1111
+		if (!$Connection->checkColumnName('atc', 'format_source')) {
1112 1112
 			$query = "ALTER TABLE atc ADD format_source VARCHAR(255) DEFAULT NULL, ADD source_name VARCHAR(255) DEFAULT NULL";
1113 1113
 			try {
1114 1114
 				$sth = $Connection->db->prepare($query);
1115 1115
 				$sth->execute();
1116
-			} catch(PDOException $e) {
1116
+			} catch (PDOException $e) {
1117 1117
 				return "error (add format_source & source_name column in atc) : ".$e->getMessage()."\n";
1118 1118
 			}
1119 1119
 		}
@@ -1121,7 +1121,7 @@  discard block
 block discarded – undo
1121 1121
 		try {
1122 1122
 			$sth = $Connection->db->prepare($query);
1123 1123
 			$sth->execute();
1124
-		} catch(PDOException $e) {
1124
+		} catch (PDOException $e) {
1125 1125
 			return "error (update schema_version) : ".$e->getMessage()."\n";
1126 1126
 		}
1127 1127
 		return $error;
@@ -1131,13 +1131,13 @@  discard block
 block discarded – undo
1131 1131
 		global $globalDBdriver;
1132 1132
 		$Connection = new Connection();
1133 1133
 		$error = '';
1134
-		if (!$Connection->checkColumnName('stats_pilot','format_source')) {
1134
+		if (!$Connection->checkColumnName('stats_pilot', 'format_source')) {
1135 1135
 			// Add forsource to airlines
1136 1136
 			$query = "ALTER TABLE stats_pilot ADD format_source VARCHAR(255) NULL DEFAULT ''";
1137 1137
 			try {
1138 1138
 				$sth = $Connection->db->prepare($query);
1139 1139
 				$sth->execute();
1140
-			} catch(PDOException $e) {
1140
+			} catch (PDOException $e) {
1141 1141
 				return "error (add format_source column in stats_pilot) : ".$e->getMessage()."\n";
1142 1142
 			}
1143 1143
 			// Add unique key
@@ -1149,7 +1149,7 @@  discard block
 block discarded – undo
1149 1149
 			try {
1150 1150
 				$sth = $Connection->db->prepare($query);
1151 1151
 				$sth->execute();
1152
-			} catch(PDOException $e) {
1152
+			} catch (PDOException $e) {
1153 1153
 				return "error (modify unique key in stats_pilot) : ".$e->getMessage()."\n";
1154 1154
 			}
1155 1155
 		}
@@ -1157,7 +1157,7 @@  discard block
 block discarded – undo
1157 1157
 		try {
1158 1158
 			$sth = $Connection->db->prepare($query);
1159 1159
 			$sth->execute();
1160
-		} catch(PDOException $e) {
1160
+		} catch (PDOException $e) {
1161 1161
 			return "error (update schema_version) : ".$e->getMessage()."\n";
1162 1162
 		}
1163 1163
 		return $error;
@@ -1167,23 +1167,23 @@  discard block
 block discarded – undo
1167 1167
 		global $globalDBdriver;
1168 1168
 		$Connection = new Connection();
1169 1169
 		$error = '';
1170
-		if ($globalDBdriver == 'mysql' && !$Connection->indexExists('spotter_live','latitude')) {
1170
+		if ($globalDBdriver == 'mysql' && !$Connection->indexExists('spotter_live', 'latitude')) {
1171 1171
 			// Add unique key
1172 1172
 			$query = "alter table spotter_live add index(latitude,longitude)";
1173 1173
 			try {
1174 1174
 				$sth = $Connection->db->prepare($query);
1175 1175
 				$sth->execute();
1176
-			} catch(PDOException $e) {
1176
+			} catch (PDOException $e) {
1177 1177
 				return "error (add index latitude,longitude on spotter_live) : ".$e->getMessage()."\n";
1178 1178
 			}
1179 1179
                 }
1180
-		if (!$Connection->checkColumnName('aircraft','mfr')) {
1180
+		if (!$Connection->checkColumnName('aircraft', 'mfr')) {
1181 1181
 			// Add mfr to aircraft
1182 1182
 			$query = "ALTER TABLE aircraft ADD mfr VARCHAR(255) NULL";
1183 1183
 			try {
1184 1184
 				$sth = $Connection->db->prepare($query);
1185 1185
 				$sth->execute();
1186
-			} catch(PDOException $e) {
1186
+			} catch (PDOException $e) {
1187 1187
 				return "error (add mfr column in aircraft) : ".$e->getMessage()."\n";
1188 1188
 			}
1189 1189
 		}
@@ -1199,7 +1199,7 @@  discard block
 block discarded – undo
1199 1199
 		try {
1200 1200
 			$sth = $Connection->db->prepare($query);
1201 1201
 			$sth->execute();
1202
-		} catch(PDOException $e) {
1202
+		} catch (PDOException $e) {
1203 1203
 			return "error (update schema_version) : ".$e->getMessage()."\n";
1204 1204
 		}
1205 1205
 		return $error;
@@ -1209,13 +1209,13 @@  discard block
 block discarded – undo
1209 1209
 		global $globalDBdriver;
1210 1210
 		$Connection = new Connection();
1211 1211
 		$error = '';
1212
-		if ($Connection->checkColumnName('aircraft','mfr')) {
1212
+		if ($Connection->checkColumnName('aircraft', 'mfr')) {
1213 1213
 			// drop mfr to aircraft
1214 1214
 			$query = "ALTER TABLE aircraft DROP COLUMN mfr";
1215 1215
 			try {
1216 1216
 				$sth = $Connection->db->prepare($query);
1217 1217
 				$sth->execute();
1218
-			} catch(PDOException $e) {
1218
+			} catch (PDOException $e) {
1219 1219
 				return "error (drop mfr column in aircraft) : ".$e->getMessage()."\n";
1220 1220
 			}
1221 1221
 		}
@@ -1231,7 +1231,7 @@  discard block
 block discarded – undo
1231 1231
 		try {
1232 1232
 			$sth = $Connection->db->prepare($query);
1233 1233
 			$sth->execute();
1234
-		} catch(PDOException $e) {
1234
+		} catch (PDOException $e) {
1235 1235
 			return "error (update schema_version) : ".$e->getMessage()."\n";
1236 1236
 		}
1237 1237
 		return $error;
@@ -1241,33 +1241,33 @@  discard block
 block discarded – undo
1241 1241
 		global $globalDBdriver;
1242 1242
 		$Connection = new Connection();
1243 1243
 		$error = '';
1244
-		if (!$Connection->indexExists('notam','ref_idx')) {
1244
+		if (!$Connection->indexExists('notam', 'ref_idx')) {
1245 1245
 			// Add index key
1246 1246
 			$query = "create index ref_idx on notam (ref)";
1247 1247
 			try {
1248 1248
 				$sth = $Connection->db->prepare($query);
1249 1249
 				$sth->execute();
1250
-			} catch(PDOException $e) {
1250
+			} catch (PDOException $e) {
1251 1251
 				return "error (add index ref on notam) : ".$e->getMessage()."\n";
1252 1252
 			}
1253 1253
                 }
1254
-		if (!$Connection->indexExists('accidents','registration_idx')) {
1254
+		if (!$Connection->indexExists('accidents', 'registration_idx')) {
1255 1255
 			// Add index key
1256 1256
 			$query = "create index registration_idx on accidents (registration)";
1257 1257
 			try {
1258 1258
 				$sth = $Connection->db->prepare($query);
1259 1259
 				$sth->execute();
1260
-			} catch(PDOException $e) {
1260
+			} catch (PDOException $e) {
1261 1261
 				return "error (add index registration on accidents) : ".$e->getMessage()."\n";
1262 1262
 			}
1263 1263
                 }
1264
-		if (!$Connection->indexExists('accidents','rdts')) {
1264
+		if (!$Connection->indexExists('accidents', 'rdts')) {
1265 1265
 			// Add index key
1266 1266
 			$query = "create index rdts on accidents (registration,date,type,source)";
1267 1267
 			try {
1268 1268
 				$sth = $Connection->db->prepare($query);
1269 1269
 				$sth->execute();
1270
-			} catch(PDOException $e) {
1270
+			} catch (PDOException $e) {
1271 1271
 				return "error (add index registration, date, type & source on accidents) : ".$e->getMessage()."\n";
1272 1272
 			}
1273 1273
                 }
@@ -1276,7 +1276,7 @@  discard block
 block discarded – undo
1276 1276
 		try {
1277 1277
 			$sth = $Connection->db->prepare($query);
1278 1278
 			$sth->execute();
1279
-		} catch(PDOException $e) {
1279
+		} catch (PDOException $e) {
1280 1280
 			return "error (update schema_version) : ".$e->getMessage()."\n";
1281 1281
 		}
1282 1282
 		return $error;
@@ -1286,23 +1286,23 @@  discard block
 block discarded – undo
1286 1286
 		global $globalDBdriver;
1287 1287
 		$Connection = new Connection();
1288 1288
 		$error = '';
1289
-		if (!$Connection->checkColumnName('accidents','airline_name')) {
1289
+		if (!$Connection->checkColumnName('accidents', 'airline_name')) {
1290 1290
 			// Add airline_name to accidents
1291 1291
 			$query = "ALTER TABLE accidents ADD airline_name VARCHAR(255) NULL";
1292 1292
 			try {
1293 1293
 				$sth = $Connection->db->prepare($query);
1294 1294
 				$sth->execute();
1295
-			} catch(PDOException $e) {
1295
+			} catch (PDOException $e) {
1296 1296
 				return "error (add airline_name column in accidents) : ".$e->getMessage()."\n";
1297 1297
 			}
1298 1298
 		}
1299
-		if (!$Connection->checkColumnName('accidents','airline_icao')) {
1299
+		if (!$Connection->checkColumnName('accidents', 'airline_icao')) {
1300 1300
 			// Add airline_icao to accidents
1301 1301
 			$query = "ALTER TABLE accidents ADD airline_icao VARCHAR(10) NULL";
1302 1302
 			try {
1303 1303
 				$sth = $Connection->db->prepare($query);
1304 1304
 				$sth->execute();
1305
-			} catch(PDOException $e) {
1305
+			} catch (PDOException $e) {
1306 1306
 				return "error (add airline_icao column in accidents) : ".$e->getMessage()."\n";
1307 1307
 			}
1308 1308
 		}
@@ -1310,7 +1310,7 @@  discard block
 block discarded – undo
1310 1310
 		try {
1311 1311
 			$sth = $Connection->db->prepare($query);
1312 1312
 			$sth->execute();
1313
-		} catch(PDOException $e) {
1313
+		} catch (PDOException $e) {
1314 1314
 			return "error (update schema_version) : ".$e->getMessage()."\n";
1315 1315
 		}
1316 1316
 		return $error;
@@ -1320,13 +1320,13 @@  discard block
 block discarded – undo
1320 1320
 		global $globalDBdriver, $globalVATSIM, $globalIVAO;
1321 1321
 		$Connection = new Connection();
1322 1322
 		$error = '';
1323
-		if (!$Connection->checkColumnName('airlines','alliance')) {
1323
+		if (!$Connection->checkColumnName('airlines', 'alliance')) {
1324 1324
 			// Add alliance to airlines
1325 1325
 			$query = "ALTER TABLE airlines ADD alliance VARCHAR(255) NULL";
1326 1326
 			try {
1327 1327
 				$sth = $Connection->db->prepare($query);
1328 1328
 				$sth->execute();
1329
-			} catch(PDOException $e) {
1329
+			} catch (PDOException $e) {
1330 1330
 				return "error (add alliance column in airlines) : ".$e->getMessage()."\n";
1331 1331
 			}
1332 1332
 		}
@@ -1353,7 +1353,7 @@  discard block
 block discarded – undo
1353 1353
 		try {
1354 1354
 			$sth = $Connection->db->prepare($query);
1355 1355
 			$sth->execute();
1356
-		} catch(PDOException $e) {
1356
+		} catch (PDOException $e) {
1357 1357
 			return "error (update schema_version) : ".$e->getMessage()."\n";
1358 1358
 		}
1359 1359
 		return $error;
@@ -1375,7 +1375,7 @@  discard block
 block discarded – undo
1375 1375
 		    try {
1376 1376
             		$sth = $Connection->db->prepare($query);
1377 1377
 		        $sth->execute();
1378
-		    } catch(PDOException $e) {
1378
+		    } catch (PDOException $e) {
1379 1379
 			return "error : ".$e->getMessage()."\n";
1380 1380
     		    }
1381 1381
     		    $result = $sth->fetch(PDO::FETCH_ASSOC);
Please login to merge, or discard this patch.
Braces   +267 added lines, -100 removed lines patch added patch discarded remove patch
@@ -258,7 +258,9 @@  discard block
 block discarded – undo
258 258
     		// Update table countries
259 259
     		if ($Connection->tableExists('airspace')) {
260 260
     		    $error .= update_db::update_countries();
261
-		    if ($error != '') return $error;
261
+		    if ($error != '') {
262
+		    	return $error;
263
+		    }
262 264
 		}
263 265
 		// Update schema_version to 7
264 266
 		$query = "UPDATE `config` SET `value` = '7' WHERE `name` = 'schema_version'";
@@ -314,7 +316,9 @@  discard block
 block discarded – undo
314 316
     		$error = '';
315 317
     		// Update table aircraft
316 318
 		$error .= create_db::import_file('../db/source_location.sql');
317
-		if ($error != '') return $error;
319
+		if ($error != '') {
320
+			return $error;
321
+		}
318 322
 		// Update schema_version to 6
319 323
 		$query = "UPDATE `config` SET `value` = '8' WHERE `name` = 'schema_version'";
320 324
         	try {
@@ -331,7 +335,9 @@  discard block
 block discarded – undo
331 335
     		$error = '';
332 336
     		// Update table aircraft
333 337
 		$error .= create_db::import_file('../db/notam.sql');
334
-		if ($error != '') return $error;
338
+		if ($error != '') {
339
+			return $error;
340
+		}
335 341
 		$query = "DELETE FROM config WHERE name = 'last_update_db';
336 342
                         INSERT INTO config (name,value) VALUES ('last_update_db',NOW());
337 343
                         DELETE FROM config WHERE name = 'last_update_notam_db';
@@ -365,7 +371,9 @@  discard block
 block discarded – undo
365 371
 		$error = '';
366 372
     		// Update table atc
367 373
 		$error .= create_db::import_file('../db/atc.sql');
368
-		if ($error != '') return $error;
374
+		if ($error != '') {
375
+			return $error;
376
+		}
369 377
 		
370 378
 		$query = "UPDATE `config` SET `value` = '10' WHERE `name` = 'schema_version'";
371 379
         	try {
@@ -389,13 +397,21 @@  discard block
 block discarded – undo
389 397
 		$error = '';
390 398
     		// Add tables
391 399
 		$error .= create_db::import_file('../db/aircraft_owner.sql');
392
-		if ($error != '') return $error;
400
+		if ($error != '') {
401
+			return $error;
402
+		}
393 403
 		$error .= create_db::import_file('../db/metar.sql');
394
-		if ($error != '') return $error;
404
+		if ($error != '') {
405
+			return $error;
406
+		}
395 407
 		$error .= create_db::import_file('../db/taf.sql');
396
-		if ($error != '') return $error;
408
+		if ($error != '') {
409
+			return $error;
410
+		}
397 411
 		$error .= create_db::import_file('../db/airport.sql');
398
-		if ($error != '') return $error;
412
+		if ($error != '') {
413
+			return $error;
414
+		}
399 415
 		
400 416
 		$query = "UPDATE `config` SET `value` = '11' WHERE `name` = 'schema_version'";
401 417
         	try {
@@ -469,19 +485,33 @@  discard block
 block discarded – undo
469 485
 		$error = '';
470 486
     		// Add tables
471 487
 		$error .= create_db::import_file('../db/stats.sql');
472
-		if ($error != '') return $error;
488
+		if ($error != '') {
489
+			return $error;
490
+		}
473 491
 		$error .= create_db::import_file('../db/stats_aircraft.sql');
474
-		if ($error != '') return $error;
492
+		if ($error != '') {
493
+			return $error;
494
+		}
475 495
 		$error .= create_db::import_file('../db/stats_airline.sql');
476
-		if ($error != '') return $error;
496
+		if ($error != '') {
497
+			return $error;
498
+		}
477 499
 		$error .= create_db::import_file('../db/stats_airport.sql');
478
-		if ($error != '') return $error;
500
+		if ($error != '') {
501
+			return $error;
502
+		}
479 503
 		$error .= create_db::import_file('../db/stats_owner.sql');
480
-		if ($error != '') return $error;
504
+		if ($error != '') {
505
+			return $error;
506
+		}
481 507
 		$error .= create_db::import_file('../db/stats_pilot.sql');
482
-		if ($error != '') return $error;
508
+		if ($error != '') {
509
+			return $error;
510
+		}
483 511
 		$error .= create_db::import_file('../db/spotter_archive_output.sql');
484
-		if ($error != '') return $error;
512
+		if ($error != '') {
513
+			return $error;
514
+		}
485 515
 		
486 516
 		$query = "UPDATE `config` SET `value` = '13' WHERE `name` = 'schema_version'";
487 517
         	try {
@@ -521,7 +551,9 @@  discard block
 block discarded – undo
521 551
     		// Add tables
522 552
     		if (!$Connection->tableExists('stats_flight')) {
523 553
 			$error .= create_db::import_file('../db/stats_flight.sql');
524
-			if ($error != '') return $error;
554
+			if ($error != '') {
555
+				return $error;
556
+			}
525 557
 		}
526 558
 		$query = "UPDATE `config` SET `value` = '15' WHERE `name` = 'schema_version'";
527 559
         	try {
@@ -545,7 +577,9 @@  discard block
 block discarded – undo
545 577
     		} catch(PDOException $e) {
546 578
 		    return "error (update stats) : ".$e->getMessage()."\n";
547 579
     		}
548
-		if ($error != '') return $error;
580
+		if ($error != '') {
581
+			return $error;
582
+		}
549 583
 		$query = "UPDATE `config` SET `value` = '16' WHERE `name` = 'schema_version'";
550 584
         	try {
551 585
             	    $sth = $Connection->db->prepare($query);
@@ -566,7 +600,9 @@  discard block
 block discarded – undo
566 600
     		if (!$Connection->tableExists('stats_callsign')) {
567 601
 			$error .= create_db::import_file('../db/stats_callsign.sql');
568 602
 		}
569
-		if ($error != '') return $error;
603
+		if ($error != '') {
604
+			return $error;
605
+		}
570 606
 		$query = "UPDATE `config` SET `value` = '17' WHERE `name` = 'schema_version'";
571 607
         	try {
572 608
             	    $sth = $Connection->db->prepare($query);
@@ -584,7 +620,9 @@  discard block
 block discarded – undo
584 620
     		if (!$Connection->tableExists('stats_country')) {
585 621
 			$error .= create_db::import_file('../db/stats_country.sql');
586 622
 		}
587
-		if ($error != '') return $error;
623
+		if ($error != '') {
624
+			return $error;
625
+		}
588 626
 		$query = "UPDATE `config` SET `value` = '18' WHERE `name` = 'schema_version'";
589 627
         	try {
590 628
             	    $sth = $Connection->db->prepare($query);
@@ -607,7 +645,9 @@  discard block
 block discarded – undo
607 645
 			    return "error (update stats) : ".$e->getMessage()."\n";
608 646
     			}
609 647
     		}
610
-		if ($error != '') return $error;
648
+		if ($error != '') {
649
+			return $error;
650
+		}
611 651
 		$query = "UPDATE `config` SET `value` = '19' WHERE `name` = 'schema_version'";
612 652
         	try {
613 653
             	    $sth = $Connection->db->prepare($query);
@@ -623,7 +663,9 @@  discard block
 block discarded – undo
623 663
 		$error = '';
624 664
     		// Update airport table
625 665
 		$error .= create_db::import_file('../db/airport.sql');
626
-		if ($error != '') return 'Import airport.sql : '.$error;
666
+		if ($error != '') {
667
+			return 'Import airport.sql : '.$error;
668
+		}
627 669
 		// Remove primary key on Spotter_Archive
628 670
 		$query = "alter table spotter_archive drop spotter_archive_id";
629 671
         	try {
@@ -699,7 +741,9 @@  discard block
 block discarded – undo
699 741
 				return "error (add source_name column) : ".$e->getMessage()."\n";
700 742
     			}
701 743
     		}
702
-		if ($error != '') return $error;
744
+		if ($error != '') {
745
+			return $error;
746
+		}
703 747
 		$query = "UPDATE `config` SET `value` = '20' WHERE `name` = 'schema_version'";
704 748
         	try {
705 749
             	    $sth = $Connection->db->prepare($query);
@@ -717,7 +761,9 @@  discard block
 block discarded – undo
717 761
     		// Update airline table
718 762
     		if (!$globalIVAO && !$globalVATSIM && !$globalphpVMS) {
719 763
 			$error .= create_db::import_file('../db/airlines.sql');
720
-			if ($error != '') return 'Import airlines.sql : '.$error;
764
+			if ($error != '') {
765
+				return 'Import airlines.sql : '.$error;
766
+			}
721 767
 		}
722 768
 		if (!$Connection->checkColumnName('aircraft_modes','type_flight')) {
723 769
 			// Add column over_country
@@ -729,7 +775,9 @@  discard block
 block discarded – undo
729 775
 				return "error (add over_country) : ".$e->getMessage()."\n";
730 776
     			}
731 777
     		}
732
-		if ($error != '') return $error;
778
+		if ($error != '') {
779
+			return $error;
780
+		}
733 781
 		/*
734 782
     		if (!$globalIVAO && !$globalVATSIM && !$globalphpVMS) {
735 783
 			// Force update ModeS (this will put type_flight data
@@ -759,7 +807,9 @@  discard block
 block discarded – undo
759 807
 			} catch(PDOException $e) {
760 808
 				return "error (rename type to stats_type on stats*) : ".$e->getMessage()."\n";
761 809
 			}
762
-			if ($error != '') return $error;
810
+			if ($error != '') {
811
+				return $error;
812
+			}
763 813
 		}
764 814
 		$query = "UPDATE `config` SET `value` = '22' WHERE `name` = 'schema_version'";
765 815
         	try {
@@ -782,7 +832,9 @@  discard block
 block discarded – undo
782 832
 			} else {
783 833
 				$error .= create_db::import_file('../db/pgsql/stats_source.sql');
784 834
 			}
785
-			if ($error != '') return $error;
835
+			if ($error != '') {
836
+				return $error;
837
+			}
786 838
 		}
787 839
 		$query = "UPDATE config SET value = '23' WHERE name = 'schema_version'";
788 840
         	try {
@@ -804,12 +856,16 @@  discard block
 block discarded – undo
804 856
 		if ($globalDBdriver == 'mysql') {
805 857
 			if (!$Connection->tableExists('tle')) {
806 858
 				$error .= create_db::import_file('../db/tle.sql');
807
-				if ($error != '') return $error;
859
+				if ($error != '') {
860
+					return $error;
861
+				}
808 862
 			}
809 863
 		} else {
810 864
 			if (!$Connection->tableExists('tle')) {
811 865
 				$error .= create_db::import_file('../db/pgsql/tle.sql');
812
-				if ($error != '') return $error;
866
+				if ($error != '') {
867
+					return $error;
868
+				}
813 869
 			}
814 870
 			$query = "create index flightaware_id_idx ON spotter_archive USING btree(flightaware_id)";
815 871
 			try {
@@ -849,7 +905,9 @@  discard block
 block discarded – undo
849 905
 		} else {
850 906
 			$error .= create_db::import_file('../db/pgsql/airlines.sql');
851 907
 		}
852
-		if ($error != '') return 'Import airlines.sql : '.$error;
908
+		if ($error != '') {
909
+			return 'Import airlines.sql : '.$error;
910
+		}
853 911
 		if (!$Connection->checkColumnName('airlines','forsource')) {
854 912
 			// Add forsource to airlines
855 913
 			$query = "ALTER TABLE airlines ADD forsource VARCHAR(255) NULL DEFAULT NULL";
@@ -1332,20 +1390,28 @@  discard block
 block discarded – undo
1332 1390
 		}
1333 1391
 		if ($globalDBdriver == 'mysql') {
1334 1392
 			$error .= create_db::import_file('../db/airlines.sql');
1335
-			if ($error != '') return $error;
1393
+			if ($error != '') {
1394
+				return $error;
1395
+			}
1336 1396
 		} else {
1337 1397
 			$error .= create_db::import_file('../db/pgsql/airlines.sql');
1338
-			if ($error != '') return $error;
1398
+			if ($error != '') {
1399
+				return $error;
1400
+			}
1339 1401
 		}
1340 1402
 		if ((isset($globalVATSIM) && $globalVATSIM) || (isset($globalIVAO) && $globalIVAO)) {
1341 1403
 			include_once('class/class.update_db.php');
1342 1404
 			if (isset($globalVATSIM) && $globalVATSIM) {
1343 1405
 				$error .= update_db::update_vatsim();
1344
-				if ($error != '') return $error;
1406
+				if ($error != '') {
1407
+					return $error;
1408
+				}
1345 1409
 			}
1346 1410
 			if (isset($globalIVAO) && $globalIVAO && file_exists('tmp/ivae_feb2013.zip')) {
1347 1411
 				$error .= update_db::update_IVAO();
1348
-				if ($error != '') return $error;
1412
+				if ($error != '') {
1413
+					return $error;
1414
+				}
1349 1415
 			}
1350 1416
 		}
1351 1417
 
@@ -1367,8 +1433,11 @@  discard block
 block discarded – undo
1367 1433
     	    if ($Connection->tableExists('aircraft')) {
1368 1434
     		if (!$Connection->tableExists('config')) {
1369 1435
     		    $version = '1';
1370
-    		    if ($update) return self::update_from_1();
1371
-    		    else return $version;
1436
+    		    if ($update) {
1437
+    		    	return self::update_from_1();
1438
+    		    } else {
1439
+    		    	return $version;
1440
+    		    }
1372 1441
 		} else {
1373 1442
     		    $Connection = new Connection();
1374 1443
 		    $query = "SELECT value FROM config WHERE name = 'schema_version' LIMIT 1";
@@ -1382,134 +1451,232 @@  discard block
 block discarded – undo
1382 1451
     		    if ($update) {
1383 1452
     			if ($result['value'] == '2') {
1384 1453
     			    $error = self::update_from_2();
1385
-    			    if ($error != '') return $error;
1386
-    			    else return self::check_version(true);
1454
+    			    if ($error != '') {
1455
+    			    	return $error;
1456
+    			    } else {
1457
+    			    	return self::check_version(true);
1458
+    			    }
1387 1459
     			} elseif ($result['value'] == '3') {
1388 1460
     			    $error = self::update_from_3();
1389
-    			    if ($error != '') return $error;
1390
-    			    else return self::check_version(true);
1461
+    			    if ($error != '') {
1462
+    			    	return $error;
1463
+    			    } else {
1464
+    			    	return self::check_version(true);
1465
+    			    }
1391 1466
     			} elseif ($result['value'] == '4') {
1392 1467
     			    $error = self::update_from_4();
1393
-    			    if ($error != '') return $error;
1394
-    			    else return self::check_version(true);
1468
+    			    if ($error != '') {
1469
+    			    	return $error;
1470
+    			    } else {
1471
+    			    	return self::check_version(true);
1472
+    			    }
1395 1473
     			} elseif ($result['value'] == '5') {
1396 1474
     			    $error = self::update_from_5();
1397
-    			    if ($error != '') return $error;
1398
-    			    else return self::check_version(true);
1475
+    			    if ($error != '') {
1476
+    			    	return $error;
1477
+    			    } else {
1478
+    			    	return self::check_version(true);
1479
+    			    }
1399 1480
     			} elseif ($result['value'] == '6') {
1400 1481
     			    $error = self::update_from_6();
1401
-    			    if ($error != '') return $error;
1402
-    			    else return self::check_version(true);
1482
+    			    if ($error != '') {
1483
+    			    	return $error;
1484
+    			    } else {
1485
+    			    	return self::check_version(true);
1486
+    			    }
1403 1487
     			} elseif ($result['value'] == '7') {
1404 1488
     			    $error = self::update_from_7();
1405
-    			    if ($error != '') return $error;
1406
-    			    else return self::check_version(true);
1489
+    			    if ($error != '') {
1490
+    			    	return $error;
1491
+    			    } else {
1492
+    			    	return self::check_version(true);
1493
+    			    }
1407 1494
     			} elseif ($result['value'] == '8') {
1408 1495
     			    $error = self::update_from_8();
1409
-    			    if ($error != '') return $error;
1410
-    			    else return self::check_version(true);
1496
+    			    if ($error != '') {
1497
+    			    	return $error;
1498
+    			    } else {
1499
+    			    	return self::check_version(true);
1500
+    			    }
1411 1501
     			} elseif ($result['value'] == '9') {
1412 1502
     			    $error = self::update_from_9();
1413
-    			    if ($error != '') return $error;
1414
-    			    else return self::check_version(true);
1503
+    			    if ($error != '') {
1504
+    			    	return $error;
1505
+    			    } else {
1506
+    			    	return self::check_version(true);
1507
+    			    }
1415 1508
     			} elseif ($result['value'] == '10') {
1416 1509
     			    $error = self::update_from_10();
1417
-    			    if ($error != '') return $error;
1418
-    			    else return self::check_version(true);
1510
+    			    if ($error != '') {
1511
+    			    	return $error;
1512
+    			    } else {
1513
+    			    	return self::check_version(true);
1514
+    			    }
1419 1515
     			} elseif ($result['value'] == '11') {
1420 1516
     			    $error = self::update_from_11();
1421
-    			    if ($error != '') return $error;
1422
-    			    else return self::check_version(true);
1517
+    			    if ($error != '') {
1518
+    			    	return $error;
1519
+    			    } else {
1520
+    			    	return self::check_version(true);
1521
+    			    }
1423 1522
     			} elseif ($result['value'] == '12') {
1424 1523
     			    $error = self::update_from_12();
1425
-    			    if ($error != '') return $error;
1426
-    			    else return self::check_version(true);
1524
+    			    if ($error != '') {
1525
+    			    	return $error;
1526
+    			    } else {
1527
+    			    	return self::check_version(true);
1528
+    			    }
1427 1529
     			} elseif ($result['value'] == '13') {
1428 1530
     			    $error = self::update_from_13();
1429
-    			    if ($error != '') return $error;
1430
-    			    else return self::check_version(true);
1531
+    			    if ($error != '') {
1532
+    			    	return $error;
1533
+    			    } else {
1534
+    			    	return self::check_version(true);
1535
+    			    }
1431 1536
     			} elseif ($result['value'] == '14') {
1432 1537
     			    $error = self::update_from_14();
1433
-    			    if ($error != '') return $error;
1434
-    			    else return self::check_version(true);
1538
+    			    if ($error != '') {
1539
+    			    	return $error;
1540
+    			    } else {
1541
+    			    	return self::check_version(true);
1542
+    			    }
1435 1543
     			} elseif ($result['value'] == '15') {
1436 1544
     			    $error = self::update_from_15();
1437
-    			    if ($error != '') return $error;
1438
-    			    else return self::check_version(true);
1545
+    			    if ($error != '') {
1546
+    			    	return $error;
1547
+    			    } else {
1548
+    			    	return self::check_version(true);
1549
+    			    }
1439 1550
     			} elseif ($result['value'] == '16') {
1440 1551
     			    $error = self::update_from_16();
1441
-    			    if ($error != '') return $error;
1442
-    			    else return self::check_version(true);
1552
+    			    if ($error != '') {
1553
+    			    	return $error;
1554
+    			    } else {
1555
+    			    	return self::check_version(true);
1556
+    			    }
1443 1557
     			} elseif ($result['value'] == '17') {
1444 1558
     			    $error = self::update_from_17();
1445
-    			    if ($error != '') return $error;
1446
-    			    else return self::check_version(true);
1559
+    			    if ($error != '') {
1560
+    			    	return $error;
1561
+    			    } else {
1562
+    			    	return self::check_version(true);
1563
+    			    }
1447 1564
     			} elseif ($result['value'] == '18') {
1448 1565
     			    $error = self::update_from_18();
1449
-    			    if ($error != '') return $error;
1450
-    			    else return self::check_version(true);
1566
+    			    if ($error != '') {
1567
+    			    	return $error;
1568
+    			    } else {
1569
+    			    	return self::check_version(true);
1570
+    			    }
1451 1571
     			} elseif ($result['value'] == '19') {
1452 1572
     			    $error = self::update_from_19();
1453
-    			    if ($error != '') return $error;
1454
-    			    else return self::check_version(true);
1573
+    			    if ($error != '') {
1574
+    			    	return $error;
1575
+    			    } else {
1576
+    			    	return self::check_version(true);
1577
+    			    }
1455 1578
     			} elseif ($result['value'] == '20') {
1456 1579
     			    $error = self::update_from_20();
1457
-    			    if ($error != '') return $error;
1458
-    			    else return self::check_version(true);
1580
+    			    if ($error != '') {
1581
+    			    	return $error;
1582
+    			    } else {
1583
+    			    	return self::check_version(true);
1584
+    			    }
1459 1585
     			} elseif ($result['value'] == '21') {
1460 1586
     			    $error = self::update_from_21();
1461
-    			    if ($error != '') return $error;
1462
-    			    else return self::check_version(true);
1587
+    			    if ($error != '') {
1588
+    			    	return $error;
1589
+    			    } else {
1590
+    			    	return self::check_version(true);
1591
+    			    }
1463 1592
     			} elseif ($result['value'] == '22') {
1464 1593
     			    $error = self::update_from_22();
1465
-    			    if ($error != '') return $error;
1466
-    			    else return self::check_version(true);
1594
+    			    if ($error != '') {
1595
+    			    	return $error;
1596
+    			    } else {
1597
+    			    	return self::check_version(true);
1598
+    			    }
1467 1599
     			} elseif ($result['value'] == '23') {
1468 1600
     			    $error = self::update_from_23();
1469
-    			    if ($error != '') return $error;
1470
-    			    else return self::check_version(true);
1601
+    			    if ($error != '') {
1602
+    			    	return $error;
1603
+    			    } else {
1604
+    			    	return self::check_version(true);
1605
+    			    }
1471 1606
     			} elseif ($result['value'] == '24') {
1472 1607
     			    $error = self::update_from_24();
1473
-    			    if ($error != '') return $error;
1474
-    			    else return self::check_version(true);
1608
+    			    if ($error != '') {
1609
+    			    	return $error;
1610
+    			    } else {
1611
+    			    	return self::check_version(true);
1612
+    			    }
1475 1613
     			} elseif ($result['value'] == '25') {
1476 1614
     			    $error = self::update_from_25();
1477
-    			    if ($error != '') return $error;
1478
-    			    else return self::check_version(true);
1615
+    			    if ($error != '') {
1616
+    			    	return $error;
1617
+    			    } else {
1618
+    			    	return self::check_version(true);
1619
+    			    }
1479 1620
     			} elseif ($result['value'] == '26') {
1480 1621
     			    $error = self::update_from_26();
1481
-    			    if ($error != '') return $error;
1482
-    			    else return self::check_version(true);
1622
+    			    if ($error != '') {
1623
+    			    	return $error;
1624
+    			    } else {
1625
+    			    	return self::check_version(true);
1626
+    			    }
1483 1627
     			} elseif ($result['value'] == '27') {
1484 1628
     			    $error = self::update_from_27();
1485
-    			    if ($error != '') return $error;
1486
-    			    else return self::check_version(true);
1629
+    			    if ($error != '') {
1630
+    			    	return $error;
1631
+    			    } else {
1632
+    			    	return self::check_version(true);
1633
+    			    }
1487 1634
     			} elseif ($result['value'] == '28') {
1488 1635
     			    $error = self::update_from_28();
1489
-    			    if ($error != '') return $error;
1490
-    			    else return self::check_version(true);
1636
+    			    if ($error != '') {
1637
+    			    	return $error;
1638
+    			    } else {
1639
+    			    	return self::check_version(true);
1640
+    			    }
1491 1641
     			} elseif ($result['value'] == '29') {
1492 1642
     			    $error = self::update_from_29();
1493
-    			    if ($error != '') return $error;
1494
-    			    else return self::check_version(true);
1643
+    			    if ($error != '') {
1644
+    			    	return $error;
1645
+    			    } else {
1646
+    			    	return self::check_version(true);
1647
+    			    }
1495 1648
     			} elseif ($result['value'] == '30') {
1496 1649
     			    $error = self::update_from_30();
1497
-    			    if ($error != '') return $error;
1498
-    			    else return self::check_version(true);
1650
+    			    if ($error != '') {
1651
+    			    	return $error;
1652
+    			    } else {
1653
+    			    	return self::check_version(true);
1654
+    			    }
1499 1655
     			} elseif ($result['value'] == '31') {
1500 1656
     			    $error = self::update_from_31();
1501
-    			    if ($error != '') return $error;
1502
-    			    else return self::check_version(true);
1657
+    			    if ($error != '') {
1658
+    			    	return $error;
1659
+    			    } else {
1660
+    			    	return self::check_version(true);
1661
+    			    }
1503 1662
     			} elseif ($result['value'] == '32') {
1504 1663
     			    $error = self::update_from_32();
1505
-    			    if ($error != '') return $error;
1506
-    			    else return self::check_version(true);
1507
-    			} else return '';
1664
+    			    if ($error != '') {
1665
+    			    	return $error;
1666
+    			    } else {
1667
+    			    	return self::check_version(true);
1668
+    			    }
1669
+    			} else {
1670
+    				return '';
1671
+    			}
1672
+    		    } else {
1673
+    		    	return $result['value'];
1508 1674
     		    }
1509
-    		    else return $result['value'];
1510 1675
 		}
1511 1676
 		
1512
-	    } else return $version;
1677
+	    } else {
1678
+	    	return $version;
1679
+	    }
1513 1680
     	}
1514 1681
     	
1515 1682
 }
Please login to merge, or discard this patch.
js/map.js.php 2 patches
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
2 2
 require_once('../require/settings.php');
3 3
 require_once('../require/class.Language.php'); 
4 4
 
5
-setcookie("MapFormat",'2d');
5
+setcookie("MapFormat", '2d');
6 6
 
7 7
 // Compressed GeoJson is used if true
8 8
 if (!isset($globalJsonCompress)) $compress = true;
@@ -18,10 +18,10 @@  discard block
 block discarded – undo
18 18
 	$lastupd = $_GET['archivespeed']*$archiveupdatetime;
19 19
 	if (isset($_GET['enddate']) && $_GET['enddate'] != '') $enddate = $_GET['enddate'];
20 20
 	else $enddate = time();
21
-	setcookie("archive_begin",$begindate);
22
-	setcookie("archive_end",$enddate);
23
-	setcookie("archive_update",$lastupd);
24
-	setcookie("archive_speed",$archivespeed);
21
+	setcookie("archive_begin", $begindate);
22
+	setcookie("archive_end", $enddate);
23
+	setcookie("archive_update", $lastupd);
24
+	setcookie("archive_speed", $archivespeed);
25 25
 ?>
26 26
 document.cookie =  'archive_begin=<?php print $begindate; ?>; expires=Thu, 2 Aug 2100 20:47:11 UTC; path=/';
27 27
 document.cookie =  'archive_end=<?php print $enddate; ?>; expires=Thu, 2 Aug 2100 20:47:11 UTC; path=/';
@@ -92,16 +92,16 @@  discard block
 block discarded – undo
92 92
 <?php
93 93
 	}
94 94
 	if (isset($_GET['ident'])) {
95
-		$ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING);
95
+		$ident = filter_input(INPUT_GET, 'ident', FILTER_SANITIZE_STRING);
96 96
 	}
97 97
 	if (isset($_GET['flightaware_id'])) {
98
-		$flightaware_id = filter_input(INPUT_GET,'flightaware_id',FILTER_SANITIZE_STRING);
98
+		$flightaware_id = filter_input(INPUT_GET, 'flightaware_id', FILTER_SANITIZE_STRING);
99 99
 	}
100 100
 	if (isset($_GET['latitude'])) {
101
-		$latitude = filter_input(INPUT_GET,'latitude',FILTER_SANITIZE_STRING);
101
+		$latitude = filter_input(INPUT_GET, 'latitude', FILTER_SANITIZE_STRING);
102 102
 	}
103 103
 	if (isset($_GET['longitude'])) {
104
-		$longitude = filter_input(INPUT_GET,'longitude',FILTER_SANITIZE_STRING);
104
+		$longitude = filter_input(INPUT_GET, 'longitude', FILTER_SANITIZE_STRING);
105 105
 	}
106 106
 ?>
107 107
 
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
 	     || navigator.userAgent.match(/BlackBerry/i)
137 137
 	     || navigator.userAgent.match(/Windows Phone/i))
138 138
 	{
139
-		var zoom = <?php if (isset($globalLiveZoom)) print $globalLiveZoom-1; else print '8'; ?>;
139
+		var zoom = <?php if (isset($globalLiveZoom)) print $globalLiveZoom - 1; else print '8'; ?>;
140 140
 	} else {
141 141
 		var zoom = <?php if (isset($globalLiveZoom)) print $globalLiveZoom; else print '9'; ?>;
142 142
 	}
@@ -230,19 +230,19 @@  discard block
 block discarded – undo
230 230
 	map.addLayer(yandexLayer);
231 231
 <?php
232 232
 	} elseif ($MapType == 'Bing-Aerial') {
233
-		if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType','OpenStreetMap');
233
+		if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType', 'OpenStreetMap');
234 234
 ?>
235 235
 	var bingLayer = new L.tileLayer.bing({bingMapsKey: '<?php print $globalBingMapKey; ?>',imagerySet: 'Aerial'});
236 236
 	map.addLayer(bingLayer);
237 237
 <?php
238 238
 	} elseif ($MapType == 'Bing-Hybrid') {
239
-		if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType','OpenStreetMap');
239
+		if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType', 'OpenStreetMap');
240 240
 ?>
241 241
 	var bingLayer = new L.tileLayer.bing({bingMapsKey: '<?php print $globalBingMapKey; ?>',imagerySet: 'AerialWithLabels'});
242 242
 	map.addLayer(bingLayer);
243 243
 <?php
244 244
 	} elseif ($MapType == 'Bing-Road') {
245
-		if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType','OpenStreetMap');
245
+		if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType', 'OpenStreetMap');
246 246
 ?>
247 247
 	var bingLayer = new L.tileLayer.bing({bingMapsKey: '<?php print $globalBingMapKey; ?>',imagerySet: 'Road'});
248 248
 	map.addLayer(bingLayer);
@@ -534,10 +534,10 @@  discard block
 block discarded – undo
534 534
 	};
535 535
 	archive.update = function (props) {
536 536
 		if (typeof props != 'undefined') {
537
-			//this._div.innerHTML = '<h4><?php echo str_replace("'","\'",_("Archive Date & Time")); ?></h4>' +  '<b>' + props.archive_date + ' UTC </b>' + '<br/><i class="fa fa-fast-backward" aria-hidden="true"></i> <i class="fa fa-backward" aria-hidden="true"></i>  <a href="#" onClick="archivePause();"><i class="fa fa-pause" aria-hidden="true"></i></a> <a href="#" onClick="archivePlay();"><i class="fa fa-play" aria-hidden="true"></i></a>  <i class="fa fa-forward" aria-hidden="true"></i> <i class="fa fa-fast-forward" aria-hidden="true"></i>';
538
-			this._div.innerHTML = '<h4><?php echo str_replace("'","\'",_("Archive Date & Time")); ?></h4>' +  '<b>' + props.archive_date + ' UTC </b>' + '<br/><a href="#" onClick="archivePause();"><i class="fa fa-pause" aria-hidden="true"></i></a> <a href="#" onClick="archivePlay();"><i class="fa fa-play" aria-hidden="true"></i></a>';
537
+			//this._div.innerHTML = '<h4><?php echo str_replace("'", "\'", _("Archive Date & Time")); ?></h4>' +  '<b>' + props.archive_date + ' UTC </b>' + '<br/><i class="fa fa-fast-backward" aria-hidden="true"></i> <i class="fa fa-backward" aria-hidden="true"></i>  <a href="#" onClick="archivePause();"><i class="fa fa-pause" aria-hidden="true"></i></a> <a href="#" onClick="archivePlay();"><i class="fa fa-play" aria-hidden="true"></i></a>  <i class="fa fa-forward" aria-hidden="true"></i> <i class="fa fa-fast-forward" aria-hidden="true"></i>';
538
+			this._div.innerHTML = '<h4><?php echo str_replace("'", "\'", _("Archive Date & Time")); ?></h4>' +  '<b>' + props.archive_date + ' UTC </b>' + '<br/><a href="#" onClick="archivePause();"><i class="fa fa-pause" aria-hidden="true"></i></a> <a href="#" onClick="archivePlay();"><i class="fa fa-play" aria-hidden="true"></i></a>';
539 539
 		} else {
540
-			this._div.innerHTML = '<h4><?php echo str_replace("'","\'",_("Archive Date & Time")); ?></h4>' +  '<b><i class="fa fa-spinner fa-pulse fa-2x fa-fw margin-bottom"></i></b>';
540
+			this._div.innerHTML = '<h4><?php echo str_replace("'", "\'", _("Archive Date & Time")); ?></h4>' +  '<b><i class="fa fa-spinner fa-pulse fa-2x fa-fw margin-bottom"></i></b>';
541 541
 		}
542 542
 
543 543
 	};
@@ -737,7 +737,7 @@  discard block
 block discarded – undo
737 737
 <?php
738 738
 		} else {
739 739
 ?>
740
-		    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000);
740
+		    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000 + 20000; ?>+feature.properties.sqt*1000);
741 741
 		    return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{
742 742
 <?php
743 743
 		}
@@ -753,7 +753,7 @@  discard block
 block discarded – undo
753 753
 			    /*
754 754
 			    shadowUrl: iconURLShadowpath,
755 755
 			    shadowSize: [<?php print $globalAircraftSize; ?>, <?php print $globalAircraftSize; ?>],
756
-			    shadowAnchor: [<?php print ($globalAircraftSize/2)+1; ?>, <?php print $globalAircraftSize; ?>]
756
+			    shadowAnchor: [<?php print ($globalAircraftSize/2) + 1; ?>, <?php print $globalAircraftSize; ?>]
757 757
 			    */
758 758
 			})
759 759
 		    })
@@ -786,7 +786,7 @@  discard block
 block discarded – undo
786 786
 <?php
787 787
 		} else {
788 788
 ?>
789
-			    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000);
789
+			    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000 + 20000; ?>+feature.properties.sqt*1000);
790 790
 			    return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{
791 791
 <?php
792 792
 		}
@@ -834,7 +834,7 @@  discard block
 block discarded – undo
834 834
 <?php
835 835
 		} else {
836 836
 ?>
837
-			    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000);
837
+			    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000 + 20000; ?>+feature.properties.sqt*1000);
838 838
 			    return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{
839 839
 <?php
840 840
 		}
@@ -1460,23 +1460,23 @@  discard block
 block discarded – undo
1460 1460
 	    airs.push(air.value);
1461 1461
 	}
1462 1462
     }
1463
-    document.cookie =  'filter_Airlines='+airs.join()+'; expires=<?php print date("D, j M Y G:i:s T",mktime(0, 0, 0, date("m")  , date("d")+1, date("Y"))); ?>; path=/'
1463
+    document.cookie =  'filter_Airlines='+airs.join()+'; expires=<?php print date("D, j M Y G:i:s T", mktime(0, 0, 0, date("m"), date("d") + 1, date("Y"))); ?>; path=/'
1464 1464
 }
1465 1465
 function airlinestype(selectObj) {
1466 1466
     var idx = selectObj.selectedIndex;
1467 1467
     var airtype = selectObj.options[idx].value;
1468
-    document.cookie =  'filter_airlinestype='+airtype+'; expires=<?php print date("D, j M Y G:i:s T",mktime(0, 0, 0, date("m")  , date("d")+1, date("Y"))); ?>; path=/'
1468
+    document.cookie =  'filter_airlinestype='+airtype+'; expires=<?php print date("D, j M Y G:i:s T", mktime(0, 0, 0, date("m"), date("d") + 1, date("Y"))); ?>; path=/'
1469 1469
 }
1470 1470
 function alliance(selectObj) {
1471 1471
     var idx = selectObj.selectedIndex;
1472 1472
     var alliance = selectObj.options[idx].value;
1473
-    document.cookie =  'filter_alliance='+alliance+'; expires=<?php print date("D, j M Y G:i:s T",mktime(0, 0, 0, date("m")  , date("d")+1, date("Y"))); ?>; path=/'
1473
+    document.cookie =  'filter_alliance='+alliance+'; expires=<?php print date("D, j M Y G:i:s T", mktime(0, 0, 0, date("m"), date("d") + 1, date("Y"))); ?>; path=/'
1474 1474
 }
1475 1475
 
1476 1476
 function identfilter() {
1477 1477
     var ident = $('#identfilter').val();
1478 1478
     console.log('Filter with '+ident);
1479
-    document.cookie =  'filter_ident='+ident+'; expires=<?php print date("D, j M Y G:i:s T",mktime(0, 0, 0, date("m")  , date("d")+2, date("Y"))); ?>; path=/'
1479
+    document.cookie =  'filter_ident='+ident+'; expires=<?php print date("D, j M Y G:i:s T", mktime(0, 0, 0, date("m"), date("d") + 2, date("Y"))); ?>; path=/'
1480 1480
 }
1481 1481
 function removefilters() {
1482 1482
     // Get an array of all cookie names (the regex matches what we don't want)
@@ -1498,7 +1498,7 @@  discard block
 block discarded – undo
1498 1498
 	}
1499 1499
     }
1500 1500
     //document.cookie =  'Sources='+sources.join()+'; expires=Thu, 2 Aug 2100 20:47:11 UTC; path=/'
1501
-    document.cookie =  'filter_Sources='+sources.join()+'; expires=<?php print date("D, j M Y G:i:s T",mktime(0, 0, 0, date("m")  , date("d")+1, date("Y"))); ?>; path=/'
1501
+    document.cookie =  'filter_Sources='+sources.join()+'; expires=<?php print date("D, j M Y G:i:s T", mktime(0, 0, 0, date("m"), date("d") + 1, date("Y"))); ?>; path=/'
1502 1502
 }
1503 1503
 
1504 1504
 function show3D() {
@@ -1521,23 +1521,23 @@  discard block
 block discarded – undo
1521 1521
 
1522 1522
 function clickVATSIM(cb) {
1523 1523
     //document.cookie =  'ShowVATSIM='+cb.checked+'; expires=Thu, 2 Aug 2100 20:47:11 UTC; path=/'
1524
-    document.cookie =  'filter_ShowVATSIM='+cb.checked+'; expires=<?php print date("D, j M Y G:i:s T",mktime(0, 0, 0, date("m")  , date("d")+2, date("Y"))); ?>; path=/'
1524
+    document.cookie =  'filter_ShowVATSIM='+cb.checked+'; expires=<?php print date("D, j M Y G:i:s T", mktime(0, 0, 0, date("m"), date("d") + 2, date("Y"))); ?>; path=/'
1525 1525
 }
1526 1526
 function clickIVAO(cb) {
1527 1527
     //document.cookie =  'ShowIVAO='+cb.checked+'; expires=Thu, 2 Aug 2100 20:47:11 UTC; path=/'
1528
-    document.cookie =  'filter_ShowIVAO='+cb.checked+'; expires=<?php print date("D, j M Y G:i:s T",mktime(0, 0, 0, date("m")  , date("d")+2, date("Y"))); ?>; path=/'
1528
+    document.cookie =  'filter_ShowIVAO='+cb.checked+'; expires=<?php print date("D, j M Y G:i:s T", mktime(0, 0, 0, date("m"), date("d") + 2, date("Y"))); ?>; path=/'
1529 1529
 }
1530 1530
 function clickphpVMS(cb) {
1531 1531
     //document.cookie =  'ShowVMS='+cb.checked+'; expires=Thu, 2 Aug 2100 20:47:11 UTC; path=/'
1532
-    document.cookie =  'filter_ShowVMS='+cb.checked+'; expires=<?php print date("D, j M Y G:i:s T",mktime(0, 0, 0, date("m")  , date("d")+2, date("Y"))); ?>; path=/'
1532
+    document.cookie =  'filter_ShowVMS='+cb.checked+'; expires=<?php print date("D, j M Y G:i:s T", mktime(0, 0, 0, date("m"), date("d") + 2, date("Y"))); ?>; path=/'
1533 1533
 }
1534 1534
 function clickSBS1(cb) {
1535 1535
     //document.cookie =  'ShowSBS1='+cb.checked+'; expires=Thu, 2 Aug 2100 20:47:11 UTC; path=/'
1536
-    document.cookie =  'filter_ShowSBS1='+cb.checked+'; expires=<?php print date("D, j M Y G:i:s T",mktime(0, 0, 0, date("m")  , date("d")+2, date("Y"))); ?>; path=/'
1536
+    document.cookie =  'filter_ShowSBS1='+cb.checked+'; expires=<?php print date("D, j M Y G:i:s T", mktime(0, 0, 0, date("m"), date("d") + 2, date("Y"))); ?>; path=/'
1537 1537
 }
1538 1538
 function clickAPRS(cb) {
1539 1539
     //document.cookie =  'ShowAPRS='+cb.checked+'; expires=Thu, 2 Aug 2100 20:47:11 UTC; path=/'
1540
-    document.cookie =  'filter_ShowAPRS='+cb.checked+'; expires=<?php print date("D, j M Y G:i:s T",mktime(0, 0, 0, date("m")  , date("d")+2, date("Y"))); ?>; path=/'
1540
+    document.cookie =  'filter_ShowAPRS='+cb.checked+'; expires=<?php print date("D, j M Y G:i:s T", mktime(0, 0, 0, date("m"), date("d") + 2, date("Y"))); ?>; path=/'
1541 1541
 }
1542 1542
 function clickFlightPopup(cb) {
1543 1543
     document.cookie =  'flightpopup='+cb.checked+'; expires=Thu, 2 Aug 2100 20:47:11 UTC; path=/'
Please login to merge, or discard this patch.
Braces   +128 added lines, -33 removed lines patch added patch discarded remove patch
@@ -5,8 +5,11 @@  discard block
 block discarded – undo
5 5
 setcookie("MapFormat",'2d');
6 6
 
7 7
 // Compressed GeoJson is used if true
8
-if (!isset($globalJsonCompress)) $compress = true;
9
-else $compress = $globalJsonCompress;
8
+if (!isset($globalJsonCompress)) {
9
+	$compress = true;
10
+} else {
11
+	$compress = $globalJsonCompress;
12
+}
10 13
 if (isset($_GET['archive'])) {
11 14
 	//$archiveupdatetime = 50;
12 15
 	$archiveupdatetime = $globalMapRefresh;
@@ -16,8 +19,11 @@  discard block
 block discarded – undo
16 19
 	//$lastupd = round(($_GET['enddate']-$_GET['begindate'])/(($_GET['during']*60)/10));
17 20
 	//$lastupd = 20;
18 21
 	$lastupd = $_GET['archivespeed']*$archiveupdatetime;
19
-	if (isset($_GET['enddate']) && $_GET['enddate'] != '') $enddate = $_GET['enddate'];
20
-	else $enddate = time();
22
+	if (isset($_GET['enddate']) && $_GET['enddate'] != '') {
23
+		$enddate = $_GET['enddate'];
24
+	} else {
25
+		$enddate = time();
26
+	}
21 27
 	setcookie("archive_begin",$begindate);
22 28
 	setcookie("archive_end",$enddate);
23 29
 	setcookie("archive_update",$lastupd);
@@ -123,7 +129,17 @@  discard block
 block discarded – undo
123 129
 	}
124 130
 
125 131
 	//create the map
126
-	map = L.map('archive-map', { zoomControl:false }).setView([<?php if (isset($latitude)) print $latitude; else print $globalCenterLatitude; ?>,<?php if (isset($longitude)) print $longitude; else print $globalCenterLongitude; ?>], zoom);
132
+	map = L.map('archive-map', { zoomControl:false }).setView([<?php if (isset($latitude)) {
133
+	print $latitude;
134
+} else {
135
+	print $globalCenterLatitude;
136
+}
137
+?>,<?php if (isset($longitude)) {
138
+	print $longitude;
139
+} else {
140
+	print $globalCenterLongitude;
141
+}
142
+?>], zoom);
127 143
 <?php
128 144
 	} else {
129 145
 ?>
@@ -136,9 +152,19 @@  discard block
 block discarded – undo
136 152
 	     || navigator.userAgent.match(/BlackBerry/i)
137 153
 	     || navigator.userAgent.match(/Windows Phone/i))
138 154
 	{
139
-		var zoom = <?php if (isset($globalLiveZoom)) print $globalLiveZoom-1; else print '8'; ?>;
155
+		var zoom = <?php if (isset($globalLiveZoom)) {
156
+	print $globalLiveZoom-1;
157
+} else {
158
+	print '8';
159
+}
160
+?>;
140 161
 	} else {
141
-		var zoom = <?php if (isset($globalLiveZoom)) print $globalLiveZoom; else print '9'; ?>;
162
+		var zoom = <?php if (isset($globalLiveZoom)) {
163
+	print $globalLiveZoom;
164
+} else {
165
+	print '9';
166
+}
167
+?>;
142 168
 	}
143 169
 
144 170
 	//create the map
@@ -163,16 +189,27 @@  discard block
 block discarded – undo
163 189
 	bounds = L.latLngBounds(southWest,northEast);
164 190
 	//a few title layers
165 191
 <?php
166
-	if (isset($_COOKIE['MapType'])) $MapType = $_COOKIE['MapType'];
167
-	else $MapType = $globalMapProvider;
192
+	if (isset($_COOKIE['MapType'])) {
193
+		$MapType = $_COOKIE['MapType'];
194
+	} else {
195
+		$MapType = $globalMapProvider;
196
+	}
168 197
 
169 198
 	if ($MapType == 'Mapbox') {
170
-		if ($_COOKIE['MapTypeId'] == 'default') $MapBoxId = $globalMapboxId;
171
-		else $MapBoxId = $_COOKIE['MapTypeId'];
172
-?>
199
+		if ($_COOKIE['MapTypeId'] == 'default') {
200
+			$MapBoxId = $globalMapboxId;
201
+		} else {
202
+			$MapBoxId = $_COOKIE['MapTypeId'];
203
+		}
204
+		?>
173 205
 	L.tileLayer('https://{s}.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token={token}', {
174 206
 	    maxZoom: 18,
175
-	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>,
207
+	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) {
208
+	print 'false';
209
+} else {
210
+	print 'true';
211
+}
212
+?>,
176 213
 	    attribution: 'Map data &copy; <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, ' +
177 214
 	      '<a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, ' +
178 215
 	      'Imagery © <a href="http://mapbox.com">Mapbox</a>',
@@ -184,7 +221,12 @@  discard block
 block discarded – undo
184 221
 ?>
185 222
 	L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
186 223
 	    maxZoom: 18,
187
-	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>,
224
+	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) {
225
+	print 'false';
226
+} else {
227
+	print 'true';
228
+}
229
+?>,
188 230
 	    attribution: 'Map data &copy; <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, ' +
189 231
 	      '<a href="www.openstreetmap.org/copyright">Open Database Licence</a>'
190 232
 	}).addTo(map);
@@ -230,20 +272,26 @@  discard block
 block discarded – undo
230 272
 	map.addLayer(yandexLayer);
231 273
 <?php
232 274
 	} elseif ($MapType == 'Bing-Aerial') {
233
-		if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType','OpenStreetMap');
234
-?>
275
+		if (!isset($globalBingMapKey) || $globalBingMapKey == '') {
276
+			setcookie('MapType','OpenStreetMap');
277
+		}
278
+		?>
235 279
 	var bingLayer = new L.tileLayer.bing({bingMapsKey: '<?php print $globalBingMapKey; ?>',imagerySet: 'Aerial'});
236 280
 	map.addLayer(bingLayer);
237 281
 <?php
238 282
 	} elseif ($MapType == 'Bing-Hybrid') {
239
-		if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType','OpenStreetMap');
240
-?>
283
+		if (!isset($globalBingMapKey) || $globalBingMapKey == '') {
284
+			setcookie('MapType','OpenStreetMap');
285
+		}
286
+		?>
241 287
 	var bingLayer = new L.tileLayer.bing({bingMapsKey: '<?php print $globalBingMapKey; ?>',imagerySet: 'AerialWithLabels'});
242 288
 	map.addLayer(bingLayer);
243 289
 <?php
244 290
 	} elseif ($MapType == 'Bing-Road') {
245
-		if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType','OpenStreetMap');
246
-?>
291
+		if (!isset($globalBingMapKey) || $globalBingMapKey == '') {
292
+			setcookie('MapType','OpenStreetMap');
293
+		}
294
+		?>
247 295
 	var bingLayer = new L.tileLayer.bing({bingMapsKey: '<?php print $globalBingMapKey; ?>',imagerySet: 'Road'});
248 296
 	map.addLayer(bingLayer);
249 297
 <?php
@@ -291,7 +339,12 @@  discard block
 block discarded – undo
291 339
 		}
292 340
 	} elseif ($globalBounding == 'circle') {
293 341
 ?>
294
-	var circle = L.circle([<?php print $globalCenterLatitude; ?>, <?php print $globalCenterLongitude; ?>],<?php if (isset($globalBoundingCircleSize)) print $globalBoundingCircleSize; else print '70000'; ?>,{
342
+	var circle = L.circle([<?php print $globalCenterLatitude; ?>, <?php print $globalCenterLongitude; ?>],<?php if (isset($globalBoundingCircleSize)) {
343
+	print $globalBoundingCircleSize;
344
+} else {
345
+	print '70000';
346
+}
347
+?>,{
295 348
 	    color: '#92C7D1',
296 349
 	    fillColor: '#92C7D1',
297 350
 	    fillOpacity: 0.3,
@@ -350,8 +403,11 @@  discard block
 block discarded – undo
350 403
 
351 404
 	function update_airportsLayer() {
352 405
 	    <?php
353
-		if (isset($_COOKIE['AirportZoom'])) $getZoom = $_COOKIE['AirportZoom'];
354
-		else $getZoom = '7';
406
+		if (isset($_COOKIE['AirportZoom'])) {
407
+			$getZoom = $_COOKIE['AirportZoom'];
408
+		} else {
409
+			$getZoom = '7';
410
+		}
355 411
 	    ?>
356 412
 	    //if (map.getZoom() <= <?php print $getZoom; ?>) {
357 413
 		if (typeof airportsLayer != 'undefined') {
@@ -687,9 +743,13 @@  discard block
 block discarded – undo
687 743
 		    if (callsign != ""){ markerLabel += callsign; }
688 744
 		    if (departure_airport_code != "" && arrival_airport_code != "" && departure_airport_code != "NA" && arrival_airport_code != "NA"){ markerLabel += ' ( '+departure_airport_code+' - '+arrival_airport_code+' )'; }
689 745
 <?php
690
-	if (isset($_COOKIE['IconColor'])) $IconColor = $_COOKIE['IconColor'];
691
-	elseif (isset($globalAircraftIconColor)) $IconColor = $globalAircraftIconColor;
692
-	else $IconColor = '1a3151';
746
+	if (isset($_COOKIE['IconColor'])) {
747
+		$IconColor = $_COOKIE['IconColor'];
748
+	} elseif (isset($globalAircraftIconColor)) {
749
+		$IconColor = $globalAircraftIconColor;
750
+	} else {
751
+		$IconColor = '1a3151';
752
+	}
693 753
 	if (!isset($ident) && !isset($flightaware_id)) {
694 754
 ?>
695 755
 		    info_update(feature.properties.fc);
@@ -737,7 +797,12 @@  discard block
 block discarded – undo
737 797
 <?php
738 798
 		} else {
739 799
 ?>
740
-		    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000);
800
+		    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) {
801
+	print $archiveupdatetime*1000;
802
+} else {
803
+	print $globalMapRefresh*1000+20000;
804
+}
805
+?>+feature.properties.sqt*1000);
741 806
 		    return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{
742 807
 <?php
743 808
 		}
@@ -786,7 +851,12 @@  discard block
 block discarded – undo
786 851
 <?php
787 852
 		} else {
788 853
 ?>
789
-			    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000);
854
+			    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) {
855
+	print $archiveupdatetime*1000;
856
+} else {
857
+	print $globalMapRefresh*1000+20000;
858
+}
859
+?>+feature.properties.sqt*1000);
790 860
 			    return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{
791 861
 <?php
792 862
 		}
@@ -834,7 +904,12 @@  discard block
 block discarded – undo
834 904
 <?php
835 905
 		} else {
836 906
 ?>
837
-			    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000);
907
+			    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) {
908
+	print $archiveupdatetime*1000;
909
+} else {
910
+	print $globalMapRefresh*1000+20000;
911
+}
912
+?>+feature.properties.sqt*1000);
838 913
 			    return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{
839 914
 <?php
840 915
 		}
@@ -1177,14 +1252,24 @@  discard block
 block discarded – undo
1177 1252
 	if (isset($_GET['archive'])) {
1178 1253
 ?>
1179 1254
 //then load it again every 30 seconds
1180
-//  var reload = setInterval(function(){if (noTimeout) getLiveData(0)},<?php if (isset($globalMapRefresh)) print ($globalMapRefresh*1000)/2; else print '15000'; ?>);
1255
+//  var reload = setInterval(function(){if (noTimeout) getLiveData(0)},<?php if (isset($globalMapRefresh)) {
1256
+	print ($globalMapRefresh*1000)/2;
1257
+} else {
1258
+	print '15000';
1259
+}
1260
+?>);
1181 1261
 reloadPage = setInterval(function(){if (noTimeout) getLiveData(0)},<?php print $archiveupdatetime*1000; ?>);
1182 1262
 <?php
1183 1263
 	} else {
1184 1264
 ?>
1185 1265
 //then load it again every 30 seconds
1186 1266
 reloadPage = setInterval(
1187
-    function(){if (noTimeout) getLiveData(0)},<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000; else print '30000'; ?>);
1267
+    function(){if (noTimeout) getLiveData(0)},<?php if (isset($globalMapRefresh)) {
1268
+	print $globalMapRefresh*1000;
1269
+} else {
1270
+	print '30000';
1271
+}
1272
+?>);
1188 1273
 var currentdate = new Date();
1189 1274
 var currentyear = new Date().getFullYear();
1190 1275
 var begindate = new Date(Date.UTC(currentyear,11,24,2,0,0,0));
@@ -1196,7 +1281,12 @@  discard block
 block discarded – undo
1196 1281
 		if (!((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) && (isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) {
1197 1282
 ?>
1198 1283
 update_polarLayer();
1199
-setInterval(function(){map.removeLayer(polarLayer);update_polarLayer()},<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000*2; else print '60000'; ?>);
1284
+setInterval(function(){map.removeLayer(polarLayer);update_polarLayer()},<?php if (isset($globalMapRefresh)) {
1285
+	print $globalMapRefresh*1000*2;
1286
+} else {
1287
+	print '60000';
1288
+}
1289
+?>);
1200 1290
 <?php
1201 1291
 		}
1202 1292
 ?>
@@ -1212,7 +1302,12 @@  discard block
 block discarded – undo
1212 1302
 	if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM)) {
1213 1303
 ?>
1214 1304
 update_atcLayer();
1215
-setInterval(function(){map.removeLayer(atcLayer);update_atcLayer()},<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000*2; else print '60000'; ?>);
1305
+setInterval(function(){map.removeLayer(atcLayer);update_atcLayer()},<?php if (isset($globalMapRefresh)) {
1306
+	print $globalMapRefresh*1000*2;
1307
+} else {
1308
+	print '60000';
1309
+}
1310
+?>);
1216 1311
 <?php
1217 1312
 	}
1218 1313
 ?>
Please login to merge, or discard this patch.
live-czml.php 2 patches
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -22,11 +22,11 @@  discard block
 block discarded – undo
22 22
     $s3 = sin($bank/2);
23 23
     $c1c2 = $c1*$c2;
24 24
     $s1s2 = $s1*$s2;
25
-    $w =$c1c2*$c3 - $s1s2*$s3;
26
-    $x =$c1c2*$s3 + $s1s2*$c3;
27
-    $y =$s1*$c2*$c3 + $c1*$s2*$s3;
28
-    $z =$c1*$s2*$c3 - $s1*$c2*$s3;
29
-    return array('x' => $x,'y' => $y,'z' => $z,'w' => $w);
25
+    $w = $c1c2*$c3 - $s1s2*$s3;
26
+    $x = $c1c2*$s3 + $s1s2*$c3;
27
+    $y = $s1*$c2*$c3 + $c1*$s2*$s3;
28
+    $z = $c1*$s2*$c3 - $s1*$c2*$s3;
29
+    return array('x' => $x, 'y' => $y, 'z' => $z, 'w' => $w);
30 30
 //    return array('x' => '0.0','y' => '-0.931','z' => '0.0','w' => '0.365');
31 31
 
32 32
 }
@@ -47,16 +47,16 @@  discard block
 block discarded – undo
47 47
 $min = false;
48 48
 $allhistory = false;
49 49
 $filter['source'] = array();
50
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt'));
51
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup'));
52
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars'));
53
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs'));
54
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs'));
55
-if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING);
56
-if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING);
57
-if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING);
58
-if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING);
59
-if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING);
50
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'], array('vatsimtxt'));
51
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'], array('whazzup'));
52
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'], array('phpvmacars'));
53
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'], array('sbs'));
54
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'], array('aprs'));
55
+if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'], FILTER_SANITIZE_STRING);
56
+if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',', $_COOKIE['filter_Airlines']), FILTER_SANITIZE_STRING);
57
+if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',', $_COOKIE['filter_Sources']), FILTER_SANITIZE_STRING);
58
+if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'], FILTER_SANITIZE_STRING);
59
+if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'], FILTER_SANITIZE_STRING);
60 60
 /*
61 61
 if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) {
62 62
 	$min = true;
@@ -103,12 +103,12 @@  discard block
 block discarded – undo
103 103
 	$from_archive = true;
104 104
 //	$begindate = filter_input(INPUT_GET,'begindate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~')));
105 105
 //	$enddate = filter_input(INPUT_GET,'enddate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~')));
106
-	$begindate = filter_input(INPUT_GET,'begindate',FILTER_SANITIZE_NUMBER_INT);
107
-	$enddate = filter_input(INPUT_GET,'enddate',FILTER_SANITIZE_NUMBER_INT);
108
-	$archivespeed = filter_input(INPUT_GET,'speed',FILTER_SANITIZE_NUMBER_INT);
109
-	$begindate = date('Y-m-d H:i:s',$begindate);
110
-	$enddate = date('Y-m-d H:i:s',$enddate);
111
-	$spotter_array = $SpotterArchive->getMinLiveSpotterDataPlayback($begindate,$enddate,$filter);
106
+	$begindate = filter_input(INPUT_GET, 'begindate', FILTER_SANITIZE_NUMBER_INT);
107
+	$enddate = filter_input(INPUT_GET, 'enddate', FILTER_SANITIZE_NUMBER_INT);
108
+	$archivespeed = filter_input(INPUT_GET, 'speed', FILTER_SANITIZE_NUMBER_INT);
109
+	$begindate = date('Y-m-d H:i:s', $begindate);
110
+	$enddate = date('Y-m-d H:i:s', $enddate);
111
+	$spotter_array = $SpotterArchive->getMinLiveSpotterDataPlayback($begindate, $enddate, $filter);
112 112
 } elseif (isset($_COOKIE['archive']) && isset($_COOKIE['archive_begin']) && isset($_COOKIE['archive_end']) && isset($_COOKIE['archive_speed'])) {
113 113
 	$from_archive = true;
114 114
 //	$begindate = filter_input(INPUT_GET,'begindate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~')));
@@ -118,34 +118,34 @@  discard block
 block discarded – undo
118 118
 	$begindate = $_COOKIE['archive_begin'];
119 119
 	$enddate = $_COOKIE['archive_end'];
120 120
 
121
-	$archivespeed = filter_var($_COOKIE['archive_speed'],FILTER_SANITIZE_NUMBER_INT);
122
-	$begindate = date('Y-m-d H:i:s',$begindate);
123
-	$enddate = date('Y-m-d H:i:s',$enddate);
121
+	$archivespeed = filter_var($_COOKIE['archive_speed'], FILTER_SANITIZE_NUMBER_INT);
122
+	$begindate = date('Y-m-d H:i:s', $begindate);
123
+	$enddate = date('Y-m-d H:i:s', $enddate);
124 124
 //	echo 'Begin : '.$begindate.' - End : '.$enddate."\n";
125
-	$spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate,$enddate,$filter);
125
+	$spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate, $enddate, $filter);
126 126
 } else {
127 127
 	$spotter_array = $SpotterLive->getMinLastLiveSpotterData($filter);
128 128
 }
129 129
 
130 130
 if (!empty($spotter_array)) {
131 131
 	if (isset($_GET['archive'])) {
132
-		$flightcnt = $SpotterArchive->getLiveSpotterCount($begindate,$enddate,$filter);
132
+		$flightcnt = $SpotterArchive->getLiveSpotterCount($begindate, $enddate, $filter);
133 133
 	} else {
134 134
 		$flightcnt = $SpotterLive->getLiveSpotterCount($filter);
135 135
 	}
136 136
 	if ($flightcnt == '') $flightcnt = 0;
137 137
 } else $flightcnt = 0;
138 138
 
139
-$sqltime = round(microtime(true)-$begintime,2);
139
+$sqltime = round(microtime(true) - $begintime, 2);
140 140
 $minitime = time();
141 141
 $maxitime = 0;
142 142
 
143 143
 
144 144
 $modelsdb = array();
145 145
 if (file_exists('models/modelsdb')) {
146
-	if (($handle = fopen('models/modelsdb','r')) !== FALSE) {
147
-		while (($row = fgetcsv($handle,1000)) !== FALSE) {
148
-			if (isset($row[1]) ){
146
+	if (($handle = fopen('models/modelsdb', 'r')) !== FALSE) {
147
+		while (($row = fgetcsv($handle, 1000)) !== FALSE) {
148
+			if (isset($row[1])) {
149 149
 				$model = $row[0];
150 150
 				$modelsdb[$model] = $row[1];
151 151
 			}
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
 $output .= '},';
175 175
 if (!empty($spotter_array) && is_array($spotter_array))
176 176
 {
177
-	foreach($spotter_array as $spotter_item)
177
+	foreach ($spotter_array as $spotter_item)
178 178
 	{
179 179
 		$j++;
180 180
 		date_default_timezone_set('UTC');
@@ -359,7 +359,7 @@  discard block
 block discarded – undo
359 359
 			$output .= '"cartographicDegrees": [';
360 360
 			if ($minitime > strtotime($spotter_item['date'])) $minitime = strtotime($spotter_item['date']);
361 361
 			if ($maxitime < strtotime($spotter_item['date'])) $maxitime = strtotime($spotter_item['date']);
362
-			$output .= '"'.date("c",strtotime($spotter_item['date'])).'", ';
362
+			$output .= '"'.date("c", strtotime($spotter_item['date'])).'", ';
363 363
 			$output .= $spotter_item['longitude'].', ';
364 364
 			$output .= $spotter_item['latitude'].', ';
365 365
 			$prevlong = $spotter_item['longitude'];
@@ -371,7 +371,7 @@  discard block
 block discarded – undo
371 371
 			//$quat = quaternionrotate(deg2rad($spotter_item['heading']),deg2rad(0),deg2rad(0));
372 372
 			//$orientation .= '"'.date("c",strtotime($spotter_item['date'])).'",'.$quat['x'].','.$quat['y'].','.$quat['z'].','.$quat['w'];
373 373
 		} else {
374
-			$output .= ',"'.date("c",strtotime($spotter_item['date'])).'", ';
374
+			$output .= ',"'.date("c", strtotime($spotter_item['date'])).'", ';
375 375
 			if ($maxitime < strtotime($spotter_item['date'])) $maxitime = strtotime($spotter_item['date']);
376 376
 			if ($spotter_item['ground_speed'] == 0) {
377 377
 				$output .= $prevlong.', ';
@@ -400,7 +400,7 @@  discard block
 block discarded – undo
400 400
 	$output  = substr($output, 0, -1);
401 401
 }
402 402
 $output .= ']';
403
-$output = str_replace('%minitime%',date("c",$minitime),$output);
404
-$output = str_replace('%maxitime%',date("c",$maxitime),$output);
403
+$output = str_replace('%minitime%', date("c", $minitime), $output);
404
+$output = str_replace('%maxitime%', date("c", $maxitime), $output);
405 405
 print $output;
406 406
 ?>
Please login to merge, or discard this patch.
Braces   +65 added lines, -22 removed lines patch added patch discarded remove patch
@@ -40,23 +40,46 @@  discard block
 block discarded – undo
40 40
 }
41 41
 header('Content-Type: text/javascript');
42 42
 
43
-if (!isset($globalJsonCompress)) $compress = true;
44
-else $compress = $globalJsonCompress;
43
+if (!isset($globalJsonCompress)) {
44
+	$compress = true;
45
+} else {
46
+	$compress = $globalJsonCompress;
47
+}
45 48
 
46 49
 $from_archive = false;
47 50
 $min = false;
48 51
 $allhistory = false;
49 52
 $filter['source'] = array();
50
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt'));
51
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup'));
52
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars'));
53
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs'));
54
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs'));
55
-if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING);
56
-if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING);
57
-if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING);
58
-if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING);
59
-if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING);
53
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') {
54
+	$filter['source'] = array_merge($filter['source'],array('vatsimtxt'));
55
+}
56
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') {
57
+	$filter['source'] = array_merge($filter['source'],array('whazzup'));
58
+}
59
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') {
60
+	$filter['source'] = array_merge($filter['source'],array('phpvmacars'));
61
+}
62
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') {
63
+	$filter['source'] = array_merge($filter['source'],array('sbs'));
64
+}
65
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') {
66
+	$filter['source'] = array_merge($filter['source'],array('aprs'));
67
+}
68
+if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') {
69
+	$filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING);
70
+}
71
+if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') {
72
+	$filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING);
73
+}
74
+if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') {
75
+	$filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING);
76
+}
77
+if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') {
78
+	$filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING);
79
+}
80
+if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') {
81
+	$filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING);
82
+}
60 83
 /*
61 84
 if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) {
62 85
 	$min = true;
@@ -133,8 +156,12 @@  discard block
 block discarded – undo
133 156
 	} else {
134 157
 		$flightcnt = $SpotterLive->getLiveSpotterCount($filter);
135 158
 	}
136
-	if ($flightcnt == '') $flightcnt = 0;
137
-} else $flightcnt = 0;
159
+	if ($flightcnt == '') {
160
+		$flightcnt = 0;
161
+	}
162
+	} else {
163
+	$flightcnt = 0;
164
+}
138 165
 
139 166
 $sqltime = round(microtime(true)-$begintime,2);
140 167
 $minitime = time();
@@ -157,7 +184,9 @@  discard block
 block discarded – undo
157 184
 $j = 0;
158 185
 $prev_flightaware_id = '';
159 186
 $speed = 1;
160
-if (isset($archivespeed)) $speed = $archivespeed;
187
+if (isset($archivespeed)) {
188
+	$speed = $archivespeed;
189
+}
161 190
 $output = '[';
162 191
 $output .= '{"id" : "document", "name" : "fam","version" : "1.0"';
163 192
 //	$output .= ',"clock": {"interval" : "'.date("c",time()-$globalLiveInterval).'/'.date("c").'","currentTime" : "'.date("c",time() - $globalLiveInterval).'","multiplier" : 1,"range" : "LOOP_STOP","step": "SYSTEM_CLOCK_MULTIPLIER"}';
@@ -227,7 +256,9 @@  discard block
 block discarded – undo
227 256
 					$spotter_item['engine_type'] = $aircraft_info[0]['engine_type'];
228 257
 					$spotter_item['wake_category'] = $aircraft_info[0]['wake_category'];
229 258
 					$spotter_item['engine_count'] = $aircraft_info[0]['engine_count'];
230
-				} else $aircraft_shadow = '';
259
+				} else {
260
+					$aircraft_shadow = '';
261
+				}
231 262
 				if ($aircraft_shadow != '') {
232 263
 					if (isset($modelsdb[$aircraft_shadow])) {
233 264
 						$output .= '"model": {"gltf" : "'.$globalURL.'/models/'.$modelsdb[$aircraft_shadow].'","scale" : 1.0,"minimumPixelSize": 20 ,';
@@ -324,7 +355,9 @@  discard block
 block discarded – undo
324 355
 						$output .= '"model": {"gltf" : "'.$globalURL.'/models/Cesium_Air.glb","scale" : 1.0,"minimumPixelSize": 20,';
325 356
 						$output .= '"heightReference": "'.$heightrelative.'"},';
326 357
 							//if ($spotter_item['aircraft_shadow'] != '') $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",';
327
-						if ($spotter_item['aircraft_icao'] != '') $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",';
358
+						if ($spotter_item['aircraft_icao'] != '') {
359
+							$output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",';
360
+						}
328 361
 						$modelsdb[$aircraft_icao] = 'Cesium_Air.glb';
329 362
 					}
330 363
 				} elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') {
@@ -336,7 +369,9 @@  discard block
 block discarded – undo
336 369
 					$output .= '"model": {"gltf" : "'.$globalURL.'/models/Cesium_Air.glb","scale" : 1.0,"minimumPixelSize": 20,';
337 370
 					$output .= '"heightReference": "'.$heightrelative.'"},';
338 371
 					//if ($spotter_item['aircraft_shadow'] != '') $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",';
339
-					if ($spotter_item['aircraft_icao'] != '') $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",';
372
+					if ($spotter_item['aircraft_icao'] != '') {
373
+						$output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",';
374
+					}
340 375
 					$modelsdb[$aircraft_icao] = 'Cesium_Air.glb';
341 376
 				}
342 377
 
@@ -344,7 +379,9 @@  discard block
 block discarded – undo
344 379
 				$output .= '"model": {"gltf" : "'.$globalURL.'/models/Cesium_Air.glb","scale" : 1.0,"minimumPixelSize": 20,';
345 380
 				$output .= '"heightReference": "'.$heightrelative.'"},';
346 381
 				//if ($spotter_item['aircraft_shadow'] != '') $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",';
347
-				if ($spotter_item['aircraft_icao'] != '') $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",';
382
+				if ($spotter_item['aircraft_icao'] != '') {
383
+					$output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",';
384
+				}
348 385
 				$modelsdb[$aircraft_icao] = 'Cesium_Air.glb';
349 386
 			}
350 387
 	//		$output .= '"heightReference": "CLAMP_TO_GROUND",';
@@ -357,8 +394,12 @@  discard block
 block discarded – undo
357 394
 	//		$output .= '"interpolationDegree" : 5,';
358 395
 	//		$output .= '"epoch" : "'.date("c",strtotime($spotter_item['date'])).'", ';
359 396
 			$output .= '"cartographicDegrees": [';
360
-			if ($minitime > strtotime($spotter_item['date'])) $minitime = strtotime($spotter_item['date']);
361
-			if ($maxitime < strtotime($spotter_item['date'])) $maxitime = strtotime($spotter_item['date']);
397
+			if ($minitime > strtotime($spotter_item['date'])) {
398
+				$minitime = strtotime($spotter_item['date']);
399
+			}
400
+			if ($maxitime < strtotime($spotter_item['date'])) {
401
+				$maxitime = strtotime($spotter_item['date']);
402
+			}
362 403
 			$output .= '"'.date("c",strtotime($spotter_item['date'])).'", ';
363 404
 			$output .= $spotter_item['longitude'].', ';
364 405
 			$output .= $spotter_item['latitude'].', ';
@@ -372,7 +413,9 @@  discard block
 block discarded – undo
372 413
 			//$orientation .= '"'.date("c",strtotime($spotter_item['date'])).'",'.$quat['x'].','.$quat['y'].','.$quat['z'].','.$quat['w'];
373 414
 		} else {
374 415
 			$output .= ',"'.date("c",strtotime($spotter_item['date'])).'", ';
375
-			if ($maxitime < strtotime($spotter_item['date'])) $maxitime = strtotime($spotter_item['date']);
416
+			if ($maxitime < strtotime($spotter_item['date'])) {
417
+				$maxitime = strtotime($spotter_item['date']);
418
+			}
376 419
 			if ($spotter_item['ground_speed'] == 0) {
377 420
 				$output .= $prevlong.', ';
378 421
 				$output .= $prevlat.', ';
Please login to merge, or discard this patch.
require/class.Spotter.php 3 patches
Indentation   +1312 added lines, -1312 removed lines patch added patch discarded remove patch
@@ -13,10 +13,10 @@  discard block
 block discarded – undo
13 13
 	}
14 14
 
15 15
 	/**
16
-	* Get SQL query part for filter used
17
-	* @param Array $filter the filter
18
-	* @return Array the SQL part
19
-	*/
16
+	 * Get SQL query part for filter used
17
+	 * @param Array $filter the filter
18
+	 * @return Array the SQL part
19
+	 */
20 20
 	public function getFilter($filter = array(),$where = false,$and = false) {
21 21
 		global $globalFilter, $globalStatsFilters, $globalFilterName;
22 22
 		$filters = array();
@@ -87,14 +87,14 @@  discard block
 block discarded – undo
87 87
 	}
88 88
 
89 89
 	/**
90
-	* Executes the SQL statements to get the spotter information
91
-	*
92
-	* @param String $query the SQL query
93
-	* @param Array $params parameter of the query
94
-	* @param String $limitQuery the limit query
95
-	* @return Array the spotter information
96
-	*
97
-	*/
90
+	 * Executes the SQL statements to get the spotter information
91
+	 *
92
+	 * @param String $query the SQL query
93
+	 * @param Array $params parameter of the query
94
+	 * @param String $limitQuery the limit query
95
+	 * @return Array the spotter information
96
+	 *
97
+	 */
98 98
 	public function getDataFromDB($query, $params = array(), $limitQuery = '',$schedules = false)
99 99
 	{
100 100
 		global $globalSquawkCountry, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalAirlinesSource, $globalVAM;
@@ -258,11 +258,11 @@  discard block
 block discarded – undo
258 258
 					if ($aircraft_array[0]['aircraft_shadow'] != NULL) {
259 259
 						$temp_array['aircraft_shadow'] = $aircraft_array[0]['aircraft_shadow'];
260 260
 					} else $temp_array['aircraft_shadow'] = 'default.png';
261
-                                } else {
262
-                            		$temp_array['aircraft_shadow'] = 'default.png';
261
+								} else {
262
+									$temp_array['aircraft_shadow'] = 'default.png';
263 263
 					$temp_array['aircraft_name'] = 'N/A';
264 264
 					$temp_array['aircraft_manufacturer'] = 'N/A';
265
-                            	}
265
+								}
266 266
 			}
267 267
 			$fromsource = NULL;
268 268
 			if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource;
@@ -458,11 +458,11 @@  discard block
 block discarded – undo
458 458
 	
459 459
 	
460 460
 	/**
461
-	* Gets all the spotter information
462
-	*
463
-	* @return Array the spotter information
464
-	*
465
-	*/
461
+	 * Gets all the spotter information
462
+	 *
463
+	 * @return Array the spotter information
464
+	 *
465
+	 */
466 466
 	public function searchSpotterData($q = '', $registration = '', $aircraft_icao = '', $aircraft_manufacturer = '', $highlights = '', $airline_icao = '', $airline_country = '', $airline_type = '', $airport = '', $airport_country = '', $callsign = '', $departure_airport_route = '', $arrival_airport_route = '', $owner = '',$pilot_id = '',$pilot_name = '',$altitude = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '',$origLat = '',$origLon = '',$dist = '',$filters = array())
467 467
 	{
468 468
 		global $globalTimezone, $globalDBdriver;
@@ -809,11 +809,11 @@  discard block
 block discarded – undo
809 809
 	
810 810
 	
811 811
 	/**
812
-	* Gets all the spotter information based on the latest data entry
813
-	*
814
-	* @return Array the spotter information
815
-	*
816
-	*/
812
+	 * Gets all the spotter information based on the latest data entry
813
+	 *
814
+	 * @return Array the spotter information
815
+	 *
816
+	 */
817 817
 	public function getLatestSpotterData($limit = '', $sort = '', $filter = array())
818 818
 	{
819 819
 		global $global_query;
@@ -852,12 +852,12 @@  discard block
 block discarded – undo
852 852
 	}
853 853
     
854 854
     
855
-    /**
856
-	* Gets all the spotter information based on a user's latitude and longitude
857
-	*
858
-	* @return Array the spotter information
859
-	*
860
-	*/
855
+	/**
856
+	 * Gets all the spotter information based on a user's latitude and longitude
857
+	 *
858
+	 * @return Array the spotter information
859
+	 *
860
+	 */
861 861
 	public function getLatestSpotterForLayar($lat, $lng, $radius, $interval)
862 862
 	{
863 863
 		date_default_timezone_set('UTC');
@@ -885,7 +885,7 @@  discard block
 block discarded – undo
885 885
 				return false;
886 886
 			}
887 887
 		}
888
-    		$additional_query = '';
888
+			$additional_query = '';
889 889
 		if ($interval != "")
890 890
 		{
891 891
 			if (!is_string($interval))
@@ -925,12 +925,12 @@  discard block
 block discarded – undo
925 925
 	}
926 926
     
927 927
     
928
-    /**
929
-	* Gets all the spotter information sorted by the newest aircraft type
930
-	*
931
-	* @return Array the spotter information
932
-	*
933
-	*/
928
+	/**
929
+	 * Gets all the spotter information sorted by the newest aircraft type
930
+	 *
931
+	 * @return Array the spotter information
932
+	 *
933
+	 */
934 934
 	public function getNewestSpotterDataSortedByAircraftType($limit = '', $sort = '',$filter = array())
935 935
 	{
936 936
 		global $global_query;
@@ -971,11 +971,11 @@  discard block
 block discarded – undo
971 971
     
972 972
     
973 973
 	/**
974
-	* Gets all the spotter information sorted by the newest aircraft registration
975
-	*
976
-	* @return Array the spotter information
977
-	*
978
-	*/
974
+	 * Gets all the spotter information sorted by the newest aircraft registration
975
+	 *
976
+	 * @return Array the spotter information
977
+	 *
978
+	 */
979 979
 	public function getNewestSpotterDataSortedByAircraftRegistration($limit = '', $sort = '', $filter = array())
980 980
 	{
981 981
 		global $global_query;
@@ -1015,11 +1015,11 @@  discard block
 block discarded – undo
1015 1015
 
1016 1016
 
1017 1017
 	/**
1018
-	* Gets all the spotter information sorted by the newest airline
1019
-	*
1020
-	* @return Array the spotter information
1021
-	*
1022
-	*/
1018
+	 * Gets all the spotter information sorted by the newest airline
1019
+	 *
1020
+	 * @return Array the spotter information
1021
+	 *
1022
+	 */
1023 1023
 	public function getNewestSpotterDataSortedByAirline($limit = '', $sort = '',$filter = array())
1024 1024
 	{
1025 1025
 		global $global_query;
@@ -1058,12 +1058,12 @@  discard block
 block discarded – undo
1058 1058
 	}
1059 1059
     
1060 1060
     
1061
-    /**
1062
-	* Gets all the spotter information sorted by the newest departure airport
1063
-	*
1064
-	* @return Array the spotter information
1065
-	*
1066
-	*/
1061
+	/**
1062
+	 * Gets all the spotter information sorted by the newest departure airport
1063
+	 *
1064
+	 * @return Array the spotter information
1065
+	 *
1066
+	 */
1067 1067
 	public function getNewestSpotterDataSortedByDepartureAirport($limit = '', $sort = '', $filter = array())
1068 1068
 	{
1069 1069
 		global $global_query;
@@ -1105,11 +1105,11 @@  discard block
 block discarded – undo
1105 1105
 
1106 1106
 
1107 1107
 	/**
1108
-	* Gets all the spotter information sorted by the newest arrival airport
1109
-	*
1110
-	* @return Array the spotter information
1111
-	*
1112
-	*/
1108
+	 * Gets all the spotter information sorted by the newest arrival airport
1109
+	 *
1110
+	 * @return Array the spotter information
1111
+	 *
1112
+	 */
1113 1113
 	public function getNewestSpotterDataSortedByArrivalAirport($limit = '', $sort = '', $filter = array())
1114 1114
 	{
1115 1115
 		global $global_query;
@@ -1148,11 +1148,11 @@  discard block
 block discarded – undo
1148 1148
 	
1149 1149
 
1150 1150
 	/**
1151
-	* Gets all the spotter information based on the spotter id
1152
-	*
1153
-	* @return Array the spotter information
1154
-	*
1155
-	*/
1151
+	 * Gets all the spotter information based on the spotter id
1152
+	 *
1153
+	 * @return Array the spotter information
1154
+	 *
1155
+	 */
1156 1156
 	public function getSpotterDataByID($id = '')
1157 1157
 	{
1158 1158
 		global $global_query;
@@ -1174,11 +1174,11 @@  discard block
 block discarded – undo
1174 1174
 	
1175 1175
 	
1176 1176
 	/**
1177
-	* Gets all the spotter information based on the callsign
1178
-	*
1179
-	* @return Array the spotter information
1180
-	*
1181
-	*/
1177
+	 * Gets all the spotter information based on the callsign
1178
+	 *
1179
+	 * @return Array the spotter information
1180
+	 *
1181
+	 */
1182 1182
 	public function getSpotterDataByIdent($ident = '', $limit = '', $sort = '')
1183 1183
 	{
1184 1184
 		global $global_query;
@@ -1231,11 +1231,11 @@  discard block
 block discarded – undo
1231 1231
 	
1232 1232
 	
1233 1233
 	/**
1234
-	* Gets all the spotter information based on the aircraft type
1235
-	*
1236
-	* @return Array the spotter information
1237
-	*
1238
-	*/
1234
+	 * Gets all the spotter information based on the aircraft type
1235
+	 *
1236
+	 * @return Array the spotter information
1237
+	 *
1238
+	 */
1239 1239
 	public function getSpotterDataByAircraft($aircraft_type = '', $limit = '', $sort = '', $filter = array())
1240 1240
 	{
1241 1241
 		global $global_query;
@@ -1289,11 +1289,11 @@  discard block
 block discarded – undo
1289 1289
 	
1290 1290
 	
1291 1291
 	/**
1292
-	* Gets all the spotter information based on the aircraft registration
1293
-	*
1294
-	* @return Array the spotter information
1295
-	*
1296
-	*/
1292
+	 * Gets all the spotter information based on the aircraft registration
1293
+	 *
1294
+	 * @return Array the spotter information
1295
+	 *
1296
+	 */
1297 1297
 	public function getSpotterDataByRegistration($registration = '', $limit = '', $sort = '', $filter = array())
1298 1298
 	{
1299 1299
 		global $global_query;
@@ -1350,11 +1350,11 @@  discard block
 block discarded – undo
1350 1350
 	
1351 1351
 	
1352 1352
 	/**
1353
-	* Gets all the spotter information based on the airline
1354
-	*
1355
-	* @return Array the spotter information
1356
-	*
1357
-	*/
1353
+	 * Gets all the spotter information based on the airline
1354
+	 *
1355
+	 * @return Array the spotter information
1356
+	 *
1357
+	 */
1358 1358
 	public function getSpotterDataByAirline($airline = '', $limit = '', $sort = '',$filters = array())
1359 1359
 	{
1360 1360
 		global $global_query;
@@ -1407,11 +1407,11 @@  discard block
 block discarded – undo
1407 1407
 	
1408 1408
 	
1409 1409
 	/**
1410
-	* Gets all the spotter information based on the airport
1411
-	*
1412
-	* @return Array the spotter information
1413
-	*
1414
-	*/
1410
+	 * Gets all the spotter information based on the airport
1411
+	 *
1412
+	 * @return Array the spotter information
1413
+	 *
1414
+	 */
1415 1415
 	public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '',$filters = array())
1416 1416
 	{
1417 1417
 		global $global_query;
@@ -1465,11 +1465,11 @@  discard block
 block discarded – undo
1465 1465
 
1466 1466
 
1467 1467
 	/**
1468
-	* Gets all the spotter information based on the date
1469
-	*
1470
-	* @return Array the spotter information
1471
-	*
1472
-	*/
1468
+	 * Gets all the spotter information based on the date
1469
+	 *
1470
+	 * @return Array the spotter information
1471
+	 *
1472
+	 */
1473 1473
 	public function getSpotterDataByDate($date = '', $limit = '', $sort = '',$filter = array())
1474 1474
 	{
1475 1475
 		global $global_query, $globalTimezone, $globalDBdriver;
@@ -1533,11 +1533,11 @@  discard block
 block discarded – undo
1533 1533
 
1534 1534
 
1535 1535
 	/**
1536
-	* Gets all the spotter information based on the country name
1537
-	*
1538
-	* @return Array the spotter information
1539
-	*
1540
-	*/
1536
+	 * Gets all the spotter information based on the country name
1537
+	 *
1538
+	 * @return Array the spotter information
1539
+	 *
1540
+	 */
1541 1541
 	public function getSpotterDataByCountry($country = '', $limit = '', $sort = '',$filters = array())
1542 1542
 	{
1543 1543
 		global $global_query;
@@ -1591,11 +1591,11 @@  discard block
 block discarded – undo
1591 1591
 	
1592 1592
 	
1593 1593
 	/**
1594
-	* Gets all the spotter information based on the manufacturer name
1595
-	*
1596
-	* @return Array the spotter information
1597
-	*
1598
-	*/
1594
+	 * Gets all the spotter information based on the manufacturer name
1595
+	 *
1596
+	 * @return Array the spotter information
1597
+	 *
1598
+	 */
1599 1599
 	public function getSpotterDataByManufacturer($aircraft_manufacturer = '', $limit = '', $sort = '', $filters = array())
1600 1600
 	{
1601 1601
 		global $global_query;
@@ -1651,13 +1651,13 @@  discard block
 block discarded – undo
1651 1651
   
1652 1652
   
1653 1653
 	/**
1654
-	* Gets a list of all aircraft that take a route
1655
-	*
1656
-	* @param String $departure_airport_icao ICAO code of departure airport
1657
-	* @param String $arrival_airport_icao ICAO code of arrival airport
1658
-	* @return Array the spotter information
1659
-	*
1660
-	*/
1654
+	 * Gets a list of all aircraft that take a route
1655
+	 *
1656
+	 * @param String $departure_airport_icao ICAO code of departure airport
1657
+	 * @param String $arrival_airport_icao ICAO code of arrival airport
1658
+	 * @return Array the spotter information
1659
+	 *
1660
+	 */
1661 1661
 	public function getSpotterDataByRoute($departure_airport_icao = '', $arrival_airport_icao = '', $limit = '', $sort = '', $filters = array())
1662 1662
 	{
1663 1663
 		global $global_query;
@@ -1726,11 +1726,11 @@  discard block
 block discarded – undo
1726 1726
 	
1727 1727
 	
1728 1728
 	/**
1729
-	* Gets all the spotter information based on the special column in the table
1730
-	*
1731
-	* @return Array the spotter information
1732
-	*
1733
-	*/
1729
+	 * Gets all the spotter information based on the special column in the table
1730
+	 *
1731
+	 * @return Array the spotter information
1732
+	 *
1733
+	 */
1734 1734
 	public function getSpotterDataByHighlight($limit = '', $sort = '', $filter = array())
1735 1735
 	{
1736 1736
 		global $global_query;
@@ -1769,11 +1769,11 @@  discard block
 block discarded – undo
1769 1769
 	}
1770 1770
 
1771 1771
 	/**
1772
-	* Gets all the highlight based on a aircraft registration
1773
-	*
1774
-	* @return String the highlight text
1775
-	*
1776
-	*/
1772
+	 * Gets all the highlight based on a aircraft registration
1773
+	 *
1774
+	 * @return String the highlight text
1775
+	 *
1776
+	 */
1777 1777
 	public function getHighlightByRegistration($registration,$filter = array())
1778 1778
 	{
1779 1779
 		global $global_query;
@@ -1795,13 +1795,13 @@  discard block
 block discarded – undo
1795 1795
 
1796 1796
 	
1797 1797
 	/**
1798
-	* Gets the squawk usage from squawk code
1799
-	*
1800
-	* @param String $squawk squawk code
1801
-	* @param String $country country
1802
-	* @return String usage
1803
-	*
1804
-	*/
1798
+	 * Gets the squawk usage from squawk code
1799
+	 *
1800
+	 * @param String $squawk squawk code
1801
+	 * @param String $country country
1802
+	 * @return String usage
1803
+	 *
1804
+	 */
1805 1805
 	public function getSquawkUsage($squawk = '',$country = 'FR')
1806 1806
 	{
1807 1807
 		
@@ -1822,12 +1822,12 @@  discard block
 block discarded – undo
1822 1822
 	}
1823 1823
 
1824 1824
 	/**
1825
-	* Gets the airport icao from the iata
1826
-	*
1827
-	* @param String $airport_iata the iata code of the airport
1828
-	* @return String airport iata
1829
-	*
1830
-	*/
1825
+	 * Gets the airport icao from the iata
1826
+	 *
1827
+	 * @param String $airport_iata the iata code of the airport
1828
+	 * @return String airport iata
1829
+	 *
1830
+	 */
1831 1831
 	public function getAirportIcao($airport_iata = '')
1832 1832
 	{
1833 1833
 		
@@ -1847,14 +1847,14 @@  discard block
 block discarded – undo
1847 1847
 	}
1848 1848
 
1849 1849
 	/**
1850
-	* Gets the airport distance
1851
-	*
1852
-	* @param String $airport_icao the icao code of the airport
1853
-	* @param Float $latitude the latitude
1854
-	* @param Float $longitude the longitude
1855
-	* @return Float distance to the airport
1856
-	*
1857
-	*/
1850
+	 * Gets the airport distance
1851
+	 *
1852
+	 * @param String $airport_icao the icao code of the airport
1853
+	 * @param Float $latitude the latitude
1854
+	 * @param Float $longitude the longitude
1855
+	 * @return Float distance to the airport
1856
+	 *
1857
+	 */
1858 1858
 	public function getAirportDistance($airport_icao,$latitude,$longitude)
1859 1859
 	{
1860 1860
 		
@@ -1875,12 +1875,12 @@  discard block
 block discarded – undo
1875 1875
 	}
1876 1876
 	
1877 1877
 	/**
1878
-	* Gets the airport info based on the icao
1879
-	*
1880
-	* @param String $airport the icao code of the airport
1881
-	* @return Array airport information
1882
-	*
1883
-	*/
1878
+	 * Gets the airport info based on the icao
1879
+	 *
1880
+	 * @param String $airport the icao code of the airport
1881
+	 * @return Array airport information
1882
+	 *
1883
+	 */
1884 1884
 	public function getAllAirportInfo($airport = '')
1885 1885
 	{
1886 1886
 		
@@ -1926,12 +1926,12 @@  discard block
 block discarded – undo
1926 1926
 	}
1927 1927
 	
1928 1928
 	/**
1929
-	* Gets the airport info based on the country
1930
-	*
1931
-	* @param Array $countries Airports countries
1932
-	* @return Array airport information
1933
-	*
1934
-	*/
1929
+	 * Gets the airport info based on the country
1930
+	 *
1931
+	 * @param Array $countries Airports countries
1932
+	 * @return Array airport information
1933
+	 *
1934
+	 */
1935 1935
 	public function getAllAirportInfobyCountry($countries)
1936 1936
 	{
1937 1937
 		$lst_countries = '';
@@ -1969,12 +1969,12 @@  discard block
 block discarded – undo
1969 1969
 	}
1970 1970
 	
1971 1971
 	/**
1972
-	* Gets airports info based on the coord
1973
-	*
1974
-	* @param Array $coord Airports longitude min,latitude min, longitude max, latitude max
1975
-	* @return Array airport information
1976
-	*
1977
-	*/
1972
+	 * Gets airports info based on the coord
1973
+	 *
1974
+	 * @param Array $coord Airports longitude min,latitude min, longitude max, latitude max
1975
+	 * @return Array airport information
1976
+	 *
1977
+	 */
1978 1978
 	public function getAllAirportInfobyCoord($coord)
1979 1979
 	{
1980 1980
 		global $globalDBdriver;
@@ -2005,12 +2005,12 @@  discard block
 block discarded – undo
2005 2005
 	}
2006 2006
 
2007 2007
 	/**
2008
-	* Gets waypoints info based on the coord
2009
-	*
2010
-	* @param Array $coord waypoints coord
2011
-	* @return Array airport information
2012
-	*
2013
-	*/
2008
+	 * Gets waypoints info based on the coord
2009
+	 *
2010
+	 * @param Array $coord waypoints coord
2011
+	 * @return Array airport information
2012
+	 *
2013
+	 */
2014 2014
 	public function getAllWaypointsInfobyCoord($coord)
2015 2015
 	{
2016 2016
 		if (is_array($coord)) {
@@ -2044,12 +2044,12 @@  discard block
 block discarded – undo
2044 2044
 	
2045 2045
 	
2046 2046
 	/**
2047
-	* Gets the airline info based on the icao code or iata code
2048
-	*
2049
-	* @param String $airline_icao the iata code of the airport
2050
-	* @return Array airport information
2051
-	*
2052
-	*/
2047
+	 * Gets the airline info based on the icao code or iata code
2048
+	 *
2049
+	 * @param String $airline_icao the iata code of the airport
2050
+	 * @return Array airport information
2051
+	 *
2052
+	 */
2053 2053
 	public function getAllAirlineInfo($airline_icao, $fromsource = NULL)
2054 2054
 	{
2055 2055
 		global $globalUseRealAirlines;
@@ -2080,7 +2080,7 @@  discard block
 block discarded – undo
2080 2080
 			} else {
2081 2081
 				$sth->execute(array(':airline_icao' => $airline_icao,':fromsource' => $fromsource));
2082 2082
 			}
2083
-                        /*
2083
+						/*
2084 2084
 			$airline_array = array();
2085 2085
 			$temp_array = array();
2086 2086
 		
@@ -2110,12 +2110,12 @@  discard block
 block discarded – undo
2110 2110
 	}
2111 2111
 	
2112 2112
 	/**
2113
-	* Gets the airline info based on the airline name
2114
-	*
2115
-	* @param String $airline_name the name of the airline
2116
-	* @return Array airline information
2117
-	*
2118
-	*/
2113
+	 * Gets the airline info based on the airline name
2114
+	 *
2115
+	 * @param String $airline_name the name of the airline
2116
+	 * @return Array airline information
2117
+	 *
2118
+	 */
2119 2119
 	public function getAllAirlineInfoByName($airline_name, $fromsource = NULL)
2120 2120
 	{
2121 2121
 		global $globalUseRealAirlines;
@@ -2143,12 +2143,12 @@  discard block
 block discarded – undo
2143 2143
 	
2144 2144
 	
2145 2145
 	/**
2146
-	* Gets the aircraft info based on the aircraft type
2147
-	*
2148
-	* @param String $aircraft_type the aircraft type
2149
-	* @return Array aircraft information
2150
-	*
2151
-	*/
2146
+	 * Gets the aircraft info based on the aircraft type
2147
+	 *
2148
+	 * @param String $aircraft_type the aircraft type
2149
+	 * @return Array aircraft information
2150
+	 *
2151
+	 */
2152 2152
 	public function getAllAircraftInfo($aircraft_type)
2153 2153
 	{
2154 2154
 		$aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING);
@@ -2180,12 +2180,12 @@  discard block
 block discarded – undo
2180 2180
 	}
2181 2181
 
2182 2182
 	/**
2183
-	* Gets the aircraft icao based on the aircraft name/type
2184
-	*
2185
-	* @param String $aircraft_type the aircraft type
2186
-	* @return String aircraft information
2187
-	*
2188
-	*/
2183
+	 * Gets the aircraft icao based on the aircraft name/type
2184
+	 *
2185
+	 * @param String $aircraft_type the aircraft type
2186
+	 * @return String aircraft information
2187
+	 *
2188
+	 */
2189 2189
 	public function getAircraftIcao($aircraft_type)
2190 2190
 	{
2191 2191
 		$aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING);
@@ -2210,12 +2210,12 @@  discard block
 block discarded – undo
2210 2210
 	}
2211 2211
 	
2212 2212
 	/**
2213
-	* Gets the aircraft info based on the aircraft modes
2214
-	*
2215
-	* @param String $aircraft_modes the aircraft ident (hex)
2216
-	* @return String aircraft type
2217
-	*
2218
-	*/
2213
+	 * Gets the aircraft info based on the aircraft modes
2214
+	 *
2215
+	 * @param String $aircraft_modes the aircraft ident (hex)
2216
+	 * @return String aircraft type
2217
+	 *
2218
+	 */
2219 2219
 	public function getAllAircraftType($aircraft_modes)
2220 2220
 	{
2221 2221
 		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
@@ -2233,12 +2233,12 @@  discard block
 block discarded – undo
2233 2233
 	}
2234 2234
 
2235 2235
 	/**
2236
-	* Gets the aircraft info based on the aircraft registration
2237
-	*
2238
-	* @param String $registration the aircraft registration
2239
-	* @return String aircraft type
2240
-	*
2241
-	*/
2236
+	 * Gets the aircraft info based on the aircraft registration
2237
+	 *
2238
+	 * @param String $registration the aircraft registration
2239
+	 * @return String aircraft type
2240
+	 *
2241
+	 */
2242 2242
 	public function getAllAircraftTypeByRegistration($registration)
2243 2243
 	{
2244 2244
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -2256,12 +2256,12 @@  discard block
 block discarded – undo
2256 2256
 	}
2257 2257
 
2258 2258
 	/**
2259
-	* Gets correct aircraft operator corde
2260
-	*
2261
-	* @param String $operator the aircraft operator code (callsign)
2262
-	* @return String aircraft operator code
2263
-	*
2264
-	*/
2259
+	 * Gets correct aircraft operator corde
2260
+	 *
2261
+	 * @param String $operator the aircraft operator code (callsign)
2262
+	 * @return String aircraft operator code
2263
+	 *
2264
+	 */
2265 2265
 	public function getOperator($operator)
2266 2266
 	{
2267 2267
 		$operator = filter_var($operator,FILTER_SANITIZE_STRING);
@@ -2278,16 +2278,16 @@  discard block
 block discarded – undo
2278 2278
 	}
2279 2279
 
2280 2280
 	/**
2281
-	* Gets the aircraft route based on the aircraft callsign
2282
-	*
2283
-	* @param String $callsign the aircraft callsign
2284
-	* @return Array aircraft type
2285
-	*
2286
-	*/
2281
+	 * Gets the aircraft route based on the aircraft callsign
2282
+	 *
2283
+	 * @param String $callsign the aircraft callsign
2284
+	 * @return Array aircraft type
2285
+	 *
2286
+	 */
2287 2287
 	public function getRouteInfo($callsign)
2288 2288
 	{
2289 2289
 		$callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
2290
-                if ($callsign == '') return array();
2290
+				if ($callsign == '') return array();
2291 2291
 		$query  = "SELECT routes.Operator_ICAO, routes.FromAirport_ICAO, routes.ToAirport_ICAO, routes.RouteStop, routes.FromAirport_Time, routes.ToAirport_Time FROM routes WHERE CallSign = :callsign LIMIT 1";
2292 2292
 		
2293 2293
 		$sth = $this->db->prepare($query);
@@ -2301,12 +2301,12 @@  discard block
 block discarded – undo
2301 2301
 	}
2302 2302
 	
2303 2303
 	/**
2304
-	* Gets the aircraft info based on the aircraft registration
2305
-	*
2306
-	* @param String $registration the aircraft registration
2307
-	* @return Array aircraft information
2308
-	*
2309
-	*/
2304
+	 * Gets the aircraft info based on the aircraft registration
2305
+	 *
2306
+	 * @param String $registration the aircraft registration
2307
+	 * @return Array aircraft information
2308
+	 *
2309
+	 */
2310 2310
 	public function getAircraftInfoByRegistration($registration)
2311 2311
 	{
2312 2312
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -2333,12 +2333,12 @@  discard block
 block discarded – undo
2333 2333
 	}
2334 2334
 	
2335 2335
 	/**
2336
-	* Gets the aircraft owner & base based on the aircraft registration
2337
-	*
2338
-	* @param String $registration the aircraft registration
2339
-	* @return Array aircraft information
2340
-	*
2341
-	*/
2336
+	 * Gets the aircraft owner & base based on the aircraft registration
2337
+	 *
2338
+	 * @param String $registration the aircraft registration
2339
+	 * @return Array aircraft information
2340
+	 *
2341
+	 */
2342 2342
 	public function getAircraftOwnerByRegistration($registration)
2343 2343
 	{
2344 2344
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -2355,11 +2355,11 @@  discard block
 block discarded – undo
2355 2355
 	
2356 2356
   
2357 2357
   /**
2358
-	* Gets all flights (but with only little info)
2359
-	*
2360
-	* @return Array basic flight information
2361
-	*
2362
-	*/
2358
+   * Gets all flights (but with only little info)
2359
+   *
2360
+   * @return Array basic flight information
2361
+   *
2362
+   */
2363 2363
 	public function getAllFlightsforSitemap()
2364 2364
 	{
2365 2365
 		//$query  = "SELECT spotter_output.spotter_id, spotter_output.ident, spotter_output.airline_name, spotter_output.aircraft_name, spotter_output.aircraft_icao FROM spotter_output ORDER BY LIMIT ";
@@ -2367,7 +2367,7 @@  discard block
 block discarded – undo
2367 2367
 		
2368 2368
 		$sth = $this->db->prepare($query);
2369 2369
 		$sth->execute();
2370
-                  /*
2370
+				  /*
2371 2371
 		$flight_array = array();
2372 2372
 		$temp_array = array();
2373 2373
 		
@@ -2389,11 +2389,11 @@  discard block
 block discarded – undo
2389 2389
 	}
2390 2390
   
2391 2391
 	/**
2392
-	* Gets a list of all aircraft manufacturers
2393
-	*
2394
-	* @return Array list of aircraft types
2395
-	*
2396
-	*/
2392
+	 * Gets a list of all aircraft manufacturers
2393
+	 *
2394
+	 * @return Array list of aircraft types
2395
+	 *
2396
+	 */
2397 2397
 	public function getAllManufacturers()
2398 2398
 	{
2399 2399
 		/*
@@ -2422,11 +2422,11 @@  discard block
 block discarded – undo
2422 2422
   
2423 2423
   
2424 2424
   /**
2425
-	* Gets a list of all aircraft types
2426
-	*
2427
-	* @return Array list of aircraft types
2428
-	*
2429
-	*/
2425
+   * Gets a list of all aircraft types
2426
+   *
2427
+   * @return Array list of aircraft types
2428
+   *
2429
+   */
2430 2430
 	public function getAllAircraftTypes($filters = array())
2431 2431
 	{
2432 2432
 		/*
@@ -2461,11 +2461,11 @@  discard block
 block discarded – undo
2461 2461
 	
2462 2462
 	
2463 2463
 	/**
2464
-	* Gets a list of all aircraft registrations
2465
-	*
2466
-	* @return Array list of aircraft registrations
2467
-	*
2468
-	*/
2464
+	 * Gets a list of all aircraft registrations
2465
+	 *
2466
+	 * @return Array list of aircraft registrations
2467
+	 *
2468
+	 */
2469 2469
 	public function getAllAircraftRegistrations($filters = array())
2470 2470
 	{
2471 2471
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2490,12 +2490,12 @@  discard block
 block discarded – undo
2490 2490
 	}
2491 2491
 
2492 2492
 	/**
2493
-	* Gets all source name
2494
-	*
2495
-	* @param String type format of source
2496
-	* @return Array list of source name
2497
-	*
2498
-	*/
2493
+	 * Gets all source name
2494
+	 *
2495
+	 * @param String type format of source
2496
+	 * @return Array list of source name
2497
+	 *
2498
+	 */
2499 2499
 	public function getAllSourceName($type = '',$filters = array())
2500 2500
 	{
2501 2501
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2526,11 +2526,11 @@  discard block
 block discarded – undo
2526 2526
 
2527 2527
 
2528 2528
 	/**
2529
-	* Gets a list of all airline names
2530
-	*
2531
-	* @return Array list of airline names
2532
-	*
2533
-	*/
2529
+	 * Gets a list of all airline names
2530
+	 *
2531
+	 * @return Array list of airline names
2532
+	 *
2533
+	 */
2534 2534
 	public function getAllAirlineNames($airline_type = '',$forsource = NULL,$filters = array())
2535 2535
 	{
2536 2536
 		global $globalAirlinesSource,$globalVATSIM, $globalIVAO;
@@ -2579,11 +2579,11 @@  discard block
 block discarded – undo
2579 2579
 	}
2580 2580
 	
2581 2581
 	/**
2582
-	* Gets a list of all alliance names
2583
-	*
2584
-	* @return Array list of alliance names
2585
-	*
2586
-	*/
2582
+	 * Gets a list of all alliance names
2583
+	 *
2584
+	 * @return Array list of alliance names
2585
+	 *
2586
+	 */
2587 2587
 	public function getAllAllianceNames($forsource = NULL,$filters = array())
2588 2588
 	{
2589 2589
 		global $globalAirlinesSource,$globalVATSIM, $globalIVAO;
@@ -2608,11 +2608,11 @@  discard block
 block discarded – undo
2608 2608
 	}
2609 2609
 	
2610 2610
 	/**
2611
-	* Gets a list of all airline countries
2612
-	*
2613
-	* @return Array list of airline countries
2614
-	*
2615
-	*/
2611
+	 * Gets a list of all airline countries
2612
+	 *
2613
+	 * @return Array list of airline countries
2614
+	 *
2615
+	 */
2616 2616
 	public function getAllAirlineCountries($filters = array())
2617 2617
 	{
2618 2618
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2640,11 +2640,11 @@  discard block
 block discarded – undo
2640 2640
 	
2641 2641
 	
2642 2642
 	/**
2643
-	* Gets a list of all departure & arrival names
2644
-	*
2645
-	* @return Array list of airport names
2646
-	*
2647
-	*/
2643
+	 * Gets a list of all departure & arrival names
2644
+	 *
2645
+	 * @return Array list of airport names
2646
+	 *
2647
+	 */
2648 2648
 	public function getAllAirportNames($filters = array())
2649 2649
 	{
2650 2650
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2693,11 +2693,11 @@  discard block
 block discarded – undo
2693 2693
 	
2694 2694
 	
2695 2695
 	/**
2696
-	* Gets a list of all departure & arrival airport countries
2697
-	*
2698
-	* @return Array list of airport countries
2699
-	*
2700
-	*/
2696
+	 * Gets a list of all departure & arrival airport countries
2697
+	 *
2698
+	 * @return Array list of airport countries
2699
+	 *
2700
+	 */
2701 2701
 	public function getAllAirportCountries($filters = array())
2702 2702
 	{
2703 2703
 		$airport_array = array();
@@ -2745,11 +2745,11 @@  discard block
 block discarded – undo
2745 2745
 	
2746 2746
 	
2747 2747
 	/**
2748
-	* Gets a list of all countries (airline, departure airport & arrival airport)
2749
-	*
2750
-	* @return Array list of countries
2751
-	*
2752
-	*/
2748
+	 * Gets a list of all countries (airline, departure airport & arrival airport)
2749
+	 *
2750
+	 * @return Array list of countries
2751
+	 *
2752
+	 */
2753 2753
 	public function getAllCountries($filters = array())
2754 2754
 	{
2755 2755
 		$Connection= new Connection($this->db);
@@ -2826,11 +2826,11 @@  discard block
 block discarded – undo
2826 2826
 	
2827 2827
 	
2828 2828
 	/**
2829
-	* Gets a list of all idents/callsigns
2830
-	*
2831
-	* @return Array list of ident/callsign names
2832
-	*
2833
-	*/
2829
+	 * Gets a list of all idents/callsigns
2830
+	 *
2831
+	 * @return Array list of ident/callsign names
2832
+	 *
2833
+	 */
2834 2834
 	public function getAllIdents($filters = array())
2835 2835
 	{
2836 2836
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2854,9 +2854,9 @@  discard block
 block discarded – undo
2854 2854
 	}
2855 2855
 
2856 2856
 	/**
2857
-	* Get a list of flights from airport since 7 days
2858
-	* @return Array number, icao, name and city of airports
2859
-	*/
2857
+	 * Get a list of flights from airport since 7 days
2858
+	 * @return Array number, icao, name and city of airports
2859
+	 */
2860 2860
 
2861 2861
 	public function getLast7DaysAirportsDeparture($airport_icao = '',$filters = array()) {
2862 2862
 		global $globalTimezone, $globalDBdriver;
@@ -2887,9 +2887,9 @@  discard block
 block discarded – undo
2887 2887
 	}
2888 2888
 
2889 2889
 	/**
2890
-	* Get a list of flights from airport since 7 days
2891
-	* @return Array number, icao, name and city of airports
2892
-	*/
2890
+	 * Get a list of flights from airport since 7 days
2891
+	 * @return Array number, icao, name and city of airports
2892
+	 */
2893 2893
 
2894 2894
 	public function getLast7DaysAirportsDepartureByAirlines($airport_icao = '') {
2895 2895
 		global $globalTimezone, $globalDBdriver;
@@ -2919,9 +2919,9 @@  discard block
 block discarded – undo
2919 2919
 	}
2920 2920
 
2921 2921
 	/**
2922
-	* Get a list of flights from detected airport since 7 days
2923
-	* @return Array number, icao, name and city of airports
2924
-	*/
2922
+	 * Get a list of flights from detected airport since 7 days
2923
+	 * @return Array number, icao, name and city of airports
2924
+	 */
2925 2925
 
2926 2926
 	public function getLast7DaysDetectedAirportsDeparture($airport_icao = '', $filters = array()) {
2927 2927
 		global $globalTimezone, $globalDBdriver;
@@ -2959,9 +2959,9 @@  discard block
 block discarded – undo
2959 2959
 	}
2960 2960
 
2961 2961
 	/**
2962
-	* Get a list of flights from detected airport since 7 days
2963
-	* @return Array number, icao, name and city of airports
2964
-	*/
2962
+	 * Get a list of flights from detected airport since 7 days
2963
+	 * @return Array number, icao, name and city of airports
2964
+	 */
2965 2965
 
2966 2966
 	public function getLast7DaysDetectedAirportsDepartureByAirlines($airport_icao = '') {
2967 2967
 		global $globalTimezone, $globalDBdriver;
@@ -3003,9 +3003,9 @@  discard block
 block discarded – undo
3003 3003
 
3004 3004
 
3005 3005
 	/**
3006
-	* Get a list of flights to airport since 7 days
3007
-	* @return Array number, icao, name and city of airports
3008
-	*/
3006
+	 * Get a list of flights to airport since 7 days
3007
+	 * @return Array number, icao, name and city of airports
3008
+	 */
3009 3009
 
3010 3010
 	public function getLast7DaysAirportsArrival($airport_icao = '', $filters = array()) {
3011 3011
 		global $globalTimezone, $globalDBdriver;
@@ -3038,9 +3038,9 @@  discard block
 block discarded – undo
3038 3038
 
3039 3039
 
3040 3040
 	/**
3041
-	* Get a list of flights detected to airport since 7 days
3042
-	* @return Array number, icao, name and city of airports
3043
-	*/
3041
+	 * Get a list of flights detected to airport since 7 days
3042
+	 * @return Array number, icao, name and city of airports
3043
+	 */
3044 3044
 
3045 3045
 	public function getLast7DaysDetectedAirportsArrival($airport_icao = '',$filters = array()) {
3046 3046
 		global $globalTimezone, $globalDBdriver;
@@ -3081,9 +3081,9 @@  discard block
 block discarded – undo
3081 3081
 
3082 3082
 
3083 3083
 	/**
3084
-	* Get a list of flights to airport since 7 days
3085
-	* @return Array number, icao, name and city of airports
3086
-	*/
3084
+	 * Get a list of flights to airport since 7 days
3085
+	 * @return Array number, icao, name and city of airports
3086
+	 */
3087 3087
 
3088 3088
 	public function getLast7DaysAirportsArrivalByAirlines($airport_icao = '') {
3089 3089
 		global $globalTimezone, $globalDBdriver;
@@ -3115,9 +3115,9 @@  discard block
 block discarded – undo
3115 3115
 
3116 3116
 
3117 3117
 	/**
3118
-	* Get a list of flights detected to airport since 7 days
3119
-	* @return Array number, icao, name and city of airports
3120
-	*/
3118
+	 * Get a list of flights detected to airport since 7 days
3119
+	 * @return Array number, icao, name and city of airports
3120
+	 */
3121 3121
 
3122 3122
 	public function getLast7DaysDetectedAirportsArrivalByAirlines($airport_icao = '') {
3123 3123
 		global $globalTimezone, $globalDBdriver;
@@ -3161,11 +3161,11 @@  discard block
 block discarded – undo
3161 3161
 
3162 3162
 
3163 3163
 	/**
3164
-	* Gets a list of all dates
3165
-	*
3166
-	* @return Array list of date names
3167
-	*
3168
-	*/
3164
+	 * Gets a list of all dates
3165
+	 *
3166
+	 * @return Array list of date names
3167
+	 *
3168
+	 */
3169 3169
 	public function getAllDates()
3170 3170
 	{
3171 3171
 		global $globalTimezone, $globalDBdriver;
@@ -3206,11 +3206,11 @@  discard block
 block discarded – undo
3206 3206
 	
3207 3207
 	
3208 3208
 	/**
3209
-	* Gets all route combinations
3210
-	*
3211
-	* @return Array the route list
3212
-	*
3213
-	*/
3209
+	 * Gets all route combinations
3210
+	 *
3211
+	 * @return Array the route list
3212
+	 *
3213
+	 */
3214 3214
 	public function getAllRoutes()
3215 3215
 	{
3216 3216
 		$query  = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route,  spotter_output.departure_airport_icao, spotter_output.arrival_airport_icao 
@@ -3236,13 +3236,13 @@  discard block
 block discarded – undo
3236 3236
 	}
3237 3237
 
3238 3238
 	/**
3239
-	* Update ident spotter data
3240
-	*
3241
-	* @param String $flightaware_id the ID from flightaware
3242
-	* @param String $ident the flight ident
3243
-	* @return String success or false
3244
-	*
3245
-	*/	
3239
+	 * Update ident spotter data
3240
+	 *
3241
+	 * @param String $flightaware_id the ID from flightaware
3242
+	 * @param String $ident the flight ident
3243
+	 * @return String success or false
3244
+	 *
3245
+	 */	
3246 3246
 	public function updateIdentSpotterData($flightaware_id = '', $ident = '',$fromsource = NULL)
3247 3247
 	{
3248 3248
 		if (!is_numeric(substr($ident, 0, 3)))
@@ -3263,14 +3263,14 @@  discard block
 block discarded – undo
3263 3263
 		} else {
3264 3264
 			$airline_array = $this->getAllAirlineInfo("NA");
3265 3265
 		}
3266
-                $airline_name = $airline_array[0]['name'];
3267
-                $airline_icao = $airline_array[0]['icao'];
3268
-                $airline_country = $airline_array[0]['country'];
3269
-                $airline_type = $airline_array[0]['type'];
3266
+				$airline_name = $airline_array[0]['name'];
3267
+				$airline_icao = $airline_array[0]['icao'];
3268
+				$airline_country = $airline_array[0]['country'];
3269
+				$airline_type = $airline_array[0]['type'];
3270 3270
 
3271 3271
 
3272 3272
 		$query = 'UPDATE spotter_output SET ident = :ident, airline_name = :airline_name, airline_icao = :airline_icao, airline_country = :airline_country, airline_type = :airline_type WHERE flightaware_id = :flightaware_id';
3273
-                $query_values = array(':flightaware_id' => $flightaware_id,':ident' => $ident,':airline_name' => $airline_name,':airline_icao' => $airline_icao,':airline_country' => $airline_country,':airline_type' => $airline_type);
3273
+				$query_values = array(':flightaware_id' => $flightaware_id,':ident' => $ident,':airline_name' => $airline_name,':airline_icao' => $airline_icao,':airline_country' => $airline_country,':airline_type' => $airline_type);
3274 3274
 
3275 3275
 		try {
3276 3276
 			$sth = $this->db->prepare($query);
@@ -3283,19 +3283,19 @@  discard block
 block discarded – undo
3283 3283
 
3284 3284
 	}
3285 3285
 	/**
3286
-	* Update latest spotter data
3287
-	*
3288
-	* @param String $flightaware_id the ID from flightaware
3289
-	* @param String $ident the flight ident
3290
-	* @param String $arrival_airport_icao the arrival airport
3291
-	* @return String success or false
3292
-	*
3293
-	*/	
3286
+	 * Update latest spotter data
3287
+	 *
3288
+	 * @param String $flightaware_id the ID from flightaware
3289
+	 * @param String $ident the flight ident
3290
+	 * @param String $arrival_airport_icao the arrival airport
3291
+	 * @return String success or false
3292
+	 *
3293
+	 */	
3294 3294
 	public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '',$arrival_airport_time = '')
3295 3295
 	{
3296 3296
 		if ($groundspeed == '') $groundspeed = NULL;
3297 3297
 		$query = 'UPDATE spotter_output SET ident = :ident, last_latitude = :last_latitude, last_longitude = :last_longitude, last_altitude = :last_altitude, last_ground = :last_ground, last_seen = :last_seen, real_arrival_airport_icao = :real_arrival_airport_icao, real_arrival_airport_time = :real_arrival_airport_time, last_ground_speed = :last_ground_speed WHERE flightaware_id = :flightaware_id';
3298
-                $query_values = array(':flightaware_id' => $flightaware_id,':real_arrival_airport_icao' => $arrival_airport_icao,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_altitude' => $altitude,':last_ground_speed' => $groundspeed,':last_seen' => $date,':real_arrival_airport_time' => $arrival_airport_time, ':last_ground' => $ground, ':ident' => $ident);
3298
+				$query_values = array(':flightaware_id' => $flightaware_id,':real_arrival_airport_icao' => $arrival_airport_icao,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_altitude' => $altitude,':last_ground_speed' => $groundspeed,':last_seen' => $date,':real_arrival_airport_time' => $arrival_airport_time, ':last_ground' => $ground, ':ident' => $ident);
3299 3299
 
3300 3300
 		try {
3301 3301
 			$sth = $this->db->prepare($query);
@@ -3309,32 +3309,32 @@  discard block
 block discarded – undo
3309 3309
 	}
3310 3310
 
3311 3311
 	/**
3312
-	* Adds a new spotter data
3313
-	*
3314
-	* @param String $flightaware_id the ID from flightaware
3315
-	* @param String $ident the flight ident
3316
-	* @param String $aircraft_icao the aircraft type
3317
-	* @param String $departure_airport_icao the departure airport
3318
-	* @param String $arrival_airport_icao the arrival airport
3319
-	* @param String $latitude latitude of flight
3320
-	* @param String $longitude latitude of flight
3321
-	* @param String $waypoints waypoints of flight
3322
-	* @param String $altitude altitude of flight
3323
-	* @param String $heading heading of flight
3324
-	* @param String $groundspeed speed of flight
3325
-	* @param String $date date of flight
3326
-	* @param String $departure_airport_time departure time of flight
3327
-	* @param String $arrival_airport_time arrival time of flight
3328
-	* @param String $squawk squawk code of flight
3329
-	* @param String $route_stop route stop of flight
3330
-	* @param String $highlight highlight or not
3331
-	* @param String $ModeS ModesS code of flight
3332
-	* @param String $registration registration code of flight
3333
-	* @param String $pilot_id pilot id of flight (for virtual airlines)
3334
-	* @param String $pilot_name pilot name of flight (for virtual airlines)
3335
-	* @param String $verticalrate vertival rate of flight
3336
-	* @return String success or false
3337
-	*/
3312
+	 * Adds a new spotter data
3313
+	 *
3314
+	 * @param String $flightaware_id the ID from flightaware
3315
+	 * @param String $ident the flight ident
3316
+	 * @param String $aircraft_icao the aircraft type
3317
+	 * @param String $departure_airport_icao the departure airport
3318
+	 * @param String $arrival_airport_icao the arrival airport
3319
+	 * @param String $latitude latitude of flight
3320
+	 * @param String $longitude latitude of flight
3321
+	 * @param String $waypoints waypoints of flight
3322
+	 * @param String $altitude altitude of flight
3323
+	 * @param String $heading heading of flight
3324
+	 * @param String $groundspeed speed of flight
3325
+	 * @param String $date date of flight
3326
+	 * @param String $departure_airport_time departure time of flight
3327
+	 * @param String $arrival_airport_time arrival time of flight
3328
+	 * @param String $squawk squawk code of flight
3329
+	 * @param String $route_stop route stop of flight
3330
+	 * @param String $highlight highlight or not
3331
+	 * @param String $ModeS ModesS code of flight
3332
+	 * @param String $registration registration code of flight
3333
+	 * @param String $pilot_id pilot id of flight (for virtual airlines)
3334
+	 * @param String $pilot_name pilot name of flight (for virtual airlines)
3335
+	 * @param String $verticalrate vertival rate of flight
3336
+	 * @return String success or false
3337
+	 */
3338 3338
 	public function addSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $departure_airport_time = '', $arrival_airport_time = '',$squawk = '', $route_stop = '', $highlight = '', $ModeS = '', $registration = '',$pilot_id = '', $pilot_name = '', $verticalrate = '', $ground = false,$format_source = '', $source_name = '')
3339 3339
 	{
3340 3340
 		global $globalURL, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalDebugTimeElapsed, $globalAirlinesSource, $globalVAM;
@@ -3549,8 +3549,8 @@  discard block
 block discarded – undo
3549 3549
     
3550 3550
 		if ($globalIVAO && $aircraft_icao != '')
3551 3551
 		{
3552
-            		if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao'];
3553
-            		else $airline_icao = '';
3552
+					if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao'];
3553
+					else $airline_icao = '';
3554 3554
 			$image_array = $Image->getSpotterImage('',$aircraft_icao,$airline_icao);
3555 3555
 			if (!isset($image_array[0]['registration']))
3556 3556
 			{
@@ -3581,53 +3581,53 @@  discard block
 block discarded – undo
3581 3581
 	
3582 3582
 		if (count($airline_array) == 0) 
3583 3583
 		{
3584
-                        $airline_array = $this->getAllAirlineInfo('NA');
3585
-                }
3586
-                if (count($aircraft_array) == 0) 
3587
-                {
3588
-                        $aircraft_array = $this->getAllAircraftInfo('NA');
3589
-                }
3590
-                if (count($departure_airport_array) == 0 || $departure_airport_array[0]['icao'] == '' || $departure_airport_icao == '') 
3591
-                {
3592
-                        $departure_airport_array = $this->getAllAirportInfo('NA');
3593
-                }
3594
-                if (count($arrival_airport_array) == 0 || $arrival_airport_array[0]['icao'] == '' || $arrival_airport_icao == '') 
3595
-                {
3596
-                        $arrival_airport_array = $this->getAllAirportInfo('NA');
3597
-                }
3598
-                if ($registration == '') $registration = 'NA';
3599
-                if ($latitude == '' && $longitude == '') {
3600
-            		$latitude = 0;
3601
-            		$longitude = 0;
3602
-            	}
3603
-                if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL;
3604
-                if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL;
3605
-                if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
3606
-                if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
3607
-                if (!isset($aircraft_owner)) $aircraft_owner = NULL;
3608
-                $query  = "INSERT INTO spotter_output (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, latitude, longitude, waypoints, altitude, heading, ground_speed, date, departure_airport_time, arrival_airport_time, squawk, route_stop,highlight,ModeS, pilot_id, pilot_name, verticalrate, owner_name, ground, format_source, source_name) 
3584
+						$airline_array = $this->getAllAirlineInfo('NA');
3585
+				}
3586
+				if (count($aircraft_array) == 0) 
3587
+				{
3588
+						$aircraft_array = $this->getAllAircraftInfo('NA');
3589
+				}
3590
+				if (count($departure_airport_array) == 0 || $departure_airport_array[0]['icao'] == '' || $departure_airport_icao == '') 
3591
+				{
3592
+						$departure_airport_array = $this->getAllAirportInfo('NA');
3593
+				}
3594
+				if (count($arrival_airport_array) == 0 || $arrival_airport_array[0]['icao'] == '' || $arrival_airport_icao == '') 
3595
+				{
3596
+						$arrival_airport_array = $this->getAllAirportInfo('NA');
3597
+				}
3598
+				if ($registration == '') $registration = 'NA';
3599
+				if ($latitude == '' && $longitude == '') {
3600
+					$latitude = 0;
3601
+					$longitude = 0;
3602
+				}
3603
+				if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL;
3604
+				if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL;
3605
+				if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
3606
+				if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
3607
+				if (!isset($aircraft_owner)) $aircraft_owner = NULL;
3608
+				$query  = "INSERT INTO spotter_output (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, latitude, longitude, waypoints, altitude, heading, ground_speed, date, departure_airport_time, arrival_airport_time, squawk, route_stop,highlight,ModeS, pilot_id, pilot_name, verticalrate, owner_name, ground, format_source, source_name) 
3609 3609
                 VALUES (:flightaware_id,:ident,:registration,:airline_name,:airline_icao,:airline_country,:airline_type,:aircraft_icao,:aircraft_type,:aircraft_manufacturer,:departure_airport_icao,:departure_airport_name,:departure_airport_city,:departure_airport_country, :arrival_airport_icao, :arrival_airport_name, :arrival_airport_city, :arrival_airport_country, :latitude,:longitude,:waypoints,:altitude,:heading,:groundspeed,:date, :departure_airport_time, :arrival_airport_time, :squawk, :route_stop, :highlight, :ModeS, :pilot_id, :pilot_name, :verticalrate, :owner_name,:ground, :format_source, :source_name)";
3610 3610
 
3611
-                $airline_name = $airline_array[0]['name'];
3612
-                $airline_icao = $airline_array[0]['icao'];
3613
-                $airline_country = $airline_array[0]['country'];
3614
-                $airline_type = $airline_array[0]['type'];
3611
+				$airline_name = $airline_array[0]['name'];
3612
+				$airline_icao = $airline_array[0]['icao'];
3613
+				$airline_country = $airline_array[0]['country'];
3614
+				$airline_type = $airline_array[0]['type'];
3615 3615
 		if ($airline_type == '') {
3616 3616
 			$timeelapsed = microtime(true);
3617 3617
 			$airline_type = $this->getAircraftTypeBymodeS($ModeS);
3618 3618
 			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3619 3619
 		}
3620 3620
 		if ($airline_type == null) $airline_type = '';
3621
-                $aircraft_type = $aircraft_array[0]['type'];
3622
-                $aircraft_manufacturer = $aircraft_array[0]['manufacturer'];
3623
-                $departure_airport_name = $departure_airport_array[0]['name'];
3624
-	        $departure_airport_city = $departure_airport_array[0]['city'];
3625
-            	$departure_airport_country = $departure_airport_array[0]['country'];
3621
+				$aircraft_type = $aircraft_array[0]['type'];
3622
+				$aircraft_manufacturer = $aircraft_array[0]['manufacturer'];
3623
+				$departure_airport_name = $departure_airport_array[0]['name'];
3624
+			$departure_airport_city = $departure_airport_array[0]['city'];
3625
+				$departure_airport_country = $departure_airport_array[0]['country'];
3626 3626
                 
3627
-                $arrival_airport_name = $arrival_airport_array[0]['name'];
3628
-                $arrival_airport_city = $arrival_airport_array[0]['city'];
3629
-                $arrival_airport_country = $arrival_airport_array[0]['country'];
3630
-                $query_values = array(':flightaware_id' => $flightaware_id,':ident' => $ident, ':registration' => $registration,':airline_name' => $airline_name,':airline_icao' => $airline_icao,':airline_country' => $airline_country,':airline_type' => $airline_type,':aircraft_icao' => $aircraft_icao,':aircraft_type' => $aircraft_type,':aircraft_manufacturer' => $aircraft_manufacturer,':departure_airport_icao' => $departure_airport_icao,':departure_airport_name' => $departure_airport_name,':departure_airport_city' => $departure_airport_city,':departure_airport_country' => $departure_airport_country,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_name' => $arrival_airport_name,':arrival_airport_city' => $arrival_airport_city,':arrival_airport_country' => $arrival_airport_country,':latitude' => $latitude,':longitude' => $longitude, ':waypoints' => $waypoints,':altitude' => $altitude,':heading' => $heading,':groundspeed' => $groundspeed,':date' => $date,':departure_airport_time' => $departure_airport_time,':arrival_airport_time' => $arrival_airport_time, ':squawk' => $squawk, ':route_stop' => $route_stop, ':highlight' => $highlight, ':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':owner_name' => $aircraft_owner, ':format_source' => $format_source, ':ground' => $ground, ':source_name' => $source_name);
3627
+				$arrival_airport_name = $arrival_airport_array[0]['name'];
3628
+				$arrival_airport_city = $arrival_airport_array[0]['city'];
3629
+				$arrival_airport_country = $arrival_airport_array[0]['country'];
3630
+				$query_values = array(':flightaware_id' => $flightaware_id,':ident' => $ident, ':registration' => $registration,':airline_name' => $airline_name,':airline_icao' => $airline_icao,':airline_country' => $airline_country,':airline_type' => $airline_type,':aircraft_icao' => $aircraft_icao,':aircraft_type' => $aircraft_type,':aircraft_manufacturer' => $aircraft_manufacturer,':departure_airport_icao' => $departure_airport_icao,':departure_airport_name' => $departure_airport_name,':departure_airport_city' => $departure_airport_city,':departure_airport_country' => $departure_airport_country,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_name' => $arrival_airport_name,':arrival_airport_city' => $arrival_airport_city,':arrival_airport_country' => $arrival_airport_country,':latitude' => $latitude,':longitude' => $longitude, ':waypoints' => $waypoints,':altitude' => $altitude,':heading' => $heading,':groundspeed' => $groundspeed,':date' => $date,':departure_airport_time' => $departure_airport_time,':arrival_airport_time' => $arrival_airport_time, ':squawk' => $squawk, ':route_stop' => $route_stop, ':highlight' => $highlight, ':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':owner_name' => $aircraft_owner, ':format_source' => $format_source, ':ground' => $ground, ':source_name' => $source_name);
3631 3631
 
3632 3632
 		try {
3633 3633
 		        
@@ -3635,7 +3635,7 @@  discard block
 block discarded – undo
3635 3635
 			$sth->execute($query_values);
3636 3636
 			$this->db = null;
3637 3637
 		} catch (PDOException $e) {
3638
-		    return "error : ".$e->getMessage();
3638
+			return "error : ".$e->getMessage();
3639 3639
 		}
3640 3640
 		
3641 3641
 		return "success";
@@ -3644,11 +3644,11 @@  discard block
 block discarded – undo
3644 3644
 	
3645 3645
   
3646 3646
 	/**
3647
-	* Gets the aircraft ident within the last hour
3648
-	*
3649
-	* @return String the ident
3650
-	*
3651
-	*/
3647
+	 * Gets the aircraft ident within the last hour
3648
+	 *
3649
+	 * @return String the ident
3650
+	 *
3651
+	 */
3652 3652
 	public function getIdentFromLastHour($ident)
3653 3653
 	{
3654 3654
 		global $globalDBdriver, $globalTimezone;
@@ -3664,11 +3664,11 @@  discard block
 block discarded – undo
3664 3664
 								AND spotter_output.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS'
3665 3665
 								AND spotter_output.date < now() AT TIME ZONE 'UTC'";
3666 3666
 			$query_data = array(':ident' => $ident);
3667
-    		}
3667
+			}
3668 3668
 		
3669 3669
 		$sth = $this->db->prepare($query);
3670 3670
 		$sth->execute($query_data);
3671
-    		$ident_result='';
3671
+			$ident_result='';
3672 3672
 		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3673 3673
 		{
3674 3674
 			$ident_result = $row['ident'];
@@ -3679,11 +3679,11 @@  discard block
 block discarded – undo
3679 3679
 	
3680 3680
 	
3681 3681
 	/**
3682
-	* Gets the aircraft data from the last 20 seconds
3683
-	*
3684
-	* @return Array the spotter data
3685
-	*
3686
-	*/
3682
+	 * Gets the aircraft data from the last 20 seconds
3683
+	 *
3684
+	 * @return Array the spotter data
3685
+	 *
3686
+	 */
3687 3687
 	public function getRealTimeData($q = '')
3688 3688
 	{
3689 3689
 		global $globalDBdriver;
@@ -3727,11 +3727,11 @@  discard block
 block discarded – undo
3727 3727
 	
3728 3728
 	
3729 3729
 	 /**
3730
-	* Gets all airlines that have flown over
3731
-	*
3732
-	* @return Array the airline list
3733
-	*
3734
-	*/
3730
+	  * Gets all airlines that have flown over
3731
+	  *
3732
+	  * @return Array the airline list
3733
+	  *
3734
+	  */
3735 3735
 	public function countAllAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
3736 3736
 	{
3737 3737
 		global $globalDBdriver;
@@ -3745,7 +3745,7 @@  discard block
 block discarded – undo
3745 3745
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
3746 3746
 			}
3747 3747
 		}
3748
-                if ($sincedate != '') {
3748
+				if ($sincedate != '') {
3749 3749
 			if ($globalDBdriver == 'mysql') {
3750 3750
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
3751 3751
 			} else {
@@ -3772,26 +3772,26 @@  discard block
 block discarded – undo
3772 3772
 	}
3773 3773
 
3774 3774
 	 /**
3775
-	* Gets all pilots that have flown over
3776
-	*
3777
-	* @return Array the pilots list
3778
-	*
3779
-	*/
3775
+	  * Gets all pilots that have flown over
3776
+	  *
3777
+	  * @return Array the pilots list
3778
+	  *
3779
+	  */
3780 3780
 	public function countAllPilots($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
3781 3781
 	{
3782 3782
 		global $globalDBdriver;
3783 3783
 		$filter_query = $this->getFilter($filters,true,true);
3784 3784
 		$query  = "SELECT DISTINCT spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count, spotter_output.format_source
3785 3785
 		 			FROM spotter_output".$filter_query." spotter_output.pilot_id <> '' ";
3786
-                if ($olderthanmonths > 0) {
3787
-            		if ($globalDBdriver == 'mysql') {
3786
+				if ($olderthanmonths > 0) {
3787
+					if ($globalDBdriver == 'mysql') {
3788 3788
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
3789 3789
 			} else {
3790 3790
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
3791 3791
 			}
3792 3792
 		}
3793
-                if ($sincedate != '') {
3794
-            		if ($globalDBdriver == 'mysql') {
3793
+				if ($sincedate != '') {
3794
+					if ($globalDBdriver == 'mysql') {
3795 3795
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
3796 3796
 			} else {
3797 3797
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -3819,25 +3819,25 @@  discard block
 block discarded – undo
3819 3819
 	}
3820 3820
 	
3821 3821
 		 /**
3822
-	* Gets all pilots that have flown over
3823
-	*
3824
-	* @return Array the pilots list
3825
-	*
3826
-	*/
3822
+		  * Gets all pilots that have flown over
3823
+		  *
3824
+		  * @return Array the pilots list
3825
+		  *
3826
+		  */
3827 3827
 	public function countAllPilotsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '')
3828 3828
 	{
3829 3829
 		global $globalDBdriver;
3830 3830
 		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count, spotter_output.format_source
3831 3831
 		 			FROM spotter_output WHERE spotter_output.pilot_id <> '' ";
3832
-                if ($olderthanmonths > 0) {
3833
-            		if ($globalDBdriver == 'mysql') {
3832
+				if ($olderthanmonths > 0) {
3833
+					if ($globalDBdriver == 'mysql') {
3834 3834
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
3835 3835
 			} else {
3836 3836
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
3837 3837
 			}
3838 3838
 		}
3839
-                if ($sincedate != '') {
3840
-            		if ($globalDBdriver == 'mysql') {
3839
+				if ($sincedate != '') {
3840
+					if ($globalDBdriver == 'mysql') {
3841 3841
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
3842 3842
 			} else {
3843 3843
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -3866,26 +3866,26 @@  discard block
 block discarded – undo
3866 3866
 	}
3867 3867
 	
3868 3868
 	 /**
3869
-	* Gets all owner that have flown over
3870
-	*
3871
-	* @return Array the pilots list
3872
-	*
3873
-	*/
3869
+	  * Gets all owner that have flown over
3870
+	  *
3871
+	  * @return Array the pilots list
3872
+	  *
3873
+	  */
3874 3874
 	public function countAllOwners($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
3875 3875
 	{
3876 3876
 		global $globalDBdriver;
3877 3877
 		$filter_query = $this->getFilter($filters,true,true);
3878 3878
 		$query  = "SELECT DISTINCT spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
3879 3879
 		 			FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL ";
3880
-                if ($olderthanmonths > 0) {
3881
-            		if ($globalDBdriver == 'mysql') {
3880
+				if ($olderthanmonths > 0) {
3881
+					if ($globalDBdriver == 'mysql') {
3882 3882
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
3883 3883
 			} else {
3884 3884
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
3885 3885
 			}
3886 3886
 		}
3887
-                if ($sincedate != '') {
3888
-            		if ($globalDBdriver == 'mysql') {
3887
+				if ($sincedate != '') {
3888
+					if ($globalDBdriver == 'mysql') {
3889 3889
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
3890 3890
 			} else {
3891 3891
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -3911,26 +3911,26 @@  discard block
 block discarded – undo
3911 3911
 	}
3912 3912
 	
3913 3913
 	 /**
3914
-	* Gets all owner that have flown over
3915
-	*
3916
-	* @return Array the pilots list
3917
-	*
3918
-	*/
3914
+	  * Gets all owner that have flown over
3915
+	  *
3916
+	  * @return Array the pilots list
3917
+	  *
3918
+	  */
3919 3919
 	public function countAllOwnersByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
3920 3920
 	{
3921 3921
 		global $globalDBdriver;
3922 3922
 		$filter_query = $this->getFilter($filters,true,true);
3923 3923
 		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
3924 3924
 		 			FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL ";
3925
-                if ($olderthanmonths > 0) {
3926
-            		if ($globalDBdriver == 'mysql') {
3925
+				if ($olderthanmonths > 0) {
3926
+					if ($globalDBdriver == 'mysql') {
3927 3927
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
3928 3928
 			} else {
3929 3929
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
3930 3930
 			}
3931 3931
 		}
3932
-                if ($sincedate != '') {
3933
-            		if ($globalDBdriver == 'mysql') {
3932
+				if ($sincedate != '') {
3933
+					if ($globalDBdriver == 'mysql') {
3934 3934
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
3935 3935
 			} else {
3936 3936
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -3957,11 +3957,11 @@  discard block
 block discarded – undo
3957 3957
 	}
3958 3958
 
3959 3959
 	/**
3960
-	* Gets all airlines that have flown over by aircraft
3961
-	*
3962
-	* @return Array the airline list
3963
-	*
3964
-	*/
3960
+	 * Gets all airlines that have flown over by aircraft
3961
+	 *
3962
+	 * @return Array the airline list
3963
+	 *
3964
+	 */
3965 3965
 	public function countAllAirlinesByAircraft($aircraft_icao,$filters = array())
3966 3966
 	{
3967 3967
 		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
@@ -3993,11 +3993,11 @@  discard block
 block discarded – undo
3993 3993
 
3994 3994
 
3995 3995
 	/**
3996
-	* Gets all airline countries that have flown over by aircraft
3997
-	*
3998
-	* @return Array the airline country list
3999
-	*
4000
-	*/
3996
+	 * Gets all airline countries that have flown over by aircraft
3997
+	 *
3998
+	 * @return Array the airline country list
3999
+	 *
4000
+	 */
4001 4001
 	public function countAllAirlineCountriesByAircraft($aircraft_icao,$filters = array())
4002 4002
 	{
4003 4003
 		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
@@ -4029,11 +4029,11 @@  discard block
 block discarded – undo
4029 4029
 	
4030 4030
 	
4031 4031
 	/**
4032
-	* Gets all airlines that have flown over by airport
4033
-	*
4034
-	* @return Array the airline list
4035
-	*
4036
-	*/
4032
+	 * Gets all airlines that have flown over by airport
4033
+	 *
4034
+	 * @return Array the airline list
4035
+	 *
4036
+	 */
4037 4037
 	public function countAllAirlinesByAirport($airport_icao,$filters = array())
4038 4038
 	{
4039 4039
 		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
@@ -4064,11 +4064,11 @@  discard block
 block discarded – undo
4064 4064
 
4065 4065
 
4066 4066
 	/**
4067
-	* Gets all airline countries that have flown over by airport icao
4068
-	*
4069
-	* @return Array the airline country list
4070
-	*
4071
-	*/
4067
+	 * Gets all airline countries that have flown over by airport icao
4068
+	 *
4069
+	 * @return Array the airline country list
4070
+	 *
4071
+	 */
4072 4072
 	public function countAllAirlineCountriesByAirport($airport_icao,$filters = array())
4073 4073
 	{
4074 4074
 		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
@@ -4098,11 +4098,11 @@  discard block
 block discarded – undo
4098 4098
 
4099 4099
 
4100 4100
 	/**
4101
-	* Gets all airlines that have flown over by aircraft manufacturer
4102
-	*
4103
-	* @return Array the airline list
4104
-	*
4105
-	*/
4101
+	 * Gets all airlines that have flown over by aircraft manufacturer
4102
+	 *
4103
+	 * @return Array the airline list
4104
+	 *
4105
+	 */
4106 4106
 	public function countAllAirlinesByManufacturer($aircraft_manufacturer,$filters = array())
4107 4107
 	{
4108 4108
 		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
@@ -4133,11 +4133,11 @@  discard block
 block discarded – undo
4133 4133
 
4134 4134
 
4135 4135
 	/**
4136
-	* Gets all airline countries that have flown over by aircraft manufacturer
4137
-	*
4138
-	* @return Array the airline country list
4139
-	*
4140
-	*/
4136
+	 * Gets all airline countries that have flown over by aircraft manufacturer
4137
+	 *
4138
+	 * @return Array the airline country list
4139
+	 *
4140
+	 */
4141 4141
 	public function countAllAirlineCountriesByManufacturer($aircraft_manufacturer,$filters = array())
4142 4142
 	{
4143 4143
 		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
@@ -4166,11 +4166,11 @@  discard block
 block discarded – undo
4166 4166
 
4167 4167
 
4168 4168
 	/**
4169
-	* Gets all airlines that have flown over by date
4170
-	*
4171
-	* @return Array the airline list
4172
-	*
4173
-	*/
4169
+	 * Gets all airlines that have flown over by date
4170
+	 *
4171
+	 * @return Array the airline list
4172
+	 *
4173
+	 */
4174 4174
 	public function countAllAirlinesByDate($date,$filters = array())
4175 4175
 	{
4176 4176
 		global $globalTimezone, $globalDBdriver;
@@ -4214,11 +4214,11 @@  discard block
 block discarded – undo
4214 4214
 	
4215 4215
 	
4216 4216
 	/**
4217
-	* Gets all airline countries that have flown over by date
4218
-	*
4219
-	* @return Array the airline country list
4220
-	*
4221
-	*/
4217
+	 * Gets all airline countries that have flown over by date
4218
+	 *
4219
+	 * @return Array the airline country list
4220
+	 *
4221
+	 */
4222 4222
 	public function countAllAirlineCountriesByDate($date,$filters = array())
4223 4223
 	{
4224 4224
 		global $globalTimezone, $globalDBdriver;
@@ -4261,11 +4261,11 @@  discard block
 block discarded – undo
4261 4261
 
4262 4262
 
4263 4263
 	/**
4264
-	* Gets all airlines that have flown over by ident/callsign
4265
-	*
4266
-	* @return Array the airline list
4267
-	*
4268
-	*/
4264
+	 * Gets all airlines that have flown over by ident/callsign
4265
+	 *
4266
+	 * @return Array the airline list
4267
+	 *
4268
+	 */
4269 4269
 	public function countAllAirlinesByIdent($ident,$filters = array())
4270 4270
 	{
4271 4271
 		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
@@ -4295,11 +4295,11 @@  discard block
 block discarded – undo
4295 4295
 	}
4296 4296
 
4297 4297
 	/**
4298
-	* Gets all airlines that have flown over by route
4299
-	*
4300
-	* @return Array the airline list
4301
-	*
4302
-	*/
4298
+	 * Gets all airlines that have flown over by route
4299
+	 *
4300
+	 * @return Array the airline list
4301
+	 *
4302
+	 */
4303 4303
 	public function countAllAirlinesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
4304 4304
 	{
4305 4305
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4331,11 +4331,11 @@  discard block
 block discarded – undo
4331 4331
 	}
4332 4332
 
4333 4333
 	/**
4334
-	* Gets all airline countries that have flown over by route
4335
-	*
4336
-	* @return Array the airline country list
4337
-	*
4338
-	*/
4334
+	 * Gets all airline countries that have flown over by route
4335
+	 *
4336
+	 * @return Array the airline country list
4337
+	 *
4338
+	 */
4339 4339
 	public function countAllAirlineCountriesByRoute($departure_airport_icao, $arrival_airport_icao,$filters= array())
4340 4340
 	{
4341 4341
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4367,11 +4367,11 @@  discard block
 block discarded – undo
4367 4367
 
4368 4368
 
4369 4369
 	/**
4370
-	* Gets all airlines that have flown over by country
4371
-	*
4372
-	* @return Array the airline list
4373
-	*
4374
-	*/
4370
+	 * Gets all airlines that have flown over by country
4371
+	 *
4372
+	 * @return Array the airline list
4373
+	 *
4374
+	 */
4375 4375
 	public function countAllAirlinesByCountry($country,$filters = array())
4376 4376
 	{
4377 4377
 		$country = filter_var($country,FILTER_SANITIZE_STRING);
@@ -4401,11 +4401,11 @@  discard block
 block discarded – undo
4401 4401
 
4402 4402
 
4403 4403
 	/**
4404
-	* Gets all airline countries that have flown over by country
4405
-	*
4406
-	* @return Array the airline country list
4407
-	*
4408
-	*/
4404
+	 * Gets all airline countries that have flown over by country
4405
+	 *
4406
+	 * @return Array the airline country list
4407
+	 *
4408
+	 */
4409 4409
 	public function countAllAirlineCountriesByCountry($country,$filters = array())
4410 4410
 	{
4411 4411
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4434,11 +4434,11 @@  discard block
 block discarded – undo
4434 4434
 
4435 4435
 
4436 4436
 	/**
4437
-	* Gets all airlines countries
4438
-	*
4439
-	* @return Array the airline country list
4440
-	*
4441
-	*/
4437
+	 * Gets all airlines countries
4438
+	 *
4439
+	 * @return Array the airline country list
4440
+	 *
4441
+	 */
4442 4442
 	public function countAllAirlineCountries($limit = true, $filters = array())
4443 4443
 	{
4444 4444
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4464,11 +4464,11 @@  discard block
 block discarded – undo
4464 4464
 	}
4465 4465
 
4466 4466
 	/**
4467
-	* Gets all number of flight over countries
4468
-	*
4469
-	* @return Array the airline country list
4470
-	*
4471
-	*/
4467
+	 * Gets all number of flight over countries
4468
+	 *
4469
+	 * @return Array the airline country list
4470
+	 *
4471
+	 */
4472 4472
 	public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
4473 4473
 	{
4474 4474
 		global $globalDBdriver;
@@ -4490,15 +4490,15 @@  discard block
 block discarded – undo
4490 4490
 		$SpotterLive = new SpotterLive();
4491 4491
 		$filter_query = $SpotterLive->getFilter($filters,true,true);
4492 4492
 		$filter_query .= ' over_country IS NOT NULL';
4493
-                if ($olderthanmonths > 0) {
4493
+				if ($olderthanmonths > 0) {
4494 4494
 			if ($globalDBdriver == 'mysql') {
4495 4495
 				$filter_query .= ' AND spotter_live.date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
4496 4496
 			} else {
4497 4497
 				$filter_query .= " AND spotter_live.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
4498 4498
 			}
4499 4499
 		}
4500
-                if ($sincedate != '') {
4501
-            		if ($globalDBdriver == 'mysql') {
4500
+				if ($sincedate != '') {
4501
+					if ($globalDBdriver == 'mysql') {
4502 4502
 				$filter_query .= " AND spotter_live.date > '".$sincedate."' ";
4503 4503
 			} else {
4504 4504
 				$filter_query .= " AND spotter_live.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -4528,11 +4528,11 @@  discard block
 block discarded – undo
4528 4528
 	
4529 4529
 	
4530 4530
 	/**
4531
-	* Gets all aircraft types that have flown over
4532
-	*
4533
-	* @return Array the aircraft list
4534
-	*
4535
-	*/
4531
+	 * Gets all aircraft types that have flown over
4532
+	 *
4533
+	 * @return Array the aircraft list
4534
+	 *
4535
+	 */
4536 4536
 	public function countAllAircraftTypes($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
4537 4537
 	{
4538 4538
 		global $globalDBdriver;
@@ -4575,11 +4575,11 @@  discard block
 block discarded – undo
4575 4575
 	}
4576 4576
 
4577 4577
 	/**
4578
-	* Gets all aircraft types that have flown over by airline
4579
-	*
4580
-	* @return Array the aircraft list
4581
-	*
4582
-	*/
4578
+	 * Gets all aircraft types that have flown over by airline
4579
+	 *
4580
+	 * @return Array the aircraft list
4581
+	 *
4582
+	 */
4583 4583
 	public function countAllAircraftTypesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
4584 4584
 	{
4585 4585
 		global $globalDBdriver;
@@ -4622,11 +4622,11 @@  discard block
 block discarded – undo
4622 4622
 	}
4623 4623
 
4624 4624
 	/**
4625
-	* Gets all aircraft types that have flown over by months
4626
-	*
4627
-	* @return Array the aircraft list
4628
-	*
4629
-	*/
4625
+	 * Gets all aircraft types that have flown over by months
4626
+	 *
4627
+	 * @return Array the aircraft list
4628
+	 *
4629
+	 */
4630 4630
 	public function countAllAircraftTypesByMonths($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
4631 4631
 	{
4632 4632
 		global $globalDBdriver;
@@ -4670,11 +4670,11 @@  discard block
 block discarded – undo
4670 4670
 
4671 4671
 
4672 4672
 	/**
4673
-	* Gets all aircraft registration that have flown over by aircaft icao
4674
-	*
4675
-	* @return Array the aircraft list
4676
-	*
4677
-	*/
4673
+	 * Gets all aircraft registration that have flown over by aircaft icao
4674
+	 *
4675
+	 * @return Array the aircraft list
4676
+	 *
4677
+	 */
4678 4678
 	public function countAllAircraftRegistrationByAircraft($aircraft_icao,$filters = array())
4679 4679
 	{
4680 4680
 		$Image = new Image($this->db);
@@ -4713,11 +4713,11 @@  discard block
 block discarded – undo
4713 4713
 
4714 4714
 
4715 4715
 	/**
4716
-	* Gets all aircraft types that have flown over by airline icao
4717
-	*
4718
-	* @return Array the aircraft list
4719
-	*
4720
-	*/
4716
+	 * Gets all aircraft types that have flown over by airline icao
4717
+	 *
4718
+	 * @return Array the aircraft list
4719
+	 *
4720
+	 */
4721 4721
 	public function countAllAircraftTypesByAirline($airline_icao,$filters = array())
4722 4722
 	{
4723 4723
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4746,11 +4746,11 @@  discard block
 block discarded – undo
4746 4746
 
4747 4747
 
4748 4748
 	/**
4749
-	* Gets all aircraft registration that have flown over by airline icao
4750
-	*
4751
-	* @return Array the aircraft list
4752
-	*
4753
-	*/
4749
+	 * Gets all aircraft registration that have flown over by airline icao
4750
+	 *
4751
+	 * @return Array the aircraft list
4752
+	 *
4753
+	 */
4754 4754
 	public function countAllAircraftRegistrationByAirline($airline_icao,$filters = array())
4755 4755
 	{
4756 4756
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4788,11 +4788,11 @@  discard block
 block discarded – undo
4788 4788
 
4789 4789
 
4790 4790
 	/**
4791
-	* Gets all aircraft manufacturer that have flown over by airline icao
4792
-	*
4793
-	* @return Array the aircraft list
4794
-	*
4795
-	*/
4791
+	 * Gets all aircraft manufacturer that have flown over by airline icao
4792
+	 *
4793
+	 * @return Array the aircraft list
4794
+	 *
4795
+	 */
4796 4796
 	public function countAllAircraftManufacturerByAirline($airline_icao,$filters = array())
4797 4797
 	{
4798 4798
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4820,11 +4820,11 @@  discard block
 block discarded – undo
4820 4820
 
4821 4821
 
4822 4822
 	/**
4823
-	* Gets all aircraft types that have flown over by airline icao
4824
-	*
4825
-	* @return Array the aircraft list
4826
-	*
4827
-	*/
4823
+	 * Gets all aircraft types that have flown over by airline icao
4824
+	 *
4825
+	 * @return Array the aircraft list
4826
+	 *
4827
+	 */
4828 4828
 	public function countAllAircraftTypesByAirport($airport_icao,$filters = array())
4829 4829
 	{
4830 4830
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4853,11 +4853,11 @@  discard block
 block discarded – undo
4853 4853
 
4854 4854
 
4855 4855
 	/**
4856
-	* Gets all aircraft registration that have flown over by airport icao
4857
-	*
4858
-	* @return Array the aircraft list
4859
-	*
4860
-	*/
4856
+	 * Gets all aircraft registration that have flown over by airport icao
4857
+	 *
4858
+	 * @return Array the aircraft list
4859
+	 *
4860
+	 */
4861 4861
 	public function countAllAircraftRegistrationByAirport($airport_icao,$filters = array())
4862 4862
 	{
4863 4863
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4894,11 +4894,11 @@  discard block
 block discarded – undo
4894 4894
 	
4895 4895
 	
4896 4896
 	/**
4897
-	* Gets all aircraft manufacturer that have flown over by airport icao
4898
-	*
4899
-	* @return Array the aircraft list
4900
-	*
4901
-	*/
4897
+	 * Gets all aircraft manufacturer that have flown over by airport icao
4898
+	 *
4899
+	 * @return Array the aircraft list
4900
+	 *
4901
+	 */
4902 4902
 	public function countAllAircraftManufacturerByAirport($airport_icao,$filters = array())
4903 4903
 	{
4904 4904
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4924,11 +4924,11 @@  discard block
 block discarded – undo
4924 4924
 	}
4925 4925
 
4926 4926
 	/**
4927
-	* Gets all aircraft types that have flown over by aircraft manufacturer
4928
-	*
4929
-	* @return Array the aircraft list
4930
-	*
4931
-	*/
4927
+	 * Gets all aircraft types that have flown over by aircraft manufacturer
4928
+	 *
4929
+	 * @return Array the aircraft list
4930
+	 *
4931
+	 */
4932 4932
 	public function countAllAircraftTypesByManufacturer($aircraft_manufacturer,$filters = array())
4933 4933
 	{
4934 4934
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4955,11 +4955,11 @@  discard block
 block discarded – undo
4955 4955
 
4956 4956
 
4957 4957
 	/**
4958
-	* Gets all aircraft registration that have flown over by aircaft manufacturer
4959
-	*
4960
-	* @return Array the aircraft list
4961
-	*
4962
-	*/
4958
+	 * Gets all aircraft registration that have flown over by aircaft manufacturer
4959
+	 *
4960
+	 * @return Array the aircraft list
4961
+	 *
4962
+	 */
4963 4963
 	public function countAllAircraftRegistrationByManufacturer($aircraft_manufacturer, $filters = array())
4964 4964
 	{
4965 4965
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4995,11 +4995,11 @@  discard block
 block discarded – undo
4995 4995
 	}
4996 4996
 
4997 4997
 	/**
4998
-	* Gets all aircraft types that have flown over by date
4999
-	*
5000
-	* @return Array the aircraft list
5001
-	*
5002
-	*/
4998
+	 * Gets all aircraft types that have flown over by date
4999
+	 *
5000
+	 * @return Array the aircraft list
5001
+	 *
5002
+	 */
5003 5003
 	public function countAllAircraftTypesByDate($date,$filters = array())
5004 5004
 	{
5005 5005
 		global $globalTimezone, $globalDBdriver;
@@ -5041,11 +5041,11 @@  discard block
 block discarded – undo
5041 5041
 
5042 5042
 
5043 5043
 	/**
5044
-	* Gets all aircraft registration that have flown over by date
5045
-	*
5046
-	* @return Array the aircraft list
5047
-	*
5048
-	*/
5044
+	 * Gets all aircraft registration that have flown over by date
5045
+	 *
5046
+	 * @return Array the aircraft list
5047
+	 *
5048
+	 */
5049 5049
 	public function countAllAircraftRegistrationByDate($date,$filters = array())
5050 5050
 	{
5051 5051
 		global $globalTimezone, $globalDBdriver;
@@ -5096,11 +5096,11 @@  discard block
 block discarded – undo
5096 5096
 
5097 5097
 
5098 5098
 	/**
5099
-	* Gets all aircraft manufacturer that have flown over by date
5100
-	*
5101
-	* @return Array the aircraft manufacturer list
5102
-	*
5103
-	*/
5099
+	 * Gets all aircraft manufacturer that have flown over by date
5100
+	 *
5101
+	 * @return Array the aircraft manufacturer list
5102
+	 *
5103
+	 */
5104 5104
 	public function countAllAircraftManufacturerByDate($date,$filters = array())
5105 5105
 	{
5106 5106
 		global $globalTimezone, $globalDBdriver;
@@ -5142,11 +5142,11 @@  discard block
 block discarded – undo
5142 5142
 
5143 5143
 
5144 5144
 	/**
5145
-	* Gets all aircraft types that have flown over by ident/callsign
5146
-	*
5147
-	* @return Array the aircraft list
5148
-	*
5149
-	*/
5145
+	 * Gets all aircraft types that have flown over by ident/callsign
5146
+	 *
5147
+	 * @return Array the aircraft list
5148
+	 *
5149
+	 */
5150 5150
 	public function countAllAircraftTypesByIdent($ident,$filters = array())
5151 5151
 	{
5152 5152
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5175,11 +5175,11 @@  discard block
 block discarded – undo
5175 5175
 
5176 5176
 
5177 5177
 	/**
5178
-	* Gets all aircraft registration that have flown over by ident/callsign
5179
-	*
5180
-	* @return Array the aircraft list
5181
-	*
5182
-	*/
5178
+	 * Gets all aircraft registration that have flown over by ident/callsign
5179
+	 *
5180
+	 * @return Array the aircraft list
5181
+	 *
5182
+	 */
5183 5183
 	public function countAllAircraftRegistrationByIdent($ident,$filters = array())
5184 5184
 	{
5185 5185
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5219,11 +5219,11 @@  discard block
 block discarded – undo
5219 5219
 
5220 5220
 
5221 5221
 	/**
5222
-	* Gets all aircraft manufacturer that have flown over by ident/callsign
5223
-	*
5224
-	* @return Array the aircraft manufacturer list
5225
-	*
5226
-	*/
5222
+	 * Gets all aircraft manufacturer that have flown over by ident/callsign
5223
+	 *
5224
+	 * @return Array the aircraft manufacturer list
5225
+	 *
5226
+	 */
5227 5227
 	public function countAllAircraftManufacturerByIdent($ident,$filters = array())
5228 5228
 	{
5229 5229
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5249,11 +5249,11 @@  discard block
 block discarded – undo
5249 5249
 
5250 5250
 
5251 5251
 	/**
5252
-	* Gets all aircraft types that have flown over by route
5253
-	*
5254
-	* @return Array the aircraft list
5255
-	*
5256
-	*/
5252
+	 * Gets all aircraft types that have flown over by route
5253
+	 *
5254
+	 * @return Array the aircraft list
5255
+	 *
5256
+	 */
5257 5257
 	public function countAllAircraftTypesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
5258 5258
 	{
5259 5259
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5282,11 +5282,11 @@  discard block
 block discarded – undo
5282 5282
 	}
5283 5283
 
5284 5284
 	/**
5285
-	* Gets all aircraft registration that have flown over by route
5286
-	*
5287
-	* @return Array the aircraft list
5288
-	*
5289
-	*/
5285
+	 * Gets all aircraft registration that have flown over by route
5286
+	 *
5287
+	 * @return Array the aircraft list
5288
+	 *
5289
+	 */
5290 5290
 	public function countAllAircraftRegistrationByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
5291 5291
 	{
5292 5292
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5328,11 +5328,11 @@  discard block
 block discarded – undo
5328 5328
 	
5329 5329
 	
5330 5330
 	/**
5331
-	* Gets all aircraft manufacturer that have flown over by route
5332
-	*
5333
-	* @return Array the aircraft manufacturer list
5334
-	*
5335
-	*/
5331
+	 * Gets all aircraft manufacturer that have flown over by route
5332
+	 *
5333
+	 * @return Array the aircraft manufacturer list
5334
+	 *
5335
+	 */
5336 5336
 	public function countAllAircraftManufacturerByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
5337 5337
 	{
5338 5338
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5366,11 +5366,11 @@  discard block
 block discarded – undo
5366 5366
 	
5367 5367
 	
5368 5368
 	/**
5369
-	* Gets all aircraft types that have flown over by country
5370
-	*
5371
-	* @return Array the aircraft list
5372
-	*
5373
-	*/
5369
+	 * Gets all aircraft types that have flown over by country
5370
+	 *
5371
+	 * @return Array the aircraft list
5372
+	 *
5373
+	 */
5374 5374
 	public function countAllAircraftTypesByCountry($country,$filters = array())
5375 5375
 	{
5376 5376
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5401,11 +5401,11 @@  discard block
 block discarded – undo
5401 5401
 
5402 5402
 
5403 5403
 	/**
5404
-	* Gets all aircraft registration that have flown over by country
5405
-	*
5406
-	* @return Array the aircraft list
5407
-	*
5408
-	*/
5404
+	 * Gets all aircraft registration that have flown over by country
5405
+	 *
5406
+	 * @return Array the aircraft list
5407
+	 *
5408
+	 */
5409 5409
 	public function countAllAircraftRegistrationByCountry($country,$filters = array())
5410 5410
 	{
5411 5411
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5445,11 +5445,11 @@  discard block
 block discarded – undo
5445 5445
 	
5446 5446
 	
5447 5447
 	/**
5448
-	* Gets all aircraft manufacturer that have flown over by country
5449
-	*
5450
-	* @return Array the aircraft manufacturer list
5451
-	*
5452
-	*/
5448
+	 * Gets all aircraft manufacturer that have flown over by country
5449
+	 *
5450
+	 * @return Array the aircraft manufacturer list
5451
+	 *
5452
+	 */
5453 5453
 	public function countAllAircraftManufacturerByCountry($country,$filters = array())
5454 5454
 	{
5455 5455
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5480,17 +5480,17 @@  discard block
 block discarded – undo
5480 5480
 	
5481 5481
 	
5482 5482
 	/**
5483
-	* Gets all aircraft manufacturers that have flown over
5484
-	*
5485
-	* @return Array the aircraft list
5486
-	*
5487
-	*/
5483
+	 * Gets all aircraft manufacturers that have flown over
5484
+	 *
5485
+	 * @return Array the aircraft list
5486
+	 *
5487
+	 */
5488 5488
 	public function countAllAircraftManufacturers($filters = array())
5489 5489
 	{
5490 5490
 		$filter_query = $this->getFilter($filters,true,true);
5491 5491
 		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5492 5492
                     FROM spotter_output ".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.aircraft_manufacturer <> 'Not Available'";
5493
-                $query .= " GROUP BY spotter_output.aircraft_manufacturer
5493
+				$query .= " GROUP BY spotter_output.aircraft_manufacturer
5494 5494
 					ORDER BY aircraft_manufacturer_count DESC
5495 5495
 					LIMIT 10";
5496 5496
       
@@ -5515,11 +5515,11 @@  discard block
 block discarded – undo
5515 5515
 	
5516 5516
 	
5517 5517
 	/**
5518
-	* Gets all aircraft registrations that have flown over
5519
-	*
5520
-	* @return Array the aircraft list
5521
-	*
5522
-	*/
5518
+	 * Gets all aircraft registrations that have flown over
5519
+	 *
5520
+	 * @return Array the aircraft list
5521
+	 *
5522
+	 */
5523 5523
 	public function countAllAircraftRegistrations($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
5524 5524
 	{
5525 5525
 		global $globalDBdriver;
@@ -5527,15 +5527,15 @@  discard block
 block discarded – undo
5527 5527
 		$filter_query = $this->getFilter($filters,true,true);
5528 5528
 		$query  = "SELECT DISTINCT spotter_output.registration, COUNT(spotter_output.registration) AS aircraft_registration_count, spotter_output.aircraft_icao,  spotter_output.aircraft_name, spotter_output.airline_name    
5529 5529
                     FROM spotter_output ".$filter_query." spotter_output.registration <> '' AND spotter_output.registration <> 'NA'";
5530
-                if ($olderthanmonths > 0) {
5531
-            		if ($globalDBdriver == 'mysql') {
5530
+				if ($olderthanmonths > 0) {
5531
+					if ($globalDBdriver == 'mysql') {
5532 5532
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
5533 5533
 			} else {
5534 5534
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
5535 5535
 			}
5536 5536
 		}
5537
-                if ($sincedate != '') {
5538
-            		if ($globalDBdriver == 'mysql') {
5537
+				if ($sincedate != '') {
5538
+					if ($globalDBdriver == 'mysql') {
5539 5539
 				$query .= " AND spotter_output.date > '".$sincedate."'";
5540 5540
 			} else {
5541 5541
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -5544,7 +5544,7 @@  discard block
 block discarded – undo
5544 5544
 
5545 5545
 		// if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5546 5546
 		//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5547
-                $query .= " GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC";
5547
+				$query .= " GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC";
5548 5548
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5549 5549
 		
5550 5550
 		$sth = $this->db->prepare($query);
@@ -5575,11 +5575,11 @@  discard block
 block discarded – undo
5575 5575
 
5576 5576
 
5577 5577
 	/**
5578
-	* Gets all aircraft registrations that have flown over
5579
-	*
5580
-	* @return Array the aircraft list
5581
-	*
5582
-	*/
5578
+	 * Gets all aircraft registrations that have flown over
5579
+	 *
5580
+	 * @return Array the aircraft list
5581
+	 *
5582
+	 */
5583 5583
 	public function countAllAircraftRegistrationsByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
5584 5584
 	{
5585 5585
 		global $globalDBdriver;
@@ -5587,15 +5587,15 @@  discard block
 block discarded – undo
5587 5587
 		$Image = new Image($this->db);
5588 5588
 		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.registration, COUNT(spotter_output.registration) AS aircraft_registration_count, spotter_output.aircraft_icao,  spotter_output.aircraft_name, spotter_output.airline_name    
5589 5589
                     FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.registration <> '' AND spotter_output.registration <> 'NA' ";
5590
-                if ($olderthanmonths > 0) {
5591
-            		if ($globalDBdriver == 'mysql') {
5590
+				if ($olderthanmonths > 0) {
5591
+					if ($globalDBdriver == 'mysql') {
5592 5592
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
5593 5593
 			} else {
5594 5594
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
5595 5595
 			}
5596 5596
 		}
5597
-                if ($sincedate != '') {
5598
-            		if ($globalDBdriver == 'mysql') {
5597
+				if ($sincedate != '') {
5598
+					if ($globalDBdriver == 'mysql') {
5599 5599
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
5600 5600
 			} else {
5601 5601
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -5604,7 +5604,7 @@  discard block
 block discarded – undo
5604 5604
 
5605 5605
 		// if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5606 5606
 		//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5607
-                $query .= "GROUP BY spotter_output.airline_icao, spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC";
5607
+				$query .= "GROUP BY spotter_output.airline_icao, spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC";
5608 5608
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5609 5609
 		
5610 5610
 		$sth = $this->db->prepare($query);
@@ -5636,35 +5636,35 @@  discard block
 block discarded – undo
5636 5636
 	
5637 5637
 	
5638 5638
 	/**
5639
-	* Gets all departure airports of the airplanes that have flown over
5640
-	*
5641
-	* @return Array the airport list
5642
-	*
5643
-	*/
5639
+	 * Gets all departure airports of the airplanes that have flown over
5640
+	 *
5641
+	 * @return Array the airport list
5642
+	 *
5643
+	 */
5644 5644
 	public function countAllDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
5645 5645
 	{
5646 5646
 		global $globalDBdriver;
5647 5647
 		$filter_query = $this->getFilter($filters,true,true);
5648 5648
 		$query  = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
5649 5649
 				FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> ''";
5650
-                if ($olderthanmonths > 0) {
5651
-            		if ($globalDBdriver == 'mysql') {
5650
+				if ($olderthanmonths > 0) {
5651
+					if ($globalDBdriver == 'mysql') {
5652 5652
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
5653 5653
 			} else {
5654 5654
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
5655 5655
 			}
5656
-                }
5657
-                if ($sincedate != '') {
5658
-            		if ($globalDBdriver == 'mysql') {
5656
+				}
5657
+				if ($sincedate != '') {
5658
+					if ($globalDBdriver == 'mysql') {
5659 5659
 				$query .= " AND spotter_output.date > '".$sincedate."'";
5660 5660
 			} else {
5661 5661
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
5662 5662
 			}
5663 5663
 		}
5664 5664
 
5665
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5666
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5667
-                $query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
5665
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5666
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5667
+				$query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
5668 5668
 				ORDER BY airport_departure_icao_count DESC";
5669 5669
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5670 5670
       
@@ -5688,35 +5688,35 @@  discard block
 block discarded – undo
5688 5688
 	}
5689 5689
 
5690 5690
 	/**
5691
-	* Gets all departure airports of the airplanes that have flown over
5692
-	*
5693
-	* @return Array the airport list
5694
-	*
5695
-	*/
5691
+	 * Gets all departure airports of the airplanes that have flown over
5692
+	 *
5693
+	 * @return Array the airport list
5694
+	 *
5695
+	 */
5696 5696
 	public function countAllDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
5697 5697
 	{
5698 5698
 		global $globalDBdriver;
5699 5699
 		$filter_query = $this->getFilter($filters,true,true);
5700 5700
 		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
5701 5701
 			FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> '' ";
5702
-                if ($olderthanmonths > 0) {
5703
-            		if ($globalDBdriver == 'mysql') {
5702
+				if ($olderthanmonths > 0) {
5703
+					if ($globalDBdriver == 'mysql') {
5704 5704
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
5705 5705
 			} else {
5706 5706
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
5707 5707
 			}
5708
-                }
5709
-                if ($sincedate != '') {
5710
-            		if ($globalDBdriver == 'mysql') {
5708
+				}
5709
+				if ($sincedate != '') {
5710
+					if ($globalDBdriver == 'mysql') {
5711 5711
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
5712 5712
 			} else {
5713 5713
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
5714 5714
 			}
5715 5715
 		}
5716 5716
 
5717
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5718
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5719
-                $query .= "GROUP BY spotter_output.airline_icao, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
5717
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5718
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5719
+				$query .= "GROUP BY spotter_output.airline_icao, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
5720 5720
 				ORDER BY airport_departure_icao_count DESC";
5721 5721
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5722 5722
       
@@ -5741,37 +5741,37 @@  discard block
 block discarded – undo
5741 5741
 	}
5742 5742
 
5743 5743
 	/**
5744
-	* Gets all detected departure airports of the airplanes that have flown over
5745
-	*
5746
-	* @return Array the airport list
5747
-	*
5748
-	*/
5744
+	 * Gets all detected departure airports of the airplanes that have flown over
5745
+	 *
5746
+	 * @return Array the airport list
5747
+	 *
5748
+	 */
5749 5749
 	public function countAllDetectedDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
5750 5750
 	{
5751 5751
 		global $globalDBdriver;
5752 5752
 		$filter_query = $this->getFilter($filters,true,true);
5753 5753
 		$query  = "SELECT DISTINCT spotter_output.real_departure_airport_icao AS departure_airport_icao, COUNT(spotter_output.real_departure_airport_icao) AS airport_departure_icao_count, airport.name as departure_airport_name, airport.city as departure_airport_city, airport.country as departure_airport_country
5754 5754
 				FROM airport, spotter_output".$filter_query." spotter_output.real_departure_airport_icao <> '' AND spotter_output.real_departure_airport_icao <> 'NA' AND airport.icao = spotter_output.real_departure_airport_icao";
5755
-                if ($olderthanmonths > 0) {
5756
-            		if ($globalDBdriver == 'mysql') {
5755
+				if ($olderthanmonths > 0) {
5756
+					if ($globalDBdriver == 'mysql') {
5757 5757
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
5758 5758
 			} else {
5759 5759
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
5760 5760
 			}
5761
-                }
5762
-                if ($sincedate != '') {
5763
-            		if ($globalDBdriver == 'mysql') {
5761
+				}
5762
+				if ($sincedate != '') {
5763
+					if ($globalDBdriver == 'mysql') {
5764 5764
 				$query .= " AND spotter_output.date > '".$sincedate."'";
5765 5765
 			} else {
5766 5766
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
5767 5767
 			}
5768 5768
 		}
5769
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5770
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5771
-                $query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
5769
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5770
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5771
+				$query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
5772 5772
 				ORDER BY airport_departure_icao_count DESC";
5773 5773
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5774
-    		//echo $query;
5774
+			//echo $query;
5775 5775
 		$sth = $this->db->prepare($query);
5776 5776
 		$sth->execute();
5777 5777
       
@@ -5792,35 +5792,35 @@  discard block
 block discarded – undo
5792 5792
 	}
5793 5793
 	
5794 5794
 	/**
5795
-	* Gets all detected departure airports of the airplanes that have flown over
5796
-	*
5797
-	* @return Array the airport list
5798
-	*
5799
-	*/
5795
+	 * Gets all detected departure airports of the airplanes that have flown over
5796
+	 *
5797
+	 * @return Array the airport list
5798
+	 *
5799
+	 */
5800 5800
 	public function countAllDetectedDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
5801 5801
 	{
5802 5802
 		global $globalDBdriver;
5803 5803
 		$filter_query = $this->getFilter($filters,true,true);
5804 5804
 		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.real_departure_airport_icao AS departure_airport_icao, COUNT(spotter_output.real_departure_airport_icao) AS airport_departure_icao_count, airport.name as departure_airport_name, airport.city as departure_airport_city, airport.country as departure_airport_country
5805 5805
 				FROM airport, spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.real_departure_airport_icao <> '' AND spotter_output.real_departure_airport_icao <> 'NA' AND airport.icao = spotter_output.real_departure_airport_icao ";
5806
-                if ($olderthanmonths > 0) {
5807
-            		if ($globalDBdriver == 'mysql') {
5806
+				if ($olderthanmonths > 0) {
5807
+					if ($globalDBdriver == 'mysql') {
5808 5808
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
5809 5809
 			} else {
5810 5810
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
5811 5811
 			}
5812
-                }
5813
-                if ($sincedate != '') {
5814
-            		if ($globalDBdriver == 'mysql') {
5812
+				}
5813
+				if ($sincedate != '') {
5814
+					if ($globalDBdriver == 'mysql') {
5815 5815
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
5816 5816
 			} else {
5817 5817
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP) ";
5818 5818
 			}
5819 5819
 		}
5820 5820
 
5821
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5822
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5823
-                $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
5821
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5822
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5823
+				$query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
5824 5824
 				ORDER BY airport_departure_icao_count DESC";
5825 5825
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5826 5826
       
@@ -5845,11 +5845,11 @@  discard block
 block discarded – undo
5845 5845
 	}	
5846 5846
 	
5847 5847
 	/**
5848
-	* Gets all departure airports of the airplanes that have flown over based on an airline icao
5849
-	*
5850
-	* @return Array the airport list
5851
-	*
5852
-	*/
5848
+	 * Gets all departure airports of the airplanes that have flown over based on an airline icao
5849
+	 *
5850
+	 * @return Array the airport list
5851
+	 *
5852
+	 */
5853 5853
 	public function countAllDepartureAirportsByAirline($airline_icao,$filters = array())
5854 5854
 	{
5855 5855
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5883,11 +5883,11 @@  discard block
 block discarded – undo
5883 5883
 	
5884 5884
 	
5885 5885
 	/**
5886
-	* Gets all departure airports by country of the airplanes that have flown over based on an airline icao
5887
-	*
5888
-	* @return Array the airport list
5889
-	*
5890
-	*/
5886
+	 * Gets all departure airports by country of the airplanes that have flown over based on an airline icao
5887
+	 *
5888
+	 * @return Array the airport list
5889
+	 *
5890
+	 */
5891 5891
 	public function countAllDepartureAirportCountriesByAirline($airline_icao,$filters = array())
5892 5892
 	{
5893 5893
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5918,11 +5918,11 @@  discard block
 block discarded – undo
5918 5918
 	
5919 5919
 	
5920 5920
 	/**
5921
-	* Gets all departure airports of the airplanes that have flown over based on an aircraft icao
5922
-	*
5923
-	* @return Array the airport list
5924
-	*
5925
-	*/
5921
+	 * Gets all departure airports of the airplanes that have flown over based on an aircraft icao
5922
+	 *
5923
+	 * @return Array the airport list
5924
+	 *
5925
+	 */
5926 5926
 	public function countAllDepartureAirportsByAircraft($aircraft_icao,$filters = array())
5927 5927
 	{
5928 5928
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5955,11 +5955,11 @@  discard block
 block discarded – undo
5955 5955
 	
5956 5956
 	
5957 5957
 	/**
5958
-	* Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao
5959
-	*
5960
-	* @return Array the airport list
5961
-	*
5962
-	*/
5958
+	 * Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao
5959
+	 *
5960
+	 * @return Array the airport list
5961
+	 *
5962
+	 */
5963 5963
 	public function countAllDepartureAirportCountriesByAircraft($aircraft_icao,$filters = array())
5964 5964
 	{
5965 5965
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5989,11 +5989,11 @@  discard block
 block discarded – undo
5989 5989
 	
5990 5990
 	
5991 5991
 	/**
5992
-	* Gets all departure airports of the airplanes that have flown over based on an aircraft registration
5993
-	*
5994
-	* @return Array the airport list
5995
-	*
5996
-	*/
5992
+	 * Gets all departure airports of the airplanes that have flown over based on an aircraft registration
5993
+	 *
5994
+	 * @return Array the airport list
5995
+	 *
5996
+	 */
5997 5997
 	public function countAllDepartureAirportsByRegistration($registration,$filters = array())
5998 5998
 	{
5999 5999
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6026,11 +6026,11 @@  discard block
 block discarded – undo
6026 6026
 	
6027 6027
 	
6028 6028
 	/**
6029
-	* Gets all departure airports by country of the airplanes that have flown over based on an aircraft registration
6030
-	*
6031
-	* @return Array the airport list
6032
-	*
6033
-	*/
6029
+	 * Gets all departure airports by country of the airplanes that have flown over based on an aircraft registration
6030
+	 *
6031
+	 * @return Array the airport list
6032
+	 *
6033
+	 */
6034 6034
 	public function countAllDepartureAirportCountriesByRegistration($registration,$filters = array())
6035 6035
 	{
6036 6036
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6060,11 +6060,11 @@  discard block
 block discarded – undo
6060 6060
 	
6061 6061
 	
6062 6062
 	/**
6063
-	* Gets all departure airports of the airplanes that have flown over based on an arrivl airport icao
6064
-	*
6065
-	* @return Array the airport list
6066
-	*
6067
-	*/
6063
+	 * Gets all departure airports of the airplanes that have flown over based on an arrivl airport icao
6064
+	 *
6065
+	 * @return Array the airport list
6066
+	 *
6067
+	 */
6068 6068
 	public function countAllDepartureAirportsByAirport($airport_icao,$filters = array())
6069 6069
 	{
6070 6070
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6097,11 +6097,11 @@  discard block
 block discarded – undo
6097 6097
 	
6098 6098
 	
6099 6099
 	/**
6100
-	* Gets all departure airports by country of the airplanes that have flown over based on an airport icao
6101
-	*
6102
-	* @return Array the airport list
6103
-	*
6104
-	*/
6100
+	 * Gets all departure airports by country of the airplanes that have flown over based on an airport icao
6101
+	 *
6102
+	 * @return Array the airport list
6103
+	 *
6104
+	 */
6105 6105
 	public function countAllDepartureAirportCountriesByAirport($airport_icao,$filters = array())
6106 6106
 	{
6107 6107
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6132,11 +6132,11 @@  discard block
 block discarded – undo
6132 6132
 	
6133 6133
 	
6134 6134
 	/**
6135
-	* Gets all departure airports of the airplanes that have flown over based on an aircraft manufacturer
6136
-	*
6137
-	* @return Array the airport list
6138
-	*
6139
-	*/
6135
+	 * Gets all departure airports of the airplanes that have flown over based on an aircraft manufacturer
6136
+	 *
6137
+	 * @return Array the airport list
6138
+	 *
6139
+	 */
6140 6140
 	public function countAllDepartureAirportsByManufacturer($aircraft_manufacturer,$filters = array())
6141 6141
 	{
6142 6142
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6169,11 +6169,11 @@  discard block
 block discarded – undo
6169 6169
 	
6170 6170
 	
6171 6171
 	/**
6172
-	* Gets all departure airports by country of the airplanes that have flown over based on an aircraft manufacturer
6173
-	*
6174
-	* @return Array the airport list
6175
-	*
6176
-	*/
6172
+	 * Gets all departure airports by country of the airplanes that have flown over based on an aircraft manufacturer
6173
+	 *
6174
+	 * @return Array the airport list
6175
+	 *
6176
+	 */
6177 6177
 	public function countAllDepartureAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array())
6178 6178
 	{
6179 6179
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6203,11 +6203,11 @@  discard block
 block discarded – undo
6203 6203
 	
6204 6204
 	
6205 6205
 	/**
6206
-	* Gets all departure airports of the airplanes that have flown over based on a date
6207
-	*
6208
-	* @return Array the airport list
6209
-	*
6210
-	*/
6206
+	 * Gets all departure airports of the airplanes that have flown over based on a date
6207
+	 *
6208
+	 * @return Array the airport list
6209
+	 *
6210
+	 */
6211 6211
 	public function countAllDepartureAirportsByDate($date,$filters = array())
6212 6212
 	{
6213 6213
 		global $globalTimezone, $globalDBdriver;
@@ -6253,11 +6253,11 @@  discard block
 block discarded – undo
6253 6253
 	
6254 6254
 	
6255 6255
 	/**
6256
-	* Gets all departure airports by country of the airplanes that have flown over based on a date
6257
-	*
6258
-	* @return Array the airport list
6259
-	*
6260
-	*/
6256
+	 * Gets all departure airports by country of the airplanes that have flown over based on a date
6257
+	 *
6258
+	 * @return Array the airport list
6259
+	 *
6260
+	 */
6261 6261
 	public function countAllDepartureAirportCountriesByDate($date,$filters = array())
6262 6262
 	{
6263 6263
 		global $globalTimezone, $globalDBdriver;
@@ -6300,11 +6300,11 @@  discard block
 block discarded – undo
6300 6300
 	
6301 6301
 	
6302 6302
 	/**
6303
-	* Gets all departure airports of the airplanes that have flown over based on a ident/callsign
6304
-	*
6305
-	* @return Array the airport list
6306
-	*
6307
-	*/
6303
+	 * Gets all departure airports of the airplanes that have flown over based on a ident/callsign
6304
+	 *
6305
+	 * @return Array the airport list
6306
+	 *
6307
+	 */
6308 6308
 	public function countAllDepartureAirportsByIdent($ident,$filters = array())
6309 6309
 	{
6310 6310
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6338,11 +6338,11 @@  discard block
 block discarded – undo
6338 6338
 	
6339 6339
 	
6340 6340
 	/**
6341
-	* Gets all departure airports by country of the airplanes that have flown over based on a callsign/ident
6342
-	*
6343
-	* @return Array the airport list
6344
-	*
6345
-	*/
6341
+	 * Gets all departure airports by country of the airplanes that have flown over based on a callsign/ident
6342
+	 *
6343
+	 * @return Array the airport list
6344
+	 *
6345
+	 */
6346 6346
 	public function countAllDepartureAirportCountriesByIdent($ident,$filters = array())
6347 6347
 	{
6348 6348
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6373,11 +6373,11 @@  discard block
 block discarded – undo
6373 6373
 	
6374 6374
 	
6375 6375
 	/**
6376
-	* Gets all departure airports of the airplanes that have flown over based on a country
6377
-	*
6378
-	* @return Array the airport list
6379
-	*
6380
-	*/
6376
+	 * Gets all departure airports of the airplanes that have flown over based on a country
6377
+	 *
6378
+	 * @return Array the airport list
6379
+	 *
6380
+	 */
6381 6381
 	public function countAllDepartureAirportsByCountry($country,$filters = array())
6382 6382
 	{
6383 6383
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6411,11 +6411,11 @@  discard block
 block discarded – undo
6411 6411
 
6412 6412
 
6413 6413
 	/**
6414
-	* Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao
6415
-	*
6416
-	* @return Array the airport list
6417
-	*
6418
-	*/
6414
+	 * Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao
6415
+	 *
6416
+	 * @return Array the airport list
6417
+	 *
6418
+	 */
6419 6419
 	public function countAllDepartureAirportCountriesByCountry($country,$filters = array())
6420 6420
 	{
6421 6421
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6445,40 +6445,40 @@  discard block
 block discarded – undo
6445 6445
 	
6446 6446
 
6447 6447
 	/**
6448
-	* Gets all arrival airports of the airplanes that have flown over
6449
-	*
6450
-	* @param Boolean $limit Limit result to 10 or not
6451
-	* @param Integer $olderthanmonths Only show result older than x months
6452
-	* @param String $sincedate Only show result since x date
6453
-	* @param Boolean $icaoaskey Show result by ICAO
6454
-	* @param Array $filters Filter used here
6455
-	* @return Array the airport list
6456
-	*
6457
-	*/
6448
+	 * Gets all arrival airports of the airplanes that have flown over
6449
+	 *
6450
+	 * @param Boolean $limit Limit result to 10 or not
6451
+	 * @param Integer $olderthanmonths Only show result older than x months
6452
+	 * @param String $sincedate Only show result since x date
6453
+	 * @param Boolean $icaoaskey Show result by ICAO
6454
+	 * @param Array $filters Filter used here
6455
+	 * @return Array the airport list
6456
+	 *
6457
+	 */
6458 6458
 	public function countAllArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array())
6459 6459
 	{
6460 6460
 		global $globalDBdriver;
6461 6461
 		$filter_query = $this->getFilter($filters,true,true);
6462 6462
 		$query  = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
6463 6463
 				FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> ''";
6464
-                if ($olderthanmonths > 0) {
6465
-            		if ($globalDBdriver == 'mysql') {
6464
+				if ($olderthanmonths > 0) {
6465
+					if ($globalDBdriver == 'mysql') {
6466 6466
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
6467 6467
 			} else {
6468 6468
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
6469 6469
 			}
6470 6470
 		}
6471
-                if ($sincedate != '') {
6472
-            		if ($globalDBdriver == 'mysql') {
6471
+				if ($sincedate != '') {
6472
+					if ($globalDBdriver == 'mysql') {
6473 6473
 				$query .= " AND spotter_output.date > '".$sincedate."'";
6474 6474
 			} else {
6475 6475
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
6476 6476
 			}
6477 6477
 		}
6478 6478
 
6479
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6480
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6481
-                $query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
6479
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6480
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6481
+				$query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
6482 6482
 					ORDER BY airport_arrival_icao_count DESC";
6483 6483
 		if ($limit) $query .= " LIMIT 10";
6484 6484
       
@@ -6507,35 +6507,35 @@  discard block
 block discarded – undo
6507 6507
 	}
6508 6508
 
6509 6509
 	/**
6510
-	* Gets all arrival airports of the airplanes that have flown over
6511
-	*
6512
-	* @return Array the airport list
6513
-	*
6514
-	*/
6510
+	 * Gets all arrival airports of the airplanes that have flown over
6511
+	 *
6512
+	 * @return Array the airport list
6513
+	 *
6514
+	 */
6515 6515
 	public function countAllArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array())
6516 6516
 	{
6517 6517
 		global $globalDBdriver;
6518 6518
 		$filter_query = $this->getFilter($filters,true,true);
6519 6519
 		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
6520 6520
 			FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' ";
6521
-                if ($olderthanmonths > 0) {
6522
-            		if ($globalDBdriver == 'mysql') {
6521
+				if ($olderthanmonths > 0) {
6522
+					if ($globalDBdriver == 'mysql') {
6523 6523
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
6524 6524
 			} else {
6525 6525
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
6526 6526
 			}
6527 6527
 		}
6528
-                if ($sincedate != '') {
6529
-            		if ($globalDBdriver == 'mysql') {
6528
+				if ($sincedate != '') {
6529
+					if ($globalDBdriver == 'mysql') {
6530 6530
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
6531 6531
 			} else {
6532 6532
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
6533 6533
 			}
6534 6534
 		}
6535 6535
 
6536
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6537
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6538
-                $query .= "GROUP BY spotter_output.airline_icao,spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
6536
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6537
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6538
+				$query .= "GROUP BY spotter_output.airline_icao,spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
6539 6539
 					ORDER BY airport_arrival_icao_count DESC";
6540 6540
 		if ($limit) $query .= " LIMIT 10";
6541 6541
       
@@ -6566,34 +6566,34 @@  discard block
 block discarded – undo
6566 6566
 
6567 6567
 
6568 6568
 	/**
6569
-	* Gets all detected arrival airports of the airplanes that have flown over
6570
-	*
6571
-	* @return Array the airport list
6572
-	*
6573
-	*/
6569
+	 * Gets all detected arrival airports of the airplanes that have flown over
6570
+	 *
6571
+	 * @return Array the airport list
6572
+	 *
6573
+	 */
6574 6574
 	public function countAllDetectedArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array())
6575 6575
 	{
6576 6576
 		global $globalDBdriver;
6577 6577
 		$filter_query = $this->getFilter($filters,true,true);
6578 6578
 		$query  = "SELECT DISTINCT spotter_output.real_arrival_airport_icao as arrival_airport_icao, COUNT(spotter_output.real_arrival_airport_icao) AS airport_arrival_icao_count, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country 
6579 6579
 			FROM airport,spotter_output".$filter_query." spotter_output.real_arrival_airport_icao <> '' AND spotter_output.real_arrival_airport_icao <> 'NA' AND airport.icao = spotter_output.real_arrival_airport_icao";
6580
-                if ($olderthanmonths > 0) {
6581
-            		if ($globalDBdriver == 'mysql') {
6580
+				if ($olderthanmonths > 0) {
6581
+					if ($globalDBdriver == 'mysql') {
6582 6582
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
6583 6583
 			} else {
6584 6584
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
6585 6585
 			}
6586 6586
 		}
6587
-                if ($sincedate != '') {
6588
-            		if ($globalDBdriver == 'mysql') {
6587
+				if ($sincedate != '') {
6588
+					if ($globalDBdriver == 'mysql') {
6589 6589
 				$query .= " AND spotter_output.date > '".$sincedate."'";
6590 6590
 			} else {
6591 6591
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
6592 6592
 			}
6593 6593
 		}
6594
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6595
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6596
-                $query .= " GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
6594
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6595
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6596
+				$query .= " GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
6597 6597
 					ORDER BY airport_arrival_icao_count DESC";
6598 6598
 		if ($limit) $query .= " LIMIT 10";
6599 6599
       
@@ -6622,35 +6622,35 @@  discard block
 block discarded – undo
6622 6622
 	}
6623 6623
 	
6624 6624
 	/**
6625
-	* Gets all detected arrival airports of the airplanes that have flown over
6626
-	*
6627
-	* @return Array the airport list
6628
-	*
6629
-	*/
6625
+	 * Gets all detected arrival airports of the airplanes that have flown over
6626
+	 *
6627
+	 * @return Array the airport list
6628
+	 *
6629
+	 */
6630 6630
 	public function countAllDetectedArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array())
6631 6631
 	{
6632 6632
 		global $globalDBdriver;
6633 6633
 		$filter_query = $this->getFilter($filters,true,true);
6634 6634
 		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.real_arrival_airport_icao as arrival_airport_icao, COUNT(spotter_output.real_arrival_airport_icao) AS airport_arrival_icao_count, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country 
6635 6635
 			FROM airport,spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.real_arrival_airport_icao <> '' AND spotter_output.real_arrival_airport_icao <> 'NA' AND airport.icao = spotter_output.real_arrival_airport_icao ";
6636
-                if ($olderthanmonths > 0) {
6637
-            		if ($globalDBdriver == 'mysql') {
6636
+				if ($olderthanmonths > 0) {
6637
+					if ($globalDBdriver == 'mysql') {
6638 6638
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
6639 6639
 			} else {
6640 6640
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
6641 6641
 			}
6642 6642
 		}
6643
-                if ($sincedate != '') {
6644
-            		if ($globalDBdriver == 'mysql') {
6643
+				if ($sincedate != '') {
6644
+					if ($globalDBdriver == 'mysql') {
6645 6645
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
6646 6646
 			} else {
6647 6647
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
6648 6648
 			}
6649 6649
 		}
6650 6650
 
6651
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6652
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6653
-                $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
6651
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6652
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6653
+				$query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
6654 6654
 					ORDER BY airport_arrival_icao_count DESC";
6655 6655
 		if ($limit) $query .= " LIMIT 10";
6656 6656
       
@@ -6680,11 +6680,11 @@  discard block
 block discarded – undo
6680 6680
 	}	
6681 6681
 	
6682 6682
 	/**
6683
-	* Gets all arrival airports of the airplanes that have flown over based on an airline icao
6684
-	*
6685
-	* @return Array the airport list
6686
-	*
6687
-	*/
6683
+	 * Gets all arrival airports of the airplanes that have flown over based on an airline icao
6684
+	 *
6685
+	 * @return Array the airport list
6686
+	 *
6687
+	 */
6688 6688
 	public function countAllArrivalAirportsByAirline($airline_icao, $filters = array())
6689 6689
 	{
6690 6690
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6716,11 +6716,11 @@  discard block
 block discarded – undo
6716 6716
 	
6717 6717
 	
6718 6718
 	/**
6719
-	* Gets all arrival airports by country of the airplanes that have flown over based on an airline icao
6720
-	*
6721
-	* @return Array the airport list
6722
-	*
6723
-	*/
6719
+	 * Gets all arrival airports by country of the airplanes that have flown over based on an airline icao
6720
+	 *
6721
+	 * @return Array the airport list
6722
+	 *
6723
+	 */
6724 6724
 	public function countAllArrivalAirportCountriesByAirline($airline_icao,$filters = array())
6725 6725
 	{
6726 6726
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6751,11 +6751,11 @@  discard block
 block discarded – undo
6751 6751
 	
6752 6752
 	
6753 6753
 	/**
6754
-	* Gets all arrival airports of the airplanes that have flown over based on an aircraft icao
6755
-	*
6756
-	* @return Array the airport list
6757
-	*
6758
-	*/
6754
+	 * Gets all arrival airports of the airplanes that have flown over based on an aircraft icao
6755
+	 *
6756
+	 * @return Array the airport list
6757
+	 *
6758
+	 */
6759 6759
 	public function countAllArrivalAirportsByAircraft($aircraft_icao,$filters = array())
6760 6760
 	{
6761 6761
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6789,11 +6789,11 @@  discard block
 block discarded – undo
6789 6789
 	
6790 6790
 	
6791 6791
 	/**
6792
-	* Gets all arrival airports by country of the airplanes that have flown over based on an aircraft icao
6793
-	*
6794
-	* @return Array the airport list
6795
-	*
6796
-	*/
6792
+	 * Gets all arrival airports by country of the airplanes that have flown over based on an aircraft icao
6793
+	 *
6794
+	 * @return Array the airport list
6795
+	 *
6796
+	 */
6797 6797
 	public function countAllArrivalAirportCountriesByAircraft($aircraft_icao,$filters = array())
6798 6798
 	{
6799 6799
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6823,11 +6823,11 @@  discard block
 block discarded – undo
6823 6823
 	
6824 6824
 	
6825 6825
 	/**
6826
-	* Gets all arrival airports of the airplanes that have flown over based on an aircraft registration
6827
-	*
6828
-	* @return Array the airport list
6829
-	*
6830
-	*/
6826
+	 * Gets all arrival airports of the airplanes that have flown over based on an aircraft registration
6827
+	 *
6828
+	 * @return Array the airport list
6829
+	 *
6830
+	 */
6831 6831
 	public function countAllArrivalAirportsByRegistration($registration,$filters = array())
6832 6832
 	{
6833 6833
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6861,11 +6861,11 @@  discard block
 block discarded – undo
6861 6861
 	
6862 6862
 	
6863 6863
 	/**
6864
-	* Gets all arrival airports by country of the airplanes that have flown over based on an aircraft registration
6865
-	*
6866
-	* @return Array the airport list
6867
-	*
6868
-	*/
6864
+	 * Gets all arrival airports by country of the airplanes that have flown over based on an aircraft registration
6865
+	 *
6866
+	 * @return Array the airport list
6867
+	 *
6868
+	 */
6869 6869
 	public function countAllArrivalAirportCountriesByRegistration($registration,$filters = array())
6870 6870
 	{
6871 6871
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6896,11 +6896,11 @@  discard block
 block discarded – undo
6896 6896
 	
6897 6897
 	
6898 6898
 	/**
6899
-	* Gets all arrival airports of the airplanes that have flown over based on an departure airport
6900
-	*
6901
-	* @return Array the airport list
6902
-	*
6903
-	*/
6899
+	 * Gets all arrival airports of the airplanes that have flown over based on an departure airport
6900
+	 *
6901
+	 * @return Array the airport list
6902
+	 *
6903
+	 */
6904 6904
 	public function countAllArrivalAirportsByAirport($airport_icao,$filters = array())
6905 6905
 	{
6906 6906
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6933,11 +6933,11 @@  discard block
 block discarded – undo
6933 6933
 	
6934 6934
 	
6935 6935
 	/**
6936
-	* Gets all arrival airports by country of the airplanes that have flown over based on an airport icao
6937
-	*
6938
-	* @return Array the airport list
6939
-	*
6940
-	*/
6936
+	 * Gets all arrival airports by country of the airplanes that have flown over based on an airport icao
6937
+	 *
6938
+	 * @return Array the airport list
6939
+	 *
6940
+	 */
6941 6941
 	public function countAllArrivalAirportCountriesByAirport($airport_icao,$filters = array())
6942 6942
 	{
6943 6943
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6967,11 +6967,11 @@  discard block
 block discarded – undo
6967 6967
 	
6968 6968
 	
6969 6969
 	/**
6970
-	* Gets all arrival airports of the airplanes that have flown over based on a aircraft manufacturer
6971
-	*
6972
-	* @return Array the airport list
6973
-	*
6974
-	*/
6970
+	 * Gets all arrival airports of the airplanes that have flown over based on a aircraft manufacturer
6971
+	 *
6972
+	 * @return Array the airport list
6973
+	 *
6974
+	 */
6975 6975
 	public function countAllArrivalAirportsByManufacturer($aircraft_manufacturer,$filters = array())
6976 6976
 	{
6977 6977
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7005,11 +7005,11 @@  discard block
 block discarded – undo
7005 7005
 	
7006 7006
 	
7007 7007
 	/**
7008
-	* Gets all arrival airports by country of the airplanes that have flown over based on a aircraft manufacturer
7009
-	*
7010
-	* @return Array the airport list
7011
-	*
7012
-	*/
7008
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a aircraft manufacturer
7009
+	 *
7010
+	 * @return Array the airport list
7011
+	 *
7012
+	 */
7013 7013
 	public function countAllArrivalAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array())
7014 7014
 	{
7015 7015
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7040,11 +7040,11 @@  discard block
 block discarded – undo
7040 7040
 	
7041 7041
 	
7042 7042
 	/**
7043
-	* Gets all arrival airports of the airplanes that have flown over based on a date
7044
-	*
7045
-	* @return Array the airport list
7046
-	*
7047
-	*/
7043
+	 * Gets all arrival airports of the airplanes that have flown over based on a date
7044
+	 *
7045
+	 * @return Array the airport list
7046
+	 *
7047
+	 */
7048 7048
 	public function countAllArrivalAirportsByDate($date,$filters = array())
7049 7049
 	{
7050 7050
 		global $globalTimezone, $globalDBdriver;
@@ -7090,11 +7090,11 @@  discard block
 block discarded – undo
7090 7090
 	
7091 7091
 	
7092 7092
 	/**
7093
-	* Gets all arrival airports by country of the airplanes that have flown over based on a date
7094
-	*
7095
-	* @return Array the airport list
7096
-	*
7097
-	*/
7093
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a date
7094
+	 *
7095
+	 * @return Array the airport list
7096
+	 *
7097
+	 */
7098 7098
 	public function countAllArrivalAirportCountriesByDate($date, $filters = array())
7099 7099
 	{
7100 7100
 		global $globalTimezone, $globalDBdriver;
@@ -7137,11 +7137,11 @@  discard block
 block discarded – undo
7137 7137
 	
7138 7138
 	
7139 7139
 	/**
7140
-	* Gets all arrival airports of the airplanes that have flown over based on a ident/callsign
7141
-	*
7142
-	* @return Array the airport list
7143
-	*
7144
-	*/
7140
+	 * Gets all arrival airports of the airplanes that have flown over based on a ident/callsign
7141
+	 *
7142
+	 * @return Array the airport list
7143
+	 *
7144
+	 */
7145 7145
 	public function countAllArrivalAirportsByIdent($ident,$filters = array())
7146 7146
 	{
7147 7147
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7174,11 +7174,11 @@  discard block
 block discarded – undo
7174 7174
 	
7175 7175
 	
7176 7176
 	/**
7177
-	* Gets all arrival airports by country of the airplanes that have flown over based on a callsign/ident
7178
-	*
7179
-	* @return Array the airport list
7180
-	*
7181
-	*/
7177
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a callsign/ident
7178
+	 *
7179
+	 * @return Array the airport list
7180
+	 *
7181
+	 */
7182 7182
 	public function countAllArrivalAirportCountriesByIdent($ident, $filters = array())
7183 7183
 	{
7184 7184
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7209,11 +7209,11 @@  discard block
 block discarded – undo
7209 7209
 	
7210 7210
 	
7211 7211
 	/**
7212
-	* Gets all arrival airports of the airplanes that have flown over based on a country
7213
-	*
7214
-	* @return Array the airport list
7215
-	*
7216
-	*/
7212
+	 * Gets all arrival airports of the airplanes that have flown over based on a country
7213
+	 *
7214
+	 * @return Array the airport list
7215
+	 *
7216
+	 */
7217 7217
 	public function countAllArrivalAirportsByCountry($country,$filters = array())
7218 7218
 	{
7219 7219
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7246,11 +7246,11 @@  discard block
 block discarded – undo
7246 7246
 	
7247 7247
 	
7248 7248
 	/**
7249
-	* Gets all arrival airports by country of the airplanes that have flown over based on a country
7250
-	*
7251
-	* @return Array the airport list
7252
-	*
7253
-	*/
7249
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a country
7250
+	 *
7251
+	 * @return Array the airport list
7252
+	 *
7253
+	 */
7254 7254
 	public function countAllArrivalAirportCountriesByCountry($country,$filters = array())
7255 7255
 	{
7256 7256
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7281,11 +7281,11 @@  discard block
 block discarded – undo
7281 7281
 
7282 7282
 
7283 7283
 	/**
7284
-	* Counts all airport departure countries
7285
-	*
7286
-	* @return Array the airport departure list
7287
-	*
7288
-	*/
7284
+	 * Counts all airport departure countries
7285
+	 *
7286
+	 * @return Array the airport departure list
7287
+	 *
7288
+	 */
7289 7289
 	public function countAllDepartureCountries($filters = array())
7290 7290
 	{
7291 7291
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7315,11 +7315,11 @@  discard block
 block discarded – undo
7315 7315
 	
7316 7316
 	
7317 7317
 	/**
7318
-	* Counts all airport arrival countries
7319
-	*
7320
-	* @return Array the airport arrival list
7321
-	*
7322
-	*/
7318
+	 * Counts all airport arrival countries
7319
+	 *
7320
+	 * @return Array the airport arrival list
7321
+	 *
7322
+	 */
7323 7323
 	public function countAllArrivalCountries($limit = true,$filters = array())
7324 7324
 	{
7325 7325
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7352,11 +7352,11 @@  discard block
 block discarded – undo
7352 7352
 
7353 7353
 
7354 7354
 	/**
7355
-	* Gets all route combinations
7356
-	*
7357
-	* @return Array the route list
7358
-	*
7359
-	*/
7355
+	 * Gets all route combinations
7356
+	 *
7357
+	 * @return Array the route list
7358
+	 *
7359
+	 */
7360 7360
 	public function countAllRoutes($filters = array())
7361 7361
 	{
7362 7362
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7395,11 +7395,11 @@  discard block
 block discarded – undo
7395 7395
 	
7396 7396
 	
7397 7397
 	/**
7398
-	* Gets all route combinations based on an aircraft
7399
-	*
7400
-	* @return Array the route list
7401
-	*
7402
-	*/
7398
+	 * Gets all route combinations based on an aircraft
7399
+	 *
7400
+	 * @return Array the route list
7401
+	 *
7402
+	 */
7403 7403
 	public function countAllRoutesByAircraft($aircraft_icao,$filters = array())
7404 7404
 	{
7405 7405
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7435,11 +7435,11 @@  discard block
 block discarded – undo
7435 7435
 	
7436 7436
 	
7437 7437
 	/**
7438
-	* Gets all route combinations based on an aircraft registration
7439
-	*
7440
-	* @return Array the route list
7441
-	*
7442
-	*/
7438
+	 * Gets all route combinations based on an aircraft registration
7439
+	 *
7440
+	 * @return Array the route list
7441
+	 *
7442
+	 */
7443 7443
 	public function countAllRoutesByRegistration($registration, $filters = array())
7444 7444
 	{
7445 7445
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7477,11 +7477,11 @@  discard block
 block discarded – undo
7477 7477
 	
7478 7478
 	
7479 7479
 	/**
7480
-	* Gets all route combinations based on an airline
7481
-	*
7482
-	* @return Array the route list
7483
-	*
7484
-	*/
7480
+	 * Gets all route combinations based on an airline
7481
+	 *
7482
+	 * @return Array the route list
7483
+	 *
7484
+	 */
7485 7485
 	public function countAllRoutesByAirline($airline_icao, $filters = array())
7486 7486
 	{
7487 7487
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7519,11 +7519,11 @@  discard block
 block discarded – undo
7519 7519
 	
7520 7520
 	
7521 7521
 	/**
7522
-	* Gets all route combinations based on an airport
7523
-	*
7524
-	* @return Array the route list
7525
-	*
7526
-	*/
7522
+	 * Gets all route combinations based on an airport
7523
+	 *
7524
+	 * @return Array the route list
7525
+	 *
7526
+	 */
7527 7527
 	public function countAllRoutesByAirport($airport_icao, $filters = array())
7528 7528
 	{
7529 7529
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7560,11 +7560,11 @@  discard block
 block discarded – undo
7560 7560
 	
7561 7561
 	
7562 7562
 	/**
7563
-	* Gets all route combinations based on an country
7564
-	*
7565
-	* @return Array the route list
7566
-	*
7567
-	*/
7563
+	 * Gets all route combinations based on an country
7564
+	 *
7565
+	 * @return Array the route list
7566
+	 *
7567
+	 */
7568 7568
 	public function countAllRoutesByCountry($country, $filters = array())
7569 7569
 	{
7570 7570
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7600,11 +7600,11 @@  discard block
 block discarded – undo
7600 7600
 
7601 7601
 
7602 7602
 	/**
7603
-	* Gets all route combinations based on an date
7604
-	*
7605
-	* @return Array the route list
7606
-	*
7607
-	*/
7603
+	 * Gets all route combinations based on an date
7604
+	 *
7605
+	 * @return Array the route list
7606
+	 *
7607
+	 */
7608 7608
 	public function countAllRoutesByDate($date, $filters = array())
7609 7609
 	{
7610 7610
 		global $globalTimezone, $globalDBdriver;
@@ -7654,11 +7654,11 @@  discard block
 block discarded – undo
7654 7654
 	
7655 7655
 	
7656 7656
 	/**
7657
-	* Gets all route combinations based on an ident/callsign
7658
-	*
7659
-	* @return Array the route list
7660
-	*
7661
-	*/
7657
+	 * Gets all route combinations based on an ident/callsign
7658
+	 *
7659
+	 * @return Array the route list
7660
+	 *
7661
+	 */
7662 7662
 	public function countAllRoutesByIdent($ident, $filters = array())
7663 7663
 	{
7664 7664
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7695,11 +7695,11 @@  discard block
 block discarded – undo
7695 7695
 	
7696 7696
 	
7697 7697
 	/**
7698
-	* Gets all route combinations based on an manufacturer
7699
-	*
7700
-	* @return Array the route list
7701
-	*
7702
-	*/
7698
+	 * Gets all route combinations based on an manufacturer
7699
+	 *
7700
+	 * @return Array the route list
7701
+	 *
7702
+	 */
7703 7703
 	public function countAllRoutesByManufacturer($aircraft_manufacturer, $filters = array())
7704 7704
 	{
7705 7705
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7737,11 +7737,11 @@  discard block
 block discarded – undo
7737 7737
 	
7738 7738
 	
7739 7739
 	/**
7740
-	* Gets all route combinations with waypoints
7741
-	*
7742
-	* @return Array the route list
7743
-	*
7744
-	*/
7740
+	 * Gets all route combinations with waypoints
7741
+	 *
7742
+	 * @return Array the route list
7743
+	 *
7744
+	 */
7745 7745
 	public function countAllRoutesWithWaypoints($filters = array())
7746 7746
 	{
7747 7747
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7778,11 +7778,11 @@  discard block
 block discarded – undo
7778 7778
 	}
7779 7779
 	
7780 7780
 	/**
7781
-	* Gets all callsigns that have flown over
7782
-	*
7783
-	* @return Array the callsign list
7784
-	*
7785
-	*/
7781
+	 * Gets all callsigns that have flown over
7782
+	 *
7783
+	 * @return Array the callsign list
7784
+	 *
7785
+	 */
7786 7786
 	public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
7787 7787
 	{
7788 7788
 		global $globalDBdriver;
@@ -7820,11 +7820,11 @@  discard block
 block discarded – undo
7820 7820
 	}
7821 7821
 
7822 7822
 	/**
7823
-	* Gets all callsigns that have flown over
7824
-	*
7825
-	* @return Array the callsign list
7826
-	*
7827
-	*/
7823
+	 * Gets all callsigns that have flown over
7824
+	 *
7825
+	 * @return Array the callsign list
7826
+	 *
7827
+	 */
7828 7828
 	public function countAllCallsignsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
7829 7829
 	{
7830 7830
 		global $globalDBdriver;
@@ -7865,11 +7865,11 @@  discard block
 block discarded – undo
7865 7865
 
7866 7866
 
7867 7867
 	/**
7868
-	* Counts all dates
7869
-	*
7870
-	* @return Array the date list
7871
-	*
7872
-	*/
7868
+	 * Counts all dates
7869
+	 *
7870
+	 * @return Array the date list
7871
+	 *
7872
+	 */
7873 7873
 	public function countAllDates($filters = array())
7874 7874
 	{
7875 7875
 		global $globalTimezone, $globalDBdriver;
@@ -7914,11 +7914,11 @@  discard block
 block discarded – undo
7914 7914
 	}
7915 7915
 	
7916 7916
 	/**
7917
-	* Counts all dates
7918
-	*
7919
-	* @return Array the date list
7920
-	*
7921
-	*/
7917
+	 * Counts all dates
7918
+	 *
7919
+	 * @return Array the date list
7920
+	 *
7921
+	 */
7922 7922
 	public function countAllDatesByAirlines($filters = array())
7923 7923
 	{
7924 7924
 		global $globalTimezone, $globalDBdriver;
@@ -7963,11 +7963,11 @@  discard block
 block discarded – undo
7963 7963
 	}	
7964 7964
 	
7965 7965
 	/**
7966
-	* Counts all dates during the last 7 days
7967
-	*
7968
-	* @return Array the date list
7969
-	*
7970
-	*/
7966
+	 * Counts all dates during the last 7 days
7967
+	 *
7968
+	 * @return Array the date list
7969
+	 *
7970
+	 */
7971 7971
 	public function countAllDatesLast7Days($filters = array())
7972 7972
 	{
7973 7973
 		global $globalTimezone, $globalDBdriver;
@@ -7989,7 +7989,7 @@  discard block
 block discarded – undo
7989 7989
 			$query .= " GROUP BY date_name 
7990 7990
 								ORDER BY date_name ASC";
7991 7991
 			$query_data = array(':offset' => $offset);
7992
-    		}
7992
+			}
7993 7993
 		
7994 7994
 		$sth = $this->db->prepare($query);
7995 7995
 		$sth->execute($query_data);
@@ -8009,11 +8009,11 @@  discard block
 block discarded – undo
8009 8009
 	}
8010 8010
 
8011 8011
 	/**
8012
-	* Counts all dates during the last month
8013
-	*
8014
-	* @return Array the date list
8015
-	*
8016
-	*/
8012
+	 * Counts all dates during the last month
8013
+	 *
8014
+	 * @return Array the date list
8015
+	 *
8016
+	 */
8017 8017
 	public function countAllDatesLastMonth($filters = array())
8018 8018
 	{
8019 8019
 		global $globalTimezone, $globalDBdriver;
@@ -8035,7 +8035,7 @@  discard block
 block discarded – undo
8035 8035
 			$query .= " GROUP BY date_name 
8036 8036
 								ORDER BY date_name ASC";
8037 8037
 			$query_data = array(':offset' => $offset);
8038
-    		}
8038
+			}
8039 8039
 		
8040 8040
 		$sth = $this->db->prepare($query);
8041 8041
 		$sth->execute($query_data);
@@ -8056,11 +8056,11 @@  discard block
 block discarded – undo
8056 8056
 
8057 8057
 
8058 8058
 	/**
8059
-	* Counts all dates during the last month
8060
-	*
8061
-	* @return Array the date list
8062
-	*
8063
-	*/
8059
+	 * Counts all dates during the last month
8060
+	 *
8061
+	 * @return Array the date list
8062
+	 *
8063
+	 */
8064 8064
 	public function countAllDatesLastMonthByAirlines($filters = array())
8065 8065
 	{
8066 8066
 		global $globalTimezone, $globalDBdriver;
@@ -8083,7 +8083,7 @@  discard block
 block discarded – undo
8083 8083
 								GROUP BY spotter_output.airline_icao, date_name 
8084 8084
 								ORDER BY date_name ASC";
8085 8085
 			$query_data = array(':offset' => $offset);
8086
-    		}
8086
+			}
8087 8087
 		
8088 8088
 		$sth = $this->db->prepare($query);
8089 8089
 		$sth->execute($query_data);
@@ -8105,11 +8105,11 @@  discard block
 block discarded – undo
8105 8105
 	
8106 8106
 
8107 8107
 	/**
8108
-	* Counts all month
8109
-	*
8110
-	* @return Array the month list
8111
-	*
8112
-	*/
8108
+	 * Counts all month
8109
+	 *
8110
+	 * @return Array the month list
8111
+	 *
8112
+	 */
8113 8113
 	public function countAllMonths($filters = array())
8114 8114
 	{
8115 8115
 		global $globalTimezone, $globalDBdriver;
@@ -8151,11 +8151,11 @@  discard block
 block discarded – undo
8151 8151
 	}
8152 8152
 
8153 8153
 	/**
8154
-	* Counts all month
8155
-	*
8156
-	* @return Array the month list
8157
-	*
8158
-	*/
8154
+	 * Counts all month
8155
+	 *
8156
+	 * @return Array the month list
8157
+	 *
8158
+	 */
8159 8159
 	public function countAllMonthsByAirlines($filters = array())
8160 8160
 	{
8161 8161
 		global $globalTimezone, $globalDBdriver;
@@ -8200,11 +8200,11 @@  discard block
 block discarded – undo
8200 8200
 	}
8201 8201
 
8202 8202
 	/**
8203
-	* Counts all military month
8204
-	*
8205
-	* @return Array the month list
8206
-	*
8207
-	*/
8203
+	 * Counts all military month
8204
+	 *
8205
+	 * @return Array the month list
8206
+	 *
8207
+	 */
8208 8208
 	public function countAllMilitaryMonths($filters = array())
8209 8209
 	{
8210 8210
 		global $globalTimezone, $globalDBdriver;
@@ -8245,11 +8245,11 @@  discard block
 block discarded – undo
8245 8245
 	}
8246 8246
 	
8247 8247
 	/**
8248
-	* Counts all month owners
8249
-	*
8250
-	* @return Array the month list
8251
-	*
8252
-	*/
8248
+	 * Counts all month owners
8249
+	 *
8250
+	 * @return Array the month list
8251
+	 *
8252
+	 */
8253 8253
 	public function countAllMonthsOwners($filters = array())
8254 8254
 	{
8255 8255
 		global $globalTimezone, $globalDBdriver;
@@ -8291,11 +8291,11 @@  discard block
 block discarded – undo
8291 8291
 	}
8292 8292
 	
8293 8293
 	/**
8294
-	* Counts all month owners
8295
-	*
8296
-	* @return Array the month list
8297
-	*
8298
-	*/
8294
+	 * Counts all month owners
8295
+	 *
8296
+	 * @return Array the month list
8297
+	 *
8298
+	 */
8299 8299
 	public function countAllMonthsOwnersByAirlines($filters = array())
8300 8300
 	{
8301 8301
 		global $globalTimezone, $globalDBdriver;
@@ -8338,11 +8338,11 @@  discard block
 block discarded – undo
8338 8338
 	}
8339 8339
 
8340 8340
 	/**
8341
-	* Counts all month pilot
8342
-	*
8343
-	* @return Array the month list
8344
-	*
8345
-	*/
8341
+	 * Counts all month pilot
8342
+	 *
8343
+	 * @return Array the month list
8344
+	 *
8345
+	 */
8346 8346
 	public function countAllMonthsPilots($filters = array())
8347 8347
 	{
8348 8348
 		global $globalTimezone, $globalDBdriver;
@@ -8384,11 +8384,11 @@  discard block
 block discarded – undo
8384 8384
 	}
8385 8385
 	
8386 8386
 	/**
8387
-	* Counts all month pilot
8388
-	*
8389
-	* @return Array the month list
8390
-	*
8391
-	*/
8387
+	 * Counts all month pilot
8388
+	 *
8389
+	 * @return Array the month list
8390
+	 *
8391
+	 */
8392 8392
 	public function countAllMonthsPilotsByAirlines($filters = array())
8393 8393
 	{
8394 8394
 		global $globalTimezone, $globalDBdriver;
@@ -8431,11 +8431,11 @@  discard block
 block discarded – undo
8431 8431
 	}
8432 8432
 
8433 8433
 	/**
8434
-	* Counts all month airline
8435
-	*
8436
-	* @return Array the month list
8437
-	*
8438
-	*/
8434
+	 * Counts all month airline
8435
+	 *
8436
+	 * @return Array the month list
8437
+	 *
8438
+	 */
8439 8439
 	public function countAllMonthsAirlines($filters = array())
8440 8440
 	{
8441 8441
 		global $globalTimezone, $globalDBdriver;
@@ -8477,11 +8477,11 @@  discard block
 block discarded – undo
8477 8477
 	}
8478 8478
 	
8479 8479
 	/**
8480
-	* Counts all month aircraft
8481
-	*
8482
-	* @return Array the month list
8483
-	*
8484
-	*/
8480
+	 * Counts all month aircraft
8481
+	 *
8482
+	 * @return Array the month list
8483
+	 *
8484
+	 */
8485 8485
 	public function countAllMonthsAircrafts($filters = array())
8486 8486
 	{
8487 8487
 		global $globalTimezone, $globalDBdriver;
@@ -8524,11 +8524,11 @@  discard block
 block discarded – undo
8524 8524
 	
8525 8525
 
8526 8526
 	/**
8527
-	* Counts all month aircraft
8528
-	*
8529
-	* @return Array the month list
8530
-	*
8531
-	*/
8527
+	 * Counts all month aircraft
8528
+	 *
8529
+	 * @return Array the month list
8530
+	 *
8531
+	 */
8532 8532
 	public function countAllMonthsAircraftsByAirlines($filters = array())
8533 8533
 	{
8534 8534
 		global $globalTimezone, $globalDBdriver;
@@ -8571,11 +8571,11 @@  discard block
 block discarded – undo
8571 8571
 	}
8572 8572
 
8573 8573
 	/**
8574
-	* Counts all month real arrival
8575
-	*
8576
-	* @return Array the month list
8577
-	*
8578
-	*/
8574
+	 * Counts all month real arrival
8575
+	 *
8576
+	 * @return Array the month list
8577
+	 *
8578
+	 */
8579 8579
 	public function countAllMonthsRealArrivals($filters = array())
8580 8580
 	{
8581 8581
 		global $globalTimezone, $globalDBdriver;
@@ -8618,11 +8618,11 @@  discard block
 block discarded – undo
8618 8618
 	
8619 8619
 
8620 8620
 	/**
8621
-	* Counts all month real arrival
8622
-	*
8623
-	* @return Array the month list
8624
-	*
8625
-	*/
8621
+	 * Counts all month real arrival
8622
+	 *
8623
+	 * @return Array the month list
8624
+	 *
8625
+	 */
8626 8626
 	public function countAllMonthsRealArrivalsByAirlines($filters = array())
8627 8627
 	{
8628 8628
 		global $globalTimezone, $globalDBdriver;
@@ -8666,11 +8666,11 @@  discard block
 block discarded – undo
8666 8666
 	
8667 8667
 
8668 8668
 	/**
8669
-	* Counts all dates during the last year
8670
-	*
8671
-	* @return Array the date list
8672
-	*
8673
-	*/
8669
+	 * Counts all dates during the last year
8670
+	 *
8671
+	 * @return Array the date list
8672
+	 *
8673
+	 */
8674 8674
 	public function countAllMonthsLastYear($filters)
8675 8675
 	{
8676 8676
 		global $globalTimezone, $globalDBdriver;
@@ -8692,7 +8692,7 @@  discard block
 block discarded – undo
8692 8692
 			$query .= " GROUP BY year_name, month_name
8693 8693
 								ORDER BY year_name, month_name ASC";
8694 8694
 			$query_data = array(':offset' => $offset);
8695
-    		}
8695
+			}
8696 8696
 		
8697 8697
 		$sth = $this->db->prepare($query);
8698 8698
 		$sth->execute($query_data);
@@ -8715,11 +8715,11 @@  discard block
 block discarded – undo
8715 8715
 	
8716 8716
 	
8717 8717
 	/**
8718
-	* Counts all hours
8719
-	*
8720
-	* @return Array the hour list
8721
-	*
8722
-	*/
8718
+	 * Counts all hours
8719
+	 *
8720
+	 * @return Array the hour list
8721
+	 *
8722
+	 */
8723 8723
 	public function countAllHours($orderby,$filters = array())
8724 8724
 	{
8725 8725
 		global $globalTimezone, $globalDBdriver;
@@ -8780,11 +8780,11 @@  discard block
 block discarded – undo
8780 8780
 	}
8781 8781
 	
8782 8782
 	/**
8783
-	* Counts all hours
8784
-	*
8785
-	* @return Array the hour list
8786
-	*
8787
-	*/
8783
+	 * Counts all hours
8784
+	 *
8785
+	 * @return Array the hour list
8786
+	 *
8787
+	 */
8788 8788
 	public function countAllHoursByAirlines($orderby, $filters = array())
8789 8789
 	{
8790 8790
 		global $globalTimezone, $globalDBdriver;
@@ -8847,11 +8847,11 @@  discard block
 block discarded – undo
8847 8847
 
8848 8848
 
8849 8849
 	/**
8850
-	* Counts all hours by airline
8851
-	*
8852
-	* @return Array the hour list
8853
-	*
8854
-	*/
8850
+	 * Counts all hours by airline
8851
+	 *
8852
+	 * @return Array the hour list
8853
+	 *
8854
+	 */
8855 8855
 	public function countAllHoursByAirline($airline_icao, $filters = array())
8856 8856
 	{
8857 8857
 		global $globalTimezone, $globalDBdriver;
@@ -8897,11 +8897,11 @@  discard block
 block discarded – undo
8897 8897
 	
8898 8898
 	
8899 8899
 	/**
8900
-	* Counts all hours by aircraft
8901
-	*
8902
-	* @return Array the hour list
8903
-	*
8904
-	*/
8900
+	 * Counts all hours by aircraft
8901
+	 *
8902
+	 * @return Array the hour list
8903
+	 *
8904
+	 */
8905 8905
 	public function countAllHoursByAircraft($aircraft_icao, $filters = array())
8906 8906
 	{
8907 8907
 		global $globalTimezone, $globalDBdriver;
@@ -8944,11 +8944,11 @@  discard block
 block discarded – undo
8944 8944
 	
8945 8945
 	
8946 8946
 	/**
8947
-	* Counts all hours by aircraft registration
8948
-	*
8949
-	* @return Array the hour list
8950
-	*
8951
-	*/
8947
+	 * Counts all hours by aircraft registration
8948
+	 *
8949
+	 * @return Array the hour list
8950
+	 *
8951
+	 */
8952 8952
 	public function countAllHoursByRegistration($registration, $filters = array())
8953 8953
 	{
8954 8954
 		global $globalTimezone, $globalDBdriver;
@@ -8991,11 +8991,11 @@  discard block
 block discarded – undo
8991 8991
 	
8992 8992
 	
8993 8993
 	/**
8994
-	* Counts all hours by airport
8995
-	*
8996
-	* @return Array the hour list
8997
-	*
8998
-	*/
8994
+	 * Counts all hours by airport
8995
+	 *
8996
+	 * @return Array the hour list
8997
+	 *
8998
+	 */
8999 8999
 	public function countAllHoursByAirport($airport_icao, $filters = array())
9000 9000
 	{
9001 9001
 		global $globalTimezone, $globalDBdriver;
@@ -9039,11 +9039,11 @@  discard block
 block discarded – undo
9039 9039
 	
9040 9040
 	
9041 9041
 	/**
9042
-	* Counts all hours by manufacturer
9043
-	*
9044
-	* @return Array the hour list
9045
-	*
9046
-	*/
9042
+	 * Counts all hours by manufacturer
9043
+	 *
9044
+	 * @return Array the hour list
9045
+	 *
9046
+	 */
9047 9047
 	public function countAllHoursByManufacturer($aircraft_manufacturer,$filters =array())
9048 9048
 	{
9049 9049
 		global $globalTimezone, $globalDBdriver;
@@ -9087,11 +9087,11 @@  discard block
 block discarded – undo
9087 9087
 	
9088 9088
 	
9089 9089
 	/**
9090
-	* Counts all hours by date
9091
-	*
9092
-	* @return Array the hour list
9093
-	*
9094
-	*/
9090
+	 * Counts all hours by date
9091
+	 *
9092
+	 * @return Array the hour list
9093
+	 *
9094
+	 */
9095 9095
 	public function countAllHoursByDate($date, $filters = array())
9096 9096
 	{
9097 9097
 		global $globalTimezone, $globalDBdriver;
@@ -9135,11 +9135,11 @@  discard block
 block discarded – undo
9135 9135
 	
9136 9136
 	
9137 9137
 	/**
9138
-	* Counts all hours by a ident/callsign
9139
-	*
9140
-	* @return Array the hour list
9141
-	*
9142
-	*/
9138
+	 * Counts all hours by a ident/callsign
9139
+	 *
9140
+	 * @return Array the hour list
9141
+	 *
9142
+	 */
9143 9143
 	public function countAllHoursByIdent($ident, $filters = array())
9144 9144
 	{
9145 9145
 		global $globalTimezone, $globalDBdriver;
@@ -9184,11 +9184,11 @@  discard block
 block discarded – undo
9184 9184
 	
9185 9185
 	
9186 9186
 	/**
9187
-	* Counts all hours by route
9188
-	*
9189
-	* @return Array the hour list
9190
-	*
9191
-	*/
9187
+	 * Counts all hours by route
9188
+	 *
9189
+	 * @return Array the hour list
9190
+	 *
9191
+	 */
9192 9192
 	public function countAllHoursByRoute($departure_airport_icao, $arrival_airport_icao, $filters =array())
9193 9193
 	{
9194 9194
 		global $globalTimezone, $globalDBdriver;
@@ -9232,11 +9232,11 @@  discard block
 block discarded – undo
9232 9232
 	
9233 9233
 	
9234 9234
 	/**
9235
-	* Counts all hours by country
9236
-	*
9237
-	* @return Array the hour list
9238
-	*
9239
-	*/
9235
+	 * Counts all hours by country
9236
+	 *
9237
+	 * @return Array the hour list
9238
+	 *
9239
+	 */
9240 9240
 	public function countAllHoursByCountry($country, $filters = array())
9241 9241
 	{
9242 9242
 		global $globalTimezone, $globalDBdriver;
@@ -9281,11 +9281,11 @@  discard block
 block discarded – undo
9281 9281
 
9282 9282
 
9283 9283
 	/**
9284
-	* Counts all aircraft that have flown over
9285
-	*
9286
-	* @return Integer the number of aircrafts
9287
-	*
9288
-	*/
9284
+	 * Counts all aircraft that have flown over
9285
+	 *
9286
+	 * @return Integer the number of aircrafts
9287
+	 *
9288
+	 */
9289 9289
 	public function countOverallAircrafts($filters = array())
9290 9290
 	{
9291 9291
 		$filter_query = $this->getFilter($filters,true,true);
@@ -9297,11 +9297,11 @@  discard block
 block discarded – undo
9297 9297
 	}
9298 9298
 
9299 9299
 	/**
9300
-	* Counts all flight that really arrival
9301
-	*
9302
-	* @return Integer the number of aircrafts
9303
-	*
9304
-	*/
9300
+	 * Counts all flight that really arrival
9301
+	 *
9302
+	 * @return Integer the number of aircrafts
9303
+	 *
9304
+	 */
9305 9305
 	public function countOverallArrival($filters = array())
9306 9306
 	{
9307 9307
 		$filter_query = $this->getFilter($filters,true,true);
@@ -9314,11 +9314,11 @@  discard block
 block discarded – undo
9314 9314
 	}
9315 9315
 
9316 9316
 	/**
9317
-	* Counts all pilots that have flown over
9318
-	*
9319
-	* @return Integer the number of pilots
9320
-	*
9321
-	*/
9317
+	 * Counts all pilots that have flown over
9318
+	 *
9319
+	 * @return Integer the number of pilots
9320
+	 *
9321
+	 */
9322 9322
 	public function countOverallPilots($filters = array())
9323 9323
 	{
9324 9324
 		$filter_query = $this->getFilter($filters,true,true);
@@ -9330,11 +9330,11 @@  discard block
 block discarded – undo
9330 9330
 	}
9331 9331
 
9332 9332
 	/**
9333
-	* Counts all owners that have flown over
9334
-	*
9335
-	* @return Integer the number of owners
9336
-	*
9337
-	*/
9333
+	 * Counts all owners that have flown over
9334
+	 *
9335
+	 * @return Integer the number of owners
9336
+	 *
9337
+	 */
9338 9338
 	public function countOverallOwners($filters = array())
9339 9339
 	{
9340 9340
 		$filter_query = $this->getFilter($filters,true,true);
@@ -9347,11 +9347,11 @@  discard block
 block discarded – undo
9347 9347
 	
9348 9348
 	
9349 9349
 	/**
9350
-	* Counts all flights that have flown over
9351
-	*
9352
-	* @return Integer the number of flights
9353
-	*
9354
-	*/
9350
+	 * Counts all flights that have flown over
9351
+	 *
9352
+	 * @return Integer the number of flights
9353
+	 *
9354
+	 */
9355 9355
 	public function countOverallFlights($filters = array())
9356 9356
 	{
9357 9357
 		$query  = "SELECT COUNT(spotter_output.spotter_id) AS flight_count  
@@ -9364,11 +9364,11 @@  discard block
 block discarded – undo
9364 9364
 	}
9365 9365
 	
9366 9366
 	/**
9367
-	* Counts all military flights that have flown over
9368
-	*
9369
-	* @return Integer the number of flights
9370
-	*
9371
-	*/
9367
+	 * Counts all military flights that have flown over
9368
+	 *
9369
+	 * @return Integer the number of flights
9370
+	 *
9371
+	 */
9372 9372
 	public function countOverallMilitaryFlights($filters = array())
9373 9373
 	{
9374 9374
 		$filter_query = $this->getFilter($filters,true,true);
@@ -9383,11 +9383,11 @@  discard block
 block discarded – undo
9383 9383
 	
9384 9384
 	
9385 9385
 	/**
9386
-	* Counts all airlines that have flown over
9387
-	*
9388
-	* @return Integer the number of airlines
9389
-	*
9390
-	*/
9386
+	 * Counts all airlines that have flown over
9387
+	 *
9388
+	 * @return Integer the number of airlines
9389
+	 *
9390
+	 */
9391 9391
 	public function countOverallAirlines($filters = array())
9392 9392
 	{
9393 9393
 		$query  = "SELECT COUNT(DISTINCT spotter_output.airline_name) AS airline_count 
@@ -9401,11 +9401,11 @@  discard block
 block discarded – undo
9401 9401
 
9402 9402
   
9403 9403
 	/**
9404
-	* Counts all hours of today
9405
-	*
9406
-	* @return Array the hour list
9407
-	*
9408
-	*/
9404
+	 * Counts all hours of today
9405
+	 *
9406
+	 * @return Array the hour list
9407
+	 *
9408
+	 */
9409 9409
 	public function countAllHoursFromToday($filters = array())
9410 9410
 	{
9411 9411
 		global $globalTimezone, $globalDBdriver;
@@ -9445,11 +9445,11 @@  discard block
 block discarded – undo
9445 9445
 	}
9446 9446
     
9447 9447
 	/**
9448
-	* Gets all the spotter information based on calculated upcoming flights
9449
-	*
9450
-	* @return Array the spotter information
9451
-	*
9452
-	*/
9448
+	 * Gets all the spotter information based on calculated upcoming flights
9449
+	 *
9450
+	 * @return Array the spotter information
9451
+	 *
9452
+	 */
9453 9453
 	public function getUpcomingFlights($limit = '', $sort = '', $filters = array())
9454 9454
 	{
9455 9455
 		global $global_query, $globalDBdriver, $globalTimezone;
@@ -9524,12 +9524,12 @@  discard block
 block discarded – undo
9524 9524
 	}
9525 9525
     
9526 9526
     
9527
-     /**
9528
-	* Gets the Barrie Spotter ID based on the FlightAware ID
9529
-	*
9530
-	* @return Integer the Barrie Spotter ID
9527
+	 /**
9528
+	  * Gets the Barrie Spotter ID based on the FlightAware ID
9529
+	  *
9530
+	  * @return Integer the Barrie Spotter ID
9531 9531
 q	*
9532
-	*/
9532
+	  */
9533 9533
 	public function getSpotterIDBasedOnFlightAwareID($flightaware_id)
9534 9534
 	{
9535 9535
 		$flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING);
@@ -9550,13 +9550,13 @@  discard block
 block discarded – undo
9550 9550
   
9551 9551
  
9552 9552
 	/**
9553
-	* Parses a date string
9554
-	*
9555
-	* @param String $dateString the date string
9556
-	* @param String $timezone the timezone of a user
9557
-	* @return Array the time information
9558
-	*
9559
-	*/
9553
+	 * Parses a date string
9554
+	 *
9555
+	 * @param String $dateString the date string
9556
+	 * @param String $timezone the timezone of a user
9557
+	 * @return Array the time information
9558
+	 *
9559
+	 */
9560 9560
 	public function parseDateString($dateString, $timezone = '')
9561 9561
 	{
9562 9562
 		$time_array = array();
@@ -9592,12 +9592,12 @@  discard block
 block discarded – undo
9592 9592
 	
9593 9593
 	
9594 9594
 	/**
9595
-	* Parses the direction degrees to working
9596
-	*
9597
-	* @param Float $direction the direction in degrees
9598
-	* @return Array the direction information
9599
-	*
9600
-	*/
9595
+	 * Parses the direction degrees to working
9596
+	 *
9597
+	 * @param Float $direction the direction in degrees
9598
+	 * @return Array the direction information
9599
+	 *
9600
+	 */
9601 9601
 	public function parseDirection($direction = 0)
9602 9602
 	{
9603 9603
 		if ($direction == '') $direction = 0;
@@ -9676,12 +9676,12 @@  discard block
 block discarded – undo
9676 9676
 	
9677 9677
 	
9678 9678
 	/**
9679
-	* Gets the aircraft registration
9680
-	*
9681
-	* @param String $flightaware_id the flight aware id
9682
-	* @return String the aircraft registration
9683
-	*
9684
-	*/
9679
+	 * Gets the aircraft registration
9680
+	 *
9681
+	 * @param String $flightaware_id the flight aware id
9682
+	 * @return String the aircraft registration
9683
+	 *
9684
+	 */
9685 9685
 	
9686 9686
 	public function getAircraftRegistration($flightaware_id)
9687 9687
 	{
@@ -9710,12 +9710,12 @@  discard block
 block discarded – undo
9710 9710
 
9711 9711
 
9712 9712
 	/**
9713
-	* Gets the aircraft registration from ModeS
9714
-	*
9715
-	* @param String $aircraft_modes the flight ModeS in hex
9716
-	* @return String the aircraft registration
9717
-	*
9718
-	*/
9713
+	 * Gets the aircraft registration from ModeS
9714
+	 *
9715
+	 * @param String $aircraft_modes the flight ModeS in hex
9716
+	 * @return String the aircraft registration
9717
+	 *
9718
+	 */
9719 9719
 	public function getAircraftRegistrationBymodeS($aircraft_modes)
9720 9720
 	{
9721 9721
 		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
@@ -9728,19 +9728,19 @@  discard block
 block discarded – undo
9728 9728
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
9729 9729
 		$sth->closeCursor();
9730 9730
 		if (count($row) > 0) {
9731
-		    //return $row['Registration'];
9732
-		    return $row['registration'];
9731
+			//return $row['Registration'];
9732
+			return $row['registration'];
9733 9733
 		} else return '';
9734 9734
 	
9735 9735
 	}
9736 9736
 
9737 9737
 	/**
9738
-	* Gets the aircraft type from ModeS
9739
-	*
9740
-	* @param String $aircraft_modes the flight ModeS in hex
9741
-	* @return String the aircraft type
9742
-	*
9743
-	*/
9738
+	 * Gets the aircraft type from ModeS
9739
+	 *
9740
+	 * @param String $aircraft_modes the flight ModeS in hex
9741
+	 * @return String the aircraft type
9742
+	 *
9743
+	 */
9744 9744
 	public function getAircraftTypeBymodeS($aircraft_modes)
9745 9745
 	{
9746 9746
 		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
@@ -9753,19 +9753,19 @@  discard block
 block discarded – undo
9753 9753
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
9754 9754
 		$sth->closeCursor();
9755 9755
 		if (count($row) > 0) {
9756
-		    if ($row['type_flight'] == null) return '';
9757
-		    else return $row['type_flight'];
9756
+			if ($row['type_flight'] == null) return '';
9757
+			else return $row['type_flight'];
9758 9758
 		} else return '';
9759 9759
 	
9760 9760
 	}
9761 9761
 
9762 9762
 	/**
9763
-	* Gets Country from latitude/longitude
9764
-	*
9765
-	* @param Float $latitude latitute of the flight
9766
-	* @param Float $longitude longitute of the flight
9767
-	* @return String the countrie
9768
-	*/
9763
+	 * Gets Country from latitude/longitude
9764
+	 *
9765
+	 * @param Float $latitude latitute of the flight
9766
+	 * @param Float $longitude longitute of the flight
9767
+	 * @return String the countrie
9768
+	 */
9769 9769
 	public function getCountryFromLatitudeLongitude($latitude,$longitude)
9770 9770
 	{
9771 9771
 		global $globalDBdriver, $globalDebug;
@@ -9802,11 +9802,11 @@  discard block
 block discarded – undo
9802 9802
 	}
9803 9803
 
9804 9804
 	/**
9805
-	* Gets Country from iso2
9806
-	*
9807
-	* @param String $iso2 ISO2 country code
9808
-	* @return String the countrie
9809
-	*/
9805
+	 * Gets Country from iso2
9806
+	 *
9807
+	 * @param String $iso2 ISO2 country code
9808
+	 * @return String the countrie
9809
+	 */
9810 9810
 	public function getCountryFromISO2($iso2)
9811 9811
 	{
9812 9812
 		global $globalDBdriver, $globalDebug;
@@ -9834,12 +9834,12 @@  discard block
 block discarded – undo
9834 9834
 	}
9835 9835
 
9836 9836
 	/**
9837
-	* converts the registration code using the country prefix
9838
-	*
9839
-	* @param String $registration the aircraft registration
9840
-	* @return String the aircraft registration
9841
-	*
9842
-	*/
9837
+	 * converts the registration code using the country prefix
9838
+	 *
9839
+	 * @param String $registration the aircraft registration
9840
+	 * @return String the aircraft registration
9841
+	 *
9842
+	 */
9843 9843
 	public function convertAircraftRegistration($registration)
9844 9844
 	{
9845 9845
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -9891,12 +9891,12 @@  discard block
 block discarded – undo
9891 9891
 	}
9892 9892
 
9893 9893
 	/**
9894
-	* Country from the registration code
9895
-	*
9896
-	* @param String $registration the aircraft registration
9897
-	* @return String the country
9898
-	*
9899
-	*/
9894
+	 * Country from the registration code
9895
+	 *
9896
+	 * @param String $registration the aircraft registration
9897
+	 * @return String the country
9898
+	 *
9899
+	 */
9900 9900
 	public function countryFromAircraftRegistration($registration)
9901 9901
 	{
9902 9902
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -9915,8 +9915,8 @@  discard block
 block discarded – undo
9915 9915
 				$country = $row['country'];
9916 9916
 			}
9917 9917
 		} else {
9918
-    			$registration_1 = substr($registration, 0, 1);
9919
-		        $registration_2 = substr($registration, 0, 2);
9918
+				$registration_1 = substr($registration, 0, 1);
9919
+				$registration_2 = substr($registration, 0, 2);
9920 9920
 
9921 9921
 			$country = '';
9922 9922
 			//first get the prefix based on two characters
@@ -9952,12 +9952,12 @@  discard block
 block discarded – undo
9952 9952
 	}
9953 9953
 
9954 9954
 	/**
9955
-	* Registration prefix from the registration code
9956
-	*
9957
-	* @param String $registration the aircraft registration
9958
-	* @return String the registration prefix
9959
-	*
9960
-	*/
9955
+	 * Registration prefix from the registration code
9956
+	 *
9957
+	 * @param String $registration the aircraft registration
9958
+	 * @return String the registration prefix
9959
+	 *
9960
+	 */
9961 9961
 	public function registrationPrefixFromAircraftRegistration($registration)
9962 9962
 	{
9963 9963
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -9976,8 +9976,8 @@  discard block
 block discarded – undo
9976 9976
 				//$country = $row['country'];
9977 9977
 			}
9978 9978
 		} else {
9979
-    			$registration_1 = substr($registration, 0, 1);
9980
-		        $registration_2 = substr($registration, 0, 2);
9979
+				$registration_1 = substr($registration, 0, 1);
9980
+				$registration_2 = substr($registration, 0, 2);
9981 9981
 
9982 9982
 			//first get the prefix based on two characters
9983 9983
 			$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_2 LIMIT 1";
@@ -10013,12 +10013,12 @@  discard block
 block discarded – undo
10013 10013
 
10014 10014
 
10015 10015
 	/**
10016
-	* Country from the registration code
10017
-	*
10018
-	* @param String $registration the aircraft registration
10019
-	* @return String the country
10020
-	*
10021
-	*/
10016
+	 * Country from the registration code
10017
+	 *
10018
+	 * @param String $registration the aircraft registration
10019
+	 * @return String the country
10020
+	 *
10021
+	 */
10022 10022
 	public function countryFromAircraftRegistrationCode($registration)
10023 10023
 	{
10024 10024
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -10035,11 +10035,11 @@  discard block
 block discarded – undo
10035 10035
 	}
10036 10036
 	
10037 10037
 	/**
10038
-	* Set a new highlight value for a flight
10039
-	*
10040
-	* @param String $flightaware_id flightaware_id from spotter_output table
10041
-	* @param String $highlight New highlight value
10042
-	*/
10038
+	 * Set a new highlight value for a flight
10039
+	 *
10040
+	 * @param String $flightaware_id flightaware_id from spotter_output table
10041
+	 * @param String $highlight New highlight value
10042
+	 */
10043 10043
 	public function setHighlightFlight($flightaware_id,$highlight) {
10044 10044
 		
10045 10045
 		$query  = "UPDATE spotter_output SET highlight = :highlight WHERE flightaware_id = :flightaware_id";
@@ -10048,12 +10048,12 @@  discard block
 block discarded – undo
10048 10048
 	}
10049 10049
 	
10050 10050
 	/**
10051
-	* Gets the short url from bit.ly
10052
-	*
10053
-	* @param String $url the full url
10054
-	* @return String the bit.ly url
10055
-	*
10056
-	*/
10051
+	 * Gets the short url from bit.ly
10052
+	 *
10053
+	 * @param String $url the full url
10054
+	 * @return String the bit.ly url
10055
+	 *
10056
+	 */
10057 10057
 	public function getBitlyURL($url)
10058 10058
 	{
10059 10059
 		global $globalBitlyAccessToken;
@@ -10342,11 +10342,11 @@  discard block
 block discarded – undo
10342 10342
 			$query="SELECT name, icao, latitude, longitude, altitude, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(latitude*pi()/180)*POWER(SIN(($origLon-longitude)*pi()/180/2),2))) as distance 
10343 10343
 	                      FROM airport WHERE longitude between ($origLon-$dist/cos(radians($origLat))*69) and ($origLon+$dist/cos(radians($origLat)*69)) and latitude between ($origLat-($dist/69)) and ($origLat+($dist/69)) 
10344 10344
 	                      AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(latitude*pi()/180)*POWER(SIN(($origLon-longitude)*pi()/180/2),2)))) < $dist ORDER BY distance limit 100;";
10345
-                } else {
10345
+				} else {
10346 10346
 			$query="SELECT name, icao, latitude, longitude, altitude, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(longitude as double precision))*pi()/180/2),2))) as distance 
10347 10347
 	                      FROM airport WHERE CAST(longitude as double precision) between ($origLon-$dist/cos(radians($origLat))*69) and ($origLon+$dist/cos(radians($origLat))*69) and CAST(latitude as double precision) between ($origLat-($dist/69)) and ($origLat+($dist/69)) 
10348 10348
 	                      AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(longitude as double precision))*pi()/180/2),2)))) < $dist ORDER BY distance limit 100;";
10349
-    		}
10349
+			}
10350 10350
 		$sth = $this->db->prepare($query);
10351 10351
 		$sth->execute();
10352 10352
 		return $sth->fetchAll(PDO::FETCH_ASSOC);
Please login to merge, or discard this patch.
Spacing   +1024 added lines, -1024 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 spotter_output.* FROM spotter_output";
6 6
 
7
-class Spotter{
7
+class Spotter {
8 8
 	public $db;
9 9
 	
10 10
 	public function __construct($dbc = null) {
@@ -17,45 +17,45 @@  discard block
 block discarded – undo
17 17
 	* @param Array $filter the filter
18 18
 	* @return Array the SQL part
19 19
 	*/
20
-	public function getFilter($filter = array(),$where = false,$and = false) {
20
+	public function getFilter($filter = array(), $where = false, $and = false) {
21 21
 		global $globalFilter, $globalStatsFilters, $globalFilterName;
22 22
 		$filters = array();
23 23
 		if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) {
24 24
 			if (isset($globalStatsFilters[$globalFilterName][0]['source'])) {
25 25
 				$filters = $globalStatsFilters[$globalFilterName];
26 26
 			} else {
27
-				$filter = array_merge($filter,$globalStatsFilters[$globalFilterName]);
27
+				$filter = array_merge($filter, $globalStatsFilters[$globalFilterName]);
28 28
 			}
29 29
 		}
30
-		if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter);
30
+		if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter);
31 31
 		$filter_query_join = '';
32 32
 		$filter_query_where = '';
33
-		foreach($filters as $flt) {
33
+		foreach ($filters as $flt) {
34 34
 			if (isset($flt['airlines']) && !empty($flt['airlines'])) {
35 35
 				if ($flt['airlines'][0] != '') {
36 36
 					if (isset($flt['source'])) {
37
-						$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$flt['airlines'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
37
+						$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $flt['airlines'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
38 38
 					} else {
39
-						$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$flt['airlines'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
39
+						$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $flt['airlines'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
40 40
 					}
41 41
 				}
42 42
 			}
43 43
 			if (isset($flt['pilots_id']) && !empty($flt['pilots_id'])) {
44 44
 				if (isset($flt['source'])) {
45
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
45
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $flt['pilots_id'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
46 46
 				} else {
47
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
47
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $flt['pilots_id'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
48 48
 				}
49 49
 			}
50 50
 			if ((isset($flt['airlines']) && empty($flt['airlines']) && isset($flt['pilots_id']) && empty($flt['pilots_id'])) || (!isset($flt['airlines']) && !isset($flt['pilots_id']))) {
51 51
 				if (isset($flt['source'])) {
52
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.format_source IN ('".implode("','",$flt['source'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
52
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.format_source IN ('".implode("','", $flt['source'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
53 53
 				}
54 54
 			}
55 55
 		}
56 56
 		if (isset($filter['airlines']) && !empty($filter['airlines'])) {
57 57
 			if ($filter['airlines'][0] != '') {
58
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
58
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
59 59
 			}
60 60
 		}
61 61
 		if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
@@ -65,19 +65,19 @@  discard block
 block discarded – undo
65 65
 			$filter_query_join .= " INNER JOIN (SELECT icao FROM airlines WHERE alliance = '".$filter['alliance']."') sal ON sal.icao = spotter_output.airline_icao ";
66 66
 		}
67 67
 		if (isset($filter['pilots_id']) && !empty($filter['pilots_id'])) {
68
-				$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$filter['pilots_id'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
68
+				$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $filter['pilots_id'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
69 69
 			}
70 70
 		if (isset($filter['source']) && !empty($filter['source'])) {
71
-			$filter_query_where = " WHERE format_source IN ('".implode("','",$filter['source'])."')";
71
+			$filter_query_where = " WHERE format_source IN ('".implode("','", $filter['source'])."')";
72 72
 		}
73 73
 		if (isset($filter['ident']) && !empty($filter['ident'])) {
74 74
 			$filter_query_where = " WHERE ident = '".$filter['ident']."'";
75 75
 		}
76 76
 		if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
77 77
 			if ($filter_query_where == '') {
78
-				$filter_query_where = " WHERE format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
78
+				$filter_query_where = " WHERE format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')";
79 79
 			} else {
80
-				$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
80
+				$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')";
81 81
 			}
82 82
 		}
83 83
 		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 	* @return Array the spotter information
96 96
 	*
97 97
 	*/
98
-	public function getDataFromDB($query, $params = array(), $limitQuery = '',$schedules = false)
98
+	public function getDataFromDB($query, $params = array(), $limitQuery = '', $schedules = false)
99 99
 	{
100 100
 		global $globalSquawkCountry, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalAirlinesSource, $globalVAM;
101 101
 		$Image = new Image($this->db);
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
 			$sth = $this->db->prepare($query.$limitQuery);
126 126
 			$sth->execute($params);
127 127
 		} catch (PDOException $e) {
128
-			printf("Invalid query : %s\nWhole query: %s\n",$e->getMessage(), $query.$limitQuery);
128
+			printf("Invalid query : %s\nWhole query: %s\n", $e->getMessage(), $query.$limitQuery);
129 129
 			exit();
130 130
 		}
131 131
 		
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
 		$spotter_array = array();
136 136
 		
137 137
 
138
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
138
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
139 139
 		{
140 140
 			$num_rows++;
141 141
 			$temp_array = array();
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
 			if (isset($row['route_stop'])) {
181 181
 				$temp_array['route_stop'] = $row['route_stop'];
182 182
 				if ($row['route_stop'] != '') {
183
-					$allroute = explode(' ',$row['route_stop']);
183
+					$allroute = explode(' ', $row['route_stop']);
184 184
 			
185 185
 					foreach ($allroute as $route) {
186 186
 						$route_airport_array = $this->getAllAirportInfo($route);
@@ -235,11 +235,11 @@  discard block
 block discarded – undo
235 235
 				{
236 236
 					$temp_array['date'] = "about ".$dateArray['hours']." hours ago";
237 237
 				} else {
238
-					$temp_array['date'] = date("M j Y, g:i a",strtotime($row['date']." UTC"));
238
+					$temp_array['date'] = date("M j Y, g:i a", strtotime($row['date']." UTC"));
239 239
 				}
240 240
 				$temp_array['date_minutes_past'] = $dateArray['minutes'];
241
-				$temp_array['date_iso_8601'] = date("c",strtotime($row['date']." UTC"));
242
-				$temp_array['date_rfc_2822'] = date("r",strtotime($row['date']." UTC"));
241
+				$temp_array['date_iso_8601'] = date("c", strtotime($row['date']." UTC"));
242
+				$temp_array['date_rfc_2822'] = date("r", strtotime($row['date']." UTC"));
243 243
 				$temp_array['date_unix'] = strtotime($row['date']." UTC");
244 244
 			}
245 245
 			
@@ -273,9 +273,9 @@  discard block
 block discarded – undo
273 273
 			if (!isset($row['airline_name']) || $row['airline_name'] == '') {
274 274
 				if (!is_numeric(substr($row['ident'], 0, 3))) {
275 275
 					if (is_numeric(substr($row['ident'], 2, 1))) {
276
-						$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 2),$fromsource);
276
+						$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 2), $fromsource);
277 277
 					} elseif (is_numeric(substr($row['ident'], 3, 1))) {
278
-						$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3),$fromsource);
278
+						$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3), $fromsource);
279 279
 					} else {
280 280
 						$airline_array = $this->getAllAirlineInfo('NA');
281 281
 					}
@@ -312,7 +312,7 @@  discard block
 block discarded – undo
312 312
 				}
313 313
 			}
314 314
 			if (isset($temp_array['airline_iata']) && $temp_array['airline_iata'] != '') {
315
-				$acars_array = $ACARS->getLiveAcarsData($temp_array['airline_iata'].substr($temp_array['ident'],3));
315
+				$acars_array = $ACARS->getLiveAcarsData($temp_array['airline_iata'].substr($temp_array['ident'], 3));
316 316
 				//$acars_array = ACARS->getLiveAcarsData('BA40YL');
317 317
 				if (count($acars_array) > 0) {
318 318
 					$temp_array['acars'] = $acars_array;
@@ -329,11 +329,11 @@  discard block
 block discarded – undo
329 329
 				$temp_array['aircraft_date_first_reg'] = $owner_info['date_first_reg'];
330 330
 			}
331 331
 
332
-			if($temp_array['registration'] != "" || ($globalIVAO && isset($temp_array['aircraft_type']) && $temp_array['aircraft_type'] != ''))
332
+			if ($temp_array['registration'] != "" || ($globalIVAO && isset($temp_array['aircraft_type']) && $temp_array['aircraft_type'] != ''))
333 333
 			{
334 334
 				if ($globalIVAO) {
335
-					if (isset($temp_array['airline_icao']))	$image_array = $Image->getSpotterImage('',$temp_array['aircraft_type'],$temp_array['airline_icao']);
336
-					else $image_array = $Image->getSpotterImage('',$temp_array['aircraft_type']);
335
+					if (isset($temp_array['airline_icao']))	$image_array = $Image->getSpotterImage('', $temp_array['aircraft_type'], $temp_array['airline_icao']);
336
+					else $image_array = $Image->getSpotterImage('', $temp_array['aircraft_type']);
337 337
 				} else $image_array = $Image->getSpotterImage($temp_array['registration']);
338 338
 				if (count($image_array) > 0) {
339 339
 					$temp_array['image'] = $image_array[0]['image'];
@@ -357,7 +357,7 @@  discard block
 block discarded – undo
357 357
 				$temp_array['arrival_airport_time'] = $row['arrival_airport_time'];
358 358
 			}
359 359
 			
360
-			if ((!isset($globalIVAO) || ! $globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalVAM) || !$globalVAM)) {
360
+			if ((!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalVAM) || !$globalVAM)) {
361 361
 				if ($schedules === true) {
362 362
 					$schedule_array = $Schedule->getSchedule($temp_array['ident']);
363 363
 					//print_r($schedule_array);
@@ -439,12 +439,12 @@  discard block
 block discarded – undo
439 439
 			if (isset($row['squawk'])) {
440 440
 				$temp_array['squawk'] = $row['squawk'];
441 441
 				if ($row['squawk'] != '' && isset($temp_array['country_iso2'])) {
442
-					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$temp_array['country_iso2']);
443
-					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
442
+					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $temp_array['country_iso2']);
443
+					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $globalSquawkCountry);
444 444
 				} elseif ($row['squawk'] != '' && isset($temp_array['over_country'])) {
445
-					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$temp_array['over_country']);
446
-					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
447
-				} elseif ($row['squawk'] != '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
445
+					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $temp_array['over_country']);
446
+					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $globalSquawkCountry);
447
+				} elseif ($row['squawk'] != '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $globalSquawkCountry);
448 448
 			}
449 449
     			
450 450
 			$temp_array['query_number_rows'] = $num_rows;
@@ -463,7 +463,7 @@  discard block
 block discarded – undo
463 463
 	* @return Array the spotter information
464 464
 	*
465 465
 	*/
466
-	public function searchSpotterData($q = '', $registration = '', $aircraft_icao = '', $aircraft_manufacturer = '', $highlights = '', $airline_icao = '', $airline_country = '', $airline_type = '', $airport = '', $airport_country = '', $callsign = '', $departure_airport_route = '', $arrival_airport_route = '', $owner = '',$pilot_id = '',$pilot_name = '',$altitude = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '',$origLat = '',$origLon = '',$dist = '',$filters = array())
466
+	public function searchSpotterData($q = '', $registration = '', $aircraft_icao = '', $aircraft_manufacturer = '', $highlights = '', $airline_icao = '', $airline_country = '', $airline_type = '', $airport = '', $airport_country = '', $callsign = '', $departure_airport_route = '', $arrival_airport_route = '', $owner = '', $pilot_id = '', $pilot_name = '', $altitude = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '', $origLat = '', $origLon = '', $dist = '', $filters = array())
467 467
 	{
468 468
 		global $globalTimezone, $globalDBdriver;
469 469
 		require_once(dirname(__FILE__).'/class.Translation.php');
@@ -473,7 +473,7 @@  discard block
 block discarded – undo
473 473
 
474 474
 		$query_values = array();
475 475
 		$additional_query = '';
476
-		$filter_query = $this->getFilter($filters,true,true);
476
+		$filter_query = $this->getFilter($filters, true, true);
477 477
 		if ($q != "")
478 478
 		{
479 479
 			if (!is_string($q))
@@ -481,8 +481,8 @@  discard block
 block discarded – undo
481 481
 				return false;
482 482
 			} else {
483 483
 				$q_array = explode(" ", $q);
484
-				foreach ($q_array as $q_item){
485
-					$q_item = filter_var($q_item,FILTER_SANITIZE_STRING);
484
+				foreach ($q_array as $q_item) {
485
+					$q_item = filter_var($q_item, FILTER_SANITIZE_STRING);
486 486
 					$additional_query .= " AND (";
487 487
 					if (is_int($q_item)) $additional_query .= "(spotter_output.spotter_id like '%".$q_item."%') OR ";
488 488
 					$additional_query .= "(spotter_output.aircraft_icao like '%".$q_item."%') OR ";
@@ -514,37 +514,37 @@  discard block
 block discarded – undo
514 514
 
515 515
 		if ($registration != "")
516 516
 		{
517
-			$registration = filter_var($registration,FILTER_SANITIZE_STRING);
517
+			$registration = filter_var($registration, FILTER_SANITIZE_STRING);
518 518
 			if (!is_string($registration))
519 519
 			{
520 520
 				return false;
521 521
 			} else {
522 522
 				$additional_query .= " AND spotter_output.registration = :registration";
523
-				$query_values = array_merge($query_values,array(':registration' => $registration));
523
+				$query_values = array_merge($query_values, array(':registration' => $registration));
524 524
 			}
525 525
 		}
526 526
 
527 527
 		if ($aircraft_icao != "")
528 528
 		{
529
-			$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
529
+			$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
530 530
 			if (!is_string($aircraft_icao))
531 531
 			{
532 532
 				return false;
533 533
 			} else {
534 534
 				$additional_query .= " AND spotter_output.aircraft_icao = :aircraft_icao";
535
-				$query_values = array_merge($query_values,array(':aircraft_icao' => $aircraft_icao));
535
+				$query_values = array_merge($query_values, array(':aircraft_icao' => $aircraft_icao));
536 536
 			}
537 537
 		}
538 538
 
539 539
 		if ($aircraft_manufacturer != "")
540 540
 		{
541
-			$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
541
+			$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
542 542
 			if (!is_string($aircraft_manufacturer))
543 543
 			{
544 544
 				return false;
545 545
 			} else {
546 546
 				$additional_query .= " AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer";
547
-				$query_values = array_merge($query_values,array(':aircraft_manufacturer' => $aircraft_manufacturer));
547
+				$query_values = array_merge($query_values, array(':aircraft_manufacturer' => $aircraft_manufacturer));
548 548
 			}
549 549
 		}
550 550
 
@@ -560,25 +560,25 @@  discard block
 block discarded – undo
560 560
 
561 561
 		if ($airline_icao != "")
562 562
 		{
563
-			$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
563
+			$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
564 564
 			if (!is_string($airline_icao))
565 565
 			{
566 566
 				return false;
567 567
 			} else {
568 568
 				$additional_query .= " AND spotter_output.airline_icao = :airline_icao";
569
-				$query_values = array_merge($query_values,array(':airline_icao' => $airline_icao));
569
+				$query_values = array_merge($query_values, array(':airline_icao' => $airline_icao));
570 570
 			}
571 571
 		}
572 572
 
573 573
 		if ($airline_country != "")
574 574
 		{
575
-			$airline_country = filter_var($airline_country,FILTER_SANITIZE_STRING);
575
+			$airline_country = filter_var($airline_country, FILTER_SANITIZE_STRING);
576 576
 			if (!is_string($airline_country))
577 577
 			{
578 578
 				return false;
579 579
 			} else {
580 580
 				$additional_query .= " AND spotter_output.airline_country = :airline_country";
581
-				$query_values = array_merge($query_values,array(':airline_country' => $airline_country));
581
+				$query_values = array_merge($query_values, array(':airline_country' => $airline_country));
582 582
 			}
583 583
 		}
584 584
 
@@ -605,31 +605,31 @@  discard block
 block discarded – undo
605 605
 
606 606
 		if ($airport != "")
607 607
 		{
608
-			$airport = filter_var($airport,FILTER_SANITIZE_STRING);
608
+			$airport = filter_var($airport, FILTER_SANITIZE_STRING);
609 609
 			if (!is_string($airport))
610 610
 			{
611 611
 				return false;
612 612
 			} else {
613 613
 				$additional_query .= " AND (spotter_output.departure_airport_icao = :airport OR spotter_output.arrival_airport_icao = :airport)";
614
-				$query_values = array_merge($query_values,array(':airport' => $airport));
614
+				$query_values = array_merge($query_values, array(':airport' => $airport));
615 615
 			}
616 616
 		}
617 617
 
618 618
 		if ($airport_country != "")
619 619
 		{
620
-			$airport_country = filter_var($airport_country,FILTER_SANITIZE_STRING);
620
+			$airport_country = filter_var($airport_country, FILTER_SANITIZE_STRING);
621 621
 			if (!is_string($airport_country))
622 622
 			{
623 623
 				return false;
624 624
 			} else {
625 625
 				$additional_query .= " AND (spotter_output.departure_airport_country = :airport_country OR spotter_output.arrival_airport_country = :airport_country)";
626
-				$query_values = array_merge($query_values,array(':airport_country' => $airport_country));
626
+				$query_values = array_merge($query_values, array(':airport_country' => $airport_country));
627 627
 			}
628 628
 		}
629 629
     
630 630
 		if ($callsign != "")
631 631
 		{
632
-			$callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
632
+			$callsign = filter_var($callsign, FILTER_SANITIZE_STRING);
633 633
 			if (!is_string($callsign))
634 634
 			{
635 635
 				return false;
@@ -637,79 +637,79 @@  discard block
 block discarded – undo
637 637
 				$translate = $Translation->ident2icao($callsign);
638 638
 				if ($translate != $callsign) {
639 639
 					$additional_query .= " AND (spotter_output.ident = :callsign OR spotter_output.ident = :translate)";
640
-					$query_values = array_merge($query_values,array(':callsign' => $callsign,':translate' => $translate));
640
+					$query_values = array_merge($query_values, array(':callsign' => $callsign, ':translate' => $translate));
641 641
 				} else {
642 642
 					$additional_query .= " AND spotter_output.ident = :callsign";
643
-					$query_values = array_merge($query_values,array(':callsign' => $callsign));
643
+					$query_values = array_merge($query_values, array(':callsign' => $callsign));
644 644
 				}
645 645
 			}
646 646
 		}
647 647
 
648 648
 		if ($owner != "")
649 649
 		{
650
-			$owner = filter_var($owner,FILTER_SANITIZE_STRING);
650
+			$owner = filter_var($owner, FILTER_SANITIZE_STRING);
651 651
 			if (!is_string($owner))
652 652
 			{
653 653
 				return false;
654 654
 			} else {
655 655
 				$additional_query .= " AND spotter_output.owner_name = :owner";
656
-				$query_values = array_merge($query_values,array(':owner' => $owner));
656
+				$query_values = array_merge($query_values, array(':owner' => $owner));
657 657
 			}
658 658
 		}
659 659
 
660 660
 		if ($pilot_name != "")
661 661
 		{
662
-			$pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING);
662
+			$pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING);
663 663
 			if (!is_string($pilot_name))
664 664
 			{
665 665
 				return false;
666 666
 			} else {
667 667
 				$additional_query .= " AND spotter_output.pilot_name = :pilot_name";
668
-				$query_values = array_merge($query_values,array(':pilot_name' => $pilot_name));
668
+				$query_values = array_merge($query_values, array(':pilot_name' => $pilot_name));
669 669
 			}
670 670
 		}
671 671
 
672 672
 		if ($pilot_id != "")
673 673
 		{
674
-			$pilot_id = filter_var($pilot_id,FILTER_SANITIZE_NUMBER_INT);
674
+			$pilot_id = filter_var($pilot_id, FILTER_SANITIZE_NUMBER_INT);
675 675
 			if (!is_string($pilot_id))
676 676
 			{
677 677
 				return false;
678 678
 			} else {
679 679
 				$additional_query .= " AND spotter_output.pilot_id = :pilot_id";
680
-				$query_values = array_merge($query_values,array(':pilot_id' => $pilot_id));
680
+				$query_values = array_merge($query_values, array(':pilot_id' => $pilot_id));
681 681
 			}
682 682
 		}
683 683
 
684 684
 		if ($departure_airport_route != "")
685 685
 		{
686
-			$departure_airport_route = filter_var($departure_airport_route,FILTER_SANITIZE_STRING);
686
+			$departure_airport_route = filter_var($departure_airport_route, FILTER_SANITIZE_STRING);
687 687
 			if (!is_string($departure_airport_route))
688 688
 			{
689 689
 				return false;
690 690
 			} else {
691 691
 				$additional_query .= " AND spotter_output.departure_airport_icao = :departure_airport_route";
692
-				$query_values = array_merge($query_values,array(':departure_airport_route' => $departure_airport_route));
692
+				$query_values = array_merge($query_values, array(':departure_airport_route' => $departure_airport_route));
693 693
 			}
694 694
 		}
695 695
 
696 696
 		if ($arrival_airport_route != "")
697 697
 		{
698
-			$arrival_airport_route = filter_var($arrival_airport_route,FILTER_SANITIZE_STRING);
698
+			$arrival_airport_route = filter_var($arrival_airport_route, FILTER_SANITIZE_STRING);
699 699
 			if (!is_string($arrival_airport_route))
700 700
 			{
701 701
 				return false;
702 702
 			} else {
703 703
 				$additional_query .= " AND spotter_output.arrival_airport_icao = :arrival_airport_route";
704
-				$query_values = array_merge($query_values,array(':arrival_airport_route' => $arrival_airport_route));
704
+				$query_values = array_merge($query_values, array(':arrival_airport_route' => $arrival_airport_route));
705 705
 			}
706 706
 		}
707 707
 
708 708
 		if ($altitude != "")
709 709
 		{
710 710
 			$altitude_array = explode(",", $altitude);
711
-			$altitude_array[0] = filter_var($altitude_array[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
712
-			$altitude_array[1] = filter_var($altitude_array[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
711
+			$altitude_array[0] = filter_var($altitude_array[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
712
+			$altitude_array[1] = filter_var($altitude_array[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
713 713
 
714 714
 			if ($altitude_array[1] != "")
715 715
 			{                
@@ -725,8 +725,8 @@  discard block
 block discarded – undo
725 725
 		if ($date_posted != "")
726 726
 		{
727 727
 			$date_array = explode(",", $date_posted);
728
-			$date_array[0] = filter_var($date_array[0],FILTER_SANITIZE_STRING);
729
-			$date_array[1] = filter_var($date_array[1],FILTER_SANITIZE_STRING);
728
+			$date_array[0] = filter_var($date_array[0], FILTER_SANITIZE_STRING);
729
+			$date_array[1] = filter_var($date_array[1], FILTER_SANITIZE_STRING);
730 730
 
731 731
 			if ($globalTimezone != '') {
732 732
 				date_default_timezone_set($globalTimezone);
@@ -757,8 +757,8 @@  discard block
 block discarded – undo
757 757
 		{
758 758
 			$limit_array = explode(",", $limit);
759 759
 			
760
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
761
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
760
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
761
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
762 762
 			
763 763
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
764 764
 			{
@@ -787,23 +787,23 @@  discard block
 block discarded – undo
787 787
 
788 788
 
789 789
 		if ($origLat != "" && $origLon != "" && $dist != "") {
790
-			$dist = number_format($dist*0.621371,2,'.',''); // convert km to mile
790
+			$dist = number_format($dist*0.621371, 2, '.', ''); // convert km to mile
791 791
 
792 792
 			if ($globalDBdriver == 'mysql') {
793
-				$query="SELECT spotter_output.*, 1.60935*3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - spotter_archive.latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(spotter_archive.latitude*pi()/180)*POWER(SIN(($origLon-spotter_archive.longitude)*pi()/180/2),2))) as distance 
793
+				$query = "SELECT spotter_output.*, 1.60935*3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - spotter_archive.latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(spotter_archive.latitude*pi()/180)*POWER(SIN(($origLon-spotter_archive.longitude)*pi()/180/2),2))) as distance 
794 794
 						FROM spotter_archive,spotter_output".$filter_query." spotter_output.flightaware_id = spotter_archive.flightaware_id AND spotter_output.ident <> '' ".$additional_query."AND spotter_archive.longitude between ($origLon-$dist/cos(radians($origLat))*69) and ($origLon+$dist/cos(radians($origLat)*69)) and spotter_archive.latitude between ($origLat-($dist/69)) and ($origLat+($dist/69)) 
795 795
 						AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - spotter_archive.latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(spotter_archive.latitude*pi()/180)*POWER(SIN(($origLon-spotter_archive.longitude)*pi()/180/2),2)))) < $dist".$orderby_query;
796 796
 			} else {
797
-				$query="SELECT spotter_output.*, 1.60935 * 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(spotter_archive.latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(spotter_archive.latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(spotter_archive.longitude as double precision))*pi()/180/2),2))) as distance 
797
+				$query = "SELECT spotter_output.*, 1.60935 * 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(spotter_archive.latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(spotter_archive.latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(spotter_archive.longitude as double precision))*pi()/180/2),2))) as distance 
798 798
 						FROM spotter_archive,spotter_output".$filter_query." spotter_output.flightaware_id = spotter_archive.flightaware_id AND spotter_output.ident <> '' ".$additional_query."AND CAST(spotter_archive.longitude as double precision) between ($origLon-$dist/cos(radians($origLat))*69) and ($origLon+$dist/cos(radians($origLat))*69) and CAST(spotter_archive.latitude as double precision) between ($origLat-($dist/69)) and ($origLat+($dist/69)) 
799 799
 						AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(spotter_archive.latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(spotter_archive.latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(spotter_archive.longitude as double precision))*pi()/180/2),2)))) < $dist".$filter_query.$orderby_query;
800 800
 			}
801 801
 		} else {		
802
-			$query  = "SELECT spotter_output.* FROM spotter_output".$filter_query." spotter_output.ident <> '' 
802
+			$query = "SELECT spotter_output.* FROM spotter_output".$filter_query." spotter_output.ident <> '' 
803 803
 					".$additional_query."
804 804
 					".$orderby_query;
805 805
 		}
806
-		$spotter_array = $this->getDataFromDB($query, $query_values,$limit_query);
806
+		$spotter_array = $this->getDataFromDB($query, $query_values, $limit_query);
807 807
 		return $spotter_array;
808 808
 	}
809 809
 	
@@ -826,8 +826,8 @@  discard block
 block discarded – undo
826 826
 		{
827 827
 			$limit_array = explode(",", $limit);
828 828
 			
829
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
830
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
829
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
830
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
831 831
 			
832 832
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
833 833
 			{
@@ -844,9 +844,9 @@  discard block
 block discarded – undo
844 844
 			$orderby_query = " ORDER BY spotter_output.date DESC";
845 845
 		}
846 846
 
847
-		$query  = $global_query.$filter_query." ".$orderby_query;
847
+		$query = $global_query.$filter_query." ".$orderby_query;
848 848
 
849
-		$spotter_array = $this->getDataFromDB($query, array(),$limit_query,true);
849
+		$spotter_array = $this->getDataFromDB($query, array(), $limit_query, true);
850 850
 
851 851
 		return $spotter_array;
852 852
 	}
@@ -892,34 +892,34 @@  discard block
 block discarded – undo
892 892
 			{
893 893
 				return false;
894 894
 			} else {
895
-				if ($interval == "30m"){
895
+				if ($interval == "30m") {
896 896
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE) <= $this_output.date ';
897
-				} else if ($interval == "1h"){
897
+				} else if ($interval == "1h") {
898 898
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) <= $this_output.date ';
899
-				} else if ($interval == "3h"){
899
+				} else if ($interval == "3h") {
900 900
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 3 HOUR) <= $this_output.date ';
901
-				} else if ($interval == "6h"){
901
+				} else if ($interval == "6h") {
902 902
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 6 HOUR) <= $this_output.date ';
903
-				} else if ($interval == "12h"){
903
+				} else if ($interval == "12h") {
904 904
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 12 HOUR) <= $this_output.date ';
905
-				} else if ($interval == "24h"){
905
+				} else if ($interval == "24h") {
906 906
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 24 HOUR) <= $this_output.date ';
907
-				} else if ($interval == "7d"){
907
+				} else if ($interval == "7d") {
908 908
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY) <= $this_output.date ';
909
-				} else if ($interval == "30d"){
909
+				} else if ($interval == "30d") {
910 910
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 DAY) <= $this_output.date ';
911 911
 				} 
912 912
 			}
913 913
 		}
914 914
 
915
-		$query  = "SELECT spotter_output.*, ( 6371 * acos( cos( radians($lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians($lng) ) + sin( radians($lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_output 
915
+		$query = "SELECT spotter_output.*, ( 6371 * acos( cos( radians($lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians($lng) ) + sin( radians($lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_output 
916 916
                    WHERE spotter_output.latitude <> '' 
917 917
 				   AND spotter_output.longitude <> '' 
918 918
                    ".$additional_query."
919 919
                    HAVING distance < :radius  
920 920
 				   ORDER BY distance";
921 921
 
922
-		$spotter_array = $this->getDataFromDB($query, array(':radius' => $radius),$limit_query);
922
+		$spotter_array = $this->getDataFromDB($query, array(':radius' => $radius), $limit_query);
923 923
 
924 924
 		return $spotter_array;
925 925
 	}
@@ -931,21 +931,21 @@  discard block
 block discarded – undo
931 931
 	* @return Array the spotter information
932 932
 	*
933 933
 	*/
934
-	public function getNewestSpotterDataSortedByAircraftType($limit = '', $sort = '',$filter = array())
934
+	public function getNewestSpotterDataSortedByAircraftType($limit = '', $sort = '', $filter = array())
935 935
 	{
936 936
 		global $global_query;
937 937
 		
938 938
 		date_default_timezone_set('UTC');
939 939
 
940
-		$filter_query = $this->getFilter($filter,true,true);
940
+		$filter_query = $this->getFilter($filter, true, true);
941 941
 
942 942
 		$limit_query = '';
943 943
 		if ($limit != "")
944 944
 		{
945 945
 			$limit_array = explode(",", $limit);
946 946
 			
947
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
948
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
947
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
948
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
949 949
 			
950 950
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
951 951
 			{
@@ -962,7 +962,7 @@  discard block
 block discarded – undo
962 962
 			$orderby_query = " ORDER BY spotter_output.date DESC ";
963 963
 		}
964 964
 
965
-		$query  = $global_query." ".$filter_query." spotter_output.aircraft_name <> '' GROUP BY spotter_output.aircraft_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query;
965
+		$query = $global_query." ".$filter_query." spotter_output.aircraft_name <> '' GROUP BY spotter_output.aircraft_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query;
966 966
 
967 967
 		$spotter_array = $this->getDataFromDB($query, array(), $limit_query);
968 968
 
@@ -981,15 +981,15 @@  discard block
 block discarded – undo
981 981
 		global $global_query;
982 982
 		
983 983
 		date_default_timezone_set('UTC');
984
-		$filter_query = $this->getFilter($filter,true,true);
984
+		$filter_query = $this->getFilter($filter, true, true);
985 985
 
986 986
 		$limit_query = '';
987 987
 		if ($limit != "")
988 988
 		{
989 989
 			$limit_array = explode(",", $limit);
990 990
 			
991
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
992
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
991
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
992
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
993 993
 			
994 994
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
995 995
 			{
@@ -1006,7 +1006,7 @@  discard block
 block discarded – undo
1006 1006
 			$orderby_query = " ORDER BY spotter_output.date DESC ";
1007 1007
 		}
1008 1008
 
1009
-		$query  = $global_query." ".$filter_query." spotter_output.registration <> '' GROUP BY spotter_output.registration,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query;
1009
+		$query = $global_query." ".$filter_query." spotter_output.registration <> '' GROUP BY spotter_output.registration,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query;
1010 1010
 
1011 1011
 		$spotter_array = $this->getDataFromDB($query, array(), $limit_query);
1012 1012
 
@@ -1020,20 +1020,20 @@  discard block
 block discarded – undo
1020 1020
 	* @return Array the spotter information
1021 1021
 	*
1022 1022
 	*/
1023
-	public function getNewestSpotterDataSortedByAirline($limit = '', $sort = '',$filter = array())
1023
+	public function getNewestSpotterDataSortedByAirline($limit = '', $sort = '', $filter = array())
1024 1024
 	{
1025 1025
 		global $global_query;
1026 1026
 		
1027 1027
 		date_default_timezone_set('UTC');
1028
-		$filter_query = $this->getFilter($filter,true,true);
1028
+		$filter_query = $this->getFilter($filter, true, true);
1029 1029
 		
1030 1030
 		$limit_query = '';
1031 1031
 		if ($limit != "")
1032 1032
 		{
1033 1033
 			$limit_array = explode(",", $limit);
1034 1034
 			
1035
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1036
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1035
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1036
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1037 1037
 			
1038 1038
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1039 1039
 			{
@@ -1050,7 +1050,7 @@  discard block
 block discarded – undo
1050 1050
 			$orderby_query = " ORDER BY spotter_output.date DESC ";
1051 1051
 		}
1052 1052
 
1053
-		$query  = $global_query." ".$filter_query." spotter_output.airline_name <> '' GROUP BY spotter_output.airline_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query;
1053
+		$query = $global_query." ".$filter_query." spotter_output.airline_name <> '' GROUP BY spotter_output.airline_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query;
1054 1054
 
1055 1055
 		$spotter_array = $this->getDataFromDB($query, array(), $limit_query);
1056 1056
 
@@ -1070,7 +1070,7 @@  discard block
 block discarded – undo
1070 1070
 		
1071 1071
 		date_default_timezone_set('UTC');
1072 1072
 		
1073
-		$filter_query = $this->getFilter($filter,true,true);
1073
+		$filter_query = $this->getFilter($filter, true, true);
1074 1074
 		
1075 1075
 		$limit_query = '';
1076 1076
 		
@@ -1078,8 +1078,8 @@  discard block
 block discarded – undo
1078 1078
 		{
1079 1079
 			$limit_array = explode(",", $limit);
1080 1080
 			
1081
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1082
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1081
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1082
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1083 1083
 			
1084 1084
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1085 1085
 			{
@@ -1096,7 +1096,7 @@  discard block
 block discarded – undo
1096 1096
 			$orderby_query = " ORDER BY spotter_output.date DESC ";
1097 1097
 		}
1098 1098
 
1099
-		$query  = $global_query." ".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' GROUP BY spotter_output.departure_airport_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query;
1099
+		$query = $global_query." ".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' GROUP BY spotter_output.departure_airport_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query;
1100 1100
 
1101 1101
 		$spotter_array = $this->getDataFromDB($query, array(), $limit_query);
1102 1102
 
@@ -1115,14 +1115,14 @@  discard block
 block discarded – undo
1115 1115
 		global $global_query;
1116 1116
 		
1117 1117
 		date_default_timezone_set('UTC');
1118
-		$filter_query = $this->getFilter($filter,true,true);
1118
+		$filter_query = $this->getFilter($filter, true, true);
1119 1119
 		$limit_query = '';
1120 1120
 		if ($limit != "")
1121 1121
 		{
1122 1122
 			$limit_array = explode(",", $limit);
1123 1123
 			
1124
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1125
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1124
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1125
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1126 1126
 			
1127 1127
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1128 1128
 			{
@@ -1139,7 +1139,7 @@  discard block
 block discarded – undo
1139 1139
 			$orderby_query = " ORDER BY spotter_output.date DESC ";
1140 1140
 		}
1141 1141
 
1142
-		$query  = $global_query.$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' GROUP BY spotter_output.arrival_airport_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query;
1142
+		$query = $global_query.$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' GROUP BY spotter_output.arrival_airport_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query;
1143 1143
 
1144 1144
 		$spotter_array = $this->getDataFromDB($query, array(), $limit_query);
1145 1145
 
@@ -1163,9 +1163,9 @@  discard block
 block discarded – undo
1163 1163
 		$query_values = array(':id' => $id);
1164 1164
 
1165 1165
 		//$query  = $global_query." WHERE spotter_output.ident <> '' ".$additional_query." ";
1166
-		$query  = $global_query." WHERE ".$additional_query." ";
1166
+		$query = $global_query." WHERE ".$additional_query." ";
1167 1167
 
1168
-		$spotter_array = $this->getDataFromDB($query,$query_values);
1168
+		$spotter_array = $this->getDataFromDB($query, $query_values);
1169 1169
 
1170 1170
 		return $spotter_array;
1171 1171
 	}
@@ -1203,8 +1203,8 @@  discard block
 block discarded – undo
1203 1203
 		{
1204 1204
 			$limit_array = explode(",", $limit);
1205 1205
 			
1206
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1207
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1206
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1207
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1208 1208
 			
1209 1209
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1210 1210
 			{
@@ -1245,7 +1245,7 @@  discard block
 block discarded – undo
1245 1245
 		$query_values = array();
1246 1246
 		$limit_query = '';
1247 1247
 		$additional_query = '';
1248
-		$filter_query = $this->getFilter($filter,true,true);
1248
+		$filter_query = $this->getFilter($filter, true, true);
1249 1249
 		
1250 1250
 		if ($aircraft_type != "")
1251 1251
 		{
@@ -1262,8 +1262,8 @@  discard block
 block discarded – undo
1262 1262
 		{
1263 1263
 			$limit_array = explode(",", $limit);
1264 1264
 			
1265
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1266
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1265
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1266
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1267 1267
 			
1268 1268
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1269 1269
 			{
@@ -1319,8 +1319,8 @@  discard block
 block discarded – undo
1319 1319
 		{
1320 1320
 			$limit_array = explode(",", $limit);
1321 1321
 			
1322
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1323
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1322
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1323
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1324 1324
 			
1325 1325
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1326 1326
 			{
@@ -1336,7 +1336,7 @@  discard block
 block discarded – undo
1336 1336
 		} else {
1337 1337
 			$orderby_query = " ORDER BY spotter_output.date DESC";
1338 1338
 		}
1339
-		$filter_query = $this->getFilter($filter,true,true);
1339
+		$filter_query = $this->getFilter($filter, true, true);
1340 1340
 
1341 1341
 		//$query = $global_query.$filter_query." spotter_output.ident <> '' ".$additional_query." ".$orderby_query;
1342 1342
 		$query = $global_query.$filter_query." ".$additional_query." ".$orderby_query;
@@ -1355,7 +1355,7 @@  discard block
 block discarded – undo
1355 1355
 	* @return Array the spotter information
1356 1356
 	*
1357 1357
 	*/
1358
-	public function getSpotterDataByAirline($airline = '', $limit = '', $sort = '',$filters = array())
1358
+	public function getSpotterDataByAirline($airline = '', $limit = '', $sort = '', $filters = array())
1359 1359
 	{
1360 1360
 		global $global_query;
1361 1361
 		
@@ -1364,7 +1364,7 @@  discard block
 block discarded – undo
1364 1364
 		$query_values = array();
1365 1365
 		$limit_query = '';
1366 1366
 		$additional_query = '';
1367
-		$filter_query = $this->getFilter($filters,true,true);
1367
+		$filter_query = $this->getFilter($filters, true, true);
1368 1368
 		
1369 1369
 		if ($airline != "")
1370 1370
 		{
@@ -1381,8 +1381,8 @@  discard block
 block discarded – undo
1381 1381
 		{
1382 1382
 			$limit_array = explode(",", $limit);
1383 1383
 			
1384
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1385
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1384
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1385
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1386 1386
 			
1387 1387
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1388 1388
 			{
@@ -1412,7 +1412,7 @@  discard block
 block discarded – undo
1412 1412
 	* @return Array the spotter information
1413 1413
 	*
1414 1414
 	*/
1415
-	public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '',$filters = array())
1415
+	public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '', $filters = array())
1416 1416
 	{
1417 1417
 		global $global_query;
1418 1418
 		
@@ -1420,7 +1420,7 @@  discard block
 block discarded – undo
1420 1420
 		$query_values = array();
1421 1421
 		$limit_query = '';
1422 1422
 		$additional_query = '';
1423
-		$filter_query = $this->getFilter($filters,true,true);
1423
+		$filter_query = $this->getFilter($filters, true, true);
1424 1424
 		
1425 1425
 		if ($airport != "")
1426 1426
 		{
@@ -1437,8 +1437,8 @@  discard block
 block discarded – undo
1437 1437
 		{
1438 1438
 			$limit_array = explode(",", $limit);
1439 1439
 			
1440
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1441
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1440
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1441
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1442 1442
 			
1443 1443
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1444 1444
 			{
@@ -1470,7 +1470,7 @@  discard block
 block discarded – undo
1470 1470
 	* @return Array the spotter information
1471 1471
 	*
1472 1472
 	*/
1473
-	public function getSpotterDataByDate($date = '', $limit = '', $sort = '',$filter = array())
1473
+	public function getSpotterDataByDate($date = '', $limit = '', $sort = '', $filter = array())
1474 1474
 	{
1475 1475
 		global $global_query, $globalTimezone, $globalDBdriver;
1476 1476
 		
@@ -1478,7 +1478,7 @@  discard block
 block discarded – undo
1478 1478
 		$limit_query = '';
1479 1479
 		$additional_query = '';
1480 1480
 
1481
-		$filter_query = $this->getFilter($filter,true,true);
1481
+		$filter_query = $this->getFilter($filter, true, true);
1482 1482
 		
1483 1483
 		if ($date != "")
1484 1484
 		{
@@ -1507,8 +1507,8 @@  discard block
 block discarded – undo
1507 1507
 		{
1508 1508
 			$limit_array = explode(",", $limit);
1509 1509
 			
1510
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1511
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1510
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1511
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1512 1512
 			
1513 1513
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1514 1514
 			{
@@ -1538,7 +1538,7 @@  discard block
 block discarded – undo
1538 1538
 	* @return Array the spotter information
1539 1539
 	*
1540 1540
 	*/
1541
-	public function getSpotterDataByCountry($country = '', $limit = '', $sort = '',$filters = array())
1541
+	public function getSpotterDataByCountry($country = '', $limit = '', $sort = '', $filters = array())
1542 1542
 	{
1543 1543
 		global $global_query;
1544 1544
 		
@@ -1547,7 +1547,7 @@  discard block
 block discarded – undo
1547 1547
 		$query_values = array();
1548 1548
 		$limit_query = '';
1549 1549
 		$additional_query = '';
1550
-		$filter_query = $this->getFilter($filters,true,true);
1550
+		$filter_query = $this->getFilter($filters, true, true);
1551 1551
 		if ($country != "")
1552 1552
 		{
1553 1553
 			if (!is_string($country))
@@ -1564,8 +1564,8 @@  discard block
 block discarded – undo
1564 1564
 		{
1565 1565
 			$limit_array = explode(",", $limit);
1566 1566
 			
1567
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1568
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1567
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1568
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1569 1569
 			
1570 1570
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1571 1571
 			{
@@ -1605,7 +1605,7 @@  discard block
 block discarded – undo
1605 1605
 		$query_values = array();
1606 1606
 		$additional_query = '';
1607 1607
 		$limit_query = '';
1608
-		$filter_query = $this->getFilter($filters,true,true);
1608
+		$filter_query = $this->getFilter($filters, true, true);
1609 1609
 		
1610 1610
 		if ($aircraft_manufacturer != "")
1611 1611
 		{
@@ -1622,8 +1622,8 @@  discard block
 block discarded – undo
1622 1622
 		{
1623 1623
 			$limit_array = explode(",", $limit);
1624 1624
 			
1625
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1626
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1625
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1626
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1627 1627
 			
1628 1628
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1629 1629
 			{
@@ -1665,14 +1665,14 @@  discard block
 block discarded – undo
1665 1665
 		$query_values = array();
1666 1666
 		$additional_query = '';
1667 1667
 		$limit_query = '';
1668
-		$filter_query = $this->getFilter($filters,true,true);
1668
+		$filter_query = $this->getFilter($filters, true, true);
1669 1669
 		if ($departure_airport_icao != "")
1670 1670
 		{
1671 1671
 			if (!is_string($departure_airport_icao))
1672 1672
 			{
1673 1673
 				return false;
1674 1674
 			} else {
1675
-				$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
1675
+				$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
1676 1676
 				$additional_query .= " AND (spotter_output.departure_airport_icao = :departure_airport_icao)";
1677 1677
 				//$additional_query .= " AND (spotter_output.departure_airport_icao = :departure_airport_icao AND spotter_output.real_departure_airport_icao IS NULL) OR spotter_output.real_departure_airport_icao = :departure_airport_icao";
1678 1678
 				$query_values = array(':departure_airport_icao' => $departure_airport_icao);
@@ -1685,10 +1685,10 @@  discard block
 block discarded – undo
1685 1685
 			{
1686 1686
 				return false;
1687 1687
 			} else {
1688
-				$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
1688
+				$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
1689 1689
 				$additional_query .= " AND (spotter_output.arrival_airport_icao = :arrival_airport_icao)";
1690 1690
 				//$additional_query .= " AND ((spotter_output.arrival_airport_icao = :arrival_airport_icao AND spotter_output.real_arrival_airport_icao IS NULL) OR spotter_output.real_arrival_airport_icao = :arrival_airport_icao)";
1691
-				$query_values = array_merge($query_values,array(':arrival_airport_icao' => $arrival_airport_icao));
1691
+				$query_values = array_merge($query_values, array(':arrival_airport_icao' => $arrival_airport_icao));
1692 1692
 			}
1693 1693
 		}
1694 1694
 		
@@ -1696,8 +1696,8 @@  discard block
 block discarded – undo
1696 1696
 		{
1697 1697
 			$limit_array = explode(",", $limit);
1698 1698
 			
1699
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1700
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1699
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1700
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1701 1701
 			
1702 1702
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1703 1703
 			{
@@ -1736,15 +1736,15 @@  discard block
 block discarded – undo
1736 1736
 		global $global_query;
1737 1737
 		
1738 1738
 		date_default_timezone_set('UTC');
1739
-		$filter_query = $this->getFilter($filter,true,true);
1739
+		$filter_query = $this->getFilter($filter, true, true);
1740 1740
 		$limit_query = '';
1741 1741
 		
1742 1742
 		if ($limit != "")
1743 1743
 		{
1744 1744
 			$limit_array = explode(",", $limit);
1745 1745
 			
1746
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1747
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1746
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1747
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1748 1748
 			
1749 1749
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1750 1750
 			{
@@ -1761,7 +1761,7 @@  discard block
 block discarded – undo
1761 1761
 			$orderby_query = " ORDER BY spotter_output.date DESC";
1762 1762
 		}
1763 1763
 
1764
-		$query  = $global_query.$filter_query." spotter_output.highlight <> '' ".$orderby_query;
1764
+		$query = $global_query.$filter_query." spotter_output.highlight <> '' ".$orderby_query;
1765 1765
 
1766 1766
 		$spotter_array = $this->getDataFromDB($query, array(), $limit_query);
1767 1767
 
@@ -1774,19 +1774,19 @@  discard block
 block discarded – undo
1774 1774
 	* @return String the highlight text
1775 1775
 	*
1776 1776
 	*/
1777
-	public function getHighlightByRegistration($registration,$filter = array())
1777
+	public function getHighlightByRegistration($registration, $filter = array())
1778 1778
 	{
1779 1779
 		global $global_query;
1780 1780
 		
1781 1781
 		date_default_timezone_set('UTC');
1782
-		$filter_query = $this->getFilter($filter,true,true);
1783
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
1782
+		$filter_query = $this->getFilter($filter, true, true);
1783
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
1784 1784
 		
1785
-		$query  = $global_query.$filter_query." spotter_output.highlight <> '' AND spotter_output.registration = :registration";
1785
+		$query = $global_query.$filter_query." spotter_output.highlight <> '' AND spotter_output.registration = :registration";
1786 1786
 		$sth = $this->db->prepare($query);
1787 1787
 		$sth->execute(array(':registration' => $registration));
1788 1788
 
1789
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
1789
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
1790 1790
 		{
1791 1791
 			$highlight = $row['highlight'];
1792 1792
 		}
@@ -1802,14 +1802,14 @@  discard block
 block discarded – undo
1802 1802
 	* @return String usage
1803 1803
 	*
1804 1804
 	*/
1805
-	public function getSquawkUsage($squawk = '',$country = 'FR')
1805
+	public function getSquawkUsage($squawk = '', $country = 'FR')
1806 1806
 	{
1807 1807
 		
1808
-		$squawk = filter_var($squawk,FILTER_SANITIZE_STRING);
1809
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
1808
+		$squawk = filter_var($squawk, FILTER_SANITIZE_STRING);
1809
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
1810 1810
 
1811 1811
 		$query  = "SELECT squawk.* FROM squawk WHERE squawk.code = :squawk AND squawk.country = :country LIMIT 1";
1812
-		$query_values = array(':squawk' => ltrim($squawk,'0'), ':country' => $country);
1812
+		$query_values = array(':squawk' => ltrim($squawk, '0'), ':country' => $country);
1813 1813
 		
1814 1814
 		$sth = $this->db->prepare($query);
1815 1815
 		$sth->execute($query_values);
@@ -1831,9 +1831,9 @@  discard block
 block discarded – undo
1831 1831
 	public function getAirportIcao($airport_iata = '')
1832 1832
 	{
1833 1833
 		
1834
-		$airport_iata = filter_var($airport_iata,FILTER_SANITIZE_STRING);
1834
+		$airport_iata = filter_var($airport_iata, FILTER_SANITIZE_STRING);
1835 1835
 
1836
-		$query  = "SELECT airport.* FROM airport WHERE airport.iata = :airport LIMIT 1";
1836
+		$query = "SELECT airport.* FROM airport WHERE airport.iata = :airport LIMIT 1";
1837 1837
 		$query_values = array(':airport' => $airport_iata);
1838 1838
 		
1839 1839
 		$sth = $this->db->prepare($query);
@@ -1855,12 +1855,12 @@  discard block
 block discarded – undo
1855 1855
 	* @return Float distance to the airport
1856 1856
 	*
1857 1857
 	*/
1858
-	public function getAirportDistance($airport_icao,$latitude,$longitude)
1858
+	public function getAirportDistance($airport_icao, $latitude, $longitude)
1859 1859
 	{
1860 1860
 		
1861
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
1861
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
1862 1862
 
1863
-		$query  = "SELECT airport.latitude, airport.longitude FROM airport WHERE airport.icao = :airport LIMIT 1";
1863
+		$query = "SELECT airport.latitude, airport.longitude FROM airport WHERE airport.icao = :airport LIMIT 1";
1864 1864
 		$query_values = array(':airport' => $airport_icao);
1865 1865
 		$sth = $this->db->prepare($query);
1866 1866
 		$sth->execute($query_values);
@@ -1870,7 +1870,7 @@  discard block
 block discarded – undo
1870 1870
 			$airport_latitude = $row['latitude'];
1871 1871
 			$airport_longitude = $row['longitude'];
1872 1872
 			$Common = new Common();
1873
-			return $Common->distance($latitude,$longitude,$airport_latitude,$airport_longitude);
1873
+			return $Common->distance($latitude, $longitude, $airport_latitude, $airport_longitude);
1874 1874
 		} else return '';
1875 1875
 	}
1876 1876
 	
@@ -1884,11 +1884,11 @@  discard block
 block discarded – undo
1884 1884
 	public function getAllAirportInfo($airport = '')
1885 1885
 	{
1886 1886
 		
1887
-		$airport = filter_var($airport,FILTER_SANITIZE_STRING);
1887
+		$airport = filter_var($airport, FILTER_SANITIZE_STRING);
1888 1888
 
1889 1889
 		$query_values = array();
1890 1890
 		if ($airport == 'NA') {
1891
-			return array(array('name' => 'Not available','city' => 'N/A', 'country' => 'N/A','iata' => 'NA','icao' => 'NA','altitude' => NULL,'latitude' => 0,'longitude' => 0,'type' => 'NA','home_link' => '','wikipedia_link' => '','image_thumb' => '', 'image' => ''));
1891
+			return array(array('name' => 'Not available', 'city' => 'N/A', 'country' => 'N/A', 'iata' => 'NA', 'icao' => 'NA', 'altitude' => NULL, 'latitude' => 0, 'longitude' => 0, 'type' => 'NA', 'home_link' => '', 'wikipedia_link' => '', 'image_thumb' => '', 'image' => ''));
1892 1892
 		} elseif ($airport == '') {
1893 1893
 			$query  = "SELECT airport.name, airport.city, airport.country, airport.iata, airport.icao, airport.latitude, airport.longitude, airport.altitude, airport.type, airport.home_link, airport.wikipedia_link, airport.image_thumb, airport.image FROM airport";
1894 1894
 		} else {
@@ -1936,14 +1936,14 @@  discard block
 block discarded – undo
1936 1936
 	{
1937 1937
 		$lst_countries = '';
1938 1938
 		foreach ($countries as $country) {
1939
-			$country = filter_var($country,FILTER_SANITIZE_STRING);
1939
+			$country = filter_var($country, FILTER_SANITIZE_STRING);
1940 1940
 			if ($lst_countries == '') {
1941 1941
 				$lst_countries = "'".$country."'";
1942 1942
 			} else {
1943 1943
 				$lst_countries .= ",'".$country."'";
1944 1944
 			}
1945 1945
 		}
1946
-		$query  = "SELECT airport.* FROM airport WHERE airport.country IN (".$lst_countries.")";
1946
+		$query = "SELECT airport.* FROM airport WHERE airport.country IN (".$lst_countries.")";
1947 1947
 		
1948 1948
 		$sth = $this->db->prepare($query);
1949 1949
 		$sth->execute();
@@ -1951,7 +1951,7 @@  discard block
 block discarded – undo
1951 1951
 		$airport_array = array();
1952 1952
 		$temp_array = array();
1953 1953
 		
1954
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
1954
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
1955 1955
 		{
1956 1956
 			$temp_array['name'] = $row['name'];
1957 1957
 			$temp_array['city'] = $row['city'];
@@ -1979,10 +1979,10 @@  discard block
 block discarded – undo
1979 1979
 	{
1980 1980
 		global $globalDBdriver;
1981 1981
 		if (is_array($coord)) {
1982
-			$minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1983
-			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1984
-			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1985
-			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1982
+			$minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1983
+			$minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1984
+			$maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1985
+			$maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1986 1986
 		} else return array();
1987 1987
 		if ($globalDBdriver == 'mysql') {
1988 1988
 			$query  = "SELECT airport.* FROM airport WHERE airport.latitude BETWEEN ".$minlat." AND ".$maxlat." AND airport.longitude BETWEEN ".$minlong." AND ".$maxlong." AND airport.type != 'closed'";
@@ -1994,7 +1994,7 @@  discard block
 block discarded – undo
1994 1994
     
1995 1995
 		$airport_array = array();
1996 1996
 		
1997
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
1997
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
1998 1998
 		{
1999 1999
 			$temp_array = $row;
2000 2000
 
@@ -2014,13 +2014,13 @@  discard block
 block discarded – undo
2014 2014
 	public function getAllWaypointsInfobyCoord($coord)
2015 2015
 	{
2016 2016
 		if (is_array($coord)) {
2017
-			$minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2018
-			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2019
-			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2020
-			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2017
+			$minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
2018
+			$minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
2019
+			$maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
2020
+			$maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
2021 2021
 		} else return array();
2022 2022
 		//$query  = "SELECT waypoints.* FROM waypoints WHERE waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong;
2023
-		$query  = "SELECT waypoints.* FROM waypoints WHERE (waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong.") OR (waypoints.latitude_end BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_end BETWEEN ".$minlong." AND ".$maxlong.")";
2023
+		$query = "SELECT waypoints.* FROM waypoints WHERE (waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong.") OR (waypoints.latitude_end BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_end BETWEEN ".$minlong." AND ".$maxlong.")";
2024 2024
 		//$query  = "SELECT waypoints.* FROM waypoints";
2025 2025
 		//$query  = "SELECT waypoints.* FROM waypoints INNER JOIN (SELECT waypoints.* FROM waypoints WHERE waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong.") w ON w.name_end = waypoints.name_begin OR w.name_begin = waypoints.name_begin OR w.name_begin = waypoints.name_end OR w.name_end = waypoints.name_end";
2026 2026
 		//$query = "SELECT * FROM waypoints LEFT JOIN waypoints w ON waypoints.name_end = w.name_begin WHERE waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong;
@@ -2032,7 +2032,7 @@  discard block
 block discarded – undo
2032 2032
     
2033 2033
 		$waypoints_array = array();
2034 2034
 		
2035
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2035
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2036 2036
 		{
2037 2037
 			$temp_array = $row;
2038 2038
 
@@ -2054,10 +2054,10 @@  discard block
 block discarded – undo
2054 2054
 	{
2055 2055
 		global $globalUseRealAirlines;
2056 2056
 		if (isset($globalUseRealAirlines) && $globalUseRealAirlines) $fromsource = NULL;
2057
-		$airline_icao = strtoupper(filter_var($airline_icao,FILTER_SANITIZE_STRING));
2057
+		$airline_icao = strtoupper(filter_var($airline_icao, FILTER_SANITIZE_STRING));
2058 2058
 		if ($airline_icao == 'NA') {
2059 2059
 			$airline_array = array();
2060
-			$airline_array[] = array('name' => 'Not Available','iata' => 'NA', 'icao' => 'NA', 'callsign' => '', 'country' => 'NA', 'type' =>'');
2060
+			$airline_array[] = array('name' => 'Not Available', 'iata' => 'NA', 'icao' => 'NA', 'callsign' => '', 'country' => 'NA', 'type' =>'');
2061 2061
 			return $airline_array;
2062 2062
 		} else {
2063 2063
 			if (strlen($airline_icao) == 2) {
@@ -2078,7 +2078,7 @@  discard block
 block discarded – undo
2078 2078
 			if ($fromsource === NULL) {
2079 2079
 				$sth->execute(array(':airline_icao' => $airline_icao));
2080 2080
 			} else {
2081
-				$sth->execute(array(':airline_icao' => $airline_icao,':fromsource' => $fromsource));
2081
+				$sth->execute(array(':airline_icao' => $airline_icao, ':fromsource' => $fromsource));
2082 2082
 			}
2083 2083
                         /*
2084 2084
 			$airline_array = array();
@@ -2120,13 +2120,13 @@  discard block
 block discarded – undo
2120 2120
 	{
2121 2121
 		global $globalUseRealAirlines;
2122 2122
 		if (isset($globalUseRealAirlines) && $globalUseRealAirlines) $fromsource = NULL;
2123
-		$airline_name = strtolower(filter_var($airline_name,FILTER_SANITIZE_STRING));
2124
-		$query  = "SELECT airlines.name, airlines.iata, airlines.icao, airlines.callsign, airlines.country, airlines.type FROM airlines WHERE lower(airlines.name) = :airline_name AND airlines.active = 'Y' AND airlines.forsource IS NULL LIMIT 1";
2123
+		$airline_name = strtolower(filter_var($airline_name, FILTER_SANITIZE_STRING));
2124
+		$query = "SELECT airlines.name, airlines.iata, airlines.icao, airlines.callsign, airlines.country, airlines.type FROM airlines WHERE lower(airlines.name) = :airline_name AND airlines.active = 'Y' AND airlines.forsource IS NULL LIMIT 1";
2125 2125
 		$sth = $this->db->prepare($query);
2126 2126
 		if ($fromsource === NULL) {
2127 2127
 			$sth->execute(array(':airline_name' => $airline_name));
2128 2128
 		} else {
2129
-			$sth->execute(array(':airline_name' => $airline_name,':fromsource' => $fromsource));
2129
+			$sth->execute(array(':airline_name' => $airline_name, ':fromsource' => $fromsource));
2130 2130
 		}
2131 2131
 		$result = $sth->fetchAll(PDO::FETCH_ASSOC);
2132 2132
 		if (empty($result) && $fromsource !== NULL) {
@@ -2151,12 +2151,12 @@  discard block
 block discarded – undo
2151 2151
 	*/
2152 2152
 	public function getAllAircraftInfo($aircraft_type)
2153 2153
 	{
2154
-		$aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING);
2154
+		$aircraft_type = filter_var($aircraft_type, FILTER_SANITIZE_STRING);
2155 2155
 
2156 2156
 		if ($aircraft_type == 'NA') {
2157
-			return array(array('icao' => 'NA','type' => 'Not Available', 'manufacturer' => 'Not Available', 'aircraft_shadow' => NULL));
2157
+			return array(array('icao' => 'NA', 'type' => 'Not Available', 'manufacturer' => 'Not Available', 'aircraft_shadow' => NULL));
2158 2158
 		}
2159
-		$query  = "SELECT aircraft.icao, aircraft.type,aircraft.manufacturer,aircraft.aircraft_shadow, aircraft.official_page, aircraft.aircraft_description, aircraft.engine_type, aircraft.engine_count, aircraft.wake_category FROM aircraft WHERE aircraft.icao = :aircraft_type";
2159
+		$query = "SELECT aircraft.icao, aircraft.type,aircraft.manufacturer,aircraft.aircraft_shadow, aircraft.official_page, aircraft.aircraft_description, aircraft.engine_type, aircraft.engine_count, aircraft.wake_category FROM aircraft WHERE aircraft.icao = :aircraft_type";
2160 2160
 		
2161 2161
 		$sth = $this->db->prepare($query);
2162 2162
 		$sth->execute(array(':aircraft_type' => $aircraft_type));
@@ -2188,7 +2188,7 @@  discard block
 block discarded – undo
2188 2188
 	*/
2189 2189
 	public function getAircraftIcao($aircraft_type)
2190 2190
 	{
2191
-		$aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING);
2191
+		$aircraft_type = filter_var($aircraft_type, FILTER_SANITIZE_STRING);
2192 2192
 		$all_aircraft = array('737-300' => 'B733',
2193 2193
 				'777-200' => 'B772',
2194 2194
 				'777-200ER' => 'B772',
@@ -2200,10 +2200,10 @@  discard block
 block discarded – undo
2200 2200
 				'A380' => 'A388');
2201 2201
 		if (isset($all_aircraft[$aircraft_type])) return $all_aircraft[$aircraft_type];
2202 2202
 
2203
-		$query  = "SELECT aircraft.icao FROM aircraft WHERE aircraft.type LIKE :saircraft_type OR aircraft.type = :aircraft_type OR aircraft.icao = :aircraft_type LIMIT 1";
2203
+		$query = "SELECT aircraft.icao FROM aircraft WHERE aircraft.type LIKE :saircraft_type OR aircraft.type = :aircraft_type OR aircraft.icao = :aircraft_type LIMIT 1";
2204 2204
 		$aircraft_type = strtoupper($aircraft_type);
2205 2205
 		$sth = $this->db->prepare($query);
2206
-		$sth->execute(array(':saircraft_type' => '%'.$aircraft_type.'%',':aircraft_type' => $aircraft_type,));
2206
+		$sth->execute(array(':saircraft_type' => '%'.$aircraft_type.'%', ':aircraft_type' => $aircraft_type,));
2207 2207
 		$result = $sth->fetchAll(PDO::FETCH_ASSOC);
2208 2208
 		if (isset($result[0]['icao'])) return $result[0]['icao'];
2209 2209
 		else return '';
@@ -2218,9 +2218,9 @@  discard block
 block discarded – undo
2218 2218
 	*/
2219 2219
 	public function getAllAircraftType($aircraft_modes)
2220 2220
 	{
2221
-		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
2221
+		$aircraft_modes = filter_var($aircraft_modes, FILTER_SANITIZE_STRING);
2222 2222
 
2223
-		$query  = "SELECT aircraft_modes.ICAOTypeCode FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes ORDER BY FirstCreated DESC LIMIT 1";
2223
+		$query = "SELECT aircraft_modes.ICAOTypeCode FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes ORDER BY FirstCreated DESC LIMIT 1";
2224 2224
 		
2225 2225
 		$sth = $this->db->prepare($query);
2226 2226
 		$sth->execute(array(':aircraft_modes' => $aircraft_modes));
@@ -2241,9 +2241,9 @@  discard block
 block discarded – undo
2241 2241
 	*/
2242 2242
 	public function getAllAircraftTypeByRegistration($registration)
2243 2243
 	{
2244
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
2244
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
2245 2245
 
2246
-		$query  = "SELECT aircraft_modes.ICAOTypeCode FROM aircraft_modes WHERE aircraft_modes.registration = :registration ORDER BY FirstCreated DESC LIMIT 1";
2246
+		$query = "SELECT aircraft_modes.ICAOTypeCode FROM aircraft_modes WHERE aircraft_modes.registration = :registration ORDER BY FirstCreated DESC LIMIT 1";
2247 2247
 		
2248 2248
 		$sth = $this->db->prepare($query);
2249 2249
 		$sth->execute(array(':registration' => $registration));
@@ -2264,8 +2264,8 @@  discard block
 block discarded – undo
2264 2264
 	*/
2265 2265
 	public function getOperator($operator)
2266 2266
 	{
2267
-		$operator = filter_var($operator,FILTER_SANITIZE_STRING);
2268
-		$query  = "SELECT translation.operator_correct FROM translation WHERE translation.operator = :operator LIMIT 1";
2267
+		$operator = filter_var($operator, FILTER_SANITIZE_STRING);
2268
+		$query = "SELECT translation.operator_correct FROM translation WHERE translation.operator = :operator LIMIT 1";
2269 2269
 		
2270 2270
 		$sth = $this->db->prepare($query);
2271 2271
 		$sth->execute(array(':operator' => $operator));
@@ -2286,9 +2286,9 @@  discard block
 block discarded – undo
2286 2286
 	*/
2287 2287
 	public function getRouteInfo($callsign)
2288 2288
 	{
2289
-		$callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
2289
+		$callsign = filter_var($callsign, FILTER_SANITIZE_STRING);
2290 2290
                 if ($callsign == '') return array();
2291
-		$query  = "SELECT routes.Operator_ICAO, routes.FromAirport_ICAO, routes.ToAirport_ICAO, routes.RouteStop, routes.FromAirport_Time, routes.ToAirport_Time FROM routes WHERE CallSign = :callsign LIMIT 1";
2291
+		$query = "SELECT routes.Operator_ICAO, routes.FromAirport_ICAO, routes.ToAirport_ICAO, routes.RouteStop, routes.FromAirport_Time, routes.ToAirport_Time FROM routes WHERE CallSign = :callsign LIMIT 1";
2292 2292
 		
2293 2293
 		$sth = $this->db->prepare($query);
2294 2294
 		$sth->execute(array(':callsign' => $callsign));
@@ -2309,9 +2309,9 @@  discard block
 block discarded – undo
2309 2309
 	*/
2310 2310
 	public function getAircraftInfoByRegistration($registration)
2311 2311
 	{
2312
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
2312
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
2313 2313
 
2314
-		$query  = "SELECT spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer, spotter_output.airline_icao FROM spotter_output WHERE spotter_output.registration = :registration";
2314
+		$query = "SELECT spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer, spotter_output.airline_icao FROM spotter_output WHERE spotter_output.registration = :registration";
2315 2315
 		
2316 2316
 		$sth = $this->db->prepare($query);
2317 2317
 		$sth->execute(array(':registration' => $registration));
@@ -2319,7 +2319,7 @@  discard block
 block discarded – undo
2319 2319
 		$aircraft_array = array();
2320 2320
 		$temp_array = array();
2321 2321
 		
2322
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2322
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2323 2323
 		{
2324 2324
 			$temp_array['airline_icao'] = $row['airline_icao'];
2325 2325
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
@@ -2341,7 +2341,7 @@  discard block
 block discarded – undo
2341 2341
 	*/
2342 2342
 	public function getAircraftOwnerByRegistration($registration)
2343 2343
 	{
2344
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
2344
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
2345 2345
 		$Connection = new Connection($this->db);
2346 2346
 		if ($Connection->tableExists('aircraft_owner')) {
2347 2347
 			$query  = "SELECT aircraft_owner.base, aircraft_owner.owner, aircraft_owner.date_first_reg FROM aircraft_owner WHERE registration = :registration LIMIT 1";
@@ -2363,7 +2363,7 @@  discard block
 block discarded – undo
2363 2363
 	public function getAllFlightsforSitemap()
2364 2364
 	{
2365 2365
 		//$query  = "SELECT spotter_output.spotter_id, spotter_output.ident, spotter_output.airline_name, spotter_output.aircraft_name, spotter_output.aircraft_icao FROM spotter_output ORDER BY LIMIT ";
2366
-		$query  = "SELECT spotter_output.spotter_id FROM spotter_output ORDER BY spotter_id DESC LIMIT 200 OFFSET 0";
2366
+		$query = "SELECT spotter_output.spotter_id FROM spotter_output ORDER BY spotter_id DESC LIMIT 200 OFFSET 0";
2367 2367
 		
2368 2368
 		$sth = $this->db->prepare($query);
2369 2369
 		$sth->execute();
@@ -2410,7 +2410,7 @@  discard block
 block discarded – undo
2410 2410
 		$manufacturer_array = array();
2411 2411
 		$temp_array = array();
2412 2412
 		
2413
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2413
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2414 2414
 		{
2415 2415
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
2416 2416
 
@@ -2447,7 +2447,7 @@  discard block
 block discarded – undo
2447 2447
 		$aircraft_array = array();
2448 2448
 		$temp_array = array();
2449 2449
 		
2450
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2450
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2451 2451
 		{
2452 2452
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
2453 2453
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
@@ -2468,8 +2468,8 @@  discard block
 block discarded – undo
2468 2468
 	*/
2469 2469
 	public function getAllAircraftRegistrations($filters = array())
2470 2470
 	{
2471
-		$filter_query = $this->getFilter($filters,true,true);
2472
-		$query  = "SELECT DISTINCT spotter_output.registration 
2471
+		$filter_query = $this->getFilter($filters, true, true);
2472
+		$query = "SELECT DISTINCT spotter_output.registration 
2473 2473
 				FROM spotter_output".$filter_query." spotter_output.registration <> '' 
2474 2474
 				ORDER BY spotter_output.registration ASC";
2475 2475
 
@@ -2479,7 +2479,7 @@  discard block
 block discarded – undo
2479 2479
 		$aircraft_array = array();
2480 2480
 		$temp_array = array();
2481 2481
 		
2482
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2482
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2483 2483
 		{
2484 2484
 			$temp_array['registration'] = $row['registration'];
2485 2485
 
@@ -2496,11 +2496,11 @@  discard block
 block discarded – undo
2496 2496
 	* @return Array list of source name
2497 2497
 	*
2498 2498
 	*/
2499
-	public function getAllSourceName($type = '',$filters = array())
2499
+	public function getAllSourceName($type = '', $filters = array())
2500 2500
 	{
2501
-		$filter_query = $this->getFilter($filters,true,true);
2501
+		$filter_query = $this->getFilter($filters, true, true);
2502 2502
 		$query_values = array();
2503
-		$query  = "SELECT DISTINCT spotter_output.source_name 
2503
+		$query = "SELECT DISTINCT spotter_output.source_name 
2504 2504
 				FROM spotter_output".$filter_query." spotter_output.source_name <> ''";
2505 2505
 		if ($type != '') {
2506 2506
 			$query_values = array(':type' => $type);
@@ -2515,7 +2515,7 @@  discard block
 block discarded – undo
2515 2515
 		$source_array = array();
2516 2516
 		$temp_array = array();
2517 2517
 		
2518
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2518
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2519 2519
 		{
2520 2520
 			$temp_array['source_name'] = $row['source_name'];
2521 2521
 			$source_array[] = $temp_array;
@@ -2531,11 +2531,11 @@  discard block
 block discarded – undo
2531 2531
 	* @return Array list of airline names
2532 2532
 	*
2533 2533
 	*/
2534
-	public function getAllAirlineNames($airline_type = '',$forsource = NULL,$filters = array())
2534
+	public function getAllAirlineNames($airline_type = '', $forsource = NULL, $filters = array())
2535 2535
 	{
2536
-		global $globalAirlinesSource,$globalVATSIM, $globalIVAO;
2537
-		$filter_query = $this->getFilter($filters,true,true);
2538
-		$airline_type = filter_var($airline_type,FILTER_SANITIZE_STRING);
2536
+		global $globalAirlinesSource, $globalVATSIM, $globalIVAO;
2537
+		$filter_query = $this->getFilter($filters, true, true);
2538
+		$airline_type = filter_var($airline_type, FILTER_SANITIZE_STRING);
2539 2539
 		if ($airline_type == '' || $airline_type == 'all') {
2540 2540
 			/*
2541 2541
 			$query  = "SELECT DISTINCT spotter_output.airline_icao AS airline_icao, spotter_output.airline_name AS airline_name, spotter_output.airline_type AS airline_type
@@ -2554,7 +2554,7 @@  discard block
 block discarded – undo
2554 2554
 				$query_data = array(':forsource' => $forsource);
2555 2555
 			}
2556 2556
 		} else {
2557
-			$query  = "SELECT DISTINCT spotter_output.airline_icao AS airline_icao, spotter_output.airline_name AS airline_name, spotter_output.airline_type AS airline_type
2557
+			$query = "SELECT DISTINCT spotter_output.airline_icao AS airline_icao, spotter_output.airline_name AS airline_name, spotter_output.airline_type AS airline_type
2558 2558
 					FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' 
2559 2559
 					AND spotter_output.airline_type = :airline_type 
2560 2560
 					ORDER BY spotter_output.airline_icao ASC";
@@ -2567,7 +2567,7 @@  discard block
 block discarded – undo
2567 2567
 		$airline_array = array();
2568 2568
 		$temp_array = array();
2569 2569
 		
2570
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2570
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2571 2571
 		{
2572 2572
 			$temp_array['airline_icao'] = $row['airline_icao'];
2573 2573
 			$temp_array['airline_name'] = $row['airline_name'];
@@ -2584,10 +2584,10 @@  discard block
 block discarded – undo
2584 2584
 	* @return Array list of alliance names
2585 2585
 	*
2586 2586
 	*/
2587
-	public function getAllAllianceNames($forsource = NULL,$filters = array())
2587
+	public function getAllAllianceNames($forsource = NULL, $filters = array())
2588 2588
 	{
2589
-		global $globalAirlinesSource,$globalVATSIM, $globalIVAO;
2590
-		$filter_query = $this->getFilter($filters,true,true);
2589
+		global $globalAirlinesSource, $globalVATSIM, $globalIVAO;
2590
+		$filter_query = $this->getFilter($filters, true, true);
2591 2591
 		if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $forsource = $globalAirlinesSource;
2592 2592
 		elseif (isset($globalVATSIM) && $globalVATSIM) $forsource = 'vatsim';
2593 2593
 		elseif (isset($globalIVAO) && $globalIVAO) $forsource = 'ivao';
@@ -2615,8 +2615,8 @@  discard block
 block discarded – undo
2615 2615
 	*/
2616 2616
 	public function getAllAirlineCountries($filters = array())
2617 2617
 	{
2618
-		$filter_query = $this->getFilter($filters,true,true);
2619
-		$query  = "SELECT DISTINCT spotter_output.airline_country AS airline_country
2618
+		$filter_query = $this->getFilter($filters, true, true);
2619
+		$query = "SELECT DISTINCT spotter_output.airline_country AS airline_country
2620 2620
 				FROM spotter_output".$filter_query." spotter_output.airline_country <> '' 
2621 2621
 				ORDER BY spotter_output.airline_country ASC";
2622 2622
 		
@@ -2627,7 +2627,7 @@  discard block
 block discarded – undo
2627 2627
 		$airline_array = array();
2628 2628
 		$temp_array = array();
2629 2629
 		
2630
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2630
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2631 2631
 		{
2632 2632
 			$temp_array['airline_country'] = $row['airline_country'];
2633 2633
 
@@ -2647,9 +2647,9 @@  discard block
 block discarded – undo
2647 2647
 	*/
2648 2648
 	public function getAllAirportNames($filters = array())
2649 2649
 	{
2650
-		$filter_query = $this->getFilter($filters,true,true);
2650
+		$filter_query = $this->getFilter($filters, true, true);
2651 2651
 		$airport_array = array();
2652
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_icao AS airport_icao, spotter_output.departure_airport_name AS airport_name, spotter_output.departure_airport_city AS airport_city, spotter_output.departure_airport_country AS airport_country
2652
+		$query = "SELECT DISTINCT spotter_output.departure_airport_icao AS airport_icao, spotter_output.departure_airport_name AS airport_name, spotter_output.departure_airport_city AS airport_city, spotter_output.departure_airport_country AS airport_country
2653 2653
 				FROM spotter_output".$filter_query." spotter_output.departure_airport_icao <> '' AND spotter_output.departure_airport_icao <> 'NA' 
2654 2654
 				ORDER BY spotter_output.departure_airport_city ASC";
2655 2655
 		
@@ -2658,7 +2658,7 @@  discard block
 block discarded – undo
2658 2658
 		$sth->execute();
2659 2659
 
2660 2660
 		$temp_array = array();
2661
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2661
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2662 2662
 		{
2663 2663
 			$temp_array['airport_icao'] = $row['airport_icao'];
2664 2664
 			$temp_array['airport_name'] = $row['airport_name'];
@@ -2668,14 +2668,14 @@  discard block
 block discarded – undo
2668 2668
 			$airport_array[$row['airport_city'].",".$row['airport_name']] = $temp_array;
2669 2669
 		}
2670 2670
 
2671
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_icao AS airport_icao, spotter_output.arrival_airport_name AS airport_name, spotter_output.arrival_airport_city AS airport_city, spotter_output.arrival_airport_country AS airport_country
2671
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_icao AS airport_icao, spotter_output.arrival_airport_name AS airport_name, spotter_output.arrival_airport_city AS airport_city, spotter_output.arrival_airport_country AS airport_country
2672 2672
 								FROM spotter_output".$filter_query." spotter_output.arrival_airport_icao <> '' AND spotter_output.arrival_airport_icao <> 'NA' 
2673 2673
 								ORDER BY spotter_output.arrival_airport_city ASC";
2674 2674
 					
2675 2675
 		$sth = $this->db->prepare($query);
2676 2676
 		$sth->execute();
2677 2677
 
2678
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2678
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2679 2679
 			{
2680 2680
 		//	if ($airport_array[$row['airport_city'].",".$row['airport_name']]['airport_icao'] != $row['airport_icao'])
2681 2681
 		//	{
@@ -2715,21 +2715,21 @@  discard block
 block discarded – undo
2715 2715
    
2716 2716
 		$temp_array = array();
2717 2717
 		
2718
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2718
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2719 2719
 		{
2720 2720
 			$temp_array['airport_country'] = $row['airport_country'];
2721 2721
 
2722 2722
 			$airport_array[$row['airport_country']] = $temp_array;
2723 2723
 		}
2724
-		$filter_query = $this->getFilter($filters,true,true);
2725
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country
2724
+		$filter_query = $this->getFilter($filters, true, true);
2725
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country
2726 2726
 								FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' 
2727 2727
 								ORDER BY spotter_output.arrival_airport_country ASC";
2728 2728
 					
2729 2729
 		$sth = $this->db->prepare($query);
2730 2730
 		$sth->execute();
2731 2731
 		
2732
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2732
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2733 2733
 		{
2734 2734
 			if (isset($airport_array[$row['airport_country']]['airport_country']) && $airport_array[$row['airport_country']]['airport_country'] != $row['airport_country'])
2735 2735
 			{
@@ -2752,9 +2752,9 @@  discard block
 block discarded – undo
2752 2752
 	*/
2753 2753
 	public function getAllCountries($filters = array())
2754 2754
 	{
2755
-		$Connection= new Connection($this->db);
2755
+		$Connection = new Connection($this->db);
2756 2756
 		if ($Connection->tableExists('countries')) {
2757
-			$query  = "SELECT countries.name AS airport_country
2757
+			$query = "SELECT countries.name AS airport_country
2758 2758
 				FROM countries
2759 2759
 				ORDER BY countries.name ASC";
2760 2760
 			$sth = $this->db->prepare($query);
@@ -2763,14 +2763,14 @@  discard block
 block discarded – undo
2763 2763
 			$temp_array = array();
2764 2764
 			$country_array = array();
2765 2765
 		
2766
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
2766
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2767 2767
 			{
2768 2768
 				$temp_array['country'] = $row['airport_country'];
2769 2769
 				$country_array[$row['airport_country']] = $temp_array;
2770 2770
 			}
2771 2771
 		} else {
2772
-			$filter_query = $this->getFilter($filters,true,true);
2773
-			$query  = "SELECT DISTINCT spotter_output.departure_airport_country AS airport_country
2772
+			$filter_query = $this->getFilter($filters, true, true);
2773
+			$query = "SELECT DISTINCT spotter_output.departure_airport_country AS airport_country
2774 2774
 								FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' 
2775 2775
 								ORDER BY spotter_output.departure_airport_country ASC";
2776 2776
 
@@ -2779,20 +2779,20 @@  discard block
 block discarded – undo
2779 2779
    
2780 2780
 			$temp_array = array();
2781 2781
 			$country_array = array();
2782
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
2782
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2783 2783
 			{
2784 2784
 				$temp_array['country'] = $row['airport_country'];
2785 2785
 				$country_array[$row['airport_country']] = $temp_array;
2786 2786
 			}
2787 2787
 
2788
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country
2788
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country
2789 2789
 								FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' 
2790 2790
 								ORDER BY spotter_output.arrival_airport_country ASC";
2791 2791
 					
2792 2792
 		$sth = $this->db->prepare($query);
2793 2793
 		$sth->execute();
2794 2794
 		
2795
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2795
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2796 2796
 		{
2797 2797
 			if ($country_array[$row['airport_country']]['country'] != $row['airport_country'])
2798 2798
 			{
@@ -2802,14 +2802,14 @@  discard block
 block discarded – undo
2802 2802
 			}
2803 2803
 		}
2804 2804
 		
2805
-		$query  = "SELECT DISTINCT spotter_output.airline_country AS airline_country
2805
+		$query = "SELECT DISTINCT spotter_output.airline_country AS airline_country
2806 2806
 								FROM spotter_output".$filter_query." spotter_output.airline_country <> '' 
2807 2807
 								ORDER BY spotter_output.airline_country ASC";
2808 2808
 					
2809 2809
 		$sth = $this->db->prepare($query);
2810 2810
 		$sth->execute();
2811 2811
 		
2812
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2812
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2813 2813
 		{
2814 2814
 			if (isset($country_array[$row['airline_country']]['country']) && $country_array[$row['airline_country']]['country'] != $row['airline_country'])
2815 2815
 			{
@@ -2833,8 +2833,8 @@  discard block
 block discarded – undo
2833 2833
 	*/
2834 2834
 	public function getAllIdents($filters = array())
2835 2835
 	{
2836
-		$filter_query = $this->getFilter($filters,true,true);
2837
-		$query  = "SELECT DISTINCT spotter_output.ident
2836
+		$filter_query = $this->getFilter($filters, true, true);
2837
+		$query = "SELECT DISTINCT spotter_output.ident
2838 2838
 								FROM spotter_output".$filter_query." spotter_output.ident <> '' 
2839 2839
 								ORDER BY spotter_output.date ASC LIMIT 700 OFFSET 0";
2840 2840
 
@@ -2844,7 +2844,7 @@  discard block
 block discarded – undo
2844 2844
 		$ident_array = array();
2845 2845
 		$temp_array = array();
2846 2846
 		
2847
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2847
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2848 2848
 		{
2849 2849
 			$temp_array['ident'] = $row['ident'];
2850 2850
 			$ident_array[] = $temp_array;
@@ -2858,9 +2858,9 @@  discard block
 block discarded – undo
2858 2858
 	* @return Array number, icao, name and city of airports
2859 2859
 	*/
2860 2860
 
2861
-	public function getLast7DaysAirportsDeparture($airport_icao = '',$filters = array()) {
2861
+	public function getLast7DaysAirportsDeparture($airport_icao = '', $filters = array()) {
2862 2862
 		global $globalTimezone, $globalDBdriver;
2863
-		$filter_query = $this->getFilter($filters,true,true);
2863
+		$filter_query = $this->getFilter($filters, true, true);
2864 2864
 		if ($globalTimezone != '') {
2865 2865
 			date_default_timezone_set($globalTimezone);
2866 2866
 			$datetime = new DateTime();
@@ -2925,7 +2925,7 @@  discard block
 block discarded – undo
2925 2925
 
2926 2926
 	public function getLast7DaysDetectedAirportsDeparture($airport_icao = '', $filters = array()) {
2927 2927
 		global $globalTimezone, $globalDBdriver;
2928
-		$filter_query = $this->getFilter($filters,true,true);
2928
+		$filter_query = $this->getFilter($filters, true, true);
2929 2929
 		if ($globalTimezone != '') {
2930 2930
 			date_default_timezone_set($globalTimezone);
2931 2931
 			$datetime = new DateTime();
@@ -3009,7 +3009,7 @@  discard block
 block discarded – undo
3009 3009
 
3010 3010
 	public function getLast7DaysAirportsArrival($airport_icao = '', $filters = array()) {
3011 3011
 		global $globalTimezone, $globalDBdriver;
3012
-		$filter_query = $this->getFilter($filters,true,true);
3012
+		$filter_query = $this->getFilter($filters, true, true);
3013 3013
 		if ($globalTimezone != '') {
3014 3014
 			date_default_timezone_set($globalTimezone);
3015 3015
 			$datetime = new DateTime();
@@ -3042,9 +3042,9 @@  discard block
 block discarded – undo
3042 3042
 	* @return Array number, icao, name and city of airports
3043 3043
 	*/
3044 3044
 
3045
-	public function getLast7DaysDetectedAirportsArrival($airport_icao = '',$filters = array()) {
3045
+	public function getLast7DaysDetectedAirportsArrival($airport_icao = '', $filters = array()) {
3046 3046
 		global $globalTimezone, $globalDBdriver;
3047
-		$filter_query = $this->getFilter($filters,true,true);
3047
+		$filter_query = $this->getFilter($filters, true, true);
3048 3048
 		if ($globalTimezone != '') {
3049 3049
 			date_default_timezone_set($globalTimezone);
3050 3050
 			$datetime = new DateTime();
@@ -3176,12 +3176,12 @@  discard block
 block discarded – undo
3176 3176
 		} else $offset = '+00:00';
3177 3177
 
3178 3178
 		if ($globalDBdriver == 'mysql') {
3179
-			$query  = "SELECT DISTINCT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) as date
3179
+			$query = "SELECT DISTINCT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) as date
3180 3180
 								FROM spotter_output
3181 3181
 								WHERE spotter_output.date <> '' 
3182 3182
 								ORDER BY spotter_output.date ASC LIMIT 0,200";
3183 3183
 		} else {
3184
-			$query  = "SELECT DISTINCT to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') as date
3184
+			$query = "SELECT DISTINCT to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') as date
3185 3185
 								FROM spotter_output
3186 3186
 								WHERE spotter_output.date <> '' 
3187 3187
 								ORDER BY spotter_output.date ASC LIMIT 0,200";
@@ -3193,7 +3193,7 @@  discard block
 block discarded – undo
3193 3193
 		$date_array = array();
3194 3194
 		$temp_array = array();
3195 3195
 		
3196
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3196
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3197 3197
 		{
3198 3198
 			$temp_array['date'] = $row['date'];
3199 3199
 
@@ -3213,7 +3213,7 @@  discard block
 block discarded – undo
3213 3213
 	*/
3214 3214
 	public function getAllRoutes()
3215 3215
 	{
3216
-		$query  = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route,  spotter_output.departure_airport_icao, spotter_output.arrival_airport_icao 
3216
+		$query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route,  spotter_output.departure_airport_icao, spotter_output.arrival_airport_icao 
3217 3217
 				FROM spotter_output
3218 3218
 				WHERE spotter_output.ident <> '' 
3219 3219
 				GROUP BY route
@@ -3224,7 +3224,7 @@  discard block
 block discarded – undo
3224 3224
 
3225 3225
 		$routes_array = array();
3226 3226
 		$temp_array = array();
3227
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3227
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3228 3228
 		{
3229 3229
 			$temp_array['route'] = $row['route'];
3230 3230
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -3243,21 +3243,21 @@  discard block
 block discarded – undo
3243 3243
 	* @return String success or false
3244 3244
 	*
3245 3245
 	*/	
3246
-	public function updateIdentSpotterData($flightaware_id = '', $ident = '',$fromsource = NULL)
3246
+	public function updateIdentSpotterData($flightaware_id = '', $ident = '', $fromsource = NULL)
3247 3247
 	{
3248 3248
 		if (!is_numeric(substr($ident, 0, 3)))
3249 3249
 		{
3250 3250
 			if (is_numeric(substr(substr($ident, 0, 3), -1, 1))) {
3251
-				$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2),$fromsource);
3251
+				$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2), $fromsource);
3252 3252
 			} elseif (is_numeric(substr(substr($ident, 0, 4), -1, 1))) {
3253
-				$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3),$fromsource);
3253
+				$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3), $fromsource);
3254 3254
 			} else {
3255 3255
 				$airline_array = $this->getAllAirlineInfo("NA");
3256 3256
 			}
3257 3257
 			if (count($airline_array) == 0) {
3258 3258
 				$airline_array = $this->getAllAirlineInfo("NA");
3259 3259
 			}
3260
-			if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == ""){
3260
+			if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == "") {
3261 3261
 				$airline_array = $this->getAllAirlineInfo("NA");
3262 3262
 			}
3263 3263
 		} else {
@@ -3270,7 +3270,7 @@  discard block
 block discarded – undo
3270 3270
 
3271 3271
 
3272 3272
 		$query = 'UPDATE spotter_output SET ident = :ident, airline_name = :airline_name, airline_icao = :airline_icao, airline_country = :airline_country, airline_type = :airline_type WHERE flightaware_id = :flightaware_id';
3273
-                $query_values = array(':flightaware_id' => $flightaware_id,':ident' => $ident,':airline_name' => $airline_name,':airline_icao' => $airline_icao,':airline_country' => $airline_country,':airline_type' => $airline_type);
3273
+                $query_values = array(':flightaware_id' => $flightaware_id, ':ident' => $ident, ':airline_name' => $airline_name, ':airline_icao' => $airline_icao, ':airline_country' => $airline_country, ':airline_type' => $airline_type);
3274 3274
 
3275 3275
 		try {
3276 3276
 			$sth = $this->db->prepare($query);
@@ -3291,11 +3291,11 @@  discard block
 block discarded – undo
3291 3291
 	* @return String success or false
3292 3292
 	*
3293 3293
 	*/	
3294
-	public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '',$arrival_airport_time = '')
3294
+	public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '', $arrival_airport_time = '')
3295 3295
 	{
3296 3296
 		if ($groundspeed == '') $groundspeed = NULL;
3297 3297
 		$query = 'UPDATE spotter_output SET ident = :ident, last_latitude = :last_latitude, last_longitude = :last_longitude, last_altitude = :last_altitude, last_ground = :last_ground, last_seen = :last_seen, real_arrival_airport_icao = :real_arrival_airport_icao, real_arrival_airport_time = :real_arrival_airport_time, last_ground_speed = :last_ground_speed WHERE flightaware_id = :flightaware_id';
3298
-                $query_values = array(':flightaware_id' => $flightaware_id,':real_arrival_airport_icao' => $arrival_airport_icao,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_altitude' => $altitude,':last_ground_speed' => $groundspeed,':last_seen' => $date,':real_arrival_airport_time' => $arrival_airport_time, ':last_ground' => $ground, ':ident' => $ident);
3298
+                $query_values = array(':flightaware_id' => $flightaware_id, ':real_arrival_airport_icao' => $arrival_airport_icao, ':last_latitude' => $latitude, ':last_longitude' => $longitude, ':last_altitude' => $altitude, ':last_ground_speed' => $groundspeed, ':last_seen' => $date, ':real_arrival_airport_time' => $arrival_airport_time, ':last_ground' => $ground, ':ident' => $ident);
3299 3299
 
3300 3300
 		try {
3301 3301
 			$sth = $this->db->prepare($query);
@@ -3335,7 +3335,7 @@  discard block
 block discarded – undo
3335 3335
 	* @param String $verticalrate vertival rate of flight
3336 3336
 	* @return String success or false
3337 3337
 	*/
3338
-	public function addSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $departure_airport_time = '', $arrival_airport_time = '',$squawk = '', $route_stop = '', $highlight = '', $ModeS = '', $registration = '',$pilot_id = '', $pilot_name = '', $verticalrate = '', $ground = false,$format_source = '', $source_name = '')
3338
+	public function addSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $departure_airport_time = '', $arrival_airport_time = '', $squawk = '', $route_stop = '', $highlight = '', $ModeS = '', $registration = '', $pilot_id = '', $pilot_name = '', $verticalrate = '', $ground = false, $format_source = '', $source_name = '')
3339 3339
 	{
3340 3340
 		global $globalURL, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalDebugTimeElapsed, $globalAirlinesSource, $globalVAM;
3341 3341
 		
@@ -3359,13 +3359,13 @@  discard block
 block discarded – undo
3359 3359
 				if ($ModeS != '') {
3360 3360
 					$timeelapsed = microtime(true);
3361 3361
 					$registration = $this->getAircraftRegistrationBymodeS($ModeS);
3362
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3362
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3363 3363
 				} else {
3364
-					$myhex = explode('-',$flightaware_id);
3364
+					$myhex = explode('-', $flightaware_id);
3365 3365
 					if (count($myhex) > 0) {
3366 3366
 						$timeelapsed = microtime(true);
3367 3367
 						$registration = $this->getAircraftRegistrationBymodeS($myhex[0]);
3368
-						if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3368
+						if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3369 3369
 					}
3370 3370
 				}
3371 3371
 			}
@@ -3387,24 +3387,24 @@  discard block
 block discarded – undo
3387 3387
 				{
3388 3388
 					$timeelapsed = microtime(true);
3389 3389
 					if (is_numeric(substr(substr($ident, 0, 3), -1, 1))) {
3390
-						$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2),$fromsource);
3390
+						$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2), $fromsource);
3391 3391
 					} elseif (is_numeric(substr(substr($ident, 0, 4), -1, 1))) {
3392
-						$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3),$fromsource);
3392
+						$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3), $fromsource);
3393 3393
 					} else {
3394 3394
 						$airline_array = $this->getAllAirlineInfo("NA");
3395 3395
 					}
3396 3396
 					if (count($airline_array) == 0) {
3397 3397
 						$airline_array = $this->getAllAirlineInfo("NA");
3398 3398
 					}
3399
-					if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == ""){
3399
+					if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == "") {
3400 3400
 						$airline_array = $this->getAllAirlineInfo("NA");
3401 3401
 					}
3402
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3402
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3403 3403
 
3404 3404
 				} else {
3405 3405
 					$timeelapsed = microtime(true);
3406 3406
 					$airline_array = $this->getAllAirlineInfo("NA");
3407
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3407
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3408 3408
 				}
3409 3409
 			}
3410 3410
 		} else $airline_array = array();
@@ -3421,27 +3421,27 @@  discard block
 block discarded – undo
3421 3421
 				{
3422 3422
 					$timeelapsed = microtime(true);
3423 3423
 					$aircraft_array = $this->getAllAircraftInfo("NA");
3424
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3424
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3425 3425
 				} else {
3426 3426
 					$timeelapsed = microtime(true);
3427 3427
 					$aircraft_array = $this->getAllAircraftInfo($aircraft_icao);
3428
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3428
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3429 3429
 				}
3430 3430
 			}
3431 3431
 		} else {
3432 3432
 			if ($ModeS != '') {
3433 3433
 				$timeelapsed = microtime(true);
3434 3434
 				$aircraft_icao = $this->getAllAircraftType($ModeS);
3435
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3435
+				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3436 3436
 				if ($aircraft_icao == "" || $aircraft_icao == "XXXX")
3437 3437
 				{
3438 3438
 					$timeelapsed = microtime(true);
3439 3439
 					$aircraft_array = $this->getAllAircraftInfo("NA");
3440
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3440
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3441 3441
 				} else {
3442 3442
 					$timeelapsed = microtime(true);
3443 3443
 					$aircraft_array = $this->getAllAircraftInfo($aircraft_icao);
3444
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3444
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3445 3445
 				}
3446 3446
 			}
3447 3447
 		}
@@ -3457,7 +3457,7 @@  discard block
 block discarded – undo
3457 3457
 			} else {
3458 3458
 				$timeelapsed = microtime(true);
3459 3459
 				$departure_airport_array = $this->getAllAirportInfo($departure_airport_icao);
3460
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3460
+				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3461 3461
 			}
3462 3462
 		}
3463 3463
 		
@@ -3472,7 +3472,7 @@  discard block
 block discarded – undo
3472 3472
 			} else {
3473 3473
 				$timeelapsed = microtime(true);
3474 3474
 				$arrival_airport_array = $this->getAllAirportInfo($arrival_airport_icao);
3475
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3475
+				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3476 3476
 			}
3477 3477
 		}
3478 3478
 
@@ -3535,7 +3535,7 @@  discard block
 block discarded – undo
3535 3535
 		{
3536 3536
 			$timeelapsed = microtime(true);
3537 3537
 			$image_array = $Image->getSpotterImage($registration);
3538
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3538
+			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3539 3539
 			if (!isset($image_array[0]['registration']))
3540 3540
 			{
3541 3541
 				//echo "Add image !!!! \n";
@@ -3543,7 +3543,7 @@  discard block
 block discarded – undo
3543 3543
 			}
3544 3544
 			$timeelapsed = microtime(true);
3545 3545
 			$owner_info = $this->getAircraftOwnerByRegistration($registration);
3546
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3546
+			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3547 3547
 			if ($owner_info['owner'] != '') $aircraft_owner = ucwords(strtolower($owner_info['owner']));
3548 3548
 		}
3549 3549
     
@@ -3551,33 +3551,33 @@  discard block
 block discarded – undo
3551 3551
 		{
3552 3552
             		if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao'];
3553 3553
             		else $airline_icao = '';
3554
-			$image_array = $Image->getSpotterImage('',$aircraft_icao,$airline_icao);
3554
+			$image_array = $Image->getSpotterImage('', $aircraft_icao, $airline_icao);
3555 3555
 			if (!isset($image_array[0]['registration']))
3556 3556
 			{
3557 3557
 				//echo "Add image !!!! \n";
3558
-				$Image->addSpotterImage('',$aircraft_icao,$airline_icao);
3558
+				$Image->addSpotterImage('', $aircraft_icao, $airline_icao);
3559 3559
 			}
3560 3560
 		}
3561 3561
     
3562
-		$flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING);
3563
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
3564
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
3565
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
3566
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
3567
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
3568
-		$latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
3569
-		$longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
3570
-		$waypoints = filter_var($waypoints,FILTER_SANITIZE_STRING);
3571
-		$altitude = filter_var($altitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
3572
-		$heading = filter_var($heading,FILTER_SANITIZE_NUMBER_INT);
3573
-		$groundspeed = filter_var($groundspeed,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
3574
-		$squawk = filter_var($squawk,FILTER_SANITIZE_NUMBER_INT);
3575
-		$route_stop = filter_var($route_stop,FILTER_SANITIZE_STRING);
3576
-		$ModeS = filter_var($ModeS,FILTER_SANITIZE_STRING);
3577
-		$pilot_id = filter_var($pilot_id,FILTER_SANITIZE_STRING);
3578
-		$pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING);
3579
-		$format_source = filter_var($format_source,FILTER_SANITIZE_STRING);
3580
-		$verticalrate = filter_var($verticalrate,FILTER_SANITIZE_NUMBER_INT);
3562
+		$flightaware_id = filter_var($flightaware_id, FILTER_SANITIZE_STRING);
3563
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
3564
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
3565
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
3566
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
3567
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
3568
+		$latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
3569
+		$longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
3570
+		$waypoints = filter_var($waypoints, FILTER_SANITIZE_STRING);
3571
+		$altitude = filter_var($altitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
3572
+		$heading = filter_var($heading, FILTER_SANITIZE_NUMBER_INT);
3573
+		$groundspeed = filter_var($groundspeed, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
3574
+		$squawk = filter_var($squawk, FILTER_SANITIZE_NUMBER_INT);
3575
+		$route_stop = filter_var($route_stop, FILTER_SANITIZE_STRING);
3576
+		$ModeS = filter_var($ModeS, FILTER_SANITIZE_STRING);
3577
+		$pilot_id = filter_var($pilot_id, FILTER_SANITIZE_STRING);
3578
+		$pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING);
3579
+		$format_source = filter_var($format_source, FILTER_SANITIZE_STRING);
3580
+		$verticalrate = filter_var($verticalrate, FILTER_SANITIZE_NUMBER_INT);
3581 3581
 	
3582 3582
 		if (count($airline_array) == 0) 
3583 3583
 		{
@@ -3605,7 +3605,7 @@  discard block
 block discarded – undo
3605 3605
                 if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
3606 3606
                 if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
3607 3607
                 if (!isset($aircraft_owner)) $aircraft_owner = NULL;
3608
-                $query  = "INSERT INTO spotter_output (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, latitude, longitude, waypoints, altitude, heading, ground_speed, date, departure_airport_time, arrival_airport_time, squawk, route_stop,highlight,ModeS, pilot_id, pilot_name, verticalrate, owner_name, ground, format_source, source_name) 
3608
+                $query = "INSERT INTO spotter_output (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, latitude, longitude, waypoints, altitude, heading, ground_speed, date, departure_airport_time, arrival_airport_time, squawk, route_stop,highlight,ModeS, pilot_id, pilot_name, verticalrate, owner_name, ground, format_source, source_name) 
3609 3609
                 VALUES (:flightaware_id,:ident,:registration,:airline_name,:airline_icao,:airline_country,:airline_type,:aircraft_icao,:aircraft_type,:aircraft_manufacturer,:departure_airport_icao,:departure_airport_name,:departure_airport_city,:departure_airport_country, :arrival_airport_icao, :arrival_airport_name, :arrival_airport_city, :arrival_airport_country, :latitude,:longitude,:waypoints,:altitude,:heading,:groundspeed,:date, :departure_airport_time, :arrival_airport_time, :squawk, :route_stop, :highlight, :ModeS, :pilot_id, :pilot_name, :verticalrate, :owner_name,:ground, :format_source, :source_name)";
3610 3610
 
3611 3611
                 $airline_name = $airline_array[0]['name'];
@@ -3615,7 +3615,7 @@  discard block
 block discarded – undo
3615 3615
 		if ($airline_type == '') {
3616 3616
 			$timeelapsed = microtime(true);
3617 3617
 			$airline_type = $this->getAircraftTypeBymodeS($ModeS);
3618
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3618
+			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3619 3619
 		}
3620 3620
 		if ($airline_type == null) $airline_type = '';
3621 3621
                 $aircraft_type = $aircraft_array[0]['type'];
@@ -3627,7 +3627,7 @@  discard block
 block discarded – undo
3627 3627
                 $arrival_airport_name = $arrival_airport_array[0]['name'];
3628 3628
                 $arrival_airport_city = $arrival_airport_array[0]['city'];
3629 3629
                 $arrival_airport_country = $arrival_airport_array[0]['country'];
3630
-                $query_values = array(':flightaware_id' => $flightaware_id,':ident' => $ident, ':registration' => $registration,':airline_name' => $airline_name,':airline_icao' => $airline_icao,':airline_country' => $airline_country,':airline_type' => $airline_type,':aircraft_icao' => $aircraft_icao,':aircraft_type' => $aircraft_type,':aircraft_manufacturer' => $aircraft_manufacturer,':departure_airport_icao' => $departure_airport_icao,':departure_airport_name' => $departure_airport_name,':departure_airport_city' => $departure_airport_city,':departure_airport_country' => $departure_airport_country,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_name' => $arrival_airport_name,':arrival_airport_city' => $arrival_airport_city,':arrival_airport_country' => $arrival_airport_country,':latitude' => $latitude,':longitude' => $longitude, ':waypoints' => $waypoints,':altitude' => $altitude,':heading' => $heading,':groundspeed' => $groundspeed,':date' => $date,':departure_airport_time' => $departure_airport_time,':arrival_airport_time' => $arrival_airport_time, ':squawk' => $squawk, ':route_stop' => $route_stop, ':highlight' => $highlight, ':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':owner_name' => $aircraft_owner, ':format_source' => $format_source, ':ground' => $ground, ':source_name' => $source_name);
3630
+                $query_values = array(':flightaware_id' => $flightaware_id, ':ident' => $ident, ':registration' => $registration, ':airline_name' => $airline_name, ':airline_icao' => $airline_icao, ':airline_country' => $airline_country, ':airline_type' => $airline_type, ':aircraft_icao' => $aircraft_icao, ':aircraft_type' => $aircraft_type, ':aircraft_manufacturer' => $aircraft_manufacturer, ':departure_airport_icao' => $departure_airport_icao, ':departure_airport_name' => $departure_airport_name, ':departure_airport_city' => $departure_airport_city, ':departure_airport_country' => $departure_airport_country, ':arrival_airport_icao' => $arrival_airport_icao, ':arrival_airport_name' => $arrival_airport_name, ':arrival_airport_city' => $arrival_airport_city, ':arrival_airport_country' => $arrival_airport_country, ':latitude' => $latitude, ':longitude' => $longitude, ':waypoints' => $waypoints, ':altitude' => $altitude, ':heading' => $heading, ':groundspeed' => $groundspeed, ':date' => $date, ':departure_airport_time' => $departure_airport_time, ':arrival_airport_time' => $arrival_airport_time, ':squawk' => $squawk, ':route_stop' => $route_stop, ':highlight' => $highlight, ':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':owner_name' => $aircraft_owner, ':format_source' => $format_source, ':ground' => $ground, ':source_name' => $source_name);
3631 3631
 
3632 3632
 		try {
3633 3633
 		        
@@ -3653,13 +3653,13 @@  discard block
 block discarded – undo
3653 3653
 	{
3654 3654
 		global $globalDBdriver, $globalTimezone;
3655 3655
 		if ($globalDBdriver == 'mysql') {
3656
-			$query  = "SELECT spotter_output.ident FROM spotter_output 
3656
+			$query = "SELECT spotter_output.ident FROM spotter_output 
3657 3657
 								WHERE spotter_output.ident = :ident 
3658 3658
 								AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) 
3659 3659
 								AND spotter_output.date < UTC_TIMESTAMP()";
3660 3660
 			$query_data = array(':ident' => $ident);
3661 3661
 		} else {
3662
-			$query  = "SELECT spotter_output.ident FROM spotter_output 
3662
+			$query = "SELECT spotter_output.ident FROM spotter_output 
3663 3663
 								WHERE spotter_output.ident = :ident 
3664 3664
 								AND spotter_output.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS'
3665 3665
 								AND spotter_output.date < now() AT TIME ZONE 'UTC'";
@@ -3668,8 +3668,8 @@  discard block
 block discarded – undo
3668 3668
 		
3669 3669
 		$sth = $this->db->prepare($query);
3670 3670
 		$sth->execute($query_data);
3671
-    		$ident_result='';
3672
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3671
+    		$ident_result = '';
3672
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3673 3673
 		{
3674 3674
 			$ident_result = $row['ident'];
3675 3675
 		}
@@ -3695,8 +3695,8 @@  discard block
 block discarded – undo
3695 3695
 				return false;
3696 3696
 			} else {
3697 3697
 				$q_array = explode(" ", $q);
3698
-				foreach ($q_array as $q_item){
3699
-					$q_item = filter_var($q_item,FILTER_SANITIZE_STRING);
3698
+				foreach ($q_array as $q_item) {
3699
+					$q_item = filter_var($q_item, FILTER_SANITIZE_STRING);
3700 3700
 					$additional_query .= " AND (";
3701 3701
 					$additional_query .= "(spotter_output.aircraft_icao like '%".$q_item."%') OR ";
3702 3702
 					$additional_query .= "(spotter_output.aircraft_name like '%".$q_item."%') OR ";
@@ -3711,11 +3711,11 @@  discard block
 block discarded – undo
3711 3711
 			}
3712 3712
 		}
3713 3713
 		if ($globalDBdriver == 'mysql') {
3714
-			$query  = "SELECT spotter_output.* FROM spotter_output 
3714
+			$query = "SELECT spotter_output.* FROM spotter_output 
3715 3715
 				WHERE spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 20 SECOND) ".$additional_query." 
3716 3716
 				AND spotter_output.date < UTC_TIMESTAMP()";
3717 3717
 		} else {
3718
-			$query  = "SELECT spotter_output.* FROM spotter_output 
3718
+			$query = "SELECT spotter_output.* FROM spotter_output 
3719 3719
 				WHERE spotter_output.date::timestamp >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '20 SECONDS' ".$additional_query." 
3720 3720
 				AND spotter_output.date::timestamp < CURRENT_TIMESTAMP AT TIME ZONE 'UTC'";
3721 3721
 		}
@@ -3732,11 +3732,11 @@  discard block
 block discarded – undo
3732 3732
 	* @return Array the airline list
3733 3733
 	*
3734 3734
 	*/
3735
-	public function countAllAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
3735
+	public function countAllAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
3736 3736
 	{
3737 3737
 		global $globalDBdriver;
3738
-		$filter_query = $this->getFilter($filters,true,true);
3739
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
3738
+		$filter_query = $this->getFilter($filters, true, true);
3739
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
3740 3740
 		 			FROM spotter_output".$filter_query." spotter_output.airline_name <> '' AND spotter_output.airline_icao <> 'NA' ";
3741 3741
 		if ($olderthanmonths > 0) {
3742 3742
 			if ($globalDBdriver == 'mysql') {
@@ -3760,7 +3760,7 @@  discard block
 block discarded – undo
3760 3760
  
3761 3761
 		$airline_array = array();
3762 3762
 		$temp_array = array();
3763
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3763
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3764 3764
 		{
3765 3765
 			$temp_array['airline_name'] = $row['airline_name'];
3766 3766
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -3777,11 +3777,11 @@  discard block
 block discarded – undo
3777 3777
 	* @return Array the pilots list
3778 3778
 	*
3779 3779
 	*/
3780
-	public function countAllPilots($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
3780
+	public function countAllPilots($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
3781 3781
 	{
3782 3782
 		global $globalDBdriver;
3783
-		$filter_query = $this->getFilter($filters,true,true);
3784
-		$query  = "SELECT DISTINCT spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count, spotter_output.format_source
3783
+		$filter_query = $this->getFilter($filters, true, true);
3784
+		$query = "SELECT DISTINCT spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count, spotter_output.format_source
3785 3785
 		 			FROM spotter_output".$filter_query." spotter_output.pilot_id <> '' ";
3786 3786
                 if ($olderthanmonths > 0) {
3787 3787
             		if ($globalDBdriver == 'mysql') {
@@ -3807,7 +3807,7 @@  discard block
 block discarded – undo
3807 3807
 		$airline_array = array();
3808 3808
 		$temp_array = array();
3809 3809
         
3810
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3810
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3811 3811
 		{
3812 3812
 			$temp_array['pilot_name'] = $row['pilot_name'];
3813 3813
 			$temp_array['pilot_id'] = $row['pilot_id'];
@@ -3827,7 +3827,7 @@  discard block
 block discarded – undo
3827 3827
 	public function countAllPilotsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '')
3828 3828
 	{
3829 3829
 		global $globalDBdriver;
3830
-		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count, spotter_output.format_source
3830
+		$query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count, spotter_output.format_source
3831 3831
 		 			FROM spotter_output WHERE spotter_output.pilot_id <> '' ";
3832 3832
                 if ($olderthanmonths > 0) {
3833 3833
             		if ($globalDBdriver == 'mysql') {
@@ -3853,7 +3853,7 @@  discard block
 block discarded – undo
3853 3853
 		$airline_array = array();
3854 3854
 		$temp_array = array();
3855 3855
         
3856
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3856
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3857 3857
 		{
3858 3858
 			$temp_array['pilot_name'] = $row['pilot_name'];
3859 3859
 			$temp_array['pilot_id'] = $row['pilot_id'];
@@ -3871,11 +3871,11 @@  discard block
 block discarded – undo
3871 3871
 	* @return Array the pilots list
3872 3872
 	*
3873 3873
 	*/
3874
-	public function countAllOwners($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
3874
+	public function countAllOwners($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
3875 3875
 	{
3876 3876
 		global $globalDBdriver;
3877
-		$filter_query = $this->getFilter($filters,true,true);
3878
-		$query  = "SELECT DISTINCT spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
3877
+		$filter_query = $this->getFilter($filters, true, true);
3878
+		$query = "SELECT DISTINCT spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
3879 3879
 		 			FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL ";
3880 3880
                 if ($olderthanmonths > 0) {
3881 3881
             		if ($globalDBdriver == 'mysql') {
@@ -3901,7 +3901,7 @@  discard block
 block discarded – undo
3901 3901
 		$airline_array = array();
3902 3902
 		$temp_array = array();
3903 3903
         
3904
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3904
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3905 3905
 		{
3906 3906
 			$temp_array['owner_name'] = $row['owner_name'];
3907 3907
 			$temp_array['owner_count'] = $row['owner_count'];
@@ -3916,11 +3916,11 @@  discard block
 block discarded – undo
3916 3916
 	* @return Array the pilots list
3917 3917
 	*
3918 3918
 	*/
3919
-	public function countAllOwnersByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
3919
+	public function countAllOwnersByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
3920 3920
 	{
3921 3921
 		global $globalDBdriver;
3922
-		$filter_query = $this->getFilter($filters,true,true);
3923
-		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
3922
+		$filter_query = $this->getFilter($filters, true, true);
3923
+		$query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
3924 3924
 		 			FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL ";
3925 3925
                 if ($olderthanmonths > 0) {
3926 3926
             		if ($globalDBdriver == 'mysql') {
@@ -3946,7 +3946,7 @@  discard block
 block discarded – undo
3946 3946
 		$airline_array = array();
3947 3947
 		$temp_array = array();
3948 3948
         
3949
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3949
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3950 3950
 		{
3951 3951
 			$temp_array['owner_name'] = $row['owner_name'];
3952 3952
 			$temp_array['owner_count'] = $row['owner_count'];
@@ -3962,11 +3962,11 @@  discard block
 block discarded – undo
3962 3962
 	* @return Array the airline list
3963 3963
 	*
3964 3964
 	*/
3965
-	public function countAllAirlinesByAircraft($aircraft_icao,$filters = array())
3965
+	public function countAllAirlinesByAircraft($aircraft_icao, $filters = array())
3966 3966
 	{
3967
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
3968
-		$filter_query = $this->getFilter($filters,true,true);
3969
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
3967
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
3968
+		$filter_query = $this->getFilter($filters, true, true);
3969
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
3970 3970
 		 	    FROM spotter_output".$filter_query." spotter_output.airline_name <> '' AND spotter_output.aircraft_icao = :aircraft_icao 
3971 3971
 			    GROUP BY spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country 
3972 3972
 			    ORDER BY airline_count DESC";
@@ -3978,7 +3978,7 @@  discard block
 block discarded – undo
3978 3978
 		$airline_array = array();
3979 3979
 		$temp_array = array();
3980 3980
         
3981
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3981
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3982 3982
 		{
3983 3983
 			$temp_array['airline_name'] = $row['airline_name'];
3984 3984
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -3998,11 +3998,11 @@  discard block
 block discarded – undo
3998 3998
 	* @return Array the airline country list
3999 3999
 	*
4000 4000
 	*/
4001
-	public function countAllAirlineCountriesByAircraft($aircraft_icao,$filters = array())
4001
+	public function countAllAirlineCountriesByAircraft($aircraft_icao, $filters = array())
4002 4002
 	{
4003
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
4004
-		$filter_query = $this->getFilter($filters,true,true);
4005
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4003
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
4004
+		$filter_query = $this->getFilter($filters, true, true);
4005
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4006 4006
 		 			FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND spotter_output.aircraft_icao = :aircraft_icao
4007 4007
                     GROUP BY spotter_output.airline_country
4008 4008
 					ORDER BY airline_country_count DESC
@@ -4015,7 +4015,7 @@  discard block
 block discarded – undo
4015 4015
 		$airline_country_array = array();
4016 4016
 		$temp_array = array();
4017 4017
         
4018
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4018
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4019 4019
 		{
4020 4020
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4021 4021
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4034,11 +4034,11 @@  discard block
 block discarded – undo
4034 4034
 	* @return Array the airline list
4035 4035
 	*
4036 4036
 	*/
4037
-	public function countAllAirlinesByAirport($airport_icao,$filters = array())
4037
+	public function countAllAirlinesByAirport($airport_icao, $filters = array())
4038 4038
 	{
4039
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
4040
-		$filter_query = $this->getFilter($filters,true,true);
4041
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4039
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
4040
+		$filter_query = $this->getFilter($filters, true, true);
4041
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4042 4042
 		    FROM spotter_output".$filter_query." spotter_output.airline_name <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao ) 
4043 4043
                     GROUP BY spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country
4044 4044
 		    ORDER BY airline_count DESC";
@@ -4050,7 +4050,7 @@  discard block
 block discarded – undo
4050 4050
 		$airline_array = array();
4051 4051
 		$temp_array = array();
4052 4052
         
4053
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4053
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4054 4054
 		{
4055 4055
 			$temp_array['airline_name'] = $row['airline_name'];
4056 4056
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4069,11 +4069,11 @@  discard block
 block discarded – undo
4069 4069
 	* @return Array the airline country list
4070 4070
 	*
4071 4071
 	*/
4072
-	public function countAllAirlineCountriesByAirport($airport_icao,$filters = array())
4072
+	public function countAllAirlineCountriesByAirport($airport_icao, $filters = array())
4073 4073
 	{
4074
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
4075
-		$filter_query = $this->getFilter($filters,true,true);
4076
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4074
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
4075
+		$filter_query = $this->getFilter($filters, true, true);
4076
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4077 4077
 		 			FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao )
4078 4078
 					GROUP BY spotter_output.airline_country
4079 4079
 					ORDER BY airline_country_count DESC
@@ -4086,7 +4086,7 @@  discard block
 block discarded – undo
4086 4086
 		$airline_country_array = array();
4087 4087
 		$temp_array = array();
4088 4088
         
4089
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4089
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4090 4090
 		{
4091 4091
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4092 4092
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4103,11 +4103,11 @@  discard block
 block discarded – undo
4103 4103
 	* @return Array the airline list
4104 4104
 	*
4105 4105
 	*/
4106
-	public function countAllAirlinesByManufacturer($aircraft_manufacturer,$filters = array())
4106
+	public function countAllAirlinesByManufacturer($aircraft_manufacturer, $filters = array())
4107 4107
 	{
4108
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
4109
-		$filter_query = $this->getFilter($filters,true,true);
4110
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4108
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
4109
+		$filter_query = $this->getFilter($filters, true, true);
4110
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4111 4111
 		 			FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer = :aircraft_manufacturer 
4112 4112
 					GROUP BY spotter_output.airline_name
4113 4113
 					ORDER BY airline_count DESC";
@@ -4118,7 +4118,7 @@  discard block
 block discarded – undo
4118 4118
 		$airline_array = array();
4119 4119
 		$temp_array = array();
4120 4120
         
4121
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4121
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4122 4122
 		{
4123 4123
 			$temp_array['airline_name'] = $row['airline_name'];
4124 4124
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4138,11 +4138,11 @@  discard block
 block discarded – undo
4138 4138
 	* @return Array the airline country list
4139 4139
 	*
4140 4140
 	*/
4141
-	public function countAllAirlineCountriesByManufacturer($aircraft_manufacturer,$filters = array())
4141
+	public function countAllAirlineCountriesByManufacturer($aircraft_manufacturer, $filters = array())
4142 4142
 	{
4143
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
4144
-		$filter_query = $this->getFilter($filters,true,true);
4145
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4143
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
4144
+		$filter_query = $this->getFilter($filters, true, true);
4145
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4146 4146
 		 			FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer 
4147 4147
 					GROUP BY spotter_output.airline_country
4148 4148
 					ORDER BY airline_country_count DESC
@@ -4155,7 +4155,7 @@  discard block
 block discarded – undo
4155 4155
 		$airline_country_array = array();
4156 4156
 		$temp_array = array();
4157 4157
         
4158
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4158
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4159 4159
 		{
4160 4160
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4161 4161
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4171,11 +4171,11 @@  discard block
 block discarded – undo
4171 4171
 	* @return Array the airline list
4172 4172
 	*
4173 4173
 	*/
4174
-	public function countAllAirlinesByDate($date,$filters = array())
4174
+	public function countAllAirlinesByDate($date, $filters = array())
4175 4175
 	{
4176 4176
 		global $globalTimezone, $globalDBdriver;
4177
-		$filter_query = $this->getFilter($filters,true,true);
4178
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
4177
+		$filter_query = $this->getFilter($filters, true, true);
4178
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
4179 4179
 		if ($globalTimezone != '') {
4180 4180
 			date_default_timezone_set($globalTimezone);
4181 4181
 			$datetime = new DateTime($date);
@@ -4183,12 +4183,12 @@  discard block
 block discarded – undo
4183 4183
 		} else $offset = '+00:00';
4184 4184
 
4185 4185
 		if ($globalDBdriver == 'mysql') {
4186
-			$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4186
+			$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4187 4187
 		 			FROM spotter_output".$filter_query." DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
4188 4188
 					GROUP BY spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country 
4189 4189
 					ORDER BY airline_count DESC";
4190 4190
 		} else {
4191
-			$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4191
+			$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4192 4192
 		 			FROM spotter_output".$filter_query." to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date 
4193 4193
 					GROUP BY spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country
4194 4194
 					ORDER BY airline_count DESC";
@@ -4199,7 +4199,7 @@  discard block
 block discarded – undo
4199 4199
 
4200 4200
 		$airline_array = array();
4201 4201
 		$temp_array = array();
4202
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4202
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4203 4203
 		{
4204 4204
 			$temp_array['airline_name'] = $row['airline_name'];
4205 4205
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4219,11 +4219,11 @@  discard block
 block discarded – undo
4219 4219
 	* @return Array the airline country list
4220 4220
 	*
4221 4221
 	*/
4222
-	public function countAllAirlineCountriesByDate($date,$filters = array())
4222
+	public function countAllAirlineCountriesByDate($date, $filters = array())
4223 4223
 	{
4224 4224
 		global $globalTimezone, $globalDBdriver;
4225
-		$filter_query = $this->getFilter($filters,true,true);
4226
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
4225
+		$filter_query = $this->getFilter($filters, true, true);
4226
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
4227 4227
 		if ($globalTimezone != '') {
4228 4228
 			date_default_timezone_set($globalTimezone);
4229 4229
 			$datetime = new DateTime($date);
@@ -4231,13 +4231,13 @@  discard block
 block discarded – undo
4231 4231
 		} else $offset = '+00:00';
4232 4232
 		
4233 4233
 		if ($globalDBdriver == 'mysql') {
4234
-			$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4234
+			$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4235 4235
 		 			FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
4236 4236
 					GROUP BY spotter_output.airline_country
4237 4237
 					ORDER BY airline_country_count DESC
4238 4238
 					LIMIT 10 OFFSET 0";
4239 4239
 		} else {
4240
-			$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4240
+			$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4241 4241
 		 			FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date 
4242 4242
 					GROUP BY spotter_output.airline_country
4243 4243
 					ORDER BY airline_country_count DESC
@@ -4249,7 +4249,7 @@  discard block
 block discarded – undo
4249 4249
  
4250 4250
 		$airline_country_array = array();
4251 4251
 		$temp_array = array();
4252
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4252
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4253 4253
 		{
4254 4254
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4255 4255
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4266,11 +4266,11 @@  discard block
 block discarded – undo
4266 4266
 	* @return Array the airline list
4267 4267
 	*
4268 4268
 	*/
4269
-	public function countAllAirlinesByIdent($ident,$filters = array())
4269
+	public function countAllAirlinesByIdent($ident, $filters = array())
4270 4270
 	{
4271
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
4272
-		$filter_query = $this->getFilter($filters,true,true);
4273
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4271
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
4272
+		$filter_query = $this->getFilter($filters, true, true);
4273
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4274 4274
 		 		FROM spotter_output".$filter_query." spotter_output.ident = :ident  
4275 4275
 				GROUP BY spotter_output.airline_name
4276 4276
 				ORDER BY airline_count DESC";
@@ -4282,7 +4282,7 @@  discard block
 block discarded – undo
4282 4282
 		$airline_array = array();
4283 4283
 		$temp_array = array();
4284 4284
         
4285
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4285
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4286 4286
 		{
4287 4287
 			$temp_array['airline_name'] = $row['airline_name'];
4288 4288
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4300,25 +4300,25 @@  discard block
 block discarded – undo
4300 4300
 	* @return Array the airline list
4301 4301
 	*
4302 4302
 	*/
4303
-	public function countAllAirlinesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
4303
+	public function countAllAirlinesByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array())
4304 4304
 	{
4305
-		$filter_query = $this->getFilter($filters,true,true);
4306
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
4307
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
4305
+		$filter_query = $this->getFilter($filters, true, true);
4306
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
4307
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
4308 4308
 
4309
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4309
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4310 4310
 		 			FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao) 
4311 4311
 					GROUP BY spotter_output.airline_name
4312 4312
 					ORDER BY airline_count DESC";
4313 4313
       
4314 4314
 		
4315 4315
 		$sth = $this->db->prepare($query);
4316
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao));
4316
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao));
4317 4317
       
4318 4318
 		$airline_array = array();
4319 4319
 		$temp_array = array();
4320 4320
         
4321
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4321
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4322 4322
 		{
4323 4323
 			$temp_array['airline_name'] = $row['airline_name'];
4324 4324
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4336,13 +4336,13 @@  discard block
 block discarded – undo
4336 4336
 	* @return Array the airline country list
4337 4337
 	*
4338 4338
 	*/
4339
-	public function countAllAirlineCountriesByRoute($departure_airport_icao, $arrival_airport_icao,$filters= array())
4339
+	public function countAllAirlineCountriesByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array())
4340 4340
 	{
4341
-		$filter_query = $this->getFilter($filters,true,true);
4342
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
4343
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
4341
+		$filter_query = $this->getFilter($filters, true, true);
4342
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
4343
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
4344 4344
       
4345
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4345
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4346 4346
 		 		FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao) 
4347 4347
 				GROUP BY spotter_output.airline_country
4348 4348
 				ORDER BY airline_country_count DESC
@@ -4350,11 +4350,11 @@  discard block
 block discarded – undo
4350 4350
       
4351 4351
 		
4352 4352
 		$sth = $this->db->prepare($query);
4353
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao));
4353
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao));
4354 4354
       
4355 4355
 		$airline_country_array = array();
4356 4356
 		$temp_array = array();
4357
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4357
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4358 4358
 		{
4359 4359
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4360 4360
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4372,11 +4372,11 @@  discard block
 block discarded – undo
4372 4372
 	* @return Array the airline list
4373 4373
 	*
4374 4374
 	*/
4375
-	public function countAllAirlinesByCountry($country,$filters = array())
4375
+	public function countAllAirlinesByCountry($country, $filters = array())
4376 4376
 	{
4377
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
4378
-		$filter_query = $this->getFilter($filters,true,true);
4379
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4377
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
4378
+		$filter_query = $this->getFilter($filters, true, true);
4379
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4380 4380
 		 	    FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country  
4381 4381
 			    GROUP BY spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country 
4382 4382
 			    ORDER BY airline_count DESC";
@@ -4387,7 +4387,7 @@  discard block
 block discarded – undo
4387 4387
 
4388 4388
 		$airline_array = array();
4389 4389
 		$temp_array = array();
4390
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4390
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4391 4391
 		{
4392 4392
 			$temp_array['airline_name'] = $row['airline_name'];
4393 4393
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4406,11 +4406,11 @@  discard block
 block discarded – undo
4406 4406
 	* @return Array the airline country list
4407 4407
 	*
4408 4408
 	*/
4409
-	public function countAllAirlineCountriesByCountry($country,$filters = array())
4409
+	public function countAllAirlineCountriesByCountry($country, $filters = array())
4410 4410
 	{
4411
-		$filter_query = $this->getFilter($filters,true,true);
4412
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
4413
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4411
+		$filter_query = $this->getFilter($filters, true, true);
4412
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
4413
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4414 4414
 		 		FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country 
4415 4415
 				GROUP BY spotter_output.airline_country
4416 4416
 				ORDER BY airline_country_count DESC
@@ -4422,7 +4422,7 @@  discard block
 block discarded – undo
4422 4422
 
4423 4423
 		$airline_country_array = array();
4424 4424
 		$temp_array = array();
4425
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4425
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4426 4426
 		{
4427 4427
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4428 4428
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4441,8 +4441,8 @@  discard block
 block discarded – undo
4441 4441
 	*/
4442 4442
 	public function countAllAirlineCountries($limit = true, $filters = array())
4443 4443
 	{
4444
-		$filter_query = $this->getFilter($filters,true,true);
4445
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4444
+		$filter_query = $this->getFilter($filters, true, true);
4445
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4446 4446
 		 			FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND spotter_output.airline_country <> 'NA' 
4447 4447
 					GROUP BY spotter_output.airline_country
4448 4448
 					ORDER BY airline_country_count DESC";
@@ -4453,7 +4453,7 @@  discard block
 block discarded – undo
4453 4453
 
4454 4454
 		$airline_array = array();
4455 4455
 		$temp_array = array();
4456
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4456
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4457 4457
 		{
4458 4458
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4459 4459
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4469,11 +4469,11 @@  discard block
 block discarded – undo
4469 4469
 	* @return Array the airline country list
4470 4470
 	*
4471 4471
 	*/
4472
-	public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
4472
+	public function countAllFlightOverCountries($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
4473 4473
 	{
4474 4474
 		global $globalDBdriver;
4475 4475
 		//$filter_query = $this->getFilter($filters,true,true);
4476
-		$Connection= new Connection($this->db);
4476
+		$Connection = new Connection($this->db);
4477 4477
 		if (!$Connection->tableExists('countries')) return array();
4478 4478
 		/*
4479 4479
 		$query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb 
@@ -4488,7 +4488,7 @@  discard block
 block discarded – undo
4488 4488
 */
4489 4489
 		require_once('class.SpotterLive.php');
4490 4490
 		$SpotterLive = new SpotterLive();
4491
-		$filter_query = $SpotterLive->getFilter($filters,true,true);
4491
+		$filter_query = $SpotterLive->getFilter($filters, true, true);
4492 4492
 		$filter_query .= ' over_country IS NOT NULL';
4493 4493
                 if ($olderthanmonths > 0) {
4494 4494
 			if ($globalDBdriver == 'mysql') {
@@ -4515,7 +4515,7 @@  discard block
 block discarded – undo
4515 4515
 		$flight_array = array();
4516 4516
 		$temp_array = array();
4517 4517
         
4518
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4518
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4519 4519
 		{
4520 4520
 			$temp_array['flight_count'] = $row['nb'];
4521 4521
 			$temp_array['flight_country'] = $row['name'];
@@ -4533,12 +4533,12 @@  discard block
 block discarded – undo
4533 4533
 	* @return Array the aircraft list
4534 4534
 	*
4535 4535
 	*/
4536
-	public function countAllAircraftTypes($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
4536
+	public function countAllAircraftTypes($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
4537 4537
 	{
4538 4538
 		global $globalDBdriver;
4539
-		$filter_query = $this->getFilter($filters,true,true);
4539
+		$filter_query = $this->getFilter($filters, true, true);
4540 4540
 
4541
-		$query  = "SELECT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer 
4541
+		$query = "SELECT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer 
4542 4542
 		    FROM spotter_output ".$filter_query." spotter_output.aircraft_name  <> '' AND spotter_output.aircraft_icao  <> ''";
4543 4543
 		if ($olderthanmonths > 0) {
4544 4544
 			if ($globalDBdriver == 'mysql') {
@@ -4563,7 +4563,7 @@  discard block
 block discarded – undo
4563 4563
 
4564 4564
 		$aircraft_array = array();
4565 4565
 		$temp_array = array();
4566
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4566
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4567 4567
 		{
4568 4568
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4569 4569
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -4580,11 +4580,11 @@  discard block
 block discarded – undo
4580 4580
 	* @return Array the aircraft list
4581 4581
 	*
4582 4582
 	*/
4583
-	public function countAllAircraftTypesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
4583
+	public function countAllAircraftTypesByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
4584 4584
 	{
4585 4585
 		global $globalDBdriver;
4586
-		$filter_query = $this->getFilter($filters,true,true);
4587
-		$query  = "SELECT spotter_output.airline_icao, spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer 
4586
+		$filter_query = $this->getFilter($filters, true, true);
4587
+		$query = "SELECT spotter_output.airline_icao, spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer 
4588 4588
 		    FROM spotter_output".$filter_query." spotter_output.aircraft_name  <> '' AND spotter_output.aircraft_icao  <> '' AND spotter_output.airline_icao <>'' AND spotter_output.airline_icao <> 'NA' ";
4589 4589
 		if ($olderthanmonths > 0) {
4590 4590
 			if ($globalDBdriver == 'mysql') {
@@ -4609,7 +4609,7 @@  discard block
 block discarded – undo
4609 4609
 
4610 4610
 		$aircraft_array = array();
4611 4611
 		$temp_array = array();
4612
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4612
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4613 4613
 		{
4614 4614
 			$temp_array['airline_icao'] = $row['airline_icao'];
4615 4615
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
@@ -4627,11 +4627,11 @@  discard block
 block discarded – undo
4627 4627
 	* @return Array the aircraft list
4628 4628
 	*
4629 4629
 	*/
4630
-	public function countAllAircraftTypesByMonths($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
4630
+	public function countAllAircraftTypesByMonths($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
4631 4631
 	{
4632 4632
 		global $globalDBdriver;
4633
-		$filter_query = $this->getFilter($filters,true,true);
4634
-		$query  = "SELECT EXTRACT(month from spotter_output.date) as month, EXTRACT(year from spotter_output.date) as year,spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer 
4633
+		$filter_query = $this->getFilter($filters, true, true);
4634
+		$query = "SELECT EXTRACT(month from spotter_output.date) as month, EXTRACT(year from spotter_output.date) as year,spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer 
4635 4635
 		    FROM spotter_output".$filter_query." spotter_output.aircraft_name  <> '' AND spotter_output.aircraft_icao  <> '' AND spotter_output.airline_icao <>'' AND spotter_output.airline_icao <> 'NA' ";
4636 4636
 		if ($olderthanmonths > 0) {
4637 4637
 			if ($globalDBdriver == 'mysql') {
@@ -4656,7 +4656,7 @@  discard block
 block discarded – undo
4656 4656
 
4657 4657
 		$aircraft_array = array();
4658 4658
 		$temp_array = array();
4659
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4659
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4660 4660
 		{
4661 4661
 			//$temp_array['airline_icao'] = $row['airline_icao'];
4662 4662
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
@@ -4675,13 +4675,13 @@  discard block
 block discarded – undo
4675 4675
 	* @return Array the aircraft list
4676 4676
 	*
4677 4677
 	*/
4678
-	public function countAllAircraftRegistrationByAircraft($aircraft_icao,$filters = array())
4678
+	public function countAllAircraftRegistrationByAircraft($aircraft_icao, $filters = array())
4679 4679
 	{
4680 4680
 		$Image = new Image($this->db);
4681
-		$filter_query = $this->getFilter($filters,true,true);
4682
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
4681
+		$filter_query = $this->getFilter($filters, true, true);
4682
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
4683 4683
 
4684
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name  
4684
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name  
4685 4685
 				FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.aircraft_icao = :aircraft_icao  
4686 4686
 				GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name  
4687 4687
 				ORDER BY registration_count DESC";
@@ -4692,14 +4692,14 @@  discard block
 block discarded – undo
4692 4692
 		$aircraft_array = array();
4693 4693
 		$temp_array = array();
4694 4694
         
4695
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4695
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4696 4696
 		{
4697 4697
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4698 4698
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
4699 4699
 			$temp_array['registration'] = $row['registration'];
4700 4700
 			$temp_array['airline_name'] = $row['airline_name'];
4701 4701
 			$temp_array['image_thumbnail'] = "";
4702
-			if($row['registration'] != "")
4702
+			if ($row['registration'] != "")
4703 4703
 			{
4704 4704
 				$image_array = $Image->getSpotterImage($row['registration']);
4705 4705
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -4718,11 +4718,11 @@  discard block
 block discarded – undo
4718 4718
 	* @return Array the aircraft list
4719 4719
 	*
4720 4720
 	*/
4721
-	public function countAllAircraftTypesByAirline($airline_icao,$filters = array())
4721
+	public function countAllAircraftTypesByAirline($airline_icao, $filters = array())
4722 4722
 	{
4723
-		$filter_query = $this->getFilter($filters,true,true);
4724
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
4725
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4723
+		$filter_query = $this->getFilter($filters, true, true);
4724
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
4725
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4726 4726
 			    FROM spotter_output".$filter_query." spotter_output.aircraft_icao <> '' AND spotter_output.airline_icao = :airline_icao 
4727 4727
 			    GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao 
4728 4728
 			    ORDER BY aircraft_icao_count DESC";
@@ -4733,7 +4733,7 @@  discard block
 block discarded – undo
4733 4733
 		$aircraft_array = array();
4734 4734
 		$temp_array = array();
4735 4735
 
4736
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4736
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4737 4737
 		{
4738 4738
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4739 4739
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -4751,13 +4751,13 @@  discard block
 block discarded – undo
4751 4751
 	* @return Array the aircraft list
4752 4752
 	*
4753 4753
 	*/
4754
-	public function countAllAircraftRegistrationByAirline($airline_icao,$filters = array())
4754
+	public function countAllAircraftRegistrationByAirline($airline_icao, $filters = array())
4755 4755
 	{
4756
-		$filter_query = $this->getFilter($filters,true,true);
4756
+		$filter_query = $this->getFilter($filters, true, true);
4757 4757
 		$Image = new Image($this->db);
4758
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
4758
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
4759 4759
 
4760
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name 
4760
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name 
4761 4761
 			    FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.airline_icao = :airline_icao 
4762 4762
 			    GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name
4763 4763
 			    ORDER BY registration_count DESC";
@@ -4767,14 +4767,14 @@  discard block
 block discarded – undo
4767 4767
 
4768 4768
 		$aircraft_array = array();
4769 4769
 		$temp_array = array();
4770
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4770
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4771 4771
 		{
4772 4772
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4773 4773
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
4774 4774
 			$temp_array['registration'] = $row['registration'];
4775 4775
 			$temp_array['airline_name'] = $row['airline_name'];
4776 4776
 			$temp_array['image_thumbnail'] = "";
4777
-			if($row['registration'] != "")
4777
+			if ($row['registration'] != "")
4778 4778
 			{
4779 4779
 				$image_array = $Image->getSpotterImage($row['registration']);
4780 4780
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -4793,11 +4793,11 @@  discard block
 block discarded – undo
4793 4793
 	* @return Array the aircraft list
4794 4794
 	*
4795 4795
 	*/
4796
-	public function countAllAircraftManufacturerByAirline($airline_icao,$filters = array())
4796
+	public function countAllAircraftManufacturerByAirline($airline_icao, $filters = array())
4797 4797
 	{
4798
-		$filter_query = $this->getFilter($filters,true,true);
4799
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
4800
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
4798
+		$filter_query = $this->getFilter($filters, true, true);
4799
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
4800
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
4801 4801
 				FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.airline_icao = :airline_icao 
4802 4802
 				GROUP BY spotter_output.aircraft_manufacturer 
4803 4803
 				ORDER BY aircraft_manufacturer_count DESC";
@@ -4808,7 +4808,7 @@  discard block
 block discarded – undo
4808 4808
 		$aircraft_array = array();
4809 4809
 		$temp_array = array();
4810 4810
 
4811
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4811
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4812 4812
 		{
4813 4813
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
4814 4814
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -4825,12 +4825,12 @@  discard block
 block discarded – undo
4825 4825
 	* @return Array the aircraft list
4826 4826
 	*
4827 4827
 	*/
4828
-	public function countAllAircraftTypesByAirport($airport_icao,$filters = array())
4828
+	public function countAllAircraftTypesByAirport($airport_icao, $filters = array())
4829 4829
 	{
4830
-		$filter_query = $this->getFilter($filters,true,true);
4831
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
4830
+		$filter_query = $this->getFilter($filters, true, true);
4831
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
4832 4832
 
4833
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4833
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4834 4834
 				FROM spotter_output".$filter_query." spotter_output.aircraft_icao <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao) 
4835 4835
 				GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao 
4836 4836
 				ORDER BY aircraft_icao_count DESC";
@@ -4840,7 +4840,7 @@  discard block
 block discarded – undo
4840 4840
 
4841 4841
 		$aircraft_array = array();
4842 4842
 		$temp_array = array();
4843
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4843
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4844 4844
 		{
4845 4845
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4846 4846
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -4858,13 +4858,13 @@  discard block
 block discarded – undo
4858 4858
 	* @return Array the aircraft list
4859 4859
 	*
4860 4860
 	*/
4861
-	public function countAllAircraftRegistrationByAirport($airport_icao,$filters = array())
4861
+	public function countAllAircraftRegistrationByAirport($airport_icao, $filters = array())
4862 4862
 	{
4863
-		$filter_query = $this->getFilter($filters,true,true);
4863
+		$filter_query = $this->getFilter($filters, true, true);
4864 4864
 		$Image = new Image($this->db);
4865
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
4865
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
4866 4866
 
4867
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name  
4867
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name  
4868 4868
                     FROM spotter_output".$filter_query." spotter_output.registration <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao)   
4869 4869
                     GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name 
4870 4870
 		    ORDER BY registration_count DESC";
@@ -4874,14 +4874,14 @@  discard block
 block discarded – undo
4874 4874
 
4875 4875
 		$aircraft_array = array();
4876 4876
 		$temp_array = array();
4877
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4877
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4878 4878
 		{
4879 4879
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4880 4880
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
4881 4881
 			$temp_array['registration'] = $row['registration'];
4882 4882
 			$temp_array['airline_name'] = $row['airline_name'];
4883 4883
 			$temp_array['image_thumbnail'] = "";
4884
-			if($row['registration'] != "")
4884
+			if ($row['registration'] != "")
4885 4885
 			{
4886 4886
 				$image_array = $Image->getSpotterImage($row['registration']);
4887 4887
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -4899,11 +4899,11 @@  discard block
 block discarded – undo
4899 4899
 	* @return Array the aircraft list
4900 4900
 	*
4901 4901
 	*/
4902
-	public function countAllAircraftManufacturerByAirport($airport_icao,$filters = array())
4902
+	public function countAllAircraftManufacturerByAirport($airport_icao, $filters = array())
4903 4903
 	{
4904
-		$filter_query = $this->getFilter($filters,true,true);
4905
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
4906
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
4904
+		$filter_query = $this->getFilter($filters, true, true);
4905
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
4906
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
4907 4907
                     FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao)  
4908 4908
                     GROUP BY spotter_output.aircraft_manufacturer 
4909 4909
 					ORDER BY aircraft_manufacturer_count DESC";
@@ -4914,7 +4914,7 @@  discard block
 block discarded – undo
4914 4914
 
4915 4915
 		$aircraft_array = array();
4916 4916
 		$temp_array = array();
4917
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4917
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4918 4918
 		{
4919 4919
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
4920 4920
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -4929,12 +4929,12 @@  discard block
 block discarded – undo
4929 4929
 	* @return Array the aircraft list
4930 4930
 	*
4931 4931
 	*/
4932
-	public function countAllAircraftTypesByManufacturer($aircraft_manufacturer,$filters = array())
4932
+	public function countAllAircraftTypesByManufacturer($aircraft_manufacturer, $filters = array())
4933 4933
 	{
4934
-		$filter_query = $this->getFilter($filters,true,true);
4935
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
4934
+		$filter_query = $this->getFilter($filters, true, true);
4935
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
4936 4936
 
4937
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4937
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4938 4938
                     FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer = :aircraft_manufacturer
4939 4939
                     GROUP BY spotter_output.aircraft_name 
4940 4940
 					ORDER BY aircraft_icao_count DESC";
@@ -4943,7 +4943,7 @@  discard block
 block discarded – undo
4943 4943
 		$sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer));
4944 4944
 		$aircraft_array = array();
4945 4945
 		$temp_array = array();
4946
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4946
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4947 4947
 		{
4948 4948
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4949 4949
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -4962,11 +4962,11 @@  discard block
 block discarded – undo
4962 4962
 	*/
4963 4963
 	public function countAllAircraftRegistrationByManufacturer($aircraft_manufacturer, $filters = array())
4964 4964
 	{
4965
-		$filter_query = $this->getFilter($filters,true,true);
4965
+		$filter_query = $this->getFilter($filters, true, true);
4966 4966
 		$Image = new Image($this->db);
4967
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
4967
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
4968 4968
 
4969
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name   
4969
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name   
4970 4970
                     FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer   
4971 4971
                     GROUP BY spotter_output.registration 
4972 4972
 					ORDER BY registration_count DESC";
@@ -4976,14 +4976,14 @@  discard block
 block discarded – undo
4976 4976
 		$sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer));
4977 4977
 		$aircraft_array = array();
4978 4978
 		$temp_array = array();
4979
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4979
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4980 4980
 		{
4981 4981
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4982 4982
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
4983 4983
 			$temp_array['registration'] = $row['registration'];
4984 4984
 			$temp_array['airline_name'] = $row['airline_name'];
4985 4985
 			$temp_array['image_thumbnail'] = "";
4986
-			if($row['registration'] != "")
4986
+			if ($row['registration'] != "")
4987 4987
 			{
4988 4988
 				$image_array = $Image->getSpotterImage($row['registration']);
4989 4989
 				$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5000,11 +5000,11 @@  discard block
 block discarded – undo
5000 5000
 	* @return Array the aircraft list
5001 5001
 	*
5002 5002
 	*/
5003
-	public function countAllAircraftTypesByDate($date,$filters = array())
5003
+	public function countAllAircraftTypesByDate($date, $filters = array())
5004 5004
 	{
5005 5005
 		global $globalTimezone, $globalDBdriver;
5006
-		$filter_query = $this->getFilter($filters,true,true);
5007
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
5006
+		$filter_query = $this->getFilter($filters, true, true);
5007
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
5008 5008
 		if ($globalTimezone != '') {
5009 5009
 			date_default_timezone_set($globalTimezone);
5010 5010
 			$datetime = new DateTime($date);
@@ -5012,12 +5012,12 @@  discard block
 block discarded – undo
5012 5012
 		} else $offset = '+00:00';
5013 5013
 
5014 5014
 		if ($globalDBdriver == 'mysql') {
5015
-			$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5015
+			$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5016 5016
 					FROM spotter_output".$filter_query." DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date
5017 5017
 					GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao 
5018 5018
 					ORDER BY aircraft_icao_count DESC";
5019 5019
 		} else {
5020
-			$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5020
+			$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5021 5021
 					FROM spotter_output".$filter_query." to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date
5022 5022
 					GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao 
5023 5023
 					ORDER BY aircraft_icao_count DESC";
@@ -5028,7 +5028,7 @@  discard block
 block discarded – undo
5028 5028
 
5029 5029
 		$aircraft_array = array();
5030 5030
 		$temp_array = array();
5031
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5031
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5032 5032
 		{
5033 5033
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5034 5034
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -5046,12 +5046,12 @@  discard block
 block discarded – undo
5046 5046
 	* @return Array the aircraft list
5047 5047
 	*
5048 5048
 	*/
5049
-	public function countAllAircraftRegistrationByDate($date,$filters = array())
5049
+	public function countAllAircraftRegistrationByDate($date, $filters = array())
5050 5050
 	{
5051 5051
 		global $globalTimezone, $globalDBdriver;
5052
-		$filter_query = $this->getFilter($filters,true,true);
5052
+		$filter_query = $this->getFilter($filters, true, true);
5053 5053
 		$Image = new Image($this->db);
5054
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
5054
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
5055 5055
 		if ($globalTimezone != '') {
5056 5056
 			date_default_timezone_set($globalTimezone);
5057 5057
 			$datetime = new DateTime($date);
@@ -5059,12 +5059,12 @@  discard block
 block discarded – undo
5059 5059
 		} else $offset = '+00:00';
5060 5060
 
5061 5061
 		if ($globalDBdriver == 'mysql') {
5062
-			$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name 
5062
+			$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name 
5063 5063
 					FROM spotter_output".$filter_query." spotter_output.registration <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
5064 5064
 					GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name 
5065 5065
 					ORDER BY registration_count DESC";
5066 5066
 		} else {
5067
-			$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name    
5067
+			$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name    
5068 5068
 					FROM spotter_output".$filter_query." spotter_output.registration <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date 
5069 5069
 					GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name 
5070 5070
 					ORDER BY registration_count DESC";
@@ -5075,14 +5075,14 @@  discard block
 block discarded – undo
5075 5075
 
5076 5076
 		$aircraft_array = array();
5077 5077
 		$temp_array = array();
5078
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5078
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5079 5079
 		{
5080 5080
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5081 5081
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5082 5082
 			$temp_array['registration'] = $row['registration'];
5083 5083
 			$temp_array['airline_name'] = $row['airline_name'];
5084 5084
 			$temp_array['image_thumbnail'] = "";
5085
-			if($row['registration'] != "")
5085
+			if ($row['registration'] != "")
5086 5086
 			{
5087 5087
 				$image_array = $Image->getSpotterImage($row['registration']);
5088 5088
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5101,11 +5101,11 @@  discard block
 block discarded – undo
5101 5101
 	* @return Array the aircraft manufacturer list
5102 5102
 	*
5103 5103
 	*/
5104
-	public function countAllAircraftManufacturerByDate($date,$filters = array())
5104
+	public function countAllAircraftManufacturerByDate($date, $filters = array())
5105 5105
 	{
5106 5106
 		global $globalTimezone, $globalDBdriver;
5107
-		$filter_query = $this->getFilter($filters,true,true);
5108
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
5107
+		$filter_query = $this->getFilter($filters, true, true);
5108
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
5109 5109
 		if ($globalTimezone != '') {
5110 5110
 			date_default_timezone_set($globalTimezone);
5111 5111
 			$datetime = new DateTime($date);
@@ -5113,12 +5113,12 @@  discard block
 block discarded – undo
5113 5113
 		} else $offset = '+00:00';
5114 5114
 
5115 5115
 		if ($globalDBdriver == 'mysql') {
5116
-			$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5116
+			$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5117 5117
 				FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
5118 5118
 				GROUP BY spotter_output.aircraft_manufacturer 
5119 5119
 				ORDER BY aircraft_manufacturer_count DESC";
5120 5120
 		} else {
5121
-			$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5121
+			$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5122 5122
 				FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date 
5123 5123
 				GROUP BY spotter_output.aircraft_manufacturer 
5124 5124
 				ORDER BY aircraft_manufacturer_count DESC";
@@ -5130,7 +5130,7 @@  discard block
 block discarded – undo
5130 5130
 		$aircraft_array = array();
5131 5131
 		$temp_array = array();
5132 5132
 
5133
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5133
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5134 5134
 		{
5135 5135
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
5136 5136
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -5147,11 +5147,11 @@  discard block
 block discarded – undo
5147 5147
 	* @return Array the aircraft list
5148 5148
 	*
5149 5149
 	*/
5150
-	public function countAllAircraftTypesByIdent($ident,$filters = array())
5150
+	public function countAllAircraftTypesByIdent($ident, $filters = array())
5151 5151
 	{
5152
-		$filter_query = $this->getFilter($filters,true,true);
5153
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
5154
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5152
+		$filter_query = $this->getFilter($filters, true, true);
5153
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
5154
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5155 5155
 				FROM spotter_output".$filter_query." spotter_output.ident = :ident 
5156 5156
 				GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao
5157 5157
 				ORDER BY aircraft_icao_count DESC";
@@ -5162,7 +5162,7 @@  discard block
 block discarded – undo
5162 5162
 		$aircraft_array = array();
5163 5163
 		$temp_array = array();
5164 5164
 
5165
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5165
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5166 5166
 		{
5167 5167
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5168 5168
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -5180,13 +5180,13 @@  discard block
 block discarded – undo
5180 5180
 	* @return Array the aircraft list
5181 5181
 	*
5182 5182
 	*/
5183
-	public function countAllAircraftRegistrationByIdent($ident,$filters = array())
5183
+	public function countAllAircraftRegistrationByIdent($ident, $filters = array())
5184 5184
 	{
5185
-		$filter_query = $this->getFilter($filters,true,true);
5185
+		$filter_query = $this->getFilter($filters, true, true);
5186 5186
 		$Image = new Image($this->db);
5187
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
5187
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
5188 5188
 
5189
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name  
5189
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name  
5190 5190
                     FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.ident = :ident   
5191 5191
                     GROUP BY spotter_output.registration,spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name
5192 5192
 		    ORDER BY registration_count DESC";
@@ -5198,14 +5198,14 @@  discard block
 block discarded – undo
5198 5198
 		$aircraft_array = array();
5199 5199
 		$temp_array = array();
5200 5200
         
5201
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5201
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5202 5202
 		{
5203 5203
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5204 5204
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5205 5205
 			$temp_array['registration'] = $row['registration'];
5206 5206
 			$temp_array['airline_name'] = $row['airline_name'];
5207 5207
 			$temp_array['image_thumbnail'] = "";
5208
-			if($row['registration'] != "")
5208
+			if ($row['registration'] != "")
5209 5209
 			{
5210 5210
 				$image_array = $Image->getSpotterImage($row['registration']);
5211 5211
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5224,11 +5224,11 @@  discard block
 block discarded – undo
5224 5224
 	* @return Array the aircraft manufacturer list
5225 5225
 	*
5226 5226
 	*/
5227
-	public function countAllAircraftManufacturerByIdent($ident,$filters = array())
5227
+	public function countAllAircraftManufacturerByIdent($ident, $filters = array())
5228 5228
 	{
5229
-		$filter_query = $this->getFilter($filters,true,true);
5230
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
5231
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5229
+		$filter_query = $this->getFilter($filters, true, true);
5230
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
5231
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5232 5232
                     FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.ident = :ident  
5233 5233
                     GROUP BY spotter_output.aircraft_manufacturer 
5234 5234
 					ORDER BY aircraft_manufacturer_count DESC";
@@ -5238,7 +5238,7 @@  discard block
 block discarded – undo
5238 5238
 		$sth->execute(array(':ident' => $ident));
5239 5239
 		$aircraft_array = array();
5240 5240
 		$temp_array = array();
5241
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5241
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5242 5242
 		{
5243 5243
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
5244 5244
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -5254,24 +5254,24 @@  discard block
 block discarded – undo
5254 5254
 	* @return Array the aircraft list
5255 5255
 	*
5256 5256
 	*/
5257
-	public function countAllAircraftTypesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
5257
+	public function countAllAircraftTypesByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array())
5258 5258
 	{
5259
-		$filter_query = $this->getFilter($filters,true,true);
5260
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
5261
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
5259
+		$filter_query = $this->getFilter($filters, true, true);
5260
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
5261
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
5262 5262
 		
5263 5263
 
5264
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5264
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5265 5265
                     FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao)
5266 5266
                     GROUP BY spotter_output.aircraft_name 
5267 5267
 					ORDER BY aircraft_icao_count DESC";
5268 5268
  
5269 5269
 		
5270 5270
 		$sth = $this->db->prepare($query);
5271
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao));
5271
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao));
5272 5272
 		$aircraft_array = array();
5273 5273
 		$temp_array = array();
5274
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5274
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5275 5275
 		{
5276 5276
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5277 5277
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -5287,33 +5287,33 @@  discard block
 block discarded – undo
5287 5287
 	* @return Array the aircraft list
5288 5288
 	*
5289 5289
 	*/
5290
-	public function countAllAircraftRegistrationByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
5290
+	public function countAllAircraftRegistrationByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array())
5291 5291
 	{
5292
-		$filter_query = $this->getFilter($filters,true,true);
5292
+		$filter_query = $this->getFilter($filters, true, true);
5293 5293
 		$Image = new Image($this->db);
5294
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
5295
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
5294
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
5295
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
5296 5296
 
5297
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name   
5297
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name   
5298 5298
                     FROM spotter_output".$filter_query." spotter_output.registration <> '' AND (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao)   
5299 5299
                     GROUP BY spotter_output.registration 
5300 5300
 					ORDER BY registration_count DESC";
5301 5301
 
5302 5302
 		
5303 5303
 		$sth = $this->db->prepare($query);
5304
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao));
5304
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao));
5305 5305
       
5306 5306
 		$aircraft_array = array();
5307 5307
 		$temp_array = array();
5308 5308
         
5309
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5309
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5310 5310
 		{
5311 5311
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5312 5312
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5313 5313
 			$temp_array['registration'] = $row['registration'];
5314 5314
 			$temp_array['airline_name'] = $row['airline_name'];
5315 5315
 			$temp_array['image_thumbnail'] = "";
5316
-			if($row['registration'] != "")
5316
+			if ($row['registration'] != "")
5317 5317
 			{
5318 5318
 				$image_array = $Image->getSpotterImage($row['registration']);
5319 5319
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5333,25 +5333,25 @@  discard block
 block discarded – undo
5333 5333
 	* @return Array the aircraft manufacturer list
5334 5334
 	*
5335 5335
 	*/
5336
-	public function countAllAircraftManufacturerByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
5336
+	public function countAllAircraftManufacturerByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array())
5337 5337
 	{
5338
-		$filter_query = $this->getFilter($filters,true,true);
5339
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
5340
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
5338
+		$filter_query = $this->getFilter($filters, true, true);
5339
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
5340
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
5341 5341
 
5342
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5342
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5343 5343
                     FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao) 
5344 5344
                     GROUP BY spotter_output.aircraft_manufacturer 
5345 5345
 					ORDER BY aircraft_manufacturer_count DESC";
5346 5346
 
5347 5347
 		
5348 5348
 		$sth = $this->db->prepare($query);
5349
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao));
5349
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao));
5350 5350
       
5351 5351
 		$aircraft_array = array();
5352 5352
 		$temp_array = array();
5353 5353
         
5354
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5354
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5355 5355
 		{
5356 5356
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
5357 5357
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -5371,11 +5371,11 @@  discard block
 block discarded – undo
5371 5371
 	* @return Array the aircraft list
5372 5372
 	*
5373 5373
 	*/
5374
-	public function countAllAircraftTypesByCountry($country,$filters = array())
5374
+	public function countAllAircraftTypesByCountry($country, $filters = array())
5375 5375
 	{
5376
-		$filter_query = $this->getFilter($filters,true,true);
5377
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
5378
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5376
+		$filter_query = $this->getFilter($filters, true, true);
5377
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
5378
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5379 5379
 			    FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country 
5380 5380
 			    GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao 
5381 5381
 			    ORDER BY aircraft_icao_count DESC";
@@ -5387,7 +5387,7 @@  discard block
 block discarded – undo
5387 5387
 		$aircraft_array = array();
5388 5388
 		$temp_array = array();
5389 5389
         
5390
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5390
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5391 5391
 		{
5392 5392
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5393 5393
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -5406,12 +5406,12 @@  discard block
 block discarded – undo
5406 5406
 	* @return Array the aircraft list
5407 5407
 	*
5408 5408
 	*/
5409
-	public function countAllAircraftRegistrationByCountry($country,$filters = array())
5409
+	public function countAllAircraftRegistrationByCountry($country, $filters = array())
5410 5410
 	{
5411
-		$filter_query = $this->getFilter($filters,true,true);
5411
+		$filter_query = $this->getFilter($filters, true, true);
5412 5412
 		$Image = new Image($this->db);
5413
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
5414
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name 
5413
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
5414
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name 
5415 5415
 			    FROM spotter_output".$filter_query." spotter_output.registration <> '' AND (((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country)    
5416 5416
 			    GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name 
5417 5417
 			    ORDER BY registration_count DESC";
@@ -5423,14 +5423,14 @@  discard block
 block discarded – undo
5423 5423
 		$aircraft_array = array();
5424 5424
 		$temp_array = array();
5425 5425
         
5426
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5426
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5427 5427
 		{
5428 5428
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5429 5429
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5430 5430
 			$temp_array['registration'] = $row['registration'];
5431 5431
 			$temp_array['airline_name'] = $row['airline_name'];
5432 5432
 			$temp_array['image_thumbnail'] = "";
5433
-			if($row['registration'] != "")
5433
+			if ($row['registration'] != "")
5434 5434
 			{
5435 5435
 				$image_array = $Image->getSpotterImage($row['registration']);
5436 5436
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5450,11 +5450,11 @@  discard block
 block discarded – undo
5450 5450
 	* @return Array the aircraft manufacturer list
5451 5451
 	*
5452 5452
 	*/
5453
-	public function countAllAircraftManufacturerByCountry($country,$filters = array())
5453
+	public function countAllAircraftManufacturerByCountry($country, $filters = array())
5454 5454
 	{
5455
-		$filter_query = $this->getFilter($filters,true,true);
5456
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
5457
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5455
+		$filter_query = $this->getFilter($filters, true, true);
5456
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
5457
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5458 5458
                     FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND (((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country) 
5459 5459
                     GROUP BY spotter_output.aircraft_manufacturer 
5460 5460
 					ORDER BY aircraft_manufacturer_count DESC";
@@ -5466,7 +5466,7 @@  discard block
 block discarded – undo
5466 5466
 		$aircraft_array = array();
5467 5467
 		$temp_array = array();
5468 5468
         
5469
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5469
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5470 5470
 		{
5471 5471
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
5472 5472
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -5487,8 +5487,8 @@  discard block
 block discarded – undo
5487 5487
 	*/
5488 5488
 	public function countAllAircraftManufacturers($filters = array())
5489 5489
 	{
5490
-		$filter_query = $this->getFilter($filters,true,true);
5491
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5490
+		$filter_query = $this->getFilter($filters, true, true);
5491
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5492 5492
                     FROM spotter_output ".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.aircraft_manufacturer <> 'Not Available'";
5493 5493
                 $query .= " GROUP BY spotter_output.aircraft_manufacturer
5494 5494
 					ORDER BY aircraft_manufacturer_count DESC
@@ -5501,7 +5501,7 @@  discard block
 block discarded – undo
5501 5501
 		$manufacturer_array = array();
5502 5502
 		$temp_array = array();
5503 5503
         
5504
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5504
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5505 5505
 		{
5506 5506
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
5507 5507
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -5520,12 +5520,12 @@  discard block
 block discarded – undo
5520 5520
 	* @return Array the aircraft list
5521 5521
 	*
5522 5522
 	*/
5523
-	public function countAllAircraftRegistrations($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
5523
+	public function countAllAircraftRegistrations($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
5524 5524
 	{
5525 5525
 		global $globalDBdriver;
5526 5526
 		$Image = new Image($this->db);
5527
-		$filter_query = $this->getFilter($filters,true,true);
5528
-		$query  = "SELECT DISTINCT spotter_output.registration, COUNT(spotter_output.registration) AS aircraft_registration_count, spotter_output.aircraft_icao,  spotter_output.aircraft_name, spotter_output.airline_name    
5527
+		$filter_query = $this->getFilter($filters, true, true);
5528
+		$query = "SELECT DISTINCT spotter_output.registration, COUNT(spotter_output.registration) AS aircraft_registration_count, spotter_output.aircraft_icao,  spotter_output.aircraft_name, spotter_output.airline_name    
5529 5529
                     FROM spotter_output ".$filter_query." spotter_output.registration <> '' AND spotter_output.registration <> 'NA'";
5530 5530
                 if ($olderthanmonths > 0) {
5531 5531
             		if ($globalDBdriver == 'mysql') {
@@ -5553,7 +5553,7 @@  discard block
 block discarded – undo
5553 5553
 		$aircraft_array = array();
5554 5554
 		$temp_array = array();
5555 5555
         
5556
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5556
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5557 5557
 		{
5558 5558
 			$temp_array['registration'] = $row['registration'];
5559 5559
 			$temp_array['aircraft_registration_count'] = $row['aircraft_registration_count'];
@@ -5561,7 +5561,7 @@  discard block
 block discarded – undo
5561 5561
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5562 5562
 			$temp_array['airline_name'] = $row['airline_name'];
5563 5563
 			$temp_array['image_thumbnail'] = "";
5564
-			if($row['registration'] != "")
5564
+			if ($row['registration'] != "")
5565 5565
 			{
5566 5566
 				$image_array = $Image->getSpotterImage($row['registration']);
5567 5567
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5580,12 +5580,12 @@  discard block
 block discarded – undo
5580 5580
 	* @return Array the aircraft list
5581 5581
 	*
5582 5582
 	*/
5583
-	public function countAllAircraftRegistrationsByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
5583
+	public function countAllAircraftRegistrationsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
5584 5584
 	{
5585 5585
 		global $globalDBdriver;
5586
-		$filter_query = $this->getFilter($filters,true,true);
5586
+		$filter_query = $this->getFilter($filters, true, true);
5587 5587
 		$Image = new Image($this->db);
5588
-		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.registration, COUNT(spotter_output.registration) AS aircraft_registration_count, spotter_output.aircraft_icao,  spotter_output.aircraft_name, spotter_output.airline_name    
5588
+		$query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.registration, COUNT(spotter_output.registration) AS aircraft_registration_count, spotter_output.aircraft_icao,  spotter_output.aircraft_name, spotter_output.airline_name    
5589 5589
                     FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.registration <> '' AND spotter_output.registration <> 'NA' ";
5590 5590
                 if ($olderthanmonths > 0) {
5591 5591
             		if ($globalDBdriver == 'mysql') {
@@ -5613,7 +5613,7 @@  discard block
 block discarded – undo
5613 5613
 		$aircraft_array = array();
5614 5614
 		$temp_array = array();
5615 5615
         
5616
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5616
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5617 5617
 		{
5618 5618
 			$temp_array['registration'] = $row['registration'];
5619 5619
 			$temp_array['aircraft_registration_count'] = $row['aircraft_registration_count'];
@@ -5622,7 +5622,7 @@  discard block
 block discarded – undo
5622 5622
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5623 5623
 			$temp_array['airline_name'] = $row['airline_name'];
5624 5624
 			$temp_array['image_thumbnail'] = "";
5625
-			if($row['registration'] != "")
5625
+			if ($row['registration'] != "")
5626 5626
 			{
5627 5627
 				$image_array = $Image->getSpotterImage($row['registration']);
5628 5628
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5641,11 +5641,11 @@  discard block
 block discarded – undo
5641 5641
 	* @return Array the airport list
5642 5642
 	*
5643 5643
 	*/
5644
-	public function countAllDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
5644
+	public function countAllDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
5645 5645
 	{
5646 5646
 		global $globalDBdriver;
5647
-		$filter_query = $this->getFilter($filters,true,true);
5648
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
5647
+		$filter_query = $this->getFilter($filters, true, true);
5648
+		$query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
5649 5649
 				FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> ''";
5650 5650
                 if ($olderthanmonths > 0) {
5651 5651
             		if ($globalDBdriver == 'mysql') {
@@ -5674,7 +5674,7 @@  discard block
 block discarded – undo
5674 5674
 		$airport_array = array();
5675 5675
 		$temp_array = array();
5676 5676
         
5677
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5677
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5678 5678
 		{
5679 5679
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
5680 5680
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -5693,11 +5693,11 @@  discard block
 block discarded – undo
5693 5693
 	* @return Array the airport list
5694 5694
 	*
5695 5695
 	*/
5696
-	public function countAllDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
5696
+	public function countAllDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
5697 5697
 	{
5698 5698
 		global $globalDBdriver;
5699
-		$filter_query = $this->getFilter($filters,true,true);
5700
-		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
5699
+		$filter_query = $this->getFilter($filters, true, true);
5700
+		$query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
5701 5701
 			FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> '' ";
5702 5702
                 if ($olderthanmonths > 0) {
5703 5703
             		if ($globalDBdriver == 'mysql') {
@@ -5726,7 +5726,7 @@  discard block
 block discarded – undo
5726 5726
 		$airport_array = array();
5727 5727
 		$temp_array = array();
5728 5728
         
5729
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5729
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5730 5730
 		{
5731 5731
 			$temp_array['airline_icao'] = $row['airline_icao'];
5732 5732
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -5746,11 +5746,11 @@  discard block
 block discarded – undo
5746 5746
 	* @return Array the airport list
5747 5747
 	*
5748 5748
 	*/
5749
-	public function countAllDetectedDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
5749
+	public function countAllDetectedDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
5750 5750
 	{
5751 5751
 		global $globalDBdriver;
5752
-		$filter_query = $this->getFilter($filters,true,true);
5753
-		$query  = "SELECT DISTINCT spotter_output.real_departure_airport_icao AS departure_airport_icao, COUNT(spotter_output.real_departure_airport_icao) AS airport_departure_icao_count, airport.name as departure_airport_name, airport.city as departure_airport_city, airport.country as departure_airport_country
5752
+		$filter_query = $this->getFilter($filters, true, true);
5753
+		$query = "SELECT DISTINCT spotter_output.real_departure_airport_icao AS departure_airport_icao, COUNT(spotter_output.real_departure_airport_icao) AS airport_departure_icao_count, airport.name as departure_airport_name, airport.city as departure_airport_city, airport.country as departure_airport_country
5754 5754
 				FROM airport, spotter_output".$filter_query." spotter_output.real_departure_airport_icao <> '' AND spotter_output.real_departure_airport_icao <> 'NA' AND airport.icao = spotter_output.real_departure_airport_icao";
5755 5755
                 if ($olderthanmonths > 0) {
5756 5756
             		if ($globalDBdriver == 'mysql') {
@@ -5778,7 +5778,7 @@  discard block
 block discarded – undo
5778 5778
 		$airport_array = array();
5779 5779
 		$temp_array = array();
5780 5780
         
5781
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5781
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5782 5782
 		{
5783 5783
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
5784 5784
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -5797,11 +5797,11 @@  discard block
 block discarded – undo
5797 5797
 	* @return Array the airport list
5798 5798
 	*
5799 5799
 	*/
5800
-	public function countAllDetectedDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
5800
+	public function countAllDetectedDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
5801 5801
 	{
5802 5802
 		global $globalDBdriver;
5803
-		$filter_query = $this->getFilter($filters,true,true);
5804
-		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.real_departure_airport_icao AS departure_airport_icao, COUNT(spotter_output.real_departure_airport_icao) AS airport_departure_icao_count, airport.name as departure_airport_name, airport.city as departure_airport_city, airport.country as departure_airport_country
5803
+		$filter_query = $this->getFilter($filters, true, true);
5804
+		$query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.real_departure_airport_icao AS departure_airport_icao, COUNT(spotter_output.real_departure_airport_icao) AS airport_departure_icao_count, airport.name as departure_airport_name, airport.city as departure_airport_city, airport.country as departure_airport_country
5805 5805
 				FROM airport, spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.real_departure_airport_icao <> '' AND spotter_output.real_departure_airport_icao <> 'NA' AND airport.icao = spotter_output.real_departure_airport_icao ";
5806 5806
                 if ($olderthanmonths > 0) {
5807 5807
             		if ($globalDBdriver == 'mysql') {
@@ -5830,7 +5830,7 @@  discard block
 block discarded – undo
5830 5830
 		$airport_array = array();
5831 5831
 		$temp_array = array();
5832 5832
         
5833
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5833
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5834 5834
 		{
5835 5835
 			$temp_array['airline_icao'] = $row['airline_icao'];
5836 5836
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -5850,11 +5850,11 @@  discard block
 block discarded – undo
5850 5850
 	* @return Array the airport list
5851 5851
 	*
5852 5852
 	*/
5853
-	public function countAllDepartureAirportsByAirline($airline_icao,$filters = array())
5853
+	public function countAllDepartureAirportsByAirline($airline_icao, $filters = array())
5854 5854
 	{
5855
-		$filter_query = $this->getFilter($filters,true,true);
5856
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
5857
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
5855
+		$filter_query = $this->getFilter($filters, true, true);
5856
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
5857
+		$query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
5858 5858
 			    FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.airline_icao = :airline_icao AND spotter_output.departure_airport_icao <> '' 
5859 5859
 			    GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
5860 5860
 			    ORDER BY airport_departure_icao_count DESC";
@@ -5866,7 +5866,7 @@  discard block
 block discarded – undo
5866 5866
 		$airport_array = array();
5867 5867
 		$temp_array = array();
5868 5868
         
5869
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5869
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5870 5870
 		{
5871 5871
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
5872 5872
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -5888,11 +5888,11 @@  discard block
 block discarded – undo
5888 5888
 	* @return Array the airport list
5889 5889
 	*
5890 5890
 	*/
5891
-	public function countAllDepartureAirportCountriesByAirline($airline_icao,$filters = array())
5891
+	public function countAllDepartureAirportCountriesByAirline($airline_icao, $filters = array())
5892 5892
 	{
5893
-		$filter_query = $this->getFilter($filters,true,true);
5894
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
5895
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
5893
+		$filter_query = $this->getFilter($filters, true, true);
5894
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
5895
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
5896 5896
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.airline_icao = :airline_icao 
5897 5897
                     GROUP BY spotter_output.departure_airport_country
5898 5898
 					ORDER BY airport_departure_country_count DESC";
@@ -5904,7 +5904,7 @@  discard block
 block discarded – undo
5904 5904
 		$airport_array = array();
5905 5905
 		$temp_array = array();
5906 5906
         
5907
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5907
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5908 5908
 		{
5909 5909
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
5910 5910
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -5923,11 +5923,11 @@  discard block
 block discarded – undo
5923 5923
 	* @return Array the airport list
5924 5924
 	*
5925 5925
 	*/
5926
-	public function countAllDepartureAirportsByAircraft($aircraft_icao,$filters = array())
5926
+	public function countAllDepartureAirportsByAircraft($aircraft_icao, $filters = array())
5927 5927
 	{
5928
-		$filter_query = $this->getFilter($filters,true,true);
5929
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
5930
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
5928
+		$filter_query = $this->getFilter($filters, true, true);
5929
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
5930
+		$query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
5931 5931
 			    FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.aircraft_icao = :aircraft_icao AND spotter_output.departure_airport_icao <> '' 
5932 5932
 			    GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
5933 5933
 			    ORDER BY airport_departure_icao_count DESC";
@@ -5939,7 +5939,7 @@  discard block
 block discarded – undo
5939 5939
 		$airport_array = array();
5940 5940
 		$temp_array = array();
5941 5941
         
5942
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5942
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5943 5943
 		{
5944 5944
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
5945 5945
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -5960,11 +5960,11 @@  discard block
 block discarded – undo
5960 5960
 	* @return Array the airport list
5961 5961
 	*
5962 5962
 	*/
5963
-	public function countAllDepartureAirportCountriesByAircraft($aircraft_icao,$filters = array())
5963
+	public function countAllDepartureAirportCountriesByAircraft($aircraft_icao, $filters = array())
5964 5964
 	{
5965
-		$filter_query = $this->getFilter($filters,true,true);
5966
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
5967
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
5965
+		$filter_query = $this->getFilter($filters, true, true);
5966
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
5967
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
5968 5968
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.aircraft_icao = :aircraft_icao
5969 5969
                     GROUP BY spotter_output.departure_airport_country
5970 5970
 					ORDER BY airport_departure_country_count DESC";
@@ -5976,7 +5976,7 @@  discard block
 block discarded – undo
5976 5976
 		$airport_array = array();
5977 5977
 		$temp_array = array();
5978 5978
         
5979
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5979
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5980 5980
 		{
5981 5981
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
5982 5982
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -5994,11 +5994,11 @@  discard block
 block discarded – undo
5994 5994
 	* @return Array the airport list
5995 5995
 	*
5996 5996
 	*/
5997
-	public function countAllDepartureAirportsByRegistration($registration,$filters = array())
5997
+	public function countAllDepartureAirportsByRegistration($registration, $filters = array())
5998 5998
 	{
5999
-		$filter_query = $this->getFilter($filters,true,true);
6000
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
6001
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
5999
+		$filter_query = $this->getFilter($filters, true, true);
6000
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
6001
+		$query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
6002 6002
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.registration = :registration AND spotter_output.departure_airport_icao <> '' 
6003 6003
                     GROUP BY spotter_output.departure_airport_icao
6004 6004
 					ORDER BY airport_departure_icao_count DESC";
@@ -6010,7 +6010,7 @@  discard block
 block discarded – undo
6010 6010
 		$airport_array = array();
6011 6011
 		$temp_array = array();
6012 6012
         
6013
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6013
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6014 6014
 		{
6015 6015
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
6016 6016
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -6031,11 +6031,11 @@  discard block
 block discarded – undo
6031 6031
 	* @return Array the airport list
6032 6032
 	*
6033 6033
 	*/
6034
-	public function countAllDepartureAirportCountriesByRegistration($registration,$filters = array())
6034
+	public function countAllDepartureAirportCountriesByRegistration($registration, $filters = array())
6035 6035
 	{
6036
-		$filter_query = $this->getFilter($filters,true,true);
6037
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
6038
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6036
+		$filter_query = $this->getFilter($filters, true, true);
6037
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
6038
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6039 6039
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.registration = :registration 
6040 6040
                     GROUP BY spotter_output.departure_airport_country
6041 6041
 					ORDER BY airport_departure_country_count DESC";
@@ -6047,7 +6047,7 @@  discard block
 block discarded – undo
6047 6047
 		$airport_array = array();
6048 6048
 		$temp_array = array();
6049 6049
         
6050
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6050
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6051 6051
 		{
6052 6052
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
6053 6053
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -6065,11 +6065,11 @@  discard block
 block discarded – undo
6065 6065
 	* @return Array the airport list
6066 6066
 	*
6067 6067
 	*/
6068
-	public function countAllDepartureAirportsByAirport($airport_icao,$filters = array())
6068
+	public function countAllDepartureAirportsByAirport($airport_icao, $filters = array())
6069 6069
 	{
6070
-		$filter_query = $this->getFilter($filters,true,true);
6071
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
6072
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
6070
+		$filter_query = $this->getFilter($filters, true, true);
6071
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
6072
+		$query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
6073 6073
 			    FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao = :airport_icao AND spotter_output.departure_airport_icao <> '' 
6074 6074
 			    GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
6075 6075
 			    ORDER BY airport_departure_icao_count DESC";
@@ -6081,7 +6081,7 @@  discard block
 block discarded – undo
6081 6081
 		$airport_array = array();
6082 6082
 		$temp_array = array();
6083 6083
         
6084
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6084
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6085 6085
 		{
6086 6086
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
6087 6087
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -6102,11 +6102,11 @@  discard block
 block discarded – undo
6102 6102
 	* @return Array the airport list
6103 6103
 	*
6104 6104
 	*/
6105
-	public function countAllDepartureAirportCountriesByAirport($airport_icao,$filters = array())
6105
+	public function countAllDepartureAirportCountriesByAirport($airport_icao, $filters = array())
6106 6106
 	{
6107
-		$filter_query = $this->getFilter($filters,true,true);
6108
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
6109
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6107
+		$filter_query = $this->getFilter($filters, true, true);
6108
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
6109
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6110 6110
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.arrival_airport_icao = :airport_icao 
6111 6111
                     GROUP BY spotter_output.departure_airport_country
6112 6112
 					ORDER BY airport_departure_country_count DESC";
@@ -6118,7 +6118,7 @@  discard block
 block discarded – undo
6118 6118
 		$airport_array = array();
6119 6119
 		$temp_array = array();
6120 6120
         
6121
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6121
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6122 6122
 		{
6123 6123
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
6124 6124
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -6137,11 +6137,11 @@  discard block
 block discarded – undo
6137 6137
 	* @return Array the airport list
6138 6138
 	*
6139 6139
 	*/
6140
-	public function countAllDepartureAirportsByManufacturer($aircraft_manufacturer,$filters = array())
6140
+	public function countAllDepartureAirportsByManufacturer($aircraft_manufacturer, $filters = array())
6141 6141
 	{
6142
-		$filter_query = $this->getFilter($filters,true,true);
6143
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
6144
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
6142
+		$filter_query = $this->getFilter($filters, true, true);
6143
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
6144
+		$query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
6145 6145
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer AND spotter_output.departure_airport_icao <> '' 
6146 6146
                     GROUP BY spotter_output.departure_airport_icao
6147 6147
 					ORDER BY airport_departure_icao_count DESC";
@@ -6153,7 +6153,7 @@  discard block
 block discarded – undo
6153 6153
 		$airport_array = array();
6154 6154
 		$temp_array = array();
6155 6155
         
6156
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6156
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6157 6157
 		{
6158 6158
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
6159 6159
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -6174,11 +6174,11 @@  discard block
 block discarded – undo
6174 6174
 	* @return Array the airport list
6175 6175
 	*
6176 6176
 	*/
6177
-	public function countAllDepartureAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array())
6177
+	public function countAllDepartureAirportCountriesByManufacturer($aircraft_manufacturer, $filters = array())
6178 6178
 	{
6179
-		$filter_query = $this->getFilter($filters,true,true);
6180
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
6181
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6179
+		$filter_query = $this->getFilter($filters, true, true);
6180
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
6181
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6182 6182
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer 
6183 6183
                     GROUP BY spotter_output.departure_airport_country
6184 6184
 					ORDER BY airport_departure_country_count DESC";
@@ -6190,7 +6190,7 @@  discard block
 block discarded – undo
6190 6190
 		$airport_array = array();
6191 6191
 		$temp_array = array();
6192 6192
         
6193
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6193
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6194 6194
 		{
6195 6195
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
6196 6196
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -6208,11 +6208,11 @@  discard block
 block discarded – undo
6208 6208
 	* @return Array the airport list
6209 6209
 	*
6210 6210
 	*/
6211
-	public function countAllDepartureAirportsByDate($date,$filters = array())
6211
+	public function countAllDepartureAirportsByDate($date, $filters = array())
6212 6212
 	{
6213 6213
 		global $globalTimezone, $globalDBdriver;
6214
-		$filter_query = $this->getFilter($filters,true,true);
6215
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
6214
+		$filter_query = $this->getFilter($filters, true, true);
6215
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
6216 6216
 		if ($globalTimezone != '') {
6217 6217
 			date_default_timezone_set($globalTimezone);
6218 6218
 			$datetime = new DateTime($date);
@@ -6220,12 +6220,12 @@  discard block
 block discarded – undo
6220 6220
 		} else $offset = '+00:00';
6221 6221
 
6222 6222
 		if ($globalDBdriver == 'mysql') {
6223
-			$query  = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
6223
+			$query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
6224 6224
 					FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date
6225 6225
 					GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
6226 6226
 					ORDER BY airport_departure_icao_count DESC";
6227 6227
 		} else {
6228
-			$query  = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
6228
+			$query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
6229 6229
 					FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date
6230 6230
 					GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
6231 6231
 					ORDER BY airport_departure_icao_count DESC";
@@ -6237,7 +6237,7 @@  discard block
 block discarded – undo
6237 6237
 		$airport_array = array();
6238 6238
 		$temp_array = array();
6239 6239
         
6240
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6240
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6241 6241
 		{
6242 6242
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
6243 6243
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -6258,11 +6258,11 @@  discard block
 block discarded – undo
6258 6258
 	* @return Array the airport list
6259 6259
 	*
6260 6260
 	*/
6261
-	public function countAllDepartureAirportCountriesByDate($date,$filters = array())
6261
+	public function countAllDepartureAirportCountriesByDate($date, $filters = array())
6262 6262
 	{
6263 6263
 		global $globalTimezone, $globalDBdriver;
6264
-		$filter_query = $this->getFilter($filters,true,true);
6265
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
6264
+		$filter_query = $this->getFilter($filters, true, true);
6265
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
6266 6266
 		if ($globalTimezone != '') {
6267 6267
 			date_default_timezone_set($globalTimezone);
6268 6268
 			$datetime = new DateTime($date);
@@ -6270,12 +6270,12 @@  discard block
 block discarded – undo
6270 6270
 		} else $offset = '+00:00';
6271 6271
 
6272 6272
 		if ($globalDBdriver == 'mysql') {
6273
-			$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6273
+			$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6274 6274
 					FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
6275 6275
 					GROUP BY spotter_output.departure_airport_country
6276 6276
 					ORDER BY airport_departure_country_count DESC";
6277 6277
 		} else {
6278
-			$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6278
+			$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6279 6279
 					FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date 
6280 6280
 					GROUP BY spotter_output.departure_airport_country
6281 6281
 					ORDER BY airport_departure_country_count DESC";
@@ -6287,7 +6287,7 @@  discard block
 block discarded – undo
6287 6287
 		$airport_array = array();
6288 6288
 		$temp_array = array();
6289 6289
         
6290
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6290
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6291 6291
 		{
6292 6292
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
6293 6293
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -6305,11 +6305,11 @@  discard block
 block discarded – undo
6305 6305
 	* @return Array the airport list
6306 6306
 	*
6307 6307
 	*/
6308
-	public function countAllDepartureAirportsByIdent($ident,$filters = array())
6308
+	public function countAllDepartureAirportsByIdent($ident, $filters = array())
6309 6309
 	{
6310
-		$filter_query = $this->getFilter($filters,true,true);
6311
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
6312
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
6310
+		$filter_query = $this->getFilter($filters, true, true);
6311
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
6312
+		$query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
6313 6313
 		    FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> '' AND spotter_output.ident = :ident 
6314 6314
                     GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
6315 6315
 		    ORDER BY airport_departure_icao_count DESC";
@@ -6321,7 +6321,7 @@  discard block
 block discarded – undo
6321 6321
 		$airport_array = array();
6322 6322
 		$temp_array = array();
6323 6323
         
6324
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6324
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6325 6325
 		{
6326 6326
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
6327 6327
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -6343,11 +6343,11 @@  discard block
 block discarded – undo
6343 6343
 	* @return Array the airport list
6344 6344
 	*
6345 6345
 	*/
6346
-	public function countAllDepartureAirportCountriesByIdent($ident,$filters = array())
6346
+	public function countAllDepartureAirportCountriesByIdent($ident, $filters = array())
6347 6347
 	{
6348
-		$filter_query = $this->getFilter($filters,true,true);
6349
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
6350
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6348
+		$filter_query = $this->getFilter($filters, true, true);
6349
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
6350
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6351 6351
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.ident = :ident 
6352 6352
                     GROUP BY spotter_output.departure_airport_country
6353 6353
 					ORDER BY airport_departure_country_count DESC";
@@ -6359,7 +6359,7 @@  discard block
 block discarded – undo
6359 6359
 		$airport_array = array();
6360 6360
 		$temp_array = array();
6361 6361
         
6362
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6362
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6363 6363
 		{
6364 6364
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
6365 6365
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -6378,12 +6378,12 @@  discard block
 block discarded – undo
6378 6378
 	* @return Array the airport list
6379 6379
 	*
6380 6380
 	*/
6381
-	public function countAllDepartureAirportsByCountry($country,$filters = array())
6381
+	public function countAllDepartureAirportsByCountry($country, $filters = array())
6382 6382
 	{
6383
-		$filter_query = $this->getFilter($filters,true,true);
6384
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
6383
+		$filter_query = $this->getFilter($filters, true, true);
6384
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
6385 6385
 
6386
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
6386
+		$query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
6387 6387
 			    FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country
6388 6388
 			    GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
6389 6389
 			    ORDER BY airport_departure_icao_count DESC";
@@ -6395,7 +6395,7 @@  discard block
 block discarded – undo
6395 6395
 		$airport_array = array();
6396 6396
 		$temp_array = array();
6397 6397
         
6398
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6398
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6399 6399
 		{
6400 6400
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
6401 6401
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -6416,11 +6416,11 @@  discard block
 block discarded – undo
6416 6416
 	* @return Array the airport list
6417 6417
 	*
6418 6418
 	*/
6419
-	public function countAllDepartureAirportCountriesByCountry($country,$filters = array())
6419
+	public function countAllDepartureAirportCountriesByCountry($country, $filters = array())
6420 6420
 	{
6421
-		$filter_query = $this->getFilter($filters,true,true);
6422
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
6423
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6421
+		$filter_query = $this->getFilter($filters, true, true);
6422
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
6423
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6424 6424
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country 
6425 6425
                     GROUP BY spotter_output.departure_airport_country
6426 6426
 					ORDER BY airport_departure_country_count DESC";
@@ -6432,7 +6432,7 @@  discard block
 block discarded – undo
6432 6432
 		$airport_array = array();
6433 6433
 		$temp_array = array();
6434 6434
         
6435
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6435
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6436 6436
 		{
6437 6437
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
6438 6438
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -6455,11 +6455,11 @@  discard block
 block discarded – undo
6455 6455
 	* @return Array the airport list
6456 6456
 	*
6457 6457
 	*/
6458
-	public function countAllArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array())
6458
+	public function countAllArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false, $filters = array())
6459 6459
 	{
6460 6460
 		global $globalDBdriver;
6461
-		$filter_query = $this->getFilter($filters,true,true);
6462
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
6461
+		$filter_query = $this->getFilter($filters, true, true);
6462
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
6463 6463
 				FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> ''";
6464 6464
                 if ($olderthanmonths > 0) {
6465 6465
             		if ($globalDBdriver == 'mysql') {
@@ -6489,7 +6489,7 @@  discard block
 block discarded – undo
6489 6489
 		$airport_array = array();
6490 6490
 		$temp_array = array();
6491 6491
         
6492
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6492
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6493 6493
 		{
6494 6494
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
6495 6495
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -6512,11 +6512,11 @@  discard block
 block discarded – undo
6512 6512
 	* @return Array the airport list
6513 6513
 	*
6514 6514
 	*/
6515
-	public function countAllArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array())
6515
+	public function countAllArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false, $filters = array())
6516 6516
 	{
6517 6517
 		global $globalDBdriver;
6518
-		$filter_query = $this->getFilter($filters,true,true);
6519
-		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
6518
+		$filter_query = $this->getFilter($filters, true, true);
6519
+		$query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
6520 6520
 			FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' ";
6521 6521
                 if ($olderthanmonths > 0) {
6522 6522
             		if ($globalDBdriver == 'mysql') {
@@ -6546,7 +6546,7 @@  discard block
 block discarded – undo
6546 6546
 		$airport_array = array();
6547 6547
 		$temp_array = array();
6548 6548
         
6549
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6549
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6550 6550
 		{
6551 6551
 			$temp_array['airline_icao'] = $row['airline_icao'];
6552 6552
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
@@ -6571,11 +6571,11 @@  discard block
 block discarded – undo
6571 6571
 	* @return Array the airport list
6572 6572
 	*
6573 6573
 	*/
6574
-	public function countAllDetectedArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array())
6574
+	public function countAllDetectedArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false, $filters = array())
6575 6575
 	{
6576 6576
 		global $globalDBdriver;
6577
-		$filter_query = $this->getFilter($filters,true,true);
6578
-		$query  = "SELECT DISTINCT spotter_output.real_arrival_airport_icao as arrival_airport_icao, COUNT(spotter_output.real_arrival_airport_icao) AS airport_arrival_icao_count, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country 
6577
+		$filter_query = $this->getFilter($filters, true, true);
6578
+		$query = "SELECT DISTINCT spotter_output.real_arrival_airport_icao as arrival_airport_icao, COUNT(spotter_output.real_arrival_airport_icao) AS airport_arrival_icao_count, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country 
6579 6579
 			FROM airport,spotter_output".$filter_query." spotter_output.real_arrival_airport_icao <> '' AND spotter_output.real_arrival_airport_icao <> 'NA' AND airport.icao = spotter_output.real_arrival_airport_icao";
6580 6580
                 if ($olderthanmonths > 0) {
6581 6581
             		if ($globalDBdriver == 'mysql') {
@@ -6604,7 +6604,7 @@  discard block
 block discarded – undo
6604 6604
 		$airport_array = array();
6605 6605
 		$temp_array = array();
6606 6606
         
6607
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6607
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6608 6608
 		{
6609 6609
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
6610 6610
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -6627,11 +6627,11 @@  discard block
 block discarded – undo
6627 6627
 	* @return Array the airport list
6628 6628
 	*
6629 6629
 	*/
6630
-	public function countAllDetectedArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array())
6630
+	public function countAllDetectedArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false, $filters = array())
6631 6631
 	{
6632 6632
 		global $globalDBdriver;
6633
-		$filter_query = $this->getFilter($filters,true,true);
6634
-		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.real_arrival_airport_icao as arrival_airport_icao, COUNT(spotter_output.real_arrival_airport_icao) AS airport_arrival_icao_count, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country 
6633
+		$filter_query = $this->getFilter($filters, true, true);
6634
+		$query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.real_arrival_airport_icao as arrival_airport_icao, COUNT(spotter_output.real_arrival_airport_icao) AS airport_arrival_icao_count, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country 
6635 6635
 			FROM airport,spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.real_arrival_airport_icao <> '' AND spotter_output.real_arrival_airport_icao <> 'NA' AND airport.icao = spotter_output.real_arrival_airport_icao ";
6636 6636
                 if ($olderthanmonths > 0) {
6637 6637
             		if ($globalDBdriver == 'mysql') {
@@ -6661,7 +6661,7 @@  discard block
 block discarded – undo
6661 6661
 		$airport_array = array();
6662 6662
 		$temp_array = array();
6663 6663
         
6664
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6664
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6665 6665
 		{
6666 6666
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
6667 6667
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -6687,9 +6687,9 @@  discard block
 block discarded – undo
6687 6687
 	*/
6688 6688
 	public function countAllArrivalAirportsByAirline($airline_icao, $filters = array())
6689 6689
 	{
6690
-		$filter_query = $this->getFilter($filters,true,true);
6691
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
6692
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
6690
+		$filter_query = $this->getFilter($filters, true, true);
6691
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
6692
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
6693 6693
 			    FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' AND spotter_output.airline_icao = :airline_icao 
6694 6694
 			    GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
6695 6695
 			    ORDER BY airport_arrival_icao_count DESC";
@@ -6700,7 +6700,7 @@  discard block
 block discarded – undo
6700 6700
 		$airport_array = array();
6701 6701
 		$temp_array = array();
6702 6702
         
6703
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6703
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6704 6704
 		{
6705 6705
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
6706 6706
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -6721,12 +6721,12 @@  discard block
 block discarded – undo
6721 6721
 	* @return Array the airport list
6722 6722
 	*
6723 6723
 	*/
6724
-	public function countAllArrivalAirportCountriesByAirline($airline_icao,$filters = array())
6724
+	public function countAllArrivalAirportCountriesByAirline($airline_icao, $filters = array())
6725 6725
 	{
6726
-		$filter_query = $this->getFilter($filters,true,true);
6727
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
6726
+		$filter_query = $this->getFilter($filters, true, true);
6727
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
6728 6728
 					
6729
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6729
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6730 6730
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.airline_icao = :airline_icao 
6731 6731
                     GROUP BY spotter_output.arrival_airport_country
6732 6732
 					ORDER BY airport_arrival_country_count DESC";
@@ -6738,7 +6738,7 @@  discard block
 block discarded – undo
6738 6738
 		$airport_array = array();
6739 6739
 		$temp_array = array();
6740 6740
         
6741
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6741
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6742 6742
 		{
6743 6743
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
6744 6744
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -6756,11 +6756,11 @@  discard block
 block discarded – undo
6756 6756
 	* @return Array the airport list
6757 6757
 	*
6758 6758
 	*/
6759
-	public function countAllArrivalAirportsByAircraft($aircraft_icao,$filters = array())
6759
+	public function countAllArrivalAirportsByAircraft($aircraft_icao, $filters = array())
6760 6760
 	{
6761
-		$filter_query = $this->getFilter($filters,true,true);
6762
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
6763
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
6761
+		$filter_query = $this->getFilter($filters, true, true);
6762
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
6763
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
6764 6764
 			    FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' AND spotter_output.aircraft_icao = :aircraft_icao 
6765 6765
 			    GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
6766 6766
 			    ORDER BY airport_arrival_icao_count DESC";
@@ -6772,7 +6772,7 @@  discard block
 block discarded – undo
6772 6772
 		$airport_array = array();
6773 6773
 		$temp_array = array();
6774 6774
         
6775
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6775
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6776 6776
 		{
6777 6777
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
6778 6778
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -6794,11 +6794,11 @@  discard block
 block discarded – undo
6794 6794
 	* @return Array the airport list
6795 6795
 	*
6796 6796
 	*/
6797
-	public function countAllArrivalAirportCountriesByAircraft($aircraft_icao,$filters = array())
6797
+	public function countAllArrivalAirportCountriesByAircraft($aircraft_icao, $filters = array())
6798 6798
 	{
6799
-		$filter_query = $this->getFilter($filters,true,true);
6800
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
6801
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6799
+		$filter_query = $this->getFilter($filters, true, true);
6800
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
6801
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6802 6802
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.aircraft_icao = :aircraft_icao
6803 6803
                     GROUP BY spotter_output.arrival_airport_country
6804 6804
 					ORDER BY airport_arrival_country_count DESC";
@@ -6810,7 +6810,7 @@  discard block
 block discarded – undo
6810 6810
 		$airport_array = array();
6811 6811
 		$temp_array = array();
6812 6812
         
6813
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6813
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6814 6814
 		{
6815 6815
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
6816 6816
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -6828,12 +6828,12 @@  discard block
 block discarded – undo
6828 6828
 	* @return Array the airport list
6829 6829
 	*
6830 6830
 	*/
6831
-	public function countAllArrivalAirportsByRegistration($registration,$filters = array())
6831
+	public function countAllArrivalAirportsByRegistration($registration, $filters = array())
6832 6832
 	{
6833
-		$filter_query = $this->getFilter($filters,true,true);
6834
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
6833
+		$filter_query = $this->getFilter($filters, true, true);
6834
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
6835 6835
 
6836
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
6836
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
6837 6837
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' AND spotter_output.registration = :registration 
6838 6838
                     GROUP BY spotter_output.arrival_airport_icao
6839 6839
 					ORDER BY airport_arrival_icao_count DESC";
@@ -6845,7 +6845,7 @@  discard block
 block discarded – undo
6845 6845
 		$airport_array = array();
6846 6846
 		$temp_array = array();
6847 6847
         
6848
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6848
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6849 6849
 		{
6850 6850
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
6851 6851
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -6866,11 +6866,11 @@  discard block
 block discarded – undo
6866 6866
 	* @return Array the airport list
6867 6867
 	*
6868 6868
 	*/
6869
-	public function countAllArrivalAirportCountriesByRegistration($registration,$filters = array())
6869
+	public function countAllArrivalAirportCountriesByRegistration($registration, $filters = array())
6870 6870
 	{
6871
-		$filter_query = $this->getFilter($filters,true,true);
6872
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
6873
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6871
+		$filter_query = $this->getFilter($filters, true, true);
6872
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
6873
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6874 6874
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.registration = :registration 
6875 6875
                     GROUP BY spotter_output.arrival_airport_country
6876 6876
 					ORDER BY airport_arrival_country_count DESC";
@@ -6882,7 +6882,7 @@  discard block
 block discarded – undo
6882 6882
 		$airport_array = array();
6883 6883
 		$temp_array = array();
6884 6884
         
6885
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6885
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6886 6886
 		{
6887 6887
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
6888 6888
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -6901,11 +6901,11 @@  discard block
 block discarded – undo
6901 6901
 	* @return Array the airport list
6902 6902
 	*
6903 6903
 	*/
6904
-	public function countAllArrivalAirportsByAirport($airport_icao,$filters = array())
6904
+	public function countAllArrivalAirportsByAirport($airport_icao, $filters = array())
6905 6905
 	{
6906
-		$filter_query = $this->getFilter($filters,true,true);
6907
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
6908
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
6906
+		$filter_query = $this->getFilter($filters, true, true);
6907
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
6908
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
6909 6909
 			    FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' AND spotter_output.departure_airport_icao = :airport_icao 
6910 6910
 			    GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
6911 6911
 			    ORDER BY airport_arrival_icao_count DESC";
@@ -6917,7 +6917,7 @@  discard block
 block discarded – undo
6917 6917
 		$airport_array = array();
6918 6918
 		$temp_array = array();
6919 6919
         
6920
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6920
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6921 6921
 		{
6922 6922
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
6923 6923
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -6938,11 +6938,11 @@  discard block
 block discarded – undo
6938 6938
 	* @return Array the airport list
6939 6939
 	*
6940 6940
 	*/
6941
-	public function countAllArrivalAirportCountriesByAirport($airport_icao,$filters = array())
6941
+	public function countAllArrivalAirportCountriesByAirport($airport_icao, $filters = array())
6942 6942
 	{
6943
-		$filter_query = $this->getFilter($filters,true,true);
6944
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
6945
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6943
+		$filter_query = $this->getFilter($filters, true, true);
6944
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
6945
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6946 6946
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.departure_airport_icao = :airport_icao 
6947 6947
                     GROUP BY spotter_output.arrival_airport_country
6948 6948
 					ORDER BY airport_arrival_country_count DESC";
@@ -6954,7 +6954,7 @@  discard block
 block discarded – undo
6954 6954
 		$airport_array = array();
6955 6955
 		$temp_array = array();
6956 6956
         
6957
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6957
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6958 6958
 		{
6959 6959
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
6960 6960
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -6972,11 +6972,11 @@  discard block
 block discarded – undo
6972 6972
 	* @return Array the airport list
6973 6973
 	*
6974 6974
 	*/
6975
-	public function countAllArrivalAirportsByManufacturer($aircraft_manufacturer,$filters = array())
6975
+	public function countAllArrivalAirportsByManufacturer($aircraft_manufacturer, $filters = array())
6976 6976
 	{
6977
-		$filter_query = $this->getFilter($filters,true,true);
6978
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
6979
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
6977
+		$filter_query = $this->getFilter($filters, true, true);
6978
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
6979
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
6980 6980
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer 
6981 6981
                     GROUP BY spotter_output.arrival_airport_icao
6982 6982
 					ORDER BY airport_arrival_icao_count DESC";
@@ -6988,7 +6988,7 @@  discard block
 block discarded – undo
6988 6988
 		$airport_array = array();
6989 6989
 		$temp_array = array();
6990 6990
         
6991
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6991
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6992 6992
 		{
6993 6993
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
6994 6994
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -7010,11 +7010,11 @@  discard block
 block discarded – undo
7010 7010
 	* @return Array the airport list
7011 7011
 	*
7012 7012
 	*/
7013
-	public function countAllArrivalAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array())
7013
+	public function countAllArrivalAirportCountriesByManufacturer($aircraft_manufacturer, $filters = array())
7014 7014
 	{
7015
-		$filter_query = $this->getFilter($filters,true,true);
7016
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
7017
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7015
+		$filter_query = $this->getFilter($filters, true, true);
7016
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
7017
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7018 7018
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer 
7019 7019
                     GROUP BY spotter_output.arrival_airport_country
7020 7020
 					ORDER BY airport_arrival_country_count DESC";
@@ -7026,7 +7026,7 @@  discard block
 block discarded – undo
7026 7026
 		$airport_array = array();
7027 7027
 		$temp_array = array();
7028 7028
         
7029
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7029
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7030 7030
 		{
7031 7031
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
7032 7032
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -7045,11 +7045,11 @@  discard block
 block discarded – undo
7045 7045
 	* @return Array the airport list
7046 7046
 	*
7047 7047
 	*/
7048
-	public function countAllArrivalAirportsByDate($date,$filters = array())
7048
+	public function countAllArrivalAirportsByDate($date, $filters = array())
7049 7049
 	{
7050 7050
 		global $globalTimezone, $globalDBdriver;
7051
-		$filter_query = $this->getFilter($filters,true,true);
7052
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
7051
+		$filter_query = $this->getFilter($filters, true, true);
7052
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
7053 7053
 		if ($globalTimezone != '') {
7054 7054
 			date_default_timezone_set($globalTimezone);
7055 7055
 			$datetime = new DateTime($date);
@@ -7057,12 +7057,12 @@  discard block
 block discarded – undo
7057 7057
 		} else $offset = '+00:00';
7058 7058
 
7059 7059
 		if ($globalDBdriver == 'mysql') {
7060
-			$query  = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
7060
+			$query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
7061 7061
 					FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date  
7062 7062
 					GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
7063 7063
 					ORDER BY airport_arrival_icao_count DESC";
7064 7064
 		} else {
7065
-			$query  = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
7065
+			$query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
7066 7066
 					FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date  
7067 7067
 					GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
7068 7068
 					ORDER BY airport_arrival_icao_count DESC";
@@ -7074,7 +7074,7 @@  discard block
 block discarded – undo
7074 7074
 		$airport_array = array();
7075 7075
 		$temp_array = array();
7076 7076
         
7077
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7077
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7078 7078
 		{
7079 7079
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
7080 7080
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -7098,8 +7098,8 @@  discard block
 block discarded – undo
7098 7098
 	public function countAllArrivalAirportCountriesByDate($date, $filters = array())
7099 7099
 	{
7100 7100
 		global $globalTimezone, $globalDBdriver;
7101
-		$filter_query = $this->getFilter($filters,true,true);
7102
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
7101
+		$filter_query = $this->getFilter($filters, true, true);
7102
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
7103 7103
 		if ($globalTimezone != '') {
7104 7104
 			date_default_timezone_set($globalTimezone);
7105 7105
 			$datetime = new DateTime($date);
@@ -7107,12 +7107,12 @@  discard block
 block discarded – undo
7107 7107
 		} else $offset = '+00:00';
7108 7108
 
7109 7109
 		if ($globalDBdriver == 'mysql') {
7110
-			$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7110
+			$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7111 7111
 					FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
7112 7112
 					GROUP BY spotter_output.arrival_airport_country
7113 7113
 					ORDER BY airport_arrival_country_count DESC";
7114 7114
 		} else {
7115
-			$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7115
+			$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7116 7116
 					FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date 
7117 7117
 					GROUP BY spotter_output.arrival_airport_country
7118 7118
 					ORDER BY airport_arrival_country_count DESC";
@@ -7124,7 +7124,7 @@  discard block
 block discarded – undo
7124 7124
 		$airport_array = array();
7125 7125
 		$temp_array = array();
7126 7126
         
7127
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7127
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7128 7128
 		{
7129 7129
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
7130 7130
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -7142,11 +7142,11 @@  discard block
 block discarded – undo
7142 7142
 	* @return Array the airport list
7143 7143
 	*
7144 7144
 	*/
7145
-	public function countAllArrivalAirportsByIdent($ident,$filters = array())
7145
+	public function countAllArrivalAirportsByIdent($ident, $filters = array())
7146 7146
 	{
7147
-		$filter_query = $this->getFilter($filters,true,true);
7148
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
7149
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
7147
+		$filter_query = $this->getFilter($filters, true, true);
7148
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
7149
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
7150 7150
 		    FROM spotter_output".$filter_query." WHERE spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' AND spotter_output.ident = :ident  
7151 7151
                     GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
7152 7152
 		    ORDER BY airport_arrival_icao_count DESC";
@@ -7158,7 +7158,7 @@  discard block
 block discarded – undo
7158 7158
 		$airport_array = array();
7159 7159
 		$temp_array = array();
7160 7160
         
7161
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7161
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7162 7162
 		{
7163 7163
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
7164 7164
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -7181,9 +7181,9 @@  discard block
 block discarded – undo
7181 7181
 	*/
7182 7182
 	public function countAllArrivalAirportCountriesByIdent($ident, $filters = array())
7183 7183
 	{
7184
-		$filter_query = $this->getFilter($filters,true,true);
7185
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
7186
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7184
+		$filter_query = $this->getFilter($filters, true, true);
7185
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
7186
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7187 7187
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.ident = :ident 
7188 7188
                     GROUP BY spotter_output.arrival_airport_country
7189 7189
 					ORDER BY airport_arrival_country_count DESC";
@@ -7195,7 +7195,7 @@  discard block
 block discarded – undo
7195 7195
 		$airport_array = array();
7196 7196
 		$temp_array = array();
7197 7197
         
7198
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7198
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7199 7199
 		{
7200 7200
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
7201 7201
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -7214,11 +7214,11 @@  discard block
 block discarded – undo
7214 7214
 	* @return Array the airport list
7215 7215
 	*
7216 7216
 	*/
7217
-	public function countAllArrivalAirportsByCountry($country,$filters = array())
7217
+	public function countAllArrivalAirportsByCountry($country, $filters = array())
7218 7218
 	{
7219
-		$filter_query = $this->getFilter($filters,true,true);
7220
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
7221
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
7219
+		$filter_query = $this->getFilter($filters, true, true);
7220
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
7221
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
7222 7222
 			    FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country  
7223 7223
 			    GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
7224 7224
 			    ORDER BY airport_arrival_icao_count DESC";
@@ -7230,7 +7230,7 @@  discard block
 block discarded – undo
7230 7230
 		$airport_array = array();
7231 7231
 		$temp_array = array();
7232 7232
         
7233
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7233
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7234 7234
 		{
7235 7235
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
7236 7236
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -7251,11 +7251,11 @@  discard block
 block discarded – undo
7251 7251
 	* @return Array the airport list
7252 7252
 	*
7253 7253
 	*/
7254
-	public function countAllArrivalAirportCountriesByCountry($country,$filters = array())
7254
+	public function countAllArrivalAirportCountriesByCountry($country, $filters = array())
7255 7255
 	{
7256
-		$filter_query = $this->getFilter($filters,true,true);
7257
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
7258
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7256
+		$filter_query = $this->getFilter($filters, true, true);
7257
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
7258
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7259 7259
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country 
7260 7260
                     GROUP BY spotter_output.arrival_airport_country
7261 7261
 					ORDER BY airport_arrival_country_count DESC";
@@ -7267,7 +7267,7 @@  discard block
 block discarded – undo
7267 7267
 		$airport_array = array();
7268 7268
 		$temp_array = array();
7269 7269
         
7270
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7270
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7271 7271
 		{
7272 7272
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
7273 7273
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -7288,7 +7288,7 @@  discard block
 block discarded – undo
7288 7288
 	*/
7289 7289
 	public function countAllDepartureCountries($filters = array())
7290 7290
 	{
7291
-		$filter_query = $this->getFilter($filters,true,true);
7291
+		$filter_query = $this->getFilter($filters, true, true);
7292 7292
 		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7293 7293
 				FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> ''";
7294 7294
 		$query .= " GROUP BY spotter_output.departure_airport_country
@@ -7302,7 +7302,7 @@  discard block
 block discarded – undo
7302 7302
 		$airport_array = array();
7303 7303
 		$temp_array = array();
7304 7304
         
7305
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7305
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7306 7306
 		{
7307 7307
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
7308 7308
 			$temp_array['airport_departure_country'] = $row['departure_airport_country'];
@@ -7320,9 +7320,9 @@  discard block
 block discarded – undo
7320 7320
 	* @return Array the airport arrival list
7321 7321
 	*
7322 7322
 	*/
7323
-	public function countAllArrivalCountries($limit = true,$filters = array())
7323
+	public function countAllArrivalCountries($limit = true, $filters = array())
7324 7324
 	{
7325
-		$filter_query = $this->getFilter($filters,true,true);
7325
+		$filter_query = $this->getFilter($filters, true, true);
7326 7326
 		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7327 7327
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> ''";
7328 7328
 		$query .= " GROUP BY spotter_output.arrival_airport_country
@@ -7336,7 +7336,7 @@  discard block
 block discarded – undo
7336 7336
 		$airport_array = array();
7337 7337
 		$temp_array = array();
7338 7338
         
7339
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7339
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7340 7340
 		{
7341 7341
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
7342 7342
 			$temp_array['airport_arrival_country'] = $row['arrival_airport_country'];
@@ -7359,8 +7359,8 @@  discard block
 block discarded – undo
7359 7359
 	*/
7360 7360
 	public function countAllRoutes($filters = array())
7361 7361
 	{
7362
-		$filter_query = $this->getFilter($filters,true,true);
7363
-		$query  = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7362
+		$filter_query = $this->getFilter($filters, true, true);
7363
+		$query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7364 7364
 		    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> ''
7365 7365
                     GROUP BY route,spotter_output.departure_airport_icao, spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
7366 7366
                     ORDER BY route_count DESC
@@ -7373,7 +7373,7 @@  discard block
 block discarded – undo
7373 7373
 		$routes_array = array();
7374 7374
 		$temp_array = array();
7375 7375
         
7376
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7376
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7377 7377
 		{
7378 7378
 			$temp_array['route_count'] = $row['route_count'];
7379 7379
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -7400,11 +7400,11 @@  discard block
 block discarded – undo
7400 7400
 	* @return Array the route list
7401 7401
 	*
7402 7402
 	*/
7403
-	public function countAllRoutesByAircraft($aircraft_icao,$filters = array())
7403
+	public function countAllRoutesByAircraft($aircraft_icao, $filters = array())
7404 7404
 	{
7405
-		$filter_query = $this->getFilter($filters,true,true);
7406
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
7407
-		$query  = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7405
+		$filter_query = $this->getFilter($filters, true, true);
7406
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
7407
+		$query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7408 7408
 			    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.aircraft_icao = :aircraft_icao 
7409 7409
 			    GROUP BY route, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
7410 7410
 			    ORDER BY route_count DESC";
@@ -7415,7 +7415,7 @@  discard block
 block discarded – undo
7415 7415
 		$routes_array = array();
7416 7416
 		$temp_array = array();
7417 7417
         
7418
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7418
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7419 7419
 		{
7420 7420
 			$temp_array['route_count'] = $row['route_count'];
7421 7421
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -7442,9 +7442,9 @@  discard block
 block discarded – undo
7442 7442
 	*/
7443 7443
 	public function countAllRoutesByRegistration($registration, $filters = array())
7444 7444
 	{
7445
-		$filter_query = $this->getFilter($filters,true,true);
7445
+		$filter_query = $this->getFilter($filters, true, true);
7446 7446
 		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
7447
-		$query  = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7447
+		$query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7448 7448
 			FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.registration = :registration 
7449 7449
                     GROUP BY route
7450 7450
                     ORDER BY route_count DESC";
@@ -7456,7 +7456,7 @@  discard block
 block discarded – undo
7456 7456
 		$routes_array = array();
7457 7457
 		$temp_array = array();
7458 7458
         
7459
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7459
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7460 7460
 		{
7461 7461
 			$temp_array['route_count'] = $row['route_count'];
7462 7462
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -7484,9 +7484,9 @@  discard block
 block discarded – undo
7484 7484
 	*/
7485 7485
 	public function countAllRoutesByAirline($airline_icao, $filters = array())
7486 7486
 	{
7487
-		$filter_query = $this->getFilter($filters,true,true);
7488
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
7489
-		$query  = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7487
+		$filter_query = $this->getFilter($filters, true, true);
7488
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
7489
+		$query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7490 7490
 			    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.airline_icao = :airline_icao 
7491 7491
 			    GROUP BY route, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
7492 7492
 			    ORDER BY route_count DESC";
@@ -7498,7 +7498,7 @@  discard block
 block discarded – undo
7498 7498
 		$routes_array = array();
7499 7499
 		$temp_array = array();
7500 7500
         
7501
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7501
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7502 7502
 		{
7503 7503
 			$temp_array['route_count'] = $row['route_count'];
7504 7504
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -7526,9 +7526,9 @@  discard block
 block discarded – undo
7526 7526
 	*/
7527 7527
 	public function countAllRoutesByAirport($airport_icao, $filters = array())
7528 7528
 	{
7529
-		$filter_query = $this->getFilter($filters,true,true);
7530
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
7531
-		$query  = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7529
+		$filter_query = $this->getFilter($filters, true, true);
7530
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
7531
+		$query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7532 7532
 			    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao)
7533 7533
 			    GROUP BY route, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
7534 7534
 			    ORDER BY route_count DESC";
@@ -7539,7 +7539,7 @@  discard block
 block discarded – undo
7539 7539
 		$routes_array = array();
7540 7540
 		$temp_array = array();
7541 7541
         
7542
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7542
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7543 7543
 		{
7544 7544
 			$temp_array['route_count'] = $row['route_count'];
7545 7545
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -7567,9 +7567,9 @@  discard block
 block discarded – undo
7567 7567
 	*/
7568 7568
 	public function countAllRoutesByCountry($country, $filters = array())
7569 7569
 	{
7570
-		$filter_query = $this->getFilter($filters,true,true);
7571
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
7572
-		$query  = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7570
+		$filter_query = $this->getFilter($filters, true, true);
7571
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
7572
+		$query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7573 7573
 			    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country 
7574 7574
 			    GROUP BY route, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
7575 7575
 			    ORDER BY route_count DESC";
@@ -7580,7 +7580,7 @@  discard block
 block discarded – undo
7580 7580
 		$routes_array = array();
7581 7581
 		$temp_array = array();
7582 7582
         
7583
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7583
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7584 7584
 		{
7585 7585
 			$temp_array['route_count'] = $row['route_count'];
7586 7586
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -7608,8 +7608,8 @@  discard block
 block discarded – undo
7608 7608
 	public function countAllRoutesByDate($date, $filters = array())
7609 7609
 	{
7610 7610
 		global $globalTimezone, $globalDBdriver;
7611
-		$filter_query = $this->getFilter($filters,true,true);
7612
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
7611
+		$filter_query = $this->getFilter($filters, true, true);
7612
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
7613 7613
 		if ($globalTimezone != '') {
7614 7614
 			date_default_timezone_set($globalTimezone);
7615 7615
 			$datetime = new DateTime($date);
@@ -7617,12 +7617,12 @@  discard block
 block discarded – undo
7617 7617
 		} else $offset = '+00:00';
7618 7618
 		
7619 7619
 		if ($globalDBdriver == 'mysql') {
7620
-			$query  = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7620
+			$query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7621 7621
 				    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date  
7622 7622
 				    GROUP BY route, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
7623 7623
 				    ORDER BY route_count DESC";
7624 7624
 		} else {
7625
-			$query  = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7625
+			$query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7626 7626
 				    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date  
7627 7627
 				    GROUP BY route, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
7628 7628
 				    ORDER BY route_count DESC";
@@ -7634,7 +7634,7 @@  discard block
 block discarded – undo
7634 7634
 		$routes_array = array();
7635 7635
 		$temp_array = array();
7636 7636
         
7637
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7637
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7638 7638
 		{
7639 7639
 			$temp_array['route_count'] = $row['route_count'];
7640 7640
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -7661,9 +7661,9 @@  discard block
 block discarded – undo
7661 7661
 	*/
7662 7662
 	public function countAllRoutesByIdent($ident, $filters = array())
7663 7663
 	{
7664
-		$filter_query = $this->getFilter($filters,true,true);
7665
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
7666
-		$query  = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7664
+		$filter_query = $this->getFilter($filters, true, true);
7665
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
7666
+		$query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7667 7667
 		    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.ident = :ident   
7668 7668
                     GROUP BY route, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
7669 7669
                     ORDER BY route_count DESC";
@@ -7675,7 +7675,7 @@  discard block
 block discarded – undo
7675 7675
 		$routes_array = array();
7676 7676
 		$temp_array = array();
7677 7677
         
7678
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7678
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7679 7679
 		{
7680 7680
 			$temp_array['route_count'] = $row['route_count'];
7681 7681
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -7702,9 +7702,9 @@  discard block
 block discarded – undo
7702 7702
 	*/
7703 7703
 	public function countAllRoutesByManufacturer($aircraft_manufacturer, $filters = array())
7704 7704
 	{
7705
-		$filter_query = $this->getFilter($filters,true,true);
7706
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
7707
-		$query  = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7705
+		$filter_query = $this->getFilter($filters, true, true);
7706
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
7707
+		$query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7708 7708
 		    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer   
7709 7709
                     GROUP BY route
7710 7710
                     ORDER BY route_count DESC";
@@ -7716,7 +7716,7 @@  discard block
 block discarded – undo
7716 7716
 		$routes_array = array();
7717 7717
 		$temp_array = array();
7718 7718
         
7719
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7719
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7720 7720
 		{
7721 7721
 			$temp_array['route_count'] = $row['route_count'];
7722 7722
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -7744,8 +7744,8 @@  discard block
 block discarded – undo
7744 7744
 	*/
7745 7745
 	public function countAllRoutesWithWaypoints($filters = array())
7746 7746
 	{
7747
-		$filter_query = $this->getFilter($filters,true,true);
7748
-		$query  = "SELECT DISTINCT spotter_output.waypoints AS route, count(spotter_output.waypoints) AS route_count, spotter_output.spotter_id, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7747
+		$filter_query = $this->getFilter($filters, true, true);
7748
+		$query = "SELECT DISTINCT spotter_output.waypoints AS route, count(spotter_output.waypoints) AS route_count, spotter_output.spotter_id, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7749 7749
 		    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.waypoints <> '' 
7750 7750
                     GROUP BY route, spotter_output.spotter_id, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
7751 7751
                     ORDER BY route_count DESC
@@ -7758,7 +7758,7 @@  discard block
 block discarded – undo
7758 7758
 		$routes_array = array();
7759 7759
 		$temp_array = array();
7760 7760
         
7761
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7761
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7762 7762
 		{
7763 7763
 			$temp_array['spotter_id'] = $row['spotter_id'];
7764 7764
 			$temp_array['route_count'] = $row['route_count'];
@@ -7783,11 +7783,11 @@  discard block
 block discarded – undo
7783 7783
 	* @return Array the callsign list
7784 7784
 	*
7785 7785
 	*/
7786
-	public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
7786
+	public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
7787 7787
 	{
7788 7788
 		global $globalDBdriver;
7789
-		$filter_query = $this->getFilter($filters,true,true);
7790
-		$query  = "SELECT DISTINCT spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name, spotter_output.airline_icao  
7789
+		$filter_query = $this->getFilter($filters, true, true);
7790
+		$query = "SELECT DISTINCT spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name, spotter_output.airline_icao  
7791 7791
                     FROM spotter_output".$filter_query." spotter_output.ident <> '' ";
7792 7792
 		 if ($olderthanmonths > 0) {
7793 7793
 			if ($globalDBdriver == 'mysql') $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)';
@@ -7806,7 +7806,7 @@  discard block
 block discarded – undo
7806 7806
 		$callsign_array = array();
7807 7807
 		$temp_array = array();
7808 7808
         
7809
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7809
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7810 7810
 		{
7811 7811
 			$temp_array['callsign_icao'] = $row['ident'];
7812 7812
 			$temp_array['airline_name'] = $row['airline_name'];
@@ -7828,8 +7828,8 @@  discard block
 block discarded – undo
7828 7828
 	public function countAllCallsignsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
7829 7829
 	{
7830 7830
 		global $globalDBdriver;
7831
-		$filter_query = $this->getFilter($filters,true,true);
7832
-		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name  
7831
+		$filter_query = $this->getFilter($filters, true, true);
7832
+		$query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name  
7833 7833
                     FROM spotter_output".$filter_query." spotter_output.ident <> ''  AND spotter_output.airline_icao <> '' ";
7834 7834
 		 if ($olderthanmonths > 0) {
7835 7835
 			if ($globalDBdriver == 'mysql') $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
@@ -7848,7 +7848,7 @@  discard block
 block discarded – undo
7848 7848
 		$callsign_array = array();
7849 7849
 		$temp_array = array();
7850 7850
         
7851
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7851
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7852 7852
 		{
7853 7853
 			$temp_array['callsign_icao'] = $row['ident'];
7854 7854
 			$temp_array['airline_name'] = $row['airline_name'];
@@ -7902,7 +7902,7 @@  discard block
 block discarded – undo
7902 7902
 		$date_array = array();
7903 7903
 		$temp_array = array();
7904 7904
         
7905
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7905
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7906 7906
 		{
7907 7907
 			$temp_array['date_name'] = $row['date_name'];
7908 7908
 			$temp_array['date_count'] = $row['date_count'];
@@ -7927,15 +7927,15 @@  discard block
 block discarded – undo
7927 7927
 			$datetime = new DateTime();
7928 7928
 			$offset = $datetime->format('P');
7929 7929
 		} else $offset = '+00:00';
7930
-		$filter_query = $this->getFilter($filters,true,true);
7930
+		$filter_query = $this->getFilter($filters, true, true);
7931 7931
 		if ($globalDBdriver == 'mysql') {
7932
-			$query  = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
7932
+			$query = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
7933 7933
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' 
7934 7934
 								GROUP BY spotter_output.airline_icao, date_name 
7935 7935
 								ORDER BY date_count DESC
7936 7936
 								LIMIT 10 OFFSET 0";
7937 7937
 		} else {
7938
-			$query  = "SELECT spotter_output.airline_icao, to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') AS date_name, count(*) as date_count
7938
+			$query = "SELECT spotter_output.airline_icao, to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') AS date_name, count(*) as date_count
7939 7939
 								FROM spotter_output 
7940 7940
 								WHERE spotter_output.airline_icao <> '' 
7941 7941
 								GROUP BY spotter_output.airline_icao, date_name 
@@ -7950,7 +7950,7 @@  discard block
 block discarded – undo
7950 7950
 		$date_array = array();
7951 7951
 		$temp_array = array();
7952 7952
         
7953
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7953
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7954 7954
 		{
7955 7955
 			$temp_array['date_name'] = $row['date_name'];
7956 7956
 			$temp_array['date_count'] = $row['date_count'];
@@ -7976,7 +7976,7 @@  discard block
 block discarded – undo
7976 7976
 			$datetime = new DateTime();
7977 7977
 			$offset = $datetime->format('P');
7978 7978
 		} else $offset = '+00:00';
7979
-		$filter_query = $this->getFilter($filters,true,true);
7979
+		$filter_query = $this->getFilter($filters, true, true);
7980 7980
 		if ($globalDBdriver == 'mysql') {
7981 7981
 			$query  = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
7982 7982
 								FROM spotter_output".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY)";
@@ -7997,7 +7997,7 @@  discard block
 block discarded – undo
7997 7997
 		$date_array = array();
7998 7998
 		$temp_array = array();
7999 7999
         
8000
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8000
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8001 8001
 		{
8002 8002
 			$temp_array['date_name'] = $row['date_name'];
8003 8003
 			$temp_array['date_count'] = $row['date_count'];
@@ -8022,7 +8022,7 @@  discard block
 block discarded – undo
8022 8022
 			$datetime = new DateTime();
8023 8023
 			$offset = $datetime->format('P');
8024 8024
 		} else $offset = '+00:00';
8025
-		$filter_query = $this->getFilter($filters,true,true);
8025
+		$filter_query = $this->getFilter($filters, true, true);
8026 8026
 		if ($globalDBdriver == 'mysql') {
8027 8027
 			$query  = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
8028 8028
 								FROM spotter_output".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MONTH)";
@@ -8043,7 +8043,7 @@  discard block
 block discarded – undo
8043 8043
 		$date_array = array();
8044 8044
 		$temp_array = array();
8045 8045
         
8046
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8046
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8047 8047
 		{
8048 8048
 			$temp_array['date_name'] = $row['date_name'];
8049 8049
 			$temp_array['date_count'] = $row['date_count'];
@@ -8064,7 +8064,7 @@  discard block
 block discarded – undo
8064 8064
 	public function countAllDatesLastMonthByAirlines($filters = array())
8065 8065
 	{
8066 8066
 		global $globalTimezone, $globalDBdriver;
8067
-		$filter_query = $this->getFilter($filters,true,true);
8067
+		$filter_query = $this->getFilter($filters, true, true);
8068 8068
 		if ($globalTimezone != '') {
8069 8069
 			date_default_timezone_set($globalTimezone);
8070 8070
 			$datetime = new DateTime();
@@ -8072,13 +8072,13 @@  discard block
 block discarded – undo
8072 8072
 		} else $offset = '+00:00';
8073 8073
 		
8074 8074
 		if ($globalDBdriver == 'mysql') {
8075
-			$query  = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
8075
+			$query = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
8076 8076
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MONTH)
8077 8077
 								GROUP BY spotter_output.airline_icao, date_name 
8078 8078
 								ORDER BY spotter_output.date ASC";
8079 8079
 			$query_data = array(':offset' => $offset);
8080 8080
 		} else {
8081
-			$query  = "SELECT spotter_output.airline_icao, to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') AS date_name, count(*) as date_count
8081
+			$query = "SELECT spotter_output.airline_icao, to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') AS date_name, count(*) as date_count
8082 8082
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.date >= CURRENT_TIMESTAMP AT TIME ZONE INTERVAL :offset - INTERVAL '1 MONTHS'
8083 8083
 								GROUP BY spotter_output.airline_icao, date_name 
8084 8084
 								ORDER BY date_name ASC";
@@ -8091,7 +8091,7 @@  discard block
 block discarded – undo
8091 8091
 		$date_array = array();
8092 8092
 		$temp_array = array();
8093 8093
         
8094
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8094
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8095 8095
 		{
8096 8096
 			$temp_array['date_name'] = $row['date_name'];
8097 8097
 			$temp_array['date_count'] = $row['date_count'];
@@ -8138,7 +8138,7 @@  discard block
 block discarded – undo
8138 8138
 		$date_array = array();
8139 8139
 		$temp_array = array();
8140 8140
         
8141
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8141
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8142 8142
 		{
8143 8143
 			$temp_array['month_name'] = $row['month_name'];
8144 8144
 			$temp_array['year_name'] = $row['year_name'];
@@ -8159,7 +8159,7 @@  discard block
 block discarded – undo
8159 8159
 	public function countAllMonthsByAirlines($filters = array())
8160 8160
 	{
8161 8161
 		global $globalTimezone, $globalDBdriver;
8162
-		$filter_query = $this->getFilter($filters,true,true);
8162
+		$filter_query = $this->getFilter($filters, true, true);
8163 8163
 		if ($globalTimezone != '') {
8164 8164
 			date_default_timezone_set($globalTimezone);
8165 8165
 			$datetime = new DateTime();
@@ -8167,12 +8167,12 @@  discard block
 block discarded – undo
8167 8167
 		} else $offset = '+00:00';
8168 8168
 
8169 8169
 		if ($globalDBdriver == 'mysql') {
8170
-			$query  = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(*) as date_count
8170
+			$query = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(*) as date_count
8171 8171
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' 
8172 8172
 								GROUP BY spotter_output.airline_icao, year_name, month_name 
8173 8173
 								ORDER BY date_count DESC";
8174 8174
 		} else {
8175
-			$query  = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(*) as date_count
8175
+			$query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(*) as date_count
8176 8176
 								FROM spotter_output 
8177 8177
 								WHERE spotter_output.airline_icao <> '' 
8178 8178
 								GROUP BY spotter_output.airline_icao, year_name, month_name 
@@ -8186,7 +8186,7 @@  discard block
 block discarded – undo
8186 8186
 		$date_array = array();
8187 8187
 		$temp_array = array();
8188 8188
         
8189
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8189
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8190 8190
 		{
8191 8191
 			$temp_array['month_name'] = $row['month_name'];
8192 8192
 			$temp_array['year_name'] = $row['year_name'];
@@ -8213,14 +8213,14 @@  discard block
 block discarded – undo
8213 8213
 			$datetime = new DateTime();
8214 8214
 			$offset = $datetime->format('P');
8215 8215
 		} else $offset = '+00:00';
8216
-		$filter_query = $this->getFilter($filters,true,true);
8216
+		$filter_query = $this->getFilter($filters, true, true);
8217 8217
 		if ($globalDBdriver == 'mysql') {
8218
-			$query  = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(*) as date_count
8218
+			$query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(*) as date_count
8219 8219
 								FROM spotter_output".$filter_query." spotter_output.airline_type = 'military'
8220 8220
 								GROUP BY year_name, month_name 
8221 8221
 								ORDER BY date_count DESC";
8222 8222
 		} else {
8223
-			$query  = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(*) as date_count
8223
+			$query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(*) as date_count
8224 8224
 								FROM spotter_output".$filter_query." spotter_output.airline_type = 'military'
8225 8225
 								GROUP BY year_name, month_name 
8226 8226
 								ORDER BY date_count DESC";
@@ -8232,7 +8232,7 @@  discard block
 block discarded – undo
8232 8232
 		$date_array = array();
8233 8233
 		$temp_array = array();
8234 8234
         
8235
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8235
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8236 8236
 		{
8237 8237
 			$temp_array['month_name'] = $row['month_name'];
8238 8238
 			$temp_array['year_name'] = $row['year_name'];
@@ -8258,15 +8258,15 @@  discard block
 block discarded – undo
8258 8258
 			$datetime = new DateTime();
8259 8259
 			$offset = $datetime->format('P');
8260 8260
 		} else $offset = '+00:00';
8261
-		$filter_query = $this->getFilter($filters,true,true);
8261
+		$filter_query = $this->getFilter($filters, true, true);
8262 8262
 
8263 8263
 		if ($globalDBdriver == 'mysql') {
8264
-			$query  = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct owner_name) as date_count
8264
+			$query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct owner_name) as date_count
8265 8265
 								FROM spotter_output".$filter_query." owner_name <> ''
8266 8266
 								GROUP BY year_name, month_name
8267 8267
 								ORDER BY date_count DESC";
8268 8268
 		} else {
8269
-			$query  = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct owner_name) as date_count
8269
+			$query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct owner_name) as date_count
8270 8270
 								FROM spotter_output".$filter_query." owner_name <> ''
8271 8271
 								GROUP BY year_name, month_name
8272 8272
 								ORDER BY date_count DESC";
@@ -8278,7 +8278,7 @@  discard block
 block discarded – undo
8278 8278
 		$date_array = array();
8279 8279
 		$temp_array = array();
8280 8280
         
8281
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8281
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8282 8282
 		{
8283 8283
 			$temp_array['month_name'] = $row['month_name'];
8284 8284
 			$temp_array['year_name'] = $row['year_name'];
@@ -8299,7 +8299,7 @@  discard block
 block discarded – undo
8299 8299
 	public function countAllMonthsOwnersByAirlines($filters = array())
8300 8300
 	{
8301 8301
 		global $globalTimezone, $globalDBdriver;
8302
-		$filter_query = $this->getFilter($filters,true,true);
8302
+		$filter_query = $this->getFilter($filters, true, true);
8303 8303
 		if ($globalTimezone != '') {
8304 8304
 			date_default_timezone_set($globalTimezone);
8305 8305
 			$datetime = new DateTime();
@@ -8307,12 +8307,12 @@  discard block
 block discarded – undo
8307 8307
 		} else $offset = '+00:00';
8308 8308
 
8309 8309
 		if ($globalDBdriver == 'mysql') {
8310
-			$query  = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct owner_name) as date_count
8310
+			$query = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct owner_name) as date_count
8311 8311
 								FROM spotter_output".$filter_query." owner_name <> '' AND spotter_output.airline_icao <> '' 
8312 8312
 								GROUP BY spotter_output.airline_icao, year_name, month_name
8313 8313
 								ORDER BY date_count DESC";
8314 8314
 		} else {
8315
-			$query  = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct owner_name) as date_count
8315
+			$query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct owner_name) as date_count
8316 8316
 								FROM spotter_output".$filter_query." owner_name <> '' AND spotter_output.airline_icao <> '' 
8317 8317
 								GROUP BY spotter_output.airline_icao, year_name, month_name
8318 8318
 								ORDER BY date_count DESC";
@@ -8324,7 +8324,7 @@  discard block
 block discarded – undo
8324 8324
 		$date_array = array();
8325 8325
 		$temp_array = array();
8326 8326
         
8327
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8327
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8328 8328
 		{
8329 8329
 			$temp_array['month_name'] = $row['month_name'];
8330 8330
 			$temp_array['year_name'] = $row['year_name'];
@@ -8351,15 +8351,15 @@  discard block
 block discarded – undo
8351 8351
 			$datetime = new DateTime();
8352 8352
 			$offset = $datetime->format('P');
8353 8353
 		} else $offset = '+00:00';
8354
-		$filter_query = $this->getFilter($filters,true,true);
8354
+		$filter_query = $this->getFilter($filters, true, true);
8355 8355
 
8356 8356
 		if ($globalDBdriver == 'mysql') {
8357
-			$query  = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct pilot_id) as date_count
8357
+			$query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct pilot_id) as date_count
8358 8358
 								FROM spotter_output".$filter_query." pilot_id <> '' AND pilot_id IS NOT NULL
8359 8359
 								GROUP BY year_name, month_name
8360 8360
 								ORDER BY date_count DESC";
8361 8361
 		} else {
8362
-			$query  = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct pilot_id) as date_count
8362
+			$query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct pilot_id) as date_count
8363 8363
 								FROM spotter_output".$filter_query." pilot_id <> '' AND pilot_id IS NOT NULL
8364 8364
 								GROUP BY year_name, month_name
8365 8365
 								ORDER BY date_count DESC";
@@ -8371,7 +8371,7 @@  discard block
 block discarded – undo
8371 8371
 		$date_array = array();
8372 8372
 		$temp_array = array();
8373 8373
         
8374
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8374
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8375 8375
 		{
8376 8376
 			$temp_array['month_name'] = $row['month_name'];
8377 8377
 			$temp_array['year_name'] = $row['year_name'];
@@ -8392,7 +8392,7 @@  discard block
 block discarded – undo
8392 8392
 	public function countAllMonthsPilotsByAirlines($filters = array())
8393 8393
 	{
8394 8394
 		global $globalTimezone, $globalDBdriver;
8395
-		$filter_query = $this->getFilter($filters,true,true);
8395
+		$filter_query = $this->getFilter($filters, true, true);
8396 8396
 		if ($globalTimezone != '') {
8397 8397
 			date_default_timezone_set($globalTimezone);
8398 8398
 			$datetime = new DateTime();
@@ -8400,12 +8400,12 @@  discard block
 block discarded – undo
8400 8400
 		} else $offset = '+00:00';
8401 8401
 
8402 8402
 		if ($globalDBdriver == 'mysql') {
8403
-			$query  = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct pilot_id) as date_count
8403
+			$query = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct pilot_id) as date_count
8404 8404
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND pilot_id <> '' AND pilot_id IS NOT NULL
8405 8405
 								GROUP BY spotter_output.airline_icao,year_name, month_name
8406 8406
 								ORDER BY date_count DESC";
8407 8407
 		} else {
8408
-			$query  = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct pilot_id) as date_count
8408
+			$query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct pilot_id) as date_count
8409 8409
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND pilot_id <> '' AND pilot_id IS NOT NULL
8410 8410
 								GROUP BY spotter_output.airline_icao, year_name, month_name
8411 8411
 								ORDER BY date_count DESC";
@@ -8417,7 +8417,7 @@  discard block
 block discarded – undo
8417 8417
 		$date_array = array();
8418 8418
 		$temp_array = array();
8419 8419
         
8420
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8420
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8421 8421
 		{
8422 8422
 			$temp_array['month_name'] = $row['month_name'];
8423 8423
 			$temp_array['year_name'] = $row['year_name'];
@@ -8439,7 +8439,7 @@  discard block
 block discarded – undo
8439 8439
 	public function countAllMonthsAirlines($filters = array())
8440 8440
 	{
8441 8441
 		global $globalTimezone, $globalDBdriver;
8442
-		$filter_query = $this->getFilter($filters,true,true);
8442
+		$filter_query = $this->getFilter($filters, true, true);
8443 8443
 		if ($globalTimezone != '') {
8444 8444
 			date_default_timezone_set($globalTimezone);
8445 8445
 			$datetime = new DateTime();
@@ -8447,12 +8447,12 @@  discard block
 block discarded – undo
8447 8447
 		} else $offset = '+00:00';
8448 8448
 
8449 8449
 		if ($globalDBdriver == 'mysql') {
8450
-			$query  = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct airline_icao) as date_count
8450
+			$query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct airline_icao) as date_count
8451 8451
 								FROM spotter_output".$filter_query." airline_icao <> '' 
8452 8452
 								GROUP BY year_name, month_name
8453 8453
 								ORDER BY date_count DESC";
8454 8454
 		} else {
8455
-			$query  = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct airline_icao) as date_count
8455
+			$query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct airline_icao) as date_count
8456 8456
 								FROM spotter_output".$filter_query." airline_icao <> '' 
8457 8457
 								GROUP BY year_name, month_name
8458 8458
 								ORDER BY date_count DESC";
@@ -8464,7 +8464,7 @@  discard block
 block discarded – undo
8464 8464
 		$date_array = array();
8465 8465
 		$temp_array = array();
8466 8466
         
8467
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8467
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8468 8468
 		{
8469 8469
 			$temp_array['month_name'] = $row['month_name'];
8470 8470
 			$temp_array['year_name'] = $row['year_name'];
@@ -8490,15 +8490,15 @@  discard block
 block discarded – undo
8490 8490
 			$datetime = new DateTime();
8491 8491
 			$offset = $datetime->format('P');
8492 8492
 		} else $offset = '+00:00';
8493
-		$filter_query = $this->getFilter($filters,true,true);
8493
+		$filter_query = $this->getFilter($filters, true, true);
8494 8494
 
8495 8495
 		if ($globalDBdriver == 'mysql') {
8496
-			$query  = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct aircraft_icao) as date_count
8496
+			$query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct aircraft_icao) as date_count
8497 8497
 								FROM spotter_output".$filter_query." aircraft_icao <> '' 
8498 8498
 								GROUP BY year_name, month_name
8499 8499
 								ORDER BY date_count DESC";
8500 8500
 		} else {
8501
-			$query  = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct aircraft_icao) as date_count
8501
+			$query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct aircraft_icao) as date_count
8502 8502
 								FROM spotter_output".$filter_query." aircraft_icao <> '' 
8503 8503
 								GROUP BY year_name, month_name
8504 8504
 								ORDER BY date_count DESC";
@@ -8510,7 +8510,7 @@  discard block
 block discarded – undo
8510 8510
 		$date_array = array();
8511 8511
 		$temp_array = array();
8512 8512
         
8513
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8513
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8514 8514
 		{
8515 8515
 			$temp_array['month_name'] = $row['month_name'];
8516 8516
 			$temp_array['year_name'] = $row['year_name'];
@@ -8532,7 +8532,7 @@  discard block
 block discarded – undo
8532 8532
 	public function countAllMonthsAircraftsByAirlines($filters = array())
8533 8533
 	{
8534 8534
 		global $globalTimezone, $globalDBdriver;
8535
-		$filter_query = $this->getFilter($filters,true,true);
8535
+		$filter_query = $this->getFilter($filters, true, true);
8536 8536
 		if ($globalTimezone != '') {
8537 8537
 			date_default_timezone_set($globalTimezone);
8538 8538
 			$datetime = new DateTime();
@@ -8540,12 +8540,12 @@  discard block
 block discarded – undo
8540 8540
 		} else $offset = '+00:00';
8541 8541
 
8542 8542
 		if ($globalDBdriver == 'mysql') {
8543
-			$query  = "SELECT spotter_output.airline_icao,YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct aircraft_icao) as date_count
8543
+			$query = "SELECT spotter_output.airline_icao,YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct aircraft_icao) as date_count
8544 8544
 								FROM spotter_output".$filter_query." aircraft_icao <> ''  AND spotter_output.airline_icao <> '' 
8545 8545
 								GROUP BY spotter_output.airline_icao, year_name, month_name
8546 8546
 								ORDER BY date_count DESC";
8547 8547
 		} else {
8548
-			$query  = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct aircraft_icao) as date_count
8548
+			$query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct aircraft_icao) as date_count
8549 8549
 								FROM spotter_output".$filter_query." aircraft_icao <> '' AND spotter_output.airline_icao <> '' 
8550 8550
 								GROUP BY spotter_output.airline_icao, year_name, month_name
8551 8551
 								ORDER BY date_count DESC";
@@ -8557,7 +8557,7 @@  discard block
 block discarded – undo
8557 8557
 		$date_array = array();
8558 8558
 		$temp_array = array();
8559 8559
         
8560
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8560
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8561 8561
 		{
8562 8562
 			$temp_array['month_name'] = $row['month_name'];
8563 8563
 			$temp_array['year_name'] = $row['year_name'];
@@ -8584,15 +8584,15 @@  discard block
 block discarded – undo
8584 8584
 			$datetime = new DateTime();
8585 8585
 			$offset = $datetime->format('P');
8586 8586
 		} else $offset = '+00:00';
8587
-		$filter_query = $this->getFilter($filters,true,true);
8587
+		$filter_query = $this->getFilter($filters, true, true);
8588 8588
 
8589 8589
 		if ($globalDBdriver == 'mysql') {
8590
-			$query  = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(real_arrival_airport_icao) as date_count
8590
+			$query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(real_arrival_airport_icao) as date_count
8591 8591
 								FROM spotter_output".$filter_query." real_arrival_airport_icao <> '' 
8592 8592
 								GROUP BY year_name, month_name
8593 8593
 								ORDER BY date_count DESC";
8594 8594
 		} else {
8595
-			$query  = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(real_arrival_airport_icao) as date_count
8595
+			$query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(real_arrival_airport_icao) as date_count
8596 8596
 								FROM spotter_output".$filter_query." real_arrival_airport_icao <> '' 
8597 8597
 								GROUP BY year_name, month_name
8598 8598
 								ORDER BY date_count DESC";
@@ -8604,7 +8604,7 @@  discard block
 block discarded – undo
8604 8604
 		$date_array = array();
8605 8605
 		$temp_array = array();
8606 8606
         
8607
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8607
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8608 8608
 		{
8609 8609
 			$temp_array['month_name'] = $row['month_name'];
8610 8610
 			$temp_array['year_name'] = $row['year_name'];
@@ -8626,7 +8626,7 @@  discard block
 block discarded – undo
8626 8626
 	public function countAllMonthsRealArrivalsByAirlines($filters = array())
8627 8627
 	{
8628 8628
 		global $globalTimezone, $globalDBdriver;
8629
-		$filter_query = $this->getFilter($filters,true,true);
8629
+		$filter_query = $this->getFilter($filters, true, true);
8630 8630
 		if ($globalTimezone != '') {
8631 8631
 			date_default_timezone_set($globalTimezone);
8632 8632
 			$datetime = new DateTime();
@@ -8634,12 +8634,12 @@  discard block
 block discarded – undo
8634 8634
 		} else $offset = '+00:00';
8635 8635
 
8636 8636
 		if ($globalDBdriver == 'mysql') {
8637
-			$query  = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(real_arrival_airport_icao) as date_count
8637
+			$query = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(real_arrival_airport_icao) as date_count
8638 8638
 								FROM spotter_output".$filter_query." real_arrival_airport_icao <> '' AND spotter_output.airline_icao <> '' 
8639 8639
 								GROUP BY spotter_output.airline_icao, year_name, month_name
8640 8640
 								ORDER BY date_count DESC";
8641 8641
 		} else {
8642
-			$query  = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(real_arrival_airport_icao) as date_count
8642
+			$query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(real_arrival_airport_icao) as date_count
8643 8643
 								FROM spotter_output".$filter_query." real_arrival_airport_icao <> '' AND spotter_output.airline_icao <> '' 
8644 8644
 								GROUP BY spotter_output.airline_icao, year_name, month_name
8645 8645
 								ORDER BY date_count DESC";
@@ -8651,7 +8651,7 @@  discard block
 block discarded – undo
8651 8651
 		$date_array = array();
8652 8652
 		$temp_array = array();
8653 8653
         
8654
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8654
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8655 8655
 		{
8656 8656
 			$temp_array['month_name'] = $row['month_name'];
8657 8657
 			$temp_array['year_name'] = $row['year_name'];
@@ -8679,7 +8679,7 @@  discard block
 block discarded – undo
8679 8679
 			$datetime = new DateTime();
8680 8680
 			$offset = $datetime->format('P');
8681 8681
 		} else $offset = '+00:00';
8682
-		$filter_query = $this->getFilter($filters,true,true);
8682
+		$filter_query = $this->getFilter($filters, true, true);
8683 8683
 		if ($globalDBdriver == 'mysql') {
8684 8684
 			$query  = "SELECT MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name, count(*) as date_count
8685 8685
 								FROM spotter_output".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 YEAR)";
@@ -8700,7 +8700,7 @@  discard block
 block discarded – undo
8700 8700
 		$date_array = array();
8701 8701
 		$temp_array = array();
8702 8702
         
8703
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8703
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8704 8704
 		{
8705 8705
 			$temp_array['year_name'] = $row['year_name'];
8706 8706
 			$temp_array['month_name'] = $row['month_name'];
@@ -8720,7 +8720,7 @@  discard block
 block discarded – undo
8720 8720
 	* @return Array the hour list
8721 8721
 	*
8722 8722
 	*/
8723
-	public function countAllHours($orderby,$filters = array())
8723
+	public function countAllHours($orderby, $filters = array())
8724 8724
 	{
8725 8725
 		global $globalTimezone, $globalDBdriver;
8726 8726
 		if ($globalTimezone != '') {
@@ -8768,7 +8768,7 @@  discard block
 block discarded – undo
8768 8768
 		$hour_array = array();
8769 8769
 		$temp_array = array();
8770 8770
         
8771
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8771
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8772 8772
 		{
8773 8773
 			$temp_array['hour_name'] = $row['hour_name'];
8774 8774
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -8788,7 +8788,7 @@  discard block
 block discarded – undo
8788 8788
 	public function countAllHoursByAirlines($orderby, $filters = array())
8789 8789
 	{
8790 8790
 		global $globalTimezone, $globalDBdriver;
8791
-		$filter_query = $this->getFilter($filters,true,true);
8791
+		$filter_query = $this->getFilter($filters, true, true);
8792 8792
 		if ($globalTimezone != '') {
8793 8793
 			date_default_timezone_set($globalTimezone);
8794 8794
 			$datetime = new DateTime();
@@ -8806,7 +8806,7 @@  discard block
 block discarded – undo
8806 8806
 		}
8807 8807
 		
8808 8808
 		if ($globalDBdriver == 'mysql') {
8809
-			$query  = "SELECT spotter_output.airline_icao, HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8809
+			$query = "SELECT spotter_output.airline_icao, HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8810 8810
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' 
8811 8811
 								GROUP BY spotter_output.airline_icao, hour_name 
8812 8812
 								".$orderby_sql;
@@ -8819,7 +8819,7 @@  discard block
 block discarded – undo
8819 8819
   */    
8820 8820
 		$query_data = array(':offset' => $offset);
8821 8821
 		} else {
8822
-			$query  = "SELECT spotter_output.airline_icao, EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8822
+			$query = "SELECT spotter_output.airline_icao, EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8823 8823
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' 
8824 8824
 								GROUP BY spotter_output.airline_icao, hour_name 
8825 8825
 								".$orderby_sql;
@@ -8832,7 +8832,7 @@  discard block
 block discarded – undo
8832 8832
 		$hour_array = array();
8833 8833
 		$temp_array = array();
8834 8834
         
8835
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8835
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8836 8836
 		{
8837 8837
 			$temp_array['hour_name'] = $row['hour_name'];
8838 8838
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -8855,34 +8855,34 @@  discard block
 block discarded – undo
8855 8855
 	public function countAllHoursByAirline($airline_icao, $filters = array())
8856 8856
 	{
8857 8857
 		global $globalTimezone, $globalDBdriver;
8858
-		$filter_query = $this->getFilter($filters,true,true);
8858
+		$filter_query = $this->getFilter($filters, true, true);
8859 8859
 		if ($globalTimezone != '') {
8860 8860
 			date_default_timezone_set($globalTimezone);
8861 8861
 			$datetime = new DateTime();
8862 8862
 			$offset = $datetime->format('P');
8863 8863
 		} else $offset = '+00:00';
8864 8864
 
8865
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
8865
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
8866 8866
 
8867 8867
 		if ($globalDBdriver == 'mysql') {
8868
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8868
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8869 8869
 								FROM spotter_output".$filter_query." spotter_output.airline_icao = :airline_icao
8870 8870
 								GROUP BY hour_name 
8871 8871
 								ORDER BY hour_name ASC";
8872 8872
 		} else {
8873
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8873
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8874 8874
 								FROM spotter_output".$filter_query." spotter_output.airline_icao = :airline_icao
8875 8875
 								GROUP BY hour_name 
8876 8876
 								ORDER BY hour_name ASC";
8877 8877
 		}
8878 8878
 		
8879 8879
 		$sth = $this->db->prepare($query);
8880
-		$sth->execute(array(':airline_icao' => $airline_icao,':offset' => $offset));
8880
+		$sth->execute(array(':airline_icao' => $airline_icao, ':offset' => $offset));
8881 8881
       
8882 8882
 		$hour_array = array();
8883 8883
 		$temp_array = array();
8884 8884
         
8885
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8885
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8886 8886
 		{
8887 8887
 			$temp_array['hour_name'] = $row['hour_name'];
8888 8888
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -8905,8 +8905,8 @@  discard block
 block discarded – undo
8905 8905
 	public function countAllHoursByAircraft($aircraft_icao, $filters = array())
8906 8906
 	{
8907 8907
 		global $globalTimezone, $globalDBdriver;
8908
-		$filter_query = $this->getFilter($filters,true,true);
8909
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
8908
+		$filter_query = $this->getFilter($filters, true, true);
8909
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
8910 8910
 		if ($globalTimezone != '') {
8911 8911
 			date_default_timezone_set($globalTimezone);
8912 8912
 			$datetime = new DateTime();
@@ -8914,24 +8914,24 @@  discard block
 block discarded – undo
8914 8914
 		} else $offset = '+00:00';
8915 8915
 
8916 8916
 		if ($globalDBdriver == 'mysql') {
8917
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8917
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8918 8918
 								FROM spotter_output".$filter_query." spotter_output.aircraft_icao = :aircraft_icao
8919 8919
 								GROUP BY hour_name 
8920 8920
 								ORDER BY hour_name ASC";
8921 8921
 		} else {
8922
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8922
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8923 8923
 								FROM spotter_output".$filter_query." spotter_output.aircraft_icao = :aircraft_icao
8924 8924
 								GROUP BY hour_name 
8925 8925
 								ORDER BY hour_name ASC";
8926 8926
 		}
8927 8927
 		
8928 8928
 		$sth = $this->db->prepare($query);
8929
-		$sth->execute(array(':aircraft_icao' => $aircraft_icao,':offset' => $offset));
8929
+		$sth->execute(array(':aircraft_icao' => $aircraft_icao, ':offset' => $offset));
8930 8930
       
8931 8931
 		$hour_array = array();
8932 8932
 		$temp_array = array();
8933 8933
         
8934
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8934
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8935 8935
 		{
8936 8936
 			$temp_array['hour_name'] = $row['hour_name'];
8937 8937
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -8952,8 +8952,8 @@  discard block
 block discarded – undo
8952 8952
 	public function countAllHoursByRegistration($registration, $filters = array())
8953 8953
 	{
8954 8954
 		global $globalTimezone, $globalDBdriver;
8955
-		$filter_query = $this->getFilter($filters,true,true);
8956
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
8955
+		$filter_query = $this->getFilter($filters, true, true);
8956
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
8957 8957
 		if ($globalTimezone != '') {
8958 8958
 			date_default_timezone_set($globalTimezone);
8959 8959
 			$datetime = new DateTime();
@@ -8961,24 +8961,24 @@  discard block
 block discarded – undo
8961 8961
 		} else $offset = '+00:00';
8962 8962
 
8963 8963
 		if ($globalDBdriver == 'mysql') {
8964
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8964
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8965 8965
 								FROM spotter_output".$filter_query." spotter_output.registration = :registration
8966 8966
 								GROUP BY hour_name 
8967 8967
 								ORDER BY hour_name ASC";
8968 8968
 		} else {
8969
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8969
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8970 8970
 								FROM spotter_output".$filter_query." spotter_output.registration = :registration
8971 8971
 								GROUP BY hour_name 
8972 8972
 								ORDER BY hour_name ASC";
8973 8973
 		}
8974 8974
 		
8975 8975
 		$sth = $this->db->prepare($query);
8976
-		$sth->execute(array(':registration' => $registration,':offset' => $offset));
8976
+		$sth->execute(array(':registration' => $registration, ':offset' => $offset));
8977 8977
       
8978 8978
 		$hour_array = array();
8979 8979
 		$temp_array = array();
8980 8980
         
8981
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8981
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8982 8982
 		{
8983 8983
 			$temp_array['hour_name'] = $row['hour_name'];
8984 8984
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -8999,8 +8999,8 @@  discard block
 block discarded – undo
8999 8999
 	public function countAllHoursByAirport($airport_icao, $filters = array())
9000 9000
 	{
9001 9001
 		global $globalTimezone, $globalDBdriver;
9002
-		$filter_query = $this->getFilter($filters,true,true);
9003
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
9002
+		$filter_query = $this->getFilter($filters, true, true);
9003
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
9004 9004
 		if ($globalTimezone != '') {
9005 9005
 			date_default_timezone_set($globalTimezone);
9006 9006
 			$datetime = new DateTime();
@@ -9008,24 +9008,24 @@  discard block
 block discarded – undo
9008 9008
 		} else $offset = '+00:00';
9009 9009
 
9010 9010
 		if ($globalDBdriver == 'mysql') {
9011
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9011
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9012 9012
 								FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao)
9013 9013
 								GROUP BY hour_name 
9014 9014
 								ORDER BY hour_name ASC";
9015 9015
 		} else {
9016
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9016
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9017 9017
 								FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao)
9018 9018
 								GROUP BY hour_name 
9019 9019
 								ORDER BY hour_name ASC";
9020 9020
 		}
9021 9021
 		
9022 9022
 		$sth = $this->db->prepare($query);
9023
-		$sth->execute(array(':airport_icao' => $airport_icao,':offset' => $offset));
9023
+		$sth->execute(array(':airport_icao' => $airport_icao, ':offset' => $offset));
9024 9024
       
9025 9025
 		$hour_array = array();
9026 9026
 		$temp_array = array();
9027 9027
         
9028
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9028
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9029 9029
 		{
9030 9030
 			$temp_array['hour_name'] = $row['hour_name'];
9031 9031
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -9044,11 +9044,11 @@  discard block
 block discarded – undo
9044 9044
 	* @return Array the hour list
9045 9045
 	*
9046 9046
 	*/
9047
-	public function countAllHoursByManufacturer($aircraft_manufacturer,$filters =array())
9047
+	public function countAllHoursByManufacturer($aircraft_manufacturer, $filters = array())
9048 9048
 	{
9049 9049
 		global $globalTimezone, $globalDBdriver;
9050
-		$filter_query = $this->getFilter($filters,true,true);
9051
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
9050
+		$filter_query = $this->getFilter($filters, true, true);
9051
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
9052 9052
 		if ($globalTimezone != '') {
9053 9053
 			date_default_timezone_set($globalTimezone);
9054 9054
 			$datetime = new DateTime();
@@ -9056,24 +9056,24 @@  discard block
 block discarded – undo
9056 9056
 		} else $offset = '+00:00';
9057 9057
 
9058 9058
 		if ($globalDBdriver == 'mysql') {
9059
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9059
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9060 9060
 								FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer = :aircraft_manufacturer
9061 9061
 								GROUP BY hour_name 
9062 9062
 								ORDER BY hour_name ASC";
9063 9063
 		} else {
9064
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9064
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9065 9065
 								FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer = :aircraft_manufacturer
9066 9066
 								GROUP BY hour_name 
9067 9067
 								ORDER BY hour_name ASC";
9068 9068
 		}
9069 9069
 		
9070 9070
 		$sth = $this->db->prepare($query);
9071
-		$sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer,':offset' => $offset));
9071
+		$sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer, ':offset' => $offset));
9072 9072
       
9073 9073
 		$hour_array = array();
9074 9074
 		$temp_array = array();
9075 9075
         
9076
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9076
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9077 9077
 		{
9078 9078
 			$temp_array['hour_name'] = $row['hour_name'];
9079 9079
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -9095,8 +9095,8 @@  discard block
 block discarded – undo
9095 9095
 	public function countAllHoursByDate($date, $filters = array())
9096 9096
 	{
9097 9097
 		global $globalTimezone, $globalDBdriver;
9098
-		$filter_query = $this->getFilter($filters,true,true);
9099
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
9098
+		$filter_query = $this->getFilter($filters, true, true);
9099
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
9100 9100
 		if ($globalTimezone != '') {
9101 9101
 			date_default_timezone_set($globalTimezone);
9102 9102
 			$datetime = new DateTime($date);
@@ -9104,12 +9104,12 @@  discard block
 block discarded – undo
9104 9104
 		} else $offset = '+00:00';
9105 9105
 
9106 9106
 		if ($globalDBdriver == 'mysql') {
9107
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9107
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9108 9108
 								FROM spotter_output".$filter_query." DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date
9109 9109
 								GROUP BY hour_name 
9110 9110
 								ORDER BY hour_name ASC";
9111 9111
 		} else {
9112
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9112
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9113 9113
 								FROM spotter_output".$filter_query." to_char(spotter_output.date AT TIME ZONE INTERVAL :offset, 'YYYY-mm-dd') = :date
9114 9114
 								GROUP BY hour_name 
9115 9115
 								ORDER BY hour_name ASC";
@@ -9121,7 +9121,7 @@  discard block
 block discarded – undo
9121 9121
 		$hour_array = array();
9122 9122
 		$temp_array = array();
9123 9123
         
9124
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9124
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9125 9125
 		{
9126 9126
 			$temp_array['hour_name'] = $row['hour_name'];
9127 9127
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -9143,8 +9143,8 @@  discard block
 block discarded – undo
9143 9143
 	public function countAllHoursByIdent($ident, $filters = array())
9144 9144
 	{
9145 9145
 		global $globalTimezone, $globalDBdriver;
9146
-		$filter_query = $this->getFilter($filters,true,true);
9147
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
9146
+		$filter_query = $this->getFilter($filters, true, true);
9147
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
9148 9148
 		if ($globalTimezone != '') {
9149 9149
 			date_default_timezone_set($globalTimezone);
9150 9150
 			$datetime = new DateTime();
@@ -9152,12 +9152,12 @@  discard block
 block discarded – undo
9152 9152
 		} else $offset = '+00:00';
9153 9153
 
9154 9154
 		if ($globalDBdriver == 'mysql') {
9155
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9155
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9156 9156
 								FROM spotter_output".$filter_query." spotter_output.ident = :ident 
9157 9157
 								GROUP BY hour_name 
9158 9158
 								ORDER BY hour_name ASC";
9159 9159
 		} else {
9160
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9160
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9161 9161
 								FROM spotter_output".$filter_query." spotter_output.ident = :ident 
9162 9162
 								GROUP BY hour_name 
9163 9163
 								ORDER BY hour_name ASC";
@@ -9165,12 +9165,12 @@  discard block
 block discarded – undo
9165 9165
       
9166 9166
 		
9167 9167
 		$sth = $this->db->prepare($query);
9168
-		$sth->execute(array(':ident' => $ident,':offset' => $offset));
9168
+		$sth->execute(array(':ident' => $ident, ':offset' => $offset));
9169 9169
       
9170 9170
 		$hour_array = array();
9171 9171
 		$temp_array = array();
9172 9172
         
9173
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9173
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9174 9174
 		{
9175 9175
 			$temp_array['hour_name'] = $row['hour_name'];
9176 9176
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -9189,12 +9189,12 @@  discard block
 block discarded – undo
9189 9189
 	* @return Array the hour list
9190 9190
 	*
9191 9191
 	*/
9192
-	public function countAllHoursByRoute($departure_airport_icao, $arrival_airport_icao, $filters =array())
9192
+	public function countAllHoursByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array())
9193 9193
 	{
9194 9194
 		global $globalTimezone, $globalDBdriver;
9195
-		$filter_query = $this->getFilter($filters,true,true);
9196
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
9197
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
9195
+		$filter_query = $this->getFilter($filters, true, true);
9196
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
9197
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
9198 9198
 		if ($globalTimezone != '') {
9199 9199
 			date_default_timezone_set($globalTimezone);
9200 9200
 			$datetime = new DateTime();
@@ -9202,24 +9202,24 @@  discard block
 block discarded – undo
9202 9202
 		} else $offset = '+00:00';
9203 9203
 
9204 9204
 		if ($globalDBdriver == 'mysql') {
9205
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9205
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9206 9206
 								FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao)
9207 9207
 								GROUP BY hour_name 
9208 9208
 								ORDER BY hour_name ASC";
9209 9209
 		} else {
9210
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9210
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9211 9211
 								FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao)
9212 9212
 								GROUP BY hour_name 
9213 9213
 								ORDER BY hour_name ASC";
9214 9214
 		}
9215 9215
 		
9216 9216
 		$sth = $this->db->prepare($query);
9217
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao,':offset' => $offset));
9217
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao, ':offset' => $offset));
9218 9218
       
9219 9219
 		$hour_array = array();
9220 9220
 		$temp_array = array();
9221 9221
         
9222
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9222
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9223 9223
 		{
9224 9224
 			$temp_array['hour_name'] = $row['hour_name'];
9225 9225
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -9240,8 +9240,8 @@  discard block
 block discarded – undo
9240 9240
 	public function countAllHoursByCountry($country, $filters = array())
9241 9241
 	{
9242 9242
 		global $globalTimezone, $globalDBdriver;
9243
-		$filter_query = $this->getFilter($filters,true,true);
9244
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
9243
+		$filter_query = $this->getFilter($filters, true, true);
9244
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
9245 9245
 		if ($globalTimezone != '') {
9246 9246
 			date_default_timezone_set($globalTimezone);
9247 9247
 			$datetime = new DateTime();
@@ -9249,24 +9249,24 @@  discard block
 block discarded – undo
9249 9249
 		} else $offset = '+00:00';
9250 9250
 
9251 9251
 		if ($globalDBdriver == 'mysql') {
9252
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9252
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9253 9253
 								FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country
9254 9254
 								GROUP BY hour_name 
9255 9255
 								ORDER BY hour_name ASC";
9256 9256
 		} else {
9257
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9257
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9258 9258
 								FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country
9259 9259
 								GROUP BY hour_name 
9260 9260
 								ORDER BY hour_name ASC";
9261 9261
 		}
9262 9262
 		
9263 9263
 		$sth = $this->db->prepare($query);
9264
-		$sth->execute(array(':country' => $country,':offset' => $offset));
9264
+		$sth->execute(array(':country' => $country, ':offset' => $offset));
9265 9265
       
9266 9266
 		$hour_array = array();
9267 9267
 		$temp_array = array();
9268 9268
         
9269
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9269
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9270 9270
 		{
9271 9271
 			$temp_array['hour_name'] = $row['hour_name'];
9272 9272
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -9288,8 +9288,8 @@  discard block
 block discarded – undo
9288 9288
 	*/
9289 9289
 	public function countOverallAircrafts($filters = array())
9290 9290
 	{
9291
-		$filter_query = $this->getFilter($filters,true,true);
9292
-		$query  = "SELECT COUNT(DISTINCT spotter_output.aircraft_icao) AS aircraft_count  
9291
+		$filter_query = $this->getFilter($filters, true, true);
9292
+		$query = "SELECT COUNT(DISTINCT spotter_output.aircraft_icao) AS aircraft_count  
9293 9293
                     FROM spotter_output".$filter_query." spotter_output.ident <> ''";
9294 9294
 		$sth = $this->db->prepare($query);
9295 9295
 		$sth->execute();
@@ -9304,8 +9304,8 @@  discard block
 block discarded – undo
9304 9304
 	*/
9305 9305
 	public function countOverallArrival($filters = array())
9306 9306
 	{
9307
-		$filter_query = $this->getFilter($filters,true,true);
9308
-		$query  = "SELECT COUNT(spotter_output.real_arrival_airport_icao) AS arrival_count  
9307
+		$filter_query = $this->getFilter($filters, true, true);
9308
+		$query = "SELECT COUNT(spotter_output.real_arrival_airport_icao) AS arrival_count  
9309 9309
                     FROM spotter_output".$filter_query." spotter_output.arrival_airport_icao <> ''";
9310 9310
 		
9311 9311
 		$sth = $this->db->prepare($query);
@@ -9321,8 +9321,8 @@  discard block
 block discarded – undo
9321 9321
 	*/
9322 9322
 	public function countOverallPilots($filters = array())
9323 9323
 	{
9324
-		$filter_query = $this->getFilter($filters,true,true);
9325
-		$query  = "SELECT COUNT(DISTINCT spotter_output.pilot_id) AS pilot_count  
9324
+		$filter_query = $this->getFilter($filters, true, true);
9325
+		$query = "SELECT COUNT(DISTINCT spotter_output.pilot_id) AS pilot_count  
9326 9326
                     FROM spotter_output".$filter_query." spotter_output.pilot_id <> ''";
9327 9327
 		$sth = $this->db->prepare($query);
9328 9328
 		$sth->execute();
@@ -9337,8 +9337,8 @@  discard block
 block discarded – undo
9337 9337
 	*/
9338 9338
 	public function countOverallOwners($filters = array())
9339 9339
 	{
9340
-		$filter_query = $this->getFilter($filters,true,true);
9341
-		$query  = "SELECT COUNT(DISTINCT spotter_output.owner_name) AS owner_count  
9340
+		$filter_query = $this->getFilter($filters, true, true);
9341
+		$query = "SELECT COUNT(DISTINCT spotter_output.owner_name) AS owner_count  
9342 9342
                     FROM spotter_output".$filter_query." spotter_output.owner_name <> ''";
9343 9343
 		$sth = $this->db->prepare($query);
9344 9344
 		$sth->execute();
@@ -9371,8 +9371,8 @@  discard block
 block discarded – undo
9371 9371
 	*/
9372 9372
 	public function countOverallMilitaryFlights($filters = array())
9373 9373
 	{
9374
-		$filter_query = $this->getFilter($filters,true,true);
9375
-		$query  = "SELECT COUNT(spotter_output.spotter_id) AS flight_count  
9374
+		$filter_query = $this->getFilter($filters, true, true);
9375
+		$query = "SELECT COUNT(spotter_output.spotter_id) AS flight_count  
9376 9376
                     FROM airlines,spotter_output".$filter_query." spotter_output.airline_icao = airlines.icao AND airlines.type = 'military'";
9377 9377
       
9378 9378
 		$sth = $this->db->prepare($query);
@@ -9409,7 +9409,7 @@  discard block
 block discarded – undo
9409 9409
 	public function countAllHoursFromToday($filters = array())
9410 9410
 	{
9411 9411
 		global $globalTimezone, $globalDBdriver;
9412
-		$filter_query = $this->getFilter($filters,true,true);
9412
+		$filter_query = $this->getFilter($filters, true, true);
9413 9413
 		if ($globalTimezone != '') {
9414 9414
 			date_default_timezone_set($globalTimezone);
9415 9415
 			$datetime = new DateTime();
@@ -9417,12 +9417,12 @@  discard block
 block discarded – undo
9417 9417
 		} else $offset = '+00:00';
9418 9418
 
9419 9419
 		if ($globalDBdriver == 'mysql') {
9420
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9420
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9421 9421
 								FROM spotter_output".$filter_query." DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = CURDATE()
9422 9422
 								GROUP BY hour_name 
9423 9423
 								ORDER BY hour_name ASC";
9424 9424
 		} else {
9425
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9425
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9426 9426
 								FROM spotter_output".$filter_query." to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = CAST(NOW() AS date)
9427 9427
 								GROUP BY hour_name 
9428 9428
 								ORDER BY hour_name ASC";
@@ -9434,7 +9434,7 @@  discard block
 block discarded – undo
9434 9434
 		$hour_array = array();
9435 9435
 		$temp_array = array();
9436 9436
         
9437
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9437
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9438 9438
 		{
9439 9439
 			$temp_array['hour_name'] = $row['hour_name'];
9440 9440
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -9453,14 +9453,14 @@  discard block
 block discarded – undo
9453 9453
 	public function getUpcomingFlights($limit = '', $sort = '', $filters = array())
9454 9454
 	{
9455 9455
 		global $global_query, $globalDBdriver, $globalTimezone;
9456
-		$filter_query = $this->getFilter($filters,true,true);
9456
+		$filter_query = $this->getFilter($filters, true, true);
9457 9457
 		date_default_timezone_set('UTC');
9458 9458
 		$limit_query = '';
9459 9459
 		if ($limit != "")
9460 9460
 		{
9461 9461
 			$limit_array = explode(",", $limit);
9462
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
9463
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
9462
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
9463
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
9464 9464
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
9465 9465
 			{
9466 9466
 				//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
@@ -9513,7 +9513,7 @@  discard block
 block discarded – undo
9513 9513
 			    GROUP BY spotter_output.ident,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time, to_char(spotter_output.date,'HH')
9514 9514
 			    HAVING count(spotter_output.ident) > 5$orderby_query";
9515 9515
 			//echo $query;
9516
-			$spotter_array = $this->getDataFromDB($query.$limit_query,array(':timezone' => $globalTimezone));
9516
+			$spotter_array = $this->getDataFromDB($query.$limit_query, array(':timezone' => $globalTimezone));
9517 9517
 			/*
9518 9518
 			$sth = $this->db->prepare($query);
9519 9519
 			$sth->execute(array(':timezone' => $globalTimezone));
@@ -9532,9 +9532,9 @@  discard block
 block discarded – undo
9532 9532
 	*/
9533 9533
 	public function getSpotterIDBasedOnFlightAwareID($flightaware_id)
9534 9534
 	{
9535
-		$flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING);
9535
+		$flightaware_id = filter_var($flightaware_id, FILTER_SANITIZE_STRING);
9536 9536
 
9537
-		$query  = "SELECT spotter_output.spotter_id
9537
+		$query = "SELECT spotter_output.spotter_id
9538 9538
 								FROM spotter_output 
9539 9539
 								WHERE spotter_output.flightaware_id = '".$flightaware_id."'";
9540 9540
         
@@ -9542,7 +9542,7 @@  discard block
 block discarded – undo
9542 9542
 		$sth = $this->db->prepare($query);
9543 9543
 		$sth->execute();
9544 9544
 
9545
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9545
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9546 9546
 		{
9547 9547
 			return $row['spotter_id'];
9548 9548
 		}
@@ -9567,23 +9567,23 @@  discard block
 block discarded – undo
9567 9567
 		}
9568 9568
 		
9569 9569
 		$current_date = date("Y-m-d H:i:s");
9570
-		$date = date("Y-m-d H:i:s",strtotime($dateString." UTC"));
9570
+		$date = date("Y-m-d H:i:s", strtotime($dateString." UTC"));
9571 9571
 		
9572 9572
 		$diff = abs(strtotime($current_date) - strtotime($date));
9573 9573
 
9574
-		$time_array['years'] = floor($diff / (365*60*60*24)); 
9574
+		$time_array['years'] = floor($diff/(365*60*60*24)); 
9575 9575
 		$years = $time_array['years'];
9576 9576
 		
9577
-		$time_array['months'] = floor(($diff - $years * 365*60*60*24) / (30*60*60*24));
9577
+		$time_array['months'] = floor(($diff - $years*365*60*60*24)/(30*60*60*24));
9578 9578
 		$months = $time_array['months'];
9579 9579
 		
9580
-		$time_array['days'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24)/ (60*60*24));
9580
+		$time_array['days'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24)/(60*60*24));
9581 9581
 		$days = $time_array['days'];
9582
-		$time_array['hours'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24)/ (60*60));
9582
+		$time_array['hours'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24)/(60*60));
9583 9583
 		$hours = $time_array['hours'];
9584
-		$time_array['minutes'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60)/ 60);
9584
+		$time_array['minutes'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60)/60);
9585 9585
 		$minutes = $time_array['minutes'];
9586
-		$time_array['seconds'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60 - $minutes*60));  
9586
+		$time_array['seconds'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60 - $minutes*60));  
9587 9587
 		
9588 9588
 		return $time_array;	
9589 9589
 	}	
@@ -9609,63 +9609,63 @@  discard block
 block discarded – undo
9609 9609
 			$temp_array['direction_degree'] = $direction;
9610 9610
 			$temp_array['direction_shortname'] = "N";
9611 9611
 			$temp_array['direction_fullname'] = "North";
9612
-		} elseif ($direction >= 22.5 && $direction < 45){
9612
+		} elseif ($direction >= 22.5 && $direction < 45) {
9613 9613
 			$temp_array['direction_degree'] = $direction;
9614 9614
 			$temp_array['direction_shortname'] = "NNE";
9615 9615
 			$temp_array['direction_fullname'] = "North-Northeast";
9616
-		} elseif ($direction >= 45 && $direction < 67.5){
9616
+		} elseif ($direction >= 45 && $direction < 67.5) {
9617 9617
 			$temp_array['direction_degree'] = $direction;
9618 9618
 			$temp_array['direction_shortname'] = "NE";
9619 9619
 			$temp_array['direction_fullname'] = "Northeast";
9620
-		} elseif ($direction >= 67.5 && $direction < 90){
9620
+		} elseif ($direction >= 67.5 && $direction < 90) {
9621 9621
 			$temp_array['direction_degree'] = $direction;
9622 9622
 			$temp_array['direction_shortname'] = "ENE";
9623 9623
 			$temp_array['direction_fullname'] = "East-Northeast";
9624
-		} elseif ($direction >= 90 && $direction < 112.5){
9624
+		} elseif ($direction >= 90 && $direction < 112.5) {
9625 9625
 			$temp_array['direction_degree'] = $direction;
9626 9626
 			$temp_array['direction_shortname'] = "E";
9627 9627
 			$temp_array['direction_fullname'] = "East";
9628
-		} elseif ($direction >= 112.5 && $direction < 135){
9628
+		} elseif ($direction >= 112.5 && $direction < 135) {
9629 9629
 			$temp_array['direction_degree'] = $direction;
9630 9630
 			$temp_array['direction_shortname'] = "ESE";
9631 9631
 			$temp_array['direction_fullname'] = "East-Southeast";
9632
-		} elseif ($direction >= 135 && $direction < 157.5){
9632
+		} elseif ($direction >= 135 && $direction < 157.5) {
9633 9633
 			$temp_array['direction_degree'] = $direction;
9634 9634
 			$temp_array['direction_shortname'] = "SE";
9635 9635
 			$temp_array['direction_fullname'] = "Southeast";
9636
-		} elseif ($direction >= 157.5 && $direction < 180){
9636
+		} elseif ($direction >= 157.5 && $direction < 180) {
9637 9637
 			$temp_array['direction_degree'] = $direction;
9638 9638
 			$temp_array['direction_shortname'] = "SSE";
9639 9639
 			$temp_array['direction_fullname'] = "South-Southeast";
9640
-		} elseif ($direction >= 180 && $direction < 202.5){
9640
+		} elseif ($direction >= 180 && $direction < 202.5) {
9641 9641
 			$temp_array['direction_degree'] = $direction;
9642 9642
 			$temp_array['direction_shortname'] = "S";
9643 9643
 			$temp_array['direction_fullname'] = "South";
9644
-		} elseif ($direction >= 202.5 && $direction < 225){
9644
+		} elseif ($direction >= 202.5 && $direction < 225) {
9645 9645
 			$temp_array['direction_degree'] = $direction;
9646 9646
 			$temp_array['direction_shortname'] = "SSW";
9647 9647
 			$temp_array['direction_fullname'] = "South-Southwest";
9648
-		} elseif ($direction >= 225 && $direction < 247.5){
9648
+		} elseif ($direction >= 225 && $direction < 247.5) {
9649 9649
 			$temp_array['direction_degree'] = $direction;
9650 9650
 			$temp_array['direction_shortname'] = "SW";
9651 9651
 			$temp_array['direction_fullname'] = "Southwest";
9652
-		} elseif ($direction >= 247.5 && $direction < 270){
9652
+		} elseif ($direction >= 247.5 && $direction < 270) {
9653 9653
 			$temp_array['direction_degree'] = $direction;
9654 9654
 			$temp_array['direction_shortname'] = "WSW";
9655 9655
 			$temp_array['direction_fullname'] = "West-Southwest";
9656
-		} elseif ($direction >= 270 && $direction < 292.5){
9656
+		} elseif ($direction >= 270 && $direction < 292.5) {
9657 9657
 			$temp_array['direction_degree'] = $direction;
9658 9658
 			$temp_array['direction_shortname'] = "W";
9659 9659
 			$temp_array['direction_fullname'] = "West";
9660
-		} elseif ($direction >= 292.5 && $direction < 315){
9660
+		} elseif ($direction >= 292.5 && $direction < 315) {
9661 9661
 			$temp_array['direction_degree'] = $direction;
9662 9662
 			$temp_array['direction_shortname'] = "WNW";
9663 9663
 			$temp_array['direction_fullname'] = "West-Northwest";
9664
-		} elseif ($direction >= 315 && $direction < 337.5){
9664
+		} elseif ($direction >= 315 && $direction < 337.5) {
9665 9665
 			$temp_array['direction_degree'] = $direction;
9666 9666
 			$temp_array['direction_shortname'] = "NW";
9667 9667
 			$temp_array['direction_fullname'] = "Northwest";
9668
-		} elseif ($direction >= 337.5 && $direction < 360){
9668
+		} elseif ($direction >= 337.5 && $direction < 360) {
9669 9669
 			$temp_array['direction_degree'] = $direction;
9670 9670
 			$temp_array['direction_shortname'] = "NNW";
9671 9671
 			$temp_array['direction_fullname'] = "North-Northwest";
@@ -9718,9 +9718,9 @@  discard block
 block discarded – undo
9718 9718
 	*/
9719 9719
 	public function getAircraftRegistrationBymodeS($aircraft_modes)
9720 9720
 	{
9721
-		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
9721
+		$aircraft_modes = filter_var($aircraft_modes, FILTER_SANITIZE_STRING);
9722 9722
 	
9723
-		$query  = "SELECT aircraft_modes.Registration FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes ORDER BY FirstCreated DESC LIMIT 1";
9723
+		$query = "SELECT aircraft_modes.Registration FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes ORDER BY FirstCreated DESC LIMIT 1";
9724 9724
 		
9725 9725
 		$sth = $this->db->prepare($query);
9726 9726
 		$sth->execute(array(':aircraft_modes' => $aircraft_modes));
@@ -9743,9 +9743,9 @@  discard block
 block discarded – undo
9743 9743
 	*/
9744 9744
 	public function getAircraftTypeBymodeS($aircraft_modes)
9745 9745
 	{
9746
-		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
9746
+		$aircraft_modes = filter_var($aircraft_modes, FILTER_SANITIZE_STRING);
9747 9747
 	
9748
-		$query  = "SELECT aircraft_modes.type_flight FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes ORDER BY FirstCreated DESC LIMIT 1";
9748
+		$query = "SELECT aircraft_modes.type_flight FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes ORDER BY FirstCreated DESC LIMIT 1";
9749 9749
 		
9750 9750
 		$sth = $this->db->prepare($query);
9751 9751
 		$sth->execute(array(':aircraft_modes' => $aircraft_modes));
@@ -9766,11 +9766,11 @@  discard block
 block discarded – undo
9766 9766
 	* @param Float $longitude longitute of the flight
9767 9767
 	* @return String the countrie
9768 9768
 	*/
9769
-	public function getCountryFromLatitudeLongitude($latitude,$longitude)
9769
+	public function getCountryFromLatitudeLongitude($latitude, $longitude)
9770 9770
 	{
9771 9771
 		global $globalDBdriver, $globalDebug;
9772
-		$latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
9773
-		$longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
9772
+		$latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
9773
+		$longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
9774 9774
 	
9775 9775
 		$Connection = new Connection($this->db);
9776 9776
 		if (!$Connection->tableExists('countries')) return '';
@@ -9810,7 +9810,7 @@  discard block
 block discarded – undo
9810 9810
 	public function getCountryFromISO2($iso2)
9811 9811
 	{
9812 9812
 		global $globalDBdriver, $globalDebug;
9813
-		$iso2 = filter_var($iso2,FILTER_SANITIZE_STRING);
9813
+		$iso2 = filter_var($iso2, FILTER_SANITIZE_STRING);
9814 9814
 	
9815 9815
 		$Connection = new Connection($this->db);
9816 9816
 		if (!$Connection->tableExists('countries')) return '';
@@ -9842,19 +9842,19 @@  discard block
 block discarded – undo
9842 9842
 	*/
9843 9843
 	public function convertAircraftRegistration($registration)
9844 9844
 	{
9845
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
9845
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
9846 9846
 		$registration_prefix = '';
9847 9847
 		$registration_1 = substr($registration, 0, 1);
9848 9848
 		$registration_2 = substr($registration, 0, 2);
9849 9849
 
9850 9850
 		//first get the prefix based on two characters
9851
-		$query  = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_2";
9851
+		$query = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_2";
9852 9852
       
9853 9853
 		
9854 9854
 		$sth = $this->db->prepare($query);
9855 9855
 		$sth->execute(array(':registration_2' => $registration_2));
9856 9856
         
9857
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9857
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9858 9858
 		{
9859 9859
 			$registration_prefix = $row['registration_prefix'];
9860 9860
 		}
@@ -9862,11 +9862,11 @@  discard block
 block discarded – undo
9862 9862
 		//if we didn't find a two chracter prefix lets just search the one with one character
9863 9863
 		if ($registration_prefix == '')
9864 9864
 		{
9865
-			$query  = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_1";
9865
+			$query = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_1";
9866 9866
 			$sth = $this->db->prepare($query);
9867 9867
 			$sth->execute(array(':registration_1' => $registration_1));
9868 9868
 	        
9869
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
9869
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9870 9870
 			{
9871 9871
 				$registration_prefix = $row['registration_prefix'];
9872 9872
 			}
@@ -9880,7 +9880,7 @@  discard block
 block discarded – undo
9880 9880
 			} else {
9881 9881
 				$registration = preg_replace("/^(.{1})/", "$1-", $registration);
9882 9882
 			}
9883
-		} else if(strlen($registration_prefix) == 2){
9883
+		} else if (strlen($registration_prefix) == 2) {
9884 9884
 			if (0 === strpos($registration, 'N')) {
9885 9885
 				$registration = preg_replace("/^(.{2})/", "$1", $registration);
9886 9886
 			} else {
@@ -9899,17 +9899,17 @@  discard block
 block discarded – undo
9899 9899
 	*/
9900 9900
 	public function countryFromAircraftRegistration($registration)
9901 9901
 	{
9902
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
9902
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
9903 9903
 		
9904 9904
 		$registration_prefix = '';
9905
-		$registration_test = explode('-',$registration);
9905
+		$registration_test = explode('-', $registration);
9906 9906
 		$country = '';
9907 9907
 		if ($registration_test[0] != $registration) {
9908 9908
 			$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1";
9909 9909
 	      
9910 9910
 			$sth = $this->db->prepare($query);
9911 9911
 			$sth->execute(array(':registration_1' => $registration_test[0]));
9912
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
9912
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9913 9913
 			{
9914 9914
 				//$registration_prefix = $row['registration_prefix'];
9915 9915
 				$country = $row['country'];
@@ -9920,13 +9920,13 @@  discard block
 block discarded – undo
9920 9920
 
9921 9921
 			$country = '';
9922 9922
 			//first get the prefix based on two characters
9923
-			$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_2 LIMIT 1";
9923
+			$query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_2 LIMIT 1";
9924 9924
       
9925 9925
 			
9926 9926
 			$sth = $this->db->prepare($query);
9927 9927
 			$sth->execute(array(':registration_2' => $registration_2));
9928 9928
         
9929
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
9929
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9930 9930
 			{
9931 9931
 				$registration_prefix = $row['registration_prefix'];
9932 9932
 				$country = $row['country'];
@@ -9935,12 +9935,12 @@  discard block
 block discarded – undo
9935 9935
 			//if we didn't find a two chracter prefix lets just search the one with one character
9936 9936
 			if ($registration_prefix == "")
9937 9937
 			{
9938
-				$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1";
9938
+				$query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1";
9939 9939
 	      
9940 9940
 				$sth = $this->db->prepare($query);
9941 9941
 				$sth->execute(array(':registration_1' => $registration_1));
9942 9942
 	        
9943
-				while($row = $sth->fetch(PDO::FETCH_ASSOC))
9943
+				while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9944 9944
 				{
9945 9945
 					//$registration_prefix = $row['registration_prefix'];
9946 9946
 					$country = $row['country'];
@@ -9960,17 +9960,17 @@  discard block
 block discarded – undo
9960 9960
 	*/
9961 9961
 	public function registrationPrefixFromAircraftRegistration($registration)
9962 9962
 	{
9963
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
9963
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
9964 9964
 		
9965 9965
 		$registration_prefix = '';
9966
-		$registration_test = explode('-',$registration);
9966
+		$registration_test = explode('-', $registration);
9967 9967
 		//$country = '';
9968 9968
 		if ($registration_test[0] != $registration) {
9969
-			$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1";
9969
+			$query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1";
9970 9970
 	      
9971 9971
 			$sth = $this->db->prepare($query);
9972 9972
 			$sth->execute(array(':registration_1' => $registration_test[0]));
9973
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
9973
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9974 9974
 			{
9975 9975
 				$registration_prefix = $row['registration_prefix'];
9976 9976
 				//$country = $row['country'];
@@ -9980,13 +9980,13 @@  discard block
 block discarded – undo
9980 9980
 		        $registration_2 = substr($registration, 0, 2);
9981 9981
 
9982 9982
 			//first get the prefix based on two characters
9983
-			$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_2 LIMIT 1";
9983
+			$query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_2 LIMIT 1";
9984 9984
       
9985 9985
 			
9986 9986
 			$sth = $this->db->prepare($query);
9987 9987
 			$sth->execute(array(':registration_2' => $registration_2));
9988 9988
         
9989
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
9989
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9990 9990
 			{
9991 9991
 				$registration_prefix = $row['registration_prefix'];
9992 9992
 				//$country = $row['country'];
@@ -9995,12 +9995,12 @@  discard block
 block discarded – undo
9995 9995
 			//if we didn't find a two chracter prefix lets just search the one with one character
9996 9996
 			if ($registration_prefix == "")
9997 9997
 			{
9998
-				$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1";
9998
+				$query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1";
9999 9999
 	      
10000 10000
 				$sth = $this->db->prepare($query);
10001 10001
 				$sth->execute(array(':registration_1' => $registration_1));
10002 10002
 	        
10003
-				while($row = $sth->fetch(PDO::FETCH_ASSOC))
10003
+				while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10004 10004
 				{
10005 10005
 					$registration_prefix = $row['registration_prefix'];
10006 10006
 					//$country = $row['country'];
@@ -10021,13 +10021,13 @@  discard block
 block discarded – undo
10021 10021
 	*/
10022 10022
 	public function countryFromAircraftRegistrationCode($registration)
10023 10023
 	{
10024
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
10024
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
10025 10025
 		
10026 10026
 		$country = '';
10027
-		$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration LIMIT 1";
10027
+		$query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration LIMIT 1";
10028 10028
 		$sth = $this->db->prepare($query);
10029 10029
 		$sth->execute(array(':registration' => $registration));
10030
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10030
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10031 10031
 		{
10032 10032
 			$country = $row['country'];
10033 10033
 		}
@@ -10040,9 +10040,9 @@  discard block
 block discarded – undo
10040 10040
 	* @param String $flightaware_id flightaware_id from spotter_output table
10041 10041
 	* @param String $highlight New highlight value
10042 10042
 	*/
10043
-	public function setHighlightFlight($flightaware_id,$highlight) {
10043
+	public function setHighlightFlight($flightaware_id, $highlight) {
10044 10044
 		
10045
-		$query  = "UPDATE spotter_output SET highlight = :highlight WHERE flightaware_id = :flightaware_id";
10045
+		$query = "UPDATE spotter_output SET highlight = :highlight WHERE flightaware_id = :flightaware_id";
10046 10046
 		$sth = $this->db->prepare($query);
10047 10047
 		$sth->execute(array(':flightaware_id' => $flightaware_id, ':highlight' => $highlight));
10048 10048
 	}
@@ -10071,7 +10071,7 @@  discard block
 block discarded – undo
10071 10071
 		
10072 10072
 		$bitly_data = json_decode($bitly_data);
10073 10073
 		$bitly_url = '';
10074
-		if ($bitly_data->status_txt = "OK"){
10074
+		if ($bitly_data->status_txt = "OK") {
10075 10075
 			$bitly_url = $bitly_data->data->url;
10076 10076
 		}
10077 10077
 
@@ -10081,7 +10081,7 @@  discard block
 block discarded – undo
10081 10081
 
10082 10082
 	public function getOrderBy()
10083 10083
 	{
10084
-		$orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY spotter_output.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY spotter_output.aircraft_icao DESC"),"manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY spotter_output.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY spotter_output.aircraft_manufacturer DESC"),"airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY spotter_output.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY spotter_output.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY spotter_output.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY spotter_output.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY spotter_output.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY spotter_output.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY spotter_output.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY spotter_output.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY spotter_output.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY spotter_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"));
10084
+		$orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY spotter_output.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY spotter_output.aircraft_icao DESC"), "manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY spotter_output.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY spotter_output.aircraft_manufacturer DESC"), "airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY spotter_output.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY spotter_output.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY spotter_output.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY spotter_output.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY spotter_output.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY spotter_output.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY spotter_output.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY spotter_output.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY spotter_output.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY spotter_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"));
10085 10085
 		
10086 10086
 		return $orderby;
10087 10087
 		
@@ -10215,14 +10215,14 @@  discard block
 block discarded – undo
10215 10215
 		}
10216 10216
 		$sth = $this->db->prepare($query);
10217 10217
 		$sth->execute();
10218
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10218
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10219 10219
 		{
10220 10220
 			$departure_airport_array = $this->getAllAirportInfo($row['fromairport_icao']);
10221 10221
 			$arrival_airport_array = $this->getAllAirportInfo($row['toairport_icao']);
10222 10222
 			if (count($departure_airport_array) > 0 && count($arrival_airport_array) > 0) {
10223
-				$update_query="UPDATE spotter_output SET departure_airport_icao = :fromicao, arrival_airport_icao = :toicao, departure_airport_name = :departure_airport_name, departure_airport_city = :departure_airport_city, departure_airport_country = :departure_airport_country, arrival_airport_name = :arrival_airport_name, arrival_airport_city = :arrival_airport_city, arrival_airport_country = :arrival_airport_country WHERE spotter_id = :spotter_id";
10223
+				$update_query = "UPDATE spotter_output SET departure_airport_icao = :fromicao, arrival_airport_icao = :toicao, departure_airport_name = :departure_airport_name, departure_airport_city = :departure_airport_city, departure_airport_country = :departure_airport_country, arrival_airport_name = :arrival_airport_name, arrival_airport_city = :arrival_airport_city, arrival_airport_country = :arrival_airport_country WHERE spotter_id = :spotter_id";
10224 10224
 				$sthu = $this->db->prepare($update_query);
10225
-				$sthu->execute(array(':fromicao' => $row['fromairport_icao'],':toicao' => $row['toairport_icao'],':spotter_id' => $row['spotter_id'],':departure_airport_name' => $departure_airport_array[0]['name'],':departure_airport_city' => $departure_airport_array[0]['city'],':departure_airport_country' => $departure_airport_array[0]['country'],':arrival_airport_name' => $arrival_airport_array[0]['name'],':arrival_airport_city' => $arrival_airport_array[0]['city'],':arrival_airport_country' => $arrival_airport_array[0]['country']));
10225
+				$sthu->execute(array(':fromicao' => $row['fromairport_icao'], ':toicao' => $row['toairport_icao'], ':spotter_id' => $row['spotter_id'], ':departure_airport_name' => $departure_airport_array[0]['name'], ':departure_airport_city' => $departure_airport_array[0]['city'], ':departure_airport_country' => $departure_airport_array[0]['country'], ':arrival_airport_name' => $arrival_airport_array[0]['name'], ':arrival_airport_city' => $arrival_airport_array[0]['city'], ':arrival_airport_country' => $arrival_airport_array[0]['country']));
10226 10226
 			}
10227 10227
 		}
10228 10228
 		
@@ -10235,7 +10235,7 @@  discard block
 block discarded – undo
10235 10235
 		}
10236 10236
 		$sth = $this->db->prepare($query);
10237 10237
 		$sth->execute();
10238
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10238
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10239 10239
 		{
10240 10240
 			if (is_numeric(substr($row['ident'], -1, 1)))
10241 10241
 			{
@@ -10244,11 +10244,11 @@  discard block
 block discarded – undo
10244 10244
 				elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') $fromsource = 'ivao';
10245 10245
 				elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim';
10246 10246
 				elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao';
10247
-				$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3),$fromsource);
10247
+				$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3), $fromsource);
10248 10248
 				if (isset($airline_array[0]['name'])) {
10249
-					$update_query  = "UPDATE spotter_output SET spotter_output.airline_name = :airline_name, spotter_output.airline_icao = :airline_icao, spotter_output.airline_country = :airline_country, spotter_output.airline_type = :airline_type WHERE spotter_output.spotter_id = :spotter_id";
10249
+					$update_query = "UPDATE spotter_output SET spotter_output.airline_name = :airline_name, spotter_output.airline_icao = :airline_icao, spotter_output.airline_country = :airline_country, spotter_output.airline_type = :airline_type WHERE spotter_output.spotter_id = :spotter_id";
10250 10250
 					$sthu = $this->db->prepare($update_query);
10251
-					$sthu->execute(array(':airline_name' => $airline_array[0]['name'],':airline_icao' => $airline_array[0]['icao'], ':airline_country' => $airline_array[0]['country'], ':airline_type' => $airline_array[0]['type'], ':spotter_id' => $row['spotter_id']));
10251
+					$sthu->execute(array(':airline_name' => $airline_array[0]['name'], ':airline_icao' => $airline_array[0]['icao'], ':airline_country' => $airline_array[0]['country'], ':airline_type' => $airline_array[0]['type'], ':spotter_id' => $row['spotter_id']));
10252 10252
 				}
10253 10253
 			}
10254 10254
 		}
@@ -10268,18 +10268,18 @@  discard block
 block discarded – undo
10268 10268
 		}
10269 10269
 		$sth = $this->db->prepare($query);
10270 10270
 		$sth->execute();
10271
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10271
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10272 10272
 		{
10273 10273
 			if ($row['aircraft_icao'] != '') {
10274 10274
 				$aircraft_name = $this->getAllAircraftInfo($row['aircraft_icao']);
10275
-				if ($row['registration'] != ""){
10275
+				if ($row['registration'] != "") {
10276 10276
 					$image_array = $Image->getSpotterImage($row['registration']);
10277 10277
 					if (!isset($image_array[0]['registration'])) {
10278 10278
 						$Image->addSpotterImage($row['registration']);
10279 10279
 					}
10280 10280
 				}
10281 10281
 				if (count($aircraft_name) > 0) {
10282
-					$update_query  = "UPDATE spotter_output SET spotter_output.aircraft_name = :aircraft_name, spotter_output.aircraft_manufacturer = :aircraft_manufacturer WHERE spotter_output.spotter_id = :spotter_id";
10282
+					$update_query = "UPDATE spotter_output SET spotter_output.aircraft_name = :aircraft_name, spotter_output.aircraft_manufacturer = :aircraft_manufacturer WHERE spotter_output.spotter_id = :spotter_id";
10283 10283
 					$sthu = $this->db->prepare($update_query);
10284 10284
 					$sthu->execute(array(':aircraft_name' => $aircraft_name[0]['type'], ':aircraft_manufacturer' => $aircraft_name[0]['manufacturer'], ':spotter_id' => $row['spotter_id']));
10285 10285
 				}
@@ -10294,10 +10294,10 @@  discard block
 block discarded – undo
10294 10294
 		$query = "SELECT spotter_output.spotter_id, spotter_output.last_latitude, spotter_output.last_longitude, spotter_output.last_altitude, spotter_output.arrival_airport_icao, spotter_output.real_arrival_airport_icao FROM spotter_output";
10295 10295
 		$sth = $this->db->prepare($query);
10296 10296
 		$sth->execute();
10297
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10297
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10298 10298
 		{
10299 10299
 			if ($row['last_latitude'] != '' && $row['last_longitude'] != '') {
10300
-				$closestAirports = $this->closestAirports($row['last_latitude'],$row['last_longitude'],$globalClosestMinDist);
10300
+				$closestAirports = $this->closestAirports($row['last_latitude'], $row['last_longitude'], $globalClosestMinDist);
10301 10301
 				$airport_icao = '';
10302 10302
 				 if (isset($closestAirports[0])) {
10303 10303
 					if ($row['arrival_airport_icao'] == $closestAirports[0]['icao']) {
@@ -10311,7 +10311,7 @@  discard block
 block discarded – undo
10311 10311
 								break;
10312 10312
 							}
10313 10313
 						}
10314
-					} elseif ($row['last_altitude'] == 0 || ($row['last_altitude'] != '' && ($closestAirports[0]['altitude'] <= $row['last_altitude']*100+1000 && $row['last_altitude']*100 < $closestAirports[0]['altitude']+5000))) {
10314
+					} elseif ($row['last_altitude'] == 0 || ($row['last_altitude'] != '' && ($closestAirports[0]['altitude'] <= $row['last_altitude']*100 + 1000 && $row['last_altitude']*100 < $closestAirports[0]['altitude'] + 5000))) {
10315 10315
 						$airport_icao = $closestAirports[0]['icao'];
10316 10316
 						if ($globalDebug) echo "\o/ NP --++ Find arrival airport. Airport ICAO : ".$airport_icao." !  Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist." - Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.($row['last_altitude']*100)."\n";
10317 10317
 					} else {
@@ -10322,28 +10322,28 @@  discard block
 block discarded – undo
10322 10322
 				}
10323 10323
 				if ($row['real_arrival_airport_icao'] != $airport_icao) {
10324 10324
 					if ($globalDebug) echo "Updating airport to ".$airport_icao."...\n";
10325
-					$update_query="UPDATE spotter_output SET real_arrival_airport_icao = :airport_icao WHERE spotter_id = :spotter_id";
10325
+					$update_query = "UPDATE spotter_output SET real_arrival_airport_icao = :airport_icao WHERE spotter_id = :spotter_id";
10326 10326
 					$sthu = $this->db->prepare($update_query);
10327
-					$sthu->execute(array(':airport_icao' => $airport_icao,':spotter_id' => $row['spotter_id']));
10327
+					$sthu->execute(array(':airport_icao' => $airport_icao, ':spotter_id' => $row['spotter_id']));
10328 10328
 				}
10329 10329
 			}
10330 10330
 		}
10331 10331
 	}
10332 10332
 	
10333
-	public function closestAirports($origLat,$origLon,$dist = 10) {
10333
+	public function closestAirports($origLat, $origLon, $dist = 10) {
10334 10334
 		global $globalDBdriver;
10335
-		$dist = number_format($dist*0.621371,2,'.',''); // convert km to mile
10335
+		$dist = number_format($dist*0.621371, 2, '.', ''); // convert km to mile
10336 10336
 /*
10337 10337
 		$query="SELECT name, icao, latitude, longitude, altitude, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - abs(latitude))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(abs(latitude)*pi()/180)*POWER(SIN(($origLon-longitude)*pi()/180/2),2))) as distance 
10338 10338
                       FROM airport WHERE longitude between ($origLon-$dist/abs(cos(radians($origLat))*69)) and ($origLon+$dist/abs(cos(radians($origLat))*69)) and latitude between ($origLat-($dist/69)) and ($origLat+($dist/69)) 
10339 10339
                       having distance < $dist ORDER BY distance limit 100;";
10340 10340
 */
10341 10341
 		if ($globalDBdriver == 'mysql') {
10342
-			$query="SELECT name, icao, latitude, longitude, altitude, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(latitude*pi()/180)*POWER(SIN(($origLon-longitude)*pi()/180/2),2))) as distance 
10342
+			$query = "SELECT name, icao, latitude, longitude, altitude, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(latitude*pi()/180)*POWER(SIN(($origLon-longitude)*pi()/180/2),2))) as distance 
10343 10343
 	                      FROM airport WHERE longitude between ($origLon-$dist/cos(radians($origLat))*69) and ($origLon+$dist/cos(radians($origLat)*69)) and latitude between ($origLat-($dist/69)) and ($origLat+($dist/69)) 
10344 10344
 	                      AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(latitude*pi()/180)*POWER(SIN(($origLon-longitude)*pi()/180/2),2)))) < $dist ORDER BY distance limit 100;";
10345 10345
                 } else {
10346
-			$query="SELECT name, icao, latitude, longitude, altitude, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(longitude as double precision))*pi()/180/2),2))) as distance 
10346
+			$query = "SELECT name, icao, latitude, longitude, altitude, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(longitude as double precision))*pi()/180/2),2))) as distance 
10347 10347
 	                      FROM airport WHERE CAST(longitude as double precision) between ($origLon-$dist/cos(radians($origLat))*69) and ($origLon+$dist/cos(radians($origLat))*69) and CAST(latitude as double precision) between ($origLat-($dist/69)) and ($origLat+($dist/69)) 
10348 10348
 	                      AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(longitude as double precision))*pi()/180/2),2)))) < $dist ORDER BY distance limit 100;";
10349 10349
     		}
Please login to merge, or discard this patch.
Braces   +692 added lines, -240 removed lines patch added patch discarded remove patch
@@ -27,7 +27,9 @@  discard block
 block discarded – undo
27 27
 				$filter = array_merge($filter,$globalStatsFilters[$globalFilterName]);
28 28
 			}
29 29
 		}
30
-		if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter);
30
+		if (is_array($globalFilter)) {
31
+			$filter = array_merge($filter,$globalFilter);
32
+		}
31 33
 		$filter_query_join = '';
32 34
 		$filter_query_where = '';
33 35
 		foreach($filters as $flt) {
@@ -80,8 +82,11 @@  discard block
 block discarded – undo
80 82
 				$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
81 83
 			}
82 84
 		}
83
-		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
84
-		elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND';
85
+		if ($filter_query_where == '' && $where) {
86
+			$filter_query_where = ' WHERE';
87
+		} elseif ($filter_query_where != '' && $and) {
88
+			$filter_query_where .= ' AND';
89
+		}
85 90
 		$filter_query = $filter_query_join.$filter_query_where;
86 91
 		return $filter_query;
87 92
 	}
@@ -101,10 +106,18 @@  discard block
 block discarded – undo
101 106
 		$Image = new Image($this->db);
102 107
 		$Schedule = new Schedule($this->db);
103 108
 		$ACARS = new ACARS($this->db);
104
-		if (!isset($globalIVAO)) $globalIVAO = FALSE;
105
-		if (!isset($globalVATSIM)) $globalVATSIM = FALSE;
106
-		if (!isset($globalphpVMS)) $globalphpVMS = FALSE;
107
-		if (!isset($globalVAM)) $globalVAM = FALSE;
109
+		if (!isset($globalIVAO)) {
110
+			$globalIVAO = FALSE;
111
+		}
112
+		if (!isset($globalVATSIM)) {
113
+			$globalVATSIM = FALSE;
114
+		}
115
+		if (!isset($globalphpVMS)) {
116
+			$globalphpVMS = FALSE;
117
+		}
118
+		if (!isset($globalVAM)) {
119
+			$globalVAM = FALSE;
120
+		}
108 121
 		date_default_timezone_set('UTC');
109 122
 		
110 123
 		if (!is_string($query))
@@ -151,21 +164,35 @@  discard block
 block discarded – undo
151 164
 			} else {
152 165
 				$temp_array['spotter_id'] = '';
153 166
 			}
154
-			if (isset($row['flightaware_id'])) $temp_array['flightaware_id'] = $row['flightaware_id'];
155
-			if (isset($row['modes'])) $temp_array['modes'] = $row['modes'];
167
+			if (isset($row['flightaware_id'])) {
168
+				$temp_array['flightaware_id'] = $row['flightaware_id'];
169
+			}
170
+			if (isset($row['modes'])) {
171
+				$temp_array['modes'] = $row['modes'];
172
+			}
156 173
 			$temp_array['ident'] = $row['ident'];
157 174
 			if (isset($row['registration']) && $row['registration'] != '') {
158 175
 				$temp_array['registration'] = $row['registration'];
159 176
 			} elseif (isset($temp_array['modes'])) {
160 177
 				$temp_array['registration'] = $this->getAircraftRegistrationBymodeS($temp_array['modes']);
161
-			} else $temp_array['registration'] = '';
162
-			if (isset($row['aircraft_icao'])) $temp_array['aircraft_type'] = $row['aircraft_icao'];
178
+			} else {
179
+				$temp_array['registration'] = '';
180
+			}
181
+			if (isset($row['aircraft_icao'])) {
182
+				$temp_array['aircraft_type'] = $row['aircraft_icao'];
183
+			}
163 184
 			
164 185
 			$temp_array['departure_airport'] = $row['departure_airport_icao'];
165 186
 			$temp_array['arrival_airport'] = $row['arrival_airport_icao'];
166
-			if (isset($row['real_arrival_airport_icao']) && $row['real_arrival_airport_icao'] != NULL) $temp_array['real_arrival_airport'] = $row['real_arrival_airport_icao'];
167
-			if (isset($row['latitude'])) $temp_array['latitude'] = $row['latitude'];
168
-			if (isset($row['longitude'])) $temp_array['longitude'] = $row['longitude'];
187
+			if (isset($row['real_arrival_airport_icao']) && $row['real_arrival_airport_icao'] != NULL) {
188
+				$temp_array['real_arrival_airport'] = $row['real_arrival_airport_icao'];
189
+			}
190
+			if (isset($row['latitude'])) {
191
+				$temp_array['latitude'] = $row['latitude'];
192
+			}
193
+			if (isset($row['longitude'])) {
194
+				$temp_array['longitude'] = $row['longitude'];
195
+			}
169 196
 			/*
170 197
 			if (Connection->tableExists('countries')) {
171 198
 				$country_info = $this->getCountryFromLatitudeLongitude($temp_array['latitude'],$temp_array['longitude']);
@@ -175,8 +202,12 @@  discard block
 block discarded – undo
175 202
 				}
176 203
 			}
177 204
 			*/
178
-			if (isset($row['waypoints'])) $temp_array['waypoints'] = $row['waypoints'];
179
-			if (isset($row['format_source'])) $temp_array['format_source'] = $row['format_source'];
205
+			if (isset($row['waypoints'])) {
206
+				$temp_array['waypoints'] = $row['waypoints'];
207
+			}
208
+			if (isset($row['format_source'])) {
209
+				$temp_array['format_source'] = $row['format_source'];
210
+			}
180 211
 			if (isset($row['route_stop'])) {
181 212
 				$temp_array['route_stop'] = $row['route_stop'];
182 213
 				if ($row['route_stop'] != '') {
@@ -195,13 +226,19 @@  discard block
 block discarded – undo
195 226
 					}
196 227
 				}
197 228
 			}
198
-			if (isset($row['altitude'])) $temp_array['altitude'] = $row['altitude'];
229
+			if (isset($row['altitude'])) {
230
+				$temp_array['altitude'] = $row['altitude'];
231
+			}
199 232
 			if (isset($row['heading'])) {
200 233
 				$temp_array['heading'] = $row['heading'];
201 234
 				$heading_direction = $this->parseDirection($row['heading']);
202
-				if (isset($heading_direction[0]['direction_fullname'])) $temp_array['heading_name'] = $heading_direction[0]['direction_fullname'];
235
+				if (isset($heading_direction[0]['direction_fullname'])) {
236
+					$temp_array['heading_name'] = $heading_direction[0]['direction_fullname'];
237
+				}
238
+			}
239
+			if (isset($row['ground_speed'])) {
240
+				$temp_array['ground_speed'] = $row['ground_speed'];
203 241
 			}
204
-			if (isset($row['ground_speed'])) $temp_array['ground_speed'] = $row['ground_speed'];
205 242
 			$temp_array['image'] = "";
206 243
 			$temp_array['image_thumbnail'] = "";
207 244
 			$temp_array['image_source'] = "";
@@ -209,7 +246,9 @@  discard block
 block discarded – undo
209 246
  
210 247
 			if (isset($row['highlight'])) {
211 248
 				$temp_array['highlight'] = $row['highlight'];
212
-			} else $temp_array['highlight'] = '';
249
+			} else {
250
+				$temp_array['highlight'] = '';
251
+			}
213 252
 			
214 253
 			if (isset($row['date'])) {
215 254
 				$dateArray = $this->parseDateString($row['date']);
@@ -257,7 +296,9 @@  discard block
 block discarded – undo
257 296
 				
258 297
 					if ($aircraft_array[0]['aircraft_shadow'] != NULL) {
259 298
 						$temp_array['aircraft_shadow'] = $aircraft_array[0]['aircraft_shadow'];
260
-					} else $temp_array['aircraft_shadow'] = 'default.png';
299
+					} else {
300
+						$temp_array['aircraft_shadow'] = 'default.png';
301
+					}
261 302
                                 } else {
262 303
                             		$temp_array['aircraft_shadow'] = 'default.png';
263 304
 					$temp_array['aircraft_name'] = 'N/A';
@@ -265,11 +306,17 @@  discard block
 block discarded – undo
265 306
                             	}
266 307
 			}
267 308
 			$fromsource = NULL;
268
-			if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource;
269
-			elseif (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') $fromsource = 'vatsim';
270
-			elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') $fromsource = 'ivao';
271
-			elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim';
272
-			elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao';
309
+			if (isset($globalAirlinesSource) && $globalAirlinesSource != '') {
310
+				$fromsource = $globalAirlinesSource;
311
+			} elseif (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') {
312
+				$fromsource = 'vatsim';
313
+			} elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') {
314
+				$fromsource = 'ivao';
315
+			} elseif (isset($globalVATSIM) && $globalVATSIM) {
316
+				$fromsource = 'vatsim';
317
+			} elseif (isset($globalIVAO) && $globalIVAO) {
318
+				$fromsource = 'ivao';
319
+			}
273 320
 			if (!isset($row['airline_name']) || $row['airline_name'] == '') {
274 321
 				if (!is_numeric(substr($row['ident'], 0, 3))) {
275 322
 					if (is_numeric(substr($row['ident'], 2, 1))) {
@@ -292,12 +339,18 @@  discard block
 block discarded – undo
292 339
 				}
293 340
 			} else {
294 341
 				$temp_array['airline_icao'] = $row['airline_icao'];
295
-				if (isset($row['airline_iata'])) $temp_array['airline_iata'] = $row['airline_iata'];
296
-				else $temp_array['airline_iata'] = 'N/A';
342
+				if (isset($row['airline_iata'])) {
343
+					$temp_array['airline_iata'] = $row['airline_iata'];
344
+				} else {
345
+					$temp_array['airline_iata'] = 'N/A';
346
+				}
297 347
 				$temp_array['airline_name'] = $row['airline_name'];
298 348
 				$temp_array['airline_country'] = $row['airline_country'];
299
-				if (isset($row['airline_callsign'])) $temp_array['airline_callsign'] = $row['airline_callsign'];
300
-				else $temp_array['airline_callsign'] = 'N/A';
349
+				if (isset($row['airline_callsign'])) {
350
+					$temp_array['airline_callsign'] = $row['airline_callsign'];
351
+				} else {
352
+					$temp_array['airline_callsign'] = 'N/A';
353
+				}
301 354
 				$temp_array['airline_type'] = $row['airline_type'];
302 355
 				if ($temp_array['airline_icao'] != '' && $temp_array['airline_iata'] == 'N/A') {
303 356
 					$airline_array = $this->getAllAirlineInfo($temp_array['airline_icao']);
@@ -324,7 +377,9 @@  discard block
 block discarded – undo
324 377
 			}
325 378
 			if ($temp_array['registration'] != "" && !$globalIVAO && !$globalVATSIM && !$globalphpVMS && !$globalVAM && !isset($temp_array['aircraft_owner'])) {
326 379
 				$owner_info = $this->getAircraftOwnerByRegistration($temp_array['registration']);
327
-				if ($owner_info['owner'] != '') $temp_array['aircraft_owner'] = ucwords(strtolower($owner_info['owner']));
380
+				if ($owner_info['owner'] != '') {
381
+					$temp_array['aircraft_owner'] = ucwords(strtolower($owner_info['owner']));
382
+				}
328 383
 				$temp_array['aircraft_base'] = $owner_info['base'];
329 384
 				$temp_array['aircraft_date_first_reg'] = $owner_info['date_first_reg'];
330 385
 			}
@@ -332,9 +387,14 @@  discard block
 block discarded – undo
332 387
 			if($temp_array['registration'] != "" || ($globalIVAO && isset($temp_array['aircraft_type']) && $temp_array['aircraft_type'] != ''))
333 388
 			{
334 389
 				if ($globalIVAO) {
335
-					if (isset($temp_array['airline_icao']))	$image_array = $Image->getSpotterImage('',$temp_array['aircraft_type'],$temp_array['airline_icao']);
336
-					else $image_array = $Image->getSpotterImage('',$temp_array['aircraft_type']);
337
-				} else $image_array = $Image->getSpotterImage($temp_array['registration']);
390
+					if (isset($temp_array['airline_icao'])) {
391
+						$image_array = $Image->getSpotterImage('',$temp_array['aircraft_type'],$temp_array['airline_icao']);
392
+					} else {
393
+						$image_array = $Image->getSpotterImage('',$temp_array['aircraft_type']);
394
+					}
395
+				} else {
396
+					$image_array = $Image->getSpotterImage($temp_array['registration']);
397
+				}
338 398
 				if (count($image_array) > 0) {
339 399
 					$temp_array['image'] = $image_array[0]['image'];
340 400
 					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -386,7 +446,9 @@  discard block
 block discarded – undo
386 446
 			//if ($row['departure_airport_icao'] != '' && $row['departure_airport_name'] == '') {
387 447
 			if ($row['departure_airport_icao'] != '') {
388 448
 				$departure_airport_array = $this->getAllAirportInfo($row['departure_airport_icao']);
389
-				if (!isset($departure_airport_array[0]['name'])) $departure_airport_array = $this->getAllAirportInfo('NA');
449
+				if (!isset($departure_airport_array[0]['name'])) {
450
+					$departure_airport_array = $this->getAllAirportInfo('NA');
451
+				}
390 452
 			/*
391 453
 			} elseif ($row['departure_airport_name'] != '') {
392 454
 				$temp_array['departure_airport_name'] = $row['departure_airport_name'];
@@ -394,7 +456,9 @@  discard block
 block discarded – undo
394 456
 				$temp_array['departure_airport_country'] = $row['departure_airport_country'];
395 457
 				$temp_array['departure_airport_icao'] = $row['departure_airport_icao'];
396 458
 			*/
397
-			} else $departure_airport_array = $this->getAllAirportInfo('NA');
459
+			} else {
460
+				$departure_airport_array = $this->getAllAirportInfo('NA');
461
+			}
398 462
 			if (isset($departure_airport_array[0]['name'])) {
399 463
 				$temp_array['departure_airport_name'] = $departure_airport_array[0]['name'];
400 464
 				$temp_array['departure_airport_city'] = $departure_airport_array[0]['city'];
@@ -414,8 +478,12 @@  discard block
 block discarded – undo
414 478
 			
415 479
 			if ($row['arrival_airport_icao'] != '') {
416 480
 				$arrival_airport_array = $this->getAllAirportInfo($row['arrival_airport_icao']);
417
-				if (count($arrival_airport_array) == 0) $arrival_airport_array = $this->getAllAirportInfo('NA');
418
-			} else $arrival_airport_array = $this->getAllAirportInfo('NA');
481
+				if (count($arrival_airport_array) == 0) {
482
+					$arrival_airport_array = $this->getAllAirportInfo('NA');
483
+				}
484
+			} else {
485
+				$arrival_airport_array = $this->getAllAirportInfo('NA');
486
+			}
419 487
 			if (isset($arrival_airport_array[0]['name'])) {
420 488
 				$temp_array['arrival_airport_name'] = $arrival_airport_array[0]['name'];
421 489
 				$temp_array['arrival_airport_city'] = $arrival_airport_array[0]['city'];
@@ -431,27 +499,45 @@  discard block
 block discarded – undo
431 499
 				$temp_array['arrival_airport_time'] = $row['arrival_airport_time'];
432 500
 			}
433 501
 			*/
434
-			if (isset($row['pilot_id']) && $row['pilot_id'] != '') $temp_array['pilot_id'] = $row['pilot_id'];
435
-			if (isset($row['pilot_name']) && $row['pilot_name'] != '') $temp_array['pilot_name'] = $row['pilot_name'];
436
-			if (isset($row['source_name']) && $row['source_name'] != '') $temp_array['source_name'] = $row['source_name'];
437
-			if (isset($row['over_country']) && $row['over_country'] != '') $temp_array['over_country'] = $row['over_country'];
438
-			if (isset($row['distance']) && $row['distance'] != '') $temp_array['distance'] = $row['distance'];
502
+			if (isset($row['pilot_id']) && $row['pilot_id'] != '') {
503
+				$temp_array['pilot_id'] = $row['pilot_id'];
504
+			}
505
+			if (isset($row['pilot_name']) && $row['pilot_name'] != '') {
506
+				$temp_array['pilot_name'] = $row['pilot_name'];
507
+			}
508
+			if (isset($row['source_name']) && $row['source_name'] != '') {
509
+				$temp_array['source_name'] = $row['source_name'];
510
+			}
511
+			if (isset($row['over_country']) && $row['over_country'] != '') {
512
+				$temp_array['over_country'] = $row['over_country'];
513
+			}
514
+			if (isset($row['distance']) && $row['distance'] != '') {
515
+				$temp_array['distance'] = $row['distance'];
516
+			}
439 517
 			if (isset($row['squawk'])) {
440 518
 				$temp_array['squawk'] = $row['squawk'];
441 519
 				if ($row['squawk'] != '' && isset($temp_array['country_iso2'])) {
442 520
 					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$temp_array['country_iso2']);
443
-					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
521
+					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) {
522
+						$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
523
+					}
444 524
 				} elseif ($row['squawk'] != '' && isset($temp_array['over_country'])) {
445 525
 					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$temp_array['over_country']);
446
-					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
447
-				} elseif ($row['squawk'] != '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
526
+					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) {
527
+						$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
528
+					}
529
+				} elseif ($row['squawk'] != '' && isset($globalSquawkCountry)) {
530
+					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
531
+				}
448 532
 			}
449 533
     			
450 534
 			$temp_array['query_number_rows'] = $num_rows;
451 535
 			
452 536
 			$spotter_array[] = $temp_array;
453 537
 		}
454
-		if ($num_rows == 0) return array();
538
+		if ($num_rows == 0) {
539
+			return array();
540
+		}
455 541
 		$spotter_array[0]['query_number_rows'] = $num_rows;
456 542
 		return $spotter_array;
457 543
 	}	
@@ -484,7 +570,9 @@  discard block
 block discarded – undo
484 570
 				foreach ($q_array as $q_item){
485 571
 					$q_item = filter_var($q_item,FILTER_SANITIZE_STRING);
486 572
 					$additional_query .= " AND (";
487
-					if (is_int($q_item)) $additional_query .= "(spotter_output.spotter_id like '%".$q_item."%') OR ";
573
+					if (is_int($q_item)) {
574
+						$additional_query .= "(spotter_output.spotter_id like '%".$q_item."%') OR ";
575
+					}
488 576
 					$additional_query .= "(spotter_output.aircraft_icao like '%".$q_item."%') OR ";
489 577
 					$additional_query .= "(spotter_output.aircraft_name like '%".$q_item."%') OR ";
490 578
 					$additional_query .= "(spotter_output.aircraft_manufacturer like '%".$q_item."%') OR ";
@@ -505,7 +593,9 @@  discard block
 block discarded – undo
505 593
 					$additional_query .= "(spotter_output.pilot_name like '%".$q_item."%') OR ";
506 594
 					$additional_query .= "(spotter_output.ident like '%".$q_item."%') OR ";
507 595
 					$translate = $Translation->ident2icao($q_item);
508
-					if ($translate != $q_item) $additional_query .= "(spotter_output.ident like '%".$translate."%') OR ";
596
+					if ($translate != $q_item) {
597
+						$additional_query .= "(spotter_output.ident like '%".$translate."%') OR ";
598
+					}
509 599
 					$additional_query .= "(spotter_output.highlight like '%".$q_item."%')";
510 600
 					$additional_query .= ")";
511 601
 				}
@@ -732,7 +822,9 @@  discard block
 block discarded – undo
732 822
 				date_default_timezone_set($globalTimezone);
733 823
 				$datetime = new DateTime();
734 824
 				$offset = $datetime->format('P');
735
-			} else $offset = '+00:00';
825
+			} else {
826
+				$offset = '+00:00';
827
+			}
736 828
 
737 829
 			if ($date_array[1] != "")
738 830
 			{
@@ -764,8 +856,12 @@  discard block
 block discarded – undo
764 856
 			{
765 857
 				//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
766 858
 				$limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0];
767
-			} else $limit_query = "";
768
-		} else $limit_query = "";
859
+			} else {
860
+				$limit_query = "";
861
+			}
862
+		} else {
863
+			$limit_query = "";
864
+		}
769 865
 
770 866
 
771 867
 		if ($sort != "")
@@ -833,8 +929,12 @@  discard block
 block discarded – undo
833 929
 			{
834 930
 				//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
835 931
 				$limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0];
836
-			} else $limit_query = "";
837
-		} else $limit_query = "";
932
+			} else {
933
+				$limit_query = "";
934
+			}
935
+		} else {
936
+			$limit_query = "";
937
+		}
838 938
 		
839 939
 		if ($sort != "")
840 940
 		{
@@ -1158,7 +1258,9 @@  discard block
 block discarded – undo
1158 1258
 		global $global_query;
1159 1259
 		
1160 1260
 		date_default_timezone_set('UTC');
1161
-		if ($id == '') return array();
1261
+		if ($id == '') {
1262
+			return array();
1263
+		}
1162 1264
 		$additional_query = "spotter_output.spotter_id = :id";
1163 1265
 		$query_values = array(':id' => $id);
1164 1266
 
@@ -1790,7 +1892,9 @@  discard block
 block discarded – undo
1790 1892
 		{
1791 1893
 			$highlight = $row['highlight'];
1792 1894
 		}
1793
-		if (isset($highlight)) return $highlight;
1895
+		if (isset($highlight)) {
1896
+			return $highlight;
1897
+		}
1794 1898
 	}
1795 1899
 
1796 1900
 	
@@ -1818,7 +1922,9 @@  discard block
 block discarded – undo
1818 1922
 		$sth->closeCursor();
1819 1923
 		if (count($row) > 0) {
1820 1924
 			return $row['usage'];
1821
-		} else return '';
1925
+		} else {
1926
+			return '';
1927
+		}
1822 1928
 	}
1823 1929
 
1824 1930
 	/**
@@ -1843,7 +1949,9 @@  discard block
 block discarded – undo
1843 1949
 		$sth->closeCursor();
1844 1950
 		if (count($row) > 0) {
1845 1951
 			return $row['icao'];
1846
-		} else return '';
1952
+		} else {
1953
+			return '';
1954
+		}
1847 1955
 	}
1848 1956
 
1849 1957
 	/**
@@ -1871,7 +1979,9 @@  discard block
 block discarded – undo
1871 1979
 			$airport_longitude = $row['longitude'];
1872 1980
 			$Common = new Common();
1873 1981
 			return $Common->distance($latitude,$longitude,$airport_latitude,$airport_longitude);
1874
-		} else return '';
1982
+		} else {
1983
+			return '';
1984
+		}
1875 1985
 	}
1876 1986
 	
1877 1987
 	/**
@@ -1983,7 +2093,9 @@  discard block
 block discarded – undo
1983 2093
 			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1984 2094
 			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1985 2095
 			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1986
-		} else return array();
2096
+		} else {
2097
+			return array();
2098
+		}
1987 2099
 		if ($globalDBdriver == 'mysql') {
1988 2100
 			$query  = "SELECT airport.* FROM airport WHERE airport.latitude BETWEEN ".$minlat." AND ".$maxlat." AND airport.longitude BETWEEN ".$minlong." AND ".$maxlong." AND airport.type != 'closed'";
1989 2101
 		} else {
@@ -2018,7 +2130,9 @@  discard block
 block discarded – undo
2018 2130
 			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2019 2131
 			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2020 2132
 			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2021
-		} else return array();
2133
+		} else {
2134
+			return array();
2135
+		}
2022 2136
 		//$query  = "SELECT waypoints.* FROM waypoints WHERE waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong;
2023 2137
 		$query  = "SELECT waypoints.* FROM waypoints WHERE (waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong.") OR (waypoints.latitude_end BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_end BETWEEN ".$minlong." AND ".$maxlong.")";
2024 2138
 		//$query  = "SELECT waypoints.* FROM waypoints";
@@ -2053,7 +2167,9 @@  discard block
 block discarded – undo
2053 2167
 	public function getAllAirlineInfo($airline_icao, $fromsource = NULL)
2054 2168
 	{
2055 2169
 		global $globalUseRealAirlines;
2056
-		if (isset($globalUseRealAirlines) && $globalUseRealAirlines) $fromsource = NULL;
2170
+		if (isset($globalUseRealAirlines) && $globalUseRealAirlines) {
2171
+			$fromsource = NULL;
2172
+		}
2057 2173
 		$airline_icao = strtoupper(filter_var($airline_icao,FILTER_SANITIZE_STRING));
2058 2174
 		if ($airline_icao == 'NA') {
2059 2175
 			$airline_array = array();
@@ -2103,7 +2219,9 @@  discard block
 block discarded – undo
2103 2219
 				$sth->execute(array(':fromsource' => $fromsource));
2104 2220
 				$row = $sth->fetch(PDO::FETCH_ASSOC);
2105 2221
 				$sth->closeCursor();
2106
-				if ($row['nb'] == 0) $result = $this->getAllAirlineInfo($airline_icao);
2222
+				if ($row['nb'] == 0) {
2223
+					$result = $this->getAllAirlineInfo($airline_icao);
2224
+				}
2107 2225
 			}
2108 2226
 			return $result;
2109 2227
 		}
@@ -2119,7 +2237,9 @@  discard block
 block discarded – undo
2119 2237
 	public function getAllAirlineInfoByName($airline_name, $fromsource = NULL)
2120 2238
 	{
2121 2239
 		global $globalUseRealAirlines;
2122
-		if (isset($globalUseRealAirlines) && $globalUseRealAirlines) $fromsource = NULL;
2240
+		if (isset($globalUseRealAirlines) && $globalUseRealAirlines) {
2241
+			$fromsource = NULL;
2242
+		}
2123 2243
 		$airline_name = strtolower(filter_var($airline_name,FILTER_SANITIZE_STRING));
2124 2244
 		$query  = "SELECT airlines.name, airlines.iata, airlines.icao, airlines.callsign, airlines.country, airlines.type FROM airlines WHERE lower(airlines.name) = :airline_name AND airlines.active = 'Y' AND airlines.forsource IS NULL LIMIT 1";
2125 2245
 		$sth = $this->db->prepare($query);
@@ -2135,7 +2255,9 @@  discard block
 block discarded – undo
2135 2255
 			$sth->execute(array(':fromsource' => $fromsource));
2136 2256
 			$row = $sth->fetch(PDO::FETCH_ASSOC);
2137 2257
 			$sth->closeCursor();
2138
-			if ($row['nb'] == 0) $result = $this->getAllAirlineInfoByName($airline_name);
2258
+			if ($row['nb'] == 0) {
2259
+				$result = $this->getAllAirlineInfoByName($airline_name);
2260
+			}
2139 2261
 		}
2140 2262
 		return $result;
2141 2263
 	}
@@ -2198,15 +2320,20 @@  discard block
 block discarded – undo
2198 2320
 				'A320-211' => 'A320',
2199 2321
 				'747-8i' => 'B748',
2200 2322
 				'A380' => 'A388');
2201
-		if (isset($all_aircraft[$aircraft_type])) return $all_aircraft[$aircraft_type];
2323
+		if (isset($all_aircraft[$aircraft_type])) {
2324
+			return $all_aircraft[$aircraft_type];
2325
+		}
2202 2326
 
2203 2327
 		$query  = "SELECT aircraft.icao FROM aircraft WHERE aircraft.type LIKE :saircraft_type OR aircraft.type = :aircraft_type OR aircraft.icao = :aircraft_type LIMIT 1";
2204 2328
 		$aircraft_type = strtoupper($aircraft_type);
2205 2329
 		$sth = $this->db->prepare($query);
2206 2330
 		$sth->execute(array(':saircraft_type' => '%'.$aircraft_type.'%',':aircraft_type' => $aircraft_type,));
2207 2331
 		$result = $sth->fetchAll(PDO::FETCH_ASSOC);
2208
-		if (isset($result[0]['icao'])) return $result[0]['icao'];
2209
-		else return '';
2332
+		if (isset($result[0]['icao'])) {
2333
+			return $result[0]['icao'];
2334
+		} else {
2335
+			return '';
2336
+		}
2210 2337
 	}
2211 2338
 	
2212 2339
 	/**
@@ -2229,7 +2356,9 @@  discard block
 block discarded – undo
2229 2356
 		$sth->closeCursor();
2230 2357
 		if (isset($row['icaotypecode'])) {
2231 2358
 			return $row['icaotypecode'];
2232
-		} else return '';
2359
+		} else {
2360
+			return '';
2361
+		}
2233 2362
 	}
2234 2363
 
2235 2364
 	/**
@@ -2252,7 +2381,9 @@  discard block
 block discarded – undo
2252 2381
 		$sth->closeCursor();
2253 2382
 		if (isset($row['icaotypecode'])) {
2254 2383
 			return $row['icaotypecode'];
2255
-		} else return '';
2384
+		} else {
2385
+			return '';
2386
+		}
2256 2387
 	}
2257 2388
 
2258 2389
 	/**
@@ -2274,7 +2405,9 @@  discard block
 block discarded – undo
2274 2405
 		$sth->closeCursor();
2275 2406
 		if (isset($row['operator_correct'])) {
2276 2407
 			return $row['operator_correct'];
2277
-		} else return $operator;
2408
+		} else {
2409
+			return $operator;
2410
+		}
2278 2411
 	}
2279 2412
 
2280 2413
 	/**
@@ -2287,7 +2420,9 @@  discard block
 block discarded – undo
2287 2420
 	public function getRouteInfo($callsign)
2288 2421
 	{
2289 2422
 		$callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
2290
-                if ($callsign == '') return array();
2423
+                if ($callsign == '') {
2424
+                	return array();
2425
+                }
2291 2426
 		$query  = "SELECT routes.Operator_ICAO, routes.FromAirport_ICAO, routes.ToAirport_ICAO, routes.RouteStop, routes.FromAirport_Time, routes.ToAirport_Time FROM routes WHERE CallSign = :callsign LIMIT 1";
2292 2427
 		
2293 2428
 		$sth = $this->db->prepare($query);
@@ -2297,7 +2432,9 @@  discard block
 block discarded – undo
2297 2432
 		$sth->closeCursor();
2298 2433
 		if (count($row) > 0) {
2299 2434
 			return $row;
2300
-		} else return array();
2435
+		} else {
2436
+			return array();
2437
+		}
2301 2438
 	}
2302 2439
 	
2303 2440
 	/**
@@ -2350,7 +2487,9 @@  discard block
 block discarded – undo
2350 2487
 			$result = $sth->fetch(PDO::FETCH_ASSOC);
2351 2488
 			$sth->closeCursor();
2352 2489
 			return $result;
2353
-		} else return array();
2490
+		} else {
2491
+			return array();
2492
+		}
2354 2493
 	}
2355 2494
 	
2356 2495
   
@@ -2509,8 +2648,11 @@  discard block
 block discarded – undo
2509 2648
 		$query .= " ORDER BY spotter_output.source_name ASC";
2510 2649
 
2511 2650
 		$sth = $this->db->prepare($query);
2512
-		if (!empty($query_values)) $sth->execute($query_values);
2513
-		else $sth->execute();
2651
+		if (!empty($query_values)) {
2652
+			$sth->execute($query_values);
2653
+		} else {
2654
+			$sth->execute();
2655
+		}
2514 2656
 
2515 2657
 		$source_array = array();
2516 2658
 		$temp_array = array();
@@ -2543,9 +2685,13 @@  discard block
 block discarded – undo
2543 2685
 								WHERE spotter_output.airline_icao <> '' 
2544 2686
 								ORDER BY spotter_output.airline_name ASC";
2545 2687
 			*/
2546
-			if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $forsource = $globalAirlinesSource;
2547
-			elseif (isset($globalVATSIM) && $globalVATSIM) $forsource = 'vatsim';
2548
-			elseif (isset($globalIVAO) && $globalIVAO) $forsource = 'ivao';
2688
+			if (isset($globalAirlinesSource) && $globalAirlinesSource != '') {
2689
+				$forsource = $globalAirlinesSource;
2690
+			} elseif (isset($globalVATSIM) && $globalVATSIM) {
2691
+				$forsource = 'vatsim';
2692
+			} elseif (isset($globalIVAO) && $globalIVAO) {
2693
+				$forsource = 'ivao';
2694
+			}
2549 2695
 			if ($forsource === NULL) {
2550 2696
 				$query = "SELECT DISTINCT icao AS airline_icao, name AS airline_name, type AS airline_type FROM airlines WHERE forsource IS NULL ORDER BY name ASC";
2551 2697
 				$query_data = array();
@@ -2588,9 +2734,13 @@  discard block
 block discarded – undo
2588 2734
 	{
2589 2735
 		global $globalAirlinesSource,$globalVATSIM, $globalIVAO;
2590 2736
 		$filter_query = $this->getFilter($filters,true,true);
2591
-		if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $forsource = $globalAirlinesSource;
2592
-		elseif (isset($globalVATSIM) && $globalVATSIM) $forsource = 'vatsim';
2593
-		elseif (isset($globalIVAO) && $globalIVAO) $forsource = 'ivao';
2737
+		if (isset($globalAirlinesSource) && $globalAirlinesSource != '') {
2738
+			$forsource = $globalAirlinesSource;
2739
+		} elseif (isset($globalVATSIM) && $globalVATSIM) {
2740
+			$forsource = 'vatsim';
2741
+		} elseif (isset($globalIVAO) && $globalIVAO) {
2742
+			$forsource = 'ivao';
2743
+		}
2594 2744
 		if ($forsource === NULL) {
2595 2745
 			$query = "SELECT DISTINCT alliance FROM airlines WHERE alliance IS NOT NULL AND forsource IS NULL ORDER BY alliance ASC";
2596 2746
 			$query_data = array();
@@ -2865,7 +3015,9 @@  discard block
 block discarded – undo
2865 3015
 			date_default_timezone_set($globalTimezone);
2866 3016
 			$datetime = new DateTime();
2867 3017
 			$offset = $datetime->format('P');
2868
-		} else $offset = '+00:00';
3018
+		} else {
3019
+			$offset = '+00:00';
3020
+		}
2869 3021
 		if ($airport_icao == '') {
2870 3022
 			if ($globalDBdriver == 'mysql') {
2871 3023
 				$query = "SELECT COUNT(departure_airport_icao) AS departure_airport_count, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date FROM `spotter_output`".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 7 DAY) AND departure_airport_icao <> 'NA' AND departure_airport_icao <> '' GROUP BY departure_airport_icao, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d'), departure_airport_name, departure_airport_city, departure_airport_country ORDER BY departure_airport_count DESC";
@@ -2897,7 +3049,9 @@  discard block
 block discarded – undo
2897 3049
 			date_default_timezone_set($globalTimezone);
2898 3050
 			$datetime = new DateTime();
2899 3051
 			$offset = $datetime->format('P');
2900
-		} else $offset = '+00:00';
3052
+		} else {
3053
+			$offset = '+00:00';
3054
+		}
2901 3055
 		if ($airport_icao == '') {
2902 3056
 			if ($globalDBdriver == 'mysql') {
2903 3057
 				$query = "SELECT spotter_output.airline_icao, COUNT(departure_airport_icao) AS departure_airport_count, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date FROM `spotter_output` WHERE spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 7 DAY) AND departure_airport_icao <> 'NA' AND departure_airport_icao <> '' AND spotter_output.airline_icao <> '' GROUP BY spotter_output.airline_icao, departure_airport_icao, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d'), departure_airport_name, departure_airport_city, departure_airport_country ORDER BY departure_airport_count DESC";
@@ -2930,7 +3084,9 @@  discard block
 block discarded – undo
2930 3084
 			date_default_timezone_set($globalTimezone);
2931 3085
 			$datetime = new DateTime();
2932 3086
 			$offset = $datetime->format('P');
2933
-		} else $offset = '+00:00';
3087
+		} else {
3088
+			$offset = '+00:00';
3089
+		}
2934 3090
 		if ($airport_icao == '') {
2935 3091
 			if ($globalDBdriver == 'mysql') {
2936 3092
 				$query = "SELECT COUNT(real_departure_airport_icao) AS departure_airport_count, real_departure_airport_icao AS departure_airport_icao, airport.name AS departure_airport_name, airport.city AS departure_airport_city, airport.country AS departure_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date 
@@ -2969,7 +3125,9 @@  discard block
 block discarded – undo
2969 3125
 			date_default_timezone_set($globalTimezone);
2970 3126
 			$datetime = new DateTime();
2971 3127
 			$offset = $datetime->format('P');
2972
-		} else $offset = '+00:00';
3128
+		} else {
3129
+			$offset = '+00:00';
3130
+		}
2973 3131
 		if ($airport_icao == '') {
2974 3132
 			if ($globalDBdriver == 'mysql') {
2975 3133
 				$query = "SELECT spotter_output.airline_icao, COUNT(real_departure_airport_icao) AS departure_airport_count, real_departure_airport_icao AS departure_airport_icao, airport.name AS departure_airport_name, airport.city AS departure_airport_city, airport.country AS departure_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date 
@@ -3014,7 +3172,9 @@  discard block
 block discarded – undo
3014 3172
 			date_default_timezone_set($globalTimezone);
3015 3173
 			$datetime = new DateTime();
3016 3174
 			$offset = $datetime->format('P');
3017
-		} else $offset = '+00:00';
3175
+		} else {
3176
+			$offset = '+00:00';
3177
+		}
3018 3178
 		if ($airport_icao == '') {
3019 3179
 			if ($globalDBdriver == 'mysql') {
3020 3180
 				$query = "SELECT COUNT(arrival_airport_icao) AS arrival_airport_count, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date FROM `spotter_output`".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 7 DAY) AND arrival_airport_icao <> 'NA' AND arrival_airport_icao <> '' GROUP BY arrival_airport_icao, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d'), arrival_airport_name, arrival_airport_city, arrival_airport_country ORDER BY arrival_airport_count DESC";
@@ -3049,7 +3209,9 @@  discard block
 block discarded – undo
3049 3209
 			date_default_timezone_set($globalTimezone);
3050 3210
 			$datetime = new DateTime();
3051 3211
 			$offset = $datetime->format('P');
3052
-		} else $offset = '+00:00';
3212
+		} else {
3213
+			$offset = '+00:00';
3214
+		}
3053 3215
 		if ($airport_icao == '') {
3054 3216
 			if ($globalDBdriver == 'mysql') {
3055 3217
 				$query = "SELECT COUNT(real_arrival_airport_icao) AS arrival_airport_count, real_arrival_airport_icao AS arrival_airport_icao, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date 
@@ -3091,7 +3253,9 @@  discard block
 block discarded – undo
3091 3253
 			date_default_timezone_set($globalTimezone);
3092 3254
 			$datetime = new DateTime();
3093 3255
 			$offset = $datetime->format('P');
3094
-		} else $offset = '+00:00';
3256
+		} else {
3257
+			$offset = '+00:00';
3258
+		}
3095 3259
 		if ($airport_icao == '') {
3096 3260
 			if ($globalDBdriver == 'mysql') {
3097 3261
 				$query = "SELECT spotter_output.airline_icao, COUNT(arrival_airport_icao) AS arrival_airport_count, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date FROM `spotter_output` WHERE spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 7 DAY) AND arrival_airport_icao <> 'NA' AND arrival_airport_icao <> '' AND spotter_output.airline_icao <> '' GROUP BY spotter_output.airline_icao, arrival_airport_icao, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d'), arrival_airport_name, arrival_airport_city, arrival_airport_country ORDER BY arrival_airport_count DESC";
@@ -3125,7 +3289,9 @@  discard block
 block discarded – undo
3125 3289
 			date_default_timezone_set($globalTimezone);
3126 3290
 			$datetime = new DateTime();
3127 3291
 			$offset = $datetime->format('P');
3128
-		} else $offset = '+00:00';
3292
+		} else {
3293
+			$offset = '+00:00';
3294
+		}
3129 3295
 		if ($airport_icao == '') {
3130 3296
 			if ($globalDBdriver == 'mysql') {
3131 3297
 				$query = "SELECT spotter_output.airline_icao, COUNT(real_arrival_airport_icao) AS arrival_airport_count, real_arrival_airport_icao AS arrival_airport_icao, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date 
@@ -3173,7 +3339,9 @@  discard block
 block discarded – undo
3173 3339
 			date_default_timezone_set($globalTimezone);
3174 3340
 			$datetime = new DateTime();
3175 3341
 			$offset = $datetime->format('P');
3176
-		} else $offset = '+00:00';
3342
+		} else {
3343
+			$offset = '+00:00';
3344
+		}
3177 3345
 
3178 3346
 		if ($globalDBdriver == 'mysql') {
3179 3347
 			$query  = "SELECT DISTINCT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) as date
@@ -3293,7 +3461,9 @@  discard block
 block discarded – undo
3293 3461
 	*/	
3294 3462
 	public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '',$arrival_airport_time = '')
3295 3463
 	{
3296
-		if ($groundspeed == '') $groundspeed = NULL;
3464
+		if ($groundspeed == '') {
3465
+			$groundspeed = NULL;
3466
+		}
3297 3467
 		$query = 'UPDATE spotter_output SET ident = :ident, last_latitude = :last_latitude, last_longitude = :last_longitude, last_altitude = :last_altitude, last_ground = :last_ground, last_seen = :last_seen, real_arrival_airport_icao = :real_arrival_airport_icao, real_arrival_airport_time = :real_arrival_airport_time, last_ground_speed = :last_ground_speed WHERE flightaware_id = :flightaware_id';
3298 3468
                 $query_values = array(':flightaware_id' => $flightaware_id,':real_arrival_airport_icao' => $arrival_airport_icao,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_altitude' => $altitude,':last_ground_speed' => $groundspeed,':last_seen' => $date,':real_arrival_airport_time' => $arrival_airport_time, ':last_ground' => $ground, ':ident' => $ident);
3299 3469
 
@@ -3343,10 +3513,18 @@  discard block
 block discarded – undo
3343 3513
 		$Image = new Image($this->db);
3344 3514
 		$Common = new Common();
3345 3515
 		
3346
-		if (!isset($globalIVAO)) $globalIVAO = FALSE;
3347
-		if (!isset($globalVATSIM)) $globalVATSIM = FALSE;
3348
-		if (!isset($globalphpVMS)) $globalphpVMS = FALSE;
3349
-		if (!isset($globalVAM)) $globalVAM = FALSE;
3516
+		if (!isset($globalIVAO)) {
3517
+			$globalIVAO = FALSE;
3518
+		}
3519
+		if (!isset($globalVATSIM)) {
3520
+			$globalVATSIM = FALSE;
3521
+		}
3522
+		if (!isset($globalphpVMS)) {
3523
+			$globalphpVMS = FALSE;
3524
+		}
3525
+		if (!isset($globalVAM)) {
3526
+			$globalVAM = FALSE;
3527
+		}
3350 3528
 		date_default_timezone_set('UTC');
3351 3529
 		
3352 3530
 		//getting the registration
@@ -3359,23 +3537,33 @@  discard block
 block discarded – undo
3359 3537
 				if ($ModeS != '') {
3360 3538
 					$timeelapsed = microtime(true);
3361 3539
 					$registration = $this->getAircraftRegistrationBymodeS($ModeS);
3362
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3540
+					if ($globalDebugTimeElapsed) {
3541
+						echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3542
+					}
3363 3543
 				} else {
3364 3544
 					$myhex = explode('-',$flightaware_id);
3365 3545
 					if (count($myhex) > 0) {
3366 3546
 						$timeelapsed = microtime(true);
3367 3547
 						$registration = $this->getAircraftRegistrationBymodeS($myhex[0]);
3368
-						if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3548
+						if ($globalDebugTimeElapsed) {
3549
+							echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3550
+						}
3369 3551
 					}
3370 3552
 				}
3371 3553
 			}
3372 3554
 		}
3373 3555
 		$fromsource = NULL;
3374
-		if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource;
3375
-		elseif ($format_source == 'vatsimtxt') $fromsource = 'vatsim';
3376
-		elseif ($format_source == 'whazzup') $fromsource = 'ivao';
3377
-		elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim';
3378
-		elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao';
3556
+		if (isset($globalAirlinesSource) && $globalAirlinesSource != '') {
3557
+			$fromsource = $globalAirlinesSource;
3558
+		} elseif ($format_source == 'vatsimtxt') {
3559
+			$fromsource = 'vatsim';
3560
+		} elseif ($format_source == 'whazzup') {
3561
+			$fromsource = 'ivao';
3562
+		} elseif (isset($globalVATSIM) && $globalVATSIM) {
3563
+			$fromsource = 'vatsim';
3564
+		} elseif (isset($globalIVAO) && $globalIVAO) {
3565
+			$fromsource = 'ivao';
3566
+		}
3379 3567
 		//getting the airline information
3380 3568
 		if ($ident != "")
3381 3569
 		{
@@ -3399,15 +3587,21 @@  discard block
 block discarded – undo
3399 3587
 					if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == ""){
3400 3588
 						$airline_array = $this->getAllAirlineInfo("NA");
3401 3589
 					}
3402
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3590
+					if ($globalDebugTimeElapsed) {
3591
+						echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3592
+					}
3403 3593
 
3404 3594
 				} else {
3405 3595
 					$timeelapsed = microtime(true);
3406 3596
 					$airline_array = $this->getAllAirlineInfo("NA");
3407
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3597
+					if ($globalDebugTimeElapsed) {
3598
+						echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3599
+					}
3408 3600
 				}
3409 3601
 			}
3410
-		} else $airline_array = array();
3602
+		} else {
3603
+			$airline_array = array();
3604
+		}
3411 3605
 		
3412 3606
 		//getting the aircraft information
3413 3607
 		$aircraft_array = array();
@@ -3421,27 +3615,37 @@  discard block
 block discarded – undo
3421 3615
 				{
3422 3616
 					$timeelapsed = microtime(true);
3423 3617
 					$aircraft_array = $this->getAllAircraftInfo("NA");
3424
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3618
+					if ($globalDebugTimeElapsed) {
3619
+						echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3620
+					}
3425 3621
 				} else {
3426 3622
 					$timeelapsed = microtime(true);
3427 3623
 					$aircraft_array = $this->getAllAircraftInfo($aircraft_icao);
3428
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3624
+					if ($globalDebugTimeElapsed) {
3625
+						echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3626
+					}
3429 3627
 				}
3430 3628
 			}
3431 3629
 		} else {
3432 3630
 			if ($ModeS != '') {
3433 3631
 				$timeelapsed = microtime(true);
3434 3632
 				$aircraft_icao = $this->getAllAircraftType($ModeS);
3435
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3633
+				if ($globalDebugTimeElapsed) {
3634
+					echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3635
+				}
3436 3636
 				if ($aircraft_icao == "" || $aircraft_icao == "XXXX")
3437 3637
 				{
3438 3638
 					$timeelapsed = microtime(true);
3439 3639
 					$aircraft_array = $this->getAllAircraftInfo("NA");
3440
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3640
+					if ($globalDebugTimeElapsed) {
3641
+						echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3642
+					}
3441 3643
 				} else {
3442 3644
 					$timeelapsed = microtime(true);
3443 3645
 					$aircraft_array = $this->getAllAircraftInfo($aircraft_icao);
3444
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3646
+					if ($globalDebugTimeElapsed) {
3647
+						echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3648
+					}
3445 3649
 				}
3446 3650
 			}
3447 3651
 		}
@@ -3457,7 +3661,9 @@  discard block
 block discarded – undo
3457 3661
 			} else {
3458 3662
 				$timeelapsed = microtime(true);
3459 3663
 				$departure_airport_array = $this->getAllAirportInfo($departure_airport_icao);
3460
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3664
+				if ($globalDebugTimeElapsed) {
3665
+					echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3666
+				}
3461 3667
 			}
3462 3668
 		}
3463 3669
 		
@@ -3472,7 +3678,9 @@  discard block
 block discarded – undo
3472 3678
 			} else {
3473 3679
 				$timeelapsed = microtime(true);
3474 3680
 				$arrival_airport_array = $this->getAllAirportInfo($arrival_airport_icao);
3475
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3681
+				if ($globalDebugTimeElapsed) {
3682
+					echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3683
+				}
3476 3684
 			}
3477 3685
 		}
3478 3686
 
@@ -3506,7 +3714,9 @@  discard block
 block discarded – undo
3506 3714
 			{
3507 3715
 				return false;
3508 3716
 			}
3509
-		} else $altitude = 0;
3717
+		} else {
3718
+			$altitude = 0;
3719
+		}
3510 3720
 		
3511 3721
 		if ($heading != "")
3512 3722
 		{
@@ -3535,7 +3745,9 @@  discard block
 block discarded – undo
3535 3745
 		{
3536 3746
 			$timeelapsed = microtime(true);
3537 3747
 			$image_array = $Image->getSpotterImage($registration);
3538
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3748
+			if ($globalDebugTimeElapsed) {
3749
+				echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3750
+			}
3539 3751
 			if (!isset($image_array[0]['registration']))
3540 3752
 			{
3541 3753
 				//echo "Add image !!!! \n";
@@ -3543,14 +3755,21 @@  discard block
 block discarded – undo
3543 3755
 			}
3544 3756
 			$timeelapsed = microtime(true);
3545 3757
 			$owner_info = $this->getAircraftOwnerByRegistration($registration);
3546
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3547
-			if ($owner_info['owner'] != '') $aircraft_owner = ucwords(strtolower($owner_info['owner']));
3758
+			if ($globalDebugTimeElapsed) {
3759
+				echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3760
+			}
3761
+			if ($owner_info['owner'] != '') {
3762
+				$aircraft_owner = ucwords(strtolower($owner_info['owner']));
3763
+			}
3548 3764
 		}
3549 3765
     
3550 3766
 		if ($globalIVAO && $aircraft_icao != '')
3551 3767
 		{
3552
-            		if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao'];
3553
-            		else $airline_icao = '';
3768
+            		if (isset($airline_array[0]['icao'])) {
3769
+            			$airline_icao = $airline_array[0]['icao'];
3770
+            		} else {
3771
+            			$airline_icao = '';
3772
+            		}
3554 3773
 			$image_array = $Image->getSpotterImage('',$aircraft_icao,$airline_icao);
3555 3774
 			if (!isset($image_array[0]['registration']))
3556 3775
 			{
@@ -3595,16 +3814,28 @@  discard block
 block discarded – undo
3595 3814
                 {
3596 3815
                         $arrival_airport_array = $this->getAllAirportInfo('NA');
3597 3816
                 }
3598
-                if ($registration == '') $registration = 'NA';
3817
+                if ($registration == '') {
3818
+                	$registration = 'NA';
3819
+                }
3599 3820
                 if ($latitude == '' && $longitude == '') {
3600 3821
             		$latitude = 0;
3601 3822
             		$longitude = 0;
3602 3823
             	}
3603
-                if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL;
3604
-                if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL;
3605
-                if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
3606
-                if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
3607
-                if (!isset($aircraft_owner)) $aircraft_owner = NULL;
3824
+                if ($squawk == '' || $Common->isInteger($squawk) === false) {
3825
+                	$squawk = NULL;
3826
+                }
3827
+                if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) {
3828
+                	$verticalrate = NULL;
3829
+                }
3830
+                if ($heading == '' || $Common->isInteger($heading) === false) {
3831
+                	$heading = 0;
3832
+                }
3833
+                if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) {
3834
+                	$groundspeed = 0;
3835
+                }
3836
+                if (!isset($aircraft_owner)) {
3837
+                	$aircraft_owner = NULL;
3838
+                }
3608 3839
                 $query  = "INSERT INTO spotter_output (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, latitude, longitude, waypoints, altitude, heading, ground_speed, date, departure_airport_time, arrival_airport_time, squawk, route_stop,highlight,ModeS, pilot_id, pilot_name, verticalrate, owner_name, ground, format_source, source_name) 
3609 3840
                 VALUES (:flightaware_id,:ident,:registration,:airline_name,:airline_icao,:airline_country,:airline_type,:aircraft_icao,:aircraft_type,:aircraft_manufacturer,:departure_airport_icao,:departure_airport_name,:departure_airport_city,:departure_airport_country, :arrival_airport_icao, :arrival_airport_name, :arrival_airport_city, :arrival_airport_country, :latitude,:longitude,:waypoints,:altitude,:heading,:groundspeed,:date, :departure_airport_time, :arrival_airport_time, :squawk, :route_stop, :highlight, :ModeS, :pilot_id, :pilot_name, :verticalrate, :owner_name,:ground, :format_source, :source_name)";
3610 3841
 
@@ -3615,9 +3846,13 @@  discard block
 block discarded – undo
3615 3846
 		if ($airline_type == '') {
3616 3847
 			$timeelapsed = microtime(true);
3617 3848
 			$airline_type = $this->getAircraftTypeBymodeS($ModeS);
3618
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3849
+			if ($globalDebugTimeElapsed) {
3850
+				echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3851
+			}
3852
+		}
3853
+		if ($airline_type == null) {
3854
+			$airline_type = '';
3619 3855
 		}
3620
-		if ($airline_type == null) $airline_type = '';
3621 3856
                 $aircraft_type = $aircraft_array[0]['type'];
3622 3857
                 $aircraft_manufacturer = $aircraft_array[0]['manufacturer'];
3623 3858
                 $departure_airport_name = $departure_airport_array[0]['name'];
@@ -3753,7 +3988,9 @@  discard block
 block discarded – undo
3753 3988
 			}
3754 3989
 		}
3755 3990
 		$query .= "GROUP BY spotter_output.airline_name,spotter_output.airline_icao, spotter_output.airline_country ORDER BY airline_count DESC";
3756
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
3991
+		if ($limit) {
3992
+			$query .= " LIMIT 10 OFFSET 0";
3993
+		}
3757 3994
 		
3758 3995
 		$sth = $this->db->prepare($query);
3759 3996
 		$sth->execute();
@@ -3798,7 +4035,9 @@  discard block
 block discarded – undo
3798 4035
 			}
3799 4036
 		}
3800 4037
 		$query .= "GROUP BY spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.format_source ORDER BY pilot_count DESC";
3801
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4038
+		if ($limit) {
4039
+			$query .= " LIMIT 10 OFFSET 0";
4040
+		}
3802 4041
       
3803 4042
 		
3804 4043
 		$sth = $this->db->prepare($query);
@@ -3844,7 +4083,9 @@  discard block
 block discarded – undo
3844 4083
 			}
3845 4084
 		}
3846 4085
 		$query .= "GROUP BY spotter_output.airline_icao, spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.format_source ORDER BY pilot_count DESC";
3847
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4086
+		if ($limit) {
4087
+			$query .= " LIMIT 10 OFFSET 0";
4088
+		}
3848 4089
       
3849 4090
 		
3850 4091
 		$sth = $this->db->prepare($query);
@@ -3892,7 +4133,9 @@  discard block
 block discarded – undo
3892 4133
 			}
3893 4134
 		}
3894 4135
 		$query .= "GROUP BY spotter_output.owner_name ORDER BY owner_count DESC";
3895
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4136
+		if ($limit) {
4137
+			$query .= " LIMIT 10 OFFSET 0";
4138
+		}
3896 4139
       
3897 4140
 		
3898 4141
 		$sth = $this->db->prepare($query);
@@ -3937,7 +4180,9 @@  discard block
 block discarded – undo
3937 4180
 			}
3938 4181
 		}
3939 4182
 		$query .= "GROUP BY spotter_output.airline_icao, spotter_output.owner_name ORDER BY owner_count DESC";
3940
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4183
+		if ($limit) {
4184
+			$query .= " LIMIT 10 OFFSET 0";
4185
+		}
3941 4186
       
3942 4187
 		
3943 4188
 		$sth = $this->db->prepare($query);
@@ -4180,7 +4425,9 @@  discard block
 block discarded – undo
4180 4425
 			date_default_timezone_set($globalTimezone);
4181 4426
 			$datetime = new DateTime($date);
4182 4427
 			$offset = $datetime->format('P');
4183
-		} else $offset = '+00:00';
4428
+		} else {
4429
+			$offset = '+00:00';
4430
+		}
4184 4431
 
4185 4432
 		if ($globalDBdriver == 'mysql') {
4186 4433
 			$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
@@ -4228,7 +4475,9 @@  discard block
 block discarded – undo
4228 4475
 			date_default_timezone_set($globalTimezone);
4229 4476
 			$datetime = new DateTime($date);
4230 4477
 			$offset = $datetime->format('P');
4231
-		} else $offset = '+00:00';
4478
+		} else {
4479
+			$offset = '+00:00';
4480
+		}
4232 4481
 		
4233 4482
 		if ($globalDBdriver == 'mysql') {
4234 4483
 			$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
@@ -4446,7 +4695,9 @@  discard block
 block discarded – undo
4446 4695
 		 			FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND spotter_output.airline_country <> 'NA' 
4447 4696
 					GROUP BY spotter_output.airline_country
4448 4697
 					ORDER BY airline_country_count DESC";
4449
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4698
+		if ($limit) {
4699
+			$query .= " LIMIT 10 OFFSET 0";
4700
+		}
4450 4701
       
4451 4702
 		$sth = $this->db->prepare($query);
4452 4703
 		$sth->execute();
@@ -4474,7 +4725,9 @@  discard block
 block discarded – undo
4474 4725
 		global $globalDBdriver;
4475 4726
 		//$filter_query = $this->getFilter($filters,true,true);
4476 4727
 		$Connection= new Connection($this->db);
4477
-		if (!$Connection->tableExists('countries')) return array();
4728
+		if (!$Connection->tableExists('countries')) {
4729
+			return array();
4730
+		}
4478 4731
 		/*
4479 4732
 		$query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb 
4480 4733
 					FROM countries c, spotter_output s
@@ -4506,7 +4759,9 @@  discard block
 block discarded – undo
4506 4759
 		}
4507 4760
 		$query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb FROM countries c INNER JOIN (SELECT DISTINCT flightaware_id,over_country FROM spotter_live".$filter_query.") l ON c.iso2 = l.over_country ";
4508 4761
 		$query .= "GROUP BY c.name,c.iso3,c.iso2 ORDER BY nb DESC";
4509
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4762
+		if ($limit) {
4763
+			$query .= " LIMIT 10 OFFSET 0";
4764
+		}
4510 4765
       
4511 4766
 		
4512 4767
 		$sth = $this->db->prepare($query);
@@ -4556,7 +4811,9 @@  discard block
 block discarded – undo
4556 4811
 		}
4557 4812
 
4558 4813
 		$query .= " GROUP BY spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer ORDER BY aircraft_icao_count DESC";
4559
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4814
+		if ($limit) {
4815
+			$query .= " LIMIT 10 OFFSET 0";
4816
+		}
4560 4817
  
4561 4818
 		$sth = $this->db->prepare($query);
4562 4819
 		$sth->execute();
@@ -4602,7 +4859,9 @@  discard block
 block discarded – undo
4602 4859
 		}
4603 4860
 
4604 4861
 		$query .= "GROUP BY spotter_output.airline_icao, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer ORDER BY aircraft_icao_count DESC";
4605
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4862
+		if ($limit) {
4863
+			$query .= " LIMIT 10 OFFSET 0";
4864
+		}
4606 4865
  
4607 4866
 		$sth = $this->db->prepare($query);
4608 4867
 		$sth->execute();
@@ -4649,7 +4908,9 @@  discard block
 block discarded – undo
4649 4908
 		}
4650 4909
 
4651 4910
 		$query .= "GROUP BY EXTRACT(month from spotter_output.date), EXTRACT(year from spotter_output.date), spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer ORDER BY aircraft_icao_count DESC";
4652
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4911
+		if ($limit) {
4912
+			$query .= " LIMIT 10 OFFSET 0";
4913
+		}
4653 4914
  
4654 4915
 		$sth = $this->db->prepare($query);
4655 4916
 		$sth->execute();
@@ -4702,7 +4963,9 @@  discard block
 block discarded – undo
4702 4963
 			if($row['registration'] != "")
4703 4964
 			{
4704 4965
 				$image_array = $Image->getSpotterImage($row['registration']);
4705
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
4966
+				if (isset($image_array[0]['image_thumbnail'])) {
4967
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
4968
+				}
4706 4969
 			}
4707 4970
 			$temp_array['registration_count'] = $row['registration_count'];
4708 4971
 
@@ -4777,7 +5040,9 @@  discard block
 block discarded – undo
4777 5040
 			if($row['registration'] != "")
4778 5041
 			{
4779 5042
 				$image_array = $Image->getSpotterImage($row['registration']);
4780
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5043
+				if (isset($image_array[0]['image_thumbnail'])) {
5044
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5045
+				}
4781 5046
 			}
4782 5047
 			$temp_array['registration_count'] = $row['registration_count'];
4783 5048
 
@@ -4884,7 +5149,9 @@  discard block
 block discarded – undo
4884 5149
 			if($row['registration'] != "")
4885 5150
 			{
4886 5151
 				$image_array = $Image->getSpotterImage($row['registration']);
4887
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5152
+				if (isset($image_array[0]['image_thumbnail'])) {
5153
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5154
+				}
4888 5155
 			}
4889 5156
 			$temp_array['registration_count'] = $row['registration_count'];
4890 5157
 			$aircraft_array[] = $temp_array;
@@ -5009,7 +5276,9 @@  discard block
 block discarded – undo
5009 5276
 			date_default_timezone_set($globalTimezone);
5010 5277
 			$datetime = new DateTime($date);
5011 5278
 			$offset = $datetime->format('P');
5012
-		} else $offset = '+00:00';
5279
+		} else {
5280
+			$offset = '+00:00';
5281
+		}
5013 5282
 
5014 5283
 		if ($globalDBdriver == 'mysql') {
5015 5284
 			$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
@@ -5056,7 +5325,9 @@  discard block
 block discarded – undo
5056 5325
 			date_default_timezone_set($globalTimezone);
5057 5326
 			$datetime = new DateTime($date);
5058 5327
 			$offset = $datetime->format('P');
5059
-		} else $offset = '+00:00';
5328
+		} else {
5329
+			$offset = '+00:00';
5330
+		}
5060 5331
 
5061 5332
 		if ($globalDBdriver == 'mysql') {
5062 5333
 			$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name 
@@ -5085,7 +5356,9 @@  discard block
 block discarded – undo
5085 5356
 			if($row['registration'] != "")
5086 5357
 			{
5087 5358
 				$image_array = $Image->getSpotterImage($row['registration']);
5088
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5359
+				if (isset($image_array[0]['image_thumbnail'])) {
5360
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5361
+				}
5089 5362
 			}
5090 5363
 			$temp_array['registration_count'] = $row['registration_count'];
5091 5364
  
@@ -5110,7 +5383,9 @@  discard block
 block discarded – undo
5110 5383
 			date_default_timezone_set($globalTimezone);
5111 5384
 			$datetime = new DateTime($date);
5112 5385
 			$offset = $datetime->format('P');
5113
-		} else $offset = '+00:00';
5386
+		} else {
5387
+			$offset = '+00:00';
5388
+		}
5114 5389
 
5115 5390
 		if ($globalDBdriver == 'mysql') {
5116 5391
 			$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
@@ -5208,8 +5483,11 @@  discard block
 block discarded – undo
5208 5483
 			if($row['registration'] != "")
5209 5484
 			{
5210 5485
 				$image_array = $Image->getSpotterImage($row['registration']);
5211
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5212
-				else $temp_array['image_thumbnail'] = '';
5486
+				if (isset($image_array[0]['image_thumbnail'])) {
5487
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5488
+				} else {
5489
+					$temp_array['image_thumbnail'] = '';
5490
+				}
5213 5491
 			}
5214 5492
 			$temp_array['registration_count'] = $row['registration_count'];
5215 5493
 			$aircraft_array[] = $temp_array;
@@ -5316,7 +5594,9 @@  discard block
 block discarded – undo
5316 5594
 			if($row['registration'] != "")
5317 5595
 			{
5318 5596
 				$image_array = $Image->getSpotterImage($row['registration']);
5319
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5597
+				if (isset($image_array[0]['image_thumbnail'])) {
5598
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5599
+				}
5320 5600
 			}
5321 5601
 			$temp_array['registration_count'] = $row['registration_count'];
5322 5602
           
@@ -5433,7 +5713,9 @@  discard block
 block discarded – undo
5433 5713
 			if($row['registration'] != "")
5434 5714
 			{
5435 5715
 				$image_array = $Image->getSpotterImage($row['registration']);
5436
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5716
+				if (isset($image_array[0]['image_thumbnail'])) {
5717
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5718
+				}
5437 5719
 			}
5438 5720
 			$temp_array['registration_count'] = $row['registration_count'];
5439 5721
           
@@ -5545,7 +5827,9 @@  discard block
 block discarded – undo
5545 5827
 		// if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5546 5828
 		//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5547 5829
                 $query .= " GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC";
5548
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5830
+		if ($limit) {
5831
+			$query .= " LIMIT 10 OFFSET 0";
5832
+		}
5549 5833
 		
5550 5834
 		$sth = $this->db->prepare($query);
5551 5835
 		$sth->execute();
@@ -5564,7 +5848,9 @@  discard block
 block discarded – undo
5564 5848
 			if($row['registration'] != "")
5565 5849
 			{
5566 5850
 				$image_array = $Image->getSpotterImage($row['registration']);
5567
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5851
+				if (isset($image_array[0]['image_thumbnail'])) {
5852
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5853
+				}
5568 5854
 			}
5569 5855
           
5570 5856
 			$aircraft_array[] = $temp_array;
@@ -5605,7 +5891,9 @@  discard block
 block discarded – undo
5605 5891
 		// if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5606 5892
 		//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5607 5893
                 $query .= "GROUP BY spotter_output.airline_icao, spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC";
5608
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5894
+		if ($limit) {
5895
+			$query .= " LIMIT 10 OFFSET 0";
5896
+		}
5609 5897
 		
5610 5898
 		$sth = $this->db->prepare($query);
5611 5899
 		$sth->execute();
@@ -5625,7 +5913,9 @@  discard block
 block discarded – undo
5625 5913
 			if($row['registration'] != "")
5626 5914
 			{
5627 5915
 				$image_array = $Image->getSpotterImage($row['registration']);
5628
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5916
+				if (isset($image_array[0]['image_thumbnail'])) {
5917
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5918
+				}
5629 5919
 			}
5630 5920
           
5631 5921
 			$aircraft_array[] = $temp_array;
@@ -5666,7 +5956,9 @@  discard block
 block discarded – undo
5666 5956
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5667 5957
                 $query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
5668 5958
 				ORDER BY airport_departure_icao_count DESC";
5669
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5959
+		if ($limit) {
5960
+			$query .= " LIMIT 10 OFFSET 0";
5961
+		}
5670 5962
       
5671 5963
 		$sth = $this->db->prepare($query);
5672 5964
 		$sth->execute();
@@ -5718,7 +6010,9 @@  discard block
 block discarded – undo
5718 6010
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5719 6011
                 $query .= "GROUP BY spotter_output.airline_icao, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
5720 6012
 				ORDER BY airport_departure_icao_count DESC";
5721
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
6013
+		if ($limit) {
6014
+			$query .= " LIMIT 10 OFFSET 0";
6015
+		}
5722 6016
       
5723 6017
 		$sth = $this->db->prepare($query);
5724 6018
 		$sth->execute();
@@ -5770,7 +6064,9 @@  discard block
 block discarded – undo
5770 6064
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5771 6065
                 $query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
5772 6066
 				ORDER BY airport_departure_icao_count DESC";
5773
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
6067
+		if ($limit) {
6068
+			$query .= " LIMIT 10 OFFSET 0";
6069
+		}
5774 6070
     		//echo $query;
5775 6071
 		$sth = $this->db->prepare($query);
5776 6072
 		$sth->execute();
@@ -5822,7 +6118,9 @@  discard block
 block discarded – undo
5822 6118
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5823 6119
                 $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
5824 6120
 				ORDER BY airport_departure_icao_count DESC";
5825
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
6121
+		if ($limit) {
6122
+			$query .= " LIMIT 10 OFFSET 0";
6123
+		}
5826 6124
       
5827 6125
 		$sth = $this->db->prepare($query);
5828 6126
 		$sth->execute();
@@ -6217,7 +6515,9 @@  discard block
 block discarded – undo
6217 6515
 			date_default_timezone_set($globalTimezone);
6218 6516
 			$datetime = new DateTime($date);
6219 6517
 			$offset = $datetime->format('P');
6220
-		} else $offset = '+00:00';
6518
+		} else {
6519
+			$offset = '+00:00';
6520
+		}
6221 6521
 
6222 6522
 		if ($globalDBdriver == 'mysql') {
6223 6523
 			$query  = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
@@ -6267,7 +6567,9 @@  discard block
 block discarded – undo
6267 6567
 			date_default_timezone_set($globalTimezone);
6268 6568
 			$datetime = new DateTime($date);
6269 6569
 			$offset = $datetime->format('P');
6270
-		} else $offset = '+00:00';
6570
+		} else {
6571
+			$offset = '+00:00';
6572
+		}
6271 6573
 
6272 6574
 		if ($globalDBdriver == 'mysql') {
6273 6575
 			$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
@@ -6480,7 +6782,9 @@  discard block
 block discarded – undo
6480 6782
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6481 6783
                 $query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
6482 6784
 					ORDER BY airport_arrival_icao_count DESC";
6483
-		if ($limit) $query .= " LIMIT 10";
6785
+		if ($limit) {
6786
+			$query .= " LIMIT 10";
6787
+		}
6484 6788
       
6485 6789
 		
6486 6790
 		$sth = $this->db->prepare($query);
@@ -6500,7 +6804,9 @@  discard block
 block discarded – undo
6500 6804
 			if ($icaoaskey) {
6501 6805
 				$icao = $row['arrival_airport_icao'];
6502 6806
 				$airport_array[$icao] = $temp_array;
6503
-			} else $airport_array[] = $temp_array;
6807
+			} else {
6808
+				$airport_array[] = $temp_array;
6809
+			}
6504 6810
 		}
6505 6811
 
6506 6812
 		return $airport_array;
@@ -6537,7 +6843,9 @@  discard block
 block discarded – undo
6537 6843
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6538 6844
                 $query .= "GROUP BY spotter_output.airline_icao,spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
6539 6845
 					ORDER BY airport_arrival_icao_count DESC";
6540
-		if ($limit) $query .= " LIMIT 10";
6846
+		if ($limit) {
6847
+			$query .= " LIMIT 10";
6848
+		}
6541 6849
       
6542 6850
 		
6543 6851
 		$sth = $this->db->prepare($query);
@@ -6558,7 +6866,9 @@  discard block
 block discarded – undo
6558 6866
 			if ($icaoaskey) {
6559 6867
 				$icao = $row['arrival_airport_icao'];
6560 6868
 				$airport_array[$icao] = $temp_array;
6561
-			} else $airport_array[] = $temp_array;
6869
+			} else {
6870
+				$airport_array[] = $temp_array;
6871
+			}
6562 6872
 		}
6563 6873
 
6564 6874
 		return $airport_array;
@@ -6595,7 +6905,9 @@  discard block
 block discarded – undo
6595 6905
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6596 6906
                 $query .= " GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
6597 6907
 					ORDER BY airport_arrival_icao_count DESC";
6598
-		if ($limit) $query .= " LIMIT 10";
6908
+		if ($limit) {
6909
+			$query .= " LIMIT 10";
6910
+		}
6599 6911
       
6600 6912
 		
6601 6913
 		$sth = $this->db->prepare($query);
@@ -6615,7 +6927,9 @@  discard block
 block discarded – undo
6615 6927
 			if ($icaoaskey) {
6616 6928
 				$icao = $row['arrival_airport_icao'];
6617 6929
 				$airport_array[$icao] = $temp_array;
6618
-			} else $airport_array[] = $temp_array;
6930
+			} else {
6931
+				$airport_array[] = $temp_array;
6932
+			}
6619 6933
 		}
6620 6934
 
6621 6935
 		return $airport_array;
@@ -6652,7 +6966,9 @@  discard block
 block discarded – undo
6652 6966
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6653 6967
                 $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
6654 6968
 					ORDER BY airport_arrival_icao_count DESC";
6655
-		if ($limit) $query .= " LIMIT 10";
6969
+		if ($limit) {
6970
+			$query .= " LIMIT 10";
6971
+		}
6656 6972
       
6657 6973
 		
6658 6974
 		$sth = $this->db->prepare($query);
@@ -6673,7 +6989,9 @@  discard block
 block discarded – undo
6673 6989
 			if ($icaoaskey) {
6674 6990
 				$icao = $row['arrival_airport_icao'];
6675 6991
 				$airport_array[$icao] = $temp_array;
6676
-			} else $airport_array[] = $temp_array;
6992
+			} else {
6993
+				$airport_array[] = $temp_array;
6994
+			}
6677 6995
 		}
6678 6996
 
6679 6997
 		return $airport_array;
@@ -7054,7 +7372,9 @@  discard block
 block discarded – undo
7054 7372
 			date_default_timezone_set($globalTimezone);
7055 7373
 			$datetime = new DateTime($date);
7056 7374
 			$offset = $datetime->format('P');
7057
-		} else $offset = '+00:00';
7375
+		} else {
7376
+			$offset = '+00:00';
7377
+		}
7058 7378
 
7059 7379
 		if ($globalDBdriver == 'mysql') {
7060 7380
 			$query  = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
@@ -7104,7 +7424,9 @@  discard block
 block discarded – undo
7104 7424
 			date_default_timezone_set($globalTimezone);
7105 7425
 			$datetime = new DateTime($date);
7106 7426
 			$offset = $datetime->format('P');
7107
-		} else $offset = '+00:00';
7427
+		} else {
7428
+			$offset = '+00:00';
7429
+		}
7108 7430
 
7109 7431
 		if ($globalDBdriver == 'mysql') {
7110 7432
 			$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
@@ -7327,7 +7649,9 @@  discard block
 block discarded – undo
7327 7649
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> ''";
7328 7650
 		$query .= " GROUP BY spotter_output.arrival_airport_country
7329 7651
 					ORDER BY airport_arrival_country_count DESC";
7330
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
7652
+		if ($limit) {
7653
+			$query .= " LIMIT 10 OFFSET 0";
7654
+		}
7331 7655
       
7332 7656
 		
7333 7657
 		$sth = $this->db->prepare($query);
@@ -7614,7 +7938,9 @@  discard block
 block discarded – undo
7614 7938
 			date_default_timezone_set($globalTimezone);
7615 7939
 			$datetime = new DateTime($date);
7616 7940
 			$offset = $datetime->format('P');
7617
-		} else $offset = '+00:00';
7941
+		} else {
7942
+			$offset = '+00:00';
7943
+		}
7618 7944
 		
7619 7945
 		if ($globalDBdriver == 'mysql') {
7620 7946
 			$query  = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
@@ -7790,15 +8116,23 @@  discard block
 block discarded – undo
7790 8116
 		$query  = "SELECT DISTINCT spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name, spotter_output.airline_icao  
7791 8117
                     FROM spotter_output".$filter_query." spotter_output.ident <> '' ";
7792 8118
 		 if ($olderthanmonths > 0) {
7793
-			if ($globalDBdriver == 'mysql') $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)';
7794
-			else $query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
8119
+			if ($globalDBdriver == 'mysql') {
8120
+				$query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)';
8121
+			} else {
8122
+				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
8123
+			}
7795 8124
 		}
7796 8125
 		if ($sincedate != '') {
7797
-			if ($globalDBdriver == 'mysql') $query .= " AND spotter_output.date > '".$sincedate."'";
7798
-			else $query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
8126
+			if ($globalDBdriver == 'mysql') {
8127
+				$query .= " AND spotter_output.date > '".$sincedate."'";
8128
+			} else {
8129
+				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
8130
+			}
7799 8131
 		}
7800 8132
 		$query .= " GROUP BY spotter_output.ident, spotter_output.airline_name, spotter_output.airline_icao ORDER BY callsign_icao_count DESC";
7801
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
8133
+		if ($limit) {
8134
+			$query .= " LIMIT 10 OFFSET 0";
8135
+		}
7802 8136
       		
7803 8137
 		$sth = $this->db->prepare($query);
7804 8138
 		$sth->execute();
@@ -7832,15 +8166,23 @@  discard block
 block discarded – undo
7832 8166
 		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name  
7833 8167
                     FROM spotter_output".$filter_query." spotter_output.ident <> ''  AND spotter_output.airline_icao <> '' ";
7834 8168
 		 if ($olderthanmonths > 0) {
7835
-			if ($globalDBdriver == 'mysql') $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
7836
-			else $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
8169
+			if ($globalDBdriver == 'mysql') {
8170
+				$query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
8171
+			} else {
8172
+				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
8173
+			}
7837 8174
 		}
7838 8175
 		if ($sincedate != '') {
7839
-			if ($globalDBdriver == 'mysql') $query .= "AND spotter_output.date > '".$sincedate."' ";
7840
-			else $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP) ";
8176
+			if ($globalDBdriver == 'mysql') {
8177
+				$query .= "AND spotter_output.date > '".$sincedate."' ";
8178
+			} else {
8179
+				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP) ";
8180
+			}
7841 8181
 		}
7842 8182
 		$query .= "GROUP BY spotter_output.airline_icao, spotter_output.ident, spotter_output.airline_name, spotter_output.airline_icao ORDER BY callsign_icao_count DESC";
7843
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
8183
+		if ($limit) {
8184
+			$query .= " LIMIT 10 OFFSET 0";
8185
+		}
7844 8186
       		
7845 8187
 		$sth = $this->db->prepare($query);
7846 8188
 		$sth->execute();
@@ -7877,7 +8219,9 @@  discard block
 block discarded – undo
7877 8219
 			date_default_timezone_set($globalTimezone);
7878 8220
 			$datetime = new DateTime();
7879 8221
 			$offset = $datetime->format('P');
7880
-		} else $offset = '+00:00';
8222
+		} else {
8223
+			$offset = '+00:00';
8224
+		}
7881 8225
 
7882 8226
 		if ($globalDBdriver == 'mysql') {
7883 8227
 			$query  = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -7926,7 +8270,9 @@  discard block
 block discarded – undo
7926 8270
 			date_default_timezone_set($globalTimezone);
7927 8271
 			$datetime = new DateTime();
7928 8272
 			$offset = $datetime->format('P');
7929
-		} else $offset = '+00:00';
8273
+		} else {
8274
+			$offset = '+00:00';
8275
+		}
7930 8276
 		$filter_query = $this->getFilter($filters,true,true);
7931 8277
 		if ($globalDBdriver == 'mysql') {
7932 8278
 			$query  = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -7975,7 +8321,9 @@  discard block
 block discarded – undo
7975 8321
 			date_default_timezone_set($globalTimezone);
7976 8322
 			$datetime = new DateTime();
7977 8323
 			$offset = $datetime->format('P');
7978
-		} else $offset = '+00:00';
8324
+		} else {
8325
+			$offset = '+00:00';
8326
+		}
7979 8327
 		$filter_query = $this->getFilter($filters,true,true);
7980 8328
 		if ($globalDBdriver == 'mysql') {
7981 8329
 			$query  = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -8021,7 +8369,9 @@  discard block
 block discarded – undo
8021 8369
 			date_default_timezone_set($globalTimezone);
8022 8370
 			$datetime = new DateTime();
8023 8371
 			$offset = $datetime->format('P');
8024
-		} else $offset = '+00:00';
8372
+		} else {
8373
+			$offset = '+00:00';
8374
+		}
8025 8375
 		$filter_query = $this->getFilter($filters,true,true);
8026 8376
 		if ($globalDBdriver == 'mysql') {
8027 8377
 			$query  = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -8069,7 +8419,9 @@  discard block
 block discarded – undo
8069 8419
 			date_default_timezone_set($globalTimezone);
8070 8420
 			$datetime = new DateTime();
8071 8421
 			$offset = $datetime->format('P');
8072
-		} else $offset = '+00:00';
8422
+		} else {
8423
+			$offset = '+00:00';
8424
+		}
8073 8425
 		
8074 8426
 		if ($globalDBdriver == 'mysql') {
8075 8427
 			$query  = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -8117,7 +8469,9 @@  discard block
 block discarded – undo
8117 8469
 			date_default_timezone_set($globalTimezone);
8118 8470
 			$datetime = new DateTime();
8119 8471
 			$offset = $datetime->format('P');
8120
-		} else $offset = '+00:00';
8472
+		} else {
8473
+			$offset = '+00:00';
8474
+		}
8121 8475
 
8122 8476
 		if ($globalDBdriver == 'mysql') {
8123 8477
 			$query  = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(*) as date_count
@@ -8164,7 +8518,9 @@  discard block
 block discarded – undo
8164 8518
 			date_default_timezone_set($globalTimezone);
8165 8519
 			$datetime = new DateTime();
8166 8520
 			$offset = $datetime->format('P');
8167
-		} else $offset = '+00:00';
8521
+		} else {
8522
+			$offset = '+00:00';
8523
+		}
8168 8524
 
8169 8525
 		if ($globalDBdriver == 'mysql') {
8170 8526
 			$query  = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(*) as date_count
@@ -8212,7 +8568,9 @@  discard block
 block discarded – undo
8212 8568
 			date_default_timezone_set($globalTimezone);
8213 8569
 			$datetime = new DateTime();
8214 8570
 			$offset = $datetime->format('P');
8215
-		} else $offset = '+00:00';
8571
+		} else {
8572
+			$offset = '+00:00';
8573
+		}
8216 8574
 		$filter_query = $this->getFilter($filters,true,true);
8217 8575
 		if ($globalDBdriver == 'mysql') {
8218 8576
 			$query  = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(*) as date_count
@@ -8257,7 +8615,9 @@  discard block
 block discarded – undo
8257 8615
 			date_default_timezone_set($globalTimezone);
8258 8616
 			$datetime = new DateTime();
8259 8617
 			$offset = $datetime->format('P');
8260
-		} else $offset = '+00:00';
8618
+		} else {
8619
+			$offset = '+00:00';
8620
+		}
8261 8621
 		$filter_query = $this->getFilter($filters,true,true);
8262 8622
 
8263 8623
 		if ($globalDBdriver == 'mysql') {
@@ -8304,7 +8664,9 @@  discard block
 block discarded – undo
8304 8664
 			date_default_timezone_set($globalTimezone);
8305 8665
 			$datetime = new DateTime();
8306 8666
 			$offset = $datetime->format('P');
8307
-		} else $offset = '+00:00';
8667
+		} else {
8668
+			$offset = '+00:00';
8669
+		}
8308 8670
 
8309 8671
 		if ($globalDBdriver == 'mysql') {
8310 8672
 			$query  = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct owner_name) as date_count
@@ -8350,7 +8712,9 @@  discard block
 block discarded – undo
8350 8712
 			date_default_timezone_set($globalTimezone);
8351 8713
 			$datetime = new DateTime();
8352 8714
 			$offset = $datetime->format('P');
8353
-		} else $offset = '+00:00';
8715
+		} else {
8716
+			$offset = '+00:00';
8717
+		}
8354 8718
 		$filter_query = $this->getFilter($filters,true,true);
8355 8719
 
8356 8720
 		if ($globalDBdriver == 'mysql') {
@@ -8397,7 +8761,9 @@  discard block
 block discarded – undo
8397 8761
 			date_default_timezone_set($globalTimezone);
8398 8762
 			$datetime = new DateTime();
8399 8763
 			$offset = $datetime->format('P');
8400
-		} else $offset = '+00:00';
8764
+		} else {
8765
+			$offset = '+00:00';
8766
+		}
8401 8767
 
8402 8768
 		if ($globalDBdriver == 'mysql') {
8403 8769
 			$query  = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct pilot_id) as date_count
@@ -8444,7 +8810,9 @@  discard block
 block discarded – undo
8444 8810
 			date_default_timezone_set($globalTimezone);
8445 8811
 			$datetime = new DateTime();
8446 8812
 			$offset = $datetime->format('P');
8447
-		} else $offset = '+00:00';
8813
+		} else {
8814
+			$offset = '+00:00';
8815
+		}
8448 8816
 
8449 8817
 		if ($globalDBdriver == 'mysql') {
8450 8818
 			$query  = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct airline_icao) as date_count
@@ -8489,7 +8857,9 @@  discard block
 block discarded – undo
8489 8857
 			date_default_timezone_set($globalTimezone);
8490 8858
 			$datetime = new DateTime();
8491 8859
 			$offset = $datetime->format('P');
8492
-		} else $offset = '+00:00';
8860
+		} else {
8861
+			$offset = '+00:00';
8862
+		}
8493 8863
 		$filter_query = $this->getFilter($filters,true,true);
8494 8864
 
8495 8865
 		if ($globalDBdriver == 'mysql') {
@@ -8537,7 +8907,9 @@  discard block
 block discarded – undo
8537 8907
 			date_default_timezone_set($globalTimezone);
8538 8908
 			$datetime = new DateTime();
8539 8909
 			$offset = $datetime->format('P');
8540
-		} else $offset = '+00:00';
8910
+		} else {
8911
+			$offset = '+00:00';
8912
+		}
8541 8913
 
8542 8914
 		if ($globalDBdriver == 'mysql') {
8543 8915
 			$query  = "SELECT spotter_output.airline_icao,YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct aircraft_icao) as date_count
@@ -8583,7 +8955,9 @@  discard block
 block discarded – undo
8583 8955
 			date_default_timezone_set($globalTimezone);
8584 8956
 			$datetime = new DateTime();
8585 8957
 			$offset = $datetime->format('P');
8586
-		} else $offset = '+00:00';
8958
+		} else {
8959
+			$offset = '+00:00';
8960
+		}
8587 8961
 		$filter_query = $this->getFilter($filters,true,true);
8588 8962
 
8589 8963
 		if ($globalDBdriver == 'mysql') {
@@ -8631,7 +9005,9 @@  discard block
 block discarded – undo
8631 9005
 			date_default_timezone_set($globalTimezone);
8632 9006
 			$datetime = new DateTime();
8633 9007
 			$offset = $datetime->format('P');
8634
-		} else $offset = '+00:00';
9008
+		} else {
9009
+			$offset = '+00:00';
9010
+		}
8635 9011
 
8636 9012
 		if ($globalDBdriver == 'mysql') {
8637 9013
 			$query  = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(real_arrival_airport_icao) as date_count
@@ -8678,7 +9054,9 @@  discard block
 block discarded – undo
8678 9054
 			date_default_timezone_set($globalTimezone);
8679 9055
 			$datetime = new DateTime();
8680 9056
 			$offset = $datetime->format('P');
8681
-		} else $offset = '+00:00';
9057
+		} else {
9058
+			$offset = '+00:00';
9059
+		}
8682 9060
 		$filter_query = $this->getFilter($filters,true,true);
8683 9061
 		if ($globalDBdriver == 'mysql') {
8684 9062
 			$query  = "SELECT MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name, count(*) as date_count
@@ -8727,7 +9105,9 @@  discard block
 block discarded – undo
8727 9105
 			date_default_timezone_set($globalTimezone);
8728 9106
 			$datetime = new DateTime();
8729 9107
 			$offset = $datetime->format('P');
8730
-		} else $offset = '+00:00';
9108
+		} else {
9109
+			$offset = '+00:00';
9110
+		}
8731 9111
 
8732 9112
 		$orderby_sql = '';
8733 9113
 		if ($orderby == "hour")
@@ -8793,7 +9173,9 @@  discard block
 block discarded – undo
8793 9173
 			date_default_timezone_set($globalTimezone);
8794 9174
 			$datetime = new DateTime();
8795 9175
 			$offset = $datetime->format('P');
8796
-		} else $offset = '+00:00';
9176
+		} else {
9177
+			$offset = '+00:00';
9178
+		}
8797 9179
 
8798 9180
 		$orderby_sql = '';
8799 9181
 		if ($orderby == "hour")
@@ -8860,7 +9242,9 @@  discard block
 block discarded – undo
8860 9242
 			date_default_timezone_set($globalTimezone);
8861 9243
 			$datetime = new DateTime();
8862 9244
 			$offset = $datetime->format('P');
8863
-		} else $offset = '+00:00';
9245
+		} else {
9246
+			$offset = '+00:00';
9247
+		}
8864 9248
 
8865 9249
 		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
8866 9250
 
@@ -8911,7 +9295,9 @@  discard block
 block discarded – undo
8911 9295
 			date_default_timezone_set($globalTimezone);
8912 9296
 			$datetime = new DateTime();
8913 9297
 			$offset = $datetime->format('P');
8914
-		} else $offset = '+00:00';
9298
+		} else {
9299
+			$offset = '+00:00';
9300
+		}
8915 9301
 
8916 9302
 		if ($globalDBdriver == 'mysql') {
8917 9303
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -8958,7 +9344,9 @@  discard block
 block discarded – undo
8958 9344
 			date_default_timezone_set($globalTimezone);
8959 9345
 			$datetime = new DateTime();
8960 9346
 			$offset = $datetime->format('P');
8961
-		} else $offset = '+00:00';
9347
+		} else {
9348
+			$offset = '+00:00';
9349
+		}
8962 9350
 
8963 9351
 		if ($globalDBdriver == 'mysql') {
8964 9352
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -9005,7 +9393,9 @@  discard block
 block discarded – undo
9005 9393
 			date_default_timezone_set($globalTimezone);
9006 9394
 			$datetime = new DateTime();
9007 9395
 			$offset = $datetime->format('P');
9008
-		} else $offset = '+00:00';
9396
+		} else {
9397
+			$offset = '+00:00';
9398
+		}
9009 9399
 
9010 9400
 		if ($globalDBdriver == 'mysql') {
9011 9401
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -9053,7 +9443,9 @@  discard block
 block discarded – undo
9053 9443
 			date_default_timezone_set($globalTimezone);
9054 9444
 			$datetime = new DateTime();
9055 9445
 			$offset = $datetime->format('P');
9056
-		} else $offset = '+00:00';
9446
+		} else {
9447
+			$offset = '+00:00';
9448
+		}
9057 9449
 
9058 9450
 		if ($globalDBdriver == 'mysql') {
9059 9451
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -9101,7 +9493,9 @@  discard block
 block discarded – undo
9101 9493
 			date_default_timezone_set($globalTimezone);
9102 9494
 			$datetime = new DateTime($date);
9103 9495
 			$offset = $datetime->format('P');
9104
-		} else $offset = '+00:00';
9496
+		} else {
9497
+			$offset = '+00:00';
9498
+		}
9105 9499
 
9106 9500
 		if ($globalDBdriver == 'mysql') {
9107 9501
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -9149,7 +9543,9 @@  discard block
 block discarded – undo
9149 9543
 			date_default_timezone_set($globalTimezone);
9150 9544
 			$datetime = new DateTime();
9151 9545
 			$offset = $datetime->format('P');
9152
-		} else $offset = '+00:00';
9546
+		} else {
9547
+			$offset = '+00:00';
9548
+		}
9153 9549
 
9154 9550
 		if ($globalDBdriver == 'mysql') {
9155 9551
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -9199,7 +9595,9 @@  discard block
 block discarded – undo
9199 9595
 			date_default_timezone_set($globalTimezone);
9200 9596
 			$datetime = new DateTime();
9201 9597
 			$offset = $datetime->format('P');
9202
-		} else $offset = '+00:00';
9598
+		} else {
9599
+			$offset = '+00:00';
9600
+		}
9203 9601
 
9204 9602
 		if ($globalDBdriver == 'mysql') {
9205 9603
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -9246,7 +9644,9 @@  discard block
 block discarded – undo
9246 9644
 			date_default_timezone_set($globalTimezone);
9247 9645
 			$datetime = new DateTime();
9248 9646
 			$offset = $datetime->format('P');
9249
-		} else $offset = '+00:00';
9647
+		} else {
9648
+			$offset = '+00:00';
9649
+		}
9250 9650
 
9251 9651
 		if ($globalDBdriver == 'mysql') {
9252 9652
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -9414,7 +9814,9 @@  discard block
 block discarded – undo
9414 9814
 			date_default_timezone_set($globalTimezone);
9415 9815
 			$datetime = new DateTime();
9416 9816
 			$offset = $datetime->format('P');
9417
-		} else $offset = '+00:00';
9817
+		} else {
9818
+			$offset = '+00:00';
9819
+		}
9418 9820
 
9419 9821
 		if ($globalDBdriver == 'mysql') {
9420 9822
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -9600,7 +10002,9 @@  discard block
 block discarded – undo
9600 10002
 	*/
9601 10003
 	public function parseDirection($direction = 0)
9602 10004
 	{
9603
-		if ($direction == '') $direction = 0;
10005
+		if ($direction == '') {
10006
+			$direction = 0;
10007
+		}
9604 10008
 		$direction_array = array();
9605 10009
 		$temp_array = array();
9606 10010
 
@@ -9701,7 +10105,9 @@  discard block
 block discarded – undo
9701 10105
 		if (isset($result->AirlineFlightInfoResult))
9702 10106
 		{
9703 10107
 			$registration = $result->AirlineFlightInfoResult->tailnumber;
9704
-		} else return '';
10108
+		} else {
10109
+			return '';
10110
+		}
9705 10111
 		
9706 10112
 		$registration = $this->convertAircraftRegistration($registration);
9707 10113
 		
@@ -9730,7 +10136,9 @@  discard block
 block discarded – undo
9730 10136
 		if (count($row) > 0) {
9731 10137
 		    //return $row['Registration'];
9732 10138
 		    return $row['registration'];
9733
-		} else return '';
10139
+		} else {
10140
+			return '';
10141
+		}
9734 10142
 	
9735 10143
 	}
9736 10144
 
@@ -9753,9 +10161,14 @@  discard block
 block discarded – undo
9753 10161
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
9754 10162
 		$sth->closeCursor();
9755 10163
 		if (count($row) > 0) {
9756
-		    if ($row['type_flight'] == null) return '';
9757
-		    else return $row['type_flight'];
9758
-		} else return '';
10164
+		    if ($row['type_flight'] == null) {
10165
+		    	return '';
10166
+		    } else {
10167
+		    	return $row['type_flight'];
10168
+		    }
10169
+		} else {
10170
+			return '';
10171
+		}
9759 10172
 	
9760 10173
 	}
9761 10174
 
@@ -9773,7 +10186,9 @@  discard block
 block discarded – undo
9773 10186
 		$longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
9774 10187
 	
9775 10188
 		$Connection = new Connection($this->db);
9776
-		if (!$Connection->tableExists('countries')) return '';
10189
+		if (!$Connection->tableExists('countries')) {
10190
+			return '';
10191
+		}
9777 10192
 	
9778 10193
 		try {
9779 10194
 			/*
@@ -9793,9 +10208,13 @@  discard block
 block discarded – undo
9793 10208
 			$sth->closeCursor();
9794 10209
 			if (count($row) > 0) {
9795 10210
 				return $row;
9796
-			} else return '';
10211
+			} else {
10212
+				return '';
10213
+			}
9797 10214
 		} catch (PDOException $e) {
9798
-			if (isset($globalDebug) && $globalDebug) echo 'Error : '.$e->getMessage()."\n";
10215
+			if (isset($globalDebug) && $globalDebug) {
10216
+				echo 'Error : '.$e->getMessage()."\n";
10217
+			}
9799 10218
 			return '';
9800 10219
 		}
9801 10220
 	
@@ -9813,7 +10232,9 @@  discard block
 block discarded – undo
9813 10232
 		$iso2 = filter_var($iso2,FILTER_SANITIZE_STRING);
9814 10233
 	
9815 10234
 		$Connection = new Connection($this->db);
9816
-		if (!$Connection->tableExists('countries')) return '';
10235
+		if (!$Connection->tableExists('countries')) {
10236
+			return '';
10237
+		}
9817 10238
 	
9818 10239
 		try {
9819 10240
 			$query = "SELECT name,iso2,iso3 FROM countries WHERE iso2 = :iso2 LIMIT 1";
@@ -9825,9 +10246,13 @@  discard block
 block discarded – undo
9825 10246
 			$sth->closeCursor();
9826 10247
 			if (count($row) > 0) {
9827 10248
 				return $row;
9828
-			} else return '';
10249
+			} else {
10250
+				return '';
10251
+			}
9829 10252
 		} catch (PDOException $e) {
9830
-			if (isset($globalDebug) && $globalDebug) echo 'Error : '.$e->getMessage()."\n";
10253
+			if (isset($globalDebug) && $globalDebug) {
10254
+				echo 'Error : '.$e->getMessage()."\n";
10255
+			}
9831 10256
 			return '';
9832 10257
 		}
9833 10258
 	
@@ -10058,7 +10483,9 @@  discard block
 block discarded – undo
10058 10483
 	{
10059 10484
 		global $globalBitlyAccessToken;
10060 10485
 		
10061
-		if ($globalBitlyAccessToken == '') return $url;
10486
+		if ($globalBitlyAccessToken == '') {
10487
+			return $url;
10488
+		}
10062 10489
         
10063 10490
 		$google_url = 'https://api-ssl.bitly.com/v3/shorten?access_token='.$globalBitlyAccessToken.'&longUrl='.$url;
10064 10491
 		
@@ -10207,7 +10634,9 @@  discard block
 block discarded – undo
10207 10634
 		
10208 10635
 
10209 10636
 		// routes
10210
-		if ($globalDebug) print "Routes...\n";
10637
+		if ($globalDebug) {
10638
+			print "Routes...\n";
10639
+		}
10211 10640
 		if ($globalDBdriver == 'mysql') {
10212 10641
 			$query = "SELECT spotter_output.spotter_id, routes.FromAirport_ICAO, routes.ToAirport_ICAO FROM spotter_output, routes WHERE spotter_output.ident = routes.CallSign AND ( spotter_output.departure_airport_icao != routes.FromAirport_ICAO OR spotter_output.arrival_airport_icao != routes.ToAirport_ICAO) AND routes.FromAirport_ICAO != '' AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 DAY)";
10213 10642
 		} else {
@@ -10226,7 +10655,9 @@  discard block
 block discarded – undo
10226 10655
 			}
10227 10656
 		}
10228 10657
 		
10229
-		if ($globalDebug) print "Airlines...\n";
10658
+		if ($globalDebug) {
10659
+			print "Airlines...\n";
10660
+		}
10230 10661
 		//airlines
10231 10662
 		if ($globalDBdriver == 'mysql') {
10232 10663
 			$query  = "SELECT spotter_output.spotter_id, spotter_output.ident FROM spotter_output WHERE (spotter_output.airline_name = '' OR spotter_output.airline_name = 'Not Available') AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 DAY)";
@@ -10240,10 +10671,15 @@  discard block
 block discarded – undo
10240 10671
 			if (is_numeric(substr($row['ident'], -1, 1)))
10241 10672
 			{
10242 10673
 				$fromsource = NULL;
10243
-				if (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') $fromsource = 'vatsim';
10244
-				elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') $fromsource = 'ivao';
10245
-				elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim';
10246
-				elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao';
10674
+				if (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') {
10675
+					$fromsource = 'vatsim';
10676
+				} elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') {
10677
+					$fromsource = 'ivao';
10678
+				} elseif (isset($globalVATSIM) && $globalVATSIM) {
10679
+					$fromsource = 'vatsim';
10680
+				} elseif (isset($globalIVAO) && $globalIVAO) {
10681
+					$fromsource = 'ivao';
10682
+				}
10247 10683
 				$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3),$fromsource);
10248 10684
 				if (isset($airline_array[0]['name'])) {
10249 10685
 					$update_query  = "UPDATE spotter_output SET spotter_output.airline_name = :airline_name, spotter_output.airline_icao = :airline_icao, spotter_output.airline_country = :airline_country, spotter_output.airline_type = :airline_type WHERE spotter_output.spotter_id = :spotter_id";
@@ -10253,13 +10689,17 @@  discard block
 block discarded – undo
10253 10689
 			}
10254 10690
 		}
10255 10691
 
10256
-		if ($globalDebug) print "Remove Duplicate in aircraft_modes...\n";
10692
+		if ($globalDebug) {
10693
+			print "Remove Duplicate in aircraft_modes...\n";
10694
+		}
10257 10695
 		//duplicate modes
10258 10696
 		$query = "DELETE aircraft_modes FROM aircraft_modes LEFT OUTER JOIN (SELECT max(`AircraftID`) as `AircraftID`,`ModeS` FROM `aircraft_modes` group by ModeS) as KeepRows ON aircraft_modes.AircraftID = KeepRows.AircraftID WHERE KeepRows.AircraftID IS NULL";
10259 10697
 		$sth = $this->db->prepare($query);
10260 10698
 		$sth->execute();
10261 10699
 		
10262
-		if ($globalDebug) print "Aircraft...\n";
10700
+		if ($globalDebug) {
10701
+			print "Aircraft...\n";
10702
+		}
10263 10703
 		//aircraft
10264 10704
 		if ($globalDBdriver == 'mysql') {
10265 10705
 			$query  = "SELECT spotter_output.spotter_id, spotter_output.aircraft_icao, spotter_output.registration FROM spotter_output WHERE (spotter_output.aircraft_name = '' OR spotter_output.aircraft_name = 'Not Available') AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY)";
@@ -10302,26 +10742,38 @@  discard block
 block discarded – undo
10302 10742
 				 if (isset($closestAirports[0])) {
10303 10743
 					if ($row['arrival_airport_icao'] == $closestAirports[0]['icao']) {
10304 10744
 						$airport_icao = $closestAirports[0]['icao'];
10305
-						if ($globalDebug) echo "\o/ 1st ---++ Find arrival airport. airport_icao : ".$airport_icao."\n";
10745
+						if ($globalDebug) {
10746
+							echo "\o/ 1st ---++ Find arrival airport. airport_icao : ".$airport_icao."\n";
10747
+						}
10306 10748
 					} elseif (count($closestAirports > 1) && $row['arrival_airport_icao'] != '' && $row['arrival_airport_icao'] != 'NA') {
10307 10749
 						foreach ($closestAirports as $airport) {
10308 10750
 							if ($row['arrival_airport_icao'] == $airport['icao']) {
10309 10751
 								$airport_icao = $airport['icao'];
10310
-								if ($globalDebug) echo "\o/ try --++ Find arrival airport. airport_icao : ".$airport_icao."\n";
10752
+								if ($globalDebug) {
10753
+									echo "\o/ try --++ Find arrival airport. airport_icao : ".$airport_icao."\n";
10754
+								}
10311 10755
 								break;
10312 10756
 							}
10313 10757
 						}
10314 10758
 					} elseif ($row['last_altitude'] == 0 || ($row['last_altitude'] != '' && ($closestAirports[0]['altitude'] <= $row['last_altitude']*100+1000 && $row['last_altitude']*100 < $closestAirports[0]['altitude']+5000))) {
10315 10759
 						$airport_icao = $closestAirports[0]['icao'];
10316
-						if ($globalDebug) echo "\o/ NP --++ Find arrival airport. Airport ICAO : ".$airport_icao." !  Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist." - Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.($row['last_altitude']*100)."\n";
10760
+						if ($globalDebug) {
10761
+							echo "\o/ NP --++ Find arrival airport. Airport ICAO : ".$airport_icao." !  Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist." - Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.($row['last_altitude']*100)."\n";
10762
+						}
10317 10763
 					} else {
10318
-						if ($globalDebug) echo "----- Can't find arrival airport. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist." - Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.($row['last_altitude']*100)."\n";
10764
+						if ($globalDebug) {
10765
+							echo "----- Can't find arrival airport. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist." - Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.($row['last_altitude']*100)."\n";
10766
+						}
10319 10767
 					}
10320 10768
 				} else {
10321
-					if ($globalDebug) echo "----- No Airport near last coord. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist."\n";
10769
+					if ($globalDebug) {
10770
+						echo "----- No Airport near last coord. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist."\n";
10771
+					}
10322 10772
 				}
10323 10773
 				if ($row['real_arrival_airport_icao'] != $airport_icao) {
10324
-					if ($globalDebug) echo "Updating airport to ".$airport_icao."...\n";
10774
+					if ($globalDebug) {
10775
+						echo "Updating airport to ".$airport_icao."...\n";
10776
+					}
10325 10777
 					$update_query="UPDATE spotter_output SET real_arrival_airport_icao = :airport_icao WHERE spotter_id = :spotter_id";
10326 10778
 					$sthu = $this->db->prepare($update_query);
10327 10779
 					$sthu->execute(array(':airport_icao' => $airport_icao,':spotter_id' => $row['spotter_id']));
Please login to merge, or discard this patch.
index.php 3 patches
Indentation   +77 added lines, -77 removed lines patch added patch discarded remove patch
@@ -36,12 +36,12 @@  discard block
 block discarded – undo
36 36
 <div id="showdetails" class="showdetails"></div>
37 37
 <div id="infobox" class="infobox"><h4><?php echo _("Aircrafts detected"); ?></h4><br /><i class="fa fa-spinner fa-pulse fa-fw"></i></div>
38 38
 <?php
39
-    if ((!isset($_COOKIE['MapFormat']) && isset($globalMap3Ddefault) && $globalMap3Ddefault) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d')) {
39
+	if ((!isset($_COOKIE['MapFormat']) && isset($globalMap3Ddefault) && $globalMap3Ddefault) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d')) {
40 40
 
41 41
 ?>
42 42
 <script src="<?php echo $globalURL; ?>/js/map.3d.js.php"></script>
43 43
 <?php
44
-    }
44
+	}
45 45
 ?>
46 46
 <div id="dialog" title="<?php echo _("Session has timed-out"); ?>">
47 47
   <p><?php echo _("In order to save data consumption web page times out after 30 minutes. Close this dialog to continue."); ?></p>
@@ -55,34 +55,34 @@  discard block
 block discarded – undo
55 55
 	<li><a href="#" onclick="getUserLocation(); return false;" title="<?php echo _("Plot your Location"); ?>"><i class="fa fa-map-marker"></i></a></li>
56 56
 	<li><a href="#" onclick="getCompassDirection(); return false;" title="<?php echo _("Compass Mode"); ?>"><i class="fa fa-compass"></i></a></li>
57 57
 <?php
58
-    if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
58
+	if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
59 59
 	if (isset($globalArchive) && $globalArchive == TRUE) {
60 60
 ?>
61 61
 	<li><a href="#archive" role="tab" title="<?php echo _("Archive"); ?>"><i class="fa fa-archive"></i></a></li>
62 62
 <?php
63 63
 	}
64
-    }
64
+	}
65 65
 ?>
66 66
 	<li><a href="#home" role="tab" title="<?php echo _("Layers"); ?>"><i class="fa fa-map"></i></a></li>
67 67
 	<li><a href="#filters" role="tab" title="<?php echo _("Filters"); ?>"><i class="fa fa-filter"></i></a></li>
68 68
 	<li><a href="#settings" role="tab" title="<?php echo _("Settings"); ?>"><i class="fa fa-gears"></i></a></li>
69 69
 <?php
70
-    if (isset($globalMap3D) && $globalMap3D) {
70
+	if (isset($globalMap3D) && $globalMap3D) {
71 71
 	if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) {
72 72
 ?>
73 73
 	<li><a href="#" onclick="show3D(); return false;" role="tab" title="3D"><b>3D</b></a></li>
74 74
 <?php
75
-        } else {
76
-    	    if (isset($globalMapSatellites) && $globalMapSatellites) {
75
+		} else {
76
+			if (isset($globalMapSatellites) && $globalMapSatellites) {
77 77
 ?>
78 78
 	<li><a href="#satellites" role="tab" title="<?php echo _("Satellites"); ?>"><i class="satellite"></i></a></li>
79 79
 <?php
80
-	    }
80
+		}
81 81
 ?>
82 82
 	<li><a href="#" onclick="show2D(); return false;" role="tab" title="2D"><b>2D</b></a></li>
83 83
 <?php
84 84
 	}
85
-    }
85
+	}
86 86
 ?>
87 87
     </ul>
88 88
 
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
 ?>
157 157
         </div>
158 158
 <?php
159
-    if (isset($globalArchive) && $globalArchive == TRUE) {
159
+	if (isset($globalArchive) && $globalArchive == TRUE) {
160 160
 ?>
161 161
         <div class="sidebar-pane" id="archive">
162 162
 	    <h1 class="sidebar-header"><?php echo _("Playback"); ?> <i>Bêta</i><span class="sidebar-close"><i class="fa fa-caret-left"></i></span></h1>
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
 	    </form>
217 217
 	</div>
218 218
 <?php
219
-    }
219
+	}
220 220
 ?>
221 221
         <div class="sidebar-pane" id="settings">
222 222
 	    <h1 class="sidebar-header"><?php echo _("Settings"); ?><span class="sidebar-close"><i class="fa fa-caret-left"></i></span></h1>
@@ -227,56 +227,56 @@  discard block
 block discarded – undo
227 227
 			    <?php
228 228
 				if (!isset($_COOKIE['MapType']) || $_COOKIE['MapType'] == '') $MapType = $globalMapProvider;
229 229
 				else $MapType = $_COOKIE['MapType'];
230
-			    ?>
230
+				?>
231 231
 			    <?php
232 232
 				if (isset($globalBingMapKey) && $globalBingMapKey != '') {
233
-			    ?>
233
+				?>
234 234
 			    <option value="Bing-Aerial"<?php if ($MapType == 'Bing-Aerial') print ' selected'; ?>>Bing-Aerial</option>
235 235
 			    <option value="Bing-Hybrid"<?php if ($MapType == 'Bing-Hybrid') print ' selected'; ?>>Bing-Hybrid</option>
236 236
 			    <option value="Bing-Road"<?php if ($MapType == 'Bing-Road') print ' selected'; ?>>Bing-Road</option>
237 237
 			    <?php
238 238
 				}
239
-			    ?>
239
+				?>
240 240
 			    <?php
241
-			        if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) {
242
-			    ?>
241
+					if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) {
242
+				?>
243 243
 			    <?php
244
-				    if (isset($globalHereappId) && $globalHereappId != '' && isset($globalHereappCode) && $globalHereappCode != '') {
245
-			    ?>
244
+					if (isset($globalHereappId) && $globalHereappId != '' && isset($globalHereappCode) && $globalHereappCode != '') {
245
+				?>
246 246
 			    <option value="Here-Aerial"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Aerial</option>
247 247
 			    <option value="Here-Hybrid"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Hybrid</option>
248 248
 			    <option value="Here-Road"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Road</option>
249 249
 			    <?php
250
-				    }
251
-			    ?>
250
+					}
251
+				?>
252 252
 			    <?php
253
-				    if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '') {
254
-			    ?>
253
+					if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '') {
254
+				?>
255 255
 			    <option value="Google-Roadmap"<?php if ($MapType == 'Google-Roadmap') print ' selected'; ?>>Google Roadmap</option>
256 256
 			    <option value="Google-Satellite"<?php if ($MapType == 'Google-Satellite') print ' selected'; ?>>Google Satellite</option>
257 257
 			    <option value="Google-Hybrid"<?php if ($MapType == 'Google-Hybrid') print ' selected'; ?>>Google Hybrid</option>
258 258
 			    <option value="Google-Terrain"<?php if ($MapType == 'Google-Terrain') print ' selected'; ?>>Google Terrain</option>
259 259
 			    <?php
260
-				    }
261
-			    ?>
260
+					}
261
+				?>
262 262
 			    <?php
263
-				    if (isset($globalMapQuestKey) && $globalMapQuestKey != '') {
264
-			    ?>
263
+					if (isset($globalMapQuestKey) && $globalMapQuestKey != '') {
264
+				?>
265 265
 			    <option value="MapQuest-OSM"<?php if ($MapType == 'MapQuest-OSM') print ' selected'; ?>>MapQuest-OSM</option>
266 266
 			    <option value="MapQuest-Aerial"<?php if ($MapType == 'MapQuest-Aerial') print ' selected'; ?>>MapQuest-Aerial</option>
267 267
 			    <option value="MapQuest-Hybrid"<?php if ($MapType == 'MapQuest-Hybrid') print ' selected'; ?>>MapQuest-Hybrid</option>
268 268
 			    <?php
269
-				    }
270
-			    ?>
269
+					}
270
+				?>
271 271
 			    <option value="Yandex"<?php if ($MapType == 'Yandex') print ' selected'; ?>>Yandex</option>
272 272
 			    <?php
273 273
 				}
274
-			    ?>
274
+				?>
275 275
 			    <?php
276
-				    if (isset($globalMapboxToken) && $globalMapboxToken != '') {
276
+					if (isset($globalMapboxToken) && $globalMapboxToken != '') {
277 277
 					if (!isset($_COOKIE['MapTypeId'])) $MapBoxId = 'default';
278 278
 					else $MapBoxId = $_COOKIE['MapTypeId'];
279
-			    ?>
279
+				?>
280 280
 			    <option value="Mapbox-default"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'default') print ' selected'; ?>>Mapbox default</option>
281 281
 			    <option value="Mapbox-mapbox.streets"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets') print ' selected'; ?>>Mapbox streets</option>
282 282
 			    <option value="Mapbox-mapbox.light"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.light') print ' selected'; ?>>Mapbox light</option>
@@ -290,13 +290,13 @@  discard block
 block discarded – undo
290 290
 			    <option value="Mapbox-mapbox.pirates"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pirates') print ' selected'; ?>>Mapbox pirates</option>
291 291
 			    <option value="Mapbox-mapbox.emerald"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.emerald') print ' selected'; ?>>Mapbox emerald</option>
292 292
 			    <?php
293
-				    }
294
-			    ?>
293
+					}
294
+				?>
295 295
 			    <option value="OpenStreetMap"<?php if ($MapType == 'OpenStreetMap') print ' selected'; ?>>OpenStreetMap</option>
296 296
 			</select>
297 297
 		    </li>
298 298
 <?php
299
-    if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
299
+	if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
300 300
 ?>
301 301
 		    <li><?php echo _("Type of Terrain:"); ?>
302 302
 			<select  class="selectpicker" onchange="terrainType(this);">
@@ -306,10 +306,10 @@  discard block
 block discarded – undo
306 306
 			</select>
307 307
 		    </li>
308 308
 <?php
309
-    }
309
+	}
310 310
 ?>
311 311
 <?php
312
-    if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') {
312
+	if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') {
313 313
 ?>
314 314
 		    
315 315
 		    <li><div class="checkbox"><label><input type="checkbox" name="flightpopup" value="1" onclick="clickFlightPopup(this)" <?php if (isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true') print 'checked'; ?> ><?php echo _("Display flight info as popup"); ?></label></div></li>
@@ -317,59 +317,59 @@  discard block
 block discarded – undo
317 317
 		    <li><div class="checkbox"><label><input type="checkbox" name="flightroute" value="1" onclick="clickFlightRoute(this)" <?php if ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == 'true') || !isset($_COOKIE['MapRoute'])) print 'checked'; ?> ><?php echo _("Display flight route on click"); ?></label></div></li>
318 318
 		    <li><div class="checkbox"><label><input type="checkbox" name="flightestimation" value="1" onclick="clickFlightEstimation(this)" <?php if ((isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'true') || (!isset($_COOKIE['flightestimation']) && !isset($globalMapEstimation)) || (!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation)) print 'checked'; ?> ><?php echo _("Planes animate between updates"); ?></label></div></li>
319 319
 <?php
320
-    }
320
+	}
321 321
 ?>
322 322
 		    <li><div class="checkbox"><label><input type="checkbox" name="displayairports" value="1" onclick="clickDisplayAirports(this)" <?php if (isset($_COOKIE['displayairports']) && $_COOKIE['displayairports'] == 'true') print 'checked'; ?> ><?php echo _("Display airports on map"); ?></label></div></li>
323 323
 <?php
324
-    if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
324
+	if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
325 325
 ?>
326 326
 		    <li><div class="checkbox"><label><input type="checkbox" name="displayminimap" value="1" onclick="clickDisplayMinimap(this)" <?php if (!isset($_COOKIE['displayminimap']) || (isset($_COOKIE['displayminimap']) && $_COOKIE['displayminimap'] == 'true')) print 'checked'; ?> ><?php echo _("Show mini-map"); ?></label></div></li>
327 327
 <?php
328
-    }
329
-    if (time() > mktime(0,0,0,12,1,date("Y")) && time() < mktime(0,0,0,12,31,date("Y"))) {
328
+	}
329
+	if (time() > mktime(0,0,0,12,1,date("Y")) && time() < mktime(0,0,0,12,31,date("Y"))) {
330 330
 ?>
331 331
 		    <li><div class="checkbox"><label><input type="checkbox" name="displaysanta" value="1" onclick="clickSanta(this)"><i class="fa fa-snowflake-o" aria-hidden="true"></i> <?php echo _("Show Santa Claus now"); ?> <i class="fa fa-snowflake-o" aria-hidden="true"></i></label></div></li>
332 332
 <?php
333
-    }
333
+	}
334 334
 ?>
335 335
 
336 336
 		    <?php
337 337
 			if (function_exists('array_column')) {
338
-			    if (array_search(TRUE, array_column($globalSources, 'sourcestats')) !== FALSE) {
339
-		    ?>
338
+				if (array_search(TRUE, array_column($globalSources, 'sourcestats')) !== FALSE) {
339
+			?>
340 340
 		    <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) print 'checked'; ?> ><?php echo _("Display polar on map"); ?></label></div></li>
341 341
 		    <?php
342
-			    }
342
+				}
343 343
 			} elseif (isset($globalSources)) {
344
-			    $dispolar = false;
345
-			    foreach ($globalSources as $testsource) {
346
-			        if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) $dispolar = true;
347
-			    }
348
-			    if ($dispolar) {
349
-		    ?>
344
+				$dispolar = false;
345
+				foreach ($globalSources as $testsource) {
346
+					if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) $dispolar = true;
347
+				}
348
+				if ($dispolar) {
349
+			?>
350 350
 		    <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) print 'checked'; ?> ><?php echo _("Display polar on map"); ?></label></div></li>
351 351
 		    <?php
352
-			    }
353
-		        }
354
-		    ?>
352
+				}
353
+				}
354
+			?>
355 355
 <?php
356
-    if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') {
356
+	if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') {
357 357
 ?>
358 358
 
359 359
 		    <?php
360
-		        if (extension_loaded('gd') && function_exists('gd_info')) {
361
-		    ?>
360
+				if (extension_loaded('gd') && function_exists('gd_info')) {
361
+			?>
362 362
 		    <li><input type="checkbox" name="aircraftcoloraltitude" value="1" onclick="iconColorAltitude(this)" <?php if (isset($_COOKIE['IconColorAltitude']) && $_COOKIE['IconColorAltitude'] == 'true') print 'checked'; ?> ><?php echo _("Aircraft icon color based on altitude"); ?></li>
363 363
 		    <?php 
364 364
 			if (!isset($_COOKIE['IconColorAltitude']) || $_COOKIE['IconColorAltitude'] == 'false') {
365
-		    ?>
365
+			?>
366 366
 		    <li><?php echo _("Aircraft icon color:"); ?>
367 367
 			<input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(aircraftcolor.value);" value="#<?php if (isset($_COOKIE['IconColor'])) print $_COOKIE['IconColor']; elseif (isset($globalAircraftIconColor)) print $globalAircraftIconColor; else print '1a3151'; ?>">
368 368
 		    </li>
369 369
 		    <?php
370
-			    }
371
-		        }
372
-		    ?>
370
+				}
371
+				}
372
+			?>
373 373
 		    <li><?php echo _("Show airport icon at zoom level:"); ?>
374 374
 			<div class="range">
375 375
 			    <input type="range" min="0" max="19" step="1" name="airportzoom" onchange="range.value=value;airportDisplayZoom(airportzoom.value);" value="<?php if (isset($_COOKIE['AirportZoom'])) print $_COOKIE['AirportZoom']; elseif (isset($globalAirportZoom)) print $globalAirportZoom; else print '7'; ?>">
@@ -377,7 +377,7 @@  discard block
 block discarded – undo
377 377
 			</div>
378 378
 		    </li>
379 379
 <?php
380
-    }
380
+	}
381 381
 ?>
382 382
 		    <li><?php echo _("Distance unit:"); ?>
383 383
 			<select class="selectpicker" onchange="unitdistance(this);">
@@ -410,16 +410,16 @@  discard block
 block discarded – undo
410 410
 		    <ul>
411 411
 		    <?php
412 412
 			if (((isset($globalVATSIM) && $globalVATSIM) || isset($globalIVAO) && $globalIVAO || isset($globalphpVMS) && $globalphpVMS) && (!isset($globalMapVAchoose) || $globalMapVAchoose)) {
413
-		    ?>
413
+			?>
414 414
 			<?php if (isset($globalVATSIM) && $globalVATSIM) { ?><li><input type="checkbox" name="vatsim" value="1" onclick="clickVATSIM(this)" <?php if ((isset($_COOKIE['ShowVATSIM']) && $_COOKIE['ShowVATSIM'] == 'true') || !isset($_COOKIE['ShowVATSIM'])) print 'checked'; ?> ><?php echo _("Display VATSIM data"); ?></li><?php } ?>
415 415
 			<?php if (isset($globalIVAO) && $globalIVAO) { ?><li><input type="checkbox" name="ivao" value="1" onclick="clickIVAO(this)" <?php if ((isset($_COOKIE['ShowIVAO']) && $_COOKIE['ShowIVAO'] == 'true') || !isset($_COOKIE['ShowIVAO'])) print 'checked'; ?> ><?php echo _("Display IVAO data"); ?></li><?php } ?>
416 416
 			<?php if (isset($globalphpVMS) && $globalphpVMS) { ?><li><input type="checkbox" name="phpvms" value="1" onclick="clickphpVMS(this)" <?php if ((isset($_COOKIE['ShowVMS']) && $_COOKIE['ShowVMS'] == 'true') || !isset($_COOKIE['ShowVMS'])) print 'checked'; ?> ><?php echo _("Display phpVMS data"); ?></li><?php } ?>
417 417
 		    <?php
418 418
 			}
419
-		    ?>
419
+			?>
420 420
 		    <?php
421 421
 			if (!(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalphpVMS) && $globalphpVMS) && isset($globalSBS1) && $globalSBS1 && isset($globalAPRS) && $globalAPRS && (!isset($globalMapchoose) || $globalMapchoose)) {
422
-		    ?>
422
+			?>
423 423
 			<?php if (isset($globalSBS1) && $globalSBS1) { ?>
424 424
 			    <li><div class="checkbox"><label><input type="checkbox" name="sbs" value="1" onclick="clickSBS1(this)" <?php if ((isset($_COOKIE['ShowSBS1']) && $_COOKIE['ShowSBS1'] == 'true') || !isset($_COOKIE['ShowSBS1'])) print 'checked'; ?> ><?php echo _("Display ADS-B data"); ?></label></div></li>
425 425
 			<?php } ?>
@@ -428,7 +428,7 @@  discard block
 block discarded – undo
428 428
 			<?php } ?>
429 429
 		    <?php
430 430
 			}
431
-		    ?>
431
+			?>
432 432
 		    <li><?php echo _("Display airlines:"); ?>
433 433
 		    <br/>
434 434
 			<select class="selectpicker" multiple onchange="airlines(this);" id="display_airlines">
@@ -448,14 +448,14 @@  discard block
 block discarded – undo
448 448
 						echo '<option value="'.$airline['airline_icao'].'">'.$airline_name.'</option>';
449 449
 					}
450 450
 				}
451
-			    ?>
451
+				?>
452 452
 			</select>
453 453
 		    </li>
454 454
 		    <?php
455 455
 			$Spotter = new Spotter();
456 456
 			$allalliancenames = $Spotter->getAllAllianceNames();
457 457
 			if (!empty($allalliancenames)) {
458
-		    ?>
458
+			?>
459 459
 		    <li><?php echo _("Display alliance:"); ?>
460 460
 		    <br/>
461 461
 			<select class="selectpicker" onchange="alliance(this);" id="display_alliance">
@@ -469,15 +469,15 @@  discard block
 block discarded – undo
469 469
 						echo '<option value="'.$alliance_name.'">'.$alliance_name.'</option>';
470 470
 					}
471 471
 				}
472
-			    ?>
472
+				?>
473 473
 			</select>
474 474
 		    </li>
475 475
 		    <?php
476 476
 			}
477
-		    ?>
477
+			?>
478 478
 		    <?php
479 479
 			if (isset($globalAPRS) && $globalAPRS) {
480
-		    ?>
480
+			?>
481 481
 		    <li><?php echo _("Display APRS sources name:"); ?>
482 482
 			<select class="selectpicker" multiple onchange="sources(this);">
483 483
 			    <?php
@@ -489,15 +489,15 @@  discard block
 block discarded – undo
489 489
 						echo '<option value="'.$source['source_name'].'">'.$source['source_name'].'</option>';
490 490
 					}
491 491
 				}
492
-			    ?>
492
+				?>
493 493
 			</select>
494 494
 		    </li>
495 495
 		    <?php
496 496
 			}
497
-		    ?>
497
+			?>
498 498
 		    <?php
499 499
 			if (!(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalphpVMS) && $globalphpVMS)) {
500
-		    ?>
500
+			?>
501 501
 		    <li><?php echo _("Display airlines of type:"); ?><br/>
502 502
 			<select class="selectpicker" onchange="airlinestype(this);">
503 503
 			    <option value="all"<?php if (!isset($_COOKIE['filter_airlinestype']) || $_COOKIE['filter_airlinestype'] == 'all' || $_COOKIE['filter_airlinestype'] == '') echo ' selected'; ?>><?php echo _("All"); ?></option>
@@ -508,7 +508,7 @@  discard block
 block discarded – undo
508 508
 		    </li>
509 509
 		    <?php
510 510
 			}
511
-		    ?>
511
+			?>
512 512
 		    <li>
513 513
 			<?php echo _("Display flight with ident:"); ?>
514 514
 			<input type="text" name="identfilter" onchange="identfilter();" id="identfilter" value="<?php if (isset($_COOKIE['filter_ident'])) print $_COOKIE['filter_ident']; ?>" />
@@ -521,7 +521,7 @@  discard block
 block discarded – undo
521 521
 	    </form>
522 522
     	</div>
523 523
 <?php
524
-    if (isset($globalMapSatellites) && $globalMapSatellites && isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
524
+	if (isset($globalMapSatellites) && $globalMapSatellites && isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
525 525
 ?>
526 526
         <div class="sidebar-pane" id="satellites">
527 527
 	    <h1 class="sidebar-header"><?php echo _("Satellites"); ?><span class="sidebar-close"><i class="fa fa-caret-left"></i></span></h1>
@@ -561,14 +561,14 @@  discard block
 block discarded – undo
561 561
 						print '<option value="'.$type['tle_type'].'">'.$type_name.'</option>';
562 562
 					}
563 563
 				}
564
-			    ?>
564
+				?>
565 565
 			</select>
566 566
 		    </li>
567 567
 		</ul>
568 568
 	    </form>
569 569
 	</div>
570 570
 <?php
571
-    }
571
+	}
572 572
 ?>
573 573
     </div>
574 574
 </div>
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
4 4
 require_once('require/class.Language.php');
5 5
 require_once('require/class.Satellite.php');
6 6
 
7
-$trackident = filter_input(INPUT_GET,'trackid',FILTER_SANITIZE_STRING);
7
+$trackident = filter_input(INPUT_GET, 'trackid', FILTER_SANITIZE_STRING);
8 8
 if ($trackident != '') {
9 9
 	require_once('require/class.SpotterLive.php');
10 10
 	$SpotterLive = new SpotterLive();
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 		$spotterid = $Spotter->getSpotterIDBasedOnFlightAwareID($trackident);
15 15
 		header('Location: '.$globalURL.'/flightid/'.$spotterid);
16 16
 	} else {
17
-		setcookie('MapTrack',$resulttrackident[0]['flightaware_id']);
17
+		setcookie('MapTrack', $resulttrackident[0]['flightaware_id']);
18 18
 	}
19 19
 } else {
20 20
 	unset($_COOKIE['MapTrack']);
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
 		        <div class="form-group">
168 168
 			    <label>From (UTC):</label>
169 169
 		            <div class='input-group date' id='datetimepicker1'>
170
-            			<input type='text' name="start_date" class="form-control" value="<?php if (isset($_POST['start_date'])) print $_POST['start_date']; elseif (isset($_COOKIE['archive_begin'])) print date("m/d/Y h:i a",$_COOKIE['archive_begin']); ?>" required />
170
+            			<input type='text' name="start_date" class="form-control" value="<?php if (isset($_POST['start_date'])) print $_POST['start_date']; elseif (isset($_COOKIE['archive_begin'])) print date("m/d/Y h:i a", $_COOKIE['archive_begin']); ?>" required />
171 171
 		                <span class="input-group-addon">
172 172
             			    <span class="glyphicon glyphicon-calendar"></span>
173 173
 		                </span>
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
 		        <div class="form-group">
177 177
 			    <label>To (UTC):</label>
178 178
 		            <div class='input-group date' id='datetimepicker2'>
179
-		                <input type='text' name="end_date" class="form-control" value="<?php if (isset($_POST['end_date'])) print $_POST['end_date']; elseif (isset($_COOKIE['archive_end'])) print date("m/d/Y h:i a",$_COOKIE['archive_end']); ?>" />
179
+		                <input type='text' name="end_date" class="form-control" value="<?php if (isset($_POST['end_date'])) print $_POST['end_date']; elseif (isset($_COOKIE['archive_end'])) print date("m/d/Y h:i a", $_COOKIE['archive_end']); ?>" />
180 180
             			<span class="input-group-addon">
181 181
 		                    <span class="glyphicon glyphicon-calendar"></span>
182 182
             			</span>
@@ -301,8 +301,8 @@  discard block
 block discarded – undo
301 301
 		    <li><?php echo _("Type of Terrain:"); ?>
302 302
 			<select  class="selectpicker" onchange="terrainType(this);">
303 303
 			    <option value="stk"<?php if (!isset($_COOKIE['MapTerrain']) || $_COOKIE['MapTerrain'] == 'stk') print ' selected'; ?>>stk terrain</option>
304
-			    <option value="ellipsoid"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'ellipsoid') print ' selected';?>>ellipsoid</option>
305
-			    <option value="vrterrain"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'vrterrain') print ' selected';?>>vr terrain</option>
304
+			    <option value="ellipsoid"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'ellipsoid') print ' selected'; ?>>ellipsoid</option>
305
+			    <option value="vrterrain"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'vrterrain') print ' selected'; ?>>vr terrain</option>
306 306
 			</select>
307 307
 		    </li>
308 308
 <?php
@@ -326,7 +326,7 @@  discard block
 block discarded – undo
326 326
 		    <li><div class="checkbox"><label><input type="checkbox" name="displayminimap" value="1" onclick="clickDisplayMinimap(this)" <?php if (!isset($_COOKIE['displayminimap']) || (isset($_COOKIE['displayminimap']) && $_COOKIE['displayminimap'] == 'true')) print 'checked'; ?> ><?php echo _("Show mini-map"); ?></label></div></li>
327 327
 <?php
328 328
     }
329
-    if (time() > mktime(0,0,0,12,1,date("Y")) && time() < mktime(0,0,0,12,31,date("Y"))) {
329
+    if (time() > mktime(0, 0, 0, 12, 1, date("Y")) && time() < mktime(0, 0, 0, 12, 31, date("Y"))) {
330 330
 ?>
331 331
 		    <li><div class="checkbox"><label><input type="checkbox" name="displaysanta" value="1" onclick="clickSanta(this)"><i class="fa fa-snowflake-o" aria-hidden="true"></i> <?php echo _("Show Santa Claus now"); ?> <i class="fa fa-snowflake-o" aria-hidden="true"></i></label></div></li>
332 332
 <?php
@@ -439,10 +439,10 @@  discard block
 block discarded – undo
439 439
 					$Spotter = new Spotter();
440 440
 					$allairlinenames = $Spotter->getAllAirlineNames();
441 441
 				}
442
-				foreach($allairlinenames as $airline) {
442
+				foreach ($allairlinenames as $airline) {
443 443
 					$airline_name = $airline['airline_name'];
444
-					if (strlen($airline_name) > 30) $airline_name = substr($airline_name,0,30).'...';
445
-					if (isset($_COOKIE['filter_Airlines']) && in_array($airline['airline_icao'],explode(',',$_COOKIE['filter_Airlines']))) {
444
+					if (strlen($airline_name) > 30) $airline_name = substr($airline_name, 0, 30).'...';
445
+					if (isset($_COOKIE['filter_Airlines']) && in_array($airline['airline_icao'], explode(',', $_COOKIE['filter_Airlines']))) {
446 446
 						echo '<option value="'.$airline['airline_icao'].'" selected>'.$airline_name.'</option>';
447 447
 					} else {
448 448
 						echo '<option value="'.$airline['airline_icao'].'">'.$airline_name.'</option>';
@@ -461,7 +461,7 @@  discard block
 block discarded – undo
461 461
 			<select class="selectpicker" onchange="alliance(this);" id="display_alliance">
462 462
 			    <option value="all"<?php if (!isset($_COOKIE['filter_alliance']) || $_COOKIE['filter_alliance'] == 'all' || $_COOKIE['filter_alliance'] == '') echo ' selected'; ?>><?php echo _("All"); ?></option>
463 463
 			    <?php
464
-				foreach($allalliancenames as $alliance) {
464
+				foreach ($allalliancenames as $alliance) {
465 465
 					$alliance_name = $alliance['alliance'];
466 466
 					if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] == $alliance_name) {
467 467
 						echo '<option value="'.$alliance_name.'" selected>'.$alliance_name.'</option>';
@@ -482,8 +482,8 @@  discard block
 block discarded – undo
482 482
 			<select class="selectpicker" multiple onchange="sources(this);">
483 483
 			    <?php
484 484
 				$Spotter = new Spotter();
485
-				foreach($Spotter->getAllSourceName('aprs') as $source) {
486
-					if (isset($_COOKIE['filter_Sources']) && in_array($source['source_name'],explode(',',$_COOKIE['filter_Sources']))) {
485
+				foreach ($Spotter->getAllSourceName('aprs') as $source) {
486
+					if (isset($_COOKIE['filter_Sources']) && in_array($source['source_name'], explode(',', $_COOKIE['filter_Sources']))) {
487 487
 						echo '<option value="'.$source['source_name'].'" selected>'.$source['source_name'].'</option>';
488 488
 					} else {
489 489
 						echo '<option value="'.$source['source_name'].'">'.$source['source_name'].'</option>';
@@ -555,7 +555,7 @@  discard block
 block discarded – undo
555 555
 					else if ($type_name == 'radar') $type_name = 'Radar Calibration';
556 556
 					else if ($type_name == 'tle-new') $type_name = 'Last 30 days launches';
557 557
 					
558
-					if (isset($_COOKIE['sattypes']) && in_array($type['tle_type'],explode(',',$_COOKIE['sattypes']))) {
558
+					if (isset($_COOKIE['sattypes']) && in_array($type['tle_type'], explode(',', $_COOKIE['sattypes']))) {
559 559
 						print '<option value="'.$type['tle_type'].'" selected>'.$type_name.'</option>';
560 560
 					} else {
561 561
 						print '<option value="'.$type['tle_type'].'">'.$type_name.'</option>';
Please login to merge, or discard this patch.
Braces   +361 added lines, -96 removed lines patch added patch discarded remove patch
@@ -135,11 +135,26 @@  discard block
 block discarded – undo
135 135
 				<li><div class="checkbox"><label><input type="checkbox" name="notamcb" value="1" onclick="showNotam();" /><?php echo _("Display NOTAM"); ?></label></div></li>
136 136
 				<li><?php echo _("NOTAM scope:"); ?>
137 137
 					<select class="selectpicker" onchange="notamscope(this);">
138
-						<option<?php if (!isset($_COOKIE['notamscope']) || $_COOKIE['notamscope'] == 'All') print ' selected'; ?>>All</option>
139
-						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport/Enroute warning') print ' selected'; ?>>Airport/Enroute warning</option>
140
-						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport warning') print ' selected'; ?>>Airport warning</option>
141
-						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Navigation warning') print ' selected'; ?>>Navigation warning</option>
142
-						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Enroute warning') print ' selected'; ?>>Enroute warning</option>
138
+						<option<?php if (!isset($_COOKIE['notamscope']) || $_COOKIE['notamscope'] == 'All') {
139
+	print ' selected';
140
+}
141
+?>>All</option>
142
+						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport/Enroute warning') {
143
+	print ' selected';
144
+}
145
+?>>Airport/Enroute warning</option>
146
+						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport warning') {
147
+	print ' selected';
148
+}
149
+?>>Airport warning</option>
150
+						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Navigation warning') {
151
+	print ' selected';
152
+}
153
+?>>Navigation warning</option>
154
+						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Enroute warning') {
155
+	print ' selected';
156
+}
157
+?>>Enroute warning</option>
143 158
 					</select
144 159
 				</li>
145 160
 			</ul>
@@ -167,7 +182,12 @@  discard block
 block discarded – undo
167 182
 		        <div class="form-group">
168 183
 			    <label>From (UTC):</label>
169 184
 		            <div class='input-group date' id='datetimepicker1'>
170
-            			<input type='text' name="start_date" class="form-control" value="<?php if (isset($_POST['start_date'])) print $_POST['start_date']; elseif (isset($_COOKIE['archive_begin'])) print date("m/d/Y h:i a",$_COOKIE['archive_begin']); ?>" required />
185
+            			<input type='text' name="start_date" class="form-control" value="<?php if (isset($_POST['start_date'])) {
186
+	print $_POST['start_date'];
187
+} elseif (isset($_COOKIE['archive_begin'])) {
188
+	print date("m/d/Y h:i a",$_COOKIE['archive_begin']);
189
+}
190
+?>" required />
171 191
 		                <span class="input-group-addon">
172 192
             			    <span class="glyphicon glyphicon-calendar"></span>
173 193
 		                </span>
@@ -176,7 +196,12 @@  discard block
 block discarded – undo
176 196
 		        <div class="form-group">
177 197
 			    <label>To (UTC):</label>
178 198
 		            <div class='input-group date' id='datetimepicker2'>
179
-		                <input type='text' name="end_date" class="form-control" value="<?php if (isset($_POST['end_date'])) print $_POST['end_date']; elseif (isset($_COOKIE['archive_end'])) print date("m/d/Y h:i a",$_COOKIE['archive_end']); ?>" />
199
+		                <input type='text' name="end_date" class="form-control" value="<?php if (isset($_POST['end_date'])) {
200
+	print $_POST['end_date'];
201
+} elseif (isset($_COOKIE['archive_end'])) {
202
+	print date("m/d/Y h:i a",$_COOKIE['archive_end']);
203
+}
204
+?>" />
180 205
             			<span class="input-group-addon">
181 206
 		                    <span class="glyphicon glyphicon-calendar"></span>
182 207
             			</span>
@@ -202,8 +227,20 @@  discard block
 block discarded – undo
202 227
 
203 228
 		    <li><?php echo _("Playback speed:"); ?>
204 229
 			<div class="range">
205
-			    <input type="range" min="0" max="50" step="1" name="archivespeed" onChange="archivespeedrange.value=value;" value="<?php  if (isset($_POST['archivespeed'])) print $_POST['archivespeed']; elseif (isset($_COOKIE['archive_speed'])) print $_COOKIE['archive_speed']; else print '1'; ?>">
206
-			    <output id="archivespeedrange"><?php  if (isset($_COOKIE['archive_speed'])) print $_COOKIE['archive_speed']; else print '1'; ?></output>
230
+			    <input type="range" min="0" max="50" step="1" name="archivespeed" onChange="archivespeedrange.value=value;" value="<?php  if (isset($_POST['archivespeed'])) {
231
+	print $_POST['archivespeed'];
232
+} elseif (isset($_COOKIE['archive_speed'])) {
233
+	print $_COOKIE['archive_speed'];
234
+} else {
235
+	print '1';
236
+}
237
+?>">
238
+			    <output id="archivespeedrange"><?php  if (isset($_COOKIE['archive_speed'])) {
239
+	print $_COOKIE['archive_speed'];
240
+} else {
241
+	print '1';
242
+}
243
+?></output>
207 244
 			</div>
208 245
 		    </li>
209 246
 		    <li><input type="submit" name="archive" value="Show archive" class="btn btn-primary" /></li>
@@ -225,15 +262,27 @@  discard block
 block discarded – undo
225 262
 		    <li><?php echo _("Type of Map:"); ?>
226 263
 			<select  class="selectpicker" onchange="mapType(this);">
227 264
 			    <?php
228
-				if (!isset($_COOKIE['MapType']) || $_COOKIE['MapType'] == '') $MapType = $globalMapProvider;
229
-				else $MapType = $_COOKIE['MapType'];
265
+				if (!isset($_COOKIE['MapType']) || $_COOKIE['MapType'] == '') {
266
+					$MapType = $globalMapProvider;
267
+				} else {
268
+					$MapType = $_COOKIE['MapType'];
269
+				}
230 270
 			    ?>
231 271
 			    <?php
232 272
 				if (isset($globalBingMapKey) && $globalBingMapKey != '') {
233 273
 			    ?>
234
-			    <option value="Bing-Aerial"<?php if ($MapType == 'Bing-Aerial') print ' selected'; ?>>Bing-Aerial</option>
235
-			    <option value="Bing-Hybrid"<?php if ($MapType == 'Bing-Hybrid') print ' selected'; ?>>Bing-Hybrid</option>
236
-			    <option value="Bing-Road"<?php if ($MapType == 'Bing-Road') print ' selected'; ?>>Bing-Road</option>
274
+			    <option value="Bing-Aerial"<?php if ($MapType == 'Bing-Aerial') {
275
+	print ' selected';
276
+}
277
+?>>Bing-Aerial</option>
278
+			    <option value="Bing-Hybrid"<?php if ($MapType == 'Bing-Hybrid') {
279
+	print ' selected';
280
+}
281
+?>>Bing-Hybrid</option>
282
+			    <option value="Bing-Road"<?php if ($MapType == 'Bing-Road') {
283
+	print ' selected';
284
+}
285
+?>>Bing-Road</option>
237 286
 			    <?php
238 287
 				}
239 288
 			    ?>
@@ -243,56 +292,131 @@  discard block
 block discarded – undo
243 292
 			    <?php
244 293
 				    if (isset($globalHereappId) && $globalHereappId != '' && isset($globalHereappCode) && $globalHereappCode != '') {
245 294
 			    ?>
246
-			    <option value="Here-Aerial"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Aerial</option>
247
-			    <option value="Here-Hybrid"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Hybrid</option>
248
-			    <option value="Here-Road"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Road</option>
295
+			    <option value="Here-Aerial"<?php if ($MapType == 'Here') {
296
+	print ' selected';
297
+}
298
+?>>Here-Aerial</option>
299
+			    <option value="Here-Hybrid"<?php if ($MapType == 'Here') {
300
+	print ' selected';
301
+}
302
+?>>Here-Hybrid</option>
303
+			    <option value="Here-Road"<?php if ($MapType == 'Here') {
304
+	print ' selected';
305
+}
306
+?>>Here-Road</option>
249 307
 			    <?php
250 308
 				    }
251 309
 			    ?>
252 310
 			    <?php
253 311
 				    if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '') {
254 312
 			    ?>
255
-			    <option value="Google-Roadmap"<?php if ($MapType == 'Google-Roadmap') print ' selected'; ?>>Google Roadmap</option>
256
-			    <option value="Google-Satellite"<?php if ($MapType == 'Google-Satellite') print ' selected'; ?>>Google Satellite</option>
257
-			    <option value="Google-Hybrid"<?php if ($MapType == 'Google-Hybrid') print ' selected'; ?>>Google Hybrid</option>
258
-			    <option value="Google-Terrain"<?php if ($MapType == 'Google-Terrain') print ' selected'; ?>>Google Terrain</option>
313
+			    <option value="Google-Roadmap"<?php if ($MapType == 'Google-Roadmap') {
314
+	print ' selected';
315
+}
316
+?>>Google Roadmap</option>
317
+			    <option value="Google-Satellite"<?php if ($MapType == 'Google-Satellite') {
318
+	print ' selected';
319
+}
320
+?>>Google Satellite</option>
321
+			    <option value="Google-Hybrid"<?php if ($MapType == 'Google-Hybrid') {
322
+	print ' selected';
323
+}
324
+?>>Google Hybrid</option>
325
+			    <option value="Google-Terrain"<?php if ($MapType == 'Google-Terrain') {
326
+	print ' selected';
327
+}
328
+?>>Google Terrain</option>
259 329
 			    <?php
260 330
 				    }
261 331
 			    ?>
262 332
 			    <?php
263 333
 				    if (isset($globalMapQuestKey) && $globalMapQuestKey != '') {
264 334
 			    ?>
265
-			    <option value="MapQuest-OSM"<?php if ($MapType == 'MapQuest-OSM') print ' selected'; ?>>MapQuest-OSM</option>
266
-			    <option value="MapQuest-Aerial"<?php if ($MapType == 'MapQuest-Aerial') print ' selected'; ?>>MapQuest-Aerial</option>
267
-			    <option value="MapQuest-Hybrid"<?php if ($MapType == 'MapQuest-Hybrid') print ' selected'; ?>>MapQuest-Hybrid</option>
335
+			    <option value="MapQuest-OSM"<?php if ($MapType == 'MapQuest-OSM') {
336
+	print ' selected';
337
+}
338
+?>>MapQuest-OSM</option>
339
+			    <option value="MapQuest-Aerial"<?php if ($MapType == 'MapQuest-Aerial') {
340
+	print ' selected';
341
+}
342
+?>>MapQuest-Aerial</option>
343
+			    <option value="MapQuest-Hybrid"<?php if ($MapType == 'MapQuest-Hybrid') {
344
+	print ' selected';
345
+}
346
+?>>MapQuest-Hybrid</option>
268 347
 			    <?php
269 348
 				    }
270 349
 			    ?>
271
-			    <option value="Yandex"<?php if ($MapType == 'Yandex') print ' selected'; ?>>Yandex</option>
350
+			    <option value="Yandex"<?php if ($MapType == 'Yandex') {
351
+	print ' selected';
352
+}
353
+?>>Yandex</option>
272 354
 			    <?php
273 355
 				}
274 356
 			    ?>
275 357
 			    <?php
276 358
 				    if (isset($globalMapboxToken) && $globalMapboxToken != '') {
277
-					if (!isset($_COOKIE['MapTypeId'])) $MapBoxId = 'default';
278
-					else $MapBoxId = $_COOKIE['MapTypeId'];
359
+					if (!isset($_COOKIE['MapTypeId'])) {
360
+						$MapBoxId = 'default';
361
+					} else {
362
+						$MapBoxId = $_COOKIE['MapTypeId'];
363
+					}
279 364
 			    ?>
280
-			    <option value="Mapbox-default"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'default') print ' selected'; ?>>Mapbox default</option>
281
-			    <option value="Mapbox-mapbox.streets"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets') print ' selected'; ?>>Mapbox streets</option>
282
-			    <option value="Mapbox-mapbox.light"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.light') print ' selected'; ?>>Mapbox light</option>
283
-			    <option value="Mapbox-mapbox.dark"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.dark') print ' selected'; ?>>Mapbox dark</option>
284
-			    <option value="Mapbox-mapbox.satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.satellite') print ' selected'; ?>>Mapbox satellite</option>
285
-			    <option value="Mapbox-mapbox.streets-satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-satellite') print ' selected'; ?>>Mapbox streets-satellite</option>
286
-			    <option value="Mapbox-mapbox.streets-basic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-basic') print ' selected'; ?>>Mapbox streets-basic</option>
287
-			    <option value="Mapbox-mapbox.comic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.comic') print ' selected'; ?>>Mapbox comic</option>
288
-			    <option value="Mapbox-mapbox.outdoors"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.outdoors') print ' selected'; ?>>Mapbox outdoors</option>
289
-			    <option value="Mapbox-mapbox.pencil"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pencil') print ' selected'; ?>>Mapbox pencil</option>
290
-			    <option value="Mapbox-mapbox.pirates"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pirates') print ' selected'; ?>>Mapbox pirates</option>
291
-			    <option value="Mapbox-mapbox.emerald"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.emerald') print ' selected'; ?>>Mapbox emerald</option>
365
+			    <option value="Mapbox-default"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'default') {
366
+	print ' selected';
367
+}
368
+?>>Mapbox default</option>
369
+			    <option value="Mapbox-mapbox.streets"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets') {
370
+	print ' selected';
371
+}
372
+?>>Mapbox streets</option>
373
+			    <option value="Mapbox-mapbox.light"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.light') {
374
+	print ' selected';
375
+}
376
+?>>Mapbox light</option>
377
+			    <option value="Mapbox-mapbox.dark"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.dark') {
378
+	print ' selected';
379
+}
380
+?>>Mapbox dark</option>
381
+			    <option value="Mapbox-mapbox.satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.satellite') {
382
+	print ' selected';
383
+}
384
+?>>Mapbox satellite</option>
385
+			    <option value="Mapbox-mapbox.streets-satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-satellite') {
386
+	print ' selected';
387
+}
388
+?>>Mapbox streets-satellite</option>
389
+			    <option value="Mapbox-mapbox.streets-basic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-basic') {
390
+	print ' selected';
391
+}
392
+?>>Mapbox streets-basic</option>
393
+			    <option value="Mapbox-mapbox.comic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.comic') {
394
+	print ' selected';
395
+}
396
+?>>Mapbox comic</option>
397
+			    <option value="Mapbox-mapbox.outdoors"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.outdoors') {
398
+	print ' selected';
399
+}
400
+?>>Mapbox outdoors</option>
401
+			    <option value="Mapbox-mapbox.pencil"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pencil') {
402
+	print ' selected';
403
+}
404
+?>>Mapbox pencil</option>
405
+			    <option value="Mapbox-mapbox.pirates"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pirates') {
406
+	print ' selected';
407
+}
408
+?>>Mapbox pirates</option>
409
+			    <option value="Mapbox-mapbox.emerald"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.emerald') {
410
+	print ' selected';
411
+}
412
+?>>Mapbox emerald</option>
292 413
 			    <?php
293 414
 				    }
294 415
 			    ?>
295
-			    <option value="OpenStreetMap"<?php if ($MapType == 'OpenStreetMap') print ' selected'; ?>>OpenStreetMap</option>
416
+			    <option value="OpenStreetMap"<?php if ($MapType == 'OpenStreetMap') {
417
+	print ' selected';
418
+}
419
+?>>OpenStreetMap</option>
296 420
 			</select>
297 421
 		    </li>
298 422
 <?php
@@ -300,9 +424,18 @@  discard block
 block discarded – undo
300 424
 ?>
301 425
 		    <li><?php echo _("Type of Terrain:"); ?>
302 426
 			<select  class="selectpicker" onchange="terrainType(this);">
303
-			    <option value="stk"<?php if (!isset($_COOKIE['MapTerrain']) || $_COOKIE['MapTerrain'] == 'stk') print ' selected'; ?>>stk terrain</option>
304
-			    <option value="ellipsoid"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'ellipsoid') print ' selected';?>>ellipsoid</option>
305
-			    <option value="vrterrain"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'vrterrain') print ' selected';?>>vr terrain</option>
427
+			    <option value="stk"<?php if (!isset($_COOKIE['MapTerrain']) || $_COOKIE['MapTerrain'] == 'stk') {
428
+	print ' selected';
429
+}
430
+?>>stk terrain</option>
431
+			    <option value="ellipsoid"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'ellipsoid') {
432
+	print ' selected';
433
+}
434
+?>>ellipsoid</option>
435
+			    <option value="vrterrain"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'vrterrain') {
436
+	print ' selected';
437
+}
438
+?>>vr terrain</option>
306 439
 			</select>
307 440
 		    </li>
308 441
 <?php
@@ -312,18 +445,36 @@  discard block
 block discarded – undo
312 445
     if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') {
313 446
 ?>
314 447
 		    
315
-		    <li><div class="checkbox"><label><input type="checkbox" name="flightpopup" value="1" onclick="clickFlightPopup(this)" <?php if (isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true') print 'checked'; ?> ><?php echo _("Display flight info as popup"); ?></label></div></li>
316
-		    <li><div class="checkbox"><label><input type="checkbox" name="flightpath" value="1" onclick="clickFlightPath(this)" <?php if ((isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true') || !isset($_COOKIE['flightpath'])) print 'checked'; ?> ><?php echo _("Display flight path"); ?></label></div></li>
317
-		    <li><div class="checkbox"><label><input type="checkbox" name="flightroute" value="1" onclick="clickFlightRoute(this)" <?php if ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == 'true') || !isset($_COOKIE['MapRoute'])) print 'checked'; ?> ><?php echo _("Display flight route on click"); ?></label></div></li>
318
-		    <li><div class="checkbox"><label><input type="checkbox" name="flightestimation" value="1" onclick="clickFlightEstimation(this)" <?php if ((isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'true') || (!isset($_COOKIE['flightestimation']) && !isset($globalMapEstimation)) || (!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation)) print 'checked'; ?> ><?php echo _("Planes animate between updates"); ?></label></div></li>
448
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightpopup" value="1" onclick="clickFlightPopup(this)" <?php if (isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true') {
449
+	print 'checked';
450
+}
451
+?> ><?php echo _("Display flight info as popup"); ?></label></div></li>
452
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightpath" value="1" onclick="clickFlightPath(this)" <?php if ((isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true') || !isset($_COOKIE['flightpath'])) {
453
+	print 'checked';
454
+}
455
+?> ><?php echo _("Display flight path"); ?></label></div></li>
456
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightroute" value="1" onclick="clickFlightRoute(this)" <?php if ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == 'true') || !isset($_COOKIE['MapRoute'])) {
457
+	print 'checked';
458
+}
459
+?> ><?php echo _("Display flight route on click"); ?></label></div></li>
460
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightestimation" value="1" onclick="clickFlightEstimation(this)" <?php if ((isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'true') || (!isset($_COOKIE['flightestimation']) && !isset($globalMapEstimation)) || (!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation)) {
461
+	print 'checked';
462
+}
463
+?> ><?php echo _("Planes animate between updates"); ?></label></div></li>
319 464
 <?php
320 465
     }
321 466
 ?>
322
-		    <li><div class="checkbox"><label><input type="checkbox" name="displayairports" value="1" onclick="clickDisplayAirports(this)" <?php if (isset($_COOKIE['displayairports']) && $_COOKIE['displayairports'] == 'true') print 'checked'; ?> ><?php echo _("Display airports on map"); ?></label></div></li>
467
+		    <li><div class="checkbox"><label><input type="checkbox" name="displayairports" value="1" onclick="clickDisplayAirports(this)" <?php if (isset($_COOKIE['displayairports']) && $_COOKIE['displayairports'] == 'true') {
468
+	print 'checked';
469
+}
470
+?> ><?php echo _("Display airports on map"); ?></label></div></li>
323 471
 <?php
324 472
     if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
325 473
 ?>
326
-		    <li><div class="checkbox"><label><input type="checkbox" name="displayminimap" value="1" onclick="clickDisplayMinimap(this)" <?php if (!isset($_COOKIE['displayminimap']) || (isset($_COOKIE['displayminimap']) && $_COOKIE['displayminimap'] == 'true')) print 'checked'; ?> ><?php echo _("Show mini-map"); ?></label></div></li>
474
+		    <li><div class="checkbox"><label><input type="checkbox" name="displayminimap" value="1" onclick="clickDisplayMinimap(this)" <?php if (!isset($_COOKIE['displayminimap']) || (isset($_COOKIE['displayminimap']) && $_COOKIE['displayminimap'] == 'true')) {
475
+	print 'checked';
476
+}
477
+?> ><?php echo _("Show mini-map"); ?></label></div></li>
327 478
 <?php
328 479
     }
329 480
     if (time() > mktime(0,0,0,12,1,date("Y")) && time() < mktime(0,0,0,12,31,date("Y"))) {
@@ -337,17 +488,25 @@  discard block
 block discarded – undo
337 488
 			if (function_exists('array_column')) {
338 489
 			    if (array_search(TRUE, array_column($globalSources, 'sourcestats')) !== FALSE) {
339 490
 		    ?>
340
-		    <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) print 'checked'; ?> ><?php echo _("Display polar on map"); ?></label></div></li>
491
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) {
492
+	print 'checked';
493
+}
494
+?> ><?php echo _("Display polar on map"); ?></label></div></li>
341 495
 		    <?php
342 496
 			    }
343 497
 			} elseif (isset($globalSources)) {
344 498
 			    $dispolar = false;
345 499
 			    foreach ($globalSources as $testsource) {
346
-			        if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) $dispolar = true;
500
+			        if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) {
501
+			        	$dispolar = true;
502
+			        }
347 503
 			    }
348 504
 			    if ($dispolar) {
349 505
 		    ?>
350
-		    <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) print 'checked'; ?> ><?php echo _("Display polar on map"); ?></label></div></li>
506
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) {
507
+	print 'checked';
508
+}
509
+?> ><?php echo _("Display polar on map"); ?></label></div></li>
351 510
 		    <?php
352 511
 			    }
353 512
 		        }
@@ -359,12 +518,22 @@  discard block
 block discarded – undo
359 518
 		    <?php
360 519
 		        if (extension_loaded('gd') && function_exists('gd_info')) {
361 520
 		    ?>
362
-		    <li><input type="checkbox" name="aircraftcoloraltitude" value="1" onclick="iconColorAltitude(this)" <?php if (isset($_COOKIE['IconColorAltitude']) && $_COOKIE['IconColorAltitude'] == 'true') print 'checked'; ?> ><?php echo _("Aircraft icon color based on altitude"); ?></li>
521
+		    <li><input type="checkbox" name="aircraftcoloraltitude" value="1" onclick="iconColorAltitude(this)" <?php if (isset($_COOKIE['IconColorAltitude']) && $_COOKIE['IconColorAltitude'] == 'true') {
522
+	print 'checked';
523
+}
524
+?> ><?php echo _("Aircraft icon color based on altitude"); ?></li>
363 525
 		    <?php 
364 526
 			if (!isset($_COOKIE['IconColorAltitude']) || $_COOKIE['IconColorAltitude'] == 'false') {
365 527
 		    ?>
366 528
 		    <li><?php echo _("Aircraft icon color:"); ?>
367
-			<input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(aircraftcolor.value);" value="#<?php if (isset($_COOKIE['IconColor'])) print $_COOKIE['IconColor']; elseif (isset($globalAircraftIconColor)) print $globalAircraftIconColor; else print '1a3151'; ?>">
529
+			<input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(aircraftcolor.value);" value="#<?php if (isset($_COOKIE['IconColor'])) {
530
+	print $_COOKIE['IconColor'];
531
+} elseif (isset($globalAircraftIconColor)) {
532
+	print $globalAircraftIconColor;
533
+} else {
534
+	print '1a3151';
535
+}
536
+?>">
368 537
 		    </li>
369 538
 		    <?php
370 539
 			    }
@@ -372,8 +541,22 @@  discard block
 block discarded – undo
372 541
 		    ?>
373 542
 		    <li><?php echo _("Show airport icon at zoom level:"); ?>
374 543
 			<div class="range">
375
-			    <input type="range" min="0" max="19" step="1" name="airportzoom" onchange="range.value=value;airportDisplayZoom(airportzoom.value);" value="<?php if (isset($_COOKIE['AirportZoom'])) print $_COOKIE['AirportZoom']; elseif (isset($globalAirportZoom)) print $globalAirportZoom; else print '7'; ?>">
376
-			    <output id="range"><?php if (isset($_COOKIE['AirportZoom'])) print $_COOKIE['AirportZoom']; elseif (isset($globalAirportZoom)) print $globalAirportZoom; else print '7'; ?></output>
544
+			    <input type="range" min="0" max="19" step="1" name="airportzoom" onchange="range.value=value;airportDisplayZoom(airportzoom.value);" value="<?php if (isset($_COOKIE['AirportZoom'])) {
545
+	print $_COOKIE['AirportZoom'];
546
+} elseif (isset($globalAirportZoom)) {
547
+	print $globalAirportZoom;
548
+} else {
549
+	print '7';
550
+}
551
+?>">
552
+			    <output id="range"><?php if (isset($_COOKIE['AirportZoom'])) {
553
+	print $_COOKIE['AirportZoom'];
554
+} elseif (isset($globalAirportZoom)) {
555
+	print $globalAirportZoom;
556
+} else {
557
+	print '7';
558
+}
559
+?></output>
377 560
 			</div>
378 561
 		    </li>
379 562
 <?php
@@ -381,22 +564,46 @@  discard block
 block discarded – undo
381 564
 ?>
382 565
 		    <li><?php echo _("Distance unit:"); ?>
383 566
 			<select class="selectpicker" onchange="unitdistance(this);">
384
-			    <option value="km"<?php if ((!isset($_COOKIE['unitdistance']) && (!isset($globalUnitDistance) || (isset($globalUnitDistance) && $globalUnitDistance == 'km'))) || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'km')) echo ' selected'; ?>>km</option>
385
-			    <option value="nm"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) echo ' selected'; ?>>nm</option>
386
-			    <option value="mi"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) echo ' selected'; ?>>mi</option>
567
+			    <option value="km"<?php if ((!isset($_COOKIE['unitdistance']) && (!isset($globalUnitDistance) || (isset($globalUnitDistance) && $globalUnitDistance == 'km'))) || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'km')) {
568
+	echo ' selected';
569
+}
570
+?>>km</option>
571
+			    <option value="nm"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) {
572
+	echo ' selected';
573
+}
574
+?>>nm</option>
575
+			    <option value="mi"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) {
576
+	echo ' selected';
577
+}
578
+?>>mi</option>
387 579
 		        </select>
388 580
 		    </li>
389 581
 		    <li><?php echo _("Altitude unit:"); ?>
390 582
 			<select class="selectpicker" onchange="unitaltitude(this);">
391
-			    <option value="m"<?php if ((!isset($_COOKIE['unitaltitude']) && (!isset($globalUnitAltitude) || (isset($globalUnitAltitude) && $globalUnitAltitude == 'm'))) || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'm')) echo ' selected'; ?>>m</option>
392
-			    <option value="feet"<?php if ((!isset($_COOKIE['unitaltitude']) && isset($globalUnitAltitude) && $globalUnitAltitude == 'feet') || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'feet')) echo ' selected'; ?>>feet</option>
583
+			    <option value="m"<?php if ((!isset($_COOKIE['unitaltitude']) && (!isset($globalUnitAltitude) || (isset($globalUnitAltitude) && $globalUnitAltitude == 'm'))) || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'm')) {
584
+	echo ' selected';
585
+}
586
+?>>m</option>
587
+			    <option value="feet"<?php if ((!isset($_COOKIE['unitaltitude']) && isset($globalUnitAltitude) && $globalUnitAltitude == 'feet') || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'feet')) {
588
+	echo ' selected';
589
+}
590
+?>>feet</option>
393 591
 		        </select>
394 592
 		    </li>
395 593
 		    <li><?php echo _("Speed unit:"); ?>
396 594
 			<select class="selectpicker" onchange="unitspeed(this);">
397
-			    <option value="kmh"<?php if ((!isset($_COOKIE['unitspeed']) && (!isset($globalUnitSpeed) || (isset($globalUnitSpeed) && $globalUnitSpeed == 'kmh'))) || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'kmh')) echo ' selected'; ?>>km/h</option>
398
-			    <option value="mph"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'mph') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'mph')) echo ' selected'; ?>>mph</option>
399
-			    <option value="knots"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'knots') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'knots')) echo ' selected'; ?>>knots</option>
595
+			    <option value="kmh"<?php if ((!isset($_COOKIE['unitspeed']) && (!isset($globalUnitSpeed) || (isset($globalUnitSpeed) && $globalUnitSpeed == 'kmh'))) || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'kmh')) {
596
+	echo ' selected';
597
+}
598
+?>>km/h</option>
599
+			    <option value="mph"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'mph') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'mph')) {
600
+	echo ' selected';
601
+}
602
+?>>mph</option>
603
+			    <option value="knots"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'knots') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'knots')) {
604
+	echo ' selected';
605
+}
606
+?>>knots</option>
400 607
 		        </select>
401 608
 		    </li>
402 609
 
@@ -411,9 +618,18 @@  discard block
 block discarded – undo
411 618
 		    <?php
412 619
 			if (((isset($globalVATSIM) && $globalVATSIM) || isset($globalIVAO) && $globalIVAO || isset($globalphpVMS) && $globalphpVMS) && (!isset($globalMapVAchoose) || $globalMapVAchoose)) {
413 620
 		    ?>
414
-			<?php if (isset($globalVATSIM) && $globalVATSIM) { ?><li><input type="checkbox" name="vatsim" value="1" onclick="clickVATSIM(this)" <?php if ((isset($_COOKIE['ShowVATSIM']) && $_COOKIE['ShowVATSIM'] == 'true') || !isset($_COOKIE['ShowVATSIM'])) print 'checked'; ?> ><?php echo _("Display VATSIM data"); ?></li><?php } ?>
415
-			<?php if (isset($globalIVAO) && $globalIVAO) { ?><li><input type="checkbox" name="ivao" value="1" onclick="clickIVAO(this)" <?php if ((isset($_COOKIE['ShowIVAO']) && $_COOKIE['ShowIVAO'] == 'true') || !isset($_COOKIE['ShowIVAO'])) print 'checked'; ?> ><?php echo _("Display IVAO data"); ?></li><?php } ?>
416
-			<?php if (isset($globalphpVMS) && $globalphpVMS) { ?><li><input type="checkbox" name="phpvms" value="1" onclick="clickphpVMS(this)" <?php if ((isset($_COOKIE['ShowVMS']) && $_COOKIE['ShowVMS'] == 'true') || !isset($_COOKIE['ShowVMS'])) print 'checked'; ?> ><?php echo _("Display phpVMS data"); ?></li><?php } ?>
621
+			<?php if (isset($globalVATSIM) && $globalVATSIM) { ?><li><input type="checkbox" name="vatsim" value="1" onclick="clickVATSIM(this)" <?php if ((isset($_COOKIE['ShowVATSIM']) && $_COOKIE['ShowVATSIM'] == 'true') || !isset($_COOKIE['ShowVATSIM'])) {
622
+	print 'checked';
623
+}
624
+?> ><?php echo _("Display VATSIM data"); ?></li><?php } ?>
625
+			<?php if (isset($globalIVAO) && $globalIVAO) { ?><li><input type="checkbox" name="ivao" value="1" onclick="clickIVAO(this)" <?php if ((isset($_COOKIE['ShowIVAO']) && $_COOKIE['ShowIVAO'] == 'true') || !isset($_COOKIE['ShowIVAO'])) {
626
+	print 'checked';
627
+}
628
+?> ><?php echo _("Display IVAO data"); ?></li><?php } ?>
629
+			<?php if (isset($globalphpVMS) && $globalphpVMS) { ?><li><input type="checkbox" name="phpvms" value="1" onclick="clickphpVMS(this)" <?php if ((isset($_COOKIE['ShowVMS']) && $_COOKIE['ShowVMS'] == 'true') || !isset($_COOKIE['ShowVMS'])) {
630
+	print 'checked';
631
+}
632
+?> ><?php echo _("Display phpVMS data"); ?></li><?php } ?>
417 633
 		    <?php
418 634
 			}
419 635
 		    ?>
@@ -421,10 +637,16 @@  discard block
 block discarded – undo
421 637
 			if (!(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalphpVMS) && $globalphpVMS) && isset($globalSBS1) && $globalSBS1 && isset($globalAPRS) && $globalAPRS && (!isset($globalMapchoose) || $globalMapchoose)) {
422 638
 		    ?>
423 639
 			<?php if (isset($globalSBS1) && $globalSBS1) { ?>
424
-			    <li><div class="checkbox"><label><input type="checkbox" name="sbs" value="1" onclick="clickSBS1(this)" <?php if ((isset($_COOKIE['ShowSBS1']) && $_COOKIE['ShowSBS1'] == 'true') || !isset($_COOKIE['ShowSBS1'])) print 'checked'; ?> ><?php echo _("Display ADS-B data"); ?></label></div></li>
640
+			    <li><div class="checkbox"><label><input type="checkbox" name="sbs" value="1" onclick="clickSBS1(this)" <?php if ((isset($_COOKIE['ShowSBS1']) && $_COOKIE['ShowSBS1'] == 'true') || !isset($_COOKIE['ShowSBS1'])) {
641
+	print 'checked';
642
+}
643
+?> ><?php echo _("Display ADS-B data"); ?></label></div></li>
425 644
 			<?php } ?>
426 645
 			<?php if (isset($globalAPRS) && $globalAPRS) { ?>
427
-			    <li><div class="checkbox"><label><input type="checkbox" name="aprs" value="1" onclick="clickAPRS(this)" <?php if ((isset($_COOKIE['ShowAPRS']) && $_COOKIE['ShowAPRS'] == 'true') || !isset($_COOKIE['ShowAPRS'])) print 'checked'; ?> ><?php echo _("Display APRS data"); ?></label></div></li>
646
+			    <li><div class="checkbox"><label><input type="checkbox" name="aprs" value="1" onclick="clickAPRS(this)" <?php if ((isset($_COOKIE['ShowAPRS']) && $_COOKIE['ShowAPRS'] == 'true') || !isset($_COOKIE['ShowAPRS'])) {
647
+	print 'checked';
648
+}
649
+?> ><?php echo _("Display APRS data"); ?></label></div></li>
428 650
 			<?php } ?>
429 651
 		    <?php
430 652
 			}
@@ -441,7 +663,9 @@  discard block
 block discarded – undo
441 663
 				}
442 664
 				foreach($allairlinenames as $airline) {
443 665
 					$airline_name = $airline['airline_name'];
444
-					if (strlen($airline_name) > 30) $airline_name = substr($airline_name,0,30).'...';
666
+					if (strlen($airline_name) > 30) {
667
+						$airline_name = substr($airline_name,0,30).'...';
668
+					}
445 669
 					if (isset($_COOKIE['filter_Airlines']) && in_array($airline['airline_icao'],explode(',',$_COOKIE['filter_Airlines']))) {
446 670
 						echo '<option value="'.$airline['airline_icao'].'" selected>'.$airline_name.'</option>';
447 671
 					} else {
@@ -459,7 +683,10 @@  discard block
 block discarded – undo
459 683
 		    <li><?php echo _("Display alliance:"); ?>
460 684
 		    <br/>
461 685
 			<select class="selectpicker" onchange="alliance(this);" id="display_alliance">
462
-			    <option value="all"<?php if (!isset($_COOKIE['filter_alliance']) || $_COOKIE['filter_alliance'] == 'all' || $_COOKIE['filter_alliance'] == '') echo ' selected'; ?>><?php echo _("All"); ?></option>
686
+			    <option value="all"<?php if (!isset($_COOKIE['filter_alliance']) || $_COOKIE['filter_alliance'] == 'all' || $_COOKIE['filter_alliance'] == '') {
687
+	echo ' selected';
688
+}
689
+?>><?php echo _("All"); ?></option>
463 690
 			    <?php
464 691
 				foreach($allalliancenames as $alliance) {
465 692
 					$alliance_name = $alliance['alliance'];
@@ -500,10 +727,22 @@  discard block
 block discarded – undo
500 727
 		    ?>
501 728
 		    <li><?php echo _("Display airlines of type:"); ?><br/>
502 729
 			<select class="selectpicker" onchange="airlinestype(this);">
503
-			    <option value="all"<?php if (!isset($_COOKIE['filter_airlinestype']) || $_COOKIE['filter_airlinestype'] == 'all' || $_COOKIE['filter_airlinestype'] == '') echo ' selected'; ?>><?php echo _("All"); ?></option>
504
-			    <option value="passenger"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'passenger') echo ' selected'; ?>><?php echo _("Passenger"); ?></option>
505
-			    <option value="cargo"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'cargo') echo ' selected'; ?>><?php echo _("Cargo"); ?></option>
506
-			    <option value="military"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'military') echo ' selected'; ?>><?php echo _("Military"); ?></option>
730
+			    <option value="all"<?php if (!isset($_COOKIE['filter_airlinestype']) || $_COOKIE['filter_airlinestype'] == 'all' || $_COOKIE['filter_airlinestype'] == '') {
731
+	echo ' selected';
732
+}
733
+?>><?php echo _("All"); ?></option>
734
+			    <option value="passenger"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'passenger') {
735
+	echo ' selected';
736
+}
737
+?>><?php echo _("Passenger"); ?></option>
738
+			    <option value="cargo"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'cargo') {
739
+	echo ' selected';
740
+}
741
+?>><?php echo _("Cargo"); ?></option>
742
+			    <option value="military"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'military') {
743
+	echo ' selected';
744
+}
745
+?>><?php echo _("Military"); ?></option>
507 746
 			</select>
508 747
 		    </li>
509 748
 		    <?php
@@ -511,7 +750,10 @@  discard block
 block discarded – undo
511 750
 		    ?>
512 751
 		    <li>
513 752
 			<?php echo _("Display flight with ident:"); ?>
514
-			<input type="text" name="identfilter" onchange="identfilter();" id="identfilter" value="<?php if (isset($_COOKIE['filter_ident'])) print $_COOKIE['filter_ident']; ?>" />
753
+			<input type="text" name="identfilter" onchange="identfilter();" id="identfilter" value="<?php if (isset($_COOKIE['filter_ident'])) {
754
+	print $_COOKIE['filter_ident'];
755
+}
756
+?>" />
515 757
 		    </li>
516 758
 		</ul>
517 759
 	    </form>
@@ -527,7 +769,10 @@  discard block
 block discarded – undo
527 769
 	    <h1 class="sidebar-header"><?php echo _("Satellites"); ?><span class="sidebar-close"><i class="fa fa-caret-left"></i></span></h1>
528 770
 	    <form>
529 771
 		<ul>
530
-		    <li><div class="checkbox"><label><input type="checkbox" name="displayiss" value="1" onclick="clickDisplayISS(this)" <?php if (isset($_COOKIE['displayiss']) && $_COOKIE['displayiss'] == 'true') print 'checked'; ?> ><?php echo _("Show ISS, Tiangong-1 and Tiangong-2 on map"); ?></label></div></li>
772
+		    <li><div class="checkbox"><label><input type="checkbox" name="displayiss" value="1" onclick="clickDisplayISS(this)" <?php if (isset($_COOKIE['displayiss']) && $_COOKIE['displayiss'] == 'true') {
773
+	print 'checked';
774
+}
775
+?> ><?php echo _("Show ISS, Tiangong-1 and Tiangong-2 on map"); ?></label></div></li>
531 776
 		    <li><?php echo _("Type:"); ?>
532 777
 			<select class="selectpicker" multiple onchange="sattypes(this);">
533 778
 			    <?php
@@ -535,25 +780,45 @@  discard block
 block discarded – undo
535 780
 				$types = $Satellite->get_tle_types();
536 781
 				foreach ($types as $type) {
537 782
 					$type_name = $type['tle_type'];
538
-					if ($type_name == 'musson') $type_name = 'Russian LEO Navigation';
539
-					else if ($type_name == 'nnss') $type_name = 'Navi Navigation Satellite System';
540
-					else if ($type_name == 'sbas') $type_name = 'Satellite-Based Augmentation System';
541
-					else if ($type_name == 'glo-ops') $type_name = 'Glonass Operational';
542
-					else if ($type_name == 'gps-ops') $type_name = 'GPS Operational';
543
-					else if ($type_name == 'argos') $type_name = 'ARGOS Data Collection System';
544
-					else if ($type_name == 'tdrss') $type_name = 'Tracking and Data Relay Satellite System';
545
-					else if ($type_name == 'sarsat') $type_name = 'Search & Rescue';
546
-					else if ($type_name == 'dmc') $type_name = 'Disaster Monitoring';
547
-					else if ($type_name == 'resource') $type_name = 'Earth Resources';
548
-					else if ($type_name == 'stations') $type_name = 'Space Stations';
549
-					else if ($type_name == 'geo') $type_name = 'Geostationary';
550
-					else if ($type_name == 'amateur') $type_name = 'Amateur Radio';
551
-					else if ($type_name == 'x-comm') $type_name = 'Experimental';
552
-					else if ($type_name == 'other-comm') $type_name = 'Other Comm';
553
-					else if ($type_name == 'science') $type_name = 'Space & Earth Science';
554
-					else if ($type_name == 'military') $type_name = 'Miscellaneous Military';
555
-					else if ($type_name == 'radar') $type_name = 'Radar Calibration';
556
-					else if ($type_name == 'tle-new') $type_name = 'Last 30 days launches';
783
+					if ($type_name == 'musson') {
784
+						$type_name = 'Russian LEO Navigation';
785
+					} else if ($type_name == 'nnss') {
786
+						$type_name = 'Navi Navigation Satellite System';
787
+					} else if ($type_name == 'sbas') {
788
+						$type_name = 'Satellite-Based Augmentation System';
789
+					} else if ($type_name == 'glo-ops') {
790
+						$type_name = 'Glonass Operational';
791
+					} else if ($type_name == 'gps-ops') {
792
+						$type_name = 'GPS Operational';
793
+					} else if ($type_name == 'argos') {
794
+						$type_name = 'ARGOS Data Collection System';
795
+					} else if ($type_name == 'tdrss') {
796
+						$type_name = 'Tracking and Data Relay Satellite System';
797
+					} else if ($type_name == 'sarsat') {
798
+						$type_name = 'Search & Rescue';
799
+					} else if ($type_name == 'dmc') {
800
+						$type_name = 'Disaster Monitoring';
801
+					} else if ($type_name == 'resource') {
802
+						$type_name = 'Earth Resources';
803
+					} else if ($type_name == 'stations') {
804
+						$type_name = 'Space Stations';
805
+					} else if ($type_name == 'geo') {
806
+						$type_name = 'Geostationary';
807
+					} else if ($type_name == 'amateur') {
808
+						$type_name = 'Amateur Radio';
809
+					} else if ($type_name == 'x-comm') {
810
+						$type_name = 'Experimental';
811
+					} else if ($type_name == 'other-comm') {
812
+						$type_name = 'Other Comm';
813
+					} else if ($type_name == 'science') {
814
+						$type_name = 'Space & Earth Science';
815
+					} else if ($type_name == 'military') {
816
+						$type_name = 'Miscellaneous Military';
817
+					} else if ($type_name == 'radar') {
818
+						$type_name = 'Radar Calibration';
819
+					} else if ($type_name == 'tle-new') {
820
+						$type_name = 'Last 30 days launches';
821
+					}
557 822
 					
558 823
 					if (isset($_COOKIE['sattypes']) && in_array($type['tle_type'],explode(',',$_COOKIE['sattypes']))) {
559 824
 						print '<option value="'.$type['tle_type'].'" selected>'.$type_name.'</option>';
Please login to merge, or discard this patch.