Completed
Push — master ( 2874a1...1a51fc )
by Yannick
09:22
created
require/class.SpotterServer.php 1 patch
Indentation   +63 added lines, -63 removed lines patch added patch discarded remove patch
@@ -7,121 +7,121 @@
 block discarded – undo
7 7
 require_once(dirname(__FILE__).'/class.Translation.php');
8 8
 
9 9
 class SpotterServer {
10
-    public $dbs = null;
10
+	public $dbs = null;
11 11
     
12
-    function __construct($dbs = null) {
12
+	function __construct($dbs = null) {
13 13
 	if ($dbs === null) {
14
-	    $Connection = new Connection(null,'server');
15
-	    $this->dbs = $Connection->dbs;
16
-	    $query = "CREATE TABLE IF NOT EXISTS `spotter_temp` ( `id_data` INT NOT NULL AUTO_INCREMENT , `id_user` INT NOT NULL , `datetime` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP , `hex` VARCHAR(20) NOT NULL , `ident` VARCHAR(20) NULL , `latitude` FLOAT NULL , `longitude` FLOAT NULL , `verticalrate` INT NULL , `speed` INT NULL , `squawk` INT NULL , `altitude` INT NULL , `heading` INT NULL , `registration` VARCHAR(10) NULL , `aircraft_icao` VARCHAR(10) NULL , `waypoints` VARCHAR(255) NULL , `noarchive` BOOLEAN NOT NULL DEFAULT FALSE, `id_source` INT NOT NULL DEFAULT '1', `format_source` VARCHAR(25) NULL, `source_name` VARCHAR(25) NULL, `over_country` VARCHAR(255) NULL, PRIMARY KEY (`id_data`) ) ENGINE = MEMORY;";
17
-	    try {
14
+		$Connection = new Connection(null,'server');
15
+		$this->dbs = $Connection->dbs;
16
+		$query = "CREATE TABLE IF NOT EXISTS `spotter_temp` ( `id_data` INT NOT NULL AUTO_INCREMENT , `id_user` INT NOT NULL , `datetime` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP , `hex` VARCHAR(20) NOT NULL , `ident` VARCHAR(20) NULL , `latitude` FLOAT NULL , `longitude` FLOAT NULL , `verticalrate` INT NULL , `speed` INT NULL , `squawk` INT NULL , `altitude` INT NULL , `heading` INT NULL , `registration` VARCHAR(10) NULL , `aircraft_icao` VARCHAR(10) NULL , `waypoints` VARCHAR(255) NULL , `noarchive` BOOLEAN NOT NULL DEFAULT FALSE, `id_source` INT NOT NULL DEFAULT '1', `format_source` VARCHAR(25) NULL, `source_name` VARCHAR(25) NULL, `over_country` VARCHAR(255) NULL, PRIMARY KEY (`id_data`) ) ENGINE = MEMORY;";
17
+		try {
18 18
 		$sth = $this->dbs['server']->exec($query);
19
-	    } catch(PDOException $e) {
19
+		} catch(PDOException $e) {
20 20
 		return "error : ".$e->getMessage();
21
-	    }
21
+		}
22
+	}
22 23
 	}
23
-    }
24 24
     
25
-    function checkAll() {
26
-        return true;
27
-    }
25
+	function checkAll() {
26
+		return true;
27
+	}
28 28
     
29
-    function add($line) {
29
+	function add($line) {
30 30
 	global $globalDebug, $globalServerUserID;
31 31
 	date_default_timezone_set('UTC');
32 32
 	//if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'aprs')) {
33 33
 	if (isset($line['format_source'])) {
34
-	    if(is_array($line) && isset($line['hex'])) {
34
+		if(is_array($line) && isset($line['hex'])) {
35 35
 		if ($line['hex'] != '' && $line['hex'] != '00000' && $line['hex'] != '000000' && $line['hex'] != '111111' && ctype_xdigit($line['hex']) && strlen($line['hex']) === 6) {
36
-		    $data['hex'] = trim($line['hex']);
37
-		    if (preg_match('/^(\d{4}(?:\-\d{2}){2} \d{2}(?:\:\d{2}){2})$/',$line['datetime'])) {
38
-		        $data['datetime'] = $line['datetime'];
39
-		    } else $data['datetime'] = date('Y-m-d H:i:s');
40
-		    if (!isset($line['aircraft_icao'])) {
41
-		        $Spotter = new Spotter();
42
-		        $aircraft_icao = $Spotter->getAllAircraftType($data['hex']);
43
-		        $Spotter->db = null;
36
+			$data['hex'] = trim($line['hex']);
37
+			if (preg_match('/^(\d{4}(?:\-\d{2}){2} \d{2}(?:\:\d{2}){2})$/',$line['datetime'])) {
38
+				$data['datetime'] = $line['datetime'];
39
+			} else $data['datetime'] = date('Y-m-d H:i:s');
40
+			if (!isset($line['aircraft_icao'])) {
41
+				$Spotter = new Spotter();
42
+				$aircraft_icao = $Spotter->getAllAircraftType($data['hex']);
43
+				$Spotter->db = null;
44 44
 			if ($aircraft_icao == '' && isset($line['aircraft_type'])) {
45
-			    if ($line['aircraft_type'] == 'PARA_GLIDER') $aircraft_icao = 'GLID';
46
-			    elseif ($line['aircraft_type'] == 'HELICOPTER_ROTORCRAFT') $aircraft_icao = 'UHEL';
47
-			    elseif ($line['aircraft_type'] == 'TOW_PLANE') $aircraft_icao = 'TOWPLANE';
48
-			    elseif ($line['aircraft_type'] == 'POWERED_AIRCRAFT') $aircraft_icao = 'POWAIRC';
45
+				if ($line['aircraft_type'] == 'PARA_GLIDER') $aircraft_icao = 'GLID';
46
+				elseif ($line['aircraft_type'] == 'HELICOPTER_ROTORCRAFT') $aircraft_icao = 'UHEL';
47
+				elseif ($line['aircraft_type'] == 'TOW_PLANE') $aircraft_icao = 'TOWPLANE';
48
+				elseif ($line['aircraft_type'] == 'POWERED_AIRCRAFT') $aircraft_icao = 'POWAIRC';
49 49
 			}
50 50
 			$data['aircraft_icao'] = $aircraft_icao;
51
-		    } else $data['aircraft_icao'] = $line['aircraft_icao'];
52
-		    //if ($globalDebug) echo "*********** New aircraft hex : ".$data['hex']." ***********\n";
51
+			} else $data['aircraft_icao'] = $line['aircraft_icao'];
52
+			//if ($globalDebug) echo "*********** New aircraft hex : ".$data['hex']." ***********\n";
53 53
 		}
54 54
 		if (isset($line['registration']) && $line['registration'] != '') {
55
-		    $data['registration'] = $line['registration'];
55
+			$data['registration'] = $line['registration'];
56 56
 		} else $data['registration'] = null;
57 57
 		if (isset($line['waypoints']) && $line['waypoints'] != '') {
58
-		    $data['waypoints'] = $line['waypoints'];
58
+			$data['waypoints'] = $line['waypoints'];
59 59
 		} else $data['waypoints'] = null;
60 60
 		if (isset($line['ident']) && $line['ident'] != '' && $line['ident'] != '????????' && $line['ident'] != '00000000' && preg_match('/^[a-zA-Z0-9]+$/', $line['ident'])) {
61
-		    $data['ident'] = trim($line['ident']);
61
+			$data['ident'] = trim($line['ident']);
62 62
 		} else $data['ident'] = null;
63 63
 
64
-	        if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '') {
65
-		    if (isset($line['latitude']) && $line['latitude'] != '' && $line['latitude'] != 0 && $line['latitude'] < 91 && $line['latitude'] > -90) {
64
+			if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '') {
65
+			if (isset($line['latitude']) && $line['latitude'] != '' && $line['latitude'] != 0 && $line['latitude'] < 91 && $line['latitude'] > -90) {
66 66
 			$data['latitude'] = $line['latitude'];
67
-		    } else $data['latitude'] = null;
68
-		    if (isset($line['longitude']) && $line['longitude'] != '' && $line['longitude'] != 0 && $line['longitude'] < 360 && $line['longitude'] > -180) {
69
-		        if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360;
67
+			} else $data['latitude'] = null;
68
+			if (isset($line['longitude']) && $line['longitude'] != '' && $line['longitude'] != 0 && $line['longitude'] < 360 && $line['longitude'] > -180) {
69
+				if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360;
70 70
 			$data['longitude'] = $line['longitude'];
71
-		    } else $data['longitude'] = null;
71
+			} else $data['longitude'] = null;
72 72
 		} else {
73
-		    $data['latitude'] = null;
74
-		    $data['longitude'] = null;
73
+			$data['latitude'] = null;
74
+			$data['longitude'] = null;
75 75
 		}
76 76
 		if (isset($line['verticalrate']) && $line['verticalrate'] != '') {
77
-		    $data['verticalrate'] = $line['verticalrate'];
77
+			$data['verticalrate'] = $line['verticalrate'];
78 78
 		} else $data['verticalrate'] = null;
79 79
 		if (isset($line['emergency']) && $line['emergency'] != '') {
80
-		    $data['emergency'] = $line['emergency'];
80
+			$data['emergency'] = $line['emergency'];
81 81
 		} else $data['emergency'] = null;
82 82
 		if (isset($line['ground']) && $line['ground'] != '') {
83
-		    $data['ground'] = $line['ground'];
83
+			$data['ground'] = $line['ground'];
84 84
 		} else $data['ground'] = null;
85 85
 		if (isset($line['speed']) && $line['speed'] != '') {
86
-		    $data['speed'] = round($line['speed']);
86
+			$data['speed'] = round($line['speed']);
87 87
 		} else $data['speed'] = null;
88 88
 		if (isset($line['squawk']) && $line['squawk'] != '') {
89
-		    $data['squawk'] = $line['squawk'];
89
+			$data['squawk'] = $line['squawk'];
90 90
 		} else $data['squawk'] = null;
91 91
 
92 92
 		if (isset($line['altitude']) && $line['altitude'] != '') {
93 93
 			$data['altitude'] = round($line['altitude']);
94 94
   		} else $data['altitude'] = null;
95 95
 		if (isset($line['heading']) && $line['heading'] != '') {
96
-		    $data['heading'] = round($line['heading']);
96
+			$data['heading'] = round($line['heading']);
97 97
   		} else $data['heading'] = null;
98 98
 		if (isset($line['source_name']) && $line['source_name'] != '') {
99
-		    $data['source_name'] = $line['source_name'];
99
+			$data['source_name'] = $line['source_name'];
100 100
   		} else $data['source_name'] = null;
101 101
 		if (isset($line['over_country']) && $line['over_country'] != '') {
102
-		    $data['over_country'] = $line['over_country'];
102
+			$data['over_country'] = $line['over_country'];
103 103
   		} else $data['over_country'] = null;
104 104
   		if (isset($line['noarchive']) && $line['noarchive']) {
105
-  		    $data['noarchive'] = true;
105
+  			$data['noarchive'] = true;
106 106
   		} else $data['noarchive'] = false;
107 107
   		$data['format_source'] = $line['format_source'];
108 108
   		if (isset($line['id_source'])) $id_source = $line['id_source'];
109 109
   		if (isset($data['hex'])) {
110
-  		    echo '.';
111
-  		    $id_user = $globalServerUserID;
112
-  		    if ($id_user == NULL) $id_user = 1;
113
-  		    if (!isset($id_source)) $id_source = 1;
114
-  		    $query = 'INSERT INTO spotter_temp (id_user,datetime,hex,ident,latitude,longitude,verticalrate,speed,squawk,altitude,heading,registration,aircraft_icao,waypoints,id_source,noarchive,format_source,source_name,over_country) VALUES (:id_user,:datetime,:hex,:ident,:latitude,:longitude,:verticalrate,:speed,:squawk,:altitude,:heading,:registration,:aircraft_icao,:waypoints,:id_source,:noarchive, :format_source, :source_name, :over_country)';
115
-		    $query_values = array(':id_user' => $id_user,':datetime' => $data['datetime'],':hex' => $data['hex'],':ident' => $data['ident'],':latitude' => $data['latitude'],':longitude' => $data['longitude'],':verticalrate' => $data['verticalrate'],':speed' => $data['speed'],':squawk' => $data['squawk'],':altitude' => $data['altitude'],':heading' => $data['heading'],':registration' => $data['registration'],':aircraft_icao' => $data['aircraft_icao'],':waypoints' => $data['waypoints'],':id_source' => $id_source,':noarchive' => $data['noarchive'], ':format_source' => $data['format_source'], ':source_name' => $data['source_name'],':over_country' => $data['over_country']);
116
-		    try {
117
-                        $sth = $this->dbs['server']->prepare($query);
118
-                        $sth->execute($query_values);
119
-                    } catch(PDOException $e) {
120
-                        return "error : ".$e->getMessage();
121
-            	    }
122
-        	}
123
-    	    }
110
+  			echo '.';
111
+  			$id_user = $globalServerUserID;
112
+  			if ($id_user == NULL) $id_user = 1;
113
+  			if (!isset($id_source)) $id_source = 1;
114
+  			$query = 'INSERT INTO spotter_temp (id_user,datetime,hex,ident,latitude,longitude,verticalrate,speed,squawk,altitude,heading,registration,aircraft_icao,waypoints,id_source,noarchive,format_source,source_name,over_country) VALUES (:id_user,:datetime,:hex,:ident,:latitude,:longitude,:verticalrate,:speed,:squawk,:altitude,:heading,:registration,:aircraft_icao,:waypoints,:id_source,:noarchive, :format_source, :source_name, :over_country)';
115
+			$query_values = array(':id_user' => $id_user,':datetime' => $data['datetime'],':hex' => $data['hex'],':ident' => $data['ident'],':latitude' => $data['latitude'],':longitude' => $data['longitude'],':verticalrate' => $data['verticalrate'],':speed' => $data['speed'],':squawk' => $data['squawk'],':altitude' => $data['altitude'],':heading' => $data['heading'],':registration' => $data['registration'],':aircraft_icao' => $data['aircraft_icao'],':waypoints' => $data['waypoints'],':id_source' => $id_source,':noarchive' => $data['noarchive'], ':format_source' => $data['format_source'], ':source_name' => $data['source_name'],':over_country' => $data['over_country']);
116
+			try {
117
+						$sth = $this->dbs['server']->prepare($query);
118
+						$sth->execute($query_values);
119
+					} catch(PDOException $e) {
120
+						return "error : ".$e->getMessage();
121
+					}
122
+			}
123
+			}
124
+	}
124 125
 	}
