Completed
Push — master ( 4c247d...ce17c6 )
by Yannick
07:53
created
live-czml.php 1 patch
Spacing   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -43,11 +43,11 @@  discard block
 block discarded – undo
43 43
     $s3 = sin($bank/2);
44 44
     $c1c2 = $c1*$c2;
45 45
     $s1s2 = $s1*$s2;
46
-    $w =$c1c2*$c3 - $s1s2*$s3;
47
-    $x =$c1c2*$s3 + $s1s2*$c3;
48
-    $y =$s1*$c2*$c3 + $c1*$s2*$s3;
49
-    $z =$c1*$s2*$c3 - $s1*$c2*$s3;
50
-    return array('x' => $x,'y' => $y,'z' => $z,'w' => $w);
46
+    $w = $c1c2*$c3 - $s1s2*$s3;
47
+    $x = $c1c2*$s3 + $s1s2*$c3;
48
+    $y = $s1*$c2*$c3 + $c1*$s2*$s3;
49
+    $z = $c1*$s2*$c3 - $s1*$c2*$s3;
50
+    return array('x' => $x, 'y' => $y, 'z' => $z, 'w' => $w);
51 51
 //    return array('x' => '0.0','y' => '-0.931','z' => '0.0','w' => '0.365');
52 52
 
53 53
 }
@@ -68,16 +68,16 @@  discard block
 block discarded – undo
68 68
 $min = false;
69 69
 $allhistory = false;
70 70
 $filter['source'] = array();
