Completed
Push — master ( b8e332...db2756 )
by Yannick
28:25
created
live-geojson.php 1 patch
Indentation   +67 added lines, -67 removed lines patch added patch discarded remove patch
@@ -14,23 +14,23 @@  discard block
 block discarded – undo
14 14
 $marine = false;
15 15
 $usecoord = false;
16 16
 if (isset($_GET['tracker'])) {
17
-    $tracker = true;
17
+	$tracker = true;
18 18
 }
19 19
 if (isset($_GET['marine'])) {
20
-    $marine = true;
20
+	$marine = true;
21 21
 }
22 22
 if ($tracker) {
23
-    require_once('require/class.Tracker.php');
24
-    require_once('require/class.TrackerLive.php');
25
-    require_once('require/class.TrackerArchive.php');
23
+	require_once('require/class.Tracker.php');
24
+	require_once('require/class.TrackerLive.php');
25
+	require_once('require/class.TrackerArchive.php');
26 26
 } elseif ($marine) {
27
-    require_once('require/class.Marine.php');
28
-    require_once('require/class.MarineLive.php');
29
-    require_once('require/class.MarineArchive.php');
27
+	require_once('require/class.Marine.php');
28
+	require_once('require/class.MarineLive.php');
29
+	require_once('require/class.MarineArchive.php');
30 30
 } else {
31
-    require_once('require/class.Spotter.php');
32
-    require_once('require/class.SpotterLive.php');
33
-    require_once('require/class.SpotterArchive.php');
31
+	require_once('require/class.Spotter.php');
32
+	require_once('require/class.SpotterLive.php');
33
+	require_once('require/class.SpotterArchive.php');
34 34
 }
35 35
 
36 36
 $begintime = microtime(true);
@@ -50,10 +50,10 @@  discard block
 block discarded – undo
50 50
 $Common = new Common();
51 51
 
52 52
 if (isset($_GET['download'])) {
53
-    if ($_GET['download'] == "true")
54
-    {
53
+	if ($_GET['download'] == "true")
54
+	{
55 55
 	header('Content-disposition: attachment; filename="flightairmap.json"');
56
-    }
56
+	}
57 57
 }
58 58
 header('Content-Type: text/javascript');
59 59
 
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 	$usecoord = true;
118 118
 	$coord = explode(',',$_GET['coord']);