125
-    }
126 126
 }
127 127
 ?>
Please login to merge, or discard this patch.
search-json.php 1 patch
Indentation   +81 added lines, -81 removed lines patch added patch discarded remove patch
@@ -4,55 +4,55 @@  discard block
 block discarded – undo
4 4
 require_once('require/class.Language.php');
5 5
 $Spotter = new Spotter();
6 6
 if (isset($_GET['start_date'])) {
7
-        //for the date manipulation into the query
8
-        if($_GET['start_date'] != "" && $_GET['end_date'] != ""){
9
-                $start_date = $_GET['start_date'].":00";
10
-                $end_date = $_GET['end_date'].":00";
11
-                $sql_date = $start_date.",".$end_date;
12
-        } else if($_GET['start_date'] != ""){
13
-                $start_date = $_GET['start_date'].":00";
14
-                $sql_date = $start_date;
15
-        } else if($_GET['start_date'] == "" && $_GET['end_date'] != ""){
16
-                $end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")).",".$_GET['end_date'].":00";
17
-                $sql_date = $end_date;
18
-        } else $sql_date = '';
7
+		//for the date manipulation into the query
8
+		if($_GET['start_date'] != "" && $_GET['end_date'] != ""){
9
+				$start_date = $_GET['start_date'].":00";
10
+				$end_date = $_GET['end_date'].":00";
11
+				$sql_date = $start_date.",".$end_date;
12
+		} else if($_GET['start_date'] != ""){
13
+				$start_date = $_GET['start_date'].":00";
14
+				$sql_date = $start_date;
15
+		} else if($_GET['start_date'] == "" && $_GET['end_date'] != ""){
16
+				$end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")).",".$_GET['end_date'].":00";
17
+				$sql_date = $end_date;
18
+		} else $sql_date = '';
19 19
 } else $sql_date = '';
20 20
 
21 21
 if (isset($_GET['highest_altitude'])) {
22
-        //for altitude manipulation
23
-        if($_GET['highest_altitude'] != "" && $_GET['lowest_altitude'] != ""){
24
-                $end_altitude = $_GET['highest_altitude'];
25
-                $start_altitude = $_GET['lowest_altitude'];
26
-                $sql_altitude = $start_altitude.",".$end_altitude;
27
-        } else if($_GET['highest_altitude'] != ""){
28
-                $end_altitude = $_GET['highest_altitude'];
29
-                $sql_altitude = $end_altitude;
30
-        } else if($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != ""){
31
-                $start_altitude = $_GET['lowest_altitude'].",60000";
32
-                $sql_altitude = $start_altitude;
33
-        } else $sql_altitude = '';
22
+		//for altitude manipulation
23
+		if($_GET['highest_altitude'] != "" && $_GET['lowest_altitude'] != ""){
24
+				$end_altitude = $_GET['highest_altitude'];
25
+				$start_altitude = $_GET['lowest_altitude'];
26
+				$sql_altitude = $start_altitude.",".$end_altitude;
27
+		} else if($_GET['highest_altitude'] != ""){
28
+				$end_altitude = $_GET['highest_altitude'];
29
+				$sql_altitude = $end_altitude;
30
+		} else if($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != ""){
31
+				$start_altitude = $_GET['lowest_altitude'].",60000";
32
+				$sql_altitude = $start_altitude;
33
+		} else $sql_altitude = '';
34 34
 } else $sql_altitude = '';
35 35
 
36 36
 //calculuation for the pagination
37 37
 if(!isset($_GET['limit']))