71
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt'));
72
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup'));
73
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars'));
74
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs','famaprs'));
75
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs'));
76
-if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING);
77
-if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING);
78
-if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING);
79
-if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING);
80
-if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING);
71
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'], array('vatsimtxt'));
72
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'], array('whazzup'));
73
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'], array('phpvmacars'));
74
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'], array('sbs', 'famaprs'));
75
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'], array('aprs'));
76
+if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'], FILTER_SANITIZE_STRING);
77
+if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',', $_COOKIE['filter_Airlines']), FILTER_SANITIZE_STRING);
78
+if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',', $_COOKIE['filter_Sources']), FILTER_SANITIZE_STRING);
79
+if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'], FILTER_SANITIZE_STRING);
80
+if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'], FILTER_SANITIZE_STRING);
81 81
 /*
82 82
 if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) {
83 83
 	$min = true;
@@ -124,12 +124,12 @@  discard block
 block discarded – undo
124 124
 	$from_archive = true;
125 125
 //	$begindate = filter_input(INPUT_GET,'begindate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~')));
126 126
 //	$enddate = filter_input(INPUT_GET,'enddate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~')));
127
-	$begindate = filter_input(INPUT_GET,'begindate',FILTER_SANITIZE_NUMBER_INT);
128
-	$enddate = filter_input(INPUT_GET,'enddate',FILTER_SANITIZE_NUMBER_INT);
129
-	$archivespeed = filter_input(INPUT_GET,'speed',FILTER_SANITIZE_NUMBER_INT);
130
-	$begindate = date('Y-m-d H:i:s',$begindate);
131
-	$enddate = date('Y-m-d H:i:s',$enddate);
132
-	$spotter_array = $SpotterArchive->getMinLiveSpotterDataPlayback($begindate,$enddate,$filter);
127
+	$begindate = filter_input(INPUT_GET, 'begindate', FILTER_SANITIZE_NUMBER_INT);
128
+	$enddate = filter_input(INPUT_GET, 'enddate', FILTER_SANITIZE_NUMBER_INT);
129
+	$archivespeed = filter_input(INPUT_GET, 'speed', FILTER_SANITIZE_NUMBER_INT);
130
+	$begindate = date('Y-m-d H:i:s', $begindate);
131
+	$enddate = date('Y-m-d H:i:s', $enddate);
132
+	$spotter_array = $SpotterArchive->getMinLiveSpotterDataPlayback($begindate, $enddate, $filter);
133 133
 } elseif (isset($_COOKIE['archive']) && isset($_COOKIE['archive_begin']) && isset($_COOKIE['archive_end']) && isset($_COOKIE['archive_speed'])) {
134 134
 	$from_archive = true;
135 135
 //	$begindate = filter_input(INPUT_GET,'begindate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~')));
@@ -139,11 +139,11 @@  discard block
 block discarded – undo
139 139
 	$begindate = $_COOKIE['archive_begin'];
140 140
 	$enddate = $_COOKIE['archive_end'];
141 141
 
142
-	$archivespeed = filter_var($_COOKIE['archive_speed'],FILTER_SANITIZE_NUMBER_INT);
143
-	$begindate = date('Y-m-d H:i:s',$begindate);
144
-	$enddate = date('Y-m-d H:i:s',$enddate);
142
+	$archivespeed = filter_var($_COOKIE['archive_speed'], FILTER_SANITIZE_NUMBER_INT);
143
+	$begindate = date('Y-m-d H:i:s', $begindate);
144
+	$enddate = date('Y-m-d H:i:s', $enddate);
145 145
 //	echo 'Begin : '.$begindate.' - End : '.$enddate."\n";
146
-	$spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate,$enddate,$filter);
146
+	$spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate, $enddate, $filter);
147 147
 } elseif ($tracker) {
148 148
 	$spotter_array = $TrackerLive->getMinLastLiveTrackerData($filter);
149 149
 } elseif ($marine) {
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
 
155 155
 if (!empty($spotter_array)) {
156 156
 	if (isset($_GET['archive'])) {
157
-		$flightcnt = $SpotterArchive->getLiveSpotterCount($begindate,$enddate,$filter);
157
+		$flightcnt = $SpotterArchive->getLiveSpotterCount($begindate, $enddate, $filter);
158 158
 	} elseif ($tracker) {
159 159
 		$flightcnt = $TrackerLive->getLiveTrackerCount($filter);
160 160
 	} elseif ($marine) {
@@ -165,16 +165,16 @@  discard block
 block discarded – undo
165 165
 	if ($flightcnt == '') $flightcnt = 0;
166 166
 } else $flightcnt = 0;
167 167
 
168
-$sqltime = round(microtime(true)-$begintime,2);
168
+$sqltime = round(microtime(true) - $begintime, 2);
169 169
 $minitime = time();
170 170
 $maxitime = 0;
171 171
 
172 172
 
173 173
 $modelsdb = array();
174 174
 if (file_exists('models/modelsdb')) {
175
-	if (($handle = fopen('models/modelsdb','r')) !== FALSE) {
176
-		while (($row = fgetcsv($handle,1000)) !== FALSE) {
177
-			if (isset($row[1]) ){
175
+	if (($handle = fopen('models/modelsdb', 'r')) !== FALSE) {
176
+		while (($row = fgetcsv($handle, 1000)) !== FALSE) {
177
+			if (isset($row[1])) {
178 178
 				$model = $row[0];
179 179
 				$modelsdb[$model] = $row[1];
180 180
 			}
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
 	$output .= ',"clock": {"currentTime" : "%minitime%","multiplier" : '.$speed.',"range" : "UNBOUNDED","step": "SYSTEM_CLOCK_MULTIPLIER","interval": "%minitime%/%maxitime%"}';
204 204
 } else {
205 205
 	if (isset($globalArchive) && $globalArchive === TRUE) {
206
-		$output .= ',"clock": {"currentTime" : "'.date("c",time()-$globalLiveInterval).'","multiplier" : '.$speed.',"range" : "UNBOUNDED","step": "SYSTEM_CLOCK_MULTIPLIER"}';
206
+		$output .= ',"clock": {"currentTime" : "'.date("c", time() - $globalLiveInterval).'","multiplier" : '.$speed.',"range" : "UNBOUNDED","step": "SYSTEM_CLOCK_MULTIPLIER"}';
207 207
 	} else {
208 208
 		$output .= ',"clock": {"currentTime" : "%minitime%","multiplier" : '.$speed.',"range" : "UNBOUNDED","step": "SYSTEM_CLOCK_MULTIPLIER"}';
209 209
 	}
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
 $output .= '},';
214 214
 if (!empty($spotter_array) && is_array($spotter_array))
215 215
 {
216
-	foreach($spotter_array as $spotter_item)
216
+	foreach ($spotter_array as $spotter_item)
217 217
 	{
218 218
 		$j++;
219 219
 		date_default_timezone_set('UTC');
@@ -501,7 +501,7 @@  discard block
 block discarded – undo
501 501
 			$output .= '"cartographicDegrees": [';
502 502
 			if ($minitime > strtotime($spotter_item['date'])) $minitime = strtotime($spotter_item['date']);
503 503
 			if ($maxitime < strtotime($spotter_item['date'])) $maxitime = strtotime($spotter_item['date']);
504
-			$output .= '"'.date("c",strtotime($spotter_item['date'])).'", ';
504
+			$output .= '"'.date("c", strtotime($spotter_item['date'])).'", ';
505 505
 			$output .= $spotter_item['longitude'].', ';
506 506
 			$output .= $spotter_item['latitude'];
507 507
 			$prevlong = $spotter_item['longitude'];
@@ -515,7 +515,7 @@  discard block
 block discarded – undo
515 515
 			//$quat = quaternionrotate(deg2rad($spotter_item['heading']),deg2rad(0),deg2rad(0));
516 516
 			//$orientation .= '"'.date("c",strtotime($spotter_item['date'])).'",'.$quat['x'].','.$quat['y'].','.$quat['z'].','.$quat['w'];
517 517
 		} else {
518
-			$output .= ',"'.date("c",strtotime($spotter_item['date'])).'", ';
518
+			$output .= ',"'.date("c", strtotime($spotter_item['date'])).'", ';
519 519
 			if ($maxitime < strtotime($spotter_item['date'])) $maxitime = strtotime($spotter_item['date']);
520 520
 			if ($spotter_item['ground_speed'] == 0) {
521 521
 				$output .= $prevlong.', ';
@@ -547,7 +547,7 @@  discard block
 block discarded – undo
547 547
 	$output  = substr($output, 0, -1);
548 548
 }
549 549
 $output .= ']';
550
-$output = str_replace('%minitime%',date("c",$minitime),$output);
551
-$output = str_replace('%maxitime%',date("c",$maxitime),$output);
550
+$output = str_replace('%minitime%', date("c", $minitime), $output);
551
+$output = str_replace('%maxitime%', date("c", $maxitime), $output);
552 552
 print $output;
553 553
 ?>
Please login to merge, or discard this patch.
require/class.SpotterLive.php 1 patch
Spacing   +126 added lines, -126 removed lines patch added patch discarded remove patch
@@ -16,62 +16,62 @@  discard block
 block discarded – undo
16 16
 	* @param Array $filter the filter
17 17
 	* @return Array the SQL part
18 18
 	*/
19
-	public function getFilter($filter = array(),$where = false,$and = false) {
19
+	public function getFilter($filter = array(), $where = false, $and = false) {
20 20
 		global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver;
21 21
 		$filters = array();
22 22
 		if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) {
23 23
 			if (isset($globalStatsFilters[$globalFilterName][0]['source'])) {
24 24
 				$filters = $globalStatsFilters[$globalFilterName];
25 25
 			} else {
26
-				$filter = array_merge($filter,$globalStatsFilters[$globalFilterName]);
26
+				$filter = array_merge($filter, $globalStatsFilters[$globalFilterName]);
27 27
 			}
28 28
 		}
29 29
 		if (isset($filter[0]['source'])) {
30
-			$filters = array_merge($filters,$filter);
30
+			$filters = array_merge($filters, $filter);
31 31
 		}
32
-		if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter);
32
+		if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter);
33 33
 		$filter_query_join = '';
34 34
 		$filter_query_where = '';