119 119
 	if (filter_var($coord[0],FILTER_VALIDATE_FLOAT) && filter_var($coord[1],FILTER_VALIDATE_FLOAT) && filter_var($coord[2],FILTER_VALIDATE_FLOAT) && filter_var($coord[3],FILTER_VALIDATE_FLOAT) 
120
-	    && $coord[0] > -180.0 && $coord[0] < 180.0 && $coord[1] > -90.0 && $coord[1] < 90.0 && $coord[2] > -180.0 && $coord[2] < 180.0 && $coord[3] > -90.0 && $coord[3] < 90.0) {
120
+		&& $coord[0] > -180.0 && $coord[0] < 180.0 && $coord[1] > -90.0 && $coord[1] < 90.0 && $coord[2] > -180.0 && $coord[2] < 180.0 && $coord[3] > -90.0 && $coord[3] < 90.0) {
121 121
 		if ($tracker) {
122 122
 			$spotter_array = $TrackerLive->getLiveTrackerDatabyCoord($coord,$filter);
123 123
 		} elseif ($marine) {
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
 	$usecoord = true;
131 131
 	$coord = explode(',',$_GET['coord']);
132 132
 	if (filter_var($coord[0],FILTER_VALIDATE_FLOAT) && filter_var($coord[1],FILTER_VALIDATE_FLOAT) && filter_var($coord[2],FILTER_VALIDATE_FLOAT) && filter_var($coord[3],FILTER_VALIDATE_FLOAT) 
133
-	    && $coord[0] > -180.0 && $coord[0] < 180.0 && $coord[1] > -90.0 && $coord[1] < 90.0 && $coord[2] > -180.0 && $coord[2] < 180.0 && $coord[3] > -90.0 && $coord[3] < 90.0) {
133
+		&& $coord[0] > -180.0 && $coord[0] < 180.0 && $coord[1] > -90.0 && $coord[1] < 90.0 && $coord[2] > -180.0 && $coord[2] < 180.0 && $coord[3] > -90.0 && $coord[3] < 90.0) {
134 134
 		if ($tracker) {
135 135
 			$spotter_array = $TrackerLive->getMinLiveTrackerDatabyCoord($coord,$filter);
136 136
 		} elseif ($marine) {
@@ -634,17 +634,17 @@  discard block
 block discarded – undo
634 634
 				if ($history == '' && isset($_COOKIE['history'])) $history = $_COOKIE['history'];
635 635
 				
636 636
 				if (
637
-				    (isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true') 
638
-				    || ((isset($globalMapHistory) && $globalMapHistory) || $allhistory)
637
+					(isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true') 
638
+					|| ((isset($globalMapHistory) && $globalMapHistory) || $allhistory)
639 639
 				//    || (isset($history) && $history != '' && $history != 'NA' && ($history == $spotter_item['ident'] || $history == $spotter_item['flightaware_id']))
640 640
 				//    || (isset($history) && $history != '' && $history != 'NA' && $history == $spotter_item['ident'])
641
-				    || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id']))
642
-				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id'])
643
-				    || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['fammarine_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['fammarine_id']))
644
-				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['fammarine_id']) && $_GET['fammarine_id'] == $spotter_item['fammarine_id'])
645
-				    || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['famtrackid']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['famtrackid']))
646
-				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['famtrackid']) && $_GET['famtrackid'] == $spotter_item['famtrackid'])
647
-				    ) {
641
+					|| (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id']))
642
+					|| (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id'])
643
+					|| (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['fammarine_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['fammarine_id']))
644
+					|| (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['fammarine_id']) && $_GET['fammarine_id'] == $spotter_item['fammarine_id'])
645
+					|| (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['famtrackid']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['famtrackid']))
646
+					|| (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['famtrackid']) && $_GET['famtrackid'] == $spotter_item['famtrackid'])
647
+					) {
648 648
 					if ($tracker) {
649 649
 						if ($from_archive || $globalArchive) {
650 650
 							$spotter_history_array = $TrackerArchive->getAllArchiveTrackerDataById($spotter_item['famtrackid']);
@@ -652,7 +652,7 @@  discard block
 block discarded – undo
652 652
 							$spotter_history_array = $TrackerLive->getAllLiveTrackerDataById($spotter_item['famtrackid']);
653 653
 						}
654 654
 						if ($globalMapMatching === TRUE && isset($_GET['zoom']) && $_GET['zoom'] > 12 && 
655
-						    isset($spotter_item['type']) && (
655
+							isset($spotter_item['type']) && (
656 656
 							$spotter_item['type'] == 'Firetruck' ||
657 657
 							$spotter_item['type'] == 'Ambulance' ||
658 658
 							$spotter_item['type'] == 'Truck (18 Wheeler)' ||
@@ -664,7 +664,7 @@  discard block
 block discarded – undo
664 664
 							$spotter_item['type'] == 'Jeep' ||
665 665
 							$spotter_item['type'] == 'Motorcycle' ||
666 666
 							$spotter_item['type'] == 'Car'
667
-						    )
667
+							)
668 668
 						) {
669 669
 							require(dirname(__FILE__).'/require/class.MapMatching.php');
670 670
 							$MapMatching = new MapMatching();
@@ -753,65 +753,65 @@  discard block
 block discarded – undo
753 753
 				}
754 754
 				
755 755
 				if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id']))
756
-				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id']))
757
-				     && (isset($spotter_item['departure_airport']) 
758
-				        && $spotter_item['departure_airport'] != 'NA' 
759
-				        && isset($spotter_item['arrival_airport']) 
760
-				        && $spotter_item['arrival_airport'] != 'NA' 
761
-				        && ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") 
762
-				    	    || (!isset($_COOKIE['MapRoute']) && isset($globalMapRoute) && $globalMapRoute)))) {
763
-				    if ($compress) $output_air = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "route"},"geometry": {"type": "LineString","coordinates": [';
764
-				    else $output_air = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "route"},"geometry": {"type": "LineString","coordinates": [';
765
-				    if (isset($spotter_item['departure_airport_latitude'])) {
756
+					|| (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id']))
757
+					 && (isset($spotter_item['departure_airport']) 
758
+						&& $spotter_item['departure_airport'] != 'NA' 
759
+						&& isset($spotter_item['arrival_airport']) 
760
+						&& $spotter_item['arrival_airport'] != 'NA' 
761
+						&& ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") 
762
+							|| (!isset($_COOKIE['MapRoute']) && isset($globalMapRoute) && $globalMapRoute)))) {
763
+					if ($compress) $output_air = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "route"},"geometry": {"type": "LineString","coordinates": [';
764
+					else $output_air = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "route"},"geometry": {"type": "LineString","coordinates": [';
765
+					if (isset($spotter_item['departure_airport_latitude'])) {
766 766
 					$output_air .= '['.$spotter_item['departure_airport_longitude'].','.$spotter_item['departure_airport_latitude'].'],';
767
-				    } elseif (isset($spotter_item['departure_airport']) && $spotter_item['departure_airport'] != 'NA') {
767
+					} elseif (isset($spotter_item['departure_airport']) && $spotter_item['departure_airport'] != 'NA') {
768 768
 					$dairport = $Spotter->getAllAirportInfo($spotter_item['departure_airport']);
769 769
 					if (isset($dairport[0]['latitude'])) {
770
-					    $output_air .= '['.$dairport[0]['longitude'].','.$dairport[0]['latitude'].'],';
770
+						$output_air .= '['.$dairport[0]['longitude'].','.$dairport[0]['latitude'].'],';
771 771
 					}
772
-				    }
773
-				    if (isset($spotter_item['arrival_airport_latitude'])) {
772
+					}
773
+					if (isset($spotter_item['arrival_airport_latitude'])) {
774 774
 					$output_air .= '['.$spotter_item['arrival_airport_longitude'].','.$spotter_item['arrival_airport_latitude'].'],';
775
-				    } elseif (isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA') {
775
+					} elseif (isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA') {
776 776
 					$aairport = $Spotter->getAllAirportInfo($spotter_item['arrival_airport']);
777 777
 					if (isset($aairport[0]['latitude'])) {
778
-					    $output_air .= '['.$aairport[0]['longitude'].','.$aairport[0]['latitude'].'],';
778
+						$output_air .= '['.$aairport[0]['longitude'].','.$aairport[0]['latitude'].'],';
779 779
 					}
780
-				    }
781
-				    $output_air  = substr($output_air, 0, -1);
782
-				    $output_air .= ']}},';
783
-				    $output .= $output_air;
784
-				    unset($output_air);
780
+					}
781
+					$output_air  = substr($output_air, 0, -1);
782
+					$output_air .= ']}},';
783
+					$output .= $output_air;
784
+					unset($output_air);
785 785
 				}
786 786
 
787 787
 				//if (isset($history) && $history != '' && $history == $spotter_item['ident'] && isset($spotter_item['departure_airport']) && $spotter_item['departure_airport'] != 'NA' && isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA' && ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") || (!isset($_COOKIE['MapRoute']) && (!isset($globalMapRoute) || (isset($globalMapRoute) && $globalMapRoute))))) {
788 788
 				//if (isset($history) && $history != '' && $history == $spotter_item['ident'] && isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA' && ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") || (!isset($_COOKIE['MapRoute']) && (!isset($globalMapRoute) || (isset($globalMapRoute) && $globalMapRoute))))) {
789 789
 				if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id']))
790
-				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id']))
791
-				     && (isset($spotter_item['arrival_airport']) 
792
-				        && $spotter_item['arrival_airport'] != 'NA' 
793
-				        && ((isset($_COOKIE['MapRemainingRoute']) && $_COOKIE['MapRemainingRoute'] == "true") 
794
-				    	    || (!isset($_COOKIE['MapRemainaingRoute']) && (!isset($globalMapRemainingRoute) 
795
-				    	    || (isset($globalMapRemainingRoute) && $globalMapRemainingRoute)))))) {
796
-				    $havedata = false;
797
-				    if ($compress) $output_dest = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "routedest"},"geometry": {"type": "LineString","coordinates": [';
798
-				    else $output_dest = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "routedest"},"geometry": {"type": "LineString","coordinates": [';
799
-				    $output_dest .= '['.$spotter_item['longitude'].','.$spotter_item['latitude'].'],';
790
+					|| (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id']))
791
+					 && (isset($spotter_item['arrival_airport']) 
792
+						&& $spotter_item['arrival_airport'] != 'NA' 
793
+						&& ((isset($_COOKIE['MapRemainingRoute']) && $_COOKIE['MapRemainingRoute'] == "true") 
794
+							|| (!isset($_COOKIE['MapRemainaingRoute']) && (!isset($globalMapRemainingRoute) 
795
+							|| (isset($globalMapRemainingRoute) && $globalMapRemainingRoute)))))) {
796
+					$havedata = false;
797
+					if ($compress) $output_dest = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "routedest"},"geometry": {"type": "LineString","coordinates": [';
798
+					else $output_dest = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "routedest"},"geometry": {"type": "LineString","coordinates": [';
799
+					$output_dest .= '['.$spotter_item['longitude'].','.$spotter_item['latitude'].'],';
800 800
 
801
-				    if (isset($spotter_item['arrival_airport_latitude'])) {
801
+					if (isset($spotter_item['arrival_airport_latitude'])) {
802 802
 					$output_dest .= '['.$spotter_item['arrival_airport_longitude'].','.$spotter_item['arrival_airport_latitude'].']';
803 803
 					$havedata = true;
804
-				    } elseif (isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA') {
804
+					} elseif (isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA') {
805 805
 					$aairport = $Spotter->getAllAirportInfo($spotter_item['arrival_airport']);
806 806
 					if (isset($aairport[0]['latitude'])) {
807
-					    $output_dest .= '['.$aairport[0]['longitude'].','.$aairport[0]['latitude'].']';
808
-					    $havedata = true;
807
+						$output_dest .= '['.$aairport[0]['longitude'].','.$aairport[0]['latitude'].']';
808
+						$havedata = true;
809 809
 					}
810
-				    }
811
-				    //$output_dest  = substr($output_dest, 0, -1);
812
-				    $output_dest .= ']}},';
813
-				    if ($havedata) $output .= $output_dest;
814
-				    unset($output_dest);
810
+					}
811
+					//$output_dest  = substr($output_dest, 0, -1);
812
+					$output_dest .= ']}},';
813
+					if ($havedata) $output .= $output_dest;
814
+					unset($output_dest);
815 815
 				}
816 816
 			}
817 817
 			$output  = substr($output, 0, -1);
Please login to merge, or discard this patch.