38 38
 {
39
-        if (!isset($_GET['number_results']))
40
-        {
41
-                $limit_start = 0;
42
-                $limit_end = 25;
43
-                $absolute_difference = 25;
44
-        } else {
45
-                if ($_GET['number_results'] > 1000){
46
-                        $_GET['number_results'] = 1000;
47
-                }
48
-                $limit_start = 0;
49
-                $limit_end = $_GET['number_results'];
50
-                $absolute_difference = $_GET['number_results'];
51
-        }
39
+		if (!isset($_GET['number_results']))
40
+		{
41
+				$limit_start = 0;
42
+				$limit_end = 25;
43
+				$absolute_difference = 25;
44
+		} else {
45
+				if ($_GET['number_results'] > 1000){
46
+						$_GET['number_results'] = 1000;
47
+				}
48
+				$limit_start = 0;
49
+				$limit_end = $_GET['number_results'];
50
+				$absolute_difference = $_GET['number_results'];
51
+		}
52 52
 }  else {
53
-        $limit_explode = explode(",", $_GET['limit']);
54
-        $limit_start = $limit_explode[0];
55
-        $limit_end = $limit_explode[1];
53
+		$limit_explode = explode(",", $_GET['limit']);
54
+		$limit_start = $limit_explode[0];
55
+		$limit_end = $limit_explode[1];
56 56
 }
57 57
 
58 58
 $absolute_difference = abs($limit_start - $limit_end);
@@ -89,52 +89,52 @@  discard block
 block discarded – undo
89 89
        
90 90
 $output = '{';
91 91
   $output .= '"flightairmap": {';
92
-    $output .= '"title": "FlightAirMap JSON Feed",';
93
-    $output .= '"link": "http://www.flightairmap.fr",';
94
-    $output .= '"aircraft": [';
92
+	$output .= '"title": "FlightAirMap JSON Feed",';
93
+	$output .= '"link": "http://www.flightairmap.fr",';
94
+	$output .= '"aircraft": [';
95 95
     
96
-    if (!empty($spotter_array))
96
+	if (!empty($spotter_array))
97 97
 	  {
98
-	    foreach($spotter_array as $spotter_item)
99
-	    {
98
+		foreach($spotter_array as $spotter_item)
99
+		{
100 100
 				
101 101
 				$output .= '{';    	
102
-		            $output .= '"id": "'.$spotter_item['spotter_id'].'",';
103
-                    $output .= '"ident": "'.$spotter_item['ident'].'",';
104
-                    $output .= '"registration": "'.$spotter_item['registration'].'",';
105
-                    $output .= '"aircraft_icao": "'.$spotter_item['aircraft_type'].'",';
106
-                    $output .= '"aircraft_name": "'.$spotter_item['aircraft_name'].'",';
107
-                    $output .= '"aircraft_manufacturer": "'.$spotter_item['aircraft_manufacturer'].'",';
108
-                    $output .= '"airline_name": "'.$spotter_item['airline_name'].'",';
109
-                    $output .= '"airline_icao": "'.$spotter_item['airline_icao'].'",';
110
-                    $output .= '"airline_iata": "'.$spotter_item['airline_iata'].'",';
111
-                    $output .= '"airline_country": "'.$spotter_item['airline_country'].'",';
112
-                    $output .= '"airline_callsign": "'.$spotter_item['airline_callsign'].'",';
113
-                    $output .= '"airline_type": "'.$spotter_item['airline_type'].'",';
114
-                    $output .= '"departure_airport_city": "'.$spotter_item['departure_airport_city'].'",';
115
-                    $output .= '"departure_airport_country": "'.$spotter_item['departure_airport_country'].'",';
116
-                    $output .= '"departure_airport_iata": "'.$spotter_item['departure_airport_iata'].'",';
117
-                    $output .= '"departure_airport_icao": "'.$spotter_item['departure_airport_icao'].'",';
118
-                    $output .= '"departure_airport_latitude": "'.$spotter_item['departure_airport_latitude'].'",';
119
-                    $output .= '"departure_airport_longitude": "'.$spotter_item['departure_airport_longitude'].'",';
120
-                    $output .= '"departure_airport_altitude": "'.$spotter_item['departure_airport_altitude'].'",'; 
121
-                    $output .= '"arrival_airport_city": "'.$spotter_item['arrival_airport_city'].'",';
122
-                    $output .= '"arrival_airport_country": "'.$spotter_item['arrival_airport_country'].'",';
123
-                    $output .= '"arrival_airport_iata": "'.$spotter_item['arrival_airport_iata'].'",';
124
-                    $output .= '"departure_airport_icao": "'.$spotter_item['arrival_airport_icao'].'",';
125
-                    $output .= '"arrival_airport_latitude": "'.$spotter_item['arrival_airport_latitude'].'",';
126
-                    $output .= '"arrival_airport_longitude": "'.$spotter_item['arrival_airport_longitude'].'",';
127
-                    $output .= '"arrival_airport_altitude": "'.$spotter_item['arrival_airport_altitude'].'",';
128
-                    $output .= '"latitude": "'.$spotter_item['latitude'].'",';
129
-                    $output .= '"longitude": "'.$spotter_item['longitude'].'",';
130
-                    $output .= '"altitude": "'.$spotter_item['altitude'].'",';
131
-                    $output .= '"ground_speed": "'.$spotter_item['ground_speed'].'",';
132
-                    $output .= '"heading": "'.$spotter_item['heading'].'",';
133
-                    $output .= '"heading_name": "'.$spotter_item['heading_name'].'",';
134
-                    $output .= '"waypoints": "'.$spotter_item['waypoints'].'",';
135
-                    $output .= '"date": "'.date("c", strtotime($spotter_item['date_iso_8601'])).'"';
102
+					$output .= '"id": "'.$spotter_item['spotter_id'].'",';
103
+					$output .= '"ident": "'.$spotter_item['ident'].'",';
104
+					$output .= '"registration": "'.$spotter_item['registration'].'",';
105
+					$output .= '"aircraft_icao": "'.$spotter_item['aircraft_type'].'",';
106
+					$output .= '"aircraft_name": "'.$spotter_item['aircraft_name'].'",';
107
+					$output .= '"aircraft_manufacturer": "'.$spotter_item['aircraft_manufacturer'].'",';
108
+					$output .= '"airline_name": "'.$spotter_item['airline_name'].'",';
109
+					$output .= '"airline_icao": "'.$spotter_item['airline_icao'].'",';
110
+					$output .= '"airline_iata": "'.$spotter_item['airline_iata'].'",';
111
+					$output .= '"airline_country": "'.$spotter_item['airline_country'].'",';
112
+					$output .= '"airline_callsign": "'.$spotter_item['airline_callsign'].'",';
113
+					$output .= '"airline_type": "'.$spotter_item['airline_type'].'",';
114
+					$output .= '"departure_airport_city": "'.$spotter_item['departure_airport_city'].'",';
115
+					$output .= '"departure_airport_country": "'.$spotter_item['departure_airport_country'].'",';
116
+					$output .= '"departure_airport_iata": "'.$spotter_item['departure_airport_iata'].'",';
117
+					$output .= '"departure_airport_icao": "'.$spotter_item['departure_airport_icao'].'",';
118
+					$output .= '"departure_airport_latitude": "'.$spotter_item['departure_airport_latitude'].'",';
119
+					$output .= '"departure_airport_longitude": "'.$spotter_item['departure_airport_longitude'].'",';
120
+					$output .= '"departure_airport_altitude": "'.$spotter_item['departure_airport_altitude'].'",'; 
121
+					$output .= '"arrival_airport_city": "'.$spotter_item['arrival_airport_city'].'",';
122
+					$output .= '"arrival_airport_country": "'.$spotter_item['arrival_airport_country'].'",';
123
+					$output .= '"arrival_airport_iata": "'.$spotter_item['arrival_airport_iata'].'",';
124
+					$output .= '"departure_airport_icao": "'.$spotter_item['arrival_airport_icao'].'",';
125
+					$output .= '"arrival_airport_latitude": "'.$spotter_item['arrival_airport_latitude'].'",';
126
+					$output .= '"arrival_airport_longitude": "'.$spotter_item['arrival_airport_longitude'].'",';
127
+					$output .= '"arrival_airport_altitude": "'.$spotter_item['arrival_airport_altitude'].'",';
128
+					$output .= '"latitude": "'.$spotter_item['latitude'].'",';
129
+					$output .= '"longitude": "'.$spotter_item['longitude'].'",';
130
+					$output .= '"altitude": "'.$spotter_item['altitude'].'",';
131
+					$output .= '"ground_speed": "'.$spotter_item['ground_speed'].'",';
132
+					$output .= '"heading": "'.$spotter_item['heading'].'",';
133
+					$output .= '"heading_name": "'.$spotter_item['heading_name'].'",';
134
+					$output .= '"waypoints": "'.$spotter_item['waypoints'].'",';
135
+					$output .= '"date": "'.date("c", strtotime($spotter_item['date_iso_8601'])).'"';
136 136
 				$output .= '},';
137
-	    }
137
+		}
138 138
 	   }