35
-		foreach($filters as $flt) {
35
+		foreach ($filters as $flt) {
36 36
 			if (isset($flt['airlines']) && !empty($flt['airlines'])) {
37 37
 				if ($flt['airlines'][0] != '') {
38 38
 					if (isset($flt['source'])) {
39
-						$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'])."')) saf ON saf.flightaware_id = spotter_live.flightaware_id";
39
+						$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'])."')) saf ON saf.flightaware_id = spotter_live.flightaware_id";
40 40
 					} else {
41
-						$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$flt['airlines'])."')) saf ON saf.flightaware_id = spotter_live.flightaware_id";
41
+						$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $flt['airlines'])."')) saf ON saf.flightaware_id = spotter_live.flightaware_id";
42 42
 					}
43 43
 				}
44 44
 			}
45 45
 			if (isset($flt['pilots_id']) && !empty($flt['pilots_id'])) {
46 46
 				if (isset($flt['source'])) {
47
-					$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'])."')) spi ON spi.flightaware_id = spotter_live.flightaware_id";
47
+					$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'])."')) spi ON spi.flightaware_id = spotter_live.flightaware_id";
48 48
 				} else {
49
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."')) spi ON spi.flightaware_id = spotter_live.flightaware_id";
49
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $flt['pilots_id'])."')) spi ON spi.flightaware_id = spotter_live.flightaware_id";
50 50
 				}
51 51
 			}
52 52
 			if (isset($flt['idents']) && !empty($flt['idents'])) {
53 53
 				if (isset($flt['source'])) {
54
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.ident IN ('".implode("','",$flt['idents'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) spid ON spid.flightaware_id = spotter_live.flightaware_id";
54
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.ident IN ('".implode("','", $flt['idents'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) spid ON spid.flightaware_id = spotter_live.flightaware_id";
55 55
 				} else {
56
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.ident IN ('".implode("','",$flt['idents'])."')) spid ON spid.flightaware_id = spotter_live.flightaware_id";
56
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.ident IN ('".implode("','", $flt['idents'])."')) spid ON spid.flightaware_id = spotter_live.flightaware_id";
57 57
 				}
58 58
 			}
59 59
 			if (isset($flt['registrations']) && !empty($flt['registrations'])) {
60 60
 				if (isset($flt['source'])) {
61
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.registration IN ('".implode("','",$flt['registrations'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) sre ON sre.flightaware_id = spotter_live.flightaware_id";
61
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.registration IN ('".implode("','", $flt['registrations'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) sre ON sre.flightaware_id = spotter_live.flightaware_id";
62 62
 				} else {
63
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.registration IN ('".implode("','",$flt['registrations'])."')) sre ON sre.flightaware_id = spotter_live.flightaware_id";
63
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.registration IN ('".implode("','", $flt['registrations'])."')) sre ON sre.flightaware_id = spotter_live.flightaware_id";
64 64
 				}
65 65
 			}
66 66
 			if ((isset($flt['airlines']) && empty($flt['airlines']) && isset($flt['pilots_id']) && empty($flt['pilots_id']) && isset($flt['idents']) && empty($flt['idents'])) || (!isset($flt['airlines']) && !isset($flt['pilots_id']) && !isset($flt['idents']) && !isset($flt['registrations']))) {
67 67
 				if (isset($flt['source'])) {
68
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.format_source IN ('".implode("','",$flt['source'])."')) ssf ON ssf.flightaware_id = spotter_live.flightaware_id";
68
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.format_source IN ('".implode("','", $flt['source'])."')) ssf ON ssf.flightaware_id = spotter_live.flightaware_id";
69 69
 				}
70 70
 			}
71 71
 		}
72 72
 		if (isset($filter['airlines']) && !empty($filter['airlines'])) {
73 73
 			if ($filter['airlines'][0] != '') {
74
-				$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) sai ON sai.flightaware_id = spotter_live.flightaware_id";
74
+				$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) sai ON sai.flightaware_id = spotter_live.flightaware_id";
75 75
 			}
76 76
 		}
77 77
 		if (isset($filter['alliance']) && !empty($filter['alliance'])) {
@@ -81,10 +81,10 @@  discard block
 block discarded – undo
81 81
 			$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_live.flightaware_id ";
82 82
 		}
83 83
 		if (isset($filter['pilots_id']) && !empty($filter['pilots_id'])) {
84
-			$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$filter['pilots_id'])."')) sp ON sp.flightaware_id = spotter_live.flightaware_id";
84
+			$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $filter['pilots_id'])."')) sp ON sp.flightaware_id = spotter_live.flightaware_id";
85 85
 		}
86 86
 		if (isset($filter['source']) && !empty($filter['source'])) {
87
-			$filter_query_where .= " AND format_source IN ('".implode("','",$filter['source'])."')";
87
+			$filter_query_where .= " AND format_source IN ('".implode("','", $filter['source'])."')";
88 88
 		}
89 89
 		if (isset($filter['ident']) && !empty($filter['ident'])) {
90 90
 			$filter_query_where .= " AND ident = '".$filter['ident']."'";
@@ -113,15 +113,15 @@  discard block
 block discarded – undo
113 113
 					$filter_query_date .= " AND EXTRACT(DAY FROM spotter_output.date) = '".$filter['day']."'";
114 114
 				}
115 115
 			}
116
-			$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output".preg_replace('/^ AND/',' WHERE',$filter_query_date).") sd ON sd.flightaware_id = spotter_live.flightaware_id";
116
+			$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output".preg_replace('/^ AND/', ' WHERE', $filter_query_date).") sd ON sd.flightaware_id = spotter_live.flightaware_id";
117 117
 		}
118 118
 		if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
119
-			$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
119
+			$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')";
120 120
 		}
121 121
 		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
122 122
 		elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND';
123 123
 		if ($filter_query_where != '') {
124
-			$filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where);
124
+			$filter_query_where = preg_replace('/^ AND/', ' WHERE', $filter_query_where);
125 125
 		}
126 126
 		$filter_query = $filter_query_join.$filter_query_where;
127 127
 		return $filter_query;
@@ -144,8 +144,8 @@  discard block
 block discarded – undo
144 144
 		if ($limit != '')
145 145
 		{
146 146
 			$limit_array = explode(',', $limit);
147
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
148
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
147
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
148
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
149 149
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
150 150
 			{
151 151
 				$limit_query = ' LIMIT '.$limit_array[1].' OFFSET '.$limit_array[0];
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
 		} else {
169 169
 			$query  = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate".$filter_query.$orderby_query;
170 170
 		}
171
-		$spotter_array = $Spotter->getDataFromDB($query.$limit_query,array(),'',true);
171
+		$spotter_array = $Spotter->getDataFromDB($query.$limit_query, array(), '', true);
172 172
 
173 173
 		return $spotter_array;
174 174
 	}
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
 	{
184 184
 		global $globalDBdriver, $globalLiveInterval, $globalArchive;
185 185
 		date_default_timezone_set('UTC');
186
-		$filter_query = $this->getFilter($filter,true,true);
186
+		$filter_query = $this->getFilter($filter, true, true);
187 187
 		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
188 188
 		if ($globalDBdriver == 'mysql') {
189 189
 			if (isset($globalArchive) && $globalArchive === TRUE) {
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
 		try {
207 207
 			$sth = $this->db->prepare($query);
208 208
 			$sth->execute();
209
-		} catch(PDOException $e) {
209
+		} catch (PDOException $e) {
210 210
 			echo $e->getMessage();
211 211
 			die;
212 212
 		}
@@ -225,26 +225,26 @@  discard block
 block discarded – undo
225 225
 		global $globalDBdriver, $globalLiveInterval, $globalArchive;
226 226
 		date_default_timezone_set('UTC');
227 227
 
228
-		$filter_query = $this->getFilter($filter,true,true);
228
+		$filter_query = $this->getFilter($filter, true, true);
229 229
 
230 230
 		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
231 231
 		if ($globalDBdriver == 'mysql') {
232 232
 			if (isset($globalArchive) && $globalArchive === TRUE) {
233
-				$query  = 'SELECT spotter_archive.ident, spotter_archive.flightaware_id, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, spotter_archive.date, spotter_archive.format_source 
233
+				$query = 'SELECT spotter_archive.ident, spotter_archive.flightaware_id, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, spotter_archive.date, spotter_archive.format_source 
234 234
 				FROM spotter_archive INNER JOIN (SELECT flightaware_id FROM spotter_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= spotter_live.date) l ON l.flightaware_id = spotter_archive.flightaware_id AND spotter_archive.latitude <> '0' AND spotter_archive.longitude <> '0' 
235 235
 				ORDER BY spotter_archive.flightaware_id, spotter_archive.date";
236 236
 			} else {
237
-				$query  = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
237
+				$query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
238 238
 				FROM spotter_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= spotter_live.date AND spotter_live.latitude <> '0' AND spotter_live.longitude <> '0' 
239 239
 				ORDER BY spotter_live.flightaware_id, spotter_live.date";
240 240
 			}
241 241
                 } else {
242 242
 			if (isset($globalArchive) && $globalArchive === TRUE) {
243
-				$query  = "SELECT spotter_archive.ident, spotter_archive.flightaware_id, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, spotter_archive.date, spotter_archive.format_source 
243
+				$query = "SELECT spotter_archive.ident, spotter_archive.flightaware_id, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, spotter_archive.date, spotter_archive.format_source 
244 244
 				FROM spotter_archive INNER JOIN (SELECT flightaware_id FROM spotter_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= spotter_live.date) l ON l.flightaware_id = spotter_archive.flightaware_id WHERE spotter_archive.latitude <> '0' AND spotter_archive.longitude <> '0' 
245 245
 				ORDER BY spotter_archive.flightaware_id, spotter_archive.date";
246 246
 			} else {
247
-				$query  = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
247
+				$query = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
248 248
 				FROM spotter_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= spotter_live.date AND spotter_live.latitude <> '0' AND spotter_live.longitude <> '0' 
249 249
 				ORDER BY spotter_live.flightaware_id, spotter_live.date";
250 250
 			}
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
     		try {
254 254
 			$sth = $this->db->prepare($query);
255 255
 			$sth->execute();
256
-		} catch(PDOException $e) {
256
+		} catch (PDOException $e) {
257 257
 			echo $e->getMessage();
258 258
 			die;
259 259
 		}
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
 	public function getLiveSpotterCount($filter = array())
271 271
 	{
272 272
 		global $globalDBdriver, $globalLiveInterval;
273
-		$filter_query = $this->getFilter($filter,true,true);
273
+		$filter_query = $this->getFilter($filter, true, true);
274 274
 
275 275
 		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
276 276
 		if ($globalDBdriver == 'mysql') {
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
 		try {
284 284
 			$sth = $this->db->prepare($query);
285 285
 			$sth->execute();
286
-		} catch(PDOException $e) {
286
+		} catch (PDOException $e) {
287 287
 			echo $e->getMessage();
288 288
 			die;
289 289
 		}
@@ -306,10 +306,10 @@  discard block
 block discarded – undo
306 306
 		$filter_query = $this->getFilter($filter);
307 307
 
308 308
 		if (is_array($coord)) {
309
-			$minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
310
-			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
311
-			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
312
-			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
309
+			$minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
310
+			$minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
311
+			$maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
312
+			$maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
313 313
 		} else return array();
314 314
 		if ($globalDBdriver == 'mysql') {
315 315
 			$query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate AND spotter_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND spotter_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.' GROUP BY spotter_live.flightaware_id'.$filter_query;
@@ -332,23 +332,23 @@  discard block
 block discarded – undo
332 332
 		global $globalDBdriver, $globalLiveInterval, $globalArchive;
333 333
 		$Spotter = new Spotter($this->db);
334 334
 		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
335
-		$filter_query = $this->getFilter($filter,true,true);
335
+		$filter_query = $this->getFilter($filter, true, true);
336 336
 
337 337
 		if (is_array($coord)) {
338
-			$minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
339
-			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
340
-			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
341
-			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
338
+			$minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
339
+			$minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
340
+			$maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
341
+			$maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
342 342
 		} else return array();
343 343
 		if ($globalDBdriver == 'mysql') {
344 344
 			if (isset($globalArchive) && $globalArchive === TRUE) {
345
-				$query  = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
345
+				$query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
346 346
 				FROM spotter_live 
347 347
 				'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= spotter_live.date 
348 348
 				AND spotter_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND spotter_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.'
349 349
 				AND spotter_live.latitude <> 0 AND spotter_live.longitude <> 0';
350 350
 			} else {
351
-				$query  = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
351
+				$query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
352 352
 				FROM spotter_live 
353 353
 				INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate 
354 354
 				    FROM spotter_live l 
@@ -360,14 +360,14 @@  discard block
 block discarded – undo
360 360
 			}
361 361
 		} else {
362 362
 			if (isset($globalArchive) && $globalArchive === TRUE) {
363
-				$query  = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
363
+				$query = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
364 364
 				FROM spotter_live 
365 365
 				".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= spotter_live.date 
366 366
 				AND spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." 
367 367
 				AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong." 
368 368
 				AND spotter_live.latitude <> '0' AND spotter_live.longitude <> '0'";
369 369
 			} else {
370
-				$query  = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
370
+				$query = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
371 371
 				FROM spotter_live 
372 372
 				INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate 
373 373
 				    FROM spotter_live l 
@@ -382,7 +382,7 @@  discard block
 block discarded – undo
382 382
 		try {
383 383
 			$sth = $this->db->prepare($query);
384 384
 			$sth->execute();
385
-		} catch(PDOException $e) {
385
+		} catch (PDOException $e) {
386 386
 			echo $e->getMessage();
387 387
 			die;
388 388
 		}
@@ -431,7 +431,7 @@  discard block
 block discarded – undo
431 431
                 if ($interval == '1m')
432 432
                 {
433 433
                     $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';
434
-                } else if ($interval == '15m'){
434
+                } else if ($interval == '15m') {
435 435
                     $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= spotter_live.date ';
436 436
                 } 
437 437
             }
@@ -439,14 +439,14 @@  discard block
 block discarded – undo
439 439
          $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';   
440 440
         }
441 441
 
442
-                $query  = "SELECT spotter_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_live 
442
+                $query = "SELECT spotter_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_live 
443 443
                    WHERE spotter_live.latitude <> '' 
444 444
                                    AND spotter_live.longitude <> '' 
445 445
                    ".$additional_query."
446 446
                    HAVING distance < :radius  
447 447
                                    ORDER BY distance";
448 448
 
449
-                $spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius));
449
+                $spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng, ':radius' => $radius));
450 450
 
451 451
                 return $spotter_array;
452 452
         }
@@ -464,9 +464,9 @@  discard block
 block discarded – undo
464 464
 		date_default_timezone_set('UTC');
465 465
 
466 466
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
467
-                $query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
467
+                $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
468 468
 
469
-		$spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident),'',true);
469
+		$spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident), '', true);
470 470
 