139 139
 	   $output  = substr($output, 0, -1);
140 140
 		 $output .= ']';
Please login to merge, or discard this patch.
scripts/cron.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -11,12 +11,12 @@
 block discarded – undo
11 11
 //checks to see if FlightAware import is set
12 12
 if ($globalFlightAware == TRUE)
13 13
 {
14
-    $SpotterLive = new SpotterLive();
15
-    $Spotter = new Spotter();
16
-    //deletes the spotter LIVE data
17
-    $SpotterLive->deleteLiveSpotterData();
14
+	$SpotterLive = new SpotterLive();
15
+	$Spotter = new Spotter();
16
+	//deletes the spotter LIVE data
17
+	$SpotterLive->deleteLiveSpotterData();
18 18
     
19
-    //imports the new data from FlightAware
20
-    $Spotter->importFromFlightAware();
19
+	//imports the new data from FlightAware
20
+	$Spotter->importFromFlightAware();
21 21
 }
22 22
 ?>
23 23
\ No newline at end of file
Please login to merge, or discard this patch.
scripts/check_data.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -5,8 +5,8 @@
 block discarded – undo
5 5
 */
6 6
 require_once(dirname(__FILE__).'/../require/settings.php');
7 7
 if ($globalInstalled) {
8
-    echo '$globalInstalled must be set to FALSE in require/settings.php';
9
-    exit;
8
+	echo '$globalInstalled must be set to FALSE in require/settings.php';
9
+	exit;
10 10
 }
11 11
 
12 12
 require_once('../require/class.Connection.php');
Please login to merge, or discard this patch.
scripts/daemon-acars.php 1 patch
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -11,8 +11,8 @@  discard block
 block discarded – undo
11 11
 require_once(dirname(__FILE__).'/../require/class.Connection.php');
12 12
 $schema = new Connection();
13 13
 if ($schema->latest() === false) {
14
-    echo "You MUST update to latest schema. Run install/index.php";
15
-    exit();
14
+	echo "You MUST update to latest schema. Run install/index.php";
15
+	exit();
16 16
 }
17 17
 
18 18
 $debug = true;
@@ -21,11 +21,11 @@  discard block
 block discarded – undo
21 21
 date_default_timezone_set('UTC');
22 22
 // signal handler - playing nice with sockets and dump1090
23 23
 pcntl_signal(SIGINT,  function($signo) {
24
-    global $sock;
25
-    echo "\n\nctrl-c or kill signal received. Tidying up ... ";
26
-    socket_shutdown($sock, 0);
27
-    socket_close($sock);
28
-    die("Bye!\n");
24
+	global $sock;
25
+	echo "\n\nctrl-c or kill signal received. Tidying up ... ";
26
+	socket_shutdown($sock, 0);
27
+	socket_close($sock);
28
+	die("Bye!\n");
29 29
 });
30 30
 pcntl_signal_dispatch();
31 31
 
@@ -38,24 +38,24 @@  discard block
 block discarded – undo
38 38
 // Bind the source address
39 39
 if( !socket_bind($sock, $globalACARSHost , $globalACARSPort) )
40 40
 {
41
-    $errorcode = socket_last_error();
42
-    $errormsg = socket_strerror($errorcode);
41
+	$errorcode = socket_last_error();
42
+	$errormsg = socket_strerror($errorcode);
43 43
      
44
-    die("Could not bind socket : [$errorcode] $errormsg \n");
44
+	die("Could not bind socket : [$errorcode] $errormsg \n");
45 45
 }
46 46
 
47 47
 echo "LISTEN UDP MODE \n\n";
48 48
 while(1) {
49
-    $r = socket_recvfrom($sock, $buffer, 512, 0, $remote_ip, $remote_port);
50
-
51
-    // lets play nice and handle signals such as ctrl-c/kill properly
52
-    pcntl_signal_dispatch();
53
-    $dataFound = false;
54
-    //  (null) 2 23/02/2015 14:46:06 0 -16 X .D-AIPW ! 1L 7 M82A LH077P 010952342854:VP-MIBI+W+0)-V+(),GB1
55
-    echo $buffer."\n";
56
-    $ACARS->add(trim($buffer));
57
-    socket_sendto($sock, "OK " . $buffer , 100 , 0 , $remote_ip , $remote_port);
58
-    $ACARS->deleteLiveAcarsData();
49
+	$r = socket_recvfrom($sock, $buffer, 512, 0, $remote_ip, $remote_port);
50
+
51
+	// lets play nice and handle signals such as ctrl-c/kill properly
52
+	pcntl_signal_dispatch();
53
+	$dataFound = false;
54
+	//  (null) 2 23/02/2015 14:46:06 0 -16 X .D-AIPW ! 1L 7 M82A LH077P 010952342854:VP-MIBI+W+0)-V+(),GB1
55
+	echo $buffer."\n";
56
+	$ACARS->add(trim($buffer));
57
+	socket_sendto($sock, "OK " . $buffer , 100 , 0 , $remote_ip , $remote_port);
58
+	$ACARS->deleteLiveAcarsData();
59 59
 }
60 60
 pcntl_exec($_,$argv);
61 61
 ?>
Please login to merge, or discard this patch.
search-geojson.php 1 patch
Indentation   +126 added lines, -126 removed lines patch added patch discarded remove patch
@@ -4,55 +4,55 @@  discard block
 block discarded – undo
4 4
 require_once('require/class.Language.php');
5 5
 $Spotter=new Spotter();
6 6
 if (isset($_GET['start_date'])) {
7
-        //for the date manipulation into the query
8
-        if($_GET['start_date'] != "" && $_GET['end_date'] != ""){
9
-                $start_date = $_GET['start_date'].":00";
10
-                $end_date = $_GET['end_date'].":00";
11
-                $sql_date = $start_date.",".$end_date;
12
-        } else if($_GET['start_date'] != ""){
13
-                $start_date = $_GET['start_date'].":00";
14
-                $sql_date = $start_date;
15
-        } else if($_GET['start_date'] == "" && $_GET['end_date'] != ""){
16
-                $end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")).",".$_GET['end_date'].":00";
17
-                $sql_date = $end_date;
18
-        } else $sql_date = '';
7
+		//for the date manipulation into the query
8
+		if($_GET['start_date'] != "" && $_GET['end_date'] != ""){
9
+				$start_date = $_GET['start_date'].":00";
10
+				$end_date = $_GET['end_date'].":00";
11
+				$sql_date = $start_date.",".$end_date;
12
+		} else if($_GET['start_date'] != ""){
13
+				$start_date = $_GET['start_date'].":00";
14
+				$sql_date = $start_date;
15
+		} else if($_GET['start_date'] == "" && $_GET['end_date'] != ""){
16
+				$end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")).",".$_GET['end_date'].":00";
17
+				$sql_date = $end_date;
18
+		} else $sql_date = '';
19 19
 } else $sql_date = '';
20 20
 
21 21
 if (isset($_GET['highest_altitude'])) {
22
-        //for altitude manipulation
23
-        if($_GET['highest_altitude'] != "" && $_GET['lowest_altitude'] != ""){
24
-                $end_altitude = $_GET['highest_altitude'];
25
-                $start_altitude = $_GET['lowest_altitude'];
26
-                $sql_altitude = $start_altitude.",".$end_altitude;
27
-        } else if($_GET['highest_altitude'] != ""){
28
-                $end_altitude = $_GET['highest_altitude'];
29
-                $sql_altitude = $end_altitude;
30
-        } else if($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != ""){
31
-                $start_altitude = $_GET['lowest_altitude'].",60000";
32
-                $sql_altitude = $start_altitude;
33
-        } else $sql_altitude = '';
22
+		//for altitude manipulation
23
+		if($_GET['highest_altitude'] != "" && $_GET['lowest_altitude'] != ""){
24
+				$end_altitude = $_GET['highest_altitude'];
25
+				$start_altitude = $_GET['lowest_altitude'];
26
+				$sql_altitude = $start_altitude.",".$end_altitude;
27
+		} else if($_GET['highest_altitude'] != ""){
28
+				$end_altitude = $_GET['highest_altitude'];
29
+				$sql_altitude = $end_altitude;
30
+		} else if($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != ""){
31
+				$start_altitude = $_GET['lowest_altitude'].",60000";
32
+				$sql_altitude = $start_altitude;
33
+		} else $sql_altitude = '';
34 34
 } else $sql_altitude = '';
35 35
 
36 36
 //calculuation for the pagination
37 37
 if(!isset($_GET['limit']))