471 471
 		return $spotter_array;
472 472
 	}
@@ -477,16 +477,16 @@  discard block
 block discarded – undo
477 477
 	* @return Array the spotter information
478 478
 	*
479 479
 	*/
480
-	public function getDateLiveSpotterDataByIdent($ident,$date)
480
+	public function getDateLiveSpotterDataByIdent($ident, $date)
481 481
 	{
482 482
 		$Spotter = new Spotter($this->db);
483 483
 		date_default_timezone_set('UTC');
484 484
 
485 485
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
486
-                $query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
486
+                $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
487 487
 
488
-                $date = date('c',$date);
489
-		$spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident,':date' => $date));
488
+                $date = date('c', $date);
489
+		$spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident, ':date' => $date));
490 490
 
491 491
 		return $spotter_array;
492 492
 	}
@@ -503,9 +503,9 @@  discard block
 block discarded – undo
503 503
 		date_default_timezone_set('UTC');
504 504
 
505 505
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
506
-                $query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
506
+                $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
507 507
 
508
-		$spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id),'',true);
508
+		$spotter_array = $Spotter->getDataFromDB($query, array(':id' => $id), '', true);
509 509
 
510 510
 		return $spotter_array;
511 511
 	}
@@ -516,15 +516,15 @@  discard block
 block discarded – undo
516 516
 	* @return Array the spotter information
517 517
 	*
518 518
 	*/
519
-	public function getDateLiveSpotterDataById($id,$date)
519
+	public function getDateLiveSpotterDataById($id, $date)
520 520
 	{
521 521
 		$Spotter = new Spotter($this->db);
522 522
 		date_default_timezone_set('UTC');
523 523
 
524 524
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
525
-                $query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
526
-                $date = date('c',$date);
527
-		$spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id,':date' => $date),'',true);
525
+                $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
526
+                $date = date('c', $date);
527
+		$spotter_array = $Spotter->getDataFromDB($query, array(':id' => $id, ':date' => $date), '', true);
528 528
 
529 529
 		return $spotter_array;
530 530
 	}
@@ -541,13 +541,13 @@  discard block
 block discarded – undo
541 541
 		date_default_timezone_set('UTC');
542 542
 
543 543
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
544
-                $query  = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident';
544
+                $query = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident';
545 545
 
546 546
     		try {
547 547
 			
548 548
 			$sth = $this->db->prepare($query);
549 549
 			$sth->execute(array(':ident' => $ident));
550
-		} catch(PDOException $e) {
550
+		} catch (PDOException $e) {
551 551
 			echo $e->getMessage();
552 552
 			die;
553 553
 		}
@@ -562,7 +562,7 @@  discard block
 block discarded – undo
562 562
 	* @return Array the spotter information
563 563
 	*
564 564
 	*/