38 38
 {
39
-        if (!isset($_GET['number_results']))
40
-        {
41
-                $limit_start = 0;
42
-                $limit_end = 25;
43
-                $absolute_difference = 25;
44
-        } else {
45
-                if ($_GET['number_results'] > 1000){
46
-                        $_GET['number_results'] = 1000;
47
-                }
48
-                $limit_start = 0;
49
-                $limit_end = $_GET['number_results'];
50
-                $absolute_difference = $_GET['number_results'];
51
-        }
39
+		if (!isset($_GET['number_results']))
40
+		{
41
+				$limit_start = 0;
42
+				$limit_end = 25;
43
+				$absolute_difference = 25;
44
+		} else {
45
+				if ($_GET['number_results'] > 1000){
46
+						$_GET['number_results'] = 1000;
47
+				}
48
+				$limit_start = 0;
49
+				$limit_end = $_GET['number_results'];
50
+				$absolute_difference = $_GET['number_results'];
51
+		}
52 52
 }  else {
53
-        $limit_explode = explode(",", $_GET['limit']);
54
-        $limit_start = $limit_explode[0];
55
-        $limit_end = $limit_explode[1];
53
+		$limit_explode = explode(",", $_GET['limit']);
54
+		$limit_start = $limit_explode[0];
55
+		$limit_end = $limit_explode[1];
56 56
 }
57 57
 
58 58
 $absolute_difference = abs($limit_start - $limit_end);
@@ -90,69 +90,69 @@  discard block
 block discarded – undo
90 90
       
91 91
 $output = '{';
92 92
 	$output .= '"type": "FeatureCollection",';
93
-    $output .= '"features": [';
93
+	$output .= '"features": [';
94 94
             
95 95
     