565
-	public function getAllLiveSpotterDataById($id,$liveinterval = false)
565
+	public function getAllLiveSpotterDataById($id, $liveinterval = false)
566 566
 	{
567 567
 		global $globalDBdriver, $globalLiveInterval;
568 568
 		date_default_timezone_set('UTC');
@@ -581,7 +581,7 @@  discard block
 block discarded – undo
581 581
 		try {
582 582
 			$sth = $this->db->prepare($query);
583 583
 			$sth->execute(array(':id' => $id));
584
-		} catch(PDOException $e) {
584
+		} catch (PDOException $e) {
585 585
 			echo $e->getMessage();
586 586
 			die;
587 587
 		}
@@ -599,12 +599,12 @@  discard block
 block discarded – undo
599 599
 	{
600 600
 		date_default_timezone_set('UTC');
601 601
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
602
-		$query  = self::$global_query.' WHERE spotter_live.ident = :ident';
602
+		$query = self::$global_query.' WHERE spotter_live.ident = :ident';
603 603
     		try {
604 604
 			
605 605
 			$sth = $this->db->prepare($query);
606 606
 			$sth->execute(array(':ident' => $ident));
607
-		} catch(PDOException $e) {
607
+		} catch (PDOException $e) {
608 608
 			echo $e->getMessage();
609 609
 			die;
610 610
 		}
@@ -634,7 +634,7 @@  discard block
 block discarded – undo
634 634
 			
635 635
 			$sth = $this->db->prepare($query);
636 636
 			$sth->execute();
637
-		} catch(PDOException $e) {
637
+		} catch (PDOException $e) {
638 638
 			return "error";
639 639
 		}
640 640
 
@@ -657,14 +657,14 @@  discard block
 block discarded – undo
657 657
 				
658 658
 				$sth = $this->db->prepare($query);
659 659
 				$sth->execute();
660
-			} catch(PDOException $e) {
660
+			} catch (PDOException $e) {
661 661
 				return "error";
662 662
 			}