96
-    if (!empty($spotter_array))
96
+	if (!empty($spotter_array))
97 97
 	  {	  
98
-	    foreach($spotter_array as $spotter_item)
99
-	    {
98
+		foreach($spotter_array as $spotter_item)
99
+		{
100 100
 				
101 101
 				
102 102
 				//waypoint plotting
103 103
 				$output .= '{';  
104 104
 					$output .= '"type": "Feature",';
105
-	      		$output .= '"properties": {';
106
-	          	    $output .= '"id": "'.$spotter_item['spotter_id'].'",';
107
-                    $output .= '"ident": "'.$spotter_item['ident'].'",';
108
-                    $output .= '"registration": "'.$spotter_item['registration'].'",';
109
-                    $output .= '"aircraft_icao": "'.$spotter_item['aircraft_type'].'",';
110
-                    $output .= '"aircraft_name": "'.$spotter_item['aircraft_name'].'",';
111
-                    $output .= '"aircraft_manufacturer": "'.$spotter_item['aircraft_manufacturer'].'",';
112
-                    $output .= '"airline_name": "'.$spotter_item['airline_name'].'",';
113
-                    $output .= '"airline_icao": "'.$spotter_item['airline_icao'].'",';
114
-                    $output .= '"airline_iata": "'.$spotter_item['airline_iata'].'",';
115
-                    $output .= '"airline_country": "'.$spotter_item['airline_country'].'",';
116
-                    $output .= '"airline_callsign": "'.$spotter_item['airline_callsign'].'",';
117
-                    $output .= '"airline_type": "'.$spotter_item['airline_type'].'",';
118
-                    $output .= '"departure_airport_city": "'.$spotter_item['departure_airport_city'].'",';
119
-                    $output .= '"departure_airport_country": "'.$spotter_item['departure_airport_country'].'",';
120
-                    $output .= '"departure_airport_iata": "'.$spotter_item['departure_airport_iata'].'",';
121
-                    $output .= '"departure_airport_icao": "'.$spotter_item['departure_airport_icao'].'",';
122
-                    $output .= '"departure_airport_latitude": "'.$spotter_item['departure_airport_latitude'].'",';
123
-                    $output .= '"departure_airport_longitude": "'.$spotter_item['departure_airport_longitude'].'",';
124
-                    $output .= '"departure_airport_altitude": "'.$spotter_item['departure_airport_altitude'].'",'; 
125
-                    $output .= '"arrival_airport_city": "'.$spotter_item['arrival_airport_city'].'",';
126
-                    $output .= '"arrival_airport_country": "'.$spotter_item['arrival_airport_country'].'",';
127
-                    $output .= '"arrival_airport_iata": "'.$spotter_item['arrival_airport_iata'].'",';
128
-                    $output .= '"departure_airport_icao": "'.$spotter_item['arrival_airport_icao'].'",';
129
-                    $output .= '"arrival_airport_latitude": "'.$spotter_item['arrival_airport_latitude'].'",';
130
-                    $output .= '"arrival_airport_longitude": "'.$spotter_item['arrival_airport_longitude'].'",';
131
-                    $output .= '"arrival_airport_altitude": "'.$spotter_item['arrival_airport_altitude'].'",';
132
-                    $output .= '"latitude": "'.$spotter_item['latitude'].'",';
133
-                    $output .= '"longitude": "'.$spotter_item['longitude'].'",';
134
-                    $output .= '"altitude": "'.$spotter_item['altitude'].'",';
135
-                    $output .= '"ground_speed": "'.$spotter_item['ground_speed'].'",';
136
-                    $output .= '"heading": "'.$spotter_item['heading'].'",';
137
-                    $output .= '"heading_name": "'.$spotter_item['heading_name'].'",';
138
-                    $output .= '"date": "'.date("c", strtotime($spotter_item['date_iso_8601'])).'"';
139
-	          $output .= '}';
140
-	          if ($spotter_item['waypoints'] != '') {
141
-	          $output .= ',"geometry": {';
142
-	          	$output .= '"type": "LineString",';
143
-	            	$output .= '"coordinates": [';
144
-		            	$waypoint_pieces = explode(' ', $spotter_item['waypoints']);
105
+		  		$output .= '"properties": {';
106
+			  		$output .= '"id": "'.$spotter_item['spotter_id'].'",';
107
+					$output .= '"ident": "'.$spotter_item['ident'].'",';
108
+					$output .= '"registration": "'.$spotter_item['registration'].'",';
109
+					$output .= '"aircraft_icao": "'.$spotter_item['aircraft_type'].'",';
110
+					$output .= '"aircraft_name": "'.$spotter_item['aircraft_name'].'",';
111
+					$output .= '"aircraft_manufacturer": "'.$spotter_item['aircraft_manufacturer'].'",';
112
+					$output .= '"airline_name": "'.$spotter_item['airline_name'].'",';
113
+					$output .= '"airline_icao": "'.$spotter_item['airline_icao'].'",';
114
+					$output .= '"airline_iata": "'.$spotter_item['airline_iata'].'",';
115
+					$output .= '"airline_country": "'.$spotter_item['airline_country'].'",';
116
+					$output .= '"airline_callsign": "'.$spotter_item['airline_callsign'].'",';
117
+					$output .= '"airline_type": "'.$spotter_item['airline_type'].'",';
118
+					$output .= '"departure_airport_city": "'.$spotter_item['departure_airport_city'].'",';
119
+					$output .= '"departure_airport_country": "'.$spotter_item['departure_airport_country'].'",';
120
+					$output .= '"departure_airport_iata": "'.$spotter_item['departure_airport_iata'].'",';
121
+					$output .= '"departure_airport_icao": "'.$spotter_item['departure_airport_icao'].'",';
122
+					$output .= '"departure_airport_latitude": "'.$spotter_item['departure_airport_latitude'].'",';
123
+					$output .= '"departure_airport_longitude": "'.$spotter_item['departure_airport_longitude'].'",';
124
+					$output .= '"departure_airport_altitude": "'.$spotter_item['departure_airport_altitude'].'",'; 
125
+					$output .= '"arrival_airport_city": "'.$spotter_item['arrival_airport_city'].'",';
126
+					$output .= '"arrival_airport_country": "'.$spotter_item['arrival_airport_country'].'",';
127
+					$output .= '"arrival_airport_iata": "'.$spotter_item['arrival_airport_iata'].'",';
128
+					$output .= '"departure_airport_icao": "'.$spotter_item['arrival_airport_icao'].'",';
129
+					$output .= '"arrival_airport_latitude": "'.$spotter_item['arrival_airport_latitude'].'",';
130
+					$output .= '"arrival_airport_longitude": "'.$spotter_item['arrival_airport_longitude'].'",';
131
+					$output .= '"arrival_airport_altitude": "'.$spotter_item['arrival_airport_altitude'].'",';
132
+					$output .= '"latitude": "'.$spotter_item['latitude'].'",';
133
+					$output .= '"longitude": "'.$spotter_item['longitude'].'",';
134
+					$output .= '"altitude": "'.$spotter_item['altitude'].'",';
135
+					$output .= '"ground_speed": "'.$spotter_item['ground_speed'].'",';
136
+					$output .= '"heading": "'.$spotter_item['heading'].'",';
137
+					$output .= '"heading_name": "'.$spotter_item['heading_name'].'",';
138
+					$output .= '"date": "'.date("c", strtotime($spotter_item['date_iso_8601'])).'"';
139
+			  $output .= '}';
140
+			  if ($spotter_item['waypoints'] != '') {
141
+			  $output .= ',"geometry": {';
142
+			  	$output .= '"type": "LineString",';
143
+					$output .= '"coordinates": [';
144
+						$waypoint_pieces = explode(' ', $spotter_item['waypoints']);
145 145
 									$waypoint_pieces = array_chunk($waypoint_pieces, 2);
146 146
 									    
147 147
 									foreach ($waypoint_pieces as $waypoint_coordinate)
148 148
 									{
149 149
 										$output .= '[';
150
-									        $output .=  $waypoint_coordinate[1].', ';	
151
-									        $output .=  $waypoint_coordinate[0];
150
+											$output .=  $waypoint_coordinate[1].', ';	
151
+											$output .=  $waypoint_coordinate[0];
152 152
 									  $output .= '],';
153 153
 									
154 154
 									}
155
-		            	$output = substr($output, 0, -1);
155
+						$output = substr($output, 0, -1);
156 156
 								$output .= ']';
157 157
 							$output .= '}';
158 158
 		}
@@ -161,50 +161,50 @@  discard block
 block discarded – undo
161 161
 				//location of aircraft
162 162
 				$output .= '{';  
163 163
 					$output .= '"type": "Feature",';
164
-	      		$output .= '"properties": {';
165
-	          	    $output .= '"id": "'.$spotter_item['spotter_id'].'",';
166
-                    $output .= '"ident": "'.$spotter_item['ident'].'",';
167
-                    $output .= '"registration": "'.$spotter_item['registration'].'",';
168
-                    $output .= '"aircraft_icao": "'.$spotter_item['aircraft_type'].'",';
169
-                    $output .= '"aircraft_name": "'.$spotter_item['aircraft_name'].'",';
170
-                    $output .= '"aircraft_manufacturer": "'.$spotter_item['aircraft_manufacturer'].'",';
171
-                    $output .= '"airline_name": "'.$spotter_item['airline_name'].'",';
172
-                    $output .= '"airline_icao": "'.$spotter_item['airline_icao'].'",';
173
-                    $output .= '"airline_iata": "'.$spotter_item['airline_iata'].'",';
174
-                    $output .= '"airline_country": "'.$spotter_item['airline_country'].'",';
175
-                    $output .= '"airline_callsign": "'.$spotter_item['airline_callsign'].'",';
176
-                    $output .= '"airline_type": "'.$spotter_item['airline_type'].'",';
177
-                    $output .= '"departure_airport_city": "'.$spotter_item['departure_airport_city'].'",';
178
-                    $output .= '"departure_airport_country": "'.$spotter_item['departure_airport_country'].'",';
179
-                    $output .= '"departure_airport_iata": "'.$spotter_item['departure_airport_iata'].'",';
180
-                    $output .= '"departure_airport_icao": "'.$spotter_item['departure_airport_icao'].'",';
181
-                    $output .= '"departure_airport_latitude": "'.$spotter_item['departure_airport_latitude'].'",';
182
-                    $output .= '"departure_airport_longitude": "'.$spotter_item['departure_airport_longitude'].'",';
183
-                    $output .= '"departure_airport_altitude": "'.$spotter_item['departure_airport_altitude'].'",'; 
184
-                    $output .= '"arrival_airport_city": "'.$spotter_item['arrival_airport_city'].'",';
185
-                    $output .= '"arrival_airport_country": "'.$spotter_item['arrival_airport_country'].'",';
186
-                    $output .= '"arrival_airport_iata": "'.$spotter_item['arrival_airport_iata'].'",';
187
-                    $output .= '"departure_airport_icao": "'.$spotter_item['arrival_airport_icao'].'",';
188
-                    $output .= '"arrival_airport_latitude": "'.$spotter_item['arrival_airport_latitude'].'",';
189
-                    $output .= '"arrival_airport_longitude": "'.$spotter_item['arrival_airport_longitude'].'",';
190
-                    $output .= '"arrival_airport_altitude": "'.$spotter_item['arrival_airport_altitude'].'",';
191
-                    $output .= '"latitude": "'.$spotter_item['latitude'].'",';
192
-                    $output .= '"longitude": "'.$spotter_item['longitude'].'",';
193
-                    $output .= '"altitude": "'.$spotter_item['altitude'].'",';
194
-                    $output .= '"ground_speed": "'.$spotter_item['ground_speed'].'",';
195
-                    $output .= '"heading": "'.$spotter_item['heading'].'",';
196
-                    $output .= '"heading_name": "'.$spotter_item['heading_name'].'",';
197
-                    $output .= '"date": "'.date("c", strtotime($spotter_item['date_iso_8601'])).'"';
198
-	          $output .= '},';
199
-	          $output .= '"geometry": {';
200
-	          	$output .= '"type": "Point",';
201
-	            	$output .= '"coordinates": [';
164
+		  		$output .= '"properties": {';
165
+			  		$output .= '"id": "'.$spotter_item['spotter_id'].'",';
166
+					$output .= '"ident": "'.$spotter_item['ident'].'",';
167
+					$output .= '"registration": "'.$spotter_item['registration'].'",';
168
+					$output .= '"aircraft_icao": "'.$spotter_item['aircraft_type'].'",';
169
+					$output .= '"aircraft_name": "'.$spotter_item['aircraft_name'].'",';
170
+					$output .= '"aircraft_manufacturer": "'.$spotter_item['aircraft_manufacturer'].'",';
171
+					$output .= '"airline_name": "'.$spotter_item['airline_name'].'",';
172
+					$output .= '"airline_icao": "'.$spotter_item['airline_icao'].'",';
173
+					$output .= '"airline_iata": "'.$spotter_item['airline_iata'].'",';
174
+					$output .= '"airline_country": "'.$spotter_item['airline_country'].'",';
175
+					$output .= '"airline_callsign": "'.$spotter_item['airline_callsign'].'",';
176
+					$output .= '"airline_type": "'.$spotter_item['airline_type'].'",';
177
+					$output .= '"departure_airport_city": "'.$spotter_item['departure_airport_city'].'",';
178
+					$output .= '"departure_airport_country": "'.$spotter_item['departure_airport_country'].'",';
179
+					$output .= '"departure_airport_iata": "'.$spotter_item['departure_airport_iata'].'",';
180
+					$output .= '"departure_airport_icao": "'.$spotter_item['departure_airport_icao'].'",';
181
+					$output .= '"departure_airport_latitude": "'.$spotter_item['departure_airport_latitude'].'",';
182
+					$output .= '"departure_airport_longitude": "'.$spotter_item['departure_airport_longitude'].'",';
183
+					$output .= '"departure_airport_altitude": "'.$spotter_item['departure_airport_altitude'].'",'; 
184
+					$output .= '"arrival_airport_city": "'.$spotter_item['arrival_airport_city'].'",';
185
+					$output .= '"arrival_airport_country": "'.$spotter_item['arrival_airport_country'].'",';
186
+					$output .= '"arrival_airport_iata": "'.$spotter_item['arrival_airport_iata'].'",';
187
+					$output .= '"departure_airport_icao": "'.$spotter_item['arrival_airport_icao'].'",';
188
+					$output .= '"arrival_airport_latitude": "'.$spotter_item['arrival_airport_latitude'].'",';
189
+					$output .= '"arrival_airport_longitude": "'.$spotter_item['arrival_airport_longitude'].'",';
190
+					$output .= '"arrival_airport_altitude": "'.$spotter_item['arrival_airport_altitude'].'",';
191
+					$output .= '"latitude": "'.$spotter_item['latitude'].'",';
192
+					$output .= '"longitude": "'.$spotter_item['longitude'].'",';
193
+					$output .= '"altitude": "'.$spotter_item['altitude'].'",';
194
+					$output .= '"ground_speed": "'.$spotter_item['ground_speed'].'",';
195
+					$output .= '"heading": "'.$spotter_item['heading'].'",';
196
+					$output .= '"heading_name": "'.$spotter_item['heading_name'].'",';
197
+					$output .= '"date": "'.date("c", strtotime($spotter_item['date_iso_8601'])).'"';
198
+			  $output .= '},';
199
+			  $output .= '"geometry": {';
200
+			  	$output .= '"type": "Point",';
201
+					$output .= '"coordinates": [';
202 202
 										$output .=  $spotter_item['longitude'].', ';	
203 203
 									  $output .=  $spotter_item['latitude'];
204 204
 								$output .= ']';
205 205
 							$output .= '}';
206 206
 				$output .= '},';
207
-	    }
207
+		}
208 208
 	   }
209 209
 	   $output  = substr($output, 0, -1);
210 210
 	   
Please login to merge, or discard this patch.
search-georss.php 1 patch
Indentation   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -4,55 +4,55 @@  discard block
 block discarded – undo
4 4
 require_once('require/class.Language.php');
5 5
 $Spotter = new Spotter();
6 6
 if (isset($_GET['start_date'])) {
7
-        //for the date manipulation into the query
8
-        if($_GET['start_date'] != "" && $_GET['end_date'] != ""){
9
-                $start_date = $_GET['start_date'].":00";
10
-                $end_date = $_GET['end_date'].":00";
11
-                $sql_date = $start_date.",".$end_date;
12
-        } else if($_GET['start_date'] != ""){
13
-                $start_date = $_GET['start_date'].":00";
14
-                $sql_date = $start_date;
15
-        } else if($_GET['start_date'] == "" && $_GET['end_date'] != ""){
16
-                $end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")).",".$_GET['end_date'].":00";
17
-                $sql_date = $end_date;
18
-        } else $sql_date = '';
7
+		//for the date manipulation into the query
8
+		if($_GET['start_date'] != "" && $_GET['end_date'] != ""){
9
+				$start_date = $_GET['start_date'].":00";
10
+				$end_date = $_GET['end_date'].":00";
11
+				$sql_date = $start_date.",".$end_date;
12
+		} else if($_GET['start_date'] != ""){
13
+				$start_date = $_GET['start_date'].":00";
14
+				$sql_date = $start_date;
15
+		} else if($_GET['start_date'] == "" && $_GET['end_date'] != ""){
16
+				$end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")).",".$_GET['end_date'].":00";
17
+				$sql_date = $end_date;
18
+		} else $sql_date = '';
19 19
 } else $sql_date = '';
20 20
 
21 21
 if (isset($_GET['highest_altitude'])) {
22
-        //for altitude manipulation
23
-        if($_GET['highest_altitude'] != "" && $_GET['lowest_altitude'] != ""){
24
-                $end_altitude = $_GET['highest_altitude'];
25
-                $start_altitude = $_GET['lowest_altitude'];
26
-                $sql_altitude = $start_altitude.",".$end_altitude;
27
-        } else if($_GET['highest_altitude'] != ""){
28
-                $end_altitude = $_GET['highest_altitude'];
29
-                $sql_altitude = $end_altitude;
30
-        } else if($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != ""){
31
-                $start_altitude = $_GET['lowest_altitude'].",60000";
32
-                $sql_altitude = $start_altitude;
33
-        } else $sql_altitude = '';
22
+		//for altitude manipulation
23
+		if($_GET['highest_altitude'] != "" && $_GET['lowest_altitude'] != ""){
24
+				$end_altitude = $_GET['highest_altitude'];
25
+				$start_altitude = $_GET['lowest_altitude'];
26
+				$sql_altitude = $start_altitude.",".$end_altitude;
27
+		} else if($_GET['highest_altitude'] != ""){
28
+				$end_altitude = $_GET['highest_altitude'];
29
+				$sql_altitude = $end_altitude;
30
+		} else if($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != ""){
31
+				$start_altitude = $_GET['lowest_altitude'].",60000";
32
+				$sql_altitude = $start_altitude;
33
+		} else $sql_altitude = '';
34 34
 } else $sql_altitude = '';
35 35
 
36 36
 //calculuation for the pagination
37 37
 if(!isset($_GET['limit']))
38 38
 {
39
-        if (!isset($_GET['number_results']))
40
-        {
41
-                $limit_start = 0;
42
-                $limit_end = 25;
43
-                $absolute_difference = 25;
44
-        } else {
45
-                if ($_GET['number_results'] > 1000){
46
-                        $_GET['number_results'] = 1000;
47
-                }
48
-                $limit_start = 0;
49
-                $limit_end = $_GET['number_results'];
50
-                $absolute_difference = $_GET['number_results'];
51
-        }
39
+		if (!isset($_GET['number_results']))
40
+		{
41
+				$limit_start = 0;
42
+				$limit_end = 25;
43
+				$absolute_difference = 25;
44
+		} else {
45
+				if ($_GET['number_results'] > 1000){
46
+						$_GET['number_results'] = 1000;
47
+				}
48
+				$limit_start = 0;
49
+				$limit_end = $_GET['number_results'];
50
+				$absolute_difference = $_GET['number_results'];
51
+		}
52 52
 }  else {
53
-        $limit_explode = explode(",", $_GET['limit']);
54
-        $limit_start = $limit_explode[0];
55
-        $limit_end = $limit_explode[1];
53
+		$limit_explode = explode(",", $_GET['limit']);
54
+		$limit_start = $limit_explode[0];
55
+		$limit_end = $limit_explode[1];
56 56
 }
57 57
 
58 58
 $absolute_difference = abs($limit_start - $limit_end);
@@ -98,8 +98,8 @@  discard block
 block discarded – undo
98 98
 	print '<subtitle>The latest airplanes</subtitle>';
99 99
 	print '<updated>'.$date.'</updated>';
100 100
 	print '<author>';
101
-    	print '<name>FlightAirMap</name>';
102
-    	print '<email>[email protected]</email>';
101
+		print '<name>FlightAirMap</name>';
102
+		print '<email>[email protected]</email>';
103 103
 	print '</author>';
104 104
 	print '<id>FlightAirMap</id>';
105 105
 	
@@ -110,14 +110,14 @@  discard block
 block discarded – undo
110 110
 	
111 111
 	      
112 112
 		  print '<entry>';
113
-		    print '<title>'.$spotter_item['ident'].' '.$spotter_item['airline_name'].' | '.$spotter_item['registration'].' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].') | '.$spotter_item['departure_airport'].' - '.$spotter_item['arrival_airport'].'</title>';
114
-		    print '<link href="http://www.flightairmap.fr/flightid/'.$spotter_item['spotter_id'].'"/>';
115
-		    print '<id>http://www.flightairmap.fr/flightid/'.$spotter_item['spotter_id'].'</id>';
116
-		    print '<content>Ident: '.$spotter_item['ident'].' | Registration: '.$spotter_item['registration'].' | Aircraft: '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].') | Airline: '.$spotter_item['airline_name'].' | Coming From: '.$spotter_item['departure_airport_city'].', '.$spotter_item['departure_airport_name'].', '.$spotter_item['departure_airport_country'].' ('.$spotter_item['departure_airport'].') | Flying to: '.$spotter_item['arrival_airport_city'].', '.$spotter_item['arrival_airport_name'].', '.$spotter_item['arrival_airport_country'].' ('.$spotter_item['arrival_airport'].') | Flew nearby on: '.date("M j, Y, g:i a T", strtotime($spotter_item['date_iso_8601'])).'</content>';
117
-		    print '<updated>'.$date.'</updated>';
118
-		    if ($spotter_item['waypoints'] != "")
119
-		    {
120
-			    print '<georss:where>';
113
+			print '<title>'.$spotter_item['ident'].' '.$spotter_item['airline_name'].' | '.$spotter_item['registration'].' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].') | '.$spotter_item['departure_airport'].' - '.$spotter_item['arrival_airport'].'</title>';
114
+			print '<link href="http://www.flightairmap.fr/flightid/'.$spotter_item['spotter_id'].'"/>';
115
+			print '<id>http://www.flightairmap.fr/flightid/'.$spotter_item['spotter_id'].'</id>';
116
+			print '<content>Ident: '.$spotter_item['ident'].' | Registration: '.$spotter_item['registration'].' | Aircraft: '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].') | Airline: '.$spotter_item['airline_name'].' | Coming From: '.$spotter_item['departure_airport_city'].', '.$spotter_item['departure_airport_name'].', '.$spotter_item['departure_airport_country'].' ('.$spotter_item['departure_airport'].') | Flying to: '.$spotter_item['arrival_airport_city'].', '.$spotter_item['arrival_airport_name'].', '.$spotter_item['arrival_airport_country'].' ('.$spotter_item['arrival_airport'].') | Flew nearby on: '.date("M j, Y, g:i a T", strtotime($spotter_item['date_iso_8601'])).'</content>';
117
+			print '<updated>'.$date.'</updated>';
118
+			if ($spotter_item['waypoints'] != "")
119
+			{
120
+				print '<georss:where>';
121 121
 					print '<gml:LineString>';
122 122
 						print '<gml:posList>';
123 123
 							$waypoint_pieces = explode(' ', $spotter_item['waypoints']);
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
 							    
126 126
 							foreach ($waypoint_pieces as $waypoint_coordinate)
127 127
 							{
128
-							        print $waypoint_coordinate[0].' '.$waypoint_coordinate[1].' ';
128
+									print $waypoint_coordinate[0].' '.$waypoint_coordinate[1].' ';
129 129
 							
130 130
 							}
131 131
 						print '</gml:posList>';
Please login to merge, or discard this patch.
search-php.php 1 patch
Indentation   +69 added lines, -69 removed lines patch added patch discarded remove patch
@@ -4,55 +4,55 @@  discard block
 block discarded – undo
4 4
 require_once('require/class.Language.php');
5 5
 $Spotter = new Spotter();
6 6
 if (isset($_GET['start_date'])) {
7
-        //for the date manipulation into the query
8
-        if($_GET['start_date'] != "" && $_GET['end_date'] != ""){
9
-                $start_date = $_GET['start_date'].":00";
10
-                $end_date = $_GET['end_date'].":00";
11
-                $sql_date = $start_date.",".$end_date;
12
-        } else if($_GET['start_date'] != ""){
13
-                $start_date = $_GET['start_date'].":00";
14
-                $sql_date = $start_date;
15
-        } else if($_GET['start_date'] == "" && $_GET['end_date'] != ""){
16
-                $end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")).",".$_GET['end_date'].":00";
17
-                $sql_date = $end_date;
18
-        } else $sql_date = '';
7
+		//for the date manipulation into the query
8
+		if($_GET['start_date'] != "" && $_GET['end_date'] != ""){
9
+				$start_date = $_GET['start_date'].":00";
10
+				$end_date = $_GET['end_date'].":00";
11
+				$sql_date = $start_date.",".$end_date;
12
+		} else if($_GET['start_date'] != ""){
13
+				$start_date = $_GET['start_date'].":00";
14
+				$sql_date = $start_date;
15
+		} else if($_GET['start_date'] == "" && $_GET['end_date'] != ""){
16
+				$end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")).",".$_GET['end_date'].":00";
17
+				$sql_date = $end_date;
18
+		} else $sql_date = '';
19 19
 } else $sql_date = '';
20 20
 
21 21
 if (isset($_GET['highest_altitude'])) {
22
-        //for altitude manipulation
23
-        if($_GET['highest_altitude'] != "" && $_GET['lowest_altitude'] != ""){
24
-                $end_altitude = $_GET['highest_altitude'];
25
-                $start_altitude = $_GET['lowest_altitude'];
26
-                $sql_altitude = $start_altitude.",".$end_altitude;
27
-        } else if($_GET['highest_altitude'] != ""){
28
-                $end_altitude = $_GET['highest_altitude'];
29
-                $sql_altitude = $end_altitude;
30
-        } else if($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != ""){
31
-                $start_altitude = $_GET['lowest_altitude'].",60000";
32
-                $sql_altitude = $start_altitude;
33
-        } else $sql_altitude = '';
22
+		//for altitude manipulation
23
+		if($_GET['highest_altitude'] != "" && $_GET['lowest_altitude'] != ""){
24
+				$end_altitude = $_GET['highest_altitude'];
25
+				$start_altitude = $_GET['lowest_altitude'];
26
+				$sql_altitude = $start_altitude.",".$end_altitude;
27
+		} else if($_GET['highest_altitude'] != ""){
28
+				$end_altitude = $_GET['highest_altitude'];
29
+				$sql_altitude = $end_altitude;
30
+		} else if($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != ""){
31
+				$start_altitude = $_GET['lowest_altitude'].",60000";
32
+				$sql_altitude = $start_altitude;
33
+		} else $sql_altitude = '';
34 34
 } else $sql_altitude = '';
35 35
 
36 36
 //calculuation for the pagination
37 37
 if(!isset($_GET['limit']))
38 38
 {
39
-        if (!isset($_GET['number_results']))
40
-        {
41
-                $limit_start = 0;
42
-                $limit_end = 25;
43
-                $absolute_difference = 25;
44
-        } else {
45
-                if ($_GET['number_results'] > 1000){
46
-                        $_GET['number_results'] = 1000;
47
-                }
48
-                $limit_start = 0;
49
-                $limit_end = $_GET['number_results'];
50
-                $absolute_difference = $_GET['number_results'];
51
-        }
39
+		if (!isset($_GET['number_results']))
40
+		{
41
+				$limit_start = 0;
42
+				$limit_end = 25;
43
+				$absolute_difference = 25;
44
+		} else {
45
+				if ($_GET['number_results'] > 1000){
46
+						$_GET['number_results'] = 1000;
47
+				}
48
+				$limit_start = 0;
49
+				$limit_end = $_GET['number_results'];
50
+				$absolute_difference = $_GET['number_results'];
51
+		}
52 52
 }  else {
53
-        $limit_explode = explode(",", $_GET['limit']);
54
-        $limit_start = $limit_explode[0];
55
-        $limit_end = $limit_explode[1];
53
+		$limit_explode = explode(",", $_GET['limit']);
54
+		$limit_start = $limit_explode[0];
55
+		$limit_end = $limit_explode[1];
56 56
 }
57 57
 
58 58
 $absolute_difference = abs($limit_start - $limit_end);
@@ -95,39 +95,39 @@  discard block
 block discarded – undo
95 95
   {
96 96
 	  
97 97
 	array_push($flights, array(
98
-                            "id" => $spotter_item['spotter_id'], 
98
+							"id" => $spotter_item['spotter_id'], 
99 99
 							"ident" => $spotter_item['ident'], 
100 100
 							"registration" => $spotter_item['registration'], 
101 101
 							"aircraft_icao" => $spotter_item['aircraft_type'], 
102
-                            "aircraft_name" => $spotter_item['aircraft_name'], 
103
-                            "aircraft_manufacturer" => $spotter_item['aircraft_manufacturer'],
102
+							"aircraft_name" => $spotter_item['aircraft_name'], 
103
+							"aircraft_manufacturer" => $spotter_item['aircraft_manufacturer'],
104 104
 							"airline_name" => $spotter_item['airline_name'], 
105
-                            "airline_icao" => $spotter_item['airline_icao'], 
106
-                            "airline_iata" => $spotter_item['airline_iata'], 
107
-                            "airline_country" => $spotter_item['airline_country'], 
108
-                            "airline_callsign" => $spotter_item['airline_callsign'], 
109
-                            "airline_type" => $spotter_item['airline_type'],
110
-                            "departure_airport_city" => $spotter_item['departure_airport_city'], 
111
-                            "departure_airport_country" => $spotter_item['departure_airport_country'], 
112
-                            "departure_airport_iata" => $spotter_item['departure_airport_iata'], 
113
-                            "departure_airport_icao" => $spotter_item['departure_airport_icao'], 
114
-                            "departure_airport_latitude" => $spotter_item['departure_airport_latitude'], 
115
-                            "departure_airport_longitude" => $spotter_item['departure_airport_longitude'], 
116
-                            "departure_airport_altitude" => $spotter_item['departure_airport_altitude'], 
117
-                            "arrival_airport_city" => $spotter_item['arrival_airport_city'], 
118
-                            "arrival_airport_country" => $spotter_item['arrival_airport_country'], 
119
-                            "arrival_airport_iata" => $spotter_item['arrival_airport_iata'], 
120
-                            "arrival_airport_icao" => $spotter_item['arrival_airport_icao'], 
121
-                            "arrival_airport_latitude" => $spotter_item['arrival_airport_latitude'], 
122
-                            "arrival_airport_longitude" => $spotter_item['arrival_airport_longitude'], 
123
-                            "arrival_airport_altitude" => $spotter_item['arrival_airport_altitude'],
124
-                            "latitude" => $spotter_item['latitude'], 
125
-                            "longitude" => $spotter_item['longitude'], 
126
-                            "altitude" => $spotter_item['altitude'], 
127
-                            "ground_speed" => $spotter_item['ground_speed'], 
128
-                            "heading" => $spotter_item['heading'], 
129
-                            "heading_name" => $spotter_item['heading_name'], 
130
-                            "waypoints" => $spotter_item['waypoints'],
105
+							"airline_icao" => $spotter_item['airline_icao'], 
106
+							"airline_iata" => $spotter_item['airline_iata'], 
107
+							"airline_country" => $spotter_item['airline_country'], 
108
+							"airline_callsign" => $spotter_item['airline_callsign'], 
109
+							"airline_type" => $spotter_item['airline_type'],
110
+							"departure_airport_city" => $spotter_item['departure_airport_city'], 
111
+							"departure_airport_country" => $spotter_item['departure_airport_country'], 
112
+							"departure_airport_iata" => $spotter_item['departure_airport_iata'], 
113
+							"departure_airport_icao" => $spotter_item['departure_airport_icao'], 
114
+							"departure_airport_latitude" => $spotter_item['departure_airport_latitude'], 
115
+							"departure_airport_longitude" => $spotter_item['departure_airport_longitude'], 
116
+							"departure_airport_altitude" => $spotter_item['departure_airport_altitude'], 
117
+							"arrival_airport_city" => $spotter_item['arrival_airport_city'], 
118
+							"arrival_airport_country" => $spotter_item['arrival_airport_country'], 
119
+							"arrival_airport_iata" => $spotter_item['arrival_airport_iata'], 
120
+							"arrival_airport_icao" => $spotter_item['arrival_airport_icao'], 
121
+							"arrival_airport_latitude" => $spotter_item['arrival_airport_latitude'], 
122
+							"arrival_airport_longitude" => $spotter_item['arrival_airport_longitude'], 
123
+							"arrival_airport_altitude" => $spotter_item['arrival_airport_altitude'],
124
+							"latitude" => $spotter_item['latitude'], 
125
+							"longitude" => $spotter_item['longitude'], 
126
+							"altitude" => $spotter_item['altitude'], 
127
+							"ground_speed" => $spotter_item['ground_speed'], 
128
+							"heading" => $spotter_item['heading'], 
129
+							"heading_name" => $spotter_item['heading_name'], 
130
+							"waypoints" => $spotter_item['waypoints'],
131 131
 							"date" => date("c", strtotime($spotter_item['date_iso_8601']))
132 132
 						)
133 133
 			); 	
Please login to merge, or discard this patch.
aircraft-statistics-airline.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -4,8 +4,8 @@
 block discarded – undo
4 4
 require_once('require/class.Language.php');
5 5
 
6 6
 if (!isset($_GET['aircraft_type'])) {
7
-        header('Location: '.$globalURL.'/aircraft');
8
-        die();
7
+		header('Location: '.$globalURL.'/aircraft');
8
+		die();
9 9
 }
10 10
 $aircraft_type = filter_input(INPUT_GET,'aircraft_type',FILTER_SANITIZE_STRING);
11 11
 $Spotter = new Spotter();
Please login to merge, or discard this patch.