663 663
 			$query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN (';
664 664
                         $i = 0;
665
-                        $j =0;
665
+                        $j = 0;
666 666
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
667
-			foreach($all as $row)
667
+			foreach ($all as $row)
668 668
 			{
669 669
 				$i++;
670 670
 				$j++;
@@ -672,9 +672,9 @@  discard block
 block discarded – undo
672 672
 					if ($globalDebug) echo ".";
673 673
 				    	try {
674 674
 						
675
-						$sth = $this->db->prepare(substr($query_delete,0,-1).")");
675
+						$sth = $this->db->prepare(substr($query_delete, 0, -1).")");
676 676
 						$sth->execute();
677
-					} catch(PDOException $e) {
677
+					} catch (PDOException $e) {
678 678
 						return "error";
679 679
 					}
680 680
                                 	$query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN (';
@@ -685,9 +685,9 @@  discard block
 block discarded – undo
685 685
 			if ($i > 0) {
686 686
     				try {
687 687
 					
688
-					$sth = $this->db->prepare(substr($query_delete,0,-1).")");
688
+					$sth = $this->db->prepare(substr($query_delete, 0, -1).")");
689 689
 					$sth->execute();
690
-				} catch(PDOException $e) {
690
+				} catch (PDOException $e) {
691 691
 					return "error";
692 692
 				}
693 693
 			}
@@ -700,7 +700,7 @@  discard block
 block discarded – undo
700 700
 				
701 701
 				$sth = $this->db->prepare($query);
702 702
 				$sth->execute();
703
-			} catch(PDOException $e) {
703
+			} catch (PDOException $e) {
704 704
 				return "error";
705 705
 			}
706 706
 /*			$query_delete = "DELETE FROM spotter_live WHERE flightaware_id IN (";
@@ -748,13 +748,13 @@  discard block
 block discarded – undo
748 748
 	public function deleteLiveSpotterDataByIdent($ident)
749 749
 	{
750 750
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
751
-		$query  = 'DELETE FROM spotter_live WHERE ident = :ident';
751
+		$query = 'DELETE FROM spotter_live WHERE ident = :ident';
752 752
         
753 753
     		try {
754 754
 			
755 755
 			$sth = $this->db->prepare($query);
756 756
 			$sth->execute(array(':ident' => $ident));
757
-		} catch(PDOException $e) {
757
+		} catch (PDOException $e) {
758 758
 			return "error";
759 759
 		}
760 760
 
@@ -770,13 +770,13 @@  discard block
 block discarded – undo
770 770
 	public function deleteLiveSpotterDataById($id)
771 771
 	{
772 772
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
773
-		$query  = 'DELETE FROM spotter_live WHERE flightaware_id = :id';
773
+		$query = 'DELETE FROM spotter_live WHERE flightaware_id = :id';
774 774
         
775 775
     		try {
776 776
 			
777 777
 			$sth = $this->db->prepare($query);
778 778
 			$sth->execute(array(':id' => $id));
779
-		} catch(PDOException $e) {
779
+		} catch (PDOException $e) {
780 780
 			return "error";
781 781
 		}
782 782
 
@@ -794,13 +794,13 @@  discard block
 block discarded – undo
794 794
 	{
795 795
 		global $globalDBdriver, $globalTimezone;
796 796
 		if ($globalDBdriver == 'mysql') {
797
-			$query  = 'SELECT spotter_live.ident FROM spotter_live 
797
+			$query = 'SELECT spotter_live.ident FROM spotter_live 
798 798
 				WHERE spotter_live.ident = :ident 
799 799
 				AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) 
800 800
 				AND spotter_live.date < UTC_TIMESTAMP()';
801 801
 			$query_data = array(':ident' => $ident);
802 802
 		} else {
803
-			$query  = "SELECT spotter_live.ident FROM spotter_live 
803
+			$query = "SELECT spotter_live.ident FROM spotter_live 
804 804
 				WHERE spotter_live.ident = :ident 
805 805
 				AND spotter_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS'
806 806
 				AND spotter_live.date < now() AT TIME ZONE 'UTC'";
@@ -809,8 +809,8 @@  discard block
 block discarded – undo
809 809
 		
810 810
 		$sth = $this->db->prepare($query);
811 811
 		$sth->execute($query_data);
812
-		$ident_result='';
813
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
812
+		$ident_result = '';
813
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
814 814
 		{
815 815
 			$ident_result = $row['ident'];
816 816
 		}
@@ -827,13 +827,13 @@  discard block
 block discarded – undo
827 827
 	{
828 828
 		global $globalDBdriver, $globalTimezone;
829 829
 		if ($globalDBdriver == 'mysql') {
830
-			$query  = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
830
+			$query = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
831 831
 				WHERE spotter_live.ident = :ident 
832 832
 				AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE)'; 
833 833
 //				AND spotter_live.date < UTC_TIMESTAMP()";
834 834
 			$query_data = array(':ident' => $ident);
835 835
 		} else {
836
-			$query  = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
836
+			$query = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
837 837
 				WHERE spotter_live.ident = :ident 
838 838
 				AND spotter_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '30 MINUTES'";
839 839
 //				AND spotter_live.date < now() AT TIME ZONE 'UTC'";
@@ -842,8 +842,8 @@  discard block
 block discarded – undo
842 842
 		
843 843
 		$sth = $this->db->prepare($query);
844 844
 		$sth->execute($query_data);
845
-		$ident_result='';
846
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
845
+		$ident_result = '';
846
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
847 847
 		{
848 848
 			$ident_result = $row['flightaware_id'];
849 849
 		}
@@ -860,13 +860,13 @@  discard block
 block discarded – undo
860 860
 	{
861 861
 		global $globalDBdriver, $globalTimezone;
862 862
 		if ($globalDBdriver == 'mysql') {
863
-			$query  = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
863
+			$query = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
864 864
 				WHERE spotter_live.flightaware_id = :id 
865 865
 				AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 10 HOUR)'; 
866 866
 //				AND spotter_live.date < UTC_TIMESTAMP()";
867 867
 			$query_data = array(':id' => $id);
868 868
 		} else {
869
-			$query  = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
869
+			$query = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
870 870
 				WHERE spotter_live.flightaware_id = :id 
871 871
 				AND spotter_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '10 HOUR'";
872 872
 //				AND spotter_live.date < now() AT TIME ZONE 'UTC'";
@@ -875,8 +875,8 @@  discard block
 block discarded – undo
875 875
 		
876 876
 		$sth = $this->db->prepare($query);
877 877
 		$sth->execute($query_data);
878
-		$ident_result='';
879
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
878
+		$ident_result = '';
879
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
880 880
 		{
881 881
 			$ident_result = $row['flightaware_id'];
882 882
 		}
@@ -893,13 +893,13 @@  discard block
 block discarded – undo
893 893
 	{
894 894
 		global $globalDBdriver, $globalTimezone;
895 895
 		if ($globalDBdriver == 'mysql') {
896
-			$query  = 'SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live 
896
+			$query = 'SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live 
897 897
 				WHERE spotter_live.ModeS = :modes 
898 898
 				AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE)'; 
899 899
 //				AND spotter_live.date < UTC_TIMESTAMP()";
900 900
 			$query_data = array(':modes' => $modes);
901 901
 		} else {
902
-			$query  = "SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live 
902
+			$query = "SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live 
903 903
 				WHERE spotter_live.ModeS = :modes 
904 904
 				AND spotter_live.date >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '30 MINUTE'";
905 905
 //			//	AND spotter_live.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC'";
@@ -908,8 +908,8 @@  discard block
 block discarded – undo
908 908
 		
909 909
 		$sth = $this->db->prepare($query);
910 910
 		$sth->execute($query_data);
911
-		$ident_result='';
912
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
911
+		$ident_result = '';
912
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
913 913
 		{
914 914
 			//$ident_result = $row['spotter_live_id'];
915 915
 			$ident_result = $row['flightaware_id'];
@@ -928,7 +928,7 @@  discard block
 block discarded – undo
928 928
 	* @return String success or false
929 929
 	*
930 930
 	*/
931
-	public function addLiveSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $altitude_real = '',$heading = '', $groundspeed = '', $date = '',$departure_airport_time = '', $arrival_airport_time = '', $squawk = '', $route_stop = '', $ModeS = '', $putinarchive = false,$registration = '',$pilot_id = '', $pilot_name = '', $verticalrate = '', $noarchive = false, $ground = false,$format_source = '', $source_name = '', $over_country = '')
931
+	public function addLiveSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $altitude_real = '', $heading = '', $groundspeed = '', $date = '', $departure_airport_time = '', $arrival_airport_time = '', $squawk = '', $route_stop = '', $ModeS = '', $putinarchive = false, $registration = '', $pilot_id = '', $pilot_name = '', $verticalrate = '', $noarchive = false, $ground = false, $format_source = '', $source_name = '', $over_country = '')
932 932
 	{
933 933
 		global $globalURL, $globalArchive, $globalDebug;
934 934
 		$Common = new Common();
@@ -1021,26 +1021,26 @@  discard block
 block discarded – undo
1021 1021
 		if ($date == '') $date = date("Y-m-d H:i:s", time());
1022 1022
 
1023 1023
         
1024
-		$flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING);
1025
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
1026
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
1027
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
1028
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
1029
-		$latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1030
-		$longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1031
-		$waypoints = filter_var($waypoints,FILTER_SANITIZE_STRING);
1032
-		$altitude = filter_var($altitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1033
-		$heading = filter_var($heading,FILTER_SANITIZE_NUMBER_INT);
1034
-		$groundspeed = filter_var($groundspeed,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1035
-		$squawk = filter_var($squawk,FILTER_SANITIZE_NUMBER_INT);
1036
-		$route_stop = filter_var($route_stop,FILTER_SANITIZE_STRING);
1037
-		$ModeS = filter_var($ModeS,FILTER_SANITIZE_STRING);
1038
-		$pilot_id = filter_var($pilot_id,FILTER_SANITIZE_STRING);
1039
-		$pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING);
1040
-		$format_source = filter_var($format_source,FILTER_SANITIZE_STRING);
1041
-		$source_name = filter_var($source_name,FILTER_SANITIZE_STRING);
1042
-		$over_country = filter_var($over_country,FILTER_SANITIZE_STRING);
1043
-		$verticalrate = filter_var($verticalrate,FILTER_SANITIZE_NUMBER_INT);
1024
+		$flightaware_id = filter_var($flightaware_id, FILTER_SANITIZE_STRING);
1025
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
1026
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
1027
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
1028
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
1029
+		$latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1030
+		$longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1031
+		$waypoints = filter_var($waypoints, FILTER_SANITIZE_STRING);
1032
+		$altitude = filter_var($altitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1033
+		$heading = filter_var($heading, FILTER_SANITIZE_NUMBER_INT);
1034
+		$groundspeed = filter_var($groundspeed, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1035
+		$squawk = filter_var($squawk, FILTER_SANITIZE_NUMBER_INT);
1036
+		$route_stop = filter_var($route_stop, FILTER_SANITIZE_STRING);
1037
+		$ModeS = filter_var($ModeS, FILTER_SANITIZE_STRING);
1038
+		$pilot_id = filter_var($pilot_id, FILTER_SANITIZE_STRING);
1039
+		$pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING);
1040
+		$format_source = filter_var($format_source, FILTER_SANITIZE_STRING);
1041
+		$source_name = filter_var($source_name, FILTER_SANITIZE_STRING);
1042
+		$over_country = filter_var($over_country, FILTER_SANITIZE_STRING);
1043
+		$verticalrate = filter_var($verticalrate, FILTER_SANITIZE_NUMBER_INT);
1044 1044
 
1045 1045
 		$airline_name = '';
1046 1046
 		$airline_icao = '';
@@ -1062,10 +1062,10 @@  discard block
 block discarded – undo
1062 1062
 		$arrival_airport_country = '';
1063 1063
 		
1064 1064
             	
1065
-            	if ($squawk == '' || $Common->isInteger($squawk) === false ) $squawk = NULL;
1066
-            	if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) $verticalrate = NULL;
1067
-            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
1068
-            	if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
1065
+            	if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL;
1066
+            	if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL;
1067
+            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
1068
+            	if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
1069 1069
 		
1070 1070
 		$query = '';
1071 1071
 		if ($globalArchive) {
@@ -1076,19 +1076,19 @@  discard block
 block discarded – undo
1076 1076
 		$query  .= 'INSERT INTO spotter_live (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_shadow, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, 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, ModeS, pilot_id, pilot_name, verticalrate, ground, format_source, source_name, over_country) 
1077 1077
 		VALUES (:flightaware_id,:ident,:registration,:airline_name,:airline_icao,:airline_country,:airline_type,:aircraft_icao,:aircraft_shadow,: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,:ModeS, :pilot_id, :pilot_name, :verticalrate, :ground, :format_source, :source_name, :over_country)';
1078 1078
 
1079
-		$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_shadow' => $aircraft_shadow,':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,':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':format_source' => $format_source,':ground' => $ground, ':source_name' => $source_name, ':over_country' => $over_country);
1079
+		$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_shadow' => $aircraft_shadow, ':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, ':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':format_source' => $format_source, ':ground' => $ground, ':source_name' => $source_name, ':over_country' => $over_country);
1080 1080
 		try {
1081 1081
 			
1082 1082
 			$sth = $this->db->prepare($query);
1083 1083
 			$sth->execute($query_values);
1084 1084
 			$sth->closeCursor();
1085
-		} catch(PDOException $e) {
1085
+		} catch (PDOException $e) {
1086 1086
 			return "error : ".$e->getMessage();
1087 1087
 		}
1088 1088
 		if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) {
1089 1089
 		    if ($globalDebug) echo '(Add to SBS archive : ';
1090 1090
 		    $SpotterArchive = new SpotterArchive($this->db);
1091
-		    $result =  $SpotterArchive->addSpotterArchiveData($flightaware_id, $ident, $registration, $airline_name, $airline_icao, $airline_country, $airline_type, $aircraft_icao, $aircraft_shadow, $aircraft_name, $aircraft_manufacturer, $departure_airport_icao, $departure_airport_name, $departure_airport_city, $departure_airport_country, $departure_airport_time,$arrival_airport_icao, $arrival_airport_name, $arrival_airport_city, $arrival_airport_country, $arrival_airport_time, $route_stop, $date,$latitude, $longitude, $waypoints, $altitude, $heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name,$verticalrate,$format_source,$source_name, $over_country);
1091
+		    $result = $SpotterArchive->addSpotterArchiveData($flightaware_id, $ident, $registration, $airline_name, $airline_icao, $airline_country, $airline_type, $aircraft_icao, $aircraft_shadow, $aircraft_name, $aircraft_manufacturer, $departure_airport_icao, $departure_airport_name, $departure_airport_city, $departure_airport_country, $departure_airport_time, $arrival_airport_icao, $arrival_airport_name, $arrival_airport_city, $arrival_airport_country, $arrival_airport_time, $route_stop, $date, $latitude, $longitude, $waypoints, $altitude, $heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name, $verticalrate, $format_source, $source_name, $over_country);
1092 1092
 		    if ($globalDebug) echo $result.')';
1093 1093
 		}
1094 1094
 		return "success";
@@ -1097,7 +1097,7 @@  discard block
 block discarded – undo
1097 1097
 
1098 1098
 	public function getOrderBy()
1099 1099
 	{
1100
-		$orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY spotter_live.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY spotter_live.aircraft_icao DESC"),"manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY spotter_live.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY spotter_live.aircraft_manufacturer DESC"),"airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY spotter_live.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY spotter_live.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY spotter_live.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY spotter_live.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY spotter_live.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY spotter_live.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY spotter_live.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY spotter_live.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY spotter_live.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY spotter_live.date DESC"));
1100
+		$orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY spotter_live.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY spotter_live.aircraft_icao DESC"), "manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY spotter_live.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY spotter_live.aircraft_manufacturer DESC"), "airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY spotter_live.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY spotter_live.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY spotter_live.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY spotter_live.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY spotter_live.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY spotter_live.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY spotter_live.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY spotter_live.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY spotter_live.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY spotter_live.date DESC"));
1101 1101
 		return $orderby;
1102 1102
 	}
1103 1103
 
Please login to merge, or discard this patch.